From 79455c380d5632bf5dc0f3e26c442b7a5de71388 Mon Sep 17 00:00:00 2001 From: Ralf Ramsauer Date: Sat, 11 Mar 2017 21:37:59 -0800 Subject: [PATCH] consequently use tabs, and no spaces and wrap lines at 80 characters Signed-off-by: Ralf Ramsauer --- src/client.h | 3 ++- src/common.h | 6 +++-- src/dns.h | 3 ++- src/encoding.h | 8 ++++-- src/windows.h | 69 +++++++++++++++++++++++++------------------------- 5 files changed, 48 insertions(+), 41 deletions(-) diff --git a/src/client.h b/src/client.h index 41e9aa1..3dab6fb 100644 --- a/src/client.h +++ b/src/client.h @@ -34,7 +34,8 @@ void client_set_selecttimeout(int select_timeout); void client_set_lazymode(int lazy_mode); void client_set_hostname_maxlen(int i); -int client_handshake(int dns_fd, int raw_mode, int autodetect_frag_size, int fragsize); +int client_handshake(int dns_fd, int raw_mode, int autodetect_frag_size, + int fragsize); int client_tunnel(int tun_fd, int dns_fd); #endif diff --git a/src/common.h b/src/common.h index 9792517..9306846 100644 --- a/src/common.h +++ b/src/common.h @@ -68,7 +68,8 @@ extern const unsigned char raw_header[RAW_HDR_LEN]; #endif #define T_PRIVATE 65399 -/* Undefined RR type; "private use" range, see http://www.bind9.net/dns-parameters */ +/* Undefined RR type; "private use" range, see + * http://www.bind9.net/dns-parameters */ #define T_UNSET 65432 /* Unused RR type, never actually sent */ @@ -112,7 +113,8 @@ void check_superuser(void); char *format_addr(struct sockaddr_storage *sockaddr, int sockaddr_len); int get_addr(char *, int, int, int, struct sockaddr_storage *); int open_dns(struct sockaddr_storage *, size_t); -int open_dns_opt(struct sockaddr_storage *sockaddr, size_t sockaddr_len, int v6only); +int open_dns_opt(struct sockaddr_storage *sockaddr, size_t sockaddr_len, + int v6only); int open_dns_from_host(char *host, int port, int addr_family, int flags); void close_dns(int); diff --git a/src/dns.h b/src/dns.h index ce48d1a..660f610 100644 --- a/src/dns.h +++ b/src/dns.h @@ -28,7 +28,8 @@ typedef enum { extern int dnsc_use_edns0; int dns_encode(char *, size_t, struct query *, qr_t, const char *, size_t); -int dns_encode_ns_response(char *buf, size_t buflen, struct query *q, char *topdomain); +int dns_encode_ns_response(char *buf, size_t buflen, struct query *q, + char *topdomain); int dns_encode_a_response(char *buf, size_t buflen, struct query *q); unsigned short dns_get_id(char *packet, size_t packetlen); int dns_decode(char *, size_t, struct query *, qr_t, char *, size_t); diff --git a/src/encoding.h b/src/encoding.h index 8d8caef..abd0aea 100644 --- a/src/encoding.h +++ b/src/encoding.h @@ -30,7 +30,10 @@ spreads across multiple encoded chars -> 16 bytes total. Followed by 32 bytes from my /dev/random; should be enough. */ -#define DOWNCODECCHECK1 "\000\000\000\000\377\377\377\377\125\125\125\125\252\252\252\252\201\143\310\322\307\174\262\027\137\117\316\311\111\055\122\041\141\251\161\040\045\263\006\163\346\330\104\060\171\120\127\277" +#define DOWNCODECCHECK1 \ + "\000\000\000\000\377\377\377\377\125\125\125\125\252\252\252\252" \ + "\201\143\310\322\307\174\262\027\137\117\316\311\111\055\122\041" \ + "\141\251\161\040\045\263\006\163\346\330\104\060\171\120\127\277" #define DOWNCODECCHECK1_LEN 48 struct encoder { @@ -45,7 +48,8 @@ struct encoder { const int blocksize_encoded; }; -int build_hostname(char *, size_t, const char *, const size_t, const char *, const struct encoder *, int); +int build_hostname(char *, size_t, const char *, const size_t, const char *, + const struct encoder *, int); int unpack_data(char *, size_t, char *, size_t, const struct encoder *); int inline_dotify(char *, size_t); int inline_undotify(char *, size_t); diff --git a/src/windows.h b/src/windows.h index 96288d1..1a94fb5 100644 --- a/src/windows.h +++ b/src/windows.h @@ -53,43 +53,42 @@ typedef unsigned int in_addr_t; #define sleep(seconds) Sleep((seconds)*1000) typedef struct { - unsigned id :16; /* query identification number */ - /* fields in third byte */ - unsigned rd :1; /* recursion desired */ - unsigned tc :1; /* truncated message */ - unsigned aa :1; /* authoritive answer */ - unsigned opcode :4; /* purpose of message */ - unsigned qr :1; /* response flag */ - /* fields in fourth byte */ - unsigned rcode :4; /* response code */ - unsigned cd: 1; /* checking disabled by resolver */ - unsigned ad: 1; /* authentic data from named */ - unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */ - unsigned ra :1; /* recursion available */ - /* remaining bytes */ - unsigned qdcount :16; /* number of question entries */ - unsigned ancount :16; /* number of answer entries */ - unsigned nscount :16; /* number of authority entries */ - unsigned arcount :16; /* number of resource entries */ + unsigned id :16; /* query identification number */ + /* fields in third byte */ + unsigned rd :1; /* recursion desired */ + unsigned tc :1; /* truncated message */ + unsigned aa :1; /* authoritive answer */ + unsigned opcode :4; /* purpose of message */ + unsigned qr :1; /* response flag */ + /* fields in fourth byte */ + unsigned rcode :4; /* response code */ + unsigned cd: 1; /* checking disabled by resolver */ + unsigned ad: 1; /* authentic data from named */ + unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */ + unsigned ra :1; /* recursion available */ + /* remaining bytes */ + unsigned qdcount :16; /* number of question entries */ + unsigned ancount :16; /* number of answer entries */ + unsigned nscount :16; /* number of authority entries */ + unsigned arcount :16; /* number of resource entries */ } HEADER; -struct ip - { - unsigned int ip_hl:4; /* header length */ - unsigned int ip_v:4; /* version */ - u_char ip_tos; /* type of service */ - u_short ip_len; /* total length */ - u_short ip_id; /* identification */ - u_short ip_off; /* fragment offset field */ -#define IP_RF 0x8000 /* reserved fragment flag */ -#define IP_DF 0x4000 /* dont fragment flag */ -#define IP_MF 0x2000 /* more fragments flag */ -#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ - u_char ip_ttl; /* time to live */ - u_char ip_p; /* protocol */ - u_short ip_sum; /* checksum */ - struct in_addr ip_src, ip_dst; /* source and dest address */ - }; +struct ip { + unsigned int ip_hl:4; /* header length */ + unsigned int ip_v:4; /* version */ + u_char ip_tos; /* type of service */ + u_short ip_len; /* total length */ + u_short ip_id; /* identification */ + u_short ip_off; /* fragment offset field */ +#define IP_RF 0x8000 /* reserved fragment flag */ +#define IP_DF 0x4000 /* dont fragment flag */ +#define IP_MF 0x2000 /* more fragments flag */ +#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ + u_char ip_ttl; /* time to live */ + u_char ip_p; /* protocol */ + u_short ip_sum; /* checksum */ + struct in_addr ip_src, ip_dst; /* source and dest address */ +}; DWORD WINAPI tun_reader(LPVOID arg); struct tun_data {