Changeset 4f64a523 in mainline for uspace/srv/ethip/ethip.c
- Timestamp:
- 2012-02-12T19:36:32Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- df15e5f
- Parents:
- 1493811
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/ethip/ethip.c
r1493811 r4f64a523 52 52 #define NAME "eth" 53 53 54 static int ethip_open(iplink_ conn_t *conn);55 static int ethip_close(iplink_ conn_t *conn);56 static int ethip_send(iplink_ conn_t *conn, iplink_srv_sdu_t *sdu);57 static int ethip_get_mtu(iplink_ conn_t *conn, size_t *mtu);54 static int ethip_open(iplink_srv_t *srv); 55 static int ethip_close(iplink_srv_t *srv); 56 static int ethip_send(iplink_srv_t *srv, iplink_srv_sdu_t *sdu); 57 static int ethip_get_mtu(iplink_srv_t *srv, size_t *mtu); 58 58 59 59 static void ethip_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg); … … 95 95 log_msg(LVL_DEBUG, "ethip_iplink_init()"); 96 96 97 iplink_srv_init(&nic->iplink); 97 98 nic->iplink.ops = ðip_iplink_ops; 98 99 nic->iplink.arg = nic; … … 148 149 } 149 150 150 static int ethip_open(iplink_ conn_t *conn)151 static int ethip_open(iplink_srv_t *srv) 151 152 { 152 153 log_msg(LVL_DEBUG, "ethip_open()"); … … 154 155 } 155 156 156 static int ethip_close(iplink_ conn_t *conn)157 { 158 log_msg(LVL_DEBUG, "ethip_ open()");159 return EOK; 160 } 161 162 static int ethip_send(iplink_ conn_t *conn, iplink_srv_sdu_t *sdu)163 { 164 ethip_nic_t *nic = (ethip_nic_t *) conn->srv->arg;157 static int ethip_close(iplink_srv_t *srv) 158 { 159 log_msg(LVL_DEBUG, "ethip_close()"); 160 return EOK; 161 } 162 163 static int ethip_send(iplink_srv_t *srv, iplink_srv_sdu_t *sdu) 164 { 165 ethip_nic_t *nic = (ethip_nic_t *)srv->arg; 165 166 eth_frame_t frame; 166 167 void *data; … … 188 189 int ethip_received(iplink_srv_t *srv, void *data, size_t size) 189 190 { 191 log_msg(LVL_DEBUG, "ethip_received(): srv=%p", srv); 192 ethip_nic_t *nic = (ethip_nic_t *)srv->arg; 190 193 eth_frame_t frame; 191 194 iplink_srv_sdu_t sdu; 192 195 int rc; 193 196 197 log_msg(LVL_DEBUG, "ethip_received()"); 198 199 log_msg(LVL_DEBUG, " - eth_pdu_decode"); 194 200 rc = eth_pdu_decode(data, size, &frame); 195 if (rc != EOK) 196 return rc; 197 201 if (rc != EOK) { 202 log_msg(LVL_DEBUG, " - eth_pdu_decode failed"); 203 return rc; 204 } 205 206 log_msg(LVL_DEBUG, " - construct SDU"); 207 sdu.lsrc.ipv4 = (192 << 24) | (168 << 16) | (0 << 8) | 1; 208 sdu.ldest.ipv4 = (192 << 24) | (168 << 16) | (0 << 8) | 4; 198 209 sdu.data = frame.data; 199 210 sdu.size = frame.size; 200 (void) sdu;201 //rc = iplink_ev_recv(conn, &sdu);211 log_msg(LVL_DEBUG, " - call iplink_ev_recv"); 212 rc = iplink_ev_recv(&nic->iplink, &sdu); 202 213 203 214 free(frame.data); … … 205 216 } 206 217 207 static int ethip_get_mtu(iplink_ conn_t *conn, size_t *mtu)218 static int ethip_get_mtu(iplink_srv_t *srv, size_t *mtu) 208 219 { 209 220 log_msg(LVL_DEBUG, "ethip_get_mtu()");
Note:
See TracChangeset
for help on using the changeset viewer.