source:
ResearchApps/Measurement/install_files/pcapy_warpnet_patch.diff
Last change on this file was 1581, checked in by sgupta, 15 years ago | |
---|---|
File size: 1.4 KB |
-
pcapobj.cc
old new 58 58 static PyObject* p_getnonblock(register pcapobject* pp, PyObject* args); 59 59 static PyObject* p_dump_open(register pcapobject* pp, PyObject* args); 60 60 static PyObject* p_sendpacket(register pcapobject* pp, PyObject* args); 61 static PyObject* p_inject(register pcapobject* pp, PyObject* args); 61 62 62 63 63 64 static PyMethodDef p_methods[] = { … … 72 73 {"setnonblock", (PyCFunction) p_setnonblock, METH_VARARGS, "puts into `non-blocking' mode, or take it out, depending on the argument"}, 73 74 {"dump_open", (PyCFunction) p_dump_open, METH_VARARGS, "creates a dumper object"}, 74 75 {"sendpacket", (PyCFunction) p_sendpacket, METH_VARARGS, "sends a packet through the interface"}, 76 {"inject", (PyCFunction) p_inject, METH_VARARGS, "sends a packet over pcap"}, 75 77 {NULL, NULL} /* sentinel */ 76 78 }; 77 79 … … 436 438 Py_INCREF(Py_None); 437 439 return Py_None; 438 440 } 441 442 static PyObject* 443 p_inject(register pcapobject* pp, PyObject* args) 444 { 445 int len; 446 const char *data; 447 int status; 448 449 if (pp->ob_type != &Pcaptype) 450 { 451 PyErr_SetString(PcapError, "Not a pcap object"); 452 return NULL; 453 } 454 455 if (!PyArg_ParseTuple(args, "s#", &data, &len)) 456 return NULL; 457 458 status = pcap_inject(pp->pcap, data, len); 459 return Py_BuildValue("i", status); 460 }
Note: See TracBrowser
for help on using the repository browser.