Changeset f2b3d3e in mainline for uspace/srv/net/udp/udp.c
- Timestamp:
- 2012-05-04T10:57:48Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 35a35651
- Parents:
- 90924df (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. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/udp/udp.c
r90924df rf2b3d3e 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.