Changeset eea65f4 in mainline for uspace/srv/net/tl/tcp/rqueue.c


Ignore:
Timestamp:
2011-11-21T21:16:23Z (12 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6896409c
Parents:
004a5fe
Message:

PDU encoding and decoding.

File:
1 edited

Legend:

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

    r004a5fe reea65f4  
    4141#include <thread.h>
    4242#include "conn.h"
     43#include "header.h"
    4344#include "rqueue.h"
     45#include "segment.h"
    4446#include "state.h"
    4547#include "tcp_type.h"
     48
     49/** Transcode bounced segments.
     50 *
     51 * If defined, segments bounced via the internal debugging loopback will
     52 * be encoded to a PDU and the decoded. Otherwise they will be bounced back
     53 * directly without passing the encoder-decoder.
     54 */
     55#define BOUNCE_TRANSCODE
    4656
    4757static prodcons_t rqueue;
     
    6676        log_msg(LVL_DEBUG, "tcp_rqueue_bounce_seg()");
    6777
     78#ifdef BOUNCE_TRANSCODE
     79        tcp_pdu_t *pdu;
     80        tcp_segment_t *dseg;
     81
     82        if (tcp_pdu_encode(sp, seg, &pdu) != EOK) {
     83                log_msg(LVL_WARN, "Not enough memory. Segment dropped.");
     84                return;
     85        }
     86
     87        if (tcp_pdu_decode(pdu, &rident, &dseg) != EOK) {
     88                log_msg(LVL_WARN, "Not enough memory. Segment dropped.");
     89                return;
     90        }
     91
     92        tcp_pdu_delete(pdu);
     93
     94        /** Insert decoded segment into rqueue */
     95        tcp_rqueue_insert_seg(&rident, dseg);
     96        tcp_segment_delete(seg);
     97#else
    6898        /* Reverse the identification */
    6999        tcp_sockpair_flipped(sp, &rident);
    70100
     101        /* Insert segment back into rqueue */
    71102        tcp_rqueue_insert_seg(&rident, seg);
     103#endif
    72104}
    73105
Note: See TracChangeset for help on using the changeset viewer.