Fix <resolv.h> and <netinet/tcp.h> so dnscap builds.
Some guy on the internet complained that dnscap doesn't build out of the box.
Now it does.
Bug: http://b/27839637
Change-Id: I8c4f22d3c3f8885a6fe06029d89ef68a15931027
diff --git a/libc/include/netinet/tcp.h b/libc/include/netinet/tcp.h
index e95cc09..147f6f7 100644
--- a/libc/include/netinet/tcp.h
+++ b/libc/include/netinet/tcp.h
@@ -30,11 +30,56 @@
#define _NETINET_TCP_H
#include <sys/cdefs.h>
+#include <stdint.h>
+#define tcphdr __kernel_tcphdr
#include <linux/tcp.h>
+#undef tcphdr
__BEGIN_DECLS
+struct tcphdr {
+ __extension__ union {
+ struct {
+ uint16_t th_sport;
+ uint16_t th_dport;
+ uint32_t th_seq;
+ uint32_t th_ack;
+ uint8_t th_x2:4;
+ uint8_t th_off:4;
+ uint8_t th_flags;
+ uint16_t th_win;
+ uint16_t th_sum;
+ uint16_t th_urp;
+ };
+ struct {
+ uint16_t source;
+ uint16_t dest;
+ uint32_t seq;
+ uint32_t ack_seq;
+ uint16_t res1:4;
+ uint16_t doff:4;
+ uint16_t fin:1;
+ uint16_t syn:1;
+ uint16_t rst:1;
+ uint16_t psh:1;
+ uint16_t ack:1;
+ uint16_t urg:1;
+ uint16_t res2:2;
+ uint16_t window;
+ uint16_t check;
+ uint16_t urg_ptr;
+ };
+ };
+};
+
+#define TH_FIN 0x01
+#define TH_SYN 0x02
+#define TH_RST 0x04
+#define TH_PUSH 0x08
+#define TH_ACK 0x10
+#define TH_URG 0x20
+
enum {
TCP_ESTABLISHED = 1,
TCP_SYN_SENT,
diff --git a/libc/include/resolv.h b/libc/include/resolv.h
index b10aaf4..aca3552 100644
--- a/libc/include/resolv.h
+++ b/libc/include/resolv.h
@@ -25,6 +25,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
+
#ifndef _RESOLV_H_
#define _RESOLV_H_
@@ -40,13 +41,24 @@
#pragma GCC visibility push(default)
#define b64_ntop __b64_ntop
+int b64_ntop(u_char const*, size_t, char*, size_t);
#define b64_pton __b64_pton
-extern int b64_ntop(u_char const*, size_t, char*, size_t);
-extern int b64_pton(char const*, u_char*, size_t);
+int b64_pton(char const*, u_char*, size_t);
#define dn_comp __dn_comp
-extern int dn_comp(const char*, u_char*, int, u_char**, u_char**);
-extern int dn_expand(const u_char*, const u_char*, const u_char*, char*, int);
+int dn_comp(const char*, u_char*, int, u_char**, u_char**);
+
+int dn_expand(const u_char*, const u_char*, const u_char*, char*, int);
+
+#define p_class __p_class
+const char* p_class(int);
+#define p_type __p_type
+const char* p_type(int);
+
+int res_init(void);
+int res_mkquery(int, const char*, int, int, const u_char*, int, const u_char*, u_char*, int);
+int res_query(const char*, int, int, u_char*, int);
+int res_search(const char*, int, int, u_char*, int);
#pragma GCC visibility pop
__END_DECLS