| 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 |
from libc cimport stdint |
| 8 |
|
| 9 |
cimport c_amqp_definitions |
| 10 |
cimport c_amqpvalue |
| 11 |
cimport c_xio |
| 12 |
|
| 13 |
cdef extern from "azure_uamqp_c/connection.h": |
| 14 |
|
| 15 |
ctypedef struct CONNECTION_HANDLE: |
| 16 |
pass |
| 17 |
ctypedef struct ENDPOINT_HANDLE: |
| 18 |
pass |
| 19 |
ctypedef struct ON_CONNECTION_CLOSED_EVENT_SUBSCRIPTION_HANDLE: |
| 20 |
pass |
| 21 |
|
| 22 |
cdef enum CONNECTION_STATE_TAG: |
| 23 |
CONNECTION_STATE_START, |
| 24 |
CONNECTION_STATE_HDR_RCVD, |
| 25 |
CONNECTION_STATE_HDR_SENT, |
| 26 |
CONNECTION_STATE_HDR_EXCH, |
| 27 |
CONNECTION_STATE_OPEN_PIPE, |
| 28 |
CONNECTION_STATE_OC_PIPE, |
| 29 |
CONNECTION_STATE_OPEN_RCVD, |
| 30 |
CONNECTION_STATE_OPEN_SENT, |
| 31 |
CONNECTION_STATE_CLOSE_PIPE, |
| 32 |
CONNECTION_STATE_OPENED, |
| 33 |
CONNECTION_STATE_CLOSE_RCVD, |
| 34 |
CONNECTION_STATE_CLOSE_SENT, |
| 35 |
CONNECTION_STATE_DISCARDING, |
| 36 |
CONNECTION_STATE_END, |
| 37 |
CONNECTION_STATE_ERROR |
| 38 |
|
| 39 |
ctypedef CONNECTION_STATE_TAG CONNECTION_STATE |
| 40 |
|
| 41 |
ctypedef void (*ON_CONNECTION_STATE_CHANGED)(void* context, CONNECTION_STATE new_connection_state, CONNECTION_STATE previous_connection_state) |
| 42 |
ctypedef bint (*ON_NEW_ENDPOINT)(void* context, ENDPOINT_HANDLE new_endpoint) |
| 43 |
ctypedef void (*ON_CONNECTION_CLOSE_RECEIVED)(void* context, c_amqp_definitions.ERROR_HANDLE error) |
| 44 |
|
| 45 |
CONNECTION_HANDLE connection_create(c_xio.XIO_HANDLE io, const char* hostname, const char* container_id, ON_NEW_ENDPOINT on_new_endpoint, void* callback_context) |
| 46 |
CONNECTION_HANDLE connection_create2(c_xio.XIO_HANDLE xio, const char* hostname, const char* container_id, ON_NEW_ENDPOINT on_new_endpoint, void* callback_context, ON_CONNECTION_STATE_CHANGED on_connection_state_changed, void* on_connection_state_changed_context, c_xio.ON_IO_ERROR on_io_error, void* on_io_error_context) |
| 47 |
void connection_destroy(CONNECTION_HANDLE connection) |
| 48 |
int connection_open(CONNECTION_HANDLE connection) |
| 49 |
int connection_listen(CONNECTION_HANDLE connection) |
| 50 |
int connection_close(CONNECTION_HANDLE connection, const char* condition_value, const char* description, c_amqpvalue.AMQP_VALUE info) |
| 51 |
int connection_set_max_frame_size(CONNECTION_HANDLE connection, stdint.uint32_t max_frame_size) |
| 52 |
int connection_get_max_frame_size(CONNECTION_HANDLE connection, stdint.uint32_t* max_frame_size) |
| 53 |
int connection_set_channel_max(CONNECTION_HANDLE connection, stdint.uint16_t channel_max) |
| 54 |
int connection_get_channel_max(CONNECTION_HANDLE connection, stdint.uint16_t* channel_max) |
| 55 |
int connection_set_idle_timeout(CONNECTION_HANDLE connection, c_amqp_definitions.milliseconds idle_timeout) |
| 56 |
int connection_get_idle_timeout(CONNECTION_HANDLE connection, c_amqp_definitions.milliseconds* idle_timeout) |
| 57 |
int connection_set_properties(CONNECTION_HANDLE connection, c_amqp_definitions.fields properties) |
| 58 |
int connection_get_properties(CONNECTION_HANDLE connection, c_amqp_definitions.fields* properties) |
| 59 |
int connection_get_remote_max_frame_size(CONNECTION_HANDLE connection, stdint.uint32_t* remote_max_frame_size) |
| 60 |
int connection_set_remote_idle_timeout_empty_frame_send_ratio(CONNECTION_HANDLE connection, double idle_timeout_empty_frame_send_ratio) |
| 61 |
stdint.uint64_t connection_handle_deadlines(CONNECTION_HANDLE connection) |
| 62 |
void connection_dowork(CONNECTION_HANDLE connection) nogil |
| 63 |
void connection_set_trace(CONNECTION_HANDLE connection, bint trace_on) |
| 64 |
|
| 65 |
ON_CONNECTION_CLOSED_EVENT_SUBSCRIPTION_HANDLE connection_subscribe_on_connection_close_received(CONNECTION_HANDLE connection, ON_CONNECTION_CLOSE_RECEIVED on_connection_close_received, void* context) |
| 66 |
void connection_unsubscribe_on_connection_close_received(ON_CONNECTION_CLOSED_EVENT_SUBSCRIPTION_HANDLE event_subscription) |
| 67 |
|