diff options
author | cvs2svn <admin@example.com> | 2025-04-14 17:32:06 +0000 |
---|---|---|
committer | cvs2svn <admin@example.com> | 2025-04-14 17:32:06 +0000 |
commit | eb8dd9dca1228af0cd132f515509051ecfabf6f6 (patch) | |
tree | edb6da6af7e865d488dc1a29309f1e1ec226e603 /src/regress/lib/libc/asr/bin/common.h | |
parent | 247f0352e0ed72a4f476db9dc91f4d982bc83eb2 (diff) | |
download | openbsd-tb_20250414.tar.gz openbsd-tb_20250414.tar.bz2 openbsd-tb_20250414.zip |
This commit was manufactured by cvs2git to create tag 'tb_20250414'.tb_20250414
Diffstat (limited to 'src/regress/lib/libc/asr/bin/common.h')
-rw-r--r-- | src/regress/lib/libc/asr/bin/common.h | 138 |
1 files changed, 0 insertions, 138 deletions
diff --git a/src/regress/lib/libc/asr/bin/common.h b/src/regress/lib/libc/asr/bin/common.h deleted file mode 100644 index 6a6b90a34f..0000000000 --- a/src/regress/lib/libc/asr/bin/common.h +++ /dev/null | |||
@@ -1,138 +0,0 @@ | |||
1 | /* $OpenBSD: common.h,v 1.2 2018/12/15 15:16:12 eric Exp $ */ | ||
2 | /* | ||
3 | * Copyright (c) 2012 Eric Faurot <eric@openbsd.org> | ||
4 | * | ||
5 | * Permission to use, copy, modify, and distribute this software for any | ||
6 | * purpose with or without fee is hereby granted, provided that the above | ||
7 | * copyright notice and this permission notice appear in all copies. | ||
8 | * | ||
9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
16 | */ | ||
17 | #include <sys/types.h> | ||
18 | #include <sys/socket.h> | ||
19 | |||
20 | #include <arpa/nameser.h> | ||
21 | |||
22 | #include <netinet/in.h> | ||
23 | |||
24 | #include <netdb.h> | ||
25 | |||
26 | |||
27 | #define unpack_rr __unpack_rr | ||
28 | #define unpack_header __unpack_header | ||
29 | #define packed_init __packed_init | ||
30 | #define unpack_query __unpack_query | ||
31 | #define sockaddr_from_str __sockaddr_from_str | ||
32 | #define print_addr __print_addr | ||
33 | |||
34 | extern int long_err; | ||
35 | extern int gai_errno; | ||
36 | extern int rrset_errno; | ||
37 | |||
38 | const char *classtostr(uint16_t); | ||
39 | const char *typetostr(uint16_t); | ||
40 | const char *rcodetostr(uint16_t); | ||
41 | |||
42 | uint16_t strtotype(const char*); | ||
43 | uint16_t strtoclass(const char*); | ||
44 | int strtoresopt(const char*); | ||
45 | void parseresopt(const char*); | ||
46 | |||
47 | void print_rrsetinfo(struct rrsetinfo *); | ||
48 | void print_addrinfo(struct addrinfo *); | ||
49 | void print_errors(void); | ||
50 | void print_hostent(struct hostent *); | ||
51 | void print_netent(struct netent *); | ||
52 | |||
53 | int sockaddr_from_str(struct sockaddr *, int, const char *); | ||
54 | int addr_from_str(char *, int *, int *, const char *); | ||
55 | char* gethostarg(char *); | ||
56 | |||
57 | #define QR_MASK (0x1 << 15) | ||
58 | #define OPCODE_MASK (0xf << 11) | ||
59 | #define AA_MASK (0x1 << 10) | ||
60 | #define TC_MASK (0x1 << 9) | ||
61 | #define RD_MASK (0x1 << 8) | ||
62 | #define RA_MASK (0x1 << 7) | ||
63 | #define Z_MASK (0x7 << 4) | ||
64 | #define RCODE_MASK (0xf) | ||
65 | |||
66 | #define OPCODE(v) ((v) & OPCODE_MASK) | ||
67 | #define RCODE(v) ((v) & RCODE_MASK) | ||
68 | |||
69 | |||
70 | struct packed { | ||
71 | char *data; | ||
72 | size_t len; | ||
73 | size_t offset; | ||
74 | const char *err; | ||
75 | }; | ||
76 | |||
77 | struct header { | ||
78 | uint16_t id; | ||
79 | uint16_t flags; | ||
80 | uint16_t qdcount; | ||
81 | uint16_t ancount; | ||
82 | uint16_t nscount; | ||
83 | uint16_t arcount; | ||
84 | }; | ||
85 | |||
86 | struct query { | ||
87 | char q_dname[MAXDNAME]; | ||
88 | uint16_t q_type; | ||
89 | uint16_t q_class; | ||
90 | }; | ||
91 | |||
92 | struct rr { | ||
93 | char rr_dname[MAXDNAME]; | ||
94 | uint16_t rr_type; | ||
95 | uint16_t rr_class; | ||
96 | uint32_t rr_ttl; | ||
97 | union { | ||
98 | struct { | ||
99 | char cname[MAXDNAME]; | ||
100 | } cname; | ||
101 | struct { | ||
102 | uint16_t preference; | ||
103 | char exchange[MAXDNAME]; | ||
104 | } mx; | ||
105 | struct { | ||
106 | char nsname[MAXDNAME]; | ||
107 | } ns; | ||
108 | struct { | ||
109 | char ptrname[MAXDNAME]; | ||
110 | } ptr; | ||
111 | struct { | ||
112 | char mname[MAXDNAME]; | ||
113 | char rname[MAXDNAME]; | ||
114 | uint32_t serial; | ||
115 | uint32_t refresh; | ||
116 | uint32_t retry; | ||
117 | uint32_t expire; | ||
118 | uint32_t minimum; | ||
119 | } soa; | ||
120 | struct { | ||
121 | struct in_addr addr; | ||
122 | } in_a; | ||
123 | struct { | ||
124 | struct in6_addr addr6; | ||
125 | } in_aaaa; | ||
126 | struct { | ||
127 | uint16_t rdlen; | ||
128 | const void *rdata; | ||
129 | } other; | ||
130 | } rr; | ||
131 | }; | ||
132 | |||
133 | void packed_init(struct packed*, char*, size_t); | ||
134 | int pack_header(struct packed*, const struct header*); | ||
135 | int pack_query(struct packed*, uint16_t, uint16_t, const char*); | ||
136 | int unpack_header(struct packed*, struct header*); | ||
137 | int unpack_query(struct packed*, struct query*); | ||
138 | int unpack_rr(struct packed*, struct rr*); | ||