Changes in uspace/lib/c/generic/inet.c [77ad86c:a2e3ee6] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/inet.c
r77ad86c ra2e3ee6 107 107 int inet_send(inet_dgram_t *dgram, uint8_t ttl, inet_df_t df) 108 108 { 109 async_exch_t *exch = async_exchange_begin(inet_sess); 110 109 uint32_t src; 110 int rc = inet_addr_pack(&dgram->src, &src); 111 if (rc != EOK) 112 return rc; 113 114 uint32_t dest; 115 rc = inet_addr_pack(&dgram->dest, &dest); 116 if (rc != EOK) 117 return EOK; 118 119 async_exch_t *exch = async_exchange_begin(inet_sess); 120 111 121 ipc_call_t answer; 112 aid_t req = async_send_5(exch, INET_SEND, dgram->src.ipv4, 113 dgram->dest.ipv4, dgram->tos, ttl, df, &answer); 114 int rc = async_data_write_start(exch, dgram->data, dgram->size); 115 async_exchange_end(exch); 116 122 aid_t req = async_send_5(exch, INET_SEND, (sysarg_t) src, 123 (sysarg_t) dest, dgram->tos, ttl, df, &answer); 124 rc = async_data_write_start(exch, dgram->data, dgram->size); 125 126 async_exchange_end(exch); 127 117 128 if (rc != EOK) { 118 129 async_forget(req); 119 130 return rc; 120 131 } 121 132 122 133 sysarg_t retval; 123 134 async_wait_for(req, &retval); 124 135 if (retval != EOK) 125 136 return retval; 126 137 127 138 return EOK; 128 139 } … … 130 141 int inet_get_srcaddr(inet_addr_t *remote, uint8_t tos, inet_addr_t *local) 131 142 { 143 uint32_t remote_addr; 144 int rc = inet_addr_pack(remote, &remote_addr); 145 if (rc != EOK) 146 return rc; 147 148 async_exch_t *exch = async_exchange_begin(inet_sess); 149 132 150 sysarg_t local_addr; 133 async_exch_t *exch = async_exchange_begin(inet_sess); 134 135 int rc = async_req_2_1(exch, INET_GET_SRCADDR, remote->ipv4, 151 rc = async_req_2_1(exch, INET_GET_SRCADDR, (sysarg_t) remote_addr, 136 152 tos, &local_addr); 137 async_exchange_end(exch); 138 139 if (rc != EOK) 140 return rc; 141 142 local->ipv4 = local_addr; 153 154 async_exchange_end(exch); 155 156 if (rc != EOK) 157 return rc; 158 159 inet_addr_unpack(local_addr, local); 143 160 return EOK; 144 161 } … … 148 165 int rc; 149 166 inet_dgram_t dgram; 150 151 dgram.src.ipv4 = IPC_GET_ARG1(*call);152 dgram.dest.ipv4 = IPC_GET_ARG2(*call);167 168 inet_addr_unpack(IPC_GET_ARG1(*call), &dgram.src); 169 inet_addr_unpack(IPC_GET_ARG2(*call), &dgram.dest); 153 170 dgram.tos = IPC_GET_ARG3(*call); 154 171
Note:
See TracChangeset
for help on using the changeset viewer.