CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
inet.c
Go to the documentation of this file.
1/* FUNCTION: __inet_addr */
2
3#ifndef _WIN32
4
5#ifndef __CPROVER_INET_H_INCLUDED
6#include <arpa/inet.h>
7#define __CPROVER_INET_H_INCLUDED
8#endif
9
11
13{
15 #ifdef __CPROVER_STRING_ABSTRACTION
17 "inet_addr zero-termination of argument");
18 #endif
19 (void)*cp;
20
22 return result;
23}
24
25#endif
26
27/* FUNCTION: inet_addr */
28
29#ifndef _WIN32
30
31# ifndef __CPROVER_INET_H_INCLUDED
32# include <arpa/inet.h>
33# define __CPROVER_INET_H_INCLUDED
34# endif
35
36# undef inet_addr
37
38in_addr_t __inet_addr(const char *cp);
39
41{
43 return __inet_addr(cp);
44}
45
46#endif
47
48/* FUNCTION: __inet_aton */
49
50#ifndef _WIN32
51
52#ifndef __CPROVER_INET_H_INCLUDED
53#include <arpa/inet.h>
54#define __CPROVER_INET_H_INCLUDED
55#endif
56
58
59int __inet_aton(const char *cp, struct in_addr *pin)
60{
62 #ifdef __CPROVER_STRING_ABSTRACTION
64 "inet_aton zero-termination of name argument");
65 #endif
66 (void)*cp;
67 (void)*pin;
68
69 int result=__VERIFIER_nondet_int();
70 return result;
71}
72
73#endif
74
75/* FUNCTION: inet_aton */
76
77#ifndef _WIN32
78
79# ifndef __CPROVER_INET_H_INCLUDED
80# include <arpa/inet.h>
81# define __CPROVER_INET_H_INCLUDED
82# endif
83
84# undef inet_aton
85
86int __inet_aton(const char *cp, struct in_addr *pin);
87
88int inet_aton(const char *cp, struct in_addr *pin)
89{
91 return __inet_aton(cp, pin);
92}
93
94#endif
95
96/* FUNCTION: __inet_ntoa */
97
98#ifndef _WIN32
99
100# ifndef __CPROVER_INET_H_INCLUDED
101# include <arpa/inet.h>
102# define __CPROVER_INET_H_INCLUDED
103# endif
104
106
107char *__inet_ntoa(struct in_addr in)
108{
110 (void)in;
111 // the last byte remains zero to ensure string termination
113 return __inet_ntoa_buffer;
114}
115
116#endif
117
118/* FUNCTION: inet_ntoa */
119
120#ifndef _WIN32
121
122# ifndef __CPROVER_INET_H_INCLUDED
123# include <arpa/inet.h>
124# define __CPROVER_INET_H_INCLUDED
125# endif
126
127# undef inet_ntoa
128
129char *__inet_ntoa(struct in_addr in);
130
131char *inet_ntoa(struct in_addr in)
132{
134 return __inet_ntoa(in);
135}
136
137#endif
138
139/* FUNCTION: __inet_network */
140
141#ifndef _WIN32
142
143#ifndef __CPROVER_INET_H_INCLUDED
144#include <arpa/inet.h>
145#define __CPROVER_INET_H_INCLUDED
146#endif
147
149
151{
153 #ifdef __CPROVER_STRING_ABSTRACTION
155 "inet_network zero-termination of name argument");
156 #endif
157 (void)*cp;
158
160 return result;
161}
162
163#endif
164
165/* FUNCTION: inet_network */
166
167#ifndef _WIN32
168
169# ifndef __CPROVER_INET_H_INCLUDED
170# include <arpa/inet.h>
171# define __CPROVER_INET_H_INCLUDED
172# endif
173
174# undef inet_network
175
176in_addr_t __inet_network(const char *cp);
177
179{
181 return __inet_network(cp);
182}
183
184#endif
185
186/* FUNCTION: htonl */
187
188#ifndef __CPROVER_STDINT_H_INCLUDED
189#include <stdint.h>
190#define __CPROVER_STDINT_H_INCLUDED
191#endif
192
193#undef htonl
194
196
198{
199#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
201#else
202 return hostlong;
203#endif
204}
205
206/* FUNCTION: htons */
207
208#ifndef __CPROVER_STDINT_H_INCLUDED
209#include <stdint.h>
210#define __CPROVER_STDINT_H_INCLUDED
211#endif
212
213#undef htons
214
216
218{
219#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
221#else
222 return hostshort;
223#endif
224}
225
226
227/* FUNCTION: ntohl */
228
229#ifndef __CPROVER_STDINT_H_INCLUDED
230#include <stdint.h>
231#define __CPROVER_STDINT_H_INCLUDED
232#endif
233
234#undef ntohl
235
237
239{
240#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
242#else
243 return netlong;
244#endif
245}
246
247
248/* FUNCTION: ntohs */
249
250#ifndef __CPROVER_STDINT_H_INCLUDED
251#include <stdint.h>
252#define __CPROVER_STDINT_H_INCLUDED
253#endif
254
255#undef ntohs
256
258
260{
261#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
263#else
264 return netshort;
265#endif
266}
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
void __CPROVER_havoc_slice(void *, __CPROVER_size_t)
void __CPROVER_precondition(__CPROVER_bool precondition, const char *description)
_Bool __CPROVER_is_zero_string(const void *)
int __VERIFIER_nondet_int(void)
in_addr_t inet_addr(const char *cp)
Definition inet.c:40
in_addr_t __VERIFIER_nondet_in_addr_t(void)
in_addr_t inet_network(const char *cp)
Definition inet.c:178
uint32_t ntohl(uint32_t netlong)
Definition inet.c:238
uint32_t htonl(uint32_t hostlong)
Definition inet.c:197
in_addr_t __inet_network(const char *cp)
Definition inet.c:150
char * __inet_ntoa(struct in_addr in)
Definition inet.c:107
uint16_t htons(uint16_t hostshort)
Definition inet.c:217
char * inet_ntoa(struct in_addr in)
Definition inet.c:131
int inet_aton(const char *cp, struct in_addr *pin)
Definition inet.c:88
uint16_t ntohs(uint16_t netshort)
Definition inet.c:259
char __inet_ntoa_buffer[16]
Definition inet.c:105
uint32_t __builtin_bswap32(uint32_t)
uint16_t __builtin_bswap16(uint16_t)
in_addr_t __inet_addr(const char *cp)
Definition inet.c:12
int __inet_aton(const char *cp, struct in_addr *pin)
Definition inet.c:59