Changeset ee603c4 in mainline for uspace/srv/udp/udp_inet.c


Ignore:
Timestamp:
2012-04-04T21:10:22Z (12 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
92b42442
Parents:
4794417
Message:

UDP associations, sending datagrams.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/udp/udp_inet.c

    r4794417 ree603c4  
    4343#include <task.h>
    4444
    45 /*
    46 #include "pdu.h"
    47 #include "rqueue.h"
    48 */
    4945#include "std.h"
    5046#include "udp_inet.h"
     47#include "udp_type.h"
    5148
    5249static int udp_inet_ev_recv(inet_dgram_t *dgram);
     
    123120
    124121/** Transmit PDU over network layer. */
    125 /*void tcp_transmit_pdu(tcp_pdu_t *pdu)
     122int udp_transmit_pdu(udp_pdu_t *pdu)
    126123{
    127124        int rc;
    128         uint8_t *pdu_raw;
    129         size_t pdu_raw_size;
    130125        inet_dgram_t dgram;
    131126
    132         pdu_raw_size = pdu->header_size + pdu->text_size;
    133         pdu_raw = malloc(pdu_raw_size);
    134         if (pdu_raw == NULL) {
    135                 log_msg(LVL_ERROR, "Failed to transmit PDU. Out of memory.");
    136                 return;
    137         }
    138 
    139         memcpy(pdu_raw, pdu->header, pdu->header_size);
    140         memcpy(pdu_raw + pdu->header_size, pdu->text,
    141             pdu->text_size);
    142 
    143         dgram.src.ipv4 = pdu->src_addr.ipv4;
    144         dgram.dest.ipv4 = pdu->dest_addr.ipv4;
     127        dgram.src.ipv4 = pdu->src.ipv4;
     128        dgram.dest.ipv4 = pdu->dest.ipv4;
    145129        dgram.tos = 0;
    146         dgram.data = pdu_raw;
    147         dgram.size = pdu_raw_size;
     130        dgram.data = pdu->data;
     131        dgram.size = pdu->data_size;
    148132
    149133        rc = inet_send(&dgram, INET_TTL_MAX, 0);
    150134        if (rc != EOK)
    151135                log_msg(LVL_ERROR, "Failed to transmit PDU.");
     136
     137        return rc;
    152138}
    153 */
     139
    154140/** Process received PDU. */
    155141/*
Note: See TracChangeset for help on using the changeset viewer.