X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=tinyos-2.x.git;a=blobdiff_plain;f=tos%2Flib%2Fnet%2Fblip%2FTcpP.nc;h=23d6cd6d3ef9f92679bded116cb3c9d5909c7f21;hp=02c42aff7f80b66eb8c3b0e9ed598dca14ddab38;hb=d520e0df83a5188e7a7c6f7bec791e27cb127719;hpb=3d5c78e867d6fd52e44894e93e4bd0c172071522 diff --git a/tos/lib/net/blip/TcpP.nc b/tos/lib/net/blip/TcpP.nc index 02c42aff..23d6cd6d 100644 --- a/tos/lib/net/blip/TcpP.nc +++ b/tos/lib/net/blip/TcpP.nc @@ -60,26 +60,19 @@ module TcpP { #include "circ.c" #include "tcplib.c" - void setSrcAddr(struct split_ip_msg *msg) { - if (msg->hdr.ip6_dst.s6_addr16[0] == htons(0xff02) || - msg->hdr.ip6_dst.s6_addr16[0] == htons(0xfe80)) { - call IPAddress.getLLAddr(&msg->hdr.ip6_src); - } else { - call IPAddress.getIPAddr(&msg->hdr.ip6_src); - } - } - struct tcplib_sock socks[uniqueCount("TCP_CLIENT")]; struct tcplib_sock *tcplib_accept(struct tcplib_sock *conn, struct sockaddr_in6 *from) { int cid = find_client(conn); + int buf_len; printfUART("tcplib_accept: cid: %i\n", cid); if (cid == N_CLIENTS) return NULL; - if (signal Tcp.accept[cid](from, &conn->tx_buf, &conn->tx_buf_len)) { + if (signal Tcp.accept[cid](from, &conn->tx_buf, &buf_len)) { if (conn->tx_buf == NULL) return NULL; + conn->tx_buf_len = buf_len; return conn; } return NULL; @@ -87,7 +80,7 @@ module TcpP { void tcplib_send_out(struct split_ip_msg *msg, struct tcp_hdr *tcph) { printfUART("tcp output\n"); - setSrcAddr(msg); + call IPAddress.setSource(&msg->hdr); tcph->chksum = htons(msg_cksum(msg, IANA_TCP)); call IP.send(msg); }