Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(362)

Side by Side Diff: libraries/nacl-mounts/net/newlib_compat.h

Issue 10392070: Socket subsystem implementation (Closed) Base URL: http://naclports.googlecode.com/svn/trunk/src/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « libraries/nacl-mounts/net/TcpSocket.cc ('k') | libraries/nacl-mounts/pepper/PepperMount.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
5 */
6 #ifndef PACKAGES_LIBRARIES_NACL_MOUNTS_BASE_NEWLIB_H_
7 #define PACKAGES_LIBRARIES_NACL_MOUNTS_BASE_NEWLIB_H_
8
9 #include <assert.h>
10
11 typedef uint32_t socklen_t;
12 struct sockaddr {
13 uint16_t sa_family;
14 char sa_data[14];
15 };
16
17 typedef uint32_t in_addr_t;
18 typedef uint16_t in_port_t;
19
20 struct in_addr {
21 in_addr_t s_addr;
22 };
23
24 struct sockaddr_in {
25 uint16_t sin_family;
26 uint16_t sin_port;
27 struct in_addr sin_addr;
28 char sin_zero[8];
29 };
30
31 typedef struct addrinfo {
32 int ai_flags;
33 int ai_family;
34 int ai_socktype;
35 int ai_protocol;
36 size_t ai_addrlen;
37 struct sockaddr *ai_addr;
38 char* ai_canonname; /* canonical name */
39 struct addrinfo *ai_next; /* this struct can form a linked list */
40 } ADDRINFOA;
41
42 struct in6_addr {
43 uint8_t s6_addr[16]; /* IPv6 address */
44 };
45
46 #define AF_INET 1
47 #define AF_INET6 2
48 #define AF_UNSPEC 4
49 #define SOCK_STREAM 1
50 #define SOCK_DGRAM 2
51
52 #define EAI_FAIL 1
53 #define AI_PASSIVE 1
54 #define AI_NUMERICHOST 2
55 #define AI_CANONNAME 3
56 #define EAI_FAMILY 2
57
58 #define NI_MAXHOST 256
59
60 #ifndef INET_ADDRSTRLEN
61 #define INET_ADDRSTRLEN 16
62 #endif
63
64 struct hostent {
65 char* h_name; /* official name of host */
66 char** h_aliases; /* alias list */
67 int h_addrtype; /* host address type */
68 int h_length; /* length of address */
69 char** h_addr_list; /* list of addresses */
70 };
71
72 #define h_addr h_addr_list[0] /* for backward compatibility */
73
74 static uint16_t htons(uint16_t v) {
75 assert(0);
76 }
77 uint16_t ntohs(uint16_t v) {
78 assert(0);
79 }
80
81 const char*
82 inet_ntop(int af, const void *src, char *dst, socklen_t cnt) {
83 assert(0);
84 }
85 int inet_pton(int af, const char* src, void* dst) {
86 assert(0);
87 }
88
89 struct sockaddr_in6 {
90 uint16_t sin6_family; /* AF_INET6 */
91 in_port_t sin6_port; /* Transport layer port # */
92 uint32_t sin6_flowinfo; /* IPv6 flow information */
93 struct in6_addr sin6_addr; /* IPv6 address */
94 };
95
96 #endif // PACKAGES_LIBRARIES_NACL_MOUNTS_BASE_NEWLIB_H_
97
OLDNEW
« no previous file with comments | « libraries/nacl-mounts/net/TcpSocket.cc ('k') | libraries/nacl-mounts/pepper/PepperMount.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698