Changes in uspace/srv/net/loopip/loopip.c [b688fd8:1d6dd2a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/loopip/loopip.c
rb688fd8 r1d6dd2a 38 38 #include <async.h> 39 39 #include <errno.h> 40 #include <str_error.h> 40 41 #include <inet/iplink_srv.h> 41 42 #include <inet/addr.h> … … 44 45 #include <stdio.h> 45 46 #include <stdlib.h> 47 #include <str.h> 46 48 #include <task.h> 47 49 48 50 #define NAME "loopip" 49 51 50 static int loopip_open(iplink_srv_t *srv);51 static int loopip_close(iplink_srv_t *srv);52 static int loopip_send(iplink_srv_t *srv, iplink_sdu_t *sdu);53 static int loopip_send6(iplink_srv_t *srv, iplink_sdu6_t *sdu);54 static int loopip_get_mtu(iplink_srv_t *srv, size_t *mtu);55 static int loopip_get_mac48(iplink_srv_t *srv, addr48_t *mac);56 static int loopip_addr_add(iplink_srv_t *srv, inet_addr_t *addr);57 static int loopip_addr_remove(iplink_srv_t *srv, inet_addr_t *addr);52 static errno_t loopip_open(iplink_srv_t *srv); 53 static errno_t loopip_close(iplink_srv_t *srv); 54 static errno_t loopip_send(iplink_srv_t *srv, iplink_sdu_t *sdu); 55 static errno_t loopip_send6(iplink_srv_t *srv, iplink_sdu6_t *sdu); 56 static errno_t loopip_get_mtu(iplink_srv_t *srv, size_t *mtu); 57 static errno_t loopip_get_mac48(iplink_srv_t *srv, addr48_t *mac); 58 static errno_t loopip_addr_add(iplink_srv_t *srv, inet_addr_t *addr); 59 static errno_t loopip_addr_remove(iplink_srv_t *srv, inet_addr_t *addr); 58 60 59 61 static void loopip_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg); … … 81 83 } rqueue_entry_t; 82 84 83 static int loopip_recv_fibril(void *arg)85 static errno_t loopip_recv_fibril(void *arg) 84 86 { 85 87 while (true) { … … 98 100 } 99 101 100 static int loopip_init(void)102 static errno_t loopip_init(void) 101 103 { 102 104 async_set_fallback_port_handler(loopip_client_conn, NULL); 103 105 104 int rc = loc_server_register(NAME);106 errno_t rc = loc_server_register(NAME); 105 107 if (rc != EOK) { 106 108 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server."); … … 152 154 } 153 155 154 static int loopip_open(iplink_srv_t *srv)156 static errno_t loopip_open(iplink_srv_t *srv) 155 157 { 156 158 log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip_open()"); … … 158 160 } 159 161 160 static int loopip_close(iplink_srv_t *srv)162 static errno_t loopip_close(iplink_srv_t *srv) 161 163 { 162 164 log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip_close()"); … … 164 166 } 165 167 166 static int loopip_send(iplink_srv_t *srv, iplink_sdu_t *sdu)168 static errno_t loopip_send(iplink_srv_t *srv, iplink_sdu_t *sdu) 167 169 { 168 170 log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip_send()"); … … 193 195 } 194 196 195 static int loopip_send6(iplink_srv_t *srv, iplink_sdu6_t *sdu)197 static errno_t loopip_send6(iplink_srv_t *srv, iplink_sdu6_t *sdu) 196 198 { 197 199 log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip6_send()"); … … 222 224 } 223 225 224 static int loopip_get_mtu(iplink_srv_t *srv, size_t *mtu)226 static errno_t loopip_get_mtu(iplink_srv_t *srv, size_t *mtu) 225 227 { 226 228 log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip_get_mtu()"); … … 229 231 } 230 232 231 static int loopip_get_mac48(iplink_srv_t *src, addr48_t *mac)233 static errno_t loopip_get_mac48(iplink_srv_t *src, addr48_t *mac) 232 234 { 233 235 log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip_get_mac48()"); … … 235 237 } 236 238 237 static int loopip_addr_add(iplink_srv_t *srv, inet_addr_t *addr)238 { 239 return EOK; 240 } 241 242 static int loopip_addr_remove(iplink_srv_t *srv, inet_addr_t *addr)239 static errno_t loopip_addr_add(iplink_srv_t *srv, inet_addr_t *addr) 240 { 241 return EOK; 242 } 243 244 static errno_t loopip_addr_remove(iplink_srv_t *srv, inet_addr_t *addr) 243 245 { 244 246 return EOK; … … 249 251 printf("%s: HelenOS loopback IP link provider\n", NAME); 250 252 251 int rc = log_init(NAME);252 if (rc != EOK) { 253 printf("%s: Failed to initialize logging .\n", NAME);253 errno_t rc = log_init(NAME); 254 if (rc != EOK) { 255 printf("%s: Failed to initialize logging: %s.\n", NAME, str_error(rc)); 254 256 return rc; 255 257 } 256 258 257 259 rc = loopip_init(); 258 if (rc != EOK) 259 return rc; 260 if (rc != EOK) { 261 printf("%s: Failed to initialize loopip: %s.\n", NAME, str_error(rc)); 262 return rc; 263 } 260 264 261 265 printf("%s: Accepting connections.\n", NAME);
Note:
See TracChangeset
for help on using the changeset viewer.