1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248
|
/*
* Copyright (c) 2000-2004 QoSient, LLC
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/*
* Copyright (c) 1993, 1994 Carnegie Mellon University.
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation, and that the name of CMU not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
*/
/* ArgusOutput.h */
/* ArgusOutput.h is an amalgum of declarations, defines and routines from
* interface.h, cons_sockets.c,
*
*/
#ifndef ArgusOutput_h
#define ArgusOutput_h
#define PARENTSIDE 0
#define CLIENTSIDE 1
#define ARGUS_MONITORPORT 561
#define ARGUS_MAXLISTEN 5
#include <unistd.h>
#include <stdlib.h>
#include <limits.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <strings.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#if defined(__NetBSD__)
#include <sys/sched.h>
#else
#include <sched.h>
#endif
#include <fcntl.h>
#include <signal.h>
#include <pcap.h>
#include <argus_filter.h>
#ifdef ARGUS_SASL
#include <sasl.h>
#endif
struct ArgusClientData {
int fd, pid;
int pipe[2];
struct ArgusSocketStruct *sock;
#ifdef ARGUS_SASL
sasl_conn_t *sasl_conn;
#endif
};
struct ArgusOutputStruct {
pid_t pid;
int clienttags;
struct ArgusClientData client[ARGUS_MAXLISTEN];
};
struct ArgusWfileStruct {
char *filename;
char *filter;
};
#if defined(ArgusOutput)
struct ArgusOutputStruct *ArgusOutputTask = NULL;
struct ArgusRecord ArgusSystemMarBuffer;
struct ArgusRecord *ArgusSystemMar = &ArgusSystemMarBuffer;
struct ArgusListStruct *ArgusWfileList = NULL;
struct timeval ArgusReportTime = {0, 0};
struct timeval ArgusMarReportInterval = {0, 0};
struct timeval ArgusLastMarUpdateTime = {0, 0};
int ArgusOutputPipe[2] = {-1, -1};
char *ArgusWfile = NULL;
int ArgusPortNum = 0;
char *ArgusBindIP = NULL;
int ArgusLfd = -1;
int ArgusOutfd = -1;
unsigned int ArgusOutputSequence = 1;
struct ArgusOutputStruct * ArgusNewOutput (void);
void ArgusDeleteOutput (void);
void ArgusInitOutput (void);
void ArgusInitOutputProcess(void);
void ArgusGenerateInitialMar (void);
void ArgusGenerateStatusMar (void);
void ArgusGenerateClosingMar (unsigned char);
void ArgusSendOutputData(int, struct ArgusRecord *);
int ArgusHandleData(struct ArgusSocketStruct *, unsigned char *, int, void *);
int ArgusHandleClientData(struct ArgusSocketStruct *, unsigned char *, int, void *);
void ArgusSendInitialMar (int);
void ArgusSendStatusMar (int);
void ArgusSendClosingMar (int, unsigned char);
void ArgusOutputProcess(void);
void *ArgusClientProcess(struct ArgusClientData *, struct ArgusWfileStruct *);
int getArgusLfd(void);
char *getArgusWfile(void);
int getArgusPortNum(void);
struct timeval *getArgusMarReportInterval(void);
void clearArgusWfile(char *, char *);
void setArgusLfd(int);
void setArgusWfile(char *, char *);
void setArgusPortNum(int, char *);
void setArgusMarReportInterval(char *);
void ArgusCheckClientStatus (void);
int ArgusEstablishListen(int, char *, char *);
int ArgusTcpWrapper (int, struct sockaddr *);
void ArgusCloseSocket (int);
void ArgusCloseClients (void);
void ArgusUsr1Sig (int);
void ArgusUsr2Sig (int);
void ArgusChildExit (int);
void ArgusClientError(void);
void ArgusInitClientProcess(struct ArgusClientData *, struct ArgusWfileStruct *);
extern unsigned int argus_filter (struct bpf_insn *, unsigned char *);
#else
extern struct timeval ArgusReportTime;
extern struct ArgusRecord *ArgusSystemMar;
extern struct ArgusListStruct *ArgusWfileList;
extern int ArgusOutputPipe[2];
extern char *ArgusWfile;
extern int ArgusPortNum;
extern char *ArgusBindIP;
extern int ArgusLfd;
extern int ArgusOutfd;
extern unsigned int ArgusOutputSequence;
extern struct ArgusOutputStruct *ArgusOutputTask;
extern struct ArgusOutputStruct * ArgusNewOutput (void);
extern void ArgusDeleteOutput (void);
extern void ArgusInitOutput (void);
extern void ArgusInitOutputProcess(void);
extern void ArgusGenerateInitialMar (void);
extern void ArgusGenerateStatusMar (void);
extern void ArgusGenerateClosingMar (unsigned char);
extern void ArgusSendOutputData(int, struct ArgusRecord *);
extern int ArgusHandleData(struct ArgusSocketStruct *, unsigned char *, int, void *);
extern int ArgusHandleClientData(struct ArgusSocketStruct *, unsigned char *, int, void *);
extern void ArgusSendInitialMar (int);
extern void ArgusSendStatusMar (int);
extern void ArgusSendClosingMar (int, unsigned char);
extern void ArgusOutputProcess(void);
extern void *ArgusClientProcess(struct ArgusClientData *, struct ArgusWfileStruct *);
extern int getArgusLfd(void);
extern void setArgusLfd(int);
extern char *getArgusWfile(void);
extern void setArgusWfile(char *, char *);
extern int getArgusPortNum(void);
extern struct timeval *getArgusMarReportInterval(void);
extern void setArgusPortNum(int, char *);
extern void setArgusMarReportInterval(char *);
extern void ArgusCheckClientStatus (void);
extern int ArgusEstablishListen(int, char *, char *);
extern int ArgusTcpWrapper (int, struct sockaddr *);
extern void ArgusCloseSocket (int);
extern void ArgusCloseClients (void);
extern void ArgusUsr1Sig (int);
extern void ArgusUsr2Sig (int);
extern void ArgusClientError(void);
extern void ArgusInitClientProcess(struct ArgusClientData *, struct ArgusWfileStruct *);
#endif
#endif /* #ifndef ArgusOutput_h */
|