| 249 |
|
|
| 250 |
/* Copy the options into the header, if they are present. */ |
/* Copy the options into the header, if they are present. */ |
| 251 |
if (optdata == NULL) { |
if (optdata == NULL) { |
| 252 |
TCPH_OFFSET_SET(seg->tcphdr, 5 << 4); |
TCPH_HDRLEN_SET(seg->tcphdr, 5); |
| 253 |
} |
} |
| 254 |
else { |
else { |
| 255 |
TCPH_OFFSET_SET(seg->tcphdr, (5 + optlen / 4) << 4); |
TCPH_HDRLEN_SET(seg->tcphdr, (5 + optlen / 4)); |
| 256 |
/* Copy options into data portion of segment. |
/* Copy options into data portion of segment. |
| 257 |
Options can thus only be sent in non data carrying |
Options can thus only be sent in non data carrying |
| 258 |
segments such as SYN|ACK. */ |
segments such as SYN|ACK. */ |
| 327 |
/* Set the PSH flag in the last segment that we enqueued, but only |
/* Set the PSH flag in the last segment that we enqueued, but only |
| 328 |
if the segment has data (indicated by seglen > 0). */ |
if the segment has data (indicated by seglen > 0). */ |
| 329 |
if (seg != NULL && seglen > 0 && seg->tcphdr != NULL) { |
if (seg != NULL && seglen > 0 && seg->tcphdr != NULL) { |
| 330 |
TCPH_FLAGS_SET(seg->tcphdr, TCPH_FLAGS(seg->tcphdr) | TCP_PSH); |
TCPH_SET_FLAG(seg->tcphdr, TCP_PSH); |
| 331 |
} |
} |
| 332 |
|
|
| 333 |
return ERR_OK; |
return ERR_OK; |
| 372 |
|
|
| 373 |
|
|
| 374 |
seg = pcb->unsent; |
seg = pcb->unsent; |
| 375 |
|
useg = pcb->unacked; |
| 376 |
|
|
| 377 |
/* If the TF_ACK_NOW flag is set, we check if there is data that is |
/* If the TF_ACK_NOW flag is set, we check if there is data that is |
| 378 |
to be sent. If data is to be sent out, we'll just piggyback our |
to be sent. If data is to be sent out, we'll just piggyback our |
| 379 |
acknowledgement with the outgoing segment. If no data will be |
acknowledgement with the outgoing segment. If no data will be |
| 399 |
TCPH_FLAGS_SET(tcphdr, TCP_ACK); |
TCPH_FLAGS_SET(tcphdr, TCP_ACK); |
| 400 |
tcphdr->wnd = htons(pcb->rcv_wnd); |
tcphdr->wnd = htons(pcb->rcv_wnd); |
| 401 |
tcphdr->urgp = 0; |
tcphdr->urgp = 0; |
| 402 |
TCPH_OFFSET_SET(tcphdr, 5 << 4); |
TCPH_HDRLEN_SET(tcphdr, 5); |
| 403 |
|
|
| 404 |
tcphdr->chksum = 0; |
tcphdr->chksum = 0; |
| 405 |
tcphdr->chksum = inet_chksum_pseudo(p, &(pcb->local_ip), &(pcb->remote_ip), |
tcphdr->chksum = inet_chksum_pseudo(p, &(pcb->local_ip), &(pcb->remote_ip), |
| 444 |
pcb->unsent = seg->next; |
pcb->unsent = seg->next; |
| 445 |
|
|
| 446 |
if (pcb->state != SYN_SENT) { |
if (pcb->state != SYN_SENT) { |
| 447 |
TCPH_FLAGS_SET(seg->tcphdr, TCPH_FLAGS(seg->tcphdr) | TCP_ACK); |
TCPH_SET_FLAG(seg->tcphdr, TCP_ACK); |
| 448 |
pcb->flags &= ~(TF_ACK_DELAY | TF_ACK_NOW); |
pcb->flags &= ~(TF_ACK_DELAY | TF_ACK_NOW); |
| 449 |
} |
} |
| 450 |
|
|
| 458 |
seg->next = NULL; |
seg->next = NULL; |
| 459 |
if (pcb->unacked == NULL) { |
if (pcb->unacked == NULL) { |
| 460 |
pcb->unacked = seg; |
pcb->unacked = seg; |
| 461 |
|
useg = seg; |
|
|
|
| 462 |
} else { |
} else { |
|
for (useg = pcb->unacked; useg->next != NULL; useg = useg->next); |
|
| 463 |
useg->next = seg; |
useg->next = seg; |
| 464 |
|
useg = useg->next; |
| 465 |
} |
} |
| 466 |
} else { |
} else { |
| 467 |
tcp_seg_free(seg); |
tcp_seg_free(seg); |
| 552 |
TCPH_FLAGS_SET(tcphdr, TCP_RST | TCP_ACK); |
TCPH_FLAGS_SET(tcphdr, TCP_RST | TCP_ACK); |
| 553 |
tcphdr->wnd = htons(TCP_WND); |
tcphdr->wnd = htons(TCP_WND); |
| 554 |
tcphdr->urgp = 0; |
tcphdr->urgp = 0; |
| 555 |
TCPH_OFFSET_SET(tcphdr, 5 << 4); |
TCPH_HDRLEN_SET(tcphdr, 5); |
| 556 |
|
|
| 557 |
tcphdr->chksum = 0; |
tcphdr->chksum = 0; |
| 558 |
tcphdr->chksum = inet_chksum_pseudo(p, local_ip, remote_ip, |
tcphdr->chksum = inet_chksum_pseudo(p, local_ip, remote_ip, |