Changeset f85ed4b in mainline for uspace/srv/net/dnsres/dns_msg.c
- Timestamp:
- 2012-08-12T17:51:26Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 08a6382
- Parents:
- adae30d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/dnsres/dns_msg.c
radae30d rf85ed4b 45 45 #define NAME "dnsres" 46 46 47 #include <stdio.h> 47 48 static int dns_name_encode(char *name, uint8_t *buf, size_t buf_size, 48 49 size_t *act_size) … … 55 56 pi = 0; 56 57 di = 1; 57 58 off = 0; 59 60 printf("dns_name_encode(name='%s', buf=%p, buf_size=%zu, act_size=%p\n", 61 name, buf, buf_size, act_size); 58 62 lsize = 0; 59 63 while (true) { 64 printf("off=%zu\n", off); 60 65 c = str_decode(name, &off, STR_NO_LIMIT); 66 printf("c=%d\n", (int)c); 61 67 if (c > 127) { 62 68 /* Non-ASCII character */ 69 printf("non-ascii character\n"); 63 70 return EINVAL; 64 71 } … … 66 73 if (c == '.' || c == '\0') { 67 74 /* Empty string, starting with period or two consecutive periods. */ 68 if (lsize == 0) 75 if (lsize == 0) { 76 printf("empty token\n"); 69 77 return EINVAL; 78 } 70 79 71 80 if (lsize > DNS_LABEL_MAX_SIZE) { 72 81 /* Label too long */ 82 printf("label too long\n"); 73 83 return EINVAL; 74 84 } … … 83 93 ++di; 84 94 } else { 95 ++lsize; 85 96 if (buf != NULL && di < buf_size) 86 97 buf[di++] = c; … … 116 127 117 128 *act_size = name_size + sizeof(uint16_t) + sizeof(uint16_t); 129 if (buf == NULL) 130 return EOK; 131 118 132 di = name_size; 119 133
Note:
See TracChangeset
for help on using the changeset viewer.