summaryrefslogtreecommitdiff
path: root/src/common
AgeCommit message (Collapse)AuthorFilesLines
2015-08-15Added HPMHooking support for common interfacesHaru1-1/+9
Signed-off-by: Haru <haru@dotalux.com>
2015-08-15Minor symbols cleanup to avoid conflictsHaru4-45/+45
Signed-off-by: Haru <haru@dotalux.com>
2015-08-15Added showmsg HPM interfaceHaru6-97/+155
- The showmsg interface is automatically imported into plugins by the HPM (just like previously, the various Show* functions were). This change requires no actions from plugin developers. - stdout_with_ansisequence is now available through showmsg->stdout_with_ansisequence - msg_silent is now available through showmsg->silent - console_msg_log is now available through showmsg->console_log - timestamp_format is now available through showmsg->timestamp_format - Plugin-safe macros are provided, so that all Show* and Clear* calls will require no changes. - vShowMessage is provided through the public API, as va_list variant of ShowMessage. - vShowMessage_ is no longer part of the public API. If necessary, va_list variants of the other Show* functions will be added at a later time as follow-ups. Signed-off-by: Haru <haru@dotalux.com>
2015-08-15Cleaned up strlib interfaceHaru2-120/+73
- Replaced some macro calls with the proper interface syntax - Removed useless macros and workarounds - Removed no longer needed library function re-definitions API changes summary: - The macros remove_control_chars(), trim(), normalize_name(), stristr(), e_mail_check(), config_switch(), safestrncpy(), safestrnlen(), safesnprintf(), strline(), bin2hex() can now be safely used both inside and outside strlib.c - The macros strnlen() and strtok_r() can now be safely used both inside and outside strlib.c, on the systems where they are necessary. The systems that provide those natively, aren't affected by this change. - jstrescape() is now strlib->jstrescape() - jstrescapecpy() is now strlib->jstrescapecpy() - jmemescapecpy() is now strlib->jmemescapecpy() - a custom strtoull() implementation is no longer provided, since all supported systems and compilers provide a library implementation. Signed-off-by: Haru <haru@dotalux.com>
2015-08-15Cleaned up socket interfaceHaru2-76/+59
- Replaced some macro calls with the proper interface syntax - Removed useless macros and workarounds API changes summary: - WFIFOSET() can now be safely used both inside and outside socket.c - RFIFOSKIP() can now be safely used both inside and outside socket.c - do_close() is now sockt->close() - flush_fifo() is now sockt->flush() - flush_fifos() is now sockt->flush_fifos() - getips() is now sockt->getips() - host2ip() is now sockt->host2ip() - ip2str() is now sockt->ip2str() - ntows() is now sockt->ntows() - make_connection() is now sockt->make_connection() - make_listen_bind() is now sockt->make_listen_bind() - realloc_fifo() is now sockt->realloc_fifo() - realloc_writefifo() is now sockt->realloc_writefifo() - session_isActive() is now sockt->session_is_active() - session_isValid() is now sockt->session_is_valid() - set_defaultparse() is now sockt->set_defaultparse() - set_eof() is now sockt->eof() - set_noblocking() is now sockt->set_noblocking() - str2ip() is now sockt->str2ip() Signed-off-by: Haru <haru@dotalux.com>
2015-08-13Added check for execinfo.h/backtrace() to the configure scriptHaru1-6/+6
- This fixes compilation on systems such as FreeBSD, where -lexecinfo is necessary, or Cygwin, where execinfo.h is not available. Signed-off-by: Haru <haru@dotalux.com>
2015-08-11HPM Hooks UpdateHercules.ws1-0/+1
Signed-off-by: HerculesWSAPI <Hercules@efficiently.awesome>
2015-08-11subnet.conf overhaulHaru2-0/+208
The subnet.conf system has been rewritten to offer greater flexibility, and to fix some issues that appeared with 838321a36c79e71117320154c9b611c99e93af03. It is now possible to enter, separately, LAN subnets: - `lan_subnets`: This is essentially the same feature present in the old subnet.conf. Each entry in this list defines a (LAN, private) subnet the server is in. Clients connecting from the same subnet, will be redirected to the LAN IP rather than the default public IP. The format has been simplified, and it only requires one IP and one subnet mask (as opposed to a character and a map server IP). - `allowed`: Allowed IPs are IP ranges a server (char to login or map to char) can connect from. Any attempt to connect as a server from an IP not included here, will fail. For convenience, a wildcard range (matching all possible IP addresses) has been provided (`0.0.0.0:0.0.0.0`), but it is very advisable to edit it to a more restrictive set. - `trusted`: Trusted IPs are IP ranges excluded from the IPban checks. This may be useful, for example, to exclude the server's own IP from ipbans, in case of false positives. Any IP ranges added to this list are also implicitly included in the allowed IP ranges.
2015-08-10Added support for visual Studio 2015Haru3-2/+6
Please report any issues Signed-off-by: Haru <haru@dotalux.com>
2015-08-10Fixed a compile error in CygwinHaru1-3/+3
- Follow-up to c5ff02958806ea5a672dcc9371602a6c090c6758 - Cygwin doesn't support backtrace() nor it provides execinfo.h Signed-off-by: Haru <haru@dotalux.com>
2015-08-10Fixed a compile error on WIN32/MSVCHaru1-0/+6
- Follow-up to 84e02ac28fbb15c58d0a0f8a916b49663198b05b - Thanks to KirieZ for pointing it out. Signed-off-by: Haru <haru@dotalux.com>
2015-08-01HPM Hooks UpdateHercules.ws1-0/+3
Signed-off-by: HerculesWSAPI <Hercules@efficiently.awesome>
2015-07-08HPM Hooks UpdateHercules.ws1-0/+1
Signed-off-by: HerculesWSAPI <Hercules@efficiently.awesome>
2015-06-19HPM Hooks UpdateHercules.ws1-0/+424
Signed-off-by: HerculesWSAPI <Hercules@efficiently.awesome>
2015-06-19Improved info/error messages during plugin loadingHaru1-3/+8
- Each loaded plugin will now show a status message - If a plugin loads because of a missing symbol, an error message will be displayed, mentioning the name of the missing symbol. Signed-off-by: Haru <haru@dotalux.com>
2015-06-19Cleaned up some #includesHaru21-32/+9
Signed-off-by: Haru <haru@dotalux.com>
2015-06-19Removed ".." from include directivesHaru47-239/+236
- Include directives are now directory-independent. - This will allow building plugins from other directories in future. Signed-off-by: Haru <haru@dotalux.com>
2015-06-19Fixed a warning in the backtrace() functionHaru1-3/+3
On some systems it returns size_t instead of int. Signed-off-by: Haru <haru@dotalux.com>
2015-06-03Follow-up to 42e1df9eHaru1-1/+1
- BASE_GUILD_SIZE is 16, not 10. I should stop thinking hexadecimal. - Fixed bugreport:8718, thanks to Ness http://herc.ws/board/tracker/issue-8718-warning-in-map-server/ Signed-off-by: Haru <haru@dotalux.com>
2015-06-02Follow up to 712812bMysteries4-4/+4
- More link changes - Added proper link to Roulette topic
2015-06-01Plugin load failure now causes Fatal ErrorAncyker1-39/+26
If you set a plugin to load and it fails for some reason, the server will now exit. It will still warn when attempting to load a plugin twice.
2015-06-01Replaced some of the hardcoded values with constants (char)Haru1-6/+91
- Replaced several hardcoded values with the appropriate enums. - Added documentation for some hardcoded values that haven't been replaced by enums (yet) - Minor code legibility improvements. Signed-off-by: Haru <haru@dotalux.com>
2015-06-01Replaced some of the hardcoded values with constants (misc)Haru5-62/+59
- Replaced several hardcoded values with the appropriate enums. - Added documentation for some hardcoded values that haven't been replaced by enums (yet) - Minor code legibility improvements. Signed-off-by: Haru <haru@dotalux.com>
2015-05-30Dump stack in nullpo*/Assert* function.Andrei Karas1-0/+17
Also enable in configure linker flag -rdynamic.
2015-05-20* Fixed a compile error.Michieru1-1/+1
Thanks to Haru
2015-05-19Fixed some issues reported by coverity scan [3/3]Haru1-0/+6
- Automatically zeroed variables are now zeroed in the correct size, regardless of padding. - Special thanks to Ind. Signed-off-by: Haru <haru@dotalux.com>
2015-05-17HPM Hooks UpdateHercules.ws1-0/+1
Signed-off-by: HerculesWSAPI <Hercules@efficiently.awesome>
2015-05-17Fixed some issues detected by coverity scanHaru1-0/+1
Signed-off-by: Haru <haru@dotalux.com>
2015-02-11Battleground Data to HPM Structdastgir1-0/+5
2015-01-24HPM Hooks UpdateHaru1-0/+5
Signed-off-by: Haru <haru@dotalux.com>
2015-01-24Moved the Hercules Channel System to its own file/interfaceHaru1-2/+2
Signed-off-by: Haru <haru@dotalux.com>
2015-01-24Fixed 18 minor issuesHaru6-93/+161
Signed-off-by: Haru <haru@dotalux.com>
2015-01-20Fixes Compile Error on WindowsDastgir1-2/+3
2015-01-20Minor fixes and tweaks suggested by cppcheckHaru9-93/+69
- Variable scopes reduced - Parenthesized ambiguous expressions - Removed or added NULL checks where (un)necessary - Corrected format strings - Fixed typos potentially leading to bugs Signed-off-by: Haru <haru@dotalux.com>
2015-01-18Command line arguments handling overhaulHaru7-91/+331
- login_server, char_server, map_server as well as the tools (mapcache) now have a common command line arguments handling mechanism. - All of them now accept `--help` (`-h`), `--version` (`-v`) and `--load-plugin`. - login_server now accepts `--login-config` and `--lan-config` instead of relying on positional arguments to override those files. The old syntax will no longer work, please update your custom startup scripts. - char_server now accepts `--char-config`, `--inter-config`, `--lan-config` instead of relying on positional arguments. The old syntax will no longer work, please update your custom startup scripts. - mapcache now accepts `--grf-list`, `--map-list`, `--map-cache`, `--rebuild` in place of, respectively, `-grf`, `-list`, `-cache`, `-rebuild`. - A new macro `CMDLINEARG()` is provided, to help defining new command line argument handlers (i.e. in plugins). the `addArg()` call is still required, but its syntax has changed. The `help` argument is now of type `const char *` rather than a function pointer, and it is supposed to contain the message to show in the `--help` screen. Pass `NULL` if no help message is desired. Signed-off-by: Haru <haru@dotalux.com>
2015-01-18Implementing nullpo interface for plugin useshennetsind4-3/+24
As proposed in pull request #361 Signed-off-by: shennetsind <ind@henn.et>
2015-01-18Connection History Redesignshennetsind1-81/+56
Drops ~250kb in memory usage from each server, speeds up lookup/insertion and the cleanup timer will iterate thru the list rather than that ~65k array loop Signed-off-by: shennetsind <ind@henn.et>
2015-01-18Merge branch 'master' of github.com:HerculesWS/Herculesshennetsind1-1/+1
2015-01-18Fixing 38 issuesshennetsind3-11/+15
Addressing out of bounds read/write, pointless null checks on already deferenced variables, dead code. Special Thanks to 4144 and Haruna! Signed-off-by: shennetsind <ind@henn.et>
2015-01-17Merge pull request #444 from 4144/coverityshennetsind1-1/+1
some fixes for different issues
2015-01-18Fix out of bound issue in mapindex.c.Andrei Karas1-1/+1
Found by coverity scan.
2015-01-1727 Fixesshennetsind1-1/+1
Addressing out of bounds read/write, pointless null checks on already deferenced variables. Special Thanks to 4144 and Haruna! Signed-off-by: shennetsind <ind@henn.et>
2015-01-17Another ~10 Fixesshennetsind2-3/+5
Addressing out of bounds read/write, resource leaks. Special Thanks to 4144 and Haruna! Signed-off-by: shennetsind <ind@henn.et>
2015-01-1710 Distinct fixesshennetsind2-2/+3
Addressing out of bounds read-write. Special Thanks to 4144, Haruna! Signed-off-by: shennetsind <ind@henn.et>
2015-01-15Merge branch 'master' of https://github.com/HerculesWS/HerculesDastgir28-62/+95
2015-01-15Changed Zeny Limit in Bank to 2,147,483,647Dastgir1-1/+1
2015-01-12Fix some compilation warnings with clang 3.6.Andrei Karas1-1/+1
2015-01-12Silenced some -Wunused-value warnings in sigemptyset and sigaddset callsHaru1-7/+8
- Fixes warnings when gcc-4.9 is used, with headers (such as Apple's) that define those symbols as `#define sigemptyset(set) (*(set) = 0, 0)` - See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61081 Signed-off-by: Haru <haru@dotalux.com>
2015-01-12Removed unused (re)definition of NBBY from cbasetypes.hHaru1-6/+0
Signed-off-by: Haru <haru@dotalux.com>
2015-01-12Blocked compilation of plugins that use unavailable functionsHaru23-46/+81
- Rather than failing at runtime, plugins that try to access non-interfaced, unavailable functions or variables, will now show an error at compile-time. Signed-off-by: Haru <haru@dotalux.com>