Subject: RE: How to read current value of a socket option with sctp_opt_info()

From: [email-masked]
Date: Thu, 5 Jun 2003 13:53:19 +0300

Hi,

Since sctp_opt_info() is read only it seems redundant and sometimes conflicting that many of the options have SET/GET as part of the option name.

If sctp_opt_info() is used to query a socket option we know that it is always GET.
If getsockopt() is used, the function call implies that this is a GET operation.
If setsockopt() is used, the function call implies that this is SET operation

Sometimes it is not very intuitive whether it is a set or a get. For example at the moment to query Peer Address Parameters I would call
sctp_opt_info (.. ,SCTP_SET_PEER_ADDR_PARAMS, ..) or (in BSD systems)
getsockopt (.. ,SCTP_SET_PEER_ADDR_PARAMS, ..). 

--Kimmo

> -----Original Message-----
> From: ext Randall Stewart (cisco) [mailto:[email-masked]]
> Sent: 03 June, 2003 18:08
> To: Rainola Kimmo (NET/Helsinki)
> Cc: [email-masked]
> Subject: Re: How to read current value of a socket option with
> sctp_opt_info()
> 
> 
> [email-masked] wrote:
> 
> >Hi,
> >
> >I have a question regarding the use of sctp_opt_info(). In 
> addition of setting socket options can it also be used to 
> read the current value of a socket option?
> >
> >For example if I want to set heartbeat interval to some 
> value I would fill out struct sctp_paddrparams with the new 
> value and call sctp_opt_info() with 
> SCTP_SET_PEER_ADDR_PARAMS. But what if I'm just interested in 
> knowing the current value of heartbeat interval? Do I again 
> call sctp_opt_info() and pass struct sctp_paddrparams as an 
> argument and expect that when sctp_opt_info() returns it will 
> be filled with the current data. 
> >
> >The problem I see here is that since the calls to set/get 
> the socket option look the same, how does the system know if 
> I want to set or get the socket option. Should I use 
> getsockopt() instead of sctp_opt_info() when I want to read 
> the current value of socket option.
> >
> >Br,
> >	Kimmo 
> >
> >  
> >
> sctp_opt_info()
> 
> is only getting options. This is due to the fact that on
> some machines.. you can NOT pass a in-out variable into the
> getsockopt() call.
> 
> For BSD machines you can use either getsockopt() OR sctp_opt_info()
> 
> You CAN NOT use sctp_opt_info() to set any socket option..
> 
> R
> 
> -- 
> Randall R. Stewart
> ITD
> Cisco Systems Inc.
> [email-masked] 815-342-5222(cell) or 815-477-2127(office)
> 
> 
>

---

From: "Randall Stewart (cisco)" <[email-masked]>
Date: Thu, 05 Jun 2003 09:32:32 -0500

Kimmo:

Please see the earlier discussion on this list... the next socket api
draft will change all of the items that have the word SET in them
to NOT have this word (if it can be used in a set and get). I believe
we end with only ONE item left with SET in the neame

SET_PEER_PRIMARY_ADDR

to trigger the addip setprimary aka what your peer thinks is primary.

All others will loose the SET name.

R