X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=adns.git;a=blobdiff_plain;f=src%2Finternal.h;h=c7667382babd3adfec53dfde1e92e641c387c5d8;hp=9e442fed7135ff0c87fbf896645535100e2c3bb5;hb=626f869531a241dd8f187afb392a3151caf9a728;hpb=2953d358511ac5d196362f6b339c010d4e9cae3e diff --git a/src/internal.h b/src/internal.h index 9e442fe..c766738 100644 --- a/src/internal.h +++ b/src/internal.h @@ -58,6 +58,7 @@ typedef unsigned char byte; #define DNS_PORT 53 #define DNS_MAXUDP 512 +#define DNS_MAXLABEL 63 #define DNS_MAXDOMAIN 255 #define DNS_HDRSIZE 12 #define DNS_IDOFFSET 0 @@ -288,10 +289,10 @@ struct adns__state { server_ok, server_broken } tcpstate; struct timeval tcptimeout; - /* This will have tv_sec==0 if it is not valid. - * It will always be valid if tcpstate _connecting. - * When _ok, it will be nonzero if we are idle - * (ie, tcpw queue is empty) and counting down. + /* This will have tv_sec==0 if it is not valid. It will always be + * valid if tcpstate _connecting. When _ok, it will be nonzero if + * we are idle (ie, tcpw queue is empty), in which case it is the + * absolute time when we will close the connection. */ struct sigaction stdsigpipe; sigset_t stdsigmask; @@ -683,6 +684,9 @@ static inline int ctype_alpha(int c) { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); } static inline int ctype_822special(int c) { return strchr("()<>@,;:\\\".[]",c) != 0; } +static inline int ctype_domainunquoted(int c) { + return ctype_alpha(c) || ctype_digit(c) || (strchr("-_/+",c) != 0); +} static inline int errno_resources(int e) { return e==ENOMEM || e==ENOBUFS; }