diff options
Diffstat (limited to 'lib/libc/resolv/res_mkupdate.c')
-rw-r--r-- | lib/libc/resolv/res_mkupdate.c | 76 |
1 files changed, 40 insertions, 36 deletions
diff --git a/lib/libc/resolv/res_mkupdate.c b/lib/libc/resolv/res_mkupdate.c index 0e800e3..589c056 100644 --- a/lib/libc/resolv/res_mkupdate.c +++ b/lib/libc/resolv/res_mkupdate.c @@ -15,13 +15,14 @@ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* +/*! \file + * \brief * Based on the Dynamic DNS reference implementation by Viraj Bais - * <viraj_bais@ccm.fm.intel.com> + * <viraj_bais@ccm.fm.intel.com> */ #if !defined(lint) && !defined(SABER) -static const char rcsid[] = "$Id: res_mkupdate.c,v 1.1.2.1.4.5 2005/10/14 05:43:47 marka Exp $"; +static const char rcsid[] = "$Id: res_mkupdate.c,v 1.4.18.4 2005/10/14 05:44:12 marka Exp $"; #endif /* not lint */ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); @@ -74,17 +75,19 @@ static #endif int res_servicenumber(const char *); -/* +/*% * Form update packets. * Returns the size of the resulting packet if no error + * * On error, - * returns -1 if error in reading a word/number in rdata + * returns + *\li -1 if error in reading a word/number in rdata * portion for update packets - * -2 if length of buffer passed is insufficient - * -3 if zone section is not the first section in + *\li -2 if length of buffer passed is insufficient + *\li -3 if zone section is not the first section in * the linked list, or section order has a problem - * -4 on a number overflow - * -5 unknown operation or no records + *\li -4 on a number overflow + *\li -5 unknown operation or no records */ int res_nmkupdate(res_state statp, ns_updrec *rrecp_in, u_char *buf, int buflen) { @@ -204,7 +207,7 @@ res_nmkupdate(res_state statp, ns_updrec *rrecp_in, u_char *buf, int buflen) { } ShrinkBuffer(INT32SZ + INT16SZ); PUTLONG(rttl, cp); - sp2 = cp; /* save pointer to length byte */ + sp2 = cp; /*%< save pointer to length byte */ cp += INT16SZ; if (rrecp->r_size == 0) { if (section == S_UPDATE && rclass != C_ANY) @@ -410,7 +413,7 @@ res_nmkupdate(res_state statp, ns_updrec *rrecp_in, u_char *buf, int buflen) { } break; case T_X25: - /* RFC 1183 */ + /* RFC1183 */ if ((n = getstr_str(buf2, sizeof buf2, &startp, endp)) < 0) return (-1); @@ -422,7 +425,7 @@ res_nmkupdate(res_state statp, ns_updrec *rrecp_in, u_char *buf, int buflen) { cp += n; break; case T_ISDN: - /* RFC 1183 */ + /* RFC1183 */ if ((n = getstr_str(buf2, sizeof buf2, &startp, endp)) < 0) return (-1); @@ -727,7 +730,7 @@ res_nmkupdate(res_state statp, ns_updrec *rrecp_in, u_char *buf, int buflen) { return (cp - buf); } -/* +/*% * Get a whitespace delimited word from a string (not file) * into buf. modify the start pointer to point after the * word in the string. @@ -740,9 +743,9 @@ getword_str(char *buf, int size, u_char **startpp, u_char *endp) { for (cp = buf; *startpp <= endp; ) { c = **startpp; if (isspace(c) || c == '\0') { - if (cp != buf) /* trailing whitespace */ + if (cp != buf) /*%< trailing whitespace */ break; - else { /* leading whitespace */ + else { /*%< leading whitespace */ (*startpp)++; continue; } @@ -756,9 +759,9 @@ getword_str(char *buf, int size, u_char **startpp, u_char *endp) { return (cp != buf); } -/* +/*% * get a white spae delimited string from memory. Process quoted strings - * and \DDD escapes. Return length or -1 on error. Returned string may + * and \\DDD escapes. Return length or -1 on error. Returned string may * contain nulls. */ static char digits[] = "0123456789"; @@ -835,7 +838,8 @@ getstr_str(char *buf, int size, u_char **startpp, u_char *endp) { *cp = '\0'; return ((cp == buf)? (seen_quote? 0: -1): (cp - buf)); } -/* + +/*% * Get a whitespace delimited base 16 number from a string (not file) into buf * update the start pointer to point after the number in the string. */ @@ -851,9 +855,9 @@ gethexnum_str(u_char **startpp, u_char *endp) { for (n = 0; *startpp <= endp; ) { c = **startpp; if (isspace(c) || c == '\0') { - if (seendigit) /* trailing whitespace */ + if (seendigit) /*%< trailing whitespace */ break; - else { /* leading whitespace */ + else { /*%< leading whitespace */ (*startpp)++; continue; } @@ -883,7 +887,7 @@ gethexnum_str(u_char **startpp, u_char *endp) { return (n + m); } -/* +/*% * Get a whitespace delimited base 10 number from a string (not file) into buf * update the start pointer to point after the number in the string. */ @@ -896,9 +900,9 @@ getnum_str(u_char **startpp, u_char *endp) { for (n = 0; *startpp <= endp; ) { c = **startpp; if (isspace(c) || c == '\0') { - if (seendigit) /* trailing whitespace */ + if (seendigit) /*%< trailing whitespace */ break; - else { /* leading whitespace */ + else { /*%< leading whitespace */ (*startpp)++; continue; } @@ -925,7 +929,7 @@ getnum_str(u_char **startpp, u_char *endp) { return (n + m); } -/* +/*% * Allocate a resource record buffer & save rr info. */ ns_updrec * @@ -947,7 +951,7 @@ res_mkupdrec(int section, const char *dname, return (rrecp); } -/* +/*% * Free a resource record buffer created by res_mkupdrec. */ void @@ -989,7 +993,7 @@ res_buildservicelist() { free(slp); break; } - slp->port = ntohs((u_int16_t)sp->s_port); /* host byt order */ + slp->port = ntohs((u_int16_t)sp->s_port); /*%< host byt order */ slp->next = servicelist; slp->prev = NULL; if (servicelist) @@ -1036,7 +1040,7 @@ res_buildprotolist(void) { free(slp); break; } - slp->port = pp->p_proto; /* host byte order */ + slp->port = pp->p_proto; /*%< host byte order */ slp->next = protolist; slp->prev = NULL; if (protolist) @@ -1075,14 +1079,14 @@ findservice(const char *s, struct valuelist **list) { lp->next = *list; *list = lp; } - return (lp->port); /* host byte order */ + return (lp->port); /*%< host byte order */ } if (sscanf(s, "%d", &n) != 1 || n <= 0) n = -1; return (n); } -/* +/*% * Convert service name or (ascii) number to int. */ #ifdef _LIBC @@ -1095,7 +1099,7 @@ res_servicenumber(const char *p) { return (findservice(p, &servicelist)); } -/* +/*% * Convert protocol name or (ascii) number to int. */ #ifdef _LIBC @@ -1110,14 +1114,14 @@ res_protocolnumber(const char *p) { #ifndef _LIBC static struct servent * -cgetservbyport(u_int16_t port, const char *proto) { /* Host byte order. */ +cgetservbyport(u_int16_t port, const char *proto) { /*%< Host byte order. */ struct valuelist **list = &servicelist; struct valuelist *lp = *list; static struct servent serv; port = ntohs(port); for (; lp != NULL; lp = lp->next) { - if (port != (u_int16_t)lp->port) /* Host byte order. */ + if (port != (u_int16_t)lp->port) /*%< Host byte order. */ continue; if (strcasecmp(lp->proto, proto) == 0) { if (lp != *list) { @@ -1138,13 +1142,13 @@ cgetservbyport(u_int16_t port, const char *proto) { /* Host byte order. */ } static struct protoent * -cgetprotobynumber(int proto) { /* Host byte order. */ +cgetprotobynumber(int proto) { /*%< Host byte order. */ struct valuelist **list = &protolist; struct valuelist *lp = *list; static struct protoent prot; for (; lp != NULL; lp = lp->next) - if (lp->port == proto) { /* Host byte order. */ + if (lp->port == proto) { /*%< Host byte order. */ if (lp != *list) { lp->prev->next = lp->next; if (lp->next) @@ -1154,7 +1158,7 @@ cgetprotobynumber(int proto) { /* Host byte order. */ *list = lp; } prot.p_name = lp->name; - prot.p_proto = lp->port; /* Host byte order. */ + prot.p_proto = lp->port; /*%< Host byte order. */ return (&prot); } return (0); @@ -1176,7 +1180,7 @@ res_protocolname(int num) { } const char * -res_servicename(u_int16_t port, const char *proto) { /* Host byte order. */ +res_servicename(u_int16_t port, const char *proto) { /*%< Host byte order. */ static char number[8]; struct servent *ss; |