static int dissect_lock(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, int offset, rpc_call_info_value *civ) { proto_item* lock_item = NULL; proto_tree* lock_tree = NULL; lock_item = proto_tree_add_item(tree, hf_klm_lock, tvb, offset, -1, ENC_NA); lock_tree = proto_item_add_subtree(lock_item, ett_klm_lock); offset = dissect_rpc_string(tvb, lock_tree, hf_klm_servername, offset, NULL); offset = dissect_nfs3_fh(tvb, offset, pinfo, lock_tree,"fh", NULL, civ); offset = dissect_rpc_uint32(tvb, lock_tree, hf_klm_pid, offset); offset = dissect_rpc_uint32(tvb, lock_tree, hf_klm_offset, offset); offset = dissect_rpc_uint32(tvb, lock_tree, hf_klm_len, offset); return offset; }
static int dissect_holder(tvbuff_t *tvb, proto_tree *tree, int offset) { proto_item* lock_item = NULL; proto_tree* lock_tree = NULL; lock_item = proto_tree_add_item(tree, hf_klm_holder, tvb, offset, -1, ENC_NA); lock_tree = proto_item_add_subtree(lock_item, ett_klm_holder); offset = dissect_rpc_bool( tvb, lock_tree, hf_klm_exclusive, offset); offset = dissect_rpc_uint32(tvb, lock_tree, hf_klm_pid, offset); offset = dissect_rpc_uint32(tvb, lock_tree, hf_klm_offset, offset); offset = dissect_rpc_uint32(tvb, lock_tree, hf_klm_len, offset); return offset; }
static int dissect_create_link_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { guint32 error, lid; offset = dissect_error(tvb, offset, pinfo, tree, "Create_LinkResp", &error); lid = tvb_get_ntohl(tvb, offset); offset = dissect_rpc_uint32(tvb, tree, hf_vxi11_core_lid, offset); offset = dissect_rpc_uint32(tvb, tree, hf_vxi11_core_abort_port, offset); offset = dissect_rpc_uint32(tvb, tree, hf_vxi11_core_max_recv_size, offset); if (error == VXI11_CORE_ERROR_NO_ERROR) { if (tree) { proto_item_append_text(tree, " LID=%d", lid); } col_append_fstr(pinfo->cinfo, COL_INFO, " LID=%d", lid); } return offset; }
/* **************************** */ static int dissect_lock(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int version, int offset) { proto_item* lock_item = NULL; proto_tree* lock_tree = NULL; guint32 fh_hash, svid, start_offset=0, end_offset=0; if (tree) { lock_item = proto_tree_add_item(tree, hf_nlm_lock, tvb, offset, -1, ENC_NA); if (lock_item) lock_tree = proto_item_add_subtree(lock_item, ett_nlm_lock); } offset = dissect_rpc_string(tvb,lock_tree, hf_nlm_lock_caller_name, offset, NULL); offset = dissect_nfs3_fh(tvb, offset, pinfo, lock_tree, "fh", &fh_hash); if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, " FH:0x%08x", fh_hash); } offset = dissect_rpc_data(tvb, lock_tree, hf_nlm_lock_owner, offset); svid = tvb_get_ntohl(tvb, offset); offset = dissect_rpc_uint32(tvb, lock_tree, hf_nlm_lock_svid, offset); if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, " svid:%d", svid); } if (version == 4) { start_offset = tvb_get_ntohl(tvb, offset); offset = dissect_rpc_uint64(tvb, lock_tree, hf_nlm_lock_l_offset64, offset); end_offset = tvb_get_ntohl(tvb, offset); offset = dissect_rpc_uint64(tvb, lock_tree, hf_nlm_lock_l_len64, offset); } else { start_offset = tvb_get_ntohl(tvb, offset); offset = dissect_rpc_uint32(tvb, lock_tree, hf_nlm_lock_l_offset, offset); end_offset = tvb_get_ntohl(tvb, offset); offset = dissect_rpc_uint32(tvb, lock_tree, hf_nlm_lock_l_len, offset); } if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, " pos:%d-%d", start_offset, end_offset); } return offset; }
static int dissect_nlm_lock(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,int version) { if(nlm_match_msgres){ rpc_call_info_value *rpc_call=(rpc_call_info_value *)pinfo->private_data; if(rpc_call->proc==7){ /* NLM_LOCK_MSG */ if( (!pinfo->fd->flags.visited) ){ nlm_register_unmatched_msg(pinfo, tvb, offset); } else { nlm_print_msgres_request(pinfo, tree, tvb); } /* for the fhandle matching that finds both request and response packet */ if(nfs_fhandle_reqrep_matching){ nlm_match_fhandle_request(pinfo, tree); } } } offset = dissect_rpc_data(tvb, tree, hf_nlm_cookie, offset); offset = dissect_rpc_bool(tvb, tree, hf_nlm_block, offset); offset = dissect_rpc_bool(tvb, tree, hf_nlm_exclusive, offset); offset = dissect_lock(tvb, pinfo, tree, version, offset); offset = dissect_rpc_bool(tvb, tree, hf_nlm_reclaim, offset); offset = dissect_rpc_uint32(tvb, tree, hf_nlm_state, offset); return offset; }
static int dissect_bp_address(tvbuff_t *tvb, int offset, proto_tree *tree, int hfindex) { guint32 type; guint32 ipaddr; type = tvb_get_ntohl(tvb, offset); offset = dissect_rpc_uint32(tvb, tree, hf_bootparams_addresstype, offset); switch(type){ case 1: ipaddr = ((tvb_get_guint8(tvb, offset+3 )&0xff)<<24) |((tvb_get_guint8(tvb, offset+7 )&0xff)<<16) |((tvb_get_guint8(tvb, offset+11)&0xff)<<8 ) |((tvb_get_guint8(tvb, offset+15)&0xff) ); proto_tree_add_ipv4(tree, hfindex, tvb, offset, 16, g_ntohl(ipaddr)); offset += 16; break; default: break; } return offset; }
/* This function dissects fhstatus for v1 and v2 of the mount protocol. * Formally, hf_mount3_status only define the status codes returned by version * 3 of the protocol. * Though not formally defined in the standard, we use the same * value-to-string mappings as version 3 since we belive that this mapping * is consistant with most v1 and v2 implementations. */ static int dissect_fhstatus(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { gint32 status; status=tvb_get_ntohl(tvb,offset); offset = dissect_rpc_uint32(tvb,tree,hf_mount3_status,offset); switch (status) { case 0: offset = dissect_fhandle(tvb,offset,pinfo,tree,"fhandle", NULL); break; default: /* void */ if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr( pinfo->cinfo, COL_INFO, " Error:%s", val_to_str(status, mount3_mountstat3, "Unknown (0x%08X)")); } break; } return offset; }
static int dissect_create_link_parms(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { char *str; offset = dissect_rpc_uint32(tvb, tree, hf_vxi11_core_client_id, offset); offset = dissect_rpc_bool(tvb, tree, hf_vxi11_core_lock_device, offset); offset = dissect_rpc_uint32(tvb, tree, hf_vxi11_core_lock_timeout, offset); offset = dissect_rpc_string(tvb, tree, hf_vxi11_core_device, offset, &str); if (tree) { proto_item_append_text(tree, " (Create_LinkParms) %s", str); } col_append_fstr(pinfo->cinfo, COL_INFO, " %s", str); return offset; }
static int gluster_gd_mgmt_probe_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid, offset); offset = dissect_rpc_string(tvb, tree, hf_glusterd_hostname, offset, NULL); offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_port, offset); offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree); return offset; }
static int dissect_rquota(tvbuff_t *tvb, int offset, proto_tree *tree) { proto_item *lock_item = NULL; proto_tree *lock_tree = NULL; lock_item = proto_tree_add_item(tree, hf_rquota_rquota, tvb, offset, -1, FALSE); lock_tree = proto_item_add_subtree(lock_item, ett_rquota_rquota); offset = dissect_rpc_uint32(tvb, lock_tree, hf_rquota_bsize, offset); offset = dissect_rpc_bool(tvb, lock_tree, hf_rquota_active, offset); offset = dissect_rpc_uint32(tvb, lock_tree, hf_rquota_bhardlimit, offset); offset = dissect_rpc_uint32(tvb, lock_tree, hf_rquota_bsoftlimit, offset); offset = dissect_rpc_uint32(tvb, lock_tree, hf_rquota_curblocks, offset); offset = dissect_rpc_uint32(tvb, lock_tree, hf_rquota_fhardlimit, offset); offset = dissect_rpc_uint32(tvb, lock_tree, hf_rquota_fsoftlimit, offset); offset = dissect_rpc_uint32(tvb, lock_tree, hf_rquota_curfiles, offset); offset = dissect_rpc_uint32(tvb, lock_tree, hf_rquota_btimeleft, offset); offset = dissect_rpc_uint32(tvb, lock_tree, hf_rquota_ftimeleft, offset); return offset; }
static int dissect_error(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, const gchar *packet_type, guint32 *error) { const gchar *errstr; *error = tvb_get_ntohl(tvb, offset); errstr = val_to_str(*error, vxi11_core_error_vals, "Error %d"); offset = dissect_rpc_uint32(tvb, tree, hf_vxi11_core_error, offset); if (tree) { proto_item_append_text(tree, " (%s) %s", packet_type, errstr); } col_append_fstr(pinfo->cinfo, COL_INFO, " %s", errstr); return offset; }
} return offset + 4; } /* Dissectors for individual RPC requests and responses. */ static int dissect_create_link_parms(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, void* data _U_) { const char *str; offset = dissect_rpc_uint32(tvb, tree, hf_vxi11_core_client_id, offset); offset = dissect_rpc_bool(tvb, tree, hf_vxi11_core_lock_device, offset); offset = dissect_rpc_uint32(tvb, tree, hf_vxi11_core_lock_timeout, offset); offset = dissect_rpc_string(tvb, tree, hf_vxi11_core_device, offset, &str); if (tree) { proto_item_append_text(tree, " (Create_LinkParms) %s", str); } col_append_fstr(pinfo->cinfo, COL_INFO, " %s", str); return offset; } static int dissect_create_link_resp(tvbuff_t *tvb,
hf_rquota_btimeleft, offset); offset = dissect_rpc_uint32(tvb, lock_tree, hf_rquota_ftimeleft, offset); return offset; } static int dissect_getquota_result(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { gint32 status; status = tvb_get_ntohl(tvb, offset); offset = dissect_rpc_uint32(tvb, tree, hf_rquota_status, offset); if (status==Q_OK) { offset = dissect_rquota(tvb, offset, tree); } return offset; } static int dissect_getquota_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { offset = dissect_rpc_string(tvb, tree, hf_rquota_pathp, offset, NULL); offset = dissect_rpc_uint32(tvb, tree,
return offset; } static int dissect_klm_unlock_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, void* data) { offset = dissect_lock(tvb, pinfo, tree, offset, (rpc_call_info_value*)data); return offset; } static int dissect_klm_stat_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) { offset = dissect_rpc_uint32(tvb, tree, hf_klm_stats, offset); return offset; } static int dissect_klm_lock_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, void* data) { offset = dissect_rpc_bool( tvb, tree, hf_klm_block, offset); offset = dissect_rpc_bool( tvb, tree, hf_klm_exclusive, offset); offset = dissect_lock(tvb, pinfo, tree, offset, (rpc_call_info_value*)data);
static int proto_statnotify = -1; static int hf_statnotify_procedure_v1 = -1; static int hf_statnotify_name = -1; static int hf_statnotify_state = -1; static int hf_statnotify_priv = -1; static gint ett_statnotify = -1; static int dissect_statnotify_mon(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) { offset = dissect_rpc_string(tvb,tree,hf_statnotify_name,offset,NULL); offset = dissect_rpc_uint32(tvb,tree,hf_statnotify_state,offset); proto_tree_add_item(tree,hf_statnotify_priv,tvb,offset,16,ENC_NA); offset += 16; return offset; } /* proc number, "proc name", dissect_request, dissect_reply */ /* NULL as function pointer means: type of arguments is "void". */ static const vsff statnotify1_proc[] = { { 0, "NULL", NULL, NULL }, { STATNOTIFYPROC_MON, "MON-CALLBACK", dissect_statnotify_mon, NULL }, { 0, NULL, NULL, NULL }
static int hf_spray_counter = -1; static int hf_spray_clock = -1; static int hf_spray_sec = -1; static int hf_spray_usec = -1; static gint ett_spray = -1; static gint ett_spray_clock = -1; static int dissect_get_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { proto_item* lock_item = NULL; proto_tree* lock_tree = NULL; offset = dissect_rpc_uint32(tvb, tree, hf_spray_counter, offset); lock_item = proto_tree_add_item(tree, hf_spray_clock, tvb, offset, -1, ENC_NA); lock_tree = proto_item_add_subtree(lock_item, ett_spray_clock); offset = dissect_rpc_uint32(tvb, lock_tree, hf_spray_sec, offset); offset = dissect_rpc_uint32(tvb, lock_tree, hf_spray_usec, offset); return offset; }
static gint hf_gluster_progname = -1; static gint hf_gluster_prognum = -1; static gint hf_gluster_progver = -1; /* Initialize the subtree pointers */ static gint ett_gluster_pmap = -1; static gint ett_gluster_dump = -1; static gint ett_gluster_dump_detail = -1; /* PMAP PORTBYBRICK */ static int gluster_pmap_portbybrick_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, void* data _U_) { offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree, data); offset = dissect_rpc_uint32(tvb, tree, hf_gluster_brick_status, offset); offset = dissect_rpc_uint32(tvb, tree, hf_gluster_brick_port, offset); return offset; } static int gluster_pmap_portbybrick_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) { offset = dissect_rpc_string(tvb, tree, hf_gluster_brick, offset, NULL); return offset; } /* Based on rpc/rpc-lib/src/rpc-common.c, but xdr encoding/decoding is broken.
offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree); return offset; } static int gluster_gd_mgmt_probe_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { gchar *hostname = NULL; offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid, offset); offset = dissect_rpc_string(tvb, tree, hf_glusterd_hostname, offset, &hostname); offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_port, offset); return offset; } static int gluster_gd_mgmt_friend_add_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { gchar *hostname = NULL; offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid, offset); offset = dissect_rpc_string(tvb, tree, hf_glusterd_hostname, offset, &hostname); offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree);
static int dissect_fmp_notify_status(tvbuff_t *tvb, int offset, proto_tree *tree, int *rval) { fmpStat status; status = tvb_get_ntohl(tvb, offset); switch (status) { case FMP_OK: *rval = 0; break; case FMP_IOERROR: *rval = 1; break; case FMP_NOMEM: *rval = 1; break; case FMP_NOACCESS: *rval = 1; break; case FMP_INVALIDARG: *rval = 1; break; case FMP_FSFULL: *rval = 0; break; case FMP_QUEUE_FULL: *rval = 1; break; case FMP_WRONG_MSG_NUM: *rval = 1; break; case FMP_SESSION_LOST: *rval = 1; break; case FMP_HOT_SESSION: *rval = 0; break; case FMP_COLD_SESSION: *rval = 0; break; case FMP_CLIENT_TERMINATED: *rval = 0; break; case FMP_WRITER_LOST_BLK: *rval = 1; break; case FMP_REQUEST_QUEUED: *rval = 0; break; case FMP_FALL_BACK: *rval = 0; break; case FMP_REQUEST_CANCELLED: *rval = 1; break; case FMP_WRITER_ZEROED_BLK: *rval = 0; break; case FMP_NOTIFY_ERROR: *rval = 1; break; case FMP_WRONG_HANDLE: *rval = 0; break; case FMP_DUPLICATE_OPEN: *rval = 1; break; case FMP_PLUGIN_NOFUNC: *rval = 1; break; default: *rval = 1; break; } offset = dissect_rpc_uint32(tvb, tree, hf_fmp_status , offset); return offset; }
proto_tree *lock_tree = NULL; int offset = 0; offset = dissect_rpc_string(tvb, tree, hf_yppasswd_oldpass, offset, NULL); lock_item = proto_tree_add_item(tree, hf_yppasswd_newpw, tvb, offset, -1, ENC_NA); lock_tree = proto_item_add_subtree(lock_item, ett_yppasswd_newpw); offset = dissect_rpc_string(tvb, lock_tree, hf_yppasswd_newpw_name, offset, NULL); offset = dissect_rpc_string(tvb, lock_tree, hf_yppasswd_newpw_passwd, offset, NULL); offset = dissect_rpc_uint32(tvb, lock_tree, hf_yppasswd_newpw_uid, offset); offset = dissect_rpc_uint32(tvb, lock_tree, hf_yppasswd_newpw_gid, offset); offset = dissect_rpc_string(tvb, lock_tree, hf_yppasswd_newpw_gecos, offset, NULL); offset = dissect_rpc_string(tvb, lock_tree, hf_yppasswd_newpw_dir, offset, NULL); offset = dissect_rpc_string(tvb, lock_tree, hf_yppasswd_newpw_shell, offset, NULL); return offset; } static int dissect_yppasswd_reply(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) {
if (tree) proto_tree_add_text(tree, tvb, offset, 4, "Request: %s (%u)", val_to_str(mapreq, names_mapreq, "%u"), mapreq); offset += 4; return offset; } static int dissect_pcnfsd2_dissect_mapreq_arg_item(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) { offset = dissect_pcnfsd_mapreq(tvb, offset, tree); offset = dissect_rpc_uint32(tvb, tree, hf_pcnfsd_uid, offset); offset = dissect_pcnfsd_username(tvb, offset, tree); return offset; } static int dissect_pcnfsd2_mapid_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, void* data _U_) { offset = dissect_rpc_string(tvb, tree, hf_pcnfsd_comment, offset, NULL); offset = dissect_rpc_list(tvb, pinfo, tree, offset, dissect_pcnfsd2_dissect_mapreq_arg_item);
static const value_string teklink_vtc_modes[] = { { 0, "VTC_MODE_NONE" }, { 1, "VTC_MODE_1" }, { 2, "VTC_MODE_2" }, { 3, "VTC_MODE_3" }, { 4, "VTC_MODE_4" }, { 5, "VTC_MODE_5" }, { 6, "VTC_MODE_6" }, { 7, "VTC_MODE_EVENT_CNT_LAT" }, { 0, NULL }, }; static int dissect_teklink_tlaframeopen_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { offset = dissect_rpc_uint32(tvb, tree, hf_teklink_unknown_long, offset); offset = dissect_rpc_string(tvb, tree, hf_teklink_unknown_string, offset, NULL); offset = dissect_rpc_string(tvb, tree, hf_teklink_unknown_string, offset, NULL); offset = dissect_rpc_string(tvb, tree, hf_teklink_unknown_string, offset, NULL); return offset; } static int dissect_teklink_tlaframeclose_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { offset = dissect_rpc_uint32(tvb, tree, hf_teklink_unknown_long, offset); return offset; } static int dissect_teklink_tlaframeclose_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
/* Initialize the subtree pointers */ static gint ett_gluster_cli = -1; static gint ett_gluster_cli_2 = -1; /* CLI Operations */ static int gluster_cli_2_probe_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { gchar* hostname = NULL; offset = dissect_rpc_uint32(tvb, tree, hf_gluster_op_ret, offset); offset = dissect_rpc_uint32(tvb, tree, hf_gluster_op_errno, offset); offset = dissect_rpc_uint32(tvb, tree, hf_gluster_port, offset); offset = dissect_rpc_string(tvb, tree, hf_gluster_hostname, offset, &hostname); } static int gluster_cli_2_probe_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { gchar* hostname = NULL; offset = dissect_rpc_string(tvb, tree, hf_gluster_hostname, offset, &hostname); offset = dissect_rpc_uint32(tvb, tree, hf_gluster_port, offset); }