Lines Matching full:off

104 			const char *s, int *off, const u_char *start,
107 const u_char *data, int *off, char *cbuf, int cbuflen,
121 static int ng_parse_skip_value(const char *s, int off, int *lenp);
147 const char *string, int *off, u_char *buf, int *buflen) in ng_parse() argument
149 return INVOKE(type, parse)(type, string, off, buf, buf, buflen); in ng_parse()
159 int off = 0; in ng_unparse() local
161 return INVOKE(type, unparse)(type, data, &off, cbuf, cbuflen); in ng_unparse()
183 const char *s, int *off, const u_char *const start, in ng_struct_parse() argument
186 return ng_parse_composite(type, s, off, start, buf, buflen, CT_STRUCT); in ng_struct_parse()
191 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_struct_unparse() argument
193 return ng_unparse_composite(type, data, off, cbuf, cbuflen, CT_STRUCT); in ng_struct_unparse()
200 int off = 0; in ng_struct_getDefault() local
203 "{}", &off, start, buf, buflen, CT_STRUCT); in ng_struct_getDefault()
237 const char *s, int *off, const u_char *const start, in ng_fixedarray_parse() argument
241 s, off, start, buf, buflen, CT_FIXEDARRAY); in ng_fixedarray_parse()
246 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_fixedarray_unparse() argument
249 data, off, cbuf, cbuflen, CT_FIXEDARRAY); in ng_fixedarray_unparse()
256 int off = 0; in ng_fixedarray_getDefault() local
259 "[]", &off, start, buf, buflen, CT_FIXEDARRAY); in ng_fixedarray_getDefault()
286 const char *s, int *off, const u_char *const start, in ng_array_parse() argument
289 return ng_parse_composite(type, s, off, start, buf, buflen, CT_ARRAY); in ng_array_parse()
294 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_array_unparse() argument
296 return ng_unparse_composite(type, data, off, cbuf, cbuflen, CT_ARRAY); in ng_array_unparse()
303 int off = 0; in ng_array_getDefault() local
306 "[]", &off, start, buf, buflen, CT_ARRAY); in ng_array_getDefault()
333 const char *s, int *off, const u_char *const start, in ng_int8_parse() argument
340 val = strtol(s + *off, &eptr, 0); in ng_int8_parse()
341 if (val < (int8_t)0x80 || val > (u_int8_t)0xff || eptr == s + *off) in ng_int8_parse()
343 *off = eptr - s; in ng_int8_parse()
352 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_int8_unparse() argument
359 bcopy(data + *off, &val, sizeof(int8_t)); in ng_int8_unparse()
378 *off += sizeof(int8_t); in ng_int8_unparse()
428 const char *s, int *off, const u_char *const start, in ng_int16_parse() argument
435 val = strtol(s + *off, &eptr, 0); in ng_int16_parse()
437 || val > (u_int16_t)0xffff || eptr == s + *off) in ng_int16_parse()
439 *off = eptr - s; in ng_int16_parse()
448 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_int16_unparse() argument
455 bcopy(data + *off, &val, sizeof(int16_t)); in ng_int16_unparse()
474 *off += sizeof(int16_t); in ng_int16_unparse()
524 const char *s, int *off, const u_char *const start, in ng_int32_parse() argument
532 val = strtol(s + *off, &eptr, 0); in ng_int32_parse()
534 val = strtoul(s + *off, &eptr, 0); in ng_int32_parse()
536 || val > (u_int32_t)0xffffffff || eptr == s + *off) in ng_int32_parse()
538 *off = eptr - s; in ng_int32_parse()
547 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_int32_unparse() argument
554 bcopy(data + *off, &val, sizeof(int32_t)); in ng_int32_unparse()
573 *off += sizeof(int32_t); in ng_int32_unparse()
623 const char *s, int *off, const u_char *const start, in ng_int64_parse() argument
630 val = strtoq(s + *off, &eptr, 0); in ng_int64_parse()
631 if (eptr == s + *off) in ng_int64_parse()
633 *off = eptr - s; in ng_int64_parse()
642 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_int64_unparse() argument
649 bcopy(data + *off, &val, sizeof(int64_t)); in ng_int64_unparse()
668 *off += sizeof(int64_t); in ng_int64_unparse()
718 const char *s, int *off, const u_char *const start, in ng_string_parse() argument
725 if ((sval = ng_get_string_token(s, off, &len, &slen)) == NULL) in ng_string_parse()
727 *off += len; in ng_string_parse()
736 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_string_unparse() argument
738 const char *const raw = (const char *)data + *off; in ng_string_unparse()
748 *off += strlen(raw) + 1; in ng_string_unparse()
781 const char *s, int *off, const u_char *const start, in ng_fixedstring_parse() argument
789 if ((sval = ng_get_string_token(s, off, &len, &slen)) == NULL) in ng_fixedstring_parse()
795 *off += len; in ng_fixedstring_parse()
805 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_fixedstring_unparse() argument
808 int error, temp = *off; in ng_fixedstring_unparse()
812 *off += fi->bufSize; in ng_fixedstring_unparse()
885 const char *s, int *off, const u_char *const start, in ng_sizedstring_parse() argument
892 if ((sval = ng_get_string_token(s, off, &len, &slen)) == NULL) in ng_sizedstring_parse()
898 *off += len; in ng_sizedstring_parse()
908 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_sizedstring_unparse() argument
910 const char *const raw = (const char *)data + *off + 2; in ng_sizedstring_unparse()
911 const int slen = *((const u_int16_t *)(data + *off)); in ng_sizedstring_unparse()
922 *off += slen + 2; in ng_sizedstring_unparse()
953 const char *s, int *off, const u_char *const start, in ng_ipaddr_parse() argument
960 s, off, start, buf + i, buflen)) != 0) in ng_ipaddr_parse()
963 if (s[*off] != '.') in ng_ipaddr_parse()
965 (*off)++; in ng_ipaddr_parse()
974 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_ipaddr_unparse() argument
979 bcopy(data + *off, &ip, sizeof(ip)); in ng_ipaddr_unparse()
984 *off += sizeof(ip); in ng_ipaddr_unparse()
1017 const char *s, int *const off, const u_char *const start, in ng_enaddr_parse() argument
1027 val = strtoul(s + *off, &eptr, 16); in ng_enaddr_parse()
1028 if (val > 0xff || eptr == s + *off) in ng_enaddr_parse()
1031 *off = (eptr - s); in ng_enaddr_parse()
1035 (*off)++; in ng_enaddr_parse()
1044 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_enaddr_unparse() argument
1049 data[*off], data[*off + 1], data[*off + 2], in ng_enaddr_unparse()
1050 data[*off + 3], data[*off + 4], data[*off + 5]); in ng_enaddr_unparse()
1053 *off += ETHER_ADDR_LEN; in ng_enaddr_unparse()
1094 const char *s, int *off, const u_char *const start, in ng_bytearray_parse() argument
1102 if ((str = ng_get_string_token(s, off, &toklen, &slen)) != NULL) { in ng_bytearray_parse()
1118 *off += toklen; in ng_bytearray_parse()
1126 return ng_array_parse(&subtype, s, off, start, buf, buflen); in ng_bytearray_parse()
1132 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_bytearray_unparse() argument
1138 return ng_array_unparse(&subtype, data, off, cbuf, cbuflen); in ng_bytearray_unparse()
1200 int *off, const u_char *const start, u_char *const buf, int *buflen, in ng_parse_composite() argument
1219 if (ng_parse_get_token(s, off, &len) in ng_parse_composite()
1224 *off += len; in ng_parse_composite()
1231 tok = ng_parse_get_token(s, off, &len); in ng_parse_composite()
1233 *off += len; in ng_parse_composite()
1258 off2 = *off + len; in ng_parse_composite()
1265 ul = strtoul(s + *off, &eptr, 0); in ng_parse_composite()
1266 if (ul == ULONG_MAX || eptr - (s + *off) != len) { in ng_parse_composite()
1272 *off += len + len2; in ng_parse_composite()
1286 if (strncmp(&s[*off], field->name, len) == 0 in ng_parse_composite()
1294 *off += len; in ng_parse_composite()
1297 if (ng_parse_get_token(s, off, &len) != T_EQUALS) { in ng_parse_composite()
1301 *off += len; in ng_parse_composite()
1316 while (isspace(s[*off])) in ng_parse_composite()
1317 (*off)++; in ng_parse_composite()
1318 foff[index] = *off; in ng_parse_composite()
1319 if ((error = ng_parse_skip_value(s, *off, &len)) != 0) in ng_parse_composite()
1321 *off += len; in ng_parse_composite()
1346 *off = foff[index]; in ng_parse_composite()
1348 s, off, start, buf + blen, &vlen); in ng_parse_composite()
1379 int *off, char *cbuf, int cbuflen, const enum comptype ctype) in ng_unparse_composite() argument
1383 const int num = ng_get_composite_len(type, data, data + *off, ctype); in ng_unparse_composite()
1405 *off += ng_parse_get_elem_pad(type, index, ctype, *off); in ng_unparse_composite()
1411 if (sizeof(*hdr) + *off < workSize) { in ng_unparse_composite()
1412 int tempsize = workSize - sizeof(*hdr) - *off; in ng_unparse_composite()
1414 bcopy(hdr, workBuf, sizeof(*hdr) + *off); in ng_unparse_composite()
1416 + sizeof(*hdr), workBuf + sizeof(*hdr) + *off, in ng_unparse_composite()
1418 && bcmp(workBuf + sizeof(*hdr) + *off, in ng_unparse_composite()
1419 data + *off, tempsize) == 0) { in ng_unparse_composite()
1420 *off += tempsize; in ng_unparse_composite()
1447 (etype, data, off, cbuf, cbuflen)) != 0) { in ng_unparse_composite()
1647 int off = off0; in ng_parse_skip_value() local
1651 switch (ng_parse_get_token(s, &off, &len)) { in ng_parse_skip_value()
1671 off += len; in ng_parse_skip_value()
1673 *lenp = off - off0; in ng_parse_skip_value()
1732 int start, off; in ng_get_string_token() local
1744 for (slen = 0, off = 1, p = cbuf; *p != '\0'; slen++, off++, p++) { in ng_get_string_token()
1747 *lenp = off + 1; in ng_get_string_token()
1760 off++; in ng_get_string_token()
1764 off++; in ng_get_string_token()
1768 off++; in ng_get_string_token()
1772 off++; in ng_get_string_token()
1776 off++; in ng_get_string_token()
1780 off++; in ng_get_string_token()
1787 off++; in ng_get_string_token()
1797 off++; in ng_get_string_token()
1820 int off = 0; in ng_encode_string() local
1826 cbuf[off++] = '"'; in ng_encode_string()
1830 cbuf[off++] = '\\'; in ng_encode_string()
1831 cbuf[off++] = 't'; in ng_encode_string()
1834 cbuf[off++] = '\\'; in ng_encode_string()
1835 cbuf[off++] = 'f'; in ng_encode_string()
1838 cbuf[off++] = '\\'; in ng_encode_string()
1839 cbuf[off++] = 'n'; in ng_encode_string()
1842 cbuf[off++] = '\\'; in ng_encode_string()
1843 cbuf[off++] = 'r'; in ng_encode_string()
1846 cbuf[off++] = '\\'; in ng_encode_string()
1847 cbuf[off++] = 'v'; in ng_encode_string()
1851 cbuf[off++] = '\\'; in ng_encode_string()
1852 cbuf[off++] = *raw; in ng_encode_string()
1856 off += sprintf(cbuf + off, in ng_encode_string()
1860 cbuf[off++] = *raw; in ng_encode_string()
1864 cbuf[off++] = '"'; in ng_encode_string()
1865 cbuf[off] = '\0'; in ng_encode_string()