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

Function sctp_copy_it_in

freebsd/netinet/sctp_output.c:12318–12408  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12316}
12317
12318static struct sctp_stream_queue_pending *
12319sctp_copy_it_in(struct sctp_tcb *stcb,
12320 struct sctp_association *asoc,
12321 struct sctp_sndrcvinfo *srcv,
12322 struct uio *uio,
12323 struct sctp_nets *net,
12324 ssize_t max_send_len,
12325 int user_marks_eor,
12326 int *error)
12327{
12328
12329 /*-
12330 * This routine must be very careful in its work. Protocol
12331 * processing is up and running so care must be taken to spl...()
12332 * when you need to do something that may effect the stcb/asoc. The
12333 * sb is locked however. When data is copied the protocol processing
12334 * should be enabled since this is a slower operation...
12335 */
12336 struct sctp_stream_queue_pending *sp = NULL;
12337 int resv_in_first;
12338
12339 *error = 0;
12340 /* Now can we send this? */
12341 if ((SCTP_GET_STATE(stcb) == SCTP_STATE_SHUTDOWN_SENT) ||
12342 (SCTP_GET_STATE(stcb) == SCTP_STATE_SHUTDOWN_ACK_SENT) ||
12343 (SCTP_GET_STATE(stcb) == SCTP_STATE_SHUTDOWN_RECEIVED) ||
12344 (asoc->state & SCTP_STATE_SHUTDOWN_PENDING)) {
12345 /* got data while shutting down */
12346 SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ECONNRESET);
12347 *error = ECONNRESET;
12348 goto out_now;
12349 }
12350 sctp_alloc_a_strmoq(stcb, sp);
12351 if (sp == NULL) {
12352 SCTP_LTRACE_ERR_RET(NULL, stcb, net, SCTP_FROM_SCTP_OUTPUT, ENOMEM);
12353 *error = ENOMEM;
12354 goto out_now;
12355 }
12356 sp->act_flags = 0;
12357 sp->sender_all_done = 0;
12358 sp->sinfo_flags = srcv->sinfo_flags;
12359 sp->timetolive = srcv->sinfo_timetolive;
12360 sp->ppid = srcv->sinfo_ppid;
12361 sp->context = srcv->sinfo_context;
12362 sp->fsn = 0;
12363 (void)SCTP_GETTIME_TIMEVAL(&sp->ts);
12364
12365 sp->sid = srcv->sinfo_stream;
12366 sp->length = (uint32_t)min(uio->uio_resid, max_send_len);
12367 if ((sp->length == (uint32_t)uio->uio_resid) &&
12368 ((user_marks_eor == 0) ||
12369 (srcv->sinfo_flags & SCTP_EOF) ||
12370 (user_marks_eor && (srcv->sinfo_flags & SCTP_EOR)))) {
12371 sp->msg_is_complete = 1;
12372 } else {
12373 sp->msg_is_complete = 0;
12374 }
12375 sp->sender_all_done = 0;

Callers 1

sctp_lower_sosendFunction · 0.85

Calls 4

minFunction · 0.85
sctp_auth_key_acquireFunction · 0.85
sctp_copy_oneFunction · 0.85
sctp_set_prsctp_policyFunction · 0.85

Tested by

no test coverage detected