#include <pcap-stdinc.h>#include <stdlib.h>#include <string.h>#include <memory.h>#include <setjmp.h>#include <stdarg.h>#include "pcap-int.h"#include "ethertype.h"#include "nlpid.h"#include "llc.h"#include "gencode.h"#include "atmuni31.h"#include "sunatmpos.h"#include "ppp.h"#include "sll.h"#include "arcnet.h"#include <pcap-namedb.h>Go to the source code of this file.
Data Structures | |
| struct | chunk |
Defines | |
| #define | ETHERMTU 1500 |
| #define | IPPROTO_SCTP 132 |
| #define | JMP(c) ((c)|BPF_JMP|BPF_K) |
| #define | NCHUNKS 16 |
| #define | CHUNK0SIZE 1024 |
| #define | SWAPLONG(y) ((((y)&0xff)<<24) | (((y)&0xff00)<<8) | (((y)&0xff0000)>>8) | (((y)>>24)&0xff)) |
| #define | IPPROTO_IGMP 2 |
| #define | IPPROTO_IGRP 9 |
| #define | IPPROTO_PIM 103 |
| #define | IPPROTO_VRRP 112 |
| #define | IPPROTO_AH 51 |
| #define | IPPROTO_ESP 50 |
| #define | IPPROTO_NONE 59 |
Functions | |
| void | bpf_error (const char *fmt,...) |
| void | init_linktype (int) |
| int | alloc_reg (void) |
| void | free_reg (int) |
| void * | newchunk (u_int) |
| void | freechunks (void) |
| block * | new_block (int) |
| slist * | new_stmt (int) |
| block * | gen_retblk (int) |
| void | syntax (void) |
| void | backpatch (struct block *, struct block *) |
| void | merge (struct block *, struct block *) |
| block * | gen_cmp (u_int, u_int, bpf_int32) |
| block * | gen_cmp_gt (u_int, u_int, bpf_int32) |
| block * | gen_mcmp (u_int, u_int, bpf_int32, bpf_u_int32) |
| block * | gen_bcmp (u_int, u_int, const u_char *) |
| block * | gen_ncmp (bpf_u_int32, bpf_u_int32, bpf_u_int32, bpf_u_int32, bpf_u_int32, int) |
| block * | gen_uncond (int) |
| block * | gen_true (void) |
| block * | gen_false (void) |
| block * | gen_ether_linktype (int) |
| block * | gen_linktype (int) |
| block * | gen_snap (bpf_u_int32, bpf_u_int32, u_int) |
| block * | gen_llc (int) |
| block * | gen_hostop (bpf_u_int32, bpf_u_int32, int, int, u_int, u_int) |
| block * | gen_ahostop (const u_char *, int) |
| block * | gen_ehostop (const u_char *, int) |
| block * | gen_fhostop (const u_char *, int) |
| block * | gen_thostop (const u_char *, int) |
| block * | gen_wlanhostop (const u_char *, int) |
| block * | gen_ipfchostop (const u_char *, int) |
| block * | gen_dnhostop (bpf_u_int32, int, u_int) |
| block * | gen_host (bpf_u_int32, bpf_u_int32, int, int) |
| block * | gen_gateway (const u_char *, bpf_u_int32 **, int, int) |
| block * | gen_ipfrag (void) |
| block * | gen_portatom (int, bpf_int32) |
| block * | gen_portop (int, int, int) |
| block * | gen_port (int, int, int) |
| int | lookup_proto (const char *, int) |
| block * | gen_protochain (int, int, int) |
| block * | gen_proto (int, int, int) |
| slist * | xfer_to_x (struct arth *) |
| slist * | xfer_to_a (struct arth *) |
| block * | gen_mac_multicast (int) |
| block * | gen_len (int, int) |
| block * | gen_msg_abbrev (int type) |
| void * | newchunk (n) u_int n |
| int | pcap_compile (pcap_t *p, struct bpf_program *program, char *buf, int optimize, bpf_u_int32 mask) |
| Compiles a packet filter. Converts an high level filtering expression (see Filtering expression syntax ) in a program that can be interpreted by the kernel-level filtering engine. | |
| int | pcap_compile_nopcap (int snaplen_arg, int linktype_arg, struct bpf_program *program, char *buf, int optimize, bpf_u_int32 mask) |
| Deprecated, use pcap_open_dead() and pcap_compile() instead . Compiles a packet filter without the need of opening an adapter. Converts an high level filtering expression (see Filtering expression syntax ) in a program that can be interpreted by the kernel-level filtering engine. | |
| void | pcap_freecode (struct bpf_program *program) |
| Frees a filter. | |
| void | backpatch (list, target) struct block *list |
| void | init_linktype (type) int type |
| void | free_reg (n) int n |
| block * | gen_broadcast (proto) int proto |
Variables | |
| const char | rcsid [] |
| jmp_buf | top_ctx |
| pcap_t * | bpf_pcap |
| u_int | orig_linktype = -1 |
| u_int | orig_nl = -1 |
| u_int | orig_nl_nosnap = -1 |
| int | pcap_fddipad |
| block * | root |
| chunk | chunks [NCHUNKS] |
| int | cur_chunk |
| int | snaplen |
| int | no_optimize |
| void * | target |
| * | b1 |
| size | |
| bpf_int32 | v |
| bpf_u_int32 | mask |
| offset | |
| jtype | |
| jvalue | |
| int | reverse |
| u_int | off_linktype |
| int | is_atm = 0 |
| int | is_lane = 0 |
| u_int | off_vpi |
| u_int | off_vci |
| u_int | off_proto |
| u_int | off_payload |
| u_int | off_nl |
| u_int | off_nl_nosnap |
| int | linktype |
| bpf_u_int32 | ptype |
| int | dir |
| int | proto |
| u_int | src_off |
| u_int | dst_off |
| u_int | base_off |
| bpf_u_int32 ** | alist |
| int | ip_proto |
| qual | q |
| * | s2 |
| register int | masklen |
| * | s1 |
| arth * | index |
| arth * | a0 |
| arth * | a1 |
| int | reversed |
| int | curreg |
| n | |
| idx | |
| val | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 4501 of file gencode.c. References bpf_error(), curreg, and n. |
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
Definition at line 108 of file gencode.c. References bpf_pcap, and pcap_geterr(). Referenced by alloc_reg(), and pcap_compile(). |
|
|
|
|
|
|
|
|
Referenced by pcap_compile(). |
|
||||||||||||
|
|
|
||||||||||||||||
|
|
|
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||
|
|
|
|
|
|
|
|
|
||||||||||||
|
|
|
||||||||||||||||||||
|
|
|
||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||
|
|
|
||||||||||||
|
|
|
|
|
|
||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||||||||||
|
|
|
|
|
|
||||||||||||||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
|
Referenced by pcap_compile(). |
|
||||||||||||||||
|
|
|
||||||||||||
|
|
|
|
|
|
|
|
|
||||||||||||
|
|
|
|
Referenced by pcap_compile(). |
|
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||||||||||||||
|
Compiles a packet filter. Converts an high level filtering expression (see Filtering expression syntax ) in a program that can be interpreted by the kernel-level filtering engine. pcap_compile() is used to compile the string str into a filter program. program is a pointer to a bpf_program struct and is filled in by pcap_compile(). optimize controls whether optimization on the resulting code is performed. netmask specifies the netmask of the local net. A return of -1 indicates an error in which case pcap_geterr() may be used to display the error text.
Definition at line 310 of file gencode.c. References bpf_program::bf_insns, bpf_program::bf_len, bpf_error(), bpf_pcap, freechunks(), gen_retblk(), init_linktype(), mask, no_optimize, pcap_datalink(), pcap_snapshot(), root, snaplen, snprintf, and syntax(). Referenced by main(), and pcap_compile_nopcap(). |
|
||||||||||||||||||||||||||||
|
Deprecated, use pcap_open_dead() and pcap_compile() instead . pcap_compile_nopcap() is similar to pcap_compile() except that instead of passing a pcap structure, one passes the snaplen and linktype explicitly. It is intended to be used for compiling filters for direct BPF usage, without necessarily having called pcap_open(). A return of -1 indicates an error; the error text is unavailable. (pcap_compile_nopcap() is a wrapper around pcap_open_dead(), pcap_compile(), and pcap_close(); the latter three routines can be used directly in order to get the error text for a compilation error.) Look at the Filtering expression syntax section for details on the str parameter.
Definition at line 364 of file gencode.c. References pcap_close(), pcap_compile(), pcap_open_dead(), and pcap_t. |
|
|
Frees a filter. pcap_freecode() is used to free up allocated memory pointed to by a bpf_program struct generated by pcap_compile() when that BPF program is no longer needed, for example after it has been made the filter program for a pcap structure by a call to pcap_setfilter().
Definition at line 384 of file gencode.c. References bpf_program::bf_insns, and bpf_program::bf_len. Referenced by pcap_close(). |
|
|
Referenced by pcap_compile(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 94 of file gencode.c. Referenced by bpf_error(), and pcap_compile(). |
|
|
|
|
|
|
|
|
Definition at line 4495 of file gencode.c. Referenced by alloc_reg(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 2447 of file gencode.c. Referenced by pcap_compile(). |
|
|
|
|
|
|
|
|
Definition at line 307 of file gencode.c. Referenced by pcap_compile(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 1713 of file gencode.c. Referenced by sock_bufferize(). |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 103 of file gencode.c. Referenced by pcap_open_offline(). |
|
|
|
|
|
|
|
|
|
|
|
Initial value:
"@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.184 2003/01/23 07:24:51 guy Exp $ (LBL)"
|
|
|
|
|
|
|
|
|
Definition at line 127 of file gencode.c. Referenced by pcap_compile(). |
|
|
Definition at line 4218 of file gencode.c. Referenced by pcap_strcasecmp(). |
|
|
Definition at line 3991 of file gencode.c. Referenced by pcap_strcasecmp(). |
|
|
Definition at line 4255 of file gencode.c. Referenced by pcap_remoteact_list(), pcap_setuserbuffer(), sock_bufferize(), sock_discard(), sock_recv(), and sock_send(). |
|
|
Definition at line 306 of file gencode.c. Referenced by pcap_compile(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 4567 of file gencode.c. Referenced by inet_addrU(), and svc_geterr(). |
documentation. Copyright (c) 2002-2003 Politecnico di Torino. All rights reserved.