3 function psi\htonl(int $l) : int {
5 return htonl(l) as to_int(htonl);
7 function psi\htons(int $s) : int {
9 return htons(s) as to_int(htons);
12 function psi\ntohl(int $l) : int {
14 return ntohl(l) as to_int(ntohl);
16 function psi\ntohs(int $s) : int {
18 return ntohs(s) as to_int(ntohs);
22 function psi\inet_addr(string $cp) : int {
24 return inet_addr(cp) as to_int(inet_addr);
27 function psi\inet_ntoa(array $in) : string {
31 return inet_ntoa(in) as to_string(inet_ntoa);
34 function psi\inet_ntop(int $af, string $src) : string {
36 let src = strval($src);
37 let size = sizeof(struct sockaddr_storage);
38 let dst = calloc(1, size);
39 return inet_ntop(af, src, dst, size) as to_string(inet_ntop);
42 function psi\inet_pton(int $af, string $src, string &$dst) : int {
44 let src = strval($src);
45 let dst = calloc(1, sizeof(struct sockaddr_storage));
46 return inet_pton(af, src, dst) as to_int(inet_pton);
47 set $dst = to_string(dst, sizeof(struct sockaddr_storage));