36.4 SCTP Applications
SCTP supports legacy ns applications, but they obviously cannot
completely exploit all SCTP's features. For these applications, the
TCL-bound SCTP configuration parameters can be used to set
reliability and ordering options. However, these options cannot be
controlled per message using these parameters. Only SCTP-aware
application can be written to do so. ns applications wishing to
become SCTP-aware can use the sendmsg API as follows (see
~ns/apps/sctp_app1.{cc, h} as an example).
- Create and fill an instance of the AppData_S
structure (see ~ns/sctp/sctp.h). The AppData_S
structure has the following fields:
- usNumStreams is the number of outgoing streams
to setup during negotiation. Although this field is passed
with every sendmsg call, it is only used during association
setup. Once the association is established, this field is
ignored.
- usNumUnreliable is the number of outgoing
streams which are unreliable (now called partially
reliable). The sender simply sets the lowest outgoing stream
to unreliable/partially-reliable; the remaining ones are
reliable. This field is also only used during association
establishment.
- usStreamId is the stream ID of a message.
- usReliability is the reliability level (k-rtx
value) of a message. This field is ignored if the message is
sent on a reliable stream.
- eUnordered is the unordered boolean flag for a
message.
- uiNumBytes is the number of bytes in a message.
- Pass this object as the second parameter in SCTP's sendmsg:
sctpAgent-sendmsg(numBytes, (char *)appData);
Tom Henderson
2011-11-05