Lines Matching defs:chk
176 * Take a chk structure and build it into an mbuf. Hmm should we change things
228 * Take a chk structure and build it into an mbuf. Should we change things
233 sctp_build_ctl(struct sctp_tcb *stcb, struct sctp_tmit_chunk *chk)
254 outinfo->sinfo_stream = chk->rec.data.stream_number;
255 outinfo->sinfo_ssn = chk->rec.data.stream_seq;
256 if (chk->rec.data.rcv_flags & SCTP_DATA_UNORDERED) {
261 outinfo->sinfo_ppid = chk->rec.data.payloadtype;
262 outinfo->sinfo_context = chk->rec.data.context;
264 outinfo->sinfo_tsn = chk->rec.data.TSN_seq;
275 struct sctp_tmit_chunk *chk, int hold_locks)
284 printf("I am now in Deliver data! (%p)\n", chk);
302 if (chk != NULL) {
303 sctp_m_freem(chk->data);
304 chk->data = NULL;
305 sctp_free_remote_addr(chk->whoTo);
306 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, chk);
313 TAILQ_FOREACH(chk, &asoc->delivery_queue, sctp_next) {
314 asoc->size_on_delivery_queue -= chk->send_size;
319 sctp_m_freem(chk->data);
320 chk->data = NULL;
322 sctp_free_remote_addr(chk->whoTo);
323 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, chk);
335 if (chk != NULL) {
336 TAILQ_INSERT_TAIL(&asoc->delivery_queue, chk, sctp_next);
337 asoc->size_on_delivery_queue += chk->send_size;
356 chk = TAILQ_FIRST(&asoc->delivery_queue);
357 if (chk == NULL) {
381 printf("Now to the delivery with chk(%p)!\n", chk);
385 if ((chk->data->m_flags & M_PKTHDR) == 0) {
394 m->m_pkthdr.len = chk->send_size;
396 m->m_next = chk->data;
397 chk->data = m;
399 if (chk->rec.data.rcv_flags & SCTP_DATA_LAST_FRAG) {
400 if (chk->data->m_next == NULL) {
402 chk->data->m_flags |= M_EOR;
405 m = chk->data;
413 if (chk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) {
416 control = sctp_build_ctl(stcb, chk);
417 to = rtcache_getdst(&chk->whoTo->ro);
432 chk->whoTo,
437 if (sctp_sbspace(&stcb->sctp_socket->so_rcv) < (long)chk->send_size) {
447 to, chk->data, control, stcb->asoc.my_vtag,
469 (long)chk->send_size) {
470 sbappend(&stcb->sctp_socket->so_rcv, chk->data);
487 TAILQ_REMOVE(&asoc->delivery_queue, chk, sctp_next);
488 asoc->size_on_delivery_queue -= chk->send_size;
491 chk->data = NULL;
493 sctp_free_remote_addr(chk->whoTo);
494 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, chk);
516 struct sctp_tmit_chunk *chk, *at;
534 TAILQ_FOREACH(chk, &asoc->reasmqueue, sctp_next) {
535 asoc->size_on_delivery_queue -= chk->send_size;
540 sctp_m_freem(chk->data);
541 chk->data = NULL;
543 sctp_free_remote_addr(chk->whoTo);
544 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, chk);
568 chk = TAILQ_FIRST(&asoc->reasmqueue);
569 if (chk == NULL) {
579 if (chk->rec.data.TSN_seq != (asoc->tsn_last_delivered + 1)) {
590 stream_no = chk->rec.data.stream_number;
592 if (nxt_todel != chk->rec.data.stream_seq &&
593 (chk->rec.data.rcv_flags & SCTP_DATA_UNORDERED) == 0) {
608 if ((chk->data->m_flags & M_PKTHDR) == 0) {
617 m->m_pkthdr.len = chk->send_size;
619 m->m_next = chk->data;
620 chk->data = m;
622 if (chk->rec.data.rcv_flags & SCTP_DATA_LAST_FRAG) {
623 if (chk->data->m_next == NULL) {
625 chk->data->m_flags |= M_EOR;
628 m = chk->data;
635 if (chk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) {
638 control = sctp_build_ctl(stcb, chk);
639 to = rtcache_getdst(&chk->whoTo->ro);
654 chk->whoTo,
660 (long)chk->send_size) {
674 to, chk->data, control, stcb->asoc.my_vtag,
700 (long)chk->send_size) {
701 sbappend(&stcb->sctp_socket->so_rcv, chk->data);
714 TAILQ_REMOVE(&asoc->reasmqueue, chk, sctp_next);
715 if (chk->rec.data.rcv_flags & SCTP_DATA_LAST_FRAG) {
717 if ((chk->rec.data.rcv_flags & SCTP_DATA_UNORDERED) == 0) {
721 asoc->tsn_last_delivered = chk->rec.data.TSN_seq;
722 asoc->size_on_reasm_queue -= chk->send_size;
724 /* free up the chk */
725 sctp_free_remote_addr(chk->whoTo);
726 chk->data = NULL;
727 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, chk);
743 chk = TAILQ_FIRST(&strm->inqueue);
744 if (chk && (nxt_todel == chk->rec.data.stream_seq)) {
745 while (chk != NULL) {
748 chk->rec.data.stream_seq) {
749 at = TAILQ_NEXT(chk, sctp_next);
751 chk, sctp_next);
753 chk->send_size;
764 sctp_deliver_data(stcb, asoc, chk, 1);
765 chk = at;
784 chk = TAILQ_FIRST(&asoc->reasmqueue);
785 } while (chk);
802 struct sctp_tmit_chunk *chk, int *abort_flag)
816 asoc->size_on_all_streams += chk->send_size;
818 strm = &asoc->strmin[chk->rec.data.stream_number];
821 sctp_log_strm_del(chk, NULL, SCTP_STR_LOG_FROM_INTO_STRD);
826 (u_int)chk->rec.data.stream_seq,
831 chk->rec.data.stream_seq, MAX_SEQ) ||
832 (strm->last_sequence_delivered == chk->rec.data.stream_seq)) {
837 chk->rec.data.stream_seq,
845 TAILQ_INSERT_HEAD(&strm->inqueue, chk, sctp_next);
866 if (nxt_todel == chk->rec.data.stream_seq) {
874 sctp_log_strm_del(chk, NULL, SCTP_STR_LOG_FROM_IMMED_DEL);
877 asoc->size_on_all_streams -= chk->send_size;
880 sctp_deliver_data(stcb, asoc, chk, 0);
881 chk = TAILQ_FIRST(&strm->inqueue);
882 while (chk != NULL) {
885 if (nxt_todel == chk->rec.data.stream_seq) {
886 at = TAILQ_NEXT(chk, sctp_next);
887 TAILQ_REMOVE(&strm->inqueue, chk, sctp_next);
888 asoc->size_on_all_streams -= chk->send_size;
898 sctp_log_strm_del(chk, NULL,
901 sctp_deliver_data(stcb, asoc, chk, 0);
902 chk = at;
921 sctp_log_strm_del(chk, NULL, SCTP_STR_LOG_FROM_INSERT_HD);
923 TAILQ_INSERT_HEAD(&strm->inqueue, chk, sctp_next);
927 chk->rec.data.stream_seq, MAX_SEQ)) {
933 sctp_log_strm_del(chk, at,
936 TAILQ_INSERT_BEFORE(at, chk, sctp_next);
939 chk->rec.data.stream_seq) {
954 sctp_m_freem(chk->data);
955 chk->data = NULL;
956 asoc->size_on_all_streams -= chk->send_size;
959 sctp_free_remote_addr(chk->whoTo);
960 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, chk);
975 sctp_log_strm_del(chk, at,
979 at, chk, sctp_next);
1005 struct sctp_tmit_chunk *chk;
1009 chk = TAILQ_FIRST(&asoc->reasmqueue);
1010 if (chk == NULL) {
1014 if ((chk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) == 0) {
1018 tsn = chk->rec.data.TSN_seq;
1019 while (chk) {
1020 if (tsn != chk->rec.data.TSN_seq) {
1023 *t_size += chk->send_size;
1024 if (chk->rec.data.rcv_flags & SCTP_DATA_LAST_FRAG) {
1028 chk = TAILQ_NEXT(chk, sctp_next);
1041 struct sctp_tmit_chunk *chk, int *abort_flag)
1054 TAILQ_INSERT_HEAD(&asoc->reasmqueue, chk, sctp_next);
1059 asoc->size_on_reasm_queue = chk->send_size;
1061 if (chk->rec.data.TSN_seq == cum_ackp1) {
1063 (chk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) !=
1094 (chk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) == SCTP_DATA_FIRST_FRAG) {
1125 if (chk->rec.data.stream_number !=
1131 chk->rec.data.stream_number,
1156 chk->rec.data.stream_seq !=
1162 chk->rec.data.stream_seq,
1196 chk->rec.data.TSN_seq, MAX_TSN)) {
1202 asoc->size_on_reasm_queue += chk->send_size;
1205 TAILQ_INSERT_BEFORE(at, chk, sctp_next);
1207 } else if (at->rec.data.TSN_seq == chk->rec.data.TSN_seq) {
1216 sctp_m_freem(chk->data);
1217 chk->data = NULL;
1218 sctp_free_remote_addr(chk->whoTo);
1219 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, chk);
1233 asoc->size_on_reasm_queue += chk->send_size;
1235 TAILQ_INSERT_AFTER(&asoc->reasmqueue, at, chk, sctp_next);
1242 prev_tsn = chk->rec.data.TSN_seq - 1;
1253 * Insert chk MUST be a MIDDLE or LAST fragment
1255 if ((chk->rec.data.rcv_flags & SCTP_DATA_FRAG_MASK) ==
1286 if (chk->rec.data.stream_number !=
1295 chk->rec.data.stream_number,
1324 chk->rec.data.stream_seq !=
1333 chk->rec.data.stream_seq,
1363 /* Insert chk MUST be a FIRST */
1364 if ((chk->rec.data.rcv_flags & SCTP_DATA_FRAG_MASK) !=
1400 post_tsn = chk->rec.data.TSN_seq + 1;
1407 /* Insert chk MUST be a last fragment */
1408 if ((chk->rec.data.rcv_flags&SCTP_DATA_FRAG_MASK)
1412 printf("Next chk - Next is FIRST, we must be LAST\n");
1444 /* Insert chk CAN be MIDDLE or FIRST NOT LAST */
1445 if ((chk->rec.data.rcv_flags & SCTP_DATA_FRAG_MASK) ==
1449 printf("Next chk - Next is a MIDDLE/LAST\n");
1476 if (chk->rec.data.stream_number !=
1484 printf("Next chk - Gak, Evil plot, ssn:%d not the same as at:%d\n",
1485 chk->rec.data.stream_number,
1514 chk->rec.data.stream_seq !=
1522 printf("Next chk - Gak, Evil plot, sseq:%d not the same as at:%d\n",
1523 chk->rec.data.stream_seq,
1560 chk = TAILQ_FIRST(&asoc->reasmqueue);
1561 if (chk == NULL) {
1569 asoc->strmin[chk->rec.data.stream_number].last_sequence_delivered + 1;
1570 if ((chk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) &&
1571 (nxt_todel == chk->rec.data.stream_seq ||
1572 (chk->rec.data.rcv_flags & SCTP_DATA_UNORDERED))) {
1589 chk->rec.data.TSN_seq - 1;
1591 chk->rec.data.stream_number;
1592 asoc->ssn_of_pdapi = chk->rec.data.stream_seq;
1593 asoc->fragment_flags = chk->rec.data.rcv_flags;
1610 struct sctp_tmit_chunk *chk)
1616 if (compare_with_wrap(chk->rec.data.TSN_seq,
1620 if (tsn_est == chk->rec.data.TSN_seq) {
1639 } else if (chk->rec.data.TSN_seq == at->rec.data.TSN_seq) {
1647 tsn_est = chk->rec.data.TSN_seq + 1;
1670 /* struct sctp_tmit_chunk *chk;*/
1671 struct sctp_tmit_chunk *chk;
1678 chk = NULL;
2016 chk = (struct sctp_tmit_chunk *)SCTP_ZONE_GET(sctppcbinfo.ipi_zone_chunk);
2017 if (chk == NULL) {
2028 chk->rec.data.TSN_seq = tsn;
2029 chk->rec.data.stream_seq = strmseq;
2030 chk->rec.data.stream_number = strmno;
2031 chk->rec.data.payloadtype = ch->dp.protocol_id;
2032 chk->rec.data.context = 0;
2033 chk->rec.data.doing_fast_retransmit = 0;
2034 chk->rec.data.rcv_flags = ch->ch.chunk_flags;
2035 chk->asoc = asoc;
2036 chk->send_size = the_len;
2037 chk->whoTo = net;
2039 chk->data = dmbuf;
2044 if ((chk->rec.data.rcv_flags & SCTP_DATA_NOT_FRAG) ==
2057 (estimate_tsn == chk->rec.data.TSN_seq)) {
2081 if (sctp_does_chk_belong_to_reasm(asoc, chk)) {
2111 * validate that this chk does not need to
2115 if (sctp_does_chk_belong_to_reasm(asoc, chk)) {
2142 if (chk->rec.data.rcv_flags & SCTP_DATA_UNORDERED) {
2144 sctp_deliver_data(stcb, asoc, chk, 0);
2167 TAILQ_INSERT_TAIL(&asoc->pending_reply_queue , chk, sctp_next);
2169 sctp_queue_data_to_stream(stcb, asoc, chk, abort_flag);
2174 sctp_queue_data_for_reasm(stcb, asoc, chk, abort_flag);
2356 struct sctp_tmit_chunk *chk;
2360 chk = TAILQ_FIRST(&asoc->pending_reply_queue);
2361 while (chk) {
2362 TAILQ_REMOVE(&asoc->pending_reply_queue, chk, sctp_next);
2363 sctp_queue_data_to_stream(stcb, asoc, chk, abort_flag);
2367 chk = TAILQ_FIRST(&asoc->pending_reply_queue);
2425 struct sctp_tmit_chunk *chk;
2453 chk = TAILQ_FIRST(&asoc->delivery_queue);
2454 } while (chk);
2462 chk = TAILQ_FIRST(&asoc->reasmqueue);
2463 if (chk == NULL) {
2468 nxt_todel = asoc->strmin[chk->rec.data.stream_number].last_sequence_delivered + 1;
2469 if ((chk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) &&
2470 ((nxt_todel == chk->rec.data.stream_seq) ||
2471 (chk->rec.data.rcv_flags & SCTP_DATA_UNORDERED))) {
2489 asoc->tsn_last_delivered = chk->rec.data.TSN_seq-1;
2490 asoc->str_of_pdapi = chk->rec.data.stream_number;
2491 asoc->ssn_of_pdapi = chk->rec.data.stream_seq;
2492 asoc->fragment_flags = chk->rec.data.rcv_flags;
4283 struct sctp_tmit_chunk *chk;
4284 TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) {
4285 if (chk->whoTo == net &&
4286 (chk->sent < SCTP_DATAGRAM_ACKED ||
4287 chk->sent == SCTP_FORWARD_TSN_SKIP)) {
4332 struct sctp_tmit_chunk *chk, *nchk;
4342 chk = TAILQ_FIRST(&strmin->inqueue);
4343 while (chk) {
4344 nchk = TAILQ_NEXT(chk, sctp_next);
4345 if (compare_with_wrap(tt, chk->rec.data.stream_seq, MAX_SEQ) ||
4346 (tt == chk->rec.data.stream_seq)) {
4348 TAILQ_REMOVE(&strmin->inqueue, chk, sctp_next);
4350 asoc->size_on_all_streams -= chk->send_size;
4353 sctp_deliver_data(stcb, &stcb->asoc, chk, 0);
4358 chk = nchk;
4365 chk = TAILQ_FIRST(&strmin->inqueue);
4366 while (chk) {
4367 nchk = TAILQ_NEXT(chk, sctp_next);
4368 if (tt == chk->rec.data.stream_seq) {
4370 TAILQ_REMOVE(&strmin->inqueue, chk, sctp_next);
4372 asoc->size_on_all_streams -= chk->send_size;
4376 chk->rec.data.stream_seq;
4377 sctp_deliver_data(stcb, &stcb->asoc, chk, 0);
4382 chk = nchk;
4421 struct sctp_tmit_chunk *chk, *at;
4533 chk = TAILQ_FIRST(&asoc->reasmqueue);
4534 while (chk) {
4535 at = TAILQ_NEXT(chk, sctp_next);
4537 chk->rec.data.TSN_seq, MAX_TSN) ||
4538 asoc->cumulative_tsn == chk->rec.data.TSN_seq) {
4540 TAILQ_REMOVE(&asoc->reasmqueue, chk, sctp_next);
4541 if (compare_with_wrap(chk->rec.data.TSN_seq,
4544 chk->rec.data.TSN_seq;
4546 chk->rec.data.stream_number;
4548 chk->rec.data.stream_seq;
4550 chk->rec.data.rcv_flags;
4552 asoc->size_on_reasm_queue -= chk->send_size;
4557 if ((chk->rec.data.rcv_flags & SCTP_DATA_UNORDERED) !=
4559 (compare_with_wrap(chk->rec.data.stream_seq,
4560 asoc->strmin[chk->rec.data.stream_number].last_sequence_delivered,
4578 asoc->strmin[chk->rec.data.stream_number].last_sequence_delivered =
4579 chk->rec.data.stream_seq;
4581 sctp_m_freem(chk->data);
4582 chk->data = NULL;
4583 sctp_free_remote_addr(chk->whoTo);
4584 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, chk);
4596 (chk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG)) {
4608 chk = at;