本文整理汇总了C++中ep_strdup_printf函数的典型用法代码示例。如果您正苦于以下问题:C++ ep_strdup_printf函数的具体用法?C++ ep_strdup_printf怎么用?C++ ep_strdup_printf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ep_strdup_printf函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: header_fields_update_cb
static void
header_fields_update_cb(void *r, const char **err)
{
header_field_t *rec = (header_field_t *)r;
char c;
if (rec->header_name == NULL) {
*err = ep_strdup_printf("Header name can't be empty");
return;
}
g_strstrip(rec->header_name);
if (rec->header_name[0] == 0) {
*err = ep_strdup_printf("Header name can't be empty");
return;
}
/* Check for invalid characters (to avoid asserting out when
* registering the field).
*/
c = proto_check_field_name(rec->header_name);
if (c) {
*err = ep_strdup_printf("Header name can't contain '%c'", c);
return;
}
*err = NULL;
}
开发者ID:akimac,项目名称:wireshark-1.10.0,代码行数:28,代码来源:packet-imf.c
示例2: time_stamp
/* -------------------------- */
static int
time_stamp(tvbuff_t *tvb, proto_tree *nasdaq_itch_tree, int id, int offset, int size)
{
if (nasdaq_itch_tree) {
guint32 ms, val;
const char *display = "";
const char *str_value = tvb_get_ephemeral_string(tvb, offset, size);
ms = val = strtoul(str_value, NULL, 10);
switch (size) {
case 3:
display = ep_strdup_printf(" %03u" , val);
break;
case 5:
ms = val *1000;
case 8: /* 0 86 400 000 */
display = ep_strdup_printf(" %u (%02u:%02u:%02u.%03u)", val,
ms/3600000, (ms % 3600000)/60000, (ms % 60000)/1000, ms %1000);
break;
}
proto_tree_add_uint_format_value(nasdaq_itch_tree, id, tvb, offset, size, val, "%s", display);
}
return offset+size;
}
开发者ID:kailiu-bupt2005,项目名称:wireshark,代码行数:26,代码来源:packet-nasdaq-itch.c
示例3: dissect_UDPR1
static void
dissect_UDPR1(tvbuff_t *tvb, packet_info *pinfo,
proto_tree *adwin_tree, proto_tree *adwin_debug_tree,
gchar** info_string)
{
const gchar *status_string;
guint32 seq_num, status;
status = tvb_get_letohl(tvb, 0);
status_string = match_strval_ext(status, &error_code_mapping_ext);
if (status_string) {
*info_string = ep_strdup_printf("UDPR1 Status: %s", status_string);
} else {
*info_string = ep_strdup_printf("UDPR1 Undefined error code %d", status);
}
/* Get the transaction identifier */
seq_num = tvb_get_letohl(tvb, 4);
adwin_request_response_handling(tvb, pinfo, adwin_tree, seq_num, ADWIN_RESPONSE);
if (! adwin_tree)
return;
SET_PACKET_TYPE(adwin_tree, APT_UDPR1);
ADWIN_ADD_LE(adwin_tree, status, 0, 4);
ADWIN_ADD_LE(adwin_tree, packet_index, 4, 4);
ADWIN_ADD_LE(adwin_tree, val1, 8, 4);
ADWIN_ADD_LE(adwin_tree, val1f, 8, 4);
ADWIN_ADD_LE(adwin_tree, val2, 12, 4);
ADWIN_ADD_LE(adwin_tree, val3, 16, 4);
ADWIN_ADD_LE(adwin_tree, val4, 20, 4);
ADWIN_ADD_LE(adwin_debug_tree, unused, 24, 8);
}
开发者ID:hubolo,项目名称:wireshark-1.8.0,代码行数:33,代码来源:packet-adwin.c
示例4: decode_visit
gint
decode_visit(tvbuff_t *tvb, proto_tree *tree, gint offset)
{
guint32 to_visit_len;
guint32 visited_len;
guint32 i;
to_visit_len = tvb_get_ntohl(tvb, offset);
proto_tree_add_uint(tree, hf_scribe_to_visit_len, tvb, offset, 4, to_visit_len);
offset += 4;
for (i = 0; i < to_visit_len; ++i){
offset = decode_nodehandle(tvb, tree, offset, ep_strdup_printf("NodeHandle to visit #%d", i+1));
if (offset == -1){
return -1;
}
}/*end for each to_visit*/
visited_len = tvb_get_ntohl(tvb, offset);
proto_tree_add_uint(tree, hf_scribe_visited_len, tvb, offset, 4, visited_len);
offset += 4;
for (i = 0; i < visited_len; ++i){
offset = decode_nodehandle(tvb, tree, offset, ep_strdup_printf("Visited NodeHandle #%d", i+1));
if (offset == -1){
return -1;
}
}/*end for each visited*/
return offset;
}
开发者ID:baont,项目名称:thesis,代码行数:28,代码来源:packet-scribe.c
示例5: dissect_UDPR2
static void
dissect_UDPR2(tvbuff_t *tvb, packet_info *pinfo,
proto_tree *adwin_tree, proto_tree *adwin_debug_tree,
gchar** info_string)
{
const gchar *status_string;
guint32 i, status, seq_num;
status = tvb_get_letohl(tvb, 0);
status_string = match_strval_ext(status, &error_code_mapping_ext);
if (status_string) {
*info_string = ep_strdup_printf("UDPR2 Status: %s", status_string);
} else {
*info_string = ep_strdup_printf("UDPR2 Undefined error code %d", status);
}
/* Get the transaction identifier */
seq_num = tvb_get_letohl(tvb, 4);
adwin_request_response_handling(tvb, pinfo, adwin_tree, seq_num, ADWIN_RESPONSE);
if (! adwin_tree)
return;
SET_PACKET_TYPE(adwin_tree, APT_UDPR2);
ADWIN_ADD_LE(adwin_tree, status, 0, 4);
ADWIN_ADD_LE(adwin_tree, packet_index, 4, 4);
if (! global_adwin_dissect_data) {
proto_tree_add_text(adwin_debug_tree, tvb, 8, 250 * 4, "Data");
return;
}
for (i = 0; i < 250; i++) {
proto_item *item;
guint32 offset = 8 + i * sizeof(guint32);
gint32 value = tvb_get_letohl(tvb, offset);
void * fvalue = &value;
proto_tree_add_text(adwin_debug_tree, tvb, offset, 4,
"Data[%3d]: %10d - %10f - 0x%08x",
i, value, *(float*)fvalue, value);
item = ADWIN_ADD_LE(adwin_debug_tree, data_int, offset, 4);
PROTO_ITEM_SET_HIDDEN(item);
item = ADWIN_ADD_LE(adwin_debug_tree, data_float, offset, 4);
PROTO_ITEM_SET_HIDDEN(item);
item = ADWIN_ADD_LE(adwin_debug_tree, data_hex, offset, 4);
PROTO_ITEM_SET_HIDDEN(item);
}
}
开发者ID:hubolo,项目名称:wireshark-1.8.0,代码行数:48,代码来源:packet-adwin.c
示例6: parseByteString
void parseByteString(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
{
char *szValue;
int iOffset = *pOffset;
gint32 iLen = tvb_get_letohl(tvb, iOffset);
iOffset += 4;
if (iLen == -1)
{
proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 0, ENC_NA);
proto_item_append_text(item, "[OpcUa Null ByteString]");
proto_item_set_end(item, tvb, *pOffset + 4);
}
else if (iLen == 0)
{
proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 0, ENC_NA);
proto_item_append_text(item, "[OpcUa Empty ByteString]");
proto_item_set_end(item, tvb, *pOffset + 4);
}
else if (iLen > 0)
{
proto_tree_add_item(tree, hfIndex, tvb, iOffset, iLen, ENC_NA);
iOffset += iLen; /* eat the whole bytestring */
}
else
{
proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 0, ENC_NA);
szValue = ep_strdup_printf("[Invalid ByteString] Invalid length: %d", iLen);
proto_item_append_text(item, "%s", szValue);
proto_item_set_end(item, tvb, *pOffset + 4);
}
*pOffset = iOffset;
}
开发者ID:dnstap,项目名称:wireshark,代码行数:34,代码来源:opcua_simpletypes.c
示例7: dissect_bt_dht_error
/* dissect a bt dht error from tvb, start at offset. it's like "li201e9:error msge" */
static int
dissect_bt_dht_error(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, char **result, char *label )
{
proto_item *ti;
proto_tree *sub_tree;
char *error_no, *error_msg;
error_no = NULL;
error_msg = NULL;
ti = proto_tree_add_item( tree, hf_bt_dht_error, tvb, offset, 0, ENC_NA );
sub_tree = proto_item_add_subtree( ti, ett_bt_dht_error);
/* we have confirmed that the first byte is 'l' */
offset += 1;
/* dissect bt-dht error number and message */
offset = dissect_bencoded_int( tvb, pinfo, sub_tree, offset, &error_no, "Error ID" );
offset = dissect_bencoded_string( tvb, pinfo, sub_tree, offset, &error_msg, FALSE, "Error Message" );
proto_item_set_text( ti, "%s: error %s, %s", label, error_no, error_msg );
col_append_fstr( pinfo->cinfo, COL_INFO, "error_no=%s error_msg=%s ", error_no, error_msg );
*result = ep_strdup_printf("error %s, %s", error_no, error_msg );
return offset;
}
开发者ID:giuliano108,项目名称:wireshark-rtpmon,代码行数:27,代码来源:packet-bt-dht.c
示例8: NSTime__tostring
WSLUA_METAMETHOD NSTime__tostring(lua_State* L) {
NSTime nstime = checkNSTime(L,1);
lua_pushstring(L,ep_strdup_printf("%ld.%09d", (long)nstime->secs, nstime->nsecs));
WSLUA_RETURN(1); /* The string representing the nstime. */
}
开发者ID:dot-Sean,项目名称:wireshark-http2,代码行数:7,代码来源:wslua_pinfo.c
示例9: diam_tree_to_csv
static gboolean
diam_tree_to_csv(proto_node* node, gpointer data)
{
char* val_str=NULL;
char* val_tmp=NULL;
ftenum_t ftype;
field_info* fi;
header_field_info *hfi;
if(!node) {
fprintf(stderr,"traverse end: empty node. node='%p' data='%p'\n",(void *)node,(void *)data);
return FALSE;
}
fi=node->finfo;
hfi=fi ? fi->hfinfo : NULL;
if(!hfi) {
fprintf(stderr,"traverse end: hfi not found. node='%p'\n",(void *)node);
return FALSE;
}
ftype=fvalue_type_ftenum(&fi->value);
if (ftype!=FT_NONE&&ftype!=FT_PROTOCOL) {
/* convert value to string */
val_tmp=fvalue_to_string_repr(&fi->value,FTREPR_DISPLAY,NULL);
if(val_tmp)
{
val_str=ep_strdup(val_tmp);
g_free(val_tmp);
} else
val_str=ep_strdup_printf("unsupported type: %s",ftype_name(ftype));
/*printf("traverse: name='%s', abbrev='%s',desc='%s', val='%s'\n",hfi->name,hfi->abbrev,ftype_name(hfi->type),val_str);*/
printf("%s='%s' ",hfi->name,val_str);
}
return FALSE;
}
开发者ID:pvons,项目名称:wireshark,代码行数:34,代码来源:tap-diameter-avp.c
示例10: cmpp_msg_id
static void
cmpp_msg_id(proto_tree *tree, tvbuff_t *tvb, gint field, gint offset)
{
guint8 month,day,hour,minute,second;
guint32 ismg_code;
proto_item *pi;
proto_tree *sub_tree;
char *strval;
pi = proto_tree_add_item(tree, field, tvb, offset, 8, ENC_BIG_ENDIAN);
sub_tree = proto_item_add_subtree(pi, ett_msg_id);
month = (tvb_get_guint8(tvb, offset) & 0xF0) >> 4;
day = (tvb_get_ntohs(tvb, offset) & 0x0F80) >> 7;
hour = (tvb_get_guint8(tvb, offset + 1) & 0x7C) >> 2;
minute = (tvb_get_ntohs(tvb, offset + 1) & 0x03F0) >> 4;
second = (tvb_get_ntohs(tvb, offset + 2) & 0x0FC0) >> 6;
strval = ep_strdup_printf("%02u/%02u %02u:%02u:%02u", month, day,
hour, minute, second);
ismg_code = (tvb_get_ntohl(tvb, offset + 3) & 0x3FFFFF00) >> 16;
proto_tree_add_string(sub_tree, hf_msg_id_timestamp, tvb, offset, 4, strval);
proto_tree_add_uint(sub_tree, hf_msg_id_ismg_code, tvb, offset + 3, 3, ismg_code);
cmpp_uint2(sub_tree, tvb, hf_msg_id_sequence_id, offset + 6);
}
开发者ID:giuliano108,项目名称:wireshark-rtpmon,代码行数:26,代码来源:packet-cmpp.c
示例11: proto_register_opcua
/** plugin entry functions.
* This registers the OpcUa protocol.
*/
void proto_register_opcua(void)
{
module_t *opcua_module;
proto_opcua = proto_register_protocol(
"OpcUa Binary Protocol", /* name */
"OpcUa", /* short name */
"opcua" /* abbrev */
);
registerTransportLayerTypes(proto_opcua);
registerSecurityLayerTypes(proto_opcua);
registerApplicationLayerTypes(proto_opcua);
registerSimpleTypes(proto_opcua);
registerEnumTypes(proto_opcua);
registerComplexTypes();
registerServiceTypes();
registerFieldTypes(proto_opcua);
proto_register_subtree_array(ett, array_length(ett));
range_convert_str(&global_tcp_ports_opcua, ep_strdup_printf("%u", OPCUA_PORT), 65535);
/* register user preferences */
opcua_module = prefs_register_protocol(proto_opcua, proto_reg_handoff_opcua);
prefs_register_range_preference(opcua_module, "tcp_ports",
"OPC UA TCP Ports",
"The TCP ports for the OPC UA TCP Binary Protocol",
&global_tcp_ports_opcua, 65535);
}
开发者ID:AkhilaAG,项目名称:gluster-wireshark-1.4,代码行数:33,代码来源:opcua.c
示例12: k12_update_cb
static void
k12_update_cb(void* r, const char** err)
{
k12_handles_t* h = r;
gchar** protos;
guint num_protos, i;
protos = ep_strsplit(h->protos,":",0);
for (num_protos = 0; protos[num_protos]; num_protos++)
g_strstrip(protos[num_protos]);
g_free(h->handles);
h->handles = g_malloc0(sizeof(dissector_handle_t)*(num_protos < 2 ? 2 : num_protos));
for (i = 0; i < num_protos; i++) {
if ( ! (h->handles[i] = find_dissector(protos[i])) ) {
h->handles[i] = data_handle;
*err = ep_strdup_printf("Could not find dissector for: '%s'",protos[i]);
return;
}
}
*err = NULL;
}
开发者ID:sstjohn,项目名称:wireshark,代码行数:25,代码来源:packet-k12.c
示例13: call_dop_oid_callback
static int
call_dop_oid_callback(char *base_string, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, char *col_info)
{
char* binding_param;
binding_param = ep_strdup_printf("%s.%s", base_string, binding_type ? binding_type : "");
if (col_info && (check_col(pinfo->cinfo, COL_INFO)))
col_append_fstr(pinfo->cinfo, COL_INFO, " %s", col_info);
if (dissector_try_string(dop_dissector_table, binding_param, tvb, pinfo, tree)) {
offset += tvb_length_remaining (tvb, offset);
} else {
proto_item *item=NULL;
proto_tree *next_tree=NULL;
item = proto_tree_add_text(tree, tvb, 0, tvb_length_remaining(tvb, offset), "Dissector for parameter %s OID:%s not implemented. Contact Wireshark developers if you want this supported", base_string, binding_type ? binding_type : "<empty>");
if (item) {
next_tree = proto_item_add_subtree(item, ett_dop_unknown);
}
offset = dissect_unknown_ber(pinfo, tvb, offset, next_tree);
expert_add_info_format(pinfo, item, PI_UNDECODED, PI_WARN, "Unknown binding-parameter");
}
return offset;
}
开发者ID:RazZziel,项目名称:wireshark-dplay,代码行数:26,代码来源:packet-dop-template.c
示例14: xmpp_error
static void
xmpp_error(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, element_t *element)
{
proto_item *error_item;
proto_tree *error_tree;
element_t *text_element, *cond_element;
attr_info attrs_info[] = {
{"type", hf_xmpp_error_type, TRUE, TRUE, NULL, NULL},
{"code", hf_xmpp_error_code, FALSE, TRUE, NULL, NULL},
{"condition", hf_xmpp_error_condition, TRUE, TRUE, NULL, NULL} /*TODO: validate list to the condition element*/
};
gchar *error_info;
attr_t *fake_condition = NULL;
error_info = ep_strdup("Stanza error");
error_item = proto_tree_add_item(tree, hf_xmpp_error, tvb, element->offset, element->length, FALSE);
error_tree = proto_item_add_subtree(error_item, ett_xmpp_query_item);
cond_element = steal_element_by_attr(element, "xmlns", "urn:ietf:params:xml:ns:xmpp-stanzas");
if(cond_element)
{
fake_condition = ep_init_attr_t(cond_element->name, cond_element->offset, cond_element->length);
g_hash_table_insert(element->attrs,"condition", fake_condition);
error_info = ep_strdup_printf("%s: %s;", error_info, cond_element->name);
}
display_attrs(error_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
while((text_element = steal_element_by_name(element, "text")) != NULL)
{
xmpp_error_text(error_tree, tvb, text_element);
error_info = ep_strdup_printf("%s Text: %s", error_info, text_element->data?text_element->data->value:"");
}
expert_add_info_format(pinfo, error_item, PI_RESPONSE_CODE, PI_CHAT,"%s", error_info);
xmpp_unknown(error_tree, tvb, pinfo, element);
}
开发者ID:SagiSatish,项目名称:xmpp-dissector,代码行数:46,代码来源:xmpp-core.c
示例15: dissect_bt_dht_values
/* dissect a bt dht values list from tvb, start at offset. it's like "l6:....6:....e" */
static int
dissect_bt_dht_values(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, char **result, char *label )
{
proto_item *ti;
proto_tree *sub_tree;
proto_item *value_ti;
proto_tree *value_tree;
address addr;
guint peer_index;
guint string_len_start;
guint string_len;
guint16 port;
ti = proto_tree_add_item( tree, hf_bt_dht_peers, tvb, offset, 0, ENC_NA );
sub_tree = proto_item_add_subtree( ti, ett_bt_dht_peers);
peer_index = 0;
/* we has confirmed that the first byte is 'l' */
offset += 1;
/* dissect bt-dht values */
while( tvb_get_guint8(tvb,offset)!='e' )
{
string_len_start = offset;
while( tvb_get_guint8(tvb,offset) != ':' )
offset += 1;
string_len = atoi( tvb_get_ephemeral_string(tvb,string_len_start,offset-string_len_start) );
/* skip the ':' */
offset += 1;
/* 4 bytes ip, 2 bytes port */
for( ; string_len>=6; string_len-=6, offset+=6 )
{
peer_index += 1;
SET_ADDRESS( &addr, AT_IPv4, 4, tvb_get_ptr( tvb, offset, 4) );
port = tvb_get_letohl( tvb, offset+4 );
value_ti = proto_tree_add_none_format( sub_tree, hf_bt_dht_peer, tvb, offset, 6,
"%d\t%s:%u", peer_index, ep_address_to_str( &addr ), port );
value_tree = proto_item_add_subtree( value_ti, ett_bt_dht_peers);
proto_tree_add_item( value_tree, hf_ip, tvb, offset, 4, ENC_BIG_ENDIAN);
proto_tree_add_item( value_tree, hf_port, tvb, offset+4, 2, ENC_BIG_ENDIAN);
}
/* truncated data */
if( string_len>0 )
{
proto_tree_add_item( tree, hf_truncated_data, tvb, offset, string_len, ENC_NA );
offset += string_len;
}
}
proto_item_set_text( ti, "%s: %d peers", label, peer_index );
col_append_fstr( pinfo->cinfo, COL_INFO, "reply=%d peers ", peer_index );
*result = ep_strdup_printf("%d peers", peer_index);
return offset;
}
开发者ID:giuliano108,项目名称:wireshark-rtpmon,代码行数:59,代码来源:packet-bt-dht.c
示例16: if
static guint8 *unhexbytes(const char *si, guint len, guint *len_p, const char** err) {
guint8 *buf;
guint8 *p;
const guint8 *s = (const guint8 *)si;
guint i;
if (len % 2) {
*err = ep_strdup_printf("Uneven number of chars hex string %u \n'%s'", len, si);
return NULL;
}
buf = (guint8 *)ep_alloc(len/2+1);
p = buf;
for (i = 0; i<len ; i += 2) {
guint8 lo = s[i+1];
guint8 hi = s[i];
if (hi >= '0' && hi <= '9') {
hi -= '0';
} else if (hi >= 'a' && hi <= 'f') {
hi -= 'a';
hi += 0xa;
} else if (hi >= 'A' && hi <= 'F') {
hi -= 'A';
hi += 0xa;
} else {
goto on_error;
}
if (lo >= '0' && lo <= '9') {
lo -= '0';
} else if (lo >= 'a' && lo <= 'f') {
lo -= 'a';
lo += 0xa;
} else if (lo >= 'A' && lo <= 'F') {
lo -= 'A';
lo += 0xa;
} else {
goto on_error;
}
*(p++) = (hi*0x10) + lo;
}
len /= 2;
if (len_p) *len_p = len;
buf[len] = '\0';
*err = NULL;
return buf;
on_error:
*err = "Error parsing hex string";
return NULL;
}
开发者ID:P1sec,项目名称:LTE_monitor_c2xx,代码行数:58,代码来源:uat_gui.c
示例17: xmpp_failure_text
static void
xmpp_failure_text(proto_tree *tree, tvbuff_t *tvb, element_t *element)
{
attr_t *lang = get_attr(element,"xml:lang");
proto_tree_add_text(tree, tvb, element->offset, element->length, "TEXT%s: %s",
lang?ep_strdup_printf("(%s)",lang->value):"",
element->data?element->data->value:"");
}
开发者ID:SagiSatish,项目名称:xmpp-dissector,代码行数:9,代码来源:xmpp-core.c
示例18: uat_key_record_update_cb
static void uat_key_record_update_cb(void* r, const char** err) {
uat_key_record_t* rec = (uat_key_record_t *)r;
if (rec->string == NULL) {
*err = ep_strdup_printf("Key can't be blank");
} else {
g_strstrip(rec->string);
if (rec->string[0] != 0) {
*err = NULL;
if ( !zbee_security_parse_key(rec->string, rec->key, rec->byte_order) ) {
*err = ep_strdup_printf("Expecting %d hexadecimal bytes or\n"
"a %d character double-quoted string", ZBEE_SEC_CONST_KEYSIZE, ZBEE_SEC_CONST_KEYSIZE);
}
} else {
*err = ep_strdup_printf("Key can't be blank");
}
}
}
开发者ID:hubolo,项目名称:wireshark-1.8.0,代码行数:19,代码来源:packet-zbee-security.c
示例19: dissect_bt_dht_nodes
static int
dissect_bt_dht_nodes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, char **result, char *label )
{
proto_item *ti;
proto_tree *sub_tree;
proto_item *node_ti;
proto_tree *node_tree;
guint node_index;
guint string_len_start;
guint string_len;
address addr;
guint16 port;
guint8 *id;
ti = proto_tree_add_item( tree, hf_bt_dht_nodes, tvb, offset, 0, ENC_NA );
sub_tree = proto_item_add_subtree( ti, ett_bt_dht_nodes);
node_index = 0;
string_len_start = offset;
while( tvb_get_guint8(tvb,offset) != ':' )
offset += 1;
string_len = atoi( tvb_get_ephemeral_string(tvb,string_len_start,offset-string_len_start) );
/* skip the ':' */
offset += 1;
/* 20 bytes id, 4 bytes ip, 2 bytes port */
for( ; string_len>=26; string_len-=26, offset+=26 )
{
node_index += 1;
id = tvb_bytes_to_str(tvb, offset, 20 );
SET_ADDRESS( &addr, AT_IPv4, 4, tvb_get_ptr( tvb, offset, 4) );
port = tvb_get_letohl( tvb, offset+24 );
node_ti = proto_tree_add_none_format( sub_tree, hf_bt_dht_node, tvb, offset, 26,
"%d\t%s %s:%u", node_index, id, ep_address_to_str( &addr ), port );
node_tree = proto_item_add_subtree( node_ti, ett_bt_dht_peers);
proto_tree_add_item( node_tree, hf_bt_dht_id, tvb, offset, 20, ENC_NA);
proto_tree_add_item( node_tree, hf_ip, tvb, offset+20, 4, ENC_BIG_ENDIAN);
proto_tree_add_item( node_tree, hf_port, tvb, offset+24, 2, ENC_BIG_ENDIAN);
}
if( string_len>0 )
{
proto_tree_add_item( tree, hf_truncated_data, tvb, offset, string_len, ENC_NA );
offset += string_len;
}
proto_item_set_text( ti, "%s: %d nodes", label, node_index );
col_append_fstr( pinfo->cinfo, COL_INFO, "reply=%d nodes ", node_index );
*result = ep_strdup_printf("%d", node_index);
return offset;
}
开发者ID:giuliano108,项目名称:wireshark-rtpmon,代码行数:55,代码来源:packet-bt-dht.c
示例20: Tvb__tostring
WSLUA_METAMETHOD Tvb__tostring(lua_State* L) {
/* Convert the bytes of a Tvb into a string, to be used for debugging purposes as '...' will be appended in case the string is too long. */
Tvb tvb = checkTvb(L,1);
int len;
gchar* str;
len = tvb_length(tvb->ws_tvb);
str = ep_strdup_printf("TVB(%i) : %s",len,tvb_bytes_to_ep_str(tvb->ws_tvb,0,len));
lua_pushstring(L,str);
WSLUA_RETURN(1); /* The string. */
}
开发者ID:jelmer,项目名称:wireshark,代码行数:11,代码来源:wslua_tvb.c
注:本文中的ep_strdup_printf函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论