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

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

?? a_decode.c

?? 在freescale 的ne64上開發的源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
#include "snmptype.h"
#include "snmpdef.h"
#include "a_localio.h"

/****************************************************************************
NAME:  A_DecodeTypeValue

PURPOSE:  Decode the numeric part of an ASN.1 type from a stream.
          The data stream is read using the local I/O package.
          On exit, the stream poINT32er will be positioned to the byte
          *AFTER* the type.

NOTE:     The Class portion of the type is NOT decoded here, only the
          value portion.
          The user should call A_DecodeTypeClass *BEFORE* calling this
          routine in order to get the class.

PARAMETERS:  LCL_FILE *     A stream descriptor (already open)
             _INT16 *          Receives an error code, if any.

RETURNS:  _UINT16         The type value

RESTRICTIONS:  It is assumed that the stream does not reach EOF before the
                end of the field.
****************************************************************************/
_UINT16 A_DecodeTypeValue(LCL_FILE * lfile, _INT16 *errp)
{
	_UINT8 oct;

	oct = (_UINT8) (Lcl_Getc(lfile) & ~A_IDCF_MASK);

	if(Lcl_Eof(lfile))
	{
		*errp = AE_PREMATURE_END;
		return (_UINT16) 0;
	}

	if(oct != 0x1F)
	{							/* Are there extension bytes? */
		/* No extensions, type is in oct */
		return (_UINT16) oct;
	}
	else
	{							/* Type is in extension octets */
		_UINT16 t = 0;

		for(;;)
		{
			oct = (_UINT8) Lcl_Getc(lfile);
			if(Lcl_Eof(lfile))
			{
				*errp = AE_PREMATURE_END;
				return t;
			}
			if(!(oct & 0x80))
				break;			/* Hit final byte, we'll use */
			/* it at the end of the loop */

			t |= (_UINT16) (oct & 0x7F);	/* Deal with a non-final byte */
			t <<= 7;
		}
		t |= (_UINT16) oct;	/* Take care of the final byte (the one */
		/* without the 0x80 continuation bit.)  */
		return t;
	}
 /*NOTREACHED*/}

/****************************************************************************
NAME:  A_DecodeLength

PURPOSE:  Decode an ASN.1 length from a stream.
          The data stream is read using the local I/O package.
          On exit, the stream poINT32er will be positioned to the byte
          *AFTER* the length.

PARAMETERS:  LCL_FILE *     Stream descriptor
             _INT16 *          Receives an error code, if any.

RETURNS:  _UINT16 -- the length.
          If the length is indefinite, (_UINT16)-1 is returned.

RESTRICTIONS:  The stream must be open.
               It is assumed that the stream will not reach EOF before the
               length is decoded.
****************************************************************************/
_UINT16 A_DecodeLength(LCL_FILE * lfile, _INT16 *errp)
{
	_UINT8 oct=0;
	_UINT8 lsize=0;
	_UINT16 len = 0;
	oct = (_UINT8) Lcl_Getc(lfile);
	if(Lcl_Eof(lfile))
	{
		*errp = AE_PREMATURE_END;
		return (_UINT16) 0;
	}

	/* Indefinite form? */
	if(oct == 0x80)
	{
		*errp = AE_INDEFINITE_LENGTH;
		return (_UINT16) - 1;
	}

	if(!(oct & 0x80))			/* Short or long format? */
		return (_UINT16) oct;	/* Short format */
	else
	{							/* Long format */
		lsize = oct & (_UINT8) 0x7F;	/* Get # of bytes comprising length field */
		while(lsize-- != 0)
		{
			len <<= 8;
			len |= (_UINT8) Lcl_Getc(lfile);
			if(Lcl_Eof(lfile))
			{
				*errp = AE_PREMATURE_END;
				return (_UINT16) 0;
			}
		}
		return len;
	}
 /*NOTREACHED*/
}

/********************
A_DecodeOctetStringData

PURPOSE:  Pull an octet string from an ASN.1 stream.
          The data stream is read using the local I/O package.
          On entry stream poINT32er should be positioned to the first byte
          of the data field.
          On exit, the stream poINT32er will be positioned to at the start
          of the next ASN.1 type field.

Parameters:
        LCL_FILE *      Stream descriptor
        _UINT16       Length of octet string, from its ASN.1 header
        _UINT8 *     Control structure to receive the data.
        _INT16 *           Receives an error code, if any.

Returns: Nothing

Note:   On return, the "start_bp" component of the buffer structure
        poINT32s to a "malloc"-ed area in which the octet string is held.
        Note that the octet string is NOT null terminated, may contain
        INT32ernal nulls. A null poINT32er, (char *)0, is used if no area
        is malloc-ed.
        If the string is of zero length, a dummy buffer is established
        which appears to be have a static buffer of length zero at
        address zero.
********************/
void A_DecodeOctetStringData(LCL_FILE * stream, _UINT16 length, 
	_UINT8 * ebuffp, 
	_UINT16 maxEbuffLen, 
	_INT16 *errp)
{
	_UINT16 got;
	_UINT8 c;
	*errp=0;
	if((length != 0) && (length != (_UINT16) - 1))
	{
		if(length>maxEbuffLen) /*whr add*/
		{			
			(void)Lcl_Read(stream, ebuffp,maxEbuffLen);
			got=(length-maxEbuffLen);
			while(got > 0)
			{
				c=Lcl_Getc(stream);
				if(Lcl_Eof(stream))
					break;		
				--got;
			}
		}
		else
			got=Lcl_Read(stream, ebuffp, length);		
	}
}
/********************
A_DecodeOctetStringWTC

PURPOSE:  Pull an octet string from an ASN.1 stream.
          The data stream is read using the local I/O package.
          On entry stream poINT32er should be positioned to the first byte
          of the octet string's type field.
          This version does type checking.
          On exit, the stream poINT32er will be positioned to at the start
          of the next ASN.1 type field.

Parameters:
        LCL_FILE *      Stream descriptor
        _UINT8 *     Control structure to receive the data.
        _INT16 *           Receives an error code, if any.
        _UINT16       The type value
        _UINT8         A_IDC_MASK flag values

Returns: Nothing

Note:   On return, the "start_bp" component of the buffer structure
        poINT32s to a "malloc"-ed area in which the octet string is held.
        Note that the octet string is NOT null terminated, may contain
        INT32ernal nulls. A null poINT32er, (char *)0, is used if no area
        is malloc-ed.
********************/
void A_DecodeOctetStringWTC(LCL_FILE * stream,
					   _UINT8 * ebuffp, _UINT16 maxLen, 
					   _INT16 *errp, _UINT16 id, _UINT8 flags)
{
	_UINT16 os_length;

	if((A_DecodeTypeClass(stream) != flags) || (A_DecodeTypeValue(stream, errp) != id))
	{
		if(*errp == 0)
			*errp = AE_WRONG_TYPE;
		/* On a decoding error, pretend we have a zero length string */
		return;
	}
	os_length = A_DecodeLength(stream, errp);
	if(os_length>maxLen)
	{
		if(*errp == 0)
			*errp = AUTHORIZATION_ERROR;
		return;
	}
	if(*errp == 0)
	{
		A_DecodeOctetStringData(stream,os_length,ebuffp,maxLen,errp);
	}
}


/********************
A_DecodeIntegerData

PURPOSE:  Pull an INT32eger from an ASN.1 stream.
          The data stream is read using the local I/O package.
          On entry stream poINT32er should be positioned to the first byte
          of the data field.
          On exit, the stream poINT32er will be positioned to at the start
          of the next ASN.1 type field.

Parameters:
        LCL_FILE *      Stream descriptor
        _UINT16       Length of contents field, from the ASN.1 header
        _INT16 *           Receives an error code, if any.

Returns: _INT16       (See note below)

NOTE: If the received value is really unsigned, then the caller should
merely cast the value returned by this procedure to an _UINT32.

WARNING: If the INT32eger occupies more than 4 octets, then high order precision
will be lost, including the sign bit.  For unsigned values in which the
basic value occupies all 4 octets, the sign octet, containing a zero sign
bit, will be lost but will not damage the returned value.
********************/
_INT32 A_DecodeIntegerData(LCL_FILE * stream, _UINT16 length, _INT16 *errp)
{
	_INT32 ivalue = 0;
	_INT32 firstone = 1;
	_UINT8 oct;

	while(length-- != 0)
	{
		oct = (_UINT8) Lcl_Getc(stream);
		if(Lcl_Eof(stream))
		{
			*errp = AE_PREMATURE_END;
			return ivalue;
		}

		/* See whether we are receiving something that has the sign bit set, or
		 * if this is a 5 byte unsigned _INT32 check the first byte, it must be 0 */
		if(firstone)
		{
			firstone = 0;
			if((length == 4) && (oct != 0))
			{
				*errp = AE_WRONG_VALUE;
				return ivalue;
			}
			if(oct & (_UINT8) 0x80)
				ivalue = (_INT32) - 1;
		}
		/*lINT32 -e703    */
		ivalue <<= 8;
		/*lINT32 +e703    */
		ivalue |= oct;			/* 'oct' better not be sign extended!!! */
	}
	return ivalue;
}

/********************
A_DecodeIntegerWTC

PURPOSE:  Pull an INT32eger from an ASN.1 stream.
          The data stream is read using the local I/O package.
          On entry stream poINT32er should be positioned to the first byte
          of the INT32eger's ASN.1 type field.
          As we pull off the class and type we check them against
          the arguments to make sure they are correct.
          On exit, the stream poINT32er will be positioned to at the start
          of the next ASN.1 type field.

Parameters:
        LCL_FILE *      Stream descriptor
        _INT16 *           Receives an error code, if any.
        _UINT16       The type value
        _UINT8         A_IDC_MASK flag values

Returns: _INT32;
********************/
_INT32 A_DecodeIntegerWTC(LCL_FILE * stream, _INT16 *errp, _UINT16 id, _UINT8 flags)
{
	_UINT16 INT32_length;

	if((A_DecodeTypeClass(stream) != flags) || (A_DecodeTypeValue(stream, errp) != id))
	{
		if(*errp == 0)
			*errp = AE_WRONG_TYPE;
		return (0);
	}

	INT32_length = A_DecodeLength(stream, errp);
	if(*errp == 0)
	{
		if(INT32_length > 5)
			*errp = AE_WRONG_VALUE;
		else
			return A_DecodeIntegerData(stream, INT32_length, errp);
	}

	return (0);

}

/********************
A_DecodeObjectIdData

PURPOSE:  Pull an object identifier from an ASN.1 stream.
          The data stream is read using the local I/O package.
          On entry stream poINT32er should be positioned to the first byte
          of the data field.
          On exit, the stream poINT32er will be positioned to at the start
          of the next ASN.1 type field.

Parameters:
        LCL_FILE *      Stream descriptor
        _UINT16       Length of contents field, from the ASN.1 header
        OBJ_ID_T *      Object identifier structure to receive the object id.
                        The "component_list" will be "malloc"ed.
                        component_list == (_UINT32 *)0 indicates that
                        there is no component_list.
        _INT16 *           Receives an error code, if any.

Returns: Nothing
********************/
void A_DecodeObjectIdData(LCL_FILE * stream, _UINT16 length, OBJ_ID_T * objp, _INT16 *errp)
{
	_UINT16 content_offset;	/* Offset in stream where contents begins */
	_INT16 subids=0;
	_INT32 left;					/* Count of unused contents bytes */
	_UINT16 j=0;					/* Number of subidentifiers     */
	_INT16 subid_num;
	_UINT32 subid_val;			/* Value of a subidentifier */
	_UINT32 cp[MAX_OID_LENGTH];
	_UINT8 c, first_c;
	_INT16 subid_bytes;	/* number of bytes in this sub id */
	_INT16 subid_done;	/* flag to see if the sub id is finished */	
	objp->num_components = 0;
	(void)memset((_UINT8 *)(&cp[0]),0,sizeof(cp));
	/* Remember where the contents begins */
	content_offset = Lcl_Tell(stream);

	/* Count the number of components */
	for(subids = 0, left = (_INT32) length; left > 0;)
	{
		first_c = (_UINT8) Lcl_Getc(stream);
		if(Lcl_Eof(stream))
		{
			*errp = AE_PREMATURE_END;
			return;
		}
		left--;

		/* if its not the last (only) byte, step through the rest of the bytes */
		if(first_c & 0x80)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩大陆一区二区| 国产69精品久久久久毛片| 日本精品视频一区二区| 日韩一区在线免费观看| 精品伦理精品一区| 国产精品自拍毛片| 久久久久青草大香线综合精品| 国产精品一区二区男女羞羞无遮挡| 国产偷国产偷精品高清尤物| 成人午夜伦理影院| 亚洲另类春色国产| 欧美一区二区三区免费观看视频| 麻豆精品一区二区av白丝在线| 2020国产精品| 色又黄又爽网站www久久| 午夜影院在线观看欧美| 精品国产凹凸成av人网站| 成人影视亚洲图片在线| 亚洲国产综合91精品麻豆 | 成人黄色一级视频| 亚洲乱码精品一二三四区日韩在线| 欧美日韩成人综合| 国产精品一区二区不卡| 亚洲国产日韩av| 精品久久五月天| 91久久免费观看| 捆绑紧缚一区二区三区视频| 国产精品久久久久久久岛一牛影视| 一本大道久久精品懂色aⅴ| 免费观看在线综合| 日韩一区有码在线| 精品区一区二区| 色嗨嗨av一区二区三区| 精品亚洲欧美一区| 一区二区三区国产| 国产亚洲欧美一级| 欧美浪妇xxxx高跟鞋交| 国产成人在线视频网站| 日韩精品电影在线| 亚洲品质自拍视频| 日韩精品专区在线影院重磅| 日本久久一区二区| 国产精品伊人色| 日韩电影免费在线看| 亚洲黄色av一区| 久久久www免费人成精品| 欧美性色aⅴ视频一区日韩精品| 国产在线精品一区二区三区不卡| 亚洲综合自拍偷拍| 中文av一区特黄| 亚洲精品菠萝久久久久久久| xnxx国产精品| 欧美一二三区在线| 欧美亚洲动漫制服丝袜| av在线综合网| 国产宾馆实践打屁股91| 久久99这里只有精品| 亚洲国产裸拍裸体视频在线观看乱了| 日本一区二区在线不卡| 日韩欧美成人午夜| 欧美精品一卡二卡| 欧美色综合影院| 色偷偷久久一区二区三区| 成人午夜视频在线观看| 国产高清视频一区| 国产一区二区三区精品视频| 免费成人av资源网| 日本一道高清亚洲日美韩| 亚洲成在人线免费| 一区二区三区免费观看| 亚洲日本乱码在线观看| 亚洲欧洲国产日韩| 日韩一区日韩二区| 亚洲视频精选在线| 亚洲免费三区一区二区| 亚洲黄一区二区三区| 亚洲欧美日韩久久| 亚洲精品国产a久久久久久| 亚洲精品视频一区二区| 亚洲影视在线观看| 亚洲国产一区二区三区青草影视| 亚洲精品视频在线观看网站| 一区二区三区四区高清精品免费观看| 日韩毛片在线免费观看| 亚洲精品菠萝久久久久久久| 国产成人综合亚洲91猫咪| 国产乱子轮精品视频| 国产九色sp调教91| 成人动漫中文字幕| 色诱视频网站一区| 欧美日韩视频在线一区二区| 欧美精品日日鲁夜夜添| 日韩欧美美女一区二区三区| 精品国产伦一区二区三区免费 | 久久夜色精品一区| 国产精品美女久久久久久久网站| 国产精品免费人成网站| 亚洲乱码精品一二三四区日韩在线| 亚洲国产综合在线| 久久99国产精品免费网站| 国产成人亚洲精品狼色在线 | 色狠狠一区二区| 在线播放中文字幕一区| 精品国产成人系列| 综合久久国产九一剧情麻豆| 亚洲成人av在线电影| 韩国一区二区视频| av不卡在线观看| 91精品久久久久久蜜臀| 久久久久久一二三区| 一区二区三区日韩在线观看| 日本aⅴ精品一区二区三区| 国产91露脸合集magnet| 在线观看视频一区| 久久网站最新地址| 亚洲最新在线观看| 国产精品自拍av| 欧美视频一二三区| 国产欧美精品一区二区色综合朱莉| 亚洲丝袜美腿综合| 久久国产尿小便嘘嘘尿| 99久久国产综合色|国产精品| 欧美一级在线观看| 亚洲色欲色欲www| 激情五月激情综合网| 91黄色激情网站| 国产午夜一区二区三区| 午夜精品一区二区三区电影天堂| 国产999精品久久| 日韩欧美在线影院| 亚洲五月六月丁香激情| 成人伦理片在线| 亚洲精品一区二区三区蜜桃下载 | 精品美女在线播放| 国产乱子伦视频一区二区三区| 欧美亚洲一区二区在线| 国产精品美女久久久久久久久久久| 奇米色777欧美一区二区| 日本韩国精品一区二区在线观看| 久久久久国产免费免费| 日韩激情视频网站| 欧美午夜精品久久久久久孕妇| 国产精品无圣光一区二区| 美洲天堂一区二卡三卡四卡视频| 91精品福利在线| 国产精品欧美一区二区三区| 国产在线精品一区二区| 日韩精品一区二区三区老鸭窝 | 99re8在线精品视频免费播放| 日韩天堂在线观看| 亚洲网友自拍偷拍| 91成人国产精品| 亚洲人亚洲人成电影网站色| 国产一区二区在线影院| 欧美成人精品福利| 婷婷综合五月天| 欧美日韩午夜影院| 亚洲一卡二卡三卡四卡| 在线免费亚洲电影| 亚洲精品高清视频在线观看| 99久久婷婷国产综合精品| 国产精品萝li| 成人app网站| 国产精品久久免费看| 不卡的电影网站| 国产精品国产三级国产aⅴ无密码| 国产成人午夜精品5599| 国产亚洲一本大道中文在线| 国产在线一区二区综合免费视频| 精品国产乱码91久久久久久网站| 精品影院一区二区久久久| 日韩精品一区二区三区在线观看 | 国产精品久久影院| www.av精品| 亚洲综合一二区| 欧美亚洲一区三区| 日韩国产欧美在线视频| 日韩欧美国产一区二区在线播放| 蜜臀va亚洲va欧美va天堂| 欧美电视剧免费全集观看| 国产中文一区二区三区| 国产日韩欧美麻豆| 97精品视频在线观看自产线路二| |精品福利一区二区三区| 欧洲人成人精品| 午夜伊人狠狠久久| 精品精品欲导航| 不卡区在线中文字幕| 亚洲精品亚洲人成人网 | 国产成人av资源| 中文字幕佐山爱一区二区免费| 在线看一区二区| 蜜臀va亚洲va欧美va天堂| 国产日韩精品一区二区三区在线| 91亚洲精品久久久蜜桃网站| 亚洲444eee在线观看| 精品久久久久久久久久久久包黑料 | 欧美激情一区二区三区不卡| 日韩一区二区影院| 粉嫩av一区二区三区在线播放|