----- Original Message ----- 
From: "Dave Shield" <[EMAIL PROTECTED]>
To: "RH" <[EMAIL PROTECTED]>
Cc: <net-snmp-coders@lists.sourceforge.net>
Sent: Wednesday, September 14, 2005 9:12 AM
Subject: Re: Setting TOS option (newbie)


> On Tue, 2005-09-13 at 12:45 -0400, RH wrote:
> > I need to set the apply getsockopt() and setsockopt() against the
socket(s)
> > used to send SNMP PDUs to an agent.  It's a must-have capability to
transmit
> > packets with a defined TOS option configuration.
>
> > That's obviously better than my admittedly act-of-desperation hack:
> > Defeating the detail hiding / abstraction layer and use the session
pointer
> > from snmp_open() to get access to the sock field of the
netsnmp_transport
> > member of the session_list struct associated with that session.
>
> I'm not sure exactly how you were thinking of doing (or not doing!)
> this, but I'm tempted to suggest that it may actually be the best
> way to go.

I was going to work along these lines:

struct a
{
    int a1 ;
    int a2 ;
} ;

struct b
{
    int b1 ;
    int b2 ;
} ;

struct c
{
    struct a ;
    struct b ;
} ;

Given a pointer to 'a' in 'struct c', as we all know you can access / modify
'b' in 'struct c'.

Considering

// snmp_api.c
struct session_list {
    struct session_list *next;
    netsnmp_session *session;
    netsnmp_transport *transport;
    struct snmp_internal_session *internal;
};

and that snmp_open() apparently returns the necessary session pointer, I was
going to try to use it to access the 'sock' field in 'transport' in
session_list.

I hadn't actually tried it yet.  I'm new to net-snmp and am still at the
'looking way up' end of the learning curve.

>    There is already a defined API  (snmp_sess_transport) for
> retrieving the transport structure associated with a particular
> session,  and the socket is one of the top-level fields of this
> transport structure.  It's probably not unreasonable to access
> this field (and perhaps the transport flags field) directly.

That's exactly what I need !  Thank you very much.

I apologize for the newbie question, and greatly appreciate all the help.

> The main purpose of the module transport mechanism is to hide
> the transport-specific aspects of how things operate - this level
> of transport-independent information seems fair game, IMO.

> We *could* provide a wrapper API:
>     int netsnmp_transport_socket( netsnmp_transport *);
> I suppose, but it hardly seems worth it.
>
>
> Dave
>




-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. 
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to