Changeset 6843a9c in mainline for uspace/srv/net


Ignore:
Timestamp:
2012-06-29T13:02:14Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
722912e
Parents:
ba72f2b (diff), 0bbd13e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

Trivial conflicts.

Location:
uspace/srv/net
Files:
70 added
24 deleted
11 moved

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/ethip/atrans.h

    rba72f2b r6843a9c  
    11/*
    2  * Copyright (c) 2009 Lukas Mejdrech
     2 * Copyright (c) 2012 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup libnet
     29/** @addtogroup inet
    3030 * @{
    3131 */
    32 
    33 /** @file
    34  * ICMP client interface.
     32/**
     33 * @file
     34 * @brief
    3535 */
    3636
    37 #ifndef LIBNET_ICMP_CLIENT_H_
    38 #define LIBNET_ICMP_CLIENT_H_
     37#ifndef ATRANS_H_
     38#define ATRANS_H_
    3939
    40 #include <net/icmp_codes.h>
    41 #include <net/packet.h>
     40#include <inet/iplink_srv.h>
     41#include "ethip.h"
    4242
    43 extern int icmp_client_process_packet(packet_t *, icmp_type_t *, icmp_code_t *,
    44     icmp_param_t *, icmp_param_t *);
    45 extern size_t icmp_client_header_length(packet_t *);
     43extern int atrans_add(iplink_srv_addr_t *, mac48_addr_t *);
     44extern int atrans_remove(iplink_srv_addr_t *);
     45extern int atrans_lookup(iplink_srv_addr_t *, mac48_addr_t *);
     46extern int atrans_wait_timeout(suseconds_t);
    4647
    4748#endif
  • uspace/srv/net/inetsrv/icmp_std.h

    rba72f2b r6843a9c  
    11/*
    2  * Copyright (c) 2009 Lukas Mejdrech
     2 * Copyright (c) 2012 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup libc
     29/** @addtogroup inet
    3030 * @{
    3131 */
    32 
    33 /** @file
    34  * ICMP module application interface.
     32/**
     33 * @file ICMP standard definitions
     34 *
    3535 */
    3636
    37 #ifndef LIBC_ICMP_API_H_
    38 #define LIBC_ICMP_API_H_
     37#ifndef ICMP_STD_H_
     38#define ICMP_STD_H_
    3939
    40 #include <net/socket_codes.h>
    41 #include <net/inet.h>
    4240#include <sys/types.h>
    43 #include <sys/time.h>
    44 #include <adt/measured_strings.h>
    45 #include <net/ip_codes.h>
    46 #include <net/icmp_codes.h>
    47 #include <net/icmp_common.h>
    48 #include <async.h>
    4941
    50 /** @name ICMP module application interface
    51  * This interface is used by other application modules.
    52  */
    53 /*@{*/
     42#define IP_PROTO_ICMP 1
    5443
    55 extern int icmp_echo_msg(async_sess_t *, size_t, mseconds_t, ip_ttl_t, ip_tos_t,
    56     int, const struct sockaddr *, socklen_t);
     44/** Type of service used for ICMP */
     45#define ICMP_TOS        0
    5746
    58 /*@}*/
     47/** ICMP message type */
     48enum icmp_type {
     49        ICMP_ECHO_REPLY   = 0,
     50        ICMP_ECHO_REQUEST = 8
     51};
     52
     53/** ICMP Echo Request or Reply message header */
     54typedef struct {
     55        /** ICMP message type */
     56        uint8_t type;
     57        /** Code (0) */
     58        uint8_t code;
     59        /** Internet checksum of the ICMP message */
     60        uint16_t checksum;
     61        /** Indentifier */
     62        uint16_t ident;
     63        /** Sequence number */
     64        uint16_t seq_no;
     65} icmp_echo_t;
    5966
    6067#endif
  • uspace/srv/net/tcp/Makefile

    rba72f2b r6843a9c  
    11#
    2 # Copyright (c) 2005 Martin Decky
    3 # Copyright (c) 2007 Jakub Jermar
     2# Copyright (c) 2011 Jiri Svoboda
    43# All rights reserved.
    54#
     
    2827#
    2928
    30 USPACE_PREFIX = ../../../..
     29USPACE_PREFIX = ../../..
    3130LIBS = $(LIBNET_PREFIX)/libnet.a
    3231EXTRA_CFLAGS = -I$(LIBNET_PREFIX)/include
     
    3433
    3534SOURCES = \
    36         tcp.c
     35        conn.c \
     36        iqueue.c \
     37        ncsim.c \
     38        pdu.c \
     39        rqueue.c \
     40        segment.c \
     41        seq_no.c \
     42        sock.c \
     43        tcp.c \
     44        test.c \
     45        tqueue.c \
     46        ucall.c
    3747
    3848include $(USPACE_PREFIX)/Makefile.common
  • uspace/srv/net/tcp/segment.h

    rba72f2b r6843a9c  
    11/*
    2  * Copyright (c) 2009 Lukas Mejdrech
     2 * Copyright (c) 2011 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup libnet
     29/** @addtogroup tcp
    3030 * @{
    3131 */
    32 
    33 /** @file
    34  * Ethernet protocol numbers according to the on-line IANA - Ethernet numbers
    35  * http://www.iana.org/assignments/ethernet-numbers
    36  * cited January 17 2009.
     32/** @file Segment processing
    3733 */
    3834
    39 #ifndef LIBNET_ETHERNET_PROTOCOLS_H_
    40 #define LIBNET_ETHERNET_PROTOCOLS_H_
     35#ifndef SEGMENT_H
     36#define SEGMENT_H
    4137
    4238#include <sys/types.h>
     39#include "tcp_type.h"
    4340
    44 /** Ethernet protocol type definition. */
    45 typedef uint16_t eth_type_t;
     41extern tcp_segment_t *tcp_segment_new(void);
     42extern void tcp_segment_delete(tcp_segment_t *);
     43extern tcp_segment_t *tcp_segment_dup(tcp_segment_t *);
     44extern tcp_segment_t *tcp_segment_make_ctrl(tcp_control_t);
     45extern tcp_segment_t *tcp_segment_make_rst(tcp_segment_t *);
     46extern tcp_segment_t *tcp_segment_make_data(tcp_control_t, void *, size_t);
     47extern void tcp_segment_trim(tcp_segment_t *, uint32_t, uint32_t);
     48extern void tcp_segment_text_copy(tcp_segment_t *, void *, size_t);
     49extern size_t tcp_segment_text_size(tcp_segment_t *);
     50extern void tcp_segment_dump(tcp_segment_t *);
    4651
    47 /** @name Ethernet protocols definitions */
    48 /*@{*/
    4952
    50 /** Ethernet minimal protocol number.
    51  * According to the IEEE 802.3 specification.
    52  */
    53 #define ETH_MIN_PROTO           0x0600 /* 1536 */
    54 
    55 /** Internet IP (IPv4) ethernet protocol type. */
    56 #define ETH_P_IP                0x0800
    57 
    58 /** ARP ethernet protocol type. */
    59 #define ETH_P_ARP               0x0806
    60 
    61 /*@}*/
    6253
    6354#endif
  • uspace/srv/net/tcp/seq_no.h

    rba72f2b r6843a9c  
    11/*
    2  * Copyright (c) 2009 Lukas Mejdrech
     2 * Copyright (c) 2011 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup libnet
     29/** @addtogroup tcp
    3030 * @{
    3131 */
    32 
    33 /** @file
    34  * Internetwork layer module interface for the underlying network interface
    35  * layer. This interface is always called by the remote modules.
     32/** @file Sequence number computations
    3633 */
    3734
    38 #ifndef LIBNET_IL_REMOTE_H_
    39 #define LIBNET_IL_REMOTE_H_
     35#ifndef SEQ_NO_H
     36#define SEQ_NO_H
    4037
    41 #include <ipc/services.h>
    4238#include <sys/types.h>
    43 #include <net/device.h>
    44 #include <net/packet.h>
    45 #include <async.h>
     39#include "tcp_type.h"
    4640
    47 /** @name Internetwork layer module interface
    48  * This interface is used by other modules.
    49  */
    50 /*@{*/
     41extern bool seq_no_ack_acceptable(tcp_conn_t *, uint32_t);
     42extern bool seq_no_ack_duplicate(tcp_conn_t *, uint32_t);
     43extern bool seq_no_in_rcv_wnd(tcp_conn_t *, uint32_t);
     44extern bool seq_no_new_wnd_update(tcp_conn_t *, tcp_segment_t *);
     45extern bool seq_no_segment_acked(tcp_conn_t *, tcp_segment_t *, uint32_t);
     46extern bool seq_no_syn_acked(tcp_conn_t *);
     47extern bool seq_no_segment_ready(tcp_conn_t *, tcp_segment_t *);
     48extern bool seq_no_segment_acceptable(tcp_conn_t *, tcp_segment_t *);
     49extern void seq_no_seg_trim_calc(tcp_conn_t *, tcp_segment_t *, uint32_t *,
     50    uint32_t *);
     51extern int seq_no_seg_cmp(tcp_conn_t *, tcp_segment_t *, tcp_segment_t *);
    5152
    52 extern int il_device_state_msg(async_sess_t *, nic_device_id_t,
    53     nic_device_state_t, services_t);
    54 extern int il_received_msg(async_sess_t *, nic_device_id_t, packet_t *,
    55     services_t);
    56 extern int il_mtu_changed_msg(async_sess_t *, nic_device_id_t, size_t,
    57     services_t);
    58 extern int il_addr_changed_msg(async_sess_t *, nic_device_id_t, size_t,
    59     const uint8_t *);
    60 
    61 /*@}*/
     53extern uint32_t seq_no_control_len(tcp_control_t);
    6254
    6355#endif
  • uspace/srv/net/tcp/sock.h

    rba72f2b r6843a9c  
    11/*
    2  * Copyright (c) 2006 Jakub Vana
     2 * Copyright (c) 2011 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup ia32
     29/** @addtogroup tcp
    3030 * @{
    3131 */
    32 /** @file
     32/** @file Socket provider
    3333 */
    3434
    35 #ifndef KERN_ia32_VESA_H_
    36 #define KERN_ia32_VESA_H_
     35#ifndef SOCK_H
     36#define SOCK_H
    3737
    38 #include <typedefs.h>
     38#include <async.h>
    3939
    40 extern bool vesa_init(void);
     40extern int tcp_sock_init(void);
    4141
    4242#endif
  • uspace/srv/net/tcp/tcp.h

    rba72f2b r6843a9c  
    11/*
    2  * Copyright (c) 2009 Lukas Mejdrech
     2 * Copyright (c) 2011 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup libc
    30  *  @{
     29/** @addtogroup tcp
     30 * @{
     31 */
     32/** @file TCP (Transmission Control Protocol) network module
    3133 */
    3234
    33 /** @file
    34  * ICMP module common interface.
    35  */
     35#ifndef TCP_H
     36#define TCP_H
    3637
    37 #ifndef LIBC_ICMP_COMMON_H_
    38 #define LIBC_ICMP_COMMON_H_
     38#include <async.h>
     39#include "tcp_type.h"
    3940
    40 #include <ipc/services.h>
    41 #include <sys/time.h>
    42 #include <async.h>
    43 
    44 extern async_sess_t *icmp_connect_module(void);
     41extern void tcp_transmit_pdu(tcp_pdu_t *);
    4542
    4643#endif
  • uspace/srv/net/udp/Makefile

    rba72f2b r6843a9c  
    11#
    2 # Copyright (c) 2005 Martin Decky
    3 # Copyright (c) 2007 Jakub Jermar
     2# Copyright (c) 2012 Jiri Svoboda
    43# All rights reserved.
    54#
     
    2827#
    2928
    30 USPACE_PREFIX = ../../../..
     29USPACE_PREFIX = ../../..
    3130LIBS = $(LIBNET_PREFIX)/libnet.a
    3231EXTRA_CFLAGS = -I$(LIBNET_PREFIX)/include
     
    3433
    3534SOURCES = \
    36         udp.c
     35        assoc.c \
     36        msg.c \
     37        sock.c \
     38        pdu.c \
     39        ucall.c \
     40        udp.c \
     41        udp_inet.c
    3742
    3843include $(USPACE_PREFIX)/Makefile.common
  • uspace/srv/net/udp/assoc.h

    rba72f2b r6843a9c  
    11/*
    2  * Copyright (c) 2009 Lukas Mejdrech
     2 * Copyright (c) 2012 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup libnet
     29/** @addtogroup udp
    3030 * @{
    3131 */
    32 
    33 /** @file
    34  * Link service access point identifiers.
     32/** @file UDP associations
    3533 */
    3634
    37 #ifndef LIBNET_ETHERNET_LSAP_H_
    38 #define LIBNET_ETHERNET_LSAP_H_
     35#ifndef ASSOC_H
     36#define ASSOC_H
    3937
    4038#include <sys/types.h>
     39#include "udp_type.h"
    4140
    42 /** Ethernet LSAP type definition. */
    43 typedef uint8_t eth_lsap_t;
     41extern udp_assoc_t *udp_assoc_new(udp_sock_t *, udp_sock_t *);
     42extern void udp_assoc_delete(udp_assoc_t *);
     43extern void udp_assoc_add(udp_assoc_t *);
     44extern void udp_assoc_remove(udp_assoc_t *);
     45extern void udp_assoc_addref(udp_assoc_t *);
     46extern void udp_assoc_delref(udp_assoc_t *);
     47extern void udp_assoc_set_foreign(udp_assoc_t *, udp_sock_t *);
     48extern void udp_assoc_set_local(udp_assoc_t *, udp_sock_t *);
     49extern int udp_assoc_send(udp_assoc_t *, udp_sock_t *, udp_msg_t *);
     50extern int udp_assoc_recv(udp_assoc_t *, udp_msg_t **, udp_sock_t *);
     51extern void udp_assoc_received(udp_sockpair_t *, udp_msg_t *);
    4452
    45 /** @name Ethernet LSAP values definitions */
    46 /*@{*/
    47 
    48 /** Null LSAP LSAP identifier. */
    49 #define ETH_LSAP_NULL   0x00
    50 /** ARPANET Internet Protocol (IP) LSAP identifier. */
    51 #define ETH_LSAP_IP     0x06
    52 /** ARPANET Address Resolution Protocol (ARP) LSAP identifier. */
    53 #define ETH_LSAP_ARP    0x98
    54 /** SubNetwork Access Protocol (SNAP) LSAP identifier. */
    55 #define ETH_LSAP_SNAP   0xAA
    56 /** Global LSAP LSAP identifier. */
    57 #define ETH_LSAP_GLSAP  0xFF
    58 
    59 /*@}*/
    6053
    6154#endif
  • uspace/srv/net/udp/udp.c

    rba72f2b r6843a9c  
    11/*
    2  * Copyright (c) 2008 Lukas Mejdrech
     2 * Copyright (c) 2012 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    3131 */
    3232
    33 /** @file
    34  * UDP module.
     33/**
     34 * @file UDP (User Datagram Protocol) service
    3535 */
    3636
    37 #ifndef NET_UDP_H_
    38 #define NET_UDP_H_
     37#include <async.h>
     38#include <errno.h>
     39#include <io/log.h>
     40#include <stdio.h>
     41#include <task.h>
    3942
    40 #include <async.h>
    41 #include <fibril_synch.h>
    42 #include <socket_core.h>
    43 #include <tl_common.h>
     43#include "udp_inet.h"
     44#include "sock.h"
    4445
    45 /** Type definition of the UDP global data.
    46  * @see udp_globals
     46#define NAME       "udp"
     47
     48static int udp_init(void)
     49{
     50        int rc;
     51
     52        log_msg(LVL_DEBUG, "udp_init()");
     53
     54        rc = udp_inet_init();
     55        if (rc != EOK) {
     56                log_msg(LVL_ERROR, "Failed connecting to internet service.");
     57                return ENOENT;
     58        }
     59
     60        rc = udp_sock_init();
     61        if (rc != EOK) {
     62                log_msg(LVL_ERROR, "Failed initializing socket service.");
     63                return ENOENT;
     64        }
     65
     66        return EOK;
     67}
     68
     69int main(int argc, char **argv)
     70{
     71        int rc;
     72
     73        printf(NAME ": UDP (User Datagram Protocol) service\n");
     74
     75        rc = log_init(NAME, LVL_DEBUG);
     76        if (rc != EOK) {
     77                printf(NAME ": Failed to initialize log.\n");
     78                return 1;
     79        }
     80
     81        rc = udp_init();
     82        if (rc != EOK)
     83                return 1;
     84
     85        printf(NAME ": Accepting connections.\n");
     86        task_retval(0);
     87        async_manager();
     88
     89        /* Not reached */
     90        return 0;
     91}
     92
     93/**
     94 * @}
    4795 */
    48 typedef struct udp_globals udp_globals_t;
    49 
    50 /** UDP global data. */
    51 struct udp_globals {
    52         /** Networking module session. */
    53         async_sess_t *net_sess;
    54         /** IP module session. */
    55         async_sess_t *ip_sess;
    56         /** ICMP module session. */
    57         async_sess_t *icmp_sess;
    58         /** Packet dimension. */
    59         packet_dimension_t packet_dimension;
    60         /** Indicates whether UDP checksum computing is enabled. */
    61         int checksum_computing;
    62         /** Indicates whether UDP autobnding on send is enabled. */
    63         int autobinding;
    64         /** Last used free port. */
    65         int last_used_port;
    66         /** Active sockets. */
    67         socket_ports_t sockets;
    68         /** Device packet dimensions. */
    69         packet_dimensions_t dimensions;
    70         /** Safety lock. */
    71         fibril_rwlock_t lock;
    72 };
    73 
    74 #endif
    75 
    76 /** @}
    77  */
Note: See TracChangeset for help on using the changeset viewer.