static string format_signed_integer_pointer(Context &context, void *address) { Type data; if (obtain_pointer_data(context, &data, address, Context::POINTER_VALUES)) return "[" + context.FormatSigned(data, sizeof(Type)) + "]"; return context.FormatPointer(address); }
static string format_socket_type(Context &context, int type) { if (context.GetContents(Context::ENUMERATIONS)) { switch (type) { case SOCK_RAW: return "SOCK_RAW"; case SOCK_DGRAM: return "SOCK_DGRAM"; case SOCK_STREAM: return "SOCK_STREAM"; } } return "type = " + context.FormatSigned(type); }
static string format_socket_protocol(Context &context, int protocol) { if (context.GetContents(Context::ENUMERATIONS)) { switch (protocol) { case IPPROTO_IP: return "IPPROTO_IP"; case IPPROTO_RAW: return "IPPROTO_RAW"; case IPPROTO_ICMP: return "IPPROTO_ICMP"; case IPPROTO_UDP: return "IPPROTO_UDP"; case IPPROTO_TCP: return "IPPROTO_TCP"; } } return "protocol = " + context.FormatSigned(protocol); }
static string format_socket_family(Context &context, int family) { if (context.GetContents(Context::ENUMERATIONS)) { #define SOCKET_FAMILY(family) \ case family: \ return #family switch (family) { SOCKET_FAMILY(AF_UNSPEC); SOCKET_FAMILY(AF_INET); SOCKET_FAMILY(AF_APPLETALK); SOCKET_FAMILY(AF_ROUTE); SOCKET_FAMILY(AF_LINK); SOCKET_FAMILY(AF_INET6); SOCKET_FAMILY(AF_LOCAL); } } return "family = " + context.FormatSigned(family); }
string GetReturnValue(Context &context, uint64 value) { return context.FormatSigned(value, sizeof(Type)); }
string GetParameterValue(Context &context, Parameter *, const void *address) { return context.FormatSigned(get_value<Type>(address), sizeof(Type)); }