def valueDecoder(self, fullSubstrate, substrate, asn1Spec, tagSet,
length, state, decodeFun, substrateFun):
head, tail = substrate[:length], substrate[length:]
r = self._createComponent(asn1Spec, tagSet)
if head:
raise error.PyAsn1Error('Unexpected %d-octet substrate for Null' % length)
return r, tail
python类Null()的实例源码
def valueDecoder(self, fullSubstrate, substrate, asn1Spec, tagSet,
length, state, decodeFun, substrateFun):
head, tail = substrate[:length], substrate[length:]
r = self._createComponent(asn1Spec, tagSet)
if head:
raise error.PyAsn1Error('Unexpected %d-octet substrate for Null' % length)
return r, tail
def valueDecoder(self, fullSubstrate, substrate, asn1Spec, tagSet,
length, state, decodeFun, substrateFun):
head, tail = substrate[:length], substrate[length:]
r = self._createComponent(asn1Spec, tagSet)
if head:
raise error.PyAsn1Error('Unexpected %d-octet substrate for Null' % length)
return r, tail
def valueDecoder(self, fullSubstrate, substrate, asn1Spec, tagSet,
length, state, decodeFun, substrateFun):
head, tail = substrate[:length], substrate[length:]
r = self._createComponent(asn1Spec, tagSet)
if head:
raise error.PyAsn1Error('Unexpected %d-octet substrate for Null' % length)
return r, tail
def valueDecoder(self, fullSubstrate, substrate, asn1Spec, tagSet,
length, state, decodeFun, substrateFun):
head, tail = substrate[:length], substrate[length:]
r = self._createComponent(asn1Spec, tagSet)
if head:
raise error.PyAsn1Error('Unexpected %d-octet substrate for Null' % length)
return r, tail
def valueDecoder(self, fullSubstrate, substrate, asn1Spec, tagSet,
length, state, decodeFun, substrateFun):
head, tail = substrate[:length], substrate[length:]
r = self._createComponent(asn1Spec, tagSet)
if head:
raise error.PyAsn1Error('Unexpected %d-octet substrate for Null' % length)
return r, tail
def _ValidateEmptyParams(self, params):
if params:
param_value, rest = decoder.decode(params)
if rest:
raise Asn1Error('Extra unparsed content.')
if param_value != univ.Null():
raise Asn1Error('Hasher has parameters. No idea what to do with them.')
def valueDecoder(self, fullSubstrate, substrate, asn1Spec, tagSet,
length, state, decodeFun, substrateFun):
head, tail = substrate[:length], substrate[length:]
r = self._createComponent(asn1Spec, tagSet)
if head:
raise error.PyAsn1Error('Unexpected %d-octet substrate for Null' % length)
return r, tail
def valueDecoder(self, fullSubstrate, substrate, asn1Spec, tagSet,
length, state, decodeFun, substrateFun):
head, tail = substrate[:length], substrate[length:]
r = self._createComponent(asn1Spec, tagSet)
if head:
raise error.PyAsn1Error('Unexpected %d-octet substrate for Null' % length)
return r, tail
def valueDecoder(self, fullSubstrate, substrate, asn1Spec, tagSet,
length, state, decodeFun, substrateFun):
head, tail = substrate[:length], substrate[length:]
r = self._createComponent(asn1Spec, tagSet)
if head:
raise error.PyAsn1Error('Unexpected %d-octet substrate for Null' % length)
return r, tail
def evaluateValue(self, oid, tag, value, **context):
# Variation module reference
if ':' in tag:
modName, tag = tag[tag.index(':')+1:], tag[:tag.index(':')]
else:
modName = None
if modName:
if ('variationModules' in context and
modName in context['variationModules']):
if 'dataValidation' in context:
return oid, tag, univ.Null
else:
if context['setFlag']:
hexvalue = self.grammar.hexifyValue(context['origValue'])
if hexvalue is not None:
context['hexvalue'] = hexvalue
context['hextag'] = self.grammar.getTagByType(context['origValue']) + 'x'
# prepare agent and record contexts on first reference
(variationModule,
agentContexts,
recordContexts) = context['variationModules'][modName]
if context['dataFile'] not in agentContexts:
agentContexts[context['dataFile']] = {}
if context['dataFile'] not in recordContexts:
recordContexts[context['dataFile']] = {}
variationModule['agentContext'] = agentContexts[context['dataFile']]
recordContexts = recordContexts[context['dataFile']]
if oid not in recordContexts:
recordContexts[oid] = {}
variationModule['recordContext'] = recordContexts[oid]
# invoke variation module
oid, tag, value = variationModule['variate'](oid, tag, value, **context)
else:
raise SnmpsimError('Variation module "%s" referenced but not loaded\r\n' % modName)
if not modName:
if 'dataValidation' in context:
snmprec.SnmprecRecord.evaluateValue(
self, oid, tag, value, **context
)
if (not context['nextFlag'] and not context['exactMatch'] or
context['setFlag']):
return context['origOid'], tag, context['errorStatus']
if not hasattr(value, 'tagSet'): # not already a pyasn1 object
return snmprec.SnmprecRecord.evaluateValue(
self, oid, tag, value, **context
)
return oid, tag, value