consequently use tabs, and no spaces
and wrap lines at 80 characters Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
This commit is contained in:
parent
8d4b43e178
commit
79455c380d
|
@ -34,7 +34,8 @@ void client_set_selecttimeout(int select_timeout);
|
||||||
void client_set_lazymode(int lazy_mode);
|
void client_set_lazymode(int lazy_mode);
|
||||||
void client_set_hostname_maxlen(int i);
|
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);
|
int client_tunnel(int tun_fd, int dns_fd);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -68,7 +68,8 @@ extern const unsigned char raw_header[RAW_HDR_LEN];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define T_PRIVATE 65399
|
#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
|
#define T_UNSET 65432
|
||||||
/* Unused RR type, never actually sent */
|
/* Unused RR type, never actually sent */
|
||||||
|
|
||||||
|
@ -112,7 +113,8 @@ void check_superuser(void);
|
||||||
char *format_addr(struct sockaddr_storage *sockaddr, int sockaddr_len);
|
char *format_addr(struct sockaddr_storage *sockaddr, int sockaddr_len);
|
||||||
int get_addr(char *, int, int, int, struct sockaddr_storage *);
|
int get_addr(char *, int, int, int, struct sockaddr_storage *);
|
||||||
int open_dns(struct sockaddr_storage *, size_t);
|
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);
|
int open_dns_from_host(char *host, int port, int addr_family, int flags);
|
||||||
void close_dns(int);
|
void close_dns(int);
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,8 @@ typedef enum {
|
||||||
extern int dnsc_use_edns0;
|
extern int dnsc_use_edns0;
|
||||||
|
|
||||||
int dns_encode(char *, size_t, struct query *, qr_t, const char *, size_t);
|
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);
|
int dns_encode_a_response(char *buf, size_t buflen, struct query *q);
|
||||||
unsigned short dns_get_id(char *packet, size_t packetlen);
|
unsigned short dns_get_id(char *packet, size_t packetlen);
|
||||||
int dns_decode(char *, size_t, struct query *, qr_t, char *, size_t);
|
int dns_decode(char *, size_t, struct query *, qr_t, char *, size_t);
|
||||||
|
|
|
@ -30,7 +30,10 @@
|
||||||
spreads across multiple encoded chars -> 16 bytes total.
|
spreads across multiple encoded chars -> 16 bytes total.
|
||||||
Followed by 32 bytes from my /dev/random; should be enough.
|
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
|
#define DOWNCODECCHECK1_LEN 48
|
||||||
|
|
||||||
struct encoder {
|
struct encoder {
|
||||||
|
@ -45,7 +48,8 @@ struct encoder {
|
||||||
const int blocksize_encoded;
|
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 unpack_data(char *, size_t, char *, size_t, const struct encoder *);
|
||||||
int inline_dotify(char *, size_t);
|
int inline_dotify(char *, size_t);
|
||||||
int inline_undotify(char *, size_t);
|
int inline_undotify(char *, size_t);
|
||||||
|
|
|
@ -53,43 +53,42 @@ typedef unsigned int in_addr_t;
|
||||||
#define sleep(seconds) Sleep((seconds)*1000)
|
#define sleep(seconds) Sleep((seconds)*1000)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned id :16; /* query identification number */
|
unsigned id :16; /* query identification number */
|
||||||
/* fields in third byte */
|
/* fields in third byte */
|
||||||
unsigned rd :1; /* recursion desired */
|
unsigned rd :1; /* recursion desired */
|
||||||
unsigned tc :1; /* truncated message */
|
unsigned tc :1; /* truncated message */
|
||||||
unsigned aa :1; /* authoritive answer */
|
unsigned aa :1; /* authoritive answer */
|
||||||
unsigned opcode :4; /* purpose of message */
|
unsigned opcode :4; /* purpose of message */
|
||||||
unsigned qr :1; /* response flag */
|
unsigned qr :1; /* response flag */
|
||||||
/* fields in fourth byte */
|
/* fields in fourth byte */
|
||||||
unsigned rcode :4; /* response code */
|
unsigned rcode :4; /* response code */
|
||||||
unsigned cd: 1; /* checking disabled by resolver */
|
unsigned cd: 1; /* checking disabled by resolver */
|
||||||
unsigned ad: 1; /* authentic data from named */
|
unsigned ad: 1; /* authentic data from named */
|
||||||
unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
|
unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
|
||||||
unsigned ra :1; /* recursion available */
|
unsigned ra :1; /* recursion available */
|
||||||
/* remaining bytes */
|
/* remaining bytes */
|
||||||
unsigned qdcount :16; /* number of question entries */
|
unsigned qdcount :16; /* number of question entries */
|
||||||
unsigned ancount :16; /* number of answer entries */
|
unsigned ancount :16; /* number of answer entries */
|
||||||
unsigned nscount :16; /* number of authority entries */
|
unsigned nscount :16; /* number of authority entries */
|
||||||
unsigned arcount :16; /* number of resource entries */
|
unsigned arcount :16; /* number of resource entries */
|
||||||
} HEADER;
|
} HEADER;
|
||||||
|
|
||||||
struct ip
|
struct ip {
|
||||||
{
|
unsigned int ip_hl:4; /* header length */
|
||||||
unsigned int ip_hl:4; /* header length */
|
unsigned int ip_v:4; /* version */
|
||||||
unsigned int ip_v:4; /* version */
|
u_char ip_tos; /* type of service */
|
||||||
u_char ip_tos; /* type of service */
|
u_short ip_len; /* total length */
|
||||||
u_short ip_len; /* total length */
|
u_short ip_id; /* identification */
|
||||||
u_short ip_id; /* identification */
|
u_short ip_off; /* fragment offset field */
|
||||||
u_short ip_off; /* fragment offset field */
|
#define IP_RF 0x8000 /* reserved fragment flag */
|
||||||
#define IP_RF 0x8000 /* reserved fragment flag */
|
#define IP_DF 0x4000 /* dont fragment flag */
|
||||||
#define IP_DF 0x4000 /* dont fragment flag */
|
#define IP_MF 0x2000 /* more fragments flag */
|
||||||
#define IP_MF 0x2000 /* more fragments flag */
|
#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
|
||||||
#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
|
u_char ip_ttl; /* time to live */
|
||||||
u_char ip_ttl; /* time to live */
|
u_char ip_p; /* protocol */
|
||||||
u_char ip_p; /* protocol */
|
u_short ip_sum; /* checksum */
|
||||||
u_short ip_sum; /* checksum */
|
struct in_addr ip_src, ip_dst; /* source and dest address */
|
||||||
struct in_addr ip_src, ip_dst; /* source and dest address */
|
};
|
||||||
};
|
|
||||||
|
|
||||||
DWORD WINAPI tun_reader(LPVOID arg);
|
DWORD WINAPI tun_reader(LPVOID arg);
|
||||||
struct tun_data {
|
struct tun_data {
|
||||||
|
|
Loading…
Reference in New Issue