MCPcopy Create free account
hub / github.com/F-Stack/f-stack / AliasSctpInit

Function AliasSctpInit

freebsd/netinet/libalias/alias_sctp.c:640–666  ·  view source on GitHub ↗

---------------------------------------------------------------------- * CODE BEGINS HERE * ---------------------------------------------------------------------- */ * @brief Initialises the SCTP NAT Implementation * * Creates the look-up tables and the timer queue and initialises all state * variables * * @param la Pointer to the relevant libalias instance */

Source from the content-addressed store, hash-verified

638 * @param la Pointer to the relevant libalias instance
639 */
640void AliasSctpInit(struct libalias *la)
641{
642 /* Initialise association tables*/
643 int i;
644 la->sctpNatTableSize = sysctl_hashtable_size;
645 SN_LOG(SN_LOG_EVENT,
646 SctpAliasLog("Initialising SCTP NAT Instance (hash_table_size:%d)\n", la->sctpNatTableSize));
647 la->sctpTableLocal = sn_calloc(la->sctpNatTableSize, sizeof(struct sctpNatTableL));
648 la->sctpTableGlobal = sn_calloc(la->sctpNatTableSize, sizeof(struct sctpNatTableG));
649 la->sctpNatTimer.TimerQ = sn_calloc(SN_TIMER_QUEUE_SIZE, sizeof(struct sctpTimerQ));
650 /* Initialise hash table */
651 for (i = 0; i < la->sctpNatTableSize; i++) {
652 LIST_INIT(&la->sctpTableLocal[i]);
653 LIST_INIT(&la->sctpTableGlobal[i]);
654 }
655
656 /* Initialise circular timer Q*/
657 for (i = 0; i < SN_TIMER_QUEUE_SIZE; i++)
658 LIST_INIT(&la->sctpNatTimer.TimerQ[i]);
659#ifdef _KERNEL
660 la->sctpNatTimer.loc_time=time_uptime; /* la->timeStamp is not set yet */
661#else
662 la->sctpNatTimer.loc_time=la->timeStamp;
663#endif
664 la->sctpNatTimer.cur_loc = 0;
665 la->sctpLinkCount = 0;
666}
667
668/**
669 * @brief Cleans-up the SCTP NAT Implementation prior to unloading

Callers 1

LibAliasInitFunction · 0.85

Calls 1

SctpAliasLogFunction · 0.85

Tested by

no test coverage detected