File: l4_udp.c

package info (click to toggle)
libosmo-netif 1.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,764 kB
  • sloc: ansic: 11,830; makefile: 261; sh: 85
file content (36 lines) | stat: -rw-r--r-- 854 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
 * (C) 2012 by Pablo Neira Ayuso <pablo@gnumonks.org>
 * (C) 2012 by On Waves ehf <http://www.on-waves.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later vers
 */

#include <netinet/ip.h>
#include <netinet/udp.h>

#include "proto.h"

static unsigned int l4_udp_pkt_hdr_len(const uint8_t *pkt)
{
	return sizeof(struct udphdr);
}

static unsigned int l4_udp_pkt_no_data(const uint8_t *pkt)
{
	/* UDP has no control packets. */
	return 0;
}

static struct osmo_pcap_proto_l4 udp = {
	.l4protonum	= IPPROTO_UDP,
	.l4pkt_hdr_len	= l4_udp_pkt_hdr_len,
	.l4pkt_no_data	= l4_udp_pkt_no_data,
};

void l4_udp_init(void)
{
	osmo_pcap_proto_l4_register(&udp);
}