diff options
Diffstat (limited to 'analyzer/parser')
| -rw-r--r-- | analyzer/parser/fight_results.h | 17 | ||||
| -rw-r--r-- | analyzer/parser/parser_defs.h | 15 |
2 files changed, 9 insertions, 23 deletions
diff --git a/analyzer/parser/fight_results.h b/analyzer/parser/fight_results.h index ca45348..3aadf09 100644 --- a/analyzer/parser/fight_results.h +++ b/analyzer/parser/fight_results.h @@ -4,6 +4,9 @@ #include "parser/parser_defs.h" #include "utils/tcp.h" +#ifndef FIGHT_RESULTS_H +#define FIGHT_RESULTS_H + // Payload structure: // FIGHT_RESULTS_START EntityResults (SEPARATOR_ENTITY EntityResults)* FIGHT_RESULTS_END // @@ -92,8 +95,6 @@ &entity_results.saturation \ } -#ifndef ENTITY_RESULTS_DEFINED -#define ENTITY_RESULTS_DEFINED typedef struct { int team; // friend or enemy char *name; @@ -131,7 +132,6 @@ typedef struct { char *field34; char *saturation; } EntityResults; -#endif // items/gear/drifs fields parsing info #define INIT_ITEMS_CAPACITY 8 @@ -143,8 +143,6 @@ typedef struct { #define TEAM_ENEMY 2 // fight results data for friendly -#ifndef FRIENDLY_RESULTS_DEFINED -#define FRIENDLY_RESULTS_DEFINED typedef struct { char *name; int exp; @@ -157,29 +155,24 @@ typedef struct { char *saturation_type; int saturation; } FriendlyResults; -#endif // fight results data for enemy -#ifndef ENEMY_RESULTS_DEFINED -#define ENEMY_RESULTS_DEFINED typedef struct { char *name; int level; } EnemyResults; -#endif #define MAX_ENTITIES_PER_SIDE 8 // entire fight resutls -#ifndef FIGHT_RESULTS_DEFINED -#define FIGHT_RESULTS_DEFINED typedef struct { size_t num_friendly; FriendlyResults friendly_results[MAX_ENTITIES_PER_SIDE]; size_t num_enemy; EnemyResults enemy_results[MAX_ENTITIES_PER_SIDE]; } FightResults; -#endif extern find_function_t find_fight_results; extern parse_function_t parse_fight_results; + +#endif diff --git a/analyzer/parser/parser_defs.h b/analyzer/parser/parser_defs.h index 6af6059..aa39a4c 100644 --- a/analyzer/parser/parser_defs.h +++ b/analyzer/parser/parser_defs.h @@ -3,18 +3,13 @@ #include "utils/tcp.h" -#ifndef TYPE_ENUM_DEFINED -#define TYPE_ENUM_DEFINED +#ifndef PARSER_DEFS_H +#define PARSER_DEFS_H + typedef enum { INT, FLOAT, DOUBLE, STRING } TypeEnum; -#endif -#ifndef RESULTS_ENUM_DEFINED -#define RESULTS_ENUM_DEFINED typedef enum { TYPE_FIGHT_RESULTS } ResultsEnum; -#endif -#ifndef PARSED_DATA_DEFINED -#define PARSED_DATA_DEFINED // "generic" type for parsed data typedef struct { ResultsEnum data_type; // type of data represented by an enum @@ -22,7 +17,6 @@ typedef struct { void (*data_cleanup)(void *data); // function to cleanup internal allocations inside data // if no internal allocations - this should be NULL } ParsedData; -#endif // find the first results data of specific type in stream // params: @@ -42,10 +36,9 @@ typedef byte_t *find_function_t(TCPStream *stream, int offset, int *length); typedef ParsedData parse_function_t(byte_t *data, size_t length); // struct for holding the find and parse function for every result type -#ifndef FIND_PARSE_FUNCTIONS_DEFINED -#define FIND_PARSE_FUNCTIONS_DEFINED typedef struct { find_function_t *find_fn; parse_function_t *parse_fn; } FindParseFunctions; + #endif |
