static void irc_handle_line( char* line ) { switch ( line[0] ) { case 0 : return; case ':' : parse_line1(++line); break; default : parse_line2(line); break; } }
static int parse_mod(char *line, int *pdsa2, int *pL, int *pN, const EVP_MD **pmd) { char lbuf[10240]; char *keyword, *value; char *p; p = strchr(line, ','); if (!p) { *pL = atoi(line); *pdsa2 = 0; *pN = 160; if (pmd) *pmd = EVP_sha1(); return 1; } *pdsa2 = 1; *p = 0; if (!parse_line2(&keyword, &value, lbuf, line, 0)) return 0; if (strcmp(keyword, "L")) return 0; *pL = atoi(value); strcpy(line, p + 1); if (pmd) p = strchr(line, ','); else p = strchr(line, ']'); if (!p) return 0; *p = 0; if (!parse_line2(&keyword, &value, lbuf, line, 0)) return 0; if (strcmp(keyword, "N")) return 0; *pN = atoi(value); if (!pmd) return 1; strcpy(line, p + 1); p = strchr(line, ']'); if (!p) return 0; *p = 0; p = line; while(isspace(*p)) p++; if (!strcmp(p, "SHA-1")) *pmd = EVP_sha1(); else if (!strcmp(p, "SHA-224")) *pmd = EVP_sha224(); else if (!strcmp(p, "SHA-256")) *pmd = EVP_sha256(); else if (!strcmp(p, "SHA-384")) *pmd = EVP_sha384(); else if (!strcmp(p, "SHA-512")) *pmd = EVP_sha512(); else return 0; return 1; }
StickInitResponse ( const std::string& line1, const std::string& line2) : Response(line1, line2) { parse_line2(); };