|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
41 # include <linux/unistd.h>
42 # include <linux/signal.h>
60 #include <sys/socket.h>
67 #include <linux/types.h>
68 #include <linux/netlink.h>
76 # include <linux/socket.h>
77 # include <linux/in.h>
78 # include <linux/ip.h>
79 # include <linux/tcp.h>
80 # include <linux/udp.h>
81 # include <linux/icmp.h>
82 # include <linux/if_ether.h>
83 # include <linux/if_arp.h>
86 # include <netinet/in.h>
87 # include <netinet/ip.h>
88 # include <netinet/tcp.h>
89 # include <netinet/udp.h>
90 # include <netinet/ip_icmp.h>
91 # include <netinet/if_ether.h>
102 u8 * t = (
u8 *)
"UNKNOWN";
105 #define _(x) case PF_##x: t = (u8 *) #x; break
171 vec_add (s, t, strlen ((
char *) t));
181 struct protoent * p = getprotobynumber (
protocol);
183 ASSERT (family == AF_INET);
185 return format (s,
"%s", p->p_name);
199 struct servent * p = getservbyport (
port,
proto == IPPROTO_UDP ?
"udp" :
"tcp");
202 return format (s,
"%s", p->s_name);
206 return format (s,
"%s/%d",
proto == IPPROTO_UDP ?
"udp" :
"tcp",
port);
225 s =
format (s,
"%02x:%02x:%02x:%02x:%02x:%02x",
230 clib_error (
"unsupported address family %d", family);
238 void * v = va_arg (*args,
void *);
239 struct sockaddr * sa = v;
240 static u32 local_counter;
242 switch (sa->sa_family)
246 struct sockaddr_in *
i = v;
260 s =
format (s,
"local:%u", local_counter++);
268 struct sockaddr_nl * n = v;
269 s =
format (s,
"KERNEL-NETLINK");
271 s =
format (s,
" (groups 0x%x)", n->nl_groups);
278 s =
format (s,
"sockaddr family %d", sa->sa_family);
290 char *
fmt = va_arg (*args,
char *);
291 struct timeval * tv = va_arg (*args,
struct timeval *);
297 fmt =
"y/m/d H:M:S:F";
301 static struct timeval
now;
302 gettimeofday (&
now, 0);
308 { msec = 0; tv->tv_sec++; }
311 time_t t = tv->tv_sec;
318 char * what_fmt =
"%d";
327 what = 1900 + tm->tm_year;
331 what = tm->tm_mon + 1;
356 s =
format (s, what_fmt, what);
365 u8 *
fmt = va_arg (*args,
u8 *);
366 f64 t = va_arg (*args,
f64);
371 tv.tv_usec = 1e6*(t - tv.tv_sec);
381 #define _(x) case x: t = #x; break;
419 return format (s,
"unknown %d", signum);
428 ucontext_t * uc __attribute__((unused));
429 unsigned long *
regs = 0;
432 uc = va_arg (*args, ucontext_t *);
434 #if defined (powerpc)
435 regs = &uc->uc_mcontext.uc_regs->gregs[0];
436 #elif defined (powerpc64)
437 regs = &uc->uc_mcontext.uc_regs->gp_regs[0];
438 #elif defined (i386) || defined (__x86_64__)
439 regs = (
void *) &uc->uc_mcontext.gregs[0];
442 #
if defined (powerpc) || defined (powerpc64)
446 #elif defined (__x86_64__)
454 return format (s,
"unsupported");
462 gid_t *gid = va_arg (*args, gid_t *);
463 struct group *grp = 0;
471 else if (
unformat (input,
"%s", &s))
473 grp = getgrnam ((
char *) s);
#define vec_add(V, E, N)
Add N elements to end of vector V (no header, unspecified alignment)
static f64 unix_time_now(void)
vnet_hw_if_output_node_runtime_t * r
static vnet_feature_upd_registration_t * regs
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#define vec_free(V)
Free vector's memory (no header).
description fragment has unexpected format
vl_api_ip_proto_t protocol
static word flt_round_nearest(f64 x)
#define clib_error(format, args...)