blob: 9c98a80230aa57e3103a8e1d037b7086fb253bd2 [file] [log] [blame]
Radek Krejcic61f0b42017-06-07 13:21:41 +02001/**
2 * @file netconf.h
3 * @author Radek Krejci <rkrejci@cesnet.cz>
4 * @brief Main header of Python3 bindings for libnetconf2 (client-side)
5 *
6 * Copyright (c) 2017 CESNET, z.s.p.o.
7 *
8 * This source code is licensed under BSD 3-Clause License (the "License").
9 * You may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * https://opensource.org/licenses/BSD-3-Clause
13 */
14
15#ifndef PYNETCONF_H_
16#define PYNETCONF_H_
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
Radek Krejcic61f0b42017-06-07 13:21:41 +020022#include "../src/netconf.h"
23#include "../src/log.h"
24#include "../src/messages_client.h"
25#include "../src/session_client.h"
26#include "../src/session_client_ch.h"
27
28#ifdef UNUSED
29#elif defined(__GNUC__)
30# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))
31#elif defined(__LCLINT__)
32# define UNUSED(x) /*@unused@*/ x
33#elif defined(__cplusplus)
34# define UNUSED(x)
35#else
36# define UNUSED(x) x
37#endif
38
39typedef struct {
40 PyObject_HEAD
41 PyObject *username; /* username */
42 PyObject *password; /* plaintext password for authentication or unlocking a private key */
43 PyObject *pubkeys; /* public keys for the key authentication, both pubkey and privkey must be set */
44 PyObject *privkeys; /* private key for the key authentication, both pubkey and privkey must be set */
Radek Krejcib20999f2017-06-21 13:47:11 +020045
Radek Krejcifa3731e2017-11-08 12:49:46 +010046 PyObject *clb_hostcheck; /* callback to check host key (fingerprint) */
47 PyObject *clb_hostcheck_data; /* private data for the host key check callback */
Radek Krejcib20999f2017-06-21 13:47:11 +020048 PyObject *clb_password; /* callback for SSH password authentication */
49 PyObject *clb_password_data; /* private data for the SSH password authentication callback */
50 PyObject *clb_interactive; /* callback for SSH keyboard-interactive authentication */
51 PyObject *clb_interactive_data; /* private data for the SSH keyboard-interactive authentication callback */
Radek Krejcic61f0b42017-06-07 13:21:41 +020052} ncSSHObject;
53
54typedef struct {
55 PyObject_HEAD
56 PyObject *cert_file; /* path to the client certificate file */
57 PyObject *key_file; /* path to the file with the private key for the client certificate */
58 PyObject *ca_file; /* path to the file with the CA certificate(s) used to verify the server certificate */
59 PyObject *ca_dir; /* path to the directory with the CA certificate(s) used to verify the server certificate */
60 PyObject *crl_file; /* path to the file with the CRL certificate(s) used to check for revocated server certificates */
61 PyObject *crl_dir; /* path to the directory with the CRL certificate(s) used to check for revocated server certificates */
62} ncTLSObject;
63
Radek Krejci0f3499a2017-10-13 13:39:36 +020064typedef struct {
65 PyObject_HEAD
66 struct nc_err *err;
67 struct ly_ctx *ctx;
68} ncErrObject;
69
Radek Krejcic61f0b42017-06-07 13:21:41 +020070extern PyTypeObject ncSSHType;
71extern PyTypeObject ncTLSType;
72extern PyTypeObject ncSessionType;
Radek Krejci0f3499a2017-10-13 13:39:36 +020073extern PyTypeObject ncErrType;
Radek Krejcic61f0b42017-06-07 13:21:41 +020074
75#ifdef __cplusplus
76}
77#endif
78
79#endif /* PYNETCONF_H_ */