Ticket #28132: patch-pcap.c.diff

File patch-pcap.c.diff, 99.6 KB (added by andrew.reusch@…, 14 years ago)
  • pcap.c

    old new  
    1 /* Generated by Pyrex 0.9.3 on Sun Oct 16 19:38:39 2005 */
     1/* Generated by Pyrex 0.9.9 on Tue Jan 25 12:41:20 2011 */
    22
     3#define PY_SSIZE_T_CLEAN
    34#include "Python.h"
    45#include "structmember.h"
    56#ifndef PY_LONG_LONG
    67  #define PY_LONG_LONG LONG_LONG
    78#endif
     9#if PY_VERSION_HEX < 0x02050000
     10  typedef int Py_ssize_t;
     11  #define PY_SSIZE_T_MAX INT_MAX
     12  #define PY_SSIZE_T_MIN INT_MIN
     13  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
     14  #define PyInt_AsSsize_t(o)    PyInt_AsLong(o)
     15#endif
     16#if !defined(WIN32) && !defined(MS_WINDOWS)
     17  #ifndef __stdcall
     18    #define __stdcall
     19  #endif
     20  #ifndef __cdecl
     21    #define __cdecl
     22  #endif
     23#endif
     24#ifdef __cplusplus
     25#define __PYX_EXTERN_C extern "C"
     26#else
     27#define __PYX_EXTERN_C extern
     28#endif
     29#include <math.h>
    830#include "pcap.h"
    931#include "pcap_ex.h"
    1032
    1133
    12 typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/
    13 typedef struct {PyObject **p; char *s; long n;} __Pyx_StringTabEntry; /*proto*/
    14 static PyObject *__Pyx_UnpackItem(PyObject *, int); /*proto*/
    15 static int __Pyx_EndUnpack(PyObject *, int); /*proto*/
    16 static int __Pyx_PrintItem(PyObject *); /*proto*/
    17 static int __Pyx_PrintNewline(void); /*proto*/
    18 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
    19 static void __Pyx_ReRaise(void); /*proto*/
    20 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
    21 static PyObject *__Pyx_GetExcValue(void); /*proto*/
    22 static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name); /*proto*/
    23 static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
    24 static int __Pyx_GetStarArgs(PyObject **args, PyObject **kwds, char *kwd_list[], int nargs, PyObject **args2, PyObject **kwds2); /*proto*/
    25 static void __Pyx_WriteUnraisable(char *name); /*proto*/
    26 static void __Pyx_AddTraceback(char *funcname); /*proto*/
    27 static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, long size);  /*proto*/
    28 static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
    29 static int __Pyx_GetVtable(PyObject *dict, void *vtabptr); /*proto*/
    30 static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, char *modname); /*proto*/
    31 static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/
    32 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
    33 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
     34typedef struct {PyObject **p; int i; char *s; long n;} __Pyx_StringTabEntry; /*proto*/
    3435
    3536static PyObject *__pyx_m;
    3637static PyObject *__pyx_b;
    3738static int __pyx_lineno;
    3839static char *__pyx_filename;
    39 staticforward char **__pyx_f;
     40static char **__pyx_f;
    4041
    4142static char __pyx_mdoc[] = "packet capture library\n\nThis module provides a high level interface to packet capture systems.\nAll packets on the network, even those destined for other hosts, are\naccessible through this mechanism.\n";
    4243
     44static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
     45
     46static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
     47
     48static int __Pyx_GetStarArgs(PyObject **args, PyObject **kwds, char *kwd_list[],     Py_ssize_t nargs, PyObject **args2, PyObject **kwds2, char rqd_kwds[]); /*proto*/
     49
     50static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
     51
     52static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
     53
     54static void __Pyx_AddTraceback(char *funcname); /*proto*/
     55
    4356/* Declarations from pcap */
    4457
     58
     59/* Declarations from implementation of pcap */
     60
     61typedef void (*__pyx_t_4pcap_pcap_handler)(void *,struct pcap_pkthdr *,char *);
     62
    4563struct __pyx_t_4pcap_pcap_handler_ctx {
    46   void (*callback);
    47   void (*args);
     64  void *callback;
     65  void *args;
    4866  int got_exc;
    4967};
    5068
    51 staticforward PyTypeObject __pyx_type_4pcap_bpf;
    52 
    5369struct __pyx_obj_4pcap_bpf {
    5470  PyObject_HEAD
    5571  struct bpf_program fcode;
    5672};
    5773
    58 staticforward PyTypeObject __pyx_type_4pcap_pcap;
    59 
    6074struct __pyx_obj_4pcap_pcap {
    6175  PyObject_HEAD
    62   pcap_t (*__pcap);
    63   char (*__name);
    64   char (*__filter);
    65   char (__ebuf[256]);
     76  pcap_t *__pcap;
     77  char *__name;
     78  char *__filter;
     79  char __ebuf[256];
    6680  int __dloff;
    6781};
    6882
     83
     84
    6985static PyTypeObject *__pyx_ptype_4pcap_bpf = 0;
    7086static PyTypeObject *__pyx_ptype_4pcap_pcap = 0;
    71 static PyObject *__pyx_k13;
    72 static PyObject *__pyx_k14;
    73 static PyObject *__pyx_k15;
    74 static PyObject *__pyx_k16;
    75 static PyObject *__pyx_k17;
    76 static PyObject *__pyx_k18;
    77 static PyObject *__pyx_k19;
    78 static PyObject *__pyx_k20;
    79 static void (__pyx_f_4pcap___pcap_handler(void (*),struct pcap_pkthdr (*),char (*))); /*proto*/
     87static void __pyx_f_4pcap___pcap_handler(void *,struct pcap_pkthdr *,char *); /*proto*/
    8088
    81 /* Implementation of pcap */
    82 
    83 static char (__pyx_k1[]) = "Network interface or dumpfile name.";
    84 static char (__pyx_k2[]) = "Maximum number of bytes to capture for each packet.";
    85 static char (__pyx_k3[]) = "Datalink offset (length of layer-2 frame header).";
    86 static char (__pyx_k4[]) = "Current packet capture filter.";
    87 static char (__pyx_k5[]) = "File descriptor (or Win32 HANDLE) for capture handle.";
    88 static char (__pyx_k6[]) = "Dug Song <dugsong@monkey.org>";
    89 static char (__pyx_k7[]) = "Copyright (c) 2004 Dug Song";
    90 static char (__pyx_k8[]) = "BSD license";
    91 static char (__pyx_k9[]) = "http://monkey.org/~dugsong/pypcap/";
    92 static char (__pyx_k10[]) = "1.1";
     89static char __pyx_k1[] = "bad filter";
     90static char __pyx_k2[] = "";
     91static char __pyx_k3[] = "dltoff";
     92static char __pyx_k4[] = "couldn't set BPF immediate mode";
     93static char __pyx_k5[] = "append";
     94static char __pyx_k6[] = "dispatch";
     95static char __pyx_k7[] = "__add_pkts";
     96static char __pyx_k8[] = "sys";
     97static char __pyx_k9[] = "exc_info";
     98static char __pyx_k10[] = "Network interface or dumpfile name.";
     99static char __pyx_k11[] = "Maximum number of bytes to capture for each packet.";
     100static char __pyx_k12[] = "Datalink offset (length of layer-2 frame header).";
     101static char __pyx_k13[] = "Current packet capture filter.";
     102static char __pyx_k14[] = "File descriptor (or Win32 HANDLE) for capture handle.";
     103static char __pyx_k15[] = "Dug Song <dugsong@monkey.org>";
     104static char __pyx_k16[] = "__author__";
     105static char __pyx_k17[] = "Copyright (c) 2004 Dug Song";
     106static char __pyx_k18[] = "__copyright__";
     107static char __pyx_k19[] = "BSD license";
     108static char __pyx_k20[] = "__license__";
     109static char __pyx_k21[] = "http://monkey.org/~dugsong/pypcap/";
     110static char __pyx_k22[] = "__url__";
     111static char __pyx_k23[] = "1.1";
     112static char __pyx_k24[] = "__version__";
     113static char __pyx_k25[] = "DLT_NULL";
     114static char __pyx_k26[] = "DLT_EN10MB";
     115static char __pyx_k27[] = "DLT_EN3MB";
     116static char __pyx_k28[] = "DLT_AX25";
     117static char __pyx_k29[] = "DLT_PRONET";
     118static char __pyx_k30[] = "DLT_CHAOS";
     119static char __pyx_k31[] = "DLT_IEEE802";
     120static char __pyx_k32[] = "DLT_ARCNET";
     121static char __pyx_k33[] = "DLT_SLIP";
     122static char __pyx_k34[] = "DLT_PPP";
     123static char __pyx_k35[] = "DLT_FDDI";
     124static char __pyx_k36[] = "DLT_LINUX_SLL";
     125static char __pyx_k37[] = "DLT_PFLOG";
     126static char __pyx_k38[] = "DLT_PFSYNC";
     127static char __pyx_k39[] = "platform";
     128static char __pyx_k40[] = "find";
     129static char __pyx_k41[] = "openbsd";
     130static char __pyx_k42[] = "DLT_LOOP";
     131static char __pyx_k43[] = "DLT_RAW";
    93132
    94 static PyObject *__pyx_n___author__;
    95 static PyObject *__pyx_n___copyright__;
    96 static PyObject *__pyx_n___license__;
    97 static PyObject *__pyx_n___url__;
    98 static PyObject *__pyx_n___version__;
    99 static PyObject *__pyx_n_sys;
    100 static PyObject *__pyx_n_DLT_NULL;
    101 static PyObject *__pyx_n_DLT_EN10MB;
    102 static PyObject *__pyx_n_DLT_EN3MB;
     133static PyObject *__pyx_n_DLT_ARCNET;
    103134static PyObject *__pyx_n_DLT_AX25;
    104 static PyObject *__pyx_n_DLT_PRONET;
    105135static PyObject *__pyx_n_DLT_CHAOS;
    106 static PyObject *__pyx_n_DLT_IEEE802;
    107 static PyObject *__pyx_n_DLT_ARCNET;
    108 static PyObject *__pyx_n_DLT_SLIP;
    109 static PyObject *__pyx_n_DLT_PPP;
     136static PyObject *__pyx_n_DLT_EN10MB;
     137static PyObject *__pyx_n_DLT_EN3MB;
    110138static PyObject *__pyx_n_DLT_FDDI;
     139static PyObject *__pyx_n_DLT_IEEE802;
    111140static PyObject *__pyx_n_DLT_LINUX_SLL;
     141static PyObject *__pyx_n_DLT_LOOP;
     142static PyObject *__pyx_n_DLT_NULL;
    112143static PyObject *__pyx_n_DLT_PFLOG;
    113144static PyObject *__pyx_n_DLT_PFSYNC;
    114 static PyObject *__pyx_n_DLT_LOOP;
     145static PyObject *__pyx_n_DLT_PPP;
     146static PyObject *__pyx_n_DLT_PRONET;
    115147static PyObject *__pyx_n_DLT_RAW;
     148static PyObject *__pyx_n_DLT_SLIP;
     149static PyObject *__pyx_n___add_pkts;
     150static PyObject *__pyx_n___author__;
     151static PyObject *__pyx_n___copyright__;
     152static PyObject *__pyx_n___license__;
     153static PyObject *__pyx_n___url__;
     154static PyObject *__pyx_n___version__;
     155static PyObject *__pyx_n_append;
     156static PyObject *__pyx_n_dispatch;
    116157static PyObject *__pyx_n_dltoff;
    117 static PyObject *__pyx_n_ex_name;
    118 static PyObject *__pyx_n_lookupdev;
    119 static PyObject *__pyx_n_platform;
     158static PyObject *__pyx_n_exc_info;
    120159static PyObject *__pyx_n_find;
    121160static PyObject *__pyx_n_openbsd;
    122 static PyObject *__pyx_n_True;
    123 static PyObject *__pyx_n_False;
     161static PyObject *__pyx_n_platform;
     162static PyObject *__pyx_n_sys;
    124163
    125 static PyObject *__pyx_k6p;
    126 static PyObject *__pyx_k7p;
    127 static PyObject *__pyx_k8p;
    128 static PyObject *__pyx_k9p;
    129 static PyObject *__pyx_k10p;
     164static PyObject *__pyx_k1p;
     165static PyObject *__pyx_k4p;
     166static PyObject *__pyx_k15p;
     167static PyObject *__pyx_k17p;
     168static PyObject *__pyx_k19p;
     169static PyObject *__pyx_k21p;
     170static PyObject *__pyx_k23p;
    130171
    131 static void __pyx_f_4pcap___pcap_handler(void (*__pyx_v_arg),struct pcap_pkthdr (*__pyx_v_hdr),char (*__pyx_v_pkt)) {
    132   struct __pyx_t_4pcap_pcap_handler_ctx (*__pyx_v_ctx);
     172static __Pyx_StringTabEntry __pyx_string_tab[] = {
     173  {&__pyx_n_DLT_ARCNET, 1, __pyx_k32, sizeof(__pyx_k32)},
     174  {&__pyx_n_DLT_AX25, 1, __pyx_k28, sizeof(__pyx_k28)},
     175  {&__pyx_n_DLT_CHAOS, 1, __pyx_k30, sizeof(__pyx_k30)},
     176  {&__pyx_n_DLT_EN10MB, 1, __pyx_k26, sizeof(__pyx_k26)},
     177  {&__pyx_n_DLT_EN3MB, 1, __pyx_k27, sizeof(__pyx_k27)},
     178  {&__pyx_n_DLT_FDDI, 1, __pyx_k35, sizeof(__pyx_k35)},
     179  {&__pyx_n_DLT_IEEE802, 1, __pyx_k31, sizeof(__pyx_k31)},
     180  {&__pyx_n_DLT_LINUX_SLL, 1, __pyx_k36, sizeof(__pyx_k36)},
     181  {&__pyx_n_DLT_LOOP, 1, __pyx_k42, sizeof(__pyx_k42)},
     182  {&__pyx_n_DLT_NULL, 1, __pyx_k25, sizeof(__pyx_k25)},
     183  {&__pyx_n_DLT_PFLOG, 1, __pyx_k37, sizeof(__pyx_k37)},
     184  {&__pyx_n_DLT_PFSYNC, 1, __pyx_k38, sizeof(__pyx_k38)},
     185  {&__pyx_n_DLT_PPP, 1, __pyx_k34, sizeof(__pyx_k34)},
     186  {&__pyx_n_DLT_PRONET, 1, __pyx_k29, sizeof(__pyx_k29)},
     187  {&__pyx_n_DLT_RAW, 1, __pyx_k43, sizeof(__pyx_k43)},
     188  {&__pyx_n_DLT_SLIP, 1, __pyx_k33, sizeof(__pyx_k33)},
     189  {&__pyx_n___add_pkts, 1, __pyx_k7, sizeof(__pyx_k7)},
     190  {&__pyx_n___author__, 1, __pyx_k16, sizeof(__pyx_k16)},
     191  {&__pyx_n___copyright__, 1, __pyx_k18, sizeof(__pyx_k18)},
     192  {&__pyx_n___license__, 1, __pyx_k20, sizeof(__pyx_k20)},
     193  {&__pyx_n___url__, 1, __pyx_k22, sizeof(__pyx_k22)},
     194  {&__pyx_n___version__, 1, __pyx_k24, sizeof(__pyx_k24)},
     195  {&__pyx_n_append, 1, __pyx_k5, sizeof(__pyx_k5)},
     196  {&__pyx_n_dispatch, 1, __pyx_k6, sizeof(__pyx_k6)},
     197  {&__pyx_n_dltoff, 1, __pyx_k3, sizeof(__pyx_k3)},
     198  {&__pyx_n_exc_info, 1, __pyx_k9, sizeof(__pyx_k9)},
     199  {&__pyx_n_find, 1, __pyx_k40, sizeof(__pyx_k40)},
     200  {&__pyx_n_openbsd, 1, __pyx_k41, sizeof(__pyx_k41)},
     201  {&__pyx_n_platform, 1, __pyx_k39, sizeof(__pyx_k39)},
     202  {&__pyx_n_sys, 1, __pyx_k8, sizeof(__pyx_k8)},
     203  {&__pyx_k1p, 0, __pyx_k1, sizeof(__pyx_k1)},
     204  {&__pyx_k4p, 0, __pyx_k4, sizeof(__pyx_k4)},
     205  {&__pyx_k15p, 0, __pyx_k15, sizeof(__pyx_k15)},
     206  {&__pyx_k17p, 0, __pyx_k17, sizeof(__pyx_k17)},
     207  {&__pyx_k19p, 0, __pyx_k19, sizeof(__pyx_k19)},
     208  {&__pyx_k21p, 0, __pyx_k21, sizeof(__pyx_k21)},
     209  {&__pyx_k23p, 0, __pyx_k23, sizeof(__pyx_k23)},
     210  {0, 0, 0, 0}
     211};
     212
     213static PyObject *__pyx_d1;
     214static PyObject *__pyx_d2;
     215static PyObject *__pyx_d3;
     216static PyObject *__pyx_d4;
     217static PyObject *__pyx_d5;
     218static PyObject *__pyx_d6;
     219static PyObject *__pyx_d7;
     220static PyObject *__pyx_d8;
     221
     222
     223/* Implementation of pcap */
     224
     225static void __pyx_f_4pcap___pcap_handler(void *__pyx_v_arg,struct pcap_pkthdr *__pyx_v_hdr,char *__pyx_v_pkt) {
     226  struct __pyx_t_4pcap_pcap_handler_ctx *__pyx_v_ctx;
    133227  int __pyx_v_gil;
    134228  PyObject *__pyx_1 = 0;
    135229  PyObject *__pyx_2 = 0;
    136230  PyObject *__pyx_3 = 0;
    137   PyObject *__pyx_4 = 0;
    138231
    139   /* "/Users/dugsong/projects/pypcap/pcap.pyx":92 */
    140   __pyx_v_ctx = ((struct __pyx_t_4pcap_pcap_handler_ctx (*))__pyx_v_arg);
     232  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":92 */
     233  __pyx_v_ctx = ((struct __pyx_t_4pcap_pcap_handler_ctx *)__pyx_v_arg);
    141234
    142   /* "/Users/dugsong/projects/pypcap/pcap.pyx":93 */
     235  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":93 */
    143236  __pyx_v_gil = PyGILState_Ensure();
    144237
    145   /* "/Users/dugsong/projects/pypcap/pcap.pyx":94 */
     238  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":94 */
    146239  /*try:*/ {
    147 
    148     /* "/Users/dugsong/projects/pypcap/pcap.pyx":95 */
    149     __pyx_1 = (PyObject *)__pyx_v_ctx->callback;
    150     Py_INCREF(__pyx_1);
    151     __pyx_2 = PyFloat_FromDouble((__pyx_v_hdr->ts.tv_sec + (__pyx_v_hdr->ts.tv_usec / 1000000.0))); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; goto __pyx_L2;}
    152     __pyx_3 = PyBuffer_FromMemory(__pyx_v_pkt,__pyx_v_hdr->caplen); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; goto __pyx_L2;}
    153     __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; goto __pyx_L2;}
    154     PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
    155     PyTuple_SET_ITEM(__pyx_4, 1, __pyx_3);
     240    __pyx_1 = PyFloat_FromDouble((__pyx_v_hdr->ts.tv_sec + (__pyx_v_hdr->ts.tv_usec / 1000000.0))); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; goto __pyx_L2;}
     241    __pyx_2 = PyBuffer_FromMemory(__pyx_v_pkt,__pyx_v_hdr->caplen); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; goto __pyx_L2;}
     242    __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; goto __pyx_L2;}
     243    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
     244    PyTuple_SET_ITEM(__pyx_3, 1, __pyx_2);
     245    __pyx_1 = 0;
    156246    __pyx_2 = 0;
    157     __pyx_3 = 0;
    158     __pyx_2 = (PyObject *)__pyx_v_ctx->args;
    159     Py_INCREF(__pyx_2);
    160     __pyx_3 = PySequence_Tuple(__pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; goto __pyx_L2;}
    161     Py_DECREF(__pyx_2); __pyx_2 = 0;
    162     __pyx_2 = PyNumber_Add(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; goto __pyx_L2;}
    163     Py_DECREF(__pyx_4); __pyx_4 = 0;
     247    __pyx_1 = PySequence_Tuple(((PyObject *)__pyx_v_ctx->args)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; goto __pyx_L2;}
     248    __pyx_2 = PyNumber_Add(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; goto __pyx_L2;}
    164249    Py_DECREF(__pyx_3); __pyx_3 = 0;
    165     __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; goto __pyx_L2;}
    166250    Py_DECREF(__pyx_1); __pyx_1 = 0;
     251    __pyx_3 = PyObject_CallObject(((PyObject *)__pyx_v_ctx->callback), __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; goto __pyx_L2;}
    167252    Py_DECREF(__pyx_2); __pyx_2 = 0;
    168     Py_DECREF(__pyx_4); __pyx_4 = 0;
     253    Py_DECREF(__pyx_3); __pyx_3 = 0;
    169254  }
    170255  goto __pyx_L3;
    171256  __pyx_L2:;
    172   Py_XDECREF(__pyx_3); __pyx_3 = 0;
    173257  Py_XDECREF(__pyx_1); __pyx_1 = 0;
    174258  Py_XDECREF(__pyx_2); __pyx_2 = 0;
    175   Py_XDECREF(__pyx_4); __pyx_4 = 0;
     259  Py_XDECREF(__pyx_3); __pyx_3 = 0;
    176260
    177   /* "/Users/dugsong/projects/pypcap/pcap.pyx":98 */
     261  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":98 */
    178262  /*except:*/ {
    179     __Pyx_AddTraceback("pcap.__pcap_handler");
    180     __pyx_3 = __Pyx_GetExcValue(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; goto __pyx_L1;}
    181     Py_DECREF(__pyx_3); __pyx_3 = 0;
    182 
    183     /* "/Users/dugsong/projects/pypcap/pcap.pyx":99 */
    184263    __pyx_v_ctx->got_exc = 1;
    185264    goto __pyx_L3;
    186265  }
    187266  __pyx_L3:;
    188267
    189   /* "/Users/dugsong/projects/pypcap/pcap.pyx":100 */
     268  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":100 */
    190269  PyGILState_Release(__pyx_v_gil);
    191270
    192   goto __pyx_L0;
    193   __pyx_L1:;
    194   Py_XDECREF(__pyx_1);
    195   Py_XDECREF(__pyx_2);
    196   Py_XDECREF(__pyx_3);
    197   Py_XDECREF(__pyx_4);
    198   __Pyx_WriteUnraisable("pcap.__pcap_handler");
    199   __pyx_L0:;
    200271}
    201272
    202 static PyObject *__pyx_n_IOError;
    203 
    204 static PyObject *__pyx_k21p;
    205 
    206 static char (__pyx_k21[]) = "bad filter";
    207 
    208273static int __pyx_f_4pcap_3bpf___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    209274static int __pyx_f_4pcap_3bpf___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
    210   char (*__pyx_v_filter);
     275  char *__pyx_v_filter;
    211276  PyObject *__pyx_v_dlt = 0;
    212277  int __pyx_r;
    213278  int __pyx_1;
    214279  int __pyx_2;
    215   PyObject *__pyx_3 = 0;
    216280  static char *__pyx_argnames[] = {"filter","dlt",0};
    217   __pyx_v_dlt = __pyx_k13;
     281  __pyx_v_dlt = __pyx_d1;
    218282  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "s|O", __pyx_argnames, &__pyx_v_filter, &__pyx_v_dlt)) return -1;
    219283  Py_INCREF(__pyx_v_self);
    220284  Py_INCREF(__pyx_v_dlt);
    221 
    222   /* "/Users/dugsong/projects/pypcap/pcap.pyx":133 */
    223285  __pyx_1 = PyInt_AsLong(__pyx_v_dlt); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; goto __pyx_L1;}
    224286  __pyx_2 = (pcap_ex_compile_nopcap(65535,__pyx_1,(&((struct __pyx_obj_4pcap_bpf *)__pyx_v_self)->fcode),__pyx_v_filter,1,0) < 0);
    225287  if (__pyx_2) {
    226 
    227     /* "/Users/dugsong/projects/pypcap/pcap.pyx":134 */
    228     __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_IOError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; goto __pyx_L1;}
    229     __Pyx_Raise(__pyx_3, __pyx_k21p, 0);
    230     Py_DECREF(__pyx_3); __pyx_3 = 0;
     288    __Pyx_Raise(PyExc_IOError, __pyx_k1p, 0);
    231289    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; goto __pyx_L1;}
    232290    goto __pyx_L2;
    233291  }
     
    236294  __pyx_r = 0;
    237295  goto __pyx_L0;
    238296  __pyx_L1:;
    239   Py_XDECREF(__pyx_3);
    240297  __Pyx_AddTraceback("pcap.bpf.__init__");
    241298  __pyx_r = -1;
    242299  __pyx_L0:;
     
    245302  return __pyx_r;
    246303}
    247304
    248 static PyObject *__pyx_n_len;
    249 
    250305static PyObject *__pyx_f_4pcap_3bpf_filter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    251306static char __pyx_doc_4pcap_3bpf_filter[] = "Return boolean match for buf against our filter.";
    252307static PyObject *__pyx_f_4pcap_3bpf_filter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
    253308  PyObject *__pyx_v_buf = 0;
    254309  int __pyx_v_n;
    255310  PyObject *__pyx_r;
    256   PyObject *__pyx_1 = 0;
    257   PyObject *__pyx_2 = 0;
    258   PyObject *__pyx_3 = 0;
    259   int __pyx_4;
    260   char (*__pyx_5);
     311  Py_ssize_t __pyx_1;
     312  char *__pyx_2;
     313  int __pyx_3;
    261314  static char *__pyx_argnames[] = {"buf",0};
    262315  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_buf)) return 0;
    263316  Py_INCREF(__pyx_v_self);
    264317  Py_INCREF(__pyx_v_buf);
    265318
    266   /* "/Users/dugsong/projects/pypcap/pcap.pyx":138 */
    267   __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; goto __pyx_L1;}
    268   __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; goto __pyx_L1;}
    269   Py_INCREF(__pyx_v_buf);
    270   PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_buf);
    271   __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; goto __pyx_L1;}
    272   Py_DECREF(__pyx_1); __pyx_1 = 0;
    273   Py_DECREF(__pyx_2); __pyx_2 = 0;
    274   __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; goto __pyx_L1;}
    275   Py_DECREF(__pyx_3); __pyx_3 = 0;
    276   __pyx_v_n = __pyx_4;
    277 
    278   /* "/Users/dugsong/projects/pypcap/pcap.pyx":139 */
    279   __pyx_5 = PyString_AsString(__pyx_v_buf); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; goto __pyx_L1;}
    280   __pyx_4 = (bpf_filter(((struct __pyx_obj_4pcap_bpf *)__pyx_v_self)->fcode.bf_insns,__pyx_5,__pyx_v_n,__pyx_v_n) == 0);
    281   if (__pyx_4) {
    282 
    283     /* "/Users/dugsong/projects/pypcap/pcap.pyx":140 */
    284     __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_False); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; goto __pyx_L1;}
    285     __pyx_r = __pyx_1;
    286     __pyx_1 = 0;
     319  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":138 */
     320  __pyx_1 = PyObject_Length(__pyx_v_buf); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; goto __pyx_L1;}
     321  __pyx_v_n = __pyx_1;
     322
     323  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":139 */
     324  __pyx_2 = PyString_AsString(__pyx_v_buf); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; goto __pyx_L1;}
     325  __pyx_3 = (bpf_filter(((struct __pyx_obj_4pcap_bpf *)__pyx_v_self)->fcode.bf_insns,__pyx_2,__pyx_v_n,__pyx_v_n) == 0);
     326  if (__pyx_3) {
     327    Py_INCREF(Py_False);
     328    __pyx_r = Py_False;
    287329    goto __pyx_L0;
    288330    goto __pyx_L2;
    289331  }
    290332  __pyx_L2:;
    291333
    292   /* "/Users/dugsong/projects/pypcap/pcap.pyx":141 */
    293   __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_True); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; goto __pyx_L1;}
    294   __pyx_r = __pyx_2;
    295   __pyx_2 = 0;
     334  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":141 */
     335  Py_INCREF(Py_True);
     336  __pyx_r = Py_True;
    296337  goto __pyx_L0;
    297338
    298   __pyx_r = Py_None; Py_INCREF(__pyx_r);
     339  __pyx_r = Py_None; Py_INCREF(Py_None);
    299340  goto __pyx_L0;
    300341  __pyx_L1:;
    301   Py_XDECREF(__pyx_1);
    302   Py_XDECREF(__pyx_2);
    303   Py_XDECREF(__pyx_3);
    304342  __Pyx_AddTraceback("pcap.bpf.filter");
    305343  __pyx_r = 0;
    306344  __pyx_L0:;
     
    312350static void __pyx_f_4pcap_3bpf___dealloc__(PyObject *__pyx_v_self); /*proto*/
    313351static void __pyx_f_4pcap_3bpf___dealloc__(PyObject *__pyx_v_self) {
    314352  Py_INCREF(__pyx_v_self);
    315 
    316   /* "/Users/dugsong/projects/pypcap/pcap.pyx":143 */
    317353  pcap_freecode((&((struct __pyx_obj_4pcap_bpf *)__pyx_v_self)->fcode));
    318354
    319   goto __pyx_L0;
    320   __pyx_L1:;
    321   __Pyx_AddTraceback("pcap.bpf.__dealloc__");
    322   __pyx_L0:;
    323355  Py_DECREF(__pyx_v_self);
    324356}
    325357
    326 static PyObject *__pyx_n_OSError;
    327 static PyObject *__pyx_n_KeyError;
    328 
    329 static PyObject *__pyx_k23p;
    330 
    331 static char (__pyx_k22[]) = "";
    332 static char (__pyx_k23[]) = "couldn't set BPF immediate mode";
    333 
    334358static int __pyx_f_4pcap_4pcap___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    335359static int __pyx_f_4pcap_4pcap___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
    336360  PyObject *__pyx_v_name = 0;
     
    338362  PyObject *__pyx_v_promisc = 0;
    339363  PyObject *__pyx_v_timeout_ms = 0;
    340364  PyObject *__pyx_v_immediate = 0;
    341   char (*__pyx_v_p);
     365  char *__pyx_v_p;
    342366  int __pyx_r;
    343367  int __pyx_1;
    344368  int __pyx_2;
    345369  PyObject *__pyx_3 = 0;
    346   PyObject *__pyx_4 = 0;
    347   char (*__pyx_5);
    348   int __pyx_6;
     370  char *__pyx_4;
     371  int __pyx_5;
     372  PyObject *__pyx_6 = 0;
    349373  PyObject *__pyx_7 = 0;
    350374  static char *__pyx_argnames[] = {"name","snaplen","promisc","timeout_ms","immediate",0};
    351   __pyx_v_name = __pyx_k14;
    352   __pyx_v_snaplen = __pyx_k15;
    353   __pyx_v_promisc = __pyx_k16;
    354   __pyx_v_timeout_ms = __pyx_k17;
    355   __pyx_v_immediate = __pyx_k18;
     375  __pyx_v_name = __pyx_d2;
     376  __pyx_v_snaplen = __pyx_d3;
     377  __pyx_v_promisc = __pyx_d4;
     378  __pyx_v_timeout_ms = __pyx_d5;
     379  __pyx_v_immediate = __pyx_d6;
    356380  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|OOOOO", __pyx_argnames, &__pyx_v_name, &__pyx_v_snaplen, &__pyx_v_promisc, &__pyx_v_timeout_ms, &__pyx_v_immediate)) return -1;
    357381  Py_INCREF(__pyx_v_self);
    358382  Py_INCREF(__pyx_v_name);
     
    361385  Py_INCREF(__pyx_v_timeout_ms);
    362386  Py_INCREF(__pyx_v_immediate);
    363387
    364   /* "/Users/dugsong/projects/pypcap/pcap.pyx":168 */
     388  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":168 */
    365389  __pyx_1 = PyObject_IsTrue(__pyx_v_name); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; goto __pyx_L1;}
    366390  __pyx_2 = (!__pyx_1);
    367391  if (__pyx_2) {
    368392
    369     /* "/Users/dugsong/projects/pypcap/pcap.pyx":169 */
     393    /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":169 */
    370394    __pyx_v_p = pcap_ex_lookupdev(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__ebuf);
    371395
    372     /* "/Users/dugsong/projects/pypcap/pcap.pyx":170 */
    373     __pyx_1 = (__pyx_v_p == 0);
     396    /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":170 */
     397    __pyx_1 = (__pyx_v_p == NULL);
    374398    if (__pyx_1) {
    375 
    376       /* "/Users/dugsong/projects/pypcap/pcap.pyx":171 */
    377       __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; goto __pyx_L1;}
    378       __pyx_4 = PyString_FromString(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__ebuf); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; goto __pyx_L1;}
    379       __Pyx_Raise(__pyx_3, __pyx_4, 0);
     399      __pyx_3 = PyString_FromString(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__ebuf); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; goto __pyx_L1;}
     400      __Pyx_Raise(PyExc_OSError, __pyx_3, 0);
    380401      Py_DECREF(__pyx_3); __pyx_3 = 0;
    381       Py_DECREF(__pyx_4); __pyx_4 = 0;
    382402      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; goto __pyx_L1;}
    383403      goto __pyx_L3;
    384404    }
     
    386406    goto __pyx_L2;
    387407  }
    388408  /*else*/ {
    389 
    390     /* "/Users/dugsong/projects/pypcap/pcap.pyx":173 */
    391     __pyx_5 = PyString_AsString(__pyx_v_name); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; goto __pyx_L1;}
    392     __pyx_v_p = __pyx_5;
     409    __pyx_4 = PyString_AsString(__pyx_v_name); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; goto __pyx_L1;}
     410    __pyx_v_p = __pyx_4;
    393411  }
    394412  __pyx_L2:;
    395413
    396   /* "/Users/dugsong/projects/pypcap/pcap.pyx":175 */
     414  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":175 */
    397415  ((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap = pcap_open_offline(__pyx_v_p,((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__ebuf);
    398416
    399   /* "/Users/dugsong/projects/pypcap/pcap.pyx":176 */
     417  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":176 */
    400418  __pyx_2 = (!(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap != 0));
    401419  if (__pyx_2) {
    402 
    403     /* "/Users/dugsong/projects/pypcap/pcap.pyx":177 */
    404420    __pyx_1 = PyInt_AsLong(__pyx_v_snaplen); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}
    405421    __pyx_2 = PyInt_AsLong(__pyx_v_promisc); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}
    406     __pyx_6 = PyInt_AsLong(__pyx_v_timeout_ms); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}
    407     ((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap = pcap_open_live(pcap_ex_name(__pyx_v_p),__pyx_1,__pyx_2,__pyx_6,((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__ebuf);
     422    __pyx_5 = PyInt_AsLong(__pyx_v_timeout_ms); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}
     423    ((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap = pcap_open_live(pcap_ex_name(__pyx_v_p),__pyx_1,__pyx_2,__pyx_5,((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__ebuf);
    408424    goto __pyx_L4;
    409425  }
    410426  __pyx_L4:;
    411427
    412   /* "/Users/dugsong/projects/pypcap/pcap.pyx":179 */
     428  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":179 */
    413429  __pyx_1 = (!(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap != 0));
    414430  if (__pyx_1) {
    415 
    416     /* "/Users/dugsong/projects/pypcap/pcap.pyx":180 */
    417     __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; goto __pyx_L1;}
    418     __pyx_4 = PyString_FromString(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__ebuf); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; goto __pyx_L1;}
    419     __Pyx_Raise(__pyx_3, __pyx_4, 0);
     431    __pyx_3 = PyString_FromString(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__ebuf); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; goto __pyx_L1;}
     432    __Pyx_Raise(PyExc_OSError, __pyx_3, 0);
    420433    Py_DECREF(__pyx_3); __pyx_3 = 0;
    421     Py_DECREF(__pyx_4); __pyx_4 = 0;
    422434    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; goto __pyx_L1;}
    423435    goto __pyx_L5;
    424436  }
    425437  __pyx_L5:;
    426438
    427   /* "/Users/dugsong/projects/pypcap/pcap.pyx":182 */
     439  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":182 */
    428440  ((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__name = strdup(__pyx_v_p);
    429441
    430   /* "/Users/dugsong/projects/pypcap/pcap.pyx":183 */
    431   ((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__filter = strdup(__pyx_k22);
     442  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":183 */
     443  ((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__filter = strdup(__pyx_k2);
    432444
    433   /* "/Users/dugsong/projects/pypcap/pcap.pyx":184 */
     445  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":184 */
    434446  /*try:*/ {
    435447    __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_dltoff); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; goto __pyx_L6;}
    436     __pyx_4 = PyInt_FromLong(pcap_datalink(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; goto __pyx_L6;}
    437     __pyx_7 = PyObject_GetItem(__pyx_3, __pyx_4); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; goto __pyx_L6;}
     448    __pyx_6 = PyInt_FromLong(pcap_datalink(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap)); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; goto __pyx_L6;}
     449    __pyx_7 = PyObject_GetItem(__pyx_3, __pyx_6); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; goto __pyx_L6;}
    438450    Py_DECREF(__pyx_3); __pyx_3 = 0;
    439     Py_DECREF(__pyx_4); __pyx_4 = 0;
     451    Py_DECREF(__pyx_6); __pyx_6 = 0;
    440452    __pyx_2 = PyInt_AsLong(__pyx_7); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; goto __pyx_L6;}
    441453    Py_DECREF(__pyx_7); __pyx_7 = 0;
    442454    ((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__dloff = __pyx_2;
     
    444456  goto __pyx_L7;
    445457  __pyx_L6:;
    446458  Py_XDECREF(__pyx_3); __pyx_3 = 0;
    447   Py_XDECREF(__pyx_4); __pyx_4 = 0;
     459  Py_XDECREF(__pyx_6); __pyx_6 = 0;
    448460  Py_XDECREF(__pyx_7); __pyx_7 = 0;
    449461
    450   /* "/Users/dugsong/projects/pypcap/pcap.pyx":185 */
    451   __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_KeyError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; goto __pyx_L1;}
    452   __pyx_6 = PyErr_ExceptionMatches(__pyx_3);
    453   Py_DECREF(__pyx_3); __pyx_3 = 0;
    454   if (__pyx_6) {
    455     __Pyx_AddTraceback("pcap.__init__");
    456     __pyx_4 = __Pyx_GetExcValue(); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; goto __pyx_L1;}
    457     Py_DECREF(__pyx_4); __pyx_4 = 0;
     462  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":185 */
     463  __pyx_5 = PyErr_ExceptionMatches(PyExc_KeyError);
     464  if (__pyx_5) {
    458465    goto __pyx_L7;
    459466  }
    460467  goto __pyx_L1;
    461468  __pyx_L7:;
    462469
    463   /* "/Users/dugsong/projects/pypcap/pcap.pyx":186 */
    464   __pyx_7 = __pyx_v_immediate;
    465   Py_INCREF(__pyx_7);
    466   __pyx_1 = PyObject_IsTrue(__pyx_7); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; goto __pyx_L1;}
     470  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":186 */
     471  __pyx_3 = __pyx_v_immediate;
     472  Py_INCREF(__pyx_3);
     473  __pyx_1 = PyObject_IsTrue(__pyx_3); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; goto __pyx_L1;}
    467474  if (__pyx_1) {
    468     Py_DECREF(__pyx_7); __pyx_7 = 0;
    469     __pyx_7 = PyInt_FromLong((pcap_ex_immediate(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap) < 0)); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; goto __pyx_L1;}
     475    Py_DECREF(__pyx_3); __pyx_3 = 0;
     476    __pyx_3 = PyInt_FromLong((pcap_ex_immediate(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap) < 0)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; goto __pyx_L1;}
    470477  }
    471   __pyx_2 = PyObject_IsTrue(__pyx_7); if (__pyx_2 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; goto __pyx_L1;}
    472   Py_DECREF(__pyx_7); __pyx_7 = 0;
     478  __pyx_2 = PyObject_IsTrue(__pyx_3); if (__pyx_2 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; goto __pyx_L1;}
     479  Py_DECREF(__pyx_3); __pyx_3 = 0;
    473480  if (__pyx_2) {
    474 
    475     /* "/Users/dugsong/projects/pypcap/pcap.pyx":187 */
    476     __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; goto __pyx_L1;}
    477     __Pyx_Raise(__pyx_3, __pyx_k23p, 0);
    478     Py_DECREF(__pyx_3); __pyx_3 = 0;
     481    __Pyx_Raise(PyExc_OSError, __pyx_k4p, 0);
    479482    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; goto __pyx_L1;}
    480483    goto __pyx_L8;
    481484  }
     
    485488  goto __pyx_L0;
    486489  __pyx_L1:;
    487490  Py_XDECREF(__pyx_3);
    488   Py_XDECREF(__pyx_4);
     491  Py_XDECREF(__pyx_6);
    489492  Py_XDECREF(__pyx_7);
    490493  __Pyx_AddTraceback("pcap.pcap.__init__");
    491494  __pyx_r = -1;
     
    504507  PyObject *__pyx_r;
    505508  PyObject *__pyx_1 = 0;
    506509  Py_INCREF(__pyx_v_self);
    507 
    508   /* "/Users/dugsong/projects/pypcap/pcap.pyx":192 */
    509510  __pyx_1 = PyString_FromString(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__name); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; goto __pyx_L1;}
    510511  __pyx_r = __pyx_1;
    511512  __pyx_1 = 0;
    512513  goto __pyx_L0;
    513514
    514   __pyx_r = Py_None; Py_INCREF(__pyx_r);
     515  __pyx_r = Py_None; Py_INCREF(Py_None);
    515516  goto __pyx_L0;
    516517  __pyx_L1:;
    517518  Py_XDECREF(__pyx_1);
     
    527528  PyObject *__pyx_r;
    528529  PyObject *__pyx_1 = 0;
    529530  Py_INCREF(__pyx_v_self);
    530 
    531   /* "/Users/dugsong/projects/pypcap/pcap.pyx":197 */
    532531  __pyx_1 = PyInt_FromLong(pcap_snapshot(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; goto __pyx_L1;}
    533532  __pyx_r = __pyx_1;
    534533  __pyx_1 = 0;
    535534  goto __pyx_L0;
    536535
    537   __pyx_r = Py_None; Py_INCREF(__pyx_r);
     536  __pyx_r = Py_None; Py_INCREF(Py_None);
    538537  goto __pyx_L0;
    539538  __pyx_L1:;
    540539  Py_XDECREF(__pyx_1);
     
    550549  PyObject *__pyx_r;
    551550  PyObject *__pyx_1 = 0;
    552551  Py_INCREF(__pyx_v_self);
    553 
    554   /* "/Users/dugsong/projects/pypcap/pcap.pyx":202 */
    555552  __pyx_1 = PyInt_FromLong(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__dloff); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; goto __pyx_L1;}
    556553  __pyx_r = __pyx_1;
    557554  __pyx_1 = 0;
    558555  goto __pyx_L0;
    559556
    560   __pyx_r = Py_None; Py_INCREF(__pyx_r);
     557  __pyx_r = Py_None; Py_INCREF(Py_None);
    561558  goto __pyx_L0;
    562559  __pyx_L1:;
    563560  Py_XDECREF(__pyx_1);
     
    573570  PyObject *__pyx_r;
    574571  PyObject *__pyx_1 = 0;
    575572  Py_INCREF(__pyx_v_self);
    576 
    577   /* "/Users/dugsong/projects/pypcap/pcap.pyx":207 */
    578573  __pyx_1 = PyString_FromString(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__filter); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; goto __pyx_L1;}
    579574  __pyx_r = __pyx_1;
    580575  __pyx_1 = 0;
    581576  goto __pyx_L0;
    582577
    583   __pyx_r = Py_None; Py_INCREF(__pyx_r);
     578  __pyx_r = Py_None; Py_INCREF(Py_None);
    584579  goto __pyx_L0;
    585580  __pyx_L1:;
    586581  Py_XDECREF(__pyx_1);
     
    596591  PyObject *__pyx_r;
    597592  PyObject *__pyx_1 = 0;
    598593  Py_INCREF(__pyx_v_self);
    599 
    600   /* "/Users/dugsong/projects/pypcap/pcap.pyx":212 */
    601594  __pyx_1 = PyInt_FromLong(pcap_ex_fileno(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; goto __pyx_L1;}
    602595  __pyx_r = __pyx_1;
    603596  __pyx_1 = 0;
    604597  goto __pyx_L0;
    605598
    606   __pyx_r = Py_None; Py_INCREF(__pyx_r);
     599  __pyx_r = Py_None; Py_INCREF(Py_None);
    607600  goto __pyx_L0;
    608601  __pyx_L1:;
    609602  Py_XDECREF(__pyx_1);
     
    622615  static char *__pyx_argnames[] = {0};
    623616  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
    624617  Py_INCREF(__pyx_v_self);
    625 
    626   /* "/Users/dugsong/projects/pypcap/pcap.pyx":216 */
    627618  __pyx_1 = PyInt_FromLong(pcap_ex_fileno(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; goto __pyx_L1;}
    628619  __pyx_r = __pyx_1;
    629620  __pyx_1 = 0;
    630621  goto __pyx_L0;
    631622
    632   __pyx_r = Py_None; Py_INCREF(__pyx_r);
     623  __pyx_r = Py_None; Py_INCREF(Py_None);
    633624  goto __pyx_L0;
    634625  __pyx_L1:;
    635626  Py_XDECREF(__pyx_1);
     
    647638  PyObject *__pyx_v_optimize = 0;
    648639  struct bpf_program __pyx_v_fcode;
    649640  PyObject *__pyx_r;
    650   char (*__pyx_1);
     641  char *__pyx_1;
    651642  int __pyx_2;
    652643  int __pyx_3;
    653644  PyObject *__pyx_4 = 0;
    654   PyObject *__pyx_5 = 0;
    655645  static char *__pyx_argnames[] = {"value","optimize",0};
    656   __pyx_v_optimize = __pyx_k19;
     646  __pyx_v_optimize = __pyx_d7;
    657647  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|O", __pyx_argnames, &__pyx_v_value, &__pyx_v_optimize)) return 0;
    658648  Py_INCREF(__pyx_v_self);
    659649  Py_INCREF(__pyx_v_value);
    660650  Py_INCREF(__pyx_v_optimize);
    661651
    662   /* "/Users/dugsong/projects/pypcap/pcap.pyx":221 */
     652  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":221 */
    663653  free(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__filter);
    664654
    665   /* "/Users/dugsong/projects/pypcap/pcap.pyx":222 */
    666   __pyx_1 = PyString_AsString(__pyx_v_value); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; goto __pyx_L1;}
     655  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":222 */
     656  __pyx_1 = PyString_AsString(__pyx_v_value); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; goto __pyx_L1;}
    667657  ((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__filter = strdup(__pyx_1);
    668658
    669   /* "/Users/dugsong/projects/pypcap/pcap.pyx":223 */
     659  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":223 */
    670660  __pyx_2 = PyInt_AsLong(__pyx_v_optimize); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; goto __pyx_L1;}
    671661  __pyx_3 = (pcap_compile(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap,(&__pyx_v_fcode),((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__filter,__pyx_2,0) < 0);
    672662  if (__pyx_3) {
    673 
    674     /* "/Users/dugsong/projects/pypcap/pcap.pyx":224 */
    675     __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; goto __pyx_L1;}
    676     __pyx_5 = PyString_FromString(pcap_geterr(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap)); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; goto __pyx_L1;}
    677     __Pyx_Raise(__pyx_4, __pyx_5, 0);
     663    __pyx_4 = PyString_FromString(pcap_geterr(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; goto __pyx_L1;}
     664    __Pyx_Raise(PyExc_OSError, __pyx_4, 0);
    678665    Py_DECREF(__pyx_4); __pyx_4 = 0;
    679     Py_DECREF(__pyx_5); __pyx_5 = 0;
    680666    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; goto __pyx_L1;}
    681667    goto __pyx_L2;
    682668  }
    683669  __pyx_L2:;
    684670
    685   /* "/Users/dugsong/projects/pypcap/pcap.pyx":225 */
     671  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":225 */
    686672  __pyx_2 = (pcap_setfilter(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap,(&__pyx_v_fcode)) < 0);
    687673  if (__pyx_2) {
    688 
    689     /* "/Users/dugsong/projects/pypcap/pcap.pyx":226 */
    690     __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}
    691     __pyx_5 = PyString_FromString(pcap_geterr(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap)); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}
    692     __Pyx_Raise(__pyx_4, __pyx_5, 0);
     674    __pyx_4 = PyString_FromString(pcap_geterr(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}
     675    __Pyx_Raise(PyExc_OSError, __pyx_4, 0);
    693676    Py_DECREF(__pyx_4); __pyx_4 = 0;
    694     Py_DECREF(__pyx_5); __pyx_5 = 0;
    695677    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}
    696678    goto __pyx_L3;
    697679  }
    698680  __pyx_L3:;
    699681
    700   /* "/Users/dugsong/projects/pypcap/pcap.pyx":227 */
     682  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":227 */
    701683  pcap_freecode((&__pyx_v_fcode));
    702684
    703   __pyx_r = Py_None; Py_INCREF(__pyx_r);
     685  __pyx_r = Py_None; Py_INCREF(Py_None);
    704686  goto __pyx_L0;
    705687  __pyx_L1:;
    706688  Py_XDECREF(__pyx_4);
    707   Py_XDECREF(__pyx_5);
    708689  __Pyx_AddTraceback("pcap.pcap.setfilter");
    709690  __pyx_r = 0;
    710691  __pyx_L0:;
     
    721702  PyObject *__pyx_r;
    722703  int __pyx_1;
    723704  static char *__pyx_argnames[] = {"nonblock",0};
    724   __pyx_v_nonblock = __pyx_k20;
     705  __pyx_v_nonblock = __pyx_d8;
    725706  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|O", __pyx_argnames, &__pyx_v_nonblock)) return 0;
    726707  Py_INCREF(__pyx_v_self);
    727708  Py_INCREF(__pyx_v_nonblock);
    728 
    729   /* "/Users/dugsong/projects/pypcap/pcap.pyx":231 */
    730709  __pyx_1 = PyInt_AsLong(__pyx_v_nonblock); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;}
    731710  pcap_ex_setnonblock(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap,__pyx_1,((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__ebuf);
    732711
    733   __pyx_r = Py_None; Py_INCREF(__pyx_r);
     712  __pyx_r = Py_None; Py_INCREF(Py_None);
    734713  goto __pyx_L0;
    735714  __pyx_L1:;
    736715  __Pyx_AddTraceback("pcap.pcap.setnonblock");
     
    748727  PyObject *__pyx_r;
    749728  PyObject *__pyx_1 = 0;
    750729  int __pyx_2;
    751   PyObject *__pyx_3 = 0;
    752730  static char *__pyx_argnames[] = {0};
    753731  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
    754732  Py_INCREF(__pyx_v_self);
    755   __pyx_v_ret = Py_None; Py_INCREF(__pyx_v_ret);
     733  __pyx_v_ret = Py_None; Py_INCREF(Py_None);
    756734
    757   /* "/Users/dugsong/projects/pypcap/pcap.pyx":235 */
     735  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":235 */
    758736  __pyx_1 = PyInt_FromLong(pcap_ex_getnonblock(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap,((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__ebuf)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; goto __pyx_L1;}
    759737  Py_DECREF(__pyx_v_ret);
    760738  __pyx_v_ret = __pyx_1;
    761739  __pyx_1 = 0;
    762740
    763   /* "/Users/dugsong/projects/pypcap/pcap.pyx":236 */
     741  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":236 */
    764742  __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; goto __pyx_L1;}
    765743  if (PyObject_Cmp(__pyx_v_ret, __pyx_1, &__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; goto __pyx_L1;}
    766744  __pyx_2 = __pyx_2 < 0;
    767745  Py_DECREF(__pyx_1); __pyx_1 = 0;
    768746  if (__pyx_2) {
    769 
    770     /* "/Users/dugsong/projects/pypcap/pcap.pyx":237 */
    771     __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; goto __pyx_L1;}
    772     __pyx_3 = PyString_FromString(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__ebuf); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; goto __pyx_L1;}
    773     __Pyx_Raise(__pyx_1, __pyx_3, 0);
     747    __pyx_1 = PyString_FromString(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__ebuf); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; goto __pyx_L1;}
     748    __Pyx_Raise(PyExc_OSError, __pyx_1, 0);
    774749    Py_DECREF(__pyx_1); __pyx_1 = 0;
    775     Py_DECREF(__pyx_3); __pyx_3 = 0;
    776750    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; goto __pyx_L1;}
    777751    goto __pyx_L2;
    778752  }
    779753  __pyx_2 = PyObject_IsTrue(__pyx_v_ret); if (__pyx_2 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; goto __pyx_L1;}
    780754  if (__pyx_2) {
    781 
    782     /* "/Users/dugsong/projects/pypcap/pcap.pyx":239 */
    783     __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_True); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; goto __pyx_L1;}
    784     __pyx_r = __pyx_1;
    785     __pyx_1 = 0;
     755    Py_INCREF(Py_True);
     756    __pyx_r = Py_True;
    786757    goto __pyx_L0;
    787758    goto __pyx_L2;
    788759  }
    789760  __pyx_L2:;
    790761
    791   /* "/Users/dugsong/projects/pypcap/pcap.pyx":240 */
    792   __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_False); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; goto __pyx_L1;}
    793   __pyx_r = __pyx_3;
    794   __pyx_3 = 0;
     762  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":240 */
     763  Py_INCREF(Py_False);
     764  __pyx_r = Py_False;
    795765  goto __pyx_L0;
    796766
    797   __pyx_r = Py_None; Py_INCREF(__pyx_r);
     767  __pyx_r = Py_None; Py_INCREF(Py_None);
    798768  goto __pyx_L0;
    799769  __pyx_L1:;
    800770  Py_XDECREF(__pyx_1);
    801   Py_XDECREF(__pyx_3);
    802771  __Pyx_AddTraceback("pcap.pcap.getnonblock");
    803772  __pyx_r = 0;
    804773  __pyx_L0:;
     
    815784  static char *__pyx_argnames[] = {0};
    816785  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
    817786  Py_INCREF(__pyx_v_self);
    818 
    819   /* "/Users/dugsong/projects/pypcap/pcap.pyx":244 */
    820787  __pyx_1 = PyInt_FromLong(pcap_datalink(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; goto __pyx_L1;}
    821788  __pyx_r = __pyx_1;
    822789  __pyx_1 = 0;
    823790  goto __pyx_L0;
    824791
    825   __pyx_r = Py_None; Py_INCREF(__pyx_r);
     792  __pyx_r = Py_None; Py_INCREF(Py_None);
    826793  goto __pyx_L0;
    827794  __pyx_L1:;
    828795  Py_XDECREF(__pyx_1);
     
    837804static char __pyx_doc_4pcap_4pcap_next[] = "Return the next (timestamp, packet) tuple, or None on error.";
    838805static PyObject *__pyx_f_4pcap_4pcap_next(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
    839806  struct pcap_pkthdr __pyx_v_hdr;
    840   char (*__pyx_v_pkt);
     807  char *__pyx_v_pkt;
    841808  PyObject *__pyx_r;
    842809  int __pyx_1;
    843810  PyObject *__pyx_2 = 0;
     
    847814  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
    848815  Py_INCREF(__pyx_v_self);
    849816
    850   /* "/Users/dugsong/projects/pypcap/pcap.pyx":250 */
    851   __pyx_v_pkt = ((char (*))pcap_next(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap,(&__pyx_v_hdr)));
     817  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":250 */
     818  __pyx_v_pkt = ((char *)pcap_next(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap,(&__pyx_v_hdr)));
    852819
    853   /* "/Users/dugsong/projects/pypcap/pcap.pyx":251 */
     820  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":251 */
    854821  __pyx_1 = (!(__pyx_v_pkt != 0));
    855822  if (__pyx_1) {
    856 
    857     /* "/Users/dugsong/projects/pypcap/pcap.pyx":252 */
    858823    Py_INCREF(Py_None);
    859824    __pyx_r = Py_None;
    860825    goto __pyx_L0;
     
    862827  }
    863828  __pyx_L2:;
    864829
    865   /* "/Users/dugsong/projects/pypcap/pcap.pyx":253 */
     830  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":253 */
    866831  __pyx_2 = PyFloat_FromDouble((__pyx_v_hdr.ts.tv_sec + (__pyx_v_hdr.ts.tv_usec / 1000000.0))); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; goto __pyx_L1;}
    867832  __pyx_3 = PyBuffer_FromMemory(__pyx_v_pkt,__pyx_v_hdr.caplen); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; goto __pyx_L1;}
    868833  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; goto __pyx_L1;}
     
    874839  __pyx_4 = 0;
    875840  goto __pyx_L0;
    876841
    877   __pyx_r = Py_None; Py_INCREF(__pyx_r);
     842  __pyx_r = Py_None; Py_INCREF(Py_None);
    878843  goto __pyx_L0;
    879844  __pyx_L1:;
    880845  Py_XDECREF(__pyx_2);
     
    887852  return __pyx_r;
    888853}
    889854
    890 static PyObject *__pyx_n_append;
    891 
    892855static PyObject *__pyx_f_4pcap_4pcap___add_pkts(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    893856static PyObject *__pyx_f_4pcap_4pcap___add_pkts(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
    894857  PyObject *__pyx_v_ts = 0;
     
    904867  Py_INCREF(__pyx_v_ts);
    905868  Py_INCREF(__pyx_v_pkt);
    906869  Py_INCREF(__pyx_v_pkts);
    907 
    908   /* "/Users/dugsong/projects/pypcap/pcap.pyx":257 */
    909870  __pyx_1 = PyObject_GetAttr(__pyx_v_pkts, __pyx_n_append); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; goto __pyx_L1;}
    910871  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; goto __pyx_L1;}
    911872  Py_INCREF(__pyx_v_ts);
     
    920881  Py_DECREF(__pyx_3); __pyx_3 = 0;
    921882  Py_DECREF(__pyx_2); __pyx_2 = 0;
    922883
    923   __pyx_r = Py_None; Py_INCREF(__pyx_r);
     884  __pyx_r = Py_None; Py_INCREF(Py_None);
    924885  goto __pyx_L0;
    925886  __pyx_L1:;
    926887  Py_XDECREF(__pyx_1);
     
    936897  return __pyx_r;
    937898}
    938899
    939 static PyObject *__pyx_n_dispatch;
    940 static PyObject *__pyx_n___add_pkts;
    941 
    942900static PyObject *__pyx_f_4pcap_4pcap_readpkts(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    943901static char __pyx_doc_4pcap_4pcap_readpkts[] = "Return a list of (timestamp, packet) tuples received in one buffer.";
    944902static PyObject *__pyx_f_4pcap_4pcap_readpkts(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
     
    951909  static char *__pyx_argnames[] = {0};
    952910  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
    953911  Py_INCREF(__pyx_v_self);
    954   __pyx_v_pkts = Py_None; Py_INCREF(__pyx_v_pkts);
     912  __pyx_v_pkts = Py_None; Py_INCREF(Py_None);
    955913
    956   /* "/Users/dugsong/projects/pypcap/pcap.pyx":261 */
     914  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":261 */
    957915  __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; goto __pyx_L1;}
    958916  Py_DECREF(__pyx_v_pkts);
    959917  __pyx_v_pkts = __pyx_1;
    960918  __pyx_1 = 0;
    961919
    962   /* "/Users/dugsong/projects/pypcap/pcap.pyx":262 */
     920  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":262 */
    963921  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_dispatch); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;}
    964922  __pyx_2 = PyInt_FromLong((-1)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;}
    965923  __pyx_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n___add_pkts); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;}
     
    975933  Py_DECREF(__pyx_4); __pyx_4 = 0;
    976934  Py_DECREF(__pyx_2); __pyx_2 = 0;
    977935
    978   /* "/Users/dugsong/projects/pypcap/pcap.pyx":263 */
     936  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":263 */
    979937  Py_INCREF(__pyx_v_pkts);
    980938  __pyx_r = __pyx_v_pkts;
    981939  goto __pyx_L0;
    982940
    983   __pyx_r = Py_None; Py_INCREF(__pyx_r);
     941  __pyx_r = Py_None; Py_INCREF(Py_None);
    984942  goto __pyx_L0;
    985943  __pyx_L1:;
    986944  Py_XDECREF(__pyx_1);
     
    995953  return __pyx_r;
    996954}
    997955
    998 static PyObject *__pyx_n_exc_info;
    999 
    1000956static PyObject *__pyx_f_4pcap_4pcap_dispatch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    1001957static char __pyx_doc_4pcap_4pcap_dispatch[] = "Collect and process packets with a user callback,\n        return the number of packets processed, or 0 for a savefile.\n        \n        Arguments:\n        \n        cnt      -- number of packets to process;\n                    or 0 to process all packets until an error occurs,\n                    EOF is reached, or the read times out;\n                    or -1 to process all packets received in one buffer\n        callback -- function with (timestamp, pkt, *args) prototype\n        *args    -- optional arguments passed to callback on execution\n        ";
    1002958static PyObject *__pyx_f_4pcap_4pcap_dispatch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
     
    1013969  PyObject *__pyx_4 = 0;
    1014970  PyObject *__pyx_5 = 0;
    1015971  static char *__pyx_argnames[] = {"cnt","callback",0};
    1016   if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 2, &__pyx_v_args, 0) < 0) return 0;
     972  if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 2, &__pyx_v_args, 0, 0) < 0) return 0;
    1017973  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_cnt, &__pyx_v_callback)) {
    1018974    Py_XDECREF(__pyx_args);
    1019975    Py_XDECREF(__pyx_kwds);
     
    1023979  Py_INCREF(__pyx_v_self);
    1024980  Py_INCREF(__pyx_v_cnt);
    1025981  Py_INCREF(__pyx_v_callback);
    1026   __pyx_v_exc = Py_None; Py_INCREF(__pyx_v_exc);
     982  __pyx_v_exc = Py_None; Py_INCREF(Py_None);
    1027983
    1028   /* "/Users/dugsong/projects/pypcap/pcap.pyx":281 */
    1029   __pyx_v_ctx.callback = ((void (*))__pyx_v_callback);
     984  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":281 */
     985  __pyx_v_ctx.callback = ((void *)__pyx_v_callback);
    1030986
    1031   /* "/Users/dugsong/projects/pypcap/pcap.pyx":282 */
    1032   __pyx_v_ctx.args = ((void (*))__pyx_v_args);
     987  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":282 */
     988  __pyx_v_ctx.args = ((void *)__pyx_v_args);
    1033989
    1034   /* "/Users/dugsong/projects/pypcap/pcap.pyx":283 */
     990  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":283 */
    1035991  __pyx_v_ctx.got_exc = 0;
    1036992
    1037   /* "/Users/dugsong/projects/pypcap/pcap.pyx":284 */
     993  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":284 */
    1038994  __pyx_1 = PyInt_AsLong(__pyx_v_cnt); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; goto __pyx_L1;}
    1039   __pyx_v_n = pcap_dispatch(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap,__pyx_1,__pyx_f_4pcap___pcap_handler,((unsigned char (*))(&__pyx_v_ctx)));
     995  __pyx_v_n = pcap_dispatch(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap,__pyx_1,__pyx_f_4pcap___pcap_handler,((unsigned char *)(&__pyx_v_ctx)));
    1040996
    1041   /* "/Users/dugsong/projects/pypcap/pcap.pyx":286 */
     997  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":286 */
    1042998  __pyx_1 = __pyx_v_ctx.got_exc;
    1043999  if (__pyx_1) {
    10441000
    1045     /* "/Users/dugsong/projects/pypcap/pcap.pyx":287 */
     1001    /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":287 */
    10461002    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_sys); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; goto __pyx_L1;}
    10471003    __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_exc_info); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; goto __pyx_L1;}
    10481004    Py_DECREF(__pyx_2); __pyx_2 = 0;
    1049     __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; goto __pyx_L1;}
    1050     __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; goto __pyx_L1;}
     1005    __pyx_2 = PyObject_CallObject(__pyx_3, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; goto __pyx_L1;}
    10511006    Py_DECREF(__pyx_3); __pyx_3 = 0;
    1052     Py_DECREF(__pyx_2); __pyx_2 = 0;
    10531007    Py_DECREF(__pyx_v_exc);
    1054     __pyx_v_exc = __pyx_4;
    1055     __pyx_4 = 0;
     1008    __pyx_v_exc = __pyx_2;
     1009    __pyx_2 = 0;
    10561010
    1057     /* "/Users/dugsong/projects/pypcap/pcap.pyx":288 */
     1011    /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":288 */
    10581012    __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; goto __pyx_L1;}
    10591013    __pyx_2 = PyObject_GetItem(__pyx_v_exc, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; goto __pyx_L1;}
    10601014    Py_DECREF(__pyx_3); __pyx_3 = 0;
    1061     __pyx_4 = PyInt_FromLong(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; goto __pyx_L1;}
    1062     __pyx_3 = PyObject_GetItem(__pyx_v_exc, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; goto __pyx_L1;}
    1063     Py_DECREF(__pyx_4); __pyx_4 = 0;
    1064     __pyx_4 = PyInt_FromLong(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; goto __pyx_L1;}
    1065     __pyx_5 = PyObject_GetItem(__pyx_v_exc, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; goto __pyx_L1;}
    1066     Py_DECREF(__pyx_4); __pyx_4 = 0;
    1067     __Pyx_Raise(__pyx_2, __pyx_3, __pyx_5);
    1068     Py_DECREF(__pyx_2); __pyx_2 = 0;
     1015    __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; goto __pyx_L1;}
     1016    __pyx_4 = PyObject_GetItem(__pyx_v_exc, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; goto __pyx_L1;}
     1017    Py_DECREF(__pyx_3); __pyx_3 = 0;
     1018    __pyx_3 = PyInt_FromLong(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; goto __pyx_L1;}
     1019    __pyx_5 = PyObject_GetItem(__pyx_v_exc, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; goto __pyx_L1;}
    10691020    Py_DECREF(__pyx_3); __pyx_3 = 0;
     1021    __Pyx_Raise(__pyx_2, __pyx_4, __pyx_5);
     1022    Py_DECREF(__pyx_2); __pyx_2 = 0;
     1023    Py_DECREF(__pyx_4); __pyx_4 = 0;
    10701024    Py_DECREF(__pyx_5); __pyx_5 = 0;
    10711025    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; goto __pyx_L1;}
    10721026    goto __pyx_L2;
    10731027  }
    10741028  __pyx_L2:;
    10751029
    1076   /* "/Users/dugsong/projects/pypcap/pcap.pyx":289 */
    1077   __pyx_4 = PyInt_FromLong(__pyx_v_n); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; goto __pyx_L1;}
    1078   __pyx_r = __pyx_4;
    1079   __pyx_4 = 0;
     1030  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":289 */
     1031  __pyx_3 = PyInt_FromLong(__pyx_v_n); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; goto __pyx_L1;}
     1032  __pyx_r = __pyx_3;
     1033  __pyx_3 = 0;
    10801034  goto __pyx_L0;
    10811035
    1082   __pyx_r = Py_None; Py_INCREF(__pyx_r);
     1036  __pyx_r = Py_None; Py_INCREF(Py_None);
    10831037  goto __pyx_L0;
    10841038  __pyx_L1:;
    10851039  Py_XDECREF(__pyx_2);
     
    10991053  return __pyx_r;
    11001054}
    11011055
    1102 static PyObject *__pyx_n_KeyboardInterrupt;
    1103 
    11041056static PyObject *__pyx_f_4pcap_4pcap_loop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    11051057static char __pyx_doc_4pcap_4pcap_loop[] = "Loop forever, processing packets with a user callback.\n        The loop can be exited with an exception, including KeyboardInterrupt.\n        \n        Arguments:\n\n        callback -- function with (timestamp, pkt, *args) prototype\n        *args    -- optional arguments passed to callback on execution\n        ";
    11061058static PyObject *__pyx_f_4pcap_4pcap_loop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
    11071059  PyObject *__pyx_v_callback = 0;
    11081060  PyObject *__pyx_v_args = 0;
    1109   struct pcap_pkthdr (*__pyx_v_hdr);
    1110   char (*__pyx_v_pkt);
     1061  struct pcap_pkthdr *__pyx_v_hdr;
     1062  char *__pyx_v_pkt;
    11111063  int __pyx_v_n;
    11121064  PyObject *__pyx_r;
    11131065  long __pyx_1;
     
    11161068  PyObject *__pyx_4 = 0;
    11171069  PyObject *__pyx_5 = 0;
    11181070  static char *__pyx_argnames[] = {"callback",0};
    1119   if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 1, &__pyx_v_args, 0) < 0) return 0;
     1071  if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 1, &__pyx_v_args, 0, 0) < 0) return 0;
    11201072  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_callback)) {
    11211073    Py_XDECREF(__pyx_args);
    11221074    Py_XDECREF(__pyx_kwds);
     
    11261078  Py_INCREF(__pyx_v_self);
    11271079  Py_INCREF(__pyx_v_callback);
    11281080
    1129   /* "/Users/dugsong/projects/pypcap/pcap.pyx":303 */
     1081  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":303 */
    11301082  pcap_ex_setup(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap);
    11311083
    1132   /* "/Users/dugsong/projects/pypcap/pcap.pyx":304 */
     1084  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":304 */
    11331085  while (1) {
    1134     __pyx_L2:;
    11351086    __pyx_1 = 1;
    11361087    if (!__pyx_1) break;
    11371088
    1138     /* "/Users/dugsong/projects/pypcap/pcap.pyx":305 */
     1089    /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":305 */
    11391090    Py_BEGIN_ALLOW_THREADS;
    11401091
    1141     /* "/Users/dugsong/projects/pypcap/pcap.pyx":306 */
     1092    /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":306 */
    11421093    __pyx_v_n = pcap_ex_next(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap,(&__pyx_v_hdr),(&__pyx_v_pkt));
    11431094
    1144     /* "/Users/dugsong/projects/pypcap/pcap.pyx":307 */
     1095    /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":307 */
    11451096    Py_END_ALLOW_THREADS;
    11461097
    1147     /* "/Users/dugsong/projects/pypcap/pcap.pyx":308 */
     1098    /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":308 */
    11481099    __pyx_2 = (__pyx_v_n == 1);
    11491100    if (__pyx_2) {
    1150 
    1151       /* "/Users/dugsong/projects/pypcap/pcap.pyx":309 */
    11521101      __pyx_3 = PyFloat_FromDouble((__pyx_v_hdr->ts.tv_sec + (__pyx_v_hdr->ts.tv_usec / 1000000.0))); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; goto __pyx_L1;}
    11531102      __pyx_4 = PyBuffer_FromMemory(__pyx_v_pkt,__pyx_v_hdr->caplen); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; goto __pyx_L1;}
    11541103      __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; goto __pyx_L1;}
     
    11671116    }
    11681117    __pyx_2 = (__pyx_v_n == (-1));
    11691118    if (__pyx_2) {
    1170 
    1171       /* "/Users/dugsong/projects/pypcap/pcap.pyx":312 */
    1172       __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_KeyboardInterrupt); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; goto __pyx_L1;}
    1173       __Pyx_Raise(__pyx_3, 0, 0);
    1174       Py_DECREF(__pyx_3); __pyx_3 = 0;
     1119      __Pyx_Raise(PyExc_KeyboardInterrupt, 0, 0);
    11751120      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; goto __pyx_L1;}
    11761121      goto __pyx_L4;
    11771122    }
    11781123    __pyx_2 = (__pyx_v_n == (-2));
    11791124    if (__pyx_2) {
    1180 
    1181       /* "/Users/dugsong/projects/pypcap/pcap.pyx":314 */
    11821125      goto __pyx_L3;
    11831126      goto __pyx_L4;
    11841127    }
     
    11861129  }
    11871130  __pyx_L3:;
    11881131
    1189   __pyx_r = Py_None; Py_INCREF(__pyx_r);
     1132  __pyx_r = Py_None; Py_INCREF(Py_None);
    11901133  goto __pyx_L0;
    11911134  __pyx_L1:;
    11921135  Py_XDECREF(__pyx_3);
     
    12111154  static char *__pyx_argnames[] = {0};
    12121155  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
    12131156  Py_INCREF(__pyx_v_self);
    1214 
    1215   /* "/Users/dugsong/projects/pypcap/pcap.pyx":318 */
    12161157  __pyx_1 = PyString_FromString(pcap_geterr(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}
    12171158  __pyx_r = __pyx_1;
    12181159  __pyx_1 = 0;
    12191160  goto __pyx_L0;
    12201161
    1221   __pyx_r = Py_None; Py_INCREF(__pyx_r);
     1162  __pyx_r = Py_None; Py_INCREF(Py_None);
    12221163  goto __pyx_L0;
    12231164  __pyx_L1:;
    12241165  Py_XDECREF(__pyx_1);
     
    12431184  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
    12441185  Py_INCREF(__pyx_v_self);
    12451186
    1246   /* "/Users/dugsong/projects/pypcap/pcap.pyx":324 */
     1187  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":324 */
    12471188  __pyx_1 = (pcap_stats(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap,(&__pyx_v_pstat)) < 0);
    12481189  if (__pyx_1) {
    1249 
    1250     /* "/Users/dugsong/projects/pypcap/pcap.pyx":325 */
    1251     __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; goto __pyx_L1;}
    1252     __pyx_3 = PyString_FromString(pcap_geterr(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; goto __pyx_L1;}
    1253     __Pyx_Raise(__pyx_2, __pyx_3, 0);
     1190    __pyx_2 = PyString_FromString(pcap_geterr(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; goto __pyx_L1;}
     1191    __Pyx_Raise(PyExc_OSError, __pyx_2, 0);
    12541192    Py_DECREF(__pyx_2); __pyx_2 = 0;
    1255     Py_DECREF(__pyx_3); __pyx_3 = 0;
    12561193    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; goto __pyx_L1;}
    12571194    goto __pyx_L2;
    12581195  }
    12591196  __pyx_L2:;
    12601197
    1261   /* "/Users/dugsong/projects/pypcap/pcap.pyx":326 */
    1262   __pyx_2 = PyInt_FromLong(__pyx_v_pstat.ps_recv); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; goto __pyx_L1;}
    1263   __pyx_3 = PyInt_FromLong(__pyx_v_pstat.ps_drop); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; goto __pyx_L1;}
    1264   __pyx_4 = PyInt_FromLong(__pyx_v_pstat.ps_ifdrop); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; goto __pyx_L1;}
     1198  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":326 */
     1199  __pyx_2 = PyLong_FromUnsignedLong(__pyx_v_pstat.ps_recv); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; goto __pyx_L1;}
     1200  __pyx_3 = PyLong_FromUnsignedLong(__pyx_v_pstat.ps_drop); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; goto __pyx_L1;}
     1201  __pyx_4 = PyLong_FromUnsignedLong(__pyx_v_pstat.ps_ifdrop); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; goto __pyx_L1;}
    12651202  __pyx_5 = PyTuple_New(3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; goto __pyx_L1;}
    12661203  PyTuple_SET_ITEM(__pyx_5, 0, __pyx_2);
    12671204  PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
     
    12731210  __pyx_5 = 0;
    12741211  goto __pyx_L0;
    12751212
    1276   __pyx_r = Py_None; Py_INCREF(__pyx_r);
     1213  __pyx_r = Py_None; Py_INCREF(Py_None);
    12771214  goto __pyx_L0;
    12781215  __pyx_L1:;
    12791216  Py_XDECREF(__pyx_2);
     
    12921229  PyObject *__pyx_r;
    12931230  Py_INCREF(__pyx_v_self);
    12941231
    1295   /* "/Users/dugsong/projects/pypcap/pcap.pyx":329 */
     1232  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":329 */
    12961233  pcap_ex_setup(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap);
    12971234
    1298   /* "/Users/dugsong/projects/pypcap/pcap.pyx":330 */
     1235  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":330 */
    12991236  Py_INCREF(__pyx_v_self);
    13001237  __pyx_r = __pyx_v_self;
    13011238  goto __pyx_L0;
    13021239
    1303   __pyx_r = Py_None; Py_INCREF(__pyx_r);
    1304   goto __pyx_L0;
    1305   __pyx_L1:;
    1306   __Pyx_AddTraceback("pcap.pcap.__iter__");
    1307   __pyx_r = 0;
     1240  __pyx_r = Py_None; Py_INCREF(Py_None);
    13081241  __pyx_L0:;
    13091242  Py_DECREF(__pyx_v_self);
    13101243  return __pyx_r;
    13111244}
    13121245
    1313 static PyObject *__pyx_n_StopIteration;
    1314 
    13151246static PyObject *__pyx_f_4pcap_4pcap___next__(PyObject *__pyx_v_self); /*proto*/
    13161247static PyObject *__pyx_f_4pcap_4pcap___next__(PyObject *__pyx_v_self) {
    1317   struct pcap_pkthdr (*__pyx_v_hdr);
    1318   char (*__pyx_v_pkt);
     1248  struct pcap_pkthdr *__pyx_v_hdr;
     1249  char *__pyx_v_pkt;
    13191250  int __pyx_v_n;
    13201251  PyObject *__pyx_r;
    13211252  long __pyx_1;
     
    13251256  PyObject *__pyx_5 = 0;
    13261257  Py_INCREF(__pyx_v_self);
    13271258
    1328   /* "/Users/dugsong/projects/pypcap/pcap.pyx":336 */
     1259  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":336 */
    13291260  while (1) {
    1330     __pyx_L2:;
    13311261    __pyx_1 = 1;
    13321262    if (!__pyx_1) break;
    13331263
    1334     /* "/Users/dugsong/projects/pypcap/pcap.pyx":337 */
     1264    /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":337 */
    13351265    Py_BEGIN_ALLOW_THREADS;
    13361266
    1337     /* "/Users/dugsong/projects/pypcap/pcap.pyx":338 */
     1267    /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":338 */
    13381268    __pyx_v_n = pcap_ex_next(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap,(&__pyx_v_hdr),(&__pyx_v_pkt));
    13391269
    1340     /* "/Users/dugsong/projects/pypcap/pcap.pyx":339 */
     1270    /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":339 */
    13411271    Py_END_ALLOW_THREADS;
    13421272
    1343     /* "/Users/dugsong/projects/pypcap/pcap.pyx":340 */
     1273    /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":340 */
    13441274    __pyx_2 = (__pyx_v_n == 1);
    13451275    if (__pyx_2) {
    1346 
    1347       /* "/Users/dugsong/projects/pypcap/pcap.pyx":341 */
    13481276      __pyx_3 = PyFloat_FromDouble((__pyx_v_hdr->ts.tv_sec + (__pyx_v_hdr->ts.tv_usec / 1000000.0))); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; goto __pyx_L1;}
    13491277      __pyx_4 = PyBuffer_FromMemory(__pyx_v_pkt,__pyx_v_hdr->caplen); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; goto __pyx_L1;}
    13501278      __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; goto __pyx_L1;}
     
    13591287    }
    13601288    __pyx_2 = (__pyx_v_n == (-1));
    13611289    if (__pyx_2) {
    1362 
    1363       /* "/Users/dugsong/projects/pypcap/pcap.pyx":344 */
    1364       __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_KeyboardInterrupt); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; goto __pyx_L1;}
    1365       __Pyx_Raise(__pyx_3, 0, 0);
    1366       Py_DECREF(__pyx_3); __pyx_3 = 0;
     1290      __Pyx_Raise(PyExc_KeyboardInterrupt, 0, 0);
    13671291      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; goto __pyx_L1;}
    13681292      goto __pyx_L4;
    13691293    }
    13701294    __pyx_2 = (__pyx_v_n == (-2));
    13711295    if (__pyx_2) {
    1372 
    1373       /* "/Users/dugsong/projects/pypcap/pcap.pyx":346 */
    1374       __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_StopIteration); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; goto __pyx_L1;}
    1375       __Pyx_Raise(__pyx_4, 0, 0);
    1376       Py_DECREF(__pyx_4); __pyx_4 = 0;
     1296      __Pyx_Raise(PyExc_StopIteration, 0, 0);
    13771297      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; goto __pyx_L1;}
    13781298      goto __pyx_L4;
    13791299    }
    13801300    __pyx_L4:;
    13811301  }
    1382   __pyx_L3:;
    13831302
    1384   __pyx_r = Py_None; Py_INCREF(__pyx_r);
     1303  __pyx_r = Py_None; Py_INCREF(Py_None);
    13851304  goto __pyx_L0;
    13861305  __pyx_L1:;
    13871306  Py_XDECREF(__pyx_3);
     
    13991318  int __pyx_1;
    14001319  Py_INCREF(__pyx_v_self);
    14011320
    1402   /* "/Users/dugsong/projects/pypcap/pcap.pyx":349 */
     1321  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":349 */
    14031322  __pyx_1 = (((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__name != 0);
    14041323  if (__pyx_1) {
    1405 
    1406     /* "/Users/dugsong/projects/pypcap/pcap.pyx":350 */
    14071324    free(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__name);
    14081325    goto __pyx_L2;
    14091326  }
    14101327  __pyx_L2:;
    14111328
    1412   /* "/Users/dugsong/projects/pypcap/pcap.pyx":351 */
     1329  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":351 */
    14131330  __pyx_1 = (((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__filter != 0);
    14141331  if (__pyx_1) {
    1415 
    1416     /* "/Users/dugsong/projects/pypcap/pcap.pyx":352 */
    14171332    free(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__filter);
    14181333    goto __pyx_L3;
    14191334  }
    14201335  __pyx_L3:;
    14211336
    1422   /* "/Users/dugsong/projects/pypcap/pcap.pyx":353 */
     1337  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":353 */
    14231338  __pyx_1 = (((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap != 0);
    14241339  if (__pyx_1) {
    1425 
    1426     /* "/Users/dugsong/projects/pypcap/pcap.pyx":354 */
    14271340    pcap_close(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap);
    14281341    goto __pyx_L4;
    14291342  }
    14301343  __pyx_L4:;
    14311344
    1432   goto __pyx_L0;
    1433   __pyx_L1:;
    1434   __Pyx_AddTraceback("pcap.pcap.__dealloc__");
    1435   __pyx_L0:;
    14361345  Py_DECREF(__pyx_v_self);
    14371346}
    14381347
    14391348static PyObject *__pyx_f_4pcap_ex_name(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    14401349static PyObject *__pyx_f_4pcap_ex_name(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
    1441   char (*__pyx_v_foo);
     1350  char *__pyx_v_foo;
    14421351  PyObject *__pyx_r;
    14431352  PyObject *__pyx_1 = 0;
    14441353  static char *__pyx_argnames[] = {"foo",0};
    14451354  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "s", __pyx_argnames, &__pyx_v_foo)) return 0;
    1446 
    1447   /* "/Users/dugsong/projects/pypcap/pcap.pyx":357 */
    14481355  __pyx_1 = PyString_FromString(pcap_ex_name(__pyx_v_foo)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; goto __pyx_L1;}
    14491356  __pyx_r = __pyx_1;
    14501357  __pyx_1 = 0;
    14511358  goto __pyx_L0;
    14521359
    1453   __pyx_r = Py_None; Py_INCREF(__pyx_r);
     1360  __pyx_r = Py_None; Py_INCREF(Py_None);
    14541361  goto __pyx_L0;
    14551362  __pyx_L1:;
    14561363  Py_XDECREF(__pyx_1);
     
    14631370static PyObject *__pyx_f_4pcap_lookupdev(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    14641371static char __pyx_doc_4pcap_lookupdev[] = "Return the name of a network device suitable for sniffing.";
    14651372static PyObject *__pyx_f_4pcap_lookupdev(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
    1466   char (*__pyx_v_p);
    1467   char (__pyx_v_ebuf[256]);
     1373  char *__pyx_v_p;
     1374  char __pyx_v_ebuf[256];
    14681375  PyObject *__pyx_r;
    14691376  int __pyx_1;
    14701377  PyObject *__pyx_2 = 0;
    1471   PyObject *__pyx_3 = 0;
    14721378  static char *__pyx_argnames[] = {0};
    14731379  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
    14741380
    1475   /* "/Users/dugsong/projects/pypcap/pcap.pyx":362 */
     1381  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":362 */
    14761382  __pyx_v_p = pcap_ex_lookupdev(__pyx_v_ebuf);
    14771383
    1478   /* "/Users/dugsong/projects/pypcap/pcap.pyx":363 */
    1479   __pyx_1 = (__pyx_v_p == 0);
     1384  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":363 */
     1385  __pyx_1 = (__pyx_v_p == NULL);
    14801386  if (__pyx_1) {
    1481 
    1482     /* "/Users/dugsong/projects/pypcap/pcap.pyx":364 */
    1483     __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; goto __pyx_L1;}
    1484     __pyx_3 = PyString_FromString(__pyx_v_ebuf); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; goto __pyx_L1;}
    1485     __Pyx_Raise(__pyx_2, __pyx_3, 0);
     1387    __pyx_2 = PyString_FromString(__pyx_v_ebuf); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; goto __pyx_L1;}
     1388    __Pyx_Raise(PyExc_OSError, __pyx_2, 0);
    14861389    Py_DECREF(__pyx_2); __pyx_2 = 0;
    1487     Py_DECREF(__pyx_3); __pyx_3 = 0;
    14881390    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; goto __pyx_L1;}
    14891391    goto __pyx_L2;
    14901392  }
    14911393  __pyx_L2:;
    14921394
    1493   /* "/Users/dugsong/projects/pypcap/pcap.pyx":365 */
     1395  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":365 */
    14941396  __pyx_2 = PyString_FromString(__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; goto __pyx_L1;}
    14951397  __pyx_r = __pyx_2;
    14961398  __pyx_2 = 0;
    14971399  goto __pyx_L0;
    14981400
    1499   __pyx_r = Py_None; Py_INCREF(__pyx_r);
     1401  __pyx_r = Py_None; Py_INCREF(Py_None);
    15001402  goto __pyx_L0;
    15011403  __pyx_L1:;
    15021404  Py_XDECREF(__pyx_2);
    1503   Py_XDECREF(__pyx_3);
    15041405  __Pyx_AddTraceback("pcap.lookupdev");
    15051406  __pyx_r = 0;
    15061407  __pyx_L0:;
    15071408  return __pyx_r;
    15081409}
    15091410
    1510 static __Pyx_InternTabEntry __pyx_intern_tab[] = {
    1511   {&__pyx_n_DLT_ARCNET, "DLT_ARCNET"},
    1512   {&__pyx_n_DLT_AX25, "DLT_AX25"},
    1513   {&__pyx_n_DLT_CHAOS, "DLT_CHAOS"},
    1514   {&__pyx_n_DLT_EN10MB, "DLT_EN10MB"},
    1515   {&__pyx_n_DLT_EN3MB, "DLT_EN3MB"},
    1516   {&__pyx_n_DLT_FDDI, "DLT_FDDI"},
    1517   {&__pyx_n_DLT_IEEE802, "DLT_IEEE802"},
    1518   {&__pyx_n_DLT_LINUX_SLL, "DLT_LINUX_SLL"},
    1519   {&__pyx_n_DLT_LOOP, "DLT_LOOP"},
    1520   {&__pyx_n_DLT_NULL, "DLT_NULL"},
    1521   {&__pyx_n_DLT_PFLOG, "DLT_PFLOG"},
    1522   {&__pyx_n_DLT_PFSYNC, "DLT_PFSYNC"},
    1523   {&__pyx_n_DLT_PPP, "DLT_PPP"},
    1524   {&__pyx_n_DLT_PRONET, "DLT_PRONET"},
    1525   {&__pyx_n_DLT_RAW, "DLT_RAW"},
    1526   {&__pyx_n_DLT_SLIP, "DLT_SLIP"},
    1527   {&__pyx_n_False, "False"},
    1528   {&__pyx_n_IOError, "IOError"},
    1529   {&__pyx_n_KeyError, "KeyError"},
    1530   {&__pyx_n_KeyboardInterrupt, "KeyboardInterrupt"},
    1531   {&__pyx_n_OSError, "OSError"},
    1532   {&__pyx_n_StopIteration, "StopIteration"},
    1533   {&__pyx_n_True, "True"},
    1534   {&__pyx_n___add_pkts, "__add_pkts"},
    1535   {&__pyx_n___author__, "__author__"},
    1536   {&__pyx_n___copyright__, "__copyright__"},
    1537   {&__pyx_n___license__, "__license__"},
    1538   {&__pyx_n___url__, "__url__"},
    1539   {&__pyx_n___version__, "__version__"},
    1540   {&__pyx_n_append, "append"},
    1541   {&__pyx_n_dispatch, "dispatch"},
    1542   {&__pyx_n_dltoff, "dltoff"},
    1543   {&__pyx_n_ex_name, "ex_name"},
    1544   {&__pyx_n_exc_info, "exc_info"},
    1545   {&__pyx_n_find, "find"},
    1546   {&__pyx_n_len, "len"},
    1547   {&__pyx_n_lookupdev, "lookupdev"},
    1548   {&__pyx_n_openbsd, "openbsd"},
    1549   {&__pyx_n_platform, "platform"},
    1550   {&__pyx_n_sys, "sys"},
    1551   {0, 0}
    1552 };
    1553 
    1554 static __Pyx_StringTabEntry __pyx_string_tab[] = {
    1555   {&__pyx_k6p, __pyx_k6, sizeof(__pyx_k6)},
    1556   {&__pyx_k7p, __pyx_k7, sizeof(__pyx_k7)},
    1557   {&__pyx_k8p, __pyx_k8, sizeof(__pyx_k8)},
    1558   {&__pyx_k9p, __pyx_k9, sizeof(__pyx_k9)},
    1559   {&__pyx_k10p, __pyx_k10, sizeof(__pyx_k10)},
    1560   {&__pyx_k21p, __pyx_k21, sizeof(__pyx_k21)},
    1561   {&__pyx_k23p, __pyx_k23, sizeof(__pyx_k23)},
    1562   {0, 0, 0}
    1563 };
    1564 
    15651411static PyObject *__pyx_tp_new_4pcap_bpf(PyTypeObject *t, PyObject *a, PyObject *k) {
    15661412  PyObject *o = (*t->tp_alloc)(t, 0);
    1567   struct __pyx_obj_4pcap_bpf *p = (struct __pyx_obj_4pcap_bpf *)o;
     1413  if (!o) return 0;
    15681414  return o;
    15691415}
    15701416
    15711417static void __pyx_tp_dealloc_4pcap_bpf(PyObject *o) {
    1572   struct __pyx_obj_4pcap_bpf *p = (struct __pyx_obj_4pcap_bpf *)o;
    15731418  {
    15741419    PyObject *etype, *eval, *etb;
    15751420    PyErr_Fetch(&etype, &eval, &etb);
     
    15821427  (*o->ob_type->tp_free)(o);
    15831428}
    15841429
    1585 static int __pyx_tp_traverse_4pcap_bpf(PyObject *o, visitproc v, void *a) {
    1586   int e;
    1587   struct __pyx_obj_4pcap_bpf *p = (struct __pyx_obj_4pcap_bpf *)o;
    1588   return 0;
    1589 }
    1590 
    1591 static int __pyx_tp_clear_4pcap_bpf(PyObject *o) {
    1592   struct __pyx_obj_4pcap_bpf *p = (struct __pyx_obj_4pcap_bpf *)o;
    1593   return 0;
    1594 }
    1595 
    15961430static struct PyMethodDef __pyx_methods_4pcap_bpf[] = {
    15971431  {"filter", (PyCFunction)__pyx_f_4pcap_3bpf_filter, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4pcap_3bpf_filter},
    15981432  {0, 0, 0, 0}
     
    16371471  0, /*nb_true_divide*/
    16381472  0, /*nb_inplace_floor_divide*/
    16391473  0, /*nb_inplace_true_divide*/
     1474  #if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
     1475  0, /*nb_index*/
     1476  #endif
    16401477};
    16411478
    16421479static PySequenceMethods __pyx_tp_as_sequence_bpf = {
     
    16651502  0, /*bf_getcharbuffer*/
    16661503};
    16671504
    1668 statichere PyTypeObject __pyx_type_4pcap_bpf = {
     1505PyTypeObject __pyx_type_4pcap_bpf = {
    16691506  PyObject_HEAD_INIT(0)
    16701507  0, /*ob_size*/
    16711508  "pcap.bpf", /*tp_name*/
     
    16881525  &__pyx_tp_as_buffer_bpf, /*tp_as_buffer*/
    16891526  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE, /*tp_flags*/
    16901527  "bpf(filter, dlt=DLT_RAW) -> BPF filter object", /*tp_doc*/
    1691   __pyx_tp_traverse_4pcap_bpf, /*tp_traverse*/
    1692   __pyx_tp_clear_4pcap_bpf, /*tp_clear*/
     1528  0, /*tp_traverse*/
     1529  0, /*tp_clear*/
    16931530  0, /*tp_richcompare*/
    16941531  0, /*tp_weaklistoffset*/
    16951532  0, /*tp_iter*/
     
    17161553
    17171554static PyObject *__pyx_tp_new_4pcap_pcap(PyTypeObject *t, PyObject *a, PyObject *k) {
    17181555  PyObject *o = (*t->tp_alloc)(t, 0);
    1719   struct __pyx_obj_4pcap_pcap *p = (struct __pyx_obj_4pcap_pcap *)o;
     1556  if (!o) return 0;
    17201557  return o;
    17211558}
    17221559
    17231560static void __pyx_tp_dealloc_4pcap_pcap(PyObject *o) {
    1724   struct __pyx_obj_4pcap_pcap *p = (struct __pyx_obj_4pcap_pcap *)o;
    17251561  {
    17261562    PyObject *etype, *eval, *etb;
    17271563    PyErr_Fetch(&etype, &eval, &etb);
     
    17341570  (*o->ob_type->tp_free)(o);
    17351571}
    17361572
    1737 static int __pyx_tp_traverse_4pcap_pcap(PyObject *o, visitproc v, void *a) {
    1738   int e;
    1739   struct __pyx_obj_4pcap_pcap *p = (struct __pyx_obj_4pcap_pcap *)o;
    1740   return 0;
    1741 }
    1742 
    1743 static int __pyx_tp_clear_4pcap_pcap(PyObject *o) {
    1744   struct __pyx_obj_4pcap_pcap *p = (struct __pyx_obj_4pcap_pcap *)o;
    1745   return 0;
    1746 }
    1747 
    17481573static PyObject *__pyx_getprop_4pcap_4pcap_name(PyObject *o, void *x) {
    17491574  return __pyx_f_4pcap_4pcap_4name___get__(o);
    17501575}
     
    17821607};
    17831608
    17841609static struct PyGetSetDef __pyx_getsets_4pcap_pcap[] = {
    1785   {"name", __pyx_getprop_4pcap_4pcap_name, 0, __pyx_k1, 0},
    1786   {"snaplen", __pyx_getprop_4pcap_4pcap_snaplen, 0, __pyx_k2, 0},
    1787   {"dloff", __pyx_getprop_4pcap_4pcap_dloff, 0, __pyx_k3, 0},
    1788   {"filter", __pyx_getprop_4pcap_4pcap_filter, 0, __pyx_k4, 0},
    1789   {"fd", __pyx_getprop_4pcap_4pcap_fd, 0, __pyx_k5, 0},
     1610  {"name", __pyx_getprop_4pcap_4pcap_name, 0, __pyx_k10, 0},
     1611  {"snaplen", __pyx_getprop_4pcap_4pcap_snaplen, 0, __pyx_k11, 0},
     1612  {"dloff", __pyx_getprop_4pcap_4pcap_dloff, 0, __pyx_k12, 0},
     1613  {"filter", __pyx_getprop_4pcap_4pcap_filter, 0, __pyx_k13, 0},
     1614  {"fd", __pyx_getprop_4pcap_4pcap_fd, 0, __pyx_k14, 0},
    17901615  {0, 0, 0, 0, 0}
    17911616};
    17921617
     
    18291654  0, /*nb_true_divide*/
    18301655  0, /*nb_inplace_floor_divide*/
    18311656  0, /*nb_inplace_true_divide*/
     1657  #if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
     1658  0, /*nb_index*/
     1659  #endif
    18321660};
    18331661
    18341662static PySequenceMethods __pyx_tp_as_sequence_pcap = {
     
    18571685  0, /*bf_getcharbuffer*/
    18581686};
    18591687
    1860 statichere PyTypeObject __pyx_type_4pcap_pcap = {
     1688PyTypeObject __pyx_type_4pcap_pcap = {
    18611689  PyObject_HEAD_INIT(0)
    18621690  0, /*ob_size*/
    18631691  "pcap.pcap", /*tp_name*/
     
    18801708  &__pyx_tp_as_buffer_pcap, /*tp_as_buffer*/
    18811709  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE, /*tp_flags*/
    18821710  "pcap(name=None, snaplen=65535, promisc=True, immediate=False) -> packet capture object\n    \n    Open a handle to a packet capture descriptor.\n    \n    Keyword arguments:\n    name      -- name of a network interface or dumpfile to open,\n                 or None to open the first available up interface\n    snaplen   -- maximum number of bytes to capture for each packet\n    promisc   -- boolean to specify promiscuous mode sniffing\n    immediate -- disable buffering, if possible\n    ", /*tp_doc*/
    1883   __pyx_tp_traverse_4pcap_pcap, /*tp_traverse*/
    1884   __pyx_tp_clear_4pcap_pcap, /*tp_clear*/
     1711  0, /*tp_traverse*/
     1712  0, /*tp_clear*/
    18851713  0, /*tp_richcompare*/
    18861714  0, /*tp_weaklistoffset*/
    18871715  __pyx_f_4pcap_4pcap___iter__, /*tp_iter*/
     
    19121740  {0, 0, 0, 0}
    19131741};
    19141742
    1915 DL_EXPORT(void) initpcap(void); /*proto*/
    1916 DL_EXPORT(void) initpcap(void) {
     1743static void __pyx_init_filenames(void); /*proto*/
     1744
     1745PyMODINIT_FUNC initpcap(void); /*proto*/
     1746PyMODINIT_FUNC initpcap(void) {
    19171747  PyObject *__pyx_1 = 0;
    19181748  PyObject *__pyx_2 = 0;
    19191749  PyObject *__pyx_3 = 0;
    19201750  int __pyx_4;
    19211751  PyObject *__pyx_5 = 0;
    1922   PyObject *__pyx_6 = 0;
    1923   PyObject *__pyx_7 = 0;
    1924   PyObject *__pyx_8 = 0;
     1752  __pyx_init_filenames();
    19251753  __pyx_m = Py_InitModule4("pcap", __pyx_methods, __pyx_mdoc, 0, PYTHON_API_VERSION);
    19261754  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; goto __pyx_L1;};
     1755  Py_INCREF(__pyx_m);
    19271756  __pyx_b = PyImport_AddModule("__builtin__");
    19281757  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; goto __pyx_L1;};
    19291758  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; goto __pyx_L1;};
    1930   if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; goto __pyx_L1;};
    19311759  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; goto __pyx_L1;};
    19321760  if (PyType_Ready(&__pyx_type_4pcap_bpf) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; goto __pyx_L1;}
    19331761  if (PyObject_SetAttrString(__pyx_m, "bpf", (PyObject *)&__pyx_type_4pcap_bpf) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; goto __pyx_L1;}
     
    19361764  if (PyObject_SetAttrString(__pyx_m, "pcap", (PyObject *)&__pyx_type_4pcap_pcap) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; goto __pyx_L1;}
    19371765  __pyx_ptype_4pcap_pcap = &__pyx_type_4pcap_pcap;
    19381766
    1939   /* "/Users/dugsong/projects/pypcap/pcap.pyx":13 */
    1940   if (PyObject_SetAttr(__pyx_m, __pyx_n___author__, __pyx_k6p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; goto __pyx_L1;}
     1767  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":13 */
     1768  if (PyObject_SetAttr(__pyx_m, __pyx_n___author__, __pyx_k15p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; goto __pyx_L1;}
    19411769
    1942   /* "/Users/dugsong/projects/pypcap/pcap.pyx":14 */
    1943   if (PyObject_SetAttr(__pyx_m, __pyx_n___copyright__, __pyx_k7p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; goto __pyx_L1;}
     1770  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":14 */
     1771  if (PyObject_SetAttr(__pyx_m, __pyx_n___copyright__, __pyx_k17p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; goto __pyx_L1;}
    19441772
    1945   /* "/Users/dugsong/projects/pypcap/pcap.pyx":15 */
    1946   if (PyObject_SetAttr(__pyx_m, __pyx_n___license__, __pyx_k8p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; goto __pyx_L1;}
     1773  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":15 */
     1774  if (PyObject_SetAttr(__pyx_m, __pyx_n___license__, __pyx_k19p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; goto __pyx_L1;}
    19471775
    1948   /* "/Users/dugsong/projects/pypcap/pcap.pyx":16 */
    1949   if (PyObject_SetAttr(__pyx_m, __pyx_n___url__, __pyx_k9p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; goto __pyx_L1;}
     1776  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":16 */
     1777  if (PyObject_SetAttr(__pyx_m, __pyx_n___url__, __pyx_k21p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; goto __pyx_L1;}
    19501778
    1951   /* "/Users/dugsong/projects/pypcap/pcap.pyx":17 */
    1952   if (PyObject_SetAttr(__pyx_m, __pyx_n___version__, __pyx_k10p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;}
     1779  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":17 */
     1780  if (PyObject_SetAttr(__pyx_m, __pyx_n___version__, __pyx_k23p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;}
    19531781
    1954   /* "/Users/dugsong/projects/pypcap/pcap.pyx":19 */
     1782  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":19 */
    19551783  __pyx_1 = __Pyx_Import(__pyx_n_sys, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; goto __pyx_L1;}
    19561784  if (PyObject_SetAttr(__pyx_m, __pyx_n_sys, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; goto __pyx_L1;}
    19571785  Py_DECREF(__pyx_1); __pyx_1 = 0;
    19581786
    1959   /* "/Users/dugsong/projects/pypcap/pcap.pyx":102 */
     1787  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":102 */
    19601788  __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; goto __pyx_L1;}
    19611789  if (PyObject_SetAttr(__pyx_m, __pyx_n_DLT_NULL, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; goto __pyx_L1;}
    19621790  Py_DECREF(__pyx_1); __pyx_1 = 0;
    19631791
    1964   /* "/Users/dugsong/projects/pypcap/pcap.pyx":103 */
     1792  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":103 */
    19651793  __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; goto __pyx_L1;}
    19661794  if (PyObject_SetAttr(__pyx_m, __pyx_n_DLT_EN10MB, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; goto __pyx_L1;}
    19671795  Py_DECREF(__pyx_1); __pyx_1 = 0;
    19681796
    1969   /* "/Users/dugsong/projects/pypcap/pcap.pyx":104 */
     1797  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":104 */
    19701798  __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; goto __pyx_L1;}
    19711799  if (PyObject_SetAttr(__pyx_m, __pyx_n_DLT_EN3MB, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; goto __pyx_L1;}
    19721800  Py_DECREF(__pyx_1); __pyx_1 = 0;
    19731801
    1974   /* "/Users/dugsong/projects/pypcap/pcap.pyx":105 */
     1802  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":105 */
    19751803  __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L1;}
    19761804  if (PyObject_SetAttr(__pyx_m, __pyx_n_DLT_AX25, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L1;}
    19771805  Py_DECREF(__pyx_1); __pyx_1 = 0;
    19781806
    1979   /* "/Users/dugsong/projects/pypcap/pcap.pyx":106 */
     1807  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":106 */
    19801808  __pyx_1 = PyInt_FromLong(4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; goto __pyx_L1;}
    19811809  if (PyObject_SetAttr(__pyx_m, __pyx_n_DLT_PRONET, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; goto __pyx_L1;}
    19821810  Py_DECREF(__pyx_1); __pyx_1 = 0;
    19831811
    1984   /* "/Users/dugsong/projects/pypcap/pcap.pyx":107 */
     1812  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":107 */
    19851813  __pyx_1 = PyInt_FromLong(5); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;}
    19861814  if (PyObject_SetAttr(__pyx_m, __pyx_n_DLT_CHAOS, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;}
    19871815  Py_DECREF(__pyx_1); __pyx_1 = 0;
    19881816
    1989   /* "/Users/dugsong/projects/pypcap/pcap.pyx":108 */
     1817  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":108 */
    19901818  __pyx_1 = PyInt_FromLong(6); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;}
    19911819  if (PyObject_SetAttr(__pyx_m, __pyx_n_DLT_IEEE802, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;}
    19921820  Py_DECREF(__pyx_1); __pyx_1 = 0;
    19931821
    1994   /* "/Users/dugsong/projects/pypcap/pcap.pyx":109 */
     1822  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":109 */
    19951823  __pyx_1 = PyInt_FromLong(7); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; goto __pyx_L1;}
    19961824  if (PyObject_SetAttr(__pyx_m, __pyx_n_DLT_ARCNET, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; goto __pyx_L1;}
    19971825  Py_DECREF(__pyx_1); __pyx_1 = 0;
    19981826
    1999   /* "/Users/dugsong/projects/pypcap/pcap.pyx":110 */
     1827  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":110 */
    20001828  __pyx_1 = PyInt_FromLong(8); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}
    20011829  if (PyObject_SetAttr(__pyx_m, __pyx_n_DLT_SLIP, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}
    20021830  Py_DECREF(__pyx_1); __pyx_1 = 0;
    20031831
    2004   /* "/Users/dugsong/projects/pypcap/pcap.pyx":111 */
     1832  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":111 */
    20051833  __pyx_1 = PyInt_FromLong(9); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; goto __pyx_L1;}
    20061834  if (PyObject_SetAttr(__pyx_m, __pyx_n_DLT_PPP, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; goto __pyx_L1;}
    20071835  Py_DECREF(__pyx_1); __pyx_1 = 0;
    20081836
    2009   /* "/Users/dugsong/projects/pypcap/pcap.pyx":112 */
     1837  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":112 */
    20101838  __pyx_1 = PyInt_FromLong(10); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; goto __pyx_L1;}
    20111839  if (PyObject_SetAttr(__pyx_m, __pyx_n_DLT_FDDI, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; goto __pyx_L1;}
    20121840  Py_DECREF(__pyx_1); __pyx_1 = 0;
    20131841
    2014   /* "/Users/dugsong/projects/pypcap/pcap.pyx":114 */
     1842  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":114 */
    20151843  __pyx_1 = PyInt_FromLong(113); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;}
    20161844  if (PyObject_SetAttr(__pyx_m, __pyx_n_DLT_LINUX_SLL, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;}
    20171845  Py_DECREF(__pyx_1); __pyx_1 = 0;
    20181846
    2019   /* "/Users/dugsong/projects/pypcap/pcap.pyx":116 */
     1847  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":116 */
    20201848  __pyx_1 = PyInt_FromLong(117); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;}
    20211849  if (PyObject_SetAttr(__pyx_m, __pyx_n_DLT_PFLOG, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;}
    20221850  Py_DECREF(__pyx_1); __pyx_1 = 0;
    20231851
    2024   /* "/Users/dugsong/projects/pypcap/pcap.pyx":117 */
     1852  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":117 */
    20251853  __pyx_1 = PyInt_FromLong(18); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; goto __pyx_L1;}
    20261854  if (PyObject_SetAttr(__pyx_m, __pyx_n_DLT_PFSYNC, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; goto __pyx_L1;}
    20271855  Py_DECREF(__pyx_1); __pyx_1 = 0;
    20281856
    2029   /* "/Users/dugsong/projects/pypcap/pcap.pyx":118 */
     1857  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":118 */
    20301858  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_sys); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; goto __pyx_L1;}
    20311859  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_platform); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; goto __pyx_L1;}
    20321860  Py_DECREF(__pyx_1); __pyx_1 = 0;
     
    20451873  Py_DECREF(__pyx_1); __pyx_1 = 0;
    20461874  if (__pyx_4) {
    20471875
    2048     /* "/Users/dugsong/projects/pypcap/pcap.pyx":119 */
     1876    /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":119 */
    20491877    __pyx_2 = PyInt_FromLong(12); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; goto __pyx_L1;}
    20501878    if (PyObject_SetAttr(__pyx_m, __pyx_n_DLT_LOOP, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; goto __pyx_L1;}
    20511879    Py_DECREF(__pyx_2); __pyx_2 = 0;
    20521880
    2053     /* "/Users/dugsong/projects/pypcap/pcap.pyx":120 */
     1881    /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":120 */
    20541882    __pyx_3 = PyInt_FromLong(14); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L1;}
    20551883    if (PyObject_SetAttr(__pyx_m, __pyx_n_DLT_RAW, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L1;}
    20561884    Py_DECREF(__pyx_3); __pyx_3 = 0;
     
    20581886  }
    20591887  /*else*/ {
    20601888
    2061     /* "/Users/dugsong/projects/pypcap/pcap.pyx":122 */
     1889    /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":122 */
    20621890    __pyx_1 = PyInt_FromLong(108); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; goto __pyx_L1;}
    20631891    if (PyObject_SetAttr(__pyx_m, __pyx_n_DLT_LOOP, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; goto __pyx_L1;}
    20641892    Py_DECREF(__pyx_1); __pyx_1 = 0;
    20651893
    2066     /* "/Users/dugsong/projects/pypcap/pcap.pyx":123 */
     1894    /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":123 */
    20671895    __pyx_2 = PyInt_FromLong(12); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; goto __pyx_L1;}
    20681896    if (PyObject_SetAttr(__pyx_m, __pyx_n_DLT_RAW, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; goto __pyx_L1;}
    20691897    Py_DECREF(__pyx_2); __pyx_2 = 0;
    20701898  }
    20711899  __pyx_L3:;
    20721900
    2073   /* "/Users/dugsong/projects/pypcap/pcap.pyx":125 */
     1901  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":125 */
    20741902  __pyx_3 = PyDict_New(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; goto __pyx_L1;}
    20751903  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_DLT_NULL); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; goto __pyx_L1;}
    20761904  __pyx_2 = PyInt_FromLong(4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; goto __pyx_L1;}
     
    21351963  if (PyObject_SetAttr(__pyx_m, __pyx_n_dltoff, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; goto __pyx_L1;}
    21361964  Py_DECREF(__pyx_3); __pyx_3 = 0;
    21371965
    2138   /* "/Users/dugsong/projects/pypcap/pcap.pyx":132 */
     1966  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":132 */
    21391967  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_DLT_RAW); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; goto __pyx_L1;}
    2140   __pyx_k13 = __pyx_1;
     1968  __pyx_d1 = __pyx_1;
    21411969  __pyx_1 = 0;
    21421970
    2143   /* "/Users/dugsong/projects/pypcap/pcap.pyx":163 */
     1971  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":163 */
    21441972  Py_INCREF(Py_None);
    2145   __pyx_k14 = Py_None;
     1973  __pyx_d2 = Py_None;
    21461974  __pyx_2 = PyInt_FromLong(65535); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; goto __pyx_L1;}
    2147   __pyx_k15 = __pyx_2;
     1975  __pyx_d3 = __pyx_2;
    21481976  __pyx_2 = 0;
    2149   __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_True); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; goto __pyx_L1;}
    2150   __pyx_k16 = __pyx_3;
     1977  Py_INCREF(Py_True);
     1978  __pyx_d4 = Py_True;
     1979  __pyx_3 = PyInt_FromLong(500); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;}
     1980  __pyx_d5 = __pyx_3;
    21511981  __pyx_3 = 0;
    2152   __pyx_5 = PyInt_FromLong(500); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;}
    2153   __pyx_k17 = __pyx_5;
     1982  Py_INCREF(Py_False);
     1983  __pyx_d6 = Py_False;
     1984
     1985  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":218 */
     1986  __pyx_5 = PyInt_FromLong(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; goto __pyx_L1;}
     1987  __pyx_d7 = __pyx_5;
    21541988  __pyx_5 = 0;
    2155   __pyx_6 = __Pyx_GetName(__pyx_b, __pyx_n_False); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;}
    2156   __pyx_k18 = __pyx_6;
    2157   __pyx_6 = 0;
    2158 
    2159   /* "/Users/dugsong/projects/pypcap/pcap.pyx":218 */
    2160   __pyx_7 = PyInt_FromLong(1); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; goto __pyx_L1;}
    2161   __pyx_k19 = __pyx_7;
    2162   __pyx_7 = 0;
    2163 
    2164   /* "/Users/dugsong/projects/pypcap/pcap.pyx":229 */
    2165   __pyx_8 = __Pyx_GetName(__pyx_b, __pyx_n_True); if (!__pyx_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; goto __pyx_L1;}
    2166   __pyx_k20 = __pyx_8;
    2167   __pyx_8 = 0;
    21681989
    2169   /* "/Users/dugsong/projects/pypcap/pcap.pyx":359 */
     1990  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":229 */
     1991  Py_INCREF(Py_True);
     1992  __pyx_d8 = Py_True;
     1993
     1994  /* "/Users/areusch/Build/pypcap-1.1/pcap.pyx":359 */
    21701995  return;
    21711996  __pyx_L1:;
    21721997  Py_XDECREF(__pyx_1);
    21731998  Py_XDECREF(__pyx_2);
    21741999  Py_XDECREF(__pyx_3);
    21752000  Py_XDECREF(__pyx_5);
    2176   Py_XDECREF(__pyx_6);
    2177   Py_XDECREF(__pyx_7);
    2178   Py_XDECREF(__pyx_8);
    21792001  __Pyx_AddTraceback("pcap");
    21802002}
    21812003
    21822004static char *__pyx_filenames[] = {
    21832005  "pcap.pyx",
    21842006};
    2185 statichere char **__pyx_f = __pyx_filenames;
    21862007
    21872008/* Runtime support code */
    21882009
     2010static void __pyx_init_filenames(void) {
     2011  __pyx_f = __pyx_filenames;
     2012}
     2013
     2014static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
     2015    if (value == Py_None)
     2016        value = NULL;
     2017    if (tb == Py_None)
     2018        tb = NULL;
     2019    Py_XINCREF(type);
     2020    Py_XINCREF(value);
     2021    Py_XINCREF(tb);
     2022    if (tb && !PyTraceBack_Check(tb)) {
     2023        PyErr_SetString(PyExc_TypeError,
     2024            "raise: arg 3 must be a traceback or None");
     2025        goto raise_error;
     2026    }
     2027    #if PY_VERSION_HEX < 0x02050000
     2028    if (!PyClass_Check(type))
     2029    #else
     2030    if (!PyType_Check(type))
     2031    #endif
     2032    {
     2033        /* Raising an instance.  The value should be a dummy. */
     2034        if (value) {
     2035            PyErr_SetString(PyExc_TypeError,
     2036                "instance exception may not have a separate value");
     2037            goto raise_error;
     2038        }
     2039        /* Normalize to raise <class>, <instance> */
     2040        value = type;
     2041        #if PY_VERSION_HEX < 0x02050000
     2042            if (PyInstance_Check(type)) {
     2043                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
     2044                Py_INCREF(type);
     2045            }
     2046            else {
     2047                PyErr_SetString(PyExc_TypeError,
     2048                    "raise: exception must be an old-style class or instance");
     2049                goto raise_error;
     2050            }
     2051        #else
     2052            type = (PyObject*) type->ob_type;
     2053            Py_INCREF(type);
     2054            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
     2055                PyErr_SetString(PyExc_TypeError,
     2056                    "raise: exception class must be a subclass of BaseException");
     2057                goto raise_error;
     2058            }
     2059        #endif
     2060    }
     2061    PyErr_Restore(type, value, tb);
     2062    return;
     2063raise_error:
     2064    Py_XDECREF(value);
     2065    Py_XDECREF(type);
     2066    Py_XDECREF(tb);
     2067    return;
     2068}
     2069
     2070static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
     2071    PyObject *result;
     2072    result = PyObject_GetAttr(dict, name);
     2073    if (!result)
     2074        PyErr_SetObject(PyExc_NameError, name);
     2075    return result;
     2076}
     2077
    21892078static int __Pyx_GetStarArgs(
    21902079    PyObject **args,
    21912080    PyObject **kwds,
    21922081    char *kwd_list[],
    2193     int nargs,
     2082    Py_ssize_t nargs,
    21942083    PyObject **args2,
    2195     PyObject **kwds2)
     2084    PyObject **kwds2,
     2085    char rqd_kwds[])
    21962086{
    21972087    PyObject *x = 0, *args1 = 0, *kwds1 = 0;
     2088    int i;
     2089    char **p;
    21982090   
    21992091    if (args2)
    22002092        *args2 = 0;
     
    22052097        args1 = PyTuple_GetSlice(*args, 0, nargs);
    22062098        if (!args1)
    22072099            goto bad;
    2208         *args2 = PyTuple_GetSlice(*args, nargs, PyTuple_Size(*args));
     2100        *args2 = PyTuple_GetSlice(*args, nargs, PyTuple_GET_SIZE(*args));
    22092101        if (!*args2)
    22102102            goto bad;
    22112103    }
     2104    else if (PyTuple_GET_SIZE(*args) > nargs) {
     2105        int m = nargs;
     2106        int n = PyTuple_GET_SIZE(*args);
     2107        PyErr_Format(PyExc_TypeError,
     2108            "function takes at most %d positional arguments (%d given)",
     2109                m, n);
     2110        goto bad;
     2111    }
    22122112    else {
    22132113        args1 = *args;
    22142114        Py_INCREF(args1);
    22152115    }
    22162116   
     2117    if (rqd_kwds && !*kwds)
     2118            for (i = 0, p = kwd_list; *p; i++, p++)
     2119                if (rqd_kwds[i])
     2120                    goto missing_kwarg;
     2121   
    22172122    if (kwds2) {
    22182123        if (*kwds) {
    2219             char **p;
    22202124            kwds1 = PyDict_New();
    2221             if (!kwds)
     2125            if (!kwds1)
    22222126                goto bad;
    22232127            *kwds2 = PyDict_Copy(*kwds);
    22242128            if (!*kwds2)
    22252129                goto bad;
    2226             for (p = kwd_list; *p; p++) {
     2130            for (i = 0, p = kwd_list; *p; i++, p++) {
    22272131                x = PyDict_GetItemString(*kwds, *p);
    22282132                if (x) {
    22292133                    if (PyDict_SetItemString(kwds1, *p, x) < 0)
     
    22312135                    if (PyDict_DelItemString(*kwds2, *p) < 0)
    22322136                        goto bad;
    22332137                }
     2138                else if (rqd_kwds && rqd_kwds[i])
     2139                    goto missing_kwarg;
    22342140            }
    22352141        }
    22362142        else {
     
    22422148    else {
    22432149        kwds1 = *kwds;
    22442150        Py_XINCREF(kwds1);
     2151        if (rqd_kwds && *kwds)
     2152            for (i = 0, p = kwd_list; *p; i++, p++)
     2153                if (rqd_kwds[i] && !PyDict_GetItemString(*kwds, *p))
     2154                        goto missing_kwarg;
    22452155    }
    22462156   
    22472157    *args = args1;
    22482158    *kwds = kwds1;
    22492159    return 0;
     2160missing_kwarg:
     2161    PyErr_Format(PyExc_TypeError,
     2162        "required keyword argument '%s' is missing", *p);
    22502163bad:
    22512164    Py_XDECREF(args1);
    22522165    Py_XDECREF(kwds1);
    2253     if (*args2)
     2166    if (args2) {
    22542167        Py_XDECREF(*args2);
    2255     if (*kwds2)
     2168    }
     2169    if (kwds2) {
    22562170        Py_XDECREF(*kwds2);
     2171    }
    22572172    return -1;
    22582173}
    22592174
     2175static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
     2176    while (t->p) {
     2177        *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
     2178        if (!*t->p)
     2179            return -1;
     2180        if (t->i)
     2181            PyString_InternInPlace(t->p);
     2182        ++t;
     2183    }
     2184    return 0;
     2185}
     2186
    22602187static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
    22612188    PyObject *__import__ = 0;
    22622189    PyObject *empty_list = 0;
     
    22902217    return module;
    22912218}
    22922219
    2293 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
    2294     PyObject *result;
    2295     result = PyObject_GetAttr(dict, name);
    2296     if (!result)
    2297         PyErr_SetObject(PyExc_NameError, name);
    2298     return result;
    2299 }
    2300 
    2301 static PyObject *__Pyx_GetExcValue(void) {
    2302     PyObject *type = 0, *value = 0, *tb = 0;
    2303     PyObject *result = 0;
    2304     PyThreadState *tstate = PyThreadState_Get();
    2305     PyErr_Fetch(&type, &value, &tb);
    2306     PyErr_NormalizeException(&type, &value, &tb);
    2307     if (PyErr_Occurred())
    2308         goto bad;
    2309     if (!value) {
    2310         value = Py_None;
    2311         Py_INCREF(value);
    2312     }
    2313     Py_XDECREF(tstate->exc_type);
    2314     Py_XDECREF(tstate->exc_value);
    2315     Py_XDECREF(tstate->exc_traceback);
    2316     tstate->exc_type = type;
    2317     tstate->exc_value = value;
    2318     tstate->exc_traceback = tb;
    2319     result = value;
    2320     Py_XINCREF(result);
    2321     type = 0;
    2322     value = 0;
    2323     tb = 0;
    2324 bad:
    2325     Py_XDECREF(type);
    2326     Py_XDECREF(value);
    2327     Py_XDECREF(tb);
    2328     return result;
    2329 }
    2330 
    2331 static void __Pyx_WriteUnraisable(char *name) {
    2332     PyObject *old_exc, *old_val, *old_tb;
    2333     PyObject *ctx;
    2334     PyErr_Fetch(&old_exc, &old_val, &old_tb);
    2335     ctx = PyString_FromString(name);
    2336     PyErr_Restore(old_exc, old_val, old_tb);
    2337     if (!ctx)
    2338         ctx = Py_None;
    2339     PyErr_WriteUnraisable(ctx);
    2340 }
    2341 
    2342 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
    2343     Py_XINCREF(type);
    2344     Py_XINCREF(value);
    2345     Py_XINCREF(tb);
    2346     /* First, check the traceback argument, replacing None with NULL. */
    2347     if (tb == Py_None) {
    2348         Py_DECREF(tb);
    2349         tb = 0;
    2350     }
    2351     else if (tb != NULL && !PyTraceBack_Check(tb)) {
    2352         PyErr_SetString(PyExc_TypeError,
    2353             "raise: arg 3 must be a traceback or None");
    2354         goto raise_error;
    2355     }
    2356     /* Next, replace a missing value with None */
    2357     if (value == NULL) {
    2358         value = Py_None;
    2359         Py_INCREF(value);
    2360     }
    2361     /* Next, repeatedly, replace a tuple exception with its first item */
    2362     while (PyTuple_Check(type) && PyTuple_Size(type) > 0) {
    2363         PyObject *tmp = type;
    2364         type = PyTuple_GET_ITEM(type, 0);
    2365         Py_INCREF(type);
    2366         Py_DECREF(tmp);
    2367     }
    2368     if (PyString_Check(type))
    2369         ;
    2370     else if (PyClass_Check(type))
    2371         ; /*PyErr_NormalizeException(&type, &value, &tb);*/
    2372     else if (PyInstance_Check(type)) {
    2373         /* Raising an instance.  The value should be a dummy. */
    2374         if (value != Py_None) {
    2375             PyErr_SetString(PyExc_TypeError,
    2376               "instance exception may not have a separate value");
    2377             goto raise_error;
    2378         }
    2379         else {
    2380             /* Normalize to raise <class>, <instance> */
    2381             Py_DECREF(value);
    2382             value = type;
    2383             type = (PyObject*) ((PyInstanceObject*)type)->in_class;
    2384             Py_INCREF(type);
    2385         }
    2386     }
    2387     else {
    2388         /* Not something you can raise.  You get an exception
    2389            anyway, just not what you specified :-) */
    2390         PyErr_Format(PyExc_TypeError,
    2391                  "exceptions must be strings, classes, or "
    2392                  "instances, not %s", type->ob_type->tp_name);
    2393         goto raise_error;
    2394     }
    2395     PyErr_Restore(type, value, tb);
    2396     return;
    2397 raise_error:
    2398     Py_XDECREF(value);
    2399     Py_XDECREF(type);
    2400     Py_XDECREF(tb);
    2401     return;
    2402 }
    2403 
    2404 static int __Pyx_InternStrings(__Pyx_InternTabEntry *t) {
    2405     while (t->p) {
    2406         *t->p = PyString_InternFromString(t->s);
    2407         if (!*t->p)
    2408             return -1;
    2409         ++t;
    2410     }
    2411     return 0;
    2412 }
    2413 
    2414 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    2415     while (t->p) {
    2416         *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
    2417         if (!*t->p)
    2418             return -1;
    2419         ++t;
    2420     }
    2421     return 0;
    2422 }
    2423 
    24242220#include "compile.h"
    24252221#include "frameobject.h"
    24262222#include "traceback.h"