FreeBSD kernel IPv4 code
sctp_var.h File Reference
#include <sys/cdefs.h>
#include <netinet/sctp_uio.h>
Include dependency graph for sctp_var.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _NETINET_SCTP_VAR_H_
 
#define sctp_feature_on(inp, feature)   (inp->sctp_features |= feature)
 
#define sctp_feature_off(inp, feature)   (inp->sctp_features &= ~feature)
 
#define sctp_is_feature_on(inp, feature)   ((inp->sctp_features & feature) == feature)
 
#define sctp_is_feature_off(inp, feature)   ((inp->sctp_features & feature) == 0)
 
#define sctp_stcb_feature_on(inp, stcb, feature)
 
#define sctp_stcb_feature_off(inp, stcb, feature)
 
#define sctp_stcb_is_feature_on(inp, stcb, feature)
 
#define sctp_stcb_is_feature_off(inp, stcb, feature)
 
#define sctp_mobility_feature_on(inp, feature)   (inp->sctp_mobility_features |= feature)
 
#define sctp_mobility_feature_off(inp, feature)   (inp->sctp_mobility_features &= ~feature)
 
#define sctp_is_mobility_feature_on(inp, feature)   (inp->sctp_mobility_features & feature)
 
#define sctp_is_mobility_feature_off(inp, feature)   ((inp->sctp_mobility_features & feature) == 0)
 
#define sctp_maxspace(sb)   (max((sb)->sb_hiwat,SCTP_MINIMAL_RWND))
 
#define sctp_sbspace(asoc, sb)   ((long) ((sctp_maxspace(sb) > (asoc)->sb_cc) ? (sctp_maxspace(sb) - (asoc)->sb_cc) : 0))
 
#define sctp_sbspace_failedmsgs(sb)   ((long) ((sctp_maxspace(sb) > (sb)->sb_cc) ? (sctp_maxspace(sb) - (sb)->sb_cc) : 0))
 
#define sctp_sbspace_sub(a, b)   (((a) > (b)) ? ((a) - (b)) : 0)
 
#define sctp_free_a_readq(_stcb, _readq)
 
#define sctp_alloc_a_readq(_stcb, _readq)
 
#define sctp_free_a_strmoq(_stcb, _strmoq, _so_locked)
 
#define sctp_alloc_a_strmoq(_stcb, _strmoq)
 
#define sctp_free_a_chunk(_stcb, _chk, _so_locked)
 
#define sctp_alloc_a_chunk(_stcb, _chk)
 
#define sctp_free_remote_addr(__net)
 
#define sctp_sbfree(ctl, stcb, sb, m)
 
#define sctp_sballoc(stcb, sb, m)
 
#define sctp_ucount_incr(val)
 
#define sctp_ucount_decr(val)
 
#define sctp_mbuf_crush(data)
 
#define sctp_flight_size_decrease(tp1)
 
#define sctp_flight_size_increase(tp1)
 
#define sctp_total_flight_decrease(stcb, tp1)
 
#define sctp_total_flight_increase(stcb, tp1)
 
#define SCTP_PF_ENABLED(_net)   (_net->pf_threshold < _net->failure_threshold)
 
#define SCTP_NET_IS_PF(_net)   (_net->pf_threshold < _net->error_count)
 

Functions

 __FBSDID ("$FreeBSD$")
 
void sctp_close (struct socket *so)
 
int sctp_disconnect (struct socket *so)
 
void sctp_ctlinput (int, struct sockaddr *, void *)
 
int sctp_ctloutput (struct socket *, struct sockopt *)
 
void sctp_pathmtu_adjustment (struct sctp_tcb *, uint32_t, bool)
 
void sctp_drain (void)
 
void sctp_notify (struct sctp_inpcb *, struct sctp_tcb *, struct sctp_nets *, uint8_t, uint8_t, uint16_t, uint32_t)
 
int sctp_flush (struct socket *, int)
 
int sctp_shutdown (struct socket *)
 
int sctp_bindx (struct socket *, int, struct sockaddr_storage *, int, int, struct proc *)
 
int sctp_peeloff (struct socket *, struct socket *, int, caddr_t, int *)
 
int sctp_ingetaddr (struct socket *, struct sockaddr **)
 
int sctp_peeraddr (struct socket *, struct sockaddr **)
 
int sctp_listen (struct socket *, int, struct thread *)
 
int sctp_accept (struct socket *, struct sockaddr **)
 

Variables

struct pr_usrreqs sctp_usrreqs
 

Macro Definition Documentation

◆ _NETINET_SCTP_VAR_H_

#define _NETINET_SCTP_VAR_H_

Definition at line 39 of file sctp_var.h.

◆ sctp_alloc_a_chunk

#define sctp_alloc_a_chunk (   _stcb,
  _chk 
)
Value:
{ \
if (TAILQ_EMPTY(&(_stcb)->asoc.free_chunks)) { \
(_chk) = SCTP_ZONE_GET(SCTP_BASE_INFO(ipi_zone_chunk), struct sctp_tmit_chunk); \
if ((_chk)) { \
SCTP_INCR_CHK_COUNT(); \
(_chk)->whoTo = NULL; \
(_chk)->holds_key_ref = 0; \
} \
} else { \
(_chk) = TAILQ_FIRST(&(_stcb)->asoc.free_chunks); \
TAILQ_REMOVE(&(_stcb)->asoc.free_chunks, (_chk), sctp_next); \
atomic_subtract_int(&SCTP_BASE_INFO(ipi_free_chunks), 1); \
(_chk)->holds_key_ref = 0; \
SCTP_STAT_INCR(sctps_cached_chk); \
(_stcb)->asoc.free_chunk_cnt--; \
} \
}
#define SCTP_ZONE_GET(zone, type)
Definition: sctp_os_bsd.h:251
#define SCTP_BASE_INFO(__m)
Definition: sctp_os_bsd.h:145
struct sctpchunk_listhead free_chunks
Definition: sctp_structs.h:817
uint16_t free_chunk_cnt
struct sctp_nets * whoTo
Definition: sctp_structs.h:431
uint8_t holds_key_ref
Definition: sctp_structs.h:440
struct sctp_association * asoc
Definition: sctp_structs.h:427

Definition at line 166 of file sctp_var.h.

◆ sctp_alloc_a_readq

#define sctp_alloc_a_readq (   _stcb,
  _readq 
)
Value:
{ \
(_readq) = SCTP_ZONE_GET(SCTP_BASE_INFO(ipi_zone_readq), struct sctp_queued_to_read); \
if ((_readq)) { \
SCTP_INCR_READQ_COUNT(); \
} \
}

Definition at line 115 of file sctp_var.h.

◆ sctp_alloc_a_strmoq

#define sctp_alloc_a_strmoq (   _stcb,
  _strmoq 
)
Value:
{ \
(_strmoq) = SCTP_ZONE_GET(SCTP_BASE_INFO(ipi_zone_strmoq), struct sctp_stream_queue_pending); \
if ((_strmoq)) { \
memset(_strmoq, 0, sizeof(struct sctp_stream_queue_pending)); \
SCTP_INCR_STRMOQ_COUNT(); \
(_strmoq)->holds_key_ref = 0; \
} \
}

Definition at line 131 of file sctp_var.h.

◆ sctp_feature_off

#define sctp_feature_off (   inp,
  feature 
)    (inp->sctp_features &= ~feature)

Definition at line 48 of file sctp_var.h.

◆ sctp_feature_on

#define sctp_feature_on (   inp,
  feature 
)    (inp->sctp_features |= feature)

Definition at line 47 of file sctp_var.h.

◆ sctp_flight_size_decrease

#define sctp_flight_size_decrease (   tp1)
Value:
do { \
if (tp1->whoTo->flight_size >= tp1->book_size) \
tp1->whoTo->flight_size -= tp1->book_size; \
else \
tp1->whoTo->flight_size = 0; \
} while (0)

Definition at line 247 of file sctp_var.h.

◆ sctp_flight_size_increase

#define sctp_flight_size_increase (   tp1)
Value:
do { \
(tp1)->whoTo->flight_size += (tp1)->book_size; \
} while (0)

Definition at line 254 of file sctp_var.h.

◆ sctp_free_a_chunk

#define sctp_free_a_chunk (   _stcb,
  _chk,
  _so_locked 
)
Value:
{ \
if ((_chk)->holds_key_ref) {\
sctp_auth_key_release((_stcb), (_chk)->auth_keyid, _so_locked); \
(_chk)->holds_key_ref = 0; \
} \
if (_stcb) { \
SCTP_TCB_LOCK_ASSERT((_stcb)); \
if ((_chk)->whoTo) { \
sctp_free_remote_addr((_chk)->whoTo); \
(_chk)->whoTo = NULL; \
} \
if (((_stcb)->asoc.free_chunk_cnt > SCTP_BASE_SYSCTL(sctp_asoc_free_resc_limit)) || \
(SCTP_BASE_INFO(ipi_free_chunks) > SCTP_BASE_SYSCTL(sctp_system_free_resc_limit))) { \
SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_chunk), (_chk)); \
SCTP_DECR_CHK_COUNT(); \
} else { \
TAILQ_INSERT_TAIL(&(_stcb)->asoc.free_chunks, (_chk), sctp_next); \
(_stcb)->asoc.free_chunk_cnt++; \
atomic_add_int(&SCTP_BASE_INFO(ipi_free_chunks), 1); \
} \
} else { \
SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_chunk), (_chk)); \
SCTP_DECR_CHK_COUNT(); \
} \
}
#define SCTP_BASE_SYSCTL(__m)
Definition: sctp_os_bsd.h:148

Definition at line 140 of file sctp_var.h.

◆ sctp_free_a_readq

#define sctp_free_a_readq (   _stcb,
  _readq 
)
Value:
{ \
SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_readq), (_readq)); \
SCTP_DECR_READQ_COUNT(); \
}

Definition at line 109 of file sctp_var.h.

◆ sctp_free_a_strmoq

#define sctp_free_a_strmoq (   _stcb,
  _strmoq,
  _so_locked 
)
Value:
{ \
if ((_strmoq)->holds_key_ref) { \
sctp_auth_key_release(stcb, sp->auth_keyid, _so_locked); \
(_strmoq)->holds_key_ref = 0; \
} \
SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_strmoq), (_strmoq)); \
SCTP_DECR_STRMOQ_COUNT(); \
}

Definition at line 122 of file sctp_var.h.

◆ sctp_free_remote_addr

#define sctp_free_remote_addr (   __net)
Value:
{ \
if ((__net)) { \
if (SCTP_DECREMENT_AND_CHECK_REFCOUNT(&(__net)->ref_count)) { \
RO_NHFREE(&(__net)->ro); \
if ((__net)->src_addr_selected) { \
sctp_free_ifa((__net)->ro._s_addr); \
(__net)->ro._s_addr = NULL; \
} \
(__net)->src_addr_selected = 0; \
(__net)->dest_state &= ~SCTP_ADDR_REACHABLE; \
SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_net), (__net)); \
SCTP_DECR_RADDR_COUNT(); \
} \
} \
}
#define SCTP_ADDR_REACHABLE
#define SCTP_DECREMENT_AND_CHECK_REFCOUNT(addr)
Definition: sctp_os_bsd.h:459

Definition at line 184 of file sctp_var.h.

◆ sctp_is_feature_off

#define sctp_is_feature_off (   inp,
  feature 
)    ((inp->sctp_features & feature) == 0)

Definition at line 50 of file sctp_var.h.

◆ sctp_is_feature_on

#define sctp_is_feature_on (   inp,
  feature 
)    ((inp->sctp_features & feature) == feature)

Definition at line 49 of file sctp_var.h.

◆ sctp_is_mobility_feature_off

#define sctp_is_mobility_feature_off (   inp,
  feature 
)    ((inp->sctp_mobility_features & feature) == 0)

Definition at line 82 of file sctp_var.h.

◆ sctp_is_mobility_feature_on

#define sctp_is_mobility_feature_on (   inp,
  feature 
)    (inp->sctp_mobility_features & feature)

Definition at line 81 of file sctp_var.h.

◆ sctp_maxspace

#define sctp_maxspace (   sb)    (max((sb)->sb_hiwat,SCTP_MINIMAL_RWND))

Definition at line 84 of file sctp_var.h.

◆ sctp_mbuf_crush

#define sctp_mbuf_crush (   data)
Value:
do { \
struct mbuf *_m; \
_m = (data); \
while (_m && (SCTP_BUF_LEN(_m) == 0)) { \
(data) = SCTP_BUF_NEXT(_m); \
SCTP_BUF_NEXT(_m) = NULL; \
sctp_m_free(_m); \
_m = (data); \
} \
} while (0)
#define SCTP_BUF_LEN(m)
Definition: sctp_os_bsd.h:290
#define SCTP_BUF_NEXT(m)
Definition: sctp_os_bsd.h:291

Definition at line 236 of file sctp_var.h.

◆ sctp_mobility_feature_off

#define sctp_mobility_feature_off (   inp,
  feature 
)    (inp->sctp_mobility_features &= ~feature)

Definition at line 80 of file sctp_var.h.

◆ sctp_mobility_feature_on

#define sctp_mobility_feature_on (   inp,
  feature 
)    (inp->sctp_mobility_features |= feature)

Definition at line 79 of file sctp_var.h.

◆ SCTP_NET_IS_PF

#define SCTP_NET_IS_PF (   _net)    (_net->pf_threshold < _net->error_count)

Definition at line 316 of file sctp_var.h.

◆ SCTP_PF_ENABLED

#define SCTP_PF_ENABLED (   _net)    (_net->pf_threshold < _net->failure_threshold)

Definition at line 315 of file sctp_var.h.

◆ sctp_sballoc

#define sctp_sballoc (   stcb,
  sb,
 
)
Value:
{ \
atomic_add_int(&(sb)->sb_cc,SCTP_BUF_LEN((m))); \
atomic_add_int(&(sb)->sb_mbcnt, MSIZE); \
if (stcb) { \
atomic_add_int(&(stcb)->asoc.sb_cc, SCTP_BUF_LEN((m))); \
atomic_add_int(&(stcb)->asoc.my_rwnd_control_len, MSIZE); \
} \
if (SCTP_BUF_TYPE(m) != MT_DATA && SCTP_BUF_TYPE(m) != MT_HEADER && \
SCTP_BUF_TYPE(m) != MT_OOBDATA) \
atomic_add_int(&(sb)->sb_ctl,SCTP_BUF_LEN((m))); \
}
#define sb_cc
Definition: sctp_os_bsd.h:379
#define SCTP_BUF_TYPE(m)
Definition: sctp_os_bsd.h:297

Definition at line 212 of file sctp_var.h.

◆ sctp_sbfree

#define sctp_sbfree (   ctl,
  stcb,
  sb,
 
)
Value:
{ \
SCTP_SAVE_ATOMIC_DECREMENT(&(sb)->sb_cc, SCTP_BUF_LEN((m))); \
SCTP_SAVE_ATOMIC_DECREMENT(&(sb)->sb_mbcnt, MSIZE); \
if (((ctl)->do_not_ref_stcb == 0) && stcb) {\
SCTP_SAVE_ATOMIC_DECREMENT(&(stcb)->asoc.sb_cc, SCTP_BUF_LEN((m))); \
SCTP_SAVE_ATOMIC_DECREMENT(&(stcb)->asoc.my_rwnd_control_len, MSIZE); \
} \
if (SCTP_BUF_TYPE(m) != MT_DATA && SCTP_BUF_TYPE(m) != MT_HEADER && \
SCTP_BUF_TYPE(m) != MT_OOBDATA) \
atomic_subtract_int(&(sb)->sb_ctl,SCTP_BUF_LEN((m))); \
}

Definition at line 200 of file sctp_var.h.

◆ sctp_sbspace

#define sctp_sbspace (   asoc,
  sb 
)    ((long) ((sctp_maxspace(sb) > (asoc)->sb_cc) ? (sctp_maxspace(sb) - (asoc)->sb_cc) : 0))

Definition at line 86 of file sctp_var.h.

◆ sctp_sbspace_failedmsgs

#define sctp_sbspace_failedmsgs (   sb)    ((long) ((sctp_maxspace(sb) > (sb)->sb_cc) ? (sctp_maxspace(sb) - (sb)->sb_cc) : 0))

Definition at line 88 of file sctp_var.h.

◆ sctp_sbspace_sub

#define sctp_sbspace_sub (   a,
 
)    (((a) > (b)) ? ((a) - (b)) : 0)

Definition at line 90 of file sctp_var.h.

◆ sctp_stcb_feature_off

#define sctp_stcb_feature_off (   inp,
  stcb,
  feature 
)
Value:
{\
if (stcb) { \
stcb->asoc.sctp_features &= ~feature; \
} else if (inp) { \
inp->sctp_features &= ~feature; \
} \
}

Definition at line 59 of file sctp_var.h.

◆ sctp_stcb_feature_on

#define sctp_stcb_feature_on (   inp,
  stcb,
  feature 
)
Value:
{\
if (stcb) { \
stcb->asoc.sctp_features |= feature; \
} else if (inp) { \
inp->sctp_features |= feature; \
} \
}

Definition at line 52 of file sctp_var.h.

◆ sctp_stcb_is_feature_off

#define sctp_stcb_is_feature_off (   inp,
  stcb,
  feature 
)
Value:
(((stcb != NULL) && \
((stcb->asoc.sctp_features & feature) == 0)) || \
((stcb == NULL) && (inp != NULL) && \
((inp->sctp_features & feature) == 0)) || \
((stcb == NULL) && (inp == NULL)))

Definition at line 71 of file sctp_var.h.

◆ sctp_stcb_is_feature_on

#define sctp_stcb_is_feature_on (   inp,
  stcb,
  feature 
)
Value:
(((stcb != NULL) && \
((stcb->asoc.sctp_features & feature) == feature)) || \
((stcb == NULL) && (inp != NULL) && \
((inp->sctp_features & feature) == feature)))

Definition at line 66 of file sctp_var.h.

◆ sctp_total_flight_decrease

#define sctp_total_flight_decrease (   stcb,
  tp1 
)
Value:
do { \
tp1->window_probe = 0; \
if (stcb->asoc.total_flight >= tp1->book_size) { \
stcb->asoc.total_flight -= tp1->book_size; \
if (stcb->asoc.total_flight_count > 0) \
stcb->asoc.total_flight_count--; \
} else { \
stcb->asoc.total_flight = 0; \
stcb->asoc.total_flight_count = 0; \
} \
} while (0)

Definition at line 296 of file sctp_var.h.

◆ sctp_total_flight_increase

#define sctp_total_flight_increase (   stcb,
  tp1 
)
Value:
do { \
(stcb)->asoc.total_flight_count++; \
(stcb)->asoc.total_flight += (tp1)->book_size; \
} while (0)

Definition at line 308 of file sctp_var.h.

◆ sctp_ucount_decr

#define sctp_ucount_decr (   val)
Value:
{ \
if (val > 0) { \
val--; \
} else { \
val = 0; \
} \
}

Definition at line 228 of file sctp_var.h.

◆ sctp_ucount_incr

#define sctp_ucount_incr (   val)
Value:
{ \
val++; \
}

Definition at line 224 of file sctp_var.h.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ sctp_accept()

◆ sctp_bindx()

int sctp_bindx ( struct socket *  ,
int  ,
struct sockaddr_storage *  ,
int  ,
int  ,
struct proc *   
)

◆ sctp_close()

◆ sctp_ctlinput()

void sctp_ctlinput ( int  ,
struct sockaddr *  ,
void *   
)

◆ sctp_ctloutput()

int sctp_ctloutput ( struct socket *  so,
struct sockopt *  sopt 
)

◆ sctp_disconnect()

◆ sctp_drain()

◆ sctp_flush()

◆ sctp_ingetaddr()

int sctp_ingetaddr ( struct socket *  ,
struct sockaddr **   
)

◆ sctp_listen()

◆ sctp_notify()

void sctp_notify ( struct sctp_inpcb ,
struct sctp_tcb ,
struct sctp_nets ,
uint8_t  ,
uint8_t  ,
uint16_t  ,
uint32_t   
)

◆ sctp_pathmtu_adjustment()

◆ sctp_peeloff()

int sctp_peeloff ( struct socket *  ,
struct socket *  ,
int  ,
caddr_t  ,
int *   
)

◆ sctp_peeraddr()

int sctp_peeraddr ( struct socket *  ,
struct sockaddr **   
)

◆ sctp_shutdown()

Variable Documentation

◆ sctp_usrreqs

struct pr_usrreqs sctp_usrreqs
extern