Logo Search packages:      
Sourcecode: ncap version File versions  Download package

ncap.c

/* Generated by Pyrex 0.9.8.5 on Sat Dec  5 12:16:58 2009 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "structmember.h"
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#if PY_VERSION_HEX < 0x02050000
  typedef int Py_ssize_t;
  #define PY_SSIZE_T_MAX INT_MAX
  #define PY_SSIZE_T_MIN INT_MIN
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)  PyInt_AsLong(o)
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
#endif
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#include <math.h>
#include "sys/types.h"
#include "stdio.h"
#include "time.h"
#include "stdlib.h"
#include "ncap.h"
#include "wrap.h"


00038 typedef struct {PyObject **p; int i; char *s; long n;} __Pyx_StringTabEntry; /*proto*/

static PyObject *__pyx_m;
static PyObject *__pyx_b;
static int __pyx_lineno;
static char *__pyx_filename;
static char **__pyx_f;

static void __Pyx_WriteUnraisable(char *name); /*proto*/

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/

static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, char *modname); /*proto*/

static void __Pyx_AddTraceback(char *funcname); /*proto*/

/* Declarations from ncap */


/* Declarations from implementation of ncap */

00063 struct __pyx_obj_4ncap_NCapFile {
  PyObject_HEAD
  FILE *_fp;
};

00068 struct __pyx_obj_4ncap_NCap {
  PyObject_HEAD
  ncap_t _ncap;
  PyObject *_files;
};



static PyTypeObject *__pyx_ptype_4ncap_NCapFile = 0;
static PyTypeObject *__pyx_ptype_4ncap_NCap = 0;
static void __pyx_f_4ncap_callback(ncap_t,void *,ncap_msg_ct,char *); /*proto*/

static char __pyx_k1[] = "fileno";
static char __pyx_k2[] = "r";
static char __pyx_k3[] = "NCapError";
static char __pyx_k4[] = "Cannot create file from %s";
static char __pyx_k5[] = "range";
static char __pyx_k6[] = "has_key";
static char __pyx_k7[] = "already associated fd %d";
static char __pyx_k8[] = "the fd is not associated: %d";
static char __pyx_k9[] = "_fp";
static char __pyx_k10[] = "cannot convert to ncap_msg";

static PyObject *__pyx_n_NCapError;
static PyObject *__pyx_n__fp;
static PyObject *__pyx_n_fileno;
static PyObject *__pyx_n_has_key;
static PyObject *__pyx_n_range;

static PyObject *__pyx_k4p;
static PyObject *__pyx_k7p;
static PyObject *__pyx_k8p;
static PyObject *__pyx_k10p;

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_n_NCapError, 1, __pyx_k3, sizeof(__pyx_k3)},
  {&__pyx_n__fp, 1, __pyx_k9, sizeof(__pyx_k9)},
  {&__pyx_n_fileno, 1, __pyx_k1, sizeof(__pyx_k1)},
  {&__pyx_n_has_key, 1, __pyx_k6, sizeof(__pyx_k6)},
  {&__pyx_n_range, 1, __pyx_k5, sizeof(__pyx_k5)},
  {&__pyx_k4p, 0, __pyx_k4, sizeof(__pyx_k4)},
  {&__pyx_k7p, 0, __pyx_k7, sizeof(__pyx_k7)},
  {&__pyx_k8p, 0, __pyx_k8, sizeof(__pyx_k8)},
  {&__pyx_k10p, 0, __pyx_k10, sizeof(__pyx_k10)},
  {0, 0, 0, 0}
};



/* Implementation of ncap */

static void __pyx_f_4ncap_callback(ncap_t __pyx_v_ncap,void *__pyx_v_ctx,ncap_msg_ct __pyx_v_msg,char *__pyx_v_some) {
  PyObject *__pyx_v_converted;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  __pyx_v_converted = Py_None; Py_INCREF(Py_None);

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":126 */
  __pyx_1 = wrap_ncap_msg_to_python(__pyx_v_msg); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}
  Py_DECREF(__pyx_v_converted);
  __pyx_v_converted = __pyx_1;
  __pyx_1 = 0;

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":128 */
  __pyx_1 = PyString_FromString(__pyx_v_some); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; goto __pyx_L1;}
  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1);
  Py_INCREF(__pyx_v_converted);
  PyTuple_SET_ITEM(__pyx_2, 1, __pyx_v_converted);
  __pyx_1 = 0;
  __pyx_1 = PyObject_CallObject(((PyObject *)__pyx_v_ctx), __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_1); __pyx_1 = 0;

  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  __Pyx_WriteUnraisable("ncap.callback");
  __pyx_L0:;
  Py_DECREF(__pyx_v_converted);
}

static int __pyx_f_4ncap_8NCapFile___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_4ncap_8NCapFile___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_file = 0;
  int __pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  int __pyx_3;
  static char *__pyx_argnames[] = {"file",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_file)) return -1;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_file);

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":140 */
  __pyx_1 = PyObject_GetAttr(__pyx_v_file, __pyx_n_fileno); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; goto __pyx_L1;}
  __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_3 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  ((struct __pyx_obj_4ncap_NCapFile *)__pyx_v_self)->_fp = fdopen(__pyx_3,__pyx_k2);

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":141 */
  __pyx_3 = (!(((struct __pyx_obj_4ncap_NCapFile *)__pyx_v_self)->_fp != 0));
  if (__pyx_3) {
    __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_NCapError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}
    __pyx_2 = PyNumber_Remainder(__pyx_k4p, __pyx_v_file); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}
    __Pyx_Raise(__pyx_1, __pyx_2, 0);
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("ncap.NCapFile.__cinit__");
  __pyx_r = -1;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_file);
  return __pyx_r;
}

static void __pyx_f_4ncap_8NCapFile___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_f_4ncap_8NCapFile___dealloc__(PyObject *__pyx_v_self) {
  Py_INCREF(__pyx_v_self);
  fclose(((struct __pyx_obj_4ncap_NCapFile *)__pyx_v_self)->_fp);

  Py_DECREF(__pyx_v_self);
}

static int __pyx_f_4ncap_4NCap___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_4ncap_4NCap___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_maxmsg = 0;
  int __pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  static char *__pyx_argnames[] = {"maxmsg",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_maxmsg)) return -1;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_maxmsg);

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":156 */
  __pyx_1 = PyInt_AsLong(__pyx_v_maxmsg); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; goto __pyx_L1;}
  ((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap = ncap_create(__pyx_1);

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":157 */
  __pyx_2 = PyDict_New(); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; goto __pyx_L1;}
  Py_DECREF(((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_files);
  ((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_files = __pyx_2;
  __pyx_2 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("ncap.NCap.__cinit__");
  __pyx_r = -1;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_maxmsg);
  return __pyx_r;
}

static void __pyx_f_4ncap_4NCap___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_f_4ncap_4NCap___dealloc__(PyObject *__pyx_v_self) {
  Py_INCREF(__pyx_v_self);
  ((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap->destroy(((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap);

  Py_DECREF(__pyx_v_self);
}

static PyObject *__pyx_f_4ncap_4NCap_LastError(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4ncap_4NCap_LastError[] = "Returns the last encountered error string.";
static PyObject *__pyx_f_4ncap_4NCap_LastError(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  static char *__pyx_argnames[] = {0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
  Py_INCREF(__pyx_v_self);
  __pyx_1 = PyString_FromString(((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap->errstr); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("ncap.NCap.LastError");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_4ncap_4NCap_AddIf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4ncap_4NCap_AddIf[] = "Adds capture to the interface called \"name\" with the bpf filter\n      \"bpf\". The capture is promiscuous if \"promisc\" is True. A list of\n      VLANs can be passed in via \"vlans\"\n      ";
static PyObject *__pyx_f_4ncap_4NCap_AddIf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_bpf = 0;
  PyObject *__pyx_v_promisc = 0;
  PyObject *__pyx_v_vlans = 0;
  int __pyx_v_fdes;
  ncap_result_e __pyx_v_result;
  int *__pyx_v_c_vlans;
  PyObject *__pyx_v_off;
  PyObject *__pyx_r;
  Py_ssize_t __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  int __pyx_5;
  char *__pyx_6;
  char *__pyx_7;
  static char *__pyx_argnames[] = {"name","bpf","promisc","vlans",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOOO", __pyx_argnames, &__pyx_v_name, &__pyx_v_bpf, &__pyx_v_promisc, &__pyx_v_vlans)) return 0;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_name);
  Py_INCREF(__pyx_v_bpf);
  Py_INCREF(__pyx_v_promisc);
  Py_INCREF(__pyx_v_vlans);
  __pyx_v_off = Py_None; Py_INCREF(Py_None);

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":175 */
  __pyx_1 = PyObject_Length(__pyx_v_vlans); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; goto __pyx_L1;}
  __pyx_v_c_vlans = ((int *)malloc((8 * __pyx_1)));

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":176 */
  __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_range); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;}
  __pyx_1 = PyObject_Length(__pyx_v_vlans); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;}
  __pyx_3 = PyInt_FromSsize_t(__pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;}
  __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
  __pyx_3 = 0;
  __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_4); __pyx_4 = 0;
  __pyx_2 = PyObject_GetIter(__pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  for (;;) {
    __pyx_4 = PyIter_Next(__pyx_2);
    if (!__pyx_4) {
      if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;}
      break;
    }
    Py_DECREF(__pyx_v_off);
    __pyx_v_off = __pyx_4;
    __pyx_4 = 0;
    __pyx_3 = PyObject_GetItem(__pyx_v_vlans, __pyx_v_off); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}
    __pyx_5 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __pyx_1 = PyInt_AsSsize_t(__pyx_v_off); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}
    (__pyx_v_c_vlans[__pyx_1]) = __pyx_5;
  }
  Py_DECREF(__pyx_2); __pyx_2 = 0;

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":179 */
  __pyx_6 = PyString_AsString(__pyx_v_name); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; goto __pyx_L1;}
  __pyx_7 = PyString_AsString(__pyx_v_bpf); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; goto __pyx_L1;}
  __pyx_5 = PyInt_AsLong(__pyx_v_promisc); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; goto __pyx_L1;}
  __pyx_1 = PyObject_Length(__pyx_v_vlans); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; goto __pyx_L1;}
  __pyx_v_result = ((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap->add_if(((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap,__pyx_6,__pyx_7,__pyx_5,__pyx_v_c_vlans,__pyx_1,(&__pyx_v_fdes));

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":181 */
  free(__pyx_v_c_vlans);

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":183 */
  __pyx_5 = (__pyx_v_result != ncap_success);
  if (__pyx_5) {
    __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_NCapError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; goto __pyx_L1;}
    __pyx_3 = PyString_FromString(((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap->errstr); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; goto __pyx_L1;}
    __Pyx_Raise(__pyx_4, __pyx_3, 0);
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; goto __pyx_L1;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":186 */
  __pyx_2 = PyInt_FromLong(__pyx_v_fdes); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; goto __pyx_L1;}
  __pyx_r = __pyx_2;
  __pyx_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  __Pyx_AddTraceback("ncap.NCap.AddIf");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_off);
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_name);
  Py_DECREF(__pyx_v_bpf);
  Py_DECREF(__pyx_v_promisc);
  Py_DECREF(__pyx_v_vlans);
  return __pyx_r;
}

static PyObject *__pyx_f_4ncap_4NCap_DropIf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4ncap_4NCap_DropIf[] = "Drops the interface associated with the file descriptor fdes.\n      Returns true on success and false otherwise.";
static PyObject *__pyx_f_4ncap_4NCap_DropIf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fdes = 0;
  ncap_result_e __pyx_v_result;
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  static char *__pyx_argnames[] = {"fdes",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_fdes)) return 0;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_fdes);

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":193 */
  __pyx_1 = PyInt_AsLong(__pyx_v_fdes); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}
  __pyx_v_result = ((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap->drop_if(((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap,__pyx_1);

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":194 */
  __pyx_2 = PyInt_FromLong((__pyx_v_result == ncap_success)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}
  __pyx_r = __pyx_2;
  __pyx_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("ncap.NCap.DropIf");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_fdes);
  return __pyx_r;
}

static PyObject *__pyx_f_4ncap_4NCap_AddNf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4ncap_4NCap_AddNf[] = "Adds the opened ncap file to the data collection.  The label is used to\n      label the data stream.";
static PyObject *__pyx_f_4ncap_4NCap_AddNf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_file = 0;
  PyObject *__pyx_v_label = 0;
  ncap_result_e __pyx_v_result;
  PyObject *__pyx_v_nf;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  int __pyx_4;
  char *__pyx_5;
  static char *__pyx_argnames[] = {"file","label",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_file, &__pyx_v_label)) return 0;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_file);
  Py_INCREF(__pyx_v_label);
  __pyx_v_nf = Py_None; Py_INCREF(Py_None);

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":201 */
  __pyx_1 = PyObject_GetAttr(((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_files, __pyx_n_has_key); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; goto __pyx_L1;}
  __pyx_2 = PyObject_GetAttr(__pyx_v_file, __pyx_n_fileno); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; goto __pyx_L1;}
  __pyx_3 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3);
  __pyx_3 = 0;
  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_4 = PyObject_IsTrue(__pyx_3); if (__pyx_4 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  if (__pyx_4) {
    __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_NCapError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; goto __pyx_L1;}
    __pyx_2 = PyObject_GetAttr(__pyx_v_file, __pyx_n_fileno); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; goto __pyx_L1;}
    __pyx_3 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_2 = PyNumber_Remainder(__pyx_k7p, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __Pyx_Raise(__pyx_1, __pyx_2, 0);
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":206 */
  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; goto __pyx_L1;}
  Py_INCREF(__pyx_v_file);
  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_file);
  __pyx_1 = PyObject_CallObject(((PyObject *)__pyx_ptype_4ncap_NCapFile), __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  Py_DECREF(__pyx_v_nf);
  __pyx_v_nf = __pyx_1;
  __pyx_1 = 0;

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":207 */
  __pyx_2 = PyObject_GetAttr(__pyx_v_file, __pyx_n_fileno); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; goto __pyx_L1;}
  __pyx_3 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  if (PyObject_SetItem(((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_files, __pyx_3, __pyx_v_nf) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":209 */
  __pyx_1 = PyObject_GetAttr(__pyx_v_file, __pyx_n_fileno); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; goto __pyx_L1;}
  __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_4 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_5 = PyString_AsString(__pyx_v_label); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; goto __pyx_L1;}
  __pyx_v_result = ((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap->add_nf(((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap,__pyx_4,__pyx_5);

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":211 */
  __pyx_3 = PyInt_FromLong((__pyx_v_result == ncap_success)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; goto __pyx_L1;}
  __pyx_r = __pyx_3;
  __pyx_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("ncap.NCap.AddNf");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_nf);
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_file);
  Py_DECREF(__pyx_v_label);
  return __pyx_r;
}

static PyObject *__pyx_f_4ncap_4NCap_DropNf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4ncap_4NCap_DropNf[] = "Drop a previously added ncap file object.";
static PyObject *__pyx_f_4ncap_4NCap_DropNf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_file = 0;
  ncap_result_e __pyx_v_result;
  PyObject *__pyx_v_nf;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  int __pyx_4;
  int __pyx_5;
  static char *__pyx_argnames[] = {"file",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_file)) return 0;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_file);
  __pyx_v_nf = Py_None; Py_INCREF(Py_None);

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":217 */
  __pyx_1 = PyObject_GetAttr(((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_files, __pyx_n_has_key); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; goto __pyx_L1;}
  __pyx_2 = PyObject_GetAttr(__pyx_v_file, __pyx_n_fileno); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; goto __pyx_L1;}
  __pyx_3 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3);
  __pyx_3 = 0;
  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_4 = PyObject_IsTrue(__pyx_3); if (__pyx_4 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  __pyx_5 = (!__pyx_4);
  if (__pyx_5) {
    __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_NCapError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; goto __pyx_L1;}
    __pyx_2 = PyObject_GetAttr(__pyx_v_file, __pyx_n_fileno); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; goto __pyx_L1;}
    __pyx_3 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_2 = PyNumber_Remainder(__pyx_k8p, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __Pyx_Raise(__pyx_1, __pyx_2, 0);
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":220 */
  __pyx_3 = PyObject_GetAttr(__pyx_v_file, __pyx_n_fileno); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; goto __pyx_L1;}
  __pyx_1 = PyObject_CallObject(__pyx_3, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  __pyx_2 = PyObject_GetItem(((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_files, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_v_nf);
  __pyx_v_nf = __pyx_2;
  __pyx_2 = 0;

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":222 */
  __pyx_3 = PyObject_GetAttr(__pyx_v_file, __pyx_n_fileno); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; goto __pyx_L1;}
  __pyx_1 = PyObject_CallObject(__pyx_3, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  __pyx_4 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_v_result = ((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap->drop_nf(((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap,__pyx_4);

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":224 */
  __pyx_2 = PyObject_GetAttr(__pyx_v_file, __pyx_n_fileno); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; goto __pyx_L1;}
  __pyx_3 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  if (PyObject_DelItem(((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_files, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":226 */
  __pyx_1 = PyInt_FromLong((__pyx_v_result == ncap_success)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("ncap.NCap.DropNf");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_nf);
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_file);
  return __pyx_r;
}

static PyObject *__pyx_f_4ncap_4NCap_AddPf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4ncap_4NCap_AddPf[] = "Adds the opened pcap file to the data collection.  The label is used to\n      label the data stream.";
static PyObject *__pyx_f_4ncap_4NCap_AddPf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_file = 0;
  PyObject *__pyx_v_label = 0;
  PyObject *__pyx_v_nf;
  PyObject *__pyx_v_result;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  int __pyx_4;
  char *__pyx_5;
  static char *__pyx_argnames[] = {"file","label",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_file, &__pyx_v_label)) return 0;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_file);
  Py_INCREF(__pyx_v_label);
  __pyx_v_nf = Py_None; Py_INCREF(Py_None);
  __pyx_v_result = Py_None; Py_INCREF(Py_None);

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":233 */
  __pyx_1 = PyObject_GetAttr(((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_files, __pyx_n_has_key); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; goto __pyx_L1;}
  __pyx_2 = PyObject_GetAttr(__pyx_v_file, __pyx_n_fileno); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; goto __pyx_L1;}
  __pyx_3 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3);
  __pyx_3 = 0;
  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_4 = PyObject_IsTrue(__pyx_3); if (__pyx_4 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  if (__pyx_4) {
    __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_NCapError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; goto __pyx_L1;}
    __pyx_2 = PyObject_GetAttr(__pyx_v_file, __pyx_n_fileno); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; goto __pyx_L1;}
    __pyx_3 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_2 = PyNumber_Remainder(__pyx_k7p, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __Pyx_Raise(__pyx_1, __pyx_2, 0);
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":238 */
  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; goto __pyx_L1;}
  Py_INCREF(__pyx_v_file);
  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_file);
  __pyx_1 = PyObject_CallObject(((PyObject *)__pyx_ptype_4ncap_NCapFile), __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  Py_DECREF(__pyx_v_nf);
  __pyx_v_nf = __pyx_1;
  __pyx_1 = 0;

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":239 */
  __pyx_2 = PyObject_GetAttr(__pyx_v_file, __pyx_n_fileno); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; goto __pyx_L1;}
  __pyx_3 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  if (PyObject_SetItem(((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_files, __pyx_3, __pyx_v_nf) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":241 */
  __pyx_1 = PyObject_GetAttr(__pyx_v_nf, __pyx_n__fp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; goto __pyx_L1;}
  __pyx_5 = PyString_AsString(__pyx_v_label); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; goto __pyx_L1;}
  __pyx_2 = PyInt_FromLong(((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap->add_pf(((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap,((FILE *)__pyx_1),__pyx_5)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_v_result);
  __pyx_v_result = __pyx_2;
  __pyx_2 = 0;

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":243 */
  __pyx_3 = PyInt_FromLong(ncap_success); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}
  if (PyObject_Cmp(__pyx_v_result, __pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}
  __pyx_4 = __pyx_4 == 0;
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  __pyx_1 = PyInt_FromLong(__pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("ncap.NCap.AddPf");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_nf);
  Py_DECREF(__pyx_v_result);
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_file);
  Py_DECREF(__pyx_v_label);
  return __pyx_r;
}

static PyObject *__pyx_f_4ncap_4NCap_DropPf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4ncap_4NCap_DropPf[] = "Drop a previously added pcap file object.";
static PyObject *__pyx_f_4ncap_4NCap_DropPf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_file = 0;
  ncap_result_e __pyx_v_result;
  PyObject *__pyx_v_nf;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  int __pyx_4;
  int __pyx_5;
  static char *__pyx_argnames[] = {"file",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_file)) return 0;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_file);
  __pyx_v_nf = Py_None; Py_INCREF(Py_None);

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":249 */
  __pyx_1 = PyObject_GetAttr(((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_files, __pyx_n_has_key); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; goto __pyx_L1;}
  __pyx_2 = PyObject_GetAttr(__pyx_v_file, __pyx_n_fileno); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; goto __pyx_L1;}
  __pyx_3 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3);
  __pyx_3 = 0;
  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_4 = PyObject_IsTrue(__pyx_3); if (__pyx_4 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  __pyx_5 = (!__pyx_4);
  if (__pyx_5) {
    __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_NCapError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; goto __pyx_L1;}
    __pyx_2 = PyObject_GetAttr(__pyx_v_file, __pyx_n_fileno); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; goto __pyx_L1;}
    __pyx_3 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_2 = PyNumber_Remainder(__pyx_k8p, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __Pyx_Raise(__pyx_1, __pyx_2, 0);
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":252 */
  __pyx_3 = PyObject_GetAttr(__pyx_v_file, __pyx_n_fileno); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; goto __pyx_L1;}
  __pyx_1 = PyObject_CallObject(__pyx_3, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  __pyx_2 = PyObject_GetItem(((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_files, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_v_nf);
  __pyx_v_nf = __pyx_2;
  __pyx_2 = 0;

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":254 */
  __pyx_3 = PyObject_GetAttr(__pyx_v_nf, __pyx_n__fp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; goto __pyx_L1;}
  __pyx_v_result = ((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap->drop_pf(((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap,((FILE *)__pyx_3));
  Py_DECREF(__pyx_3); __pyx_3 = 0;

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":256 */
  __pyx_1 = PyObject_GetAttr(__pyx_v_file, __pyx_n_fileno); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; goto __pyx_L1;}
  __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  if (PyObject_DelItem(((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_files, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":258 */
  __pyx_3 = PyInt_FromLong((__pyx_v_result == ncap_success)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; goto __pyx_L1;}
  __pyx_r = __pyx_3;
  __pyx_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("ncap.NCap.DropPf");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_nf);
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_file);
  return __pyx_r;
}

static PyObject *__pyx_f_4ncap_4NCap_AddDg(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4ncap_4NCap_AddDg(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fdes = 0;
  PyObject *__pyx_v_label = 0;
  ncap_result_e __pyx_v_result;
  PyObject *__pyx_r;
  int __pyx_1;
  char *__pyx_2;
  PyObject *__pyx_3 = 0;
  static char *__pyx_argnames[] = {"fdes","label",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_fdes, &__pyx_v_label)) return 0;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_fdes);
  Py_INCREF(__pyx_v_label);

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":263 */
  __pyx_1 = PyInt_AsLong(__pyx_v_fdes); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; goto __pyx_L1;}
  __pyx_2 = PyString_AsString(__pyx_v_label); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; goto __pyx_L1;}
  __pyx_v_result = ((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap->add_dg(((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap,__pyx_1,__pyx_2);

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":264 */
  __pyx_3 = PyInt_FromLong((__pyx_v_result == ncap_success)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; goto __pyx_L1;}
  __pyx_r = __pyx_3;
  __pyx_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("ncap.NCap.AddDg");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_fdes);
  Py_DECREF(__pyx_v_label);
  return __pyx_r;
}

static PyObject *__pyx_f_4ncap_4NCap_DropDg(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4ncap_4NCap_DropDg(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fdes = 0;
  ncap_result_e __pyx_v_result;
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  static char *__pyx_argnames[] = {"fdes",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_fdes)) return 0;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_fdes);

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":269 */
  __pyx_1 = PyInt_AsLong(__pyx_v_fdes); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; goto __pyx_L1;}
  __pyx_v_result = ((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap->drop_dg(((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap,__pyx_1);

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":270 */
  __pyx_2 = PyInt_FromLong((__pyx_v_result == ncap_success)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; goto __pyx_L1;}
  __pyx_r = __pyx_2;
  __pyx_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("ncap.NCap.DropDg");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_fdes);
  return __pyx_r;
}

static PyObject *__pyx_f_4ncap_4NCap_Filter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4ncap_4NCap_Filter[] = "Installs a new pcap filter on the capture thingy.\n      Returns true on success, false otherwise.";
static PyObject *__pyx_f_4ncap_4NCap_Filter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filter = 0;
  ncap_result_e __pyx_v_result;
  PyObject *__pyx_r;
  char *__pyx_1;
  PyObject *__pyx_2 = 0;
  static char *__pyx_argnames[] = {"filter",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_filter)) return 0;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_filter);

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":278 */
  __pyx_1 = PyString_AsString(__pyx_v_filter); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; goto __pyx_L1;}
  __pyx_v_result = ((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap->filter(((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap,__pyx_1);

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":279 */
  __pyx_2 = PyInt_FromLong((__pyx_v_result == ncap_success)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; goto __pyx_L1;}
  __pyx_r = __pyx_2;
  __pyx_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("ncap.NCap.Filter");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_filter);
  return __pyx_r;
}

static PyObject *__pyx_f_4ncap_4NCap_Stop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4ncap_4NCap_Stop[] = "Stops the collect loop.";
static PyObject *__pyx_f_4ncap_4NCap_Stop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r;
  static char *__pyx_argnames[] = {0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
  Py_INCREF(__pyx_v_self);
  ((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap->stop(((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap);

  __pyx_r = Py_None; Py_INCREF(Py_None);
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_4ncap_4NCap_Write(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4ncap_4NCap_Write[] = "Writes the msg to the specified file.  If msg is None, an\n      ncap header is output.  This should be done periodically.";
static PyObject *__pyx_f_4ncap_4NCap_Write(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_msg = 0;
  PyObject *__pyx_v_file = 0;
  struct ncap_msg __pyx_v_tmp;
  ncap_result_e __pyx_v_result;
  PyObject *__pyx_r;
  int __pyx_1;
  int __pyx_2;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  static char *__pyx_argnames[] = {"msg","file",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_msg, &__pyx_v_file)) return 0;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_msg);
  Py_INCREF(__pyx_v_file);

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":292 */
  __pyx_1 = PyObject_IsTrue(__pyx_v_msg); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; goto __pyx_L1;}
  __pyx_2 = (!__pyx_1);
  if (__pyx_2) {
    __pyx_3 = PyObject_GetAttr(__pyx_v_file, __pyx_n_fileno); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; goto __pyx_L1;}
    __pyx_4 = PyObject_CallObject(__pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __pyx_1 = PyInt_AsLong(__pyx_4); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; goto __pyx_L1;}
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    __pyx_v_result = ((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap->write(((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap,NULL,__pyx_1);
    goto __pyx_L2;
  }
  /*else*/ {

    /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":295 */
    __pyx_2 = (wrap_python_to_ncap_msg(((PyObject *)__pyx_v_msg),(&__pyx_v_tmp)) == (-1));
    if (__pyx_2) {
      __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_NCapError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; goto __pyx_L1;}
      __Pyx_Raise(__pyx_3, __pyx_k10p, 0);
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; goto __pyx_L1;}
      goto __pyx_L3;
    }
    __pyx_L3:;

    /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":298 */
    __pyx_4 = PyObject_GetAttr(__pyx_v_file, __pyx_n_fileno); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; goto __pyx_L1;}
    __pyx_3 = PyObject_CallObject(__pyx_4, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; goto __pyx_L1;}
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    __pyx_1 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __pyx_v_result = ((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap->write(((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap,(&__pyx_v_tmp),__pyx_1);
  }
  __pyx_L2:;

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":300 */
  __pyx_4 = PyInt_FromLong((__pyx_v_result == ncap_success)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; goto __pyx_L1;}
  __pyx_r = __pyx_4;
  __pyx_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  __Pyx_AddTraceback("ncap.NCap.Write");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_msg);
  Py_DECREF(__pyx_v_file);
  return __pyx_r;
}

static PyObject *__pyx_f_4ncap_4NCap_Send(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4ncap_4NCap_Send[] = "Sends the msg to the specified socket.";
static PyObject *__pyx_f_4ncap_4NCap_Send(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_msg = 0;
  PyObject *__pyx_v_fdes = 0;
  PyObject *__pyx_v_flags = 0;
  struct ncap_msg __pyx_v_tmp;
  ncap_result_e __pyx_v_result;
  PyObject *__pyx_r;
  int __pyx_1;
  int __pyx_2;
  PyObject *__pyx_3 = 0;
  static char *__pyx_argnames[] = {"msg","fdes","flags",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOO", __pyx_argnames, &__pyx_v_msg, &__pyx_v_fdes, &__pyx_v_flags)) return 0;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_msg);
  Py_INCREF(__pyx_v_fdes);
  Py_INCREF(__pyx_v_flags);

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":307 */
  __pyx_1 = PyObject_IsTrue(__pyx_v_msg); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; goto __pyx_L1;}
  __pyx_2 = (!__pyx_1);
  if (__pyx_2) {
    __pyx_1 = PyInt_AsLong(__pyx_v_fdes); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; goto __pyx_L1;}
    __pyx_2 = PyInt_AsLong(__pyx_v_flags); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; goto __pyx_L1;}
    __pyx_v_result = ((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap->send(((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap,NULL,__pyx_1,__pyx_2);
    goto __pyx_L2;
  }
  /*else*/ {

    /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":310 */
    __pyx_1 = (wrap_python_to_ncap_msg(((PyObject *)__pyx_v_msg),(&__pyx_v_tmp)) == (-1));
    if (__pyx_1) {
      __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_NCapError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; goto __pyx_L1;}
      __Pyx_Raise(__pyx_3, __pyx_k10p, 0);
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; goto __pyx_L1;}
      goto __pyx_L3;
    }
    __pyx_L3:;

    /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":313 */
    __pyx_2 = PyInt_AsLong(__pyx_v_fdes); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; goto __pyx_L1;}
    __pyx_1 = PyInt_AsLong(__pyx_v_flags); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; goto __pyx_L1;}
    __pyx_v_result = ((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap->send(((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap,(&__pyx_v_tmp),__pyx_2,__pyx_1);
  }
  __pyx_L2:;

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":315 */
  __pyx_3 = PyInt_FromLong((__pyx_v_result == ncap_success)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; goto __pyx_L1;}
  __pyx_r = __pyx_3;
  __pyx_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("ncap.NCap.Send");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_msg);
  Py_DECREF(__pyx_v_fdes);
  Py_DECREF(__pyx_v_flags);
  return __pyx_r;
}

static PyObject *__pyx_f_4ncap_4NCap_Collect(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4ncap_4NCap_Collect[] = "Run data collection, either once if polling is set or\n      until Stop() has been called.   The callback is invoked for\n      each collected message.";
static PyObject *__pyx_f_4ncap_4NCap_Collect(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_polling = 0;
  PyObject *__pyx_v_f = 0;
  ncap_result_e __pyx_v_result;
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  static char *__pyx_argnames[] = {"polling","f",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_polling, &__pyx_v_f)) return 0;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_polling);
  Py_INCREF(__pyx_v_f);

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":323 */
  __pyx_1 = PyInt_AsLong(__pyx_v_polling); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;}
  __pyx_v_result = ((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap->collect(((struct __pyx_obj_4ncap_NCap *)__pyx_v_self)->_ncap,__pyx_1,__pyx_f_4ncap_callback,((void *)__pyx_v_f));

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":326 */
  __pyx_2 = PyInt_FromLong((__pyx_v_result == ncap_success)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; goto __pyx_L1;}
  __pyx_r = __pyx_2;
  __pyx_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("ncap.NCap.Collect");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_polling);
  Py_DECREF(__pyx_v_f);
  return __pyx_r;
}

static PyObject *__pyx_tp_new_4ncap_NCapFile(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  if (__pyx_f_4ncap_8NCapFile___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4ncap_NCapFile(PyObject *o) {
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++o->ob_refcnt;
    __pyx_f_4ncap_8NCapFile___dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --o->ob_refcnt;
    PyErr_Restore(etype, eval, etb);
  }
  (*o->ob_type->tp_free)(o);
}

static struct PyMethodDef __pyx_methods_4ncap_NCapFile[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_NCapFile = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_divide*/
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  0, /*nb_coerce*/
  0, /*nb_int*/
  0, /*nb_long*/
  0, /*nb_float*/
  0, /*nb_oct*/
  0, /*nb_hex*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_divide*/
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_NCapFile = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_NCapFile = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_NCapFile = {
  0, /*bf_getreadbuffer*/
  0, /*bf_getwritebuffer*/
  0, /*bf_getsegcount*/
  0, /*bf_getcharbuffer*/
};

PyTypeObject __pyx_type_4ncap_NCapFile = {
  PyObject_HEAD_INIT(0)
  0, /*ob_size*/
  "ncap.NCapFile", /*tp_name*/
  sizeof(struct __pyx_obj_4ncap_NCapFile), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4ncap_NCapFile, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_NCapFile, /*tp_as_number*/
  &__pyx_tp_as_sequence_NCapFile, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_NCapFile, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_NCapFile, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "Convert a Python File object into a FILE object.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4ncap_NCapFile, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4ncap_NCapFile, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
};

static PyObject *__pyx_tp_new_4ncap_NCap(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4ncap_NCap *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4ncap_NCap *)o);
  p->_files = Py_None; Py_INCREF(Py_None);
  if (__pyx_f_4ncap_4NCap___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4ncap_NCap(PyObject *o) {
  struct __pyx_obj_4ncap_NCap *p = (struct __pyx_obj_4ncap_NCap *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++o->ob_refcnt;
    __pyx_f_4ncap_4NCap___dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --o->ob_refcnt;
    PyErr_Restore(etype, eval, etb);
  }
  Py_XDECREF(p->_files);
  (*o->ob_type->tp_free)(o);
}

static int __pyx_tp_traverse_4ncap_NCap(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4ncap_NCap *p = (struct __pyx_obj_4ncap_NCap *)o;
  if (p->_files) {
    e = (*v)(p->_files, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4ncap_NCap(PyObject *o) {
  struct __pyx_obj_4ncap_NCap *p = (struct __pyx_obj_4ncap_NCap *)o;
  PyObject *t;
  t = p->_files; 
  p->_files = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(t);
  return 0;
}

static struct PyMethodDef __pyx_methods_4ncap_NCap[] = {
  {"LastError", (PyCFunction)__pyx_f_4ncap_4NCap_LastError, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ncap_4NCap_LastError},
  {"AddIf", (PyCFunction)__pyx_f_4ncap_4NCap_AddIf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ncap_4NCap_AddIf},
  {"DropIf", (PyCFunction)__pyx_f_4ncap_4NCap_DropIf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ncap_4NCap_DropIf},
  {"AddNf", (PyCFunction)__pyx_f_4ncap_4NCap_AddNf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ncap_4NCap_AddNf},
  {"DropNf", (PyCFunction)__pyx_f_4ncap_4NCap_DropNf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ncap_4NCap_DropNf},
  {"AddPf", (PyCFunction)__pyx_f_4ncap_4NCap_AddPf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ncap_4NCap_AddPf},
  {"DropPf", (PyCFunction)__pyx_f_4ncap_4NCap_DropPf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ncap_4NCap_DropPf},
  {"AddDg", (PyCFunction)__pyx_f_4ncap_4NCap_AddDg, METH_VARARGS|METH_KEYWORDS, 0},
  {"DropDg", (PyCFunction)__pyx_f_4ncap_4NCap_DropDg, METH_VARARGS|METH_KEYWORDS, 0},
  {"Filter", (PyCFunction)__pyx_f_4ncap_4NCap_Filter, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ncap_4NCap_Filter},
  {"Stop", (PyCFunction)__pyx_f_4ncap_4NCap_Stop, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ncap_4NCap_Stop},
  {"Write", (PyCFunction)__pyx_f_4ncap_4NCap_Write, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ncap_4NCap_Write},
  {"Send", (PyCFunction)__pyx_f_4ncap_4NCap_Send, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ncap_4NCap_Send},
  {"Collect", (PyCFunction)__pyx_f_4ncap_4NCap_Collect, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4ncap_4NCap_Collect},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_NCap = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_divide*/
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  0, /*nb_coerce*/
  0, /*nb_int*/
  0, /*nb_long*/
  0, /*nb_float*/
  0, /*nb_oct*/
  0, /*nb_hex*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_divide*/
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_NCap = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_NCap = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_NCap = {
  0, /*bf_getreadbuffer*/
  0, /*bf_getwritebuffer*/
  0, /*bf_getsegcount*/
  0, /*bf_getcharbuffer*/
};

PyTypeObject __pyx_type_4ncap_NCap = {
  PyObject_HEAD_INIT(0)
  0, /*ob_size*/
  "ncap.NCap", /*tp_name*/
  sizeof(struct __pyx_obj_4ncap_NCap), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4ncap_NCap, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_NCap, /*tp_as_number*/
  &__pyx_tp_as_sequence_NCap, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_NCap, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_NCap, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4ncap_NCap, /*tp_traverse*/
  __pyx_tp_clear_4ncap_NCap, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4ncap_NCap, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4ncap_NCap, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
};

static struct PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

static void __pyx_init_filenames(void); /*proto*/

PyMODINIT_FUNC initncap(void); /*proto*/
PyMODINIT_FUNC initncap(void) {
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  __pyx_init_filenames();
  __pyx_m = Py_InitModule4("ncap", __pyx_methods, 0, 0, PYTHON_API_VERSION);
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; goto __pyx_L1;};
  Py_INCREF(__pyx_m);
  __pyx_b = PyImport_AddModule("__builtin__");
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; goto __pyx_L1;};
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; goto __pyx_L1;};
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; goto __pyx_L1;};
  if (PyType_Ready(&__pyx_type_4ncap_NCapFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; goto __pyx_L1;}
  if (PyObject_SetAttrString(__pyx_m, "NCapFile", (PyObject *)&__pyx_type_4ncap_NCapFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; goto __pyx_L1;}
  __pyx_ptype_4ncap_NCapFile = &__pyx_type_4ncap_NCapFile;
  __pyx_type_4ncap_NCap.tp_free = _PyObject_GC_Del;
  if (PyType_Ready(&__pyx_type_4ncap_NCap) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; goto __pyx_L1;}
  if (PyObject_SetAttrString(__pyx_m, "NCap", (PyObject *)&__pyx_type_4ncap_NCap) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; goto __pyx_L1;}
  __pyx_ptype_4ncap_NCap = &__pyx_type_4ncap_NCap;

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":116 */
  __pyx_1 = PyDict_New(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;}
  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;}
  Py_INCREF(PyExc_Exception);
  PyTuple_SET_ITEM(__pyx_2, 0, PyExc_Exception);
  __pyx_3 = __Pyx_CreateClass(__pyx_2, __pyx_1, __pyx_n_NCapError, "ncap"); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_NCapError, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  Py_DECREF(__pyx_1); __pyx_1 = 0;

  /* "/home/edmonds/isc/src/ncap/pyncap/ncap.pyx":317 */
  return;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("ncap");
}

static char *__pyx_filenames[] = {
  "ncap.pyx",
};

/* Runtime support code */

static void __pyx_init_filenames(void) {
  __pyx_f = __pyx_filenames;
}

static void __Pyx_WriteUnraisable(char *name) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    PyErr_Fetch(&old_exc, &old_val, &old_tb);
    ctx = PyString_FromString(name);
    PyErr_Restore(old_exc, old_val, old_tb);
    if (!ctx)
        ctx = Py_None;
    PyErr_WriteUnraisable(ctx);
}

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
    PyObject *result;
    result = PyObject_GetAttr(dict, name);
    if (!result)
        PyErr_SetObject(PyExc_NameError, name);
    return result;
}

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
    Py_XINCREF(type);
    Py_XINCREF(value);
    Py_XINCREF(tb);
    /* First, check the traceback argument, replacing None with NULL. */
    if (tb == Py_None) {
        Py_DECREF(tb);
        tb = 0;
    }
    else if (tb != NULL && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto raise_error;
    }
    /* Next, replace a missing value with None */
    if (value == NULL) {
        value = Py_None;
        Py_INCREF(value);
    }
    #if PY_VERSION_HEX < 0x02050000
    if (!PyClass_Check(type))
    #else
    if (!PyType_Check(type))
    #endif
    {
        /* Raising an instance.  The value should be a dummy. */
        if (value != Py_None) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        /* Normalize to raise <class>, <instance> */
        Py_DECREF(value);
        value = type;
        #if PY_VERSION_HEX < 0x02050000
            if (PyInstance_Check(type)) {
                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
                Py_INCREF(type);
            }
            else {
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception must be an old-style class or instance");
                goto raise_error;
            }
        #else
            type = (PyObject*) type->ob_type;
            Py_INCREF(type);
            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception class must be a subclass of BaseException");
                goto raise_error;
            }
        #endif
    }
    PyErr_Restore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        if (!*t->p)
            return -1;
        if (t->i)
            PyString_InternInPlace(t->p);
        ++t;
    }
    return 0;
}

static PyObject *__Pyx_CreateClass(
    PyObject *bases, PyObject *dict, PyObject *name, char *modname)
{
    PyObject *py_modname;
    PyObject *result = 0;
    
    py_modname = PyString_FromString(modname);
    if (!py_modname)
        goto bad;
    if (PyDict_SetItemString(dict, "__module__", py_modname) < 0)
        goto bad;
    result = PyClass_New(bases, dict, name);
bad:
    Py_XDECREF(py_modname);
    return result;
}

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"

static void __Pyx_AddTraceback(char *funcname) {
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    PyObject *py_globals = 0;
    PyObject *empty_tuple = 0;
    PyObject *empty_string = 0;
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    
    py_srcfile = PyString_FromString(__pyx_filename);
    if (!py_srcfile) goto bad;
    py_funcname = PyString_FromString(funcname);
    if (!py_funcname) goto bad;
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    empty_tuple = PyTuple_New(0);
    if (!empty_tuple) goto bad;
    empty_string = PyString_FromString("");
    if (!empty_string) goto bad;
    py_code = PyCode_New(
        0,            /*int argcount,*/
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        empty_string, /*PyObject *code,*/
        empty_tuple,  /*PyObject *consts,*/
        empty_tuple,  /*PyObject *names,*/
        empty_tuple,  /*PyObject *varnames,*/
        empty_tuple,  /*PyObject *freevars,*/
        empty_tuple,  /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        __pyx_lineno,   /*int firstlineno,*/
        empty_string  /*PyObject *lnotab*/
    );
    if (!py_code) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_Get(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = __pyx_lineno;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    Py_XDECREF(empty_tuple);
    Py_XDECREF(empty_string);
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

Generated by  Doxygen 1.6.0   Back to index