Changeset c6588ce in mainline for uspace/srv/net/udp
- Timestamp:
- 2012-05-05T08:12:17Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ee04c28
- Parents:
- 2cc7f16 (diff), d21e935c (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/udp
- Files:
-
- 11 added
- 5 moved
-
Makefile (moved) (moved from uspace/srv/net/tl/udp/Makefile ) (3 diffs)
-
assoc.c (added)
-
assoc.h (moved) (moved from uspace/lib/net/include/ethernet_lsap.h ) (2 diffs)
-
msg.c (added)
-
msg.h (added)
-
pdu.c (added)
-
pdu.h (added)
-
sock.c (added)
-
sock.h (moved) (moved from uspace/lib/c/include/net/icmp_common.h ) (2 diffs)
-
std.h (added)
-
ucall.c (added)
-
ucall.h (moved) (moved from uspace/lib/c/include/net/icmp_api.h ) (2 diffs)
-
udp.c (moved) (moved from uspace/srv/net/tl/udp/udp.h ) (2 diffs)
-
udp_inet.c (added)
-
udp_inet.h (added)
-
udp_type.h (added)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/udp/Makefile
r2cc7f16 rc6588ce 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
r2cc7f16 rc6588ce 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/sock.h
r2cc7f16 rc6588ce 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 libc 30 * @{ 29 /** @addtogroup udp 30 * @{ 31 */ 32 /** @file Socket provider 31 33 */ 32 34 33 /** @file 34 * ICMP module common interface. 35 */ 35 #ifndef SOCK_H 36 #define SOCK_H 36 37 37 #ifndef LIBC_ICMP_COMMON_H_38 #define LIBC_ICMP_COMMON_H_39 40 #include <ipc/services.h>41 #include <sys/time.h>42 38 #include <async.h> 43 39 44 extern async_sess_t *icmp_connect_module(void);40 extern int udp_sock_init(void); 45 41 46 42 #endif -
uspace/srv/net/udp/ucall.h
r2cc7f16 rc6588ce 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 udp 30 30 * @{ 31 31 */ 32 33 /** @file 34 * ICMP module application interface. 32 /** @file UDP user calls 35 33 */ 36 34 37 #ifndef LIBC_ICMP_API_H_38 #define LIBC_ICMP_API_H_35 #ifndef UCALL_H 36 #define UCALL_H 39 37 40 #include <net/socket_codes.h>41 #include <net/inet.h>42 38 #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> 39 #include "udp_type.h" 49 40 50 /** @name ICMP module application interface 51 * This interface is used by other application modules. 52 */ 53 /*@{*/ 54 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);57 58 /*@}*/ 41 extern udp_error_t udp_uc_create(udp_assoc_t **); 42 extern udp_error_t udp_uc_set_foreign(udp_assoc_t *, udp_sock_t *); 43 extern udp_error_t udp_uc_set_local(udp_assoc_t *, udp_sock_t *); 44 extern udp_error_t udp_uc_send(udp_assoc_t *, udp_sock_t *, void *, size_t, 45 xflags_t); 46 extern udp_error_t udp_uc_receive(udp_assoc_t *, void *, size_t, size_t *, 47 xflags_t *, udp_sock_t *); 48 extern void udp_uc_status(udp_assoc_t *, udp_assoc_status_t *); 49 extern void udp_uc_destroy(udp_assoc_t *); 59 50 60 51 #endif -
uspace/srv/net/udp/udp.c
r2cc7f16 rc6588ce 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_WARN); 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.
