📄 asn_null.c
字号:
/* * asn_null.c - BER encode, decode, print and free routines for the * ASN.1 NULL type. * * MS 92 * Copyright (C) 1992 Michael Sample and the University of British Columbia * * This library is free software; you can redistribute it and/or * modify it provided that this copyright/license information is retained * in original form. * * If you modify this file, you must clearly indicate your changes. * * This source code 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. * */#if HAVE_CONFIG_H#include <config.h>#endif#include "asn_config.h"#include "asn_len.h"#include "asn_tag.h"#include "asn_null.h"/* * encodes universal TAG LENGTH and Contents of and ASN.1 NULL */AsnLenBEncAsnNull PARAMS((b, data),BUF_TYPE b _AND_AsnNull* data){ AsnLen len; len = BEncAsnNullContent(b, data); len += BEncDefLen(b, len); len += BEncTag1(b, UNIV, PRIM, NULLTYPE_TAG_CODE); return(len);} /* BEncAsnNull *//* * decodes universal TAG LENGTH and Contents of and ASN.1 NULL */voidBDecAsnNull PARAMS((b, result, bytesDecoded, env),BUF_TYPE b _AND_AsnNull* result _AND_AsnLen* bytesDecoded _AND_jmp_buf env){ AsnTag tag; AsnLen elmtLen; if ( (tag =BDecTag(b, bytesDecoded, env)) != MAKE_TAG_ID(UNIV, PRIM, NULLTYPE_TAG_CODE)) { Asn1Error("BDecAsnNull: ERROR wrong tag on NULL.\n"); longjmp(env, -40); } elmtLen = BDecLen (b, bytesDecoded, env); BDecAsnNullContent( b, tag, elmtLen, result, bytesDecoded, env);} /* BDecAsnNull */voidBDecAsnNullContent PARAMS((b, tagId, len, result, bytesDecoded, env),BUF_TYPE b _AND_AsnTag tagId _AND_AsnLen len _AND_AsnNull* result _AND_AsnLen* bytesDecoded _AND_jmp_buf env){ if ( len != 0) { Asn1Error("BDecAsnNullContent: ERROR - NULL type's len must be 0\n"); longjmp(env, -17); }} /* BDecAsnNullContent *//* * Prints the NULL value to the given FILE* in Value Notation. * ignores the indent. */voidPrintAsnNull PARAMS((f,v, indent),FILE* f _AND_AsnNull* v _AND_unsigned short int indent){ fprintf(f,"NULL");}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -