woww: Make preparations for auto generating dissector

This commit is contained in:
Gtker 2022-10-01 12:38:34 +02:00 committed by Alexis La Goutte
parent 978def5b51
commit 460ad699bf
1 changed files with 61 additions and 5 deletions

View File

@ -67,6 +67,9 @@ static int proto_woww = -1;
static int hf_woww_size = -1;
static int hf_woww_opcode = -1;
/* static int hf_woww_string_length = -1; */
/* AUTOGENERATED_START_HF */
/* SMSG_AUTH_CHALLENGE */
static int hf_woww_challenge_seed = -1;
@ -131,6 +134,7 @@ static int hf_woww_movement_jump_cos_anchor_pitch = -1;
static int hf_woww_movement_jump_sin_anchor_pitch = -1;
static int hf_woww_movement_jump_current_speed = -1;
static int hf_woww_movement_fall_start_elevation = -1;
/* AUTOGENERATED_END_HF */
#define WOWW_MOVEMENT_FALLING 0x00002000
#define WOWW_MOVEMENT_SWIMMING 0x00200000
@ -200,6 +204,7 @@ typedef struct {
guint8 opcode[];
} WowwDecryptedHeader_t;
/* AUTOGENERATED_START_ENUM */
typedef enum {
HUMAN = 1,
ORC = 2,
@ -2511,6 +2516,7 @@ static const value_string area_strings[] = {
{ AREA_ZORAMGAR_OUTPOST, "Zoram'gar Outpost" },
{ 0, NULL },
};
/* AUTOGENERATED_END_ENUM */
// All existing opcodes for 1.12.x
typedef enum
@ -2819,7 +2825,7 @@ typedef enum
CMSG_NEW_SPELL_SLOT = 0x12D,
CMSG_CAST_SPELL = 0x12E,
CMSG_CANCEL_CAST = 0x12F,
SMSG_CAST_FAILED = 0x130,
SMSG_CAST_RESULT = 0x130,
SMSG_SPELL_START = 0x131,
SMSG_SPELL_GO = 0x132,
SMSG_SPELL_FAILURE = 0x133,
@ -3047,7 +3053,7 @@ typedef enum
CMSG_GMTICKET_GETTICKET = 0x211,
SMSG_GMTICKET_GETTICKET = 0x212,
CMSG_UNLEARN_TALENTS = 0x213,
SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE = 0x214,
SMSG_GAMEOBJECT_SPAWN_ANIM = 0x214,
SMSG_GAMEOBJECT_DESPAWN_ANIM = 0x215,
MSG_CORPSE_QUERY = 0x216,
CMSG_GMTICKET_DELETETICKET = 0x217,
@ -3728,7 +3734,7 @@ static const value_string world_packet_strings[] = {
{ CMSG_NEW_SPELL_SLOT, "CMSG_NEW_SPELL_SLOT" },
{ CMSG_CAST_SPELL, "CMSG_CAST_SPELL" },
{ CMSG_CANCEL_CAST, "CMSG_CANCEL_CAST" },
{ SMSG_CAST_FAILED, "SMSG_CAST_FAILED" },
{ SMSG_CAST_RESULT, "SMSG_CAST_RESULT" },
{ SMSG_SPELL_START, "SMSG_SPELL_START" },
{ SMSG_SPELL_GO, "SMSG_SPELL_GO" },
{ SMSG_SPELL_FAILURE, "SMSG_SPELL_FAILURE" },
@ -3956,7 +3962,7 @@ static const value_string world_packet_strings[] = {
{ CMSG_GMTICKET_GETTICKET, "CMSG_GMTICKET_GETTICKET" },
{ SMSG_GMTICKET_GETTICKET, "SMSG_GMTICKET_GETTICKET" },
{ CMSG_UNLEARN_TALENTS, "CMSG_UNLEARN_TALENTS" },
{ SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, "SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE" },
{ SMSG_GAMEOBJECT_SPAWN_ANIM, "SMSG_GAMEOBJECT_SPAWN_ANIM" },
{ SMSG_GAMEOBJECT_DESPAWN_ANIM, "SMSG_GAMEOBJECT_DESPAWN_ANIM" },
{ MSG_CORPSE_QUERY, "MSG_CORPSE_QUERY" },
{ CMSG_GMTICKET_DELETETICKET, "CMSG_GMTICKET_DELETETICKET" },
@ -4651,6 +4657,44 @@ parse_SMSG_CHAR_ENUM(ptvcursor_t* ptv)
}
}
/*
static void
add_cstring(ptvcursor_t* ptv, const int* hf) {
gint32 len = get_null_terminated_string_length(ptvcursor_tvbuff(ptv), ptvcursor_current_offset(ptv));
ptvcursor_add(ptv, *hf, len, ENC_UTF_8);
}
static void
add_sized_cstring(ptvcursor_t* ptv, const int* hf) {
ptvcursor_add(ptv, hf_woww_string_length, 4, ENC_LITTLE_ENDIAN);
gint32 len = get_null_terminated_string_length(ptvcursor_tvbuff(ptv), ptvcursor_current_offset(ptv));
ptvcursor_add(ptv, *hf, len, ENC_UTF_8);
}
static void
add_packed_guid(ptvcursor_t* ptv, packet_info* pinfo) {
tvbuff_t* tvb = ptvcursor_tvbuff(ptv);
proto_tree* tree = ptvcursor_tree(ptv);
guint8 byte_mask = tvb_get_guint8(tvb, ptvcursor_current_offset(ptv));
ptvcursor_advance(ptv, 1);
guint8* guid = (guint8*)wmem_alloc(wmem_packet_scope(), 8);
for (gint i = 0; i < 8; ++i) {
if (byte_mask & (1 << i)) {
guid[i] = tvb_get_guint8(tvb, ptvcursor_current_offset(ptv));
ptvcursor_advance(ptv, 1);
}
}
tvbuff_t* next_tvb = tvb_new_child_real_data(tvb, (guint8*)guid, 8, 8);
add_new_data_source(pinfo, next_tvb, "Packed Guid");
proto_tree_add_item(tree, hf_woww_guid, next_tvb, 0, 8, ENC_LITTLE_ENDIAN);
}
*/
static void
add_body_fields(guint32 opcode,
proto_tree* tree,
@ -4658,8 +4702,12 @@ add_body_fields(guint32 opcode,
gint32 offset,
gint32 offset_packet_end)
{
gint32 len = 0;
guint32 len = 0;
/*guint32 i = 0;*/
/* AUTOGENERATED_START_VARIABLES */
/* AUTOGENERATED_END_VARIABLES */
ptvcursor_t* ptv = ptvcursor_new(wmem_packet_scope(), tree, tvb, offset);
/* AUTOGENERATED_START_PARSER */
switch (opcode) {
case SMSG_AUTH_CHALLENGE:
ptvcursor_add(ptv, hf_woww_challenge_seed, 4, ENC_LITTLE_ENDIAN);
@ -4868,6 +4916,7 @@ add_body_fields(guint32 opcode,
default:
break;
}
/* AUTOGENERATED_END_PARSER */
ptvcursor_free(ptv);
}
@ -5011,6 +5060,12 @@ proto_register_woww(void)
FT_UINT32, BASE_HEX, VALS(world_packet_strings), 0,
"Opcode of the packet", HFILL }
},
/*{ &hf_woww_string_length,
{ "String Length", "woww.string_length",
FT_UINT32, BASE_DEC_HEX, NULL, 0,
NULL, HFILL }
},*/
/* AUTOGENERATED_START_REGISTER */
{ &hf_woww_challenge_seed,
{ "Challenge Seed", "woww.challenge_seed",
FT_UINT32, BASE_HEX, NULL, 0,
@ -5251,6 +5306,7 @@ proto_register_woww(void)
FT_UINT32, BASE_DEC_HEX, NULL, 0,
NULL, HFILL }
},
/* AUTOGENERATED_END_REGISTER */
};
static gint *ett[] = {