| 1 |
|
| /* clamd_abi_impl.h - the wrappers behind clamd_abi.h. |
| 2 |
|
| * |
| 3 |
|
| * Included by the root .xs AFTER the headers defining the real |
| 4 |
|
| * functions. Not installed: a consumer vendors clamd_abi.h and never |
| 5 |
|
| * sees this. |
| 6 |
|
| */ |
| 7 |
|
| #ifndef CLAMD_ABI_IMPL_H |
| 8 |
|
| #define CLAMD_ABI_IMPL_H |
| 9 |
|
| |
| 10 |
|
| #include "clamav/clamd_abi.h" |
| 11 |
|
| |
| 12 |
|
| /* A target is a cc_target plus the storage its char pointers reference. |
| 13 |
|
| * cc_target borrows them, and an ABI consumer's strings are not this |
| 14 |
|
| * dist's to keep alive. */ |
| 15 |
|
| typedef struct { |
| 16 |
|
| cc_target t; |
| 17 |
|
| char *path; |
| 18 |
|
| char *host; |
| 19 |
|
| } cca_target; |
| 20 |
|
| |
| 21 |
35 |
| static void *cca_target_new(pTHX_ const char *socket_path, |
| 22 |
|
| const char *host, int port) { |
| 23 |
|
| cca_target *g; |
| 24 |
|
| |
| 25 |
|
| PERL_UNUSED_CONTEXT; |
| 26 |
|
| |
| 27 |
35 |
▶ | if (!socket_path && !host) return NULL; |
Branch: 2 branches
| Branch | True | False | Total |
| if (!socket_path && !host) return NULL; |
5 |
30 |
35 |
| if (!socket_path && !host) return NULL; |
1 |
4 |
5 |
|
| 28 |
34 |
▶ | if (socket_path && host) return NULL; |
Branch: 2 branches
| Branch | True | False | Total |
| if (socket_path && host) return NULL; |
30 |
4 |
34 |
| if (socket_path && host) return NULL; |
1 |
29 |
30 |
|
| 29 |
|
| |
| 30 |
|
| #ifndef _WIN32 |
| 31 |
|
| /* Refused, never truncated: a shortened sun_path connects to a |
| 32 |
|
| * different socket, and believing an answer from an unidentified |
| 33 |
|
| * peer is worse than not getting one. */ |
| 34 |
33 |
▶ | if (socket_path && strlen(socket_path) >= CC_SUN_PATH_MAX) return NULL; |
Branch: 2 branches
| Branch | True | False | Total |
| if (socket_path && strlen(socket_path) >= CC_SUN_PATH_MAX) return NULL; |
29 |
4 |
33 |
| if (socket_path && strlen(socket_path) >= CC_SUN_PATH_MAX) return NULL; |
2 |
27 |
29 |
|
| 35 |
|
| #else |
| 36 |
|
| if (socket_path) return NULL; |
| 37 |
|
| #endif |
| 38 |
|
| |
| 39 |
31 |
| g = (cca_target *)malloc(sizeof *g); |
| 40 |
|
| /* |
| 41 |
|
| # uncoverable branch true |
| 42 |
|
| # uncoverable condition left count:1 */ |
| 43 |
31 |
▶ | if (!g) return NULL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!g) return NULL; |
0 |
31 |
31 |
|
| 44 |
31 |
| memset(g, 0, sizeof *g); |
| 45 |
|
| |
| 46 |
31 |
▶ | g->path = socket_path ? cc_strdup(socket_path) : NULL; |
Branch: 1 branch
| Branch | True | False | Total |
| g->path = socket_path ? cc_strdup(socket_path) : NULL; |
27 |
4 |
31 |
|
| 47 |
31 |
▶ | g->host = host ? cc_strdup(host) : NULL; |
Branch: 1 branch
| Branch | True | False | Total |
| g->host = host ? cc_strdup(host) : NULL; |
4 |
27 |
31 |
|
| 48 |
|
| /* |
| 49 |
|
| # uncoverable branch true |
| 50 |
|
| # uncoverable condition left count:1 |
| 51 |
|
| # uncoverable condition left count:2 |
| 52 |
|
| # uncoverable condition left count:3 |
| 53 |
|
| # uncoverable condition left count:4 */ |
| 54 |
31 |
▶ | if ((socket_path && !g->path) || (host && !g->host)) { |
Branch: 4 branches
| Branch | True | False | Total |
| if ((socket_path && !g->path) || (host && !g->host)) { |
27 |
4 |
31 |
| if ((socket_path && !g->path) || (host && !g->host)) { |
27 |
0 |
27 |
| if ((socket_path && !g->path) || (host && !g->host)) { |
4 |
27 |
31 |
| if ((socket_path && !g->path) || (host && !g->host)) { |
0 |
4 |
4 |
|
| 55 |
0 |
| free(g->path); free(g->host); free(g); /* # uncoverable statement */ |
| 56 |
0 |
| return NULL; /* # uncoverable statement */ |
| 57 |
|
| } |
| 58 |
|
| |
| 59 |
31 |
| g->t.path = g->path; |
| 60 |
31 |
| g->t.host = g->host; |
| 61 |
31 |
▶ | g->t.port = port > 0 ? port : 3310; |
Branch: 1 branch
| Branch | True | False | Total |
| g->t.port = port > 0 ? port : 3310; |
3 |
28 |
31 |
|
| 62 |
31 |
| g->t.connect_timeout = 5.0; |
| 63 |
31 |
| g->t.reply_timeout = 30.0; |
| 64 |
31 |
| g->t.reply_max = 1024 * 1024; |
| 65 |
31 |
| g->t.frame = CC_FRAME_Z; |
| 66 |
31 |
| return g; |
| 67 |
|
| } |
| 68 |
|
| |
| 69 |
30 |
| static void cca_target_timeouts(pTHX_ void *target, double ct, double rt) { |
| 70 |
30 |
| cca_target *g = (cca_target *)target; |
| 71 |
|
| PERL_UNUSED_CONTEXT; |
| 72 |
30 |
▶ | if (!g) return; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!g) return; |
1 |
29 |
30 |
|
| 73 |
29 |
▶ | if (ct > 0) g->t.connect_timeout = ct; |
Branch: 1 branch
| Branch | True | False | Total |
| if (ct > 0) g->t.connect_timeout = ct; |
6 |
23 |
29 |
|
| 74 |
29 |
▶ | if (rt > 0) g->t.reply_timeout = rt; |
Branch: 1 branch
| Branch | True | False | Total |
| if (rt > 0) g->t.reply_timeout = rt; |
5 |
24 |
29 |
|
| 75 |
|
| } |
| 76 |
|
| |
| 77 |
26 |
| static void cca_target_limits(pTHX_ void *target, size_t reply_max, |
| 78 |
|
| size_t chunk, size_t max_size) { |
| 79 |
26 |
| cca_target *g = (cca_target *)target; |
| 80 |
|
| PERL_UNUSED_CONTEXT; |
| 81 |
26 |
▶ | if (!g) return; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!g) return; |
1 |
25 |
26 |
|
| 82 |
25 |
▶ | if (reply_max) g->t.reply_max = reply_max; |
Branch: 1 branch
| Branch | True | False | Total |
| if (reply_max) g->t.reply_max = reply_max; |
1 |
24 |
25 |
|
| 83 |
25 |
| g->t.chunk = chunk; |
| 84 |
25 |
| g->t.max_size = max_size; |
| 85 |
|
| } |
| 86 |
|
| |
| 87 |
32 |
| static void cca_target_free(pTHX_ void *target) { |
| 88 |
32 |
| cca_target *g = (cca_target *)target; |
| 89 |
|
| PERL_UNUSED_CONTEXT; |
| 90 |
32 |
▶ | if (!g) return; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!g) return; |
1 |
31 |
32 |
|
| 91 |
31 |
| free(g->path); free(g->host); free(g); |
| 92 |
|
| } |
| 93 |
|
| |
| 94 |
|
| /* A handle is always returned, even for a refusal, so verdict_state is |
| 95 |
|
| * always answerable - the same rule the Perl side follows, for the same |
| 96 |
|
| * reason: the safe reading has to be the short one. */ |
| 97 |
31 |
| static cc_scan *cca_scan_new(void) { |
| 98 |
31 |
| cc_scan *s = (cc_scan *)malloc(sizeof *s); |
| 99 |
|
| /* |
| 100 |
|
| # uncoverable branch true |
| 101 |
|
| # uncoverable condition left count:1 */ |
| 102 |
31 |
▶ | if (!s) return NULL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!s) return NULL; |
0 |
31 |
31 |
|
| 103 |
31 |
| memset(s, 0, sizeof *s); |
| 104 |
31 |
| s->sock = CC_INVALID_SOCK; |
| 105 |
31 |
| s->scan_fd = -1; |
| 106 |
31 |
| s->phase = CC_PH_DONE; |
| 107 |
31 |
| return s; |
| 108 |
|
| } |
| 109 |
|
| |
| 110 |
5 |
| static int cca_pick_mode(const cc_target *t) { |
| 111 |
5 |
| return (CC_HAVE_FD_PASSING && t->path) ? CC_TRANSPORT_FILDES |
| 112 |
5 |
▶ | : CC_TRANSPORT_INSTREAM; |
Branch: 1 branch
| Branch | True | False | Total |
| : CC_TRANSPORT_INSTREAM; |
4 |
1 |
5 |
|
| 113 |
|
| } |
| 114 |
|
| |
| 115 |
9 |
| static void *cca_start_fd(pTHX_ void *target, int fd, int blocking) { |
| 116 |
9 |
| cca_target *g = (cca_target *)target; |
| 117 |
|
| cc_scan *s; |
| 118 |
|
| int mode; |
| 119 |
|
| |
| 120 |
|
| PERL_UNUSED_CONTEXT; |
| 121 |
9 |
▶ | if (!g) return NULL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!g) return NULL; |
1 |
8 |
9 |
|
| 122 |
8 |
| s = cca_scan_new(); |
| 123 |
|
| /* |
| 124 |
|
| # uncoverable branch true |
| 125 |
|
| # uncoverable condition left count:1 */ |
| 126 |
8 |
▶ | if (!s) return NULL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!s) return NULL; |
0 |
8 |
8 |
|
| 127 |
|
| |
| 128 |
|
| { |
| 129 |
|
| cc_stat_t st; |
| 130 |
8 |
▶ | if (cc_fstat(fd, &st) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (cc_fstat(fd, &st) < 0) { |
1 |
7 |
8 |
|
| 131 |
1 |
| cc_err_set(&s->err, CC_ERR_IO, "fstat", strerror(errno)); |
| 132 |
3 |
| s->rc = CC_ERR_IO; return s; |
| 133 |
|
| } |
| 134 |
7 |
▶ | if (!CC_S_ISREG(st.st_mode)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (!CC_S_ISREG(st.st_mode)) { |
1 |
6 |
7 |
|
| 135 |
1 |
| cc_err_set(&s->err, CC_ERR_NOTREG, "not a regular file", NULL); |
| 136 |
1 |
| s->rc = CC_ERR_NOTREG; return s; |
| 137 |
|
| } |
| 138 |
6 |
▶ | if (g->t.max_size && (size_t)st.st_size > g->t.max_size) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (g->t.max_size && (size_t)st.st_size > g->t.max_size) { |
2 |
4 |
6 |
| if (g->t.max_size && (size_t)st.st_size > g->t.max_size) { |
1 |
1 |
2 |
|
| 139 |
1 |
| cc_err_set(&s->err, CC_ERR_TOOBIGLOC, |
| 140 |
|
| "larger than max_size; refused without scanning", NULL); |
| 141 |
1 |
| s->rc = CC_ERR_TOOBIGLOC; return s; |
| 142 |
|
| } |
| 143 |
|
| } |
| 144 |
|
| |
| 145 |
5 |
| mode = cca_pick_mode(&g->t); |
| 146 |
5 |
▶ | if (mode == CC_TRANSPORT_FILDES) |
Branch: 1 branch
| Branch | True | False | Total |
| if (mode == CC_TRANSPORT_FILDES) |
4 |
1 |
5 |
|
| 147 |
4 |
| (void)cc_scan_start(s, &g->t, mode, fd, 0, NULL, 0, -1); |
| 148 |
|
| else |
| 149 |
1 |
| (void)cc_scan_start(s, &g->t, mode, -1, 0, NULL, 0, fd); |
| 150 |
|
| |
| 151 |
5 |
▶ | if (blocking) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (blocking) { |
4 |
1 |
5 |
|
| 152 |
4 |
| char *out = NULL; |
| 153 |
4 |
| size_t n = 0; |
| 154 |
|
| cc_err e; |
| 155 |
4 |
| (void)cc_scan_run(s, &out, &n, &e); |
| 156 |
|
| /* cc_scan_run hands ownership out; put it straight back, because |
| 157 |
|
| * the verdict is read from the handle. */ |
| 158 |
4 |
| s->reply = out; s->replylen = n; |
| 159 |
|
| } |
| 160 |
5 |
| return s; |
| 161 |
|
| } |
| 162 |
|
| |
| 163 |
24 |
| static void *cca_start_mem(pTHX_ void *target, const char *buf, size_t len, |
| 164 |
|
| int blocking) { |
| 165 |
24 |
| cca_target *g = (cca_target *)target; |
| 166 |
|
| cc_scan *s; |
| 167 |
|
| |
| 168 |
|
| PERL_UNUSED_CONTEXT; |
| 169 |
24 |
▶ | if (!g) return NULL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!g) return NULL; |
1 |
23 |
24 |
|
| 170 |
23 |
| s = cca_scan_new(); |
| 171 |
|
| /* |
| 172 |
|
| # uncoverable branch true |
| 173 |
|
| # uncoverable condition left count:1 */ |
| 174 |
23 |
▶ | if (!s) return NULL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!s) return NULL; |
0 |
23 |
23 |
|
| 175 |
|
| |
| 176 |
23 |
▶ | if (g->t.max_size && len > g->t.max_size) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (g->t.max_size && len > g->t.max_size) { |
3 |
20 |
23 |
| if (g->t.max_size && len > g->t.max_size) { |
2 |
1 |
3 |
|
| 177 |
2 |
| cc_err_set(&s->err, CC_ERR_TOOBIGLOC, |
| 178 |
|
| "larger than max_size; refused without scanning", NULL); |
| 179 |
2 |
| s->rc = CC_ERR_TOOBIGLOC; |
| 180 |
2 |
| return s; |
| 181 |
|
| } |
| 182 |
|
| |
| 183 |
21 |
▶ | (void)cc_scan_start(s, &g->t, CC_TRANSPORT_INSTREAM, -1, 0, |
Branch: 1 branch
| Branch | True | False | Total |
| (void)cc_scan_start(s, &g->t, CC_TRANSPORT_INSTREAM, -1, 0, |
21 |
0 |
21 |
|
| 184 |
|
| buf ? buf : "", len, -1); |
| 185 |
|
| |
| 186 |
21 |
▶ | if (blocking) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (blocking) { |
19 |
2 |
21 |
|
| 187 |
19 |
| char *out = NULL; |
| 188 |
19 |
| size_t n = 0; |
| 189 |
|
| cc_err e; |
| 190 |
19 |
| (void)cc_scan_run(s, &out, &n, &e); |
| 191 |
19 |
| s->reply = out; s->replylen = n; |
| 192 |
|
| } |
| 193 |
21 |
| return s; |
| 194 |
|
| } |
| 195 |
|
| |
| 196 |
8 |
| static void *cca_scan_fd(pTHX_ void *t, int fd) { return cca_start_fd(aTHX_ t, fd, 1); } |
| 197 |
22 |
| static void *cca_scan_mem(pTHX_ void *t, const char *b, size_t n) { return cca_start_mem(aTHX_ t, b, n, 1); } |
| 198 |
1 |
| static void *cca_scan_start_fd(pTHX_ void *t, int fd) { return cca_start_fd(aTHX_ t, fd, 0); } |
| 199 |
2 |
| static void *cca_scan_start_mem(pTHX_ void *t, const char *b, size_t n) { return cca_start_mem(aTHX_ t, b, n, 0); } |
| 200 |
|
| |
| 201 |
6 |
| static int cca_scan_socket(pTHX_ void *scan) { |
| 202 |
6 |
| cc_scan *s = (cc_scan *)scan; |
| 203 |
|
| PERL_UNUSED_CONTEXT; |
| 204 |
6 |
▶ | return s ? s->sock : -1; |
Branch: 1 branch
| Branch | True | False | Total |
| return s ? s->sock : -1; |
5 |
1 |
6 |
|
| 205 |
|
| } |
| 206 |
31 |
| static int cca_scan_want(pTHX_ void *scan) { |
| 207 |
31 |
| cc_scan *s = (cc_scan *)scan; |
| 208 |
|
| PERL_UNUSED_CONTEXT; |
| 209 |
31 |
▶ | return (s && s->phase != CC_PH_DONE) ? s->want : CC_WANT_NONE; |
Branch: 2 branches
| Branch | True | False | Total |
| return (s && s->phase != CC_PH_DONE) ? s->want : CC_WANT_NONE; |
30 |
1 |
31 |
| return (s && s->phase != CC_PH_DONE) ? s->want : CC_WANT_NONE; |
5 |
25 |
30 |
|
| 210 |
|
| } |
| 211 |
6 |
| static int cca_scan_step(pTHX_ void *scan) { |
| 212 |
6 |
| cc_scan *s = (cc_scan *)scan; |
| 213 |
|
| PERL_UNUSED_CONTEXT; |
| 214 |
6 |
▶ | return s ? cc_scan_step(s) : CC_STEP_DONE; |
Branch: 1 branch
| Branch | True | False | Total |
| return s ? cc_scan_step(s) : CC_STEP_DONE; |
5 |
1 |
6 |
|
| 215 |
|
| } |
| 216 |
29 |
| static int cca_scan_done(pTHX_ void *scan) { |
| 217 |
29 |
| cc_scan *s = (cc_scan *)scan; |
| 218 |
|
| PERL_UNUSED_CONTEXT; |
| 219 |
29 |
▶ | return (!s || s->phase == CC_PH_DONE) ? 1 : 0; |
Branch: 2 branches
| Branch | True | False | Total |
| return (!s || s->phase == CC_PH_DONE) ? 1 : 0; |
28 |
1 |
29 |
| return (!s || s->phase == CC_PH_DONE) ? 1 : 0; |
25 |
3 |
28 |
|
| 220 |
|
| } |
| 221 |
2 |
| static void cca_scan_cancel(pTHX_ void *scan) { |
| 222 |
|
| PERL_UNUSED_CONTEXT; |
| 223 |
2 |
▶ | if (scan) cc_scan_cancel((cc_scan *)scan); |
Branch: 1 branch
| Branch | True | False | Total |
| if (scan) cc_scan_cancel((cc_scan *)scan); |
1 |
1 |
2 |
|
| 224 |
2 |
| } |
| 225 |
32 |
| static void cca_scan_free(pTHX_ void *scan) { |
| 226 |
|
| PERL_UNUSED_CONTEXT; |
| 227 |
32 |
▶ | if (scan) { cc_scan_free((cc_scan *)scan); free(scan); } |
Branch: 1 branch
| Branch | True | False | Total |
| if (scan) { cc_scan_free((cc_scan *)scan); free(scan); } |
31 |
1 |
32 |
|
| 228 |
32 |
| } |
| 229 |
|
| |
| 230 |
32 |
| static int cca_verdict_state(pTHX_ void *scan) { |
| 231 |
32 |
| cc_scan *s = (cc_scan *)scan; |
| 232 |
|
| PERL_UNUSED_CONTEXT; |
| 233 |
32 |
▶ | if (!s) return CLAMD_ABI_ERROR; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!s) return CLAMD_ABI_ERROR; |
1 |
31 |
32 |
|
| 234 |
31 |
| return cc_scan_verdict(s)->state; |
| 235 |
|
| } |
| 236 |
|
| |
| 237 |
32 |
| static const char *cca_verdict_signature(pTHX_ void *scan, size_t *len) { |
| 238 |
32 |
| cc_scan *s = (cc_scan *)scan; |
| 239 |
|
| const cc_verdict *v; |
| 240 |
|
| PERL_UNUSED_CONTEXT; |
| 241 |
32 |
▶ | if (len) *len = 0; |
Branch: 1 branch
| Branch | True | False | Total |
| if (len) *len = 0; |
28 |
4 |
32 |
|
| 242 |
32 |
▶ | if (!s) return NULL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!s) return NULL; |
1 |
31 |
32 |
|
| 243 |
31 |
| v = cc_scan_verdict(s); |
| 244 |
31 |
▶ | if (!v->signature[0]) return NULL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!v->signature[0]) return NULL; |
23 |
8 |
31 |
|
| 245 |
8 |
▶ | if (len) *len = strlen(v->signature); |
Branch: 1 branch
| Branch | True | False | Total |
| if (len) *len = strlen(v->signature); |
6 |
2 |
8 |
|
| 246 |
8 |
| return v->signature; |
| 247 |
|
| } |
| 248 |
|
| |
| 249 |
28 |
| static const char *cca_verdict_reason(pTHX_ void *scan, size_t *len) { |
| 250 |
28 |
| cc_scan *s = (cc_scan *)scan; |
| 251 |
|
| const cc_verdict *v; |
| 252 |
|
| PERL_UNUSED_CONTEXT; |
| 253 |
28 |
▶ | if (len) *len = 0; |
Branch: 1 branch
| Branch | True | False | Total |
| if (len) *len = 0; |
24 |
4 |
28 |
|
| 254 |
28 |
▶ | if (!s) return NULL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!s) return NULL; |
1 |
27 |
28 |
|
| 255 |
27 |
| v = cc_scan_verdict(s); |
| 256 |
27 |
▶ | if (!v->reason[0]) return NULL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!v->reason[0]) return NULL; |
22 |
5 |
27 |
|
| 257 |
5 |
▶ | if (len) *len = strlen(v->reason); |
Branch: 1 branch
| Branch | True | False | Total |
| if (len) *len = strlen(v->reason); |
3 |
2 |
5 |
|
| 258 |
5 |
| return v->reason; |
| 259 |
|
| } |
| 260 |
|
| |
| 261 |
26 |
| static const char *cca_verdict_error(pTHX_ void *scan, size_t *len) { |
| 262 |
26 |
| cc_scan *s = (cc_scan *)scan; |
| 263 |
|
| PERL_UNUSED_CONTEXT; |
| 264 |
26 |
▶ | if (len) *len = 0; |
Branch: 1 branch
| Branch | True | False | Total |
| if (len) *len = 0; |
22 |
4 |
26 |
|
| 265 |
26 |
▶ | if (!s || s->rc == CC_OK || !s->err.msg[0]) return NULL; /* # uncoverable condition left count:3 */ |
Branch: 3 branches
| Branch | True | False | Total |
| if (!s || s->rc == CC_OK || !s->err.msg[0]) return NULL; /* # uncoverable condition left count:3 */ |
25 |
1 |
26 |
| if (!s || s->rc == CC_OK || !s->err.msg[0]) return NULL; /* # uncoverable condition left count:3 */ |
10 |
15 |
25 |
| if (!s || s->rc == CC_OK || !s->err.msg[0]) return NULL; /* # uncoverable condition left count:3 */ |
0 |
10 |
10 |
|
| 266 |
10 |
▶ | if (len) *len = strlen(s->err.msg); |
Branch: 1 branch
| Branch | True | False | Total |
| if (len) *len = strlen(s->err.msg); |
9 |
1 |
10 |
|
| 267 |
10 |
| return s->err.msg; |
| 268 |
|
| } |
| 269 |
|
| |
| 270 |
30 |
| static int cca_verdict_transport(pTHX_ void *scan) { |
| 271 |
30 |
| cc_scan *s = (cc_scan *)scan; |
| 272 |
|
| PERL_UNUSED_CONTEXT; |
| 273 |
30 |
▶ | return s ? s->transport : CLAMD_ABI_TRANSPORT_NONE; |
Branch: 1 branch
| Branch | True | False | Total |
| return s ? s->transport : CLAMD_ABI_TRANSPORT_NONE; |
29 |
1 |
30 |
|
| 274 |
|
| } |
| 275 |
|
| |
| 276 |
|
| static const clamd_abi CLAMD_ABI = { |
| 277 |
|
| CLAMD_ABI_VERSION, |
| 278 |
|
| cca_target_new, |
| 279 |
|
| cca_target_timeouts, |
| 280 |
|
| cca_target_limits, |
| 281 |
|
| cca_target_free, |
| 282 |
|
| cca_scan_fd, |
| 283 |
|
| cca_scan_mem, |
| 284 |
|
| cca_scan_start_fd, |
| 285 |
|
| cca_scan_start_mem, |
| 286 |
|
| cca_scan_socket, |
| 287 |
|
| cca_scan_want, |
| 288 |
|
| cca_scan_step, |
| 289 |
|
| cca_scan_done, |
| 290 |
|
| cca_scan_cancel, |
| 291 |
|
| cca_scan_free, |
| 292 |
|
| cca_verdict_state, |
| 293 |
|
| cca_verdict_signature, |
| 294 |
|
| cca_verdict_reason, |
| 295 |
|
| cca_verdict_error, |
| 296 |
|
| cca_verdict_transport |
| 297 |
|
| }; |
| 298 |
|
| |
| 299 |
|
| #endif /* CLAMD_ABI_IMPL_H */ |