#include <vector>
#include <string>
Go to the source code of this file.
Functions | |
std::string | addon_check_status_desc (unsigned int code) |
std::string | addon_check_status_desc (ADDON_CHECK_STATUS code) |
std::string | translated_addon_check_status (unsigned int code) |
std::string | translated_addon_check_status (ADDON_CHECK_STATUS code) |
ADDON_TYPE | get_addon_type (const std::string &str) |
std::string | get_addon_type_string (ADDON_TYPE type) |
bool | addon_name_legal (const std::string &name) |
Checks whether an add-on id/name is legal or not. More... | |
bool | addon_filename_legal (const std::string &name) |
Checks whether an add-on file name is legal or not. More... | |
bool | check_names_legal (const config &dir, std::vector< std::string > *badlist=nullptr) |
Scans an add-on archive for illegal names. More... | |
bool | check_case_insensitive_duplicates (const config &dir, std::vector< std::string > *badlist=nullptr) |
Scans an add-on archive for case-conflicts. More... | |
std::string | encode_binary (const std::string &str) |
std::string | unencode_binary (const std::string &str) |
bool | needs_escaping (char c) |
std::string | file_hash (const config &file) |
bool | comp_file_hash (const config &file_a, const config &file_b) |
void | write_hashlist (config &hashlist, const config &data) |
bool | contains_hashlist (const config &from, const config &to) |
void | make_updatepack (config &pack, const config &from, const config &to) |
&from, &to are the top directories of their structures; addlist/removelist tag is treated as [dir] More... | |
Variables | |
const unsigned short | default_campaignd_port |
Default port number for the addon server. More... | |
|
strong |
Definition at line 32 of file validation.hpp.
enum ADDON_TYPE |
Values used for add-on classification; UI-only at the moment, in the future it could be used for directory allocation too, removing the need for the ADDON_GROUP constants (TODO).
Definition at line 101 of file validation.hpp.
|
inline |
Definition at line 80 of file validation.hpp.
References addon_check_status_desc().
std::string addon_check_status_desc | ( | unsigned int | code | ) |
Definition at line 379 of file validation.cpp.
References AUTH_TYPE_MISMATCH, BAD_DELTA, BAD_FEEDBACK_TOPIC_ID, BAD_NAME, BAD_TYPE, DENIED, EMPTY_PACK, FEEDBACK_TOPIC_ID_NOT_FOUND, FILENAME_CASE_CONFLICT, ILLEGAL_FILENAME, INVALID_UTF8_ATTRIBUTE, INVALID_UTF8_NAME, N_, NAME_HAS_MARKUP, NO_AUTHOR, NO_DESCRIPTION, NO_EMAIL, NO_PASSPHRASE, NO_TITLE, NO_VERSION, SERVER_ADDONS_LIST, SERVER_DELTA_NO_VERSIONS, SERVER_FORUM_AUTH_DISABLED, SERVER_READ_ONLY, SERVER_UNSPECIFIED, SUCCESS, TITLE_HAS_MARKUP, UNAUTHORIZED, UNEXPECTED_DELTA, USER_DOES_NOT_EXIST, and VERSION_NOT_INCREMENTED.
Referenced by addon_check_status_desc(), campaignd::server::handle_upload(), and translated_addon_check_status().
bool addon_filename_legal | ( | const std::string & | name | ) |
Checks whether an add-on file name is legal or not.
Definition at line 67 of file validation.cpp.
References filesystem::is_legal_user_file_name().
Referenced by BOOST_AUTO_TEST_CASE(), editor::context_manager::change_addon_id(), and editor::initialize_addon().
bool addon_name_legal | ( | const std::string & | name | ) |
Checks whether an add-on id/name is legal or not.
Definition at line 57 of file validation.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), addons_client::upload_addon(), and campaignd::server::validate_addon().
bool check_case_insensitive_duplicates | ( | const config & | dir, |
std::vector< std::string > * | badlist = nullptr |
||
) |
Scans an add-on archive for case-conflicts.
Case conflicts may cause trouble on case-insensitive filesystems.
dir | The WML container for the root [dir] node where the search should begin. |
badlist | If provided and not null, any case conflicts encountered will be added to this list. This also makes the archive scan more thorough instead of returning on the first conflict encountered. |
Definition at line 176 of file validation.cpp.
Referenced by addons_client::install_addon(), and addons_client::upload_addon().
bool check_names_legal | ( | const config & | dir, |
std::vector< std::string > * | badlist = nullptr |
||
) |
Scans an add-on archive for illegal names.
dir | The WML container for the root [dir] node where the search should begin. |
badlist | If provided and not null, any illegal names encountered will be added to this list. This also makes the archive scan more thorough instead of returning on the first illegal name encountered. |
Definition at line 167 of file validation.cpp.
Referenced by addons_client::install_addon(), and addons_client::upload_addon().
Definition at line 268 of file validation.cpp.
References file_hash().
Referenced by contains_hashlist(), and write_difference().
Definition at line 289 of file validation.cpp.
References config::child_range(), comp_file_hash(), d, f, and config::find_child().
Referenced by addons_client::upload_addon().
std::string encode_binary | ( | const std::string & | str | ) |
Definition at line 219 of file validation.cpp.
References n, and needs_escaping().
Referenced by archive_file(), and BOOST_AUTO_TEST_CASE().
std::string file_hash | ( | const config & | file | ) |
Definition at line 259 of file validation.cpp.
References file_hash_raw().
Referenced by comp_file_hash(), and write_difference().
ADDON_TYPE get_addon_type | ( | const std::string & | str | ) |
Definition at line 181 of file validation.cpp.
References ADDON_TYPES_COUNT, and ADDON_UNKNOWN.
Referenced by addon_info::read(), and campaignd::server::validate_addon().
std::string get_addon_type_string | ( | ADDON_TYPE | type | ) |
Definition at line 197 of file validation.cpp.
References ADDON_TYPES_COUNT.
Referenced by addon_info::write(), and addon_info::write_minimal().
&from, &to are the top directories of their structures; addlist/removelist tag is treated as [dir]
Does it worth it to archive and write the pack on the fly using config_writer? TODO: clientside verification?
Definition at line 371 of file validation.cpp.
References config::add_child(), and write_difference().
Referenced by campaignd::server::handle_upload(), and addons_client::upload_addon().
bool needs_escaping | ( | char | c | ) |
|
inline |
Definition at line 87 of file validation.hpp.
References translated_addon_check_status().
std::string translated_addon_check_status | ( | unsigned int | code | ) |
Definition at line 541 of file validation.cpp.
References _(), and addon_check_status_desc().
Referenced by translated_addon_check_status(), and addons_client::update_last_error().
std::string unencode_binary | ( | const std::string & | str | ) |
Definition at line 237 of file validation.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), and unarchive_file().
Definition at line 273 of file validation.cpp.
References config::add_child(), d, data, f, and file_hash_raw().
Referenced by campaignd::server::handle_upload(), and campaignd::server::load_config().
|
extern |
Default port number for the addon server.
Definition at line 27 of file validation.cpp.
Referenced by addons_client::addons_client(), and campaignd::server::load_config().