xs/abi.xs

filter: Statementstmt 93.3% 14 / 15 Branchbran 42.8% 6 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 68.9% 20 / 29 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« include/fetch/ft_win.h ↑ Summary include/fetch/ft_json.h »
1 MODULE = Fetch PACKAGE = Fetch
2  
3 # Address of Fetch's C ABI table (fetch_abi.h). A consumer XS module fetches
4 # this once at boot, INT2PTRs it to a `const fetch_abi *`, and checks
5 # ->abi_version before using it. Not part of the public Perl API.
6 IV
7 _abi_ptr()
8 CODE:
9 0 ▶ RETVAL = PTR2IV(&FETCH_ABI);
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = PTR2IV(&FETCH_ABI); 0 0 0
10 OUTPUT:
11 RETVAL
12  
13 IV
14 _abi_version()
15 CODE:
16 4 ▶ RETVAL = FETCH_ABI.abi_version;
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = FETCH_ABI.abi_version; 0 4 4
17 OUTPUT:
18 RETVAL
19  
20 # Fetch->on_request(\&start, \&done): the same observer registry the C ABI's
21 # on_request writes to, reached from Perl - for a consumer that is not an XS
22 # module. Same contract (process-global, per hop, no deregistration), one
23 # Perl call per hop as the price. Public.
24 IV
25 on_request(class, start, done = &PL_sv_undef)
26 SV *class
27 SV *start
28 SV *done
29 CODE:
30 PERL_UNUSED_VAR(class);
31 8 ▶ RETVAL = ft_obs_add_perl(aTHX_ start, done);
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = ft_obs_add_perl(aTHX_ start, done); 0 4 4
32 OUTPUT:
33 RETVAL
34  
35 # v2 on_request, for t/23-observer.t. Registering a C callback is not
36 # something Perl can do, so the test drives these two instead: install, make
37 # requests, then read back what the observer saw.
38 IV
39 _abi_observer_install()
40 CODE:
41 1 ▶ RETVAL = ft_obs_selftest_install(aTHX);
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = ft_obs_selftest_install(aTHX); 0 1 1
42 OUTPUT:
43 RETVAL
44  
45 # (starts, dones, resolved, failed) since load.
46 void
47 _abi_observer_state()
48 PPCODE:
49 9 ▶ EXTEND(SP, 4);
Branch: 1 branch
BranchTrueFalseTotal
EXTEND(SP, 4); 0 9 9
50 9 mPUSHi(FT_OBS_ST_STARTS);
51 9 mPUSHi(FT_OBS_ST_DONES);
52 9 mPUSHi(FT_OBS_ST_OK);
53 9 mPUSHi(FT_OBS_ST_ERR);
54  
55 # v3 tunnel_starttls, for t/25-tunnel-starttls.t. Returns (step, lines):
56 # step is "ok", or the name of the step that stopped the probe ("refused"
57 # when the server declined STARTTLS, "starttls" when the handshake failed);
58 # lines is what the server said, joined with "\n", as far as the probe got.
59 void
60 _abi_tunnel_starttls_probe(host, port, verify)
61 const char *host
62 int port
63 int verify
64 PREINIT:
65 5 const char *where = "";
66 SV *text;
67 PPCODE:
68 5 text = ft_abi_starttls_selftest(aTHX_ host, port, verify, &where);
69 5 ▶ EXTEND(SP, 2);
Branch: 1 branch
BranchTrueFalseTotal
EXTEND(SP, 2); 0 5 5
70 5 mPUSHp(where, strlen(where));
71 5 PUSHs(sv_2mortal(text));
72  
73 # The table entry's NULL-handle contract, reachable on every build.
74 IV
75 _abi_tunnel_starttls_null()
76 CODE:
77 3 ▶ RETVAL = FETCH_ABI.tunnel_starttls(NULL, "localhost", 0);
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = FETCH_ABI.tunnel_starttls(NULL, "localhost", 0); 0 3 3
78 OUTPUT:
79 RETVAL
« include/fetch/ft_win.h ↑ Summary include/fetch/ft_json.h »