aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--asn1/h450/packet-h450-template.c8
-rw-r--r--epan/dissectors/packet-h225.c28
-rw-r--r--epan/dissectors/packet-h235.c4
-rw-r--r--epan/dissectors/packet-h245.c8
-rw-r--r--epan/dissectors/packet-h450.c14
-rw-r--r--epan/dissectors/packet-per.c24
-rw-r--r--epan/dissectors/packet-per.h4
-rw-r--r--epan/dissectors/packet-t38.c2
-rwxr-xr-xtools/asn2eth.py80
9 files changed, 102 insertions, 70 deletions
diff --git a/asn1/h450/packet-h450-template.c b/asn1/h450/packet-h450-template.c
index 86068573a0..f7ad0511c5 100644
--- a/asn1/h450/packet-h450-template.c
+++ b/asn1/h450/packet-h450-template.c
@@ -377,7 +377,7 @@ dissect_h4501_ReturnResult_result(tvbuff_t *tvb, int offset, packet_info *pinfo,
{
tvbuff_t *result_tvb = NULL;
- offset=dissect_per_octet_string(tvb, offset, pinfo, tree, -1, -1, -1, &result_tvb);
+ offset=dissect_per_octet_string(tvb, offset, pinfo, tree, -1, NO_BOUND, NO_BOUND, &result_tvb);
if(tvb_length(result_tvb)){
switch (localOpcode) {
@@ -466,7 +466,7 @@ static int
dissect_h4501_parameter(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
/* TODO - decode return error parameter based on localErrorCode */
- offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h4501_parameter, -1, -1, NULL);
+ offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h4501_parameter, NO_BOUND, NO_BOUND, NULL);
return offset;
}
static const value_string localErrorCode_vals[] = {
@@ -679,13 +679,13 @@ dissect_h4501_argument(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree
/* TODO call oid dissector
* call_ber_oid_callback isn't realy apropriate ?
*/
- offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h4501_globalargument, -1, -1, NULL);
+ offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h4501_globalargument, NO_BOUND, NO_BOUND, NULL);
is_globalcode = FALSE;
return offset;
}
- offset=dissect_per_octet_string(tvb, offset, pinfo, tree, -1, -1, -1, &argument_tvb);
+ offset=dissect_per_octet_string(tvb, offset, pinfo, tree, -1, NO_BOUND, NO_BOUND, &argument_tvb);
if(tvb_length(argument_tvb)){
switch (localOpcode) {
diff --git a/epan/dissectors/packet-h225.c b/epan/dissectors/packet-h225.c
index 0e2b447723..11bc54f53b 100644
--- a/epan/dissectors/packet-h225.c
+++ b/epan/dissectors/packet-h225.c
@@ -2193,7 +2193,7 @@ dissect_h225_T_data(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tre
tvbuff_t *next_tvb = NULL;
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, &next_tvb);
+ NO_BOUND, NO_BOUND, &next_tvb);
if (next_tvb && tvb_length(next_tvb)) {
call_dissector((nsp_handle)?nsp_handle:data_handle, next_tvb, pinfo, tree);
@@ -2752,7 +2752,7 @@ static int dissect_routeCalltoSCN_item(tvbuff_t *tvb, int offset, packet_info *p
static int
dissect_h225_TBCD_STRING(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_per_restricted_character_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, "0123456789#*abc", strlen("0123456789#*abc"),
+ NO_BOUND, NO_BOUND, "0123456789#*abc", strlen("0123456789#*abc"),
NULL);
return offset;
@@ -4410,7 +4410,7 @@ dissect_h225_FastStart_item(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, p
char codec_str[50];
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, &value_tvb);
+ NO_BOUND, NO_BOUND, &value_tvb);
if (value_tvb && tvb_length(value_tvb)) {
dissect_h245_OpenLogicalChannelCodec(value_tvb, pinfo, tree, codec_str);
@@ -4658,7 +4658,7 @@ static int dissect_url(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree
static int
dissect_h225_H248SignalsDescriptor(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, NULL);
+ NO_BOUND, NO_BOUND, NULL);
return offset;
}
@@ -5231,7 +5231,7 @@ static int dissect_id(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree
static int
dissect_h225_OCTET_STRING(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, NULL);
+ NO_BOUND, NO_BOUND, NULL);
return offset;
}
@@ -5250,7 +5250,7 @@ static int dissect_messageNotUnderstood(tvbuff_t *tvb, int offset, packet_info *
static int
dissect_h225_IA5String(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_per_IA5String(tvb, offset, pinfo, tree, hf_index,
- -1, -1);
+ NO_BOUND, NO_BOUND);
return offset;
}
@@ -5263,7 +5263,7 @@ static int dissect_text(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tre
static int
dissect_h225_BMPString(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_per_BMPString(tvb, offset, pinfo, tree, hf_index,
- -1, -1);
+ NO_BOUND, NO_BOUND);
return offset;
}
@@ -5465,7 +5465,7 @@ dissect_h225_ParallelH245Control_item(tvbuff_t *tvb, int offset, packet_info *pi
tvbuff_t *h245_tvb = NULL;
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, &h245_tvb);
+ NO_BOUND, NO_BOUND, &h245_tvb);
next_tvb_add(&h245_list, h245_tvb, (h225_h245_in_tree)?tree:NULL, h245dg_handle);
@@ -6255,7 +6255,7 @@ dissect_h225_T_h4501SupplementaryService_item(tvbuff_t *tvb, int offset, packet_
tvbuff_t *h4501_tvb = NULL;
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, &h4501_tvb);
+ NO_BOUND, NO_BOUND, &h4501_tvb);
if (h4501_tvb && tvb_length(h4501_tvb)) {
call_dissector(h4501_handle, h4501_tvb, pinfo, tree);
@@ -6303,7 +6303,7 @@ dissect_h225_H245Control_item(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
tvbuff_t *h245_tvb = NULL;
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, &h245_tvb);
+ NO_BOUND, NO_BOUND, &h245_tvb);
next_tvb_add(&h245_list, h245_tvb, (h225_h245_in_tree)?tree:NULL, h245dg_handle);
@@ -6376,7 +6376,7 @@ dissect_h225_T_messageContent_item(tvbuff_t *tvb, int offset, packet_info *pinfo
tvbuff_t *next_tvb = NULL;
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, &next_tvb);
+ NO_BOUND, NO_BOUND, &next_tvb);
next_tvb_add(&tp_list, next_tvb, (h225_tp_in_tree)?tree:NULL, tp_handle);
@@ -6800,7 +6800,7 @@ static int dissect_timeToLive(tvbuff_t *tvb, int offset, packet_info *pinfo, pro
static int
dissect_h225_H248PackagesDescriptor(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, NULL);
+ NO_BOUND, NO_BOUND, NULL);
return offset;
}
@@ -6899,7 +6899,7 @@ static int dissect_integrity_item(tvbuff_t *tvb, int offset, packet_info *pinfo,
static int
dissect_h225_BIT_STRING(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_per_bit_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, FALSE);
+ NO_BOUND, NO_BOUND, FALSE);
return offset;
}
@@ -7202,7 +7202,7 @@ static int dissect_callCreditCapability(tvbuff_t *tvb, int offset, packet_info *
static int
dissect_h225_PrintableString(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_per_PrintableString(tvb, offset, pinfo, tree, hf_index,
- -1, -1);
+ NO_BOUND, NO_BOUND);
return offset;
}
diff --git a/epan/dissectors/packet-h235.c b/epan/dissectors/packet-h235.c
index cb9a36f03e..54e54267b9 100644
--- a/epan/dissectors/packet-h235.c
+++ b/epan/dissectors/packet-h235.c
@@ -276,7 +276,7 @@ static int dissect_keyDerivationOID(tvbuff_t *tvb, int offset, packet_info *pinf
static int
dissect_h235_OCTET_STRING(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, NULL);
+ NO_BOUND, NO_BOUND, NULL);
return offset;
}
@@ -681,7 +681,7 @@ static int dissect_sharedSecret(tvbuff_t *tvb, int offset, packet_info *pinfo, p
static int
dissect_h235_BIT_STRING(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_per_bit_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, FALSE);
+ NO_BOUND, NO_BOUND, FALSE);
return offset;
}
diff --git a/epan/dissectors/packet-h245.c b/epan/dissectors/packet-h245.c
index b3bf878401..631d95fcb9 100644
--- a/epan/dissectors/packet-h245.c
+++ b/epan/dissectors/packet-h245.c
@@ -2344,7 +2344,7 @@ dissect_h245_T_data(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tre
tvbuff_t *next_tvb = NULL;
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, &next_tvb);
+ NO_BOUND, NO_BOUND, &next_tvb);
if (next_tvb && tvb_length(next_tvb)) {
call_dissector((nsp_handle)?nsp_handle:data_handle, next_tvb, pinfo, tree);
@@ -5077,7 +5077,7 @@ static int dissect_t84(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree
static int
dissect_h245_OCTET_STRING(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, NULL);
+ NO_BOUND, NO_BOUND, NULL);
return offset;
}
@@ -18983,11 +18983,11 @@ void proto_register_h245(void) {
"TransparencyParameters/presentationOrder", HFILL }},
{ &hf_h245_offset_x,
{ "offset-x", "h245.offset_x",
- FT_UINT32, BASE_DEC, NULL, 0,
+ FT_INT32, BASE_DEC, NULL, 0,
"TransparencyParameters/offset-x", HFILL }},
{ &hf_h245_offset_y,
{ "offset-y", "h245.offset_y",
- FT_UINT32, BASE_DEC, NULL, 0,
+ FT_INT32, BASE_DEC, NULL, 0,
"TransparencyParameters/offset-y", HFILL }},
{ &hf_h245_scale_x,
{ "scale-x", "h245.scale_x",
diff --git a/epan/dissectors/packet-h450.c b/epan/dissectors/packet-h450.c
index 2885df4910..efb6a28441 100644
--- a/epan/dissectors/packet-h450.c
+++ b/epan/dissectors/packet-h450.c
@@ -987,7 +987,7 @@ dissect_h450_H4501SupplementaryService(tvbuff_t *tvb, int offset, packet_info *p
static int
dissect_h450_Notassignedlocalopcode(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, NULL);
+ NO_BOUND, NO_BOUND, NULL);
return offset;
}
@@ -1418,7 +1418,7 @@ static int dissect_extensionId(tvbuff_t *tvb, int offset, packet_info *pinfo, pr
static int
dissect_h450_ExtensionArgument(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, NULL);
+ NO_BOUND, NO_BOUND, NULL);
return offset;
}
@@ -1579,7 +1579,7 @@ static int dissect_nominatedInfo(tvbuff_t *tvb, int offset, packet_info *pinfo,
static int
dissect_h450_H225InformationElement(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
- -1, -1, NULL);
+ NO_BOUND, NO_BOUND, NULL);
return offset;
}
@@ -4179,7 +4179,7 @@ dissect_h4501_ReturnResult_result(tvbuff_t *tvb, int offset, packet_info *pinfo,
{
tvbuff_t *result_tvb = NULL;
- offset=dissect_per_octet_string(tvb, offset, pinfo, tree, -1, -1, -1, &result_tvb);
+ offset=dissect_per_octet_string(tvb, offset, pinfo, tree, -1, NO_BOUND, NO_BOUND, &result_tvb);
if(tvb_length(result_tvb)){
switch (localOpcode) {
@@ -4268,7 +4268,7 @@ static int
dissect_h4501_parameter(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
/* TODO - decode return error parameter based on localErrorCode */
- offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h4501_parameter, -1, -1, NULL);
+ offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h4501_parameter, NO_BOUND, NO_BOUND, NULL);
return offset;
}
static const value_string localErrorCode_vals[] = {
@@ -4481,13 +4481,13 @@ dissect_h4501_argument(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree
/* TODO call oid dissector
* call_ber_oid_callback isn't realy apropriate ?
*/
- offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h4501_globalargument, -1, -1, NULL);
+ offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h4501_globalargument, NO_BOUND, NO_BOUND, NULL);
is_globalcode = FALSE;
return offset;
}
- offset=dissect_per_octet_string(tvb, offset, pinfo, tree, -1, -1, -1, &argument_tvb);
+ offset=dissect_per_octet_string(tvb, offset, pinfo, tree, -1, NO_BOUND, NO_BOUND, &argument_tvb);
if(tvb_length(argument_tvb)){
switch (localOpcode) {
diff --git a/epan/dissectors/packet-per.c b/epan/dissectors/packet-per.c
index 0e6b70f78a..a6ecb567cd 100644
--- a/epan/dissectors/packet-per.c
+++ b/epan/dissectors/packet-per.c
@@ -311,7 +311,7 @@ DEBUG_ENTRY("dissect_per_restricted_character_string");
}
- if(min_len==-1){
+ if (min_len == NO_BOUND) {
min_len=0;
}
@@ -352,13 +352,13 @@ DEBUG_ENTRY("dissect_per_restricted_character_string");
if((min_len==max_len)&&(max_len<=2)){
byte_aligned=FALSE;
}
- if((max_len!=-1)&&(max_len<2)){
+ if ((max_len != NO_BOUND) && (max_len < 2)) {
byte_aligned=FALSE;
}
/* xx.x */
length=max_len;
- if(max_len==-1){
+ if (max_len == NO_BOUND) {
offset = dissect_per_length_determinant(tvb, offset, pinfo, tree, hf_per_octet_string_length, &length);
/* the unconstrained strings are always byte aligned (27.6.3)*/
byte_aligned=TRUE;
@@ -488,8 +488,8 @@ dissect_per_BMPString(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_t
}
- if(min_len==-1){
- min_len=0;
+ if (min_len == NO_BOUND) {
+ min_len = 0;
}
@@ -1275,7 +1275,7 @@ DEBUG_ENTRY("dissect_per_sequence");
/* 15 Encoding the bitstring type
- max_len or min_len == -1 means there is no lower/upper constraint
+ max_len or min_len == NO_BOUND means there is no lower/upper constraint
*/
guint32
@@ -1292,8 +1292,8 @@ DEBUG_ENTRY("dissect_per_bit_string");
return offset;
}
- if(min_len==-1) {
- min_len=0;
+ if (min_len == NO_BOUND) {
+ min_len = 0;
}
/* 15.9 if length is fixed and less than or equal to sixteen bits*/
@@ -1339,7 +1339,7 @@ DEBUG_ENTRY("dissect_per_bit_string");
}
/* 15.11 */
- if(max_len>0){
+ if (max_len != NO_BOUND) {
proto_item *pi;
offset=dissect_per_constrained_integer(tvb, offset, pinfo,
@@ -1372,7 +1372,7 @@ DEBUG_ENTRY("dissect_per_bit_string");
16.7
16.8
- max_len or min_len == -1 means there is no lower/upper constraint
+ max_len or min_len == NO_BOUND means there is no lower/upper constraint
hf_index can either be a FT_BYTES or an FT_STRING
*/
@@ -1391,8 +1391,8 @@ dissect_per_octet_string(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, prot
DEBUG_ENTRY("dissect_per_octet_string");
- if(min_len==-1){
- min_len=0;
+ if (min_len == NO_BOUND) {
+ min_len = 0;
}
if (max_len==0) { /* 16.5 if the length is 0 bytes there will be no encoding */
val_start = offset>>3;
diff --git a/epan/dissectors/packet-per.h b/epan/dissectors/packet-per.h
index a0856589a8..8deda0661d 100644
--- a/epan/dissectors/packet-per.h
+++ b/epan/dissectors/packet-per.h
@@ -40,6 +40,10 @@ typedef int (*per_callback)(tvbuff_t *, int, packet_info *, proto_tree *);
byteposition<<3 + bitposition
*/
+/* value for value and size constraints */
+#define NO_BOUND -1
+
+
/* values for extensions */
#define ASN1_NO_EXTENSIONS 0
#define ASN1_EXTENSION_ROOT 1
diff --git a/epan/dissectors/packet-t38.c b/epan/dissectors/packet-t38.c
index f076c87670..39d78edf8f 100644
--- a/epan/dissectors/packet-t38.c
+++ b/epan/dissectors/packet-t38.c
@@ -699,7 +699,7 @@ static int
dissect_t38_fec_data_item(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
offset=dissect_per_octet_string(tvb, offset, pinfo,
- tree, hf_t38_fec_data_item, -1, -1,
+ tree, hf_t38_fec_data_item, NO_BOUND, NO_BOUND,
NULL);
return offset;
}
diff --git a/tools/asn2eth.py b/tools/asn2eth.py
index 2954f624ed..063477179f 100755
--- a/tools/asn2eth.py
+++ b/tools/asn2eth.py
@@ -1820,9 +1820,9 @@ class Type (Node):
self.eth_reg_sub(nm, ectx)
def eth_get_size_constr(self):
- (minv, maxv, ext) = ('-1', '-1', 'FALSE')
+ (minv, maxv, ext) = ('NO_BOUND', 'NO_BOUND', 'FALSE')
if not self.HasConstraint():
- (minv, maxv, ext) = ('-1', '-1', 'FALSE')
+ (minv, maxv, ext) = ('NO_BOUND', 'NO_BOUND', 'FALSE')
elif self.constr.IsSize():
(minv, maxv, ext) = self.constr.GetSize()
elif (self.constr.type == 'Intersection'):
@@ -1832,6 +1832,14 @@ class Type (Node):
(minv, maxv, ext) = self.constr.subtype[1].GetSize()
return (minv, maxv, ext)
+ def eth_get_value_constr(self):
+ (minv, maxv, ext) = ('NO_BOUND', 'NO_BOUND', 'FALSE')
+ if not self.HasConstraint():
+ (minv, maxv, ext) = ('NO_BOUND', 'NO_BOUND', 'FALSE')
+ elif self.constr.IsValue():
+ (minv, maxv, ext) = self.constr.GetValue()
+ return (minv, maxv, ext)
+
def eth_type_vals(self, tname, ectx):
if self.eth_has_vals():
print "#Unhandled eth_type_vals('%s') in %s" % (tname, self.type)
@@ -1908,8 +1916,8 @@ class Constraint (Node):
return self.type == 'Size' and (self.subtype.type == 'SingleValue' or self.subtype.type == 'ValueRange')
def GetSize(self):
- minv = '-1'
- maxv = '-1'
+ minv = 'NO_BOUND'
+ maxv = 'NO_BOUND'
ext = 'FALSE'
if self.IsSize():
if self.subtype.type == 'SingleValue':
@@ -1924,6 +1932,44 @@ class Constraint (Node):
ext = 'FALSE'
return (minv, maxv, ext)
+ def IsValue(self):
+ return self.type == 'SingleValue' or self.type == 'ValueRange'
+
+ def GetValue(self):
+ minv = 'NO_BOUND'
+ maxv = 'NO_BOUND'
+ ext = 'FALSE'
+ if self.IsValue():
+ if self.type == 'SingleValue':
+ minv = self.subtype
+ maxv = self.subtype
+ else:
+ if self.subtype[0] == 'MIN':
+ minv = 'NO_BOUND'
+ else:
+ minv = self.subtype[0]
+ if self.subtype[1] == 'MAX':
+ maxv = 'NO_BOUND'
+ else:
+ maxv = self.subtype[1]
+ if str(minv).isdigit(): minv += 'U'
+ if str(maxv).isdigit(): maxv += 'U'
+ if hasattr(self, 'ext') and self.ext:
+ ext = 'TRUE'
+ else:
+ ext = 'FALSE'
+ return (minv, maxv, ext)
+
+ def IsNegativ(self):
+ def is_neg(sval):
+ return sval[0] == '-'
+ if self.type == 'SingleValue':
+ return is_neg(self.subtype)
+ elif self.type == 'ValueRange':
+ if self.subtype[0] == 'MIN': return True
+ return is_neg(self.subtype[0])
+ return FALSE
+
def IsPermAlph(self):
return self.type == 'From' and self.subtype.type == 'SingleValue'
@@ -3109,12 +3155,8 @@ class IntegerType (Type):
def eth_ftype(self, ectx):
if self.HasConstraint():
- if self.constr.type == 'SingleValue':
- if self.constr.subtype >= 0:
- return ('FT_UINT32', 'BASE_DEC')
- elif self.constr.type == 'ValueRange':
- if self.constr.subtype[0] >= 0:
- return ('FT_UINT32', 'BASE_DEC')
+ if not self.constr.IsNegativ():
+ return ('FT_UINT32', 'BASE_DEC')
return ('FT_INT32', 'BASE_DEC')
def eth_strings(self):
@@ -3140,22 +3182,8 @@ class IntegerType (Type):
def eth_type_default_pars(self, ectx, tname):
pars = Type.eth_type_default_pars(self, ectx, tname)
- if self.HasConstraint() and ((self.constr.type == 'SingleValue') or (self.constr.type == 'ValueRange')):
- if self.constr.type == 'SingleValue':
- minv = self.constr.subtype
- maxv = self.constr.subtype
- else:
- minv = self.constr.subtype[0]
- maxv = self.constr.subtype[1]
- if str(minv).isdigit(): minv += 'U'
- if str(maxv).isdigit(): maxv += 'U'
- if hasattr(self.constr, 'ext') and self.constr.ext:
- ext = 'TRUE'
- else:
- ext = 'FALSE'
- pars['MIN_VAL'] = minv
- pars['MAX_VAL'] = maxv
- pars['EXT'] = ext
+ if self.HasConstraint() and self.constr.IsValue():
+ (pars['MIN_VAL'], pars['MAX_VAL'], pars['EXT']) = self.eth_get_value_constr()
return pars
def eth_type_default_body(self, ectx, tname):