Set p->proto and add TCP, UDP, etc macros.

remotes/origin/master-1.0.x
Victor Julien 17 years ago
parent b7bc35e8b2
commit 3df4b7da2b

@ -15,6 +15,7 @@ void DecodeICMPV4(ThreadVars *t, Packet *p, u_int8_t *pkt, u_int16_t len )
printf("ICMPV4 TYPE %u CODE %u\n", p->icmpv4h->type, p->icmpv4h->code);
#endif
p->proto = IPPROTO_ICMP;
return;
}

@ -15,6 +15,7 @@ void DecodeICMPV6(ThreadVars *t, Packet *p, u_int8_t *pkt, u_int16_t len)
printf("ICMPV6 TYPE %u CODE %u\n", p->icmpv6h->type, p->icmpv6h->code);
#endif
p->proto = IPPROTO_ICMPV6;
return;
}

@ -129,6 +129,8 @@ static int DecodeTCPPacket(ThreadVars *t, Packet *p, u_int8_t *pkt, u_int16_t le
p->tcp_payload = pkt + p->tcpvars.hlen;
p->tcp_payload_len = len - p->tcpvars.hlen;
p->proto = IPPROTO_TCP;
return 0;
}

@ -122,6 +122,12 @@ typedef u_int16_t Port;
#define PKT_IS_IPV4(p) (((p)->ip4h != NULL))
#define PKT_IS_IPV6(p) (((p)->ip6h != NULL))
#define PKT_IS_TCP(p) (((p)->tcph != NULL))
/* XXX */
#define PKT_IS_UDP(p) (0)
#define PKT_IS_ICMPV4 (((p)->icmpv4 != NULL))
#define PKT_IS_ICMPV6 (((p)->icmpv6 != NULL))
/* structure to store the sids/gids/etc the detection engine
* found in this packet */
@ -294,8 +300,6 @@ typedef struct _Packet
#define IS_TUNNEL_ROOT_PKT(p) (((p)->root == NULL && (p)->tunnel_pkt == 1))
#define IS_TUNNEL_PKT(p) (((p)->tunnel_pkt == 1))
#define SET_TUNNEL_PKT(p) ((p)->tunnel_pkt = 1)
#define IS_IPV4_PKT(p) ((p)->ip4h ? 1 : 0)
#define IS_IPV6_PKT(p) ((p)->ip6h ? 1 : 0)
/* decoder functions */

Loading…
Cancel
Save