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

Function sctp_initiate_iterator

freebsd/netinet/sctp_pcb.c:7020–7094  ·  view source on GitHub ↗

* start a new iterator * iterates through all endpoints and associations based on the pcb_state * flags and asoc_state. "af" (mandatory) is executed for all matching * assocs and "ef" (optional) is executed when the iterator completes. * "inpf" (optional) is executed for each new endpoint as it is being * iterated through. inpe (optional) is called when the inp completes * its way through a

Source from the content-addressed store, hash-verified

7018 * its way through all the stcbs.
7019 */
7020int
7021sctp_initiate_iterator(inp_func inpf,
7022 asoc_func af,
7023 inp_func inpe,
7024 uint32_t pcb_state,
7025 uint32_t pcb_features,
7026 uint32_t asoc_state,
7027 void *argp,
7028 uint32_t argi,
7029 end_func ef,
7030 struct sctp_inpcb *s_inp,
7031 uint8_t chunk_output_off)
7032{
7033 struct sctp_iterator *it = NULL;
7034
7035 if (af == NULL) {
7036 return (-1);
7037 }
7038 if (SCTP_BASE_VAR(sctp_pcb_initialized) == 0) {
7039 SCTP_PRINTF("%s: abort on initialize being %d\n", __func__,
7040 SCTP_BASE_VAR(sctp_pcb_initialized));
7041 return (-1);
7042 }
7043 SCTP_MALLOC(it, struct sctp_iterator *, sizeof(struct sctp_iterator),
7044 SCTP_M_ITER);
7045 if (it == NULL) {
7046 SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_PCB, ENOMEM);
7047 return (-1);
7048 }
7049 memset(it, 0, sizeof(*it));
7050 it->function_assoc = af;
7051 it->function_inp = inpf;
7052 if (inpf)
7053 it->done_current_ep = 0;
7054 else
7055 it->done_current_ep = 1;
7056 it->function_atend = ef;
7057 it->pointer = argp;
7058 it->val = argi;
7059 it->pcb_flags = pcb_state;
7060 it->pcb_features = pcb_features;
7061 it->asoc_state = asoc_state;
7062 it->function_inp_end = inpe;
7063 it->no_chunk_output = chunk_output_off;
7064 it->vn = curvnet;
7065 if (s_inp) {
7066 /* Assume lock is held here */
7067 it->inp = s_inp;
7068 SCTP_INP_INCR_REF(it->inp);
7069 it->iterator_flags = SCTP_ITERATOR_DO_SINGLE_INP;
7070 } else {
7071 SCTP_INP_INFO_RLOCK();
7072 it->inp = LIST_FIRST(&SCTP_BASE_INFO(listhead));
7073 if (it->inp) {
7074 SCTP_INP_INCR_REF(it->inp);
7075 }
7076 SCTP_INP_INFO_RUNLOCK();
7077 it->iterator_flags = SCTP_ITERATOR_DO_ALL_INP;

Callers 3

sctp_sendallFunction · 0.85
sctp_handle_addr_wqFunction · 0.85
sctp_addr_mgmt_ep_saFunction · 0.85

Calls 2

memsetFunction · 0.85
sctp_wakeup_iteratorFunction · 0.85

Tested by

no test coverage detected