source: trunk/packages/python-afs/afs/_util.pxd @ 2882

Last change on this file since 2882 was 2599, checked in by broder, 15 years ago

Import python-afs.

Debathena should eventually be importing PyAFS for
<http://debathena.mit.edu/trac/ticket/395>, so hopefully this is only
temporary.

File size: 4.5 KB
RevLine 
[2599]1cdef extern from *:
2    ctypedef long size_t
3
4cdef extern from "errno.h":
5    int errno
6
7cdef 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    size_t strlen(char *s)
13
14cdef extern from "stdlib.h":
15     void * malloc(size_t size)
16     void free(void *)
17
18cdef extern from "netinet/in.h":
19    struct in_addr:
20        int s_addr
21    struct sockaddr_in:
22        short sin_family
23        unsigned short sin_port
24        in_addr sin_addr
25        char sin_zero[8]
26
27cdef extern from "afs/stds.h":
28    ctypedef unsigned long afs_uint32
29    ctypedef long afs_int32
30
31cdef extern from "afs/dirpath.h":
32    char * AFSDIR_CLIENT_ETC_DIRPATH
33
34cdef extern from "afs/cellconfig.h":
35    enum:
36        MAXCELLCHARS
37        MAXHOSTSPERCELL
38        MAXHOSTCHARS
39
40    # We just pass afsconf_dir structs around to other AFS functions,
41    # so this can be treated as opaque
42    struct afsconf_dir:
43        pass
44
45    # For afsconf_cell, on the other hand, we care about everything
46    struct afsconf_cell:
47        char name[MAXCELLCHARS]
48        short numServers
49        short flags
50        sockaddr_in hostAddr[MAXHOSTSPERCELL]
51        char hostName[MAXHOSTSPERCELL][MAXHOSTCHARS]
52        char *linkedCell
53        int timeout
54
55    afsconf_dir *afsconf_Open(char *adir)
56    int afsconf_GetCellInfo(afsconf_dir *adir,
57                            char *acellName,
58                            char *aservice,
59                            afsconf_cell *acellInfo)
60
61cdef extern from "rx/rxkad.h":
62    ctypedef char rxkad_level
63
64    enum:
65        MAXKTCNAMELEN
66        MAXKTCREALMLEN
67
68    enum:
69        rxkad_clear
70        rxkad_crypt
71
72    struct ktc_encryptionKey:
73        pass
74
75    struct ktc_principal:
76        char name[MAXKTCNAMELEN]
77        char instance[MAXKTCNAMELEN]
78        char cell[MAXKTCREALMLEN]
79
80    struct rx_securityClass:
81        pass
82
83    rx_securityClass *rxkad_NewClientSecurityObject(rxkad_level level,
84                                                    ktc_encryptionKey *sessionKey,
85                                                    afs_int32 kvno,
86                                                    int ticketLen,
87                                                    char *ticket)
88    rx_securityClass *rxnull_NewClientSecurityObject()
89
90    int rxs_Release(rx_securityClass *aobj)
91
92cdef extern from "rx/rx.h":
93    int rx_Init(int port)
94    void rx_Finalize()
95
96    struct rx_connection:
97        pass
98
99    rx_connection *rx_NewConnection(afs_uint32 shost,
100                                    unsigned short sport,
101                                    unsigned short sservice,
102                                    rx_securityClass *securityObject,
103                                    int serviceSecurityIndex)
104
105cdef extern from "afs/auth.h":
106    enum:
107        MAXKTCTICKETLEN
108
109    struct ktc_token:
110        ktc_encryptionKey sessionKey
111        short kvno
112        int ticketLen
113        char ticket[MAXKTCTICKETLEN]
114
115    int ktc_GetToken(ktc_principal *server,
116                     ktc_token *token,
117                     int tokenLen,
118                     ktc_principal *client)
119
120cdef extern from "afs/prclient.h":
121    enum:
122        PRSRV
123
124cdef extern from "ubik.h":
125    enum:
126        MAXSERVERS
127
128    # ubik_client is an opaque struct, so we don't care about its members
129    struct ubik_client:
130        pass
131
132    int ubik_ClientInit(rx_connection **serverconns,
133                        ubik_client **aclient)
134    afs_int32 ubik_ClientDestroy(ubik_client *aclient)
135
136cdef extern from "afs/com_err.h":
137    char * afs_error_message(int)
138
139# All AFS error tables
140cdef extern from "afs/auth.h":
141    void initialize_KTC_error_table()
142cdef extern from "afs/cellconfig.h":
143    void initialize_ACFG_error_table()
144cdef extern from "afs/pterror.h":
145    void initialize_PT_error_table()
146cdef extern from "rx/rxkad.h":
147    void initialize_RXK_error_table()
148cdef extern from "ubik.h":
149    void initialize_U_error_table()
150
151cdef extern from "afs/vice.h":
152    struct ViceIoctl:
153        void *cin "in"
154        void *out
155        unsigned short out_size
156        unsigned short in_size
157
158cdef extern from "afs/venus.h":
159    enum:
160        # PIOCTLS to Venus that we use
161        VIOCGETAL, VIOC_GETVCXSTATUS2, VIOCSETAL, VIOC_FILE_CELL_NAME
162
163# pioctl doesn't actually have a header, so we have to define it here
164cdef extern int pioctl(char *, afs_int32, ViceIoctl *, afs_int32)
165cdef int pioctl_read(char *, afs_int32, void *, unsigned short, afs_int32) except -1
166cdef int pioctl_write(char *, afs_int32, char *, afs_int32) except -1
167
Note: See TracBrowser for help on using the repository browser.