#ifndef DDOSPROOF_H #define DDOSPROOF_H #define DDOSCODE_COOKIEOK 200 // The cookie is valid, the request may proceed further #define DDOSCODE_GOTOWORK 201 // The client must perform some work #define DDOSCODE_GOODWORK 202 // THe proof of work is valid, here is a cookie for later #define DDOSCODE_OK 203 // THe proof of work is valid, here is a cookie for later #define DDOSCODE_BADIP 500 // This is a banned IP number. Just end the connection #define DDOSCODE_INTERNAL 501 // Internal error. Just end the connection #define DDOSCODE_BADPROOF 502 // Invalid proof of work #define DDOSCODE_INVALID 503 // Invalid parameter void util_filltb0(); bool util_validate (const char *answer, int difficulty); int util_makecookie (int fd, const string &secret, const char *ip, char tmp[100]); bool util_validcookie (const char *cookie, const char *ip, const string &secret); int util_getwork (int fd, char res[100]); bool util_validwork (const char *answer, int difficulty); #endif