1 function psi\htonl(int $l) : int {
3 return htonl(l) as to_int(htonl);
5 function psi\htons(int $s) : int {
7 return htons(s) as to_int(htons);
10 function psi\ntohl(int $l) : int {
12 return ntohl(l) as to_int(ntohl);
14 function psi\ntohs(int $s) : int {
16 return ntohs(s) as to_int(ntohs);
20 function psi\inet_addr(string $cp) : int {
22 return inet_addr(cp) as to_int(inet_addr);
25 function psi\inet_ntoa(array $in) : string {
29 return inet_ntoa(in) as to_string(inet_ntoa);
32 function psi\inet_ntop(int $af, string $src) : string {
34 let src = strval($src);
35 let size = psi\SIZEOF_STRUCT_SOCKADDR_STORAGE;
36 let dst = calloc(1, size);
37 return inet_ntop(af, src, dst, size) as to_string(inet_ntop);
40 function psi\inet_pton(int $af, string $src, string &$dst) : int {
42 let src = strval($src);
43 let dst = calloc(1, psi\SIZEOF_STRUCT_SOCKADDR_STORAGE);
44 return inet_pton(af, src, dst) as to_int(inet_pton);
45 set $dst = to_string(dst, psi\SIZEOF_STRUCT_SOCKADDR_STORAGE);