Changeset 1d24ad3 in mainline for uspace/srv/net/tcp


Ignore:
Timestamp:
2013-07-03T14:20:04Z (12 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d8b47eca
Parents:
02a09ed
Message:

more IPv6 stub code

Location:
uspace/srv/net/tcp
Files:
2 edited

Legend:

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

    r02a09ed r1d24ad3  
    145145}
    146146
    147 static uint16_t tcp_phdr_setup(tcp_pdu_t *pdu, tcp_phdr_t *phdr)
     147static uint16_t tcp_phdr_setup(tcp_pdu_t *pdu, tcp_phdr_t *phdr,
     148    tcp_phdr6_t *phdr6)
    148149{
    149150        addr32_t src_v4;
     
    167168                break;
    168169        case AF_INET6:
    169                 // FIXME TODO
    170                 assert(false);
     170                host2addr128_t_be(src_v6, phdr6->src);
     171                host2addr128_t_be(dest_v6, phdr6->dest);
     172                phdr6->tcp_length =
     173                    host2uint32_t_be(pdu->header_size + pdu->text_size);
     174                memset(phdr6->zero, 0, 3);
     175                phdr6->next = IP_PROTO_TCP;
     176                break;
    171177        default:
    172178                assert(false);
     
    259265        uint16_t cs_headers;
    260266        tcp_phdr_t phdr;
    261        
    262         uint16_t af = tcp_phdr_setup(pdu, &phdr);
     267        tcp_phdr6_t phdr6;
     268       
     269        uint16_t af = tcp_phdr_setup(pdu, &phdr, &phdr6);
    263270        switch (af) {
    264271        case AF_INET:
     
    267274                break;
    268275        case AF_INET6:
    269                 // FIXME TODO
    270                 assert(false);
     276                cs_phdr = tcp_checksum_calc(TCP_CHECKSUM_INIT, (void *) &phdr6,
     277                    sizeof(tcp_phdr6_t));
     278                break;
    271279        default:
    272280                assert(false);
  • uspace/srv/net/tcp/std.h

    r02a09ed r1d24ad3  
    7575};
    7676
    77 /** TCP pseudo header */
     77/** TCP IPv4 pseudo header */
    7878typedef struct {
    7979        /** Source address */
     
    8888        uint16_t tcp_length;
    8989} tcp_phdr_t;
     90
     91/** TCP IPv6 pseudo header */
     92typedef struct {
     93        /** Source address */
     94        addr128_t src;
     95        /** Destination address */
     96        addr128_t dest;
     97        /** TCP length */
     98        uint32_t tcp_length;
     99        /** Zeroes */
     100        uint8_t zero[3];
     101        /** Next header */
     102        uint8_t next;
     103} tcp_phdr6_t;
    90104
    91105/** Option kind */
Note: See TracChangeset for help on using the changeset viewer.