コード例 #1
0
ファイル: packet-ipp.c プロジェクト: ARK1988/wireshark
static void
add_charstring_value(const gchar *tag_desc, proto_tree *tree, tvbuff_t *tvb,
                     int offset, int name_length, int value_length)
{
    offset = add_value_head(tag_desc, tree, tvb, offset, name_length,
                            value_length, NULL);
    proto_tree_add_item(tree, hf_ipp_charstring_value, tvb, offset, value_length, ENC_NA|ENC_ASCII);
}
コード例 #2
0
ファイル: packet-ipp.c プロジェクト: danielwhite84/wireshark
static void
add_charstring_value(const gchar *tag_desc, proto_tree *tree, tvbuff_t *tvb,
                     int offset, int name_length, int value_length)
{
    offset = add_value_head(tag_desc, tree, tvb, offset, name_length,
                            value_length, NULL);
    proto_tree_add_text(tree, tvb, offset, value_length,
                        "Value: %s", tvb_format_text(tvb, offset, value_length));
}
コード例 #3
0
ファイル: packet-ipp.c プロジェクト: ARK1988/wireshark
static void
add_integer_value(const gchar *tag_desc, proto_tree *tree, tvbuff_t *tvb,
                  int offset, int name_length, int value_length, guint8 tag)
{
    char *name_val = NULL;

    offset = add_value_head(tag_desc, tree, tvb, offset, name_length,
                            value_length, &name_val);

    switch (tag) {

    case TAG_BOOLEAN:
        if (value_length == 1) {
            proto_tree_add_item(tree, hf_ipp_bool_value, tvb, offset, value_length, ENC_NA);
        }
        break;

    case TAG_INTEGER:
    case TAG_ENUM:
        /* Some fields in IPP are really unix timestamps but IPP
         * transports these as 4 byte integers.
         * A simple heuristic to make the display of these fields
         * more human readable is to assume that if the field name
         * ends in '-time' then assume they are timestamps instead
         * of integers.
         */
        if (value_length == 4) {
            if ((name_length > 5) && name_val && !strcmp(name_val+name_length-5, "-time")) {
                nstime_t ns;

                ns.secs=tvb_get_ntohl(tvb, offset);
                ns.nsecs=0;
                proto_tree_add_time(tree, hf_ipp_timestamp, tvb, offset, 4, &ns);
            }
            else if ((name_length > 5) && name_val && !strcmp(name_val, "printer-state")) {
                proto_tree_add_item(tree, hf_ipp_printer_state, tvb, offset, value_length, ENC_BIG_ENDIAN);
            }
            else if ((name_length > 5) && name_val && !strcmp(name_val, "job-state")) {
                proto_tree_add_item(tree, hf_ipp_job_state, tvb, offset, value_length, ENC_BIG_ENDIAN);
            }
            else{
                proto_tree_add_item(tree, hf_ipp_uint32_value, tvb, offset, value_length, ENC_BIG_ENDIAN);
            }
        }
        break;
    }
}
コード例 #4
0
ファイル: packet-ipp.c プロジェクト: danielwhite84/wireshark
static void
add_integer_value(const gchar *tag_desc, proto_tree *tree, tvbuff_t *tvb,
                  int offset, int name_length, int value_length, guint8 tag)
{
    guint8 bool_val;
    char *name_val = NULL;

    offset = add_value_head(tag_desc, tree, tvb, offset, name_length,
                            value_length, &name_val);

    switch (tag) {

    case TAG_BOOLEAN:
        if (value_length == 1) {
            bool_val = tvb_get_guint8(tvb, offset);
            proto_tree_add_text(tree, tvb, offset, value_length,
                                "Value: %s",
                                val_to_str(bool_val, bool_vals, "Unknown (0x%02x)"));
        }
        break;

    case TAG_INTEGER:
    case TAG_ENUM:
        /* Some fields in IPP are really unix timestamps but IPP
         * transports these as 4 byte integers.
         * A simple heuristic to make the display of these fields
         * more human readable is to assume that if the field name
         * ends in '-time' then assume they are timestamps instead
         * of integers.
         */
        if (value_length == 4) {
            if ((name_length > 5) && name_val && !strcmp(name_val+name_length-5, "-time")) {
                nstime_t ns;

                ns.secs=tvb_get_ntohl(tvb, offset);
                ns.nsecs=0;
                proto_tree_add_time(tree, hf_ipp_timestamp, tvb, offset, 4, &ns);
            }
            else if ((name_length > 5) && name_val && !strcmp(name_val, "printer-state")) {
                guint32 printer_state_reason;

                printer_state_reason = tvb_get_ntohl(tvb, offset);
                proto_tree_add_text(tree, tvb, offset, value_length,
                                    "Value: %s (%u)",
                                    val_to_str(printer_state_reason, printer_state_vals,
                                               "Unknown Printer State (0x%02x)"), printer_state_reason);
            }
            else if ((name_length > 5) && name_val && !strcmp(name_val, "job-state")) {
                guint32 job_state_reason;

                job_state_reason = tvb_get_ntohl(tvb, offset);
                proto_tree_add_text(tree, tvb, offset, value_length,
                                    "Value: %s (%u)",
                                    val_to_str(job_state_reason, job_state_vals,
                                               "Unknown Job State (0x%02x)"), job_state_reason);
            }
            else{
                proto_tree_add_text(tree, tvb, offset, value_length,
                                    "Value: %u", tvb_get_ntohl(tvb, offset));
            }
        }
        break;
    }
}