Changeset 2f19103 in mainline for uspace/srv/net/udp/pdu.c
- Timestamp:
- 2015-05-22T07:21:37Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 58e9dec
- Parents:
- bf7587b0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/udp/pdu.c
rbf7587b0 r2f19103 1 1 /* 2 * Copyright (c) 201 2Jiri Svoboda2 * Copyright (c) 2015 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 162 162 163 163 /** Decode incoming PDU */ 164 int udp_pdu_decode(udp_pdu_t *pdu, udp_sockpair_t *sp, udp_msg_t **msg)164 int udp_pdu_decode(udp_pdu_t *pdu, inet_ep2_t *epp, udp_msg_t **msg) 165 165 { 166 166 udp_msg_t *nmsg; … … 179 179 hdr = (udp_header_t *)pdu->data; 180 180 181 sp->foreign.port = uint16_t_be2host(hdr->src_port);182 sp->foreign.addr = pdu->src;183 sp->local.port = uint16_t_be2host(hdr->dest_port);184 sp->local.addr = pdu->dest;181 epp->remote.port = uint16_t_be2host(hdr->src_port); 182 epp->remote.addr = pdu->src; 183 epp->local.port = uint16_t_be2host(hdr->dest_port); 184 epp->local.addr = pdu->dest; 185 185 186 186 length = uint16_t_be2host(hdr->length); … … 208 208 209 209 /** Encode outgoing PDU */ 210 int udp_pdu_encode( udp_sockpair_t *sp, udp_msg_t *msg, udp_pdu_t **pdu)210 int udp_pdu_encode(inet_ep2_t *epp, udp_msg_t *msg, udp_pdu_t **pdu) 211 211 { 212 212 udp_pdu_t *npdu; … … 218 218 return ENOMEM; 219 219 220 npdu->iplink = sp->iplink;221 npdu->src = sp->local.addr;222 npdu->dest = sp->foreign.addr;220 npdu->iplink = epp->local_link; 221 npdu->src = epp->local.addr; 222 npdu->dest = epp->remote.addr; 223 223 224 224 npdu->data_size = sizeof(udp_header_t) + msg->data_size; … … 230 230 231 231 hdr = (udp_header_t *)npdu->data; 232 hdr->src_port = host2uint16_t_be( sp->local.port);233 hdr->dest_port = host2uint16_t_be( sp->foreign.port);232 hdr->src_port = host2uint16_t_be(epp->local.port); 233 hdr->dest_port = host2uint16_t_be(epp->remote.port); 234 234 hdr->length = host2uint16_t_be(npdu->data_size); 235 235 hdr->checksum = 0;
Note:
See TracChangeset
for help on using the changeset viewer.