|
522 |
{ |
522 |
{ |
523 |
buffer->l4 = new tcp_header; |
523 |
buffer->l4 = new tcp_header; |
524 |
tcp_header* tcp_h = (tcp_header*)buffer->l4; |
524 |
tcp_header* tcp_h = (tcp_header*)buffer->l4; |
525 |
tcp_h->tcp_src = htonl (tcp_hd.GetSourcePort ()); // Source Port |
525 |
tcp_h->tcp_src = htons (tcp_hd.GetSourcePort ()); // Source Port |
526 |
tcp_h->tcp_dst = htonl (tcp_hd.GetDestinationPort ()); // Destination Port |
526 |
tcp_h->tcp_dst = htons (tcp_hd.GetDestinationPort ()); // Destination Port |
527 |
tcp_h->tcp_seq = tcp_hd.GetSequenceNumber ().GetValue (); // Sequence Number |
527 |
tcp_h->tcp_seq = tcp_hd.GetSequenceNumber ().GetValue (); // Sequence Number |
528 |
tcp_h->tcp_ack = tcp_hd.GetAckNumber ().GetValue (); // ACK Number |
528 |
tcp_h->tcp_ack = tcp_hd.GetAckNumber ().GetValue (); // ACK Number |
529 |
tcp_h->tcp_ctl = TCP_FLAGS (tcp_hd.GetFlags ()); // Data Offset + Reserved + Flags |
529 |
tcp_h->tcp_ctl = TCP_FLAGS (tcp_hd.GetFlags ()); // Data Offset + Reserved + Flags |
|
541 |
{ |
541 |
{ |
542 |
buffer->l4 = new udp_header; |
542 |
buffer->l4 = new udp_header; |
543 |
udp_header* udp_h = (udp_header*)buffer->l4; |
543 |
udp_header* udp_h = (udp_header*)buffer->l4; |
544 |
udp_h->udp_src = htonl (udp_hd.GetSourcePort ()); // Source Port |
544 |
udp_h->udp_src = htons (udp_hd.GetSourcePort ()); // Source Port |
545 |
udp_h->udp_dst = htonl (udp_hd.GetDestinationPort ()); // Destination Port |
545 |
udp_h->udp_dst = htons (udp_hd.GetDestinationPort ()); // Destination Port |
546 |
udp_h->udp_len = htons (UDP_HEADER_LEN + packet->GetSize ()); |
546 |
udp_h->udp_len = htons (UDP_HEADER_LEN + packet->GetSize ()); |
547 |
|
547 |
|
548 |
if (protocol == Ipv4L3Protocol::PROT_NUMBER) |
548 |
if (protocol == Ipv4L3Protocol::PROT_NUMBER) |