📄 testgen.c
字号:
/* * Copyright 2000-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 1993-1997 Epilogue Technology Corporation. * Copyright 1998 Integrated Systems, Inc. * All rights reserved. *//* * $Log: testgen.c,v $ * Revision 1.2 2001/11/06 21:20:38 josh * revised new path hacking * * Revision 1.1.1.1 2001/11/05 17:47:45 tneale * Tornado shuffle * * Revision 9.1 2000/03/17 00:19:54 meister * Update copyright message * * Revision 9.0 1998/10/16 22:12:58 sar * Update version stamp to match release * * Revision 8.2 1998/06/05 18:53:32 sra * "#include <foo.h>" => "#include <envoy/h/foo.h>". * * Revision 8.1 1998/02/25 04:53:34 sra * Update copyrights. * * Revision 8.0 1997/11/18 00:57:14 sar * Updated revision to 8.0 * * Revision 7.2 1997/03/20 06:49:44 sra * DFARS-safe copyright text. Zap! * * Revision 7.1 1997/02/25 10:49:26 sra * Update copyright notice, dust under the bed. * * Revision 7.0 1996/03/18 20:24:05 sar * Updated rev to 7.0 and copyright to 96 * * Revision 6.1 1995/11/01 00:38:58 sar * added pp style argument lists * repaginated * * Revision 6.0 1995/05/31 21:49:29 sra * Release 6.0. * * Revision 5.1 1994/10/28 19:39:45 sar * Cleaned up print_pkt routine a little, also got rid of the "then" crap. * * Revision 5.0 1994/05/16 17:21:18 sar * Updated revision to 5.0 and copyright to include 1994 * * Revision 4.0 1993/06/24 17:53:56 sar * Updated rev to 4.0 and copyright to 93 * *//* [clearcase]modification history-------------------01b,19apr05,job update copyright notices01a,24nov03,job update copyright information*/#include <stdio.h>#if defined(CORELEFT)#include <alloc.h>#endif#include <wrn/wm/snmp/engine/snmp.h>#include <wrn/wm/snmp/engine/buildpkt.h>extern void print_pkt __((SNMP_PKT_T *rp));char community[] = "public";OIDC_T entrprz[] = {1, 3, 7, 128, 224, 10, 5, 15, 31, 63, 127, 255, 512};unsigned char ipaddr[] = {128, 224, 10, 5};int main(int argc, char **argv){unsigned char *cp;SNMP_PKT_T *rcvd_pkt;EBUFFER_T ebuff;int i, rcode;#if defined(MEMAVL)printf("Memavail=%u\n", _memavl());#endif#if defined(CORELEFT)printf("Memavail=%u\n", coreleft());#endifrcvd_pkt = SNMP_Create_Trap(VERSION_RFC1067, sizeof(community) - 1, community, sizeof(entrprz)/sizeof(OIDC_T), entrprz, ipaddr, COLD_START, 0, (UINT_32_T)32765, 0);EBufferInitialize(&ebuff);rcode = SNMP_Encode_Packet(rcvd_pkt, &ebuff);printf("rcode=%d\n", rcode);print_pkt(rcvd_pkt);SNMP_Free(rcvd_pkt);#define PRBUFF#if defined(PRBUFF)printf("Buffer contains %d bytes.\n", EBufferUsed(&ebuff));for (i = 0, cp = ebuff.start_bp; cp != ebuff.next_bp; i++, cp++) { printf("%02.2X ", *cp); if (i > 23) { i = 0; putchar('\n'); } }putchar('\n');#endifSNMP_memory_free(ebuff.start_bp);#if defined(MEMAVL)printf("Memavail=%u\n", _memavl());#endif#if defined(CORELEFT)printf("Memavail=%u\n", coreleft());#endifexit(0);return(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -