forked from ebroder/python-zephyr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_zephyr.pxd
126 lines (109 loc) · 3.49 KB
/
_zephyr.pxd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# cython: c_string_type=unicode, c_string_encoding=ascii
cdef extern from "netinet/in.h":
struct in_addr:
int s_addr
struct sockaddr_in:
short sin_family
unsigned short sin_port
in_addr sin_addr
char sin_zero[8]
cdef extern from "arpa/inet.h":
char * inet_ntoa(in_addr)
int inet_aton(char *, in_addr *)
cdef extern from "sys/time.h":
struct timeval:
unsigned int tv_sec
unsigned int tv_usec
cdef extern from "zephyr/zephyr.h":
ctypedef enum ZNotice_Kind_t:
UNSAFE,
UNACKED,
ACKED,
HMACK,
HMCTL,
SERVACK,
SERVNAK,
CLIENTACK,
STAT
enum _ZAuth_Levels:
ZAUTH_FAILED,
ZAUTH_YES,
ZAUTH_NO
enum _ZCharsets:
ZCHARSET_UNKNOWN,
ZCHARSET_ISO_8859_1,
ZCHARSET_UTF_8
ctypedef struct ZUnique_Id_t:
in_addr zuid_addr
timeval tv
ctypedef struct ZNotice_t:
char * z_packet
char * z_version
ZNotice_Kind_t z_kind
ZUnique_Id_t z_uid
timeval z_time
unsigned short z_port
unsigned short z_charset
int z_auth
int z_checked_auth
int z_authent_len
char * z_ascii_authent
char * z_class
char * z_class_inst
char * z_opcode
char * z_sender
char * z_recipient
char * z_default_format
char * z_multinotice
ZUnique_Id_t z_multiuid
unsigned int z_checksum
int z_num_other_fields
char * z_other_fields[10]
char * z_message
int z_message_len
ctypedef struct ZSubscription_t:
char * zsub_recipient
char * zsub_class
char * zsub_classinst
int (*ZAUTH)()
int (*ZNOAUTH)()
int ZInitialize()
int ZOpenPort(unsigned short * port)
int ZGetFD()
int ZSetFD(int)
int ZSendNotice(ZNotice_t * notice, int (*cert_routine)())
int ZReceiveNotice(ZNotice_t *, sockaddr_in *)
int ZPending()
int ZCheckAuthentication(ZNotice_t *, sockaddr_in *)
void ZFreeNotice(ZNotice_t * notice)
int ZSubscribeTo(ZSubscription_t subslist[], int nitems, unsigned short port)
int ZUnsubscribeTo(ZSubscription_t subslist[], int nitems, unsigned short port)
int ZCancelSubscriptions(unsigned short port)
char * ZGetSender()
char * ZGetRealm()
int ZRetrieveSubscriptions(unsigned short port, int* nitems)
int ZGetSubscriptions(ZSubscription_t subslist[], int* nitems)
int ZFlushSubscriptions()
# XXX: This should really be const char * (or const_char *) -- see
# <http://docs.cython.org/src/tutorial/strings.html#dealing-with-const>
# In Cython 0.12, Cython doesn't seem to support const_char at all, and
# in Cython 0.15, it doesn't seem to be able to handle converting a
# const_char * to a Python string. Once we're dealing with newer Cythons,
# this should probably change, though.
char *ZCharsetToString(unsigned short charset)
cdef extern from "com_err.h":
char * error_message(int)
cdef extern from "stdlib.h":
void * malloc(unsigned int)
void * calloc(unsigned int, unsigned int)
void free(void *)
cdef extern from "string.h":
void * memset(void *, int, unsigned int)
cdef extern from "pool.h":
ctypedef struct object_pool:
void **objects
size_t alloc
size_t count
void object_pool_init(object_pool *pool)
void object_pool_append(object_pool *pool, object obj)
void object_pool_free(object_pool *pool)