📄 contbl.c
字号:
/* $Header: /usr/cvsroot/target/src/wrn/wm/demo/unxagent/sun/contbl.c,v 1.2 2001/11/09 21:49:01 josh 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 1988-1997 Epilogue Technology Corporation. * Copyright 1998 Integrated Systems, Inc. * All rights reserved. ****************************************************************************//* * $Log: contbl.c,v $ * Revision 1.2 2001/11/09 21:49:01 josh * unxagent demo path adjustment, first pass * * Revision 1.1.1.1 2001/11/05 17:49:16 tneale * Tornado shuffle * * Revision 7.6 2001/01/19 22:25:01 paul * Update copyright. * * Revision 7.5 2000/03/17 00:15:15 meister * Update copyright message * * Revision 7.4 1998/02/25 04:58:17 sra * Update copyrights. * * Revision 7.3 1997/03/20 06:54:06 sra * DFARS-safe copyright text. Zap! * * Revision 7.2 1997/02/25 10:58:16 sra * Update copyright notice, dust under the bed. * * Revision 7.1 1997/01/08 23:01:49 sar * Updated copyright and modified include files to use envoy/h as * appropriate * * Revision 7.0 1996/03/15 22:07:57 sar * Updated revision to 7.0 and copyright to 96 * * Revision 6.1 1995/11/01 01:03:00 sar * removed no_pp stuff * removed objidcmp as nobody should be using it anymore * * Revision 6.0 1995/05/31 21:49:41 sra * Release 6.0. * * Revision 5.2 1995/05/02 23:25:51 sar * Minor cleanup to make compilers happier. * * Revision 5.1 1995/03/21 19:36:16 sar * Added param.h for use in netbsd systems * * Revision 5.0 1994/05/16 16:20:43 sar * Updated revision to 5.0 and copyright to include 1994 * * Revision 4.0 1993/06/24 17:34:02 sar * Updated rev to 4.0 copyright to 93 * * Revision 3.2 1993/05/13 22:22:28 sar * Added some defines, includes (<sysent.h> <errno.h> <libc.h>), casts * (struct sockaddr *) and changed memfoo to MEMFOO and objidcmp to * llist_cmp to get rid of warnings from the compiler. * * Revision 3.1 1992/09/01 11:37:36 dab * Fixed up for Mach386 * * Revision 3.0 92/04/03 19:53:44 dab * Release 3.0 * * Revision 2.101 92/02/04 10:46:41 dab * Updated for release 3.0 of SNMP. * * Revision 2.100 92/02/03 16:46:06 dab * Generic unix SNMP agent. * * * Rev 2.0 31 Mar 1990 15:34:18 * Initial revision. * *//* [clearcase]modification history-------------------01a,19apr05,job update copyright notices*/#include <stdio.h>#include <time.h>#include <wrn/wm/snmp/engine/asn1.h>#include <wrn/wm/snmp/engine/snmp.h>#include <wrn/wm/snmp/engine/auxfuncs.h>#include <sys/param.h>#include <sys/types.h>#include <sys/socket.h>#include <net/route.h>#include <netinet/in.h>#include <net/if.h>#include <netinet/if_ether.h>#include <netinet/in_systm.h>#include <netinet/ip.h>#include <netinet/ip_var.h>#include <netinet/in_pcb.h>#include <netinet/udp.h>#include <netinet/udp_var.h>#include "snmpvars.h"#include "general.h"void read_ct(struct inpcb **cp, off_t kernel_start_loc){ struct inpcb *cur_cp; off_t kcp; /* this is actually an in-kernel pointer */ struct inpcb tmp_cb; if (*cp) { /* Free up current connection list */ for (cur_cp = *cp; cur_cp;) { struct inpcb *next_cp; next_cp = cur_cp->inp_next; free(cur_cp); cur_cp = next_cp; } *cp = 0; } /* Read connection table from kernel. */ read_bytes((off_t)kernel_start_loc, (char *)&tmp_cb, sizeof(tmp_cb)); kcp = (off_t)(tmp_cb.inp_next); while (1) { *cp = (struct inpcb *)malloc(sizeof(struct inpcb)); read_bytes((off_t)kcp, (char *)*cp, sizeof(struct inpcb)); kcp = (off_t)((*cp)->inp_next); if (kcp == kernel_start_loc) { (*cp)->inp_next = 0; break; } cp = &((*cp)->inp_next); }}#if 0/* This is a general utility routine which does an unspeakable thing *//* to a target IP address. */struct in_addr frungulate(int tcount, OIDC_T *tlist){ struct in_addr targ_ip; targ_ip.s_addr = 0L; if (tcount > 0) { targ_ip.S_un.S_un_b.s_b1 = (unsigned char)tlist[0]; if (tcount > 1) { targ_ip.S_un.S_un_b.s_b2 = (unsigned char)tlist[1]; if (tcount > 2){ targ_ip.S_un.S_un_b.s_b3 = (unsigned char)tlist[2]; if (tcount > 3) targ_ip.S_un.S_un_b.s_b4 = (unsigned char)tlist[3]; } } } return targ_ip;}int ip_to_rlist(struct in_addr ip, OIDC_T *rlist){ rlist[0] = (OIDC_T)ip.S_un.S_un_b.s_b1; rlist[1] = (OIDC_T)ip.S_un.S_un_b.s_b2; rlist[2] = (OIDC_T)ip.S_un.S_un_b.s_b3; rlist[3] = (OIDC_T)ip.S_un.S_un_b.s_b4; return 4;}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -