my_parse.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright [2021] JD.com, Inc.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef _MY_PARSE_H_
  17. #define _MY_PARSE_H_
  18. #include "da_string.h"
  19. #include <stdint.h>
  20. #include <stdlib.h>
  21. struct msg;
  22. struct msg_tqh;
  23. /*
  24. MYSQL Protocol Definition, See more detail:
  25. https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_basic_packets.html#sect_protocol_basic_packets_packet
  26. */
  27. void my_parse_req(struct msg *r);
  28. void my_parse_rsp(struct msg *r);
  29. int my_do_command(struct context *ctx, struct conn *c_conn, struct msg *msg);
  30. int my_fragment(struct msg *r, uint32_t ncontinuum, struct msg_tqh *frag_msgq);
  31. int my_get_route_key(uint8_t *sql, int sql_len, int *start_offset,
  32. int *end_offset, const char* dbname, struct msg* r);
  33. #endif /* _MY_PARSE_H_ */