diff options
author | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2007-05-02 13:32:07 +0000 |
---|---|---|
committer | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2007-05-02 13:32:07 +0000 |
commit | 46602a91aefd6eddbb41dc0743eb51eee42fb79b (patch) | |
tree | a62195b07792f6cf45ba9b70ecb3ecb98751337b | |
parent | cd06093bcc6d3bdc3acb97c366d16fc894ecc02d (diff) | |
download | wireshark-46602a91aefd6eddbb41dc0743eb51eee42fb79b.tar.gz wireshark-46602a91aefd6eddbb41dc0743eb51eee42fb79b.tar.bz2 wireshark-46602a91aefd6eddbb41dc0743eb51eee42fb79b.zip |
updates to the ctdb dissector to follow the latest protocol
svn path=/trunk/; revision=21646
-rw-r--r-- | epan/dissectors/packet-ctdb.c | 209 |
1 files changed, 165 insertions, 44 deletions
diff --git a/epan/dissectors/packet-ctdb.c b/epan/dissectors/packet-ctdb.c index 9c11f99e1f..57934f9281 100644 --- a/epan/dissectors/packet-ctdb.c +++ b/epan/dissectors/packet-ctdb.c @@ -62,6 +62,12 @@ static int hf_ctdb_request_in = -1; static int hf_ctdb_response_in = -1; static int hf_ctdb_time = -1; static int hf_ctdb_xid = -1; +static int hf_ctdb_generation = -1; +static int hf_ctdb_hopcount = -1; +static int hf_ctdb_rsn = -1; +static int hf_ctdb_ctrl_opcode = -1; +static int hf_ctdb_srvid = -1; +static int hf_ctdb_ctrl_flags = -1; /* Initialize the subtree pointers */ static gint ett_ctdb = -1; @@ -79,23 +85,73 @@ typedef struct _ctdb_trans_t { #define CTDB_REQ_CALL 0 #define CTDB_REPLY_CALL 1 -#define CTDB_REPLY_REDIRECT 2 -#define CTDB_REQ_DMASTER 3 -#define CTDB_REPLY_DMASTER 4 -#define CTDB_REPLY_ERROR 5 -#define CTDB_REQ_MESSAGE 6 +#define CTDB_REQ_DMASTER 2 +#define CTDB_REPLY_DMASTER 3 +#define CTDB_REPLY_ERROR 4 +#define CTDB_REQ_MESSAGE 5 +#define CTDB_REQ_FINISHED 6 +#define CTDB_REQ_CONTROL 7 +#define CTDB_REPLY_CONTROL 8 static const value_string ctdb_opcodes[] = { - {CTDB_REQ_CALL, "CTDB_REQ_CALL"}, + {CTDB_REQ_CALL, "CTDB_REQ_CALL"}, {CTDB_REPLY_CALL, "CTDB_REPLY_CALL"}, - {CTDB_REPLY_REDIRECT, "CTDB_REPLY_REDIRECT"}, {CTDB_REQ_DMASTER, "CTDB_REQ_DMASTER"}, {CTDB_REPLY_DMASTER, "CTDB_REPLY_DMASTER"}, {CTDB_REPLY_ERROR, "CTDB_REPLY_ERROR"}, {CTDB_REQ_MESSAGE, "CTDB_REQ_MESSAGE"}, + {CTDB_REQ_FINISHED, "CTDB_REQ_FINISHED"}, + {CTDB_REQ_CONTROL, "CTDB_REQ_CONTROL"}, + {CTDB_REPLY_CONTROL, "CTDB_REPLY_CONTROL"}, {0,NULL} }; +#define CTDB_CONTROL_PROCESS_EXISTS 0 +#define CTDB_CONTROL_STATUS 1 +#define CTDB_CONTROL_CONFIG 2 +#define CTDB_CONTROL_PING 3 +#define CTDB_CONTROL_GETDBPATH 4 +#define CTDB_CONTROL_GETVNNMAP 5 +#define CTDB_CONTROL_SETVNNMAP 6 +#define CTDB_CONTROL_GET_DEBUG 7 +#define CTDB_CONTROL_SET_DEBUG 8 +#define CTDB_CONTROL_GET_DBMAP 9 +#define CTDB_CONTROL_GET_NODEMAP 10 +#define CTDB_CONTROL_SET_DMASTER 11 +#define CTDB_CONTROL_CLEAR_DB 12 +#define CTDB_CONTROL_PULL_DB 13 +#define CTDB_CONTROL_PUSH_DB 14 +#define CTDB_CONTROL_GET_RECMODE 15 +#define CTDB_CONTROL_SET_RECMODE 16 +#define CTDB_CONTROL_STATUS_RESET 17 +#define CTDB_CONTROL_DB_ATTACH 18 +#define CTDB_CONTROL_SET_CALL 19 +#define CTDB_CONTROL_WRITE_RECORD 20 +static const value_string ctrl_opcode_vals[] = { + {CTDB_CONTROL_PROCESS_EXISTS,"CTDB_CONTROL_PROCESS_EXISTS"}, + {CTDB_CONTROL_STATUS, "CTDB_CONTROL_STATUS"}, + {CTDB_CONTROL_CONFIG, "CTDB_CONTROL_CONFIG"}, + {CTDB_CONTROL_PING, "CTDB_CONTROL_PING"}, + {CTDB_CONTROL_GETDBPATH, "CTDB_CONTROL_GETDBPATH"}, + {CTDB_CONTROL_GETVNNMAP, "CTDB_CONTROL_GETVNNMAP"}, + {CTDB_CONTROL_SETVNNMAP, "CTDB_CONTROL_SETVNNMAP"}, + {CTDB_CONTROL_GET_DEBUG, "CTDB_CONTROL_GET_DEBUG"}, + {CTDB_CONTROL_SET_DEBUG, "CTDB_CONTROL_SET_DEBUG"}, + {CTDB_CONTROL_GET_DBMAP, "CTDB_CONTROL_GET_DBMAP"}, + {CTDB_CONTROL_GET_NODEMAP, "CTDB_CONTROL_GET_NODEMAP"}, + {CTDB_CONTROL_SET_DMASTER, "CTDB_CONTROL_SET_DMASTER"}, + {CTDB_CONTROL_CLEAR_DB, "CTDB_CONTROL_CLEAR_DB"}, + {CTDB_CONTROL_PULL_DB, "CTDB_CONTROL_PULL_DB"}, + {CTDB_CONTROL_PUSH_DB, "CTDB_CONTROL_PUSH_DB"}, + {CTDB_CONTROL_GET_RECMODE, "CTDB_CONTROL_GET_RECMODE"}, + {CTDB_CONTROL_SET_RECMODE, "CTDB_CONTROL_SET_RECMODE"}, + {CTDB_CONTROL_STATUS_RESET, "CTDB_CONTROL_STATUS_RESET"}, + {CTDB_CONTROL_DB_ATTACH, "CTDB_CONTROL_DB_ATTACH"}, + {CTDB_CONTROL_SET_CALL, "CTDB_CONTROL_SET_CALL"}, + {CTDB_CONTROL_WRITE_RECORD, "CTDB_CONTROL_WRITE_RECORD"}, + {0, NULL} +}; + static void ctdb_display_trans(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, ctdb_trans_t *ctdb_trans) { @@ -166,26 +222,53 @@ dissect_ctdb_key(proto_tree *tree, tvbuff_t *tvb, int offset, guint32 keylen, gu static int dissect_ctdb_reply_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int endianess) { + uint32_t datalen; + /* status */ proto_tree_add_item(tree, hf_ctdb_status, tvb, offset, 4, endianess); offset+=4; /* datalen */ proto_tree_add_item(tree, hf_ctdb_datalen, tvb, offset, 4, endianess); + if(endianess){ + datalen=tvb_get_letohl(tvb, offset); + } else { + datalen=tvb_get_ntohl(tvb, offset); + } offset+=4; /* data */ + proto_tree_add_item(tree, hf_ctdb_data, tvb, offset, datalen, endianess); + offset+=datalen; + return offset; } static int dissect_ctdb_reply_dmaster(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint32 reqid, guint32 dst, int endianess) { - guint32 datalen; + guint32 datalen, keylen; emem_tree_key_t tkey[3]; ctdb_trans_t *ctdb_trans; + /* dbid */ + proto_tree_add_item(tree, hf_ctdb_dbid, tvb, offset, 4, endianess); + offset+=4; + + /* rsn */ + proto_tree_add_item(tree, hf_ctdb_rsn, tvb, offset, 8, endianess); + offset+=8; + + /* keylen */ + proto_tree_add_item(tree, hf_ctdb_keylen, tvb, offset, 4, endianess); + if(endianess){ + keylen=tvb_get_letohl(tvb, offset); + } else { + keylen=tvb_get_ntohl(tvb, offset); + } + offset+=4; + /* datalen */ proto_tree_add_item(tree, hf_ctdb_datalen, tvb, offset, 4, endianess); if(endianess){ @@ -195,6 +278,9 @@ dissect_ctdb_reply_dmaster(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, pr } offset+=4; + /* key */ + offset=dissect_ctdb_key(tree, tvb, offset, keylen, NULL, endianess); + /* data */ proto_tree_add_item(tree, hf_ctdb_data, tvb, offset, datalen, endianess); offset+=datalen; @@ -225,6 +311,10 @@ dissect_ctdb_req_dmaster(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, prot proto_tree_add_item(tree, hf_ctdb_dbid, tvb, offset, 4, endianess); offset+=4; + /* rsn */ + proto_tree_add_item(tree, hf_ctdb_rsn, tvb, offset, 8, endianess); + offset+=8; + /* dmaster */ proto_tree_add_item(tree, hf_ctdb_dmaster, tvb, offset, 4, endianess); if(endianess){ @@ -274,6 +364,40 @@ dissect_ctdb_req_dmaster(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, prot return offset; } +static int +dissect_ctdb_req_control(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint32 reqid _U_, int endianess) +{ + uint32_t datalen; + + /* ctrl opcode */ + proto_tree_add_item(tree, hf_ctdb_ctrl_opcode, tvb, offset, 4, endianess); + offset+=4; + + /* srvid */ + proto_tree_add_item(tree, hf_ctdb_srvid, tvb, offset, 8, endianess); + offset+=8; + + + /* ctrl flags */ + proto_tree_add_item(tree, hf_ctdb_ctrl_flags, tvb, offset, 4, endianess); + offset+=4; + + /* datalen */ + proto_tree_add_item(tree, hf_ctdb_datalen, tvb, offset, 4, endianess); + if(endianess){ + datalen=tvb_get_letohl(tvb, offset); + } else { + datalen=tvb_get_ntohl(tvb, offset); + } + offset+=4; + + /* data */ + proto_tree_add_item(tree, hf_ctdb_data, tvb, offset, datalen, endianess); + offset+=datalen; + + return offset; +} + static const true_false_string flags_immediate_tfs={ "DMASTER for the record must IMMEDIATELY be migrated to the caller", "Dmaster migration is not required" @@ -308,6 +432,10 @@ dissect_ctdb_req_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree proto_tree_add_item(tree, hf_ctdb_callid, tvb, offset, 4, endianess); offset+=4; + /* hopcount */ + proto_tree_add_item(tree, hf_ctdb_hopcount, tvb, offset, 4, endianess); + offset+=4; + /* keylen */ proto_tree_add_item(tree, hf_ctdb_keylen, tvb, offset, 4, endianess); if(endianess){ @@ -367,39 +495,6 @@ dissect_ctdb_req_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree return offset; } -static int -dissect_ctdb_redirect(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint32 reqid, guint32 dst, int endianess) -{ - guint32 dmaster; - emem_tree_key_t tkey[3]; - ctdb_trans_t *ctdb_trans; - - /* dmaster */ - proto_tree_add_item(tree, hf_ctdb_dmaster, tvb, offset, 4, endianess); - if(endianess){ - dmaster=tvb_get_letohl(tvb, offset); - } else { - dmaster=tvb_get_ntohl(tvb, offset); - } - if(check_col(pinfo->cinfo, COL_INFO)){ - col_append_fstr(pinfo->cinfo, COL_INFO, " Dmaster:%d", dmaster); - } - offset+=4; - - tkey[0].length=1; - tkey[0].key=&reqid; - tkey[1].length=1; - tkey[1].key=&dst; - tkey[2].length=0; - ctdb_trans=se_tree_lookup32_array(ctdb_transactions, &tkey[0]); - - if(ctdb_trans){ - ctdb_display_trans(pinfo, tree, tvb, ctdb_trans); - } - - return offset; -} - static gboolean dissect_ctdb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) { @@ -451,6 +546,10 @@ dissect_ctdb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) proto_tree_add_item(tree, hf_ctdb_version, tvb, offset, 4, endianess); offset+=4; + /* generation */ + proto_tree_add_item(tree, hf_ctdb_generation, tvb, offset, 4, endianess); + offset+=4; + /* opcode */ proto_tree_add_item(tree, hf_ctdb_opcode, tvb, offset, 4, endianess); if(endianess){ @@ -503,9 +602,6 @@ dissect_ctdb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) case CTDB_REPLY_DMASTER: offset=dissect_ctdb_reply_dmaster(tvb, offset, pinfo, tree, reqid, dst, endianess); break; - case CTDB_REPLY_REDIRECT: - offset=dissect_ctdb_redirect(tvb, offset, pinfo, tree, reqid, dst, endianess); - break; case CTDB_REQ_DMASTER: offset=dissect_ctdb_req_dmaster(tvb, offset, pinfo, tree, reqid, endianess); break; @@ -513,6 +609,13 @@ dissect_ctdb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) break; case CTDB_REQ_MESSAGE: break; + case CTDB_REQ_FINISHED: + break; + case CTDB_REQ_CONTROL: + offset=dissect_ctdb_req_control(tvb, offset, pinfo, tree, reqid, endianess); + break; + case CTDB_REPLY_CONTROL: + break; }; return TRUE; @@ -568,6 +671,9 @@ proto_register_ctdb(void) { &hf_ctdb_dmaster, { "Dmaster", "ctdb.dmaster", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }}, + { &hf_ctdb_generation, { + "Generation", "ctdb.generation", FT_UINT32, BASE_DEC, + NULL, 0x0, "", HFILL }}, { &hf_ctdb_key, { "Key", "ctdb.key", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }}, @@ -589,6 +695,21 @@ proto_register_ctdb(void) { &hf_ctdb_xid, { "xid", "ctdb.xid", FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL }}, + { &hf_ctdb_hopcount, { + "Hopcount", "ctdb.hopcount", FT_UINT32, BASE_DEC, + NULL, 0x0, "", HFILL }}, + { &hf_ctdb_rsn, { + "RSN", "ctdb.rsn", FT_UINT64, BASE_HEX, + NULL, 0x0, "", HFILL }}, + { &hf_ctdb_ctrl_opcode, { + "CTRL Opcode", "ctdb.ctrl_opcode", FT_UINT32, BASE_DEC, + VALS(ctrl_opcode_vals), 0x0, "", HFILL }}, + { &hf_ctdb_srvid, { + "SrvId", "ctdb.srvid", FT_UINT64, BASE_HEX, + NULL, 0x0, "", HFILL }}, + { &hf_ctdb_ctrl_flags, { + "CTRL Flags", "ctdb.ctrl_flags", FT_UINT32, BASE_HEX, + NULL, 0x0, "", HFILL }}, }; /* Setup protocol subtree array */ |