asn2wrs.py: use BASE_VAL64_STRING and val64_string
When UINT64 contains value strings, in addition to using VALS64 to give the list of names, the type of the structure has to be val64_string and the display parameter has to be ORed with BASE_VAL64_STRING. Change-Id: I0a619c91027df1eaae8209ada816f45b85d6431d Reviewed-on: https://code.wireshark.org/review/31268 Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
dcf6a571b0
commit
c007afa7c2
@ -1202,8 +1202,9 @@ class EthCtx:
|
|||||||
if (use_ext):
|
if (use_ext):
|
||||||
self.eth_type[nm]['attr']['STRINGS'] = '&%s_ext' % (self.eth_vals_nm(nm))
|
self.eth_type[nm]['attr']['STRINGS'] = '&%s_ext' % (self.eth_vals_nm(nm))
|
||||||
else:
|
else:
|
||||||
if self.eth_type[nm]['val'].HasConstraint() and self.eth_type[nm]['val'].constr.Needs64b(self) \
|
if self.eth_type[nm]['val'].type == 'IntegerType' \
|
||||||
and self.eth_type[nm]['val'].type == 'IntegerType':
|
and self.eth_type[nm]['val'].HasConstraint() \
|
||||||
|
and self.eth_type[nm]['val'].constr.Needs64b(self):
|
||||||
self.eth_type[nm]['attr']['STRINGS'] = 'VALS64(%s)' % (self.eth_vals_nm(nm))
|
self.eth_type[nm]['attr']['STRINGS'] = 'VALS64(%s)' % (self.eth_vals_nm(nm))
|
||||||
else:
|
else:
|
||||||
self.eth_type[nm]['attr']['STRINGS'] = 'VALS(%s)' % (self.eth_vals_nm(nm))
|
self.eth_type[nm]['attr']['STRINGS'] = 'VALS(%s)' % (self.eth_vals_nm(nm))
|
||||||
@ -1319,6 +1320,12 @@ class EthCtx:
|
|||||||
use_vals_ext = self.eth_type[ethtype].get('vals_ext')
|
use_vals_ext = self.eth_type[ethtype].get('vals_ext')
|
||||||
if (use_vals_ext):
|
if (use_vals_ext):
|
||||||
attr['DISPLAY'] += '|BASE_EXT_STRING'
|
attr['DISPLAY'] += '|BASE_EXT_STRING'
|
||||||
|
if ethtype in self.type \
|
||||||
|
and self.type[ethtype]['attr'].get('STRINGS') == '$$' \
|
||||||
|
and self.eth_type[ethtype]['val'].type == 'IntegerType' \
|
||||||
|
and self.eth_type[ethtype]['val'].HasConstraint() \
|
||||||
|
and self.eth_type[ethtype]['val'].constr.Needs64b(self):
|
||||||
|
attr['DISPLAY'] += '|BASE_VAL64_STRING'
|
||||||
self.eth_hf[nm] = {'fullname' : fullname, 'pdu' : self.field[f]['pdu'],
|
self.eth_hf[nm] = {'fullname' : fullname, 'pdu' : self.field[f]['pdu'],
|
||||||
'ethtype' : ethtype, 'modified' : self.field[f]['modified'],
|
'ethtype' : ethtype, 'modified' : self.field[f]['modified'],
|
||||||
'attr' : attr.copy(),
|
'attr' : attr.copy(),
|
||||||
@ -1388,7 +1395,11 @@ class EthCtx:
|
|||||||
out += 'static '
|
out += 'static '
|
||||||
if (self.eth_type[tname]['export'] & EF_VALS) and (self.eth_type[tname]['export'] & EF_TABLE):
|
if (self.eth_type[tname]['export'] & EF_VALS) and (self.eth_type[tname]['export'] & EF_TABLE):
|
||||||
out += 'static '
|
out += 'static '
|
||||||
out += "const value_string %s[] = {\n" % (self.eth_vals_nm(tname))
|
if self.eth_type[tname]['val'].HasConstraint() and self.eth_type[tname]['val'].constr.Needs64b(self) \
|
||||||
|
and self.eth_type[tname]['val'].type == 'IntegerType':
|
||||||
|
out += "const val64_string %s[] = {\n" % (self.eth_vals_nm(tname))
|
||||||
|
else:
|
||||||
|
out += "const value_string %s[] = {\n" % (self.eth_vals_nm(tname))
|
||||||
for (val, id) in vals:
|
for (val, id) in vals:
|
||||||
if (has_enum):
|
if (has_enum):
|
||||||
vval = self.eth_enum_item(tname, id)
|
vval = self.eth_enum_item(tname, id)
|
||||||
@ -1633,7 +1644,11 @@ class EthCtx:
|
|||||||
fx.write("WS_DLL_PUBLIC ")
|
fx.write("WS_DLL_PUBLIC ")
|
||||||
else:
|
else:
|
||||||
fx.write("extern ")
|
fx.write("extern ")
|
||||||
fx.write("const value_string %s[];\n" % (self.eth_vals_nm(t)))
|
if self.eth_type[t]['val'].HasConstraint() and self.eth_type[t]['val'].constr.Needs64b(self) \
|
||||||
|
and self.eth_type[t]['val'].type == 'IntegerType':
|
||||||
|
fx.write("const val64_string %s[];\n" % (self.eth_vals_nm(t)))
|
||||||
|
else:
|
||||||
|
fx.write("const value_string %s[];\n" % (self.eth_vals_nm(t)))
|
||||||
else:
|
else:
|
||||||
fx.write(self.eth_type[t]['val'].eth_type_vals(t, self))
|
fx.write(self.eth_type[t]['val'].eth_type_vals(t, self))
|
||||||
for t in self.eth_export_ord: # functions
|
for t in self.eth_export_ord: # functions
|
||||||
@ -1790,7 +1805,11 @@ class EthCtx:
|
|||||||
if self.eth_type[t]['no_emit'] & EF_VALS:
|
if self.eth_type[t]['no_emit'] & EF_VALS:
|
||||||
pass
|
pass
|
||||||
elif self.eth_type[t]['user_def'] & EF_VALS:
|
elif self.eth_type[t]['user_def'] & EF_VALS:
|
||||||
fx.write("extern const value_string %s[];\n" % (self.eth_vals_nm(t)))
|
if self.eth_type[t]['val'].HasConstraint() and self.eth_type[t]['val'].constr.Needs64b(self) \
|
||||||
|
and self.eth_type[t]['val'].type == 'IntegerType':
|
||||||
|
fx.write("extern const val64_string %s[];\n" % (self.eth_vals_nm(t)))
|
||||||
|
else:
|
||||||
|
fx.write("extern const value_string %s[];\n" % (self.eth_vals_nm(t)))
|
||||||
elif (self.eth_type[t]['export'] & EF_VALS) and (self.eth_type[t]['export'] & EF_TABLE):
|
elif (self.eth_type[t]['export'] & EF_VALS) and (self.eth_type[t]['export'] & EF_TABLE):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user