PyArg_ParseTuple and Py_BuildValue question
Hello fellow pythonistas, I'm currently writing a simple python SCTP module in C. So far it works sending and receiving strings from it. The C sctp function sctp_sendmsg() has been wrapped and my function looks like this: sendMessage(PyObject *self, PyObject *args) { const char *msg = ""; if (!PyArg_ParseTuple(args, "s", &msg)) return NULL; snprintf(buffer, 1025, msg); ret = sctp_sendmsg(connSock, (void *)buffer, (size_t)strlen(buffer), 0, 0, 0x03000000, 0, 0, 0, 0); return Py_BuildValue("b", ""); } I'm going to construct an SS7 packet in python using struct.pack(). Here's the question, how am I going to pass the packet I wrote in python to my module and back? I already asked this question in comp.lang.python but so far no responses yet. I hope anyone can point me to the right direction. Thanks in advance. --- Alvin Delagon
On Wed, Apr 9, 2008 at 8:23 PM, Alvin Delagon
I'm going to construct an SS7 packet in python using struct.pack(). Here's the question, how am I going to pass the packet I wrote in python to my module and back? I already asked this question in comp.lang.python but so far no responses yet. I hope anyone can point me to the right direction. Thanks in advance.
What exactly is your problem? -- Cheers, Benjamin Peterson
Alvin Delagon schrieb:
I'm going to construct an SS7 packet in python using struct.pack(). Here's the question, how am I going to pass the packet I wrote in python to my module and back? I already asked this question in comp.lang.python but so far no responses yet. I hope anyone can point me to the right direction. Thanks in advance.
The Python developer list is meant for the development OF Python, not WITH Python. Please use the general Python user list to get help. Christian
On Thu, 2008-04-10 at 09:23 +0800, Alvin Delagon wrote:
I'm currently writing a simple python SCTP module in C. So far it works sending and receiving strings from it. [...] I'm going to construct an SS7 packet in python using struct.pack(). Here's the question, how am I going to pass the packet I wrote in python to my module and back? I already asked this question in comp.lang.python but so far no responses yet.
Have you tried posting to the C API mailing list? http://mail.python.org/mailman/listinfo/capi-sig
He emailed me back saying that he found the solution to his problem. -- Cheers, Benjamin Peterson
participants (4)
-
Alvin Delagon
-
Benjamin Peterson
-
Christian Heimes
-
Hrvoje Nikšić