Re: SCTP API section 7.1.13

From: David Lehmann <lehmann@ulticom.com>
Date: Tue Feb 15 2005 - 12:14:08 EST
('binary' encoding is not supported, stored as-is) ('binary' encoding is not supported, stored as-is) Ryan W Bickhart wrote:
>>How do you "get all the current peer address parameter values" without
>>setting it? The draft says that you "should" use sctp_opt_info which
>>'sets' and 'gets'. Does this mean that you can use getsockopt() as well?
>>If so, I did not see that statement in the draft.
>
>
> According to UNP (third ed) page 278, sctp_opt_info is a more portable
> replacement for getsockopt. It says that some OS implementations may not

Who is defining sctp_opt_info? UNP or SCTP API I-D?
If it is the SCTP API I-D, then usage need to be defined clearly in the I-D.

> support in-out variables with getsockopt, which SCTP needs in some cases.
> So you could think of sctp_opt_info as a glorified getsockopt that always
> works. On FreeBSD, for example, you can use getsockopt directly, but this
> is discouraged for portability reasons.

I don't necessarily agree with these statements, but I won't belabor the
point.

> So you might do:
> sctp_opt_info(...) /* get the settings */

My understanding is that sctp_opt_info will _set_ the values.
How do you get the values before setting them?

> /*modify what you want */
> setsockopt(...) /* save the changes */
>
>
>>Even if this is the case, it seems that this API is
>>inconsistent with the other structures where zero means
>>"don't change". Also, it is very inconvenient to get a value just
>>so we can then set it to the same value.
>
> I agree on both counts.

Progress! :-)

>>IMHO, zero should mean "don't change". UINT32_MAX could mean
>>disable heartbeats. (Or ~49 days, which is affectively
>>disabled.) How about adding a boolean parameter "spp_send_hb"?
>>zero would mean don't send a HB; nonzero would mean send it.
>>That would leave spp_hbinterval to behave like the other parameters.
>
>
> Even with the boolean, I think we would still have the same type of
> consistency problem, just with a different parameter. How would you turn
> off heartbeats by setting spp_send_hb to zero if zero means do not change
> the current value? :) Maybe the first suggestion might work better...any
> other ideas?

I was suggesting this:
    struct sctp_paddrparams {
        sctp_assoc_t spp_assoc_id;
        struct sockaddr_storage spp_address;
        uint32_t spp_hbinterval;
        uint16_t spp_pathmaxrxt;
        uint8_t spp_send_hb;
    };

If spp_hbinterval == 0, do not change the HB interval.
If spp_hbinterval != 0, set the HB interval to the given number
    of milliseconds. Setting it to UINT32_MAX would disable
    the HBs. (My point above is that if the SCTP implementation did not
    make a special case for UINT32_MAX, the interval would be
    more than 49 days, which effectively disables it.)

If spp_pathmaxrxt == 0, do not change the path max retrans.
If spp_pathmaxrxt != 0, set the path max retrans to that value.

If spp_send_hb == 0, do not send a HB.
If spp_send_hb != 0, send a HB. (spp_hbinterval should not
    cause the immediate sending of a HB.)

Better yet, leave the sctp_paddrparams as it was and create
a new function to send a HB:

int sctp_send_heartbeat(
        int sd, sctp_assoc_t id, const struct sockaddr *addr);

-- 
David Lehmann                          Ulticom, Inc.
AOL/Yahoo IM: davidULCM                1020 Briggs Road
1-856-787-2729                         Mt. Laurel, NJ 08054   USA
Received on Tue Feb 15 12:39:09 2005

This archive was generated by hypermail 2.1.8 : Mon Mar 13 2006 - 15:22:24 EST