dfilter: Rename "unparsed" to "literal"

A literal value is a value that cannot be interpreted as a
registered protocol. An unparsed value can be a literal or
an identifier (protocol/field) according to context and the
current disambiguation rules.

Strictly literal here is to be understood to  mean "numeric
literal, including numeric arrays, but not strings or character
constants".
This commit is contained in:
João Valverde 2022-02-23 00:47:00 +00:00 committed by A Wireshark GitLab Utility
parent 6d520addd1
commit c4f9d8abda
20 changed files with 169 additions and 170 deletions

View File

@ -147,14 +147,13 @@ entity(E) ::= UNPARSED(U).
E = stnode_new(STTYPE_FIELD, hfinfo, df_lval_value(U));
}
else {
E = stnode_new_unparsed(df_lval_value(U), df_lval_value(U));
E = stnode_new_literal(df_lval_value(U), df_lval_value(U));
}
df_lval_free(U, FALSE);
}
entity(E) ::= LITERAL(S).
{
/* Literals are unparsed that do not get resolved to protocols/fields. */
E = stnode_new_unparsed(df_lval_value(S), df_lval_value(S));
E = stnode_new_literal(df_lval_value(S), df_lval_value(S));
df_lval_free(S, FALSE);
}
entity(E) ::= IDENTIFIER(F).

View File

@ -139,14 +139,14 @@ compatible_ftypes(ftenum_t a, ftenum_t b)
/* Gets an fvalue from a string, and sets the error message on failure. */
WS_RETNONNULL
static fvalue_t*
dfilter_fvalue_from_unparsed(dfwork_t *dfw, ftenum_t ftype, stnode_t *st,
dfilter_fvalue_from_literal(dfwork_t *dfw, ftenum_t ftype, stnode_t *st,
gboolean allow_partial_value, header_field_info *hfinfo_value_string)
{
fvalue_t *fv;
const char *s = stnode_data(st);
/* Don't set the error message if it's already set. */
fv = fvalue_from_unparsed(ftype, s, allow_partial_value,
fv = fvalue_from_literal(ftype, s, allow_partial_value,
dfw->error_message == NULL ? &dfw->error_message : NULL);
if (fv == NULL && hfinfo_value_string) {
/* check value_string */
@ -435,7 +435,7 @@ check_exists(dfwork_t *dfw, stnode_t *st_arg1)
/* This is OK */
break;
case STTYPE_STRING:
case STTYPE_UNPARSED:
case STTYPE_LITERAL:
case STTYPE_CHARCONST:
FAIL(dfw, "%s is neither a field nor a protocol name.",
stnode_todisplay(st_arg1));
@ -603,7 +603,7 @@ check_relation_LHS_FIELD(dfwork_t *dfw, test_op_t st_op,
hfinfo2->abbrev, ftype_pretty_name(ftype2));
}
}
else if (type2 == STTYPE_STRING || type2 == STTYPE_UNPARSED) {
else if (type2 == STTYPE_STRING || type2 == STTYPE_LITERAL) {
/* Skip incompatible fields */
while (hfinfo1->same_name_prev_id != -1 &&
((type2 == STTYPE_STRING && ftype1 != FT_STRING && ftype1!= FT_STRINGZ) ||
@ -616,7 +616,7 @@ check_relation_LHS_FIELD(dfwork_t *dfw, test_op_t st_op,
fvalue = dfilter_fvalue_from_string(dfw, ftype1, st_arg2, hfinfo1);
}
else {
fvalue = dfilter_fvalue_from_unparsed(dfw, ftype1, st_arg2, allow_partial_value, hfinfo1);
fvalue = dfilter_fvalue_from_literal(dfw, ftype1, st_arg2, allow_partial_value, hfinfo1);
}
stnode_replace(st_arg2, STTYPE_FVALUE, fvalue);
}
@ -691,7 +691,7 @@ check_relation_LHS_STRING(dfwork_t *dfw, test_op_t st_op _U_,
fvalue = dfilter_fvalue_from_string(dfw, ftype2, st_arg1, hfinfo2);
stnode_replace(st_arg1, STTYPE_FVALUE, fvalue);
}
else if (type2 == STTYPE_STRING || type2 == STTYPE_UNPARSED ||
else if (type2 == STTYPE_STRING || type2 == STTYPE_LITERAL ||
type2 == STTYPE_CHARCONST) {
/* Well now that's silly... */
FAIL(dfw, "Neither %s nor %s are field or protocol names.",
@ -724,7 +724,7 @@ check_relation_LHS_STRING(dfwork_t *dfw, test_op_t st_op _U_,
}
static void
check_relation_LHS_UNPARSED(dfwork_t *dfw, test_op_t st_op _U_,
check_relation_LHS_LITERAL(dfwork_t *dfw, test_op_t st_op _U_,
FtypeCanFunc can_func, gboolean allow_partial_value,
stnode_t *st_node,
stnode_t *st_arg1, stnode_t *st_arg2)
@ -749,10 +749,10 @@ check_relation_LHS_UNPARSED(dfwork_t *dfw, test_op_t st_op _U_,
stnode_todisplay(st_node));
}
fvalue = dfilter_fvalue_from_unparsed(dfw, ftype2, st_arg1, allow_partial_value, hfinfo2);
fvalue = dfilter_fvalue_from_literal(dfw, ftype2, st_arg1, allow_partial_value, hfinfo2);
stnode_replace(st_arg1, STTYPE_FVALUE, fvalue);
}
else if (type2 == STTYPE_STRING || type2 == STTYPE_UNPARSED ||
else if (type2 == STTYPE_STRING || type2 == STTYPE_LITERAL ||
type2 == STTYPE_CHARCONST) {
/* Well now that's silly... */
FAIL(dfw, "Neither %s nor %s are field or protocol names.",
@ -761,7 +761,7 @@ check_relation_LHS_UNPARSED(dfwork_t *dfw, test_op_t st_op _U_,
}
else if (type2 == STTYPE_RANGE) {
check_drange_sanity(dfw, st_arg2);
fvalue = dfilter_fvalue_from_unparsed(dfw, FT_BYTES, st_arg1, allow_partial_value, NULL);
fvalue = dfilter_fvalue_from_literal(dfw, FT_BYTES, st_arg1, allow_partial_value, NULL);
stnode_replace(st_arg1, STTYPE_FVALUE, fvalue);
}
else if (type2 == STTYPE_FUNCTION) {
@ -775,7 +775,7 @@ check_relation_LHS_UNPARSED(dfwork_t *dfw, test_op_t st_op _U_,
funcdef->name, ftype_pretty_name(ftype2), stnode_todisplay(st_node));
}
fvalue = dfilter_fvalue_from_unparsed(dfw, ftype2, st_arg1, allow_partial_value, NULL);
fvalue = dfilter_fvalue_from_literal(dfw, ftype2, st_arg1, allow_partial_value, NULL);
stnode_replace(st_arg1, STTYPE_FVALUE, fvalue);
}
else {
@ -812,7 +812,7 @@ check_relation_LHS_CHARCONST(dfwork_t *dfw, test_op_t st_op _U_,
fvalue = dfilter_fvalue_from_charconst(dfw, ftype2, st_arg1);
stnode_replace(st_arg1, STTYPE_FVALUE, fvalue);
}
else if (type2 == STTYPE_STRING || type2 == STTYPE_UNPARSED ||
else if (type2 == STTYPE_STRING || type2 == STTYPE_LITERAL ||
type2 == STTYPE_CHARCONST) {
/* Well now that's silly... */
FAIL(dfw, "Neither %s nor %s are field or protocol names.",
@ -880,8 +880,8 @@ check_relation_LHS_RANGE(dfwork_t *dfw, test_op_t st_op,
fvalue = dfilter_fvalue_from_string(dfw, FT_BYTES, st_arg2, NULL);
stnode_replace(st_arg2, STTYPE_FVALUE, fvalue);
}
else if (type2 == STTYPE_UNPARSED) {
fvalue = dfilter_fvalue_from_unparsed(dfw, FT_BYTES, st_arg2, allow_partial_value, NULL);
else if (type2 == STTYPE_LITERAL) {
fvalue = dfilter_fvalue_from_literal(dfw, FT_BYTES, st_arg2, allow_partial_value, NULL);
stnode_replace(st_arg2, STTYPE_FVALUE, fvalue);
}
else if (type2 == STTYPE_CHARCONST) {
@ -965,8 +965,8 @@ check_relation_LHS_FUNCTION(dfwork_t *dfw, test_op_t st_op,
fvalue = dfilter_fvalue_from_string(dfw, ftype1, st_arg2, NULL);
stnode_replace(st_arg2, STTYPE_FVALUE, fvalue);
}
else if (type2 == STTYPE_UNPARSED) {
fvalue = dfilter_fvalue_from_unparsed(dfw, ftype1, st_arg2, allow_partial_value, NULL);
else if (type2 == STTYPE_LITERAL) {
fvalue = dfilter_fvalue_from_literal(dfw, ftype1, st_arg2, allow_partial_value, NULL);
stnode_replace(st_arg2, STTYPE_FVALUE, fvalue);
}
else if (type2 == STTYPE_CHARCONST) {
@ -1034,8 +1034,8 @@ check_relation(dfwork_t *dfw, test_op_t st_op,
check_relation_LHS_RANGE(dfw, st_op, can_func,
allow_partial_value, st_node, st_arg1, st_arg2);
break;
case STTYPE_UNPARSED:
check_relation_LHS_UNPARSED(dfw, st_op, can_func,
case STTYPE_LITERAL:
check_relation_LHS_LITERAL(dfw, st_op, can_func,
allow_partial_value, st_node, st_arg1, st_arg2);
break;
case STTYPE_CHARCONST:
@ -1059,15 +1059,15 @@ check_relation_contains(dfwork_t *dfw, stnode_t *st_node,
LOG_NODE(st_node);
/* Protocol can only be on LHS for "contains".
* Check to see if protocol is on RHS, and re-interpret it as UNPARSED
* Check to see if protocol is on RHS, and re-interpret it as LITERAL
* instead. The subsequent functions will parse it according to the
* existing rules for unparsed unquoted strings.
* existing rules for literal unquoted strings.
*
* This catches the case where the user has written "fc" on the RHS,
* probably intending a byte value rather than the fibre channel
* protocol, or similar for a number of other possibilities
* ("dc", "ff", "fefd"), and also catches the case where the user
* has written a generic string on the RHS. (The now unparsed value
* has written a generic string on the RHS. (The now literal value
* will be interpreted in a way that matches the LHS; e.g.
* FT_PROTOCOL and FT_BYTES fields expect byte arrays whereas
* FT_STRING[Z][PAD] fields expect strings.)
@ -1079,11 +1079,11 @@ check_relation_contains(dfwork_t *dfw, stnode_t *st_node,
if (stnode_type_id(st_arg2) == STTYPE_FIELD) {
header_field_info *hfinfo = stnode_data(st_arg2);
if (hfinfo->type == FT_PROTOCOL) {
/* Send it through as unparsed and all the other
/* Send it through as literal and all the other
* functions will take care of it as if it didn't
* match a protocol string.
*/
stnode_replace(st_arg2, STTYPE_UNPARSED, g_strdup(hfinfo->abbrev));
stnode_replace(st_arg2, STTYPE_LITERAL, g_strdup(hfinfo->abbrev));
}
}
@ -1101,7 +1101,7 @@ check_relation_contains(dfwork_t *dfw, stnode_t *st_node,
TRUE, st_node, st_arg1, st_arg2);
break;
case STTYPE_STRING:
case STTYPE_UNPARSED:
case STTYPE_LITERAL:
case STTYPE_CHARCONST:
FAIL(dfw, "%s is not a valid operand for contains.", stnode_todisplay(st_arg1));
break;
@ -1150,7 +1150,7 @@ check_relation_matches(dfwork_t *dfw, stnode_t *st_node,
TRUE, st_node, st_arg1, st_arg2);
break;
case STTYPE_STRING:
case STTYPE_UNPARSED:
case STTYPE_LITERAL:
case STTYPE_CHARCONST:
FAIL(dfw, "Matches requires a field-like value on the left side.");
break;

View File

@ -40,9 +40,9 @@ sttype_register_string(void)
string_tostr
};
static sttype_t unparsed_type = {
STTYPE_UNPARSED,
"UNPARSED",
static sttype_t literal_type = {
STTYPE_LITERAL,
"LITERAL",
NULL,
string_free,
string_dup,
@ -50,7 +50,7 @@ sttype_register_string(void)
};
sttype_register(&string_type);
sttype_register(&unparsed_type);
sttype_register(&literal_type);
}
/*

View File

@ -171,10 +171,10 @@ stnode_new_string(const char *str, char *token)
}
stnode_t *
stnode_new_unparsed(const char *str, char *token)
stnode_new_literal(const char *str, char *token)
{
char *value = dfilter_literal_normalized(str);
return stnode_new(STTYPE_UNPARSED, value, token);
return stnode_new(STTYPE_LITERAL, value, token);
}
stnode_t *

View File

@ -22,7 +22,7 @@
typedef enum {
STTYPE_UNINITIALIZED,
STTYPE_TEST,
STTYPE_UNPARSED,
STTYPE_LITERAL,
STTYPE_STRING,
STTYPE_CHARCONST,
STTYPE_FIELD,
@ -111,7 +111,7 @@ stnode_t *
stnode_new_string(const char *str, char *token);
stnode_t *
stnode_new_unparsed(const char *str, char *token);
stnode_new_literal(const char *str, char *token);
stnode_t *
stnode_new_charconst(unsigned long number, char *token);

View File

@ -169,7 +169,7 @@ bytes_from_string(fvalue_t *fv, const char *s, gchar **err_msg _U_)
}
GByteArray *
byte_array_from_unparsed(const char *s, gchar **err_msg)
byte_array_from_literal(const char *s, gchar **err_msg)
{
GByteArray *bytes;
gboolean res;
@ -198,11 +198,11 @@ byte_array_from_unparsed(const char *s, gchar **err_msg)
}
static gboolean
bytes_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
bytes_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
{
GByteArray *bytes;
bytes = byte_array_from_unparsed(s, err_msg);
bytes = byte_array_from_literal(s, err_msg);
if (bytes == NULL)
return FALSE;
@ -248,14 +248,14 @@ bytes_from_charconst(fvalue_t *fv, unsigned long num, gchar **err_msg)
}
static gboolean
ax25_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
ax25_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
{
/*
* Don't request an error message if bytes_from_unparsed fails;
* Don't request an error message if bytes_from_literal fails;
* if it does, we'll report an error specific to this address
* type.
*/
if (bytes_from_unparsed(fv, s, TRUE, NULL)) {
if (bytes_from_literal(fv, s, TRUE, NULL)) {
if (fv->value.bytes->len > FT_AX25_ADDR_LEN) {
if (err_msg != NULL) {
*err_msg = ws_strdup_printf("\"%s\" contains too many bytes to be a valid AX.25 address.",
@ -311,14 +311,14 @@ ax25_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, gc
}
static gboolean
vines_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
vines_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
{
/*
* Don't request an error message if bytes_from_unparsed fails;
* Don't request an error message if bytes_from_literal fails;
* if it does, we'll report an error specific to this address
* type.
*/
if (bytes_from_unparsed(fv, s, TRUE, NULL)) {
if (bytes_from_literal(fv, s, TRUE, NULL)) {
if (fv->value.bytes->len > FT_VINES_ADDR_LEN) {
if (err_msg != NULL) {
*err_msg = ws_strdup_printf("\"%s\" contains too many bytes to be a valid Vines address.",
@ -345,14 +345,14 @@ vines_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, g
}
static gboolean
ether_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
ether_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
{
/*
* Don't request an error message if bytes_from_unparsed fails;
* Don't request an error message if bytes_from_literal fails;
* if it does, we'll report an error specific to this address
* type.
*/
if (bytes_from_unparsed(fv, s, TRUE, NULL)) {
if (bytes_from_literal(fv, s, TRUE, NULL)) {
if (fv->value.bytes->len > FT_ETHER_LEN) {
if (err_msg != NULL) {
*err_msg = ws_strdup_printf("\"%s\" contains too many bytes to be a valid Ethernet address.",
@ -379,7 +379,7 @@ ether_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, g
}
static gboolean
oid_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
oid_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
{
GByteArray *bytes;
gboolean res;
@ -392,7 +392,7 @@ oid_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_,
* we'll log a message.
*/
/* do not try it as '.' is handled as valid separator for hexbytes :( */
if (bytes_from_unparsed(fv, s, TRUE, NULL)) {
if (bytes_from_literal(fv, s, TRUE, NULL)) {
return TRUE;
}
#endif
@ -414,7 +414,7 @@ oid_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_,
}
static gboolean
rel_oid_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
rel_oid_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
{
GByteArray *bytes;
gboolean res;
@ -436,14 +436,14 @@ rel_oid_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value
}
static gboolean
system_id_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
system_id_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
{
/*
* Don't request an error message if bytes_from_unparsed fails;
* Don't request an error message if bytes_from_literal fails;
* if it does, we'll report an error specific to this address
* type.
*/
if (bytes_from_unparsed(fv, s, TRUE, NULL)) {
if (bytes_from_literal(fv, s, TRUE, NULL)) {
if (fv->value.bytes->len > MAX_SYSTEMID_LEN) {
if (err_msg != NULL) {
*err_msg = ws_strdup_printf("\"%s\" contains too many bytes to be a valid OSI System-ID.",
@ -463,14 +463,14 @@ system_id_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_valu
}
static gboolean
fcwwn_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
fcwwn_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
{
/*
* Don't request an error message if bytes_from_unparsed fails;
* Don't request an error message if bytes_from_literal fails;
* if it does, we'll report an error specific to this address
* type.
*/
if (bytes_from_unparsed(fv, s, TRUE, NULL)) {
if (bytes_from_literal(fv, s, TRUE, NULL)) {
if (fv->value.bytes->len > FT_FCWWN_LEN) {
if (err_msg != NULL) {
*err_msg = ws_strdup_printf("\"%s\" contains too many bytes to be a valid FCWWN.",
@ -572,7 +572,7 @@ ftype_register_bytes(void)
0, /* wire_size */
bytes_fvalue_new, /* new_value */
bytes_fvalue_free, /* free_value */
bytes_from_unparsed, /* val_from_unparsed */
bytes_from_literal, /* val_from_literal */
bytes_from_string, /* val_from_string */
bytes_from_charconst, /* val_from_charconst */
bytes_to_repr, /* val_to_string_repr */
@ -596,7 +596,7 @@ ftype_register_bytes(void)
0, /* wire_size */
bytes_fvalue_new, /* new_value */
bytes_fvalue_free, /* free_value */
bytes_from_unparsed, /* val_from_unparsed */
bytes_from_literal, /* val_from_literal */
NULL, /* val_from_string */
NULL, /* val_from_charconst */
bytes_to_repr, /* val_to_string_repr */
@ -620,7 +620,7 @@ ftype_register_bytes(void)
FT_AX25_ADDR_LEN, /* wire_size */
bytes_fvalue_new, /* new_value */
bytes_fvalue_free, /* free_value */
ax25_from_unparsed, /* val_from_unparsed */
ax25_from_literal, /* val_from_literal */
NULL, /* val_from_string */
NULL, /* val_from_charconst */
bytes_to_repr, /* val_to_string_repr */
@ -644,7 +644,7 @@ ftype_register_bytes(void)
FT_VINES_ADDR_LEN, /* wire_size */
bytes_fvalue_new, /* new_value */
bytes_fvalue_free, /* free_value */
vines_from_unparsed, /* val_from_unparsed */
vines_from_literal, /* val_from_literal */
NULL, /* val_from_string */
NULL, /* val_from_charconst */
bytes_to_repr, /* val_to_string_repr */
@ -668,7 +668,7 @@ ftype_register_bytes(void)
FT_ETHER_LEN, /* wire_size */
bytes_fvalue_new, /* new_value */
bytes_fvalue_free, /* free_value */
ether_from_unparsed, /* val_from_unparsed */
ether_from_literal, /* val_from_literal */
NULL, /* val_from_string */
NULL, /* val_from_charconst */
bytes_to_repr, /* val_to_string_repr */
@ -692,7 +692,7 @@ ftype_register_bytes(void)
0, /* wire_size */
bytes_fvalue_new, /* new_value */
bytes_fvalue_free, /* free_value */
oid_from_unparsed, /* val_from_unparsed */
oid_from_literal, /* val_from_literal */
NULL, /* val_from_string */
NULL, /* val_from_charconst */
oid_to_repr, /* val_to_string_repr */
@ -716,7 +716,7 @@ ftype_register_bytes(void)
0, /* wire_size */
bytes_fvalue_new, /* new_value */
bytes_fvalue_free, /* free_value */
rel_oid_from_unparsed, /* val_from_unparsed */
rel_oid_from_literal, /* val_from_literal */
NULL, /* val_from_string */
NULL, /* val_from_charconst */
rel_oid_to_repr, /* val_to_string_repr */
@ -740,7 +740,7 @@ ftype_register_bytes(void)
0, /* wire_size */
bytes_fvalue_new, /* new_value */
bytes_fvalue_free, /* free_value */
system_id_from_unparsed, /* val_from_unparsed */
system_id_from_literal, /* val_from_literal */
NULL, /* val_from_string */
NULL, /* val_from_charconst */
system_id_to_repr, /* val_to_string_repr */
@ -764,7 +764,7 @@ ftype_register_bytes(void)
FT_FCWWN_LEN, /* wire_size */
bytes_fvalue_new, /* new_value */
bytes_fvalue_free, /* free_value */
fcwwn_from_unparsed, /* val_from_unparsed */
fcwwn_from_literal, /* val_from_literal */
NULL, /* val_from_string */
NULL, /* val_from_charconst */
bytes_to_repr, /* val_to_string_repr */

View File

@ -35,7 +35,7 @@ value_get_floating(fvalue_t *fv)
}
static gboolean
val_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
val_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
{
char *endptr = NULL;
@ -106,7 +106,7 @@ ftype_register_double(void)
0, /* wire_size */
double_fvalue_new, /* new_value */
NULL, /* free_value */
val_from_unparsed, /* val_from_unparsed */
val_from_literal, /* val_from_literal */
NULL, /* val_from_string */
NULL, /* val_from_charconst */
float_val_to_repr, /* val_to_string_repr */
@ -130,7 +130,7 @@ ftype_register_double(void)
0, /* wire_size */
double_fvalue_new, /* new_value */
NULL, /* free_value */
val_from_unparsed, /* val_from_unparsed */
val_from_literal, /* val_from_literal */
NULL, /* val_from_string */
NULL, /* val_from_charconst */
double_val_to_repr, /* val_to_string_repr */

View File

@ -67,7 +67,7 @@ get_guid(const char *s, e_guid_t *guid)
}
static gboolean
guid_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
guid_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
{
e_guid_t guid;
@ -104,7 +104,7 @@ ftype_register_guid(void)
GUID_LEN, /* wire_size */
NULL, /* new_value */
NULL, /* free_value */
guid_from_unparsed, /* val_from_unparsed */
guid_from_literal, /* val_from_literal */
NULL, /* val_from_string */
NULL, /* val_from_charconst */
guid_to_repr, /* val_to_string_repr */

View File

@ -42,7 +42,7 @@ sfloat_ieee_11073_fvalue_new(fvalue_t *fv)
}
static gboolean
sfloat_ieee_11073_val_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg _U_)
sfloat_ieee_11073_val_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg _U_)
{
const char *i_char = s;
char c;
@ -467,7 +467,7 @@ float_ieee_11073_fvalue_new(fvalue_t *fv)
}
static gboolean
float_ieee_11073_val_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg _U_)
float_ieee_11073_val_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg _U_)
{
const char *i_char = s;
char c;
@ -905,7 +905,7 @@ Example: 114 is 0x0072
sfloat_ieee_11073_fvalue_new, /* new_value */
NULL, /* free_value */
sfloat_ieee_11073_val_from_unparsed, /* val_from_unparsed */
sfloat_ieee_11073_val_from_literal, /* val_from_literal */
NULL, /* val_from_string */
NULL, /* val_from_charconst */
sfloat_ieee_11073_val_to_repr, /* val_to_string_repr */
@ -956,7 +956,7 @@ Example: 36.4 is 0xFF00016C
float_ieee_11073_fvalue_new, /* new_value */
NULL, /* free_value */
float_ieee_11073_val_from_unparsed, /* val_from_unparsed */
float_ieee_11073_val_from_literal, /* val_from_literal */
NULL, /* val_from_string */
NULL, /* val_from_charconst */
float_ieee_11073_val_to_repr, /* val_to_string_repr */

View File

@ -65,7 +65,7 @@ binary_strtoul(const char *s, char **endptr)
}
static gboolean
uint_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg,
uint_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg,
guint32 max)
{
unsigned long value;
@ -121,27 +121,27 @@ uint_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_
}
static gboolean
uint32_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
uint32_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
{
return uint_from_unparsed (fv, s, allow_partial_value, err_msg, G_MAXUINT32);
return uint_from_literal (fv, s, allow_partial_value, err_msg, G_MAXUINT32);
}
static gboolean
uint24_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
uint24_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
{
return uint_from_unparsed (fv, s, allow_partial_value, err_msg, 0xFFFFFF);
return uint_from_literal (fv, s, allow_partial_value, err_msg, 0xFFFFFF);
}
static gboolean
uint16_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
uint16_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
{
return uint_from_unparsed (fv, s, allow_partial_value, err_msg, G_MAXUINT16);
return uint_from_literal (fv, s, allow_partial_value, err_msg, G_MAXUINT16);
}
static gboolean
uint8_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
uint8_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
{
return uint_from_unparsed (fv, s, allow_partial_value, err_msg, G_MAXUINT8);
return uint_from_literal (fv, s, allow_partial_value, err_msg, G_MAXUINT8);
}
static gboolean
@ -174,7 +174,7 @@ binary_strtol(const char *s, char **endptr)
}
static gboolean
sint_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg,
sint_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg,
gint32 max, gint32 min)
{
long value;
@ -239,27 +239,27 @@ sint_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_
}
static gboolean
sint32_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
sint32_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
{
return sint_from_unparsed (fv, s, allow_partial_value, err_msg, G_MAXINT32, G_MININT32);
return sint_from_literal (fv, s, allow_partial_value, err_msg, G_MAXINT32, G_MININT32);
}
static gboolean
sint24_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
sint24_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
{
return sint_from_unparsed (fv, s, allow_partial_value, err_msg, 0x7FFFFF, -0x800000);
return sint_from_literal (fv, s, allow_partial_value, err_msg, 0x7FFFFF, -0x800000);
}
static gboolean
sint16_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
sint16_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
{
return sint_from_unparsed (fv, s, allow_partial_value, err_msg, G_MAXINT16, G_MININT16);
return sint_from_literal (fv, s, allow_partial_value, err_msg, G_MAXINT16, G_MININT16);
}
static gboolean
sint8_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
sint8_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
{
return sint_from_unparsed (fv, s, allow_partial_value, err_msg, G_MAXINT8, G_MININT8);
return sint_from_literal (fv, s, allow_partial_value, err_msg, G_MAXINT8, G_MININT8);
}
static gboolean
@ -402,14 +402,14 @@ char_to_repr(wmem_allocator_t *scope, const fvalue_t *fv, ftrepr_t rtype _U_, in
}
static gboolean
ipxnet_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
ipxnet_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
{
/*
* Don't request an error message if bytes_from_unparsed fails;
* Don't request an error message if bytes_from_literal fails;
* if it does, we'll report an error specific to this address
* type.
*/
if (uint32_from_unparsed(fv, s, TRUE, NULL)) {
if (uint32_from_literal(fv, s, TRUE, NULL)) {
return TRUE;
}
@ -511,7 +511,7 @@ binary_strtoull(const char *s, char **endptr)
}
static gboolean
_uint64_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg,
_uint64_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg,
guint64 max)
{
guint64 value;
@ -563,27 +563,27 @@ _uint64_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value
}
static gboolean
uint64_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
uint64_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
{
return _uint64_from_unparsed (fv, s, allow_partial_value, err_msg, G_MAXUINT64);
return _uint64_from_literal (fv, s, allow_partial_value, err_msg, G_MAXUINT64);
}
static gboolean
uint56_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
uint56_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
{
return _uint64_from_unparsed (fv, s, allow_partial_value, err_msg, G_GUINT64_CONSTANT(0xFFFFFFFFFFFFFF));
return _uint64_from_literal (fv, s, allow_partial_value, err_msg, G_GUINT64_CONSTANT(0xFFFFFFFFFFFFFF));
}
static gboolean
uint48_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
uint48_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
{
return _uint64_from_unparsed (fv, s, allow_partial_value, err_msg, G_GUINT64_CONSTANT(0xFFFFFFFFFFFF));
return _uint64_from_literal (fv, s, allow_partial_value, err_msg, G_GUINT64_CONSTANT(0xFFFFFFFFFFFF));
}
static gboolean
uint40_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
uint40_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
{
return _uint64_from_unparsed (fv, s, allow_partial_value, err_msg, G_GUINT64_CONSTANT(0xFFFFFFFFFF));
return _uint64_from_literal (fv, s, allow_partial_value, err_msg, G_GUINT64_CONSTANT(0xFFFFFFFFFF));
}
static gboolean
@ -616,7 +616,7 @@ binary_strtoll(const char *s, char **endptr)
}
static gboolean
_sint64_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg,
_sint64_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg,
gint64 max, gint64 min)
{
gint64 value;
@ -675,27 +675,27 @@ _sint64_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value
}
static gboolean
sint64_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
sint64_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
{
return _sint64_from_unparsed (fv, s, allow_partial_value, err_msg, G_MAXINT64, G_MININT64);
return _sint64_from_literal (fv, s, allow_partial_value, err_msg, G_MAXINT64, G_MININT64);
}
static gboolean
sint56_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
sint56_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
{
return _sint64_from_unparsed (fv, s, allow_partial_value, err_msg, G_GINT64_CONSTANT(0x7FFFFFFFFFFFFF), G_GINT64_CONSTANT(-0x80000000000000));
return _sint64_from_literal (fv, s, allow_partial_value, err_msg, G_GINT64_CONSTANT(0x7FFFFFFFFFFFFF), G_GINT64_CONSTANT(-0x80000000000000));
}
static gboolean
sint48_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
sint48_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
{
return _sint64_from_unparsed (fv, s, allow_partial_value, err_msg, G_GINT64_CONSTANT(0x7FFFFFFFFFFF), G_GINT64_CONSTANT(-0x800000000000));
return _sint64_from_literal (fv, s, allow_partial_value, err_msg, G_GINT64_CONSTANT(0x7FFFFFFFFFFF), G_GINT64_CONSTANT(-0x800000000000));
}
static gboolean
sint40_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
sint40_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
{
return _sint64_from_unparsed (fv, s, allow_partial_value, err_msg, G_GINT64_CONSTANT(0x7FFFFFFFFF), G_GINT64_CONSTANT(-0x8000000000));
return _sint64_from_literal (fv, s, allow_partial_value, err_msg, G_GINT64_CONSTANT(0x7FFFFFFFFF), G_GINT64_CONSTANT(-0x8000000000));
}
static gboolean
@ -755,7 +755,7 @@ cmp_bitwise_and64(const fvalue_t *a, const fvalue_t *b)
/* BOOLEAN-specific */
static gboolean
boolean_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
boolean_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value, gchar **err_msg)
{
if (g_ascii_strcasecmp(s, "true") == 0) {
fv->value.uinteger64 = 1;
@ -766,7 +766,7 @@ boolean_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value,
return TRUE;
}
return uint64_from_unparsed(fv, s, allow_partial_value, err_msg);
return uint64_from_literal(fv, s, allow_partial_value, err_msg);
}
static char *
@ -801,7 +801,7 @@ boolean_cmp_order(const fvalue_t *a, const fvalue_t *b)
/* EUI64-specific */
static gboolean
eui64_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
eui64_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
{
GByteArray *bytes;
gboolean res;
@ -811,11 +811,11 @@ eui64_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U
} eui64;
/*
* Don't request an error message if uint64_from_unparsed fails;
* Don't request an error message if uint64_from_literal fails;
* if it does, we'll try parsing it as a sequence of bytes, and
* report an error if *that* fails.
*/
if (uint64_from_unparsed(fv, s, TRUE, NULL)) {
if (uint64_from_literal(fv, s, TRUE, NULL)) {
return TRUE;
}
@ -860,7 +860,7 @@ ftype_register_integers(void)
1, /* wire_size */
int_fvalue_new, /* new_value */
NULL, /* free_value */
uint8_from_unparsed, /* val_from_unparsed */
uint8_from_literal, /* val_from_literal */
NULL, /* val_from_string */
uint_from_charconst, /* val_from_charconst */
char_to_repr, /* val_to_string_repr */
@ -883,7 +883,7 @@ ftype_register_integers(void)
1, /* wire_size */
int_fvalue_new, /* new_value */
NULL, /* free_value */
uint8_from_unparsed, /* val_from_unparsed */
uint8_from_literal, /* val_from_literal */
NULL, /* val_from_string */
uint_from_charconst, /* val_from_charconst */
uinteger_to_repr, /* val_to_string_repr */
@ -906,7 +906,7 @@ ftype_register_integers(void)
2, /* wire_size */
int_fvalue_new, /* new_value */
NULL, /* free_value */
uint16_from_unparsed, /* val_from_unparsed */
uint16_from_literal, /* val_from_literal */
NULL, /* val_from_string */
uint_from_charconst, /* val_from_charconst */
uinteger_to_repr, /* val_to_string_repr */
@ -929,7 +929,7 @@ ftype_register_integers(void)
3, /* wire_size */
int_fvalue_new, /* new_value */
NULL, /* free_value */
uint24_from_unparsed, /* val_from_unparsed */
uint24_from_literal, /* val_from_literal */
NULL, /* val_from_string */
uint_from_charconst, /* val_from_charconst */
uinteger_to_repr, /* val_to_string_repr */
@ -952,7 +952,7 @@ ftype_register_integers(void)
4, /* wire_size */
int_fvalue_new, /* new_value */
NULL, /* free_value */
uint32_from_unparsed, /* val_from_unparsed */
uint32_from_literal, /* val_from_literal */
NULL, /* val_from_string */
uint_from_charconst, /* val_from_charconst */
uinteger_to_repr, /* val_to_string_repr */
@ -975,7 +975,7 @@ ftype_register_integers(void)
5, /* wire_size */
int64_fvalue_new, /* new_value */
NULL, /* free_value */
uint40_from_unparsed, /* val_from_unparsed */
uint40_from_literal, /* val_from_literal */
NULL, /* val_from_string */
uint64_from_charconst, /* val_from_charconst */
uinteger64_to_repr, /* val_to_string_repr */
@ -998,7 +998,7 @@ ftype_register_integers(void)
6, /* wire_size */
int64_fvalue_new, /* new_value */
NULL, /* free_value */
uint48_from_unparsed, /* val_from_unparsed */
uint48_from_literal, /* val_from_literal */
NULL, /* val_from_string */
uint64_from_charconst, /* val_from_charconst */
uinteger64_to_repr, /* val_to_string_repr */
@ -1021,7 +1021,7 @@ ftype_register_integers(void)
7, /* wire_size */
int64_fvalue_new, /* new_value */
NULL, /* free_value */
uint56_from_unparsed, /* val_from_unparsed */
uint56_from_literal, /* val_from_literal */
NULL, /* val_from_string */
uint64_from_charconst, /* val_from_charconst */
uinteger64_to_repr, /* val_to_string_repr */
@ -1044,7 +1044,7 @@ ftype_register_integers(void)
8, /* wire_size */
int64_fvalue_new, /* new_value */
NULL, /* free_value */
uint64_from_unparsed, /* val_from_unparsed */
uint64_from_literal, /* val_from_literal */
NULL, /* val_from_string */
uint64_from_charconst, /* val_from_charconst */
uinteger64_to_repr, /* val_to_string_repr */
@ -1067,7 +1067,7 @@ ftype_register_integers(void)
1, /* wire_size */
int_fvalue_new, /* new_value */
NULL, /* free_value */
sint8_from_unparsed, /* val_from_unparsed */
sint8_from_literal, /* val_from_literal */
NULL, /* val_from_string */
sint_from_charconst, /* val_from_charconst */
integer_to_repr, /* val_to_string_repr */
@ -1090,7 +1090,7 @@ ftype_register_integers(void)
2, /* wire_size */
int_fvalue_new, /* new_value */
NULL, /* free_value */
sint16_from_unparsed, /* val_from_unparsed */
sint16_from_literal, /* val_from_literal */
NULL, /* val_from_string */
sint_from_charconst, /* val_from_charconst */
integer_to_repr, /* val_to_string_repr */
@ -1113,7 +1113,7 @@ ftype_register_integers(void)
3, /* wire_size */
int_fvalue_new, /* new_value */
NULL, /* free_value */
sint24_from_unparsed, /* val_from_unparsed */
sint24_from_literal, /* val_from_literal */
NULL, /* val_from_string */
sint_from_charconst, /* val_from_charconst */
integer_to_repr, /* val_to_string_repr */
@ -1136,7 +1136,7 @@ ftype_register_integers(void)
4, /* wire_size */
int_fvalue_new, /* new_value */
NULL, /* free_value */
sint32_from_unparsed, /* val_from_unparsed */
sint32_from_literal, /* val_from_literal */
NULL, /* val_from_string */
sint_from_charconst, /* val_from_charconst */
integer_to_repr, /* val_to_string_repr */
@ -1159,7 +1159,7 @@ ftype_register_integers(void)
5, /* wire_size */
int64_fvalue_new, /* new_value */
NULL, /* free_value */
sint40_from_unparsed, /* val_from_unparsed */
sint40_from_literal, /* val_from_literal */
NULL, /* val_from_string */
sint64_from_charconst, /* val_from_charconst */
integer64_to_repr, /* val_to_string_repr */
@ -1182,7 +1182,7 @@ ftype_register_integers(void)
6, /* wire_size */
int64_fvalue_new, /* new_value */
NULL, /* free_value */
sint48_from_unparsed, /* val_from_unparsed */
sint48_from_literal, /* val_from_literal */
NULL, /* val_from_string */
sint64_from_charconst, /* val_from_charconst */
integer64_to_repr, /* val_to_string_repr */
@ -1205,7 +1205,7 @@ ftype_register_integers(void)
7, /* wire_size */
int64_fvalue_new, /* new_value */
NULL, /* free_value */
sint56_from_unparsed, /* val_from_unparsed */
sint56_from_literal, /* val_from_literal */
NULL, /* val_from_string */
sint64_from_charconst, /* val_from_charconst */
integer64_to_repr, /* val_to_string_repr */
@ -1228,7 +1228,7 @@ ftype_register_integers(void)
8, /* wire_size */
int64_fvalue_new, /* new_value */
NULL, /* free_value */
sint64_from_unparsed, /* val_from_unparsed */
sint64_from_literal, /* val_from_literal */
NULL, /* val_from_string */
sint64_from_charconst, /* val_from_charconst */
integer64_to_repr, /* val_to_string_repr */
@ -1251,7 +1251,7 @@ ftype_register_integers(void)
0, /* wire_size */
int_fvalue_new, /* new_value */
NULL, /* free_value */
boolean_from_unparsed, /* val_from_unparsed */
boolean_from_literal, /* val_from_literal */
NULL, /* val_from_string */
uint64_from_charconst, /* val_from_charconst */
boolean_to_repr, /* val_to_string_repr */
@ -1275,7 +1275,7 @@ ftype_register_integers(void)
4, /* wire_size */
int_fvalue_new, /* new_value */
NULL, /* free_value */
ipxnet_from_unparsed, /* val_from_unparsed */
ipxnet_from_literal, /* val_from_literal */
NULL, /* val_from_string */
NULL, /* val_from_charconst */
ipxnet_to_repr, /* val_to_string_repr */
@ -1299,7 +1299,7 @@ ftype_register_integers(void)
4, /* wire_size */
int_fvalue_new, /* new_value */
NULL, /* free_value */
uint32_from_unparsed, /* val_from_unparsed */
uint32_from_literal, /* val_from_literal */
NULL, /* val_from_string */
uint_from_charconst, /* val_from_charconst */
uinteger_to_repr, /* val_to_string_repr */
@ -1323,7 +1323,7 @@ ftype_register_integers(void)
FT_EUI64_LEN, /* wire_size */
int64_fvalue_new, /* new_value */
NULL, /* free_value */
eui64_from_unparsed, /* val_from_unparsed */
eui64_from_literal, /* val_from_literal */
NULL, /* val_from_string */
NULL, /* val_from_charconst */
eui64_to_repr, /* val_to_string_repr */

View File

@ -29,7 +29,7 @@ value_get(fvalue_t *fv)
}
static gboolean
val_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
val_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
{
guint32 addr;
unsigned int nmask_bits;
@ -71,7 +71,7 @@ val_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_,
net_str = slash + 1;
/* XXX - this is inefficient */
nmask_fvalue = fvalue_from_unparsed(FT_UINT32, net_str, FALSE, err_msg);
nmask_fvalue = fvalue_from_literal(FT_UINT32, net_str, FALSE, err_msg);
if (!nmask_fvalue) {
return FALSE;
}
@ -153,7 +153,7 @@ ftype_register_ipv4(void)
4, /* wire_size */
NULL, /* new_value */
NULL, /* free_value */
val_from_unparsed, /* val_from_unparsed */
val_from_literal, /* val_from_literal */
NULL, /* val_from_string */
NULL, /* val_from_charconst */
val_to_repr, /* val_to_string_repr */

View File

@ -23,7 +23,7 @@ ipv6_fvalue_set(fvalue_t *fv, const guint8 *value)
}
static gboolean
ipv6_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
ipv6_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
{
const char *slash;
const char *addr_str;
@ -56,7 +56,7 @@ ipv6_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_
/* If prefix */
if (slash) {
/* XXX - this is inefficient */
nmask_fvalue = fvalue_from_unparsed(FT_UINT32, slash+1, FALSE, err_msg);
nmask_fvalue = fvalue_from_literal(FT_UINT32, slash+1, FALSE, err_msg);
if (!nmask_fvalue) {
return FALSE;
}
@ -175,7 +175,7 @@ ftype_register_ipv6(void)
FT_IPv6_LEN, /* wire_size */
NULL, /* new_value */
NULL, /* free_value */
ipv6_from_unparsed, /* val_from_unparsed */
ipv6_from_literal, /* val_from_literal */
NULL, /* val_from_string */
NULL, /* val_from_charconst */
ipv6_to_repr, /* val_to_string_repr */

View File

@ -22,7 +22,7 @@ ftype_register_none(void)
0, /* wire_size */
NULL, /* new_value */
NULL, /* free_value */
NULL, /* val_from_unparsed */
NULL, /* val_from_literal */
NULL, /* val_from_string */
NULL, /* val_from_charconst */
NULL, /* val_to_string_repr */

View File

@ -78,7 +78,7 @@ val_from_string(fvalue_t *fv, const char *s, gchar **err_msg _U_)
}
static gboolean
val_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
val_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
{
GByteArray *bytes;
tvbuff_t *new_tvb;
@ -89,7 +89,7 @@ val_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_,
fv->value.protocol.proto_string = NULL;
/* Does this look like a byte string? */
bytes = byte_array_from_unparsed(s, err_msg);
bytes = byte_array_from_literal(s, err_msg);
if (bytes != NULL) {
/* Make a tvbuff from the bytes */
new_tvb = tvb_new_real_data(bytes->data, bytes->len, bytes->len);
@ -314,7 +314,7 @@ ftype_register_tvbuff(void)
0, /* wire_size */
value_new, /* new_value */
value_free, /* free_value */
val_from_unparsed, /* val_from_unparsed */
val_from_literal, /* val_from_literal */
val_from_string, /* val_from_string */
val_from_charconst, /* val_from_charconst */
val_to_repr, /* val_to_string_repr */

View File

@ -70,11 +70,11 @@ val_from_string(fvalue_t *fv, const char *s, gchar **err_msg _U_)
}
static gboolean
val_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
val_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
{
/* Just turn it into a string */
/* XXX Should probably be a syntax error instead. It's more user-friendly to ask the
* user to be explicit about the meaning of unparsed than them trying to figure out
* user to be explicit about the meaning of an unquoted literal than them trying to figure out
* why a valid filter expression is giving wrong results. */
return val_from_string(fv, s, err_msg);
}
@ -82,7 +82,7 @@ val_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_,
static gboolean
val_from_charconst(fvalue_t *fv, unsigned long num, gchar **err_msg)
{
/* XXX Should be a syntax error if unparsed is also a syntax error. */
/* XXX Should be a syntax error if literal is also a syntax error. */
/* Free up the old value, if we have one */
string_fvalue_free(fv);
@ -166,7 +166,7 @@ ftype_register_string(void)
0, /* wire_size */
string_fvalue_new, /* new_value */
string_fvalue_free, /* free_value */
val_from_unparsed, /* val_from_unparsed */
val_from_literal, /* val_from_literal */
val_from_string, /* val_from_string */
val_from_charconst, /* val_from_charconst */
string_to_repr, /* val_to_string_repr */
@ -189,7 +189,7 @@ ftype_register_string(void)
0, /* wire_size */
string_fvalue_new, /* new_value */
string_fvalue_free, /* free_value */
val_from_unparsed, /* val_from_unparsed */
val_from_literal, /* val_from_literal */
val_from_string, /* val_from_string */
val_from_charconst, /* val_from_charconst */
string_to_repr, /* val_to_string_repr */
@ -212,7 +212,7 @@ ftype_register_string(void)
0, /* wire_size */
string_fvalue_new, /* new_value */
string_fvalue_free, /* free_value */
val_from_unparsed, /* val_from_unparsed */
val_from_literal, /* val_from_literal */
val_from_string, /* val_from_string */
val_from_charconst, /* val_from_charconst */
string_to_repr, /* val_to_string_repr */
@ -235,7 +235,7 @@ ftype_register_string(void)
0, /* wire_size */
string_fvalue_new, /* new_value */
string_fvalue_free, /* free_value */
val_from_unparsed, /* val_from_unparsed */
val_from_literal, /* val_from_literal */
val_from_string, /* val_from_string */
val_from_charconst, /* val_from_charconst */
string_to_repr, /* val_to_string_repr */
@ -258,7 +258,7 @@ ftype_register_string(void)
0, /* wire_size */
string_fvalue_new, /* new_value */
string_fvalue_free, /* free_value */
val_from_unparsed, /* val_from_unparsed */
val_from_literal, /* val_from_literal */
val_from_string, /* val_from_string */
val_from_charconst, /* val_from_charconst */
string_to_repr, /* val_to_string_repr */

View File

@ -91,7 +91,7 @@ get_nsecs(const char *startp, int *nsecs, const char **endptr)
}
static gboolean
relative_val_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
relative_val_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
{
const char *curptr;
char *endptr;
@ -308,7 +308,7 @@ fail:
}
static gboolean
absolute_val_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
absolute_val_from_literal(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, gchar **err_msg)
{
return absolute_val_from_string(fv, s, err_msg);
}
@ -416,7 +416,7 @@ ftype_register_time(void)
0, /* wire_size */
time_fvalue_new, /* new_value */
NULL, /* free_value */
absolute_val_from_unparsed, /* val_from_unparsed */
absolute_val_from_literal, /* val_from_literal */
absolute_val_from_string, /* val_from_string */
NULL, /* val_from_charconst */
absolute_val_to_repr, /* val_to_string_repr */
@ -439,7 +439,7 @@ ftype_register_time(void)
0, /* wire_size */
time_fvalue_new, /* new_value */
NULL, /* free_value */
relative_val_from_unparsed, /* val_from_unparsed */
relative_val_from_literal, /* val_from_literal */
NULL, /* val_from_string */
NULL, /* val_from_charconst */
relative_val_to_repr, /* val_to_string_repr */

View File

@ -16,7 +16,7 @@
typedef void (*FvalueNewFunc)(fvalue_t*);
typedef void (*FvalueFreeFunc)(fvalue_t*);
typedef gboolean (*FvalueFromUnparsed)(fvalue_t*, const char*, gboolean, gchar **);
typedef gboolean (*FvalueFromLiteral)(fvalue_t*, const char*, gboolean, gchar **);
typedef gboolean (*FvalueFromString)(fvalue_t*, const char*, gchar **);
typedef gboolean (*FvalueFromCharConst)(fvalue_t*, unsigned long, gchar **);
typedef char *(*FvalueToStringRepr)(wmem_allocator_t *, const fvalue_t*, ftrepr_t, int field_display);
@ -55,7 +55,7 @@ struct _ftype_t {
int wire_size;
FvalueNewFunc new_value;
FvalueFreeFunc free_value;
FvalueFromUnparsed val_from_unparsed;
FvalueFromLiteral val_from_literal;
FvalueFromString val_from_string;
FvalueFromCharConst val_from_charconst;
FvalueToStringRepr val_to_string_repr;
@ -107,7 +107,7 @@ void ftype_register_time(void);
void ftype_register_tvbuff(void);
GByteArray *
byte_array_from_unparsed(const char *s, gchar **err_msg);
byte_array_from_literal(const char *s, gchar **err_msg);
GByteArray *
byte_array_from_charconst(unsigned long num, gchar **err_msg);

View File

@ -264,13 +264,13 @@ fvalue_free(fvalue_t *fv)
}
fvalue_t*
fvalue_from_unparsed(ftenum_t ftype, const char *s, gboolean allow_partial_value, gchar **err_msg)
fvalue_from_literal(ftenum_t ftype, const char *s, gboolean allow_partial_value, gchar **err_msg)
{
fvalue_t *fv;
fv = fvalue_new(ftype);
if (fv->ftype->val_from_unparsed) {
if (fv->ftype->val_from_unparsed(fv, s, allow_partial_value, err_msg)) {
if (fv->ftype->val_from_literal) {
if (fv->ftype->val_from_literal(fv, s, allow_partial_value, err_msg)) {
/* Success */
if (err_msg != NULL)
*err_msg = NULL;

View File

@ -247,7 +247,7 @@ fvalue_free(fvalue_t *fv);
WS_DLL_PUBLIC
fvalue_t*
fvalue_from_unparsed(ftenum_t ftype, const char *s, gboolean allow_partial_value, gchar **err_msg);
fvalue_from_literal(ftenum_t ftype, const char *s, gboolean allow_partial_value, gchar **err_msg);
fvalue_t*
fvalue_from_string(ftenum_t ftype, const char *s, gchar **err_msg);

View File

@ -41,7 +41,7 @@ class case_range(unittest.TestCase):
def test_slice_unparsed_1(self, checkDFilterFail):
dfilter = "a == b[1]"
checkDFilterFail(dfilter, "Range is not supported for entity \"b\" of type UNPARSED")
checkDFilterFail(dfilter, "Range is not supported for entity \"b\" of type LITERAL")
def test_slice_func_1(self, checkDFilterSucceed):
dfilter = "string(ipx.src.node)[3:2] == \"cc:dd\""