Projet

Général

Profil

Télécharger (1,42 ko) Statistiques
| Branche: | Révision:

univnautes-tools / pfPorts / filterlog / files / common.h @ 8135339c

1

    
2

    
3
#ifndef _FILTER_LOG_COMMON_H_
4
#define _FILTER_LOG_COMMON_H_
5

    
6
#include <sys/sbuf.h>
7

    
8
#define MAXIMUM_SNAPLEN	65535
9

    
10
#ifndef IP_V
11
# define        IP_V(x)         (x)->ip_v
12
#endif
13
#ifndef IP_HL
14
# define        IP_HL(x)        (x)->ip_hl
15
#endif
16

    
17
struct tok {
18
        int action;
19
        const char *descr;
20
};
21

    
22
#include "ipproto.h"
23

    
24
typedef struct {
25
	u_int16_t	val;
26
} __attribute__((packed)) unaligned_u_int16_t;
27

    
28
typedef struct {
29
        u_int32_t       val;
30
} __attribute__((packed)) unaligned_u_int32_t;
31

    
32
static inline u_int16_t
33
EXTRACT_16BITS(const void *p)
34
{
35
	return ((u_int16_t)ntohs(((const unaligned_u_int16_t *)(p))->val));
36
}
37

    
38
static inline u_int32_t
39
EXTRACT_32BITS(const void *p)
40
{
41
	return ((u_int32_t)ntohl(((const unaligned_u_int32_t *)(p))->val));
42
}
43

    
44
const char *code2str(const struct tok *, const char[], int);
45
void ip_print(struct sbuf *sbuf, const u_char *bp, u_int length);
46
void ip6_print(struct sbuf *sbuf, const u_char *bp, u_int length);
47
int mobility_print(struct sbuf *sbuf, const u_char *bp, int len);
48
void tcp_print(struct sbuf *sbuf, register const u_char *bp, register u_int length,
49
          register const u_char *bp2);
50
void icmp_print(struct sbuf *, const u_char *, u_int, const u_char *, int);
51
int hbhopt_print(struct sbuf *sbuf, register const u_char *bp);
52
int dstopt_print(struct sbuf *sbuf, register const u_char *bp);
53
void ip6_opt_print(struct sbuf *sbuf, const u_char *bp, int len);
54

    
55
#endif /* _FILTER_LOG_COMMON_H_ */
(2-2/11)