From 22f2204745593b41bb894f1aecd281a6984bef3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Tue, 10 Aug 2021 21:46:44 +0200 Subject: [PATCH] Removed unused code --- lib/MySQL_Protocol.cpp | 95 ------------------------------------------ 1 file changed, 95 deletions(-) diff --git a/lib/MySQL_Protocol.cpp b/lib/MySQL_Protocol.cpp index cad2d1c29b..b391b8a046 100644 --- a/lib/MySQL_Protocol.cpp +++ b/lib/MySQL_Protocol.cpp @@ -260,101 +260,6 @@ static uint8_t mysql_encode_length(uint64_t len, char *hd) { return 9; } - -enum MySQL_response_type mysql_response(unsigned char *pkt, unsigned int length) { - unsigned char c=*pkt; - switch (c) { - case 0: - // proxy_debug(PROXY_DEBUG_MYSQL_COM, 6, "Packet OK_Packet\n"); - return OK_Packet; - case 0xff: - // proxy_debug(PROXY_DEBUG_MYSQL_COM, 6, "Packet ERR_Packet\n"); - return ERR_Packet; - case 0xfe: - if (length < 9) { - //proxy_debug(PROXY_DEBUG_MYSQL_COM, 6, "Packet EOF_Packet\n"); - return EOF_Packet; - } - default: - //proxy_debug(PROXY_DEBUG_MYSQL_COM, 6, "Packet UNKNOWN_Packet\n"); - return UNKNOWN_Packet; - } -} - -int pkt_com_query(unsigned char *pkt, unsigned int length) { - unsigned char buf[length]; - memcpy(buf,pkt+1, length-1); - buf[length-1]='\0'; - proxy_debug(PROXY_DEBUG_MYSQL_PROTOCOL,1,"Query: %s\n", buf); - return PKT_PARSED; -} - -int pkt_ok(unsigned char *pkt, unsigned int length, MySQL_Protocol *mp) { - if (length < 7) return PKT_ERROR; - - uint64_t affected_rows; - uint64_t insert_id; -#ifdef DEBUG - uint16_t warns; -#endif /* DEBUG */ - unsigned char msg[length]; - - unsigned int p=0; - int rc; - - pkt++; p++; - rc=mysql_decode_length(pkt,&affected_rows); - pkt += rc; p+=rc; - rc=mysql_decode_length(pkt,&insert_id); - pkt += rc; p+=rc; - mp->prot_status=CPY2(pkt); - pkt+=sizeof(uint16_t); - p+=sizeof(uint16_t); -#ifdef DEBUG - warns=CPY2(pkt); -#endif /* DEBUG */ - pkt+=sizeof(uint16_t); - p+=sizeof(uint16_t); - pkt++; - p++; - if (length>p) { - memcpy(msg,pkt,length-p); - msg[length-p]=0; - } else { - msg[0]=0; - } - - proxy_debug(PROXY_DEBUG_MYSQL_PROTOCOL,1,"OK Packet \n", (uint32_t)affected_rows, (uint32_t)insert_id, (uint16_t)mp->prot_status, (uint16_t)warns, msg); - - return PKT_PARSED; -} - - - -int pkt_end(unsigned char *pkt, unsigned int length, MySQL_Protocol *mp) -{ - if(*pkt != 0xFE || length > 5) return PKT_ERROR; -#ifdef DEBUG - uint16_t warns = 0; -#endif /* DEBUG */ - - if(length > 1) { // 4.1+ - pkt++; -#ifdef DEBUG - warns = CPY2(pkt); -#endif /* DEBUG */ - pkt += 2; - mp->prot_status = CPY2(pkt); - } - proxy_debug(PROXY_DEBUG_MYSQL_PROTOCOL,1,"End Packet \n", mp->prot_status, warns); - -// if(status & SERVER_MORE_RESULTS_EXISTS) { -// proxy_debug(PROXY_DEBUG_MYSQL_PROTOCOL,1,"End Packet \n"); -// } - - return PKT_PARSED; -} - #ifdef DEBUG void debug_spiffe_id(const unsigned char *user, const char *attributes, int __line, const char *__func) { if (strlen(attributes)) {