Changeset 59157eb in mainline for uspace/srv/inet/inet.c
- Timestamp:
- 2012-02-02T15:18:46Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f834f90d
- Parents:
- ecff3d9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/inet/inet.c
recff3d9 r59157eb 47 47 #include <sys/types.h> 48 48 49 #include "inet.h" 50 49 51 #define NAME "inet" 50 51 /** Inet Client */52 typedef struct {53 async_sess_t *sess;54 uint8_t protocol;55 link_t client_list;56 } inet_client_t;57 52 58 53 static void inet_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg); … … 111 106 ipc_call_t *call) 112 107 { 113 uint32_t src_ipv4; 114 uint32_t dest_ipv4; 115 uint8_t tos; 108 inet_dgram_t dgram; 116 109 uint8_t ttl; 117 110 int df; 118 void *data;119 size_t size;120 111 int rc; 121 112 122 113 log_msg(LVL_DEBUG, "inet_send()"); 123 114 124 src_ipv4 = IPC_GET_ARG1(*call);125 d est_ipv4 = IPC_GET_ARG2(*call);126 tos = IPC_GET_ARG3(*call);115 dgram.src.ipv4 = IPC_GET_ARG1(*call); 116 dgram.dest.ipv4 = IPC_GET_ARG2(*call); 117 dgram.tos = IPC_GET_ARG3(*call); 127 118 ttl = IPC_GET_ARG4(*call); 128 119 df = IPC_GET_ARG5(*call); 129 120 130 (void)src_ipv4;131 (void)dest_ipv4;132 (void)tos;133 121 (void)ttl; 134 122 (void)df; 135 123 136 rc = async_data_write_accept(&d ata, false, 0, 0, 0, &size);124 rc = async_data_write_accept(&dgram.data, false, 0, 0, 0, &dgram.size); 137 125 if (rc != EOK) { 138 126 async_answer_0(callid, rc); … … 140 128 } 141 129 142 free(d ata);130 free(dgram.data); 143 131 async_answer_0(callid, ENOTSUP); 144 132 } … … 223 211 } 224 212 213 int inet_ev_recv(inet_client_t *client, inet_dgram_t *dgram) 214 { 215 async_exch_t *exch = async_exchange_begin(client->sess); 216 217 ipc_call_t answer; 218 aid_t req = async_send_3(exch, INET_EV_RECV, dgram->src.ipv4, 219 dgram->dest.ipv4, dgram->tos, &answer); 220 int rc = async_data_write_start(exch, dgram->data, dgram->size); 221 async_exchange_end(exch); 222 223 if (rc != EOK) { 224 async_wait_for(req, NULL); 225 return rc; 226 } 227 228 sysarg_t retval; 229 async_wait_for(req, &retval); 230 if (retval != EOK) 231 return retval; 232 233 return EOK; 234 } 235 225 236 int main(int argc, char *argv[]) 226 237 {
Note:
See TracChangeset
for help on using the changeset viewer.