2 * Copyright (c) 2011 Nicira Networks.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #error "Use this header only with sparse. It is not a correct implementation."
21 #ifndef __NETINET_IN_SPARSE
22 #define __NETINET_IN_SPARSE 1
24 #include "openvswitch/types.h"
26 #include <sys/socket.h>
28 typedef ovs_be16 in_port_t;
29 typedef ovs_be32 in_addr_t;
36 sa_family_t sin_family;
38 struct in_addr sin_addr;
43 uint8_t u_s6_addr[16];
47 #define s6_addr u.u_s6_addr
49 extern const struct in6_addr in6addr_any;
52 #define IPPROTO_HOPOPTS 0
53 #define IPPROTO_ICMP 1
55 #define IPPROTO_UDP 17
56 #define IPPROTO_ROUTING 43
57 #define IPPROTO_FRAGMENT 44
59 #define IPPROTO_ICMPV6 58
60 #define IPPROTO_NONE 59
61 #define IPPROTO_DSTOPTS 60
63 #define INADDR_ANY 0x00000000
64 #define INADDR_BROADCAST 0xffffffff
65 #define INADDR_NONE 0xffffffff
67 #define INET6_ADDRSTRLEN 46
69 static inline ovs_be32 htonl(uint32_t x)
71 return (OVS_FORCE ovs_be32) x;
74 static inline ovs_be16 htons(uint16_t x)
76 return (OVS_FORCE ovs_be16) x;
79 static inline uint32_t ntohl(ovs_be32 x)
81 return (OVS_FORCE uint32_t) x;
84 static inline uint16_t ntohs(ovs_be16 x)
86 return (OVS_FORCE uint16_t) x;
89 in_addr_t inet_addr(const char *);
90 int inet_aton (const char *, struct in_addr *);
91 char *inet_ntoa(struct in_addr);
92 const char *inet_ntop(int, const void *, char *, socklen_t);
93 int inet_pton(int, const char *, void *);
95 #endif /* <netinet/in.h> sparse */