Exemplo n.º 1
0
 bool print(Iterator& out, const port& p) const {
   using namespace printers;
   if (!(u16(out, p.number()) && chr<'/'>(out)))
     return false;
   switch (p.type()) {
     default:
       return chr<'?'>(out);
     case port::tcp:
       return str(out, "tcp");
     case port::udp:
       return str(out, "udp");
     case port::icmp:
       return str(out, "icmp");
   }
 }
Exemplo n.º 2
0
 void operator()(port& p) {
   using port_type = std::underlying_type_t<port::port_type>;
   std::uniform_int_distribution<port_type> unif{0, 3};
   p.number(static_cast<port::number_type>(sample()));
   p.type(static_cast<port::port_type>(unif(gen_)));
 }