/* $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 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if INSTALL_SNARK_BSD_BPF #include #elif INSTALL_SNARK_BSD_NIT #include #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; }