#
# typemap file for the Net::Pcap extension
#
# Copyright (c) 1999 Tim Potter. All rights reserved. This program is free 
# software; you can redistribute it and/or modify it under the same terms 
# as Perl itself.
#
# $Id: typemap,v 1.3 1999/03/14 03:11:42 tpot Exp $
#

#
# Map C types to Perl types
#

pcap_t *                T_PTROBJ
pcap_dumper_t *         T_PTROBJ
struct bpf_program *    T_PTROBJ
bpf_u_int32             T_IV
u_char *                T_PV
const char *            T_PV
FILE *                  T_IN
pcap_send_queue *       T_PTROBJ
u_int                   T_UV

#
# 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);
