I need a simple way to pass a C struct to a Python function. I have embedded Python into a game server, and I intend to write game logic in Python. I've scoured Google and mailing lists and found nothing useful. I have a complex structure in C (with pointers to other relatively complex structures) and have found no reasonable way of doing this.
I have this struct:
struct client {
int state;
int sockfd;
struct sockaddr_in *addr;
struct epoll_event *epollev;
struct buffer *in_buffer;
struct buffer *out_buffer;
struct packet *packet;
struct player *player;
};
And need to pass it to a Python function where I can easily access the members with common syntax (preferably not the use of things like dicts although that's alright too). It's almost like I need a PyObject_FromStruct function or something.
Is there any relatively simple way to do this?