| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/bio/b_sock2.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||
| 2 | int BIO_socket(int domain, int socktype, int protocol, int options) | - | ||||||
| 3 | { | - | ||||||
| 4 | int sock = -1; | - | ||||||
| 5 | - | |||||||
| 6 | if (BIO_sock_init() != 1
| 0-371 | ||||||
| 7 | return never executed: (-1);return (-1);never executed: return (-1); | 0 | ||||||
| 8 | - | |||||||
| 9 | sock = socket(domain, socktype, protocol); | - | ||||||
| 10 | if (sock == -1
| 0-371 | ||||||
| 11 | ERR_put_error(2,(4),( | - | ||||||
| 12 | (*__errno_location ()) | - | ||||||
| 13 | ),__FILE__,49); | - | ||||||
| 14 | ERR_put_error(32,(140),(118),__FILE__,50); | - | ||||||
| 15 | return never executed: (-1);return (-1);never executed: return (-1); | 0 | ||||||
| 16 | } | - | ||||||
| 17 | - | |||||||
| 18 | return executed 371 times by 1 test: sock;return sock;Executed by:
executed 371 times by 1 test: return sock;Executed by:
| 371 | ||||||
| 19 | } | - | ||||||
| 20 | int BIO_connect(int sock, const BIO_ADDR *addr, int options) | - | ||||||
| 21 | { | - | ||||||
| 22 | const int on = 1; | - | ||||||
| 23 | - | |||||||
| 24 | if (sock == -1
| 0-193 | ||||||
| 25 | ERR_put_error(32,(138),(135),__FILE__,82); | - | ||||||
| 26 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||
| 27 | } | - | ||||||
| 28 | - | |||||||
| 29 | if (!BIO_socket_nbio(sock, (options & 0x08) != 0)
| 0-193 | ||||||
| 30 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||
| 31 | - | |||||||
| 32 | if (options & 0x04
| 2-191 | ||||||
| 33 | if (setsockopt(sock,
| 0-2 | ||||||
| 34 | 1
| 0-2 | ||||||
| 35 | ,
| 0-2 | ||||||
| 36 | 9
| 0-2 | ||||||
| 37 | ,
| 0-2 | ||||||
| 38 | (const void *)&on, sizeof(on)) != 0
| 0-2 | ||||||
| 39 | ERR_put_error(2,(14),( | - | ||||||
| 40 | (*__errno_location ()) | - | ||||||
| 41 | ),__FILE__,92); | - | ||||||
| 42 | ERR_put_error(32,(138),(137),__FILE__,93); | - | ||||||
| 43 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||
| 44 | } | - | ||||||
| 45 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||
| 46 | - | |||||||
| 47 | if (options & 0x10
| 0-193 | ||||||
| 48 | if (setsockopt(sock,
| 0 | ||||||
| 49 | IPPROTO_TCP
| 0 | ||||||
| 50 | ,
| 0 | ||||||
| 51 | 1
| 0 | ||||||
| 52 | ,
| 0 | ||||||
| 53 | (const void *)&on, sizeof(on)) != 0
| 0 | ||||||
| 54 | ERR_put_error(2,(14),( | - | ||||||
| 55 | (*__errno_location ()) | - | ||||||
| 56 | ),__FILE__,101); | - | ||||||
| 57 | ERR_put_error(32,(138),(138),__FILE__,102); | - | ||||||
| 58 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||
| 59 | } | - | ||||||
| 60 | } never executed: end of block | 0 | ||||||
| 61 | - | |||||||
| 62 | if (connect(sock, BIO_ADDR_sockaddr(addr),
| 2-191 | ||||||
| 63 | BIO_ADDR_sockaddr_size(addr)) == -1
| 2-191 | ||||||
| 64 | if (!BIO_sock_should_retry(-1)
| 0-2 | ||||||
| 65 | ERR_put_error(2,(2),( | - | ||||||
| 66 | (*__errno_location ()) | - | ||||||
| 67 | ),__FILE__,110); | - | ||||||
| 68 | ERR_put_error(32,(138),(103),__FILE__,111); | - | ||||||
| 69 | } never executed: end of block | 0 | ||||||
| 70 | return executed 2 times by 1 test: 0;return 0;Executed by:
executed 2 times by 1 test: return 0;Executed by:
| 2 | ||||||
| 71 | } | - | ||||||
| 72 | return executed 191 times by 1 test: 1;return 1;Executed by:
executed 191 times by 1 test: return 1;Executed by:
| 191 | ||||||
| 73 | } | - | ||||||
| 74 | int BIO_bind(int sock, const BIO_ADDR *addr, int options) | - | ||||||
| 75 | { | - | ||||||
| 76 | - | |||||||
| 77 | int on = 1; | - | ||||||
| 78 | - | |||||||
| 79 | - | |||||||
| 80 | if (sock == -1
| 0-178 | ||||||
| 81 | ERR_put_error(32,(147),(135),__FILE__,141); | - | ||||||
| 82 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||
| 83 | } | - | ||||||
| 84 | - | |||||||
| 85 | - | |||||||
| 86 | - | |||||||
| 87 | - | |||||||
| 88 | - | |||||||
| 89 | - | |||||||
| 90 | if (options & 0x01
| 0-178 | ||||||
| 91 | if (setsockopt(sock,
| 0-178 | ||||||
| 92 | 1
| 0-178 | ||||||
| 93 | ,
| 0-178 | ||||||
| 94 | 2
| 0-178 | ||||||
| 95 | ,
| 0-178 | ||||||
| 96 | (const void *)&on, sizeof(on)) != 0
| 0-178 | ||||||
| 97 | ERR_put_error(2,(14),( | - | ||||||
| 98 | (*__errno_location ()) | - | ||||||
| 99 | ),__FILE__,153); | - | ||||||
| 100 | ERR_put_error(32,(147),(139),__FILE__,154); | - | ||||||
| 101 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||
| 102 | } | - | ||||||
| 103 | } executed 178 times by 1 test: end of blockExecuted by:
| 178 | ||||||
| 104 | - | |||||||
| 105 | - | |||||||
| 106 | if (bind(sock, BIO_ADDR_sockaddr(addr), BIO_ADDR_sockaddr_size(addr)) != 0
| 0-178 | ||||||
| 107 | ERR_put_error(2,(6),( | - | ||||||
| 108 | (*__errno_location ()) | - | ||||||
| 109 | ),__FILE__,161); | - | ||||||
| 110 | ERR_put_error(32,(147),(117),__FILE__,162); | - | ||||||
| 111 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||
| 112 | } | - | ||||||
| 113 | - | |||||||
| 114 | return executed 178 times by 1 test: 1;return 1;Executed by:
executed 178 times by 1 test: return 1;Executed by:
| 178 | ||||||
| 115 | } | - | ||||||
| 116 | int BIO_listen(int sock, const BIO_ADDR *addr, int options) | - | ||||||
| 117 | { | - | ||||||
| 118 | int on = 1; | - | ||||||
| 119 | int socktype; | - | ||||||
| 120 | socklen_t socktype_len = sizeof(socktype); | - | ||||||
| 121 | - | |||||||
| 122 | if (sock == -1
| 0-178 | ||||||
| 123 | ERR_put_error(32,(139),(135),__FILE__,213); | - | ||||||
| 124 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||
| 125 | } | - | ||||||
| 126 | - | |||||||
| 127 | if (getsockopt(sock,
| 0-178 | ||||||
| 128 | 1
| 0-178 | ||||||
| 129 | ,
| 0-178 | ||||||
| 130 | 3
| 0-178 | ||||||
| 131 | ,
| 0-178 | ||||||
| 132 | (void *)&socktype, &socktype_len) != 0
| 0-178 | ||||||
| 133 | || socktype_len != sizeof(socktype)
| 0-178 | ||||||
| 134 | ERR_put_error(2,(15),( | - | ||||||
| 135 | (*__errno_location ()) | - | ||||||
| 136 | ),__FILE__,220); | - | ||||||
| 137 | ERR_put_error(32,(139),(134),__FILE__,221); | - | ||||||
| 138 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||
| 139 | } | - | ||||||
| 140 | - | |||||||
| 141 | if (!BIO_socket_nbio(sock, (options & 0x08) != 0)
| 0-178 | ||||||
| 142 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||
| 143 | - | |||||||
| 144 | if (options & 0x04
| 0-178 | ||||||
| 145 | if (setsockopt(sock,
| 0 | ||||||
| 146 | 1
| 0 | ||||||
| 147 | ,
| 0 | ||||||
| 148 | 9
| 0 | ||||||
| 149 | ,
| 0 | ||||||
| 150 | (const void *)&on, sizeof(on)) != 0
| 0 | ||||||
| 151 | ERR_put_error(2,(14),( | - | ||||||
| 152 | (*__errno_location ()) | - | ||||||
| 153 | ),__FILE__,231); | - | ||||||
| 154 | ERR_put_error(32,(139),(137),__FILE__,232); | - | ||||||
| 155 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||
| 156 | } | - | ||||||
| 157 | } never executed: end of block | 0 | ||||||
| 158 | - | |||||||
| 159 | if (options & 0x10
| 0-178 | ||||||
| 160 | if (setsockopt(sock,
| 0 | ||||||
| 161 | IPPROTO_TCP
| 0 | ||||||
| 162 | ,
| 0 | ||||||
| 163 | 1
| 0 | ||||||
| 164 | ,
| 0 | ||||||
| 165 | (const void *)&on, sizeof(on)) != 0
| 0 | ||||||
| 166 | ERR_put_error(2,(14),( | - | ||||||
| 167 | (*__errno_location ()) | - | ||||||
| 168 | ),__FILE__,240); | - | ||||||
| 169 | ERR_put_error(32,(139),(138),__FILE__,241); | - | ||||||
| 170 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||
| 171 | } | - | ||||||
| 172 | } never executed: end of block | 0 | ||||||
| 173 | - | |||||||
| 174 | - | |||||||
| 175 | if (BIO_ADDR_family(addr) ==
| 1-177 | ||||||
| 176 | 10
| 1-177 | ||||||
| 177 | ) { | - | ||||||
| 178 | - | |||||||
| 179 | - | |||||||
| 180 | - | |||||||
| 181 | - | |||||||
| 182 | on = options & 0x02
| 1-176 | ||||||
| 183 | if (setsockopt(sock,
| 0-177 | ||||||
| 184 | IPPROTO_IPV6
| 0-177 | ||||||
| 185 | ,
| 0-177 | ||||||
| 186 | 26
| 0-177 | ||||||
| 187 | ,
| 0-177 | ||||||
| 188 | (const void *)&on, sizeof(on)) != 0
| 0-177 | ||||||
| 189 | ERR_put_error(2,(14),( | - | ||||||
| 190 | (*__errno_location ()) | - | ||||||
| 191 | ),__FILE__,255); | - | ||||||
| 192 | ERR_put_error(32,(139),(136),__FILE__,256); | - | ||||||
| 193 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||
| 194 | } | - | ||||||
| 195 | } executed 177 times by 1 test: end of blockExecuted by:
| 177 | ||||||
| 196 | - | |||||||
| 197 | - | |||||||
| 198 | if (!BIO_bind(sock, addr, options)
| 0-178 | ||||||
| 199 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||
| 200 | - | |||||||
| 201 | if (socktype !=
| 0-178 | ||||||
| 202 | SOCK_DGRAM
| 0-178 | ||||||
| 203 | && listen(sock,
| 0-178 | ||||||
| 204 | 128
| 0-178 | ||||||
| 205 | ) == -1
| 0-178 | ||||||
| 206 | ERR_put_error(2,(7),( | - | ||||||
| 207 | (*__errno_location ()) | - | ||||||
| 208 | ),__FILE__,266); | - | ||||||
| 209 | ERR_put_error(32,(139),(119),__FILE__,267); | - | ||||||
| 210 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||
| 211 | } | - | ||||||
| 212 | - | |||||||
| 213 | return executed 178 times by 1 test: 1;return 1;Executed by:
executed 178 times by 1 test: return 1;Executed by:
| 178 | ||||||
| 214 | } | - | ||||||
| 215 | int BIO_accept_ex(int accept_sock, BIO_ADDR *addr_, int options) | - | ||||||
| 216 | { | - | ||||||
| 217 | socklen_t len; | - | ||||||
| 218 | int accepted_sock; | - | ||||||
| 219 | BIO_ADDR locaddr; | - | ||||||
| 220 | BIO_ADDR *addr = addr_ ==
| 0-193 | ||||||
| 221 | ((void *)0)
| 0-193 | ||||||
| 222 | ? &locaddr : addr_; | - | ||||||
| 223 | - | |||||||
| 224 | len = sizeof(*addr); | - | ||||||
| 225 | accepted_sock = accept(accept_sock, | - | ||||||
| 226 | BIO_ADDR_sockaddr_noconst(addr), &len); | - | ||||||
| 227 | if (accepted_sock == -1
| 0-193 | ||||||
| 228 | if (!BIO_sock_should_retry(accepted_sock)
| 0 | ||||||
| 229 | ERR_put_error(2,(8),( | - | ||||||
| 230 | (*__errno_location ()) | - | ||||||
| 231 | ),__FILE__,293); | - | ||||||
| 232 | ERR_put_error(32,(137),(100),__FILE__,294); | - | ||||||
| 233 | } never executed: end of block | 0 | ||||||
| 234 | return never executed: (-1);return (-1);never executed: return (-1); | 0 | ||||||
| 235 | } | - | ||||||
| 236 | - | |||||||
| 237 | if (!BIO_socket_nbio(accepted_sock, (options & 0x08) != 0)
| 0-193 | ||||||
| 238 | close(accepted_sock); | - | ||||||
| 239 | return never executed: (-1);return (-1);never executed: return (-1); | 0 | ||||||
| 240 | } | - | ||||||
| 241 | - | |||||||
| 242 | return executed 193 times by 1 test: accepted_sock;return accepted_sock;Executed by:
executed 193 times by 1 test: return accepted_sock;Executed by:
| 193 | ||||||
| 243 | } | - | ||||||
| 244 | - | |||||||
| 245 | - | |||||||
| 246 | - | |||||||
| 247 | - | |||||||
| 248 | - | |||||||
| 249 | int BIO_closesocket(int sock) | - | ||||||
| 250 | { | - | ||||||
| 251 | if (close(sock) < 0
| 0-562 | ||||||
| 252 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||
| 253 | return executed 562 times by 1 test: 1;return 1;Executed by:
executed 562 times by 1 test: return 1;Executed by:
| 562 | ||||||
| 254 | } | - | ||||||
| Switch to Source code | Preprocessed file |