FreeBSD kernel IPv4 code
sctp_os_bsd.h File Reference
#include <sys/cdefs.h>
#include "opt_inet6.h"
#include "opt_inet.h"
#include "opt_sctp.h"
#include <sys/param.h>
#include <sys/domain.h>
#include <sys/eventhandler.h>
#include <sys/ktr.h>
#include <sys/systm.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/kernel.h>
#include <sys/sysctl.h>
#include <sys/mbuf.h>
#include <sys/protosw.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/jail.h>
#include <sys/resourcevar.h>
#include <sys/uio.h>
#include <sys/lock.h>
#include <sys/rwlock.h>
#include <sys/kthread.h>
#include <sys/priv.h>
#include <sys/random.h>
#include <sys/limits.h>
#include <sys/queue.h>
#include <machine/cpu.h>
#include <net/if.h>
#include <net/if_types.h>
#include <net/if_var.h>
#include <net/route.h>
#include <net/route/nhop.h>
#include <net/vnet.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/in_fib.h>
#include <netinet/in_pcb.h>
#include <netinet/in_var.h>
#include <netinet/ip_var.h>
#include <netinet/ip_icmp.h>
#include <netinet/icmp_var.h>
#include <netinet/ip_options.h>
#include <crypto/sha1.h>
#include <crypto/sha2/sha256.h>
#include <vm/uma.h>
#include <sys/callout.h>
Include dependency graph for sctp_os_bsd.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _NETINET_SCTP_OS_BSD_H_
 
#define SCTP_CTR6   CTR6
 
#define MODULE_GLOBAL(__SYMBOL)   V_##__SYMBOL
 
#define V_system_base_info   VNET(system_base_info)
 
#define SCTP_BASE_INFO(__m)   V_system_base_info.sctppcbinfo.__m
 
#define SCTP_BASE_STATS   V_system_base_info.sctpstat
 
#define SCTP_BASE_STAT(__m)   V_system_base_info.sctpstat.__m
 
#define SCTP_BASE_SYSCTL(__m)   V_system_base_info.sctpsysctl.__m
 
#define SCTP_BASE_VAR(__m)   V_system_base_info.__m
 
#define SCTP_PRINTF(params...)   printf(params)
 
#define SCTPDBG(level, params...)
 
#define SCTPDBG_ADDR(level, addr)
 
#define SCTP_LTRACE_CHK(a, b, c, d)
 
#define SCTP_LTRACE_ERR_RET_PKT(m, inp, stcb, net, file, err)
 
#define SCTP_LTRACE_ERR_RET(inp, stcb, net, file, err)
 
#define SCTP_MAX_VRF_ID   0
 
#define SCTP_SIZE_OF_VRF_HASH   3
 
#define SCTP_IFNAMSIZ   IFNAMSIZ
 
#define SCTP_DEFAULT_VRFID   0
 
#define SCTP_VRF_ADDR_HASH_SIZE   16
 
#define SCTP_VRF_IFN_HASH_SIZE   3
 
#define SCTP_INIT_VRF_TABLEID(vrf)
 
#define SCTP_IFN_IS_IFT_LOOP(ifn)   ((ifn)->ifn_type == IFT_LOOP)
 
#define SCTP_ROUTE_IS_REAL_LOOP(ro)   ((ro)->ro_nh && (ro)->ro_nh->nh_ifa && (ro)->ro_nh->nh_ifa->ifa_ifp && (ro)->ro_nh->nh_ifa->ifa_ifp->if_type == IFT_LOOP)
 
#define SCTP_GET_IFN_VOID_FROM_ROUTE(ro)   (void *)ro->ro_nh->nh_ifp
 
#define SCTP_GET_IF_INDEX_FROM_ROUTE(ro)   (ro)->ro_nh->nh_ifp->if_index
 
#define SCTP_ROUTE_HAS_VALID_IFN(ro)   ((ro)->ro_nh && (ro)->ro_nh->nh_ifp)
 
#define SCTP_MALLOC(var, type, size, name)
 
#define SCTP_FREE(var, type)   free(var, type)
 
#define SCTP_MALLOC_SONAME(var, type, size)
 
#define SCTP_FREE_SONAME(var)   free(var, M_SONAME)
 
#define SCTP_PROCESS_STRUCT   struct proc *
 
#define SCTP_ZONE_INIT(zone, name, size, number)
 
#define SCTP_ZONE_DESTROY(zone)   uma_zdestroy(zone)
 
#define SCTP_ZONE_GET(zone, type)    (type *)uma_zalloc(zone, M_NOWAIT);
 
#define SCTP_ZONE_FREE(zone, element)    uma_zfree(zone, element);
 
#define SCTP_HASH_INIT(size, hashmark)   hashinit_flags(size, M_PCB, hashmark, HASH_NOWAIT)
 
#define SCTP_HASH_FREE(table, hashmark)   hashdestroy(table, M_PCB, hashmark)
 
#define SCTP_M_COPYM   m_copym
 
#define SCTP_OS_TIMER_INIT(tmr)   callout_init(tmr, 1)
 
#define SCTP_OS_TIMER_START   callout_reset
 
#define SCTP_OS_TIMER_STOP   callout_stop
 
#define SCTP_OS_TIMER_STOP_DRAIN   callout_drain
 
#define SCTP_OS_TIMER_PENDING   callout_pending
 
#define SCTP_OS_TIMER_ACTIVE   callout_active
 
#define SCTP_OS_TIMER_DEACTIVATE   callout_deactivate
 
#define sctp_get_tick_count()   (ticks)
 
#define SCTP_UNUSED   __attribute__((unused))
 
#define SCTP_BUF_LEN(m)   (m->m_len)
 
#define SCTP_BUF_NEXT(m)   (m->m_next)
 
#define SCTP_BUF_NEXT_PKT(m)   (m->m_nextpkt)
 
#define SCTP_BUF_RESV_UF(m, size)   m->m_data += size
 
#define SCTP_BUF_AT(m, size)   m->m_data + size
 
#define SCTP_BUF_IS_EXTENDED(m)   (m->m_flags & M_EXT)
 
#define SCTP_BUF_SIZE   M_SIZE
 
#define SCTP_BUF_TYPE(m)   (m->m_type)
 
#define SCTP_BUF_RECVIF(m)   (m->m_pkthdr.rcvif)
 
#define SCTP_BUF_PREPEND   M_PREPEND
 
#define SCTP_ALIGN_TO_END(m, len)   M_ALIGN(m, len)
 
#define SCTP_SNPRINTF(...)   snprintf(__VA_ARGS__)
 
#define SCTP_PKTLOG_WRITERS_NEED_LOCK   3
 
#define SCTP_GATHER_MTU_FROM_IFN_INFO(ifn, ifn_index)   ((ifn != NULL) ? ((struct ifnet *)ifn)->if_mtu : 0)
 
#define SCTP_GATHER_MTU_FROM_ROUTE(sctp_ifa, sa, nh)   ((uint32_t)((nh != NULL) ? nh->nh_mtu : 0))
 
#define SCTP_BUF_EXTEND_BASE(m)   (m->m_ext.ext_buf)
 
#define SCTP_BUF_EXTEND_REFCNT(m)   (*m->m_ext.ext_cnt)
 
#define SCTP_BUF_GET_FLAGS(m)   (m->m_flags)
 
#define SCTP_HEADER_TO_CHAIN(m)   (m)
 
#define SCTP_DETACH_HEADER_FROM_CHAIN(m)
 
#define SCTP_HEADER_LEN(m)   ((m)->m_pkthdr.len)
 
#define SCTP_GET_HEADER_FOR_OUTPUT(o_pak)   0
 
#define SCTP_RELEASE_HEADER(m)
 
#define SCTP_RELEASE_PKT(m)   sctp_m_freem(m)
 
#define SCTP_ENABLE_UDP_CSUM(m)
 
#define SCTP_GET_PKT_VRFID(m, vrf_id)   ((vrf_id = SCTP_DEFAULT_VRFID) != SCTP_DEFAULT_VRFID)
 
#define SCTP_ATTACH_CHAIN(pak, m, packet_length)
 
#define SCTP_IS_IT_BROADCAST(dst, m)   ((m->m_flags & M_PKTHDR) ? in_broadcast(dst, m->m_pkthdr.rcvif) : 0)
 
#define SCTP_IS_IT_LOOPBACK(m)   ((m->m_flags & M_PKTHDR) && ((m->m_pkthdr.rcvif == NULL) || (m->m_pkthdr.rcvif->if_type == IFT_LOOP)))
 
#define SCTP_GET_HLIM(inp, ro)   in6_selecthlim(&inp->ip_inp.inp, (ro ? (ro->ro_nh ? (ro->ro_nh->nh_ifp) : (NULL)) : (NULL)));
 
#define SCTP_IPV6_V6ONLY(sctp_inpcb)   ((sctp_inpcb)->ip_inp.inp.inp_flags & IN6P_IPV6_V6ONLY)
 
#define SCTP_SO_IS_NBIO(so)   ((so)->so_state & SS_NBIO)
 
#define SCTP_SET_SO_NBIO(so)   ((so)->so_state |= SS_NBIO)
 
#define SCTP_CLEAR_SO_NBIO(so)   ((so)->so_state &= ~SS_NBIO)
 
#define SCTP_SO_TYPE(so)   ((so)->so_type)
 
#define sb_cc   sb_acc
 
#define SCTP_SORESERVE(so, send, recv)   soreserve(so, send, recv)
 
#define SCTP_SOWAKEUP(so)   wakeup(&(so)->so_timeo)
 
#define SCTP_SB_CLEAR(sb)
 
#define SCTP_SB_LIMIT_RCV(so)   (SOLISTENING(so) ? so->sol_sbrcv_hiwat : so->so_rcv.sb_hiwat)
 
#define SCTP_SB_LIMIT_SND(so)   (SOLISTENING(so) ? so->sol_sbsnd_hiwat : so->so_snd.sb_hiwat)
 
#define SCTP_RTALLOC(ro, vrf_id, fibnum)
 
#define M_NOTIFICATION   M_PROTO1 /* SCTP notification */
 
#define SCTP_IP_OUTPUT(result, o_pak, ro, _inp, vrf_id)
 
#define SCTP_IP6_OUTPUT(result, o_pak, ro, ifp, _inp, vrf_id)
 
#define SCTP_READ_RANDOM(buf, len)   arc4rand(buf, len, 0)
 
#define SCTP_SHA1_CTX   SHA1_CTX
 
#define SCTP_SHA1_INIT   SHA1Init
 
#define SCTP_SHA1_UPDATE   SHA1Update
 
#define SCTP_SHA1_FINAL(x, y)   SHA1Final((caddr_t)x, y)
 
#define SCTP_SHA256_CTX   SHA256_CTX
 
#define SCTP_SHA256_INIT   SHA256_Init
 
#define SCTP_SHA256_UPDATE   SHA256_Update
 
#define SCTP_SHA256_FINAL(x, y)   SHA256_Final((caddr_t)x, y)
 
#define SCTP_DECREMENT_AND_CHECK_REFCOUNT(addr)   (atomic_fetchadd_int(addr, -1) == 1)
 
#define SCTP_SAVE_ATOMIC_DECREMENT(addr, val)
 
#define SCTP_IS_LISTENING(inp)   ((inp->sctp_flags & SCTP_PCB_FLAGS_ACCEPTING) != 0)
 

Typedefs

typedef struct uma_zone * sctp_zone_t
 
typedef struct callout sctp_os_timer_t
 
typedef struct route sctp_route_t
 

Functions

 __FBSDID ("$FreeBSD$")
 
 MALLOC_DECLARE (SCTP_M_MAP)
 
 MALLOC_DECLARE (SCTP_M_STRMI)
 
 MALLOC_DECLARE (SCTP_M_STRMO)
 
 MALLOC_DECLARE (SCTP_M_ASC_ADDR)
 
 MALLOC_DECLARE (SCTP_M_ASC_IT)
 
 MALLOC_DECLARE (SCTP_M_AUTH_CL)
 
 MALLOC_DECLARE (SCTP_M_AUTH_KY)
 
 MALLOC_DECLARE (SCTP_M_AUTH_HL)
 
 MALLOC_DECLARE (SCTP_M_AUTH_IF)
 
 MALLOC_DECLARE (SCTP_M_STRESET)
 
 MALLOC_DECLARE (SCTP_M_CMSG)
 
 MALLOC_DECLARE (SCTP_M_COPYAL)
 
 MALLOC_DECLARE (SCTP_M_VRF)
 
 MALLOC_DECLARE (SCTP_M_IFA)
 
 MALLOC_DECLARE (SCTP_M_IFN)
 
 MALLOC_DECLARE (SCTP_M_TIMW)
 
 MALLOC_DECLARE (SCTP_M_MVRF)
 
 MALLOC_DECLARE (SCTP_M_ITER)
 
 MALLOC_DECLARE (SCTP_M_SOCKOPT)
 
 MALLOC_DECLARE (SCTP_M_MCORE)
 
struct mbuf * sctp_get_mbuf_for_msg (unsigned int space_needed, int want_header, int how, int allonebuf, int type)
 
int sctp_syscalls_init (void)
 
int sctp_syscalls_uninit (void)
 

Macro Definition Documentation

◆ _NETINET_SCTP_OS_BSD_H_

#define _NETINET_SCTP_OS_BSD_H_

Definition at line 39 of file sctp_os_bsd.h.

◆ M_NOTIFICATION

#define M_NOTIFICATION   M_PROTO1 /* SCTP notification */

Definition at line 408 of file sctp_os_bsd.h.

◆ MODULE_GLOBAL

#define MODULE_GLOBAL (   __SYMBOL)    V_##__SYMBOL

Definition at line 142 of file sctp_os_bsd.h.

◆ sb_cc

#define sb_cc   sb_acc

Definition at line 379 of file sctp_os_bsd.h.

◆ SCTP_ALIGN_TO_END

#define SCTP_ALIGN_TO_END (   m,
  len 
)    M_ALIGN(m, len)

Definition at line 301 of file sctp_os_bsd.h.

◆ SCTP_ATTACH_CHAIN

#define SCTP_ATTACH_CHAIN (   pak,
  m,
  packet_length 
)
Value:
do { \
pak = m; \
pak->m_pkthdr.len = packet_length; \
} while(0)

Definition at line 350 of file sctp_os_bsd.h.

◆ SCTP_BASE_INFO

#define SCTP_BASE_INFO (   __m)    V_system_base_info.sctppcbinfo.__m

Definition at line 145 of file sctp_os_bsd.h.

◆ SCTP_BASE_STAT

#define SCTP_BASE_STAT (   __m)    V_system_base_info.sctpstat.__m

Definition at line 147 of file sctp_os_bsd.h.

◆ SCTP_BASE_STATS

#define SCTP_BASE_STATS   V_system_base_info.sctpstat

Definition at line 146 of file sctp_os_bsd.h.

◆ SCTP_BASE_SYSCTL

#define SCTP_BASE_SYSCTL (   __m)    V_system_base_info.sctpsysctl.__m

Definition at line 148 of file sctp_os_bsd.h.

◆ SCTP_BASE_VAR

#define SCTP_BASE_VAR (   __m)    V_system_base_info.__m

Definition at line 149 of file sctp_os_bsd.h.

◆ SCTP_BUF_AT

#define SCTP_BUF_AT (   m,
  size 
)    m->m_data + size

Definition at line 294 of file sctp_os_bsd.h.

◆ SCTP_BUF_EXTEND_BASE

#define SCTP_BUF_EXTEND_BASE (   m)    (m->m_ext.ext_buf)

Definition at line 323 of file sctp_os_bsd.h.

◆ SCTP_BUF_EXTEND_REFCNT

#define SCTP_BUF_EXTEND_REFCNT (   m)    (*m->m_ext.ext_cnt)

Definition at line 325 of file sctp_os_bsd.h.

◆ SCTP_BUF_GET_FLAGS

#define SCTP_BUF_GET_FLAGS (   m)    (m->m_flags)

Definition at line 329 of file sctp_os_bsd.h.

◆ SCTP_BUF_IS_EXTENDED

#define SCTP_BUF_IS_EXTENDED (   m)    (m->m_flags & M_EXT)

Definition at line 295 of file sctp_os_bsd.h.

◆ SCTP_BUF_LEN

#define SCTP_BUF_LEN (   m)    (m->m_len)

Definition at line 290 of file sctp_os_bsd.h.

◆ SCTP_BUF_NEXT

#define SCTP_BUF_NEXT (   m)    (m->m_next)

Definition at line 291 of file sctp_os_bsd.h.

◆ SCTP_BUF_NEXT_PKT

#define SCTP_BUF_NEXT_PKT (   m)    (m->m_nextpkt)

Definition at line 292 of file sctp_os_bsd.h.

◆ SCTP_BUF_PREPEND

#define SCTP_BUF_PREPEND   M_PREPEND

Definition at line 299 of file sctp_os_bsd.h.

◆ SCTP_BUF_RECVIF

#define SCTP_BUF_RECVIF (   m)    (m->m_pkthdr.rcvif)

Definition at line 298 of file sctp_os_bsd.h.

◆ SCTP_BUF_RESV_UF

#define SCTP_BUF_RESV_UF (   m,
  size 
)    m->m_data += size

Definition at line 293 of file sctp_os_bsd.h.

◆ SCTP_BUF_SIZE

#define SCTP_BUF_SIZE   M_SIZE

Definition at line 296 of file sctp_os_bsd.h.

◆ SCTP_BUF_TYPE

#define SCTP_BUF_TYPE (   m)    (m->m_type)

Definition at line 297 of file sctp_os_bsd.h.

◆ SCTP_CLEAR_SO_NBIO

#define SCTP_CLEAR_SO_NBIO (   so)    ((so)->so_state &= ~SS_NBIO)

Definition at line 372 of file sctp_os_bsd.h.

◆ SCTP_CTR6

#define SCTP_CTR6   CTR6

Definition at line 133 of file sctp_os_bsd.h.

◆ SCTP_DECREMENT_AND_CHECK_REFCOUNT

#define SCTP_DECREMENT_AND_CHECK_REFCOUNT (   addr)    (atomic_fetchadd_int(addr, -1) == 1)

Definition at line 459 of file sctp_os_bsd.h.

◆ SCTP_DEFAULT_VRFID

#define SCTP_DEFAULT_VRFID   0

Definition at line 200 of file sctp_os_bsd.h.

◆ SCTP_DETACH_HEADER_FROM_CHAIN

#define SCTP_DETACH_HEADER_FROM_CHAIN (   m)

Definition at line 337 of file sctp_os_bsd.h.

◆ SCTP_ENABLE_UDP_CSUM

#define SCTP_ENABLE_UDP_CSUM (   m)
Value:
do { \
m->m_pkthdr.csum_flags = CSUM_UDP; \
m->m_pkthdr.csum_data = offsetof(struct udphdr, uh_sum); \
} while (0)
Definition: udp.h:45

Definition at line 342 of file sctp_os_bsd.h.

◆ SCTP_FREE

#define SCTP_FREE (   var,
  type 
)    free(var, type)

Definition at line 224 of file sctp_os_bsd.h.

◆ SCTP_FREE_SONAME

#define SCTP_FREE_SONAME (   var)    free(var, M_SONAME)

Definition at line 231 of file sctp_os_bsd.h.

◆ SCTP_GATHER_MTU_FROM_IFN_INFO

#define SCTP_GATHER_MTU_FROM_IFN_INFO (   ifn,
  ifn_index 
)    ((ifn != NULL) ? ((struct ifnet *)ifn)->if_mtu : 0)

Definition at line 316 of file sctp_os_bsd.h.

◆ SCTP_GATHER_MTU_FROM_ROUTE

#define SCTP_GATHER_MTU_FROM_ROUTE (   sctp_ifa,
  sa,
  nh 
)    ((uint32_t)((nh != NULL) ? nh->nh_mtu : 0))

Definition at line 317 of file sctp_os_bsd.h.

◆ SCTP_GET_HEADER_FOR_OUTPUT

#define SCTP_GET_HEADER_FOR_OUTPUT (   o_pak)    0

Definition at line 339 of file sctp_os_bsd.h.

◆ SCTP_GET_HLIM

#define SCTP_GET_HLIM (   inp,
  ro 
)    in6_selecthlim(&inp->ip_inp.inp, (ro ? (ro->ro_nh ? (ro->ro_nh->nh_ifp) : (NULL)) : (NULL)));

Definition at line 365 of file sctp_os_bsd.h.

◆ SCTP_GET_IF_INDEX_FROM_ROUTE

#define SCTP_GET_IF_INDEX_FROM_ROUTE (   ro)    (ro)->ro_nh->nh_ifp->if_index

Definition at line 213 of file sctp_os_bsd.h.

◆ SCTP_GET_IFN_VOID_FROM_ROUTE

#define SCTP_GET_IFN_VOID_FROM_ROUTE (   ro)    (void *)ro->ro_nh->nh_ifp

Definition at line 212 of file sctp_os_bsd.h.

◆ SCTP_GET_PKT_VRFID

#define SCTP_GET_PKT_VRFID (   m,
  vrf_id 
)    ((vrf_id = SCTP_DEFAULT_VRFID) != SCTP_DEFAULT_VRFID)

Definition at line 347 of file sctp_os_bsd.h.

◆ sctp_get_tick_count

#define sctp_get_tick_count ( )    (ticks)

Definition at line 282 of file sctp_os_bsd.h.

◆ SCTP_HASH_FREE

#define SCTP_HASH_FREE (   table,
  hashmark 
)    hashdestroy(table, M_PCB, hashmark)

Definition at line 259 of file sctp_os_bsd.h.

◆ SCTP_HASH_INIT

#define SCTP_HASH_INIT (   size,
  hashmark 
)    hashinit_flags(size, M_PCB, hashmark, HASH_NOWAIT)

Definition at line 258 of file sctp_os_bsd.h.

◆ SCTP_HEADER_LEN

#define SCTP_HEADER_LEN (   m)    ((m)->m_pkthdr.len)

Definition at line 338 of file sctp_os_bsd.h.

◆ SCTP_HEADER_TO_CHAIN

#define SCTP_HEADER_TO_CHAIN (   m)    (m)

Definition at line 336 of file sctp_os_bsd.h.

◆ SCTP_IFN_IS_IFT_LOOP

#define SCTP_IFN_IS_IFT_LOOP (   ifn)    ((ifn)->ifn_type == IFT_LOOP)

Definition at line 205 of file sctp_os_bsd.h.

◆ SCTP_IFNAMSIZ

#define SCTP_IFNAMSIZ   IFNAMSIZ

Definition at line 199 of file sctp_os_bsd.h.

◆ SCTP_INIT_VRF_TABLEID

#define SCTP_INIT_VRF_TABLEID (   vrf)

Definition at line 203 of file sctp_os_bsd.h.

◆ SCTP_IP6_OUTPUT

#define SCTP_IP6_OUTPUT (   result,
  o_pak,
  ro,
  ifp,
  _inp,
  vrf_id 
)
Value:
{ \
struct sctp_inpcb *local_inp = _inp; \
\
m_clrprotoflags(o_pak); \
if (local_inp != NULL) { \
result = ip6_output(o_pak, \
local_inp->ip_inp.inp.in6p_outputopts, \
(ro), 0, 0, ifp, NULL); \
} else { \
result = ip6_output(o_pak, NULL, (ro), 0, 0, ifp, NULL); \
} \
}

Definition at line 425 of file sctp_os_bsd.h.

◆ SCTP_IP_OUTPUT

#define SCTP_IP_OUTPUT (   result,
  o_pak,
  ro,
  _inp,
  vrf_id 
)
Value:
{ \
struct sctp_inpcb *local_inp = _inp; \
int o_flgs = IP_RAWOUTPUT; \
\
m_clrprotoflags(o_pak); \
if ((local_inp != NULL) && (local_inp->sctp_socket != NULL)) { \
o_flgs |= local_inp->sctp_socket->so_options & SO_DONTROUTE; \
} \
result = ip_output(o_pak, NULL, ro, o_flgs, 0, NULL); \
}
int ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags, struct ip_moptions *imo, struct inpcb *inp)
Definition: ip_output.c:320
#define IP_RAWOUTPUT
Definition: ip_var.h:166

Definition at line 413 of file sctp_os_bsd.h.

◆ SCTP_IPV6_V6ONLY

#define SCTP_IPV6_V6ONLY (   sctp_inpcb)    ((sctp_inpcb)->ip_inp.inp.inp_flags & IN6P_IPV6_V6ONLY)

Definition at line 368 of file sctp_os_bsd.h.

◆ SCTP_IS_IT_BROADCAST

#define SCTP_IS_IT_BROADCAST (   dst,
 
)    ((m->m_flags & M_PKTHDR) ? in_broadcast(dst, m->m_pkthdr.rcvif) : 0)

Definition at line 356 of file sctp_os_bsd.h.

◆ SCTP_IS_IT_LOOPBACK

#define SCTP_IS_IT_LOOPBACK (   m)    ((m->m_flags & M_PKTHDR) && ((m->m_pkthdr.rcvif == NULL) || (m->m_pkthdr.rcvif->if_type == IFT_LOOP)))

Definition at line 357 of file sctp_os_bsd.h.

◆ SCTP_IS_LISTENING

#define SCTP_IS_LISTENING (   inp)    ((inp->sctp_flags & SCTP_PCB_FLAGS_ACCEPTING) != 0)

Definition at line 480 of file sctp_os_bsd.h.

◆ SCTP_LTRACE_CHK

#define SCTP_LTRACE_CHK (   a,
  b,
  c,
 
)

Definition at line 177 of file sctp_os_bsd.h.

◆ SCTP_LTRACE_ERR_RET

#define SCTP_LTRACE_ERR_RET (   inp,
  stcb,
  net,
  file,
  err 
)

Definition at line 191 of file sctp_os_bsd.h.

◆ SCTP_LTRACE_ERR_RET_PKT

#define SCTP_LTRACE_ERR_RET_PKT (   m,
  inp,
  stcb,
  net,
  file,
  err 
)

Definition at line 190 of file sctp_os_bsd.h.

◆ SCTP_M_COPYM

#define SCTP_M_COPYM   m_copym

Definition at line 261 of file sctp_os_bsd.h.

◆ SCTP_MALLOC

#define SCTP_MALLOC (   var,
  type,
  size,
  name 
)
Value:
do { \
var = (type)malloc(size, name, M_NOWAIT); \
} while (0)

Definition at line 219 of file sctp_os_bsd.h.

◆ SCTP_MALLOC_SONAME

#define SCTP_MALLOC_SONAME (   var,
  type,
  size 
)
Value:
do { \
var = (type)malloc(size, M_SONAME, M_WAITOK | M_ZERO); \
} while (0)

Definition at line 226 of file sctp_os_bsd.h.

◆ SCTP_MAX_VRF_ID

#define SCTP_MAX_VRF_ID   0

Definition at line 197 of file sctp_os_bsd.h.

◆ SCTP_OS_TIMER_ACTIVE

#define SCTP_OS_TIMER_ACTIVE   callout_active

Definition at line 279 of file sctp_os_bsd.h.

◆ SCTP_OS_TIMER_DEACTIVATE

#define SCTP_OS_TIMER_DEACTIVATE   callout_deactivate

Definition at line 280 of file sctp_os_bsd.h.

◆ SCTP_OS_TIMER_INIT

#define SCTP_OS_TIMER_INIT (   tmr)    callout_init(tmr, 1)

Definition at line 269 of file sctp_os_bsd.h.

◆ SCTP_OS_TIMER_PENDING

#define SCTP_OS_TIMER_PENDING   callout_pending

Definition at line 278 of file sctp_os_bsd.h.

◆ SCTP_OS_TIMER_START

#define SCTP_OS_TIMER_START   callout_reset

Definition at line 275 of file sctp_os_bsd.h.

◆ SCTP_OS_TIMER_STOP

#define SCTP_OS_TIMER_STOP   callout_stop

Definition at line 276 of file sctp_os_bsd.h.

◆ SCTP_OS_TIMER_STOP_DRAIN

#define SCTP_OS_TIMER_STOP_DRAIN   callout_drain

Definition at line 277 of file sctp_os_bsd.h.

◆ SCTP_PKTLOG_WRITERS_NEED_LOCK

#define SCTP_PKTLOG_WRITERS_NEED_LOCK   3

Definition at line 311 of file sctp_os_bsd.h.

◆ SCTP_PRINTF

#define SCTP_PRINTF (   params...)    printf(params)

Definition at line 151 of file sctp_os_bsd.h.

◆ SCTP_PROCESS_STRUCT

#define SCTP_PROCESS_STRUCT   struct proc *

Definition at line 233 of file sctp_os_bsd.h.

◆ SCTP_READ_RANDOM

#define SCTP_READ_RANDOM (   buf,
  len 
)    arc4rand(buf, len, 0)

Definition at line 446 of file sctp_os_bsd.h.

◆ SCTP_RELEASE_HEADER

#define SCTP_RELEASE_HEADER (   m)

Definition at line 340 of file sctp_os_bsd.h.

◆ SCTP_RELEASE_PKT

#define SCTP_RELEASE_PKT (   m)    sctp_m_freem(m)

Definition at line 341 of file sctp_os_bsd.h.

◆ SCTP_ROUTE_HAS_VALID_IFN

#define SCTP_ROUTE_HAS_VALID_IFN (   ro)    ((ro)->ro_nh && (ro)->ro_nh->nh_ifp)

Definition at line 214 of file sctp_os_bsd.h.

◆ SCTP_ROUTE_IS_REAL_LOOP

#define SCTP_ROUTE_IS_REAL_LOOP (   ro)    ((ro)->ro_nh && (ro)->ro_nh->nh_ifa && (ro)->ro_nh->nh_ifa->ifa_ifp && (ro)->ro_nh->nh_ifa->ifa_ifp->if_type == IFT_LOOP)

Definition at line 206 of file sctp_os_bsd.h.

◆ SCTP_RTALLOC

#define SCTP_RTALLOC (   ro,
  vrf_id,
  fibnum 
)
Value:
{ \
if ((ro)->ro_nh == NULL) { \
(ro)->ro_nh = rib_lookup(fibnum, &(ro)->ro_dst, NHR_REF, 0); \
} \
}

Definition at line 398 of file sctp_os_bsd.h.

◆ SCTP_SAVE_ATOMIC_DECREMENT

#define SCTP_SAVE_ATOMIC_DECREMENT (   addr,
  val 
)
Value:
{ \
int32_t oldval; \
oldval = atomic_fetchadd_int(addr, -val); \
if (oldval < val) { \
*addr = 0; \
} \
}

Definition at line 470 of file sctp_os_bsd.h.

◆ SCTP_SB_CLEAR

#define SCTP_SB_CLEAR (   sb)
Value:
(sb).sb_cc = 0; \
(sb).sb_mb = NULL; \
(sb).sb_mbcnt = 0;
#define sb_cc
Definition: sctp_os_bsd.h:379

Definition at line 385 of file sctp_os_bsd.h.

◆ SCTP_SB_LIMIT_RCV

#define SCTP_SB_LIMIT_RCV (   so)    (SOLISTENING(so) ? so->sol_sbrcv_hiwat : so->so_rcv.sb_hiwat)

Definition at line 390 of file sctp_os_bsd.h.

◆ SCTP_SB_LIMIT_SND

#define SCTP_SB_LIMIT_SND (   so)    (SOLISTENING(so) ? so->sol_sbsnd_hiwat : so->so_snd.sb_hiwat)

Definition at line 391 of file sctp_os_bsd.h.

◆ SCTP_SET_SO_NBIO

#define SCTP_SET_SO_NBIO (   so)    ((so)->so_state |= SS_NBIO)

Definition at line 371 of file sctp_os_bsd.h.

◆ SCTP_SHA1_CTX

#define SCTP_SHA1_CTX   SHA1_CTX

Definition at line 449 of file sctp_os_bsd.h.

◆ SCTP_SHA1_FINAL

#define SCTP_SHA1_FINAL (   x,
 
)    SHA1Final((caddr_t)x, y)

Definition at line 452 of file sctp_os_bsd.h.

◆ SCTP_SHA1_INIT

#define SCTP_SHA1_INIT   SHA1Init

Definition at line 450 of file sctp_os_bsd.h.

◆ SCTP_SHA1_UPDATE

#define SCTP_SHA1_UPDATE   SHA1Update

Definition at line 451 of file sctp_os_bsd.h.

◆ SCTP_SHA256_CTX

#define SCTP_SHA256_CTX   SHA256_CTX

Definition at line 454 of file sctp_os_bsd.h.

◆ SCTP_SHA256_FINAL

#define SCTP_SHA256_FINAL (   x,
 
)    SHA256_Final((caddr_t)x, y)

Definition at line 457 of file sctp_os_bsd.h.

◆ SCTP_SHA256_INIT

#define SCTP_SHA256_INIT   SHA256_Init

Definition at line 455 of file sctp_os_bsd.h.

◆ SCTP_SHA256_UPDATE

#define SCTP_SHA256_UPDATE   SHA256_Update

Definition at line 456 of file sctp_os_bsd.h.

◆ SCTP_SIZE_OF_VRF_HASH

#define SCTP_SIZE_OF_VRF_HASH   3

Definition at line 198 of file sctp_os_bsd.h.

◆ SCTP_SNPRINTF

#define SCTP_SNPRINTF (   ...)    snprintf(__VA_ARGS__)

Definition at line 303 of file sctp_os_bsd.h.

◆ SCTP_SO_IS_NBIO

#define SCTP_SO_IS_NBIO (   so)    ((so)->so_state & SS_NBIO)

Definition at line 370 of file sctp_os_bsd.h.

◆ SCTP_SO_TYPE

#define SCTP_SO_TYPE (   so)    ((so)->so_type)

Definition at line 374 of file sctp_os_bsd.h.

◆ SCTP_SORESERVE

#define SCTP_SORESERVE (   so,
  send,
  recv 
)    soreserve(so, send, recv)

Definition at line 381 of file sctp_os_bsd.h.

◆ SCTP_SOWAKEUP

#define SCTP_SOWAKEUP (   so)    wakeup(&(so)->so_timeo)

Definition at line 383 of file sctp_os_bsd.h.

◆ SCTP_UNUSED

#define SCTP_UNUSED   __attribute__((unused))

Definition at line 284 of file sctp_os_bsd.h.

◆ SCTP_VRF_ADDR_HASH_SIZE

#define SCTP_VRF_ADDR_HASH_SIZE   16

Definition at line 201 of file sctp_os_bsd.h.

◆ SCTP_VRF_IFN_HASH_SIZE

#define SCTP_VRF_IFN_HASH_SIZE   3

Definition at line 202 of file sctp_os_bsd.h.

◆ SCTP_ZONE_DESTROY

#define SCTP_ZONE_DESTROY (   zone)    uma_zdestroy(zone)

Definition at line 248 of file sctp_os_bsd.h.

◆ SCTP_ZONE_FREE

#define SCTP_ZONE_FREE (   zone,
  element 
)     uma_zfree(zone, element);

Definition at line 255 of file sctp_os_bsd.h.

◆ SCTP_ZONE_GET

#define SCTP_ZONE_GET (   zone,
  type 
)     (type *)uma_zalloc(zone, M_NOWAIT);

Definition at line 251 of file sctp_os_bsd.h.

◆ SCTP_ZONE_INIT

#define SCTP_ZONE_INIT (   zone,
  name,
  size,
  number 
)
Value:
{ \
zone = uma_zcreate(name, size, NULL, NULL, NULL, NULL, UMA_ALIGN_PTR,\
0); \
uma_zone_set_max(zone, number); \
}

Definition at line 242 of file sctp_os_bsd.h.

◆ SCTPDBG

#define SCTPDBG (   level,
  params... 
)

Definition at line 170 of file sctp_os_bsd.h.

◆ SCTPDBG_ADDR

#define SCTPDBG_ADDR (   level,
  addr 
)

Definition at line 171 of file sctp_os_bsd.h.

◆ V_system_base_info

#define V_system_base_info   VNET(system_base_info)

Definition at line 144 of file sctp_os_bsd.h.

Typedef Documentation

◆ sctp_os_timer_t

typedef struct callout sctp_os_timer_t

Definition at line 267 of file sctp_os_bsd.h.

◆ sctp_route_t

typedef struct route sctp_route_t

Definition at line 396 of file sctp_os_bsd.h.

◆ sctp_zone_t

typedef struct uma_zone* sctp_zone_t

Definition at line 241 of file sctp_os_bsd.h.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ MALLOC_DECLARE() [1/20]

MALLOC_DECLARE ( SCTP_M_ASC_ADDR  )

◆ MALLOC_DECLARE() [2/20]

MALLOC_DECLARE ( SCTP_M_ASC_IT  )

◆ MALLOC_DECLARE() [3/20]

MALLOC_DECLARE ( SCTP_M_AUTH_CL  )

◆ MALLOC_DECLARE() [4/20]

MALLOC_DECLARE ( SCTP_M_AUTH_HL  )

◆ MALLOC_DECLARE() [5/20]

MALLOC_DECLARE ( SCTP_M_AUTH_IF  )

◆ MALLOC_DECLARE() [6/20]

MALLOC_DECLARE ( SCTP_M_AUTH_KY  )

◆ MALLOC_DECLARE() [7/20]

MALLOC_DECLARE ( SCTP_M_CMSG  )

◆ MALLOC_DECLARE() [8/20]

MALLOC_DECLARE ( SCTP_M_COPYAL  )

◆ MALLOC_DECLARE() [9/20]

MALLOC_DECLARE ( SCTP_M_IFA  )

◆ MALLOC_DECLARE() [10/20]

MALLOC_DECLARE ( SCTP_M_IFN  )

◆ MALLOC_DECLARE() [11/20]

MALLOC_DECLARE ( SCTP_M_ITER  )

◆ MALLOC_DECLARE() [12/20]

MALLOC_DECLARE ( SCTP_M_MAP  )

◆ MALLOC_DECLARE() [13/20]

MALLOC_DECLARE ( SCTP_M_MCORE  )

◆ MALLOC_DECLARE() [14/20]

MALLOC_DECLARE ( SCTP_M_MVRF  )

◆ MALLOC_DECLARE() [15/20]

MALLOC_DECLARE ( SCTP_M_SOCKOPT  )

◆ MALLOC_DECLARE() [16/20]

MALLOC_DECLARE ( SCTP_M_STRESET  )

◆ MALLOC_DECLARE() [17/20]

MALLOC_DECLARE ( SCTP_M_STRMI  )

◆ MALLOC_DECLARE() [18/20]

MALLOC_DECLARE ( SCTP_M_STRMO  )

◆ MALLOC_DECLARE() [19/20]

MALLOC_DECLARE ( SCTP_M_TIMW  )

◆ MALLOC_DECLARE() [20/20]

MALLOC_DECLARE ( SCTP_M_VRF  )

◆ sctp_get_mbuf_for_msg()

struct mbuf * sctp_get_mbuf_for_msg ( unsigned int  space_needed,
int  want_header,
int  how,
int  allonebuf,
int  type 
)

Definition at line 361 of file sctp_bsd_addr.c.

References SCTP_BASE_SYSCTL, SCTP_BUF_NEXT, SCTP_BUF_SIZE, SCTP_MBUF_IALLOC, and SCTP_MBUF_LOGGING_ENABLE.

Referenced by sctp_add_addr_to_mbuf(), sctp_add_auth_chunk(), sctp_add_cookie(), sctp_add_pad_tombuf(), sctp_arethere_unrecognized_parameters(), sctp_asconf_error_response(), sctp_asconf_success_response(), sctp_build_ctl_nchunk(), sctp_compose_asconf(), sctp_copy_mbufchain(), sctp_copy_out_all(), sctp_generate_cause(), sctp_generate_no_user_data_cause(), sctp_handle_asconf(), sctp_handle_auth(), sctp_handle_cookie_echo(), sctp_handle_stream_reset(), sctp_lower_sosend(), sctp_lowlevel_chunk_output(), sctp_move_to_outqueue(), sctp_notify_adaptation_layer(), sctp_notify_assoc_change(), sctp_notify_authentication(), sctp_notify_partial_delivery_indication(), sctp_notify_peer_addr_change(), sctp_notify_remote_error(), sctp_notify_send_failed(), sctp_notify_send_failed2(), sctp_notify_sender_dry_event(), sctp_notify_shutdown_event(), sctp_notify_stream_reset(), sctp_notify_stream_reset_add(), sctp_notify_stream_reset_tsn(), sctp_process_a_data_chunk(), sctp_process_control(), sctp_process_data(), sctp_process_init_ack(), sctp_send_abort_tcb(), sctp_send_cookie_ack(), sctp_send_cwr(), sctp_send_deferred_reset_response(), sctp_send_ecn_echo(), sctp_send_hb(), sctp_send_initiate(), sctp_send_initiate_ack(), sctp_send_packet_dropped(), sctp_send_resp_msg(), sctp_send_sack(), sctp_send_shutdown(), sctp_send_shutdown_ack(), sctp_send_shutdown_complete(), sctp_send_str_reset_req(), sctp_send_stream_reset_out_if_possible(), sctp_sendall_iterator(), and send_forward_tsn().

◆ sctp_syscalls_init()

int sctp_syscalls_init ( void  )

Definition at line 103 of file sctp_syscalls.c.

References sctp_syscalls.

Referenced by sctp_module_load().

Here is the caller graph for this function:

◆ sctp_syscalls_uninit()

int sctp_syscalls_uninit ( void  )

Definition at line 123 of file sctp_syscalls.c.

References sctp_syscalls.

Referenced by sctp_module_unload().

Here is the caller graph for this function: