diff options
Diffstat (limited to 'src')
63 files changed, 332 insertions, 318 deletions
diff --git a/src/alloc.c b/src/alloc.c index 7e4ccb4..ea19e8e 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -8,13 +8,21 @@ #define ALIGNMENT 16 /* XXX: assuming that this alignment is enough */ #define SPACE 4096 /* must be multiple of ALIGNMENT */ +#define space ((char *)realspace) + +/** + @file alloc.c + @authors djb, feh, jmh + @ref qmail + @brief Generic allocation of heap memory +*/ typedef union { char irrelevant[ALIGNMENT]; double d; } aligned; + static aligned realspace[SPACE / ALIGNMENT]; -#define space ((char *)realspace) static unsigned int avail = SPACE; /* multiple of ALIGNMENT; 0<=avail<=SPACE */ void *alloc(unsigned int n) diff --git a/src/base64.c b/src/base64.c index 17847d9..3bb76d4 100644 --- a/src/base64.c +++ b/src/base64.c @@ -6,7 +6,6 @@ /** @file base64.c @author unkown - @source unknown @brief base64 en+decoding of strings */ diff --git a/src/buffer.c b/src/buffer.c index f094213..68327b8 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -27,16 +27,26 @@ static ssize_t buffer_0_read(int fd, char *buf, size_t len) return read(fd, buf, len); } +ssize_t buffer_unixread(int fd, char *buf, size_t len) +{ + return (ssize_t)read(fd, buf, len); +} + +ssize_t buffer_unixwrite(int fd, char *buf, size_t len) +{ + return (ssize_t)write(fd, buf, len); +} + char buffer_0_space[BUFFER_INSIZE]; static buffer it0 = BUFFER_INIT(buffer_0_read, 0, buffer_0_space, sizeof(buffer_0_space)); buffer *buffer_0 = &it0; char buffer_1_space[BUFFER_OUTSIZE]; -static buffer it1 = BUFFER_INIT(write, 1, buffer_1_space, sizeof(buffer_1_space)); +static buffer it1 = BUFFER_INIT(buffer_unixwrite, 1, buffer_1_space, sizeof(buffer_1_space)); buffer *buffer_1 = &it1; char buffer_2_space[BUFFER_OUTSIZE]; -static buffer it2 = BUFFER_INIT(write, 2, buffer_2_space, sizeof(buffer_2_space)); +static buffer it2 = BUFFER_INIT(buffer_unixwrite, 2, buffer_2_space, sizeof(buffer_2_space)); buffer *buffer_2 = &it2; char buffer_0_small[BUFFER_SMALL]; @@ -44,23 +54,13 @@ static buffer is0 = BUFFER_INIT(buffer_0_read, 0, buffer_0_small, sizeof(buffer_ buffer *buffer_0small = &is0; char buffer_1_small[BUFFER_SMALL]; -static buffer is1 = BUFFER_INIT(write, 1, buffer_1_small, sizeof(buffer_1_small)); +static buffer is1 = BUFFER_INIT(buffer_unixwrite, 1, buffer_1_small, sizeof(buffer_1_small)); buffer *buffer_1small = &is1; char buffer_2_small[BUFFER_SMALL]; -static buffer is2 = BUFFER_INIT(write, 2, buffer_2_small, sizeof(buffer_2_small)); +static buffer is2 = BUFFER_INIT(buffer_unixwrite, 2, buffer_2_small, sizeof(buffer_2_small)); buffer *buffer_2small = &is2; -ssize_t buffer_unixread(int fd, char *buf, size_t len) -{ - return read(fd, buf, len); -} - -ssize_t buffer_unixwrite(int fd, char *buf, size_t len) -{ - return write(fd, buf, len); -} - int buffer_copy(buffer *bout, buffer *bin) { int n; @@ -12,60 +12,63 @@ unsigned int byte_chr(char *s, unsigned int n, int c) char *t = s; for (;;) { - // clang-format off - if (!n) { break; } if (*t == ch) { break; } ++t; --n; - if (!n) { break; } if (*t == ch) { break; } ++t; --n; - if (!n) { break; } if (*t == ch) { break; } ++t; --n; - if (!n) { break; } if (*t == ch) { break; } ++t; --n; - // clang-format on + if (!n) { + break; + } + if (*t == ch) { + break; + } + ++t; + --n; } return t - s; } -void byte_copy(void *a, unsigned int n, const void *b) +void byte_copy(void *to, unsigned int n, const void *from) { - char *to = a; - const char *from = b; + char *out = to; // share same address + const char *in = from; // one byte for (;;) { - // clang-format off - if (!n) { return; } *to++ = *from++; --n; - if (!n) { return; } *to++ = *from++; --n; - if (!n) { return; } *to++ = *from++; --n; - if (!n) { return; } *to++ = *from++; --n; - // clang-format on + if (!n) { + return; + } + *out++ = *in++; + --n; } } -void byte_copyr(void *a, unsigned int n, const void *b) +void byte_copyr(void *to, unsigned int n, const void *from) { - char *to = a + n; - const char *from = b + n; + char *out = to + n; + const char *in = from + n; for (;;) { - // clang-format off - if (!n) { return; } *--to = *--from; --n; - if (!n) { return; } *--to = *--from; --n; - if (!n) { return; } *--to = *--from; --n; - if (!n) { return; } *--to = *--from; --n; - // clang-format on + if (!n) { + return; + } + *--out = *--in; + --n; } } -int byte_diff(const void *a, unsigned int n, const void *b) +int byte_diff(const void *s, unsigned int n, const void *t) { - const char *s = a; - const char *t = b; + const char *a = s; + const char *b = t; for (;;) { - // clang-format off - if (!n) { return 0; } if (*s != *t) { break; } ++s; ++t; --n; - if (!n) { return 0; } if (*s != *t) { break; } ++s; ++t; --n; - if (!n) { return 0; } if (*s != *t) { break; } ++s; ++t; --n; - if (!n) { return 0; } if (*s != *t) { break; } ++s; ++t; --n; - // clang-format on + if (!n) { + return 0; + } + if (*a != *b) { + break; + } + ++a; + ++b; + --n; } - return ((int)(unsigned int)(unsigned char)*s) - ((int)(unsigned int)(unsigned char)*t); + return ((int)(unsigned int)(unsigned char)*a) - ((int)(unsigned int)(unsigned char)*b); } unsigned int byte_rchr(char *s, unsigned int n, int c) @@ -75,42 +78,44 @@ unsigned int byte_rchr(char *s, unsigned int n, int c) char *u = 0; for (;;) { - // clang-format off - if (!n) { break; } if (*t == ch) { u = t; } ++t; --n; - if (!n) { break; } if (*t == ch) { u = t; } ++t; --n; - if (!n) { break; } if (*t == ch) { u = t; } ++t; --n; - if (!n) { break; } if (*t == ch) { u = t; } ++t; --n; - // clang-format on + if (!n) { + break; + } + if (*t == ch) { + u = t; + } + ++t; + --n; + } + if (!u) { + u = t; } - if (!u) u = t; return u - s; } -void byte_zero(void *v, unsigned int n) +void byte_zero(void *s, unsigned int n) { - char *s = v; + char *out = s; for (;;) { - // clang-format off - if (!n) { break; } *s++ = 0; --n; - if (!n) { break; } *s++ = 0; --n; - if (!n) { break; } *s++ = 0; --n; - if (!n) { break; } *s++ = 0; --n; - // clang-format on + if (!n) { + break; + } + *out++ = 0; + --n; } } -void byte_fill(void *a, unsigned int n, int c) +void byte_fill(void *to, unsigned int n, int c) { - char *s = a; + char *s = to; char ch = c; for (;;) { - // clang-format off - if (!n) { break; } *s++ = ch; --n; - if (!n) { break; } *s++ = ch; --n; - if (!n) { break; } *s++ = ch; --n; - if (!n) { break; } *s++ = ch; --n; - // clang-format on + if (!n) { + break; + } + *s++ = ch; + --n; } } diff --git a/src/cdbmake.c b/src/cdbmake.c index d1464d1..d4d9270 100644 --- a/src/cdbmake.c +++ b/src/cdbmake.c @@ -10,7 +10,7 @@ /** @file cdbmake.c @author djb - @source ucspi-tcp + @ref ucspi-tcp @brief constant data base (cdb) generation */ diff --git a/src/cdbread.c b/src/cdbread.c index 8ba920c..6f985f8 100644 --- a/src/cdbread.c +++ b/src/cdbread.c @@ -12,7 +12,7 @@ /** @file cdbread.c @author djb - @source ucspi-tcp, fastforward + @ref ucspi-tcp, fastforward @brief read entries from a cdb */ diff --git a/src/constmap.c b/src/constmap.c index 360d6f5..13df324 100644 --- a/src/constmap.c +++ b/src/constmap.c @@ -3,6 +3,15 @@ #include "alloc.h" #include "case.h" +/** + @file constmap.c + @author djb + @ref qmail + @brief constant hash table + @brief Attention! constmap is both function and struct +*/ + + static constmap_hash hash(char *s, int len) { unsigned char ch; diff --git a/src/dnsstub/dns_dfd.c b/src/dnsstub/dns_dfd.c index 832bd6e..772dbc3 100644 --- a/src/dnsstub/dns_dfd.c +++ b/src/dnsstub/dns_dfd.c @@ -4,10 +4,10 @@ #include "error.h" /** - @file dns_dfd.c - @author djb - @source ucspi-tcp - @brief domain name qualification (domain from dot) + @file dns_dfd.c + @author djb + @ref ucspi-tcp + @brief domain name qualification (domain from dot) */ int dns_domain_fromdot(char **out, const char *buf, unsigned int n) diff --git a/src/dnsstub/dns_domain.c b/src/dnsstub/dns_domain.c index dcdf2f2..6c6228d 100644 --- a/src/dnsstub/dns_domain.c +++ b/src/dnsstub/dns_domain.c @@ -4,10 +4,10 @@ #include "dnsresolv.h" /** - @file dns_domain.c - @author djb - @source ucspi-tcp - @brief domain qualification + @file dns_domain.c + @author djb + @ref ucspi-tcp + @brief domain qualification */ unsigned int dns_domain_length(const char *dn) diff --git a/src/dnsstub/dns_dtda.c b/src/dnsstub/dns_dtda.c index f1b7d58..5da6186 100644 --- a/src/dnsstub/dns_dtda.c +++ b/src/dnsstub/dns_dtda.c @@ -2,10 +2,10 @@ #include "stralloc.h" /** - @file dns_dtda.c - @author djb - @source ucspi-tcp - @brief domain to dot append + @file dns_dtda.c + @author djb + @ref ucspi-tcp + @brief domain to dot append */ int dns_domain_todot_cat(stralloc *out, const char *d) diff --git a/src/dnsstub/dns_ip.c b/src/dnsstub/dns_ip.c index 913c310..88f12b3 100644 --- a/src/dnsstub/dns_ip.c +++ b/src/dnsstub/dns_ip.c @@ -5,10 +5,10 @@ #include "uint_t.h" /** - @file dns_ip.c - @author djb, fefe, feh - @source ucspi-tcp6 - @brief DNS IP query + @file dns_ip.c + @authors djb, fefe, feh + @ref ucspi-tcp6 + @brief DNS IP query */ static char *q = 0; diff --git a/src/dnsstub/dns_ipq.c b/src/dnsstub/dns_ipq.c index 49049b5..2bfd97e 100644 --- a/src/dnsstub/dns_ipq.c +++ b/src/dnsstub/dns_ipq.c @@ -7,9 +7,9 @@ #include "stralloc.h" /** - @file dns_ipq.c - @author djb, feh - @source ucspi-tcp + @file dns_ipq.c + @authors djb, feh + @ref ucspi-tcp @brief DNS hostname qualification for ipv4 and ipv6 */ diff --git a/src/dnsstub/dns_mx.c b/src/dnsstub/dns_mx.c index 967999e..5cf7a62 100644 --- a/src/dnsstub/dns_mx.c +++ b/src/dnsstub/dns_mx.c @@ -6,7 +6,7 @@ /** @file dns_mx.c @author djb - @source qmail + @ref qmail @brief dns MX query @param (on output) stralloc out */ diff --git a/src/dnsstub/dns_name.c b/src/dnsstub/dns_name.c index 1802143..f77cbe1 100644 --- a/src/dnsstub/dns_name.c +++ b/src/dnsstub/dns_name.c @@ -5,10 +5,10 @@ #include "uint_t.h" /** - @file dns_name.c - @author djb, fefe, feh - @source ucspi-tcp - @brief DNS name query (ptr) + @file dns_name.c + @authors djb, fefe, feh + @ref ucspi-tcp + @brief DNS name query (ptr) */ static char *q = 0; diff --git a/src/dnsstub/dns_nd.c b/src/dnsstub/dns_nd.c index b8e153a..a5f9cc7 100644 --- a/src/dnsstub/dns_nd.c +++ b/src/dnsstub/dns_nd.c @@ -5,8 +5,8 @@ /** @file dns_nd.c - @autor djb, fefe - @source ucspi-tcp + @authors djb, fefe + @ref ucspi-tcp @brief DNS domain name for ip (wire format) */ diff --git a/src/dnsstub/dns_packet.c b/src/dnsstub/dns_packet.c index 66d6196..d654a84 100644 --- a/src/dnsstub/dns_packet.c +++ b/src/dnsstub/dns_packet.c @@ -2,11 +2,11 @@ #include "error.h" /** - @file dns_packet.c - @author djb - @source ucspi-tcp - @brief DNS low level packet routine - @brief DNS should have used LZ77 instead of its own sophomoric compression algorithm. + @file dns_packet.c + @author djb + @ref ucspi-tcp + @brief DNS low level packet routine + @brief DNS should have used LZ77 instead of its own sophomoric compression algorithm. */ unsigned int dns_packet_copy( diff --git a/src/dnsstub/dns_random.c b/src/dnsstub/dns_random.c index d345c78..fede312 100644 --- a/src/dnsstub/dns_random.c +++ b/src/dnsstub/dns_random.c @@ -5,10 +5,10 @@ #include "uint_t.h" /** - @file dns_random.c - @author djb - @source ucspi-tcp - @brief random use of DNS resolvers given their IP + @file dns_random.c + @author djb + @ref ucspi-tcp + @brief random use of DNS resolvers given their IP */ static uint32 seed[32]; diff --git a/src/dnsstub/dns_rcip.c b/src/dnsstub/dns_rcip.c index 2d6ad08..ca09ad2 100644 --- a/src/dnsstub/dns_rcip.c +++ b/src/dnsstub/dns_rcip.c @@ -9,7 +9,7 @@ /** @file dns_rcip.c @author djb, fefe, feh - @source ucspi-tcp + @ref ucspi-tcp @brief DNS receive for query */ diff --git a/src/dnsstub/dns_rcrw.c b/src/dnsstub/dns_rcrw.c index 95239a2..ba8daa0 100644 --- a/src/dnsstub/dns_rcrw.c +++ b/src/dnsstub/dns_rcrw.c @@ -10,7 +10,7 @@ /** @file dns_rcrw.c @author djb - @source ucspi-tcp + @ref ucspi-tcp @brief DNS receive rewrite */ diff --git a/src/dnsstub/dns_resolve.c b/src/dnsstub/dns_resolve.c index 6257b08..bb688a2 100644 --- a/src/dnsstub/dns_resolve.c +++ b/src/dnsstub/dns_resolve.c @@ -6,8 +6,8 @@ /** @file dns_resolve.c - @author djb, fefe, feh - @source ucspi-tcp + @authors djb, fefe, feh + @ref ucspi-tcp @brief high-level DNS resolve function */ diff --git a/src/dnsstub/dns_sortip.c b/src/dnsstub/dns_sortip.c index f319f53..dd3eb17 100644 --- a/src/dnsstub/dns_sortip.c +++ b/src/dnsstub/dns_sortip.c @@ -5,7 +5,7 @@ /** @file dns_sortip.c @authors djb, fefe, feh - @source ucspi-tcp6 + @ref ucspi-tcp6 @brief random sort of DNS servers per IP */ diff --git a/src/dnsstub/dns_transmit.c b/src/dnsstub/dns_transmit.c index bc37791..49cc18e 100644 --- a/src/dnsstub/dns_transmit.c +++ b/src/dnsstub/dns_transmit.c @@ -13,7 +13,7 @@ /** @file dns_transmit.c @authors djb, fefe, feh - @source qlibs + @ref qlibs @brief DNS query function @brief scope_ids[32] -> 32 LLU root servers supported */ diff --git a/src/dnsstub/dns_txt.c b/src/dnsstub/dns_txt.c index 8368a05..cead0d8 100644 --- a/src/dnsstub/dns_txt.c +++ b/src/dnsstub/dns_txt.c @@ -3,6 +3,13 @@ #include "stralloc.h" #include "uint_t.h" +/** + @file dns_txt.c + @authors djb, fefe, feh + @ref ucspi-tcp + @brief DNS text query (txt) +*/ + int dns_txt_packet(stralloc *out, const char *buf, unsigned int len) { unsigned int pos; @@ -6,7 +6,7 @@ /** @file env.c @author djb - @source ucspi-tcp + @ref ucspi-tcp @brief setting up environment after fork */ @@ -111,7 +111,7 @@ int env_put(char *name, char *value) return 1; } -int env_init(void) +int env_init() { char **newenviron; int i; diff --git a/src/errstr.c b/src/errstr.c index e2807ef..7de2cd7 100644 --- a/src/errstr.c +++ b/src/errstr.c @@ -3,7 +3,7 @@ /** @file errstr.c @author kp - @source qlibs + @ref qlibs @brief error output to log for different conditions and OS */ @@ -5,7 +5,7 @@ /** @file fd.c @autor djb - @source qmail + @ref qmail @brief file descriptor manipulation */ @@ -2,8 +2,8 @@ /** @file fmt.c - @author djb - @source qmail + @authors djb, feh + @ref qmail @brief formating differnt inputs format for output printing */ @@ -20,7 +20,7 @@ unsigned int fmt_str(char *s, const char *t) return len; } -unsigned int fmt_strn(char *s, char *t, unsigned int n) +unsigned int fmt_strn(char *s, const char *t, unsigned int n) { unsigned int len; char ch; diff --git a/src/getln.c b/src/getln.c index 476e197..f1e059c 100644 --- a/src/getln.c +++ b/src/getln.c @@ -5,8 +5,8 @@ /** @file getln.c @author djb - @source qmail - @brief evaluting tokenized input arguments + @ref qmail + @brief evaluating tokenized input arguments */ int getln(buffer *b, stralloc *sa, int *match, int sep) diff --git a/src/getoptb.c b/src/getoptb.c index e0f6118..f64d0ef 100644 --- a/src/getoptb.c +++ b/src/getoptb.c @@ -5,7 +5,7 @@ /** @file getoptb.c @author djb - @source ucspi-tcp + @ref ucspi-tcp @brief 'getopt' version w/o stdlib */ @@ -15,7 +15,7 @@ int opterr = 1; char *optprogname = 0; -static int getopt(int argc, char **argv, char *opts) +int getoptb(int argc, char **argv, char *opts) { int c; char *s; diff --git a/src/iopause.c b/src/iopause.c index 9c160ac..b8614b2 100644 --- a/src/iopause.c +++ b/src/iopause.c @@ -8,7 +8,7 @@ /** @file iopause.c @author djb - @source qmail + @ref qmail @brief stateful reading from net @return > 0 if successful */ @@ -5,19 +5,18 @@ /** @file ip4.c - @author djb, fefe, feh, kp - @source ucspi-tcp, ucspi-tcp6 + @authors djb, fefe, feh, kp + @ref ucspi-tcp, ucspi-tcp6 @brief handling of IPv4 addresses */ /** - @brief ip4_fmt - converts IPv4 address to dotted decimal string format - @param input: IPv4 char array - output: IPv4 address string - @return int length of address (ok > 0) - */ - + * @brief ip4_fmt + * converts IPv4 address to dotted decimal string format + * @param input: IPv4 char array + * output: IPv4 address string + * @return int length of address (ok > 0) + */ unsigned int ip4_fmt(char *s, char ip[4]) { unsigned int len; @@ -25,25 +24,24 @@ unsigned int ip4_fmt(char *s, char ip[4]) len = 0; // clang-format off - i = fmt_ulong(s,(unsigned long) (unsigned char) ip[0]); len += i; if (s) s += i; + i = fmt_ulong(s, (unsigned long)(unsigned char)ip[0]); len += i; if (s) s += i; if (s) { *s++ = '.'; } ++len; - i = fmt_ulong(s,(unsigned long) (unsigned char) ip[1]); len += i; if (s) s += i; + i = fmt_ulong(s, (unsigned long)(unsigned char)ip[1]); len += i; if (s) s += i; if (s) { *s++ = '.'; } ++len; - i = fmt_ulong(s,(unsigned long) (unsigned char) ip[2]); len += i; if (s) s += i; + i = fmt_ulong(s, (unsigned long)(unsigned char)ip[2]); len += i; if (s) s += i; if (s) { *s++ = '.'; } ++len; - i = fmt_ulong(s,(unsigned long) (unsigned char) ip[3]); len += i; if (s) s += i; + i = fmt_ulong(s, (unsigned long)(unsigned char)ip[3]); len += i; if (s) s += i; // clang-format on return len; } /** - @brief ia4_fmt - converts IPv4 address into DNS inverse nibble format - @param input: IPv4 char array - output: IPv4 address string - @return int length of address (ok > 0) - */ - + * @brief ia4_fmt + * converts IPv4 address into DNS inverse nibble format + * @param input: IPv4 char array + * output: IPv4 address string + * @return int length of address (ok > 0) + */ unsigned int ia4_fmt(char *s, char ip[4]) { unsigned int i; @@ -51,26 +49,25 @@ unsigned int ia4_fmt(char *s, char ip[4]) len = 0; // clang-format off - i = fmt_ulong(s,(unsigned long) ip[3]); len += i; if (s) s += i; - i = fmt_str(s,"."); len += i; if (s) s += i; - i = fmt_ulong(s,(unsigned long) ip[2]); len += i; if (s) s += i; - i = fmt_str(s,"."); len += i; if (s) s += i; - i = fmt_ulong(s,(unsigned long) ip[1]); len += i; if (s) s += i; - i = fmt_str(s,"."); len += i; if (s) s += i; - i = fmt_ulong(s,(unsigned long) ip[0]); len += i; if (s) s += i; - i = fmt_str(s,".in-addr.arpa."); len += i; if (s) s += i; + i = fmt_ulong(s, (unsigned long)ip[3]); len += i; if (s) s += i; + i = fmt_str(s, "."); len += i; if (s) s += i; + i = fmt_ulong(s, (unsigned long)ip[2]); len += i; if (s) s += i; + i = fmt_str(s, "."); len += i; if (s) s += i; + i = fmt_ulong(s, (unsigned long)ip[1]); len += i; if (s) s += i; + i = fmt_str(s, "."); len += i; if (s) s += i; + i = fmt_ulong(s, (unsigned long)ip[0]); len += i; if (s) s += i; + i = fmt_str(s, ".in-addr.arpa."); len += i; if (s) s += i; // clang-format on return len; } /** - @brief ip4_scan - parse IPv4 address string and convert to IP address array - @param input: IPv4 address string - output: IPv4 char array - @return int length of ip_address (ok > 0) - */ - + * @brief ip4_scan + * parse IPv4 address string and convert to IP address array + * @param input: IPv4 address string + * output: IPv4 char array + * @return int length of ip_address (ok > 0) + */ unsigned int ip4_scan(const char *s, char ip[4]) { unsigned int i; @@ -80,25 +77,24 @@ unsigned int ip4_scan(const char *s, char ip[4]) byte_zero(ip, 4); len = 0; // clang-format off - i = scan_ulong((char *)s,&u); if (!i) { return 0; } ip[0] = u; s += i; len += i; + i = scan_ulong((char *)s, &u); if (!i) { return 0; } ip[0] = u; s += i; len += i; if (*s != '.') { return 0; } ++s; ++len; - i = scan_ulong((char *)s,&u); if (!i) { return 0; } ip[1] = u; s += i; len += i; + i = scan_ulong((char *)s, &u); if (!i) { return 0; } ip[1] = u; s += i; len += i; if (*s != '.') { return 0; } ++s; ++len; - i = scan_ulong((char *)s,&u); if (!i) { return 0; } ip[2] = u; s += i; len += i; + i = scan_ulong((char *)s, &u); if (!i) { return 0; } ip[2] = u; s += i; len += i; if (*s != '.') { return 0; } ++s; ++len; - i = scan_ulong((char *)s,&u); if (!i) { return 0; } ip[3] = u; s += i; len += i; + i = scan_ulong((char *)s, &u); if (!i) { return 0; } ip[3] = u; s += i; len += i; // clang-format on return len; } /** - @brief ip4_scanbracket - parse IPv4 address string enclosed in brackets and convert to IP address array - @param input: IPv4 char array - output: IPv4 char array - @return int length of ip_address (ok > 0) - */ - + * @brief ip4_scanbracket + * parse IPv4 address string enclosed in brackets and convert to IP address array + * @param input: IPv4 char array + * output: IPv4 char array + * @return int length of ip_address (ok > 0) + */ unsigned int ip4_scanbracket(const char *s, char ip[4]) { unsigned int len; @@ -111,14 +107,13 @@ unsigned int ip4_scanbracket(const char *s, char ip[4]) } /** - @brief ip4_cidr - parse IPv4 address string - concatinated with the prefix length: 192.168.1/24 - @param input: IPv6 char array - output: IPv6 char array, long plen - @return int length of ip6_address/ip - */ - + * @brief ip4_cidr + * parse IPv4 address string + * concatinated with the prefix length: 192.168.1/24 + * @param input: IPv6 char array + * output: IPv6 char array, long plen + * @return int length of ip6_address/ip + */ unsigned int ip4_cidr(char *s, char ip[4], unsigned long *plen) { unsigned int j = 0; @@ -133,13 +128,12 @@ unsigned int ip4_cidr(char *s, char ip[4], unsigned long *plen) } /** - @brief ip4_bytestring - parse IPv4 address and represent as char string with length prefix - @param input: IPv4 char array, prefix length - output: pointer to stralloc bytestring - @return n: number of bytes, if ok; -1: memory shortage; -2: input error - */ - + * @brief ip4_bytestring + * parse IPv4 address and represent as char string with length prefix + * @param input: IPv4 char array, prefix length + * output: pointer to stralloc bytestring + * @return n: number of bytes, if ok; -1: memory shortage; -2: input error + */ unsigned int ip4_bytestring(stralloc *ipstring, char ip[4], int prefix) { int i, j, n = 0; @@ -6,19 +6,18 @@ /** @file ip6.c - @author djb, fefe, feh - @source ucspi-tcp, ucspi-tcp6 + @authors djb, fefe, feh + @ref ucspi-tcp, ucspi-tcp6 @brief handling of IPv6 addresses */ -/*** - @brief ip6_fmt - convert IPv6 address to compactified IPv6 address string - @param input: IPv6 char array - output: pointer to IPv6 address string - @return int length of address (ok > 0) - */ - +/** + @brief ip6_fmt + convert IPv6 address to compactified IPv6 address string + @param input: IPv6 char array + output: pointer to IPv6 address string + @return int length of address (ok > 0) +*/ unsigned int ip6_fmt(char *s, char ip[16]) { unsigned int len; @@ -76,14 +75,13 @@ unsigned int ip6_fmt(char *s, char ip[16]) return len; } -/*** - @brief ip6_fmt_flat - convert IPv6 address to IPv6 address string - @param input: IPv6 char array - output: pointer to IPv6 address string - @return int length of address (ok > 0) - */ - +/** + * @brief ip6_fmt_flat + * convert IPv6 address to IPv6 address string + * @param input: IPv6 char array + * output: pointer to IPv6 address string + * @return int length of address (ok > 0) + */ unsigned int ip6_fmt_flat(char *s, char ip[16]) { int i; @@ -95,13 +93,13 @@ unsigned int ip6_fmt_flat(char *s, char ip[16]) } /** - @brief ia6_fmt - convert IPv6 address to inverse DNS nibble format - 1.2.3.4.5.6.7.8.9.a.b.c.d.e.f.1.2.3.4.5.6.7.8.9.a.b.c.d.e.f.ip6.arpa - @param input: IPv6 char array - output: pointer to IPv6 address string - @return int length of address -*/ + * @brief ia6_fmt + * convert IPv6 address to inverse DNS nibble format + * 1.2.3.4.5.6.7.8.9.a.b.c.d.e.f.1.2.3.4.5.6.7.8.9.a.b.c.d.e.f.ip6.arpa + * @param input: IPv6 char array + * output: pointer to IPv6 address string + * @return int length of address + */ unsigned int ia6_fmt(char *s, char ip[16]) { unsigned int i; @@ -132,15 +130,13 @@ unsigned int ia6_fmt(char *s, char ip[16]) return len; } - -/*** - @brief ip6_scan_flat - convert IPv6 address string to IPv6 address array - @param input: pointer to IPv6 address string - output: IPv6 char array - @return int length of address (ok > 0) - */ - +/** + * @brief ip6_scan_flat + * convert IPv6 address string to IPv6 address array + * @param input: pointer to IPv6 address string + * output: IPv6 char array + * @return int length of address (ok > 0) + */ unsigned int ip6_scan_flat(const char *s, char ip[16]) { int i, tmp; @@ -156,14 +152,13 @@ unsigned int ip6_scan_flat(const char *s, char ip[16]) return 32; } -/*** - @brief ip6_scan - parse compactified IPv6 address string and convert to IPv6 address array - @param input: pointer to IPv6 address string - output: IPv6 char array - @return int length of ip6_address/ip - */ - +/** + * @brief ip6_scan + * parse compactified IPv6 address string and convert to IPv6 address array + * @param input: pointer to IPv6 address string + * output: IPv6 char array + * @return int length of ip6_address/ip + */ unsigned int ip6_scan(const char *s, char ip[16]) { unsigned int i, j; @@ -251,14 +246,13 @@ unsigned int ip6_scan(const char *s, char ip[16]) return len; } -/*** - @brief ip6_scanbracket - parse IPv6 string address enclosed in brackets - @param input: pointer to IPv6 address string - output: IPv6 char array - @return int length of ip_address (ok > 0) - */ - +/** + * @brief ip6_scanbracket + * parse IPv6 string address enclosed in brackets + * @param input: pointer to IPv6 address string + * output: IPv6 char array + * @return int length of ip_address (ok > 0) + */ unsigned int ip6_scanbracket(const char *s, char ip[16]) { unsigned int len; @@ -271,14 +265,13 @@ unsigned int ip6_scanbracket(const char *s, char ip[16]) } /** - @brief ip6_ifscan - parse compactified IPv6 address string - concatinated with the interface name: fe80::1%eth0 - @param input: pointer to IPv6 address string - output: IPv6 char array, stralloc interface_name - @return int length of ip6_address/ip - */ - + * @brief ip6_ifscan + * parse compactified IPv6 address string + * concatinated with the interface name: fe80::1%eth0 + * @param input: pointer to IPv6 address string + * output: IPv6 char array, stralloc interface_name + * @return int length of ip6_address/ip + */ unsigned int ip6_ifscan(char *s, char ip[16], stralloc *ifname) { int i; @@ -303,14 +296,13 @@ unsigned int ip6_ifscan(char *s, char ip[16], stralloc *ifname) } /** - @brief ip6_cidr - parse compactified IPv6 address string - concatinated with the prefix length: fe80::1/64 - @param input: pointer to IPv6 address string - output: IPv6 char array, long plen - @return int length of ip6_address/ip - */ - + * @brief ip6_cidr + * parse compactified IPv6 address string + * concatinated with the prefix length: fe80::1/64 + * @param input: pointer to IPv6 address string + * output: IPv6 char array, long plen + * @return int length of ip6_address/ip + */ unsigned int ip6_cidr(char *s, char ip[16], unsigned long *plen) { unsigned int j = 0; @@ -325,13 +317,12 @@ unsigned int ip6_cidr(char *s, char ip[16], unsigned long *plen) } /** - @brief ip6_bytestring - parse IPv6 address and represent as char string with length prefix - @param input: IPv6 char array, prefix length - output: pointer to stralloc bit string; - @return n: number of bytes, if ok; -1: memory shortage - */ - + * @brief ip6_bytestring + * parse IPv6 address and represent as char string with length prefix + * @param input: IPv6 char array, prefix length + * output: pointer to stralloc bit string; + * @return n: number of bytes, if ok; -1: memory shortage + */ unsigned int ip6_bytestring(stralloc *ipstring, char ip[16], int prefix) { int i, j, n = 0; @@ -8,7 +8,7 @@ /** @file lock.c @author djb - @source qmail + @ref qmail @brief locking of resources */ diff --git a/src/logmsg.c b/src/logmsg.c index f254fd9..f18bda9 100644 --- a/src/logmsg.c +++ b/src/logmsg.c @@ -13,7 +13,7 @@ /** @file logmsg.c @author kp, feh - @source qlibs + @ref qlibs @brief unified system and error message handling */ diff --git a/src/ndelay.c b/src/ndelay.c index 44a34d7..3701650 100644 --- a/src/ndelay.c +++ b/src/ndelay.c @@ -6,7 +6,7 @@ /** @file ndelay.c @author djb - @soure qmail + @ref qmail @brief delaying of IO operations */ @@ -6,7 +6,7 @@ /** @file open.c @author djb - @source qmail + @ref qmail @brief open a file */ diff --git a/src/pathexec.c b/src/pathexec.c index e588c65..d0e8e84 100644 --- a/src/pathexec.c +++ b/src/pathexec.c @@ -12,7 +12,7 @@ /** @file pathexec.c @author djb - @source ucspi-tcp, ucspi-ssl + @ref ucspi-tcp, ucspi-ssl @brief populate environment after fork */ @@ -9,7 +9,7 @@ /** @file prot.c @author djb - @source qmail + @ref qmail @brief setting up uid an gid for OS (short group was for ancient solaris) */ diff --git a/src/readclose.c b/src/readclose.c index 307f830..e489967 100644 --- a/src/readclose.c +++ b/src/readclose.c @@ -8,10 +8,10 @@ /** @file readclose.c @author kp - @source qlibs - @brief This is the successor of the older 'slurpclose.c' file. The function - 'slurpclose' is now called 'readclose_append'. The other function - 'readclose' was introduced here initial. + @ref qlibs + @brief This is the successor of the older 'slurpclose.c' file. + @brief The function * 'slurpclose' is now called 'readclose_append'. + @brief The other function 'readclose' was introduced here initial. */ int readclose_append(int fd, stralloc *sa, unsigned int bufsize) @@ -1,10 +1,10 @@ #include "scan.h" /** - @file scan.c + @file scan.c @author djb - @source qmail, ucspi-tcp - @brief scanning/conversion of strings to different variable types + @ref qmail, ucspi-tcp + @brief scanning/conversion of strings to different variable types */ static long int fromhex(unsigned char c) @@ -5,7 +5,7 @@ /** @file seek.c @author djb - @source qmail + @ref qmail @brief seek in an open file descritor */ @@ -4,8 +4,8 @@ /** @file sig.c - @author djb - @source qmail + @authors djb, jmh + @ref qmail @brief signal handling functions */ diff --git a/src/socket_bind.c b/src/socket_bind.c index 314ffa0..ecac6bb 100644 --- a/src/socket_bind.c +++ b/src/socket_bind.c @@ -10,7 +10,7 @@ /** @file socket_bind.c @author djb, fefe, feh - @source qmail, djbdns, ucspi-tcp6 + @ref qmail, djbdns, ucspi-tcp6 @brief binding a socket to a local resource */ diff --git a/src/socket_connect.c b/src/socket_connect.c index 240d5da..cd44c8e 100644 --- a/src/socket_connect.c +++ b/src/socket_connect.c @@ -11,8 +11,8 @@ /** @file socket_connect.c - @author djb, fefe, feh, kp - @source qmail, ucscpi-tcp6 + @authors djb, fefe, feh, kp + @ref qmail, ucscpi-tcp6 @brief connection to remote IP host */ diff --git a/src/socket_if.c b/src/socket_if.c index 682f8bd..fbbd6d0 100644 --- a/src/socket_if.c +++ b/src/socket_if.c @@ -8,8 +8,8 @@ /** @file socket_if.c - @author fefe, feh - @source ucspi-tcp6 + @authors fefe, feh + @ref ucspi-tcp6 @brief interface handling for LLU */ diff --git a/src/socket_info.c b/src/socket_info.c index 14ec6b0..89a9c5d 100644 --- a/src/socket_info.c +++ b/src/socket_info.c @@ -9,8 +9,8 @@ /** @file socket_info.c - @author djb, fefe, feh - @source ucspi-tcp6 + @authors djb, fefe, feh + @ref ucspi-tcp6 @brief querying local and remote info for socket */ diff --git a/src/socket_recv.c b/src/socket_recv.c index 2fb1e64..83f648b 100644 --- a/src/socket_recv.c +++ b/src/socket_recv.c @@ -9,8 +9,8 @@ /** @file socket_recv.c - @author djb, fefe - @source ucspi-tcp6 + @authors djb, fefe + @ref ucspi-tcp6 @brief setup receiving socket */ diff --git a/src/socket_send.c b/src/socket_send.c index 1d0ce56..5aa0535 100644 --- a/src/socket_send.c +++ b/src/socket_send.c @@ -9,8 +9,8 @@ /** @file socket_send.c - @author djb, fefe, feh - @source ucspi-tcp6 + @authors djb, fefe, feh + @ref ucspi-tcp6 @brief setup sending socket */ diff --git a/src/socket_setup.c b/src/socket_setup.c index 39fc3dd..1c18727 100644 --- a/src/socket_setup.c +++ b/src/socket_setup.c @@ -9,8 +9,8 @@ /** @file socket_setup.c - @author djb, feh - @source ucspi-tcp6 + @authors djb, feh + @ref ucspi-tcp6 @brief setup listening socket */ diff --git a/src/socket_tcp.c b/src/socket_tcp.c index f350330..866ac19 100644 --- a/src/socket_tcp.c +++ b/src/socket_tcp.c @@ -16,8 +16,8 @@ /** @file socket_tcp.c - @author djb, fefe, feh - @source ucspi-tcp6 + @authors djb, fefe, feh + @ref ucspi-tcp6 @brief setup TCP stream socket */ diff --git a/src/socket_udp.c b/src/socket_udp.c index 59af450..7da1def 100644 --- a/src/socket_udp.c +++ b/src/socket_udp.c @@ -16,8 +16,8 @@ /** @file socket_udp.c - @author djb, fefe, feh - @source ucspi-tcp6 + @authors djb, fefe, feh + @ref ucspi-tcp6 @brief setup a UDP message socket */ @@ -4,8 +4,8 @@ /** @file str.c - @author djb - @source qmail + @authors djb, feh + @ref qmail @brief string handling functions */ diff --git a/src/stralloc.c b/src/stralloc.c index 8351473..8373bfe 100644 --- a/src/stralloc.c +++ b/src/stralloc.c @@ -9,7 +9,7 @@ /** @file stralloc.c @author djb - @source qmail, ucspi-tcp + @ref qmail, ucspi-tcp @brief genious dynamic string handling */ @@ -5,7 +5,7 @@ /** @file tai.c @author djb - @source qmail + @ref qmail @brief 'temps atomic' time handling */ @@ -52,13 +52,13 @@ void tai_unpack(const char *s, struct tai *t) x = (unsigned char)s[0]; // clang-format off - x <<= 8; x += (unsigned char) s[1]; - x <<= 8; x += (unsigned char) s[2]; - x <<= 8; x += (unsigned char) s[3]; - x <<= 8; x += (unsigned char) s[4]; - x <<= 8; x += (unsigned char) s[5]; - x <<= 8; x += (unsigned char) s[6]; - x <<= 8; x += (unsigned char) s[7]; + x <<= 8; x += (unsigned char)s[1]; + x <<= 8; x += (unsigned char)s[2]; + x <<= 8; x += (unsigned char)s[3]; + x <<= 8; x += (unsigned char)s[4]; + x <<= 8; x += (unsigned char)s[5]; + x <<= 8; x += (unsigned char)s[6]; + x <<= 8; x += (unsigned char)s[7]; // clang-format on t->x = x; } @@ -6,7 +6,7 @@ /** @file taia.c @author djb - @source qmail + @ref qmail @brief 'tai' attosecond time handling */ diff --git a/src/timeout.c b/src/timeout.c index 9d34e69..c0a904f 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -8,8 +8,9 @@ /** @file timeout.c @author djb - @source qmail + @ref qmail @brief read/write timeout handling + @return same as read(2) or write(2); -1 on error */ int timeoutread(int t, int fd, char *buf, int len) diff --git a/src/timeoutconn.c b/src/timeoutconn.c index 205db0a..402e9d3 100644 --- a/src/timeoutconn.c +++ b/src/timeoutconn.c @@ -8,8 +8,8 @@ /** @file timeoutconn.c - @author djb, fefe, feh - @source qmail + @authors djb, fefe, feh + @ref qmail @brief socket read/write timeout handling; return code of iopause considered */ diff --git a/src/uint128p.c b/src/uint128p.c index e92b5a7..4606076 100644 --- a/src/uint128p.c +++ b/src/uint128p.c @@ -2,8 +2,8 @@ /** @file uint128p.c - @author feh, jannis - @source djbdns6 + @authors feh, jmh + @ref djbdns6 @brief packing/unpacking 128 bit integer to/from char string */ diff --git a/src/uint16p.c b/src/uint16p.c index 06556e4..f2e19e0 100644 --- a/src/uint16p.c +++ b/src/uint16p.c @@ -3,7 +3,7 @@ /** @file uint16p.c @author djb - @source qmail + @ref qmail @brief packing/unpacking 16 bit integer to/from char string */ diff --git a/src/uint32p.c b/src/uint32p.c index de96958..0c266a9 100644 --- a/src/uint32p.c +++ b/src/uint32p.c @@ -3,7 +3,7 @@ /** @file uint32p.c @author djb - @source qmail + @ref qmail @brief packing/unpacking 32 bit integer to/from char string */ diff --git a/src/uint64p.c b/src/uint64p.c index 4631bce..9f2e0e1 100644 --- a/src/uint64p.c +++ b/src/uint64p.c @@ -2,8 +2,8 @@ /** @file uint64p.c - @author feh, jannis - @source djbdns6 + @authors feh, jmh + @ref djbdns6 @brief packing/unpacking 64 bit integer to/from char string */ diff --git a/src/uint8p.c b/src/uint8p.c index d3921d9..466c792 100644 --- a/src/uint8p.c +++ b/src/uint8p.c @@ -1,7 +1,7 @@ #include "uint_t.h" /** - @file uint8x.c + @file uint8p.c @author feh @brief packing/unpacking 8 bit int to/from char string */ @@ -8,7 +8,7 @@ /** @file wait.c @author djb - @source qmail + @ref qmail @brief wait for forked processes */ |