Changeset 6843a9c in mainline for uspace/srv/net
- Timestamp:
- 2012-06-29T13:02:14Z (14 years ago)
- 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. - Location:
- uspace/srv/net
- Files:
-
- 70 added
- 24 deleted
- 11 moved
-
cfg/general (deleted)
-
cfg/lo.nic (deleted)
-
cfg/ne2k.nic (deleted)
-
ethip/Makefile (added)
-
ethip/arp.c (added)
-
ethip/arp.h (added)
-
ethip/atrans.c (added)
-
ethip/atrans.h (moved) (moved from uspace/lib/net/include/icmp_client.h ) (2 diffs)
-
ethip/ethip.c (added)
-
ethip/ethip.h (added)
-
ethip/ethip_nic.c (added)
-
ethip/ethip_nic.h (added)
-
ethip/pdu.c (added)
-
ethip/pdu.h (added)
-
ethip/std.h (added)
-
il/arp/Makefile (deleted)
-
il/arp/arp.c (deleted)
-
il/arp/arp.h (deleted)
-
il/ip/Makefile (deleted)
-
il/ip/ip.c (deleted)
-
il/ip/ip.h (deleted)
-
inetsrv/Makefile (added)
-
inetsrv/addrobj.c (added)
-
inetsrv/addrobj.h (added)
-
inetsrv/icmp.c (added)
-
inetsrv/icmp.h (added)
-
inetsrv/icmp_std.h (moved) (moved from uspace/lib/c/include/net/icmp_api.h ) (2 diffs)
-
inetsrv/inet_link.c (added)
-
inetsrv/inet_link.h (added)
-
inetsrv/inet_std.h (added)
-
inetsrv/inet_util.c (added)
-
inetsrv/inet_util.h (added)
-
inetsrv/inetcfg.c (added)
-
inetsrv/inetcfg.h (added)
-
inetsrv/inetping.c (added)
-
inetsrv/inetping.h (added)
-
inetsrv/inetsrv.c (added)
-
inetsrv/inetsrv.h (added)
-
inetsrv/pdu.c (added)
-
inetsrv/pdu.h (added)
-
inetsrv/reass.c (added)
-
inetsrv/reass.h (added)
-
inetsrv/sroute.c (added)
-
inetsrv/sroute.h (added)
-
loopip/Makefile (added)
-
loopip/loopip.c (added)
-
net/Makefile (deleted)
-
net/net.c (deleted)
-
net/net.h (deleted)
-
net/packet_server.c (deleted)
-
nil/eth/Makefile (deleted)
-
nil/eth/eth.c (deleted)
-
nil/eth/eth.h (deleted)
-
nil/nildummy/Makefile (deleted)
-
nil/nildummy/nildummy.c (deleted)
-
nil/nildummy/nildummy.h (deleted)
-
tcp/Makefile (moved) (moved from uspace/srv/net/tl/tcp/Makefile ) (3 diffs)
-
tcp/conn.c (added)
-
tcp/conn.h (added)
-
tcp/iqueue.c (added)
-
tcp/iqueue.h (added)
-
tcp/ncsim.c (added)
-
tcp/ncsim.h (added)
-
tcp/pdu.c (added)
-
tcp/pdu.h (added)
-
tcp/rqueue.c (added)
-
tcp/rqueue.h (added)
-
tcp/segment.c (added)
-
tcp/segment.h (moved) (moved from uspace/lib/net/include/ethernet_protocols.h ) (2 diffs)
-
tcp/seq_no.c (added)
-
tcp/seq_no.h (moved) (moved from uspace/lib/net/include/il_remote.h ) (2 diffs)
-
tcp/sock.c (added)
-
tcp/sock.h (moved) (moved from kernel/arch/ia32/include/drivers/vesa.h ) (2 diffs)
-
tcp/std.h (added)
-
tcp/tcp.c (added)
-
tcp/tcp.h (moved) (moved from uspace/lib/c/include/net/icmp_common.h ) (2 diffs)
-
tcp/tcp_header.h (moved) (moved from uspace/srv/net/tl/tcp/tcp_header.h )
-
tcp/tcp_type.h (added)
-
tcp/test.c (added)
-
tcp/test.h (added)
-
tcp/tqueue.c (added)
-
tcp/tqueue.h (added)
-
tcp/ucall.c (added)
-
tcp/ucall.h (added)
-
tl/icmp/Makefile (deleted)
-
tl/icmp/icmp.c (deleted)
-
tl/tcp/tcp.c (deleted)
-
tl/tcp/tcp.h (deleted)
-
tl/udp/udp.c (deleted)
-
udp/Makefile (moved) (moved from uspace/srv/net/tl/udp/Makefile ) (3 diffs)
-
udp/assoc.c (added)
-
udp/assoc.h (moved) (moved from uspace/lib/net/include/ethernet_lsap.h ) (2 diffs)
-
udp/msg.c (added)
-
udp/msg.h (added)
-
udp/pdu.c (added)
-
udp/pdu.h (added)
-
udp/sock.c (added)
-
udp/sock.h (added)
-
udp/std.h (added)
-
udp/ucall.c (added)
-
udp/ucall.h (added)
-
udp/udp.c (moved) (moved from uspace/srv/net/tl/udp/udp.h ) (2 diffs)
-
udp/udp_inet.c (added)
-
udp/udp_inet.h (added)
-
udp/udp_type.h (added)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/ethip/atrans.h
rba72f2b r6843a9c 1 1 /* 2 * Copyright (c) 20 09 Lukas Mejdrech2 * Copyright (c) 2012 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup libnet29 /** @addtogroup inet 30 30 * @{ 31 31 */ 32 33 /** @file34 * ICMP client interface.32 /** 33 * @file 34 * @brief 35 35 */ 36 36 37 #ifndef LIBNET_ICMP_CLIENT_H_38 #define LIBNET_ICMP_CLIENT_H_37 #ifndef ATRANS_H_ 38 #define ATRANS_H_ 39 39 40 #include < net/icmp_codes.h>41 #include <net/packet.h>40 #include <inet/iplink_srv.h> 41 #include "ethip.h" 42 42 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 *); 43 extern int atrans_add(iplink_srv_addr_t *, mac48_addr_t *); 44 extern int atrans_remove(iplink_srv_addr_t *); 45 extern int atrans_lookup(iplink_srv_addr_t *, mac48_addr_t *); 46 extern int atrans_wait_timeout(suseconds_t); 46 47 47 48 #endif -
uspace/srv/net/inetsrv/icmp_std.h
rba72f2b r6843a9c 1 1 /* 2 * Copyright (c) 20 09 Lukas Mejdrech2 * Copyright (c) 2012 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup libc29 /** @addtogroup inet 30 30 * @{ 31 31 */ 32 33 /** @file 34 * ICMP module application interface.32 /** 33 * @file ICMP standard definitions 34 * 35 35 */ 36 36 37 #ifndef LIBC_ICMP_API_H_38 #define LIBC_ICMP_API_H_37 #ifndef ICMP_STD_H_ 38 #define ICMP_STD_H_ 39 39 40 #include <net/socket_codes.h>41 #include <net/inet.h>42 40 #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>49 41 50 /** @name ICMP module application interface 51 * This interface is used by other application modules. 52 */ 53 /*@{*/ 42 #define IP_PROTO_ICMP 1 54 43 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 57 46 58 /*@}*/ 47 /** ICMP message type */ 48 enum icmp_type { 49 ICMP_ECHO_REPLY = 0, 50 ICMP_ECHO_REQUEST = 8 51 }; 52 53 /** ICMP Echo Request or Reply message header */ 54 typedef 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; 59 66 60 67 #endif -
uspace/srv/net/tcp/Makefile
rba72f2b r6843a9c 1 1 # 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 2 # Copyright (c) 2011 Jiri Svoboda 4 3 # All rights reserved. 5 4 # … … 28 27 # 29 28 30 USPACE_PREFIX = ../../.. /..29 USPACE_PREFIX = ../../.. 31 30 LIBS = $(LIBNET_PREFIX)/libnet.a 32 31 EXTRA_CFLAGS = -I$(LIBNET_PREFIX)/include … … 34 33 35 34 SOURCES = \ 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 37 47 38 48 include $(USPACE_PREFIX)/Makefile.common -
uspace/srv/net/tcp/segment.h
rba72f2b r6843a9c 1 1 /* 2 * Copyright (c) 20 09 Lukas Mejdrech2 * Copyright (c) 2011 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup libnet29 /** @addtogroup tcp 30 30 * @{ 31 31 */ 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 37 33 */ 38 34 39 #ifndef LIBNET_ETHERNET_PROTOCOLS_H_40 #define LIBNET_ETHERNET_PROTOCOLS_H_35 #ifndef SEGMENT_H 36 #define SEGMENT_H 41 37 42 38 #include <sys/types.h> 39 #include "tcp_type.h" 43 40 44 /** Ethernet protocol type definition. */ 45 typedef uint16_t eth_type_t; 41 extern tcp_segment_t *tcp_segment_new(void); 42 extern void tcp_segment_delete(tcp_segment_t *); 43 extern tcp_segment_t *tcp_segment_dup(tcp_segment_t *); 44 extern tcp_segment_t *tcp_segment_make_ctrl(tcp_control_t); 45 extern tcp_segment_t *tcp_segment_make_rst(tcp_segment_t *); 46 extern tcp_segment_t *tcp_segment_make_data(tcp_control_t, void *, size_t); 47 extern void tcp_segment_trim(tcp_segment_t *, uint32_t, uint32_t); 48 extern void tcp_segment_text_copy(tcp_segment_t *, void *, size_t); 49 extern size_t tcp_segment_text_size(tcp_segment_t *); 50 extern void tcp_segment_dump(tcp_segment_t *); 46 51 47 /** @name Ethernet protocols definitions */48 /*@{*/49 52 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 0x080057 58 /** ARP ethernet protocol type. */59 #define ETH_P_ARP 0x080660 61 /*@}*/62 53 63 54 #endif -
uspace/srv/net/tcp/seq_no.h
rba72f2b r6843a9c 1 1 /* 2 * Copyright (c) 20 09 Lukas Mejdrech2 * Copyright (c) 2011 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup libnet29 /** @addtogroup tcp 30 30 * @{ 31 31 */ 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 36 33 */ 37 34 38 #ifndef LIBNET_IL_REMOTE_H_39 #define LIBNET_IL_REMOTE_H_35 #ifndef SEQ_NO_H 36 #define SEQ_NO_H 40 37 41 #include <ipc/services.h>42 38 #include <sys/types.h> 43 #include <net/device.h> 44 #include <net/packet.h> 45 #include <async.h> 39 #include "tcp_type.h" 46 40 47 /** @name Internetwork layer module interface 48 * This interface is used by other modules. 49 */ 50 /*@{*/ 41 extern bool seq_no_ack_acceptable(tcp_conn_t *, uint32_t); 42 extern bool seq_no_ack_duplicate(tcp_conn_t *, uint32_t); 43 extern bool seq_no_in_rcv_wnd(tcp_conn_t *, uint32_t); 44 extern bool seq_no_new_wnd_update(tcp_conn_t *, tcp_segment_t *); 45 extern bool seq_no_segment_acked(tcp_conn_t *, tcp_segment_t *, uint32_t); 46 extern bool seq_no_syn_acked(tcp_conn_t *); 47 extern bool seq_no_segment_ready(tcp_conn_t *, tcp_segment_t *); 48 extern bool seq_no_segment_acceptable(tcp_conn_t *, tcp_segment_t *); 49 extern void seq_no_seg_trim_calc(tcp_conn_t *, tcp_segment_t *, uint32_t *, 50 uint32_t *); 51 extern int seq_no_seg_cmp(tcp_conn_t *, tcp_segment_t *, tcp_segment_t *); 51 52 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 /*@}*/ 53 extern uint32_t seq_no_control_len(tcp_control_t); 62 54 63 55 #endif -
uspace/srv/net/tcp/sock.h
rba72f2b r6843a9c 1 1 /* 2 * Copyright (c) 20 06 Jakub Vana2 * Copyright (c) 2011 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup ia3229 /** @addtogroup tcp 30 30 * @{ 31 31 */ 32 /** @file 32 /** @file Socket provider 33 33 */ 34 34 35 #ifndef KERN_ia32_VESA_H_36 #define KERN_ia32_VESA_H_35 #ifndef SOCK_H 36 #define SOCK_H 37 37 38 #include < typedefs.h>38 #include <async.h> 39 39 40 extern bool vesa_init(void);40 extern int tcp_sock_init(void); 41 41 42 42 #endif -
uspace/srv/net/tcp/tcp.h
rba72f2b r6843a9c 1 1 /* 2 * Copyright (c) 20 09 Lukas Mejdrech2 * Copyright (c) 2011 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup libc 30 * @{ 29 /** @addtogroup tcp 30 * @{ 31 */ 32 /** @file TCP (Transmission Control Protocol) network module 31 33 */ 32 34 33 /** @file 34 * ICMP module common interface. 35 */ 35 #ifndef TCP_H 36 #define TCP_H 36 37 37 #i fndef LIBC_ICMP_COMMON_H_38 # define LIBC_ICMP_COMMON_H_38 #include <async.h> 39 #include "tcp_type.h" 39 40 40 #include <ipc/services.h> 41 #include <sys/time.h> 42 #include <async.h> 43 44 extern async_sess_t *icmp_connect_module(void); 41 extern void tcp_transmit_pdu(tcp_pdu_t *); 45 42 46 43 #endif -
uspace/srv/net/udp/Makefile
rba72f2b r6843a9c 1 1 # 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 2 # Copyright (c) 2012 Jiri Svoboda 4 3 # All rights reserved. 5 4 # … … 28 27 # 29 28 30 USPACE_PREFIX = ../../.. /..29 USPACE_PREFIX = ../../.. 31 30 LIBS = $(LIBNET_PREFIX)/libnet.a 32 31 EXTRA_CFLAGS = -I$(LIBNET_PREFIX)/include … … 34 33 35 34 SOURCES = \ 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 37 42 38 43 include $(USPACE_PREFIX)/Makefile.common -
uspace/srv/net/udp/assoc.h
rba72f2b r6843a9c 1 1 /* 2 * Copyright (c) 20 09 Lukas Mejdrech2 * Copyright (c) 2012 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup libnet29 /** @addtogroup udp 30 30 * @{ 31 31 */ 32 33 /** @file 34 * Link service access point identifiers. 32 /** @file UDP associations 35 33 */ 36 34 37 #ifndef LIBNET_ETHERNET_LSAP_H_38 #define LIBNET_ETHERNET_LSAP_H_35 #ifndef ASSOC_H 36 #define ASSOC_H 39 37 40 38 #include <sys/types.h> 39 #include "udp_type.h" 41 40 42 /** Ethernet LSAP type definition. */ 43 typedef uint8_t eth_lsap_t; 41 extern udp_assoc_t *udp_assoc_new(udp_sock_t *, udp_sock_t *); 42 extern void udp_assoc_delete(udp_assoc_t *); 43 extern void udp_assoc_add(udp_assoc_t *); 44 extern void udp_assoc_remove(udp_assoc_t *); 45 extern void udp_assoc_addref(udp_assoc_t *); 46 extern void udp_assoc_delref(udp_assoc_t *); 47 extern void udp_assoc_set_foreign(udp_assoc_t *, udp_sock_t *); 48 extern void udp_assoc_set_local(udp_assoc_t *, udp_sock_t *); 49 extern int udp_assoc_send(udp_assoc_t *, udp_sock_t *, udp_msg_t *); 50 extern int udp_assoc_recv(udp_assoc_t *, udp_msg_t **, udp_sock_t *); 51 extern void udp_assoc_received(udp_sockpair_t *, udp_msg_t *); 44 52 45 /** @name Ethernet LSAP values definitions */46 /*@{*/47 48 /** Null LSAP LSAP identifier. */49 #define ETH_LSAP_NULL 0x0050 /** ARPANET Internet Protocol (IP) LSAP identifier. */51 #define ETH_LSAP_IP 0x0652 /** ARPANET Address Resolution Protocol (ARP) LSAP identifier. */53 #define ETH_LSAP_ARP 0x9854 /** SubNetwork Access Protocol (SNAP) LSAP identifier. */55 #define ETH_LSAP_SNAP 0xAA56 /** Global LSAP LSAP identifier. */57 #define ETH_LSAP_GLSAP 0xFF58 59 /*@}*/60 53 61 54 #endif -
uspace/srv/net/udp/udp.c
rba72f2b r6843a9c 1 1 /* 2 * Copyright (c) 20 08 Lukas Mejdrech2 * Copyright (c) 2012 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 31 31 */ 32 32 33 /** @file34 * UDP module.33 /** 34 * @file UDP (User Datagram Protocol) service 35 35 */ 36 36 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> 39 42 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" 44 45 45 /** Type definition of the UDP global data. 46 * @see udp_globals 46 #define NAME "udp" 47 48 static 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 69 int 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 * @} 47 95 */ 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 #endif75 76 /** @}77 */
Note:
See TracChangeset
for help on using the changeset viewer.
