nmsg  0.14.0
ipdg.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009-2015 by Farsight Security, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef NMSG_IPDG_H
18 #define NMSG_IPDG_H
19 
31 struct nmsg_ipdg {
32  int proto_network; /*%< PF_* value */
33  int proto_transport; /*%< transport protocol */
34  unsigned len_network; /*%< length starting from network */
35  unsigned len_transport; /*%< length starting from transport */
36  unsigned len_payload; /*%< length starting from payload */
37  const u_char *network; /*%< pointer to network header */
38  const u_char *transport; /*%< pointer to transport header */
39  const u_char *payload; /*%< pointer to application payload */
40 };
41 
67 nmsg_ipdg_parse(struct nmsg_ipdg *dg, unsigned etype, size_t len,
68  const u_char *pkt);
69 
100 nmsg_res
101 nmsg_ipdg_parse_pcap(struct nmsg_ipdg *dg, nmsg_pcap_t pcap,
102  struct pcap_pkthdr *pkt_hdr, const u_char *pkt);
103 
116 nmsg_res
117 nmsg_ipdg_parse_pcap_raw(struct nmsg_ipdg *dg, int datalink, const uint8_t *pkt, size_t len);
118 
119 #endif /* NMSG_IPDG_H */
nmsg_res
nmsg result code
Definition: res.h:25
nmsg_res nmsg_ipdg_parse_pcap_raw(struct nmsg_ipdg *dg, int datalink, const uint8_t *pkt, size_t len)
Like nmsg_ipdg_parse_pcap(), but performs no fragment handling.
unsigned len_network
length starting from network
Definition: ipdg.h:34
int proto_transport
transport protocol
Definition: ipdg.h:33
Parsed IP datagram.
Definition: ipdg.h:31
unsigned len_payload
length starting from payload
Definition: ipdg.h:36
nmsg_res nmsg_ipdg_parse(struct nmsg_ipdg *dg, unsigned etype, size_t len, const u_char *pkt)
Parse IP packets from the network layer, discarding fragments.
const u_char * payload
pointer to application payload
Definition: ipdg.h:39
const u_char * transport
pointer to transport header
Definition: ipdg.h:38
unsigned len_transport
length starting from transport
Definition: ipdg.h:35
const u_char * network
pointer to network header
Definition: ipdg.h:37
int proto_network
PF_* value.
Definition: ipdg.h:32
nmsg_res nmsg_ipdg_parse_pcap(struct nmsg_ipdg *dg, nmsg_pcap_t pcap, struct pcap_pkthdr *pkt_hdr, const u_char *pkt)
Parse IP datagrams from the data link layer, performing reassembly if necessary.