Subject: [Tsvwg] sctpsocket: getpeername/getsockname

From: Jonathan Wood <[email-masked]>
Date: Fri, 13 Jul 2001 15:24:15 -0700 (PDT)

Howard Lew pointed out to me that we don't currently have
getpeername() and getsockname() in the TCP-compatibility section
of the SCTP socket extensions draft. I think we should add
these, as follows (TCP-style sockets only):

getpeername() returns the peer's primary address and port.
getsockname() returns a local address (picked by the stack),
              and the locally bound port. If the socket is
              an AF_INET socket, the socket address will
              be a sockaddr_in. If the socket is an AF_INET6
              socket, the socket address will be a sockaddr_in6
              (containing either a IPv6 or mapped IPv4 address).
              This way a caller can determine which type a
              socket is.

getpeername() and getsockname() are single-homed. We already
have a multihomed version of getpeername(), sctp_getpaddrs().
We don't, however, have a multihomed version of getsockname().
I propose the following (similar to sctp_getpaddrs()):

int  sock, sctp_assoc_t id, struct sockaddr_storage **ss);

    Returns the list of locally bound addresses in ss. For UDP-style
    sockets, 'id' selects the association. For TCP-style sockets, 'id'
    is ignored.
    
void sctp_freeladdrs(struct sockaddr_storage *ss);

    Frees the memory allocated by sctp_getladdrs().

Comments?

Jonathan

_______________________________________________
tsvwg mailing list
[email-masked]
http://www1.ietf.org/mailman/listinfo/tsvwg

---

From: Jonathan Wood <[email-masked]>
Date: Fri, 13 Jul 2001 16:47:45 -0700 (PDT)

>int  sock, sctp_assoc_t id, struct sockaddr_storage **ss);

Should be:

int sctp_getladdrs(int sock, sctp_assoc_t id, struct sockaddr_storage **ss);