Lines Matching full:off
103 const char *s, int *off, const u_char *start,
106 const u_char *data, int *off, char *cbuf, int cbuflen,
120 static int ng_parse_skip_value(const char *s, int off, int *lenp);
146 const char *string, int *off, u_char *buf, int *buflen) in ng_parse() argument
148 return INVOKE(type, parse)(type, string, off, buf, buf, buflen); in ng_parse()
158 int off = 0; in ng_unparse() local
160 return INVOKE(type, unparse)(type, data, &off, cbuf, cbuflen); in ng_unparse()
182 const char *s, int *off, const u_char *const start, in ng_struct_parse() argument
185 return ng_parse_composite(type, s, off, start, buf, buflen, CT_STRUCT); in ng_struct_parse()
190 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_struct_unparse() argument
192 return ng_unparse_composite(type, data, off, cbuf, cbuflen, CT_STRUCT); in ng_struct_unparse()
199 int off = 0; in ng_struct_getDefault() local
202 "{}", &off, start, buf, buflen, CT_STRUCT); in ng_struct_getDefault()
236 const char *s, int *off, const u_char *const start, in ng_fixedarray_parse() argument
240 s, off, start, buf, buflen, CT_FIXEDARRAY); in ng_fixedarray_parse()
245 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_fixedarray_unparse() argument
248 data, off, cbuf, cbuflen, CT_FIXEDARRAY); in ng_fixedarray_unparse()
255 int off = 0; in ng_fixedarray_getDefault() local
258 "[]", &off, start, buf, buflen, CT_FIXEDARRAY); in ng_fixedarray_getDefault()
285 const char *s, int *off, const u_char *const start, in ng_array_parse() argument
288 return ng_parse_composite(type, s, off, start, buf, buflen, CT_ARRAY); in ng_array_parse()
293 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_array_unparse() argument
295 return ng_unparse_composite(type, data, off, cbuf, cbuflen, CT_ARRAY); in ng_array_unparse()
302 int off = 0; in ng_array_getDefault() local
305 "[]", &off, start, buf, buflen, CT_ARRAY); in ng_array_getDefault()
332 const char *s, int *off, const u_char *const start, in ng_int8_parse() argument
339 val = strtol(s + *off, &eptr, 0); in ng_int8_parse()
340 if (val < (int8_t)0x80 || val > (u_int8_t)0xff || eptr == s + *off) in ng_int8_parse()
342 *off = eptr - s; in ng_int8_parse()
351 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_int8_unparse() argument
358 bcopy(data + *off, &val, sizeof(int8_t)); in ng_int8_unparse()
377 *off += sizeof(int8_t); in ng_int8_unparse()
427 const char *s, int *off, const u_char *const start, in ng_int16_parse() argument
434 val = strtol(s + *off, &eptr, 0); in ng_int16_parse()
436 || val > (u_int16_t)0xffff || eptr == s + *off) in ng_int16_parse()
438 *off = eptr - s; in ng_int16_parse()
447 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_int16_unparse() argument
454 bcopy(data + *off, &val, sizeof(int16_t)); in ng_int16_unparse()
473 *off += sizeof(int16_t); in ng_int16_unparse()
523 const char *s, int *off, const u_char *const start, in ng_int32_parse() argument
531 val = strtol(s + *off, &eptr, 0); in ng_int32_parse()
533 val = strtoul(s + *off, &eptr, 0); in ng_int32_parse()
535 || val > (u_int32_t)0xffffffff || eptr == s + *off) in ng_int32_parse()
537 *off = eptr - s; in ng_int32_parse()
546 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_int32_unparse() argument
553 bcopy(data + *off, &val, sizeof(int32_t)); in ng_int32_unparse()
572 *off += sizeof(int32_t); in ng_int32_unparse()
622 const char *s, int *off, const u_char *const start, in ng_int64_parse() argument
629 val = strtoq(s + *off, &eptr, 0); in ng_int64_parse()
630 if (eptr == s + *off) in ng_int64_parse()
632 *off = eptr - s; in ng_int64_parse()
641 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_int64_unparse() argument
648 bcopy(data + *off, &val, sizeof(int64_t)); in ng_int64_unparse()
667 *off += sizeof(int64_t); in ng_int64_unparse()
717 const char *s, int *off, const u_char *const start, in ng_string_parse() argument
724 if ((sval = ng_get_string_token(s, off, &len, &slen)) == NULL) in ng_string_parse()
726 *off += len; in ng_string_parse()
735 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_string_unparse() argument
737 const char *const raw = (const char *)data + *off; in ng_string_unparse()
747 *off += strlen(raw) + 1; in ng_string_unparse()
780 const char *s, int *off, const u_char *const start, in ng_fixedstring_parse() argument
788 if ((sval = ng_get_string_token(s, off, &len, &slen)) == NULL) in ng_fixedstring_parse()
794 *off += len; in ng_fixedstring_parse()
804 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_fixedstring_unparse() argument
807 int error, temp = *off; in ng_fixedstring_unparse()
811 *off += fi->bufSize; in ng_fixedstring_unparse()
884 const char *s, int *off, const u_char *const start, in ng_sizedstring_parse() argument
891 if ((sval = ng_get_string_token(s, off, &len, &slen)) == NULL) in ng_sizedstring_parse()
897 *off += len; in ng_sizedstring_parse()
907 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_sizedstring_unparse() argument
909 const char *const raw = (const char *)data + *off + 2; in ng_sizedstring_unparse()
910 const int slen = *((const u_int16_t *)(data + *off)); in ng_sizedstring_unparse()
921 *off += slen + 2; in ng_sizedstring_unparse()
952 const char *s, int *off, const u_char *const start, in ng_ipaddr_parse() argument
959 s, off, start, buf + i, buflen)) != 0) in ng_ipaddr_parse()
962 if (s[*off] != '.') in ng_ipaddr_parse()
964 (*off)++; in ng_ipaddr_parse()
973 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_ipaddr_unparse() argument
978 bcopy(data + *off, &ip, sizeof(ip)); in ng_ipaddr_unparse()
983 *off += sizeof(ip); in ng_ipaddr_unparse()
1016 const char *s, int *const off, const u_char *const start, in ng_enaddr_parse() argument
1026 val = strtoul(s + *off, &eptr, 16); in ng_enaddr_parse()
1027 if (val > 0xff || eptr == s + *off) in ng_enaddr_parse()
1030 *off = (eptr - s); in ng_enaddr_parse()
1034 (*off)++; in ng_enaddr_parse()
1043 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_enaddr_unparse() argument
1048 data[*off], data[*off + 1], data[*off + 2], in ng_enaddr_unparse()
1049 data[*off + 3], data[*off + 4], data[*off + 5]); in ng_enaddr_unparse()
1052 *off += ETHER_ADDR_LEN; in ng_enaddr_unparse()
1093 const char *s, int *off, const u_char *const start, in ng_bytearray_parse() argument
1101 if ((str = ng_get_string_token(s, off, &toklen, &slen)) != NULL) { in ng_bytearray_parse()
1117 *off += toklen; in ng_bytearray_parse()
1125 return ng_array_parse(&subtype, s, off, start, buf, buflen); in ng_bytearray_parse()
1131 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_bytearray_unparse() argument
1137 return ng_array_unparse(&subtype, data, off, cbuf, cbuflen); in ng_bytearray_unparse()
1199 int *off, const u_char *const start, u_char *const buf, int *buflen, in ng_parse_composite() argument
1218 if (ng_parse_get_token(s, off, &len) in ng_parse_composite()
1223 *off += len; in ng_parse_composite()
1230 tok = ng_parse_get_token(s, off, &len); in ng_parse_composite()
1232 *off += len; in ng_parse_composite()
1257 off2 = *off + len; in ng_parse_composite()
1264 ul = strtoul(s + *off, &eptr, 0); in ng_parse_composite()
1265 if (ul == ULONG_MAX || eptr - (s + *off) != len) { in ng_parse_composite()
1271 *off += len + len2; in ng_parse_composite()
1285 if (strncmp(&s[*off], field->name, len) == 0 in ng_parse_composite()
1293 *off += len; in ng_parse_composite()
1296 if (ng_parse_get_token(s, off, &len) != T_EQUALS) { in ng_parse_composite()
1300 *off += len; in ng_parse_composite()
1315 while (isspace(s[*off])) in ng_parse_composite()
1316 (*off)++; in ng_parse_composite()
1317 foff[index] = *off; in ng_parse_composite()
1318 if ((error = ng_parse_skip_value(s, *off, &len)) != 0) in ng_parse_composite()
1320 *off += len; in ng_parse_composite()
1345 *off = foff[index]; in ng_parse_composite()
1347 s, off, start, buf + blen, &vlen); in ng_parse_composite()
1378 int *off, char *cbuf, int cbuflen, const enum comptype ctype) in ng_unparse_composite() argument
1382 const int num = ng_get_composite_len(type, data, data + *off, ctype); in ng_unparse_composite()
1404 *off += ng_parse_get_elem_pad(type, index, ctype, *off); in ng_unparse_composite()
1410 if (sizeof(*hdr) + *off < workSize) { in ng_unparse_composite()
1411 int tempsize = workSize - sizeof(*hdr) - *off; in ng_unparse_composite()
1413 bcopy(hdr, workBuf, sizeof(*hdr) + *off); in ng_unparse_composite()
1415 + sizeof(*hdr), workBuf + sizeof(*hdr) + *off, in ng_unparse_composite()
1417 && bcmp(workBuf + sizeof(*hdr) + *off, in ng_unparse_composite()
1418 data + *off, tempsize) == 0) { in ng_unparse_composite()
1419 *off += tempsize; in ng_unparse_composite()
1446 (etype, data, off, cbuf, cbuflen)) != 0) { in ng_unparse_composite()
1646 int off = off0; in ng_parse_skip_value() local
1650 switch (ng_parse_get_token(s, &off, &len)) { in ng_parse_skip_value()
1670 off += len; in ng_parse_skip_value()
1672 *lenp = off - off0; in ng_parse_skip_value()
1731 int start, off; in ng_get_string_token() local
1743 for (slen = 0, off = 1, p = cbuf; *p != '\0'; slen++, off++, p++) { in ng_get_string_token()
1746 *lenp = off + 1; in ng_get_string_token()
1759 off++; in ng_get_string_token()
1763 off++; in ng_get_string_token()
1767 off++; in ng_get_string_token()
1771 off++; in ng_get_string_token()
1775 off++; in ng_get_string_token()
1779 off++; in ng_get_string_token()
1786 off++; in ng_get_string_token()
1796 off++; in ng_get_string_token()
1819 int off = 0; in ng_encode_string() local
1825 cbuf[off++] = '"'; in ng_encode_string()
1829 cbuf[off++] = '\\'; in ng_encode_string()
1830 cbuf[off++] = 't'; in ng_encode_string()
1833 cbuf[off++] = '\\'; in ng_encode_string()
1834 cbuf[off++] = 'f'; in ng_encode_string()
1837 cbuf[off++] = '\\'; in ng_encode_string()
1838 cbuf[off++] = 'n'; in ng_encode_string()
1841 cbuf[off++] = '\\'; in ng_encode_string()
1842 cbuf[off++] = 'r'; in ng_encode_string()
1845 cbuf[off++] = '\\'; in ng_encode_string()
1846 cbuf[off++] = 'v'; in ng_encode_string()
1850 cbuf[off++] = '\\'; in ng_encode_string()
1851 cbuf[off++] = *raw; in ng_encode_string()
1855 off += sprintf(cbuf + off, in ng_encode_string()
1859 cbuf[off++] = *raw; in ng_encode_string()
1863 cbuf[off++] = '"'; in ng_encode_string()
1864 cbuf[off] = '\0'; in ng_encode_string()