Update README.dev to the fact that we're using Cython instead of Pyrex
[invirt/packages/python-afs.git] / afs / afs.pxd
1 cdef extern from *:
2     ctypedef long size_t
3
4 cdef extern from "errno.h":
5     int errno
6
7 cdef extern from "string.h":
8     char * strerror(int errnum)
9     char * strncpy(char *s1, char *s2, size_t n)
10     void * memset(void *b, int c, size_t n)
11     void * memcpy(void *s1, void *s2, size_t n)
12
13 cdef extern from "stdlib.h":
14      void * malloc(size_t size)
15      void free(void *)
16
17 cdef extern from "netinet/in.h":
18     struct in_addr:
19         int s_addr
20     struct sockaddr_in:
21         short sin_family
22         unsigned short sin_port
23         in_addr sin_addr
24         char sin_zero[8]
25
26 cdef extern from "afs/stds.h":
27     ctypedef unsigned long afs_uint32
28     ctypedef long afs_int32
29
30 cdef extern from "afs/dirpath.h":
31     char * AFSDIR_CLIENT_ETC_DIRPATH
32
33 cdef extern from "afs/cellconfig.h":
34     enum:
35         MAXCELLCHARS
36         MAXHOSTSPERCELL
37         MAXHOSTCHARS
38
39     # We just pass afsconf_dir structs around to other AFS functions,
40     # so this can be treated as opaque
41     struct afsconf_dir:
42         pass
43
44     # For afsconf_cell, on the other hand, we care about everything
45     struct afsconf_cell:
46         char name[MAXCELLCHARS]
47         short numServers
48         short flags
49         sockaddr_in hostAddr[MAXHOSTSPERCELL]
50         char hostName[MAXHOSTSPERCELL][MAXHOSTCHARS]
51         char *linkedCell
52         int timeout
53
54     afsconf_dir *afsconf_Open(char *adir)
55     int afsconf_GetCellInfo(afsconf_dir *adir,
56                             char *acellName,
57                             char *aservice,
58                             afsconf_cell *acellInfo)
59
60 cdef extern from "rx/rxkad.h":
61     ctypedef char rxkad_level
62
63     enum:
64         MAXKTCNAMELEN
65         MAXKTCREALMLEN
66
67     enum:
68         rxkad_clear
69         rxkad_crypt
70
71     struct ktc_encryptionKey:
72         pass
73
74     struct ktc_principal:
75         char name[MAXKTCNAMELEN]
76         char instance[MAXKTCNAMELEN]
77         char cell[MAXKTCREALMLEN]
78
79     struct rx_securityClass:
80         pass
81
82     rx_securityClass *rxkad_NewClientSecurityObject(rxkad_level level,
83                                                     ktc_encryptionKey *sessionKey,
84                                                     afs_int32 kvno,
85                                                     int ticketLen,
86                                                     char *ticket)
87     rx_securityClass *rxnull_NewClientSecurityObject()
88
89     int rxs_Release(rx_securityClass *aobj)
90
91 cdef extern from "rx/rx.h":
92     int rx_Init(int port)
93     void rx_Finalize()
94
95     struct rx_connection:
96         pass
97
98     rx_connection *rx_NewConnection(afs_uint32 shost,
99                                     unsigned short sport,
100                                     unsigned short sservice,
101                                     rx_securityClass *securityObject,
102                                     int serviceSecurityIndex)
103
104 cdef extern from "afs/auth.h":
105     enum:
106         MAXKTCTICKETLEN
107
108     struct ktc_token:
109         ktc_encryptionKey sessionKey
110         short kvno
111         int ticketLen
112         char ticket[MAXKTCTICKETLEN]
113
114     int ktc_GetToken(ktc_principal *server,
115                      ktc_token *token,
116                      int tokenLen,
117                      ktc_principal *client)
118
119 cdef extern from "afs/prclient.h":
120     enum:
121         PRSRV
122
123 cdef extern from "ubik.h":
124     enum:
125         MAXSERVERS
126
127     # ubik_client is an opaque struct, so we don't care about its members
128     struct ubik_client:
129         pass
130
131     int ubik_ClientInit(rx_connection **serverconns,
132                         ubik_client **aclient)
133     afs_int32 ubik_ClientDestroy(ubik_client *aclient)
134
135 cdef extern from "afs/com_err.h":
136     char * afs_error_message(int)
137
138 # All AFS error tables
139 cdef extern from "afs/auth.h":
140     void initialize_KTC_error_table()
141 cdef extern from "afs/cellconfig.h":
142     void initialize_ACFG_error_table()
143 cdef extern from "afs/pterror.h":
144     void initialize_PT_error_table()
145 cdef extern from "rx/rxkad.h":
146     void initialize_RXK_error_table()
147 cdef extern from "ubik.h":
148     void initialize_U_error_table()