equal
deleted
inserted
replaced
1 cimport qmsk.net.py as py |
1 cimport qmsk.net.py as py |
|
2 cimport qmsk.net.libc as libc |
2 |
3 |
3 cdef class sockaddr_un (sockaddr) : |
4 cdef class sockaddr_un (sockaddr) : |
4 |
5 |
5 def __init__ (self, char *addr) : |
6 def __init__ (self, char *addr) : |
6 """ |
7 """ |
22 |
23 |
23 # constant af |
24 # constant af |
24 self.sockaddr.sun_family = self.family |
25 self.sockaddr.sun_family = self.family |
25 |
26 |
26 # set the sun_path |
27 # set the sun_path |
27 memcpy(self.sockaddr.sun_path, addr, len(addr)) |
28 libc.memcpy(self.sockaddr.sun_path, addr, len(addr)) |
28 self.sockaddr.sun_path[len(addr)] = '\0' |
29 self.sockaddr.sun_path[len(addr)] = '\0' |
29 |
30 |
30 cdef int _get_sockaddr (self, platform.sockaddr **sa_ptr, platform.socklen_t *sa_len) except -1 : |
31 cdef int _get_sockaddr (self, platform.sockaddr **sa_ptr, platform.socklen_t *sa_len) except -1 : |
31 if sa_ptr : |
32 if sa_ptr : |
32 sa_ptr[0] = <platform.sockaddr *> &self.sockaddr |
33 sa_ptr[0] = <platform.sockaddr *> &self.sockaddr |
68 |
69 |
69 if other is self : |
70 if other is self : |
70 return 0 |
71 return 0 |
71 |
72 |
72 return ( |
73 return ( |
73 libc.memcmp(<void *> &sa1.sin_path, <void *> &sa2.sin_path, sizeof(sa1.sin_path)) |
74 libc.memcmp(<void *> &sa1.sun_path, <void *> &sa2.sun_path, sizeof(sa1.sun_path)) |
74 ) |
75 ) |
75 |
76 |
76 def __str__ (self) : |
77 def __str__ (self) : |
77 """ |
78 """ |
78 Return the literal ASCII representation for this sockaddr as an '<path> string |
79 Return the literal ASCII representation for this sockaddr as an '<path> string |