| 1 |
#------------------------------------------------------------------------- |
| 2 |
# Copyright (c) Microsoft Corporation. All rights reserved. |
| 3 |
# Licensed under the MIT License. See License.txt in the project root for |
| 4 |
# license information. |
| 5 |
#-------------------------------------------------------------------------- |
| 6 |
|
| 7 |
# C imports |
| 8 |
cimport c_tlsio |
| 9 |
cimport c_xio |
| 10 |
|
| 11 |
|
| 12 |
DEFAULT_PORT = 5671 |
| 13 |
|
| 14 |
|
| 15 |
cdef class TLSIOConfig(object): |
| 16 |
|
| 17 |
cdef c_tlsio.TLSIO_CONFIG _c_value |
| 18 |
|
| 19 |
def __cinit__(self): |
| 20 |
self._c_value = c_tlsio.TLSIO_CONFIG(NULL, DEFAULT_PORT, NULL, NULL) |
| 21 |
|
| 22 |
@property |
| 23 |
def hostname(self): |
| 24 |
return self._c_value.hostname |
| 25 |
|
| 26 |
@hostname.setter |
| 27 |
def hostname(self, const char* value): |
| 28 |
self._c_value.hostname = value |
| 29 |
|
| 30 |
@property |
| 31 |
def port(self): |
| 32 |
return self._c_value.port |
| 33 |
|
| 34 |
@port.setter |
| 35 |
def port(self, int port): |
| 36 |
self._c_value.port = port |
| 37 |
|
| 38 |
cpdef set_proxy_config(self, HTTPProxyConfig underlying_io_parameters): |
| 39 |
cdef const c_xio.IO_INTERFACE_DESCRIPTION* proxy_io |
| 40 |
proxy_io = c_tlsio.http_proxy_io_get_interface_description() |
| 41 |
self._c_value.underlying_io_interface = proxy_io |
| 42 |
self._c_value.underlying_io_parameters = &underlying_io_parameters._c_value |
| 43 |
|
| 44 |
|
| 45 |
cdef class HTTPProxyConfig(object): |
| 46 |
|
| 47 |
cdef c_tlsio.HTTP_PROXY_IO_CONFIG _c_value |
| 48 |
|
| 49 |
def __cinit__(self): |
| 50 |
self._c_value = c_tlsio.HTTP_PROXY_IO_CONFIG(NULL, 0, NULL, 0, NULL, NULL) |
| 51 |
|
| 52 |
@property |
| 53 |
def hostname(self): |
| 54 |
return self._c_value.hostname |
| 55 |
|
| 56 |
@hostname.setter |
| 57 |
def hostname(self, const char* value): |
| 58 |
self._c_value.hostname = value |
| 59 |
|
| 60 |
@property |
| 61 |
def port(self): |
| 62 |
return self._c_value.port |
| 63 |
|
| 64 |
@port.setter |
| 65 |
def port(self, int port): |
| 66 |
self._c_value.port = port |
| 67 |
|
| 68 |
@property |
| 69 |
def proxy_hostname(self): |
| 70 |
return self._c_value.proxy_hostname |
| 71 |
|
| 72 |
@proxy_hostname.setter |
| 73 |
def proxy_hostname(self, const char* value): |
| 74 |
self._c_value.proxy_hostname = value |
| 75 |
|
| 76 |
@property |
| 77 |
def proxy_port(self): |
| 78 |
return self._c_value.proxy_port |
| 79 |
|
| 80 |
@proxy_port.setter |
| 81 |
def proxy_port(self, int port): |
| 82 |
self._c_value.proxy_port = port |
| 83 |
|
| 84 |
@property |
| 85 |
def username(self): |
| 86 |
return self._c_value.username |
| 87 |
|
| 88 |
@username.setter |
| 89 |
def username(self, const char* value): |
| 90 |
self._c_value.username = value |
| 91 |
|
| 92 |
@property |
| 93 |
def password(self): |
| 94 |
return self._c_value.password |
| 95 |
|
| 96 |
@password.setter |
| 97 |
def password(self, const char* value): |
| 98 |
self._c_value.password = value |