诸暨麻将添加redis
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

31 lines
653 B

  1. #ifndef __PROTO_MAN_H__
  2. #define __PROTO_MAN_H__
  3. enum {
  4. PROTO_JSON = 0,
  5. PROTO_BUF = 1,
  6. };
  7. struct cmd_msg {
  8. int stype;
  9. int ctype;
  10. unsigned int utag;
  11. void* body; // JSON str »òÕßÊÇmessage;
  12. };
  13. class proto_man {
  14. public:
  15. static void init(int proto_type);
  16. static void register_pf_cmd_map(char** pf_map, int len);
  17. static int proto_type();
  18. static bool decode_cmd_msg(unsigned char* cmd, int cmd_len, struct cmd_msg** out_msg);
  19. static void cmd_msg_free(struct cmd_msg* msg);
  20. static unsigned char* encode_msg_to_raw(const struct cmd_msg* msg, int* out_len);
  21. static void msg_raw_free(unsigned char* raw);
  22. };
  23. #endif