original files of m241

This commit is contained in:
neelimap
2026-07-30 11:19:44 +05:30
parent 170c2b3f3a
commit afc7070c1f
12254 changed files with 7655111 additions and 0 deletions
@@ -0,0 +1,125 @@
/* $Header: /usr/cvsroot/target/src/wrn/wm/demo/lib/collect.c,v 1.2 2001/11/08 15:56:21 tneale Exp $ */
/*
* Copyright (C) 1999-2005 Wind River Systems, Inc.
* All rights reserved. Provided under license only.
* Distribution or other use of this software is only
* permitted pursuant to the terms of a license agreement
* from Wind River Systems (and is otherwise prohibited).
* Refer to that license agreement for terms of use.
*/
/****************************************************************************
* Copyright 1996-1997 Epilogue Technology Corporation.
* Copyright 1998 Integrated Systems, Inc.
* All rights reserved.
****************************************************************************/
/*
* $Log: collect.c,v $
* Revision 1.2 2001/11/08 15:56:21 tneale
* Updated for newest file layout
*
* Revision 1.1.1.1 2001/11/05 17:48:41 tneale
* Tornado shuffle
*
* Revision 2.5 2001/01/19 22:23:40 paul
* Update copyright.
*
* Revision 2.4 2000/03/17 00:12:37 meister
* Update copyright message
*
* Revision 2.3 1998/02/25 04:57:23 sra
* Update copyrights.
*
* Revision 2.2 1997/11/21 00:06:23 josh
* updating files for Liaison support for NIT
*
* Revision 2.1 1997/11/04 16:11:30 josh
* Adding Liaison support files
*
*/
/* [clearcase]
modification history
-------------------
01a,19apr05,job update copyright notices
*/
#include <stdio.h>
#include <stdlib.h>
#include <wrn/wm/attache/config.h>
#include <wrn/wm/attache/mib.h>
#include <wrn/wm/attache/timer.h>
#include <wrn/wm/attache/packet.h>
#include <wrn/wm/attache/net.h>
#include <wrn/wm/attache/glue.h>
#include <wrn/wm/attache/route.h>
#include <wrn/wm/attache/ip.h>
#include <wrn/wm/attache/udp.h>
#include <wrn/wm/attache/dns.h>
#include <wrn/wm/attache/loop.h>
#include <liaison/hrmon/rmonapi.h>
#include <wrn/wm/demo/read_ini.h>
#include <wrn/wm/demo/parse.h>
#include <snark/lib/netconf.h>
#if INSTALL_SNARK_BSD_BPF
#include <snark/lib/bpf.h>
#elif INSTALL_SNARK_BSD_NIT
#include <snark/lib/nit.h>
#endif
/* This file contains routines to run the packet collector for Liaison
* RMON.
*/
extern int liaison_collectors[];
void snark_process_collected_pkt(unsigned char *pktp,
unsigned caplen,
unsigned datalen,
void *cookie)
{
int i;
int bpfdev = *((int *)cookie);
/* Quick sanity check */
if (!(caplen == datalen))
return;
/* Figure out the interface number and then call Liaison
* to process the packet.
*/
for (i = 1; i < 17; i++)
{
if (liaison_collectors[i] == bpfdev)
{
rmon_process_packet(pktp, i, datalen, datalen,
XMIB_IF_TYPE_ET, FALSE, FALSE);
break;
}
}
}
void snark_liaison_collect(int bpfdev, void *cookie)
{
int errno;
#if INSTALL_SNARK_BSD_BPF
errno = bpf_read(bpfdev, 1514, snark_process_collected_pkt, cookie);
#elif INSTALL_SNARK_BSD_NIT
errno = nit_read(bpfdev, 1514, snark_process_collected_pkt, cookie);
#endif
return;
}