Changeset 9520af7 in mainline for uspace/srv/net/tcp/rqueue.c


Ignore:
Timestamp:
2017-09-12T15:48:01Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1d40c93d
Parents:
0a1e7e4
Message:

Allow TCP conn tests that involve transferring data by enabling an internal loopback. Add simple →SYN, ←RST test.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/tcp/rqueue.c

    r0a1e7e4 r9520af7  
    4343#include <fibril_synch.h>
    4444#include "conn.h"
    45 #include "pdu.h"
    4645#include "rqueue.h"
    4746#include "segment.h"
    4847#include "tcp_type.h"
    4948#include "ucall.h"
    50 
    51 /** Transcode bounced segments.
    52  *
    53  * If defined, segments bounced via the internal debugging loopback will
    54  * be encoded to a PDU and the decoded. Otherwise they will be bounced back
    55  * directly without passing the encoder-decoder.
    56  */
    57 #define BOUNCE_TRANSCODE
    5849
    5950static prodcons_t rqueue;
     
    8778}
    8879
    89 /** Bounce segment directy into receive queue without constructing the PDU.
    90  *
    91  * This is for testing purposes only.
    92  *
    93  * @param sp    Endpoint pair, oriented for transmission
    94  * @param seg   Segment
    95  */
    96 void tcp_rqueue_bounce_seg(inet_ep2_t *epp, tcp_segment_t *seg)
    97 {
    98         inet_ep2_t rident;
    99 
    100         log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_rqueue_bounce_seg()");
    101 
    102 #ifdef BOUNCE_TRANSCODE
    103         tcp_pdu_t *pdu;
    104         tcp_segment_t *dseg;
    105 
    106         if (tcp_pdu_encode(epp, seg, &pdu) != EOK) {
    107                 log_msg(LOG_DEFAULT, LVL_WARN, "Not enough memory. Segment dropped.");
    108                 return;
    109         }
    110 
    111         if (tcp_pdu_decode(pdu, &rident, &dseg) != EOK) {
    112                 log_msg(LOG_DEFAULT, LVL_WARN, "Not enough memory. Segment dropped.");
    113                 return;
    114         }
    115 
    116         tcp_pdu_delete(pdu);
    117 
    118         /** Insert decoded segment into rqueue */
    119         tcp_rqueue_insert_seg(&rident, dseg);
    120         tcp_segment_delete(seg);
    121 #else
    122         /* Reverse the identification */
    123         tcp_ep2_flipped(epp, &rident);
    124 
    125         /* Insert segment back into rqueue */
    126         tcp_rqueue_insert_seg(&rident, seg);
    127 #endif
    128 }
    129 
    13080/** Insert segment into receive queue.
    13181 *
    13282 * @param epp   Endpoint pair, oriented for reception
    133  * @param seg   Segment
     83 * @param seg   Segment (ownership transferred to rqueue)
    13484 */
    13585void tcp_rqueue_insert_seg(inet_ep2_t *epp, tcp_segment_t *seg)
Note: See TracChangeset for help on using the changeset viewer.