Handle FT_CHAR, and report unsupported types as such.

FT_CHAR is straightforward to support.

Split the list of "invalid" types into a list of "unsupported" types and
a short list of "invalid" types, containing FT_PCRE (which isn't a valid
type for a field) and "everything else".  Add FT_IEEE_11073_SFLOAT and
FT_IEEE_11073_FLOAT to the "unsupported" list.

Flag the whole unsupported list as just "not handled yet".

Change-Id: I62d2d7eead53377e4e601594a035b4395fdbeead
Reviewed-on: https://code.wireshark.org/review/18979
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2016-11-28 19:16:55 -08:00
parent a222812787
commit 0cb44e4277
1 changed files with 12 additions and 4 deletions

View File

@ -373,6 +373,7 @@ WSLUA_CONSTRUCTOR ProtoField_new(lua_State* L) {
}
}
break;
case FT_CHAR:
case FT_UINT8:
case FT_UINT16:
case FT_UINT24:
@ -384,7 +385,10 @@ WSLUA_CONSTRUCTOR ProtoField_new(lua_State* L) {
case FT_INT32:
case FT_INT64:
if (base == BASE_NONE) {
base = BASE_DEC; /* Default base for integer */
if (type == FT_CHAR)
base = BASE_OCT; /* default base for characters (BASE_HEX instead?) */
else
base = BASE_DEC; /* Default base for integer */
} else if (base < BASE_DEC || base > BASE_HEX_DEC) {
WSLUA_OPTARG_ERROR(ProtoField_new,BASE,"Base must be either base.DEC, base.HEX, base.OCT,"
" base.DEC_HEX, base.DEC_HEX or base.HEX_DEC");
@ -458,18 +462,22 @@ WSLUA_CONSTRUCTOR ProtoField_new(lua_State* L) {
return 0;
}
break;
/* TODO: new in 1.99 and not handled yet */
/* TODO: not handled yet */
case FT_UINT40:
case FT_UINT48:
case FT_UINT56:
case FT_INT40:
case FT_INT48:
case FT_INT56:
/* older but not supported yet (or maybe ever) */
case FT_IEEE_11073_SFLOAT:
case FT_IEEE_11073_FLOAT:
case FT_UINT_STRING:
case FT_PCRE:
case FT_AX25:
case FT_STRINGZPAD:
WSLUA_ARG_ERROR(ProtoField_new,TYPE,"Unsupported ProtoField field type");
break;
/* FT_PCRE isn't a valid field type. */
case FT_PCRE:
default:
WSLUA_ARG_ERROR(ProtoField_new,TYPE,"Invalid ProtoField field type");
break;