On Mon, Sep 26, 2005 at 02:55:26PM -0700, Wes Hardaker wrote:
> >>>>> On Fri, 23 Sep 2005 01:16:45 +0200, Magnus Fromreide <[EMAIL
> >>>>> PROTECTED]> said:
>
> Magnus> I wa woudering what the purpose of NETSNMP_CALLBACK_OP_CONNECT
> Magnus> is.
>
> Magnus> At a guess it should be issued when a new connection is
> Magnus> established with a transports but I do not know for sure,
> Magnus> could someone please explain?
>
> I'm betting it was designed to do that. However, since it doesn't
> exist anywhere in the source code to date I suspect it was designed
> but never implemented.
So would something like the following be what was intended?
This patche calls the callback function in the created object and gives it the
newly created session as argument, given the declaration of callback I couldn't
figure out anything better to do.
/MF
Index: snmplib/snmp_api.c
===================================================================
RCS file: /cvsroot/net-snmp/net-snmp/snmplib/snmp_api.c,v
retrieving revision 5.87
diff -u -r5.87 snmp_api.c
--- snmplib/snmp_api.c 16 Sep 2005 15:51:08 -0000 5.87
+++ snmplib/snmp_api.c 27 Sep 2005 11:15:43 -0000
@@ -5415,6 +5415,16 @@
if (nslp != NULL) {
nslp->next = Sessions;
Sessions = nslp;
+ /*
+ * Tell the new session about it's existance if possible.
+ */
+ if (nslp->session->callback != NULL) {
+ DEBUGMSGTL(("sess_read",
+ "perform callback with op=CONNECT\n"));
+ nslp->session->callback(NETSNMP_CALLBACK_OP_CONNECT,
+ nslp->session, 0,
+ NULL, sp->callback_magic);
+ }
} else {
new_transport->f_close(new_transport);
netsnmp_transport_free(new_transport);