Lines Matching refs:off
105 const char *s, int *off, const u_char *start,
108 const u_char *data, int *off, char *cbuf, int cbuflen,
122 static int ng_parse_skip_value(const char *s, int off, int *lenp);
148 const char *string, int *off, u_char *buf, int *buflen) in ng_parse() argument
150 return INVOKE(type, parse)(type, string, off, buf, buf, buflen); in ng_parse()
160 int off = 0; in ng_unparse() local
162 return INVOKE(type, unparse)(type, data, &off, cbuf, cbuflen); in ng_unparse()
184 const char *s, int *off, const u_char *const start, in ng_struct_parse() argument
187 return ng_parse_composite(type, s, off, start, buf, buflen, CT_STRUCT); in ng_struct_parse()
192 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_struct_unparse() argument
194 return ng_unparse_composite(type, data, off, cbuf, cbuflen, CT_STRUCT); in ng_struct_unparse()
201 int off = 0; in ng_struct_getDefault() local
204 "{}", &off, start, buf, buflen, CT_STRUCT); in ng_struct_getDefault()
238 const char *s, int *off, const u_char *const start, in ng_fixedarray_parse() argument
242 s, off, start, buf, buflen, CT_FIXEDARRAY); in ng_fixedarray_parse()
247 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_fixedarray_unparse() argument
250 data, off, cbuf, cbuflen, CT_FIXEDARRAY); in ng_fixedarray_unparse()
257 int off = 0; in ng_fixedarray_getDefault() local
260 "[]", &off, start, buf, buflen, CT_FIXEDARRAY); in ng_fixedarray_getDefault()
287 const char *s, int *off, const u_char *const start, in ng_array_parse() argument
290 return ng_parse_composite(type, s, off, start, buf, buflen, CT_ARRAY); in ng_array_parse()
295 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_array_unparse() argument
297 return ng_unparse_composite(type, data, off, cbuf, cbuflen, CT_ARRAY); in ng_array_unparse()
304 int off = 0; in ng_array_getDefault() local
307 "[]", &off, start, buf, buflen, CT_ARRAY); in ng_array_getDefault()
334 const char *s, int *off, const u_char *const start, in ng_int8_parse() argument
341 val = strtol(s + *off, &eptr, 0); in ng_int8_parse()
342 if (val < (int8_t)0x80 || val > (u_int8_t)0xff || eptr == s + *off) in ng_int8_parse()
344 *off = eptr - s; in ng_int8_parse()
353 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_int8_unparse() argument
360 bcopy(data + *off, &val, sizeof(int8_t)); in ng_int8_unparse()
379 *off += sizeof(int8_t); in ng_int8_unparse()
429 const char *s, int *off, const u_char *const start, in ng_int16_parse() argument
436 val = strtol(s + *off, &eptr, 0); in ng_int16_parse()
438 || val > (u_int16_t)0xffff || eptr == s + *off) in ng_int16_parse()
440 *off = eptr - s; in ng_int16_parse()
449 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_int16_unparse() argument
456 bcopy(data + *off, &val, sizeof(int16_t)); in ng_int16_unparse()
475 *off += sizeof(int16_t); in ng_int16_unparse()
525 const char *s, int *off, const u_char *const start, in ng_int32_parse() argument
533 val = strtol(s + *off, &eptr, 0); in ng_int32_parse()
535 val = strtoul(s + *off, &eptr, 0); in ng_int32_parse()
537 || val > (u_int32_t)0xffffffff || eptr == s + *off) in ng_int32_parse()
539 *off = eptr - s; in ng_int32_parse()
548 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_int32_unparse() argument
555 bcopy(data + *off, &val, sizeof(int32_t)); in ng_int32_unparse()
574 *off += sizeof(int32_t); in ng_int32_unparse()
624 const char *s, int *off, const u_char *const start, in ng_int64_parse() argument
631 val = strtoq(s + *off, &eptr, 0); in ng_int64_parse()
632 if (eptr == s + *off) in ng_int64_parse()
634 *off = eptr - s; in ng_int64_parse()
643 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_int64_unparse() argument
650 bcopy(data + *off, &val, sizeof(int64_t)); in ng_int64_unparse()
669 *off += sizeof(int64_t); in ng_int64_unparse()
719 const char *s, int *off, const u_char *const start, in ng_string_parse() argument
726 if ((sval = ng_get_string_token(s, off, &len, &slen)) == NULL) in ng_string_parse()
728 *off += len; in ng_string_parse()
737 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_string_unparse() argument
739 const char *const raw = (const char *)data + *off; in ng_string_unparse()
749 *off += strlen(raw) + 1; in ng_string_unparse()
782 const char *s, int *off, const u_char *const start, in ng_fixedstring_parse() argument
790 if ((sval = ng_get_string_token(s, off, &len, &slen)) == NULL) in ng_fixedstring_parse()
796 *off += len; in ng_fixedstring_parse()
806 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_fixedstring_unparse() argument
809 int error, temp = *off; in ng_fixedstring_unparse()
813 *off += fi->bufSize; in ng_fixedstring_unparse()
886 const char *s, int *off, const u_char *const start, in ng_sizedstring_parse() argument
893 if ((sval = ng_get_string_token(s, off, &len, &slen)) == NULL) in ng_sizedstring_parse()
899 *off += len; in ng_sizedstring_parse()
909 const u_char *data, int *off, char *cbuf, int cbuflen) in ng_sizedstring_unparse() argument
911 const char *const raw = (const char *)data + *off + 2; in ng_sizedstring_unparse()
912 const int slen = *((const u_int16_t *)(data + *off)); in ng_sizedstring_unparse()
923 *off += slen + 2; in ng_sizedstring_unparse()
954 const char *s, int *off, const u_char *const start, in ng_ipaddr_parse() argument
961 s, off, start, buf + i, buflen)) != 0) in ng_ipaddr_parse()
963 if (i < 3 && s[*off] != '.') in ng_ipaddr_parse()
965 (*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
1216 if (ng_parse_get_token(s, off, &len) in ng_parse_composite()
1221 *off += len; in ng_parse_composite()
1228 tok = ng_parse_get_token(s, off, &len); in ng_parse_composite()
1230 *off += len; in ng_parse_composite()
1255 off2 = *off + len; in ng_parse_composite()
1262 ul = strtoul(s + *off, &eptr, 0); in ng_parse_composite()
1263 if (ul == ULONG_MAX || eptr - (s + *off) != len) { in ng_parse_composite()
1269 *off += len + len2; in ng_parse_composite()
1283 if (strncmp(&s[*off], field->name, len) == 0 in ng_parse_composite()
1291 *off += len; in ng_parse_composite()
1294 if (ng_parse_get_token(s, off, &len) != T_EQUALS) { in ng_parse_composite()
1298 *off += len; in ng_parse_composite()
1313 while (isspace(s[*off])) in ng_parse_composite()
1314 (*off)++; in ng_parse_composite()
1315 foff[index] = *off; in ng_parse_composite()
1316 if ((error = ng_parse_skip_value(s, *off, &len)) != 0) in ng_parse_composite()
1318 *off += len; in ng_parse_composite()
1343 *off = foff[index]; in ng_parse_composite()
1345 s, off, start, buf + blen, &vlen); in ng_parse_composite()
1376 int *off, char *cbuf, int cbuflen, const enum comptype ctype) in ng_unparse_composite() argument
1380 const int num = ng_get_composite_len(type, data, data + *off, ctype); in ng_unparse_composite()
1402 *off += ng_parse_get_elem_pad(type, index, ctype, *off); in ng_unparse_composite()
1408 if (sizeof(*hdr) + *off < workSize) { in ng_unparse_composite()
1409 int tempsize = workSize - sizeof(*hdr) - *off; in ng_unparse_composite()
1411 bcopy(hdr, workBuf, sizeof(*hdr) + *off); in ng_unparse_composite()
1413 + sizeof(*hdr), workBuf + sizeof(*hdr) + *off, in ng_unparse_composite()
1415 && bcmp(workBuf + sizeof(*hdr) + *off, in ng_unparse_composite()
1416 data + *off, tempsize) == 0) { in ng_unparse_composite()
1417 *off += tempsize; in ng_unparse_composite()
1444 (etype, data, off, cbuf, cbuflen)) != 0) { in ng_unparse_composite()
1644 int off = off0; in ng_parse_skip_value() local
1648 switch (ng_parse_get_token(s, &off, &len)) { in ng_parse_skip_value()
1668 off += len; in ng_parse_skip_value()
1670 *lenp = off - off0; in ng_parse_skip_value()
1729 int start, off; in ng_get_string_token() local
1741 for (slen = 0, off = 1, p = cbuf; *p != '\0'; slen++, off++, p++) { in ng_get_string_token()
1744 *lenp = off + 1; in ng_get_string_token()
1757 off++; in ng_get_string_token()
1761 off++; in ng_get_string_token()
1765 off++; in ng_get_string_token()
1769 off++; in ng_get_string_token()
1773 off++; in ng_get_string_token()
1777 off++; in ng_get_string_token()
1784 off++; in ng_get_string_token()
1794 off++; in ng_get_string_token()
1817 int off = 0; in ng_encode_string() local
1823 cbuf[off++] = '"'; in ng_encode_string()
1827 cbuf[off++] = '\\'; in ng_encode_string()
1828 cbuf[off++] = 't'; in ng_encode_string()
1831 cbuf[off++] = '\\'; in ng_encode_string()
1832 cbuf[off++] = 'f'; in ng_encode_string()
1835 cbuf[off++] = '\\'; in ng_encode_string()
1836 cbuf[off++] = 'n'; in ng_encode_string()
1839 cbuf[off++] = '\\'; in ng_encode_string()
1840 cbuf[off++] = 'r'; in ng_encode_string()
1843 cbuf[off++] = '\\'; in ng_encode_string()
1844 cbuf[off++] = 'v'; in ng_encode_string()
1848 cbuf[off++] = '\\'; in ng_encode_string()
1849 cbuf[off++] = *raw; in ng_encode_string()
1853 off += sprintf(cbuf + off, in ng_encode_string()
1857 cbuf[off++] = *raw; in ng_encode_string()
1861 cbuf[off++] = '"'; in ng_encode_string()
1862 cbuf[off] = '\0'; in ng_encode_string()