| 1 |
/* Some functions from libc <arpa/inet.h> */ |
| 2 |
|
| 3 |
/* NB: functionally equivalent to linux/inet.stp |
| 4 |
* ... but we have the advantage of using (mostly) direct equivalents! |
| 5 |
*/ |
| 6 |
|
| 7 |
%{ |
| 8 |
#include <arpa/inet.h> |
| 9 |
#include <endian.h> |
| 10 |
%} |
| 11 |
|
| 12 |
function htonll:long (x:long) |
| 13 |
%{ |
| 14 |
/* pure */ STAP_RETVALUE = htobe64 ((uint64_t) STAP_ARG_x); |
| 15 |
%} |
| 16 |
|
| 17 |
function htonl:long (x:long) |
| 18 |
%{ |
| 19 |
/* pure */ STAP_RETVALUE = htonl ((uint32_t) STAP_ARG_x); |
| 20 |
%} |
| 21 |
|
| 22 |
function htons:long (x:long) |
| 23 |
%{ |
| 24 |
/* pure */ STAP_RETVALUE = htons ((uint16_t) STAP_ARG_x); |
| 25 |
%} |
| 26 |
|
| 27 |
function ntohll:long (x:long) |
| 28 |
%{ |
| 29 |
/* pure */ STAP_RETVALUE = be64toh ((uint64_t) STAP_ARG_x); |
| 30 |
%} |
| 31 |
|
| 32 |
function ntohl:long (x:long) |
| 33 |
%{ |
| 34 |
/* pure */ STAP_RETVALUE = ntohl ((uint32_t) STAP_ARG_x); |
| 35 |
%} |
| 36 |
|
| 37 |
function ntohs:long (x:long) |
| 38 |
%{ |
| 39 |
/* pure */ STAP_RETVALUE = ntohs ((uint16_t) STAP_ARG_x); |
| 40 |
%} |