Permalink
Browse files

Port to cffi from cython.

  • Loading branch information...
1 parent f948395 commit 054c9596f58f18cbf9e65e9be2931e9290d5dbc4 @nelhage committed Dec 6, 2012
Showing with 367 additions and 378 deletions.
  1. +1 −0 .gitignore
  2. +0 −113 _zephyr.pxd
  3. +365 −0 _zephyr.py
  4. +0 −257 _zephyr.pyx
  5. +1 −8 setup.py
View
@@ -4,3 +4,4 @@ build
dist
*.pyc
PyZephyr.egg-info
+/__pycache__/
View
@@ -1,113 +0,0 @@
-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
-
- 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
- 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()
-
-cdef extern from "Python.h":
- object PyString_FromStringAndSize(char *, Py_ssize_t)
-
-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)
Oops, something went wrong.

0 comments on commit 054c959

Please sign in to comment.