File: typemap

package info (click to toggle)
libnet-pcap-perl 0.21-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 636 kB
  • sloc: perl: 2,155; pascal: 830; ansic: 5; makefile: 3
file content (36 lines) | stat: -rw-r--r-- 657 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#
# Map C types to Perl types
#

pcap_t *                T_PTROBJ
pcap_dumper_t *         T_PTROBJ
struct bpf_program *    T_PTROBJ
pcap_bpf_program_t *    T_PTROBJ
pcap_send_queue *       T_PTROBJ
bpf_u_int32             T_UV
u_int                   T_UV
u_char *                T_PV
const char *            T_PV

#
# Input conversions
#

INPUT

T_PTROBJ
        if (sv_derived_from($arg, \"${ntype}\")) {
            IV tmp = SvIV((SV*)SvRV($arg));
            $var = ($type) tmp;
        }
        else
            croak(\"$var is not of type ${ntype}\")

#
# Output conversions
#

OUTPUT

T_PTROBJ
        sv_setref_pv($arg, \"${ntype}\", (void*)$var);