/* hm_lobbyserver - HearthStone HearthMod lobbyserver Copyright (C) 2016 Filip Pancik This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include #include #include #include #include #include #include #define HM_LOBBYSERVER #include #include #include #define HS_MAX 26 struct hsmap_s { int service; int method; int token; void (*reply)(struct conn_client_s *c, const char *buf, const int lenlen); }; static struct hm_log_s l; static struct hm_pool_s *pool; static struct ev_loop *loop; char ip[32]; int iplen = 0; int gameserver_port = 0; void dump_binary(char *buf, int len) { int i; printf("dumping binary:\n"); for(i = 0; i < len; i++) { printf("%x|", buf[i]); } printf("\n"); } static int step0_build(char *dst, int ndst) {const char src[163] = { 0x00, 0x0C, 0x08, 0xFE, 0x01, 0x18, 0x00, 0x20, 0x00, 0x28, 0x95, 0x01, 0x30, 0x00, 0x0A, 0x0C, 0x08, 0xF4, 0xC9, 0xCC, 0xF3, 0x0D, 0x10, 0xC6, 0x87, 0xBC, 0xB8, 0x05, 0x12, 0x0A, 0x08, 0x89, 0xFF, 0x5C, 0x10, 0x92, 0xE5, 0xA1, 0xB9, 0x05, 0x18, 0x00, 0x22, 0x0E, 0x0A, 0x0C, 0x01, 0x09, 0x08, 0x0A, 0x04, 0x03, 0x05, 0x07, 0x06, 0x02, 0x11, 0x10, 0x2A, 0x2E, 0x0A, 0x2C, 0x0D, 0x55, 0x45, 0x00, 0x00, 0x15, 0x7A, 0x72, 0x74, 0x6D, 0x1A, 0x20, 0x6F, 0xF4, 0xFD, 0xD5, 0xFA, 0x5F, 0x6D, 0x62, 0xA2, 0x78, 0xA0, 0x44, 0x03, 0xE0, 0x75, 0xD6, 0x9D, 0x73, 0x4C, 0xD4, 0x88, 0x07, 0x32, 0xDC, 0xE8, 0xED, 0xC6, 0xA3, 0xF5, 0x28, 0x08, 0x92, 0x30, 0xA0, 0x8A, 0x95, 0xF4, 0xCE, 0xBD, 0xCC, 0x02, 0x42, 0x2E, 0x0A, 0x2C, 0x0D, 0x55, 0x45, 0x00, 0x00, 0x15, 0x7A, 0x72, 0x74, 0x6D, 0x1A, 0x20, 0xB4, 0xBD, 0x0F, 0x00, 0x96, 0xA7, 0x64, 0x8D, 0xE1, 0xD1, 0x90, 0x42, 0xFB, 0x7A, 0x79, 0xB9, 0x6C, 0x0D, 0xF4, 0x8E, 0xEA, 0x34, 0x88, 0xF4, 0x98, 0xB0, 0x8A, 0xD3, 0xD3, 0x8F, 0xB2, 0xCC, }; if(ndst >= 163) { memcpy(dst, src, 163); } return 163;} static int step1_0(char *dst, int ndst) {const char src[13] = { 0x00, 0x0B, 0x08, 0xFE, 0x01, 0x18, 0x01, 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, }; if(ndst >= 13) { memcpy(dst, src, 13); } return 13;} static int step1_1(char *dst, int ndst) {const char src[27] = { 0x00, 0x0C, 0x08, 0x01, 0x10, 0x0C, 0x18, 0x00, 0x20, 0x00, 0x28, 0x0D, 0x30, 0x00, 0x08, 0x01, 0x10, 0xC3, 0x83, 0xA8, 0xF4, 0xCE, 0xBD, 0xCC, 0x02, 0x18, 0x00, }; if(ndst >= 27) { memcpy(dst, src, 27); } return 27;} static int step1_2(char *dst, int ndst) {const char src[14] = { 0x00, 0x0C, 0x08, 0x01, 0x10, 0x0D, 0x18, 0x01, 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, }; if(ndst >= 14) { memcpy(dst, src, 14); } return 14;} static int step1_3(char *dst, int ndst) {const char src[52] = { 0x00, 0x0C, 0x08, 0x08, 0x10, 0x03, 0x18, 0x02, 0x20, 0x00, 0x28, 0x26, 0x30, 0x00, 0x12, 0x0C, 0x77, 0x65, 0x62, 0x5F, 0x61, 0x75, 0x74, 0x68, 0x5F, 0x75, 0x72, 0x6C, 0x1A, 0x16, 0x68, 0x74, 0x74, 0x70, 0x3A, 0x2F, 0x2F, 0x68, 0x73, 0x2F, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x2F, 0x7a, 0x2e, 0x68, 0x74, 0x6d, 0x6c }; if(ndst >= 52) { memcpy(dst, src, 52); } return 52;} static int step2_0(char *dst, int ndst) {const char src[23] = { 0x00, 0x0C, 0x08, 0x00, 0x10, 0x03, 0x18, 0x03, 0x20, 0x00, 0x28, 0x09, 0x30, 0x00, 0x09, 0x85, 0x2B, 0x96, 0xEE, 0xEC, 0x31, 0x05, 0x00, }; if(ndst >= 23) { memcpy(dst, src, 23); } return 23;} static int step3_0(char *dst, int ndst) {const char src[13] = { 0x00, 0x0B, 0x08, 0xFE, 0x01, 0x18, 0x02, 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, }; if(ndst >= 13) { memcpy(dst, src, 13); } return 13;} static int step3_1(char *dst, int ndst) {const char src[16] = { 0x00, 0x0C, 0x08, 0x01, 0x10, 0x0A, 0x18, 0x04, 0x20, 0x00, 0x28, 0x02, 0x30, 0x00, 0x08, 0x00, }; if(ndst >= 16) { memcpy(dst, src, 16); } return 16;} static int step3_2(char *dst, int ndst) {const char src[16] = { 0x00, 0x0C, 0x08, 0x01, 0x10, 0x0A, 0x18, 0x05, 0x20, 0x00, 0x28, 0x02, 0x30, 0x00, 0x08, 0x00, }; if(ndst >= 16) { memcpy(dst, src, 16); } return 16;} static int step3_3(char *dst, int ndst) {const char src[160] = { 0x00, 0x0D, 0x08, 0x01, 0x10, 0x05, 0x18, 0x06, 0x20, 0x00, 0x28, 0x91, 0x01, 0x30, 0x00, 0x08, 0x00, 0x12, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x11, 0x93, 0x71, 0x0E, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x12, 0x09, 0x47, 0x43, 0x54, 0x57, 0x02, 0x00, 0x00, 0x02, 0x11, 0x67, 0x39, 0xAB, 0x04, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x28, 0x01, 0x28, 0x02, 0x28, 0x03, 0x28, 0x06, 0x28, 0x62, 0x30, 0x02, 0x3A, 0x0F, 0x51, 0x75, 0x69, 0x72, 0x6B, 0x79, 0x4F, 0x72, 0x63, 0x23, 0x32, 0x39, 0x36, 0x38, 0x38, 0x42, 0x02, 0x53, 0x4B, 0x4A, 0x40, 0xAA, 0x15, 0x06, 0x17, 0x71, 0x93, 0x8C, 0x77, 0x90, 0xCD, 0xA5, 0x9B, 0xD5, 0x00, 0xBF, 0x2A, 0xA3, 0x20, 0x59, 0x12, 0x14, 0x80, 0x98, 0xF8, 0xB6, 0x8A, 0xDA, 0x80, 0x2F, 0x11, 0x22, 0xB2, 0x79, 0x2D, 0x90, 0xFA, 0x29, 0x52, 0xA3, 0x38, 0x03, 0x2A, 0x03, 0x89, 0x53, 0x22, 0xDD, 0x02, 0xC4, 0xE2, 0xF3, 0xCF, 0xE6, 0xCD, 0x72, 0x41, 0x54, 0x66, 0xB3, 0x79, 0x8C, 0x9A, 0xDB, 0x01, 0x50, 0x00, }; if(ndst >= 160) { memcpy(dst, src, 160); } return 160;} static int step4_0(char *dst, int ndst) {const char src[13] = { 0x00, 0x0B, 0x08, 0xFE, 0x01, 0x18, 0x03, 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, }; if(ndst >= 13) { memcpy(dst, src, 13); } return 13;} static int step4_1(char *dst, int ndst) {const char src[13] = { 0x00, 0x0B, 0x08, 0xFE, 0x01, 0x18, 0x04, 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, }; if(ndst >= 13) { memcpy(dst, src, 13); } return 13;} static int step4_2(char *dst, int ndst) {const char src[129] = { 0x00, 0x0C, 0x08, 0x05, 0x10, 0x01, 0x18, 0x07, 0x20, 0x01, 0x28, 0x73, 0x30, 0x00, 0x1A, 0x71, 0xAA, 0x06, 0x6E, 0x0A, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x11, 0x93, 0x71, 0x0E, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x12, 0x19, 0x0A, 0x17, 0x0A, 0x0A, 0x08, 0xCE, 0x84, 0x01, 0x10, 0x01, 0x18, 0x06, 0x20, 0x00, 0x12, 0x09, 0x18, 0x9A, 0xB1, 0xD8, 0xB4, 0x99, 0xBC, 0xCC, 0x02, 0x12, 0x1A, 0x0A, 0x18, 0x0A, 0x0A, 0x08, 0xCE, 0x84, 0x01, 0x10, 0x01, 0x18, 0x01, 0x20, 0x00, 0x12, 0x0A, 0x2A, 0x08, 0x6A, 0x6F, 0x68, 0x6E, 0x20, 0x62, 0x6F, 0x6E, 0x12, 0x21, 0x0A, 0x1F, 0x0A, 0x0A, 0x08, 0xCE, 0x84, 0x01, 0x10, 0x01, 0x18, 0x04, 0x20, 0x00, 0x12, 0x11, 0x2A, 0x0F, 0x51, 0x75, 0x69, 0x72, 0x6B, 0x79, 0x4F, 0x72, 0x63, 0x23, 0x32, 0x39, 0x36, 0x38, 0x38, }; if(ndst >= 129) { memcpy(dst, src, 129); } return 129;} static int step4_3(char *dst, int ndst) {const char src[237] = { 0x00, 0x0D, 0x08, 0x05, 0x10, 0x01, 0x18, 0x08, 0x20, 0x02, 0x28, 0xDE, 0x01, 0x30, 0x00, 0x1A, 0xDB, 0x01, 0xAA, 0x06, 0xD7, 0x01, 0x0A, 0x12, 0x09, 0x47, 0x43, 0x54, 0x57, 0x02, 0x00, 0x00, 0x02, 0x11, 0x67, 0x39, 0xAB, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x21, 0x0A, 0x1F, 0x0A, 0x0A, 0x08, 0xCE, 0x84, 0x01, 0x10, 0x02, 0x18, 0x05, 0x20, 0x00, 0x12, 0x11, 0x2A, 0x0F, 0x51, 0x75, 0x69, 0x72, 0x6B, 0x79, 0x4F, 0x72, 0x63, 0x23, 0x32, 0x39, 0x36, 0x38, 0x38, 0x12, 0x24, 0x0A, 0x22, 0x0A, 0x0A, 0x08, 0xCE, 0x84, 0x01, 0x10, 0x02, 0x18, 0x07, 0x20, 0x00, 0x12, 0x14, 0x52, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x11, 0x93, 0x71, 0x0E, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x12, 0x19, 0x0A, 0x17, 0x0A, 0x0A, 0x08, 0xCE, 0x84, 0x01, 0x10, 0x02, 0x18, 0x04, 0x20, 0x00, 0x12, 0x09, 0x18, 0x9A, 0xB1, 0xD8, 0xB4, 0x99, 0xBC, 0xCC, 0x02, 0x12, 0x12, 0x0A, 0x10, 0x0A, 0x0A, 0x08, 0xCE, 0x84, 0x01, 0x10, 0x02, 0x18, 0x0C, 0x20, 0x00, 0x12, 0x02, 0x10, 0x00, 0x12, 0x12, 0x0A, 0x10, 0x0A, 0x0A, 0x08, 0xCE, 0x84, 0x01, 0x10, 0x02, 0x18, 0x01, 0x20, 0x00, 0x12, 0x02, 0x10, 0x00, 0x12, 0x16, 0x0A, 0x14, 0x0A, 0x0A, 0x08, 0xCE, 0x84, 0x01, 0x10, 0x02, 0x18, 0x03, 0x20, 0x00, 0x12, 0x06, 0x42, 0x04, 0x57, 0x54, 0x43, 0x47, 0x12, 0x1D, 0x0A, 0x1B, 0x0A, 0x0A, 0x08, 0xCE, 0x84, 0x01, 0x10, 0x02, 0x18, 0x06, 0x20, 0x00, 0x12, 0x0D, 0x2A, 0x0B, 0x34, 0x33, 0x37, 0x31, 0x35, 0x34, 0x31, 0x39, 0x35, 0x23, 0x31, }; if(ndst >= 237) { memcpy(dst, src, 237); } return 237;} static int step4_4(char *dst, int ndst) {const char src[106] = { 0x00, 0x0C, 0x08, 0x05, 0x10, 0x06, 0x18, 0x09, 0x20, 0x01, 0x28, 0x5C, 0x30, 0x00, 0x12, 0x5A, 0xAA, 0x06, 0x57, 0x0A, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x11, 0x93, 0x71, 0x0E, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x12, 0x17, 0x0A, 0x15, 0x0A, 0x08, 0x08, 0xCE, 0x84, 0x01, 0x10, 0x01, 0x18, 0x06, 0x12, 0x09, 0x18, 0xF1, 0x82, 0xEA, 0xF5, 0xCE, 0xBD, 0xCC, 0x02, 0x12, 0x28, 0x0A, 0x26, 0x0A, 0x0E, 0x08, 0xCE, 0x84, 0x01, 0x10, 0x01, 0x18, 0x03, 0x20, 0x95, 0x94, 0xE0, 0x81, 0x09, 0x12, 0x14, 0x52, 0x12, 0x09, 0x47, 0x43, 0x54, 0x57, 0x02, 0x00, 0x00, 0x02, 0x11, 0x67, 0x39, 0xAB, 0x04, 0x00, 0x00, 0x00, 0x00, }; if(ndst >= 106) { memcpy(dst, src, 106); } return 106;} static int step4_5(char *dst, int ndst) {const char src[82] = { 0x00, 0x0C, 0x08, 0x05, 0x10, 0x06, 0x18, 0x0A, 0x20, 0x02, 0x28, 0x44, 0x30, 0x00, 0x12, 0x42, 0xAA, 0x06, 0x3F, 0x0A, 0x12, 0x09, 0x47, 0x43, 0x54, 0x57, 0x02, 0x00, 0x00, 0x02, 0x11, 0x67, 0x39, 0xAB, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x17, 0x0A, 0x15, 0x0A, 0x08, 0x08, 0xCE, 0x84, 0x01, 0x10, 0x02, 0x18, 0x04, 0x12, 0x09, 0x18, 0xF1, 0x82, 0xEA, 0xF5, 0xCE, 0xBD, 0xCC, 0x02, 0x12, 0x10, 0x0A, 0x0E, 0x0A, 0x08, 0x08, 0xCE, 0x84, 0x01, 0x10, 0x02, 0x18, 0x01, 0x12, 0x02, 0x10, 0x01, }; if(ndst >= 82) { memcpy(dst, src, 82); } return 82;} static int step4_6(char *dst, int ndst) {const char src[13] = { 0x00, 0x0B, 0x08, 0xFE, 0x01, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, }; if(ndst >= 13) { memcpy(dst, src, 13); } return 13;} static int step5_0(char *dst, int ndst) {const char src[65] = { 0x00, 0x0B, 0x08, 0xFE, 0x01, 0x18, 0x06, 0x20, 0x00, 0x28, 0x34, 0x30, 0x00, 0x08, 0xC8, 0x01, 0x10, 0xC8, 0x01, 0x18, 0xC8, 0x01, 0x22, 0x15, 0x08, 0x01, 0x12, 0x11, 0x62, 0x61, 0x74, 0x74, 0x6C, 0x65, 0x5F, 0x74, 0x61, 0x67, 0x5F, 0x66, 0x72, 0x69, 0x65, 0x6E, 0x64, 0x22, 0x12, 0x08, 0x02, 0x12, 0x0E, 0x72, 0x65, 0x61, 0x6C, 0x5F, 0x69, 0x64, 0x5F, 0x66, 0x72, 0x69, 0x65, 0x6E, 0x64, }; if(ndst >= 65) { memcpy(dst, src, 65); } return 65;} static int step5_1(char *dst, int ndst) {const char src[13] = { 0x00, 0x0B, 0x08, 0xFE, 0x01, 0x18, 0x07, 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, }; if(ndst >= 13) { memcpy(dst, src, 13); } return 13;} static int step5_2(char *dst, int ndst) {const char src[57] = { 0x00, 0x0B, 0x08, 0xFE, 0x01, 0x18, 0x09, 0x20, 0x00, 0x28, 0x2C, 0x30, 0x00, 0x0D, 0x55, 0x45, 0x00, 0x00, 0x15, 0x79, 0x74, 0x66, 0x70, 0x1A, 0x20, 0x5B, 0x2F, 0x9B, 0x39, 0x43, 0x4A, 0x1C, 0x4E, 0x3F, 0x97, 0x0A, 0x76, 0xC1, 0xE9, 0x7A, 0x85, 0x48, 0xC9, 0x5D, 0xA2, 0xAD, 0x52, 0xA6, 0xD3, 0x7C, 0xF9, 0xD7, 0x93, 0xDE, 0xDD, 0x88, 0x7D, }; if(ndst >= 57) { memcpy(dst, src, 57); } return 57;} static int step5_3(char *dst, int ndst) {const char src[82] = { 0x00, 0x0B, 0x08, 0xFE, 0x01, 0x18, 0x08, 0x20, 0x00, 0x28, 0x45, 0x30, 0x00, 0x0A, 0x3C, 0x0A, 0x3A, 0x25, 0x52, 0x55, 0x45, 0x00, 0x2A, 0x03, 0x53, 0x56, 0x4B, 0x30, 0x02, 0x3A, 0x08, 0x6A, 0x6F, 0x68, 0x6E, 0x20, 0x62, 0x6F, 0x6E, 0x42, 0x0F, 0x51, 0x75, 0x69, 0x72, 0x6B, 0x79, 0x4F, 0x72, 0x63, 0x23, 0x32, 0x39, 0x36, 0x38, 0x38, 0x6A, 0x11, 0x53, 0x4F, 0x4E, 0x49, 0x43, 0x51, 0x41, 0x40, 0x47, 0x4D, 0x41, 0x49, 0x4C, 0x2E, 0x43, 0x4F, 0x4D, 0x12, 0x05, 0x15, 0x73, 0x70, 0x8F, 0xDD, }; if(ndst >= 82) { memcpy(dst, src, 82); } return 82;} static int step6_0(char *dst, int ndst) {const char src[50] = { 0x00, 0x0B, 0x08, 0xFE, 0x01, 0x18, 0x0A, 0x20, 0x00, 0x28, 0x25, 0x30, 0x00, 0x0A, 0x09, 0x0A, 0x02, 0x69, 0x64, 0x12, 0x03, 0x18, 0xBB, 0x02, 0x0A, 0x18, 0x0A, 0x05, 0x70, 0x72, 0x6F, 0x74, 0x6F, 0x12, 0x0F, 0x32, 0x0D, 0x08, 0x49, 0x18, 0xAC, 0x02, 0x20, 0x00, 0x28, 0x00, 0x30, 0x0F, 0x40, 0x78, }; if(ndst >= 50) { memcpy(dst, src, 50); } return 50;} static int step7_0(char *dst, int ndst) {const char src[230] = { 0x00, 0x0D, 0x08, 0x04, 0x10, 0x01, 0x18, 0x0B, 0x20, 0x00, 0x28, 0xD7, 0x01, 0x30, 0x00, 0x0A, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x12, 0x09, 0x47, 0x43, 0x54, 0x57, 0x02, 0x00, 0x00, 0x02, 0x11, 0x67, 0x39, 0xAB, 0x04, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x1C, 0x57, 0x54, 0x43, 0x47, 0x2E, 0x55, 0x74, 0x69, 0x6C, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x4D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x13, 0x0A, 0x0C, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, 0x18, 0x88, 0x02, 0x22, 0x19, 0x0A, 0x0C, 0x66, 0x72, 0x61, 0x67, 0x6D, 0x65, 0x6E, 0x74, 0x5F, 0x30, 0x30, 0x30, 0x12, 0x09, 0x32, 0x07, 0x80, 0x01, 0x01, 0xA8, 0x01, 0xAC, 0x02, 0x22, 0x12, 0x0A, 0x0C, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x73, 0x69, 0x7A, 0x65, 0x12, 0x02, 0x18, 0x07, 0x2A, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x11, 0x93, 0x71, 0x0E, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x4A, 0x0A, 0x08, 0x89, 0xFF, 0x5C, 0x10, 0x92, 0xE5, 0xA1, 0xB9, 0x05, 0x52, 0x15, 0x0A, 0x05, 0x0D, 0x93, 0x71, 0x0E, 0x1A, 0x12, 0x0C, 0x0D, 0x67, 0x39, 0xAB, 0x04, 0x15, 0x47, 0x43, 0x54, 0x57, 0x18, 0x02, }; if(ndst >= 230) { memcpy(dst, src, 230); } return 230;} static int step7_1(char *dst, int ndst) {const char src[42] = { 0x00, 0x0B, 0x08, 0xFE, 0x01, 0x18, 0x0B, 0x20, 0x00, 0x28, 0x1D, 0x30, 0x00, 0x0A, 0x09, 0x0A, 0x02, 0x69, 0x64, 0x12, 0x03, 0x18, 0xC6, 0x02, 0x0A, 0x10, 0x0A, 0x05, 0x70, 0x72, 0x6F, 0x74, 0x6F, 0x12, 0x07, 0x32, 0x05, 0x08, 0x01, 0x10, 0xAF, 0x02, }; if(ndst >= 42) { memcpy(dst, src, 42); } return 42;} static int step7_2(char *dst, int ndst) {const char src[230] = { 0x00, 0x0D, 0x08, 0x04, 0x10, 0x01, 0x18, 0x0C, 0x20, 0x00, 0x28, 0xD7, 0x01, 0x30, 0x00, 0x0A, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x12, 0x09, 0x47, 0x43, 0x54, 0x57, 0x02, 0x00, 0x00, 0x02, 0x11, 0x67, 0x39, 0xAB, 0x04, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x1C, 0x57, 0x54, 0x43, 0x47, 0x2E, 0x55, 0x74, 0x69, 0x6C, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x4D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x13, 0x0A, 0x0C, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, 0x18, 0x88, 0x02, 0x22, 0x19, 0x0A, 0x0C, 0x66, 0x72, 0x61, 0x67, 0x6D, 0x65, 0x6E, 0x74, 0x5F, 0x30, 0x30, 0x30, 0x12, 0x09, 0x32, 0x07, 0x80, 0x01, 0x01, 0xA8, 0x01, 0xAC, 0x02, 0x22, 0x12, 0x0A, 0x0C, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x73, 0x69, 0x7A, 0x65, 0x12, 0x02, 0x18, 0x07, 0x2A, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x11, 0x93, 0x71, 0x0E, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x4A, 0x0A, 0x08, 0x89, 0xFF, 0x5C, 0x10, 0x92, 0xE5, 0xA1, 0xB9, 0x05, 0x52, 0x15, 0x0A, 0x05, 0x0D, 0x93, 0x71, 0x0E, 0x1A, 0x12, 0x0C, 0x0D, 0x67, 0x39, 0xAB, 0x04, 0x15, 0x47, 0x43, 0x54, 0x57, 0x18, 0x02, }; if(ndst >= 230) { memcpy(dst, src, 230); } return 230;} static int step7_3(char *dst, int ndst) {const char src[226] = { 0x00, 0x0D, 0x08, 0x04, 0x10, 0x01, 0x18, 0x0D, 0x20, 0x00, 0x28, 0xD3, 0x01, 0x30, 0x00, 0x0A, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x12, 0x09, 0x47, 0x43, 0x54, 0x57, 0x02, 0x00, 0x00, 0x02, 0x11, 0x67, 0x39, 0xAB, 0x04, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x1C, 0x57, 0x54, 0x43, 0x47, 0x2E, 0x55, 0x74, 0x69, 0x6C, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x4D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x13, 0x0A, 0x0C, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, 0x18, 0xB0, 0x02, 0x22, 0x15, 0x0A, 0x0C, 0x66, 0x72, 0x61, 0x67, 0x6D, 0x65, 0x6E, 0x74, 0x5F, 0x30, 0x30, 0x30, 0x12, 0x05, 0x32, 0x03, 0x08, 0xA6, 0x56, 0x22, 0x12, 0x0A, 0x0C, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x73, 0x69, 0x7A, 0x65, 0x12, 0x02, 0x18, 0x03, 0x2A, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x11, 0x93, 0x71, 0x0E, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x4A, 0x0A, 0x08, 0x89, 0xFF, 0x5C, 0x10, 0x92, 0xE5, 0xA1, 0xB9, 0x05, 0x52, 0x15, 0x0A, 0x05, 0x0D, 0x93, 0x71, 0x0E, 0x1A, 0x12, 0x0C, 0x0D, 0x67, 0x39, 0xAB, 0x04, 0x15, 0x47, 0x43, 0x54, 0x57, 0x18, 0x02, }; if(ndst >= 226) { memcpy(dst, src, 226); } return 226;} static int step8_0(char *dst, int ndst) {const char src[13] = { 0x00, 0x0B, 0x08, 0xFE, 0x01, 0x18, 0x0C, 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, }; if(ndst >= 13) { memcpy(dst, src, 13); } return 13;} static int step9_0(char *dst, int ndst) {const char src[67] = { 0x00, 0x0C, 0x08, 0x05, 0x10, 0x06, 0x18, 0x0E, 0x20, 0x02, 0x28, 0x35, 0x30, 0x00, 0x12, 0x33, 0xAA, 0x06, 0x30, 0x0A, 0x12, 0x09, 0x47, 0x43, 0x54, 0x57, 0x02, 0x00, 0x00, 0x02, 0x11, 0x67, 0x39, 0xAB, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x1A, 0x0A, 0x18, 0x0A, 0x0A, 0x08, 0xC7, 0x86, 0xD1, 0xBA, 0x05, 0x10, 0x02, 0x18, 0x13, 0x12, 0x0A, 0x2A, 0x08, 0x38, 0x33, 0x38, 0x38, 0x36, 0x30, 0x38, 0x30, }; if(ndst >= 67) { memcpy(dst, src, 67); } return 67;} static int step9_1(char *dst, int ndst) {const char src[13] = { 0x00, 0x0B, 0x08, 0xFE, 0x01, 0x18, 0x0D, 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, }; if(ndst >= 13) { memcpy(dst, src, 13); } return 13;} static int step9_2(char *dst, int ndst) {const char src[79] = { 0x00, 0x0C, 0x08, 0x05, 0x10, 0x06, 0x18, 0x0F, 0x20, 0x02, 0x28, 0x41, 0x30, 0x00, 0x12, 0x3F, 0xAA, 0x06, 0x3C, 0x0A, 0x12, 0x09, 0x47, 0x43, 0x54, 0x57, 0x02, 0x00, 0x00, 0x02, 0x11, 0x67, 0x39, 0xAB, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x26, 0x0A, 0x24, 0x0A, 0x0A, 0x08, 0xC7, 0x86, 0xD1, 0xBA, 0x05, 0x10, 0x02, 0x18, 0x14, 0x12, 0x16, 0x2A, 0x14, 0x65, 0x75, 0x2E, 0x61, 0x63, 0x74, 0x75, 0x61, 0x6C, 0x2E, 0x62, 0x61, 0x74, 0x74, 0x6C, 0x65, 0x2E, 0x6E, 0x65, 0x74, }; if(ndst >= 79) { memcpy(dst, src, 79); } return 79;} static int step9_3(char *dst, int ndst) {const char src[66] = { 0x00, 0x0B, 0x08, 0xFE, 0x01, 0x18, 0x0E, 0x20, 0x00, 0x28, 0x35, 0x30, 0x00, 0x12, 0x33, 0x18, 0x80, 0xB5, 0xB9, 0xF5, 0x0E, 0x22, 0x1F, 0x0A, 0x0D, 0x36, 0x32, 0x2E, 0x31, 0x39, 0x37, 0x2E, 0x32, 0x34, 0x33, 0x2E, 0x38, 0x38, 0x10, 0xCB, 0xA6, 0x01, 0x1A, 0x0A, 0x42, 0x72, 0x61, 0x74, 0x69, 0x73, 0x6C, 0x61, 0x76, 0x61, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x40, 0x9A, 0xE5, 0xA1, 0xB9, 0x05, }; if(ndst >= 66) { memcpy(dst, src, 66); } return 66;} static int step9_4(char *dst, int ndst) {const char src[42] = { 0x00, 0x0B, 0x08, 0xFE, 0x01, 0x18, 0x0F, 0x20, 0x00, 0x28, 0x1D, 0x30, 0x00, 0x0A, 0x09, 0x0A, 0x02, 0x69, 0x64, 0x12, 0x03, 0x18, 0xC6, 0x02, 0x0A, 0x10, 0x0A, 0x05, 0x70, 0x72, 0x6F, 0x74, 0x6F, 0x12, 0x07, 0x32, 0x05, 0x08, 0x01, 0x10, 0x8B, 0x02, }; if(ndst >= 42) { memcpy(dst, src, 42); } return 42;} static int step9_5(char *dst, int ndst) {const char src[228] = { 0x00, 0x0D, 0x08, 0x04, 0x10, 0x01, 0x18, 0x10, 0x20, 0x00, 0x28, 0xD5, 0x01, 0x30, 0x00, 0x0A, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x12, 0x09, 0x47, 0x43, 0x54, 0x57, 0x02, 0x00, 0x00, 0x02, 0x11, 0x67, 0x39, 0xAB, 0x04, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x1C, 0x57, 0x54, 0x43, 0x47, 0x2E, 0x55, 0x74, 0x69, 0x6C, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x4D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x13, 0x0A, 0x0C, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, 0x18, 0xC6, 0x02, 0x22, 0x17, 0x0A, 0x0C, 0x66, 0x72, 0x61, 0x67, 0x6D, 0x65, 0x6E, 0x74, 0x5F, 0x30, 0x30, 0x30, 0x12, 0x07, 0x32, 0x05, 0x08, 0x01, 0x10, 0x8B, 0x02, 0x22, 0x12, 0x0A, 0x0C, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x73, 0x69, 0x7A, 0x65, 0x12, 0x02, 0x18, 0x05, 0x2A, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x11, 0x93, 0x71, 0x0E, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x4A, 0x0A, 0x08, 0x89, 0xFF, 0x5C, 0x10, 0x92, 0xE5, 0xA1, 0xB9, 0x05, 0x52, 0x15, 0x0A, 0x05, 0x0D, 0x93, 0x71, 0x0E, 0x1A, 0x12, 0x0C, 0x0D, 0x67, 0x39, 0xAB, 0x04, 0x15, 0x47, 0x43, 0x54, 0x57, 0x18, 0x02, }; if(ndst >= 228) { memcpy(dst, src, 228); } return 228;} static int step9_6(char *dst, int ndst) {const char src[13] = { 0x00, 0x0B, 0x08, 0xFE, 0x01, 0x18, 0x12, 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, }; if(ndst >= 13) { memcpy(dst, src, 13); } return 13;} static int step9_7(char *dst, int ndst) {const char src[59] = { 0x00, 0x0C, 0x08, 0x05, 0x10, 0x06, 0x18, 0x11, 0x20, 0x02, 0x28, 0x2D, 0x30, 0x00, 0x12, 0x2B, 0xAA, 0x06, 0x28, 0x0A, 0x12, 0x09, 0x47, 0x43, 0x54, 0x57, 0x02, 0x00, 0x00, 0x02, 0x11, 0x67, 0x39, 0xAB, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x12, 0x0A, 0x10, 0x0A, 0x0A, 0x08, 0xC7, 0x86, 0xD1, 0xBA, 0x05, 0x10, 0x02, 0x18, 0x01, 0x12, 0x02, 0x10, 0x00, }; if(ndst >= 59) { memcpy(dst, src, 59); } return 59;} static int step9_8(char *dst, int ndst) {const char src[50] = { 0x00, 0x0B, 0x08, 0xFE, 0x01, 0x18, 0x11, 0x20, 0x00, 0x28, 0x25, 0x30, 0x00, 0x0A, 0x09, 0x0A, 0x02, 0x69, 0x64, 0x12, 0x03, 0x18, 0xBB, 0x02, 0x0A, 0x18, 0x0A, 0x05, 0x70, 0x72, 0x6F, 0x74, 0x6F, 0x12, 0x0F, 0x32, 0x0D, 0x08, 0x1E, 0x18, 0xAC, 0x02, 0x20, 0x00, 0x28, 0x00, 0x30, 0x0F, 0x40, 0x78, }; if(ndst >= 50) { memcpy(dst, src, 50); } return 50;} static int step10_0(char *dst, int ndst) {const char src[225] = { 0x00, 0x0D, 0x08, 0x04, 0x10, 0x01, 0x18, 0x12, 0x20, 0x00, 0x28, 0xD2, 0x01, 0x30, 0x00, 0x0A, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x12, 0x09, 0x47, 0x43, 0x54, 0x57, 0x02, 0x00, 0x00, 0x02, 0x11, 0x67, 0x39, 0xAB, 0x04, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x1C, 0x57, 0x54, 0x43, 0x47, 0x2E, 0x55, 0x74, 0x69, 0x6C, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x4D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x13, 0x0A, 0x0C, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, 0x18, 0xCA, 0x02, 0x22, 0x14, 0x0A, 0x0C, 0x66, 0x72, 0x61, 0x67, 0x6D, 0x65, 0x6E, 0x74, 0x5F, 0x30, 0x30, 0x30, 0x12, 0x04, 0x32, 0x02, 0x08, 0x01, 0x22, 0x12, 0x0A, 0x0C, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x73, 0x69, 0x7A, 0x65, 0x12, 0x02, 0x18, 0x02, 0x2A, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x11, 0x93, 0x71, 0x0E, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x4A, 0x0A, 0x08, 0x89, 0xFF, 0x5C, 0x10, 0x92, 0xE5, 0xA1, 0xB9, 0x05, 0x52, 0x15, 0x0A, 0x05, 0x0D, 0x93, 0x71, 0x0E, 0x1A, 0x12, 0x0C, 0x0D, 0x67, 0x39, 0xAB, 0x04, 0x15, 0x47, 0x43, 0x54, 0x57, 0x18, 0x02, }; if(ndst >= 225) { memcpy(dst, src, 225); } return 225;} static int step10_1(char *dst, int ndst) {const char src[42] = { 0x00, 0x0B, 0x08, 0xFE, 0x01, 0x18, 0x10, 0x20, 0x00, 0x28, 0x1D, 0x30, 0x00, 0x0A, 0x09, 0x0A, 0x02, 0x69, 0x64, 0x12, 0x03, 0x18, 0xC6, 0x02, 0x0A, 0x10, 0x0A, 0x05, 0x70, 0x72, 0x6F, 0x74, 0x6F, 0x12, 0x07, 0x32, 0x05, 0x08, 0x01, 0x10, 0xCD, 0x01, }; if(ndst >= 42) { memcpy(dst, src, 42); } return 42;} static int step10_2(char *dst, int ndst) {const char src[228] = { 0x00, 0x0D, 0x08, 0x04, 0x10, 0x01, 0x18, 0x13, 0x20, 0x00, 0x28, 0xD5, 0x01, 0x30, 0x00, 0x0A, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x12, 0x09, 0x47, 0x43, 0x54, 0x57, 0x02, 0x00, 0x00, 0x02, 0x11, 0x67, 0x39, 0xAB, 0x04, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x1C, 0x57, 0x54, 0x43, 0x47, 0x2E, 0x55, 0x74, 0x69, 0x6C, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x4D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x13, 0x0A, 0x0C, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, 0x18, 0xC6, 0x02, 0x22, 0x17, 0x0A, 0x0C, 0x66, 0x72, 0x61, 0x67, 0x6D, 0x65, 0x6E, 0x74, 0x5F, 0x30, 0x30, 0x30, 0x12, 0x07, 0x32, 0x05, 0x08, 0x01, 0x10, 0xCD, 0x01, 0x22, 0x12, 0x0A, 0x0C, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x73, 0x69, 0x7A, 0x65, 0x12, 0x02, 0x18, 0x05, 0x2A, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x11, 0x93, 0x71, 0x0E, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x4A, 0x0A, 0x08, 0x89, 0xFF, 0x5C, 0x10, 0x92, 0xE5, 0xA1, 0xB9, 0x05, 0x52, 0x15, 0x0A, 0x05, 0x0D, 0x93, 0x71, 0x0E, 0x1A, 0x12, 0x0C, 0x0D, 0x67, 0x39, 0xAB, 0x04, 0x15, 0x47, 0x43, 0x54, 0x57, 0x18, 0x02, }; if(ndst >= 228) { memcpy(dst, src, 228); } return 228;} static int step10_3(char *dst, int ndst) {const char src[42] = { 0x00, 0x0B, 0x08, 0xFE, 0x01, 0x18, 0x13, 0x20, 0x00, 0x28, 0x1D, 0x30, 0x00, 0x0A, 0x09, 0x0A, 0x02, 0x69, 0x64, 0x12, 0x03, 0x18, 0xC6, 0x02, 0x0A, 0x10, 0x0A, 0x05, 0x70, 0x72, 0x6F, 0x74, 0x6F, 0x12, 0x07, 0x32, 0x05, 0x08, 0x01, 0x10, 0x94, 0x02, }; if(ndst >= 42) { memcpy(dst, src, 42); } return 42;} static int step10_4(char *dst, int ndst) {const char src[228] = { 0x00, 0x0D, 0x08, 0x04, 0x10, 0x01, 0x18, 0x14, 0x20, 0x00, 0x28, 0xD5, 0x01, 0x30, 0x00, 0x0A, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x12, 0x09, 0x47, 0x43, 0x54, 0x57, 0x02, 0x00, 0x00, 0x02, 0x11, 0x67, 0x39, 0xAB, 0x04, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x1C, 0x57, 0x54, 0x43, 0x47, 0x2E, 0x55, 0x74, 0x69, 0x6C, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x4D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x13, 0x0A, 0x0C, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, 0x18, 0xC6, 0x02, 0x22, 0x17, 0x0A, 0x0C, 0x66, 0x72, 0x61, 0x67, 0x6D, 0x65, 0x6E, 0x74, 0x5F, 0x30, 0x30, 0x30, 0x12, 0x07, 0x32, 0x05, 0x08, 0x01, 0x10, 0x94, 0x02, 0x22, 0x12, 0x0A, 0x0C, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x73, 0x69, 0x7A, 0x65, 0x12, 0x02, 0x18, 0x05, 0x2A, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x11, 0x93, 0x71, 0x0E, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x4A, 0x0A, 0x08, 0x89, 0xFF, 0x5C, 0x10, 0x92, 0xE5, 0xA1, 0xB9, 0x05, 0x52, 0x15, 0x0A, 0x05, 0x0D, 0x93, 0x71, 0x0E, 0x1A, 0x12, 0x0C, 0x0D, 0x67, 0x39, 0xAB, 0x04, 0x15, 0x47, 0x43, 0x54, 0x57, 0x18, 0x02, }; if(ndst >= 228) { memcpy(dst, src, 228); } return 228;} static int step10_5(char *dst, int ndst) {const char src[203] = { 0x00, 0x0D, 0x08, 0x04, 0x10, 0x01, 0x18, 0x15, 0x20, 0x00, 0x28, 0xBC, 0x01, 0x30, 0x00, 0x0A, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x12, 0x09, 0x47, 0x43, 0x54, 0x57, 0x02, 0x00, 0x00, 0x02, 0x11, 0x67, 0x39, 0xAB, 0x04, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x1C, 0x57, 0x54, 0x43, 0x47, 0x2E, 0x55, 0x74, 0x69, 0x6C, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x4D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x13, 0x0A, 0x0C, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, 0x18, 0xB3, 0x02, 0x22, 0x12, 0x0A, 0x0C, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x73, 0x69, 0x7A, 0x65, 0x12, 0x02, 0x18, 0x00, 0x2A, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x11, 0x93, 0x71, 0x0E, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x4A, 0x0A, 0x08, 0x89, 0xFF, 0x5C, 0x10, 0x92, 0xE5, 0xA1, 0xB9, 0x05, 0x52, 0x15, 0x0A, 0x05, 0x0D, 0x93, 0x71, 0x0E, 0x1A, 0x12, 0x0C, 0x0D, 0x67, 0x39, 0xAB, 0x04, 0x15, 0x47, 0x43, 0x54, 0x57, 0x18, 0x02, }; if(ndst >= 203) { memcpy(dst, src, 203); } return 203;} static int step10_6(char *dst, int ndst) {const char src[225] = { 0x00, 0x0D, 0x08, 0x04, 0x10, 0x01, 0x18, 0x16, 0x20, 0x00, 0x28, 0xD2, 0x01, 0x30, 0x00, 0x0A, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x12, 0x09, 0x47, 0x43, 0x54, 0x57, 0x02, 0x00, 0x00, 0x02, 0x11, 0x67, 0x39, 0xAB, 0x04, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x1C, 0x57, 0x54, 0x43, 0x47, 0x2E, 0x55, 0x74, 0x69, 0x6C, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x4D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x13, 0x0A, 0x0C, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, 0x18, 0xCB, 0x02, 0x22, 0x14, 0x0A, 0x0C, 0x66, 0x72, 0x61, 0x67, 0x6D, 0x65, 0x6E, 0x74, 0x5F, 0x30, 0x30, 0x30, 0x12, 0x04, 0x32, 0x02, 0x08, 0x01, 0x22, 0x12, 0x0A, 0x0C, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x73, 0x69, 0x7A, 0x65, 0x12, 0x02, 0x18, 0x02, 0x2A, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x11, 0x93, 0x71, 0x0E, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x4A, 0x0A, 0x08, 0x89, 0xFF, 0x5C, 0x10, 0x92, 0xE5, 0xA1, 0xB9, 0x05, 0x52, 0x15, 0x0A, 0x05, 0x0D, 0x93, 0x71, 0x0E, 0x1A, 0x12, 0x0C, 0x0D, 0x67, 0x39, 0xAB, 0x04, 0x15, 0x47, 0x43, 0x54, 0x57, 0x18, 0x02, }; if(ndst >= 225) { memcpy(dst, src, 225); } return 225;} void step0(struct conn_client_s *c, const char *buf, const int len) { char out[1024]; int n; n = step0_build(out, sizeof(out)); hm_send(c, out, n); } void step1(struct conn_client_s *c, const char *buf, const int len) { char out[1024]; int n, a, b, x; n = step1_0(out, sizeof(out)); a = step1_1(out + n, sizeof(out)); b = step1_2(out + n + a, sizeof(out)); x = step1_3(out + n + a + b, sizeof(out)); hm_send(c, out, n + a + b + x); } void step2(struct conn_client_s *c, const char *buf, const int len) { char out[1024]; int n; // 12 is offet, length of token is 16 if(len < (12 + 6)) { return; } snprintf(c->token, sizeof(c->token), "%.*s", len - 12, buf + 12); c->ntoken = len - 12; n = step2_0(out, sizeof(out)); hm_send(c, out, n); } void step3(struct conn_client_s *c, const char *buf, const int len) { char out[1024]; int n, a, b, x; n = step3_0(out, sizeof(out)); a = step3_1(out + n, sizeof(out)); b = step3_2(out + n + a, sizeof(out)); x = step3_3(out + n + a + b, sizeof(out)); hm_send(c, out, n + a + b + x); } void step4(struct conn_client_s *c, const char *buf, const int len) { char out[2048]; int t; t = step4_0(out, sizeof(out)); t += step4_1(out + t, sizeof(out)); t += step4_2(out + t, sizeof(out)); t += step4_3(out + t, sizeof(out)); t += step4_5(out + t, sizeof(out)); t += step4_6(out + t, sizeof(out)); hm_send(c, out, t); } void step5(struct conn_client_s *c, const char *buf, const int len) { char out[1024]; int t; t = step5_0(out, sizeof(out)); t += step5_1(out + t, sizeof(out)); t += step5_2(out + t, sizeof(out)); t += step5_3(out + t, sizeof(out)); hm_send(c, out, t); } void step6(struct conn_client_s *c, const char *buf, const int len) { char out[1024]; int n; n = step6_0(out, sizeof(out)); hm_send(c, out, n); } void step7(struct conn_client_s *c, const char *buf, const int len) { char out[2048]; int t; t = step7_0(out, sizeof(out)); t += step7_1(out + t, sizeof(out)); t += step7_2(out + t, sizeof(out)); t += step7_3(out + t, sizeof(out)); hm_send(c, out, t); } void step8(struct conn_client_s *c, const char *buf, const int len) { char out[1024]; int n; n = step0_build(out, sizeof(out)); hm_send(c, out, n); } void step9(struct conn_client_s *c, const char *buf, const int len) { char out[2048]; int t; t = step9_0(out, sizeof(out)); t += step9_1(out + t, sizeof(out)); t += step9_2(out + t, sizeof(out)); t += step9_3(out + t, sizeof(out)); t += step9_4(out + t, sizeof(out)); t += step9_5(out + t, sizeof(out)); t += step9_6(out + t, sizeof(out)); t += step9_7(out + t, sizeof(out)); t += step9_8(out + t, sizeof(out)); hm_send(c, out, t); } void step10(struct conn_client_s *c, const char *buf, const int len) { char out[2048]; int t; t = step10_0(out, sizeof(out)); t += step10_1(out + t, sizeof(out)); t += step10_2(out + t, sizeof(out)); t += step10_3(out + t, sizeof(out)); t += step10_4(out + t, sizeof(out)); t += step10_5(out + t, sizeof(out)); t += step10_6(out + t, sizeof(out)); hm_send(c, out, t); } void step11(struct conn_client_s *c, const char *buf, const int len) { char out[65536]; int t = 0; t += step11_0(out + t, sizeof(out) - t); t += step11_0(out + t, sizeof(out) - t); t += step11_1(out + t, sizeof(out) - t); t += step11_2(out + t, sizeof(out) - t); t += step11_3(out + t, sizeof(out) - t); t += step11_4(out + t, sizeof(out) - t); t += step11_5(out + t, sizeof(out) - t); t += step11_6(out + t, sizeof(out) - t); t += step11_7(out + t, sizeof(out) - t); t += step11_8(out + t, sizeof(out) - t); t += step11_9(out + t, sizeof(out) - t); t += step11_10(out + t, sizeof(out) - t); t += step11_11(out + t, sizeof(out) - t); t += step11_12(out + t, sizeof(out) - t); t += step11_13(out + t, sizeof(out) - t); t += step11_14(out + t, sizeof(out) - t); t += step11_15(out + t, sizeof(out) - t); t += step11_16(out + t, sizeof(out) - t); t += step11_17(out + t, sizeof(out) - t); t += step11_18(out + t, sizeof(out) - t); t += step11_19(out + t, sizeof(out) - t); t += step11_20(out + t, sizeof(out) - t); t += step11_21(out + t, sizeof(out) - t); t += step11_22(out + t, sizeof(out) - t); t += step11_23(out + t, sizeof(out) - t); t += step11_24(out + t, sizeof(out) - t); t += step11_25(out + t, sizeof(out) - t); t += step11_26(out + t, sizeof(out) - t); t += step11_27(out + t, sizeof(out) - t); t += step11_28(out + t, sizeof(out) - t); t += step11_29(out + t, sizeof(out) - t); t += step11_30(out + t, sizeof(out) - t); t += step11_31(out + t, sizeof(out) - t); t += step11_32(out + t, sizeof(out) - t); t += step11_33(out + t, sizeof(out) - t); t += step11_34(out + t, sizeof(out) - t); t += step11_35(out + t, sizeof(out) - t); t += step11_36(out + t, sizeof(out) - t); t += step11_37(out + t, sizeof(out) - t); t += step11_38(out + t, sizeof(out) - t); t += step11_39(out + t, sizeof(out) - t); t += step11_40(out + t, sizeof(out) - t); hm_send(c, out, t); } void step12(struct conn_client_s *c, const char *buf, const int len) { char out[2048]; int t = 0; t += step12_0(out + t, sizeof(out) - t); t += step12_1(out + t, sizeof(out) - t); hm_send(c, out, t); } void step13(struct conn_client_s *c, const char *buf, const int len) { char out[16384]; int t = 0; t += step13_0(out + t, sizeof(out) - t); t += step13_1(out + t, sizeof(out) - t); t += step13_2(out + t, sizeof(out) - t); hm_send(c, out, t); } void step14(struct conn_client_s *c, const char *buf, const int len) { char out[2048]; int t = 0; t += step14_0(out + t, sizeof(out) - t); t += step14_1(out + t, sizeof(out) - t); t += step14_2(out + t, sizeof(out) - t); hm_send(c, out, t); } void step15(struct conn_client_s *c, const char *buf, const int len) { char out[2048]; int t = 0; t += step15_0(out + t, sizeof(out) - t); t += step15_1(out + t, sizeof(out) - t); hm_send(c, out, t); } void step16(struct conn_client_s *c, const char *buf, const int len) { char out[2048]; int t = 0; t += step16_0(out + t, sizeof(out) - t); t += step16_1(out + t, sizeof(out) - t); t += step16_2(out + t, sizeof(out) - t); hm_send(c, out, t); } void step17(struct conn_client_s *c, const char *buf, const int len) { char out[2048]; int t = 0; t += step17_0(out + t, sizeof(out) - t); t += step17_1(out + t, sizeof(out) - t); t += step17_2(out + t, sizeof(out) - t); t += step17_3(out + t, sizeof(out) - t); hm_send(c, out, t); } void step18(struct conn_client_s *c, const char *buf, const int len) { char out[2048]; int t = 0; t += step18_0(out + t, sizeof(out) - t); t += step18_1(out + t, sizeof(out) - t); t += step18_2(out + t, sizeof(out) - t); t += step18_3(out + t, sizeof(out) - t); hm_send(c, out, t); } void step19(struct conn_client_s *c, const char *buf, const int len) { char out[2048]; int t = 0; t += step19_0(out + t, sizeof(out) - t); t += step19_1(out + t, sizeof(out) - t); t += step19_2(out + t, sizeof(out) - t); t += step19_3(out + t, sizeof(out) - t); t += step19_4(out + t, sizeof(out) - t); hm_send(c, out, t); } void step20(struct conn_client_s *c, const char *buf, const int len) { char out[2048]; int t = 0; t += step20_0(out + t, sizeof(out) - t); hm_send(c, out, t); } void step21(struct conn_client_s *c, const char *buf, const int len) { char out[2048]; int t = 0; t += step21_0(out + t, sizeof(out) - t); t += step21_1(out + t, sizeof(out) - t); hm_send(c, out, t); } void start_game(struct conn_client_s *p1, struct conn_client_s *p2, const int gamehandle) { char buf1[2048], buf2[2048]; char *out; int t; t = 0; out = buf1; t += step22_0(out + t, sizeof(buf2) - t); t += step22_1(out + t, sizeof(buf2) - t); t += step22_2(out + t, sizeof(buf2) - t); t += step22_3(out + t, sizeof(buf2) - t); t += step22_4(out + t, sizeof(buf2) - t); t += step22_5(out + t, sizeof(buf2) - t); t += step22_6(out + t, sizeof(buf2) - t); t += step22_7(out + t, sizeof(buf2) - t); t += step22_8(out + t, sizeof(buf2) - t); t += step22_9_1(out + t, sizeof(buf2) - t, iplen); t += step22_9_ip(out + t, sizeof(buf2) - t, ip, iplen); t += step22_9_2(out + t, sizeof(buf2) - t, gameserver_port); t = 0; out = buf2; t += step22_0(out + t, sizeof(buf2) - t); t += step22_1(out + t, sizeof(buf2) - t); t += step22_2(out + t, sizeof(buf2) - t); t += step22_3(out + t, sizeof(buf2) - t); t += step22_4(out + t, sizeof(buf2) - t); t += step22_5(out + t, sizeof(buf2) - t); t += step22_6(out + t, sizeof(buf2) - t); t += step22_7(out + t, sizeof(buf2) - t); t += step22_8(out + t, sizeof(buf2) - t); t += step22_9_1(out + t, sizeof(buf2) - t, iplen); t += step22_9_ip(out + t, sizeof(buf2) - t, ip, iplen); t += step22_9_2(out + t, sizeof(buf2) - t, gameserver_port); memcpy(buf1 + 1343 + (iplen - 14), p1->token, p1->ntoken); memcpy(buf2 + 1343 + (iplen - 14), p2->token, p2->ntoken); hm_send(p1, buf1, t); hm_send(p2, buf2, t); } void step22(struct conn_client_s *c, const char *buf, const int len) { c->skip = 1; matchmaking(c); } void step23(struct conn_client_s *c, const char *buf, const int len) { char out[2048]; int t = 0; t += step23_0(out + t, sizeof(out) - t); t += step23_1(out + t, sizeof(out) - t); t += step23_2(out + t, sizeof(out) - t); hm_send(c, out, t); } void step24(struct conn_client_s *c, const char *buf, const int len) { char out[2048]; int t = 0; t += step24_0(out + t, sizeof(out) - t); t += step24_1(out + t, sizeof(out) - t); t += step24_2(out + t, sizeof(out) - t); hm_send(c, out, t); } void step25(struct conn_client_s *c, const char *buf, const int len) { char out[2048]; int t = 0; t += step25_0(out + t, sizeof(out) - t); t += step25_1(out + t, sizeof(out) - t); t += step25_2(out + t, sizeof(out) - t); hm_send(c, out, t); } static struct hsmap_s hsmap[HS_MAX] = { {0, 1, 0, step0}, {1, 1, 1, step1}, {1, 7, 2, step2}, {-2, 0, 3, step3}, {4, 1, 4, step4}, {0x10, 1, 9, step5}, {9, 1, 0xa, step6}, {9, 1, 0xb, step7}, {9, 1, 0x11, step8}, {4, 3, 0x12, step9}, {9, 1, 0x13, step10}, {9, 1, 0x19, step11}, {9, 1, 0x1b, step12}, {9, 1, 0x1c, step13}, {9, 1, 0x1d, step14}, {4, 3, 0x1f, step15}, {0x10, 1, 0x20, step16}, {9, 1, 0x22, step17}, {4, 3, 0x24, step18}, // handshake end {9, 1, 0x25, step19}, {9, 1, 0x26, step20}, {4, 3, 0x27, step21}, // swapped with 0x25 {8, 3, 0x29, step22}, //{4, 3, 0x2a, step22}, //0|8|8|0|10|5|18|26|28|0| /* {9, 1, 0x2c, step23}, {4, 1, 0x2d, step24}, {4, 3, 0x2e, step25}, */ }; void hm_recv(struct conn_client_s *cs, const char *buf, const int len) { int i, service, method, token, token1; if(cs->skip == 1) { hm_log(LOG_DEBUG, &l, "Skipping for %d bytes", len); return; } if(len < 10) { hm_log(LOG_DEBUG, &l, "Ignoring as received only %d bytes", len); return; } service = buf[3]; method = buf[5]; token = buf[7]; token1 = buf[8]; for(i = 0; i < HS_MAX; i++) { if(len > 12 && *(int *)buf == -1 && *(int *)(buf + 4) == CLIENT_LOGIN ) { client_login(cs, buf + 12, len - 12); return; } else if(service == hsmap[i].service && method == hsmap[i].method && token == hsmap[i].token) { hm_log(LOG_DEBUG, &l, "Hsmap iter: %d", i); hsmap[i].reply(cs, buf, len); return; } else if(service == hsmap[i].service && token1 == hsmap[i].token) { hm_log(LOG_DEBUG, &l, "Hsmap iter: %d", i); hsmap[i].reply(cs, buf, len); return; } else { //hm_log(LOG_DEBUG, &l, "Ignoring: %d %d %d %d %d %d", service, hsmap[i].service, method, hsmap[i].method, token, hsmap[i].token); } } } int start_server() { struct conn_server_s *cs; cs = malloc(sizeof(*cs)); memset(cs, 0, sizeof(*cs)); cs->loop = loop; cs->host = "0.0.0.0"; cs->port = "45678"; cs->log = &l; cs->pool = pool; cs->recv = hm_recv; connector_server(cs); return 0; } void callback(struct instance_s *data) { struct instance_s *i; if(data == NULL) { couchbase_deinit(); hm_log(LOG_DEBUG, &l, "{Connector}: all destinations are offline"); return; } for(i = data; i != NULL; i = i->next) { hm_log(LOG_DEBUG, &l, "{Connector}: connstr: [%s] online: %d group: %d bucket index: %d", i->connstr, i->status, i->group, i->index); } start_server(); } void daemonize () { if (chdir("/") != 0) { hm_log(LOG_EMERG, &l, "Unable change directory to /: %s", strerror(errno)); exit(1); } pid_t pid = fork(); if (pid < 0) { hm_log(LOG_EMERG, &l, "Unable to daemonize: fork failed: %s", strerror(errno)); exit(1); } if (pid != 0) { hm_log(LOG_DEBUG, &l, "{core} Daemonized as pid %d.", pid); exit(0); } fclose(stdin); fclose(stdout); fclose(stderr); #define NULL_DEV "/dev/null" stdin = fopen(NULL_DEV, "r"); if (stdin == NULL) { hm_log(LOG_EMERG, &l, "Unable to reopen stdin to %s: %s", NULL_DEV, strerror(errno)); exit(1); } stdout = fopen(NULL_DEV, "w"); if (stdout == NULL) { hm_log(LOG_EMERG, &l, "Unable to reopen stdout to %s: %s", NULL_DEV, strerror(errno)); exit(1); } stderr = fopen(NULL_DEV, "w"); if (stderr == NULL) { hm_log(LOG_EMERG, &l, "Unable to reopen stderr to %s: %s", NULL_DEV, strerror(errno)); exit(1); } pid_t s = setsid(); if (s < 0) { hm_log(LOG_EMERG, &l, "Unable to create new session, setsid(2) failed: %s :: %d", strerror(errno), s); exit(1); } hm_log(LOG_DEBUG, &l, "Successfully daemonized as pid %d", getpid()); } int main(int argc, char **argv) { struct couchbase_data_s cd; const char *hosts[1] = { "localhost" }; const int groups[1] = { 0 }; // Must start with 0 const char *buckets[1] = { "hbs" }; const char *passwd[1] = { "aci" }; int i; int daemon = 0; for(i = 1; i < argc; i++) { if(strlen(argv[i]) > 6 && memcmp(argv[i], "--log=", 6) == 0) { daemon = 1; hm_log_open(&l, argv[i] + 6, LOG_DEBUG); } if(strlen(argv[i]) > 13 && memcmp(argv[i], "--gameserver=", 13) == 0) { snprintf(ip, sizeof(ip), "%s", argv[i] + 13); iplen = strlen(ip); } if(strlen(argv[i]) > 18 && memcmp(argv[i], "--gameserver_port=", 18) == 0) { char gp[32]; snprintf(gp, sizeof(gp), "%s", argv[i] + 18); gameserver_port = atoi(gp); } } assert(iplen != 0); // gameserver port number must occupy exactly 2 protobuf bytes assert(gameserver_port > (1 << 10) && gameserver_port < (1 << 14)); if(daemon == 0) { hm_log_open(&l, NULL, LOG_DEBUG); } else { daemonize(); } hm_log(LOG_DEBUG, &l, "Associated with gameserver [%s:%d]", ip, gameserver_port); loop = ev_default_loop(0); pool = hm_create_pool(&l); cd.loop = loop; cd.log = &l; cd.pool = pool; cd.callback = callback; cd.hosts = hosts; cd.hgroups = groups; cd.nhosts = 1; cd.buckets = buckets; cd.bpasswd = passwd; cd.nbuckets = 1; couchbase_init(&cd); ev_run(loop, 0); hm_destroy_pool(pool); hm_log_close(&l); ev_default_destroy(); return 0; }