CBMC
netdb.c
Go to the documentation of this file.
1 /* FUNCTION: gethostbyname */
2 
3 #ifdef _MSC_VER
4 #include <windows.h>
5 #else
6 #include <netdb.h>
7 #endif
8 
9 __CPROVER_bool __VERIFIER_nondet___CPROVER_bool(void);
10 
11 struct hostent *gethostbyname(const char *name)
12 {
13  __CPROVER_HIDE:;
14  #ifdef __CPROVER_STRING_ABSTRACTION
16  "gethostbyname zero-termination of name argument");
17  #endif
18  (void)*name;
19 
20  __CPROVER_bool error=__VERIFIER_nondet___CPROVER_bool();
21  if(error) return 0;
22 
23  // quite restrictive, as will alias between calls
24  static struct hostent result;
25 
26  // we whould be filling in the fields of this
27  return &result;
28 }
29 
30 /* FUNCTION: gethostbyaddr */
31 
32 #ifdef _MSC_VER
33 #include <windows.h>
34 #else
35 #include <netdb.h>
36 #endif
37 
38 __CPROVER_bool __VERIFIER_nondet___CPROVER_bool(void);
39 
40 struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type)
41 {
42  __CPROVER_HIDE:;
43  (void)*(char*)addr;
44  (void)len;
45  (void)type;
46 
47  __CPROVER_bool error=__VERIFIER_nondet___CPROVER_bool();
48  if(error) return 0;
49 
50  // quite restrictive, as will alias between calls
51  static struct hostent result;
52 
53  // we whould be filling in the fields of this
54  return &result;
55 }
56 
57 /* FUNCTION: gethostent */
58 
59 // There does not appear to be a Windows variant of gethostent
60 #include <netdb.h>
61 
62 __CPROVER_bool __VERIFIER_nondet___CPROVER_bool(void);
63 
64 struct hostent *gethostent(void)
65 {
66  __CPROVER_HIDE:;
67 
68  __CPROVER_bool error=__VERIFIER_nondet___CPROVER_bool();
69  if(error) return 0;
70 
71  // quite restrictive, as will alias between calls
72  static struct hostent result;
73 
74  // we whould be filling in the fields of this
75  return &result;
76 }
void __CPROVER_precondition(__CPROVER_bool precondition, const char *description)
_Bool __CPROVER_is_zero_string(const void *)
struct hostent * gethostent(void)
Definition: netdb.c:64
struct hostent * gethostbyaddr(const void *addr, socklen_t len, int type)
Definition: netdb.c:40
struct hostent * gethostbyname(const char *name)
Definition: netdb.c:11
__CPROVER_bool __VERIFIER_nondet___CPROVER_bool(void)