#ifndef _SOCKSCTP_H_
#define _SOCKSCTP_H_
#ifdef __cplusplus
extern "C" {
#endif
struct sctp_sonode {
int ss_type;
struct sonode ss_so;
sctp_assoc_t ss_maxassoc;
sctp_assoc_t ss_assoccnt;
struct sctp_sa_id *ss_assocs;
#define ss_wroff ss_so.so_proto_props.sopp_wroff
#define ss_wrsize ss_so.so_proto_props.sopp_maxblk
};
struct sctp_soassoc {
int ssa_type;
sctp_assoc_t ssa_id;
uint_t ssa_refcnt;
struct sctp_sonode *ssa_sonode;
struct sctp_s *ssa_conn;
uint_t ssa_state;
int ssa_error;
boolean_t ssa_snd_qfull;
ushort_t ssa_wroff;
ssize_t ssa_wrsize;
int ssa_rcv_queued;
boolean_t ssa_flowctrld;
};
struct sctp_sa_id {
sctp_assoc_t ssi_alloc;
struct sctp_soassoc *ssi_assoc;
};
extern sonodeops_t sosctp_sonodeops;
extern sonodeops_t sosctp_seq_sonodeops;
extern sock_upcalls_t sosctp_sock_upcalls;
extern sock_upcalls_t sosctp_assoc_upcalls;
extern struct sonode *socksctp_create(struct sockparams *, int, int,
int, int, int, int *, cred_t *);
extern void sosctp_fini(struct sonode *, struct cred *);
extern int sosctp_aid_grow(struct sctp_sonode *ss, sctp_assoc_t maxid,
int kmflags);
extern sctp_assoc_t sosctp_aid_get(struct sctp_sonode *ss);
extern void sosctp_aid_reserve(struct sctp_sonode *ss, sctp_assoc_t id,
int incr);
extern struct cmsghdr *sosctp_find_cmsg(const uchar_t *control, socklen_t clen,
int type);
extern void sosctp_pack_cmsg(const uchar_t *, struct nmsghdr *, int);
extern int sosctp_assoc(struct sctp_sonode *ss, sctp_assoc_t id,
struct sctp_soassoc **ssa);
extern struct sctp_soassoc *sosctp_assoc_create(struct sctp_sonode *ss,
int kmflags);
extern void sosctp_assoc_free(struct sctp_sonode *ss, struct sctp_soassoc *ssa);
extern int sosctp_assoc_createconn(struct sctp_sonode *ss,
const struct sockaddr *name, socklen_t namelen,
const uchar_t *control, socklen_t controllen, int fflag, struct cred *,
struct sctp_soassoc **ssap);
extern void sosctp_assoc_move(struct sctp_sonode *ss, struct sctp_sonode *nss,
struct sctp_soassoc *ssa);
extern void sosctp_so_inherit(struct sctp_sonode *lss, struct sctp_sonode *nss);
extern void sosctp_assoc_isconnecting(struct sctp_soassoc *ssa);
extern void sosctp_assoc_isconnected(struct sctp_soassoc *ssa);
extern void sosctp_assoc_isdisconnecting(struct sctp_soassoc *ssa);
extern void sosctp_assoc_isdisconnected(struct sctp_soassoc *ssa, int error);
extern int sosctp_waitconnected(struct sonode *so, int fmode);
extern int sosctp_uiomove(mblk_t *hdr_mp, ssize_t count, ssize_t blk_size,
int wroff, struct uio *uiop, int flags);
#define SOSCTP_SOCKET 0x1
#define SOSCTP_ASSOC 0x2
#define SOTOSSO(so) ((struct sctp_sonode *)(((char *)so) - \
offsetof(struct sctp_sonode, ss_so)))
#define SSA_REFHOLD(ssa) \
{ \
ASSERT(MUTEX_HELD(&(ssa)->ssa_sonode->ss_so.so_lock)); \
ASSERT((ssa)->ssa_refcnt > 0); \
++(ssa)->ssa_refcnt; \
dprint(3, ("ssa_refhold on %p %d (%s,%d)\n", \
(void *)(ssa), (ssa)->ssa_refcnt, \
__FILE__, __LINE__)); \
}
#define SSA_REFRELE(ss, ssa) \
{ \
dprint(3, ("ssa_refrele on %p %d (%s, %d)\n", \
(void *)(ssa), \
(ssa)->ssa_refcnt-1, __FILE__, __LINE__)); \
ASSERT((ssa)->ssa_refcnt > 0); \
if (--(ssa)->ssa_refcnt == 0) { \
sosctp_assoc_free(ss, ssa); \
} \
}
#ifdef __cplusplus
}
#endif
#endif