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

Side by Side Diff: libraries/nacl-mounts/base/newlib_hacks.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
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 typedef uint32_t socklen_t;
10 struct sockaddr {
11 short sa_family;
12 char sa_data[14];
13 };
14
15 typedef uint32_t in_addr_t;
16 typedef uint16_t in_port_t;
17
18 struct in_addr {
19 in_addr_t s_addr;
20 };
21
22 struct sockaddr_in {
23 short sin_family;
24 unsigned short sin_port;
25 struct in_addr sin_addr;
26 char sin_zero[8];
27 };
28
29 typedef struct addrinfo {
30 int ai_flags;
31 int ai_family;
32 int ai_socktype;
33 int ai_protocol;
34 size_t ai_addrlen;
35 struct sockaddr *ai_addr;
36 char *ai_canonname; /* canonical name */
37 struct addrinfo *ai_next; /* this struct can form a linked list */
38 } ADDRINFOA;
39
40 struct in6_addr {
41 uint8_t s6_addr[16]; /* IPv6 address */
42 };
43
44 #define AF_INET 1
45 #define AF_INET6 2
46 #define AF_UNSPEC 4
47 #define SOCK_STREAM 1
48 #define SOCK_DGRAM 2
49
50 #define EAI_FAIL 1
51 #define AI_PASSIVE 1
52 #define AI_NUMERICHOST 2
53 #define AI_CANONNAME 3
54 #define EAI_FAMILY 2
55
56 #define NI_MAXHOST 256
57
58 #ifndef INET_ADDRSTRLEN
59 #define INET_ADDRSTRLEN 16
60 #endif
61
62 struct hostent {
63 char *h_name; /* official name of host */
64 char **h_aliases; /* alias list */
65 int h_addrtype; /* host address type */
66 int h_length; /* length of address */
67 char **h_addr_list; /* list of addresses */
68 };
69
70 #define h_addr h_addr_list[0] /* for backward compatibility */
71
72 short htons(short v);
73 short ntohs(short v);
74
75 const char*
76 inet_ntop(int af, const void *src, char *dst, socklen_t cnt);
77 int inet_pton(int af, const char* src, void* dst);
78
79 struct sockaddr_in6 {
80 short sin6_family; /* AF_INET6 */
81 in_port_t sin6_port; /* Transport layer port # */
82 uint32_t sin6_flowinfo; /* IPv6 flow information */
83 struct in6_addr sin6_addr; /* IPv6 address */
84 };
85
86 #endif // PACKAGES_LIBRARIES_NACL_MOUNTS_BASE_NEWLIB_H_
87
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698