Discussion: APIs for SCTP
Afficher un message
Vieux 15/03/2006, 21h20   #2
Måns Rullgård
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: APIs for SCTP

phil-news-nospam@ipal.net writes:

> I've read about and downloaded the packages sctplib and socketapi which
> appears to use sctplib. But these are userland implementations of SCTP.
>
> What I'm really looking for is how a non-userland implementation would
> be used by a userland application program. I presume this would use the
> basic socket interface. But there are details about SCTP that would also
> make this differ somewhat. For example, identifying different streams.
>
> What is the expected standard way (API) to use SCTP for non-userland (e.g.
> in the host kernel IP stack) implementations of SCTP?


First you create a socket with

socket(PF_INET, SOCK_SEQPACKET, IPPROTO_SCTP);

and subscribe to SCTP notifications with

struct sctp_event_subscribe esub;
memset(&esub, 0, sizeof(esub));
esub.sctp_association_event = 1;
setsockopt(sock, IPPROTO_SCTP, SCTP_EVENTS, &esub, sizeof(esub));

Then you recvmsg() things from the socket and check for
msg_flags & MSG_NOTIFICATION, which indicates that the message payload
is a union sctp_notification.

There's obviously more that can be done, but maybe this will get you
started.

--
Måns Rullgård
mru@inprovide.com
  Réponse avec citation
 
Page generated in 0,06454 seconds with 9 queries