diff options
author | Brian Somers <brian@FreeBSD.org> | 2000-11-16 23:14:53 +0000 |
---|---|---|
committer | Brian Somers <brian@FreeBSD.org> | 2000-11-16 23:14:53 +0000 |
commit | 27121ab1a472e7240f114938aa6e35b314d6e714 (patch) | |
tree | b584d79680c99fc2f44e896672dd8109664b375e /sys/netgraph/ng_parse.h | |
parent | f17033e38db1b99c6180c8cab664e36d6b3446c0 (diff) | |
download | src-test2-27121ab1a472e7240f114938aa6e35b314d6e714.tar.gz src-test2-27121ab1a472e7240f114938aa6e35b314d6e714.zip |
Notes
Diffstat (limited to 'sys/netgraph/ng_parse.h')
-rw-r--r-- | sys/netgraph/ng_parse.h | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/sys/netgraph/ng_parse.h b/sys/netgraph/ng_parse.h index 027605d28953..13aa294c12e3 100644 --- a/sys/netgraph/ng_parse.h +++ b/sys/netgraph/ng_parse.h @@ -396,6 +396,17 @@ struct ng_parse_fixedstring_info { }; /* + * EXPLICITLY SIZED STRING TYPE + * + * These are strings that have a two byte length field preceding them. + * Parsed strings are NOT NUL-terminated. + * + * Default value: Empty string + * Additional info: None + */ +extern const struct ng_parse_type ng_parse_sizedstring_type; + +/* * COMMONLY USED BOUNDED LENGTH STRING TYPES */ extern const struct ng_parse_type ng_parse_nodebuf_type; /* NG_NODELEN + 1 */ @@ -506,16 +517,20 @@ extern enum ng_parse_token ng_parse_get_token(const char *s, * the string value. The string token must be enclosed in double quotes * and the normal C backslash escapes are recognized. The caller must * eventually free() the returned result. Returns NULL if token is - * not a string token, or parse or other error. + * not a string token, or parse or other error. Otherwise, *lenp contains + * the number of characters parsed, and *slenp (if not NULL) contains + * the actual number of characters in the parsed string. */ -extern char *ng_get_string_token(const char *s, int *startp, int *lenp); +extern char *ng_get_string_token(const char *s, int *startp, + int *lenp, int *slenp); /* * Convert a raw string into a doubly-quoted string including any * necessary backslash escapes. Caller must free the result. - * Returns NULL if ENOMEM. + * Returns NULL if ENOMEM. Normally "slen" should equal strlen(s) + * unless you want to encode NUL bytes. */ -extern char *ng_encode_string(const char *s); +extern char *ng_encode_string(const char *s, int slen); #endif /* _NETGRAPH_PARSE_H_ */ |