1 /* $OpenBSD: if_pflow.h,v 1.5 2009/02/27 11:09:36 gollo Exp $ */
4 * Copyright (c) 2008 Henning Brauer <henning@openbsd.org>
5 * Copyright (c) 2008 Joerg Goltermann <jg@osn.de>
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN
16 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
17 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 #ifndef _NET_IF_PFLOW_H_
23 #define _NET_IF_PFLOW_H_
25 #define PFLOW_ID_LEN sizeof(u_int64_t)
27 #define PFLOW_MAXFLOWS 30
28 #define PFLOW_VERSION 5
29 #define PFLOW_ENGINE_TYPE 42
30 #define PFLOW_ENGINE_ID 42
31 #define PFLOW_MAXBYTES 0xffffffff
32 #define PFLOW_TIMEOUT 30
38 u_int16_t if_index_in;
39 u_int16_t if_index_out;
40 u_int32_t flow_packets;
41 u_int32_t flow_octets;
43 u_int32_t flow_finish;
63 struct ifnet *sc_pflow_ifp;
65 unsigned int sc_count;
66 unsigned int sc_maxcount;
67 u_int64_t sc_gcounter;
68 struct ip_moptions sc_imo;
70 struct callout sc_tmo;
72 struct timeout sc_tmo;
74 struct in_addr sc_sender_ip;
75 u_int16_t sc_sender_port;
76 struct in_addr sc_receiver_ip;
77 u_int16_t sc_receiver_port;
78 struct mbuf *sc_mbuf; /* current cumulative mbuf */
79 SLIST_ENTRY(pflow_softc) sc_next;
82 extern struct pflow_softc *pflowif;
91 u_int32_t time_nanosec;
92 u_int32_t flow_sequence;
99 #define PFLOW_HDRLEN sizeof(struct pflow_header)
102 u_int64_t pflow_flows;
103 u_int64_t pflow_packets;
104 u_int64_t pflow_onomem;
105 u_int64_t pflow_oerrors;
109 * Configuration structure for SIOCSETPFLOW SIOCGETPFLOW
112 struct in_addr sender_ip;
113 struct in_addr receiver_ip;
114 u_int16_t receiver_port;
116 #define PFLOW_MASK_SRCIP 0x01
117 #define PFLOW_MASK_DSTIP 0x02
118 #define PFLOW_MASK_DSTPRT 0x04
122 int export_pflow(struct pf_state *);
123 int pflow_sysctl(int *, u_int, void *, size_t *, void *, size_t);
126 #endif /* _NET_IF_PFLOW_H_ */