示例#1
0
void avdecc_cmd_print_frame_header( struct jdksavdecc_printer *self, const struct jdksavdecc_frame *frame )
{
    jdksavdecc_printer_print_label( self, "DA" );
    jdksavdecc_printer_print_eui48( self, frame->dest_address );
    jdksavdecc_printer_print_eol( self );
    jdksavdecc_printer_print_label( self, "SA" );
    jdksavdecc_printer_print_eui48( self, frame->src_address );
    jdksavdecc_printer_print_eol( self );
    jdksavdecc_printer_print_label( self, "EtherType" );
    jdksavdecc_printer_print_uint16( self, frame->ethertype );
    jdksavdecc_printer_print_eol( self );
    jdksavdecc_printer_print_label( self, "Payload Length" );
    jdksavdecc_printer_print_uint16( self, frame->length );
    jdksavdecc_printer_print_eol( self );
}
void jdksavdecc_frame_print(struct jdksavdecc_printer *self, struct jdksavdecc_frame const *p, int dump_payload) {
    jdksavdecc_printer_print_label(self, "time (seconds)");

    jdksavdecc_printer_print_uint64(self, p->time / 1000000);
    jdksavdecc_printer_printc(self, '.');
    jdksavdecc_printer_print_uint64(self, p->time % 1000000);
    jdksavdecc_printer_print_eol(self);

    jdksavdecc_printer_print_label(self, "dest_address");
    jdksavdecc_printer_print_eui48(self, p->dest_address);
    jdksavdecc_printer_print_eol(self);

    jdksavdecc_printer_print_label(self, "src_address");
    jdksavdecc_printer_print_eui48(self, p->src_address);
    jdksavdecc_printer_print_eol(self);

    jdksavdecc_printer_print_label(self, "ethertype");
    jdksavdecc_printer_print_uint16(self, p->ethertype);
    jdksavdecc_printer_print_eol(self);

    jdksavdecc_printer_print_label(self, "tpid");
    jdksavdecc_printer_print_uint16(self, p->tpid);
    jdksavdecc_printer_print_eol(self);

    jdksavdecc_printer_print_label(self, "pcp");
    jdksavdecc_printer_print_uint16(self, p->pcp);
    jdksavdecc_printer_print_eol(self);

    jdksavdecc_printer_print_label(self, "dei");
    jdksavdecc_printer_print_uint16(self, p->dei);
    jdksavdecc_printer_print_eol(self);

    jdksavdecc_printer_print_label(self, "vid");
    jdksavdecc_printer_print_uint16(self, p->vid);
    jdksavdecc_printer_print_eol(self);

    jdksavdecc_printer_print_label(self, "length");
    jdksavdecc_printer_print_uint16(self, p->length);
    jdksavdecc_printer_print_eol(self);

    if (dump_payload) {
        jdksavdecc_printer_print_label(self, "payload");
        jdksavdecc_printer_print_block(self, p->payload, p->length, 0, p->length);
    }
}
示例#3
0
inline std::ostream &operator<<( std::ostream &o, jdksavdecc_eui48 const &v )
{
    jdksavdecc_printer p;
    char buf[128];
    jdksavdecc_printer_init( &p, buf, sizeof( buf ) );
    jdksavdecc_printer_print_eui48( &p, v );
    o << buf;
    return o;
}