亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? asn1.c

?? eCos操作系統源碼
?? C
?? 第 1 頁 / 共 4 頁
字號:
//==========================================================================////      ./lib/current/src/asn1.c//////==========================================================================//####ECOSGPLCOPYRIGHTBEGIN####// -------------------------------------------// This file is part of eCos, the Embedded Configurable Operating System.// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.//// eCos is free software; you can redistribute it and/or modify it under// the terms of the GNU General Public License as published by the Free// Software Foundation; either version 2 or (at your option) any later version.//// eCos is distributed in the hope that it will be useful, but WITHOUT ANY// WARRANTY; without even the implied warranty of MERCHANTABILITY or// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License// for more details.//// You should have received a copy of the GNU General Public License along// with eCos; if not, write to the Free Software Foundation, Inc.,// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.//// As a special exception, if other files instantiate templates or use macros// or inline functions from this file, or you compile this file and link it// with other works to produce a work based on this file, this file does not// by itself cause the resulting work to be covered by the GNU General Public// License. However the source code for this file must still be made available// in accordance with section (3) of the GNU General Public License.//// This exception does not invalidate any other reasons why a work based on// this file might be covered by the GNU General Public License.//// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.// at http://sources.redhat.com/ecos/ecos-license/// -------------------------------------------//####ECOSGPLCOPYRIGHTEND####//####UCDSNMPCOPYRIGHTBEGIN####//// -------------------------------------------//// Portions of this software may have been derived from the UCD-SNMP// project,  <http://ucd-snmp.ucdavis.edu/>  from the University of// California at Davis, which was originally based on the Carnegie Mellon// University SNMP implementation.  Portions of this software are therefore// covered by the appropriate copyright disclaimers included herein.//// The release used was version 4.1.2 of May 2000.  "ucd-snmp-4.1.2"// -------------------------------------------////####UCDSNMPCOPYRIGHTEND####//==========================================================================//#####DESCRIPTIONBEGIN####//// Author(s):    hmt// Contributors: hmt// Date:         2000-05-30// Purpose:      Port of UCD-SNMP distribution to eCos.// Description:  //              ////####DESCRIPTIONEND####////==========================================================================/********************************************************************       Copyright 1989, 1991, 1992 by Carnegie Mellon University			  Derivative Work -Copyright 1996, 1998, 1999, 2000 The Regents of the University of California			 All Rights ReservedPermission to use, copy, modify and distribute this software and itsdocumentation for any purpose and without fee is hereby granted,provided that the above copyright notice appears in all copies andthat both that copyright notice and this permission notice appear insupporting documentation, and that the name of CMU and The Regents ofthe University of California not be used in advertising or publicitypertaining to distribution of the software without specific writtenpermission.CMU AND THE REGENTS OF THE UNIVERSITY OF CALIFORNIA DISCLAIM ALLWARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIEDWARRANTIES OF MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL CMU ORTHE REGENTS OF THE UNIVERSITY OF CALIFORNIA BE LIABLE FOR ANY SPECIAL,INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTINGFROM THE LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OFCONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR INCONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.*********************************************************************//* * Abstract Syntax Notation One, ASN.1 * As defined in ISO/IS 8824 and ISO/IS 8825 * This implements a subset of the above International Standards that * is sufficient to implement SNMP. * * Encodes abstract data types into a machine independent stream of bytes. * *//**********************************************************************	Copyright 1988, 1989, 1991, 1992 by Carnegie Mellon University                      All Rights ReservedPermission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and thatboth that copyright notice and this permission notice appear in supporting documentation, and that the name of CMU not beused in advertising or publicity pertaining to distribution of thesoftware without specific, written prior permission.  CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDINGALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALLCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES ORANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THISSOFTWARE.******************************************************************/#include <config.h>#ifdef KINETICS#include "gw.h"#endif#if HAVE_STRING_H#include <string.h>#else#include <strings.h>#endif#include <sys/types.h>#include <stdio.h>#ifdef HAVE_STDLIB_H#include <stdlib.h>#endif#if HAVE_WINSOCK_H#include <winsock.h>#endif#if HAVE_NETINET_IN_H#include <netinet/in.h>#endif#ifdef vms#include <in.h>#endif#if HAVE_DMALLOC_H#include <dmalloc.h>#endif#include "asn1.h"#include "int64.h"#include "snmp_debug.h"#include "mib.h"#ifndef NULL#define NULL	0#endif#include "snmp_api.h"#include "snmp_impl.h" /* to define ERROR_MSG */staticvoid _asn_size_err(const char *str, size_t wrongsize, size_t rightsize){    char ebuf[128];    sprintf(ebuf,"%s size %d: s/b %d",str, wrongsize, rightsize);    ERROR_MSG(ebuf);}staticvoid _asn_length_err(const char *str, size_t wrongsize, size_t rightsize){    char ebuf[128];    sprintf(ebuf,"%s length %d too large: exceeds %d",str, wrongsize, rightsize);    ERROR_MSG(ebuf);}/* * call after asn_parse_length to verify result. */staticint _asn_parse_length_check(const char *str,                   u_char *bufp, u_char *data,                   u_long plen, size_t dlen){    char ebuf[128];    size_t header_len;    if (bufp == NULL){	/* error message is set */	return 1;    }    header_len = bufp - data;    if (((size_t)plen + header_len) > dlen){	sprintf(ebuf, "%s: message overflow: %d len + %d delta > %d len",		str, (int)plen, (int)header_len, (int)dlen);	ERROR_MSG(ebuf);	return 1;    }    return 0;}/* * call after asn_build_header to verify result. */staticint _asn_build_header_check(const char *str, u_char *data,                      size_t datalen, size_t typedlen){    char ebuf[128];        if (data == NULL){	/* error message is set */	return 1;    }    if (datalen < typedlen){	sprintf(ebuf, "%s: bad header, length too short: %d < %d", str, datalen, typedlen);	ERROR_MSG(ebuf);	return 1;    }    return 0;}/* checks the incoming packet for validity and returns its size or 0 */intasn_check_packet (u_char *pkt, size_t len){  u_long asn_length;    if (len < 2)    return 0;      /* always too short */  if (*pkt != (u_char)(ASN_SEQUENCE | ASN_CONSTRUCTOR))    return -1;     /* wrong type */  if (*(pkt+1) & 0x80) {    /* long length */    if ((int)len < (int)(*(pkt+1) & ~0x80)+2)      return 0;    /* still to short, incomplete length */    asn_parse_length(pkt+1, &asn_length);    return (asn_length + 2 + (*(pkt+1) & ~0x80));  } else {    /* short length */    return (*(pkt+1) + 2);  }}staticint _asn_bitstring_check(const char * str, u_long asn_length, u_char datum){    char ebuf[128];    if (asn_length < 1){	sprintf(ebuf,"%s: length %d too small", str, (int)asn_length);	ERROR_MSG(ebuf);	return 1;    }    if (datum > 7){	sprintf(ebuf,"%s: datum %d >7: too large", str, (int)(datum));	ERROR_MSG(ebuf);	return 1;    }    return 0;}/* * asn_parse_int - pulls a long out of an ASN int type. *  On entry, datalength is input as the number of valid bytes following *   "data".  On exit, it is returned as the number of valid bytes *   following the end of this object. * *  Returns a pointer to the first byte past the end *   of this object (i.e. the start of the next object). *  Returns NULL on any error.  u_char * asn_parse_int(      u_char     *data         IN - pointer to start of object      int        *datalength   IN/OUT - number of valid bytes left in buffer      u_char     *type         OUT - asn type of object      long       *intp         IN/OUT - pointer to start of output buffer      int         intsize      IN - size of output buffer*/u_char *asn_parse_int(u_char *data,	      size_t *datalength,	      u_char *type,	      long *intp,	      size_t intsize){/* * ASN.1 integer ::= 0x02 asnlength byte {byte}* */    static const char *errpre = "parse int";    register u_char *bufp = data;    u_long	    asn_length;    register long   value = 0;    if (intsize != sizeof (long)){	_asn_size_err(errpre, intsize, sizeof(long));	return NULL;    }    *type = *bufp++;    bufp = asn_parse_length(bufp, &asn_length);    if (_asn_parse_length_check(errpre, bufp, data, asn_length, *datalength))	return NULL;    if ((size_t)asn_length > intsize){	_asn_length_err(errpre, (size_t)asn_length, intsize);	return NULL;    }    *datalength -= (int)asn_length + (bufp - data);    if (*bufp & 0x80)	value = -1; /* integer is negative */    DEBUGDUMPSETUP("dump_recv", data, bufp - data + asn_length);    while(asn_length--)	value = (value << 8) | *bufp++;    DEBUGMSG(("dump_recv", "  ASN Integer:\t%ld (0x%.2X)\n", value, value));    *intp = value;    return bufp;}/* * asn_parse_unsigned_int - pulls an unsigned long out of an ASN int type. *  On entry, datalength is input as the number of valid bytes following *   "data".  On exit, it is returned as the number of valid bytes *   following the end of this object. * *  Returns a pointer to the first byte past the end *   of this object (i.e. the start of the next object). *  Returns NULL on any error.  u_char * asn_parse_unsigned_int(      u_char     *data         IN - pointer to start of object      int        *datalength   IN/OUT - number of valid bytes left in buffer      u_char     *type         OUT - asn type of object      u_long     *intp         IN/OUT - pointer to start of output buffer      int         intsize      IN - size of output buffer */u_char *asn_parse_unsigned_int(u_char *data,		       size_t *datalength,		       u_char *type,		       u_long *intp,		       size_t intsize){/* * ASN.1 integer ::= 0x02 asnlength byte {byte}* */    static const char *errpre = "parse uint";    register u_char *bufp = data;    u_long	    asn_length;    register u_long value = 0;    if (intsize != sizeof (long)){	_asn_size_err(errpre, intsize, sizeof(long));	return NULL;    }    *type = *bufp++;    bufp = asn_parse_length(bufp, &asn_length);    if (_asn_parse_length_check(errpre, bufp, data, asn_length, *datalength))	return NULL;    if (((int)asn_length > (intsize + 1)) ||	(((int)asn_length == intsize + 1) && *bufp != 0x00)){	_asn_length_err(errpre, (size_t)asn_length, intsize);	return NULL;    }    *datalength -= (int)asn_length + (bufp - data);    if (*bufp & 0x80)	value = ~value; /* integer is negative */    DEBUGDUMPSETUP("dump_recv", data, bufp - data + asn_length);    while(asn_length--)	value = (value << 8) | *bufp++;    DEBUGMSG(("dump_recv", "  ASN UInteger:\t%ld (0x%.2X)\n", value, value));    *intp = value;    return bufp;}/* * asn_build_int - builds an ASN object containing an integer. *  On entry, datalength is input as the number of valid bytes following *   "data".  On exit, it is returned as the number of valid bytes *   following the end of this object. * *  Returns a pointer to the first byte past the end *   of this object (i.e. the start of the next object). *  Returns NULL on any error.  u_char * asn_build_int(      u_char     *data         IN - pointer to start of output buffer      int        *datalength   IN/OUT - number of valid bytes left in buffer      int         type         IN  - asn type of object      long       *intp         IN - pointer to start of long integer      int         intsize      IN - size of input buffer */u_char *asn_build_int(u_char *data,	      size_t *datalength,	      u_char type,	      long *intp,	      size_t intsize){/* * ASN.1 integer ::= 0x02 asnlength byte {byte}* */	static const char *errpre = "build int";    register long integer;    register u_long mask;    if (intsize != sizeof (long)){	_asn_size_err(errpre, intsize, sizeof(long));	return NULL;    }    integer = *intp;    /*     * Truncate "unnecessary" bytes off of the most significant end of this     * 2's complement integer.  There should be no sequence of 9     * consecutive 1's or 0's at the most significant end of the     * integer.     */    mask = ((u_long) 0x1FF) << ((8 * (sizeof(long) - 1)) - 1);    /* mask is 0xFF800000 on a big-endian machine */    while((((integer & mask) == 0) || ((integer & mask) == mask))	  && intsize > 1){	intsize--;	integer <<= 8;    }    data = asn_build_header(data, datalength, type, intsize);    if (_asn_build_header_check(errpre,data,*datalength,intsize))	return NULL;    *datalength -= intsize;    mask = ((u_long) 0xFF) << (8 * (sizeof(long) - 1));    /* mask is 0xFF000000 on a big-endian machine */    while(intsize--){	*data++ = (u_char)((integer & mask) >> (8 * (sizeof(long) - 1)));	integer <<= 8;    }    return data;}/* * asn_build_unsigned_int - builds an ASN object containing an integer. *  On entry, datalength is input as the number of valid bytes following *   "data".  On exit, it is returned as the number of valid bytes *   following the end of this object. * *  Returns a pointer to the first byte past the end *   of this object (i.e. the start of the next object). *  Returns NULL on any error.  u_char * asn_build_unsigned_int(      u_char     *data         IN - pointer to start of output buffer      int        *datalength   IN/OUT - number of valid bytes left in buffer      u_char      type         IN  - asn type of object      u_long     *intp         IN - pointer to start of long integer      int         intsize      IN - size of input buffer */u_char *asn_build_unsigned_int(u_char *data,		       size_t *datalength,		       u_char type,		       u_long *intp,		       size_t intsize){/* * ASN.1 integer ::= 0x02 asnlength byte {byte}* */	static const char *errpre = "build uint";    register u_long integer;    register u_long mask;    int add_null_byte = 0;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99久久伊人精品| 久久综合狠狠综合| 精品久久人人做人人爱| 综合久久国产九一剧情麻豆| 午夜天堂影视香蕉久久| 福利一区二区在线观看| 欧美绝品在线观看成人午夜影视| 国产欧美一二三区| 经典三级一区二区| 欧美精选在线播放| 亚洲激情图片qvod| 波多野洁衣一区| wwwwww.欧美系列| 日本不卡一区二区| 在线亚洲精品福利网址导航| 中文欧美字幕免费| 国产精品123区| 欧美精品一区二| 日本大胆欧美人术艺术动态| 欧美网站大全在线观看| 亚洲免费毛片网站| 91社区在线播放| 中文字幕一区二区三区四区不卡| 国产一区在线观看麻豆| 日韩视频免费观看高清在线视频| 亚洲午夜精品久久久久久久久| 成人av网址在线| 国产精品天美传媒| 成人激情电影免费在线观看| 国产女同互慰高潮91漫画| 国产成人精品亚洲午夜麻豆| 国产日产欧美一区二区三区| 国产成人一区二区精品非洲| 国产色一区二区| 成熟亚洲日本毛茸茸凸凹| 国产精品免费视频观看| 99久久国产免费看| 亚洲免费在线视频一区 二区| 91麻豆成人久久精品二区三区| 国产精品久久久久一区| youjizz国产精品| 亚洲人成影院在线观看| 91福利在线看| 婷婷成人综合网| 精品国产凹凸成av人导航| 韩国精品久久久| 国产精品萝li| 在线一区二区三区四区五区| 亚洲成人一区二区在线观看| 日韩三级视频中文字幕| 国产一区二区女| 亚洲色图视频网站| 欧美福利电影网| 韩国视频一区二区| 亚洲色图一区二区三区| 欧美高清视频一二三区| 久久91精品久久久久久秒播| 亚洲国产精品精华液ab| 欧美偷拍一区二区| 激情丁香综合五月| ●精品国产综合乱码久久久久| 欧美午夜片在线看| 激情久久久久久久久久久久久久久久| 欧美国产日韩在线观看| 欧美亚一区二区| 国产一区二区久久| 亚洲一区影音先锋| 国产人妖乱国产精品人妖| 欧美性极品少妇| 国产精品一区二区免费不卡| 亚洲久本草在线中文字幕| 日韩欧美亚洲国产另类| 97久久人人超碰| 麻豆国产精品777777在线| 综合色天天鬼久久鬼色| 精品国免费一区二区三区| 色婷婷亚洲婷婷| 国产成人亚洲综合a∨婷婷图片| 亚洲一区二区三区四区在线| 国产欧美精品日韩区二区麻豆天美| 一本色道久久综合狠狠躁的推荐| 精彩视频一区二区| 亚洲国产aⅴ成人精品无吗| 欧美国产成人精品| 欧美变态tickle挠乳网站| 在线观看亚洲一区| 成人av影视在线观看| 黑人巨大精品欧美一区| 性久久久久久久| 亚洲婷婷国产精品电影人久久| 精品成人a区在线观看| 欧美人xxxx| 欧美亚洲国产一卡| 92国产精品观看| 成人性生交大合| 国产一区二区看久久| 久久国内精品自在自线400部| 亚洲一区在线看| 尤物视频一区二区| 日韩一区有码在线| 中文字幕乱码一区二区免费| 久久久久九九视频| 精品国产91久久久久久久妲己| 欧美精选一区二区| 欧美日韩免费一区二区三区视频 | 丁香激情综合国产| 国产又粗又猛又爽又黄91精品| 青青草原综合久久大伊人精品| 亚洲午夜久久久久久久久电影院 | 国产亚洲一区二区三区| 欧美一级免费大片| 欧美日韩国产成人在线91 | 91美女在线看| 色噜噜狠狠成人网p站| 99久久99久久综合| 一本色道亚洲精品aⅴ| 91免费版在线看| 在线观看日韩高清av| 欧美色爱综合网| 欧美精品1区2区| 日韩小视频在线观看专区| 日韩午夜中文字幕| 久久久天堂av| 国产精品污污网站在线观看| 国产亚洲综合在线| 一区免费观看视频| 亚洲最新在线观看| 天使萌一区二区三区免费观看| 亚洲va天堂va国产va久| 日本午夜精品视频在线观看| 久久99久久精品欧美| 国产综合一区二区| 成人激情图片网| 欧美伊人精品成人久久综合97| 欧美日韩aaaaa| 日韩丝袜情趣美女图片| 国产天堂亚洲国产碰碰| 亚洲欧美一区二区三区极速播放 | 欧美二区在线观看| 久久久久久久一区| 亚洲女同ⅹxx女同tv| 亚洲福利视频一区二区| 久久99精品网久久| 波多野结衣中文字幕一区| 欧美伊人精品成人久久综合97| 欧美一区二区成人6969| 国产精品午夜久久| 日日夜夜免费精品视频| 国产成人综合在线播放| 91电影在线观看| 日韩欧美区一区二| 亚洲欧美怡红院| 美洲天堂一区二卡三卡四卡视频| 丁香六月综合激情| 欧美一级黄色大片| 亚洲欧美一区二区三区孕妇| 蜜臀91精品一区二区三区| 丁香啪啪综合成人亚洲小说| 欧美电影一区二区| 国产精品久久二区二区| 日韩av中文在线观看| av影院午夜一区| 精品久久久久久久久久久院品网| 成人免费在线视频| 国产一区二区三区免费播放| 欧美性感一类影片在线播放| 中文字幕国产一区二区| 久久精品国产亚洲a| 欧美性极品少妇| 国产精品欧美久久久久一区二区| 欧美a级一区二区| 一本色道久久综合精品竹菊| 日本一区二区三区dvd视频在线| 天天亚洲美女在线视频| 91小视频在线观看| 久久精品一区八戒影视| 六月丁香综合在线视频| 欧美日韩色综合| 亚洲精品免费在线播放| 成人精品免费看| 久久综合色一综合色88| 男女男精品网站| 欧美日韩国产精品成人| 亚洲综合在线视频| 91理论电影在线观看| 国产精品美女一区二区在线观看| 韩国欧美国产1区| 精品国产一区二区在线观看| 日韩电影免费在线看| 欧美老人xxxx18| 亚洲成av人综合在线观看| 91福利在线免费观看| 亚洲精品中文字幕乱码三区| va亚洲va日韩不卡在线观看| 国产精品欧美综合在线| 成人激情免费视频| 成人欧美一区二区三区黑人麻豆 | 1区2区3区精品视频| 成人激情动漫在线观看| 国产精品免费久久|