示例#1
0
    void init(uint16_t l_port, uint16_t d_port)
    {
      Expects(data_end() == layer_begin() + ip_header_length());

      // Initialize UDP packet header
      // source and destination ports
      set_src_port(l_port);
      set_dst_port(d_port);
      // set zero length
      set_length(sizeof(UDP::header));
      // zero the optional checksum
      header().checksum = 0;
      set_protocol(Protocol::UDP);
    }
示例#2
0
 Packet_v& set_source(const net::Socket& src)
 {
   set_ip_src(src.address());
   set_src_port(src.port());
   return *this;
 }