⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 snmp_att.c

📁 wm PNE 3.3 source code, running at more than vxworks6.x version.
💻 C
字号:
/* $Header: /usr/cvsroot/target/src/wrn/wm/demo/lib/snmp_att.c,v 1.3 2003/01/15 14:04:35 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 1998 Integrated Systems, Inc. *  All rights reserved. ****************************************************************************//* * $Log: snmp_att.c,v $ * Revision 1.3  2003/01/15 14:04:35  josh * directory structure shifting * * Revision 1.2  2001/11/08 15:56:26  tneale * Updated for newest file layout * * Revision 1.1.1.1  2001/11/05 17:48:43  tneale * Tornado shuffle * * Revision 1.4  2001/01/19 22:23:52  paul * Update copyright. * * Revision 1.3  2000/03/17 00:12:45  meister * Update copyright message * * Revision 1.2  1998/07/06 01:04:56  sar * Add some casts and change atoi to strtol to make compilers happy * * Revision 1.1  1998/06/07 02:40:06  sar * Move the validate and timing routines to the snark library * so they can be used by multiple demos * *//* [clearcase]modification history-------------------01a,19apr05,job  update copyright notices*/#include <wrn/wm/common/install.h>#include <wrn/wm/common/config.h>#include <wrn/wm/common/types.h>#include <wrn/wm/demo/snmpfunc.h>#include <wrn/wm/snmp/engine/asn1conf.h>#include <wrn/wm/snmp/engine/snmpdefs.h>#include <wrn/wm/snmp/engine/buffer.h>#include <wrn/wm/snmp/engine/proxy_tr.h>#if INSTALL_ATTACHE#include <wrn/wm/attache/udp.h>#if INSTALL_ATTACHE_DNS#include <wrn/wm/attache/dns.h>extern struct dns_config domain_config;#endif#endif#include <wrn/wm/common/glue.h>#if INSTALL_ENVOY_SNMP_PROXY#if INSTALL_ATTACHE/****************************************************************************NAME:  proxy_dns_wonPURPOSE:  Routine to send a packet after a dns lookup for a proxyPARAMETERS: RETURNS: void         ****************************************************************************/void  proxy_dns_won(struct dns_query *query,		char             *dname,		int               n,		inaddr_t          addrs[],		void             *cookie){TRANS_STUFF_T *trans_stuff = cookie;  /* send the packet */if (n)    udp_send_to((packet *)trans_stuff->pkt, addrs[0], trans_stuff->port, 161);SNMP_memory_free(trans_stuff);}/****************************************************************************NAME:  proxy_dns_errPURPOSE:  Routine to cleanup after a filed dns lookup for a proxyPARAMETERS:RETURNS: void         ****************************************************************************/void  proxy_dns_err(struct dns_query *query,		enum dns_error    error,		void             *cookie){TRANS_STUFF_T *trans_stuff = cookie;  /* just cleanup everything */udp_free((packet *)trans_stuff->pkt);SNMP_memory_free(trans_stuff);}/****************************************************************************NAME:  attache_proxy_send_rtnPURPOSE:  Routine to attempt to transmit a byte string for proxiesPARAMETERS:        EBUFFER_T *     The buffer to send        PTR_T           Information as to where to send the buffer.RETURNS: INT_32_T       A reasonable timeout period for this transport         ****************************************************************************/INT_32_T   attache_proxy_send_rtn(EBUFFER_T   *ebuf,			 PTR_T       cookie){packet *pkt;TRANS_STUFF_T *tstuff_cp, *tstuff = (TRANS_STUFF_T *)cookie;/* create a new trans stuff block to pass through the dns query */tstuff_cp =  (TRANS_STUFF_T *)SNMP_memory_alloc(sizeof(TRANS_STUFF_T) +				     STRLEN((char *)(tstuff->addr_str)) + 1);if (tstuff_cp == 0)    return(0);/* fill it in, we zero the proxy block stuff as we aren't using it here */MEMSET(&tstuff_cp->pblockp, 0, sizeof(PROXY_BLOCK_T));tstuff_cp->addr_str = ((bits8_t *)tstuff) + sizeof(TRANS_STUFF_T);(void) STRCPY((char *)(tstuff_cp->addr_str), (char *)(tstuff->addr_str));tstuff_cp->port = tstuff->port;/* create the udp packet to send and attach it to the trans stuff struct */if ((pkt = udp_alloc(EBufferUsed(ebuf), 0)) == 0) {    SNMP_memory_free(tstuff_cp);    return(0);    }MEMCPY(pkt->pkt_data, EBufferStart(ebuf), EBufferUsed(ebuf));tstuff_cp->pkt = (ptr_t)pkt;  /* send the name to the dns to be resolved, the won option   will send the packet, the err option will clean up the packet */  dns_name_to_address((char *)(tstuff_cp->addr_str), proxy_dns_won,		    proxy_dns_err, &domain_config, 0, tstuff_cp);  return(1000);}#endif /* INSTALL_ATTACHE */#endif /* (INSTALL_ENVOY_SNMP_PROXY) */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -