| To: | Martin Röhricht <ml@xxxxxxxxxxx> |
|---|---|
| Subject: | Re: [Discussion] Retrieving a CID |
| From: | John Heffner <jheffner@xxxxxxx> |
| Date: | Mon, 24 Oct 2005 10:21:20 -0400 |
On Oct 24, 2005, at 5:32 AM, Martin Röhricht wrote:Hello again, web100_connection_find() only returns a single connection, not a list of connections, so it required a full match on the spec. What you need to do is step through the list of all connections in a loop doing a match on just the parts of the spec you want. See below for an example. (You seem not to have a remote port, but I'm assuming you do.) Incidentally, the equivalent python code is: import Web100 agent = Web100.Web100Agent() cl = agent.connection_match('192.168.0.17', None, '192.168.0.18', RemotePort) cid = cl[0].cid It works pretty well for this if you can use it. :-) -John Here is the small source code: --------------------------------8<--------------------------------- #include <stdio.h> #include <stdlib.h> #include <netinet/in.h> #include <pthread.h> #include "web100.h" #include "web100-int.h" conn = web100_connection_head(agent); while (conn) { spec2 = web100_get_connection_spec(conn); if (spec->src_addr == spec2->src_addr && spec->dst_addr == spec2->dst_addr && spec->dst_port == spec2->dst_port) break; } if (conn == NULL) { printf("connection not found\n"); return 1; } printf("conn: %p\n", conn); _______________________________________________ Discussion mailing list Discussion@xxxxxxxxxx http://internal.web100.org/mailman/listinfo/discussion |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [Discussion] Retrieving a CID, Martin Röhricht |
|---|---|
| Next by Date: | Re: [Discussion] Retrieving a CID, Martin Röhricht |
| Previous by Thread: | [Discussion] Retrieving a CID, Martin Röhricht |
| Next by Thread: | Re: [Discussion] Retrieving a CID, Martin Röhricht |
| Indexes: | [Date] [Thread] [Top] [All Lists] |