00001
00002
00003 #include "Python.h"
00004 #include "structmember.h"
00005 #ifndef PY_LONG_LONG
00006 #define PY_LONG_LONG LONG_LONG
00007 #endif
00008 #include "dnet.h"
00009
00010
00011 typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry;
00012 typedef struct {PyObject **p; char *s; long n;} __Pyx_StringTabEntry;
00013 static PyObject *__Pyx_UnpackItem(PyObject *, int);
00014 static int __Pyx_EndUnpack(PyObject *, int);
00015 static int __Pyx_PrintItem(PyObject *);
00016 static int __Pyx_PrintNewline(void);
00017 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb);
00018 static void __Pyx_ReRaise(void);
00019 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list);
00020 static PyObject *__Pyx_GetExcValue(void);
00021 static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name);
00022 static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
00023 static int __Pyx_GetStarArgs(PyObject **args, PyObject **kwds, char *kwd_list[], int nargs, PyObject **args2, PyObject **kwds2);
00024 static void __Pyx_WriteUnraisable(char *name);
00025 static void __Pyx_AddTraceback(char *funcname);
00026 static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, long size);
00027 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
00028 static int __Pyx_GetVtable(PyObject *dict, void *vtabptr);
00029 static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, char *modname);
00030 static int __Pyx_InternStrings(__Pyx_InternTabEntry *t);
00031 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
00032 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name);
00033
00034 static PyObject *__pyx_m;
00035 static PyObject *__pyx_b;
00036 static int __pyx_lineno;
00037 static char *__pyx_filename;
00038 staticforward char **__pyx_f;
00039
00040 static char __pyx_mdoc[] = "dumb networking library\n\nThis module provides a simplified interface to several low-level\nnetworking routines, including network address manipulation, kernel\narp(4) cache and route(4) table lookup and manipulation, network\nfirewalling, network interface lookup and manipulation, IP tunnelling,\nand raw IP packet and Ethernet frame transmission.\n";
00041
00042
00043
00044 enum {
00045 __pyx_e_4dnet_TEADELTA = 2654435769,
00046 __pyx_e_4dnet_TEAROUNDS = 32,
00047 __pyx_e_4dnet_TEASBOXSIZE = 128,
00048 __pyx_e_4dnet_TEASBOXSHIFT = 7,
00049 };
00050
00051 staticforward PyTypeObject __pyx_type_4dnet_eth;
00052
00053 struct __pyx_obj_4dnet_eth {
00054 PyObject_HEAD
00055 eth_t (*eth);
00056 };
00057
00058 staticforward PyTypeObject __pyx_type_4dnet_ip;
00059
00060 struct __pyx_obj_4dnet_ip {
00061 PyObject_HEAD
00062 ip_t (*ip);
00063 };
00064
00065 staticforward PyTypeObject __pyx_type_4dnet_addr;
00066
00067 struct __pyx_obj_4dnet_addr {
00068 PyObject_HEAD
00069 struct addr _addr;
00070 };
00071
00072 staticforward PyTypeObject __pyx_type_4dnet___addr_ip4_iter;
00073
00074 struct __pyx_obj_4dnet___addr_ip4_iter {
00075 PyObject_HEAD
00076 unsigned long cur;
00077 unsigned long max;
00078 };
00079
00080 staticforward PyTypeObject __pyx_type_4dnet_arp;
00081
00082 struct __pyx_obj_4dnet_arp {
00083 PyObject_HEAD
00084 arp_t (*arp);
00085 };
00086
00087 staticforward PyTypeObject __pyx_type_4dnet_intf;
00088
00089 struct __pyx_obj_4dnet_intf {
00090 PyObject_HEAD
00091 intf_t (*intf);
00092 };
00093
00094 staticforward PyTypeObject __pyx_type_4dnet_route;
00095
00096 struct __pyx_obj_4dnet_route {
00097 PyObject_HEAD
00098 route_t (*route);
00099 };
00100
00101 staticforward PyTypeObject __pyx_type_4dnet_fw;
00102
00103 struct __pyx_obj_4dnet_fw {
00104 PyObject_HEAD
00105 fw_t (*fw);
00106 };
00107
00108 staticforward PyTypeObject __pyx_type_4dnet_rand;
00109
00110 struct __pyx_obj_4dnet_rand {
00111 PyObject_HEAD
00112 rand_t (*rand);
00113 };
00114
00115 staticforward PyTypeObject __pyx_type_4dnet___rand_xrange;
00116
00117 struct __pyx_obj_4dnet___rand_xrange {
00118 PyObject_HEAD
00119 rand_t (*rand);
00120 unsigned long cur;
00121 unsigned long enc;
00122 unsigned long max;
00123 unsigned long mask;
00124 unsigned long start;
00125 unsigned long sboxmask;
00126 unsigned int (sbox[128]);
00127 int left;
00128 int right;
00129 int kshift;
00130 };
00131
00132 staticforward PyTypeObject __pyx_type_4dnet_tun;
00133
00134 struct __pyx_obj_4dnet_tun {
00135 PyObject_HEAD
00136 tun_t (*tun);
00137 char (*buf);
00138 int mtu;
00139 };
00140
00141 static PyTypeObject *__pyx_ptype_4dnet_eth = 0;
00142 static PyTypeObject *__pyx_ptype_4dnet_ip = 0;
00143 static PyTypeObject *__pyx_ptype_4dnet_addr = 0;
00144 static PyTypeObject *__pyx_ptype_4dnet___addr_ip4_iter = 0;
00145 static PyTypeObject *__pyx_ptype_4dnet_arp = 0;
00146 static PyTypeObject *__pyx_ptype_4dnet_intf = 0;
00147 static PyTypeObject *__pyx_ptype_4dnet_route = 0;
00148 static PyTypeObject *__pyx_ptype_4dnet_fw = 0;
00149 static PyTypeObject *__pyx_ptype_4dnet_rand = 0;
00150 static PyTypeObject *__pyx_ptype_4dnet___rand_xrange = 0;
00151 static PyTypeObject *__pyx_ptype_4dnet_tun = 0;
00152 static PyObject *__pyx_k16;
00153 static PyObject *__pyx_k17;
00154 static PyObject *__pyx_k18;
00155 static PyObject *__pyx_k24;
00156 static PyObject *__pyx_k25;
00157 static PyObject *__pyx_k26;
00158 static PyObject *__pyx_k27;
00159 static PyObject *__pyx_k28;
00160 static PyObject *__pyx_k29;
00161 static PyObject *__pyx_k30;
00162 static PyObject *__pyx_k31;
00163 static PyObject *__pyx_k34;
00164 static PyObject *__pyx_k35;
00165 static PyObject *__pyx_k36;
00166 static PyObject *__pyx_k37;
00167 static PyObject *__pyx_k38;
00168 static PyObject *__pyx_k39;
00169 static PyObject *__pyx_k40;
00170 static PyObject *__pyx_k41;
00171 static PyObject *__pyx_k42;
00172 static PyObject *__pyx_k43;
00173 static PyObject *__pyx_k44;
00174 static PyObject *__pyx_k45;
00175 static PyObject *__pyx_k46;
00176 static PyObject *__pyx_k47;
00177 static PyObject *__pyx_k48;
00178 static PyObject *__pyx_k49;
00179 static PyObject *__pyx_k50;
00180 static PyObject *__pyx_k51;
00181 static PyObject *__pyx_k52;
00182 static PyObject *__pyx_k53;
00183 static PyObject *__pyx_k54;
00184 static PyObject *__pyx_k55;
00185 static PyObject *__pyx_k56;
00186 static PyObject *__pyx_k57;
00187 static PyObject *__pyx_k58;
00188 static PyObject *__pyx_k59;
00189 static PyObject *(__pyx_f_4dnet___memcpy(char (*),PyObject *,int ));
00190 static PyObject *(__pyx_f_4dnet___oserror(void));
00191 static int (__pyx_f_4dnet___arp_callback(struct arp_entry (*),void (*)));
00192 static PyObject *(__pyx_f_4dnet_ifent_to_dict(struct intf_entry (*)));
00193 static PyObject *(__pyx_f_4dnet_dict_to_ifent(PyObject *,struct intf_entry (*)));
00194 static int (__pyx_f_4dnet___intf_callback(struct intf_entry (*),void (*)));
00195 static int (__pyx_f_4dnet___route_callback(struct route_entry (*),void (*)));
00196 static PyObject *(__pyx_f_4dnet_rule_to_dict(struct fw_rule (*)));
00197 static PyObject *(__pyx_f_4dnet_dict_to_rule(PyObject *,struct fw_rule (*)));
00198 static int (__pyx_f_4dnet___fw_callback(struct fw_rule (*),void (*)));
00199
00200
00201
00202 static char (__pyx_k1[]) = "Address type (ADDR_TYPE_*) integer.";
00203 static char (__pyx_k2[]) = "Address bitlength integer.";
00204 static char (__pyx_k3[]) = "Raw address string.";
00205 static char (__pyx_k4[]) = "Ethernet MAC address as binary string.";
00206 static char (__pyx_k5[]) = "IPv4 address as binary string.";
00207 static char (__pyx_k6[]) = "IPv6 address as binary string.";
00208 static char (__pyx_k7[]) = "Tunnel interface name.";
00209 static char (__pyx_k8[]) = "File descriptor for tunnel handle.";
00210 static char (__pyx_k9[]) = "Dug Song <dugsong@monkey.org>";
00211 static char (__pyx_k10[]) = "Copyright (c) 2003 Dug Song";
00212 static char (__pyx_k12[]) = "http://libdnet.sourceforge.net/";
00213 static char (__pyx_k13[]) = "1.11";
00214 static char (__pyx_k14[]) = "\x000\x000\x000\x000\x000\x000";
00215 static char (__pyx_k15[]) = "\x0ff\x0ff\x0ff\x0ff\x0ff\x0ff";
00216 static char (__pyx_k19[]) = "\x000\x000\x000\x000";
00217 static char (__pyx_k20[]) = "\x0ff\x0ff\x0ff\x0ff";
00218 static char (__pyx_k21[]) = "\x07f\x000\x000\x001";
00219 static char (__pyx_k22[]) = "\x0e0\x000\x000\x001";
00220 static char (__pyx_k23[]) = "\x0e0\x000\x000\x0ff";
00221 static char (__pyx_k32[]) = "\x000\x000\x000\x000\x000\x000\x000\x000\x000\x000\x000\x000\x000\x000\x000\x000";
00222 static char (__pyx_k33[]) = "\x000\x000\x000\x000\x000\x000\x000\x000\x000\x000\x000\x000\x000\x000\x000\x001";
00223
00224 static PyObject *__pyx_n___author__;
00225 static PyObject *__pyx_n___copyright__;
00226 static PyObject *__pyx_n___license__;
00227 static PyObject *__pyx_n___url__;
00228 static PyObject *__pyx_n___version__;
00229 static PyObject *__pyx_n___iter_append;
00230 static PyObject *__pyx_n_ETH_ADDR_LEN;
00231 static PyObject *__pyx_n_ETH_ADDR_BITS;
00232 static PyObject *__pyx_n_ETH_TYPE_LEN;
00233 static PyObject *__pyx_n_ETH_CRC_LEN;
00234 static PyObject *__pyx_n_ETH_HDR_LEN;
00235 static PyObject *__pyx_n_ETH_LEN_MIN;
00236 static PyObject *__pyx_n_ETH_LEN_MAX;
00237 static PyObject *__pyx_n_ETH_MTU;
00238 static PyObject *__pyx_n_ETH_MIN;
00239 static PyObject *__pyx_n_ETH_TYPE_PUP;
00240 static PyObject *__pyx_n_ETH_TYPE_IP;
00241 static PyObject *__pyx_n_ETH_TYPE_ARP;
00242 static PyObject *__pyx_n_ETH_TYPE_REVARP;
00243 static PyObject *__pyx_n_ETH_TYPE_8021Q;
00244 static PyObject *__pyx_n_ETH_TYPE_IPV6;
00245 static PyObject *__pyx_n_ETH_TYPE_MPLS;
00246 static PyObject *__pyx_n_ETH_TYPE_MPLS_MCAST;
00247 static PyObject *__pyx_n_ETH_TYPE_PPPOEDISC;
00248 static PyObject *__pyx_n_ETH_TYPE_PPPOE;
00249 static PyObject *__pyx_n_ETH_TYPE_LOOPBACK;
00250 static PyObject *__pyx_n_ETH_ADDR_UNSPEC;
00251 static PyObject *__pyx_n_ETH_ADDR_BROADCAST;
00252 static PyObject *__pyx_n_eth_ntoa;
00253 static PyObject *__pyx_n_eth_aton;
00254 static PyObject *__pyx_n_eth_pack_hdr;
00255 static PyObject *__pyx_n_IP_ADDR_LEN;
00256 static PyObject *__pyx_n_IP_ADDR_BITS;
00257 static PyObject *__pyx_n_IP_HDR_LEN;
00258 static PyObject *__pyx_n_IP_OPT_LEN;
00259 static PyObject *__pyx_n_IP_OPT_LEN_MAX;
00260 static PyObject *__pyx_n_IP_HDR_LEN_MAX;
00261 static PyObject *__pyx_n_IP_LEN_MAX;
00262 static PyObject *__pyx_n_IP_LEN_MIN;
00263 static PyObject *__pyx_n_IP_TOS_DEFAULT;
00264 static PyObject *__pyx_n_IP_RF;
00265 static PyObject *__pyx_n_IP_DF;
00266 static PyObject *__pyx_n_IP_MF;
00267 static PyObject *__pyx_n_IP_OFFMASK;
00268 static PyObject *__pyx_n_IP_TTL_DEFAULT;
00269 static PyObject *__pyx_n_IP_TTL_MAX;
00270 static PyObject *__pyx_n_IP_PROTO_IP;
00271 static PyObject *__pyx_n_IP_PROTO_ICMP;
00272 static PyObject *__pyx_n_IP_PROTO_IGMP;
00273 static PyObject *__pyx_n_IP_PROTO_TCP;
00274 static PyObject *__pyx_n_IP_PROTO_UDP;
00275 static PyObject *__pyx_n_IP_PROTO_IPV6;
00276 static PyObject *__pyx_n_IP_PROTO_GRE;
00277 static PyObject *__pyx_n_IP_PROTO_ESP;
00278 static PyObject *__pyx_n_IP_PROTO_AH;
00279 static PyObject *__pyx_n_IP_PROTO_ICMPV6;
00280 static PyObject *__pyx_n_IP_PROTO_RAW;
00281 static PyObject *__pyx_n_IP_PROTO_RESERVED;
00282 static PyObject *__pyx_n_IP_PROTO_MAX;
00283 static PyObject *__pyx_n_IP_ADDR_ANY;
00284 static PyObject *__pyx_n_IP_ADDR_BROADCAST;
00285 static PyObject *__pyx_n_IP_ADDR_LOOPBACK;
00286 static PyObject *__pyx_n_IP_ADDR_MCAST_ALL;
00287 static PyObject *__pyx_n_IP_ADDR_MCAST_LOCAL;
00288 static PyObject *__pyx_n_ip_ntoa;
00289 static PyObject *__pyx_n_ip_aton;
00290 static PyObject *__pyx_n_ip_checksum;
00291 static PyObject *__pyx_n_ip_cksum_add;
00292 static PyObject *__pyx_n_ip_cksum_carry;
00293 static PyObject *__pyx_n_ip_pack_hdr;
00294 static PyObject *__pyx_n_IP6_ADDR_LEN;
00295 static PyObject *__pyx_n_IP6_ADDR_BITS;
00296 static PyObject *__pyx_n_IP6_HDR_LEN;
00297 static PyObject *__pyx_n_IP6_LEN_MIN;
00298 static PyObject *__pyx_n_IP6_LEN_MAX;
00299 static PyObject *__pyx_n_IP6_MTU_MIN;
00300 static PyObject *__pyx_n_IP6_HLIM_DEFAULT;
00301 static PyObject *__pyx_n_IP6_HLIM_MAX;
00302 static PyObject *__pyx_n_IP6_ADDR_UNSPEC;
00303 static PyObject *__pyx_n_IP6_ADDR_LOOPBACK;
00304 static PyObject *__pyx_n_ip6_ntoa;
00305 static PyObject *__pyx_n_ip6_aton;
00306 static PyObject *__pyx_n_ip6_checksum;
00307 static PyObject *__pyx_n_ip6_pack_hdr;
00308 static PyObject *__pyx_n_ADDR_TYPE_NONE;
00309 static PyObject *__pyx_n_ADDR_TYPE_ETH;
00310 static PyObject *__pyx_n_ADDR_TYPE_IP;
00311 static PyObject *__pyx_n_ADDR_TYPE_IP6;
00312 static PyObject *__pyx_n_ARP_HDR_LEN;
00313 static PyObject *__pyx_n_ARP_ETHIP_LEN;
00314 static PyObject *__pyx_n_ARP_HRD_ETH;
00315 static PyObject *__pyx_n_ARP_HRD_IEEE802;
00316 static PyObject *__pyx_n_ARP_PRO_IP;
00317 static PyObject *__pyx_n_ARP_OP_REQUEST;
00318 static PyObject *__pyx_n_ARP_OP_REPLY;
00319 static PyObject *__pyx_n_ARP_OP_REVREQUEST;
00320 static PyObject *__pyx_n_ARP_OP_REVREPLY;
00321 static PyObject *__pyx_n_arp_pack_hdr_ethip;
00322 static PyObject *__pyx_n_icmp_pack_hdr;
00323 static PyObject *__pyx_n_TCP_HDR_LEN;
00324 static PyObject *__pyx_n_TH_FIN;
00325 static PyObject *__pyx_n_TH_SYN;
00326 static PyObject *__pyx_n_TH_RST;
00327 static PyObject *__pyx_n_TH_PUSH;
00328 static PyObject *__pyx_n_TH_ACK;
00329 static PyObject *__pyx_n_TH_URG;
00330 static PyObject *__pyx_n_TH_ECE;
00331 static PyObject *__pyx_n_TH_CWR;
00332 static PyObject *__pyx_n_TCP_PORT_MAX;
00333 static PyObject *__pyx_n_TCP_WIN_MAX;
00334 static PyObject *__pyx_n_TCP_OPT_EOL;
00335 static PyObject *__pyx_n_TCP_OPT_NOP;
00336 static PyObject *__pyx_n_TCP_OPT_MSS;
00337 static PyObject *__pyx_n_TCP_OPT_WSCALE;
00338 static PyObject *__pyx_n_TCP_OPT_SACKOK;
00339 static PyObject *__pyx_n_TCP_OPT_SACK;
00340 static PyObject *__pyx_n_TCP_OPT_ECHO;
00341 static PyObject *__pyx_n_TCP_OPT_ECHOREPLY;
00342 static PyObject *__pyx_n_TCP_OPT_TIMESTAMP;
00343 static PyObject *__pyx_n_TCP_OPT_POCONN;
00344 static PyObject *__pyx_n_TCP_OPT_POSVC;
00345 static PyObject *__pyx_n_TCP_OPT_CC;
00346 static PyObject *__pyx_n_TCP_OPT_CCNEW;
00347 static PyObject *__pyx_n_TCP_OPT_CCECHO;
00348 static PyObject *__pyx_n_TCP_OPT_ALTSUM;
00349 static PyObject *__pyx_n_TCP_OPT_ALTSUMDATA;
00350 static PyObject *__pyx_n_TCP_OPT_SKEETER;
00351 static PyObject *__pyx_n_TCP_OPT_BUBBA;
00352 static PyObject *__pyx_n_TCP_OPT_TRAILSUM;
00353 static PyObject *__pyx_n_TCP_OPT_MD5;
00354 static PyObject *__pyx_n_TCP_OPT_SCPS;
00355 static PyObject *__pyx_n_TCP_OPT_SNACK;
00356 static PyObject *__pyx_n_TCP_OPT_REC;
00357 static PyObject *__pyx_n_TCP_OPT_CORRUPT;
00358 static PyObject *__pyx_n_TCP_OPT_SNAP;
00359 static PyObject *__pyx_n_TCP_OPT_TCPCOMP;
00360 static PyObject *__pyx_n_TCP_OPT_MAX;
00361 static PyObject *__pyx_n_tcp_pack_hdr;
00362 static PyObject *__pyx_n_UDP_HDR_LEN;
00363 static PyObject *__pyx_n_UDP_PORT_MAX;
00364 static PyObject *__pyx_n_udp_pack_hdr;
00365 static PyObject *__pyx_n_INTF_TYPE_OTHER;
00366 static PyObject *__pyx_n_INTF_TYPE_ETH;
00367 static PyObject *__pyx_n_INTF_TYPE_LOOPBACK;
00368 static PyObject *__pyx_n_INTF_TYPE_TUN;
00369 static PyObject *__pyx_n_INTF_FLAG_UP;
00370 static PyObject *__pyx_n_INTF_FLAG_LOOPBACK;
00371 static PyObject *__pyx_n_INTF_FLAG_POINTOPOINT;
00372 static PyObject *__pyx_n_INTF_FLAG_NOARP;
00373 static PyObject *__pyx_n_INTF_FLAG_BROADCAST;
00374 static PyObject *__pyx_n_INTF_FLAG_MULTICAST;
00375 static PyObject *__pyx_n_FW_OP_ALLOW;
00376 static PyObject *__pyx_n_FW_OP_BLOCK;
00377 static PyObject *__pyx_n_FW_DIR_IN;
00378 static PyObject *__pyx_n_FW_DIR_OUT;
00379 static PyObject *__pyx_n_BSD;
00380
00381 static PyObject *__pyx_k9p;
00382 static PyObject *__pyx_k10p;
00383 static PyObject *__pyx_k12p;
00384 static PyObject *__pyx_k13p;
00385
00386 static PyObject *__pyx_n_ValueError;
00387
00388 static PyObject *__pyx_k60p;
00389
00390 static char (__pyx_k60[]) = "not a %d-byte binary string: %r";
00391
00392 static PyObject *__pyx_f_4dnet___memcpy(char (*__pyx_v_dst),PyObject *__pyx_v_src,int __pyx_v_n) {
00393 PyObject *__pyx_r;
00394 int __pyx_1;
00395 PyObject *__pyx_2 = 0;
00396 PyObject *__pyx_3 = 0;
00397 PyObject *__pyx_4 = 0;
00398 char (*__pyx_5);
00399 Py_INCREF(__pyx_v_src);
00400
00401
00402 __pyx_1 = (PyString_Size(__pyx_v_src) != __pyx_v_n);
00403 if (__pyx_1) {
00404
00405
00406 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; goto __pyx_L1;}
00407 __pyx_3 = PyInt_FromLong(__pyx_v_n); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; goto __pyx_L1;}
00408 __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; goto __pyx_L1;}
00409 PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
00410 Py_INCREF(__pyx_v_src);
00411 PyTuple_SET_ITEM(__pyx_4, 1, __pyx_v_src);
00412 __pyx_3 = 0;
00413 __pyx_3 = PyNumber_Remainder(__pyx_k60p, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; goto __pyx_L1;}
00414 Py_DECREF(__pyx_4); __pyx_4 = 0;
00415 __Pyx_Raise(__pyx_2, __pyx_3, 0);
00416 Py_DECREF(__pyx_2); __pyx_2 = 0;
00417 Py_DECREF(__pyx_3); __pyx_3 = 0;
00418 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; goto __pyx_L1;}
00419 goto __pyx_L2;
00420 }
00421 __pyx_L2:;
00422
00423
00424 __pyx_5 = PyString_AsString(__pyx_v_src); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; goto __pyx_L1;}
00425 memcpy(__pyx_v_dst,__pyx_5,__pyx_v_n);
00426
00427 __pyx_r = Py_None; Py_INCREF(__pyx_r);
00428 goto __pyx_L0;
00429 __pyx_L1:;
00430 Py_XDECREF(__pyx_2);
00431 Py_XDECREF(__pyx_3);
00432 Py_XDECREF(__pyx_4);
00433 __Pyx_AddTraceback("dnet.__memcpy");
00434 __pyx_r = 0;
00435 __pyx_L0:;
00436 Py_DECREF(__pyx_v_src);
00437 return __pyx_r;
00438 }
00439
00440 static PyObject *__pyx_f_4dnet___oserror(void) {
00441 extern int errno;
00442 PyObject *__pyx_r;
00443 PyObject *__pyx_1 = 0;
00444
00445
00446 __pyx_1 = PyString_FromString(strerror(errno)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
00447 __pyx_r = __pyx_1;
00448 __pyx_1 = 0;
00449 goto __pyx_L0;
00450
00451 __pyx_r = Py_None; Py_INCREF(__pyx_r);
00452 goto __pyx_L0;
00453 __pyx_L1:;
00454 Py_XDECREF(__pyx_1);
00455 __Pyx_AddTraceback("dnet.__oserror");
00456 __pyx_r = 0;
00457 __pyx_L0:;
00458 return __pyx_r;
00459 }
00460
00461 static PyObject *__pyx_n_append;
00462
00463 static PyObject *__pyx_f_4dnet___iter_append(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
00464 static PyObject *__pyx_f_4dnet___iter_append(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
00465 PyObject *__pyx_v_entry = 0;
00466 PyObject *__pyx_v_l = 0;
00467 PyObject *__pyx_r;
00468 PyObject *__pyx_1 = 0;
00469 PyObject *__pyx_2 = 0;
00470 PyObject *__pyx_3 = 0;
00471 static char *__pyx_argnames[] = {"entry","l",0};
00472 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_entry, &__pyx_v_l)) return 0;
00473 Py_INCREF(__pyx_v_entry);
00474 Py_INCREF(__pyx_v_l);
00475
00476
00477 __pyx_1 = PyObject_GetAttr(__pyx_v_l, __pyx_n_append); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; goto __pyx_L1;}
00478 __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; goto __pyx_L1;}
00479 Py_INCREF(__pyx_v_entry);
00480 PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_entry);
00481 __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; goto __pyx_L1;}
00482 Py_DECREF(__pyx_1); __pyx_1 = 0;
00483 Py_DECREF(__pyx_2); __pyx_2 = 0;
00484 Py_DECREF(__pyx_3); __pyx_3 = 0;
00485
00486 __pyx_r = Py_None; Py_INCREF(__pyx_r);
00487 goto __pyx_L0;
00488 __pyx_L1:;
00489 Py_XDECREF(__pyx_1);
00490 Py_XDECREF(__pyx_2);
00491 Py_XDECREF(__pyx_3);
00492 __Pyx_AddTraceback("dnet.__iter_append");
00493 __pyx_r = 0;
00494 __pyx_L0:;
00495 Py_DECREF(__pyx_v_entry);
00496 Py_DECREF(__pyx_v_l);
00497 return __pyx_r;
00498 }
00499
00500 static PyObject *__pyx_n_OSError;
00501
00502 static int __pyx_f_4dnet_3eth___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
00503 static int __pyx_f_4dnet_3eth___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
00504 PyObject *__pyx_v_device = 0;
00505 int __pyx_r;
00506 char (*__pyx_1);
00507 int __pyx_2;
00508 PyObject *__pyx_3 = 0;
00509 PyObject *__pyx_4 = 0;
00510 static char *__pyx_argnames[] = {"device",0};
00511 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_device)) return -1;
00512 Py_INCREF(__pyx_v_self);
00513 Py_INCREF(__pyx_v_device);
00514
00515
00516 __pyx_1 = PyString_AsString(__pyx_v_device); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}
00517 ((struct __pyx_obj_4dnet_eth *)__pyx_v_self)->eth = eth_open(__pyx_1);
00518
00519
00520 __pyx_2 = (!(((struct __pyx_obj_4dnet_eth *)__pyx_v_self)->eth != 0));
00521 if (__pyx_2) {
00522
00523
00524 __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; goto __pyx_L1;}
00525 __pyx_4 = __pyx_f_4dnet___oserror(); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; goto __pyx_L1;}
00526 __Pyx_Raise(__pyx_3, __pyx_4, 0);
00527 Py_DECREF(__pyx_3); __pyx_3 = 0;
00528 Py_DECREF(__pyx_4); __pyx_4 = 0;
00529 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; goto __pyx_L1;}
00530 goto __pyx_L2;
00531 }
00532 __pyx_L2:;
00533
00534 __pyx_r = 0;
00535 goto __pyx_L0;
00536 __pyx_L1:;
00537 Py_XDECREF(__pyx_3);
00538 Py_XDECREF(__pyx_4);
00539 __Pyx_AddTraceback("dnet.eth.__init__");
00540 __pyx_r = -1;
00541 __pyx_L0:;
00542 Py_DECREF(__pyx_v_self);
00543 Py_DECREF(__pyx_v_device);
00544 return __pyx_r;
00545 }
00546
00547 static PyObject *__pyx_f_4dnet_3eth_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
00548 static char __pyx_doc_4dnet_3eth_get[] = "Return the MAC address associated with the device as a\n binary string.";
00549 static PyObject *__pyx_f_4dnet_3eth_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
00550 eth_addr_t __pyx_v_ea;
00551 PyObject *__pyx_r;
00552 int __pyx_1;
00553 PyObject *__pyx_2 = 0;
00554 PyObject *__pyx_3 = 0;
00555 static char *__pyx_argnames[] = {0};
00556 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
00557 Py_INCREF(__pyx_v_self);
00558
00559
00560 __pyx_1 = (eth_get(((struct __pyx_obj_4dnet_eth *)__pyx_v_self)->eth,(&__pyx_v_ea)) < 0);
00561 if (__pyx_1) {
00562
00563
00564 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; goto __pyx_L1;}
00565 __pyx_3 = __pyx_f_4dnet___oserror(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; goto __pyx_L1;}
00566 __Pyx_Raise(__pyx_2, __pyx_3, 0);
00567 Py_DECREF(__pyx_2); __pyx_2 = 0;
00568 Py_DECREF(__pyx_3); __pyx_3 = 0;
00569 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; goto __pyx_L1;}
00570 goto __pyx_L2;
00571 }
00572 __pyx_L2:;
00573
00574
00575 __pyx_2 = PyString_FromStringAndSize(__pyx_v_ea.data,6); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L1;}
00576 __pyx_r = __pyx_2;
00577 __pyx_2 = 0;
00578 goto __pyx_L0;
00579
00580 __pyx_r = Py_None; Py_INCREF(__pyx_r);
00581 goto __pyx_L0;
00582 __pyx_L1:;
00583 Py_XDECREF(__pyx_2);
00584 Py_XDECREF(__pyx_3);
00585 __Pyx_AddTraceback("dnet.eth.get");
00586 __pyx_r = 0;
00587 __pyx_L0:;
00588 Py_DECREF(__pyx_v_self);
00589 return __pyx_r;
00590 }
00591
00592 static PyObject *__pyx_f_4dnet_3eth_set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
00593 static char __pyx_doc_4dnet_3eth_set[] = "Set the MAC address for the device, returning 0 on success,\n -1 on failure.\n \n Arguments:\n eth_addr -- 6-byte binary string (e.g. \'\\x00\\xde\\xad\\xbe\\xef\\x00\')\n ";
00594 static PyObject *__pyx_f_4dnet_3eth_set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
00595 PyObject *__pyx_v_value = 0;
00596 eth_addr_t __pyx_v_ea;
00597 PyObject *__pyx_r;
00598 PyObject *__pyx_1 = 0;
00599 int __pyx_2;
00600 PyObject *__pyx_3 = 0;
00601 static char *__pyx_argnames[] = {"value",0};
00602 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_value)) return 0;
00603 Py_INCREF(__pyx_v_self);
00604 Py_INCREF(__pyx_v_value);
00605
00606
00607 __pyx_1 = __pyx_f_4dnet___memcpy(__pyx_v_ea.data,__pyx_v_value,6); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; goto __pyx_L1;}
00608 Py_DECREF(__pyx_1); __pyx_1 = 0;
00609
00610
00611 __pyx_2 = (eth_set(((struct __pyx_obj_4dnet_eth *)__pyx_v_self)->eth,(&__pyx_v_ea)) < 0);
00612 if (__pyx_2) {
00613
00614
00615 __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; goto __pyx_L1;}
00616 __pyx_3 = __pyx_f_4dnet___oserror(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; goto __pyx_L1;}
00617 __Pyx_Raise(__pyx_1, __pyx_3, 0);
00618 Py_DECREF(__pyx_1); __pyx_1 = 0;
00619 Py_DECREF(__pyx_3); __pyx_3 = 0;
00620 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; goto __pyx_L1;}
00621 goto __pyx_L2;
00622 }
00623 __pyx_L2:;
00624
00625 __pyx_r = Py_None; Py_INCREF(__pyx_r);
00626 goto __pyx_L0;
00627 __pyx_L1:;
00628 Py_XDECREF(__pyx_1);
00629 Py_XDECREF(__pyx_3);
00630 __Pyx_AddTraceback("dnet.eth.set");
00631 __pyx_r = 0;
00632 __pyx_L0:;
00633 Py_DECREF(__pyx_v_self);
00634 Py_DECREF(__pyx_v_value);
00635 return __pyx_r;
00636 }
00637
00638 static PyObject *__pyx_f_4dnet_3eth_send(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
00639 static char __pyx_doc_4dnet_3eth_send[] = "Send an Ethernet frame, returning the number of bytes sent\n or -1 on failure.\n \n Arguments:\n frame -- binary string representing an Ethernet frame\n ";
00640 static PyObject *__pyx_f_4dnet_3eth_send(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
00641 PyObject *__pyx_v_frame = 0;
00642 PyObject *__pyx_r;
00643 char (*__pyx_1);
00644 PyObject *__pyx_2 = 0;
00645 static char *__pyx_argnames[] = {"frame",0};
00646 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_frame)) return 0;
00647 Py_INCREF(__pyx_v_self);
00648 Py_INCREF(__pyx_v_frame);
00649
00650
00651 __pyx_1 = PyString_AsString(__pyx_v_frame); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; goto __pyx_L1;}
00652 __pyx_2 = PyInt_FromLong(eth_send(((struct __pyx_obj_4dnet_eth *)__pyx_v_self)->eth,__pyx_1,PyString_Size(__pyx_v_frame))); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; goto __pyx_L1;}
00653 __pyx_r = __pyx_2;
00654 __pyx_2 = 0;
00655 goto __pyx_L0;
00656
00657 __pyx_r = Py_None; Py_INCREF(__pyx_r);
00658 goto __pyx_L0;
00659 __pyx_L1:;
00660 Py_XDECREF(__pyx_2);
00661 __Pyx_AddTraceback("dnet.eth.send");
00662 __pyx_r = 0;
00663 __pyx_L0:;
00664 Py_DECREF(__pyx_v_self);
00665 Py_DECREF(__pyx_v_frame);
00666 return __pyx_r;
00667 }
00668
00669 static void __pyx_f_4dnet_3eth___dealloc__(PyObject *__pyx_v_self);
00670 static void __pyx_f_4dnet_3eth___dealloc__(PyObject *__pyx_v_self) {
00671 int __pyx_1;
00672 Py_INCREF(__pyx_v_self);
00673
00674
00675 __pyx_1 = (((struct __pyx_obj_4dnet_eth *)__pyx_v_self)->eth != 0);
00676 if (__pyx_1) {
00677
00678
00679 eth_close(((struct __pyx_obj_4dnet_eth *)__pyx_v_self)->eth);
00680 goto __pyx_L2;
00681 }
00682 __pyx_L2:;
00683
00684 goto __pyx_L0;
00685 __pyx_L1:;
00686 __Pyx_AddTraceback("dnet.eth.__dealloc__");
00687 __pyx_L0:;
00688 Py_DECREF(__pyx_v_self);
00689 }
00690
00691 static PyObject *__pyx_f_4dnet_eth_ntoa(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
00692 static char __pyx_doc_4dnet_eth_ntoa[] = "Convert an Ethernet MAC address from 6-byte packed binary string to\n a printable string (\'00:de:ad:be:ef:00\').";
00693 static PyObject *__pyx_f_4dnet_eth_ntoa(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
00694 PyObject *__pyx_v_buf = 0;
00695 eth_addr_t __pyx_v_ea;
00696 PyObject *__pyx_r;
00697 PyObject *__pyx_1 = 0;
00698 static char *__pyx_argnames[] = {"buf",0};
00699 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_buf)) return 0;
00700 Py_INCREF(__pyx_v_buf);
00701
00702
00703 __pyx_1 = __pyx_f_4dnet___memcpy(__pyx_v_ea.data,__pyx_v_buf,6); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; goto __pyx_L1;}
00704 Py_DECREF(__pyx_1); __pyx_1 = 0;
00705
00706
00707 __pyx_1 = PyString_FromString(eth_ntoa((&__pyx_v_ea))); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; goto __pyx_L1;}
00708 __pyx_r = __pyx_1;
00709 __pyx_1 = 0;
00710 goto __pyx_L0;
00711
00712 __pyx_r = Py_None; Py_INCREF(__pyx_r);
00713 goto __pyx_L0;
00714 __pyx_L1:;
00715 Py_XDECREF(__pyx_1);
00716 __Pyx_AddTraceback("dnet.eth_ntoa");
00717 __pyx_r = 0;
00718 __pyx_L0:;
00719 Py_DECREF(__pyx_v_buf);
00720 return __pyx_r;
00721 }
00722
00723 static PyObject *__pyx_k61p;
00724
00725 static char (__pyx_k61[]) = "invalid Ethernet address";
00726
00727 static PyObject *__pyx_f_4dnet_eth_aton(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
00728 static char __pyx_doc_4dnet_eth_aton[] = "Convert an Ethernet MAC address from a printable string to a\n packed binary string (\'\\x00\\xde\\xad\\xbe\\xef\\x00\').";
00729 static PyObject *__pyx_f_4dnet_eth_aton(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
00730 PyObject *__pyx_v_buf = 0;
00731 eth_addr_t __pyx_v_ea;
00732 PyObject *__pyx_r;
00733 char (*__pyx_1);
00734 int __pyx_2;
00735 PyObject *__pyx_3 = 0;
00736 static char *__pyx_argnames[] = {"buf",0};
00737 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_buf)) return 0;
00738 Py_INCREF(__pyx_v_buf);
00739
00740
00741 __pyx_1 = PyString_AsString(__pyx_v_buf); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; goto __pyx_L1;}
00742 __pyx_2 = (eth_aton(__pyx_1,(&__pyx_v_ea)) < 0);
00743 if (__pyx_2) {
00744
00745
00746 __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L1;}
00747 __Pyx_Raise(__pyx_3, __pyx_k61p, 0);
00748 Py_DECREF(__pyx_3); __pyx_3 = 0;
00749 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L1;}
00750 goto __pyx_L2;
00751 }
00752 __pyx_L2:;
00753
00754
00755 __pyx_3 = PyString_FromStringAndSize(__pyx_v_ea.data,6); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}
00756 __pyx_r = __pyx_3;
00757 __pyx_3 = 0;
00758 goto __pyx_L0;
00759
00760 __pyx_r = Py_None; Py_INCREF(__pyx_r);
00761 goto __pyx_L0;
00762 __pyx_L1:;
00763 Py_XDECREF(__pyx_3);
00764 __Pyx_AddTraceback("dnet.eth_aton");
00765 __pyx_r = 0;
00766 __pyx_L0:;
00767 Py_DECREF(__pyx_v_buf);
00768 return __pyx_r;
00769 }
00770
00771 static PyObject *__pyx_f_4dnet_eth_pack_hdr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
00772 static char __pyx_doc_4dnet_eth_pack_hdr[] = "Return a packed binary string representing an Ethernet header.\n \n Keyword arguments:\n dst -- destination address (6-byte binary string)\n src -- source address (6-byte binary string)\n type -- Ethernet payload type (ETH_TYPE_*) (16-bit integer)\n ";
00773 static PyObject *__pyx_f_4dnet_eth_pack_hdr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
00774 PyObject *__pyx_v_dst = 0;
00775 PyObject *__pyx_v_src = 0;
00776 PyObject *__pyx_v_type = 0;
00777 char (__pyx_v_hdr[14]);
00778 eth_addr_t __pyx_v_s;
00779 eth_addr_t __pyx_v_d;
00780 PyObject *__pyx_r;
00781 PyObject *__pyx_1 = 0;
00782 int __pyx_2;
00783 static char *__pyx_argnames[] = {"dst","src","type",0};
00784 __pyx_v_dst = __pyx_k16;
00785 __pyx_v_src = __pyx_k17;
00786 __pyx_v_type = __pyx_k18;
00787 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|OOO", __pyx_argnames, &__pyx_v_dst, &__pyx_v_src, &__pyx_v_type)) return 0;
00788 Py_INCREF(__pyx_v_dst);
00789 Py_INCREF(__pyx_v_src);
00790 Py_INCREF(__pyx_v_type);
00791
00792
00793 __pyx_1 = __pyx_f_4dnet___memcpy(__pyx_v_s.data,__pyx_v_src,6); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; goto __pyx_L1;}
00794 Py_DECREF(__pyx_1); __pyx_1 = 0;
00795
00796
00797 __pyx_1 = __pyx_f_4dnet___memcpy(__pyx_v_d.data,__pyx_v_dst,6); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; goto __pyx_L1;}
00798 Py_DECREF(__pyx_1); __pyx_1 = 0;
00799
00800
00801 __pyx_2 = PyInt_AsLong(__pyx_v_type); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; goto __pyx_L1;}
00802 eth_pack_hdr(__pyx_v_hdr,__pyx_v_d,__pyx_v_s,__pyx_2);
00803
00804
00805 __pyx_1 = PyString_FromStringAndSize(__pyx_v_hdr,14); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;}
00806 __pyx_r = __pyx_1;
00807 __pyx_1 = 0;
00808 goto __pyx_L0;
00809
00810 __pyx_r = Py_None; Py_INCREF(__pyx_r);
00811 goto __pyx_L0;
00812 __pyx_L1:;
00813 Py_XDECREF(__pyx_1);
00814 __Pyx_AddTraceback("dnet.eth_pack_hdr");
00815 __pyx_r = 0;
00816 __pyx_L0:;
00817 Py_DECREF(__pyx_v_dst);
00818 Py_DECREF(__pyx_v_src);
00819 Py_DECREF(__pyx_v_type);
00820 return __pyx_r;
00821 }
00822
00823 static int __pyx_f_4dnet_2ip___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
00824 static int __pyx_f_4dnet_2ip___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
00825 int __pyx_r;
00826 int __pyx_1;
00827 PyObject *__pyx_2 = 0;
00828 PyObject *__pyx_3 = 0;
00829 static char *__pyx_argnames[] = {0};
00830 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return -1;
00831 Py_INCREF(__pyx_v_self);
00832
00833
00834 ((struct __pyx_obj_4dnet_ip *)__pyx_v_self)->ip = ip_open();
00835
00836
00837 __pyx_1 = (!(((struct __pyx_obj_4dnet_ip *)__pyx_v_self)->ip != 0));
00838 if (__pyx_1) {
00839
00840
00841 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; goto __pyx_L1;}
00842 __pyx_3 = __pyx_f_4dnet___oserror(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; goto __pyx_L1;}
00843 __Pyx_Raise(__pyx_2, __pyx_3, 0);
00844 Py_DECREF(__pyx_2); __pyx_2 = 0;
00845 Py_DECREF(__pyx_3); __pyx_3 = 0;
00846 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; goto __pyx_L1;}
00847 goto __pyx_L2;
00848 }
00849 __pyx_L2:;
00850
00851 __pyx_r = 0;
00852 goto __pyx_L0;
00853 __pyx_L1:;
00854 Py_XDECREF(__pyx_2);
00855 Py_XDECREF(__pyx_3);
00856 __Pyx_AddTraceback("dnet.ip.__init__");
00857 __pyx_r = -1;
00858 __pyx_L0:;
00859 Py_DECREF(__pyx_v_self);
00860 return __pyx_r;
00861 }
00862
00863 static PyObject *__pyx_f_4dnet_2ip_send(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
00864 static char __pyx_doc_4dnet_2ip_send[] = "Send an IP packet, returning the number of bytes sent\n or -1 on failure.\n\n Arguments:\n pkt -- binary string representing an IP packet\n ";
00865 static PyObject *__pyx_f_4dnet_2ip_send(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
00866 PyObject *__pyx_v_pkt = 0;
00867 PyObject *__pyx_r;
00868 char (*__pyx_1);
00869 PyObject *__pyx_2 = 0;
00870 static char *__pyx_argnames[] = {"pkt",0};
00871 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_pkt)) return 0;
00872 Py_INCREF(__pyx_v_self);
00873 Py_INCREF(__pyx_v_pkt);
00874
00875
00876 __pyx_1 = PyString_AsString(__pyx_v_pkt); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; goto __pyx_L1;}
00877 __pyx_2 = PyInt_FromLong(ip_send(((struct __pyx_obj_4dnet_ip *)__pyx_v_self)->ip,__pyx_1,PyString_Size(__pyx_v_pkt))); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; goto __pyx_L1;}
00878 __pyx_r = __pyx_2;
00879 __pyx_2 = 0;
00880 goto __pyx_L0;
00881
00882 __pyx_r = Py_None; Py_INCREF(__pyx_r);
00883 goto __pyx_L0;
00884 __pyx_L1:;
00885 Py_XDECREF(__pyx_2);
00886 __Pyx_AddTraceback("dnet.ip.send");
00887 __pyx_r = 0;
00888 __pyx_L0:;
00889 Py_DECREF(__pyx_v_self);
00890 Py_DECREF(__pyx_v_pkt);
00891 return __pyx_r;
00892 }
00893
00894 static void __pyx_f_4dnet_2ip___dealloc__(PyObject *__pyx_v_self);
00895 static void __pyx_f_4dnet_2ip___dealloc__(PyObject *__pyx_v_self) {
00896 int __pyx_1;
00897 Py_INCREF(__pyx_v_self);
00898
00899
00900 __pyx_1 = (((struct __pyx_obj_4dnet_ip *)__pyx_v_self)->ip != 0);
00901 if (__pyx_1) {
00902
00903
00904 ip_close(((struct __pyx_obj_4dnet_ip *)__pyx_v_self)->ip);
00905 goto __pyx_L2;
00906 }
00907 __pyx_L2:;
00908
00909 goto __pyx_L0;
00910 __pyx_L1:;
00911 __Pyx_AddTraceback("dnet.ip.__dealloc__");
00912 __pyx_L0:;
00913 Py_DECREF(__pyx_v_self);
00914 }
00915
00916 static PyObject *__pyx_f_4dnet_ip_ntoa(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
00917 static char __pyx_doc_4dnet_ip_ntoa[] = "Convert an IP address from a 4-byte packed binary string or\n integer to a printable string (\'10.0.0.1\').";
00918 static PyObject *__pyx_f_4dnet_ip_ntoa(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
00919 PyObject *__pyx_v_buf = 0;
00920 ip_addr_t __pyx_v_ia;
00921 unsigned int __pyx_v_i;
00922 PyObject *__pyx_r;
00923 int __pyx_1;
00924 unsigned long __pyx_2;
00925 PyObject *__pyx_3 = 0;
00926 static char *__pyx_argnames[] = {"buf",0};
00927 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_buf)) return 0;
00928 Py_INCREF(__pyx_v_buf);
00929
00930
00931 __pyx_1 = PyInt_Check(__pyx_v_buf);
00932 if (!__pyx_1) {
00933 __pyx_1 = PyLong_Check(__pyx_v_buf);
00934 }
00935 if (__pyx_1) {
00936
00937
00938 __pyx_2 = PyLong_AsUnsignedLong(__pyx_v_buf); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; goto __pyx_L1;}
00939 __pyx_v_i = ntohl(__pyx_2);
00940
00941
00942 memcpy(((char (*))(&__pyx_v_ia)),((char (*))(&__pyx_v_i)),4);
00943 goto __pyx_L2;
00944 }
00945 {
00946
00947
00948 __pyx_3 = __pyx_f_4dnet___memcpy(((char (*))(&__pyx_v_ia)),__pyx_v_buf,4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; goto __pyx_L1;}
00949 Py_DECREF(__pyx_3); __pyx_3 = 0;
00950 }
00951 __pyx_L2:;
00952
00953
00954 __pyx_3 = PyString_FromString(ip_ntoa((&__pyx_v_ia))); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; goto __pyx_L1;}
00955 __pyx_r = __pyx_3;
00956 __pyx_3 = 0;
00957 goto __pyx_L0;
00958
00959 __pyx_r = Py_None; Py_INCREF(__pyx_r);
00960 goto __pyx_L0;
00961 __pyx_L1:;
00962 Py_XDECREF(__pyx_3);
00963 __Pyx_AddTraceback("dnet.ip_ntoa");
00964 __pyx_r = 0;
00965 __pyx_L0:;
00966 Py_DECREF(__pyx_v_buf);
00967 return __pyx_r;
00968 }
00969
00970 static PyObject *__pyx_k62p;
00971
00972 static char (__pyx_k62[]) = "invalid IP address";
00973
00974 static PyObject *__pyx_f_4dnet_ip_aton(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
00975 static char __pyx_doc_4dnet_ip_aton[] = "Convert an IP address from a printable string to a\n packed binary string (\'\\x0a\\x00\\x00\\x01\').";
00976 static PyObject *__pyx_f_4dnet_ip_aton(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
00977 PyObject *__pyx_v_buf = 0;
00978 ip_addr_t __pyx_v_ia;
00979 PyObject *__pyx_r;
00980 char (*__pyx_1);
00981 int __pyx_2;
00982 PyObject *__pyx_3 = 0;
00983 static char *__pyx_argnames[] = {"buf",0};
00984 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_buf)) return 0;
00985 Py_INCREF(__pyx_v_buf);
00986
00987
00988 __pyx_1 = PyString_AsString(__pyx_v_buf); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; goto __pyx_L1;}
00989 __pyx_2 = (ip_aton(__pyx_1,(&__pyx_v_ia)) < 0);
00990 if (__pyx_2) {
00991
00992
00993 __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; goto __pyx_L1;}
00994 __Pyx_Raise(__pyx_3, __pyx_k62p, 0);
00995 Py_DECREF(__pyx_3); __pyx_3 = 0;
00996 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; goto __pyx_L1;}
00997 goto __pyx_L2;
00998 }
00999 __pyx_L2:;
01000
01001
01002 __pyx_3 = PyString_FromStringAndSize(((char (*))(&__pyx_v_ia)),4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; goto __pyx_L1;}
01003 __pyx_r = __pyx_3;
01004 __pyx_3 = 0;
01005 goto __pyx_L0;
01006
01007 __pyx_r = Py_None; Py_INCREF(__pyx_r);
01008 goto __pyx_L0;
01009 __pyx_L1:;
01010 Py_XDECREF(__pyx_3);
01011 __Pyx_AddTraceback("dnet.ip_aton");
01012 __pyx_r = 0;
01013 __pyx_L0:;
01014 Py_DECREF(__pyx_v_buf);
01015 return __pyx_r;
01016 }
01017
01018 static PyObject *__pyx_n_TypeError;
01019
01020 static PyObject *__pyx_f_4dnet_ip_checksum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
01021 static char __pyx_doc_4dnet_ip_checksum[] = "Return packed binary string representing an IP packet \n with the IP and transport-layer checksums set.\n \n Arguments:\n pkt -- binary string representing an IP packet\n ";
01022 static PyObject *__pyx_f_4dnet_ip_checksum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
01023 PyObject *__pyx_v_pkt = 0;
01024 char (__pyx_v_buf[2048]);
01025 char (*__pyx_v_p);
01026 int __pyx_v_n;
01027 PyObject *__pyx_v_s;
01028 PyObject *__pyx_r;
01029 int __pyx_1;
01030 PyObject *__pyx_2 = 0;
01031 char (*__pyx_3);
01032 static char *__pyx_argnames[] = {"pkt",0};
01033 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_pkt)) return 0;
01034 Py_INCREF(__pyx_v_pkt);
01035 __pyx_v_s = Py_None; Py_INCREF(__pyx_v_s);
01036
01037
01038 __pyx_1 = (PyObject_AsReadBuffer(__pyx_v_pkt,(&__pyx_v_p),(&__pyx_v_n)) == 0);
01039 if (__pyx_1) {
01040
01041
01042 __pyx_1 = (__pyx_v_n < 2048);
01043 if (__pyx_1) {
01044
01045
01046 memcpy(__pyx_v_buf,__pyx_v_p,__pyx_v_n);
01047
01048
01049 ip_checksum(__pyx_v_buf,__pyx_v_n);
01050
01051
01052 __pyx_2 = PyString_FromStringAndSize(__pyx_v_buf,__pyx_v_n); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; goto __pyx_L1;}
01053 __pyx_r = __pyx_2;
01054 __pyx_2 = 0;
01055 goto __pyx_L0;
01056 goto __pyx_L3;
01057 }
01058 __pyx_L3:;
01059
01060
01061 __pyx_v_p = malloc(__pyx_v_n);
01062
01063
01064 __pyx_3 = PyString_AsString(__pyx_v_pkt); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; goto __pyx_L1;}
01065 memcpy(__pyx_v_p,__pyx_3,__pyx_v_n);
01066
01067
01068 ip_checksum(__pyx_v_p,__pyx_v_n);
01069
01070
01071 __pyx_2 = PyString_FromStringAndSize(__pyx_v_p,__pyx_v_n); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; goto __pyx_L1;}
01072 Py_DECREF(__pyx_v_s);
01073 __pyx_v_s = __pyx_2;
01074 __pyx_2 = 0;
01075
01076
01077 free(__pyx_v_p);
01078
01079
01080 Py_INCREF(__pyx_v_s);
01081 __pyx_r = __pyx_v_s;
01082 goto __pyx_L0;
01083 goto __pyx_L2;
01084 }
01085 __pyx_L2:;
01086
01087
01088 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_TypeError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; goto __pyx_L1;}
01089 __Pyx_Raise(__pyx_2, 0, 0);
01090 Py_DECREF(__pyx_2); __pyx_2 = 0;
01091 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; goto __pyx_L1;}
01092
01093 __pyx_r = Py_None; Py_INCREF(__pyx_r);
01094 goto __pyx_L0;
01095 __pyx_L1:;
01096 Py_XDECREF(__pyx_2);
01097 __Pyx_AddTraceback("dnet.ip_checksum");
01098 __pyx_r = 0;
01099 __pyx_L0:;
01100 Py_DECREF(__pyx_v_s);
01101 Py_DECREF(__pyx_v_pkt);
01102 return __pyx_r;
01103 }
01104
01105 static PyObject *__pyx_f_4dnet_ip_cksum_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
01106 static PyObject *__pyx_f_4dnet_ip_cksum_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
01107 PyObject *__pyx_v_buf = 0;
01108 int __pyx_v_sum;
01109 char (*__pyx_v_p);
01110 int __pyx_v_n;
01111 PyObject *__pyx_r;
01112 int __pyx_1;
01113 PyObject *__pyx_2 = 0;
01114 static char *__pyx_argnames[] = {"buf","sum",0};
01115 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "Oi", __pyx_argnames, &__pyx_v_buf, &__pyx_v_sum)) return 0;
01116 Py_INCREF(__pyx_v_buf);
01117
01118
01119 __pyx_1 = (PyObject_AsReadBuffer(__pyx_v_buf,(&__pyx_v_p),(&__pyx_v_n)) == 0);
01120 if (__pyx_1) {
01121
01122
01123 __pyx_2 = PyInt_FromLong(ip_cksum_add(__pyx_v_p,__pyx_v_n,__pyx_v_sum)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; goto __pyx_L1;}
01124 __pyx_r = __pyx_2;
01125 __pyx_2 = 0;
01126 goto __pyx_L0;
01127 goto __pyx_L2;
01128 }
01129 {
01130
01131
01132 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_TypeError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; goto __pyx_L1;}
01133 __Pyx_Raise(__pyx_2, 0, 0);
01134 Py_DECREF(__pyx_2); __pyx_2 = 0;
01135 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; goto __pyx_L1;}
01136 }
01137 __pyx_L2:;
01138
01139 __pyx_r = Py_None; Py_INCREF(__pyx_r);
01140 goto __pyx_L0;
01141 __pyx_L1:;
01142 Py_XDECREF(__pyx_2);
01143 __Pyx_AddTraceback("dnet.ip_cksum_add");
01144 __pyx_r = 0;
01145 __pyx_L0:;
01146 Py_DECREF(__pyx_v_buf);
01147 return __pyx_r;
01148 }
01149
01150 static PyObject *__pyx_f_4dnet_ip_cksum_carry(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
01151 static PyObject *__pyx_f_4dnet_ip_cksum_carry(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
01152 int __pyx_v_sum;
01153 PyObject *__pyx_r;
01154 PyObject *__pyx_1 = 0;
01155 static char *__pyx_argnames[] = {"sum",0};
01156 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "i", __pyx_argnames, &__pyx_v_sum)) return 0;
01157
01158
01159 __pyx_1 = PyInt_FromLong(ip_cksum_carry(__pyx_v_sum)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}
01160 __pyx_r = __pyx_1;
01161 __pyx_1 = 0;
01162 goto __pyx_L0;
01163
01164 __pyx_r = Py_None; Py_INCREF(__pyx_r);
01165 goto __pyx_L0;
01166 __pyx_L1:;
01167 Py_XDECREF(__pyx_1);
01168 __Pyx_AddTraceback("dnet.ip_cksum_carry");
01169 __pyx_r = 0;
01170 __pyx_L0:;
01171 return __pyx_r;
01172 }
01173
01174 static PyObject *__pyx_f_4dnet_ip_pack_hdr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
01175 static char __pyx_doc_4dnet_ip_pack_hdr[] = "Return a packed binary string representing an IP header.\n \n Keyword arguments:\n tos -- type of service (8-bit integer)\n len -- length (IP_HDR_LEN + payload) (16-bit integer)\n id -- packet ID (16-bit integer)\n off -- fragmentation offset (16-bit integer)\n ttl -- time-to-live (8-bit integer)\n p -- protocol (IP_PROTO_*) (8-bit integer)\n src -- source address (4-byte binary string)\n dst -- destination address (4-byte binary string)\n ";
01176 static PyObject *__pyx_f_4dnet_ip_pack_hdr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
01177 PyObject *__pyx_v_tos = 0;
01178 PyObject *__pyx_v_len = 0;
01179 PyObject *__pyx_v_id = 0;
01180 PyObject *__pyx_v_off = 0;
01181 PyObject *__pyx_v_ttl = 0;
01182 PyObject *__pyx_v_p = 0;
01183 PyObject *__pyx_v_src = 0;
01184 PyObject *__pyx_v_dst = 0;
01185 char (__pyx_v_hdr[20]);
01186 ip_addr_t __pyx_v_s;
01187 ip_addr_t __pyx_v_d;
01188 PyObject *__pyx_r;
01189 PyObject *__pyx_1 = 0;
01190 int __pyx_2;
01191 int __pyx_3;
01192 int __pyx_4;
01193 int __pyx_5;
01194 int __pyx_6;
01195 int __pyx_7;
01196 static char *__pyx_argnames[] = {"tos","len","id","off","ttl","p","src","dst",0};
01197 __pyx_v_tos = __pyx_k24;
01198 __pyx_v_len = __pyx_k25;
01199 __pyx_v_id = __pyx_k26;
01200 __pyx_v_off = __pyx_k27;
01201 __pyx_v_ttl = __pyx_k28;
01202 __pyx_v_p = __pyx_k29;
01203 __pyx_v_src = __pyx_k30;
01204 __pyx_v_dst = __pyx_k31;
01205 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|OOOOOOOO", __pyx_argnames, &__pyx_v_tos, &__pyx_v_len, &__pyx_v_id, &__pyx_v_off, &__pyx_v_ttl, &__pyx_v_p, &__pyx_v_src, &__pyx_v_dst)) return 0;
01206 Py_INCREF(__pyx_v_tos);
01207 Py_INCREF(__pyx_v_len);
01208 Py_INCREF(__pyx_v_id);
01209 Py_INCREF(__pyx_v_off);
01210 Py_INCREF(__pyx_v_ttl);
01211 Py_INCREF(__pyx_v_p);
01212 Py_INCREF(__pyx_v_src);
01213 Py_INCREF(__pyx_v_dst);
01214
01215
01216 __pyx_1 = __pyx_f_4dnet___memcpy(((char (*))(&__pyx_v_s)),__pyx_v_src,4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}
01217 Py_DECREF(__pyx_1); __pyx_1 = 0;
01218
01219
01220 __pyx_1 = __pyx_f_4dnet___memcpy(((char (*))(&__pyx_v_d)),__pyx_v_dst,4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; goto __pyx_L1;}
01221 Py_DECREF(__pyx_1); __pyx_1 = 0;
01222
01223
01224 __pyx_2 = PyInt_AsLong(__pyx_v_tos); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; goto __pyx_L1;}
01225 __pyx_3 = PyInt_AsLong(__pyx_v_len); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; goto __pyx_L1;}
01226 __pyx_4 = PyInt_AsLong(__pyx_v_id); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; goto __pyx_L1;}
01227 __pyx_5 = PyInt_AsLong(__pyx_v_off); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; goto __pyx_L1;}
01228 __pyx_6 = PyInt_AsLong(__pyx_v_ttl); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; goto __pyx_L1;}
01229 __pyx_7 = PyInt_AsLong(__pyx_v_p); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; goto __pyx_L1;}
01230 ip_pack_hdr(__pyx_v_hdr,__pyx_2,__pyx_3,__pyx_4,__pyx_5,__pyx_6,__pyx_7,__pyx_v_s,__pyx_v_d);
01231
01232
01233 __pyx_1 = PyString_FromStringAndSize(__pyx_v_hdr,20); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; goto __pyx_L1;}
01234 __pyx_r = __pyx_1;
01235 __pyx_1 = 0;
01236 goto __pyx_L0;
01237
01238 __pyx_r = Py_None; Py_INCREF(__pyx_r);
01239 goto __pyx_L0;
01240 __pyx_L1:;
01241 Py_XDECREF(__pyx_1);
01242 __Pyx_AddTraceback("dnet.ip_pack_hdr");
01243 __pyx_r = 0;
01244 __pyx_L0:;
01245 Py_DECREF(__pyx_v_tos);
01246 Py_DECREF(__pyx_v_len);
01247 Py_DECREF(__pyx_v_id);
01248 Py_DECREF(__pyx_v_off);
01249 Py_DECREF(__pyx_v_ttl);
01250 Py_DECREF(__pyx_v_p);
01251 Py_DECREF(__pyx_v_src);
01252 Py_DECREF(__pyx_v_dst);
01253 return __pyx_r;
01254 }
01255
01256 static PyObject *__pyx_f_4dnet_ip6_ntoa(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
01257 static char __pyx_doc_4dnet_ip6_ntoa[] = "Convert an IPv6 address from a 16-byte packed binary string to a\n printable string (\'10.0.0.1\').";
01258 static PyObject *__pyx_f_4dnet_ip6_ntoa(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
01259 PyObject *__pyx_v_buf = 0;
01260 ip6_addr_t __pyx_v_ia;
01261 PyObject *__pyx_r;
01262 PyObject *__pyx_1 = 0;
01263 static char *__pyx_argnames[] = {"buf",0};
01264 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_buf)) return 0;
01265 Py_INCREF(__pyx_v_buf);
01266
01267
01268 __pyx_1 = __pyx_f_4dnet___memcpy(((char (*))(&__pyx_v_ia)),__pyx_v_buf,16); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; goto __pyx_L1;}
01269 Py_DECREF(__pyx_1); __pyx_1 = 0;
01270
01271
01272 __pyx_1 = PyString_FromString(ip6_ntoa((&__pyx_v_ia))); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; goto __pyx_L1;}
01273 __pyx_r = __pyx_1;
01274 __pyx_1 = 0;
01275 goto __pyx_L0;
01276
01277 __pyx_r = Py_None; Py_INCREF(__pyx_r);
01278 goto __pyx_L0;
01279 __pyx_L1:;
01280 Py_XDECREF(__pyx_1);
01281 __Pyx_AddTraceback("dnet.ip6_ntoa");
01282 __pyx_r = 0;
01283 __pyx_L0:;
01284 Py_DECREF(__pyx_v_buf);
01285 return __pyx_r;
01286 }
01287
01288 static PyObject *__pyx_k63p;
01289
01290 static char (__pyx_k63[]) = "invalid IPv6 address";
01291
01292 static PyObject *__pyx_f_4dnet_ip6_aton(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
01293 static char __pyx_doc_4dnet_ip6_aton[] = "Convert an IPv6 address from a printable string to a\n packed binary string (\'\\x0a\\x00\\x00\\x01\').";
01294 static PyObject *__pyx_f_4dnet_ip6_aton(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
01295 PyObject *__pyx_v_buf = 0;
01296 ip6_addr_t __pyx_v_ia;
01297 PyObject *__pyx_r;
01298 char (*__pyx_1);
01299 int __pyx_2;
01300 PyObject *__pyx_3 = 0;
01301 static char *__pyx_argnames[] = {"buf",0};
01302 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_buf)) return 0;
01303 Py_INCREF(__pyx_v_buf);
01304
01305
01306 __pyx_1 = PyString_AsString(__pyx_v_buf); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; goto __pyx_L1;}
01307 __pyx_2 = (ip6_aton(__pyx_1,(&__pyx_v_ia)) < 0);
01308 if (__pyx_2) {
01309
01310
01311 __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; goto __pyx_L1;}
01312 __Pyx_Raise(__pyx_3, __pyx_k63p, 0);
01313 Py_DECREF(__pyx_3); __pyx_3 = 0;
01314 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; goto __pyx_L1;}
01315 goto __pyx_L2;
01316 }
01317 __pyx_L2:;
01318
01319
01320 __pyx_3 = PyString_FromStringAndSize(((char (*))(&__pyx_v_ia)),16); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; goto __pyx_L1;}
01321 __pyx_r = __pyx_3;
01322 __pyx_3 = 0;
01323 goto __pyx_L0;
01324
01325 __pyx_r = Py_None; Py_INCREF(__pyx_r);
01326 goto __pyx_L0;
01327 __pyx_L1:;
01328 Py_XDECREF(__pyx_3);
01329 __Pyx_AddTraceback("dnet.ip6_aton");
01330 __pyx_r = 0;
01331 __pyx_L0:;
01332 Py_DECREF(__pyx_v_buf);
01333 return __pyx_r;
01334 }
01335
01336 static PyObject *__pyx_f_4dnet_ip6_checksum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
01337 static char __pyx_doc_4dnet_ip6_checksum[] = "Return a packed binary string representing an IPv6 packet \n with the IPv6 and transport-layer checksums set.\n\n Arguments:\n pkt -- binary string representing an IPv6 packet\n ";
01338 static PyObject *__pyx_f_4dnet_ip6_checksum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
01339 PyObject *__pyx_v_buf = 0;
01340 PyObject *__pyx_r;
01341 char (*__pyx_1);
01342 static char *__pyx_argnames[] = {"buf",0};
01343 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_buf)) return 0;
01344 Py_INCREF(__pyx_v_buf);
01345
01346
01347 __pyx_1 = PyString_AsString(__pyx_v_buf); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; goto __pyx_L1;}
01348 ip6_checksum(__pyx_1,PyString_Size(__pyx_v_buf));
01349
01350
01351 Py_INCREF(__pyx_v_buf);
01352 __pyx_r = __pyx_v_buf;
01353 goto __pyx_L0;
01354
01355 __pyx_r = Py_None; Py_INCREF(__pyx_r);
01356 goto __pyx_L0;
01357 __pyx_L1:;
01358 __Pyx_AddTraceback("dnet.ip6_checksum");
01359 __pyx_r = 0;
01360 __pyx_L0:;
01361 Py_DECREF(__pyx_v_buf);
01362 return __pyx_r;
01363 }
01364
01365 static PyObject *__pyx_f_4dnet_ip6_pack_hdr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
01366 static char __pyx_doc_4dnet_ip6_pack_hdr[] = "Return a packed binary string representing an IPv6 header.\n \n Keyword arguments:\n fc -- flow class (8-bit integer)\n fl -- flow label (20-bit integer)\n plen -- payload length (16-bit integer)\n nxt -- next header (IP_PROTO_*) (8-bit integer)\n hlim -- hop limit (8-bit integer)\n src -- source address (16-byte binary string)\n dst -- destination address (16-byte binary string)\n ";
01367 static PyObject *__pyx_f_4dnet_ip6_pack_hdr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
01368 PyObject *__pyx_v_fc = 0;
01369 PyObject *__pyx_v_fl = 0;
01370 PyObject *__pyx_v_plen = 0;
01371 PyObject *__pyx_v_nxt = 0;
01372 PyObject *__pyx_v_hlim = 0;
01373 PyObject *__pyx_v_src = 0;
01374 PyObject *__pyx_v_dst = 0;
01375 char (__pyx_v_hdr[40]);
01376 ip6_addr_t __pyx_v_s;
01377 ip6_addr_t __pyx_v_d;
01378 PyObject *__pyx_r;
01379 PyObject *__pyx_1 = 0;
01380 int __pyx_2;
01381 int __pyx_3;
01382 int __pyx_4;
01383 int __pyx_5;
01384 int __pyx_6;
01385 static char *__pyx_argnames[] = {"fc","fl","plen","nxt","hlim","src","dst",0};
01386 __pyx_v_fc = __pyx_k34;
01387 __pyx_v_fl = __pyx_k35;
01388 __pyx_v_plen = __pyx_k36;
01389 __pyx_v_nxt = __pyx_k37;
01390 __pyx_v_hlim = __pyx_k38;
01391 __pyx_v_src = __pyx_k39;
01392 __pyx_v_dst = __pyx_k40;
01393 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|OOOOOOO", __pyx_argnames, &__pyx_v_fc, &__pyx_v_fl, &__pyx_v_plen, &__pyx_v_nxt, &__pyx_v_hlim, &__pyx_v_src, &__pyx_v_dst)) return 0;
01394 Py_INCREF(__pyx_v_fc);
01395 Py_INCREF(__pyx_v_fl);
01396 Py_INCREF(__pyx_v_plen);
01397 Py_INCREF(__pyx_v_nxt);
01398 Py_INCREF(__pyx_v_hlim);
01399 Py_INCREF(__pyx_v_src);
01400 Py_INCREF(__pyx_v_dst);
01401
01402
01403 __pyx_1 = __pyx_f_4dnet___memcpy(((char (*))(&__pyx_v_s)),__pyx_v_src,16); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; goto __pyx_L1;}
01404 Py_DECREF(__pyx_1); __pyx_1 = 0;
01405
01406
01407 __pyx_1 = __pyx_f_4dnet___memcpy(((char (*))(&__pyx_v_d)),__pyx_v_dst,16); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; goto __pyx_L1;}
01408 Py_DECREF(__pyx_1); __pyx_1 = 0;
01409
01410
01411 __pyx_2 = PyInt_AsLong(__pyx_v_fc); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; goto __pyx_L1;}
01412 __pyx_3 = PyInt_AsLong(__pyx_v_fl); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; goto __pyx_L1;}
01413 __pyx_4 = PyInt_AsLong(__pyx_v_plen); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; goto __pyx_L1;}
01414 __pyx_5 = PyInt_AsLong(__pyx_v_nxt); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; goto __pyx_L1;}
01415 __pyx_6 = PyInt_AsLong(__pyx_v_hlim); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; goto __pyx_L1;}
01416 ip6_pack_hdr(__pyx_v_hdr,__pyx_2,__pyx_3,__pyx_4,__pyx_5,__pyx_6,__pyx_v_s,__pyx_v_d);
01417
01418
01419 __pyx_1 = PyString_FromStringAndSize(__pyx_v_hdr,40); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; goto __pyx_L1;}
01420 __pyx_r = __pyx_1;
01421 __pyx_1 = 0;
01422 goto __pyx_L0;
01423
01424 __pyx_r = Py_None; Py_INCREF(__pyx_r);
01425 goto __pyx_L0;
01426 __pyx_L1:;
01427 Py_XDECREF(__pyx_1);
01428 __Pyx_AddTraceback("dnet.ip6_pack_hdr");
01429 __pyx_r = 0;
01430 __pyx_L0:;
01431 Py_DECREF(__pyx_v_fc);
01432 Py_DECREF(__pyx_v_fl);
01433 Py_DECREF(__pyx_v_plen);
01434 Py_DECREF(__pyx_v_nxt);
01435 Py_DECREF(__pyx_v_hlim);
01436 Py_DECREF(__pyx_v_src);
01437 Py_DECREF(__pyx_v_dst);
01438 return __pyx_r;
01439 }
01440
01441 static PyObject *__pyx_n_ip;
01442
01443 static PyObject *__pyx_k64p;
01444
01445 static char (__pyx_k64[]) = "invalid network address";
01446
01447 static int __pyx_f_4dnet_4addr___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
01448 static int __pyx_f_4dnet_4addr___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
01449 PyObject *__pyx_v_addrtxt = 0;
01450 PyObject *__pyx_v_type = 0;
01451 int __pyx_r;
01452 int __pyx_1;
01453 char (*__pyx_2);
01454 PyObject *__pyx_3 = 0;
01455 unsigned short __pyx_4;
01456 static char *__pyx_argnames[] = {"addrtxt","type",0};
01457 __pyx_v_addrtxt = __pyx_k41;
01458 __pyx_v_type = __pyx_k42;
01459 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|OO", __pyx_argnames, &__pyx_v_addrtxt, &__pyx_v_type)) return -1;
01460 Py_INCREF(__pyx_v_self);
01461 Py_INCREF(__pyx_v_addrtxt);
01462 Py_INCREF(__pyx_v_type);
01463
01464
01465 if (PyObject_Cmp(__pyx_v_addrtxt, Py_None, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; goto __pyx_L1;}
01466 __pyx_1 = __pyx_1 != 0;
01467 if (__pyx_1) {
01468 __pyx_2 = PyString_AsString(__pyx_v_addrtxt); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; goto __pyx_L1;}
01469 __pyx_1 = (addr_aton(__pyx_2,(&((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr)) < 0);
01470 }
01471 if (__pyx_1) {
01472
01473
01474 __pyx_1 = (PyString_Size(__pyx_v_addrtxt) == 4);
01475 if (__pyx_1) {
01476
01477
01478 __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_ADDR_TYPE_IP); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; goto __pyx_L1;}
01479 __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; goto __pyx_L1;}
01480 Py_DECREF(__pyx_3); __pyx_3 = 0;
01481 ((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_type = __pyx_4;
01482
01483
01484 __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_IP_ADDR_BITS); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; goto __pyx_L1;}
01485 __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; goto __pyx_L1;}
01486 Py_DECREF(__pyx_3); __pyx_3 = 0;
01487 ((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_bits = __pyx_4;
01488
01489
01490 if (PyObject_SetAttr(__pyx_v_self, __pyx_n_ip, __pyx_v_addrtxt) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; goto __pyx_L1;}
01491 goto __pyx_L3;
01492 }
01493 {
01494
01495
01496 __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; goto __pyx_L1;}
01497 __Pyx_Raise(__pyx_3, __pyx_k64p, 0);
01498 Py_DECREF(__pyx_3); __pyx_3 = 0;
01499 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; goto __pyx_L1;}
01500 }
01501 __pyx_L3:;
01502 goto __pyx_L2;
01503 }
01504 __pyx_L2:;
01505
01506 __pyx_r = 0;
01507 goto __pyx_L0;
01508 __pyx_L1:;
01509 Py_XDECREF(__pyx_3);
01510 __Pyx_AddTraceback("dnet.addr.__init__");
01511 __pyx_r = -1;
01512 __pyx_L0:;
01513 Py_DECREF(__pyx_v_self);
01514 Py_DECREF(__pyx_v_addrtxt);
01515 Py_DECREF(__pyx_v_type);
01516 return __pyx_r;
01517 }
01518
01519 static PyObject *__pyx_f_4dnet_4addr_4type___get__(PyObject *__pyx_v_self);
01520 static PyObject *__pyx_f_4dnet_4addr_4type___get__(PyObject *__pyx_v_self) {
01521 PyObject *__pyx_r;
01522 PyObject *__pyx_1 = 0;
01523 Py_INCREF(__pyx_v_self);
01524
01525
01526 __pyx_1 = PyInt_FromLong(((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; goto __pyx_L1;}
01527 __pyx_r = __pyx_1;
01528 __pyx_1 = 0;
01529 goto __pyx_L0;
01530
01531 __pyx_r = Py_None; Py_INCREF(__pyx_r);
01532 goto __pyx_L0;
01533 __pyx_L1:;
01534 Py_XDECREF(__pyx_1);
01535 __Pyx_AddTraceback("dnet.addr.type.__get__");
01536 __pyx_r = 0;
01537 __pyx_L0:;
01538 Py_DECREF(__pyx_v_self);
01539 return __pyx_r;
01540 }
01541
01542 static PyObject *__pyx_n_OverflowError;
01543
01544 static int __pyx_f_4dnet_4addr_4type___set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value);
01545 static int __pyx_f_4dnet_4addr_4type___set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
01546 unsigned int __pyx_v_value;
01547 int __pyx_r;
01548 int __pyx_1;
01549 PyObject *__pyx_2 = 0;
01550 Py_INCREF(__pyx_v_self);
01551 __pyx_v_value = PyInt_AsLong(__pyx_arg_value); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; goto __pyx_L1;}
01552
01553
01554 __pyx_1 = (__pyx_v_value > 65535);
01555 if (__pyx_1) {
01556 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_OverflowError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; goto __pyx_L1;}
01557 __Pyx_Raise(__pyx_2, 0, 0);
01558 Py_DECREF(__pyx_2); __pyx_2 = 0;
01559 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; goto __pyx_L1;}
01560 goto __pyx_L2;
01561 }
01562 __pyx_L2:;
01563
01564
01565 ((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_type = __pyx_v_value;
01566
01567 __pyx_r = 0;
01568 goto __pyx_L0;
01569 __pyx_L1:;
01570 Py_XDECREF(__pyx_2);
01571 __Pyx_AddTraceback("dnet.addr.type.__set__");
01572 __pyx_r = -1;
01573 __pyx_L0:;
01574 Py_DECREF(__pyx_v_self);
01575 return __pyx_r;
01576 }
01577
01578 static PyObject *__pyx_f_4dnet_4addr_4bits___get__(PyObject *__pyx_v_self);
01579 static PyObject *__pyx_f_4dnet_4addr_4bits___get__(PyObject *__pyx_v_self) {
01580 PyObject *__pyx_r;
01581 PyObject *__pyx_1 = 0;
01582 Py_INCREF(__pyx_v_self);
01583
01584
01585 __pyx_1 = PyInt_FromLong(((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_bits); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; goto __pyx_L1;}
01586 __pyx_r = __pyx_1;
01587 __pyx_1 = 0;
01588 goto __pyx_L0;
01589
01590 __pyx_r = Py_None; Py_INCREF(__pyx_r);
01591 goto __pyx_L0;
01592 __pyx_L1:;
01593 Py_XDECREF(__pyx_1);
01594 __Pyx_AddTraceback("dnet.addr.bits.__get__");
01595 __pyx_r = 0;
01596 __pyx_L0:;
01597 Py_DECREF(__pyx_v_self);
01598 return __pyx_r;
01599 }
01600
01601 static int __pyx_f_4dnet_4addr_4bits___set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value);
01602 static int __pyx_f_4dnet_4addr_4bits___set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
01603 unsigned int __pyx_v_value;
01604 int __pyx_r;
01605 int __pyx_1;
01606 PyObject *__pyx_2 = 0;
01607 Py_INCREF(__pyx_v_self);
01608 __pyx_v_value = PyInt_AsLong(__pyx_arg_value); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; goto __pyx_L1;}
01609
01610
01611 __pyx_1 = (__pyx_v_value > 65535);
01612 if (__pyx_1) {
01613 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_OverflowError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; goto __pyx_L1;}
01614 __Pyx_Raise(__pyx_2, 0, 0);
01615 Py_DECREF(__pyx_2); __pyx_2 = 0;
01616 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; goto __pyx_L1;}
01617 goto __pyx_L2;
01618 }
01619 __pyx_L2:;
01620
01621
01622 ((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_bits = __pyx_v_value;
01623
01624 __pyx_r = 0;
01625 goto __pyx_L0;
01626 __pyx_L1:;
01627 Py_XDECREF(__pyx_2);
01628 __Pyx_AddTraceback("dnet.addr.bits.__set__");
01629 __pyx_r = -1;
01630 __pyx_L0:;
01631 Py_DECREF(__pyx_v_self);
01632 return __pyx_r;
01633 }
01634
01635 static PyObject *__pyx_n_eth;
01636 static PyObject *__pyx_n_ip6;
01637
01638 static PyObject *__pyx_k65p;
01639
01640 static char (__pyx_k65[]) = "invalid network address";
01641
01642 static PyObject *__pyx_f_4dnet_4addr_4data___get__(PyObject *__pyx_v_self);
01643 static PyObject *__pyx_f_4dnet_4addr_4data___get__(PyObject *__pyx_v_self) {
01644 PyObject *__pyx_r;
01645 PyObject *__pyx_1 = 0;
01646 PyObject *__pyx_2 = 0;
01647 int __pyx_3;
01648 Py_INCREF(__pyx_v_self);
01649
01650
01651 __pyx_1 = PyInt_FromLong(((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; goto __pyx_L1;}
01652 __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_ADDR_TYPE_ETH); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; goto __pyx_L1;}
01653 if (PyObject_Cmp(__pyx_1, __pyx_2, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; goto __pyx_L1;}
01654 __pyx_3 = __pyx_3 == 0;
01655 Py_DECREF(__pyx_1); __pyx_1 = 0;
01656 Py_DECREF(__pyx_2); __pyx_2 = 0;
01657 if (__pyx_3) {
01658
01659
01660 __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_eth); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; goto __pyx_L1;}
01661 __pyx_r = __pyx_1;
01662 __pyx_1 = 0;
01663 goto __pyx_L0;
01664 goto __pyx_L2;
01665 }
01666 __pyx_2 = PyInt_FromLong(((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_type); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; goto __pyx_L1;}
01667 __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_ADDR_TYPE_IP); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; goto __pyx_L1;}
01668 if (PyObject_Cmp(__pyx_2, __pyx_1, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; goto __pyx_L1;}
01669 __pyx_3 = __pyx_3 == 0;
01670 Py_DECREF(__pyx_2); __pyx_2 = 0;
01671 Py_DECREF(__pyx_1); __pyx_1 = 0;
01672 if (__pyx_3) {
01673
01674
01675 __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_ip); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; goto __pyx_L1;}
01676 __pyx_r = __pyx_2;
01677 __pyx_2 = 0;
01678 goto __pyx_L0;
01679 goto __pyx_L2;
01680 }
01681 __pyx_1 = PyInt_FromLong(((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; goto __pyx_L1;}
01682 __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_ADDR_TYPE_IP6); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; goto __pyx_L1;}
01683 if (PyObject_Cmp(__pyx_1, __pyx_2, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; goto __pyx_L1;}
01684 __pyx_3 = __pyx_3 == 0;
01685 Py_DECREF(__pyx_1); __pyx_1 = 0;
01686 Py_DECREF(__pyx_2); __pyx_2 = 0;
01687 if (__pyx_3) {
01688
01689
01690 __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_ip6); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; goto __pyx_L1;}
01691 __pyx_r = __pyx_1;
01692 __pyx_1 = 0;
01693 goto __pyx_L0;
01694 goto __pyx_L2;
01695 }
01696 {
01697
01698
01699 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}
01700 __Pyx_Raise(__pyx_2, __pyx_k65p, 0);
01701 Py_DECREF(__pyx_2); __pyx_2 = 0;
01702 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}
01703 }
01704 __pyx_L2:;
01705
01706 __pyx_r = Py_None; Py_INCREF(__pyx_r);
01707 goto __pyx_L0;
01708 __pyx_L1:;
01709 Py_XDECREF(__pyx_1);
01710 Py_XDECREF(__pyx_2);
01711 __Pyx_AddTraceback("dnet.addr.data.__get__");
01712 __pyx_r = 0;
01713 __pyx_L0:;
01714 Py_DECREF(__pyx_v_self);
01715 return __pyx_r;
01716 }
01717
01718 static PyObject *__pyx_k66p;
01719
01720 static char (__pyx_k66[]) = "non-Ethernet address";
01721
01722 static PyObject *__pyx_f_4dnet_4addr_3eth___get__(PyObject *__pyx_v_self);
01723 static PyObject *__pyx_f_4dnet_4addr_3eth___get__(PyObject *__pyx_v_self) {
01724 PyObject *__pyx_r;
01725 PyObject *__pyx_1 = 0;
01726 PyObject *__pyx_2 = 0;
01727 int __pyx_3;
01728 Py_INCREF(__pyx_v_self);
01729
01730
01731 __pyx_1 = PyInt_FromLong(((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; goto __pyx_L1;}
01732 __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_ADDR_TYPE_ETH); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; goto __pyx_L1;}
01733 if (PyObject_Cmp(__pyx_1, __pyx_2, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; goto __pyx_L1;}
01734 __pyx_3 = __pyx_3 != 0;
01735 Py_DECREF(__pyx_1); __pyx_1 = 0;
01736 Py_DECREF(__pyx_2); __pyx_2 = 0;
01737 if (__pyx_3) {
01738
01739
01740 __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; goto __pyx_L1;}
01741 __Pyx_Raise(__pyx_1, __pyx_k66p, 0);
01742 Py_DECREF(__pyx_1); __pyx_1 = 0;
01743 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; goto __pyx_L1;}
01744 goto __pyx_L2;
01745 }
01746 __pyx_L2:;
01747
01748
01749 __pyx_2 = PyString_FromStringAndSize(((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_data8,6); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; goto __pyx_L1;}
01750 __pyx_r = __pyx_2;
01751 __pyx_2 = 0;
01752 goto __pyx_L0;
01753
01754 __pyx_r = Py_None; Py_INCREF(__pyx_r);
01755 goto __pyx_L0;
01756 __pyx_L1:;
01757 Py_XDECREF(__pyx_1);
01758 Py_XDECREF(__pyx_2);
01759 __Pyx_AddTraceback("dnet.addr.eth.__get__");
01760 __pyx_r = 0;
01761 __pyx_L0:;
01762 Py_DECREF(__pyx_v_self);
01763 return __pyx_r;
01764 }
01765
01766 static PyObject *__pyx_k67p;
01767
01768 static char (__pyx_k67[]) = "not a 6-byte string";
01769
01770 static int __pyx_f_4dnet_4addr_3eth___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value);
01771 static int __pyx_f_4dnet_4addr_3eth___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
01772 int __pyx_r;
01773 PyObject *__pyx_1 = 0;
01774 PyObject *__pyx_2 = 0;
01775 int __pyx_3;
01776 unsigned short __pyx_4;
01777 Py_INCREF(__pyx_v_self);
01778 Py_INCREF(__pyx_v_value);
01779
01780
01781 __pyx_1 = PyInt_FromLong(PyString_Size(__pyx_v_value)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; goto __pyx_L1;}
01782 __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_ETH_ADDR_LEN); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; goto __pyx_L1;}
01783 if (PyObject_Cmp(__pyx_1, __pyx_2, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; goto __pyx_L1;}
01784 __pyx_3 = __pyx_3 != 0;
01785 Py_DECREF(__pyx_1); __pyx_1 = 0;
01786 Py_DECREF(__pyx_2); __pyx_2 = 0;
01787 if (__pyx_3) {
01788
01789
01790 __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; goto __pyx_L1;}
01791 __Pyx_Raise(__pyx_1, __pyx_k67p, 0);
01792 Py_DECREF(__pyx_1); __pyx_1 = 0;
01793 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; goto __pyx_L1;}
01794 goto __pyx_L2;
01795 }
01796 __pyx_L2:;
01797
01798
01799 __pyx_2 = __pyx_f_4dnet___memcpy(((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_data8,__pyx_v_value,6); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; goto __pyx_L1;}
01800 Py_DECREF(__pyx_2); __pyx_2 = 0;
01801
01802
01803 __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_ADDR_TYPE_ETH); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; goto __pyx_L1;}
01804 __pyx_4 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; goto __pyx_L1;}
01805 Py_DECREF(__pyx_1); __pyx_1 = 0;
01806 ((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_type = __pyx_4;
01807
01808
01809 __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_ETH_ADDR_BITS); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; goto __pyx_L1;}
01810 __pyx_4 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; goto __pyx_L1;}
01811 Py_DECREF(__pyx_2); __pyx_2 = 0;
01812 ((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_bits = __pyx_4;
01813
01814 __pyx_r = 0;
01815 goto __pyx_L0;
01816 __pyx_L1:;
01817 Py_XDECREF(__pyx_1);
01818 Py_XDECREF(__pyx_2);
01819 __Pyx_AddTraceback("dnet.addr.eth.__set__");
01820 __pyx_r = -1;
01821 __pyx_L0:;
01822 Py_DECREF(__pyx_v_self);
01823 Py_DECREF(__pyx_v_value);
01824 return __pyx_r;
01825 }
01826
01827 static PyObject *__pyx_k68p;
01828
01829 static char (__pyx_k68[]) = "non-IP address";
01830
01831 static PyObject *__pyx_f_4dnet_4addr_2ip___get__(PyObject *__pyx_v_self);
01832 static PyObject *__pyx_f_4dnet_4addr_2ip___get__(PyObject *__pyx_v_self) {
01833 PyObject *__pyx_r;
01834 PyObject *__pyx_1 = 0;
01835 PyObject *__pyx_2 = 0;
01836 int __pyx_3;
01837 Py_INCREF(__pyx_v_self);
01838
01839
01840 __pyx_1 = PyInt_FromLong(((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; goto __pyx_L1;}
01841 __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_ADDR_TYPE_IP); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; goto __pyx_L1;}
01842 if (PyObject_Cmp(__pyx_1, __pyx_2, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; goto __pyx_L1;}
01843 __pyx_3 = __pyx_3 != 0;
01844 Py_DECREF(__pyx_1); __pyx_1 = 0;
01845 Py_DECREF(__pyx_2); __pyx_2 = 0;
01846 if (__pyx_3) {
01847
01848
01849 __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; goto __pyx_L1;}
01850 __Pyx_Raise(__pyx_1, __pyx_k68p, 0);
01851 Py_DECREF(__pyx_1); __pyx_1 = 0;
01852 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; goto __pyx_L1;}
01853 goto __pyx_L2;
01854 }
01855 __pyx_L2:;
01856
01857
01858 __pyx_2 = PyString_FromStringAndSize(((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_data8,4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; goto __pyx_L1;}
01859 __pyx_r = __pyx_2;
01860 __pyx_2 = 0;
01861 goto __pyx_L0;
01862
01863 __pyx_r = Py_None; Py_INCREF(__pyx_r);
01864 goto __pyx_L0;
01865 __pyx_L1:;
01866 Py_XDECREF(__pyx_1);
01867 Py_XDECREF(__pyx_2);
01868 __Pyx_AddTraceback("dnet.addr.ip.__get__");
01869 __pyx_r = 0;
01870 __pyx_L0:;
01871 Py_DECREF(__pyx_v_self);
01872 return __pyx_r;
01873 }
01874
01875 static PyObject *__pyx_k69p;
01876
01877 static char (__pyx_k69[]) = "not a 4-byte string";
01878
01879 static int __pyx_f_4dnet_4addr_2ip___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value);
01880 static int __pyx_f_4dnet_4addr_2ip___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
01881 int __pyx_r;
01882 int __pyx_1;
01883 PyObject *__pyx_2 = 0;
01884 PyObject *__pyx_3 = 0;
01885 unsigned short __pyx_4;
01886 Py_INCREF(__pyx_v_self);
01887 Py_INCREF(__pyx_v_value);
01888
01889
01890 __pyx_1 = PyInt_Check(__pyx_v_value);
01891 if (__pyx_1) {
01892
01893
01894 ((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_ip = htonl(PyInt_AsLong(__pyx_v_value));
01895 goto __pyx_L2;
01896 }
01897 __pyx_1 = PyLong_Check(__pyx_v_value);
01898 if (__pyx_1) {
01899
01900
01901 ((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_ip = htonl(PyLong_AsUnsignedLong(__pyx_v_value));
01902 goto __pyx_L2;
01903 }
01904 __pyx_2 = PyInt_FromLong(PyString_Size(__pyx_v_value)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; goto __pyx_L1;}
01905 __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_IP_ADDR_LEN); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; goto __pyx_L1;}
01906 if (PyObject_Cmp(__pyx_2, __pyx_3, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; goto __pyx_L1;}
01907 __pyx_1 = __pyx_1 != 0;
01908 Py_DECREF(__pyx_2); __pyx_2 = 0;
01909 Py_DECREF(__pyx_3); __pyx_3 = 0;
01910 if (__pyx_1) {
01911
01912
01913 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; goto __pyx_L1;}
01914 __Pyx_Raise(__pyx_2, __pyx_k69p, 0);
01915 Py_DECREF(__pyx_2); __pyx_2 = 0;
01916 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; goto __pyx_L1;}
01917 goto __pyx_L2;
01918 }
01919 {
01920
01921
01922 __pyx_3 = __pyx_f_4dnet___memcpy(((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_data8,__pyx_v_value,4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; goto __pyx_L1;}
01923 Py_DECREF(__pyx_3); __pyx_3 = 0;
01924 }
01925 __pyx_L2:;
01926
01927
01928 __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_ADDR_TYPE_IP); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; goto __pyx_L1;}
01929 __pyx_4 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; goto __pyx_L1;}
01930 Py_DECREF(__pyx_2); __pyx_2 = 0;
01931 ((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_type = __pyx_4;
01932
01933
01934 __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_IP_ADDR_BITS); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}
01935 __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}
01936 Py_DECREF(__pyx_3); __pyx_3 = 0;
01937 ((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_bits = __pyx_4;
01938
01939 __pyx_r = 0;
01940 goto __pyx_L0;
01941 __pyx_L1:;
01942 Py_XDECREF(__pyx_2);
01943 Py_XDECREF(__pyx_3);
01944 __Pyx_AddTraceback("dnet.addr.ip.__set__");
01945 __pyx_r = -1;
01946 __pyx_L0:;
01947 Py_DECREF(__pyx_v_self);
01948 Py_DECREF(__pyx_v_value);
01949 return __pyx_r;
01950 }
01951
01952 static PyObject *__pyx_k70p;
01953
01954 static char (__pyx_k70[]) = "non-IPv6 address";
01955
01956 static PyObject *__pyx_f_4dnet_4addr_3ip6___get__(PyObject *__pyx_v_self);
01957 static PyObject *__pyx_f_4dnet_4addr_3ip6___get__(PyObject *__pyx_v_self) {
01958 PyObject *__pyx_r;
01959 PyObject *__pyx_1 = 0;
01960 PyObject *__pyx_2 = 0;
01961 int __pyx_3;
01962 Py_INCREF(__pyx_v_self);
01963
01964
01965 __pyx_1 = PyInt_FromLong(((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; goto __pyx_L1;}
01966 __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_ADDR_TYPE_IP6); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; goto __pyx_L1;}
01967 if (PyObject_Cmp(__pyx_1, __pyx_2, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; goto __pyx_L1;}
01968 __pyx_3 = __pyx_3 != 0;
01969 Py_DECREF(__pyx_1); __pyx_1 = 0;
01970 Py_DECREF(__pyx_2); __pyx_2 = 0;
01971 if (__pyx_3) {
01972
01973
01974 __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; goto __pyx_L1;}
01975 __Pyx_Raise(__pyx_1, __pyx_k70p, 0);
01976 Py_DECREF(__pyx_1); __pyx_1 = 0;
01977 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; goto __pyx_L1;}
01978 goto __pyx_L2;
01979 }
01980 __pyx_L2:;
01981
01982
01983 __pyx_2 = PyString_FromStringAndSize(((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_data8,16); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; goto __pyx_L1;}
01984 __pyx_r = __pyx_2;
01985 __pyx_2 = 0;
01986 goto __pyx_L0;
01987
01988 __pyx_r = Py_None; Py_INCREF(__pyx_r);
01989 goto __pyx_L0;
01990 __pyx_L1:;
01991 Py_XDECREF(__pyx_1);
01992 Py_XDECREF(__pyx_2);
01993 __Pyx_AddTraceback("dnet.addr.ip6.__get__");
01994 __pyx_r = 0;
01995 __pyx_L0:;
01996 Py_DECREF(__pyx_v_self);
01997 return __pyx_r;
01998 }
01999
02000 static PyObject *__pyx_k71p;
02001
02002 static char (__pyx_k71[]) = "not a 16-byte string";
02003
02004 static int __pyx_f_4dnet_4addr_3ip6___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value);
02005 static int __pyx_f_4dnet_4addr_3ip6___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
02006 int __pyx_r;
02007 PyObject *__pyx_1 = 0;
02008 PyObject *__pyx_2 = 0;
02009 int __pyx_3;
02010 unsigned short __pyx_4;
02011 Py_INCREF(__pyx_v_self);
02012 Py_INCREF(__pyx_v_value);
02013
02014
02015 __pyx_1 = PyInt_FromLong(PyString_Size(__pyx_v_value)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; goto __pyx_L1;}
02016 __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_IP6_ADDR_LEN); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; goto __pyx_L1;}
02017 if (PyObject_Cmp(__pyx_1, __pyx_2, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; goto __pyx_L1;}
02018 __pyx_3 = __pyx_3 != 0;
02019 Py_DECREF(__pyx_1); __pyx_1 = 0;
02020 Py_DECREF(__pyx_2); __pyx_2 = 0;
02021 if (__pyx_3) {
02022
02023
02024 __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; goto __pyx_L1;}
02025 __Pyx_Raise(__pyx_1, __pyx_k71p, 0);
02026 Py_DECREF(__pyx_1); __pyx_1 = 0;
02027 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; goto __pyx_L1;}
02028 goto __pyx_L2;
02029 }
02030 __pyx_L2:;
02031
02032
02033 __pyx_2 = __pyx_f_4dnet___memcpy(((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_data8,__pyx_v_value,16); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; goto __pyx_L1;}
02034 Py_DECREF(__pyx_2); __pyx_2 = 0;
02035
02036
02037 __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_ADDR_TYPE_IP6); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; goto __pyx_L1;}
02038 __pyx_4 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; goto __pyx_L1;}
02039 Py_DECREF(__pyx_1); __pyx_1 = 0;
02040 ((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_type = __pyx_4;
02041
02042
02043 __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_IP6_ADDR_BITS); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; goto __pyx_L1;}
02044 __pyx_4 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; goto __pyx_L1;}
02045 Py_DECREF(__pyx_2); __pyx_2 = 0;
02046 ((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_bits = __pyx_4;
02047
02048 __pyx_r = 0;
02049 goto __pyx_L0;
02050 __pyx_L1:;
02051 Py_XDECREF(__pyx_1);
02052 Py_XDECREF(__pyx_2);
02053 __Pyx_AddTraceback("dnet.addr.ip6.__set__");
02054 __pyx_r = -1;
02055 __pyx_L0:;
02056 Py_DECREF(__pyx_v_self);
02057 Py_DECREF(__pyx_v_value);
02058 return __pyx_r;
02059 }
02060
02061 static PyObject *__pyx_f_4dnet_4addr_bcast(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
02062 static char __pyx_doc_4dnet_4addr_bcast[] = "Return an addr object for our broadcast address.";
02063 static PyObject *__pyx_f_4dnet_4addr_bcast(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
02064 PyObject *__pyx_v_bcast;
02065 PyObject *__pyx_r;
02066 PyObject *__pyx_1 = 0;
02067 PyObject *__pyx_2 = 0;
02068 static char *__pyx_argnames[] = {0};
02069 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
02070 Py_INCREF(__pyx_v_self);
02071 __pyx_v_bcast = Py_None; Py_INCREF(__pyx_v_bcast);
02072
02073
02074 __pyx_1 = PyTuple_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; goto __pyx_L1;}
02075 __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_4dnet_addr), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; goto __pyx_L1;}
02076 Py_DECREF(__pyx_1); __pyx_1 = 0;
02077 Py_DECREF(__pyx_v_bcast);
02078 __pyx_v_bcast = __pyx_2;
02079 __pyx_2 = 0;
02080
02081
02082 addr_bcast((&((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr),(&((struct __pyx_obj_4dnet_addr *)__pyx_v_bcast)->_addr));
02083
02084
02085 Py_INCREF(__pyx_v_bcast);
02086 __pyx_r = __pyx_v_bcast;
02087 goto __pyx_L0;
02088
02089 __pyx_r = Py_None; Py_INCREF(__pyx_r);
02090 goto __pyx_L0;
02091 __pyx_L1:;
02092 Py_XDECREF(__pyx_1);
02093 Py_XDECREF(__pyx_2);
02094 __Pyx_AddTraceback("dnet.addr.bcast");
02095 __pyx_r = 0;
02096 __pyx_L0:;
02097 Py_DECREF(__pyx_v_bcast);
02098 Py_DECREF(__pyx_v_self);
02099 return __pyx_r;
02100 }
02101
02102 static PyObject *__pyx_f_4dnet_4addr_net(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
02103 static char __pyx_doc_4dnet_4addr_net[] = "Return an addr object for our network address.";
02104 static PyObject *__pyx_f_4dnet_4addr_net(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
02105 PyObject *__pyx_v_net;
02106 PyObject *__pyx_r;
02107 PyObject *__pyx_1 = 0;
02108 PyObject *__pyx_2 = 0;
02109 static char *__pyx_argnames[] = {0};
02110 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
02111 Py_INCREF(__pyx_v_self);
02112 __pyx_v_net = Py_None; Py_INCREF(__pyx_v_net);
02113
02114
02115 __pyx_1 = PyTuple_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; goto __pyx_L1;}
02116 __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_4dnet_addr), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; goto __pyx_L1;}
02117 Py_DECREF(__pyx_1); __pyx_1 = 0;
02118 Py_DECREF(__pyx_v_net);
02119 __pyx_v_net = __pyx_2;
02120 __pyx_2 = 0;
02121
02122
02123 addr_net((&((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr),(&((struct __pyx_obj_4dnet_addr *)__pyx_v_net)->_addr));
02124
02125
02126 Py_INCREF(__pyx_v_net);
02127 __pyx_r = __pyx_v_net;
02128 goto __pyx_L0;
02129
02130 __pyx_r = Py_None; Py_INCREF(__pyx_r);
02131 goto __pyx_L0;
02132 __pyx_L1:;
02133 Py_XDECREF(__pyx_1);
02134 Py_XDECREF(__pyx_2);
02135 __Pyx_AddTraceback("dnet.addr.net");
02136 __pyx_r = 0;
02137 __pyx_L0:;
02138 Py_DECREF(__pyx_v_net);
02139 Py_DECREF(__pyx_v_self);
02140 return __pyx_r;
02141 }
02142
02143 static PyObject *__pyx_n_NotImplementedError;
02144 static PyObject *__pyx_n___copy__;
02145
02146 static PyObject *__pyx_f_4dnet_4addr___add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other);
02147 static PyObject *__pyx_f_4dnet_4addr___add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
02148 PyObject *__pyx_v_x;
02149 PyObject *__pyx_v_y;
02150 PyObject *__pyx_v_z;
02151 PyObject *__pyx_r;
02152 int __pyx_1;
02153 PyObject *__pyx_2 = 0;
02154 PyObject *__pyx_3 = 0;
02155 PyObject *__pyx_4 = 0;
02156 unsigned long __pyx_5;
02157 Py_INCREF(__pyx_v_self);
02158 Py_INCREF(__pyx_v_other);
02159 __pyx_v_x = Py_None; Py_INCREF(__pyx_v_x);
02160 __pyx_v_y = Py_None; Py_INCREF(__pyx_v_y);
02161 __pyx_v_z = Py_None; Py_INCREF(__pyx_v_z);
02162
02163
02164 __pyx_1 = PyInt_Check(__pyx_v_self);
02165 if (__pyx_1) {
02166
02167
02168 __pyx_2 = __pyx_v_other;
02169 Py_INCREF(__pyx_2);
02170 __pyx_3 = __pyx_v_self;
02171 Py_INCREF(__pyx_3);
02172 Py_DECREF(__pyx_v_x);
02173 __pyx_v_x = __pyx_2;
02174 __pyx_2 = 0;
02175 Py_DECREF(__pyx_v_y);
02176 __pyx_v_y = __pyx_3;
02177 __pyx_3 = 0;
02178 goto __pyx_L2;
02179 }
02180 __pyx_1 = PyInt_Check(__pyx_v_other);
02181 if (__pyx_1) {
02182
02183
02184 __pyx_2 = __pyx_v_self;
02185 Py_INCREF(__pyx_2);
02186 __pyx_3 = __pyx_v_other;
02187 Py_INCREF(__pyx_3);
02188 Py_DECREF(__pyx_v_x);
02189 __pyx_v_x = __pyx_2;
02190 __pyx_2 = 0;
02191 Py_DECREF(__pyx_v_y);
02192 __pyx_v_y = __pyx_3;
02193 __pyx_3 = 0;
02194 goto __pyx_L2;
02195 }
02196 {
02197
02198
02199 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_NotImplementedError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; goto __pyx_L1;}
02200 __Pyx_Raise(__pyx_2, 0, 0);
02201 Py_DECREF(__pyx_2); __pyx_2 = 0;
02202 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; goto __pyx_L1;}
02203 }
02204 __pyx_L2:;
02205
02206
02207 __pyx_3 = PyObject_GetAttr(__pyx_v_x, __pyx_n___copy__); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}
02208 __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}
02209 __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}
02210 Py_DECREF(__pyx_3); __pyx_3 = 0;
02211 Py_DECREF(__pyx_2); __pyx_2 = 0;
02212 Py_DECREF(__pyx_v_z);
02213 __pyx_v_z = __pyx_4;
02214 __pyx_4 = 0;
02215
02216
02217 __pyx_3 = PyLong_FromUnsignedLong(ntohl(((struct __pyx_obj_4dnet_addr *)__pyx_v_x)->_addr.addr_ip)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; goto __pyx_L1;}
02218 __pyx_2 = PyNumber_Add(__pyx_3, __pyx_v_y); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; goto __pyx_L1;}
02219 Py_DECREF(__pyx_3); __pyx_3 = 0;
02220 __pyx_5 = PyLong_AsUnsignedLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; goto __pyx_L1;}
02221 Py_DECREF(__pyx_2); __pyx_2 = 0;
02222 ((struct __pyx_obj_4dnet_addr *)__pyx_v_z)->_addr.addr_ip = htonl(__pyx_5);
02223
02224
02225 Py_INCREF(__pyx_v_z);
02226 __pyx_r = __pyx_v_z;
02227 goto __pyx_L0;
02228
02229 __pyx_r = Py_None; Py_INCREF(__pyx_r);
02230 goto __pyx_L0;
02231 __pyx_L1:;
02232 Py_XDECREF(__pyx_2);
02233 Py_XDECREF(__pyx_3);
02234 Py_XDECREF(__pyx_4);
02235 __Pyx_AddTraceback("dnet.addr.__add__");
02236 __pyx_r = 0;
02237 __pyx_L0:;
02238 Py_DECREF(__pyx_v_x);
02239 Py_DECREF(__pyx_v_y);
02240 Py_DECREF(__pyx_v_z);
02241 Py_DECREF(__pyx_v_self);
02242 Py_DECREF(__pyx_v_other);
02243 return __pyx_r;
02244 }
02245
02246 static PyObject *__pyx_f_4dnet_4addr___copy__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
02247 static PyObject *__pyx_f_4dnet_4addr___copy__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
02248 PyObject *__pyx_v_a;
02249 PyObject *__pyx_r;
02250 PyObject *__pyx_1 = 0;
02251 PyObject *__pyx_2 = 0;
02252 static char *__pyx_argnames[] = {0};
02253 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
02254 Py_INCREF(__pyx_v_self);
02255 __pyx_v_a = Py_None; Py_INCREF(__pyx_v_a);
02256
02257
02258 __pyx_1 = PyTuple_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; goto __pyx_L1;}
02259 __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_4dnet_addr), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; goto __pyx_L1;}
02260 Py_DECREF(__pyx_1); __pyx_1 = 0;
02261 Py_DECREF(__pyx_v_a);
02262 __pyx_v_a = __pyx_2;
02263 __pyx_2 = 0;
02264
02265
02266 ((struct __pyx_obj_4dnet_addr *)__pyx_v_a)->_addr = ((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr;
02267
02268
02269 Py_INCREF(__pyx_v_a);
02270 __pyx_r = __pyx_v_a;
02271 goto __pyx_L0;
02272
02273 __pyx_r = Py_None; Py_INCREF(__pyx_r);
02274 goto __pyx_L0;
02275 __pyx_L1:;
02276 Py_XDECREF(__pyx_1);
02277 Py_XDECREF(__pyx_2);
02278 __Pyx_AddTraceback("dnet.addr.__copy__");
02279 __pyx_r = 0;
02280 __pyx_L0:;
02281 Py_DECREF(__pyx_v_a);
02282 Py_DECREF(__pyx_v_self);
02283 return __pyx_r;
02284 }
02285
02286 static int __pyx_f_4dnet_4addr___cmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y);
02287 static int __pyx_f_4dnet_4addr___cmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
02288 int __pyx_v_i;
02289 int __pyx_r;
02290 int __pyx_1;
02291 Py_INCREF(__pyx_v_x);
02292 Py_INCREF(__pyx_v_y);
02293 if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_4dnet_addr, 1, "y")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; goto __pyx_L1;}
02294
02295
02296 __pyx_v_i = addr_cmp((&((struct __pyx_obj_4dnet_addr *)__pyx_v_x)->_addr),(&((struct __pyx_obj_4dnet_addr *)__pyx_v_y)->_addr));
02297
02298
02299 __pyx_1 = (__pyx_v_i < 0);
02300 if (__pyx_1) {
02301
02302
02303 __pyx_r = (-1);
02304 goto __pyx_L0;
02305 goto __pyx_L2;
02306 }
02307 __pyx_L2:;
02308
02309
02310 __pyx_1 = (__pyx_v_i > 0);
02311 if (__pyx_1) {
02312
02313
02314 __pyx_r = 1;
02315 goto __pyx_L0;
02316 goto __pyx_L3;
02317 }
02318 __pyx_L3:;
02319
02320
02321 __pyx_r = 0;
02322 goto __pyx_L0;
02323
02324 __pyx_r = 0;
02325 goto __pyx_L0;
02326 __pyx_L1:;
02327 __Pyx_AddTraceback("dnet.addr.__cmp__");
02328 __pyx_r = -1;
02329 __pyx_L0:;
02330 Py_DECREF(__pyx_v_x);
02331 Py_DECREF(__pyx_v_y);
02332 return __pyx_r;
02333 }
02334
02335 static int __pyx_f_4dnet_4addr___contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_other);
02336 static int __pyx_f_4dnet_4addr___contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
02337 struct addr __pyx_v_s1;
02338 struct addr __pyx_v_s2;
02339 struct addr __pyx_v_o1;
02340 struct addr __pyx_v_o2;
02341 int __pyx_r;
02342 int __pyx_1;
02343 Py_INCREF(__pyx_v_self);
02344 Py_INCREF(__pyx_v_other);
02345 if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_4dnet_addr, 1, "other")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; goto __pyx_L1;}
02346
02347
02348 __pyx_1 = (addr_net((&((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr),(&__pyx_v_s1)) != 0);
02349 if (!__pyx_1) {
02350 __pyx_1 = (addr_bcast((&((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr),(&__pyx_v_s2)) != 0);
02351 if (!__pyx_1) {
02352 __pyx_1 = (addr_net((&((struct __pyx_obj_4dnet_addr *)__pyx_v_other)->_addr),(&__pyx_v_o1)) != 0);
02353 if (!__pyx_1) {
02354 __pyx_1 = (addr_bcast((&((struct __pyx_obj_4dnet_addr *)__pyx_v_other)->_addr),(&__pyx_v_o2)) != 0);
02355 }
02356 }
02357 }
02358 if (__pyx_1) {
02359
02360
02361 __pyx_r = 0;
02362 goto __pyx_L0;
02363 goto __pyx_L2;
02364 }
02365 __pyx_L2:;
02366
02367
02368 __pyx_1 = (addr_cmp((&__pyx_v_o1),(&__pyx_v_s1)) >= 0);
02369 if (__pyx_1) {
02370 __pyx_1 = (addr_cmp((&__pyx_v_o2),(&__pyx_v_s2)) <= 0);
02371 }
02372 __pyx_r = __pyx_1;
02373 goto __pyx_L0;
02374
02375 __pyx_r = 0;
02376 goto __pyx_L0;
02377 __pyx_L1:;
02378 __Pyx_AddTraceback("dnet.addr.__contains__");
02379 __pyx_r = -1;
02380 __pyx_L0:;
02381 Py_DECREF(__pyx_v_self);
02382 Py_DECREF(__pyx_v_other);
02383 return __pyx_r;
02384 }
02385
02386 static long __pyx_f_4dnet_4addr___hash__(PyObject *__pyx_v_self);
02387 static long __pyx_f_4dnet_4addr___hash__(PyObject *__pyx_v_self) {
02388 long __pyx_v_x;
02389 long __pyx_v_y;
02390 long __pyx_v_size;
02391 PyObject *__pyx_v_i;
02392 long __pyx_r;
02393 PyObject *__pyx_1 = 0;
02394 PyObject *__pyx_2 = 0;
02395 int __pyx_3;
02396 long __pyx_4;
02397 Py_INCREF(__pyx_v_self);
02398 __pyx_v_i = Py_None; Py_INCREF(__pyx_v_i);
02399
02400
02401 __pyx_1 = PyInt_FromLong(((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; goto __pyx_L1;}
02402 __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_ADDR_TYPE_ETH); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; goto __pyx_L1;}
02403 if (PyObject_Cmp(__pyx_1, __pyx_2, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; goto __pyx_L1;}
02404 __pyx_3 = __pyx_3 == 0;
02405 Py_DECREF(__pyx_1); __pyx_1 = 0;
02406 Py_DECREF(__pyx_2); __pyx_2 = 0;
02407 if (__pyx_3) {
02408 __pyx_v_size = 6;
02409 goto __pyx_L2;
02410 }
02411 __pyx_1 = PyInt_FromLong(((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; goto __pyx_L1;}
02412 __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_ADDR_TYPE_IP); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; goto __pyx_L1;}
02413 if (PyObject_Cmp(__pyx_1, __pyx_2, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; goto __pyx_L1;}
02414 __pyx_3 = __pyx_3 == 0;
02415 Py_DECREF(__pyx_1); __pyx_1 = 0;
02416 Py_DECREF(__pyx_2); __pyx_2 = 0;
02417 if (__pyx_3) {
02418 __pyx_v_size = 4;
02419 goto __pyx_L2;
02420 }
02421 __pyx_1 = PyInt_FromLong(((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; goto __pyx_L1;}
02422 __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_ADDR_TYPE_IP6); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; goto __pyx_L1;}
02423 if (PyObject_Cmp(__pyx_1, __pyx_2, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; goto __pyx_L1;}
02424 __pyx_3 = __pyx_3 == 0;
02425 Py_DECREF(__pyx_1); __pyx_1 = 0;
02426 Py_DECREF(__pyx_2); __pyx_2 = 0;
02427 if (__pyx_3) {
02428 __pyx_v_size = 16;
02429 goto __pyx_L2;
02430 }
02431 __pyx_L2:;
02432
02433
02434 __pyx_v_x = 3430008;
02435
02436
02437 __pyx_v_x = (__pyx_v_x ^ ((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_type);
02438
02439
02440 __pyx_v_x = (__pyx_v_x ^ ((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_bits);
02441
02442
02443 __pyx_v_y = ((((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_data8[0]) << 7);
02444
02445
02446 for (__pyx_4 = 0+1; __pyx_4 < __pyx_v_size; ++__pyx_4) {
02447 __pyx_1 = PyInt_FromLong(__pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; goto __pyx_L1;}
02448 Py_DECREF(__pyx_v_i);
02449 __pyx_v_i = __pyx_1;
02450 __pyx_1 = 0;
02451
02452
02453 __pyx_3 = PyInt_AsLong(__pyx_v_i); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; goto __pyx_L1;}
02454 __pyx_v_y = ((1000003 * __pyx_v_y) ^ (((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_data8[__pyx_3]));
02455 __pyx_L3:;
02456 }
02457 __pyx_L4:;
02458
02459
02460 __pyx_v_y = (__pyx_v_y ^ __pyx_v_size);
02461
02462
02463 __pyx_3 = (__pyx_v_y == (-1));
02464 if (__pyx_3) {
02465 __pyx_v_y = (-2);
02466 goto __pyx_L5;
02467 }
02468 __pyx_L5:;
02469
02470
02471 __pyx_v_x = (__pyx_v_x ^ __pyx_v_y);
02472
02473
02474 __pyx_3 = (__pyx_v_x == (-1));
02475 if (__pyx_3) {
02476 __pyx_v_x = (-2);
02477 goto __pyx_L6;
02478 }
02479 __pyx_L6:;
02480
02481
02482 __pyx_r = __pyx_v_x;
02483 goto __pyx_L0;
02484
02485 __pyx_r = 0;
02486 goto __pyx_L0;
02487 __pyx_L1:;
02488 Py_XDECREF(__pyx_1);
02489 Py_XDECREF(__pyx_2);
02490 __Pyx_AddTraceback("dnet.addr.__hash__");
02491 __pyx_r = -1;
02492 __pyx_L0:;
02493 Py_DECREF(__pyx_v_i);
02494 Py_DECREF(__pyx_v_self);
02495 return __pyx_r;
02496 }
02497
02498 static PyObject *__pyx_f_4dnet_4addr___int__(PyObject *__pyx_v_self);
02499 static PyObject *__pyx_f_4dnet_4addr___int__(PyObject *__pyx_v_self) {
02500 PyObject *__pyx_r;
02501 PyObject *__pyx_1 = 0;
02502 PyObject *__pyx_2 = 0;
02503 int __pyx_3;
02504 Py_INCREF(__pyx_v_self);
02505
02506
02507 __pyx_1 = PyInt_FromLong(((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; goto __pyx_L1;}
02508 __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_ADDR_TYPE_IP); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; goto __pyx_L1;}
02509 if (PyObject_Cmp(__pyx_1, __pyx_2, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; goto __pyx_L1;}
02510 __pyx_3 = __pyx_3 != 0;
02511 Py_DECREF(__pyx_1); __pyx_1 = 0;
02512 Py_DECREF(__pyx_2); __pyx_2 = 0;
02513 if (__pyx_3) {
02514
02515
02516 __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_NotImplementedError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; goto __pyx_L1;}
02517 __Pyx_Raise(__pyx_1, 0, 0);
02518 Py_DECREF(__pyx_1); __pyx_1 = 0;
02519 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; goto __pyx_L1;}
02520 goto __pyx_L2;
02521 }
02522 __pyx_L2:;
02523
02524
02525 __pyx_2 = PyLong_FromUnsignedLong(ntohl(((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_ip)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; goto __pyx_L1;}
02526 __pyx_r = __pyx_2;
02527 __pyx_2 = 0;
02528 goto __pyx_L0;
02529
02530 __pyx_r = Py_None; Py_INCREF(__pyx_r);
02531 goto __pyx_L0;
02532 __pyx_L1:;
02533 Py_XDECREF(__pyx_1);
02534 Py_XDECREF(__pyx_2);
02535 __Pyx_AddTraceback("dnet.addr.__int__");
02536 __pyx_r = 0;
02537 __pyx_L0:;
02538 Py_DECREF(__pyx_v_self);
02539 return __pyx_r;
02540 }
02541
02542 static PyObject *__pyx_n___int__;
02543
02544 static PyObject *__pyx_f_4dnet_4addr___long__(PyObject *__pyx_v_self);
02545 static PyObject *__pyx_f_4dnet_4addr___long__(PyObject *__pyx_v_self) {
02546 PyObject *__pyx_r;
02547 PyObject *__pyx_1 = 0;
02548 PyObject *__pyx_2 = 0;
02549 PyObject *__pyx_3 = 0;
02550 Py_INCREF(__pyx_v_self);
02551
02552
02553 __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n___int__); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; goto __pyx_L1;}
02554 __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; goto __pyx_L1;}
02555 __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; goto __pyx_L1;}
02556 Py_DECREF(__pyx_1); __pyx_1 = 0;
02557 Py_DECREF(__pyx_2); __pyx_2 = 0;
02558 __pyx_r = __pyx_3;
02559 __pyx_3 = 0;
02560 goto __pyx_L0;
02561
02562 __pyx_r = Py_None; Py_INCREF(__pyx_r);
02563 goto __pyx_L0;
02564 __pyx_L1:;
02565 Py_XDECREF(__pyx_1);
02566 Py_XDECREF(__pyx_2);
02567 Py_XDECREF(__pyx_3);
02568 __Pyx_AddTraceback("dnet.addr.__long__");
02569 __pyx_r = 0;
02570 __pyx_L0:;
02571 Py_DECREF(__pyx_v_self);
02572 return __pyx_r;
02573 }
02574
02575 static char (__pyx_k72[]) = "XXX - i wish!\n for i in ntohl(a.addr_ip) <= i <= ntohl(b.addr_ip):\n next = addr()\n next._addr.addr_type = ADDR_TYPE_IP\n next._addr.addr_bits = IP_ADDR_BITS\n next._addr.addr_ip = htonl(i)\n yield next\n ";
02576
02577 static PyObject *__pyx_f_4dnet_4addr___iter__(PyObject *__pyx_v_self);
02578 static PyObject *__pyx_f_4dnet_4addr___iter__(PyObject *__pyx_v_self) {
02579 struct addr __pyx_v_a;
02580 struct addr __pyx_v_b;
02581 PyObject *__pyx_r;
02582 int __pyx_1;
02583 PyObject *__pyx_2 = 0;
02584 PyObject *__pyx_3 = 0;
02585 PyObject *__pyx_4 = 0;
02586 Py_INCREF(__pyx_v_self);
02587
02588
02589 __pyx_2 = PyInt_FromLong(((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr.addr_type); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; goto __pyx_L1;}
02590 __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_ADDR_TYPE_IP); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; goto __pyx_L1;}
02591 if (PyObject_Cmp(__pyx_2, __pyx_3, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; goto __pyx_L1;}
02592 __pyx_1 = __pyx_1 != 0;
02593 Py_DECREF(__pyx_2); __pyx_2 = 0;
02594 Py_DECREF(__pyx_3); __pyx_3 = 0;
02595 if (!__pyx_1) {
02596 __pyx_1 = (addr_net((&((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr),(&__pyx_v_a)) != 0);
02597 if (!__pyx_1) {
02598 __pyx_1 = (addr_bcast((&((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr),(&__pyx_v_b)) != 0);
02599 }
02600 }
02601 if (__pyx_1) {
02602
02603
02604 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; goto __pyx_L1;}
02605 __Pyx_Raise(__pyx_2, 0, 0);
02606 Py_DECREF(__pyx_2); __pyx_2 = 0;
02607 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; goto __pyx_L1;}
02608 goto __pyx_L2;
02609 }
02610 __pyx_L2:;
02611
02612
02613 __pyx_k72;
02614
02615
02616 __pyx_3 = PyLong_FromUnsignedLong(__pyx_v_a.addr_ip); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; goto __pyx_L1;}
02617 __pyx_2 = PyLong_FromUnsignedLong(__pyx_v_b.addr_ip); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; goto __pyx_L1;}
02618 __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; goto __pyx_L1;}
02619 PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
02620 PyTuple_SET_ITEM(__pyx_4, 1, __pyx_2);
02621 __pyx_3 = 0;
02622 __pyx_2 = 0;
02623 __pyx_3 = PyObject_CallObject(((PyObject*)__pyx_ptype_4dnet___addr_ip4_iter), __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; goto __pyx_L1;}
02624 Py_DECREF(__pyx_4); __pyx_4 = 0;
02625 __pyx_r = __pyx_3;
02626 __pyx_3 = 0;
02627 goto __pyx_L0;
02628
02629 __pyx_r = Py_None; Py_INCREF(__pyx_r);
02630 goto __pyx_L0;
02631 __pyx_L1:;
02632 Py_XDECREF(__pyx_2);
02633 Py_XDECREF(__pyx_3);
02634 Py_XDECREF(__pyx_4);
02635 __Pyx_AddTraceback("dnet.addr.__iter__");
02636 __pyx_r = 0;
02637 __pyx_L0:;
02638 Py_DECREF(__pyx_v_self);
02639 return __pyx_r;
02640 }
02641
02642 static PyObject *__pyx_k73p;
02643
02644 static char (__pyx_k73[]) = "<invalid network address>";
02645
02646 static PyObject *__pyx_f_4dnet_4addr___repr__(PyObject *__pyx_v_self);
02647 static PyObject *__pyx_f_4dnet_4addr___repr__(PyObject *__pyx_v_self) {
02648 char (*__pyx_v_p);
02649 PyObject *__pyx_r;
02650 int __pyx_1;
02651 PyObject *__pyx_2 = 0;
02652 Py_INCREF(__pyx_v_self);
02653
02654
02655 __pyx_v_p = addr_ntoa((&((struct __pyx_obj_4dnet_addr *)__pyx_v_self)->_addr));
02656
02657
02658 __pyx_1 = (!(__pyx_v_p != 0));
02659 if (__pyx_1) {
02660
02661
02662 Py_INCREF(__pyx_k73p);
02663 __pyx_r = __pyx_k73p;
02664 goto __pyx_L0;
02665 goto __pyx_L2;
02666 }
02667 __pyx_L2:;
02668
02669
02670 __pyx_2 = PyString_FromString(__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; goto __pyx_L1;}
02671 __pyx_r = __pyx_2;
02672 __pyx_2 = 0;
02673 goto __pyx_L0;
02674
02675 __pyx_r = Py_None; Py_INCREF(__pyx_r);
02676 goto __pyx_L0;
02677 __pyx_L1:;
02678 Py_XDECREF(__pyx_2);
02679 __Pyx_AddTraceback("dnet.addr.__repr__");
02680 __pyx_r = 0;
02681 __pyx_L0:;
02682 Py_DECREF(__pyx_v_self);
02683 return __pyx_r;
02684 }
02685
02686 static int __pyx_f_4dnet_15__addr_ip4_iter___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
02687 static int __pyx_f_4dnet_15__addr_ip4_iter___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
02688 PyObject *__pyx_v_cur = 0;
02689 PyObject *__pyx_v_max = 0;
02690 int __pyx_r;
02691 unsigned long __pyx_1;
02692 static char *__pyx_argnames[] = {"cur","max",0};
02693 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_cur, &__pyx_v_max)) return -1;
02694 Py_INCREF(__pyx_v_self);
02695 Py_INCREF(__pyx_v_cur);
02696 Py_INCREF(__pyx_v_max);
02697
02698
02699 __pyx_1 = PyLong_AsUnsignedLong(__pyx_v_cur); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; goto __pyx_L1;}
02700 ((struct __pyx_obj_4dnet___addr_ip4_iter *)__pyx_v_self)->cur = ntohl(__pyx_1);
02701
02702
02703 __pyx_1 = PyLong_AsUnsignedLong(__pyx_v_max); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; goto __pyx_L1;}
02704 ((struct __pyx_obj_4dnet___addr_ip4_iter *)__pyx_v_self)->max = ntohl(__pyx_1);
02705
02706 __pyx_r = 0;
02707 goto __pyx_L0;
02708 __pyx_L1:;
02709 __Pyx_AddTraceback("dnet.__addr_ip4_iter.__init__");
02710 __pyx_r = -1;
02711 __pyx_L0:;
02712 Py_DECREF(__pyx_v_self);
02713 Py_DECREF(__pyx_v_cur);
02714 Py_DECREF(__pyx_v_max);
02715 return __pyx_r;
02716 }
02717
02718 static PyObject *__pyx_n_StopIteration;
02719
02720 static PyObject *__pyx_f_4dnet_15__addr_ip4_iter___next__(PyObject *__pyx_v_self);
02721 static PyObject *__pyx_f_4dnet_15__addr_ip4_iter___next__(PyObject *__pyx_v_self) {
02722 struct __pyx_obj_4dnet_addr *__pyx_v_next;
02723 PyObject *__pyx_r;
02724 int __pyx_1;
02725 PyObject *__pyx_2 = 0;
02726 PyObject *__pyx_3 = 0;
02727 unsigned short __pyx_4;
02728 Py_INCREF(__pyx_v_self);
02729 ((PyObject*)__pyx_v_next) = Py_None; Py_INCREF(((PyObject*)__pyx_v_next));
02730
02731
02732 __pyx_1 = (((struct __pyx_obj_4dnet___addr_ip4_iter *)__pyx_v_self)->cur <= ((struct __pyx_obj_4dnet___addr_ip4_iter *)__pyx_v_self)->max);
02733 if (__pyx_1) {
02734
02735
02736 __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; goto __pyx_L1;}
02737 __pyx_3 = PyObject_CallObject(((PyObject*)__pyx_ptype_4dnet_addr), __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; goto __pyx_L1;}
02738 Py_DECREF(__pyx_2); __pyx_2 = 0;
02739 if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_4dnet_addr)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; goto __pyx_L1;}
02740 Py_DECREF(((PyObject *)__pyx_v_next));
02741 ((PyObject *)__pyx_v_next) = __pyx_3;
02742 __pyx_3 = 0;
02743
02744
02745 __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_ADDR_TYPE_IP); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; goto __pyx_L1;}
02746 __pyx_4 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; goto __pyx_L1;}
02747 Py_DECREF(__pyx_2); __pyx_2 = 0;
02748 __pyx_v_next->_addr.addr_type = __pyx_4;
02749
02750
02751 __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_IP_ADDR_BITS); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; goto __pyx_L1;}
02752 __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; goto __pyx_L1;}
02753 Py_DECREF(__pyx_3); __pyx_3 = 0;
02754 __pyx_v_next->_addr.addr_bits = __pyx_4;
02755
02756
02757 __pyx_v_next->_addr.addr_ip = htonl(((struct __pyx_obj_4dnet___addr_ip4_iter *)__pyx_v_self)->cur);
02758
02759
02760 ((struct __pyx_obj_4dnet___addr_ip4_iter *)__pyx_v_self)->cur = (((struct __pyx_obj_4dnet___addr_ip4_iter *)__pyx_v_self)->cur + 1);
02761
02762
02763 Py_INCREF(((PyObject *)__pyx_v_next));
02764 __pyx_r = ((PyObject *)__pyx_v_next);
02765 goto __pyx_L0;
02766 goto __pyx_L2;
02767 }
02768 {
02769
02770
02771 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_StopIteration); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; goto __pyx_L1;}
02772 __Pyx_Raise(__pyx_2, 0, 0);
02773 Py_DECREF(__pyx_2); __pyx_2 = 0;
02774 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; goto __pyx_L1;}
02775 }
02776 __pyx_L2:;
02777
02778 __pyx_r = Py_None; Py_INCREF(__pyx_r);
02779 goto __pyx_L0;
02780 __pyx_L1:;
02781 Py_XDECREF(__pyx_2);
02782 Py_XDECREF(__pyx_3);
02783 __Pyx_AddTraceback("dnet.__addr_ip4_iter.__next__");
02784 __pyx_r = 0;
02785 __pyx_L0:;
02786 Py_DECREF(__pyx_v_next);
02787 Py_DECREF(__pyx_v_self);
02788 return __pyx_r;
02789 }
02790
02791 static int __pyx_f_4dnet___arp_callback(struct arp_entry (*__pyx_v_entry),void (*__pyx_v_arg)) {
02792 PyObject *__pyx_v_f;
02793 PyObject *__pyx_v_a;
02794 PyObject *__pyx_v_pa;
02795 PyObject *__pyx_v_ha;
02796 PyObject *__pyx_v_ret;
02797 int __pyx_r;
02798 PyObject *__pyx_1 = 0;
02799 PyObject *__pyx_2 = 0;
02800 PyObject *__pyx_3 = 0;
02801 int __pyx_4;
02802 int __pyx_5;
02803 __pyx_v_f = Py_None; Py_INCREF(__pyx_v_f);
02804 __pyx_v_a = Py_None; Py_INCREF(__pyx_v_a);
02805 __pyx_v_pa = Py_None; Py_INCREF(__pyx_v_pa);
02806 __pyx_v_ha = Py_None; Py_INCREF(__pyx_v_ha);
02807 __pyx_v_ret = Py_None; Py_INCREF(__pyx_v_ret);
02808
02809
02810 __pyx_1 = (PyObject *)__pyx_v_arg;
02811 Py_INCREF(__pyx_1);
02812 __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; goto __pyx_L1;}
02813 Py_DECREF(__pyx_v_f);
02814 __pyx_v_f = __pyx_2;
02815 __pyx_2 = 0;
02816 __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; goto __pyx_L1;}
02817 Py_DECREF(__pyx_v_a);
02818 __pyx_v_a = __pyx_3;
02819 __pyx_3 = 0;
02820 if (__Pyx_EndUnpack(__pyx_1, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; goto __pyx_L1;}
02821 Py_DECREF(__pyx_1); __pyx_1 = 0;
02822
02823
02824 __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; goto __pyx_L1;}
02825 __pyx_3 = PyObject_CallObject(((PyObject*)__pyx_ptype_4dnet_addr), __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; goto __pyx_L1;}
02826 Py_DECREF(__pyx_2); __pyx_2 = 0;
02827 __pyx_1 = PyTuple_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; goto __pyx_L1;}
02828 __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_4dnet_addr), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; goto __pyx_L1;}
02829 Py_DECREF(__pyx_1); __pyx_1 = 0;
02830 Py_DECREF(__pyx_v_pa);
02831 __pyx_v_pa = __pyx_3;
02832 __pyx_3 = 0;
02833 Py_DECREF(__pyx_v_ha);
02834 __pyx_v_ha = __pyx_2;
02835 __pyx_2 = 0;
02836
02837
02838 ((struct __pyx_obj_4dnet_addr *)__pyx_v_pa)->_addr = __pyx_v_entry->arp_pa;
02839
02840
02841 ((struct __pyx_obj_4dnet_addr *)__pyx_v_ha)->_addr = __pyx_v_entry->arp_ha;
02842
02843
02844 __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; goto __pyx_L1;}
02845 Py_INCREF(__pyx_v_pa);
02846 PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_pa);
02847 Py_INCREF(__pyx_v_ha);
02848 PyTuple_SET_ITEM(__pyx_1, 1, __pyx_v_ha);
02849 __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; goto __pyx_L1;}
02850 PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
02851 Py_INCREF(__pyx_v_a);
02852 PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_a);
02853 __pyx_1 = 0;
02854 __pyx_2 = PyObject_CallObject(__pyx_v_f, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; goto __pyx_L1;}
02855 Py_DECREF(__pyx_3); __pyx_3 = 0;
02856 Py_DECREF(__pyx_v_ret);
02857 __pyx_v_ret = __pyx_2;
02858 __pyx_2 = 0;
02859
02860
02861 __pyx_4 = PyObject_IsTrue(__pyx_v_ret); if (__pyx_4 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; goto __pyx_L1;}
02862 __pyx_5 = (!__pyx_4);
02863 if (__pyx_5) {
02864
02865
02866 __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; goto __pyx_L1;}
02867 Py_DECREF(__pyx_v_ret);
02868 __pyx_v_ret = __pyx_1;
02869 __pyx_1 = 0;
02870 goto __pyx_L2;
02871 }
02872 __pyx_L2:;
02873
02874
02875 __pyx_4 = PyInt_AsLong(__pyx_v_ret); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; goto __pyx_L1;}
02876 __pyx_r = __pyx_4;
02877 goto __pyx_L0;
02878
02879 __pyx_r = 0;
02880 goto __pyx_L0;
02881 __pyx_L1:;
02882 Py_XDECREF(__pyx_1);
02883 Py_XDECREF(__pyx_2);
02884 Py_XDECREF(__pyx_3);
02885 __Pyx_AddTraceback("dnet.__arp_callback");
02886 __pyx_r = -1;
02887 __pyx_L0:;
02888 Py_DECREF(__pyx_v_f);
02889 Py_DECREF(__pyx_v_a);
02890 Py_DECREF(__pyx_v_pa);
02891 Py_DECREF(__pyx_v_ha);
02892 Py_DECREF(__pyx_v_ret);
02893 return __pyx_r;
02894 }
02895
02896 static int __pyx_f_4dnet_3arp___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
02897 static int __pyx_f_4dnet_3arp___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
02898 int __pyx_r;
02899 int __pyx_1;
02900 PyObject *__pyx_2 = 0;
02901 PyObject *__pyx_3 = 0;
02902 static char *__pyx_argnames[] = {0};
02903 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return -1;
02904 Py_INCREF(__pyx_v_self);
02905
02906
02907 ((struct __pyx_obj_4dnet_arp *)__pyx_v_self)->arp = arp_open();
02908
02909
02910 __pyx_1 = (!(((struct __pyx_obj_4dnet_arp *)__pyx_v_self)->arp != 0));
02911 if (__pyx_1) {
02912
02913
02914 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; goto __pyx_L1;}
02915 __pyx_3 = __pyx_f_4dnet___oserror(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; goto __pyx_L1;}
02916 __Pyx_Raise(__pyx_2, __pyx_3, 0);
02917 Py_DECREF(__pyx_2); __pyx_2 = 0;
02918 Py_DECREF(__pyx_3); __pyx_3 = 0;
02919 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; goto __pyx_L1;}
02920 goto __pyx_L2;
02921 }
02922 __pyx_L2:;
02923
02924 __pyx_r = 0;
02925 goto __pyx_L0;
02926 __pyx_L1:;
02927 Py_XDECREF(__pyx_2);
02928 Py_XDECREF(__pyx_3);
02929 __Pyx_AddTraceback("dnet.arp.__init__");
02930 __pyx_r = -1;
02931 __pyx_L0:;
02932 Py_DECREF(__pyx_v_self);
02933 return __pyx_r;
02934 }
02935
02936 static PyObject *__pyx_f_4dnet_3arp_add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
02937 static char __pyx_doc_4dnet_3arp_add[] = "Add an entry to the system ARP table.\n\n Arguments:\n pa -- ADDR_TYPE_IP network address object\n ha -- ADDR_TYPE_ETH network address object\n ";
02938 static PyObject *__pyx_f_4dnet_3arp_add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
02939 struct __pyx_obj_4dnet_addr *__pyx_v_pa = 0;
02940 struct __pyx_obj_4dnet_addr *__pyx_v_ha = 0;
02941 struct arp_entry __pyx_v_entry;
02942 PyObject *__pyx_r;
02943 int __pyx_1;
02944 PyObject *__pyx_2 = 0;
02945 PyObject *__pyx_3 = 0;
02946 static char *__pyx_argnames[] = {"pa","ha",0};
02947 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_pa, &__pyx_v_ha)) return 0;
02948 Py_INCREF(__pyx_v_self);
02949 Py_INCREF(__pyx_v_pa);
02950 Py_INCREF(__pyx_v_ha);
02951 if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pa), __pyx_ptype_4dnet_addr, 1, "pa")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; goto __pyx_L1;}
02952 if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ha), __pyx_ptype_4dnet_addr, 1, "ha")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; goto __pyx_L1;}
02953
02954
02955 __pyx_v_entry.arp_pa = __pyx_v_pa->_addr;
02956
02957
02958 __pyx_v_entry.arp_ha = __pyx_v_ha->_addr;
02959
02960
02961 __pyx_1 = (arp_add(((struct __pyx_obj_4dnet_arp *)__pyx_v_self)->arp,(&__pyx_v_entry)) < 0);
02962 if (__pyx_1) {
02963
02964
02965 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; goto __pyx_L1;}
02966 __pyx_3 = __pyx_f_4dnet___oserror(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; goto __pyx_L1;}
02967 __Pyx_Raise(__pyx_2, __pyx_3, 0);
02968 Py_DECREF(__pyx_2); __pyx_2 = 0;
02969 Py_DECREF(__pyx_3); __pyx_3 = 0;
02970 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; goto __pyx_L1;}
02971 goto __pyx_L2;
02972 }
02973 __pyx_L2:;
02974
02975 __pyx_r = Py_None; Py_INCREF(__pyx_r);
02976 goto __pyx_L0;
02977 __pyx_L1:;
02978 Py_XDECREF(__pyx_2);
02979 Py_XDECREF(__pyx_3);
02980 __Pyx_AddTraceback("dnet.arp.add");
02981 __pyx_r = 0;
02982 __pyx_L0:;
02983 Py_DECREF(__pyx_v_self);
02984 Py_DECREF(__pyx_v_pa);
02985 Py_DECREF(__pyx_v_ha);
02986 return __pyx_r;
02987 }
02988
02989 static PyObject *__pyx_f_4dnet_3arp_delete(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
02990 static char __pyx_doc_4dnet_3arp_delete[] = "Delete an entry from the system ARP table.\n\n Arguments:\n pa -- ADDR_TYPE_IP network address object\n ";
02991 static PyObject *__pyx_f_4dnet_3arp_delete(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
02992 struct __pyx_obj_4dnet_addr *__pyx_v_pa = 0;
02993 struct arp_entry __pyx_v_entry;
02994 PyObject *__pyx_r;
02995 int __pyx_1;
02996 PyObject *__pyx_2 = 0;
02997 PyObject *__pyx_3 = 0;
02998 static char *__pyx_argnames[] = {"pa",0};
02999 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_pa)) return 0;
03000 Py_INCREF(__pyx_v_self);
03001 Py_INCREF(__pyx_v_pa);
03002 if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pa), __pyx_ptype_4dnet_addr, 1, "pa")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; goto __pyx_L1;}
03003
03004
03005 __pyx_v_entry.arp_pa = __pyx_v_pa->_addr;
03006
03007
03008 __pyx_1 = (arp_delete(((struct __pyx_obj_4dnet_arp *)__pyx_v_self)->arp,(&__pyx_v_entry)) < 0);
03009 if (__pyx_1) {
03010
03011
03012 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; goto __pyx_L1;}
03013 __pyx_3 = __pyx_f_4dnet___oserror(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; goto __pyx_L1;}
03014 __Pyx_Raise(__pyx_2, __pyx_3, 0);
03015 Py_DECREF(__pyx_2); __pyx_2 = 0;
03016 Py_DECREF(__pyx_3); __pyx_3 = 0;
03017 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; goto __pyx_L1;}
03018 goto __pyx_L2;
03019 }
03020 __pyx_L2:;
03021
03022 __pyx_r = Py_None; Py_INCREF(__pyx_r);
03023 goto __pyx_L0;
03024 __pyx_L1:;
03025 Py_XDECREF(__pyx_2);
03026 Py_XDECREF(__pyx_3);
03027 __Pyx_AddTraceback("dnet.arp.delete");
03028 __pyx_r = 0;
03029 __pyx_L0:;
03030 Py_DECREF(__pyx_v_self);
03031 Py_DECREF(__pyx_v_pa);
03032 return __pyx_r;
03033 }
03034
03035 static PyObject *__pyx_f_4dnet_3arp_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
03036 static char __pyx_doc_4dnet_3arp_get[] = "Return the hardware address for a given protocol address\n in the system ARP table.\n\n Arguments:\n pa -- ADDR_TYPE_IP network address object\n ";
03037 static PyObject *__pyx_f_4dnet_3arp_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
03038 struct __pyx_obj_4dnet_addr *__pyx_v_pa = 0;
03039 struct arp_entry __pyx_v_entry;
03040 PyObject *__pyx_r;
03041 int __pyx_1;
03042 PyObject *__pyx_2 = 0;
03043 PyObject *__pyx_3 = 0;
03044 static char *__pyx_argnames[] = {"pa",0};
03045 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_pa)) return 0;
03046 Py_INCREF(__pyx_v_self);
03047 Py_INCREF(__pyx_v_pa);
03048 if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pa), __pyx_ptype_4dnet_addr, 1, "pa")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; goto __pyx_L1;}
03049
03050
03051 __pyx_v_entry.arp_pa = __pyx_v_pa->_addr;
03052
03053
03054 __pyx_1 = (arp_get(((struct __pyx_obj_4dnet_arp *)__pyx_v_self)->arp,(&__pyx_v_entry)) == 0);
03055 if (__pyx_1) {
03056
03057
03058 __pyx_2 = PyString_FromString(addr_ntoa((&__pyx_v_entry.arp_ha))); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; goto __pyx_L1;}
03059 __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; goto __pyx_L1;}
03060 PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
03061 __pyx_2 = 0;
03062 __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_4dnet_addr), __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; goto __pyx_L1;}
03063 Py_DECREF(__pyx_3); __pyx_3 = 0;
03064 __pyx_r = __pyx_2;
03065 __pyx_2 = 0;
03066 goto __pyx_L0;
03067 goto __pyx_L2;
03068 }
03069 __pyx_L2:;
03070
03071
03072 Py_INCREF(Py_None);
03073 __pyx_r = Py_None;
03074 goto __pyx_L0;
03075
03076 __pyx_r = Py_None; Py_INCREF(__pyx_r);
03077 goto __pyx_L0;
03078 __pyx_L1:;
03079 Py_XDECREF(__pyx_2);
03080 Py_XDECREF(__pyx_3);
03081 __Pyx_AddTraceback("dnet.arp.get");
03082 __pyx_r = 0;
03083 __pyx_L0:;
03084 Py_DECREF(__pyx_v_self);
03085 Py_DECREF(__pyx_v_pa);
03086 return __pyx_r;
03087 }
03088
03089 static PyObject *__pyx_f_4dnet_3arp_loop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
03090 static char __pyx_doc_4dnet_3arp_loop[] = "Iterate over the system ARP table, invoking a user callback\n with each entry, returning the status of the callback routine.\n\n Keyword arguments:\n callback -- callback function with ((pa, ha), arg) prototype.\n If this function returns a non-zero value, the loop\n will break early.\n arg -- optional callback argument\n ";
03091 static PyObject *__pyx_f_4dnet_3arp_loop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
03092 PyObject *__pyx_v_callback = 0;
03093 PyObject *__pyx_v_arg = 0;
03094 PyObject *__pyx_v__arg;
03095 PyObject *__pyx_r;
03096 PyObject *__pyx_1 = 0;
03097 static char *__pyx_argnames[] = {"callback","arg",0};
03098 __pyx_v_arg = __pyx_k43;
03099 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|O", __pyx_argnames, &__pyx_v_callback, &__pyx_v_arg)) return 0;
03100 Py_INCREF(__pyx_v_self);
03101 Py_INCREF(__pyx_v_callback);
03102 Py_INCREF(__pyx_v_arg);
03103 __pyx_v__arg = Py_None; Py_INCREF(__pyx_v__arg);
03104
03105
03106 __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; goto __pyx_L1;}
03107 Py_INCREF(__pyx_v_callback);
03108 PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_callback);
03109 Py_INCREF(__pyx_v_arg);
03110 PyTuple_SET_ITEM(__pyx_1, 1, __pyx_v_arg);
03111 Py_DECREF(__pyx_v__arg);
03112 __pyx_v__arg = __pyx_1;
03113 __pyx_1 = 0;
03114
03115
03116 __pyx_1 = PyInt_FromLong(arp_loop(((struct __pyx_obj_4dnet_arp *)__pyx_v_self)->arp,__pyx_f_4dnet___arp_callback,((void (*))__pyx_v__arg))); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; goto __pyx_L1;}
03117 __pyx_r = __pyx_1;
03118 __pyx_1 = 0;
03119 goto __pyx_L0;
03120
03121 __pyx_r = Py_None; Py_INCREF(__pyx_r);
03122 goto __pyx_L0;
03123 __pyx_L1:;
03124 Py_XDECREF(__pyx_1);
03125 __Pyx_AddTraceback("dnet.arp.loop");
03126 __pyx_r = 0;
03127 __pyx_L0:;
03128 Py_DECREF(__pyx_v__arg);
03129 Py_DECREF(__pyx_v_self);
03130 Py_DECREF(__pyx_v_callback);
03131 Py_DECREF(__pyx_v_arg);
03132 return __pyx_r;
03133 }
03134
03135 static PyObject *__pyx_n_loop;
03136 static PyObject *__pyx_n_iter;
03137
03138 static PyObject *__pyx_f_4dnet_3arp___iter__(PyObject *__pyx_v_self);
03139 static PyObject *__pyx_f_4dnet_3arp___iter__(PyObject *__pyx_v_self) {
03140 PyObject *__pyx_v_l;
03141 PyObject *__pyx_r;
03142 PyObject *__pyx_1 = 0;
03143 PyObject *__pyx_2 = 0;
03144 PyObject *__pyx_3 = 0;
03145 Py_INCREF(__pyx_v_self);
03146 __pyx_v_l = Py_None; Py_INCREF(__pyx_v_l);
03147
03148
03149 __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; goto __pyx_L1;}
03150 Py_DECREF(__pyx_v_l);
03151 __pyx_v_l = __pyx_1;
03152 __pyx_1 = 0;
03153
03154
03155 __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_loop); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; goto __pyx_L1;}
03156 __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n___iter_append); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; goto __pyx_L1;}
03157 __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; goto __pyx_L1;}
03158 PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
03159 Py_INCREF(__pyx_v_l);
03160 PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_l);
03161 __pyx_2 = 0;
03162 __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; goto __pyx_L1;}
03163 Py_DECREF(__pyx_1); __pyx_1 = 0;
03164 Py_DECREF(__pyx_3); __pyx_3 = 0;
03165 Py_DECREF(__pyx_2); __pyx_2 = 0;
03166
03167
03168 __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_iter); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; goto __pyx_L1;}
03169 __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; goto __pyx_L1;}
03170 Py_INCREF(__pyx_v_l);
03171 PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_l);
03172 __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; goto __pyx_L1;}
03173 Py_DECREF(__pyx_1); __pyx_1 = 0;
03174 Py_DECREF(__pyx_3); __pyx_3 = 0;
03175 __pyx_r = __pyx_2;
03176 __pyx_2 = 0;
03177 goto __pyx_L0;
03178
03179 __pyx_r = Py_None; Py_INCREF(__pyx_r);
03180 goto __pyx_L0;
03181 __pyx_L1:;
03182 Py_XDECREF(__pyx_1);
03183 Py_XDECREF(__pyx_2);
03184 Py_XDECREF(__pyx_3);
03185 __Pyx_AddTraceback("dnet.arp.__iter__");
03186 __pyx_r = 0;
03187 __pyx_L0:;
03188 Py_DECREF(__pyx_v_l);
03189 Py_DECREF(__pyx_v_self);
03190 return __pyx_r;
03191 }
03192
03193 static void __pyx_f_4dnet_3arp___dealloc__(PyObject *__pyx_v_self);
03194 static void __pyx_f_4dnet_3arp___dealloc__(PyObject *__pyx_v_self) {
03195 int __pyx_1;
03196 Py_INCREF(__pyx_v_self);
03197
03198
03199 __pyx_1 = (((struct __pyx_obj_4dnet_arp *)__pyx_v_self)->arp != 0);
03200 if (__pyx_1) {
03201
03202
03203 arp_close(((struct __pyx_obj_4dnet_arp *)__pyx_v_self)->arp);
03204 goto __pyx_L2;
03205 }
03206 __pyx_L2:;
03207
03208 goto __pyx_L0;
03209 __pyx_L1:;
03210 __Pyx_AddTraceback("dnet.arp.__dealloc__");
03211 __pyx_L0:;
03212 Py_DECREF(__pyx_v_self);
03213 }
03214
03215 static PyObject *__pyx_f_4dnet_arp_pack_hdr_ethip(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
03216 static char __pyx_doc_4dnet_arp_pack_hdr_ethip[] = "Return a packed binary string representing an Ethernet/IP ARP message.\n \n Keyword arguments:\n op -- operation (ARP_OP_*) (16-bit integer)\n sha -- sender Ethernet address (6-byte binary string)\n spa -- sender IP address (4-byte binary string)\n dha -- destination Ethernet address (6-byte binary string)\n dpa -- destination IP address (4-byte binary string)\n ";
03217 static PyObject *__pyx_f_4dnet_arp_pack_hdr_ethip(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
03218 PyObject *__pyx_v_op = 0;
03219 PyObject *__pyx_v_sha = 0;
03220 PyObject *__pyx_v_spa = 0;
03221 PyObject *__pyx_v_dha = 0;
03222 PyObject *__pyx_v_dpa = 0;
03223 char (__pyx_v_buf[28]);
03224 eth_addr_t __pyx_v_sh;
03225 eth_addr_t __pyx_v_dh;
03226 ip_addr_t __pyx_v_sp;
03227 ip_addr_t __pyx_v_dp;
03228 PyObject *__pyx_r;
03229 PyObject *__pyx_1 = 0;
03230 int __pyx_2;
03231 static char *__pyx_argnames[] = {"op","sha","spa","dha","dpa",0};
03232 __pyx_v_op = __pyx_k44;
03233 __pyx_v_sha = __pyx_k45;
03234 __pyx_v_spa = __pyx_k46;
03235 __pyx_v_dha = __pyx_k47;
03236 __pyx_v_dpa = __pyx_k48;
03237 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|OOOOO", __pyx_argnames, &__pyx_v_op, &__pyx_v_sha, &__pyx_v_spa, &__pyx_v_dha, &__pyx_v_dpa)) return 0;
03238 Py_INCREF(__pyx_v_op);
03239 Py_INCREF(__pyx_v_sha);
03240 Py_INCREF(__pyx_v_spa);
03241 Py_INCREF(__pyx_v_dha);
03242 Py_INCREF(__pyx_v_dpa);
03243
03244
03245 __pyx_1 = __pyx_f_4dnet___memcpy(__pyx_v_sh.data,__pyx_v_sha,6); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; goto __pyx_L1;}
03246 Py_DECREF(__pyx_1); __pyx_1 = 0;
03247
03248
03249 __pyx_1 = __pyx_f_4dnet___memcpy(__pyx_v_dh.data,__pyx_v_dha,6); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; goto __pyx_L1;}
03250 Py_DECREF(__pyx_1); __pyx_1 = 0;
03251
03252
03253 __pyx_1 = __pyx_f_4dnet___memcpy(((char (*))(&__pyx_v_sp)),__pyx_v_spa,4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; goto __pyx_L1;}
03254 Py_DECREF(__pyx_1); __pyx_1 = 0;
03255
03256
03257 __pyx_1 = __pyx_f_4dnet___memcpy(((char (*))(&__pyx_v_dp)),__pyx_v_dpa,4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; goto __pyx_L1;}
03258 Py_DECREF(__pyx_1); __pyx_1 = 0;
03259
03260
03261 __pyx_2 = PyInt_AsLong(__pyx_v_op); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; goto __pyx_L1;}
03262 arp_pack_hdr_ethip(__pyx_v_buf,__pyx_2,__pyx_v_sh,__pyx_v_sp,__pyx_v_dh,__pyx_v_dp);
03263
03264
03265 __pyx_1 = PyString_FromStringAndSize(__pyx_v_buf,28); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}
03266 __pyx_r = __pyx_1;
03267 __pyx_1 = 0;
03268 goto __pyx_L0;
03269
03270 __pyx_r = Py_None; Py_INCREF(__pyx_r);
03271 goto __pyx_L0;
03272 __pyx_L1:;
03273 Py_XDECREF(__pyx_1);
03274 __Pyx_AddTraceback("dnet.arp_pack_hdr_ethip");
03275 __pyx_r = 0;
03276 __pyx_L0:;
03277 Py_DECREF(__pyx_v_op);
03278 Py_DECREF(__pyx_v_sha);
03279 Py_DECREF(__pyx_v_spa);
03280 Py_DECREF(__pyx_v_dha);
03281 Py_DECREF(__pyx_v_dpa);
03282 return __pyx_r;
03283 }
03284
03285 static PyObject *__pyx_f_4dnet_icmp_pack_hdr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
03286 static char __pyx_doc_4dnet_icmp_pack_hdr[] = "Return a packed binary string representing an ICMP header.\n\n Keyword arguments:\n type -- ICMP type (8-bit integer)\n code -- ICMP code (8-bit integer)\n ";
03287 static PyObject *__pyx_f_4dnet_icmp_pack_hdr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
03288 PyObject *__pyx_v_type = 0;
03289 PyObject *__pyx_v_code = 0;
03290 char (__pyx_v_buf[4]);
03291 PyObject *__pyx_r;
03292 int __pyx_1;
03293 int __pyx_2;
03294 PyObject *__pyx_3 = 0;
03295 static char *__pyx_argnames[] = {"type","code",0};
03296 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_type, &__pyx_v_code)) return 0;
03297 Py_INCREF(__pyx_v_type);
03298 Py_INCREF(__pyx_v_code);
03299
03300
03301 __pyx_1 = PyInt_AsLong(__pyx_v_type); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; goto __pyx_L1;}
03302 __pyx_2 = PyInt_AsLong(__pyx_v_code); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; goto __pyx_L1;}
03303 icmp_pack_hdr(__pyx_v_buf,__pyx_1,__pyx_2);
03304
03305
03306 __pyx_3 = PyString_FromStringAndSize(__pyx_v_buf,(sizeof(__pyx_v_buf))); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; goto __pyx_L1;}
03307 __pyx_r = __pyx_3;
03308 __pyx_3 = 0;
03309 goto __pyx_L0;
03310
03311 __pyx_r = Py_None; Py_INCREF(__pyx_r);
03312 goto __pyx_L0;
03313 __pyx_L1:;
03314 Py_XDECREF(__pyx_3);
03315 __Pyx_AddTraceback("dnet.icmp_pack_hdr");
03316 __pyx_r = 0;
03317 __pyx_L0:;
03318 Py_DECREF(__pyx_v_type);
03319 Py_DECREF(__pyx_v_code);
03320 return __pyx_r;
03321 }
03322
03323 static PyObject *__pyx_f_4dnet_tcp_pack_hdr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
03324 static char __pyx_doc_4dnet_tcp_pack_hdr[] = "Return a packed binary string representing a TCP header.\n\n Keyword arguments:\n sport -- source port (16-bit integer)\n dport -- destination port (16-bit integer)\n seq -- sequence number (32-bit integer)\n ack -- acknowledgment number (32-bit integer)\n flags -- control flags (TH_*) (8-bit integer bitmask)\n win -- window size (16-bit integer)\n urp -- urgent pointer (16-bit integer)\n ";
03325 static PyObject *__pyx_f_4dnet_tcp_pack_hdr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
03326 PyObject *__pyx_v_sport = 0;
03327 PyObject *__pyx_v_dport = 0;
03328 PyObject *__pyx_v_seq = 0;
03329 PyObject *__pyx_v_ack = 0;
03330 PyObject *__pyx_v_flags = 0;
03331 PyObject *__pyx_v_win = 0;
03332 PyObject *__pyx_v_urp = 0;
03333 char (__pyx_v_buf[20]);
03334 PyObject *__pyx_r;
03335 int __pyx_1;
03336 int __pyx_2;
03337 unsigned long __pyx_3;
03338 unsigned long __pyx_4;
03339 int __pyx_5;
03340 int __pyx_6;
03341 int __pyx_7;
03342 PyObject *__pyx_8 = 0;
03343 static char *__pyx_argnames[] = {"sport","dport","seq","ack","flags","win","urp",0};
03344 __pyx_v_seq = __pyx_k49;
03345 __pyx_v_ack = __pyx_k50;
03346 __pyx_v_flags = __pyx_k51;
03347 __pyx_v_win = __pyx_k52;
03348 __pyx_v_urp = __pyx_k53;
03349 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO|OOOOO", __pyx_argnames, &__pyx_v_sport, &__pyx_v_dport, &__pyx_v_seq, &__pyx_v_ack, &__pyx_v_flags, &__pyx_v_win, &__pyx_v_urp)) return 0;
03350 Py_INCREF(__pyx_v_sport);
03351 Py_INCREF(__pyx_v_dport);
03352 Py_INCREF(__pyx_v_seq);
03353 Py_INCREF(__pyx_v_ack);
03354 Py_INCREF(__pyx_v_flags);
03355 Py_INCREF(__pyx_v_win);
03356 Py_INCREF(__pyx_v_urp);
03357
03358
03359 __pyx_1 = PyInt_AsLong(__pyx_v_sport); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}
03360 __pyx_2 = PyInt_AsLong(__pyx_v_dport); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}
03361 __pyx_3 = PyLong_AsUnsignedLong(__pyx_v_seq); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}
03362 __pyx_4 = PyLong_AsUnsignedLong(__pyx_v_ack); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}
03363 __pyx_5 = PyInt_AsLong(__pyx_v_flags); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}
03364 __pyx_6 = PyInt_AsLong(__pyx_v_win); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}
03365 __pyx_7 = PyInt_AsLong(__pyx_v_urp); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}
03366 tcp_pack_hdr(__pyx_v_buf,__pyx_1,__pyx_2,__pyx_3,__pyx_4,__pyx_5,__pyx_6,__pyx_7);
03367
03368
03369 __pyx_8 = PyString_FromStringAndSize(__pyx_v_buf,(sizeof(__pyx_v_buf))); if (!__pyx_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; goto __pyx_L1;}
03370 __pyx_r = __pyx_8;
03371 __pyx_8 = 0;
03372 goto __pyx_L0;
03373
03374 __pyx_r = Py_None; Py_INCREF(__pyx_r);
03375 goto __pyx_L0;
03376 __pyx_L1:;
03377 Py_XDECREF(__pyx_8);
03378 __Pyx_AddTraceback("dnet.tcp_pack_hdr");
03379 __pyx_r = 0;
03380 __pyx_L0:;
03381 Py_DECREF(__pyx_v_sport);
03382 Py_DECREF(__pyx_v_dport);
03383 Py_DECREF(__pyx_v_seq);
03384 Py_DECREF(__pyx_v_ack);
03385 Py_DECREF(__pyx_v_flags);
03386 Py_DECREF(__pyx_v_win);
03387 Py_DECREF(__pyx_v_urp);
03388 return __pyx_r;
03389 }
03390
03391 static PyObject *__pyx_f_4dnet_udp_pack_hdr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
03392 static char __pyx_doc_4dnet_udp_pack_hdr[] = "Return a packed binary string representing a UDP header.\n\n Keyword arguments:\n sport -- source port (16-bit integer)\n dport -- destination port (16-bit integer)\n ulen -- UDP header + data length (16-bit integer)\n ";
03393 static PyObject *__pyx_f_4dnet_udp_pack_hdr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
03394 PyObject *__pyx_v_sport = 0;
03395 PyObject *__pyx_v_dport = 0;
03396 PyObject *__pyx_v_ulen = 0;
03397 char (__pyx_v_buf[8]);
03398 PyObject *__pyx_r;
03399 int __pyx_1;
03400 int __pyx_2;
03401 int __pyx_3;
03402 PyObject *__pyx_4 = 0;
03403 static char *__pyx_argnames[] = {"sport","dport","ulen",0};
03404 __pyx_v_ulen = __pyx_k54;
03405 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO|O", __pyx_argnames, &__pyx_v_sport, &__pyx_v_dport, &__pyx_v_ulen)) return 0;
03406 Py_INCREF(__pyx_v_sport);
03407 Py_INCREF(__pyx_v_dport);
03408 Py_INCREF(__pyx_v_ulen);
03409
03410
03411 __pyx_1 = PyInt_AsLong(__pyx_v_sport); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; goto __pyx_L1;}
03412 __pyx_2 = PyInt_AsLong(__pyx_v_dport); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; goto __pyx_L1;}
03413 __pyx_3 = PyInt_AsLong(__pyx_v_ulen); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; goto __pyx_L1;}
03414 udp_pack_hdr(__pyx_v_buf,__pyx_1,__pyx_2,__pyx_3);
03415
03416
03417 __pyx_4 = PyString_FromStringAndSize(__pyx_v_buf,(sizeof(__pyx_v_buf))); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; goto __pyx_L1;}
03418 __pyx_r = __pyx_4;
03419 __pyx_4 = 0;
03420 goto __pyx_L0;
03421
03422 __pyx_r = Py_None; Py_INCREF(__pyx_r);
03423 goto __pyx_L0;
03424 __pyx_L1:;
03425 Py_XDECREF(__pyx_4);
03426 __Pyx_AddTraceback("dnet.udp_pack_hdr");
03427 __pyx_r = 0;
03428 __pyx_L0:;
03429 Py_DECREF(__pyx_v_sport);
03430 Py_DECREF(__pyx_v_dport);
03431 Py_DECREF(__pyx_v_ulen);
03432 return __pyx_r;
03433 }
03434
03435 static PyObject *__pyx_n_name;
03436 static PyObject *__pyx_n_type;
03437 static PyObject *__pyx_n_flags;
03438 static PyObject *__pyx_n_mtu;
03439 static PyObject *__pyx_n_addr;
03440 static PyObject *__pyx_n_dst_addr;
03441 static PyObject *__pyx_n_link_addr;
03442 static PyObject *__pyx_n_alias_addrs;
03443
03444
03445 static PyObject *__pyx_f_4dnet_ifent_to_dict(struct intf_entry (*__pyx_v_entry)) {
03446 PyObject *__pyx_v_d;
03447 PyObject *__pyx_v_l;
03448 PyObject *__pyx_v_i;
03449 PyObject *__pyx_r;
03450 PyObject *__pyx_1 = 0;
03451 PyObject *__pyx_2 = 0;
03452 int __pyx_3;
03453 long __pyx_4;
03454 unsigned int __pyx_5;
03455 PyObject *__pyx_6 = 0;
03456 __pyx_v_d = Py_None; Py_INCREF(__pyx_v_d);
03457 __pyx_v_l = Py_None; Py_INCREF(__pyx_v_l);
03458 __pyx_v_i = Py_None; Py_INCREF(__pyx_v_i);
03459
03460
03461 __pyx_1 = PyDict_New(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; goto __pyx_L1;}
03462 Py_DECREF(__pyx_v_d);
03463 __pyx_v_d = __pyx_1;
03464 __pyx_1 = 0;
03465
03466
03467 __pyx_1 = PyString_FromString(__pyx_v_entry->intf_name); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;}
03468 if (PyObject_SetItem(__pyx_v_d, __pyx_n_name, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;}
03469 Py_DECREF(__pyx_1); __pyx_1 = 0;
03470
03471
03472 __pyx_1 = PyInt_FromLong(__pyx_v_entry->intf_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;}
03473 if (PyObject_SetItem(__pyx_v_d, __pyx_n_type, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;}
03474 Py_DECREF(__pyx_1); __pyx_1 = 0;
03475
03476
03477 __pyx_1 = PyInt_FromLong(__pyx_v_entry->intf_flags); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}
03478 if (PyObject_SetItem(__pyx_v_d, __pyx_n_flags, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}
03479 Py_DECREF(__pyx_1); __pyx_1 = 0;
03480
03481
03482 __pyx_1 = PyInt_FromLong(__pyx_v_entry->intf_mtu); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;}
03483 if (PyObject_SetItem(__pyx_v_d, __pyx_n_mtu, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;}
03484 Py_DECREF(__pyx_1); __pyx_1 = 0;
03485
03486
03487 __pyx_1 = PyInt_FromLong(__pyx_v_entry->intf_addr.addr_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;}
03488 __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_ADDR_TYPE_NONE); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;}
03489 if (PyObject_Cmp(__pyx_1, __pyx_2, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;}
03490 __pyx_3 = __pyx_3 != 0;
03491 Py_DECREF(__pyx_1); __pyx_1 = 0;
03492 Py_DECREF(__pyx_2); __pyx_2 = 0;
03493 if (__pyx_3) {
03494
03495
03496 __pyx_1 = PyString_FromString(addr_ntoa((&__pyx_v_entry->intf_addr))); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;}
03497 __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;}
03498 PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1);
03499 __pyx_1 = 0;
03500 __pyx_1 = PyObject_CallObject(((PyObject*)__pyx_ptype_4dnet_addr), __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;}
03501 Py_DECREF(__pyx_2); __pyx_2 = 0;
03502 if (PyObject_SetItem(__pyx_v_d, __pyx_n_addr, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;}
03503 Py_DECREF(__pyx_1); __pyx_1 = 0;
03504 goto __pyx_L2;
03505 }
03506 __pyx_L2:;
03507
03508
03509 __pyx_2 = PyInt_FromLong(__pyx_v_entry->intf_dst_addr.addr_type); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;}
03510 __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_ADDR_TYPE_NONE); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;}
03511 if (PyObject_Cmp(__pyx_2, __pyx_1, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;}
03512 __pyx_3 = __pyx_3 != 0;
03513 Py_DECREF(__pyx_2); __pyx_2 = 0;
03514 Py_DECREF(__pyx_1); __pyx_1 = 0;
03515 if (__pyx_3) {
03516
03517
03518 __pyx_2 = PyString_FromString(addr_ntoa((&__pyx_v_entry->intf_dst_addr))); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;}
03519 __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;}
03520 PyTuple_SET_ITEM(__pyx_1, 0, __pyx_2);
03521 __pyx_2 = 0;
03522 __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_4dnet_addr), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;}
03523 Py_DECREF(__pyx_1); __pyx_1 = 0;
03524 if (PyObject_SetItem(__pyx_v_d, __pyx_n_dst_addr, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;}
03525 Py_DECREF(__pyx_2); __pyx_2 = 0;
03526 goto __pyx_L3;
03527 }
03528 __pyx_L3:;
03529
03530
03531 __pyx_1 = PyInt_FromLong(__pyx_v_entry->intf_link_addr.addr_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; goto __pyx_L1;}
03532 __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_ADDR_TYPE_NONE); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; goto __pyx_L1;}
03533 if (PyObject_Cmp(__pyx_1, __pyx_2, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; goto __pyx_L1;}
03534 __pyx_3 = __pyx_3 != 0;
03535 Py_DECREF(__pyx_1); __pyx_1 = 0;
03536 Py_DECREF(__pyx_2); __pyx_2 = 0;
03537 if (__pyx_3) {
03538
03539
03540 __pyx_1 = PyString_FromString(addr_ntoa((&__pyx_v_entry->intf_link_addr))); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;}
03541 __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;}
03542 PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1);
03543 __pyx_1 = 0;
03544 __pyx_1 = PyObject_CallObject(((PyObject*)__pyx_ptype_4dnet_addr), __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;}
03545 Py_DECREF(__pyx_2); __pyx_2 = 0;
03546 if (PyObject_SetItem(__pyx_v_d, __pyx_n_link_addr, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;}
03547 Py_DECREF(__pyx_1); __pyx_1 = 0;
03548 goto __pyx_L4;
03549 }
03550 __pyx_L4:;
03551
03552
03553 __pyx_3 = (__pyx_v_entry->intf_alias_num > 0);
03554 if (__pyx_3) {
03555
03556
03557 __pyx_2 = PyList_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; goto __pyx_L1;}
03558 Py_DECREF(__pyx_v_l);
03559 __pyx_v_l = __pyx_2;
03560 __pyx_2 = 0;
03561
03562
03563 __pyx_5 = __pyx_v_entry->intf_alias_num;
03564 for (__pyx_4 = 0; __pyx_4 < __pyx_5; ++__pyx_4) {
03565 __pyx_1 = PyInt_FromLong(__pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; goto __pyx_L1;}
03566 Py_DECREF(__pyx_v_i);
03567 __pyx_v_i = __pyx_1;
03568 __pyx_1 = 0;
03569
03570
03571 __pyx_2 = PyObject_GetAttr(__pyx_v_l, __pyx_n_append); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}
03572 __pyx_3 = PyInt_AsLong(__pyx_v_i); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}
03573 __pyx_1 = PyString_FromString(addr_ntoa((&(__pyx_v_entry->intf_alias_addrs[__pyx_3])))); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}
03574 __pyx_6 = PyTuple_New(1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}
03575 PyTuple_SET_ITEM(__pyx_6, 0, __pyx_1);
03576 __pyx_1 = 0;
03577 __pyx_1 = PyObject_CallObject(((PyObject*)__pyx_ptype_4dnet_addr), __pyx_6); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}
03578 Py_DECREF(__pyx_6); __pyx_6 = 0;
03579 __pyx_6 = PyTuple_New(1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}
03580 PyTuple_SET_ITEM(__pyx_6, 0, __pyx_1);
03581 __pyx_1 = 0;
03582 __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_6); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}
03583 Py_DECREF(__pyx_2); __pyx_2 = 0;
03584 Py_DECREF(__pyx_6); __pyx_6 = 0;
03585 Py_DECREF(__pyx_1); __pyx_1 = 0;
03586 __pyx_L6:;
03587 }
03588 __pyx_L7:;
03589
03590
03591 if (PyObject_SetItem(__pyx_v_d, __pyx_n_alias_addrs, __pyx_v_l) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;}
03592 goto __pyx_L5;
03593 }
03594 __pyx_L5:;
03595
03596
03597 Py_INCREF(__pyx_v_d);
03598 __pyx_r = __pyx_v_d;
03599 goto __pyx_L0;
03600
03601 __pyx_r = Py_None; Py_INCREF(__pyx_r);
03602 goto __pyx_L0;
03603 __pyx_L1:;
03604 Py_XDECREF(__pyx_1);
03605 Py_XDECREF(__pyx_2);
03606 Py_XDECREF(__pyx_6);
03607 __Pyx_AddTraceback("dnet.ifent_to_dict");
03608 __pyx_r = 0;
03609 __pyx_L0:;
03610 Py_DECREF(__pyx_v_d);
03611 Py_DECREF(__pyx_v_l);
03612 Py_DECREF(__pyx_v_i);
03613 return __pyx_r;
03614 }
03615
03616 static PyObject *__pyx_n_len;
03617
03618
03619 static PyObject *__pyx_f_4dnet_dict_to_ifent(PyObject *__pyx_v_d,struct intf_entry (*__pyx_v_entry)) {
03620 PyObject *__pyx_v_s;
03621 PyObject *__pyx_v_i;
03622 PyObject *__pyx_r;
03623 PyObject *__pyx_1 = 0;
03624 char (*__pyx_2);
03625 int __pyx_3;
03626 unsigned short __pyx_4;
03627 unsigned int __pyx_5;
03628 PyObject *__pyx_6 = 0;
03629 PyObject *__pyx_7 = 0;
03630 long __pyx_8;
03631 Py_INCREF(__pyx_v_d);
03632 __pyx_v_s = Py_None; Py_INCREF(__pyx_v_s);
03633 __pyx_v_i = Py_None; Py_INCREF(__pyx_v_i);
03634
03635
03636 __pyx_1 = PyObject_GetItem(__pyx_v_d, __pyx_n_name); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;}
03637 Py_DECREF(__pyx_v_s);
03638 __pyx_v_s = __pyx_1;
03639 __pyx_1 = 0;
03640
03641
03642 __pyx_2 = PyString_AsString(__pyx_v_s); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; goto __pyx_L1;}
03643 strlcpy(__pyx_v_entry->intf_name,__pyx_2,16);
03644
03645
03646 __pyx_3 = PySequence_Contains(__pyx_v_d, __pyx_n_flags); if (__pyx_3 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; goto __pyx_L1;}
03647 if (__pyx_3) {
03648
03649
03650 __pyx_1 = PyObject_GetItem(__pyx_v_d, __pyx_n_flags); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; goto __pyx_L1;}
03651 __pyx_4 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; goto __pyx_L1;}
03652 Py_DECREF(__pyx_1); __pyx_1 = 0;
03653 __pyx_v_entry->intf_flags = __pyx_4;
03654 goto __pyx_L2;
03655 }
03656 __pyx_L2:;
03657
03658
03659 __pyx_3 = PySequence_Contains(__pyx_v_d, __pyx_n_mtu); if (__pyx_3 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; goto __pyx_L1;}
03660 if (__pyx_3) {
03661
03662
03663 __pyx_1 = PyObject_GetItem(__pyx_v_d, __pyx_n_mtu); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; goto __pyx_L1;}
03664 __pyx_5 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; goto __pyx_L1;}
03665 Py_DECREF(__pyx_1); __pyx_1 = 0;
03666 __pyx_v_entry->intf_mtu = __pyx_5;
03667 goto __pyx_L3;
03668 }
03669 __pyx_L3:;
03670
03671
03672 __pyx_3 = PySequence_Contains(__pyx_v_d, __pyx_n_addr); if (__pyx_3 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}
03673 if (__pyx_3) {
03674
03675
03676 __pyx_1 = PyObject_GetItem(__pyx_v_d, __pyx_n_addr); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; goto __pyx_L1;}
03677 __pyx_v_entry->intf_addr = ((struct __pyx_obj_4dnet_addr *)__pyx_1)->_addr;
03678 Py_DECREF(__pyx_1); __pyx_1 = 0;
03679 goto __pyx_L4;
03680 }
03681 __pyx_L4:;
03682
03683
03684 __pyx_3 = PySequence_Contains(__pyx_v_d, __pyx_n_dst_addr); if (__pyx_3 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; goto __pyx_L1;}
03685 if (__pyx_3) {
03686
03687
03688 __pyx_1 = PyObject_GetItem(__pyx_v_d, __pyx_n_dst_addr); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; goto __pyx_L1;}
03689 __pyx_v_entry->intf_dst_addr = ((struct __pyx_obj_4dnet_addr *)__pyx_1)->_addr;
03690 Py_DECREF(__pyx_1); __pyx_1 = 0;
03691 goto __pyx_L5;
03692 }
03693 __pyx_L5:;
03694
03695
03696 __pyx_3 = PySequence_Contains(__pyx_v_d, __pyx_n_link_addr); if (__pyx_3 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;}
03697 if (__pyx_3) {
03698
03699
03700 __pyx_1 = PyObject_GetItem(__pyx_v_d, __pyx_n_link_addr); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; goto __pyx_L1;}
03701 __pyx_v_entry->intf_link_addr = ((struct __pyx_obj_4dnet_addr *)__pyx_1)->_addr;
03702 Py_DECREF(__pyx_1); __pyx_1 = 0;
03703 goto __pyx_L6;
03704 }
03705 __pyx_L6:;
03706
03707
03708 __pyx_3 = PySequence_Contains(__pyx_v_d, __pyx_n_alias_addrs); if (__pyx_3 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; goto __pyx_L1;}
03709 if (__pyx_3) {
03710
03711
03712 __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; goto __pyx_L1;}
03713 __pyx_6 = PyObject_GetItem(__pyx_v_d, __pyx_n_alias_addrs); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; goto __pyx_L1;}
03714 __pyx_7 = PyTuple_New(1); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; goto __pyx_L1;}
03715 PyTuple_SET_ITEM(__pyx_7, 0, __pyx_6);
03716 __pyx_6 = 0;
03717 __pyx_6 = PyObject_CallObject(__pyx_1, __pyx_7); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; goto __pyx_L1;}
03718 Py_DECREF(__pyx_1); __pyx_1 = 0;
03719 Py_DECREF(__pyx_7); __pyx_7 = 0;
03720 __pyx_5 = PyInt_AsLong(__pyx_6); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; goto __pyx_L1;}
03721 Py_DECREF(__pyx_6); __pyx_6 = 0;
03722 __pyx_v_entry->intf_alias_num = __pyx_5;
03723
03724
03725 __pyx_5 = __pyx_v_entry->intf_alias_num;
03726 for (__pyx_8 = 0; __pyx_8 < __pyx_5; ++__pyx_8) {
03727 __pyx_1 = PyInt_FromLong(__pyx_8); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; goto __pyx_L1;}
03728 Py_DECREF(__pyx_v_i);
03729 __pyx_v_i = __pyx_1;
03730 __pyx_1 = 0;
03731
03732
03733 __pyx_7 = PyObject_GetItem(__pyx_v_d, __pyx_n_alias_addrs); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; goto __pyx_L1;}
03734 __pyx_6 = PyObject_GetItem(__pyx_7, __pyx_v_i); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; goto __pyx_L1;}
03735 Py_DECREF(__pyx_7); __pyx_7 = 0;
03736 __pyx_3 = PyInt_AsLong(__pyx_v_i); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; goto __pyx_L1;}
03737 (__pyx_v_entry->intf_alias_addrs[__pyx_3]) = ((struct __pyx_obj_4dnet_addr *)__pyx_6)->_addr;
03738 Py_DECREF(__pyx_6); __pyx_6 = 0;
03739 __pyx_L8:;
03740 }
03741 __pyx_L9:;
03742 goto __pyx_L7;
03743 }
03744 __pyx_L7:;
03745
03746 __pyx_r = Py_None; Py_INCREF(__pyx_r);
03747 goto __pyx_L0;
03748 __pyx_L1:;
03749 Py_XDECREF(__pyx_1);
03750 Py_XDECREF(__pyx_6);
03751 Py_XDECREF(__pyx_7);
03752 __Pyx_AddTraceback("dnet.dict_to_ifent");
03753 __pyx_r = 0;
03754 __pyx_L0:;
03755 Py_DECREF(__pyx_v_s);
03756 Py_DECREF(__pyx_v_i);
03757 Py_DECREF(__pyx_v_d);
03758 return __pyx_r;
03759 }
03760
03761 static int __pyx_f_4dnet___intf_callback(struct intf_entry (*__pyx_v_entry),void (*__pyx_v_arg)) {
03762 PyObject *__pyx_v_f;
03763 PyObject *__pyx_v_a;
03764 PyObject *__pyx_v_ret;
03765 int __pyx_r;
03766 PyObject *__pyx_1 = 0;
03767 PyObject *__pyx_2 = 0;
03768 PyObject *__pyx_3 = 0;
03769 int __pyx_4;
03770 int __pyx_5;
03771 __pyx_v_f = Py_None; Py_INCREF(__pyx_v_f);
03772 __pyx_v_a = Py_None; Py_INCREF(__pyx_v_a);
03773 __pyx_v_ret = Py_None; Py_INCREF(__pyx_v_ret);
03774
03775
03776 __pyx_1 = (PyObject *)__pyx_v_arg;
03777 Py_INCREF(__pyx_1);
03778 __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; goto __pyx_L1;}
03779 Py_DECREF(__pyx_v_f);
03780 __pyx_v_f = __pyx_2;
03781 __pyx_2 = 0;
03782 __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; goto __pyx_L1;}
03783 Py_DECREF(__pyx_v_a);
03784 __pyx_v_a = __pyx_3;
03785 __pyx_3 = 0;
03786 if (__Pyx_EndUnpack(__pyx_1, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; goto __pyx_L1;}
03787 Py_DECREF(__pyx_1); __pyx_1 = 0;
03788
03789
03790 __pyx_2 = __pyx_f_4dnet_ifent_to_dict(__pyx_v_entry); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; goto __pyx_L1;}
03791 __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; goto __pyx_L1;}
03792 PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
03793 Py_INCREF(__pyx_v_a);
03794 PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_a);
03795 __pyx_2 = 0;
03796 __pyx_1 = PyObject_CallObject(__pyx_v_f, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; goto __pyx_L1;}
03797 Py_DECREF(__pyx_3); __pyx_3 = 0;
03798 Py_DECREF(__pyx_v_ret);
03799 __pyx_v_ret = __pyx_1;
03800 __pyx_1 = 0;
03801
03802
03803 __pyx_4 = PyObject_IsTrue(__pyx_v_ret); if (__pyx_4 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; goto __pyx_L1;}
03804 __pyx_5 = (!__pyx_4);
03805 if (__pyx_5) {
03806
03807
03808 __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; goto __pyx_L1;}
03809 Py_DECREF(__pyx_v_ret);
03810 __pyx_v_ret = __pyx_2;
03811 __pyx_2 = 0;
03812 goto __pyx_L2;
03813 }
03814 __pyx_L2:;
03815
03816
03817 __pyx_4 = PyInt_AsLong(__pyx_v_ret); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; goto __pyx_L1;}
03818 __pyx_r = __pyx_4;
03819 goto __pyx_L0;
03820
03821 __pyx_r = 0;
03822 goto __pyx_L0;
03823 __pyx_L1:;
03824 Py_XDECREF(__pyx_1);
03825 Py_XDECREF(__pyx_2);
03826 Py_XDECREF(__pyx_3);
03827 __Pyx_AddTraceback("dnet.__intf_callback");
03828 __pyx_r = -1;
03829 __pyx_L0:;
03830 Py_DECREF(__pyx_v_f);
03831 Py_DECREF(__pyx_v_a);
03832 Py_DECREF(__pyx_v_ret);
03833 return __pyx_r;
03834 }
03835
03836 static int __pyx_f_4dnet_4intf___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
03837 static int __pyx_f_4dnet_4intf___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
03838 int __pyx_r;
03839 int __pyx_1;
03840 PyObject *__pyx_2 = 0;
03841 PyObject *__pyx_3 = 0;
03842 static char *__pyx_argnames[] = {0};
03843 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return -1;
03844 Py_INCREF(__pyx_v_self);
03845
03846
03847 ((struct __pyx_obj_4dnet_intf *)__pyx_v_self)->intf = intf_open();
03848
03849
03850 __pyx_1 = (!(((struct __pyx_obj_4dnet_intf *)__pyx_v_self)->intf != 0));
03851 if (__pyx_1) {
03852
03853
03854 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; goto __pyx_L1;}
03855 __pyx_3 = __pyx_f_4dnet___oserror(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; goto __pyx_L1;}
03856 __Pyx_Raise(__pyx_2, __pyx_3, 0);
03857 Py_DECREF(__pyx_2); __pyx_2 = 0;
03858 Py_DECREF(__pyx_3); __pyx_3 = 0;
03859 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; goto __pyx_L1;}
03860 goto __pyx_L2;
03861 }
03862 __pyx_L2:;
03863
03864 __pyx_r = 0;
03865 goto __pyx_L0;
03866 __pyx_L1:;
03867 Py_XDECREF(__pyx_2);
03868 Py_XDECREF(__pyx_3);
03869 __Pyx_AddTraceback("dnet.intf.__init__");
03870 __pyx_r = -1;
03871 __pyx_L0:;
03872 Py_DECREF(__pyx_v_self);
03873 return __pyx_r;
03874 }
03875
03876 static PyObject *__pyx_f_4dnet_4intf_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
03877 static char __pyx_doc_4dnet_4intf_get[] = "Return the configuration for a network interface as a dict.\n ";
03878 static PyObject *__pyx_f_4dnet_4intf_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
03879 PyObject *__pyx_v_name = 0;
03880 struct intf_entry (*__pyx_v_ifent);
03881 char (__pyx_v_buf[1024]);
03882 PyObject *__pyx_r;
03883 char (*__pyx_1);
03884 int __pyx_2;
03885 PyObject *__pyx_3 = 0;
03886 PyObject *__pyx_4 = 0;
03887 static char *__pyx_argnames[] = {"name",0};
03888 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_name)) return 0;
03889 Py_INCREF(__pyx_v_self);
03890 Py_INCREF(__pyx_v_name);
03891
03892
03893 __pyx_v_ifent = ((struct intf_entry (*))__pyx_v_buf);
03894
03895
03896 __pyx_v_ifent->intf_len = 1024;
03897
03898
03899 __pyx_1 = PyString_AsString(__pyx_v_name); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; goto __pyx_L1;}
03900 strlcpy(__pyx_v_ifent->intf_name,__pyx_1,16);
03901
03902
03903 __pyx_2 = (intf_get(((struct __pyx_obj_4dnet_intf *)__pyx_v_self)->intf,__pyx_v_ifent) < 0);
03904 if (__pyx_2) {
03905
03906
03907 __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; goto __pyx_L1;}
03908 __pyx_4 = __pyx_f_4dnet___oserror(); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; goto __pyx_L1;}
03909 __Pyx_Raise(__pyx_3, __pyx_4, 0);
03910 Py_DECREF(__pyx_3); __pyx_3 = 0;
03911 Py_DECREF(__pyx_4); __pyx_4 = 0;
03912 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; goto __pyx_L1;}
03913 goto __pyx_L2;
03914 }
03915 __pyx_L2:;
03916
03917
03918 __pyx_3 = __pyx_f_4dnet_ifent_to_dict(__pyx_v_ifent); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; goto __pyx_L1;}
03919 __pyx_r = __pyx_3;
03920 __pyx_3 = 0;
03921 goto __pyx_L0;
03922
03923 __pyx_r = Py_None; Py_INCREF(__pyx_r);
03924 goto __pyx_L0;
03925 __pyx_L1:;
03926 Py_XDECREF(__pyx_3);
03927 Py_XDECREF(__pyx_4);
03928 __Pyx_AddTraceback("dnet.intf.get");
03929 __pyx_r = 0;
03930 __pyx_L0:;
03931 Py_DECREF(__pyx_v_self);
03932 Py_DECREF(__pyx_v_name);
03933 return __pyx_r;
03934 }
03935
03936 static PyObject *__pyx_f_4dnet_4intf_get_src(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
03937 static char __pyx_doc_4dnet_4intf_get_src[] = "Return the configuration for the interface whose primary address\n matches the specified source address.\n ";
03938 static PyObject *__pyx_f_4dnet_4intf_get_src(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
03939 struct __pyx_obj_4dnet_addr *__pyx_v_src = 0;
03940 struct intf_entry (*__pyx_v_ifent);
03941 char (__pyx_v_buf[1024]);
03942 PyObject *__pyx_r;
03943 int __pyx_1;
03944 PyObject *__pyx_2 = 0;
03945 PyObject *__pyx_3 = 0;
03946 static char *__pyx_argnames[] = {"src",0};
03947 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_src)) return 0;
03948 Py_INCREF(__pyx_v_self);
03949 Py_INCREF(__pyx_v_src);
03950 if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_src), __pyx_ptype_4dnet_addr, 1, "src")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; goto __pyx_L1;}
03951
03952
03953 __pyx_v_ifent = ((struct intf_entry (*))__pyx_v_buf);
03954
03955
03956 __pyx_v_ifent->intf_len = 1024;
03957
03958
03959 __pyx_1 = (intf_get_src(((struct __pyx_obj_4dnet_intf *)__pyx_v_self)->intf,__pyx_v_ifent,(&__pyx_v_src->_addr)) < 0);
03960 if (__pyx_1) {
03961
03962
03963 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; goto __pyx_L1;}
03964 __pyx_3 = __pyx_f_4dnet___oserror(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; goto __pyx_L1;}
03965 __Pyx_Raise(__pyx_2, __pyx_3, 0);
03966 Py_DECREF(__pyx_2); __pyx_2 = 0;
03967 Py_DECREF(__pyx_3); __pyx_3 = 0;
03968 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; goto __pyx_L1;}
03969 goto __pyx_L2;
03970 }
03971 __pyx_L2:;
03972
03973
03974 __pyx_2 = __pyx_f_4dnet_ifent_to_dict(__pyx_v_ifent); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1003; goto __pyx_L1;}
03975 __pyx_r = __pyx_2;
03976 __pyx_2 = 0;
03977 goto __pyx_L0;
03978
03979 __pyx_r = Py_None; Py_INCREF(__pyx_r);
03980 goto __pyx_L0;
03981 __pyx_L1:;
03982 Py_XDECREF(__pyx_2);
03983 Py_XDECREF(__pyx_3);
03984 __Pyx_AddTraceback("dnet.intf.get_src");
03985 __pyx_r = 0;
03986 __pyx_L0:;
03987 Py_DECREF(__pyx_v_self);
03988 Py_DECREF(__pyx_v_src);
03989 return __pyx_r;
03990 }
03991
03992 static PyObject *__pyx_f_4dnet_4intf_get_dst(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
03993 static char __pyx_doc_4dnet_4intf_get_dst[] = "Return the configuration for the best interface with which to\n reach the specified dst address.\n ";
03994 static PyObject *__pyx_f_4dnet_4intf_get_dst(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
03995 struct __pyx_obj_4dnet_addr *__pyx_v_dst = 0;
03996 struct intf_entry (*__pyx_v_ifent);
03997 char (__pyx_v_buf[1024]);
03998 PyObject *__pyx_r;
03999 int __pyx_1;
04000 PyObject *__pyx_2 = 0;
04001 PyObject *__pyx_3 = 0;
04002 static char *__pyx_argnames[] = {"dst",0};
04003 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_dst)) return 0;
04004 Py_INCREF(__pyx_v_self);
04005 Py_INCREF(__pyx_v_dst);
04006 if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dst), __pyx_ptype_4dnet_addr, 1, "dst")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; goto __pyx_L1;}
04007
04008
04009 __pyx_v_ifent = ((struct intf_entry (*))__pyx_v_buf);
04010
04011
04012 __pyx_v_ifent->intf_len = 1024;
04013
04014
04015 __pyx_1 = (intf_get_dst(((struct __pyx_obj_4dnet_intf *)__pyx_v_self)->intf,__pyx_v_ifent,(&__pyx_v_dst->_addr)) < 0);
04016 if (__pyx_1) {
04017
04018
04019 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; goto __pyx_L1;}
04020 __pyx_3 = __pyx_f_4dnet___oserror(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; goto __pyx_L1;}
04021 __Pyx_Raise(__pyx_2, __pyx_3, 0);
04022 Py_DECREF(__pyx_2); __pyx_2 = 0;
04023 Py_DECREF(__pyx_3); __pyx_3 = 0;
04024 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; goto __pyx_L1;}
04025 goto __pyx_L2;
04026 }
04027 __pyx_L2:;
04028
04029
04030 __pyx_2 = __pyx_f_4dnet_ifent_to_dict(__pyx_v_ifent); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; goto __pyx_L1;}
04031 __pyx_r = __pyx_2;
04032 __pyx_2 = 0;
04033 goto __pyx_L0;
04034
04035 __pyx_r = Py_None; Py_INCREF(__pyx_r);
04036 goto __pyx_L0;
04037 __pyx_L1:;
04038 Py_XDECREF(__pyx_2);
04039 Py_XDECREF(__pyx_3);
04040 __Pyx_AddTraceback("dnet.intf.get_dst");
04041 __pyx_r = 0;
04042 __pyx_L0:;
04043 Py_DECREF(__pyx_v_self);
04044 Py_DECREF(__pyx_v_dst);
04045 return __pyx_r;
04046 }
04047
04048 static PyObject *__pyx_f_4dnet_4intf_set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
04049 static char __pyx_doc_4dnet_4intf_set[] = "Set the configuration for an interface from a dict.\n\n Dict values:\n name -- name of interface to set (string)\n flags -- interface flags (INTF_FLAG_*) (integer bitmask)\n mtu -- interface MTU (integer)\n addr -- primary network address (addr object)\n dst_addr -- point-to-point dst address (addr object)\n link_addr -- link-layer address (addr object)\n alias_addrs -- additional network addresses (list of addr objects)\n ";
04050 static PyObject *__pyx_f_4dnet_4intf_set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
04051 PyObject *__pyx_v_d = 0;
04052 struct intf_entry (*__pyx_v_ifent);
04053 char (__pyx_v_buf[1024]);
04054 PyObject *__pyx_r;
04055 PyObject *__pyx_1 = 0;
04056 int __pyx_2;
04057 PyObject *__pyx_3 = 0;
04058 static char *__pyx_argnames[] = {"d",0};
04059 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_d)) return 0;
04060 Py_INCREF(__pyx_v_self);
04061 Py_INCREF(__pyx_v_d);
04062
04063
04064 memset(__pyx_v_buf,0,(sizeof(__pyx_v_buf)));
04065
04066
04067 __pyx_v_ifent = ((struct intf_entry (*))__pyx_v_buf);
04068
04069
04070 __pyx_v_ifent->intf_len = 1024;
04071
04072
04073 __pyx_1 = __pyx_f_4dnet_dict_to_ifent(__pyx_v_d,__pyx_v_ifent); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; goto __pyx_L1;}
04074 Py_DECREF(__pyx_1); __pyx_1 = 0;
04075
04076
04077 __pyx_2 = (intf_set(((struct __pyx_obj_4dnet_intf *)__pyx_v_self)->intf,__pyx_v_ifent) < 0);
04078 if (__pyx_2) {
04079
04080
04081 __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; goto __pyx_L1;}
04082 __pyx_3 = __pyx_f_4dnet___oserror(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; goto __pyx_L1;}
04083 __Pyx_Raise(__pyx_1, __pyx_3, 0);
04084 Py_DECREF(__pyx_1); __pyx_1 = 0;
04085 Py_DECREF(__pyx_3); __pyx_3 = 0;
04086 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; goto __pyx_L1;}
04087 goto __pyx_L2;
04088 }
04089 __pyx_L2:;
04090
04091 __pyx_r = Py_None; Py_INCREF(__pyx_r);
04092 goto __pyx_L0;
04093 __pyx_L1:;
04094 Py_XDECREF(__pyx_1);
04095 Py_XDECREF(__pyx_3);
04096 __Pyx_AddTraceback("dnet.intf.set");
04097 __pyx_r = 0;
04098 __pyx_L0:;
04099 Py_DECREF(__pyx_v_self);
04100 Py_DECREF(__pyx_v_d);
04101 return __pyx_r;
04102 }
04103
04104 static PyObject *__pyx_f_4dnet_4intf_loop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
04105 static char __pyx_doc_4dnet_4intf_loop[] = "Iterate over the system interface table, invoking a user callback\n with each entry, returning the status of the callback routine.\n\n Keyword arguments:\n callback -- callback function with (dict, arg) prototype.\n If this function returns a non-zero value, the loop\n will break early.\n arg -- optional callback argument\n ";
04106 static PyObject *__pyx_f_4dnet_4intf_loop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
04107 PyObject *__pyx_v_callback = 0;
04108 PyObject *__pyx_v_arg = 0;
04109 PyObject *__pyx_v__arg;
04110 PyObject *__pyx_r;
04111 PyObject *__pyx_1 = 0;
04112 static char *__pyx_argnames[] = {"callback","arg",0};
04113 __pyx_v_arg = __pyx_k55;
04114 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|O", __pyx_argnames, &__pyx_v_callback, &__pyx_v_arg)) return 0;
04115 Py_INCREF(__pyx_v_self);
04116 Py_INCREF(__pyx_v_callback);
04117 Py_INCREF(__pyx_v_arg);
04118 __pyx_v__arg = Py_None; Py_INCREF(__pyx_v__arg);
04119
04120
04121 __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; goto __pyx_L1;}
04122 Py_INCREF(__pyx_v_callback);
04123 PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_callback);
04124 Py_INCREF(__pyx_v_arg);
04125 PyTuple_SET_ITEM(__pyx_1, 1, __pyx_v_arg);
04126 Py_DECREF(__pyx_v__arg);
04127 __pyx_v__arg = __pyx_1;
04128 __pyx_1 = 0;
04129
04130
04131 __pyx_1 = PyInt_FromLong(intf_loop(((struct __pyx_obj_4dnet_intf *)__pyx_v_self)->intf,__pyx_f_4dnet___intf_callback,((void (*))__pyx_v__arg))); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1049; goto __pyx_L1;}
04132 __pyx_r = __pyx_1;
04133 __pyx_1 = 0;
04134 goto __pyx_L0;
04135
04136 __pyx_r = Py_None; Py_INCREF(__pyx_r);
04137 goto __pyx_L0;
04138 __pyx_L1:;
04139 Py_XDECREF(__pyx_1);
04140 __Pyx_AddTraceback("dnet.intf.loop");
04141 __pyx_r = 0;
04142 __pyx_L0:;
04143 Py_DECREF(__pyx_v__arg);
04144 Py_DECREF(__pyx_v_self);
04145 Py_DECREF(__pyx_v_callback);
04146 Py_DECREF(__pyx_v_arg);
04147 return __pyx_r;
04148 }
04149
04150 static PyObject *__pyx_f_4dnet_4intf___iter__(PyObject *__pyx_v_self);
04151 static PyObject *__pyx_f_4dnet_4intf___iter__(PyObject *__pyx_v_self) {
04152 PyObject *__pyx_v_l;
04153 PyObject *__pyx_r;
04154 PyObject *__pyx_1 = 0;
04155 PyObject *__pyx_2 = 0;
04156 PyObject *__pyx_3 = 0;
04157 Py_INCREF(__pyx_v_self);
04158 __pyx_v_l = Py_None; Py_INCREF(__pyx_v_l);
04159
04160
04161 __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; goto __pyx_L1;}
04162 Py_DECREF(__pyx_v_l);
04163 __pyx_v_l = __pyx_1;
04164 __pyx_1 = 0;
04165
04166
04167 __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_loop); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; goto __pyx_L1;}
04168 __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n___iter_append); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; goto __pyx_L1;}
04169 __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; goto __pyx_L1;}
04170 PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
04171 Py_INCREF(__pyx_v_l);
04172 PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_l);
04173 __pyx_2 = 0;
04174 __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; goto __pyx_L1;}
04175 Py_DECREF(__pyx_1); __pyx_1 = 0;
04176 Py_DECREF(__pyx_3); __pyx_3 = 0;
04177 Py_DECREF(__pyx_2); __pyx_2 = 0;
04178
04179
04180 __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_iter); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; goto __pyx_L1;}
04181 __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; goto __pyx_L1;}
04182 Py_INCREF(__pyx_v_l);
04183 PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_l);
04184 __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; goto __pyx_L1;}
04185 Py_DECREF(__pyx_1); __pyx_1 = 0;
04186 Py_DECREF(__pyx_3); __pyx_3 = 0;
04187 __pyx_r = __pyx_2;
04188 __pyx_2 = 0;
04189 goto __pyx_L0;
04190
04191 __pyx_r = Py_None; Py_INCREF(__pyx_r);
04192 goto __pyx_L0;
04193 __pyx_L1:;
04194 Py_XDECREF(__pyx_1);
04195 Py_XDECREF(__pyx_2);
04196 Py_XDECREF(__pyx_3);
04197 __Pyx_AddTraceback("dnet.intf.__iter__");
04198 __pyx_r = 0;
04199 __pyx_L0:;
04200 Py_DECREF(__pyx_v_l);
04201 Py_DECREF(__pyx_v_self);
04202 return __pyx_r;
04203 }
04204
04205 static void __pyx_f_4dnet_4intf___dealloc__(PyObject *__pyx_v_self);
04206 static void __pyx_f_4dnet_4intf___dealloc__(PyObject *__pyx_v_self) {
04207 int __pyx_1;
04208 Py_INCREF(__pyx_v_self);
04209
04210
04211 __pyx_1 = (((struct __pyx_obj_4dnet_intf *)__pyx_v_self)->intf != 0);
04212 if (__pyx_1) {
04213
04214
04215 intf_close(((struct __pyx_obj_4dnet_intf *)__pyx_v_self)->intf);
04216 goto __pyx_L2;
04217 }
04218 __pyx_L2:;
04219
04220 goto __pyx_L0;
04221 __pyx_L1:;
04222 __Pyx_AddTraceback("dnet.intf.__dealloc__");
04223 __pyx_L0:;
04224 Py_DECREF(__pyx_v_self);
04225 }
04226
04227 static int __pyx_f_4dnet___route_callback(struct route_entry (*__pyx_v_entry),void (*__pyx_v_arg)) {
04228 PyObject *__pyx_v_f;
04229 PyObject *__pyx_v_a;
04230 PyObject *__pyx_v_dst;
04231 PyObject *__pyx_v_gw;
04232 PyObject *__pyx_v_ret;
04233 int __pyx_r;
04234 PyObject *__pyx_1 = 0;
04235 PyObject *__pyx_2 = 0;
04236 PyObject *__pyx_3 = 0;
04237 int __pyx_4;
04238 int __pyx_5;
04239 __pyx_v_f = Py_None; Py_INCREF(__pyx_v_f);
04240 __pyx_v_a = Py_None; Py_INCREF(__pyx_v_a);
04241 __pyx_v_dst = Py_None; Py_INCREF(__pyx_v_dst);
04242 __pyx_v_gw = Py_None; Py_INCREF(__pyx_v_gw);
04243 __pyx_v_ret = Py_None; Py_INCREF(__pyx_v_ret);
04244
04245
04246 __pyx_1 = (PyObject *)__pyx_v_arg;
04247 Py_INCREF(__pyx_1);
04248 __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; goto __pyx_L1;}
04249 Py_DECREF(__pyx_v_f);
04250 __pyx_v_f = __pyx_2;
04251 __pyx_2 = 0;
04252 __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; goto __pyx_L1;}
04253 Py_DECREF(__pyx_v_a);
04254 __pyx_v_a = __pyx_3;
04255 __pyx_3 = 0;
04256 if (__Pyx_EndUnpack(__pyx_1, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; goto __pyx_L1;}
04257 Py_DECREF(__pyx_1); __pyx_1 = 0;
04258
04259
04260 __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; goto __pyx_L1;}
04261 __pyx_3 = PyObject_CallObject(((PyObject*)__pyx_ptype_4dnet_addr), __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; goto __pyx_L1;}
04262 Py_DECREF(__pyx_2); __pyx_2 = 0;
04263 __pyx_1 = PyTuple_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; goto __pyx_L1;}
04264 __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_4dnet_addr), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; goto __pyx_L1;}
04265 Py_DECREF(__pyx_1); __pyx_1 = 0;
04266 Py_DECREF(__pyx_v_dst);
04267 __pyx_v_dst = __pyx_3;
04268 __pyx_3 = 0;
04269 Py_DECREF(__pyx_v_gw);
04270 __pyx_v_gw = __pyx_2;
04271 __pyx_2 = 0;
04272
04273
04274 ((struct __pyx_obj_4dnet_addr *)__pyx_v_dst)->_addr = __pyx_v_entry->route_dst;
04275
04276
04277 ((struct __pyx_obj_4dnet_addr *)__pyx_v_gw)->_addr = __pyx_v_entry->route_gw;
04278
04279
04280 __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; goto __pyx_L1;}
04281 Py_INCREF(__pyx_v_dst);
04282 PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_dst);
04283 Py_INCREF(__pyx_v_gw);
04284 PyTuple_SET_ITEM(__pyx_1, 1, __pyx_v_gw);
04285 __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; goto __pyx_L1;}
04286 PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
04287 Py_INCREF(__pyx_v_a);
04288 PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_a);
04289 __pyx_1 = 0;
04290 __pyx_2 = PyObject_CallObject(__pyx_v_f, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; goto __pyx_L1;}
04291 Py_DECREF(__pyx_3); __pyx_3 = 0;
04292 Py_DECREF(__pyx_v_ret);
04293 __pyx_v_ret = __pyx_2;
04294 __pyx_2 = 0;
04295
04296
04297 __pyx_4 = PyObject_IsTrue(__pyx_v_ret); if (__pyx_4 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; goto __pyx_L1;}
04298 __pyx_5 = (!__pyx_4);
04299 if (__pyx_5) {
04300
04301
04302 __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1085; goto __pyx_L1;}
04303 Py_DECREF(__pyx_v_ret);
04304 __pyx_v_ret = __pyx_1;
04305 __pyx_1 = 0;
04306 goto __pyx_L2;
04307 }
04308 __pyx_L2:;
04309
04310
04311 __pyx_4 = PyInt_AsLong(__pyx_v_ret); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; goto __pyx_L1;}
04312 __pyx_r = __pyx_4;
04313 goto __pyx_L0;
04314
04315 __pyx_r = 0;
04316 goto __pyx_L0;
04317 __pyx_L1:;
04318 Py_XDECREF(__pyx_1);
04319 Py_XDECREF(__pyx_2);
04320 Py_XDECREF(__pyx_3);
04321 __Pyx_AddTraceback("dnet.__route_callback");
04322 __pyx_r = -1;
04323 __pyx_L0:;
04324 Py_DECREF(__pyx_v_f);
04325 Py_DECREF(__pyx_v_a);
04326 Py_DECREF(__pyx_v_dst);
04327 Py_DECREF(__pyx_v_gw);
04328 Py_DECREF(__pyx_v_ret);
04329 return __pyx_r;
04330 }
04331
04332 static int __pyx_f_4dnet_5route___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
04333 static int __pyx_f_4dnet_5route___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
04334 int __pyx_r;
04335 int __pyx_1;
04336 PyObject *__pyx_2 = 0;
04337 PyObject *__pyx_3 = 0;
04338 static char *__pyx_argnames[] = {0};
04339 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return -1;
04340 Py_INCREF(__pyx_v_self);
04341
04342
04343 ((struct __pyx_obj_4dnet_route *)__pyx_v_self)->route = route_open();
04344
04345
04346 __pyx_1 = (!(((struct __pyx_obj_4dnet_route *)__pyx_v_self)->route != 0));
04347 if (__pyx_1) {
04348
04349
04350 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; goto __pyx_L1;}
04351 __pyx_3 = __pyx_f_4dnet___oserror(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; goto __pyx_L1;}
04352 __Pyx_Raise(__pyx_2, __pyx_3, 0);
04353 Py_DECREF(__pyx_2); __pyx_2 = 0;
04354 Py_DECREF(__pyx_3); __pyx_3 = 0;
04355 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; goto __pyx_L1;}
04356 goto __pyx_L2;
04357 }
04358 __pyx_L2:;
04359
04360 __pyx_r = 0;
04361 goto __pyx_L0;
04362 __pyx_L1:;
04363 Py_XDECREF(__pyx_2);
04364 Py_XDECREF(__pyx_3);
04365 __Pyx_AddTraceback("dnet.route.__init__");
04366 __pyx_r = -1;
04367 __pyx_L0:;
04368 Py_DECREF(__pyx_v_self);
04369 return __pyx_r;
04370 }
04371
04372 static PyObject *__pyx_f_4dnet_5route_add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
04373 static char __pyx_doc_4dnet_5route_add[] = "Add an entry to the system routing table.\n\n Arguments:\n dst -- ADDR_TYPE_IP network address object\n gw -- ADDR_TYPE_IP network address object\n ";
04374 static PyObject *__pyx_f_4dnet_5route_add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
04375 struct __pyx_obj_4dnet_addr *__pyx_v_dst = 0;
04376 struct __pyx_obj_4dnet_addr *__pyx_v_gw = 0;
04377 struct route_entry __pyx_v_entry;
04378 PyObject *__pyx_r;
04379 int __pyx_1;
04380 PyObject *__pyx_2 = 0;
04381 PyObject *__pyx_3 = 0;
04382 static char *__pyx_argnames[] = {"dst","gw",0};
04383 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_dst, &__pyx_v_gw)) return 0;
04384 Py_INCREF(__pyx_v_self);
04385 Py_INCREF(__pyx_v_dst);
04386 Py_INCREF(__pyx_v_gw);
04387 if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dst), __pyx_ptype_4dnet_addr, 1, "dst")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; goto __pyx_L1;}
04388 if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gw), __pyx_ptype_4dnet_addr, 1, "gw")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; goto __pyx_L1;}
04389
04390
04391 __pyx_v_entry.route_dst = __pyx_v_dst->_addr;
04392
04393
04394 __pyx_v_entry.route_gw = __pyx_v_gw->_addr;
04395
04396
04397 __pyx_1 = (route_add(((struct __pyx_obj_4dnet_route *)__pyx_v_self)->route,(&__pyx_v_entry)) < 0);
04398 if (__pyx_1) {
04399
04400
04401 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; goto __pyx_L1;}
04402 __pyx_3 = __pyx_f_4dnet___oserror(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; goto __pyx_L1;}
04403 __Pyx_Raise(__pyx_2, __pyx_3, 0);
04404 Py_DECREF(__pyx_2); __pyx_2 = 0;
04405 Py_DECREF(__pyx_3); __pyx_3 = 0;
04406 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; goto __pyx_L1;}
04407 goto __pyx_L2;
04408 }
04409 __pyx_L2:;
04410
04411 __pyx_r = Py_None; Py_INCREF(__pyx_r);
04412 goto __pyx_L0;
04413 __pyx_L1:;
04414 Py_XDECREF(__pyx_2);
04415 Py_XDECREF(__pyx_3);
04416 __Pyx_AddTraceback("dnet.route.add");
04417 __pyx_r = 0;
04418 __pyx_L0:;
04419 Py_DECREF(__pyx_v_self);
04420 Py_DECREF(__pyx_v_dst);
04421 Py_DECREF(__pyx_v_gw);
04422 return __pyx_r;
04423 }
04424
04425 static PyObject *__pyx_f_4dnet_5route_delete(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
04426 static char __pyx_doc_4dnet_5route_delete[] = "Delete an entry from the system routing table.\n\n Arguments:\n dst -- ADDR_TYPE_IP network address object\n ";
04427 static PyObject *__pyx_f_4dnet_5route_delete(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
04428 struct __pyx_obj_4dnet_addr *__pyx_v_dst = 0;
04429 struct route_entry __pyx_v_entry;
04430 PyObject *__pyx_r;
04431 int __pyx_1;
04432 PyObject *__pyx_2 = 0;
04433 PyObject *__pyx_3 = 0;
04434 static char *__pyx_argnames[] = {"dst",0};
04435 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_dst)) return 0;
04436 Py_INCREF(__pyx_v_self);
04437 Py_INCREF(__pyx_v_dst);
04438 if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dst), __pyx_ptype_4dnet_addr, 1, "dst")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; goto __pyx_L1;}
04439
04440
04441 __pyx_v_entry.route_dst = __pyx_v_dst->_addr;
04442
04443
04444 __pyx_1 = (route_delete(((struct __pyx_obj_4dnet_route *)__pyx_v_self)->route,(&__pyx_v_entry)) < 0);
04445 if (__pyx_1) {
04446
04447
04448 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; goto __pyx_L1;}
04449 __pyx_3 = __pyx_f_4dnet___oserror(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; goto __pyx_L1;}
04450 __Pyx_Raise(__pyx_2, __pyx_3, 0);
04451 Py_DECREF(__pyx_2); __pyx_2 = 0;
04452 Py_DECREF(__pyx_3); __pyx_3 = 0;
04453 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; goto __pyx_L1;}
04454 goto __pyx_L2;
04455 }
04456 __pyx_L2:;
04457
04458 __pyx_r = Py_None; Py_INCREF(__pyx_r);
04459 goto __pyx_L0;
04460 __pyx_L1:;
04461 Py_XDECREF(__pyx_2);
04462 Py_XDECREF(__pyx_3);
04463 __Pyx_AddTraceback("dnet.route.delete");
04464 __pyx_r = 0;
04465 __pyx_L0:;
04466 Py_DECREF(__pyx_v_self);
04467 Py_DECREF(__pyx_v_dst);
04468 return __pyx_r;
04469 }
04470
04471 static PyObject *__pyx_f_4dnet_5route_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
04472 static char __pyx_doc_4dnet_5route_get[] = "Return the hardware address for a given protocol address\n in the system routing table.\n\n Arguments:\n dst -- ADDR_TYPE_IP network address object\n ";
04473 static PyObject *__pyx_f_4dnet_5route_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
04474 struct __pyx_obj_4dnet_addr *__pyx_v_dst = 0;
04475 struct route_entry __pyx_v_entry;
04476 PyObject *__pyx_r;
04477 int __pyx_1;
04478 PyObject *__pyx_2 = 0;
04479 PyObject *__pyx_3 = 0;
04480 static char *__pyx_argnames[] = {"dst",0};
04481 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_dst)) return 0;
04482 Py_INCREF(__pyx_v_self);
04483 Py_INCREF(__pyx_v_dst);
04484 if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dst), __pyx_ptype_4dnet_addr, 1, "dst")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; goto __pyx_L1;}
04485
04486
04487 __pyx_v_entry.route_dst = __pyx_v_dst->_addr;
04488
04489
04490 __pyx_1 = (route_get(((struct __pyx_obj_4dnet_route *)__pyx_v_self)->route,(&__pyx_v_entry)) == 0);
04491 if (__pyx_1) {
04492
04493
04494 __pyx_2 = PyString_FromString(addr_ntoa((&__pyx_v_entry.route_gw))); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; goto __pyx_L1;}
04495 __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; goto __pyx_L1;}
04496 PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
04497 __pyx_2 = 0;
04498 __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_4dnet_addr), __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; goto __pyx_L1;}
04499 Py_DECREF(__pyx_3); __pyx_3 = 0;
04500 __pyx_r = __pyx_2;
04501 __pyx_2 = 0;
04502 goto __pyx_L0;
04503 goto __pyx_L2;
04504 }
04505 __pyx_L2:;
04506
04507
04508 Py_INCREF(Py_None);
04509 __pyx_r = Py_None;
04510 goto __pyx_L0;
04511
04512 __pyx_r = Py_None; Py_INCREF(__pyx_r);
04513 goto __pyx_L0;
04514 __pyx_L1:;
04515 Py_XDECREF(__pyx_2);
04516 Py_XDECREF(__pyx_3);
04517 __Pyx_AddTraceback("dnet.route.get");
04518 __pyx_r = 0;
04519 __pyx_L0:;
04520 Py_DECREF(__pyx_v_self);
04521 Py_DECREF(__pyx_v_dst);
04522 return __pyx_r;
04523 }
04524
04525 static PyObject *__pyx_f_4dnet_5route_loop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
04526 static char __pyx_doc_4dnet_5route_loop[] = "Iterate over the system routing table, invoking a user callback\n with each entry, returning the status of the callback routine.\n\n Keyword arguments:\n callback -- callback function with ((dst, gw), arg) prototype.\n If this function returns a non-zero value, the loop\n will break early.\n arg -- optional callback argument\n ";
04527 static PyObject *__pyx_f_4dnet_5route_loop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
04528 PyObject *__pyx_v_callback = 0;
04529 PyObject *__pyx_v_arg = 0;
04530 PyObject *__pyx_v__arg;
04531 PyObject *__pyx_r;
04532 PyObject *__pyx_1 = 0;
04533 static char *__pyx_argnames[] = {"callback","arg",0};
04534 __pyx_v_arg = __pyx_k56;
04535 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|O", __pyx_argnames, &__pyx_v_callback, &__pyx_v_arg)) return 0;
04536 Py_INCREF(__pyx_v_self);
04537 Py_INCREF(__pyx_v_callback);
04538 Py_INCREF(__pyx_v_arg);
04539 __pyx_v__arg = Py_None; Py_INCREF(__pyx_v__arg);
04540
04541
04542 __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; goto __pyx_L1;}
04543 Py_INCREF(__pyx_v_callback);
04544 PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_callback);
04545 Py_INCREF(__pyx_v_arg);
04546 PyTuple_SET_ITEM(__pyx_1, 1, __pyx_v_arg);
04547 Py_DECREF(__pyx_v__arg);
04548 __pyx_v__arg = __pyx_1;
04549 __pyx_1 = 0;
04550
04551
04552 __pyx_1 = PyInt_FromLong(route_loop(((struct __pyx_obj_4dnet_route *)__pyx_v_self)->route,__pyx_f_4dnet___route_callback,((void (*))__pyx_v__arg))); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; goto __pyx_L1;}
04553 __pyx_r = __pyx_1;
04554 __pyx_1 = 0;
04555 goto __pyx_L0;
04556
04557 __pyx_r = Py_None; Py_INCREF(__pyx_r);
04558 goto __pyx_L0;
04559 __pyx_L1:;
04560 Py_XDECREF(__pyx_1);
04561 __Pyx_AddTraceback("dnet.route.loop");
04562 __pyx_r = 0;
04563 __pyx_L0:;
04564 Py_DECREF(__pyx_v__arg);
04565 Py_DECREF(__pyx_v_self);
04566 Py_DECREF(__pyx_v_callback);
04567 Py_DECREF(__pyx_v_arg);
04568 return __pyx_r;
04569 }
04570
04571 static PyObject *__pyx_f_4dnet_5route___iter__(PyObject *__pyx_v_self);
04572 static PyObject *__pyx_f_4dnet_5route___iter__(PyObject *__pyx_v_self) {
04573 PyObject *__pyx_v_l;
04574 PyObject *__pyx_r;
04575 PyObject *__pyx_1 = 0;
04576 PyObject *__pyx_2 = 0;
04577 PyObject *__pyx_3 = 0;
04578 Py_INCREF(__pyx_v_self);
04579 __pyx_v_l = Py_None; Py_INCREF(__pyx_v_l);
04580
04581
04582 __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1151; goto __pyx_L1;}
04583 Py_DECREF(__pyx_v_l);
04584 __pyx_v_l = __pyx_1;
04585 __pyx_1 = 0;
04586
04587
04588 __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_loop); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1152; goto __pyx_L1;}
04589 __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n___iter_append); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1152; goto __pyx_L1;}
04590 __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1152; goto __pyx_L1;}
04591 PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
04592 Py_INCREF(__pyx_v_l);
04593 PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_l);
04594 __pyx_2 = 0;
04595 __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1152; goto __pyx_L1;}
04596 Py_DECREF(__pyx_1); __pyx_1 = 0;
04597 Py_DECREF(__pyx_3); __pyx_3 = 0;
04598 Py_DECREF(__pyx_2); __pyx_2 = 0;
04599
04600
04601 __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_iter); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1153; goto __pyx_L1;}
04602 __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1153; goto __pyx_L1;}
04603 Py_INCREF(__pyx_v_l);
04604 PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_l);
04605 __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1153; goto __pyx_L1;}
04606 Py_DECREF(__pyx_1); __pyx_1 = 0;
04607 Py_DECREF(__pyx_3); __pyx_3 = 0;
04608 __pyx_r = __pyx_2;
04609 __pyx_2 = 0;
04610 goto __pyx_L0;
04611
04612 __pyx_r = Py_None; Py_INCREF(__pyx_r);
04613 goto __pyx_L0;
04614 __pyx_L1:;
04615 Py_XDECREF(__pyx_1);
04616 Py_XDECREF(__pyx_2);
04617 Py_XDECREF(__pyx_3);
04618 __Pyx_AddTraceback("dnet.route.__iter__");
04619 __pyx_r = 0;
04620 __pyx_L0:;
04621 Py_DECREF(__pyx_v_l);
04622 Py_DECREF(__pyx_v_self);
04623 return __pyx_r;
04624 }
04625
04626 static void __pyx_f_4dnet_5route___dealloc__(PyObject *__pyx_v_self);
04627 static void __pyx_f_4dnet_5route___dealloc__(PyObject *__pyx_v_self) {
04628 int __pyx_1;
04629 Py_INCREF(__pyx_v_self);
04630
04631
04632 __pyx_1 = (((struct __pyx_obj_4dnet_route *)__pyx_v_self)->route != 0);
04633 if (__pyx_1) {
04634
04635
04636 route_close(((struct __pyx_obj_4dnet_route *)__pyx_v_self)->route);
04637 goto __pyx_L2;
04638 }
04639 __pyx_L2:;
04640
04641 goto __pyx_L0;
04642 __pyx_L1:;
04643 __Pyx_AddTraceback("dnet.route.__dealloc__");
04644 __pyx_L0:;
04645 Py_DECREF(__pyx_v_self);
04646 }
04647
04648 static PyObject *__pyx_n_device;
04649 static PyObject *__pyx_n_op;
04650 static PyObject *__pyx_n_dir;
04651 static PyObject *__pyx_n_proto;
04652 static PyObject *__pyx_n_src;
04653 static PyObject *__pyx_n_dst;
04654 static PyObject *__pyx_n_sport;
04655 static PyObject *__pyx_n_dport;
04656
04657
04658 static PyObject *__pyx_f_4dnet_rule_to_dict(struct fw_rule (*__pyx_v_rule)) {
04659 PyObject *__pyx_v_d;
04660 PyObject *__pyx_r;
04661 PyObject *__pyx_1 = 0;
04662 int __pyx_2;
04663 PyObject *__pyx_3 = 0;
04664 int __pyx_4;
04665 PyObject *__pyx_5 = 0;
04666 __pyx_v_d = Py_None; Py_INCREF(__pyx_v_d);
04667
04668
04669 __pyx_1 = PyDict_New(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; goto __pyx_L1;}
04670 Py_DECREF(__pyx_v_d);
04671 __pyx_v_d = __pyx_1;
04672 __pyx_1 = 0;
04673
04674
04675 __pyx_1 = PyString_FromString(__pyx_v_rule->fw_device); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1191; goto __pyx_L1;}
04676 if (PyObject_SetItem(__pyx_v_d, __pyx_n_device, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1191; goto __pyx_L1;}
04677 Py_DECREF(__pyx_1); __pyx_1 = 0;
04678
04679
04680 __pyx_1 = PyInt_FromLong(__pyx_v_rule->fw_op); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; goto __pyx_L1;}
04681 if (PyObject_SetItem(__pyx_v_d, __pyx_n_op, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; goto __pyx_L1;}
04682 Py_DECREF(__pyx_1); __pyx_1 = 0;
04683
04684
04685 __pyx_1 = PyInt_FromLong(__pyx_v_rule->fw_dir); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; goto __pyx_L1;}
04686 if (PyObject_SetItem(__pyx_v_d, __pyx_n_dir, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; goto __pyx_L1;}
04687 Py_DECREF(__pyx_1); __pyx_1 = 0;
04688
04689
04690 __pyx_2 = (__pyx_v_rule->fw_proto != 0);
04691 if (__pyx_2) {
04692
04693
04694 __pyx_1 = PyInt_FromLong(__pyx_v_rule->fw_proto); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1195; goto __pyx_L1;}
04695 if (PyObject_SetItem(__pyx_v_d, __pyx_n_proto, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1195; goto __pyx_L1;}
04696 Py_DECREF(__pyx_1); __pyx_1 = 0;
04697 goto __pyx_L2;
04698 }
04699 __pyx_L2:;
04700
04701
04702 __pyx_1 = PyInt_FromLong(__pyx_v_rule->fw_src.addr_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1196; goto __pyx_L1;}
04703 __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_ADDR_TYPE_NONE); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1196; goto __pyx_L1;}
04704 if (PyObject_Cmp(__pyx_1, __pyx_3, &__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1196; goto __pyx_L1;}
04705 __pyx_2 = __pyx_2 != 0;
04706 Py_DECREF(__pyx_1); __pyx_1 = 0;
04707 Py_DECREF(__pyx_3); __pyx_3 = 0;
04708 if (__pyx_2) {
04709
04710
04711 __pyx_1 = PyString_FromString(addr_ntoa((&__pyx_v_rule->fw_src))); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1197; goto __pyx_L1;}
04712 __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1197; goto __pyx_L1;}
04713 PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
04714 __pyx_1 = 0;
04715 __pyx_1 = PyObject_CallObject(((PyObject*)__pyx_ptype_4dnet_addr), __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1197; goto __pyx_L1;}
04716 Py_DECREF(__pyx_3); __pyx_3 = 0;
04717 if (PyObject_SetItem(__pyx_v_d, __pyx_n_src, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1197; goto __pyx_L1;}
04718 Py_DECREF(__pyx_1); __pyx_1 = 0;
04719 goto __pyx_L3;
04720 }
04721 __pyx_L3:;
04722
04723
04724 __pyx_3 = PyInt_FromLong(__pyx_v_rule->fw_dst.addr_type); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1198; goto __pyx_L1;}
04725 __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_ADDR_TYPE_NONE); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1198; goto __pyx_L1;}
04726 if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1198; goto __pyx_L1;}
04727 __pyx_2 = __pyx_2 != 0;
04728 Py_DECREF(__pyx_3); __pyx_3 = 0;
04729 Py_DECREF(__pyx_1); __pyx_1 = 0;
04730 if (__pyx_2) {
04731
04732
04733 __pyx_3 = PyString_FromString(addr_ntoa((&__pyx_v_rule->fw_dst))); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1199; goto __pyx_L1;}
04734 __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1199; goto __pyx_L1;}
04735 PyTuple_SET_ITEM(__pyx_1, 0, __pyx_3);
04736 __pyx_3 = 0;
04737 __pyx_3 = PyObject_CallObject(((PyObject*)__pyx_ptype_4dnet_addr), __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1199; goto __pyx_L1;}
04738 Py_DECREF(__pyx_1); __pyx_1 = 0;
04739 if (PyObject_SetItem(__pyx_v_d, __pyx_n_dst, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1199; goto __pyx_L1;}
04740 Py_DECREF(__pyx_3); __pyx_3 = 0;
04741 goto __pyx_L4;
04742 }
04743 __pyx_L4:;
04744
04745
04746 __pyx_2 = ((__pyx_v_rule->fw_sport[0]) == 0);
04747 if (__pyx_2) {
04748 __pyx_2 = ((__pyx_v_rule->fw_sport[1]) == 0);
04749 }
04750 __pyx_4 = (!__pyx_2);
04751 if (__pyx_4) {
04752
04753
04754 __pyx_1 = PyInt_FromLong((__pyx_v_rule->fw_sport[0])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; goto __pyx_L1;}
04755 __pyx_3 = PyInt_FromLong((__pyx_v_rule->fw_sport[1])); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; goto __pyx_L1;}
04756 __pyx_5 = PyList_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; goto __pyx_L1;}
04757 PyList_SET_ITEM(__pyx_5, 0, __pyx_1);
04758 PyList_SET_ITEM(__pyx_5, 1, __pyx_3);
04759 __pyx_1 = 0;
04760 __pyx_3 = 0;
04761 if (PyObject_SetItem(__pyx_v_d, __pyx_n_sport, __pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; goto __pyx_L1;}
04762 Py_DECREF(__pyx_5); __pyx_5 = 0;
04763 goto __pyx_L5;
04764 }
04765 __pyx_L5:;
04766
04767
04768 __pyx_2 = ((__pyx_v_rule->fw_dport[0]) == 0);
04769 if (__pyx_2) {
04770 __pyx_2 = ((__pyx_v_rule->fw_dport[1]) == 0);
04771 }
04772 __pyx_4 = (!__pyx_2);
04773 if (__pyx_4) {
04774
04775
04776 __pyx_1 = PyInt_FromLong((__pyx_v_rule->fw_dport[0])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; goto __pyx_L1;}
04777 __pyx_3 = PyInt_FromLong((__pyx_v_rule->fw_dport[1])); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; goto __pyx_L1;}
04778 __pyx_5 = PyList_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; goto __pyx_L1;}
04779 PyList_SET_ITEM(__pyx_5, 0, __pyx_1);
04780 PyList_SET_ITEM(__pyx_5, 1, __pyx_3);
04781 __pyx_1 = 0;
04782 __pyx_3 = 0;
04783 if (PyObject_SetItem(__pyx_v_d, __pyx_n_dport, __pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; goto __pyx_L1;}
04784 Py_DECREF(__pyx_5); __pyx_5 = 0;
04785 goto __pyx_L6;
04786 }
04787 __pyx_L6:;
04788
04789
04790 Py_INCREF(__pyx_v_d);
04791 __pyx_r = __pyx_v_d;
04792 goto __pyx_L0;
04793
04794 __pyx_r = Py_None; Py_INCREF(__pyx_r);
04795 goto __pyx_L0;
04796 __pyx_L1:;
04797 Py_XDECREF(__pyx_1);
04798 Py_XDECREF(__pyx_3);
04799 Py_XDECREF(__pyx_5);
04800 __Pyx_AddTraceback("dnet.rule_to_dict");
04801 __pyx_r = 0;
04802 __pyx_L0:;
04803 Py_DECREF(__pyx_v_d);
04804 return __pyx_r;
04805 }
04806
04807
04808 static PyObject *__pyx_f_4dnet_dict_to_rule(PyObject *__pyx_v_d,struct fw_rule (*__pyx_v_rule)) {
04809 PyObject *__pyx_v_s;
04810 PyObject *__pyx_r;
04811 PyObject *__pyx_1 = 0;
04812 char (*__pyx_2);
04813 int __pyx_3;
04814 PyObject *__pyx_4 = 0;
04815 PyObject *__pyx_5 = 0;
04816 Py_INCREF(__pyx_v_d);
04817 __pyx_v_s = Py_None; Py_INCREF(__pyx_v_s);
04818
04819
04820 __pyx_1 = PyObject_GetItem(__pyx_v_d, __pyx_n_device); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1207; goto __pyx_L1;}
04821 Py_DECREF(__pyx_v_s);
04822 __pyx_v_s = __pyx_1;
04823 __pyx_1 = 0;
04824
04825
04826 __pyx_2 = PyString_AsString(__pyx_v_s); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1208; goto __pyx_L1;}
04827 strlcpy(__pyx_v_rule->fw_device,__pyx_2,16);
04828
04829
04830 __pyx_1 = PyObject_GetItem(__pyx_v_d, __pyx_n_op); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; goto __pyx_L1;}
04831 __pyx_3 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; goto __pyx_L1;}
04832 Py_DECREF(__pyx_1); __pyx_1 = 0;
04833 __pyx_v_rule->fw_op = __pyx_3;
04834
04835
04836 __pyx_1 = PyObject_GetItem(__pyx_v_d, __pyx_n_dir); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; goto __pyx_L1;}
04837 __pyx_3 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; goto __pyx_L1;}
04838 Py_DECREF(__pyx_1); __pyx_1 = 0;
04839 __pyx_v_rule->fw_dir = __pyx_3;
04840
04841
04842 __pyx_3 = PySequence_Contains(__pyx_v_d, __pyx_n_proto); if (__pyx_3 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1211; goto __pyx_L1;}
04843 if (__pyx_3) {
04844
04845
04846 __pyx_1 = PyObject_GetItem(__pyx_v_d, __pyx_n_proto); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; goto __pyx_L1;}
04847 __pyx_3 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; goto __pyx_L1;}
04848 Py_DECREF(__pyx_1); __pyx_1 = 0;
04849 __pyx_v_rule->fw_proto = __pyx_3;
04850
04851
04852 __pyx_1 = PyInt_FromLong(__pyx_v_rule->fw_proto); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; goto __pyx_L1;}
04853 __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_IP_PROTO_TCP); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; goto __pyx_L1;}
04854 if (PyObject_Cmp(__pyx_1, __pyx_4, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; goto __pyx_L1;}
04855 __pyx_3 = __pyx_3 == 0;
04856 Py_DECREF(__pyx_1); __pyx_1 = 0;
04857 Py_DECREF(__pyx_4); __pyx_4 = 0;
04858 if (!__pyx_3) {
04859 __pyx_1 = PyInt_FromLong(__pyx_v_rule->fw_proto); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; goto __pyx_L1;}
04860 __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_IP_PROTO_UDP); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; goto __pyx_L1;}
04861 if (PyObject_Cmp(__pyx_1, __pyx_4, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; goto __pyx_L1;}
04862 __pyx_3 = __pyx_3 == 0;
04863 Py_DECREF(__pyx_1); __pyx_1 = 0;
04864 Py_DECREF(__pyx_4); __pyx_4 = 0;
04865 }
04866 if (__pyx_3) {
04867
04868
04869 (__pyx_v_rule->fw_sport[1]) = 65535;
04870
04871
04872 (__pyx_v_rule->fw_dport[1]) = 65535;
04873 goto __pyx_L3;
04874 }
04875 __pyx_L3:;
04876 goto __pyx_L2;
04877 }
04878 __pyx_L2:;
04879
04880
04881 __pyx_3 = PySequence_Contains(__pyx_v_d, __pyx_n_src); if (__pyx_3 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1216; goto __pyx_L1;}
04882 if (__pyx_3) {
04883
04884
04885 __pyx_1 = PyObject_GetItem(__pyx_v_d, __pyx_n_src); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; goto __pyx_L1;}
04886 __pyx_v_rule->fw_src = ((struct __pyx_obj_4dnet_addr *)__pyx_1)->_addr;
04887 Py_DECREF(__pyx_1); __pyx_1 = 0;
04888 goto __pyx_L4;
04889 }
04890 __pyx_L4:;
04891
04892
04893 __pyx_3 = PySequence_Contains(__pyx_v_d, __pyx_n_dst); if (__pyx_3 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1218; goto __pyx_L1;}
04894 if (__pyx_3) {
04895
04896
04897 __pyx_4 = PyObject_GetItem(__pyx_v_d, __pyx_n_dst); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1219; goto __pyx_L1;}
04898 __pyx_v_rule->fw_dst = ((struct __pyx_obj_4dnet_addr *)__pyx_4)->_addr;
04899 Py_DECREF(__pyx_4); __pyx_4 = 0;
04900 goto __pyx_L5;
04901 }
04902 __pyx_L5:;
04903
04904
04905 __pyx_3 = PySequence_Contains(__pyx_v_d, __pyx_n_sport); if (__pyx_3 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1220; goto __pyx_L1;}
04906 if (__pyx_3) {
04907
04908
04909 __pyx_1 = PyObject_GetItem(__pyx_v_d, __pyx_n_sport); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1221; goto __pyx_L1;}
04910 __pyx_4 = PyInt_FromLong(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1221; goto __pyx_L1;}
04911 __pyx_5 = PyObject_GetItem(__pyx_1, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1221; goto __pyx_L1;}
04912 Py_DECREF(__pyx_1); __pyx_1 = 0;
04913 Py_DECREF(__pyx_4); __pyx_4 = 0;
04914 __pyx_3 = PyInt_AsLong(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1221; goto __pyx_L1;}
04915 Py_DECREF(__pyx_5); __pyx_5 = 0;
04916 (__pyx_v_rule->fw_sport[0]) = __pyx_3;
04917
04918
04919 __pyx_1 = PyObject_GetItem(__pyx_v_d, __pyx_n_sport); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1222; goto __pyx_L1;}
04920 __pyx_4 = PyInt_FromLong(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1222; goto __pyx_L1;}
04921 __pyx_5 = PyObject_GetItem(__pyx_1, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1222; goto __pyx_L1;}
04922 Py_DECREF(__pyx_1); __pyx_1 = 0;
04923 Py_DECREF(__pyx_4); __pyx_4 = 0;
04924 __pyx_3 = PyInt_AsLong(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1222; goto __pyx_L1;}
04925 Py_DECREF(__pyx_5); __pyx_5 = 0;
04926 (__pyx_v_rule->fw_sport[1]) = __pyx_3;
04927 goto __pyx_L6;
04928 }
04929 __pyx_L6:;
04930
04931
04932 __pyx_3 = PySequence_Contains(__pyx_v_d, __pyx_n_dport); if (__pyx_3 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1223; goto __pyx_L1;}
04933 if (__pyx_3) {
04934
04935
04936 __pyx_1 = PyObject_GetItem(__pyx_v_d, __pyx_n_dport); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1224; goto __pyx_L1;}
04937 __pyx_4 = PyInt_FromLong(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1224; goto __pyx_L1;}
04938 __pyx_5 = PyObject_GetItem(__pyx_1, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1224; goto __pyx_L1;}
04939 Py_DECREF(__pyx_1); __pyx_1 = 0;
04940 Py_DECREF(__pyx_4); __pyx_4 = 0;
04941 __pyx_3 = PyInt_AsLong(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1224; goto __pyx_L1;}
04942 Py_DECREF(__pyx_5); __pyx_5 = 0;
04943 (__pyx_v_rule->fw_dport[0]) = __pyx_3;
04944
04945
04946 __pyx_1 = PyObject_GetItem(__pyx_v_d, __pyx_n_dport); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1225; goto __pyx_L1;}
04947 __pyx_4 = PyInt_FromLong(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1225; goto __pyx_L1;}
04948 __pyx_5 = PyObject_GetItem(__pyx_1, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1225; goto __pyx_L1;}
04949 Py_DECREF(__pyx_1); __pyx_1 = 0;
04950 Py_DECREF(__pyx_4); __pyx_4 = 0;
04951 __pyx_3 = PyInt_AsLong(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1225; goto __pyx_L1;}
04952 Py_DECREF(__pyx_5); __pyx_5 = 0;
04953 (__pyx_v_rule->fw_dport[1]) = __pyx_3;
04954 goto __pyx_L7;
04955 }
04956 __pyx_L7:;
04957
04958 __pyx_r = Py_None; Py_INCREF(__pyx_r);
04959 goto __pyx_L0;
04960 __pyx_L1:;
04961 Py_XDECREF(__pyx_1);
04962 Py_XDECREF(__pyx_4);
04963 Py_XDECREF(__pyx_5);
04964 __Pyx_AddTraceback("dnet.dict_to_rule");
04965 __pyx_r = 0;
04966 __pyx_L0:;
04967 Py_DECREF(__pyx_v_s);
04968 Py_DECREF(__pyx_v_d);
04969 return __pyx_r;
04970 }
04971
04972 static int __pyx_f_4dnet___fw_callback(struct fw_rule (*__pyx_v_rule),void (*__pyx_v_arg)) {
04973 PyObject *__pyx_v_f;
04974 PyObject *__pyx_v_a;
04975 PyObject *__pyx_v_ret;
04976 int __pyx_r;
04977 PyObject *__pyx_1 = 0;
04978 PyObject *__pyx_2 = 0;
04979 PyObject *__pyx_3 = 0;
04980 int __pyx_4;
04981 int __pyx_5;
04982 __pyx_v_f = Py_None; Py_INCREF(__pyx_v_f);
04983 __pyx_v_a = Py_None; Py_INCREF(__pyx_v_a);
04984 __pyx_v_ret = Py_None; Py_INCREF(__pyx_v_ret);
04985
04986
04987 __pyx_1 = (PyObject *)__pyx_v_arg;
04988 Py_INCREF(__pyx_1);
04989 __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1228; goto __pyx_L1;}
04990 Py_DECREF(__pyx_v_f);
04991 __pyx_v_f = __pyx_2;
04992 __pyx_2 = 0;
04993 __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1228; goto __pyx_L1;}
04994 Py_DECREF(__pyx_v_a);
04995 __pyx_v_a = __pyx_3;
04996 __pyx_3 = 0;
04997 if (__Pyx_EndUnpack(__pyx_1, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1228; goto __pyx_L1;}
04998 Py_DECREF(__pyx_1); __pyx_1 = 0;
04999
05000
05001 __pyx_2 = __pyx_f_4dnet_rule_to_dict(__pyx_v_rule); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; goto __pyx_L1;}
05002 __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; goto __pyx_L1;}
05003 PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
05004 Py_INCREF(__pyx_v_a);
05005 PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_a);
05006 __pyx_2 = 0;
05007 __pyx_1 = PyObject_CallObject(__pyx_v_f, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; goto __pyx_L1;}
05008 Py_DECREF(__pyx_3); __pyx_3 = 0;
05009 Py_DECREF(__pyx_v_ret);
05010 __pyx_v_ret = __pyx_1;
05011 __pyx_1 = 0;
05012
05013
05014 __pyx_4 = PyObject_IsTrue(__pyx_v_ret); if (__pyx_4 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1230; goto __pyx_L1;}
05015 __pyx_5 = (!__pyx_4);
05016 if (__pyx_5) {
05017
05018
05019 __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1231; goto __pyx_L1;}
05020 Py_DECREF(__pyx_v_ret);
05021 __pyx_v_ret = __pyx_2;
05022 __pyx_2 = 0;
05023 goto __pyx_L2;
05024 }
05025 __pyx_L2:;
05026
05027
05028 __pyx_4 = PyInt_AsLong(__pyx_v_ret); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1232; goto __pyx_L1;}
05029 __pyx_r = __pyx_4;
05030 goto __pyx_L0;
05031
05032 __pyx_r = 0;
05033 goto __pyx_L0;
05034 __pyx_L1:;
05035 Py_XDECREF(__pyx_1);
05036 Py_XDECREF(__pyx_2);
05037 Py_XDECREF(__pyx_3);
05038 __Pyx_AddTraceback("dnet.__fw_callback");
05039 __pyx_r = -1;
05040 __pyx_L0:;
05041 Py_DECREF(__pyx_v_f);
05042 Py_DECREF(__pyx_v_a);
05043 Py_DECREF(__pyx_v_ret);
05044 return __pyx_r;
05045 }
05046
05047 static int __pyx_f_4dnet_2fw___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
05048 static int __pyx_f_4dnet_2fw___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
05049 int __pyx_r;
05050 int __pyx_1;
05051 PyObject *__pyx_2 = 0;
05052 PyObject *__pyx_3 = 0;
05053 static char *__pyx_argnames[] = {0};
05054 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return -1;
05055 Py_INCREF(__pyx_v_self);
05056
05057
05058 ((struct __pyx_obj_4dnet_fw *)__pyx_v_self)->fw = fw_open();
05059
05060
05061 __pyx_1 = (!(((struct __pyx_obj_4dnet_fw *)__pyx_v_self)->fw != 0));
05062 if (__pyx_1) {
05063
05064
05065 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1244; goto __pyx_L1;}
05066 __pyx_3 = __pyx_f_4dnet___oserror(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1244; goto __pyx_L1;}
05067 __Pyx_Raise(__pyx_2, __pyx_3, 0);
05068 Py_DECREF(__pyx_2); __pyx_2 = 0;
05069 Py_DECREF(__pyx_3); __pyx_3 = 0;
05070 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1244; goto __pyx_L1;}
05071 goto __pyx_L2;
05072 }
05073 __pyx_L2:;
05074
05075 __pyx_r = 0;
05076 goto __pyx_L0;
05077 __pyx_L1:;
05078 Py_XDECREF(__pyx_2);
05079 Py_XDECREF(__pyx_3);
05080 __Pyx_AddTraceback("dnet.fw.__init__");
05081 __pyx_r = -1;
05082 __pyx_L0:;
05083 Py_DECREF(__pyx_v_self);
05084 return __pyx_r;
05085 }
05086
05087 static PyObject *__pyx_f_4dnet_2fw_add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
05088 static char __pyx_doc_4dnet_2fw_add[] = "Add a firewall rule specified as a dict.\n\n Dict values:\n device -- interface name (string)\n op -- operation (FW_OP_*) (integer)\n dir -- direction (FW_DIR_*) (integer)\n proto -- IP protocol (IP_PROTO_*) (integer)\n src -- source address / net (addr object)\n dst -- destination address / net (addr object)\n sport -- source port range or ICMP type/mask (list of 2 integers)\n dport -- dest port range or ICMP code/mask (list of 2 integers)\n ";
05089 static PyObject *__pyx_f_4dnet_2fw_add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
05090 PyObject *__pyx_v_d = 0;
05091 struct fw_rule __pyx_v_rule;
05092 PyObject *__pyx_r;
05093 PyObject *__pyx_1 = 0;
05094 int __pyx_2;
05095 PyObject *__pyx_3 = 0;
05096 static char *__pyx_argnames[] = {"d",0};
05097 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_d)) return 0;
05098 Py_INCREF(__pyx_v_self);
05099 Py_INCREF(__pyx_v_d);
05100
05101
05102 memset(((char (*))(&__pyx_v_rule)),0,(sizeof(__pyx_v_rule)));
05103
05104
05105 __pyx_1 = __pyx_f_4dnet_dict_to_rule(__pyx_v_d,(&__pyx_v_rule)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1261; goto __pyx_L1;}
05106 Py_DECREF(__pyx_1); __pyx_1 = 0;
05107
05108
05109 __pyx_2 = (fw_add(((struct __pyx_obj_4dnet_fw *)__pyx_v_self)->fw,(&__pyx_v_rule)) < 0);
05110 if (__pyx_2) {
05111
05112
05113 __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; goto __pyx_L1;}
05114 __pyx_3 = __pyx_f_4dnet___oserror(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; goto __pyx_L1;}
05115 __Pyx_Raise(__pyx_1, __pyx_3, 0);
05116 Py_DECREF(__pyx_1); __pyx_1 = 0;
05117 Py_DECREF(__pyx_3); __pyx_3 = 0;
05118 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; goto __pyx_L1;}
05119 goto __pyx_L2;
05120 }
05121 __pyx_L2:;
05122
05123 __pyx_r = Py_None; Py_INCREF(__pyx_r);
05124 goto __pyx_L0;
05125 __pyx_L1:;
05126 Py_XDECREF(__pyx_1);
05127 Py_XDECREF(__pyx_3);
05128 __Pyx_AddTraceback("dnet.fw.add");
05129 __pyx_r = 0;
05130 __pyx_L0:;
05131 Py_DECREF(__pyx_v_self);
05132 Py_DECREF(__pyx_v_d);
05133 return __pyx_r;
05134 }
05135
05136 static PyObject *__pyx_f_4dnet_2fw_delete(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
05137 static char __pyx_doc_4dnet_2fw_delete[] = "Delete a firewall rule specified as a dict.";
05138 static PyObject *__pyx_f_4dnet_2fw_delete(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
05139 PyObject *__pyx_v_d = 0;
05140 struct fw_rule __pyx_v_rule;
05141 PyObject *__pyx_r;
05142 PyObject *__pyx_1 = 0;
05143 int __pyx_2;
05144 PyObject *__pyx_3 = 0;
05145 static char *__pyx_argnames[] = {"d",0};
05146 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_d)) return 0;
05147 Py_INCREF(__pyx_v_self);
05148 Py_INCREF(__pyx_v_d);
05149
05150
05151 memset(((char (*))(&__pyx_v_rule)),0,(sizeof(__pyx_v_rule)));
05152
05153
05154 __pyx_1 = __pyx_f_4dnet_dict_to_rule(__pyx_v_d,(&__pyx_v_rule)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1269; goto __pyx_L1;}
05155 Py_DECREF(__pyx_1); __pyx_1 = 0;
05156
05157
05158 __pyx_2 = (fw_delete(((struct __pyx_obj_4dnet_fw *)__pyx_v_self)->fw,(&__pyx_v_rule)) < 0);
05159 if (__pyx_2) {
05160
05161
05162 __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1271; goto __pyx_L1;}
05163 __pyx_3 = __pyx_f_4dnet___oserror(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1271; goto __pyx_L1;}
05164 __Pyx_Raise(__pyx_1, __pyx_3, 0);
05165 Py_DECREF(__pyx_1); __pyx_1 = 0;
05166 Py_DECREF(__pyx_3); __pyx_3 = 0;
05167 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1271; goto __pyx_L1;}
05168 goto __pyx_L2;
05169 }
05170 __pyx_L2:;
05171
05172 __pyx_r = Py_None; Py_INCREF(__pyx_r);
05173 goto __pyx_L0;
05174 __pyx_L1:;
05175 Py_XDECREF(__pyx_1);
05176 Py_XDECREF(__pyx_3);
05177 __Pyx_AddTraceback("dnet.fw.delete");
05178 __pyx_r = 0;
05179 __pyx_L0:;
05180 Py_DECREF(__pyx_v_self);
05181 Py_DECREF(__pyx_v_d);
05182 return __pyx_r;
05183 }
05184
05185 static PyObject *__pyx_f_4dnet_2fw_loop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
05186 static char __pyx_doc_4dnet_2fw_loop[] = "Iterate over the local firewall ruleset, invoking a user callback\n with each entry, returning the status of the callback routine.\n\n Keyword arguments:\n callback -- callback function with (dict, arg) prototype.\n If this function returns a non-zero value, the loop\n will break early.\n arg -- optional callback argument\n ";
05187 static PyObject *__pyx_f_4dnet_2fw_loop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
05188 PyObject *__pyx_v_callback = 0;
05189 PyObject *__pyx_v_arg = 0;
05190 PyObject *__pyx_v__arg;
05191 PyObject *__pyx_r;
05192 PyObject *__pyx_1 = 0;
05193 static char *__pyx_argnames[] = {"callback","arg",0};
05194 __pyx_v_arg = __pyx_k57;
05195 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|O", __pyx_argnames, &__pyx_v_callback, &__pyx_v_arg)) return 0;
05196 Py_INCREF(__pyx_v_self);
05197 Py_INCREF(__pyx_v_callback);
05198 Py_INCREF(__pyx_v_arg);
05199 __pyx_v__arg = Py_None; Py_INCREF(__pyx_v__arg);
05200
05201
05202 __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1283; goto __pyx_L1;}
05203 Py_INCREF(__pyx_v_callback);
05204 PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_callback);
05205 Py_INCREF(__pyx_v_arg);
05206 PyTuple_SET_ITEM(__pyx_1, 1, __pyx_v_arg);
05207 Py_DECREF(__pyx_v__arg);
05208 __pyx_v__arg = __pyx_1;
05209 __pyx_1 = 0;
05210
05211
05212 __pyx_1 = PyInt_FromLong(fw_loop(((struct __pyx_obj_4dnet_fw *)__pyx_v_self)->fw,__pyx_f_4dnet___fw_callback,((void (*))__pyx_v__arg))); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1284; goto __pyx_L1;}
05213 __pyx_r = __pyx_1;
05214 __pyx_1 = 0;
05215 goto __pyx_L0;
05216
05217 __pyx_r = Py_None; Py_INCREF(__pyx_r);
05218 goto __pyx_L0;
05219 __pyx_L1:;
05220 Py_XDECREF(__pyx_1);
05221 __Pyx_AddTraceback("dnet.fw.loop");
05222 __pyx_r = 0;
05223 __pyx_L0:;
05224 Py_DECREF(__pyx_v__arg);
05225 Py_DECREF(__pyx_v_self);
05226 Py_DECREF(__pyx_v_callback);
05227 Py_DECREF(__pyx_v_arg);
05228 return __pyx_r;
05229 }
05230
05231 static PyObject *__pyx_f_4dnet_2fw___iter__(PyObject *__pyx_v_self);
05232 static PyObject *__pyx_f_4dnet_2fw___iter__(PyObject *__pyx_v_self) {
05233 PyObject *__pyx_v_l;
05234 PyObject *__pyx_r;
05235 PyObject *__pyx_1 = 0;
05236 PyObject *__pyx_2 = 0;
05237 PyObject *__pyx_3 = 0;
05238 Py_INCREF(__pyx_v_self);
05239 __pyx_v_l = Py_None; Py_INCREF(__pyx_v_l);
05240
05241
05242 __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1287; goto __pyx_L1;}
05243 Py_DECREF(__pyx_v_l);
05244 __pyx_v_l = __pyx_1;
05245 __pyx_1 = 0;
05246
05247
05248 __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_loop); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1288; goto __pyx_L1;}
05249 __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n___iter_append); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1288; goto __pyx_L1;}
05250 __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1288; goto __pyx_L1;}
05251 PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
05252 Py_INCREF(__pyx_v_l);
05253 PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_l);
05254 __pyx_2 = 0;
05255 __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1288; goto __pyx_L1;}
05256 Py_DECREF(__pyx_1); __pyx_1 = 0;
05257 Py_DECREF(__pyx_3); __pyx_3 = 0;
05258 Py_DECREF(__pyx_2); __pyx_2 = 0;
05259
05260
05261 __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_iter); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1289; goto __pyx_L1;}
05262 __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1289; goto __pyx_L1;}
05263 Py_INCREF(__pyx_v_l);
05264 PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_l);
05265 __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1289; goto __pyx_L1;}
05266 Py_DECREF(__pyx_1); __pyx_1 = 0;
05267 Py_DECREF(__pyx_3); __pyx_3 = 0;
05268 __pyx_r = __pyx_2;
05269 __pyx_2 = 0;
05270 goto __pyx_L0;
05271
05272 __pyx_r = Py_None; Py_INCREF(__pyx_r);
05273 goto __pyx_L0;
05274 __pyx_L1:;
05275 Py_XDECREF(__pyx_1);
05276 Py_XDECREF(__pyx_2);
05277 Py_XDECREF(__pyx_3);
05278 __Pyx_AddTraceback("dnet.fw.__iter__");
05279 __pyx_r = 0;
05280 __pyx_L0:;
05281 Py_DECREF(__pyx_v_l);
05282 Py_DECREF(__pyx_v_self);
05283 return __pyx_r;
05284 }
05285
05286 static void __pyx_f_4dnet_2fw___dealloc__(PyObject *__pyx_v_self);
05287 static void __pyx_f_4dnet_2fw___dealloc__(PyObject *__pyx_v_self) {
05288 int __pyx_1;
05289 Py_INCREF(__pyx_v_self);
05290
05291
05292 __pyx_1 = (((struct __pyx_obj_4dnet_fw *)__pyx_v_self)->fw != 0);
05293 if (__pyx_1) {
05294
05295
05296 fw_close(((struct __pyx_obj_4dnet_fw *)__pyx_v_self)->fw);
05297 goto __pyx_L2;
05298 }
05299 __pyx_L2:;
05300
05301 goto __pyx_L0;
05302 __pyx_L1:;
05303 __Pyx_AddTraceback("dnet.fw.__dealloc__");
05304 __pyx_L0:;
05305 Py_DECREF(__pyx_v_self);
05306 }
05307
05308 static int __pyx_f_4dnet_4rand___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
05309 static int __pyx_f_4dnet_4rand___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
05310 int __pyx_r;
05311 int __pyx_1;
05312 PyObject *__pyx_2 = 0;
05313 PyObject *__pyx_3 = 0;
05314 static char *__pyx_argnames[] = {0};
05315 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return -1;
05316 Py_INCREF(__pyx_v_self);
05317
05318
05319 ((struct __pyx_obj_4dnet_rand *)__pyx_v_self)->rand = rand_open();
05320
05321
05322 __pyx_1 = (!(((struct __pyx_obj_4dnet_rand *)__pyx_v_self)->rand != 0));
05323 if (__pyx_1) {
05324
05325
05326 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1324; goto __pyx_L1;}
05327 __pyx_3 = __pyx_f_4dnet___oserror(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1324; goto __pyx_L1;}
05328 __Pyx_Raise(__pyx_2, __pyx_3, 0);
05329 Py_DECREF(__pyx_2); __pyx_2 = 0;
05330 Py_DECREF(__pyx_3); __pyx_3 = 0;
05331 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1324; goto __pyx_L1;}
05332 goto __pyx_L2;
05333 }
05334 __pyx_L2:;
05335
05336 __pyx_r = 0;
05337 goto __pyx_L0;
05338 __pyx_L1:;
05339 Py_XDECREF(__pyx_2);
05340 Py_XDECREF(__pyx_3);
05341 __Pyx_AddTraceback("dnet.rand.__init__");
05342 __pyx_r = -1;
05343 __pyx_L0:;
05344 Py_DECREF(__pyx_v_self);
05345 return __pyx_r;
05346 }
05347
05348 static PyObject *__pyx_f_4dnet_4rand_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
05349 static char __pyx_doc_4dnet_4rand_get[] = "Return a string of random bytes.\n \n Arguments:\n len -- number of random bytes to generate\n ";
05350 static PyObject *__pyx_f_4dnet_4rand_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
05351 PyObject *__pyx_v_len = 0;
05352 char (__pyx_v_buf[1024]);
05353 char (*__pyx_v_p);
05354 PyObject *__pyx_v_s;
05355 PyObject *__pyx_r;
05356 PyObject *__pyx_1 = 0;
05357 int __pyx_2;
05358 static char *__pyx_argnames[] = {"len",0};
05359 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_len)) return 0;
05360 Py_INCREF(__pyx_v_self);
05361 Py_INCREF(__pyx_v_len);
05362 __pyx_v_s = Py_None; Py_INCREF(__pyx_v_s);
05363
05364
05365 __pyx_1 = PyInt_FromLong(1024); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1334; goto __pyx_L1;}
05366 if (PyObject_Cmp(__pyx_v_len, __pyx_1, &__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1334; goto __pyx_L1;}
05367 __pyx_2 = __pyx_2 <= 0;
05368 Py_DECREF(__pyx_1); __pyx_1 = 0;
05369 if (__pyx_2) {
05370
05371
05372 __pyx_2 = PyInt_AsLong(__pyx_v_len); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1335; goto __pyx_L1;}
05373 rand_get(((struct __pyx_obj_4dnet_rand *)__pyx_v_self)->rand,__pyx_v_buf,__pyx_2);
05374
05375
05376 __pyx_2 = PyInt_AsLong(__pyx_v_len); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1336; goto __pyx_L1;}
05377 __pyx_1 = PyString_FromStringAndSize(__pyx_v_buf,__pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1336; goto __pyx_L1;}
05378 __pyx_r = __pyx_1;
05379 __pyx_1 = 0;
05380 goto __pyx_L0;
05381 goto __pyx_L2;
05382 }
05383 __pyx_L2:;
05384
05385
05386 __pyx_2 = PyInt_AsLong(__pyx_v_len); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1337; goto __pyx_L1;}
05387 __pyx_v_p = malloc(__pyx_2);
05388
05389
05390 __pyx_2 = PyInt_AsLong(__pyx_v_len); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1338; goto __pyx_L1;}
05391 rand_get(((struct __pyx_obj_4dnet_rand *)__pyx_v_self)->rand,__pyx_v_p,__pyx_2);
05392
05393
05394 __pyx_2 = PyInt_AsLong(__pyx_v_len); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1339; goto __pyx_L1;}
05395 __pyx_1 = PyString_FromStringAndSize(__pyx_v_p,__pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1339; goto __pyx_L1;}
05396 Py_DECREF(__pyx_v_s);
05397 __pyx_v_s = __pyx_1;
05398 __pyx_1 = 0;
05399
05400
05401 free(__pyx_v_p);
05402
05403
05404 Py_INCREF(__pyx_v_s);
05405 __pyx_r = __pyx_v_s;
05406 goto __pyx_L0;
05407
05408 __pyx_r = Py_None; Py_INCREF(__pyx_r);
05409 goto __pyx_L0;
05410 __pyx_L1:;
05411 Py_XDECREF(__pyx_1);
05412 __Pyx_AddTraceback("dnet.rand.get");
05413 __pyx_r = 0;
05414 __pyx_L0:;
05415 Py_DECREF(__pyx_v_s);
05416 Py_DECREF(__pyx_v_self);
05417 Py_DECREF(__pyx_v_len);
05418 return __pyx_r;
05419 }
05420
05421 static PyObject *__pyx_f_4dnet_4rand_set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
05422 static char __pyx_doc_4dnet_4rand_set[] = "Initialize the PRNG from a known seed.\n \n Arguments:\n string -- binary string seed value\n ";
05423 static PyObject *__pyx_f_4dnet_4rand_set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
05424 PyObject *__pyx_v_buf = 0;
05425 PyObject *__pyx_r;
05426 char (*__pyx_1);
05427 static char *__pyx_argnames[] = {"buf",0};
05428 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_buf)) return 0;
05429 Py_INCREF(__pyx_v_self);
05430 Py_INCREF(__pyx_v_buf);
05431
05432
05433 __pyx_1 = PyString_AsString(__pyx_v_buf); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1349; goto __pyx_L1;}
05434 rand_set(((struct __pyx_obj_4dnet_rand *)__pyx_v_self)->rand,__pyx_1,PyString_Size(__pyx_v_buf));
05435
05436 __pyx_r = Py_None; Py_INCREF(__pyx_r);
05437 goto __pyx_L0;
05438 __pyx_L1:;
05439 __Pyx_AddTraceback("dnet.rand.set");
05440 __pyx_r = 0;
05441 __pyx_L0:;
05442 Py_DECREF(__pyx_v_self);
05443 Py_DECREF(__pyx_v_buf);
05444 return __pyx_r;
05445 }
05446
05447 static PyObject *__pyx_f_4dnet_4rand_add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
05448 static char __pyx_doc_4dnet_4rand_add[] = "Add additional entropy into the PRNG mix.\n\n Arguments:\n string -- binary string\n ";
05449 static PyObject *__pyx_f_4dnet_4rand_add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
05450 PyObject *__pyx_v_buf = 0;
05451 PyObject *__pyx_r;
05452 char (*__pyx_1);
05453 static char *__pyx_argnames[] = {"buf",0};
05454 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_buf)) return 0;
05455 Py_INCREF(__pyx_v_self);
05456 Py_INCREF(__pyx_v_buf);
05457
05458
05459 __pyx_1 = PyString_AsString(__pyx_v_buf); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1357; goto __pyx_L1;}
05460 rand_add(((struct __pyx_obj_4dnet_rand *)__pyx_v_self)->rand,__pyx_1,PyString_Size(__pyx_v_buf));
05461
05462 __pyx_r = Py_None; Py_INCREF(__pyx_r);
05463 goto __pyx_L0;
05464 __pyx_L1:;
05465 __Pyx_AddTraceback("dnet.rand.add");
05466 __pyx_r = 0;
05467 __pyx_L0:;
05468 Py_DECREF(__pyx_v_self);
05469 Py_DECREF(__pyx_v_buf);
05470 return __pyx_r;
05471 }
05472
05473 static PyObject *__pyx_f_4dnet_4rand_uint8(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
05474 static char __pyx_doc_4dnet_4rand_uint8[] = "Return a random 8-bit integer.";
05475 static PyObject *__pyx_f_4dnet_4rand_uint8(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
05476 PyObject *__pyx_r;
05477 PyObject *__pyx_1 = 0;
05478 static char *__pyx_argnames[] = {0};
05479 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
05480 Py_INCREF(__pyx_v_self);
05481
05482
05483 __pyx_1 = PyInt_FromLong(rand_uint8(((struct __pyx_obj_4dnet_rand *)__pyx_v_self)->rand)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; goto __pyx_L1;}
05484 __pyx_r = __pyx_1;
05485 __pyx_1 = 0;
05486 goto __pyx_L0;
05487
05488 __pyx_r = Py_None; Py_INCREF(__pyx_r);
05489 goto __pyx_L0;
05490 __pyx_L1:;
05491 Py_XDECREF(__pyx_1);
05492 __Pyx_AddTraceback("dnet.rand.uint8");
05493 __pyx_r = 0;
05494 __pyx_L0:;
05495 Py_DECREF(__pyx_v_self);
05496 return __pyx_r;
05497 }
05498
05499 static PyObject *__pyx_f_4dnet_4rand_uint16(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
05500 static char __pyx_doc_4dnet_4rand_uint16[] = "Return a random 16-bit integer.";
05501 static PyObject *__pyx_f_4dnet_4rand_uint16(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
05502 PyObject *__pyx_r;
05503 PyObject *__pyx_1 = 0;
05504 static char *__pyx_argnames[] = {0};
05505 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
05506 Py_INCREF(__pyx_v_self);
05507
05508
05509 __pyx_1 = PyInt_FromLong(rand_uint16(((struct __pyx_obj_4dnet_rand *)__pyx_v_self)->rand)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; goto __pyx_L1;}
05510 __pyx_r = __pyx_1;
05511 __pyx_1 = 0;
05512 goto __pyx_L0;
05513
05514 __pyx_r = Py_None; Py_INCREF(__pyx_r);
05515 goto __pyx_L0;
05516 __pyx_L1:;
05517 Py_XDECREF(__pyx_1);
05518 __Pyx_AddTraceback("dnet.rand.uint16");
05519 __pyx_r = 0;
05520 __pyx_L0:;
05521 Py_DECREF(__pyx_v_self);
05522 return __pyx_r;
05523 }
05524
05525 static PyObject *__pyx_f_4dnet_4rand_uint32(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
05526 static char __pyx_doc_4dnet_4rand_uint32[] = "Return a random 32-bit integer.";
05527 static PyObject *__pyx_f_4dnet_4rand_uint32(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
05528 PyObject *__pyx_r;
05529 PyObject *__pyx_1 = 0;
05530 static char *__pyx_argnames[] = {0};
05531 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
05532 Py_INCREF(__pyx_v_self);
05533
05534
05535 __pyx_1 = PyLong_FromUnsignedLong(rand_uint32(((struct __pyx_obj_4dnet_rand *)__pyx_v_self)->rand)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; goto __pyx_L1;}
05536 __pyx_r = __pyx_1;
05537 __pyx_1 = 0;
05538 goto __pyx_L0;
05539
05540 __pyx_r = Py_None; Py_INCREF(__pyx_r);
05541 goto __pyx_L0;
05542 __pyx_L1:;
05543 Py_XDECREF(__pyx_1);
05544 __Pyx_AddTraceback("dnet.rand.uint32");
05545 __pyx_r = 0;
05546 __pyx_L0:;
05547 Py_DECREF(__pyx_v_self);
05548 return __pyx_r;
05549 }
05550
05551 static PyObject *__pyx_f_4dnet_4rand_xrange(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
05552 static char __pyx_doc_4dnet_4rand_xrange[] = "xrange([start,] stop) -> xrange object\n\n Return a random permutation iterator to walk an unsigned integer range,\n like xrange().\n ";
05553 static PyObject *__pyx_f_4dnet_4rand_xrange(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
05554 PyObject *__pyx_v_start = 0;
05555 PyObject *__pyx_v_stop = 0;
05556 PyObject *__pyx_r;
05557 int __pyx_1;
05558 PyObject *__pyx_2 = 0;
05559 PyObject *__pyx_3 = 0;
05560 static char *__pyx_argnames[] = {"start","stop",0};
05561 __pyx_v_stop = __pyx_k58;
05562 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|O", __pyx_argnames, &__pyx_v_start, &__pyx_v_stop)) return 0;
05563 Py_INCREF(__pyx_v_self);
05564 Py_INCREF(__pyx_v_start);
05565 Py_INCREF(__pyx_v_stop);
05566
05567
05568 if (PyObject_Cmp(__pyx_v_stop, Py_None, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1377; goto __pyx_L1;}
05569 __pyx_1 = __pyx_1 == 0;
05570 if (__pyx_1) {
05571
05572
05573 __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; goto __pyx_L1;}
05574 __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; goto __pyx_L1;}
05575 Py_INCREF(__pyx_v_self);
05576 PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_self);
05577 PyTuple_SET_ITEM(__pyx_3, 1, __pyx_2);
05578 Py_INCREF(__pyx_v_start);
05579 PyTuple_SET_ITEM(__pyx_3, 2, __pyx_v_start);
05580 __pyx_2 = 0;
05581 __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_4dnet___rand_xrange), __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; goto __pyx_L1;}
05582 Py_DECREF(__pyx_3); __pyx_3 = 0;
05583 __pyx_r = __pyx_2;
05584 __pyx_2 = 0;
05585 goto __pyx_L0;
05586 goto __pyx_L2;
05587 }
05588 {
05589
05590
05591 __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1380; goto __pyx_L1;}
05592 Py_INCREF(__pyx_v_self);
05593 PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_self);
05594 Py_INCREF(__pyx_v_start);
05595 PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_start);
05596 Py_INCREF(__pyx_v_stop);
05597 PyTuple_SET_ITEM(__pyx_3, 2, __pyx_v_stop);
05598 __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_4dnet___rand_xrange), __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1380; goto __pyx_L1;}
05599 Py_DECREF(__pyx_3); __pyx_3 = 0;
05600 __pyx_r = __pyx_2;
05601 __pyx_2 = 0;
05602 goto __pyx_L0;
05603 }
05604 __pyx_L2:;
05605
05606 __pyx_r = Py_None; Py_INCREF(__pyx_r);
05607 goto __pyx_L0;
05608 __pyx_L1:;
05609 Py_XDECREF(__pyx_2);
05610 Py_XDECREF(__pyx_3);
05611 __Pyx_AddTraceback("dnet.rand.xrange");
05612 __pyx_r = 0;
05613 __pyx_L0:;
05614 Py_DECREF(__pyx_v_self);
05615 Py_DECREF(__pyx_v_start);
05616 Py_DECREF(__pyx_v_stop);
05617 return __pyx_r;
05618 }
05619
05620 static void __pyx_f_4dnet_4rand___dealloc__(PyObject *__pyx_v_self);
05621 static void __pyx_f_4dnet_4rand___dealloc__(PyObject *__pyx_v_self) {
05622 int __pyx_1;
05623 Py_INCREF(__pyx_v_self);
05624
05625
05626 __pyx_1 = (((struct __pyx_obj_4dnet_rand *)__pyx_v_self)->rand != 0);
05627 if (__pyx_1) {
05628
05629
05630 rand_close(((struct __pyx_obj_4dnet_rand *)__pyx_v_self)->rand);
05631 goto __pyx_L2;
05632 }
05633 __pyx_L2:;
05634
05635 goto __pyx_L0;
05636 __pyx_L1:;
05637 __Pyx_AddTraceback("dnet.rand.__dealloc__");
05638 __pyx_L0:;
05639 Py_DECREF(__pyx_v_self);
05640 }
05641
05642 static PyObject *__pyx_k119p;
05643 static PyObject *__pyx_k120p;
05644
05645 static char (__pyx_k119[]) = "start must be an integer";
05646 static char (__pyx_k120[]) = "stop must be an integer";
05647
05648 static int __pyx_f_4dnet_13__rand_xrange___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
05649 static int __pyx_f_4dnet_13__rand_xrange___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
05650 PyObject *__pyx_v_r = 0;
05651 PyObject *__pyx_v_start = 0;
05652 PyObject *__pyx_v_stop = 0;
05653 unsigned int __pyx_v_bits;
05654 int __pyx_r;
05655 int __pyx_1;
05656 PyObject *__pyx_2 = 0;
05657 static char *__pyx_argnames[] = {"r","start","stop",0};
05658 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOO", __pyx_argnames, &__pyx_v_r, &__pyx_v_start, &__pyx_v_stop)) return -1;
05659 Py_INCREF(__pyx_v_self);
05660 Py_INCREF(__pyx_v_r);
05661 Py_INCREF(__pyx_v_start);
05662 Py_INCREF(__pyx_v_stop);
05663
05664
05665 ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->rand = ((struct __pyx_obj_4dnet_rand *)__pyx_v_r)->rand;
05666
05667
05668 __pyx_1 = PyInt_Check(__pyx_v_start);
05669 if (__pyx_1) {
05670
05671
05672 ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->start = PyInt_AsLong(__pyx_v_start);
05673 goto __pyx_L2;
05674 }
05675 __pyx_1 = PyLong_Check(__pyx_v_start);
05676 if (__pyx_1) {
05677
05678
05679 ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->start = PyLong_AsUnsignedLong(__pyx_v_start);
05680 goto __pyx_L2;
05681 }
05682 {
05683
05684
05685 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_TypeError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1408; goto __pyx_L1;}
05686 __Pyx_Raise(__pyx_2, __pyx_k119p, 0);
05687 Py_DECREF(__pyx_2); __pyx_2 = 0;
05688 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1408; goto __pyx_L1;}
05689 }
05690 __pyx_L2:;
05691
05692
05693 __pyx_1 = PyInt_Check(__pyx_v_start);
05694 if (__pyx_1) {
05695
05696
05697 ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->max = (PyInt_AsLong(__pyx_v_stop) - ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->start);
05698 goto __pyx_L3;
05699 }
05700 __pyx_1 = PyLong_Check(__pyx_v_start);
05701 if (__pyx_1) {
05702
05703
05704 ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->max = (PyLong_AsUnsignedLong(__pyx_v_stop) - ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->start);
05705 goto __pyx_L3;
05706 }
05707 {
05708
05709
05710 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_TypeError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; goto __pyx_L1;}
05711 __Pyx_Raise(__pyx_2, __pyx_k120p, 0);
05712 Py_DECREF(__pyx_2); __pyx_2 = 0;
05713 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; goto __pyx_L1;}
05714 }
05715 __pyx_L3:;
05716
05717
05718 rand_get(((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->rand,((char (*))((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->sbox),(sizeof(((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->sbox)));
05719
05720
05721 __pyx_v_bits = 0;
05722
05723
05724 while (1) {
05725 __pyx_L4:;
05726 __pyx_1 = (((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->max > (1 << __pyx_v_bits));
05727 if (!__pyx_1) break;
05728
05729
05730 __pyx_v_bits = (__pyx_v_bits + 1);
05731 }
05732 __pyx_L5:;
05733
05734
05735 ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->left = (__pyx_v_bits / 2);
05736
05737
05738 ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->right = (__pyx_v_bits - ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->left);
05739
05740
05741 ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->mask = ((1 << __pyx_v_bits) - 1);
05742
05743
05744 __pyx_1 = (__pyx_e_4dnet_TEASBOXSIZE < (1 << ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->left));
05745 if (__pyx_1) {
05746
05747
05748 ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->sboxmask = (__pyx_e_4dnet_TEASBOXSIZE - 1);
05749
05750
05751 ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->kshift = __pyx_e_4dnet_TEASBOXSHIFT;
05752 goto __pyx_L6;
05753 }
05754 {
05755
05756
05757 ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->sboxmask = ((1 << ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->left) - 1);
05758
05759
05760 ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->kshift = ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->left;
05761 }
05762 __pyx_L6:;
05763
05764 __pyx_r = 0;
05765 goto __pyx_L0;
05766 __pyx_L1:;
05767 Py_XDECREF(__pyx_2);
05768 __Pyx_AddTraceback("dnet.__rand_xrange.__init__");
05769 __pyx_r = -1;
05770 __pyx_L0:;
05771 Py_DECREF(__pyx_v_self);
05772 Py_DECREF(__pyx_v_r);
05773 Py_DECREF(__pyx_v_start);
05774 Py_DECREF(__pyx_v_stop);
05775 return __pyx_r;
05776 }
05777
05778 static PyObject *__pyx_f_4dnet_13__rand_xrange___iter__(PyObject *__pyx_v_self);
05779 static PyObject *__pyx_f_4dnet_13__rand_xrange___iter__(PyObject *__pyx_v_self) {
05780 PyObject *__pyx_r;
05781 Py_INCREF(__pyx_v_self);
05782
05783
05784 ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->cur = 0;
05785 ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->enc = 0;
05786
05787
05788 Py_INCREF(__pyx_v_self);
05789 __pyx_r = __pyx_v_self;
05790 goto __pyx_L0;
05791
05792 __pyx_r = Py_None; Py_INCREF(__pyx_r);
05793 goto __pyx_L0;
05794 __pyx_L1:;
05795 __Pyx_AddTraceback("dnet.__rand_xrange.__iter__");
05796 __pyx_r = 0;
05797 __pyx_L0:;
05798 Py_DECREF(__pyx_v_self);
05799 return __pyx_r;
05800 }
05801
05802 static int __pyx_f_4dnet_13__rand_xrange___len__(PyObject *__pyx_v_self);
05803 static int __pyx_f_4dnet_13__rand_xrange___len__(PyObject *__pyx_v_self) {
05804 int __pyx_r;
05805 Py_INCREF(__pyx_v_self);
05806
05807
05808 __pyx_r = ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->max;
05809 goto __pyx_L0;
05810
05811 __pyx_r = 0;
05812 goto __pyx_L0;
05813 __pyx_L1:;
05814 __Pyx_AddTraceback("dnet.__rand_xrange.__len__");
05815 __pyx_r = -1;
05816 __pyx_L0:;
05817 Py_DECREF(__pyx_v_self);
05818 return __pyx_r;
05819 }
05820
05821 static PyObject *__pyx_f_4dnet_13__rand_xrange___next__(PyObject *__pyx_v_self);
05822 static PyObject *__pyx_f_4dnet_13__rand_xrange___next__(PyObject *__pyx_v_self) {
05823 unsigned long __pyx_v_c;
05824 unsigned long __pyx_v_sum;
05825 PyObject *__pyx_v_i;
05826 PyObject *__pyx_r;
05827 int __pyx_1;
05828 PyObject *__pyx_2 = 0;
05829 long __pyx_3;
05830 Py_INCREF(__pyx_v_self);
05831 __pyx_v_i = Py_None; Py_INCREF(__pyx_v_i);
05832
05833
05834 __pyx_1 = (((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->cur == ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->max);
05835 if (__pyx_1) {
05836
05837
05838 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_StopIteration); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1447; goto __pyx_L1;}
05839 __Pyx_Raise(__pyx_2, 0, 0);
05840 Py_DECREF(__pyx_2); __pyx_2 = 0;
05841 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1447; goto __pyx_L1;}
05842 goto __pyx_L2;
05843 }
05844 __pyx_L2:;
05845
05846
05847 ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->cur = (((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->cur + 1);
05848
05849
05850 while (1) {
05851 __pyx_L3:;
05852 __pyx_3 = 1;
05853 if (!__pyx_3) break;
05854
05855
05856 __pyx_v_c = ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->enc;
05857
05858
05859 ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->enc = (((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->enc + 1);
05860
05861
05862 __pyx_v_sum = 0;
05863
05864
05865 for (__pyx_3 = 0+1; __pyx_3 < __pyx_e_4dnet_TEAROUNDS; ++__pyx_3) {
05866 __pyx_2 = PyInt_FromLong(__pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1453; goto __pyx_L1;}
05867 Py_DECREF(__pyx_v_i);
05868 __pyx_v_i = __pyx_2;
05869 __pyx_2 = 0;
05870
05871
05872 __pyx_v_sum = (__pyx_v_sum + __pyx_e_4dnet_TEADELTA);
05873
05874
05875 __pyx_v_c = (__pyx_v_c ^ ((((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->sbox[((__pyx_v_c ^ __pyx_v_sum) & ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->sboxmask)]) << ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->kshift));
05876
05877
05878 __pyx_v_c = (__pyx_v_c + __pyx_v_sum);
05879
05880
05881 __pyx_v_c = (__pyx_v_c & ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->mask);
05882
05883
05884 __pyx_v_c = (((__pyx_v_c << ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->left) | (__pyx_v_c >> ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->right)) & ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->mask);
05885 __pyx_L5:;
05886 }
05887 __pyx_L6:;
05888
05889
05890 __pyx_1 = (__pyx_v_c < ((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->max);
05891 if (__pyx_1) {
05892
05893
05894 goto __pyx_L4;
05895 goto __pyx_L7;
05896 }
05897 __pyx_L7:;
05898 }
05899 __pyx_L4:;
05900
05901
05902 __pyx_2 = PyLong_FromUnsignedLong((((struct __pyx_obj_4dnet___rand_xrange *)__pyx_v_self)->start + __pyx_v_c)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; goto __pyx_L1;}
05903 __pyx_r = __pyx_2;
05904 __pyx_2 = 0;
05905 goto __pyx_L0;
05906
05907 __pyx_r = Py_None; Py_INCREF(__pyx_r);
05908 goto __pyx_L0;
05909 __pyx_L1:;
05910 Py_XDECREF(__pyx_2);
05911 __Pyx_AddTraceback("dnet.__rand_xrange.__next__");
05912 __pyx_r = 0;
05913 __pyx_L0:;
05914 Py_DECREF(__pyx_v_i);
05915 Py_DECREF(__pyx_v_self);
05916 return __pyx_r;
05917 }
05918
05919 static int __pyx_f_4dnet_3tun___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
05920 static int __pyx_f_4dnet_3tun___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
05921 struct __pyx_obj_4dnet_addr *__pyx_v_src = 0;
05922 struct __pyx_obj_4dnet_addr *__pyx_v_dst = 0;
05923 PyObject *__pyx_v_mtu = 0;
05924 int __pyx_r;
05925 int __pyx_1;
05926 PyObject *__pyx_2 = 0;
05927 PyObject *__pyx_3 = 0;
05928 static char *__pyx_argnames[] = {"src","dst","mtu",0};
05929 __pyx_v_mtu = __pyx_k59;
05930 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO|O", __pyx_argnames, &__pyx_v_src, &__pyx_v_dst, &__pyx_v_mtu)) return -1;
05931 Py_INCREF(__pyx_v_self);
05932 Py_INCREF(__pyx_v_src);
05933 Py_INCREF(__pyx_v_dst);
05934 Py_INCREF(__pyx_v_mtu);
05935 if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_src), __pyx_ptype_4dnet_addr, 1, "src")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1490; goto __pyx_L1;}
05936 if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dst), __pyx_ptype_4dnet_addr, 1, "dst")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1490; goto __pyx_L1;}
05937
05938
05939 __pyx_1 = PyInt_AsLong(__pyx_v_mtu); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1491; goto __pyx_L1;}
05940 ((struct __pyx_obj_4dnet_tun *)__pyx_v_self)->tun = tun_open((&__pyx_v_src->_addr),(&__pyx_v_dst->_addr),__pyx_1);
05941
05942
05943 __pyx_1 = PyInt_AsLong(__pyx_v_mtu); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1492; goto __pyx_L1;}
05944 ((struct __pyx_obj_4dnet_tun *)__pyx_v_self)->mtu = __pyx_1;
05945
05946
05947 __pyx_1 = (!(((struct __pyx_obj_4dnet_tun *)__pyx_v_self)->tun != 0));
05948 if (__pyx_1) {
05949
05950
05951 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1494; goto __pyx_L1;}
05952 __pyx_3 = __pyx_f_4dnet___oserror(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1494; goto __pyx_L1;}
05953 __Pyx_Raise(__pyx_2, __pyx_3, 0);
05954 Py_DECREF(__pyx_2); __pyx_2 = 0;
05955 Py_DECREF(__pyx_3); __pyx_3 = 0;
05956 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1494; goto __pyx_L1;}
05957 goto __pyx_L2;
05958 }
05959 __pyx_L2:;
05960
05961
05962 __pyx_1 = PyInt_AsLong(__pyx_v_mtu); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1495; goto __pyx_L1;}
05963 ((struct __pyx_obj_4dnet_tun *)__pyx_v_self)->buf = malloc(__pyx_1);
05964
05965 __pyx_r = 0;
05966 goto __pyx_L0;
05967 __pyx_L1:;
05968 Py_XDECREF(__pyx_2);
05969 Py_XDECREF(__pyx_3);
05970 __Pyx_AddTraceback("dnet.tun.__init__");
05971 __pyx_r = -1;
05972 __pyx_L0:;
05973 Py_DECREF(__pyx_v_self);
05974 Py_DECREF(__pyx_v_src);
05975 Py_DECREF(__pyx_v_dst);
05976 Py_DECREF(__pyx_v_mtu);
05977 return __pyx_r;
05978 }
05979
05980 static PyObject *__pyx_f_4dnet_3tun_4name___get__(PyObject *__pyx_v_self);
05981 static PyObject *__pyx_f_4dnet_3tun_4name___get__(PyObject *__pyx_v_self) {
05982 PyObject *__pyx_r;
05983 PyObject *__pyx_1 = 0;
05984 Py_INCREF(__pyx_v_self);
05985
05986
05987 __pyx_1 = PyString_FromString(tun_name(((struct __pyx_obj_4dnet_tun *)__pyx_v_self)->tun)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1500; goto __pyx_L1;}
05988 __pyx_r = __pyx_1;
05989 __pyx_1 = 0;
05990 goto __pyx_L0;
05991
05992 __pyx_r = Py_None; Py_INCREF(__pyx_r);
05993 goto __pyx_L0;
05994 __pyx_L1:;
05995 Py_XDECREF(__pyx_1);
05996 __Pyx_AddTraceback("dnet.tun.name.__get__");
05997 __pyx_r = 0;
05998 __pyx_L0:;
05999 Py_DECREF(__pyx_v_self);
06000 return __pyx_r;
06001 }
06002
06003 static PyObject *__pyx_f_4dnet_3tun_2fd___get__(PyObject *__pyx_v_self);
06004 static PyObject *__pyx_f_4dnet_3tun_2fd___get__(PyObject *__pyx_v_self) {
06005 PyObject *__pyx_r;
06006 PyObject *__pyx_1 = 0;
06007 Py_INCREF(__pyx_v_self);
06008
06009
06010 __pyx_1 = PyInt_FromLong(tun_fileno(((struct __pyx_obj_4dnet_tun *)__pyx_v_self)->tun)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1505; goto __pyx_L1;}
06011 __pyx_r = __pyx_1;
06012 __pyx_1 = 0;
06013 goto __pyx_L0;
06014
06015 __pyx_r = Py_None; Py_INCREF(__pyx_r);
06016 goto __pyx_L0;
06017 __pyx_L1:;
06018 Py_XDECREF(__pyx_1);
06019 __Pyx_AddTraceback("dnet.tun.fd.__get__");
06020 __pyx_r = 0;
06021 __pyx_L0:;
06022 Py_DECREF(__pyx_v_self);
06023 return __pyx_r;
06024 }
06025
06026 static PyObject *__pyx_f_4dnet_3tun_fileno(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
06027 static char __pyx_doc_4dnet_3tun_fileno[] = "Return file descriptor for tunnel handle.";
06028 static PyObject *__pyx_f_4dnet_3tun_fileno(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
06029 PyObject *__pyx_r;
06030 PyObject *__pyx_1 = 0;
06031 static char *__pyx_argnames[] = {0};
06032 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
06033 Py_INCREF(__pyx_v_self);
06034
06035
06036 __pyx_1 = PyInt_FromLong(tun_fileno(((struct __pyx_obj_4dnet_tun *)__pyx_v_self)->tun)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1509; goto __pyx_L1;}
06037 __pyx_r = __pyx_1;
06038 __pyx_1 = 0;
06039 goto __pyx_L0;
06040
06041 __pyx_r = Py_None; Py_INCREF(__pyx_r);
06042 goto __pyx_L0;
06043 __pyx_L1:;
06044 Py_XDECREF(__pyx_1);
06045 __Pyx_AddTraceback("dnet.tun.fileno");
06046 __pyx_r = 0;
06047 __pyx_L0:;
06048 Py_DECREF(__pyx_v_self);
06049 return __pyx_r;
06050 }
06051
06052 static PyObject *__pyx_f_4dnet_3tun_send(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
06053 static char __pyx_doc_4dnet_3tun_send[] = "Send an IP packet, returning the number of bytes sent\n or -1 on failure.\n\n Arguments:\n pkt -- binary string representing an IP packet\n ";
06054 static PyObject *__pyx_f_4dnet_3tun_send(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
06055 PyObject *__pyx_v_pkt = 0;
06056 PyObject *__pyx_r;
06057 char (*__pyx_1);
06058 PyObject *__pyx_2 = 0;
06059 static char *__pyx_argnames[] = {"pkt",0};
06060 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_pkt)) return 0;
06061 Py_INCREF(__pyx_v_self);
06062 Py_INCREF(__pyx_v_pkt);
06063
06064
06065 __pyx_1 = PyString_AsString(__pyx_v_pkt); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1518; goto __pyx_L1;}
06066 __pyx_2 = PyInt_FromLong(tun_send(((struct __pyx_obj_4dnet_tun *)__pyx_v_self)->tun,__pyx_1,PyString_Size(__pyx_v_pkt))); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1518; goto __pyx_L1;}
06067 __pyx_r = __pyx_2;
06068 __pyx_2 = 0;
06069 goto __pyx_L0;
06070
06071 __pyx_r = Py_None; Py_INCREF(__pyx_r);
06072 goto __pyx_L0;
06073 __pyx_L1:;
06074 Py_XDECREF(__pyx_2);
06075 __Pyx_AddTraceback("dnet.tun.send");
06076 __pyx_r = 0;
06077 __pyx_L0:;
06078 Py_DECREF(__pyx_v_self);
06079 Py_DECREF(__pyx_v_pkt);
06080 return __pyx_r;
06081 }
06082
06083 static PyObject *__pyx_f_4dnet_3tun_recv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
06084 static char __pyx_doc_4dnet_3tun_recv[] = "Return the next packet delivered to the tunnel interface.";
06085 static PyObject *__pyx_f_4dnet_3tun_recv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
06086 int __pyx_v_n;
06087 PyObject *__pyx_r;
06088 int __pyx_1;
06089 PyObject *__pyx_2 = 0;
06090 PyObject *__pyx_3 = 0;
06091 static char *__pyx_argnames[] = {0};
06092 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
06093 Py_INCREF(__pyx_v_self);
06094
06095
06096 __pyx_v_n = tun_recv(((struct __pyx_obj_4dnet_tun *)__pyx_v_self)->tun,((struct __pyx_obj_4dnet_tun *)__pyx_v_self)->buf,((struct __pyx_obj_4dnet_tun *)__pyx_v_self)->mtu);
06097
06098
06099 __pyx_1 = (__pyx_v_n < 0);
06100 if (__pyx_1) {
06101
06102
06103 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1525; goto __pyx_L1;}
06104 __pyx_3 = __pyx_f_4dnet___oserror(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1525; goto __pyx_L1;}
06105 __Pyx_Raise(__pyx_2, __pyx_3, 0);
06106 Py_DECREF(__pyx_2); __pyx_2 = 0;
06107 Py_DECREF(__pyx_3); __pyx_3 = 0;
06108 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1525; goto __pyx_L1;}
06109 goto __pyx_L2;
06110 }
06111 __pyx_L2:;
06112
06113
06114 __pyx_2 = PyString_FromStringAndSize(((struct __pyx_obj_4dnet_tun *)__pyx_v_self)->buf,__pyx_v_n); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1526; goto __pyx_L1;}
06115 __pyx_r = __pyx_2;
06116 __pyx_2 = 0;
06117 goto __pyx_L0;
06118
06119 __pyx_r = Py_None; Py_INCREF(__pyx_r);
06120 goto __pyx_L0;
06121 __pyx_L1:;
06122 Py_XDECREF(__pyx_2);
06123 Py_XDECREF(__pyx_3);
06124 __Pyx_AddTraceback("dnet.tun.recv");
06125 __pyx_r = 0;
06126 __pyx_L0:;
06127 Py_DECREF(__pyx_v_self);
06128 return __pyx_r;
06129 }
06130
06131 static PyObject *__pyx_f_4dnet_3tun_close(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
06132 static PyObject *__pyx_f_4dnet_3tun_close(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
06133 PyObject *__pyx_r;
06134 static char *__pyx_argnames[] = {0};
06135 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
06136 Py_INCREF(__pyx_v_self);
06137
06138
06139 ((struct __pyx_obj_4dnet_tun *)__pyx_v_self)->tun = tun_close(((struct __pyx_obj_4dnet_tun *)__pyx_v_self)->tun);
06140
06141 __pyx_r = Py_None; Py_INCREF(__pyx_r);
06142 goto __pyx_L0;
06143 __pyx_L1:;
06144 __Pyx_AddTraceback("dnet.tun.close");
06145 __pyx_r = 0;
06146 __pyx_L0:;
06147 Py_DECREF(__pyx_v_self);
06148 return __pyx_r;
06149 }
06150
06151 static void __pyx_f_4dnet_3tun___dealloc__(PyObject *__pyx_v_self);
06152 static void __pyx_f_4dnet_3tun___dealloc__(PyObject *__pyx_v_self) {
06153 int __pyx_1;
06154 Py_INCREF(__pyx_v_self);
06155
06156
06157 __pyx_1 = (((struct __pyx_obj_4dnet_tun *)__pyx_v_self)->buf != 0);
06158 if (__pyx_1) {
06159
06160
06161 free(((struct __pyx_obj_4dnet_tun *)__pyx_v_self)->buf);
06162 goto __pyx_L2;
06163 }
06164 __pyx_L2:;
06165
06166
06167 __pyx_1 = (((struct __pyx_obj_4dnet_tun *)__pyx_v_self)->tun != 0);
06168 if (__pyx_1) {
06169
06170
06171 tun_close(((struct __pyx_obj_4dnet_tun *)__pyx_v_self)->tun);
06172 goto __pyx_L3;
06173 }
06174 __pyx_L3:;
06175
06176 goto __pyx_L0;
06177 __pyx_L1:;
06178 __Pyx_AddTraceback("dnet.tun.__dealloc__");
06179 __pyx_L0:;
06180 Py_DECREF(__pyx_v_self);
06181 }
06182
06183 static __Pyx_InternTabEntry __pyx_intern_tab[] = {
06184 {&__pyx_n_ADDR_TYPE_ETH, "ADDR_TYPE_ETH"},
06185 {&__pyx_n_ADDR_TYPE_IP, "ADDR_TYPE_IP"},
06186 {&__pyx_n_ADDR_TYPE_IP6, "ADDR_TYPE_IP6"},
06187 {&__pyx_n_ADDR_TYPE_NONE, "ADDR_TYPE_NONE"},
06188 {&__pyx_n_ARP_ETHIP_LEN, "ARP_ETHIP_LEN"},
06189 {&__pyx_n_ARP_HDR_LEN, "ARP_HDR_LEN"},
06190 {&__pyx_n_ARP_HRD_ETH, "ARP_HRD_ETH"},
06191 {&__pyx_n_ARP_HRD_IEEE802, "ARP_HRD_IEEE802"},
06192 {&__pyx_n_ARP_OP_REPLY, "ARP_OP_REPLY"},
06193 {&__pyx_n_ARP_OP_REQUEST, "ARP_OP_REQUEST"},
06194 {&__pyx_n_ARP_OP_REVREPLY, "ARP_OP_REVREPLY"},
06195 {&__pyx_n_ARP_OP_REVREQUEST, "ARP_OP_REVREQUEST"},
06196 {&__pyx_n_ARP_PRO_IP, "ARP_PRO_IP"},
06197 {&__pyx_n_BSD, "BSD"},
06198 {&__pyx_n_ETH_ADDR_BITS, "ETH_ADDR_BITS"},
06199 {&__pyx_n_ETH_ADDR_BROADCAST, "ETH_ADDR_BROADCAST"},
06200 {&__pyx_n_ETH_ADDR_LEN, "ETH_ADDR_LEN"},
06201 {&__pyx_n_ETH_ADDR_UNSPEC, "ETH_ADDR_UNSPEC"},
06202 {&__pyx_n_ETH_CRC_LEN, "ETH_CRC_LEN"},
06203 {&__pyx_n_ETH_HDR_LEN, "ETH_HDR_LEN"},
06204 {&__pyx_n_ETH_LEN_MAX, "ETH_LEN_MAX"},
06205 {&__pyx_n_ETH_LEN_MIN, "ETH_LEN_MIN"},
06206 {&__pyx_n_ETH_MIN, "ETH_MIN"},
06207 {&__pyx_n_ETH_MTU, "ETH_MTU"},
06208 {&__pyx_n_ETH_TYPE_8021Q, "ETH_TYPE_8021Q"},
06209 {&__pyx_n_ETH_TYPE_ARP, "ETH_TYPE_ARP"},
06210 {&__pyx_n_ETH_TYPE_IP, "ETH_TYPE_IP"},
06211 {&__pyx_n_ETH_TYPE_IPV6, "ETH_TYPE_IPV6"},
06212 {&__pyx_n_ETH_TYPE_LEN, "ETH_TYPE_LEN"},
06213 {&__pyx_n_ETH_TYPE_LOOPBACK, "ETH_TYPE_LOOPBACK"},
06214 {&__pyx_n_ETH_TYPE_MPLS, "ETH_TYPE_MPLS"},
06215 {&__pyx_n_ETH_TYPE_MPLS_MCAST, "ETH_TYPE_MPLS_MCAST"},
06216 {&__pyx_n_ETH_TYPE_PPPOE, "ETH_TYPE_PPPOE"},
06217 {&__pyx_n_ETH_TYPE_PPPOEDISC, "ETH_TYPE_PPPOEDISC"},
06218 {&__pyx_n_ETH_TYPE_PUP, "ETH_TYPE_PUP"},
06219 {&__pyx_n_ETH_TYPE_REVARP, "ETH_TYPE_REVARP"},
06220 {&__pyx_n_FW_DIR_IN, "FW_DIR_IN"},
06221 {&__pyx_n_FW_DIR_OUT, "FW_DIR_OUT"},
06222 {&__pyx_n_FW_OP_ALLOW, "FW_OP_ALLOW"},
06223 {&__pyx_n_FW_OP_BLOCK, "FW_OP_BLOCK"},
06224 {&__pyx_n_INTF_FLAG_BROADCAST, "INTF_FLAG_BROADCAST"},
06225 {&__pyx_n_INTF_FLAG_LOOPBACK, "INTF_FLAG_LOOPBACK"},
06226 {&__pyx_n_INTF_FLAG_MULTICAST, "INTF_FLAG_MULTICAST"},
06227 {&__pyx_n_INTF_FLAG_NOARP, "INTF_FLAG_NOARP"},
06228 {&__pyx_n_INTF_FLAG_POINTOPOINT, "INTF_FLAG_POINTOPOINT"},
06229 {&__pyx_n_INTF_FLAG_UP, "INTF_FLAG_UP"},
06230 {&__pyx_n_INTF_TYPE_ETH, "INTF_TYPE_ETH"},
06231 {&__pyx_n_INTF_TYPE_LOOPBACK, "INTF_TYPE_LOOPBACK"},
06232 {&__pyx_n_INTF_TYPE_OTHER, "INTF_TYPE_OTHER"},
06233 {&__pyx_n_INTF_TYPE_TUN, "INTF_TYPE_TUN"},
06234 {&__pyx_n_IP6_ADDR_BITS, "IP6_ADDR_BITS"},
06235 {&__pyx_n_IP6_ADDR_LEN, "IP6_ADDR_LEN"},
06236 {&__pyx_n_IP6_ADDR_LOOPBACK, "IP6_ADDR_LOOPBACK"},
06237 {&__pyx_n_IP6_ADDR_UNSPEC, "IP6_ADDR_UNSPEC"},
06238 {&__pyx_n_IP6_HDR_LEN, "IP6_HDR_LEN"},
06239 {&__pyx_n_IP6_HLIM_DEFAULT, "IP6_HLIM_DEFAULT"},
06240 {&__pyx_n_IP6_HLIM_MAX, "IP6_HLIM_MAX"},
06241 {&__pyx_n_IP6_LEN_MAX, "IP6_LEN_MAX"},
06242 {&__pyx_n_IP6_LEN_MIN, "IP6_LEN_MIN"},
06243 {&__pyx_n_IP6_MTU_MIN, "IP6_MTU_MIN"},
06244 {&__pyx_n_IP_ADDR_ANY, "IP_ADDR_ANY"},
06245 {&__pyx_n_IP_ADDR_BITS, "IP_ADDR_BITS"},
06246 {&__pyx_n_IP_ADDR_BROADCAST, "IP_ADDR_BROADCAST"},
06247 {&__pyx_n_IP_ADDR_LEN, "IP_ADDR_LEN"},
06248 {&__pyx_n_IP_ADDR_LOOPBACK, "IP_ADDR_LOOPBACK"},
06249 {&__pyx_n_IP_ADDR_MCAST_ALL, "IP_ADDR_MCAST_ALL"},
06250 {&__pyx_n_IP_ADDR_MCAST_LOCAL, "IP_ADDR_MCAST_LOCAL"},
06251 {&__pyx_n_IP_DF, "IP_DF"},
06252 {&__pyx_n_IP_HDR_LEN, "IP_HDR_LEN"},
06253 {&__pyx_n_IP_HDR_LEN_MAX, "IP_HDR_LEN_MAX"},
06254 {&__pyx_n_IP_LEN_MAX, "IP_LEN_MAX"},
06255 {&__pyx_n_IP_LEN_MIN, "IP_LEN_MIN"},
06256 {&__pyx_n_IP_MF, "IP_MF"},
06257 {&__pyx_n_IP_OFFMASK, "IP_OFFMASK"},
06258 {&__pyx_n_IP_OPT_LEN, "IP_OPT_LEN"},
06259 {&__pyx_n_IP_OPT_LEN_MAX, "IP_OPT_LEN_MAX"},
06260 {&__pyx_n_IP_PROTO_AH, "IP_PROTO_AH"},
06261 {&__pyx_n_IP_PROTO_ESP, "IP_PROTO_ESP"},
06262 {&__pyx_n_IP_PROTO_GRE, "IP_PROTO_GRE"},
06263 {&__pyx_n_IP_PROTO_ICMP, "IP_PROTO_ICMP"},
06264 {&__pyx_n_IP_PROTO_ICMPV6, "IP_PROTO_ICMPV6"},
06265 {&__pyx_n_IP_PROTO_IGMP, "IP_PROTO_IGMP"},
06266 {&__pyx_n_IP_PROTO_IP, "IP_PROTO_IP"},
06267 {&__pyx_n_IP_PROTO_IPV6, "IP_PROTO_IPV6"},
06268 {&__pyx_n_IP_PROTO_MAX, "IP_PROTO_MAX"},
06269 {&__pyx_n_IP_PROTO_RAW, "IP_PROTO_RAW"},
06270 {&__pyx_n_IP_PROTO_RESERVED, "IP_PROTO_RESERVED"},
06271 {&__pyx_n_IP_PROTO_TCP, "IP_PROTO_TCP"},
06272 {&__pyx_n_IP_PROTO_UDP, "IP_PROTO_UDP"},
06273 {&__pyx_n_IP_RF, "IP_RF"},
06274 {&__pyx_n_IP_TOS_DEFAULT, "IP_TOS_DEFAULT"},
06275 {&__pyx_n_IP_TTL_DEFAULT, "IP_TTL_DEFAULT"},
06276 {&__pyx_n_IP_TTL_MAX, "IP_TTL_MAX"},
06277 {&__pyx_n_NotImplementedError, "NotImplementedError"},
06278 {&__pyx_n_OSError, "OSError"},
06279 {&__pyx_n_OverflowError, "OverflowError"},
06280 {&__pyx_n_StopIteration, "StopIteration"},
06281 {&__pyx_n_TCP_HDR_LEN, "TCP_HDR_LEN"},
06282 {&__pyx_n_TCP_OPT_ALTSUM, "TCP_OPT_ALTSUM"},
06283 {&__pyx_n_TCP_OPT_ALTSUMDATA, "TCP_OPT_ALTSUMDATA"},
06284 {&__pyx_n_TCP_OPT_BUBBA, "TCP_OPT_BUBBA"},
06285 {&__pyx_n_TCP_OPT_CC, "TCP_OPT_CC"},
06286 {&__pyx_n_TCP_OPT_CCECHO, "TCP_OPT_CCECHO"},
06287 {&__pyx_n_TCP_OPT_CCNEW, "TCP_OPT_CCNEW"},
06288 {&__pyx_n_TCP_OPT_CORRUPT, "TCP_OPT_CORRUPT"},
06289 {&__pyx_n_TCP_OPT_ECHO, "TCP_OPT_ECHO"},
06290 {&__pyx_n_TCP_OPT_ECHOREPLY, "TCP_OPT_ECHOREPLY"},
06291 {&__pyx_n_TCP_OPT_EOL, "TCP_OPT_EOL"},
06292 {&__pyx_n_TCP_OPT_MAX, "TCP_OPT_MAX"},
06293 {&__pyx_n_TCP_OPT_MD5, "TCP_OPT_MD5"},
06294 {&__pyx_n_TCP_OPT_MSS, "TCP_OPT_MSS"},
06295 {&__pyx_n_TCP_OPT_NOP, "TCP_OPT_NOP"},
06296 {&__pyx_n_TCP_OPT_POCONN, "TCP_OPT_POCONN"},
06297 {&__pyx_n_TCP_OPT_POSVC, "TCP_OPT_POSVC"},
06298 {&__pyx_n_TCP_OPT_REC, "TCP_OPT_REC"},
06299 {&__pyx_n_TCP_OPT_SACK, "TCP_OPT_SACK"},
06300 {&__pyx_n_TCP_OPT_SACKOK, "TCP_OPT_SACKOK"},
06301 {&__pyx_n_TCP_OPT_SCPS, "TCP_OPT_SCPS"},
06302 {&__pyx_n_TCP_OPT_SKEETER, "TCP_OPT_SKEETER"},
06303 {&__pyx_n_TCP_OPT_SNACK, "TCP_OPT_SNACK"},
06304 {&__pyx_n_TCP_OPT_SNAP, "TCP_OPT_SNAP"},
06305 {&__pyx_n_TCP_OPT_TCPCOMP, "TCP_OPT_TCPCOMP"},
06306 {&__pyx_n_TCP_OPT_TIMESTAMP, "TCP_OPT_TIMESTAMP"},
06307 {&__pyx_n_TCP_OPT_TRAILSUM, "TCP_OPT_TRAILSUM"},
06308 {&__pyx_n_TCP_OPT_WSCALE, "TCP_OPT_WSCALE"},
06309 {&__pyx_n_TCP_PORT_MAX, "TCP_PORT_MAX"},
06310 {&__pyx_n_TCP_WIN_MAX, "TCP_WIN_MAX"},
06311 {&__pyx_n_TH_ACK, "TH_ACK"},
06312 {&__pyx_n_TH_CWR, "TH_CWR"},
06313 {&__pyx_n_TH_ECE, "TH_ECE"},
06314 {&__pyx_n_TH_FIN, "TH_FIN"},
06315 {&__pyx_n_TH_PUSH, "TH_PUSH"},
06316 {&__pyx_n_TH_RST, "TH_RST"},
06317 {&__pyx_n_TH_SYN, "TH_SYN"},
06318 {&__pyx_n_TH_URG, "TH_URG"},
06319 {&__pyx_n_TypeError, "TypeError"},
06320 {&__pyx_n_UDP_HDR_LEN, "UDP_HDR_LEN"},
06321 {&__pyx_n_UDP_PORT_MAX, "UDP_PORT_MAX"},
06322 {&__pyx_n_ValueError, "ValueError"},
06323 {&__pyx_n___author__, "__author__"},
06324 {&__pyx_n___copy__, "__copy__"},
06325 {&__pyx_n___copyright__, "__copyright__"},
06326 {&__pyx_n___int__, "__int__"},
06327 {&__pyx_n___iter_append, "__iter_append"},
06328 {&__pyx_n___license__, "__license__"},
06329 {&__pyx_n___url__, "__url__"},
06330 {&__pyx_n___version__, "__version__"},
06331 {&__pyx_n_addr, "addr"},
06332 {&__pyx_n_alias_addrs, "alias_addrs"},
06333 {&__pyx_n_append, "append"},
06334 {&__pyx_n_arp_pack_hdr_ethip, "arp_pack_hdr_ethip"},
06335 {&__pyx_n_device, "device"},
06336 {&__pyx_n_dir, "dir"},
06337 {&__pyx_n_dport, "dport"},
06338 {&__pyx_n_dst, "dst"},
06339 {&__pyx_n_dst_addr, "dst_addr"},
06340 {&__pyx_n_eth, "eth"},
06341 {&__pyx_n_eth_aton, "eth_aton"},
06342 {&__pyx_n_eth_ntoa, "eth_ntoa"},
06343 {&__pyx_n_eth_pack_hdr, "eth_pack_hdr"},
06344 {&__pyx_n_flags, "flags"},
06345 {&__pyx_n_icmp_pack_hdr, "icmp_pack_hdr"},
06346 {&__pyx_n_ip, "ip"},
06347 {&__pyx_n_ip6, "ip6"},
06348 {&__pyx_n_ip6_aton, "ip6_aton"},
06349 {&__pyx_n_ip6_checksum, "ip6_checksum"},
06350 {&__pyx_n_ip6_ntoa, "ip6_ntoa"},
06351 {&__pyx_n_ip6_pack_hdr, "ip6_pack_hdr"},
06352 {&__pyx_n_ip_aton, "ip_aton"},
06353 {&__pyx_n_ip_checksum, "ip_checksum"},
06354 {&__pyx_n_ip_cksum_add, "ip_cksum_add"},
06355 {&__pyx_n_ip_cksum_carry, "ip_cksum_carry"},
06356 {&__pyx_n_ip_ntoa, "ip_ntoa"},
06357 {&__pyx_n_ip_pack_hdr, "ip_pack_hdr"},
06358 {&__pyx_n_iter, "iter"},
06359 {&__pyx_n_len, "len"},
06360 {&__pyx_n_link_addr, "link_addr"},
06361 {&__pyx_n_loop, "loop"},
06362 {&__pyx_n_mtu, "mtu"},
06363 {&__pyx_n_name, "name"},
06364 {&__pyx_n_op, "op"},
06365 {&__pyx_n_proto, "proto"},
06366 {&__pyx_n_sport, "sport"},
06367 {&__pyx_n_src, "src"},
06368 {&__pyx_n_tcp_pack_hdr, "tcp_pack_hdr"},
06369 {&__pyx_n_type, "type"},
06370 {&__pyx_n_udp_pack_hdr, "udp_pack_hdr"},
06371 {0, 0}
06372 };
06373
06374 static __Pyx_StringTabEntry __pyx_string_tab[] = {
06375 {&__pyx_k9p, __pyx_k9, sizeof(__pyx_k9)},
06376 {&__pyx_k10p, __pyx_k10, sizeof(__pyx_k10)},
06377 {&__pyx_k12p, __pyx_k12, sizeof(__pyx_k12)},
06378 {&__pyx_k13p, __pyx_k13, sizeof(__pyx_k13)},
06379 {&__pyx_k60p, __pyx_k60, sizeof(__pyx_k60)},
06380 {&__pyx_k61p, __pyx_k61, sizeof(__pyx_k61)},
06381 {&__pyx_k62p, __pyx_k62, sizeof(__pyx_k62)},
06382 {&__pyx_k63p, __pyx_k63, sizeof(__pyx_k63)},
06383 {&__pyx_k64p, __pyx_k64, sizeof(__pyx_k64)},
06384 {&__pyx_k65p, __pyx_k65, sizeof(__pyx_k65)},
06385 {&__pyx_k66p, __pyx_k66, sizeof(__pyx_k66)},
06386 {&__pyx_k67p, __pyx_k67, sizeof(__pyx_k67)},
06387 {&__pyx_k68p, __pyx_k68, sizeof(__pyx_k68)},
06388 {&__pyx_k69p, __pyx_k69, sizeof(__pyx_k69)},
06389 {&__pyx_k70p, __pyx_k70, sizeof(__pyx_k70)},
06390 {&__pyx_k71p, __pyx_k71, sizeof(__pyx_k71)},
06391 {&__pyx_k73p, __pyx_k73, sizeof(__pyx_k73)},
06392 {&__pyx_k119p, __pyx_k119, sizeof(__pyx_k119)},
06393 {&__pyx_k120p, __pyx_k120, sizeof(__pyx_k120)},
06394 {0, 0, 0}
06395 };
06396
06397 static PyObject *__pyx_tp_new_4dnet_eth(PyTypeObject *t, PyObject *a, PyObject *k) {
06398 PyObject *o = (*t->tp_alloc)(t, 0);
06399 struct __pyx_obj_4dnet_eth *p = (struct __pyx_obj_4dnet_eth *)o;
06400 return o;
06401 }
06402
06403 static void __pyx_tp_dealloc_4dnet_eth(PyObject *o) {
06404 struct __pyx_obj_4dnet_eth *p = (struct __pyx_obj_4dnet_eth *)o;
06405 {
06406 PyObject *etype, *eval, *etb;
06407 PyErr_Fetch(&etype, &eval, &etb);
06408 ++o->ob_refcnt;
06409 __pyx_f_4dnet_3eth___dealloc__(o);
06410 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
06411 --o->ob_refcnt;
06412 PyErr_Restore(etype, eval, etb);
06413 }
06414 (*o->ob_type->tp_free)(o);
06415 }
06416
06417 static int __pyx_tp_traverse_4dnet_eth(PyObject *o, visitproc v, void *a) {
06418 int e;
06419 struct __pyx_obj_4dnet_eth *p = (struct __pyx_obj_4dnet_eth *)o;
06420 return 0;
06421 }
06422
06423 static int __pyx_tp_clear_4dnet_eth(PyObject *o) {
06424 struct __pyx_obj_4dnet_eth *p = (struct __pyx_obj_4dnet_eth *)o;
06425 return 0;
06426 }
06427
06428 static struct PyMethodDef __pyx_methods_4dnet_eth[] = {
06429 {"get", (PyCFunction)__pyx_f_4dnet_3eth_get, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_3eth_get},
06430 {"set", (PyCFunction)__pyx_f_4dnet_3eth_set, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_3eth_set},
06431 {"send", (PyCFunction)__pyx_f_4dnet_3eth_send, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_3eth_send},
06432 {0, 0, 0, 0}
06433 };
06434
06435 static PyNumberMethods __pyx_tp_as_number_eth = {
06436 0,
06437 0,
06438 0,
06439 0,
06440 0,
06441 0,
06442 0,
06443 0,
06444 0,
06445 0,
06446 0,
06447 0,
06448 0,
06449 0,
06450 0,
06451 0,
06452 0,
06453 0,
06454 0,
06455 0,
06456 0,
06457 0,
06458 0,
06459 0,
06460 0,
06461 0,
06462 0,
06463 0,
06464 0,
06465 0,
06466 0,
06467 0,
06468 0,
06469 0,
06470 0,
06471 0,
06472 0,
06473 0,
06474 };
06475
06476 static PySequenceMethods __pyx_tp_as_sequence_eth = {
06477 0,
06478 0,
06479 0,
06480 0,
06481 0,
06482 0,
06483 0,
06484 0,
06485 0,
06486 0,
06487 };
06488
06489 static PyMappingMethods __pyx_tp_as_mapping_eth = {
06490 0,
06491 0,
06492 0,
06493 };
06494
06495 static PyBufferProcs __pyx_tp_as_buffer_eth = {
06496 0,
06497 0,
06498 0,
06499 0,
06500 };
06501
06502 statichere PyTypeObject __pyx_type_4dnet_eth = {
06503 PyObject_HEAD_INIT(0)
06504 0,
06505 "dnet.eth",
06506 sizeof(struct __pyx_obj_4dnet_eth),
06507 0,
06508 __pyx_tp_dealloc_4dnet_eth,
06509 0,
06510 0,
06511 0,
06512 0,
06513 0,
06514 &__pyx_tp_as_number_eth,
06515 &__pyx_tp_as_sequence_eth,
06516 &__pyx_tp_as_mapping_eth,
06517 0,
06518 0,
06519 0,
06520 0,
06521 0,
06522 &__pyx_tp_as_buffer_eth,
06523 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE,
06524 "eth(device) -> Ethernet device object\n\n Open the specified Ethernet device for sending.\n ",
06525 __pyx_tp_traverse_4dnet_eth,
06526 __pyx_tp_clear_4dnet_eth,
06527 0,
06528 0,
06529 0,
06530 0,
06531 __pyx_methods_4dnet_eth,
06532 0,
06533 0,
06534 0,
06535 0,
06536 0,
06537 0,
06538 0,
06539 __pyx_f_4dnet_3eth___init__,
06540 0,
06541 __pyx_tp_new_4dnet_eth,
06542 0,
06543 0,
06544 0,
06545 0,
06546 0,
06547 0,
06548 0,
06549 };
06550
06551 static PyObject *__pyx_tp_new_4dnet_ip(PyTypeObject *t, PyObject *a, PyObject *k) {
06552 PyObject *o = (*t->tp_alloc)(t, 0);
06553 struct __pyx_obj_4dnet_ip *p = (struct __pyx_obj_4dnet_ip *)o;
06554 return o;
06555 }
06556
06557 static void __pyx_tp_dealloc_4dnet_ip(PyObject *o) {
06558 struct __pyx_obj_4dnet_ip *p = (struct __pyx_obj_4dnet_ip *)o;
06559 {
06560 PyObject *etype, *eval, *etb;
06561 PyErr_Fetch(&etype, &eval, &etb);
06562 ++o->ob_refcnt;
06563 __pyx_f_4dnet_2ip___dealloc__(o);
06564 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
06565 --o->ob_refcnt;
06566 PyErr_Restore(etype, eval, etb);
06567 }
06568 (*o->ob_type->tp_free)(o);
06569 }
06570
06571 static int __pyx_tp_traverse_4dnet_ip(PyObject *o, visitproc v, void *a) {
06572 int e;
06573 struct __pyx_obj_4dnet_ip *p = (struct __pyx_obj_4dnet_ip *)o;
06574 return 0;
06575 }
06576
06577 static int __pyx_tp_clear_4dnet_ip(PyObject *o) {
06578 struct __pyx_obj_4dnet_ip *p = (struct __pyx_obj_4dnet_ip *)o;
06579 return 0;
06580 }
06581
06582 static struct PyMethodDef __pyx_methods_4dnet_ip[] = {
06583 {"send", (PyCFunction)__pyx_f_4dnet_2ip_send, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_2ip_send},
06584 {0, 0, 0, 0}
06585 };
06586
06587 static PyNumberMethods __pyx_tp_as_number_ip = {
06588 0,
06589 0,
06590 0,
06591 0,
06592 0,
06593 0,
06594 0,
06595 0,
06596 0,
06597 0,
06598 0,
06599 0,
06600 0,
06601 0,
06602 0,
06603 0,
06604 0,
06605 0,
06606 0,
06607 0,
06608 0,
06609 0,
06610 0,
06611 0,
06612 0,
06613 0,
06614 0,
06615 0,
06616 0,
06617 0,
06618 0,
06619 0,
06620 0,
06621 0,
06622 0,
06623 0,
06624 0,
06625 0,
06626 };
06627
06628 static PySequenceMethods __pyx_tp_as_sequence_ip = {
06629 0,
06630 0,
06631 0,
06632 0,
06633 0,
06634 0,
06635 0,
06636 0,
06637 0,
06638 0,
06639 };
06640
06641 static PyMappingMethods __pyx_tp_as_mapping_ip = {
06642 0,
06643 0,
06644 0,
06645 };
06646
06647 static PyBufferProcs __pyx_tp_as_buffer_ip = {
06648 0,
06649 0,
06650 0,
06651 0,
06652 };
06653
06654 statichere PyTypeObject __pyx_type_4dnet_ip = {
06655 PyObject_HEAD_INIT(0)
06656 0,
06657 "dnet.ip",
06658 sizeof(struct __pyx_obj_4dnet_ip),
06659 0,
06660 __pyx_tp_dealloc_4dnet_ip,
06661 0,
06662 0,
06663 0,
06664 0,
06665 0,
06666 &__pyx_tp_as_number_ip,
06667 &__pyx_tp_as_sequence_ip,
06668 &__pyx_tp_as_mapping_ip,
06669 0,
06670 0,
06671 0,
06672 0,
06673 0,
06674 &__pyx_tp_as_buffer_ip,
06675 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE,
06676 "ip() -> Raw IP object\n\n Open a raw IP socket for sending.\n ",
06677 __pyx_tp_traverse_4dnet_ip,
06678 __pyx_tp_clear_4dnet_ip,
06679 0,
06680 0,
06681 0,
06682 0,
06683 __pyx_methods_4dnet_ip,
06684 0,
06685 0,
06686 0,
06687 0,
06688 0,
06689 0,
06690 0,
06691 __pyx_f_4dnet_2ip___init__,
06692 0,
06693 __pyx_tp_new_4dnet_ip,
06694 0,
06695 0,
06696 0,
06697 0,
06698 0,
06699 0,
06700 0,
06701 };
06702
06703 static PyObject *__pyx_tp_new_4dnet_addr(PyTypeObject *t, PyObject *a, PyObject *k) {
06704 PyObject *o = (*t->tp_alloc)(t, 0);
06705 struct __pyx_obj_4dnet_addr *p = (struct __pyx_obj_4dnet_addr *)o;
06706 return o;
06707 }
06708
06709 static void __pyx_tp_dealloc_4dnet_addr(PyObject *o) {
06710 struct __pyx_obj_4dnet_addr *p = (struct __pyx_obj_4dnet_addr *)o;
06711 (*o->ob_type->tp_free)(o);
06712 }
06713
06714 static int __pyx_tp_traverse_4dnet_addr(PyObject *o, visitproc v, void *a) {
06715 int e;
06716 struct __pyx_obj_4dnet_addr *p = (struct __pyx_obj_4dnet_addr *)o;
06717 return 0;
06718 }
06719
06720 static int __pyx_tp_clear_4dnet_addr(PyObject *o) {
06721 struct __pyx_obj_4dnet_addr *p = (struct __pyx_obj_4dnet_addr *)o;
06722 return 0;
06723 }
06724
06725 static PyObject *__pyx_getprop_4dnet_4addr_type(PyObject *o, void *x) {
06726 return __pyx_f_4dnet_4addr_4type___get__(o);
06727 }
06728
06729 static int __pyx_setprop_4dnet_4addr_type(PyObject *o, PyObject *v, void *x) {
06730 if (v) {
06731 return __pyx_f_4dnet_4addr_4type___set__(o, v);
06732 }
06733 else {
06734 PyErr_SetString(PyExc_NotImplementedError, "__del__");
06735 return -1;
06736 }
06737 }
06738
06739 static PyObject *__pyx_getprop_4dnet_4addr_bits(PyObject *o, void *x) {
06740 return __pyx_f_4dnet_4addr_4bits___get__(o);
06741 }
06742
06743 static int __pyx_setprop_4dnet_4addr_bits(PyObject *o, PyObject *v, void *x) {
06744 if (v) {
06745 return __pyx_f_4dnet_4addr_4bits___set__(o, v);
06746 }
06747 else {
06748 PyErr_SetString(PyExc_NotImplementedError, "__del__");
06749 return -1;
06750 }
06751 }
06752
06753 static PyObject *__pyx_getprop_4dnet_4addr_data(PyObject *o, void *x) {
06754 return __pyx_f_4dnet_4addr_4data___get__(o);
06755 }
06756
06757 static PyObject *__pyx_getprop_4dnet_4addr_eth(PyObject *o, void *x) {
06758 return __pyx_f_4dnet_4addr_3eth___get__(o);
06759 }
06760
06761 static int __pyx_setprop_4dnet_4addr_eth(PyObject *o, PyObject *v, void *x) {
06762 if (v) {
06763 return __pyx_f_4dnet_4addr_3eth___set__(o, v);
06764 }
06765 else {
06766 PyErr_SetString(PyExc_NotImplementedError, "__del__");
06767 return -1;
06768 }
06769 }
06770
06771 static PyObject *__pyx_getprop_4dnet_4addr_ip(PyObject *o, void *x) {
06772 return __pyx_f_4dnet_4addr_2ip___get__(o);
06773 }
06774
06775 static int __pyx_setprop_4dnet_4addr_ip(PyObject *o, PyObject *v, void *x) {
06776 if (v) {
06777 return __pyx_f_4dnet_4addr_2ip___set__(o, v);
06778 }
06779 else {
06780 PyErr_SetString(PyExc_NotImplementedError, "__del__");
06781 return -1;
06782 }
06783 }
06784
06785 static PyObject *__pyx_getprop_4dnet_4addr_ip6(PyObject *o, void *x) {
06786 return __pyx_f_4dnet_4addr_3ip6___get__(o);
06787 }
06788
06789 static int __pyx_setprop_4dnet_4addr_ip6(PyObject *o, PyObject *v, void *x) {
06790 if (v) {
06791 return __pyx_f_4dnet_4addr_3ip6___set__(o, v);
06792 }
06793 else {
06794 PyErr_SetString(PyExc_NotImplementedError, "__del__");
06795 return -1;
06796 }
06797 }
06798
06799 static struct PyMethodDef __pyx_methods_4dnet_addr[] = {
06800 {"bcast", (PyCFunction)__pyx_f_4dnet_4addr_bcast, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_4addr_bcast},
06801 {"net", (PyCFunction)__pyx_f_4dnet_4addr_net, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_4addr_net},
06802 {"__copy__", (PyCFunction)__pyx_f_4dnet_4addr___copy__, METH_VARARGS|METH_KEYWORDS, 0},
06803 {0, 0, 0, 0}
06804 };
06805
06806 static struct PyGetSetDef __pyx_getsets_4dnet_addr[] = {
06807 {"type", __pyx_getprop_4dnet_4addr_type, __pyx_setprop_4dnet_4addr_type, __pyx_k1, 0},
06808 {"bits", __pyx_getprop_4dnet_4addr_bits, __pyx_setprop_4dnet_4addr_bits, __pyx_k2, 0},
06809 {"data", __pyx_getprop_4dnet_4addr_data, 0, __pyx_k3, 0},
06810 {"eth", __pyx_getprop_4dnet_4addr_eth, __pyx_setprop_4dnet_4addr_eth, __pyx_k4, 0},
06811 {"ip", __pyx_getprop_4dnet_4addr_ip, __pyx_setprop_4dnet_4addr_ip, __pyx_k5, 0},
06812 {"ip6", __pyx_getprop_4dnet_4addr_ip6, __pyx_setprop_4dnet_4addr_ip6, __pyx_k6, 0},
06813 {0, 0, 0, 0, 0}
06814 };
06815
06816 static PyNumberMethods __pyx_tp_as_number_addr = {
06817 __pyx_f_4dnet_4addr___add__,
06818 0,
06819 0,
06820 0,
06821 0,
06822 0,
06823 0,
06824 0,
06825 0,
06826 0,
06827 0,
06828 0,
06829 0,
06830 0,
06831 0,
06832 0,
06833 0,
06834 0,
06835 __pyx_f_4dnet_4addr___int__,
06836 __pyx_f_4dnet_4addr___long__,
06837 0,
06838 0,
06839 0,
06840 0,
06841 0,
06842 0,
06843 0,
06844 0,
06845 0,
06846 0,
06847 0,
06848 0,
06849 0,
06850 0,
06851 0,
06852 0,
06853 0,
06854 0,
06855 };
06856
06857 static PySequenceMethods __pyx_tp_as_sequence_addr = {
06858 0,
06859 0,
06860 0,
06861 0,
06862 0,
06863 0,
06864 0,
06865 __pyx_f_4dnet_4addr___contains__,
06866 0,
06867 0,
06868 };
06869
06870 static PyMappingMethods __pyx_tp_as_mapping_addr = {
06871 0,
06872 0,
06873 0,
06874 };
06875
06876 static PyBufferProcs __pyx_tp_as_buffer_addr = {
06877 0,
06878 0,
06879 0,
06880 0,
06881 };
06882
06883 statichere PyTypeObject __pyx_type_4dnet_addr = {
06884 PyObject_HEAD_INIT(0)
06885 0,
06886 "dnet.addr",
06887 sizeof(struct __pyx_obj_4dnet_addr),
06888 0,
06889 __pyx_tp_dealloc_4dnet_addr,
06890 0,
06891 0,
06892 0,
06893 __pyx_f_4dnet_4addr___cmp__,
06894 __pyx_f_4dnet_4addr___repr__,
06895 &__pyx_tp_as_number_addr,
06896 &__pyx_tp_as_sequence_addr,
06897 &__pyx_tp_as_mapping_addr,
06898 __pyx_f_4dnet_4addr___hash__,
06899 0,
06900 0,
06901 0,
06902 0,
06903 &__pyx_tp_as_buffer_addr,
06904 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE,
06905 "addr(addrtxt=None, type=ADDR_TYPE_NONE) -> network address object\n\n Create a network address object, optionally initialized from a\n human-readable Ethernet, IP, or IPv6 address string.\n ",
06906 __pyx_tp_traverse_4dnet_addr,
06907 __pyx_tp_clear_4dnet_addr,
06908 0,
06909 0,
06910 __pyx_f_4dnet_4addr___iter__,
06911 0,
06912 __pyx_methods_4dnet_addr,
06913 0,
06914 __pyx_getsets_4dnet_addr,
06915 0,
06916 0,
06917 0,
06918 0,
06919 0,
06920 __pyx_f_4dnet_4addr___init__,
06921 0,
06922 __pyx_tp_new_4dnet_addr,
06923 0,
06924 0,
06925 0,
06926 0,
06927 0,
06928 0,
06929 0,
06930 };
06931
06932 static PyObject *__pyx_tp_new_4dnet___addr_ip4_iter(PyTypeObject *t, PyObject *a, PyObject *k) {
06933 PyObject *o = (*t->tp_alloc)(t, 0);
06934 struct __pyx_obj_4dnet___addr_ip4_iter *p = (struct __pyx_obj_4dnet___addr_ip4_iter *)o;
06935 return o;
06936 }
06937
06938 static void __pyx_tp_dealloc_4dnet___addr_ip4_iter(PyObject *o) {
06939 struct __pyx_obj_4dnet___addr_ip4_iter *p = (struct __pyx_obj_4dnet___addr_ip4_iter *)o;
06940 (*o->ob_type->tp_free)(o);
06941 }
06942
06943 static int __pyx_tp_traverse_4dnet___addr_ip4_iter(PyObject *o, visitproc v, void *a) {
06944 int e;
06945 struct __pyx_obj_4dnet___addr_ip4_iter *p = (struct __pyx_obj_4dnet___addr_ip4_iter *)o;
06946 return 0;
06947 }
06948
06949 static int __pyx_tp_clear_4dnet___addr_ip4_iter(PyObject *o) {
06950 struct __pyx_obj_4dnet___addr_ip4_iter *p = (struct __pyx_obj_4dnet___addr_ip4_iter *)o;
06951 return 0;
06952 }
06953
06954 static struct PyMethodDef __pyx_methods_4dnet___addr_ip4_iter[] = {
06955 {0, 0, 0, 0}
06956 };
06957
06958 static PyNumberMethods __pyx_tp_as_number___addr_ip4_iter = {
06959 0,
06960 0,
06961 0,
06962 0,
06963 0,
06964 0,
06965 0,
06966 0,
06967 0,
06968 0,
06969 0,
06970 0,
06971 0,
06972 0,
06973 0,
06974 0,
06975 0,
06976 0,
06977 0,
06978 0,
06979 0,
06980 0,
06981 0,
06982 0,
06983 0,
06984 0,
06985 0,
06986 0,
06987 0,
06988 0,
06989 0,
06990 0,
06991 0,
06992 0,
06993 0,
06994 0,
06995 0,
06996 0,
06997 };
06998
06999 static PySequenceMethods __pyx_tp_as_sequence___addr_ip4_iter = {
07000 0,
07001 0,
07002 0,
07003 0,
07004 0,
07005 0,
07006 0,
07007 0,
07008 0,
07009 0,
07010 };
07011
07012 static PyMappingMethods __pyx_tp_as_mapping___addr_ip4_iter = {
07013 0,
07014 0,
07015 0,
07016 };
07017
07018 static PyBufferProcs __pyx_tp_as_buffer___addr_ip4_iter = {
07019 0,
07020 0,
07021 0,
07022 0,
07023 };
07024
07025 statichere PyTypeObject __pyx_type_4dnet___addr_ip4_iter = {
07026 PyObject_HEAD_INIT(0)
07027 0,
07028 "dnet.__addr_ip4_iter",
07029 sizeof(struct __pyx_obj_4dnet___addr_ip4_iter),
07030 0,
07031 __pyx_tp_dealloc_4dnet___addr_ip4_iter,
07032 0,
07033 0,
07034 0,
07035 0,
07036 0,
07037 &__pyx_tp_as_number___addr_ip4_iter,
07038 &__pyx_tp_as_sequence___addr_ip4_iter,
07039 &__pyx_tp_as_mapping___addr_ip4_iter,
07040 0,
07041 0,
07042 0,
07043 0,
07044 0,
07045 &__pyx_tp_as_buffer___addr_ip4_iter,
07046 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE,
07047 0,
07048 __pyx_tp_traverse_4dnet___addr_ip4_iter,
07049 __pyx_tp_clear_4dnet___addr_ip4_iter,
07050 0,
07051 0,
07052 0,
07053 __pyx_f_4dnet_15__addr_ip4_iter___next__,
07054 __pyx_methods_4dnet___addr_ip4_iter,
07055 0,
07056 0,
07057 0,
07058 0,
07059 0,
07060 0,
07061 0,
07062 __pyx_f_4dnet_15__addr_ip4_iter___init__,
07063 0,
07064 __pyx_tp_new_4dnet___addr_ip4_iter,
07065 0,
07066 0,
07067 0,
07068 0,
07069 0,
07070 0,
07071 0,
07072 };
07073
07074 static PyObject *__pyx_tp_new_4dnet_arp(PyTypeObject *t, PyObject *a, PyObject *k) {
07075 PyObject *o = (*t->tp_alloc)(t, 0);
07076 struct __pyx_obj_4dnet_arp *p = (struct __pyx_obj_4dnet_arp *)o;
07077 return o;
07078 }
07079
07080 static void __pyx_tp_dealloc_4dnet_arp(PyObject *o) {
07081 struct __pyx_obj_4dnet_arp *p = (struct __pyx_obj_4dnet_arp *)o;
07082 {
07083 PyObject *etype, *eval, *etb;
07084 PyErr_Fetch(&etype, &eval, &etb);
07085 ++o->ob_refcnt;
07086 __pyx_f_4dnet_3arp___dealloc__(o);
07087 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
07088 --o->ob_refcnt;
07089 PyErr_Restore(etype, eval, etb);
07090 }
07091 (*o->ob_type->tp_free)(o);
07092 }
07093
07094 static int __pyx_tp_traverse_4dnet_arp(PyObject *o, visitproc v, void *a) {
07095 int e;
07096 struct __pyx_obj_4dnet_arp *p = (struct __pyx_obj_4dnet_arp *)o;
07097 return 0;
07098 }
07099
07100 static int __pyx_tp_clear_4dnet_arp(PyObject *o) {
07101 struct __pyx_obj_4dnet_arp *p = (struct __pyx_obj_4dnet_arp *)o;
07102 return 0;
07103 }
07104
07105 static struct PyMethodDef __pyx_methods_4dnet_arp[] = {
07106 {"add", (PyCFunction)__pyx_f_4dnet_3arp_add, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_3arp_add},
07107 {"delete", (PyCFunction)__pyx_f_4dnet_3arp_delete, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_3arp_delete},
07108 {"get", (PyCFunction)__pyx_f_4dnet_3arp_get, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_3arp_get},
07109 {"loop", (PyCFunction)__pyx_f_4dnet_3arp_loop, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_3arp_loop},
07110 {0, 0, 0, 0}
07111 };
07112
07113 static PyNumberMethods __pyx_tp_as_number_arp = {
07114 0,
07115 0,
07116 0,
07117 0,
07118 0,
07119 0,
07120 0,
07121 0,
07122 0,
07123 0,
07124 0,
07125 0,
07126 0,
07127 0,
07128 0,
07129 0,
07130 0,
07131 0,
07132 0,
07133 0,
07134 0,
07135 0,
07136 0,
07137 0,
07138 0,
07139 0,
07140 0,
07141 0,
07142 0,
07143 0,
07144 0,
07145 0,
07146 0,
07147 0,
07148 0,
07149 0,
07150 0,
07151 0,
07152 };
07153
07154 static PySequenceMethods __pyx_tp_as_sequence_arp = {
07155 0,
07156 0,
07157 0,
07158 0,
07159 0,
07160 0,
07161 0,
07162 0,
07163 0,
07164 0,
07165 };
07166
07167 static PyMappingMethods __pyx_tp_as_mapping_arp = {
07168 0,
07169 0,
07170 0,
07171 };
07172
07173 static PyBufferProcs __pyx_tp_as_buffer_arp = {
07174 0,
07175 0,
07176 0,
07177 0,
07178 };
07179
07180 statichere PyTypeObject __pyx_type_4dnet_arp = {
07181 PyObject_HEAD_INIT(0)
07182 0,
07183 "dnet.arp",
07184 sizeof(struct __pyx_obj_4dnet_arp),
07185 0,
07186 __pyx_tp_dealloc_4dnet_arp,
07187 0,
07188 0,
07189 0,
07190 0,
07191 0,
07192 &__pyx_tp_as_number_arp,
07193 &__pyx_tp_as_sequence_arp,
07194 &__pyx_tp_as_mapping_arp,
07195 0,
07196 0,
07197 0,
07198 0,
07199 0,
07200 &__pyx_tp_as_buffer_arp,
07201 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE,
07202 "arp() -> ARP table object\n\n Open a handle to the system ARP table.\n ",
07203 __pyx_tp_traverse_4dnet_arp,
07204 __pyx_tp_clear_4dnet_arp,
07205 0,
07206 0,
07207 __pyx_f_4dnet_3arp___iter__,
07208 0,
07209 __pyx_methods_4dnet_arp,
07210 0,
07211 0,
07212 0,
07213 0,
07214 0,
07215 0,
07216 0,
07217 __pyx_f_4dnet_3arp___init__,
07218 0,
07219 __pyx_tp_new_4dnet_arp,
07220 0,
07221 0,
07222 0,
07223 0,
07224 0,
07225 0,
07226 0,
07227 };
07228
07229 static PyObject *__pyx_tp_new_4dnet_intf(PyTypeObject *t, PyObject *a, PyObject *k) {
07230 PyObject *o = (*t->tp_alloc)(t, 0);
07231 struct __pyx_obj_4dnet_intf *p = (struct __pyx_obj_4dnet_intf *)o;
07232 return o;
07233 }
07234
07235 static void __pyx_tp_dealloc_4dnet_intf(PyObject *o) {
07236 struct __pyx_obj_4dnet_intf *p = (struct __pyx_obj_4dnet_intf *)o;
07237 {
07238 PyObject *etype, *eval, *etb;
07239 PyErr_Fetch(&etype, &eval, &etb);
07240 ++o->ob_refcnt;
07241 __pyx_f_4dnet_4intf___dealloc__(o);
07242 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
07243 --o->ob_refcnt;
07244 PyErr_Restore(etype, eval, etb);
07245 }
07246 (*o->ob_type->tp_free)(o);
07247 }
07248
07249 static int __pyx_tp_traverse_4dnet_intf(PyObject *o, visitproc v, void *a) {
07250 int e;
07251 struct __pyx_obj_4dnet_intf *p = (struct __pyx_obj_4dnet_intf *)o;
07252 return 0;
07253 }
07254
07255 static int __pyx_tp_clear_4dnet_intf(PyObject *o) {
07256 struct __pyx_obj_4dnet_intf *p = (struct __pyx_obj_4dnet_intf *)o;
07257 return 0;
07258 }
07259
07260 static struct PyMethodDef __pyx_methods_4dnet_intf[] = {
07261 {"get", (PyCFunction)__pyx_f_4dnet_4intf_get, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_4intf_get},
07262 {"get_src", (PyCFunction)__pyx_f_4dnet_4intf_get_src, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_4intf_get_src},
07263 {"get_dst", (PyCFunction)__pyx_f_4dnet_4intf_get_dst, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_4intf_get_dst},
07264 {"set", (PyCFunction)__pyx_f_4dnet_4intf_set, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_4intf_set},
07265 {"loop", (PyCFunction)__pyx_f_4dnet_4intf_loop, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_4intf_loop},
07266 {0, 0, 0, 0}
07267 };
07268
07269 static PyNumberMethods __pyx_tp_as_number_intf = {
07270 0,
07271 0,
07272 0,
07273 0,
07274 0,
07275 0,
07276 0,
07277 0,
07278 0,
07279 0,
07280 0,
07281 0,
07282 0,
07283 0,
07284 0,
07285 0,
07286 0,
07287 0,
07288 0,
07289 0,
07290 0,
07291 0,
07292 0,
07293 0,
07294 0,
07295 0,
07296 0,
07297 0,
07298 0,
07299 0,
07300 0,
07301 0,
07302 0,
07303 0,
07304 0,
07305 0,
07306 0,
07307 0,
07308 };
07309
07310 static PySequenceMethods __pyx_tp_as_sequence_intf = {
07311 0,
07312 0,
07313 0,
07314 0,
07315 0,
07316 0,
07317 0,
07318 0,
07319 0,
07320 0,
07321 };
07322
07323 static PyMappingMethods __pyx_tp_as_mapping_intf = {
07324 0,
07325 0,
07326 0,
07327 };
07328
07329 static PyBufferProcs __pyx_tp_as_buffer_intf = {
07330 0,
07331 0,
07332 0,
07333 0,
07334 };
07335
07336 statichere PyTypeObject __pyx_type_4dnet_intf = {
07337 PyObject_HEAD_INIT(0)
07338 0,
07339 "dnet.intf",
07340 sizeof(struct __pyx_obj_4dnet_intf),
07341 0,
07342 __pyx_tp_dealloc_4dnet_intf,
07343 0,
07344 0,
07345 0,
07346 0,
07347 0,
07348 &__pyx_tp_as_number_intf,
07349 &__pyx_tp_as_sequence_intf,
07350 &__pyx_tp_as_mapping_intf,
07351 0,
07352 0,
07353 0,
07354 0,
07355 0,
07356 &__pyx_tp_as_buffer_intf,
07357 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE,
07358 "intf() -> Interface table object\n\n Open a handle to the system network interface table.\n ",
07359 __pyx_tp_traverse_4dnet_intf,
07360 __pyx_tp_clear_4dnet_intf,
07361 0,
07362 0,
07363 __pyx_f_4dnet_4intf___iter__,
07364 0,
07365 __pyx_methods_4dnet_intf,
07366 0,
07367 0,
07368 0,
07369 0,
07370 0,
07371 0,
07372 0,
07373 __pyx_f_4dnet_4intf___init__,
07374 0,
07375 __pyx_tp_new_4dnet_intf,
07376 0,
07377 0,
07378 0,
07379 0,
07380 0,
07381 0,
07382 0,
07383 };
07384
07385 static PyObject *__pyx_tp_new_4dnet_route(PyTypeObject *t, PyObject *a, PyObject *k) {
07386 PyObject *o = (*t->tp_alloc)(t, 0);
07387 struct __pyx_obj_4dnet_route *p = (struct __pyx_obj_4dnet_route *)o;
07388 return o;
07389 }
07390
07391 static void __pyx_tp_dealloc_4dnet_route(PyObject *o) {
07392 struct __pyx_obj_4dnet_route *p = (struct __pyx_obj_4dnet_route *)o;
07393 {
07394 PyObject *etype, *eval, *etb;
07395 PyErr_Fetch(&etype, &eval, &etb);
07396 ++o->ob_refcnt;
07397 __pyx_f_4dnet_5route___dealloc__(o);
07398 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
07399 --o->ob_refcnt;
07400 PyErr_Restore(etype, eval, etb);
07401 }
07402 (*o->ob_type->tp_free)(o);
07403 }
07404
07405 static int __pyx_tp_traverse_4dnet_route(PyObject *o, visitproc v, void *a) {
07406 int e;
07407 struct __pyx_obj_4dnet_route *p = (struct __pyx_obj_4dnet_route *)o;
07408 return 0;
07409 }
07410
07411 static int __pyx_tp_clear_4dnet_route(PyObject *o) {
07412 struct __pyx_obj_4dnet_route *p = (struct __pyx_obj_4dnet_route *)o;
07413 return 0;
07414 }
07415
07416 static struct PyMethodDef __pyx_methods_4dnet_route[] = {
07417 {"add", (PyCFunction)__pyx_f_4dnet_5route_add, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_5route_add},
07418 {"delete", (PyCFunction)__pyx_f_4dnet_5route_delete, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_5route_delete},
07419 {"get", (PyCFunction)__pyx_f_4dnet_5route_get, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_5route_get},
07420 {"loop", (PyCFunction)__pyx_f_4dnet_5route_loop, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_5route_loop},
07421 {0, 0, 0, 0}
07422 };
07423
07424 static PyNumberMethods __pyx_tp_as_number_route = {
07425 0,
07426 0,
07427 0,
07428 0,
07429 0,
07430 0,
07431 0,
07432 0,
07433 0,
07434 0,
07435 0,
07436 0,
07437 0,
07438 0,
07439 0,
07440 0,
07441 0,
07442 0,
07443 0,
07444 0,
07445 0,
07446 0,
07447 0,
07448 0,
07449 0,
07450 0,
07451 0,
07452 0,
07453 0,
07454 0,
07455 0,
07456 0,
07457 0,
07458 0,
07459 0,
07460 0,
07461 0,
07462 0,
07463 };
07464
07465 static PySequenceMethods __pyx_tp_as_sequence_route = {
07466 0,
07467 0,
07468 0,
07469 0,
07470 0,
07471 0,
07472 0,
07473 0,
07474 0,
07475 0,
07476 };
07477
07478 static PyMappingMethods __pyx_tp_as_mapping_route = {
07479 0,
07480 0,
07481 0,
07482 };
07483
07484 static PyBufferProcs __pyx_tp_as_buffer_route = {
07485 0,
07486 0,
07487 0,
07488 0,
07489 };
07490
07491 statichere PyTypeObject __pyx_type_4dnet_route = {
07492 PyObject_HEAD_INIT(0)
07493 0,
07494 "dnet.route",
07495 sizeof(struct __pyx_obj_4dnet_route),
07496 0,
07497 __pyx_tp_dealloc_4dnet_route,
07498 0,
07499 0,
07500 0,
07501 0,
07502 0,
07503 &__pyx_tp_as_number_route,
07504 &__pyx_tp_as_sequence_route,
07505 &__pyx_tp_as_mapping_route,
07506 0,
07507 0,
07508 0,
07509 0,
07510 0,
07511 &__pyx_tp_as_buffer_route,
07512 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE,
07513 "route() -> Routing table object\n\n Open a handle to the system routing table.\n ",
07514 __pyx_tp_traverse_4dnet_route,
07515 __pyx_tp_clear_4dnet_route,
07516 0,
07517 0,
07518 __pyx_f_4dnet_5route___iter__,
07519 0,
07520 __pyx_methods_4dnet_route,
07521 0,
07522 0,
07523 0,
07524 0,
07525 0,
07526 0,
07527 0,
07528 __pyx_f_4dnet_5route___init__,
07529 0,
07530 __pyx_tp_new_4dnet_route,
07531 0,
07532 0,
07533 0,
07534 0,
07535 0,
07536 0,
07537 0,
07538 };
07539
07540 static PyObject *__pyx_tp_new_4dnet_fw(PyTypeObject *t, PyObject *a, PyObject *k) {
07541 PyObject *o = (*t->tp_alloc)(t, 0);
07542 struct __pyx_obj_4dnet_fw *p = (struct __pyx_obj_4dnet_fw *)o;
07543 return o;
07544 }
07545
07546 static void __pyx_tp_dealloc_4dnet_fw(PyObject *o) {
07547 struct __pyx_obj_4dnet_fw *p = (struct __pyx_obj_4dnet_fw *)o;
07548 {
07549 PyObject *etype, *eval, *etb;
07550 PyErr_Fetch(&etype, &eval, &etb);
07551 ++o->ob_refcnt;
07552 __pyx_f_4dnet_2fw___dealloc__(o);
07553 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
07554 --o->ob_refcnt;
07555 PyErr_Restore(etype, eval, etb);
07556 }
07557 (*o->ob_type->tp_free)(o);
07558 }
07559
07560 static int __pyx_tp_traverse_4dnet_fw(PyObject *o, visitproc v, void *a) {
07561 int e;
07562 struct __pyx_obj_4dnet_fw *p = (struct __pyx_obj_4dnet_fw *)o;
07563 return 0;
07564 }
07565
07566 static int __pyx_tp_clear_4dnet_fw(PyObject *o) {
07567 struct __pyx_obj_4dnet_fw *p = (struct __pyx_obj_4dnet_fw *)o;
07568 return 0;
07569 }
07570
07571 static struct PyMethodDef __pyx_methods_4dnet_fw[] = {
07572 {"add", (PyCFunction)__pyx_f_4dnet_2fw_add, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_2fw_add},
07573 {"delete", (PyCFunction)__pyx_f_4dnet_2fw_delete, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_2fw_delete},
07574 {"loop", (PyCFunction)__pyx_f_4dnet_2fw_loop, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_2fw_loop},
07575 {0, 0, 0, 0}
07576 };
07577
07578 static PyNumberMethods __pyx_tp_as_number_fw = {
07579 0,
07580 0,
07581 0,
07582 0,
07583 0,
07584 0,
07585 0,
07586 0,
07587 0,
07588 0,
07589 0,
07590 0,
07591 0,
07592 0,
07593 0,
07594 0,
07595 0,
07596 0,
07597 0,
07598 0,
07599 0,
07600 0,
07601 0,
07602 0,
07603 0,
07604 0,
07605 0,
07606 0,
07607 0,
07608 0,
07609 0,
07610 0,
07611 0,
07612 0,
07613 0,
07614 0,
07615 0,
07616 0,
07617 };
07618
07619 static PySequenceMethods __pyx_tp_as_sequence_fw = {
07620 0,
07621 0,
07622 0,
07623 0,
07624 0,
07625 0,
07626 0,
07627 0,
07628 0,
07629 0,
07630 };
07631
07632 static PyMappingMethods __pyx_tp_as_mapping_fw = {
07633 0,
07634 0,
07635 0,
07636 };
07637
07638 static PyBufferProcs __pyx_tp_as_buffer_fw = {
07639 0,
07640 0,
07641 0,
07642 0,
07643 };
07644
07645 statichere PyTypeObject __pyx_type_4dnet_fw = {
07646 PyObject_HEAD_INIT(0)
07647 0,
07648 "dnet.fw",
07649 sizeof(struct __pyx_obj_4dnet_fw),
07650 0,
07651 __pyx_tp_dealloc_4dnet_fw,
07652 0,
07653 0,
07654 0,
07655 0,
07656 0,
07657 &__pyx_tp_as_number_fw,
07658 &__pyx_tp_as_sequence_fw,
07659 &__pyx_tp_as_mapping_fw,
07660 0,
07661 0,
07662 0,
07663 0,
07664 0,
07665 &__pyx_tp_as_buffer_fw,
07666 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE,
07667 "fw() -> Firewall ruleset object\n \n Open a handle to the local network firewall configuration.\n ",
07668 __pyx_tp_traverse_4dnet_fw,
07669 __pyx_tp_clear_4dnet_fw,
07670 0,
07671 0,
07672 __pyx_f_4dnet_2fw___iter__,
07673 0,
07674 __pyx_methods_4dnet_fw,
07675 0,
07676 0,
07677 0,
07678 0,
07679 0,
07680 0,
07681 0,
07682 __pyx_f_4dnet_2fw___init__,
07683 0,
07684 __pyx_tp_new_4dnet_fw,
07685 0,
07686 0,
07687 0,
07688 0,
07689 0,
07690 0,
07691 0,
07692 };
07693
07694 static PyObject *__pyx_tp_new_4dnet_rand(PyTypeObject *t, PyObject *a, PyObject *k) {
07695 PyObject *o = (*t->tp_alloc)(t, 0);
07696 struct __pyx_obj_4dnet_rand *p = (struct __pyx_obj_4dnet_rand *)o;
07697 return o;
07698 }
07699
07700 static void __pyx_tp_dealloc_4dnet_rand(PyObject *o) {
07701 struct __pyx_obj_4dnet_rand *p = (struct __pyx_obj_4dnet_rand *)o;
07702 {
07703 PyObject *etype, *eval, *etb;
07704 PyErr_Fetch(&etype, &eval, &etb);
07705 ++o->ob_refcnt;
07706 __pyx_f_4dnet_4rand___dealloc__(o);
07707 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
07708 --o->ob_refcnt;
07709 PyErr_Restore(etype, eval, etb);
07710 }
07711 (*o->ob_type->tp_free)(o);
07712 }
07713
07714 static int __pyx_tp_traverse_4dnet_rand(PyObject *o, visitproc v, void *a) {
07715 int e;
07716 struct __pyx_obj_4dnet_rand *p = (struct __pyx_obj_4dnet_rand *)o;
07717 return 0;
07718 }
07719
07720 static int __pyx_tp_clear_4dnet_rand(PyObject *o) {
07721 struct __pyx_obj_4dnet_rand *p = (struct __pyx_obj_4dnet_rand *)o;
07722 return 0;
07723 }
07724
07725 static struct PyMethodDef __pyx_methods_4dnet_rand[] = {
07726 {"get", (PyCFunction)__pyx_f_4dnet_4rand_get, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_4rand_get},
07727 {"set", (PyCFunction)__pyx_f_4dnet_4rand_set, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_4rand_set},
07728 {"add", (PyCFunction)__pyx_f_4dnet_4rand_add, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_4rand_add},
07729 {"uint8", (PyCFunction)__pyx_f_4dnet_4rand_uint8, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_4rand_uint8},
07730 {"uint16", (PyCFunction)__pyx_f_4dnet_4rand_uint16, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_4rand_uint16},
07731 {"uint32", (PyCFunction)__pyx_f_4dnet_4rand_uint32, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_4rand_uint32},
07732 {"xrange", (PyCFunction)__pyx_f_4dnet_4rand_xrange, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_4rand_xrange},
07733 {0, 0, 0, 0}
07734 };
07735
07736 static PyNumberMethods __pyx_tp_as_number_rand = {
07737 0,
07738 0,
07739 0,
07740 0,
07741 0,
07742 0,
07743 0,
07744 0,
07745 0,
07746 0,
07747 0,
07748 0,
07749 0,
07750 0,
07751 0,
07752 0,
07753 0,
07754 0,
07755 0,
07756 0,
07757 0,
07758 0,
07759 0,
07760 0,
07761 0,
07762 0,
07763 0,
07764 0,
07765 0,
07766 0,
07767 0,
07768 0,
07769 0,
07770 0,
07771 0,
07772 0,
07773 0,
07774 0,
07775 };
07776
07777 static PySequenceMethods __pyx_tp_as_sequence_rand = {
07778 0,
07779 0,
07780 0,
07781 0,
07782 0,
07783 0,
07784 0,
07785 0,
07786 0,
07787 0,
07788 };
07789
07790 static PyMappingMethods __pyx_tp_as_mapping_rand = {
07791 0,
07792 0,
07793 0,
07794 };
07795
07796 static PyBufferProcs __pyx_tp_as_buffer_rand = {
07797 0,
07798 0,
07799 0,
07800 0,
07801 };
07802
07803 statichere PyTypeObject __pyx_type_4dnet_rand = {
07804 PyObject_HEAD_INIT(0)
07805 0,
07806 "dnet.rand",
07807 sizeof(struct __pyx_obj_4dnet_rand),
07808 0,
07809 __pyx_tp_dealloc_4dnet_rand,
07810 0,
07811 0,
07812 0,
07813 0,
07814 0,
07815 &__pyx_tp_as_number_rand,
07816 &__pyx_tp_as_sequence_rand,
07817 &__pyx_tp_as_mapping_rand,
07818 0,
07819 0,
07820 0,
07821 0,
07822 0,
07823 &__pyx_tp_as_buffer_rand,
07824 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE,
07825 "rand() -> Pseudo-random number generator\n\n Obtain a handle for fast, cryptographically strong pseudo-random\n number generation. The starting seed is derived from the system\n random data source device (if one exists), or from the current time\n and random stack contents.\n ",
07826 __pyx_tp_traverse_4dnet_rand,
07827 __pyx_tp_clear_4dnet_rand,
07828 0,
07829 0,
07830 0,
07831 0,
07832 __pyx_methods_4dnet_rand,
07833 0,
07834 0,
07835 0,
07836 0,
07837 0,
07838 0,
07839 0,
07840 __pyx_f_4dnet_4rand___init__,
07841 0,
07842 __pyx_tp_new_4dnet_rand,
07843 0,
07844 0,
07845 0,
07846 0,
07847 0,
07848 0,
07849 0,
07850 };
07851
07852 static PyObject *__pyx_tp_new_4dnet___rand_xrange(PyTypeObject *t, PyObject *a, PyObject *k) {
07853 PyObject *o = (*t->tp_alloc)(t, 0);
07854 struct __pyx_obj_4dnet___rand_xrange *p = (struct __pyx_obj_4dnet___rand_xrange *)o;
07855 return o;
07856 }
07857
07858 static void __pyx_tp_dealloc_4dnet___rand_xrange(PyObject *o) {
07859 struct __pyx_obj_4dnet___rand_xrange *p = (struct __pyx_obj_4dnet___rand_xrange *)o;
07860 (*o->ob_type->tp_free)(o);
07861 }
07862
07863 static int __pyx_tp_traverse_4dnet___rand_xrange(PyObject *o, visitproc v, void *a) {
07864 int e;
07865 struct __pyx_obj_4dnet___rand_xrange *p = (struct __pyx_obj_4dnet___rand_xrange *)o;
07866 return 0;
07867 }
07868
07869 static int __pyx_tp_clear_4dnet___rand_xrange(PyObject *o) {
07870 struct __pyx_obj_4dnet___rand_xrange *p = (struct __pyx_obj_4dnet___rand_xrange *)o;
07871 return 0;
07872 }
07873
07874 static struct PyMethodDef __pyx_methods_4dnet___rand_xrange[] = {
07875 {0, 0, 0, 0}
07876 };
07877
07878 static PyNumberMethods __pyx_tp_as_number___rand_xrange = {
07879 0,
07880 0,
07881 0,
07882 0,
07883 0,
07884 0,
07885 0,
07886 0,
07887 0,
07888 0,
07889 0,
07890 0,
07891 0,
07892 0,
07893 0,
07894 0,
07895 0,
07896 0,
07897 0,
07898 0,
07899 0,
07900 0,
07901 0,
07902 0,
07903 0,
07904 0,
07905 0,
07906 0,
07907 0,
07908 0,
07909 0,
07910 0,
07911 0,
07912 0,
07913 0,
07914 0,
07915 0,
07916 0,
07917 };
07918
07919 static PySequenceMethods __pyx_tp_as_sequence___rand_xrange = {
07920 __pyx_f_4dnet_13__rand_xrange___len__,
07921 0,
07922 0,
07923 0,
07924 0,
07925 0,
07926 0,
07927 0,
07928 0,
07929 0,
07930 };
07931
07932 static PyMappingMethods __pyx_tp_as_mapping___rand_xrange = {
07933 __pyx_f_4dnet_13__rand_xrange___len__,
07934 0,
07935 0,
07936 };
07937
07938 static PyBufferProcs __pyx_tp_as_buffer___rand_xrange = {
07939 0,
07940 0,
07941 0,
07942 0,
07943 };
07944
07945 statichere PyTypeObject __pyx_type_4dnet___rand_xrange = {
07946 PyObject_HEAD_INIT(0)
07947 0,
07948 "dnet.__rand_xrange",
07949 sizeof(struct __pyx_obj_4dnet___rand_xrange),
07950 0,
07951 __pyx_tp_dealloc_4dnet___rand_xrange,
07952 0,
07953 0,
07954 0,
07955 0,
07956 0,
07957 &__pyx_tp_as_number___rand_xrange,
07958 &__pyx_tp_as_sequence___rand_xrange,
07959 &__pyx_tp_as_mapping___rand_xrange,
07960 0,
07961 0,
07962 0,
07963 0,
07964 0,
07965 &__pyx_tp_as_buffer___rand_xrange,
07966 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE,
07967 0,
07968 __pyx_tp_traverse_4dnet___rand_xrange,
07969 __pyx_tp_clear_4dnet___rand_xrange,
07970 0,
07971 0,
07972 __pyx_f_4dnet_13__rand_xrange___iter__,
07973 __pyx_f_4dnet_13__rand_xrange___next__,
07974 __pyx_methods_4dnet___rand_xrange,
07975 0,
07976 0,
07977 0,
07978 0,
07979 0,
07980 0,
07981 0,
07982 __pyx_f_4dnet_13__rand_xrange___init__,
07983 0,
07984 __pyx_tp_new_4dnet___rand_xrange,
07985 0,
07986 0,
07987 0,
07988 0,
07989 0,
07990 0,
07991 0,
07992 };
07993
07994 static PyObject *__pyx_tp_new_4dnet_tun(PyTypeObject *t, PyObject *a, PyObject *k) {
07995 PyObject *o = (*t->tp_alloc)(t, 0);
07996 struct __pyx_obj_4dnet_tun *p = (struct __pyx_obj_4dnet_tun *)o;
07997 return o;
07998 }
07999
08000 static void __pyx_tp_dealloc_4dnet_tun(PyObject *o) {
08001 struct __pyx_obj_4dnet_tun *p = (struct __pyx_obj_4dnet_tun *)o;
08002 {
08003 PyObject *etype, *eval, *etb;
08004 PyErr_Fetch(&etype, &eval, &etb);
08005 ++o->ob_refcnt;
08006 __pyx_f_4dnet_3tun___dealloc__(o);
08007 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
08008 --o->ob_refcnt;
08009 PyErr_Restore(etype, eval, etb);
08010 }
08011 (*o->ob_type->tp_free)(o);
08012 }
08013
08014 static int __pyx_tp_traverse_4dnet_tun(PyObject *o, visitproc v, void *a) {
08015 int e;
08016 struct __pyx_obj_4dnet_tun *p = (struct __pyx_obj_4dnet_tun *)o;
08017 return 0;
08018 }
08019
08020 static int __pyx_tp_clear_4dnet_tun(PyObject *o) {
08021 struct __pyx_obj_4dnet_tun *p = (struct __pyx_obj_4dnet_tun *)o;
08022 return 0;
08023 }
08024
08025 static PyObject *__pyx_getprop_4dnet_3tun_name(PyObject *o, void *x) {
08026 return __pyx_f_4dnet_3tun_4name___get__(o);
08027 }
08028
08029 static PyObject *__pyx_getprop_4dnet_3tun_fd(PyObject *o, void *x) {
08030 return __pyx_f_4dnet_3tun_2fd___get__(o);
08031 }
08032
08033 static struct PyMethodDef __pyx_methods_4dnet_tun[] = {
08034 {"fileno", (PyCFunction)__pyx_f_4dnet_3tun_fileno, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_3tun_fileno},
08035 {"send", (PyCFunction)__pyx_f_4dnet_3tun_send, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_3tun_send},
08036 {"recv", (PyCFunction)__pyx_f_4dnet_3tun_recv, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_3tun_recv},
08037 {"close", (PyCFunction)__pyx_f_4dnet_3tun_close, METH_VARARGS|METH_KEYWORDS, 0},
08038 {0, 0, 0, 0}
08039 };
08040
08041 static struct PyGetSetDef __pyx_getsets_4dnet_tun[] = {
08042 {"name", __pyx_getprop_4dnet_3tun_name, 0, __pyx_k7, 0},
08043 {"fd", __pyx_getprop_4dnet_3tun_fd, 0, __pyx_k8, 0},
08044 {0, 0, 0, 0, 0}
08045 };
08046
08047 static PyNumberMethods __pyx_tp_as_number_tun = {
08048 0,
08049 0,
08050 0,
08051 0,
08052 0,
08053 0,
08054 0,
08055 0,
08056 0,
08057 0,
08058 0,
08059 0,
08060 0,
08061 0,
08062 0,
08063 0,
08064 0,
08065 0,
08066 0,
08067 0,
08068 0,
08069 0,
08070 0,
08071 0,
08072 0,
08073 0,
08074 0,
08075 0,
08076 0,
08077 0,
08078 0,
08079 0,
08080 0,
08081 0,
08082 0,
08083 0,
08084 0,
08085 0,
08086 };
08087
08088 static PySequenceMethods __pyx_tp_as_sequence_tun = {
08089 0,
08090 0,
08091 0,
08092 0,
08093 0,
08094 0,
08095 0,
08096 0,
08097 0,
08098 0,
08099 };
08100
08101 static PyMappingMethods __pyx_tp_as_mapping_tun = {
08102 0,
08103 0,
08104 0,
08105 };
08106
08107 static PyBufferProcs __pyx_tp_as_buffer_tun = {
08108 0,
08109 0,
08110 0,
08111 0,
08112 };
08113
08114 statichere PyTypeObject __pyx_type_4dnet_tun = {
08115 PyObject_HEAD_INIT(0)
08116 0,
08117 "dnet.tun",
08118 sizeof(struct __pyx_obj_4dnet_tun),
08119 0,
08120 __pyx_tp_dealloc_4dnet_tun,
08121 0,
08122 0,
08123 0,
08124 0,
08125 0,
08126 &__pyx_tp_as_number_tun,
08127 &__pyx_tp_as_sequence_tun,
08128 &__pyx_tp_as_mapping_tun,
08129 0,
08130 0,
08131 0,
08132 0,
08133 0,
08134 &__pyx_tp_as_buffer_tun,
08135 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE,
08136 "tun(src, dst[, mtu]) -> Network tunnel interface handle\n \n Obtain a handle to a network tunnel interface, to which packets\n destined for dst are delivered (with source addresses rewritten to\n src), where they may be read by a userland process and processed\n as desired. Packets written back to the handle are injected into\n the kernel networking subsystem.\n ",
08137 __pyx_tp_traverse_4dnet_tun,
08138 __pyx_tp_clear_4dnet_tun,
08139 0,
08140 0,
08141 0,
08142 0,
08143 __pyx_methods_4dnet_tun,
08144 0,
08145 __pyx_getsets_4dnet_tun,
08146 0,
08147 0,
08148 0,
08149 0,
08150 0,
08151 __pyx_f_4dnet_3tun___init__,
08152 0,
08153 __pyx_tp_new_4dnet_tun,
08154 0,
08155 0,
08156 0,
08157 0,
08158 0,
08159 0,
08160 0,
08161 };
08162
08163 static struct PyMethodDef __pyx_methods[] = {
08164 {"__iter_append", (PyCFunction)__pyx_f_4dnet___iter_append, METH_VARARGS|METH_KEYWORDS, 0},
08165 {"eth_ntoa", (PyCFunction)__pyx_f_4dnet_eth_ntoa, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_eth_ntoa},
08166 {"eth_aton", (PyCFunction)__pyx_f_4dnet_eth_aton, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_eth_aton},
08167 {"eth_pack_hdr", (PyCFunction)__pyx_f_4dnet_eth_pack_hdr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_eth_pack_hdr},
08168 {"ip_ntoa", (PyCFunction)__pyx_f_4dnet_ip_ntoa, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_ip_ntoa},
08169 {"ip_aton", (PyCFunction)__pyx_f_4dnet_ip_aton, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_ip_aton},
08170 {"ip_checksum", (PyCFunction)__pyx_f_4dnet_ip_checksum, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_ip_checksum},
08171 {"ip_cksum_add", (PyCFunction)__pyx_f_4dnet_ip_cksum_add, METH_VARARGS|METH_KEYWORDS, 0},
08172 {"ip_cksum_carry", (PyCFunction)__pyx_f_4dnet_ip_cksum_carry, METH_VARARGS|METH_KEYWORDS, 0},
08173 {"ip_pack_hdr", (PyCFunction)__pyx_f_4dnet_ip_pack_hdr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_ip_pack_hdr},
08174 {"ip6_ntoa", (PyCFunction)__pyx_f_4dnet_ip6_ntoa, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_ip6_ntoa},
08175 {"ip6_aton", (PyCFunction)__pyx_f_4dnet_ip6_aton, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_ip6_aton},
08176 {"ip6_checksum", (PyCFunction)__pyx_f_4dnet_ip6_checksum, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_ip6_checksum},
08177 {"ip6_pack_hdr", (PyCFunction)__pyx_f_4dnet_ip6_pack_hdr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_ip6_pack_hdr},
08178 {"arp_pack_hdr_ethip", (PyCFunction)__pyx_f_4dnet_arp_pack_hdr_ethip, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_arp_pack_hdr_ethip},
08179 {"icmp_pack_hdr", (PyCFunction)__pyx_f_4dnet_icmp_pack_hdr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_icmp_pack_hdr},
08180 {"tcp_pack_hdr", (PyCFunction)__pyx_f_4dnet_tcp_pack_hdr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_tcp_pack_hdr},
08181 {"udp_pack_hdr", (PyCFunction)__pyx_f_4dnet_udp_pack_hdr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dnet_udp_pack_hdr},
08182 {0, 0, 0, 0}
08183 };
08184
08185 DL_EXPORT(void) initdnet(void);
08186 DL_EXPORT(void) initdnet(void) {
08187 PyObject *__pyx_1 = 0;
08188 PyObject *__pyx_2 = 0;
08189 PyObject *__pyx_3 = 0;
08190 PyObject *__pyx_4 = 0;
08191 PyObject *__pyx_5 = 0;
08192 PyObject *__pyx_6 = 0;
08193 PyObject *__pyx_7 = 0;
08194 PyObject *__pyx_8 = 0;
08195 PyObject *__pyx_9 = 0;
08196 PyObject *__pyx_10 = 0;
08197 PyObject *__pyx_11 = 0;
08198 PyObject *__pyx_12 = 0;
08199 PyObject *__pyx_13 = 0;
08200 PyObject *__pyx_14 = 0;
08201 PyObject *__pyx_15 = 0;
08202 PyObject *__pyx_16 = 0;
08203 PyObject *__pyx_17 = 0;
08204 PyObject *__pyx_18 = 0;
08205 PyObject *__pyx_19 = 0;
08206 PyObject *__pyx_20 = 0;
08207 PyObject *__pyx_21 = 0;
08208 PyObject *__pyx_22 = 0;
08209 PyObject *__pyx_23 = 0;
08210 PyObject *__pyx_24 = 0;
08211 PyObject *__pyx_25 = 0;
08212 PyObject *__pyx_26 = 0;
08213 PyObject *__pyx_27 = 0;
08214 PyObject *__pyx_28 = 0;
08215 PyObject *__pyx_29 = 0;
08216 PyObject *__pyx_30 = 0;
08217 PyObject *__pyx_31 = 0;
08218 __pyx_m = Py_InitModule4("dnet", __pyx_methods, __pyx_mdoc, 0, PYTHON_API_VERSION);
08219 if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; goto __pyx_L1;};
08220 __pyx_b = PyImport_AddModule("__builtin__");
08221 if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; goto __pyx_L1;};
08222 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; goto __pyx_L1;};
08223 if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; goto __pyx_L1;};
08224 if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; goto __pyx_L1;};
08225 if (PyType_Ready(&__pyx_type_4dnet_eth) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; goto __pyx_L1;}
08226 if (PyObject_SetAttrString(__pyx_m, "eth", (PyObject *)&__pyx_type_4dnet_eth) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; goto __pyx_L1;}
08227 __pyx_ptype_4dnet_eth = &__pyx_type_4dnet_eth;
08228 if (PyType_Ready(&__pyx_type_4dnet_ip) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; goto __pyx_L1;}
08229 if (PyObject_SetAttrString(__pyx_m, "ip", (PyObject *)&__pyx_type_4dnet_ip) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; goto __pyx_L1;}
08230 __pyx_ptype_4dnet_ip = &__pyx_type_4dnet_ip;
08231 if (PyType_Ready(&__pyx_type_4dnet_addr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; goto __pyx_L1;}
08232 if (PyObject_SetAttrString(__pyx_m, "addr", (PyObject *)&__pyx_type_4dnet_addr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; goto __pyx_L1;}
08233 __pyx_ptype_4dnet_addr = &__pyx_type_4dnet_addr;
08234 if (PyType_Ready(&__pyx_type_4dnet___addr_ip4_iter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; goto __pyx_L1;}
08235 if (PyObject_SetAttrString(__pyx_m, "__addr_ip4_iter", (PyObject *)&__pyx_type_4dnet___addr_ip4_iter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; goto __pyx_L1;}
08236 __pyx_ptype_4dnet___addr_ip4_iter = &__pyx_type_4dnet___addr_ip4_iter;
08237 if (PyType_Ready(&__pyx_type_4dnet_arp) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;}
08238 if (PyObject_SetAttrString(__pyx_m, "arp", (PyObject *)&__pyx_type_4dnet_arp) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;}
08239 __pyx_ptype_4dnet_arp = &__pyx_type_4dnet_arp;
08240 if (PyType_Ready(&__pyx_type_4dnet_intf) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; goto __pyx_L1;}
08241 if (PyObject_SetAttrString(__pyx_m, "intf", (PyObject *)&__pyx_type_4dnet_intf) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; goto __pyx_L1;}
08242 __pyx_ptype_4dnet_intf = &__pyx_type_4dnet_intf;
08243 if (PyType_Ready(&__pyx_type_4dnet_route) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; goto __pyx_L1;}
08244 if (PyObject_SetAttrString(__pyx_m, "route", (PyObject *)&__pyx_type_4dnet_route) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; goto __pyx_L1;}
08245 __pyx_ptype_4dnet_route = &__pyx_type_4dnet_route;
08246 if (PyType_Ready(&__pyx_type_4dnet_fw) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; goto __pyx_L1;}
08247 if (PyObject_SetAttrString(__pyx_m, "fw", (PyObject *)&__pyx_type_4dnet_fw) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; goto __pyx_L1;}
08248 __pyx_ptype_4dnet_fw = &__pyx_type_4dnet_fw;
08249 if (PyType_Ready(&__pyx_type_4dnet_rand) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; goto __pyx_L1;}
08250 if (PyObject_SetAttrString(__pyx_m, "rand", (PyObject *)&__pyx_type_4dnet_rand) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; goto __pyx_L1;}
08251 __pyx_ptype_4dnet_rand = &__pyx_type_4dnet_rand;
08252 if (PyType_Ready(&__pyx_type_4dnet___rand_xrange) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1393; goto __pyx_L1;}
08253 if (PyObject_SetAttrString(__pyx_m, "__rand_xrange", (PyObject *)&__pyx_type_4dnet___rand_xrange) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1393; goto __pyx_L1;}
08254 __pyx_ptype_4dnet___rand_xrange = &__pyx_type_4dnet___rand_xrange;
08255 if (PyType_Ready(&__pyx_type_4dnet_tun) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1477; goto __pyx_L1;}
08256 if (PyObject_SetAttrString(__pyx_m, "tun", (PyObject *)&__pyx_type_4dnet_tun) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1477; goto __pyx_L1;}
08257 __pyx_ptype_4dnet_tun = &__pyx_type_4dnet_tun;
08258
08259
08260 if (PyObject_SetAttr(__pyx_m, __pyx_n___author__, __pyx_k9p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; goto __pyx_L1;}
08261
08262
08263 if (PyObject_SetAttr(__pyx_m, __pyx_n___copyright__, __pyx_k10p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; goto __pyx_L1;}
08264
08265
08266 if (PyObject_SetAttr(__pyx_m, __pyx_n___license__, __pyx_n_BSD) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;}
08267
08268
08269 if (PyObject_SetAttr(__pyx_m, __pyx_n___url__, __pyx_k12p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; goto __pyx_L1;}
08270
08271
08272 if (PyObject_SetAttr(__pyx_m, __pyx_n___version__, __pyx_k13p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; goto __pyx_L1;}
08273
08274
08275 __pyx_1 = PyInt_FromLong(6); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
08276 if (PyObject_SetAttr(__pyx_m, __pyx_n_ETH_ADDR_LEN, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
08277 Py_DECREF(__pyx_1); __pyx_1 = 0;
08278
08279
08280 __pyx_1 = PyInt_FromLong(48); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; goto __pyx_L1;}
08281 if (PyObject_SetAttr(__pyx_m, __pyx_n_ETH_ADDR_BITS, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; goto __pyx_L1;}
08282 Py_DECREF(__pyx_1); __pyx_1 = 0;
08283
08284
08285 __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; goto __pyx_L1;}
08286 if (PyObject_SetAttr(__pyx_m, __pyx_n_ETH_TYPE_LEN, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; goto __pyx_L1;}
08287 Py_DECREF(__pyx_1); __pyx_1 = 0;
08288
08289
08290 __pyx_1 = PyInt_FromLong(4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; goto __pyx_L1;}
08291 if (PyObject_SetAttr(__pyx_m, __pyx_n_ETH_CRC_LEN, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; goto __pyx_L1;}
08292 Py_DECREF(__pyx_1); __pyx_1 = 0;
08293
08294
08295 __pyx_1 = PyInt_FromLong(14); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
08296 if (PyObject_SetAttr(__pyx_m, __pyx_n_ETH_HDR_LEN, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
08297 Py_DECREF(__pyx_1); __pyx_1 = 0;
08298
08299
08300 __pyx_1 = PyInt_FromLong(64); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; goto __pyx_L1;}
08301 if (PyObject_SetAttr(__pyx_m, __pyx_n_ETH_LEN_MIN, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; goto __pyx_L1;}
08302 Py_DECREF(__pyx_1); __pyx_1 = 0;
08303
08304
08305 __pyx_1 = PyInt_FromLong(1518); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
08306 if (PyObject_SetAttr(__pyx_m, __pyx_n_ETH_LEN_MAX, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
08307 Py_DECREF(__pyx_1); __pyx_1 = 0;
08308
08309
08310 __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_ETH_LEN_MAX); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
08311 __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_ETH_HDR_LEN); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
08312 __pyx_3 = PyNumber_Subtract(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
08313 Py_DECREF(__pyx_1); __pyx_1 = 0;
08314 Py_DECREF(__pyx_2); __pyx_2 = 0;
08315 __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_ETH_CRC_LEN); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
08316 __pyx_2 = PyNumber_Subtract(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
08317 Py_DECREF(__pyx_3); __pyx_3 = 0;
08318 Py_DECREF(__pyx_1); __pyx_1 = 0;
08319 if (PyObject_SetAttr(__pyx_m, __pyx_n_ETH_MTU, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
08320 Py_DECREF(__pyx_2); __pyx_2 = 0;
08321
08322
08323 __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_ETH_LEN_MIN); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; goto __pyx_L1;}
08324 __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_ETH_HDR_LEN); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; goto __pyx_L1;}
08325 __pyx_2 = PyNumber_Subtract(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; goto __pyx_L1;}
08326 Py_DECREF(__pyx_3); __pyx_3 = 0;
08327 Py_DECREF(__pyx_1); __pyx_1 = 0;
08328 __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_ETH_CRC_LEN); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; goto __pyx_L1;}
08329 __pyx_1 = PyNumber_Subtract(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; goto __pyx_L1;}
08330 Py_DECREF(__pyx_2); __pyx_2 = 0;
08331 Py_DECREF(__pyx_3); __pyx_3 = 0;
08332 if (PyObject_SetAttr(__pyx_m, __pyx_n_ETH_MIN, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; goto __pyx_L1;}
08333 Py_DECREF(__pyx_1); __pyx_1 = 0;
08334
08335
08336 __pyx_2 = PyInt_FromLong(512); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; goto __pyx_L1;}
08337 if (PyObject_SetAttr(__pyx_m, __pyx_n_ETH_TYPE_PUP, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; goto __pyx_L1;}
08338 Py_DECREF(__pyx_2); __pyx_2 = 0;
08339
08340
08341 __pyx_3 = PyInt_FromLong(2048); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
08342 if (PyObject_SetAttr(__pyx_m, __pyx_n_ETH_TYPE_IP, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
08343 Py_DECREF(__pyx_3); __pyx_3 = 0;
08344
08345
08346 __pyx_1 = PyInt_FromLong(2054); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L1;}
08347 if (PyObject_SetAttr(__pyx_m, __pyx_n_ETH_TYPE_ARP, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L1;}
08348 Py_DECREF(__pyx_1); __pyx_1 = 0;
08349
08350
08351 __pyx_2 = PyInt_FromLong(32821); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
08352 if (PyObject_SetAttr(__pyx_m, __pyx_n_ETH_TYPE_REVARP, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
08353 Py_DECREF(__pyx_2); __pyx_2 = 0;
08354
08355
08356 __pyx_3 = PyInt_FromLong(33024); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; goto __pyx_L1;}
08357 if (PyObject_SetAttr(__pyx_m, __pyx_n_ETH_TYPE_8021Q, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; goto __pyx_L1;}
08358 Py_DECREF(__pyx_3); __pyx_3 = 0;
08359
08360
08361 __pyx_1 = PyInt_FromLong(34525); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
08362 if (PyObject_SetAttr(__pyx_m, __pyx_n_ETH_TYPE_IPV6, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
08363 Py_DECREF(__pyx_1); __pyx_1 = 0;
08364
08365
08366 __pyx_2 = PyInt_FromLong(34887); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;}
08367 if (PyObject_SetAttr(__pyx_m, __pyx_n_ETH_TYPE_MPLS, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;}
08368 Py_DECREF(__pyx_2); __pyx_2 = 0;
08369
08370
08371 __pyx_3 = PyInt_FromLong(34888); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; goto __pyx_L1;}
08372 if (PyObject_SetAttr(__pyx_m, __pyx_n_ETH_TYPE_MPLS_MCAST, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; goto __pyx_L1;}
08373 Py_DECREF(__pyx_3); __pyx_3 = 0;
08374
08375
08376 __pyx_1 = PyInt_FromLong(34915); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; goto __pyx_L1;}
08377 if (PyObject_SetAttr(__pyx_m, __pyx_n_ETH_TYPE_PPPOEDISC, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; goto __pyx_L1;}
08378 Py_DECREF(__pyx_1); __pyx_1 = 0;
08379
08380
08381 __pyx_2 = PyInt_FromLong(34916); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; goto __pyx_L1;}
08382 if (PyObject_SetAttr(__pyx_m, __pyx_n_ETH_TYPE_PPPOE, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; goto __pyx_L1;}
08383 Py_DECREF(__pyx_2); __pyx_2 = 0;
08384
08385
08386 __pyx_3 = PyInt_FromLong(36864); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
08387 if (PyObject_SetAttr(__pyx_m, __pyx_n_ETH_TYPE_LOOPBACK, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
08388 Py_DECREF(__pyx_3); __pyx_3 = 0;
08389
08390
08391 __pyx_1 = PyString_FromStringAndSize(__pyx_k14,6); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; goto __pyx_L1;}
08392 if (PyObject_SetAttr(__pyx_m, __pyx_n_ETH_ADDR_UNSPEC, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; goto __pyx_L1;}
08393 Py_DECREF(__pyx_1); __pyx_1 = 0;
08394
08395
08396 __pyx_2 = PyString_FromStringAndSize(__pyx_k15,6); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; goto __pyx_L1;}
08397 if (PyObject_SetAttr(__pyx_m, __pyx_n_ETH_ADDR_BROADCAST, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; goto __pyx_L1;}
08398 Py_DECREF(__pyx_2); __pyx_2 = 0;
08399
08400
08401 __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_ETH_ADDR_BROADCAST); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; goto __pyx_L1;}
08402 __pyx_k16 = __pyx_3;
08403 __pyx_3 = 0;
08404 __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_ETH_ADDR_BROADCAST); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; goto __pyx_L1;}
08405 __pyx_k17 = __pyx_1;
08406 __pyx_1 = 0;
08407 __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_ETH_TYPE_IP); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; goto __pyx_L1;}
08408 __pyx_k18 = __pyx_2;
08409 __pyx_2 = 0;
08410
08411
08412 __pyx_4 = PyInt_FromLong(4); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;}
08413 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_ADDR_LEN, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;}
08414 Py_DECREF(__pyx_4); __pyx_4 = 0;
08415
08416
08417 __pyx_4 = PyInt_FromLong(32); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; goto __pyx_L1;}
08418 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_ADDR_BITS, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; goto __pyx_L1;}
08419 Py_DECREF(__pyx_4); __pyx_4 = 0;
08420
08421
08422 __pyx_4 = PyInt_FromLong(20); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; goto __pyx_L1;}
08423 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_HDR_LEN, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; goto __pyx_L1;}
08424 Py_DECREF(__pyx_4); __pyx_4 = 0;
08425
08426
08427 __pyx_4 = PyInt_FromLong(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; goto __pyx_L1;}
08428 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_OPT_LEN, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; goto __pyx_L1;}
08429 Py_DECREF(__pyx_4); __pyx_4 = 0;
08430
08431
08432 __pyx_4 = PyInt_FromLong(40); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; goto __pyx_L1;}
08433 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_OPT_LEN_MAX, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; goto __pyx_L1;}
08434 Py_DECREF(__pyx_4); __pyx_4 = 0;
08435
08436
08437 __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_IP_HDR_LEN); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; goto __pyx_L1;}
08438 __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_IP_OPT_LEN_MAX); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; goto __pyx_L1;}
08439 __pyx_6 = PyNumber_Add(__pyx_4, __pyx_5); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; goto __pyx_L1;}
08440 Py_DECREF(__pyx_4); __pyx_4 = 0;
08441 Py_DECREF(__pyx_5); __pyx_5 = 0;
08442 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_HDR_LEN_MAX, __pyx_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; goto __pyx_L1;}
08443 Py_DECREF(__pyx_6); __pyx_6 = 0;
08444
08445
08446 __pyx_4 = PyInt_FromLong(65535); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; goto __pyx_L1;}
08447 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_LEN_MAX, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; goto __pyx_L1;}
08448 Py_DECREF(__pyx_4); __pyx_4 = 0;
08449
08450
08451 __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_IP_HDR_LEN); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; goto __pyx_L1;}
08452 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_LEN_MIN, __pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; goto __pyx_L1;}
08453 Py_DECREF(__pyx_5); __pyx_5 = 0;
08454
08455
08456 __pyx_6 = PyInt_FromLong(0); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}
08457 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_TOS_DEFAULT, __pyx_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}
08458 Py_DECREF(__pyx_6); __pyx_6 = 0;
08459
08460
08461 __pyx_4 = PyInt_FromLong(32768); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; goto __pyx_L1;}
08462 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_RF, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; goto __pyx_L1;}
08463 Py_DECREF(__pyx_4); __pyx_4 = 0;
08464
08465
08466 __pyx_5 = PyInt_FromLong(16384); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; goto __pyx_L1;}
08467 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_DF, __pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; goto __pyx_L1;}
08468 Py_DECREF(__pyx_5); __pyx_5 = 0;
08469
08470
08471 __pyx_6 = PyInt_FromLong(8192); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; goto __pyx_L1;}
08472 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_MF, __pyx_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; goto __pyx_L1;}
08473 Py_DECREF(__pyx_6); __pyx_6 = 0;
08474
08475
08476 __pyx_4 = PyInt_FromLong(8191); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; goto __pyx_L1;}
08477 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_OFFMASK, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; goto __pyx_L1;}
08478 Py_DECREF(__pyx_4); __pyx_4 = 0;
08479
08480
08481 __pyx_5 = PyInt_FromLong(64); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; goto __pyx_L1;}
08482 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_TTL_DEFAULT, __pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; goto __pyx_L1;}
08483 Py_DECREF(__pyx_5); __pyx_5 = 0;
08484
08485
08486 __pyx_6 = PyInt_FromLong(255); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; goto __pyx_L1;}
08487 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_TTL_MAX, __pyx_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; goto __pyx_L1;}
08488 Py_DECREF(__pyx_6); __pyx_6 = 0;
08489
08490
08491 __pyx_4 = PyInt_FromLong(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; goto __pyx_L1;}
08492 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_PROTO_IP, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; goto __pyx_L1;}
08493 Py_DECREF(__pyx_4); __pyx_4 = 0;
08494
08495
08496 __pyx_5 = PyInt_FromLong(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; goto __pyx_L1;}
08497 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_PROTO_ICMP, __pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; goto __pyx_L1;}
08498 Py_DECREF(__pyx_5); __pyx_5 = 0;
08499
08500
08501 __pyx_6 = PyInt_FromLong(2); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; goto __pyx_L1;}
08502 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_PROTO_IGMP, __pyx_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; goto __pyx_L1;}
08503 Py_DECREF(__pyx_6); __pyx_6 = 0;
08504
08505
08506 __pyx_4 = PyInt_FromLong(6); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; goto __pyx_L1;}
08507 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_PROTO_TCP, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; goto __pyx_L1;}
08508 Py_DECREF(__pyx_4); __pyx_4 = 0;
08509
08510
08511 __pyx_5 = PyInt_FromLong(17); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; goto __pyx_L1;}
08512 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_PROTO_UDP, __pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; goto __pyx_L1;}
08513 Py_DECREF(__pyx_5); __pyx_5 = 0;
08514
08515
08516 __pyx_6 = PyInt_FromLong(41); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;}
08517 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_PROTO_IPV6, __pyx_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;}
08518 Py_DECREF(__pyx_6); __pyx_6 = 0;
08519
08520
08521 __pyx_4 = PyInt_FromLong(47); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}
08522 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_PROTO_GRE, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}
08523 Py_DECREF(__pyx_4); __pyx_4 = 0;
08524
08525
08526 __pyx_5 = PyInt_FromLong(50); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}
08527 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_PROTO_ESP, __pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}
08528 Py_DECREF(__pyx_5); __pyx_5 = 0;
08529
08530
08531 __pyx_6 = PyInt_FromLong(51); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; goto __pyx_L1;}
08532 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_PROTO_AH, __pyx_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; goto __pyx_L1;}
08533 Py_DECREF(__pyx_6); __pyx_6 = 0;
08534
08535
08536 __pyx_4 = PyInt_FromLong(58); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; goto __pyx_L1;}
08537 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_PROTO_ICMPV6, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; goto __pyx_L1;}
08538 Py_DECREF(__pyx_4); __pyx_4 = 0;
08539
08540
08541 __pyx_5 = PyInt_FromLong(255); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;}
08542 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_PROTO_RAW, __pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;}
08543 Py_DECREF(__pyx_5); __pyx_5 = 0;
08544
08545
08546 __pyx_6 = __Pyx_GetName(__pyx_m, __pyx_n_IP_PROTO_RAW); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;}
08547 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_PROTO_RESERVED, __pyx_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;}
08548 Py_DECREF(__pyx_6); __pyx_6 = 0;
08549
08550
08551 __pyx_4 = PyInt_FromLong(255); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; goto __pyx_L1;}
08552 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_PROTO_MAX, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; goto __pyx_L1;}
08553 Py_DECREF(__pyx_4); __pyx_4 = 0;
08554
08555
08556 __pyx_5 = PyString_FromStringAndSize(__pyx_k19,4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; goto __pyx_L1;}
08557 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_ADDR_ANY, __pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; goto __pyx_L1;}
08558 Py_DECREF(__pyx_5); __pyx_5 = 0;
08559
08560
08561 __pyx_6 = PyString_FromStringAndSize(__pyx_k20,4); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; goto __pyx_L1;}
08562 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_ADDR_BROADCAST, __pyx_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; goto __pyx_L1;}
08563 Py_DECREF(__pyx_6); __pyx_6 = 0;
08564
08565
08566 __pyx_4 = PyString_FromStringAndSize(__pyx_k21,4); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; goto __pyx_L1;}
08567 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_ADDR_LOOPBACK, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; goto __pyx_L1;}
08568 Py_DECREF(__pyx_4); __pyx_4 = 0;
08569
08570
08571 __pyx_5 = PyString_FromStringAndSize(__pyx_k22,4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; goto __pyx_L1;}
08572 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_ADDR_MCAST_ALL, __pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; goto __pyx_L1;}
08573 Py_DECREF(__pyx_5); __pyx_5 = 0;
08574
08575
08576 __pyx_6 = PyString_FromStringAndSize(__pyx_k23,4); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; goto __pyx_L1;}
08577 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP_ADDR_MCAST_LOCAL, __pyx_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; goto __pyx_L1;}
08578 Py_DECREF(__pyx_6); __pyx_6 = 0;
08579
08580
08581 __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_IP_TOS_DEFAULT); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; goto __pyx_L1;}
08582 __pyx_k24 = __pyx_4;
08583 __pyx_4 = 0;
08584 __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_IP_HDR_LEN); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; goto __pyx_L1;}
08585 __pyx_k25 = __pyx_5;
08586 __pyx_5 = 0;
08587 __pyx_6 = PyInt_FromLong(0); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; goto __pyx_L1;}
08588 __pyx_k26 = __pyx_6;
08589 __pyx_6 = 0;
08590 __pyx_7 = PyInt_FromLong(0); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; goto __pyx_L1;}
08591 __pyx_k27 = __pyx_7;
08592 __pyx_7 = 0;
08593 __pyx_8 = __Pyx_GetName(__pyx_m, __pyx_n_IP_TTL_DEFAULT); if (!__pyx_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; goto __pyx_L1;}
08594 __pyx_k28 = __pyx_8;
08595 __pyx_8 = 0;
08596 __pyx_9 = __Pyx_GetName(__pyx_m, __pyx_n_IP_PROTO_IP); if (!__pyx_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; goto __pyx_L1;}
08597 __pyx_k29 = __pyx_9;
08598 __pyx_9 = 0;
08599 __pyx_10 = __Pyx_GetName(__pyx_m, __pyx_n_IP_ADDR_ANY); if (!__pyx_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; goto __pyx_L1;}
08600 __pyx_k30 = __pyx_10;
08601 __pyx_10 = 0;
08602 __pyx_11 = __Pyx_GetName(__pyx_m, __pyx_n_IP_ADDR_ANY); if (!__pyx_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; goto __pyx_L1;}
08603 __pyx_k31 = __pyx_11;
08604 __pyx_11 = 0;
08605
08606
08607 __pyx_12 = PyInt_FromLong(16); if (!__pyx_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; goto __pyx_L1;}
08608 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP6_ADDR_LEN, __pyx_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; goto __pyx_L1;}
08609 Py_DECREF(__pyx_12); __pyx_12 = 0;
08610
08611
08612 __pyx_12 = PyInt_FromLong(128); if (!__pyx_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; goto __pyx_L1;}
08613 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP6_ADDR_BITS, __pyx_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; goto __pyx_L1;}
08614 Py_DECREF(__pyx_12); __pyx_12 = 0;
08615
08616
08617 __pyx_12 = PyInt_FromLong(40); if (!__pyx_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; goto __pyx_L1;}
08618 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP6_HDR_LEN, __pyx_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; goto __pyx_L1;}
08619 Py_DECREF(__pyx_12); __pyx_12 = 0;
08620
08621
08622 __pyx_12 = __Pyx_GetName(__pyx_m, __pyx_n_IP6_HDR_LEN); if (!__pyx_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; goto __pyx_L1;}
08623 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP6_LEN_MIN, __pyx_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; goto __pyx_L1;}
08624 Py_DECREF(__pyx_12); __pyx_12 = 0;
08625
08626
08627 __pyx_12 = PyInt_FromLong(65535); if (!__pyx_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; goto __pyx_L1;}
08628 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP6_LEN_MAX, __pyx_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; goto __pyx_L1;}
08629 Py_DECREF(__pyx_12); __pyx_12 = 0;
08630
08631
08632 __pyx_12 = PyInt_FromLong(1280); if (!__pyx_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; goto __pyx_L1;}
08633 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP6_MTU_MIN, __pyx_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; goto __pyx_L1;}
08634 Py_DECREF(__pyx_12); __pyx_12 = 0;
08635
08636
08637 __pyx_12 = PyInt_FromLong(64); if (!__pyx_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; goto __pyx_L1;}
08638 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP6_HLIM_DEFAULT, __pyx_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; goto __pyx_L1;}
08639 Py_DECREF(__pyx_12); __pyx_12 = 0;
08640
08641
08642 __pyx_12 = PyInt_FromLong(255); if (!__pyx_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; goto __pyx_L1;}
08643 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP6_HLIM_MAX, __pyx_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; goto __pyx_L1;}
08644 Py_DECREF(__pyx_12); __pyx_12 = 0;
08645
08646
08647 __pyx_12 = PyString_FromStringAndSize(__pyx_k32,16); if (!__pyx_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; goto __pyx_L1;}
08648 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP6_ADDR_UNSPEC, __pyx_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; goto __pyx_L1;}
08649 Py_DECREF(__pyx_12); __pyx_12 = 0;
08650
08651
08652 __pyx_12 = PyString_FromStringAndSize(__pyx_k33,16); if (!__pyx_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; goto __pyx_L1;}
08653 if (PyObject_SetAttr(__pyx_m, __pyx_n_IP6_ADDR_LOOPBACK, __pyx_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; goto __pyx_L1;}
08654 Py_DECREF(__pyx_12); __pyx_12 = 0;
08655
08656
08657 __pyx_12 = PyInt_FromLong(0); if (!__pyx_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; goto __pyx_L1;}
08658 __pyx_k34 = __pyx_12;
08659 __pyx_12 = 0;
08660 __pyx_13 = PyInt_FromLong(0); if (!__pyx_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; goto __pyx_L1;}
08661 __pyx_k35 = __pyx_13;
08662 __pyx_13 = 0;
08663 __pyx_14 = PyInt_FromLong(0); if (!__pyx_14) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; goto __pyx_L1;}
08664 __pyx_k36 = __pyx_14;
08665 __pyx_14 = 0;
08666 __pyx_15 = __Pyx_GetName(__pyx_m, __pyx_n_IP_PROTO_IPV6); if (!__pyx_15) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; goto __pyx_L1;}
08667 __pyx_k37 = __pyx_15;
08668 __pyx_15 = 0;
08669 __pyx_16 = __Pyx_GetName(__pyx_m, __pyx_n_IP6_HLIM_DEFAULT); if (!__pyx_16) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; goto __pyx_L1;}
08670 __pyx_k38 = __pyx_16;
08671 __pyx_16 = 0;
08672 __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n_IP6_ADDR_UNSPEC); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; goto __pyx_L1;}
08673 __pyx_k39 = __pyx_17;
08674 __pyx_17 = 0;
08675 __pyx_18 = __Pyx_GetName(__pyx_m, __pyx_n_IP6_ADDR_UNSPEC); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; goto __pyx_L1;}
08676 __pyx_k40 = __pyx_18;
08677 __pyx_18 = 0;
08678
08679
08680 __pyx_19 = PyInt_FromLong(0); if (!__pyx_19) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; goto __pyx_L1;}
08681 if (PyObject_SetAttr(__pyx_m, __pyx_n_ADDR_TYPE_NONE, __pyx_19) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; goto __pyx_L1;}
08682 Py_DECREF(__pyx_19); __pyx_19 = 0;
08683
08684
08685 __pyx_19 = PyInt_FromLong(1); if (!__pyx_19) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; goto __pyx_L1;}
08686 if (PyObject_SetAttr(__pyx_m, __pyx_n_ADDR_TYPE_ETH, __pyx_19) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; goto __pyx_L1;}
08687 Py_DECREF(__pyx_19); __pyx_19 = 0;
08688
08689
08690 __pyx_19 = PyInt_FromLong(2); if (!__pyx_19) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; goto __pyx_L1;}
08691 if (PyObject_SetAttr(__pyx_m, __pyx_n_ADDR_TYPE_IP, __pyx_19) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; goto __pyx_L1;}
08692 Py_DECREF(__pyx_19); __pyx_19 = 0;
08693
08694
08695 __pyx_19 = PyInt_FromLong(3); if (!__pyx_19) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; goto __pyx_L1;}
08696 if (PyObject_SetAttr(__pyx_m, __pyx_n_ADDR_TYPE_IP6, __pyx_19) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; goto __pyx_L1;}
08697 Py_DECREF(__pyx_19); __pyx_19 = 0;
08698
08699
08700 Py_INCREF(Py_None);
08701 __pyx_k41 = Py_None;
08702 __pyx_19 = __Pyx_GetName(__pyx_m, __pyx_n_ADDR_TYPE_NONE); if (!__pyx_19) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; goto __pyx_L1;}
08703 __pyx_k42 = __pyx_19;
08704 __pyx_19 = 0;
08705
08706
08707 __pyx_20 = PyInt_FromLong(8); if (!__pyx_20) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; goto __pyx_L1;}
08708 if (PyObject_SetAttr(__pyx_m, __pyx_n_ARP_HDR_LEN, __pyx_20) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; goto __pyx_L1;}
08709 Py_DECREF(__pyx_20); __pyx_20 = 0;
08710
08711
08712 __pyx_20 = PyInt_FromLong(20); if (!__pyx_20) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; goto __pyx_L1;}
08713 if (PyObject_SetAttr(__pyx_m, __pyx_n_ARP_ETHIP_LEN, __pyx_20) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; goto __pyx_L1;}
08714 Py_DECREF(__pyx_20); __pyx_20 = 0;
08715
08716
08717 __pyx_20 = PyInt_FromLong(1); if (!__pyx_20) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; goto __pyx_L1;}
08718 if (PyObject_SetAttr(__pyx_m, __pyx_n_ARP_HRD_ETH, __pyx_20) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; goto __pyx_L1;}
08719 Py_DECREF(__pyx_20); __pyx_20 = 0;
08720
08721
08722 __pyx_20 = PyInt_FromLong(6); if (!__pyx_20) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; goto __pyx_L1;}
08723 if (PyObject_SetAttr(__pyx_m, __pyx_n_ARP_HRD_IEEE802, __pyx_20) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; goto __pyx_L1;}
08724 Py_DECREF(__pyx_20); __pyx_20 = 0;
08725
08726
08727 __pyx_20 = PyInt_FromLong(2048); if (!__pyx_20) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; goto __pyx_L1;}
08728 if (PyObject_SetAttr(__pyx_m, __pyx_n_ARP_PRO_IP, __pyx_20) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; goto __pyx_L1;}
08729 Py_DECREF(__pyx_20); __pyx_20 = 0;
08730
08731
08732 __pyx_20 = PyInt_FromLong(1); if (!__pyx_20) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; goto __pyx_L1;}
08733 if (PyObject_SetAttr(__pyx_m, __pyx_n_ARP_OP_REQUEST, __pyx_20) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; goto __pyx_L1;}
08734 Py_DECREF(__pyx_20); __pyx_20 = 0;
08735
08736
08737 __pyx_20 = PyInt_FromLong(2); if (!__pyx_20) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; goto __pyx_L1;}
08738 if (PyObject_SetAttr(__pyx_m, __pyx_n_ARP_OP_REPLY, __pyx_20) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; goto __pyx_L1;}
08739 Py_DECREF(__pyx_20); __pyx_20 = 0;
08740
08741
08742 __pyx_20 = PyInt_FromLong(3); if (!__pyx_20) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; goto __pyx_L1;}
08743 if (PyObject_SetAttr(__pyx_m, __pyx_n_ARP_OP_REVREQUEST, __pyx_20) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; goto __pyx_L1;}
08744 Py_DECREF(__pyx_20); __pyx_20 = 0;
08745
08746
08747 __pyx_20 = PyInt_FromLong(4); if (!__pyx_20) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; goto __pyx_L1;}
08748 if (PyObject_SetAttr(__pyx_m, __pyx_n_ARP_OP_REVREPLY, __pyx_20) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; goto __pyx_L1;}
08749 Py_DECREF(__pyx_20); __pyx_20 = 0;
08750
08751
08752 Py_INCREF(Py_None);
08753 __pyx_k43 = Py_None;
08754
08755
08756 __pyx_20 = __Pyx_GetName(__pyx_m, __pyx_n_ARP_OP_REQUEST); if (!__pyx_20) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; goto __pyx_L1;}
08757 __pyx_k44 = __pyx_20;
08758 __pyx_20 = 0;
08759 __pyx_21 = __Pyx_GetName(__pyx_m, __pyx_n_ETH_ADDR_UNSPEC); if (!__pyx_21) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; goto __pyx_L1;}
08760 __pyx_k45 = __pyx_21;
08761 __pyx_21 = 0;
08762 __pyx_22 = __Pyx_GetName(__pyx_m, __pyx_n_IP_ADDR_ANY); if (!__pyx_22) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; goto __pyx_L1;}
08763 __pyx_k46 = __pyx_22;
08764 __pyx_22 = 0;
08765 __pyx_23 = __Pyx_GetName(__pyx_m, __pyx_n_ETH_ADDR_UNSPEC); if (!__pyx_23) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; goto __pyx_L1;}
08766 __pyx_k47 = __pyx_23;
08767 __pyx_23 = 0;
08768 __pyx_24 = __Pyx_GetName(__pyx_m, __pyx_n_IP_ADDR_ANY); if (!__pyx_24) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; goto __pyx_L1;}
08769 __pyx_k48 = __pyx_24;
08770 __pyx_24 = 0;
08771
08772
08773 __pyx_25 = PyInt_FromLong(20); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;}
08774 if (PyObject_SetAttr(__pyx_m, __pyx_n_TCP_HDR_LEN, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;}
08775 Py_DECREF(__pyx_25); __pyx_25 = 0;
08776
08777
08778 __pyx_25 = PyInt_FromLong(1); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}
08779 if (PyObject_SetAttr(__pyx_m, __pyx_n_TH_FIN, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}
08780 Py_DECREF(__pyx_25); __pyx_25 = 0;
08781
08782
08783 __pyx_25 = PyInt_FromLong(2); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}
08784 if (PyObject_SetAttr(__pyx_m, __pyx_n_TH_SYN, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}
08785 Py_DECREF(__pyx_25); __pyx_25 = 0;
08786
08787
08788 __pyx_25 = PyInt_FromLong(4); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}
08789 if (PyObject_SetAttr(__pyx_m, __pyx_n_TH_RST, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}
08790 Py_DECREF(__pyx_25); __pyx_25 = 0;
08791
08792
08793 __pyx_25 = PyInt_FromLong(8); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}
08794 if (PyObject_SetAttr(__pyx_m, __pyx_n_TH_PUSH, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}
08795 Py_DECREF(__pyx_25); __pyx_25 = 0;
08796
08797
08798 __pyx_25 = PyInt_FromLong(16); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}
08799 if (PyObject_SetAttr(__pyx_m, __pyx_n_TH_ACK, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}
08800 Py_DECREF(__pyx_25); __pyx_25 = 0;
08801
08802
08803 __pyx_25 = PyInt_FromLong(32); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}
08804 if (PyObject_SetAttr(__pyx_m, __pyx_n_TH_URG, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}
08805 Py_DECREF(__pyx_25); __pyx_25 = 0;
08806
08807
08808 __pyx_25 = PyInt_FromLong(64); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; goto __pyx_L1;}
08809 if (PyObject_SetAttr(__pyx_m, __pyx_n_TH_ECE, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; goto __pyx_L1;}
08810 Py_DECREF(__pyx_25); __pyx_25 = 0;
08811
08812
08813 __pyx_25 = PyInt_FromLong(128); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;}
08814 if (PyObject_SetAttr(__pyx_m, __pyx_n_TH_CWR, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;}
08815 Py_DECREF(__pyx_25); __pyx_25 = 0;
08816
08817
08818 __pyx_25 = PyInt_FromLong(65535); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; goto __pyx_L1;}
08819 if (PyObject_SetAttr(__pyx_m, __pyx_n_TCP_PORT_MAX, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; goto __pyx_L1;}
08820 Py_DECREF(__pyx_25); __pyx_25 = 0;
08821
08822
08823 __pyx_25 = PyInt_FromLong(65535); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}
08824 if (PyObject_SetAttr(__pyx_m, __pyx_n_TCP_WIN_MAX, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}
08825 Py_DECREF(__pyx_25); __pyx_25 = 0;
08826
08827
08828 __pyx_25 = PyInt_FromLong(0); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; goto __pyx_L1;}
08829 if (PyObject_SetAttr(__pyx_m, __pyx_n_TCP_OPT_EOL, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; goto __pyx_L1;}
08830 Py_DECREF(__pyx_25); __pyx_25 = 0;
08831
08832
08833 __pyx_25 = PyInt_FromLong(1); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;}
08834 if (PyObject_SetAttr(__pyx_m, __pyx_n_TCP_OPT_NOP, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;}
08835 Py_DECREF(__pyx_25); __pyx_25 = 0;
08836
08837
08838 __pyx_25 = PyInt_FromLong(2); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}
08839 if (PyObject_SetAttr(__pyx_m, __pyx_n_TCP_OPT_MSS, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}
08840 Py_DECREF(__pyx_25); __pyx_25 = 0;
08841
08842
08843 __pyx_25 = PyInt_FromLong(3); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}
08844 if (PyObject_SetAttr(__pyx_m, __pyx_n_TCP_OPT_WSCALE, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}
08845 Py_DECREF(__pyx_25); __pyx_25 = 0;
08846
08847
08848 __pyx_25 = PyInt_FromLong(4); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; goto __pyx_L1;}
08849 if (PyObject_SetAttr(__pyx_m, __pyx_n_TCP_OPT_SACKOK, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; goto __pyx_L1;}
08850 Py_DECREF(__pyx_25); __pyx_25 = 0;
08851
08852
08853 __pyx_25 = PyInt_FromLong(5); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; goto __pyx_L1;}
08854 if (PyObject_SetAttr(__pyx_m, __pyx_n_TCP_OPT_SACK, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; goto __pyx_L1;}
08855 Py_DECREF(__pyx_25); __pyx_25 = 0;
08856
08857
08858 __pyx_25 = PyInt_FromLong(6); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; goto __pyx_L1;}
08859 if (PyObject_SetAttr(__pyx_m, __pyx_n_TCP_OPT_ECHO, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; goto __pyx_L1;}
08860 Py_DECREF(__pyx_25); __pyx_25 = 0;
08861
08862
08863 __pyx_25 = PyInt_FromLong(7); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; goto __pyx_L1;}
08864 if (PyObject_SetAttr(__pyx_m, __pyx_n_TCP_OPT_ECHOREPLY, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; goto __pyx_L1;}
08865 Py_DECREF(__pyx_25); __pyx_25 = 0;
08866
08867
08868 __pyx_25 = PyInt_FromLong(8); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; goto __pyx_L1;}
08869 if (PyObject_SetAttr(__pyx_m, __pyx_n_TCP_OPT_TIMESTAMP, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; goto __pyx_L1;}
08870 Py_DECREF(__pyx_25); __pyx_25 = 0;
08871
08872
08873 __pyx_25 = PyInt_FromLong(9); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; goto __pyx_L1;}
08874 if (PyObject_SetAttr(__pyx_m, __pyx_n_TCP_OPT_POCONN, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; goto __pyx_L1;}
08875 Py_DECREF(__pyx_25); __pyx_25 = 0;
08876
08877
08878 __pyx_25 = PyInt_FromLong(10); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; goto __pyx_L1;}
08879 if (PyObject_SetAttr(__pyx_m, __pyx_n_TCP_OPT_POSVC, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; goto __pyx_L1;}
08880 Py_DECREF(__pyx_25); __pyx_25 = 0;
08881
08882
08883 __pyx_25 = PyInt_FromLong(11); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; goto __pyx_L1;}
08884 if (PyObject_SetAttr(__pyx_m, __pyx_n_TCP_OPT_CC, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; goto __pyx_L1;}
08885 Py_DECREF(__pyx_25); __pyx_25 = 0;
08886
08887
08888 __pyx_25 = PyInt_FromLong(12); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; goto __pyx_L1;}
08889 if (PyObject_SetAttr(__pyx_m, __pyx_n_TCP_OPT_CCNEW, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; goto __pyx_L1;}
08890 Py_DECREF(__pyx_25); __pyx_25 = 0;
08891
08892
08893 __pyx_25 = PyInt_FromLong(13); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}
08894 if (PyObject_SetAttr(__pyx_m, __pyx_n_TCP_OPT_CCECHO, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}
08895 Py_DECREF(__pyx_25); __pyx_25 = 0;
08896
08897
08898 __pyx_25 = PyInt_FromLong(14); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}
08899 if (PyObject_SetAttr(__pyx_m, __pyx_n_TCP_OPT_ALTSUM, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}
08900 Py_DECREF(__pyx_25); __pyx_25 = 0;
08901
08902
08903 __pyx_25 = PyInt_FromLong(15); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; goto __pyx_L1;}
08904 if (PyObject_SetAttr(__pyx_m, __pyx_n_TCP_OPT_ALTSUMDATA, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; goto __pyx_L1;}
08905 Py_DECREF(__pyx_25); __pyx_25 = 0;
08906
08907
08908 __pyx_25 = PyInt_FromLong(16); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; goto __pyx_L1;}
08909 if (PyObject_SetAttr(__pyx_m, __pyx_n_TCP_OPT_SKEETER, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; goto __pyx_L1;}
08910 Py_DECREF(__pyx_25); __pyx_25 = 0;
08911
08912
08913 __pyx_25 = PyInt_FromLong(17); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; goto __pyx_L1;}
08914 if (PyObject_SetAttr(__pyx_m, __pyx_n_TCP_OPT_BUBBA, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; goto __pyx_L1;}
08915 Py_DECREF(__pyx_25); __pyx_25 = 0;
08916
08917
08918 __pyx_25 = PyInt_FromLong(18); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}
08919 if (PyObject_SetAttr(__pyx_m, __pyx_n_TCP_OPT_TRAILSUM, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}
08920 Py_DECREF(__pyx_25); __pyx_25 = 0;
08921
08922
08923 __pyx_25 = PyInt_FromLong(19); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; goto __pyx_L1;}
08924 if (PyObject_SetAttr(__pyx_m, __pyx_n_TCP_OPT_MD5, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; goto __pyx_L1;}
08925 Py_DECREF(__pyx_25); __pyx_25 = 0;
08926
08927
08928 __pyx_25 = PyInt_FromLong(20); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; goto __pyx_L1;}
08929 if (PyObject_SetAttr(__pyx_m, __pyx_n_TCP_OPT_SCPS, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; goto __pyx_L1;}
08930 Py_DECREF(__pyx_25); __pyx_25 = 0;
08931
08932
08933 __pyx_25 = PyInt_FromLong(21); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; goto __pyx_L1;}
08934 if (PyObject_SetAttr(__pyx_m, __pyx_n_TCP_OPT_SNACK, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; goto __pyx_L1;}
08935 Py_DECREF(__pyx_25); __pyx_25 = 0;
08936
08937
08938 __pyx_25 = PyInt_FromLong(22); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; goto __pyx_L1;}
08939 if (PyObject_SetAttr(__pyx_m, __pyx_n_TCP_OPT_REC, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; goto __pyx_L1;}
08940 Py_DECREF(__pyx_25); __pyx_25 = 0;
08941
08942
08943 __pyx_25 = PyInt_FromLong(23); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; goto __pyx_L1;}
08944 if (PyObject_SetAttr(__pyx_m, __pyx_n_TCP_OPT_CORRUPT, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; goto __pyx_L1;}
08945 Py_DECREF(__pyx_25); __pyx_25 = 0;
08946
08947
08948 __pyx_25 = PyInt_FromLong(24); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; goto __pyx_L1;}
08949 if (PyObject_SetAttr(__pyx_m, __pyx_n_TCP_OPT_SNAP, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; goto __pyx_L1;}
08950 Py_DECREF(__pyx_25); __pyx_25 = 0;
08951
08952
08953 __pyx_25 = PyInt_FromLong(26); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; goto __pyx_L1;}
08954 if (PyObject_SetAttr(__pyx_m, __pyx_n_TCP_OPT_TCPCOMP, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; goto __pyx_L1;}
08955 Py_DECREF(__pyx_25); __pyx_25 = 0;
08956
08957
08958 __pyx_25 = PyInt_FromLong(27); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; goto __pyx_L1;}
08959 if (PyObject_SetAttr(__pyx_m, __pyx_n_TCP_OPT_MAX, __pyx_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; goto __pyx_L1;}
08960 Py_DECREF(__pyx_25); __pyx_25 = 0;
08961
08962
08963 __pyx_25 = PyInt_FromLong(1); if (!__pyx_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; goto __pyx_L1;}
08964 __pyx_k49 = __pyx_25;
08965 __pyx_25 = 0;
08966 __pyx_26 = PyInt_FromLong(0); if (!__pyx_26) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; goto __pyx_L1;}
08967 __pyx_k50 = __pyx_26;
08968 __pyx_26 = 0;
08969 __pyx_27 = __Pyx_GetName(__pyx_m, __pyx_n_TH_SYN); if (!__pyx_27) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; goto __pyx_L1;}
08970 __pyx_k51 = __pyx_27;
08971 __pyx_27 = 0;
08972 __pyx_28 = __Pyx_GetName(__pyx_m, __pyx_n_TCP_WIN_MAX); if (!__pyx_28) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; goto __pyx_L1;}
08973 __pyx_k52 = __pyx_28;
08974 __pyx_28 = 0;
08975 __pyx_29 = PyInt_FromLong(0); if (!__pyx_29) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; goto __pyx_L1;}
08976 __pyx_k53 = __pyx_29;
08977 __pyx_29 = 0;
08978
08979
08980 __pyx_30 = PyInt_FromLong(8); if (!__pyx_30) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}
08981 if (PyObject_SetAttr(__pyx_m, __pyx_n_UDP_HDR_LEN, __pyx_30) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}
08982 Py_DECREF(__pyx_30); __pyx_30 = 0;
08983
08984
08985 __pyx_30 = PyInt_FromLong(65535); if (!__pyx_30) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; goto __pyx_L1;}
08986 if (PyObject_SetAttr(__pyx_m, __pyx_n_UDP_PORT_MAX, __pyx_30) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; goto __pyx_L1;}
08987 Py_DECREF(__pyx_30); __pyx_30 = 0;
08988
08989
08990 __pyx_30 = __Pyx_GetName(__pyx_m, __pyx_n_UDP_HDR_LEN); if (!__pyx_30) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; goto __pyx_L1;}
08991 __pyx_k54 = __pyx_30;
08992 __pyx_30 = 0;
08993
08994
08995 __pyx_31 = PyInt_FromLong(1); if (!__pyx_31) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}
08996 if (PyObject_SetAttr(__pyx_m, __pyx_n_INTF_TYPE_OTHER, __pyx_31) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}
08997 Py_DECREF(__pyx_31); __pyx_31 = 0;
08998
08999
09000 __pyx_31 = PyInt_FromLong(6); if (!__pyx_31) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; goto __pyx_L1;}
09001 if (PyObject_SetAttr(__pyx_m, __pyx_n_INTF_TYPE_ETH, __pyx_31) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; goto __pyx_L1;}
09002 Py_DECREF(__pyx_31); __pyx_31 = 0;
09003
09004
09005 __pyx_31 = PyInt_FromLong(24); if (!__pyx_31) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}
09006 if (PyObject_SetAttr(__pyx_m, __pyx_n_INTF_TYPE_LOOPBACK, __pyx_31) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}
09007 Py_DECREF(__pyx_31); __pyx_31 = 0;
09008
09009
09010 __pyx_31 = PyInt_FromLong(53); if (!__pyx_31) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; goto __pyx_L1;}
09011 if (PyObject_SetAttr(__pyx_m, __pyx_n_INTF_TYPE_TUN, __pyx_31) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; goto __pyx_L1;}
09012 Py_DECREF(__pyx_31); __pyx_31 = 0;
09013
09014
09015 __pyx_31 = PyInt_FromLong(1); if (!__pyx_31) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; goto __pyx_L1;}
09016 if (PyObject_SetAttr(__pyx_m, __pyx_n_INTF_FLAG_UP, __pyx_31) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; goto __pyx_L1;}
09017 Py_DECREF(__pyx_31); __pyx_31 = 0;
09018
09019
09020 __pyx_31 = PyInt_FromLong(2); if (!__pyx_31) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}
09021 if (PyObject_SetAttr(__pyx_m, __pyx_n_INTF_FLAG_LOOPBACK, __pyx_31) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}
09022 Py_DECREF(__pyx_31); __pyx_31 = 0;
09023
09024
09025 __pyx_31 = PyInt_FromLong(4); if (!__pyx_31) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}
09026 if (PyObject_SetAttr(__pyx_m, __pyx_n_INTF_FLAG_POINTOPOINT, __pyx_31) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}
09027 Py_DECREF(__pyx_31); __pyx_31 = 0;
09028
09029
09030 __pyx_31 = PyInt_FromLong(8); if (!__pyx_31) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;}
09031 if (PyObject_SetAttr(__pyx_m, __pyx_n_INTF_FLAG_NOARP, __pyx_31) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;}
09032 Py_DECREF(__pyx_31); __pyx_31 = 0;
09033
09034
09035 __pyx_31 = PyInt_FromLong(16); if (!__pyx_31) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}
09036 if (PyObject_SetAttr(__pyx_m, __pyx_n_INTF_FLAG_BROADCAST, __pyx_31) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}
09037 Py_DECREF(__pyx_31); __pyx_31 = 0;
09038
09039
09040 __pyx_31 = PyInt_FromLong(32); if (!__pyx_31) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; goto __pyx_L1;}
09041 if (PyObject_SetAttr(__pyx_m, __pyx_n_INTF_FLAG_MULTICAST, __pyx_31) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; goto __pyx_L1;}
09042 Py_DECREF(__pyx_31); __pyx_31 = 0;
09043
09044
09045 Py_INCREF(Py_None);
09046 __pyx_k55 = Py_None;
09047
09048
09049 Py_INCREF(Py_None);
09050 __pyx_k56 = Py_None;
09051
09052
09053 __pyx_31 = PyInt_FromLong(1); if (!__pyx_31) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; goto __pyx_L1;}
09054 if (PyObject_SetAttr(__pyx_m, __pyx_n_FW_OP_ALLOW, __pyx_31) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; goto __pyx_L1;}
09055 Py_DECREF(__pyx_31); __pyx_31 = 0;
09056
09057
09058 __pyx_31 = PyInt_FromLong(2); if (!__pyx_31) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; goto __pyx_L1;}
09059 if (PyObject_SetAttr(__pyx_m, __pyx_n_FW_OP_BLOCK, __pyx_31) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; goto __pyx_L1;}
09060 Py_DECREF(__pyx_31); __pyx_31 = 0;
09061
09062
09063 __pyx_31 = PyInt_FromLong(1); if (!__pyx_31) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; goto __pyx_L1;}
09064 if (PyObject_SetAttr(__pyx_m, __pyx_n_FW_DIR_IN, __pyx_31) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; goto __pyx_L1;}
09065 Py_DECREF(__pyx_31); __pyx_31 = 0;
09066
09067
09068 __pyx_31 = PyInt_FromLong(2); if (!__pyx_31) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1187; goto __pyx_L1;}
09069 if (PyObject_SetAttr(__pyx_m, __pyx_n_FW_DIR_OUT, __pyx_31) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1187; goto __pyx_L1;}
09070 Py_DECREF(__pyx_31); __pyx_31 = 0;
09071
09072
09073 Py_INCREF(Py_None);
09074 __pyx_k57 = Py_None;
09075
09076
09077 Py_INCREF(Py_None);
09078 __pyx_k58 = Py_None;
09079
09080
09081 __pyx_31 = PyInt_FromLong(1500); if (!__pyx_31) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1490; goto __pyx_L1;}
09082 __pyx_k59 = __pyx_31;
09083 __pyx_31 = 0;
09084
09085
09086 return;
09087 __pyx_L1:;
09088 Py_XDECREF(__pyx_1);
09089 Py_XDECREF(__pyx_2);
09090 Py_XDECREF(__pyx_3);
09091 Py_XDECREF(__pyx_4);
09092 Py_XDECREF(__pyx_5);
09093 Py_XDECREF(__pyx_6);
09094 Py_XDECREF(__pyx_7);
09095 Py_XDECREF(__pyx_8);
09096 Py_XDECREF(__pyx_9);
09097 Py_XDECREF(__pyx_10);
09098 Py_XDECREF(__pyx_11);
09099 Py_XDECREF(__pyx_12);
09100 Py_XDECREF(__pyx_13);
09101 Py_XDECREF(__pyx_14);
09102 Py_XDECREF(__pyx_15);
09103 Py_XDECREF(__pyx_16);
09104 Py_XDECREF(__pyx_17);
09105 Py_XDECREF(__pyx_18);
09106 Py_XDECREF(__pyx_19);
09107 Py_XDECREF(__pyx_20);
09108 Py_XDECREF(__pyx_21);
09109 Py_XDECREF(__pyx_22);
09110 Py_XDECREF(__pyx_23);
09111 Py_XDECREF(__pyx_24);
09112 Py_XDECREF(__pyx_25);
09113 Py_XDECREF(__pyx_26);
09114 Py_XDECREF(__pyx_27);
09115 Py_XDECREF(__pyx_28);
09116 Py_XDECREF(__pyx_29);
09117 Py_XDECREF(__pyx_30);
09118 Py_XDECREF(__pyx_31);
09119 __Pyx_AddTraceback("dnet");
09120 }
09121
09122 static char *__pyx_filenames[] = {
09123 "dnet.pyx",
09124 };
09125 statichere char **__pyx_f = __pyx_filenames;
09126
09127
09128
09129 static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name) {
09130 if (!type) {
09131 PyErr_Format(PyExc_SystemError, "Missing type object");
09132 return 0;
09133 }
09134 if ((none_allowed && obj == Py_None) || PyObject_TypeCheck(obj, type))
09135 return 1;
09136 PyErr_Format(PyExc_TypeError,
09137 "Argument '%s' has incorrect type (expected %s, got %s)",
09138 name, type->tp_name, obj->ob_type->tp_name);
09139 return 0;
09140 }
09141
09142 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
09143 PyObject *result;
09144 result = PyObject_GetAttr(dict, name);
09145 if (!result)
09146 PyErr_SetObject(PyExc_NameError, name);
09147 return result;
09148 }
09149
09150 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
09151 Py_XINCREF(type);
09152 Py_XINCREF(value);
09153 Py_XINCREF(tb);
09154
09155 if (tb == Py_None) {
09156 Py_DECREF(tb);
09157 tb = 0;
09158 }
09159 else if (tb != NULL && !PyTraceBack_Check(tb)) {
09160 PyErr_SetString(PyExc_TypeError,
09161 "raise: arg 3 must be a traceback or None");
09162 goto raise_error;
09163 }
09164
09165 if (value == NULL) {
09166 value = Py_None;
09167 Py_INCREF(value);
09168 }
09169
09170 while (PyTuple_Check(type) && PyTuple_Size(type) > 0) {
09171 PyObject *tmp = type;
09172 type = PyTuple_GET_ITEM(type, 0);
09173 Py_INCREF(type);
09174 Py_DECREF(tmp);
09175 }
09176 if (PyString_Check(type))
09177 ;
09178 else if (PyClass_Check(type))
09179 ;
09180 else if (PyInstance_Check(type)) {
09181
09182 if (value != Py_None) {
09183 PyErr_SetString(PyExc_TypeError,
09184 "instance exception may not have a separate value");
09185 goto raise_error;
09186 }
09187 else {
09188
09189 Py_DECREF(value);
09190 value = type;
09191 type = (PyObject*) ((PyInstanceObject*)type)->in_class;
09192 Py_INCREF(type);
09193 }
09194 }
09195 else {
09196
09197
09198 PyErr_Format(PyExc_TypeError,
09199 "exceptions must be strings, classes, or "
09200 "instances, not %s", type->ob_type->tp_name);
09201 goto raise_error;
09202 }
09203 PyErr_Restore(type, value, tb);
09204 return;
09205 raise_error:
09206 Py_XDECREF(value);
09207 Py_XDECREF(type);
09208 Py_XDECREF(tb);
09209 return;
09210 }
09211
09212 static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
09213 if (!type) {
09214 PyErr_Format(PyExc_SystemError, "Missing type object");
09215 return 0;
09216 }
09217 if (obj == Py_None || PyObject_TypeCheck(obj, type))
09218 return 1;
09219 PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s",
09220 obj->ob_type->tp_name, type->tp_name);
09221 return 0;
09222 }
09223
09224 static void __Pyx_UnpackError(void) {
09225 PyErr_SetString(PyExc_ValueError, "unpack sequence of wrong size");
09226 }
09227
09228 static PyObject *__Pyx_UnpackItem(PyObject *seq, int i) {
09229 PyObject *item;
09230 if (!(item = PySequence_GetItem(seq, i))) {
09231 if (PyErr_ExceptionMatches(PyExc_IndexError))
09232 __Pyx_UnpackError();
09233 }
09234 return item;
09235 }
09236
09237 static int __Pyx_EndUnpack(PyObject *seq, int i) {
09238 PyObject *item;
09239 if (item = PySequence_GetItem(seq, i)) {
09240 Py_DECREF(item);
09241 __Pyx_UnpackError();
09242 return -1;
09243 }
09244 PyErr_Clear();
09245 return 0;
09246 }
09247
09248 static int __Pyx_InternStrings(__Pyx_InternTabEntry *t) {
09249 while (t->p) {
09250 *t->p = PyString_InternFromString(t->s);
09251 if (!*t->p)
09252 return -1;
09253 ++t;
09254 }
09255 return 0;
09256 }
09257
09258 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
09259 while (t->p) {
09260 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
09261 if (!*t->p)
09262 return -1;
09263 ++t;
09264 }
09265 return 0;
09266 }
09267
09268 #include "compile.h"
09269 #include "frameobject.h"
09270 #include "traceback.h"
09271
09272 static void __Pyx_AddTraceback(char *funcname) {
09273 PyObject *py_srcfile = 0;
09274 PyObject *py_funcname = 0;
09275 PyObject *py_globals = 0;
09276 PyObject *empty_tuple = 0;
09277 PyObject *empty_string = 0;
09278 PyCodeObject *py_code = 0;
09279 PyFrameObject *py_frame = 0;
09280
09281 py_srcfile = PyString_FromString(__pyx_filename);
09282 if (!py_srcfile) goto bad;
09283 py_funcname = PyString_FromString(funcname);
09284 if (!py_funcname) goto bad;
09285 py_globals = PyModule_GetDict(__pyx_m);
09286 if (!py_globals) goto bad;
09287 empty_tuple = PyTuple_New(0);
09288 if (!empty_tuple) goto bad;
09289 empty_string = PyString_FromString("");
09290 if (!empty_string) goto bad;
09291 py_code = PyCode_New(
09292 0,
09293 0,
09294 0,
09295 0,
09296 empty_string,
09297 empty_tuple,
09298 empty_tuple,
09299 empty_tuple,
09300 empty_tuple,
09301 empty_tuple,
09302 py_srcfile,
09303 py_funcname,
09304 __pyx_lineno,
09305 empty_string
09306 );
09307 if (!py_code) goto bad;
09308 py_frame = PyFrame_New(
09309 PyThreadState_Get(),
09310 py_code,
09311 py_globals,
09312 0
09313 );
09314 if (!py_frame) goto bad;
09315 py_frame->f_lineno = __pyx_lineno;
09316 PyTraceBack_Here(py_frame);
09317 bad:
09318 Py_XDECREF(py_srcfile);
09319 Py_XDECREF(py_funcname);
09320 Py_XDECREF(empty_tuple);
09321 Py_XDECREF(empty_string);
09322 Py_XDECREF(py_code);
09323 Py_XDECREF(py_frame);
09324 }