1 /*
2  * Argus Client Software.  Tools to read, analyze and manage Argus data.
3  * Copyright (c) 2000-2016 QoSient, LLC
4  * All applicable rights reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10 
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15 
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  *
20  */
21 
22 /*
23  * Copyright (c) 1993, 1994 Carnegie Mellon University.
24  * All rights reserved.
25  *
26  * Permission to use, copy, modify, and distribute this software and
27  * its documentation for any purpose and without fee is hereby granted,
28  * provided that the above copyright notice appear in all copies and
29  * that both that copyright notice and this permission notice appear
30  * in supporting documentation, and that the name of CMU not be
31  * used in advertising or publicity pertaining to distribution of the
32  * software without specific, written prior permission.
33  *
34  * CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
35  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
36  * CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
37  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
38  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
39  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
40  * SOFTWARE.
41  *
42  */
43 
44 /*
45  * $Id: //depot/argus/clients/include/argus/cons_out.h#8 $
46  * $DateTime: 2016/06/01 15:17:28 $
47  * $Change: 3148 $
48  */
49 
50 #if !defined(__OpenBSD__)
51 #include <net/if.h>
52 #include <netinet/if_ether.h>
53 #endif
54 
55 #include <netinet/in.h>
56 
57 struct THA_OBJECT {
58    int size;
59    unsigned char *buffer;
60 };
61 
62 struct tha {
63    struct in_addr src;
64    struct in_addr dst;
65    u_short sport;
66    u_short dport;
67 };
68 
69 struct icmptha {
70    struct in_addr src;
71    struct in_addr dst;
72    u_int port;
73    u_int addr;
74 };
75 
76 
77 struct writeStruct {
78    u_int status;
79    struct timeval startime, lasttime;
80    struct ether_addr ethersrc;
81    struct ether_addr etherdst;
82    struct tha addr;
83    int src_count, dst_count;
84    int src_bytes, dst_bytes;
85 };
86 
87 
88 struct inittcpWriteStruct {
89    int src_count, dst_count;
90    u_int addr, seq;
91 };
92 
93 struct tcpWriteStruct {
94    int src_count, dst_count;
95    int src_bytes, dst_bytes;
96 };
97 
98 struct udpWriteStruct {
99    int src_count, dst_count;
100    int src_bytes, dst_bytes;
101 };
102 
103 struct icmpWriteStruct {
104    u_char type, code;
105    u_short data;
106    struct in_addr srcaddr, dstaddr, gwaddr;
107 };
108 
109 struct fragWriteStruct {
110    int fragnum, frag_id;
111    unsigned short status, totlen, currlen, maxfraglen;
112 };
113 
114 struct physWriteStruct {
115    struct ether_addr ethersrc;
116    struct ether_addr etherdst;
117 };
118 
119 struct arpWriteStruct {
120    struct timeval time;
121    struct physWriteStruct phys;
122    struct ether_arp arp;
123 };
124 
125 struct  ipWriteStruct {
126    struct timeval startime, lasttime;
127    struct physWriteStruct ws_phys;
128    struct in_addr src;
129    struct in_addr dst;
130    u_short sport;
131    u_short dport;
132    union {
133       struct inittcpWriteStruct inittcp;
134       struct  tcpWriteStruct  tcp;
135       struct  udpWriteStruct  udp;
136       struct icmpWriteStruct icmp;
137       struct fragWriteStruct frag;
138    } ipws_trans_union;
139 };
140 
141 struct manInitStruct {
142    struct timeval startime, now;
143    char initString[20];
144    u_int localnet, netmask;
145    u_short reportInterval, dflagInterval;
146    u_char interfaceType, interfaceStatus;
147 };
148 
149 struct manStatStruct {
150    struct timeval startime, now;
151    u_short reportInterval, dflagInterval;
152    u_char interfaceType, interfaceStatus;
153    u_int pktsRcvd, bytesRcvd, pktsDrop;
154    u_short actTCPcons, cloTCPcons;
155    u_short actUDPcons, cloUDPcons;
156    u_short actIPcons,  cloIPcons;
157    u_short actICMPcons,  cloICMPcons;
158    u_short actFRAGcons,  cloFRAGcons;
159 };
160 
161 struct WriteStruct {
162    u_int status;
163    union {
164       struct    ipWriteStruct ip;
165       struct   arpWriteStruct arp;
166       struct   manInitStruct man_init;
167       struct   manStatStruct man_stat;
168    } ws_trans_union;
169 };
170 
171 #define ws_ip   ws_trans_union.ip
172 #define ws_arp  ws_trans_union.arp
173 #define ws_init ws_trans_union.man_init
174 #define ws_stat ws_trans_union.man_stat
175 
176 #define ws_ip_phys     ws_trans_union.ip.ws_phys
177 #define ws_ip_src      ws_trans_union.ip.src
178 #define ws_ip_dst      ws_trans_union.ip.dst
179 #define ws_ip_port     ws_trans_union.ip.port
180 #define ws_ip_inittcp  ws_trans_union.ip.ipws_trans_union.inittcp
181 #define ws_ip_tcp      ws_trans_union.ip.ipws_trans_union.tcp
182 #define ws_ip_udp      ws_trans_union.ip.ipws_trans_union.udp
183 #define ws_ip_icmp     ws_trans_union.ip.ipws_trans_union.icmp
184 #define ws_ip_frag     ws_trans_union.ip.ipws_trans_union.frag
185 
186 
187 
188 
189