Radek Krejci | c61f0b4 | 2017-06-07 13:21:41 +0200 | [diff] [blame] | 1 | /** |
| 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 |
| 19 | extern "C" { |
| 20 | #endif |
| 21 | |
Radek Krejci | c61f0b4 | 2017-06-07 13:21:41 +0200 | [diff] [blame] | 22 | #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 | |
| 39 | typedef 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 Krejci | b20999f | 2017-06-21 13:47:11 +0200 | [diff] [blame] | 45 | |
Radek Krejci | fa3731e | 2017-11-08 12:49:46 +0100 | [diff] [blame] | 46 | PyObject *clb_hostcheck; /* callback to check host key (fingerprint) */ |
| 47 | PyObject *clb_hostcheck_data; /* private data for the host key check callback */ |
Radek Krejci | b20999f | 2017-06-21 13:47:11 +0200 | [diff] [blame] | 48 | 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 Krejci | c61f0b4 | 2017-06-07 13:21:41 +0200 | [diff] [blame] | 52 | } ncSSHObject; |
| 53 | |
| 54 | typedef 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 Krejci | 0f3499a | 2017-10-13 13:39:36 +0200 | [diff] [blame] | 64 | typedef struct { |
| 65 | PyObject_HEAD |
| 66 | struct nc_err *err; |
| 67 | struct ly_ctx *ctx; |
| 68 | } ncErrObject; |
| 69 | |
Radek Krejci | c61f0b4 | 2017-06-07 13:21:41 +0200 | [diff] [blame] | 70 | extern PyTypeObject ncSSHType; |
| 71 | extern PyTypeObject ncTLSType; |
| 72 | extern PyTypeObject ncSessionType; |
Radek Krejci | 0f3499a | 2017-10-13 13:39:36 +0200 | [diff] [blame] | 73 | extern PyTypeObject ncErrType; |
Radek Krejci | c61f0b4 | 2017-06-07 13:21:41 +0200 | [diff] [blame] | 74 | |
| 75 | #ifdef __cplusplus |
| 76 | } |
| 77 | #endif |
| 78 | |
| 79 | #endif /* PYNETCONF_H_ */ |