Changeset ecff3d9 in mainline for uspace/lib/c/generic/inet.c
- Timestamp:
- 2012-02-01T22:06:05Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 59157eb
- Parents:
- c76e926
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/inet.c
rc76e926 recff3d9 75 75 { 76 76 service_id_t inet_svc; 77 int rc; 77 78 78 79 assert(inet_sess == NULL); … … 80 81 assert(inet_protocol == 0); 81 82 82 inet_svc = loc_service_get_id(SERVICE_NAME_INET, &inet_svc,83 rc = loc_service_get_id(SERVICE_NAME_INET, &inet_svc, 83 84 IPC_FLAG_BLOCKING); 85 if (rc != EOK) 86 return ENOENT; 87 84 88 inet_sess = loc_service_connect(EXCHANGE_SERIALIZE, inet_svc, 85 89 IPC_FLAG_BLOCKING); … … 107 111 int inet_send(inet_dgram_t *dgram, uint8_t ttl, inet_df_t df) 108 112 { 109 return ENOTSUP; 113 async_exch_t *exch = async_exchange_begin(inet_sess); 114 115 ipc_call_t answer; 116 aid_t req = async_send_5(exch, INET_SEND, dgram->src.ipv4, 117 dgram->dest.ipv4, dgram->tos, ttl, df, &answer); 118 int rc = async_data_write_start(exch, dgram->data, dgram->size); 119 async_exchange_end(exch); 120 121 if (rc != EOK) { 122 async_wait_for(req, NULL); 123 return rc; 124 } 125 126 sysarg_t retval; 127 async_wait_for(req, &retval); 128 if (retval != EOK) 129 return retval; 130 131 return EOK; 110 132 } 111 133 112 134 int inet_get_srcaddr(inet_addr_t *remote, uint8_t tos, inet_addr_t *local) 113 135 { 114 return ENOTSUP; 136 sysarg_t local_addr; 137 async_exch_t *exch = async_exchange_begin(inet_sess); 138 139 int rc = async_req_1_1(exch, INET_GET_SRCADDR, remote->ipv4, 140 &local_addr); 141 async_exchange_end(exch); 142 143 if (rc != EOK) 144 return rc; 145 146 local->ipv4 = local_addr; 147 return EOK; 115 148 } 116 149
Note:
See TracChangeset
for help on using the changeset viewer.