/* Globals - only useful within this module. */
static pcap_t *pcap = NULL;
static int pcap_fd = -1;
-static const linkhdr_t *linkhdr = NULL;
+static const struct linkhdr *linkhdr = NULL;
#define CAP_TIMEOUT 500 /* granularity of capture buffer, in milliseconds */
pktsummary *sm);
/* Link-type header information */
-static const linkhdr_t linkhdrs[] = {
+static const struct linkhdr linkhdrs[] = {
/* linktype hdrlen handler */
{ DLT_EN10MB, ETHER_HDR_LEN, decode_ether },
{ DLT_LOOP, NULL_HDR_LEN, decode_loop },
};
/*
- * Returns a pointer to the linkhdr_t record matching the given linktype, or
+ * Returns a pointer to the linkhdr record matching the given linktype, or
* NULL if no matching entry found.
*/
-const linkhdr_t *
-getlinkhdr(int linktype)
+const struct linkhdr *
+getlinkhdr(const int linktype)
{
- int i;
+ size_t i;
for (i=0; linkhdrs[i].linktype != -1; i++)
if (linkhdrs[i].linktype == linktype)
* allowed to be NULL.
*/
int
-getsnaplen(const linkhdr_t *lh)
+getsnaplen(const struct linkhdr *lh)
{
assert(lh != NULL);
/* TODO MEA Investigate why the supplementary value 20 is needed on GNU/Linux. */
# define IPPROTO_OSPF 89
#endif
-typedef struct {
+struct linkhdr {
int linktype;
unsigned int hdrlen;
pcap_handler handler;
-} linkhdr_t;
+};
-const linkhdr_t *getlinkhdr(int linktype);
-int getsnaplen(const linkhdr_t *lh);
+const struct linkhdr *getlinkhdr(const int linktype);
+int getsnaplen(const struct linkhdr *lh);
char *ip_to_str(const struct addr46 *const ip);
char *ip_to_str_af(const void *const addr, sa_family_t af);