summaryrefslogtreecommitdiff
path: root/src/common/socket.c
AgeCommit message (Collapse)AuthorFilesLines
2020-01-13Update copyright headers for year 2020Haru1-2/+2
Signed-off-by: Haru <haru@dotalux.com>
2019-05-05Disable packet validation in socket_datasyncAndrei Karas1-2/+2
2019-04-07Add ZC_PING and CZ_PING packetsAndrei Karas1-2/+5
For supported packet version, from now server send ping packets to client.
2019-03-11Move variable SOCKET_CONF_FILENAME into socket interfaceAndrei Karas1-4/+4
2019-03-11Add function connect_client into socket interfaceAndrei Karas1-2/+3
2018-12-12Fix some visual studio warnings.Andrei Karas1-1/+1
2018-11-15Update visual studio project files.Andrei Karas1-3/+3
2018-11-15Add packet validation for RFIFOSKIP.Andrei Karas1-0/+29
2018-11-15Add validation for WFIFOHEAD buffer allocations.Andrei Karas1-3/+20
2018-11-15Add packet versions for all server types into socket_datasync.Andrei Karas1-0/+5
2018-11-14Add send packet validation for connections between server and clients.Andrei Karas1-7/+49
2018-11-13Remove the unused minicore libraries and ifdefsHaru1-25/+2
Minicore was previously used by the tools in the src/tool directory, and is currently unused. Signed-off-by: Haru <haru@dotalux.com>
2018-07-01Fix some warnings caused by static functions defined and unusedHaru1-6/+4
Signed-off-by: Haru <haru@dotalux.com>
2018-07-01Change functions to static where possible (Part 1 - common)Haru1-61/+72
This fixes issues with plugins defining symbols with the same names Signed-off-by: Haru <haru@dotalux.com>
2018-05-312012-2018 !Maytichai Saowa1-1/+1
2018-02-10Clean up trailing whitespace and non-indent tabsHaru1-2/+2
Signed-off-by: Haru <haru@dotalux.com>
2016-10-07Fixed some issues detected by clang's static analyzer (Xcode 8/macOS Sierra)Haru1-4/+0
Signed-off-by: Haru <haru@dotalux.com>
2016-10-04Add missing checks into socket.cAndrei Karas1-9/+22
2016-09-22Fixed a compile error when SEND_SHORTLIST is disabledHaru1-5/+4
- Since f8edb93a (likely caused by a find and replace macro gone horribly wrong) Signed-off-by: Haru <haru@dotalux.com>
2016-08-19Ported socket.conf (was packet.conf) to libconfigHaru1-67/+196
Ported to modern Hercules and cleaned up from Panikon's commits: b10f2a88073882bea812c6278fdec7848102ab87, bc5007299a92898ea4630f2a977d9a1b42b6c145 Signed-off-by: Haru <haru@dotalux.com>
2016-08-19Changed access_allow and access_deny to VECTORsHaru1-24/+29
Signed-off-by: Haru <haru@dotalux.com>
2016-08-19Removed unnecessary typedefs in socket.cHaru1-13/+13
Signed-off-by: Haru <haru@dotalux.com>
2016-07-08Add comments into defines in socket.cAndrei Karas1-70/+70
2016-07-08Added epoll as event-dispatcher on linux (instead of select())Florian Wilkemeyer1-5/+165
Note: It will be enabled by default if configure detects that the system has support for epoll To enforce usage of select run configure with --enable-epoll=no
2016-07-03Add into travis configure option --enable-buildbot.Andrei Karas1-0/+2
Also disable all known default warnings if build bot option enabled.
2016-07-02Trivialities: indentation fixesHaru1-4/+4
Signed-off-by: Haru <haru@dotalux.com>
2016-03-20Dropped typedef from DBMapHaru1-1/+1
Signed-off-by: Haru <haru@dotalux.com>
2016-03-20Dropped typedef from DBIteratorHaru1-1/+1
Signed-off-by: Haru <haru@dotalux.com>
2016-02-19Fix all known warnings from compiler flags -Wformat*Andrei Karas1-9/+9
Add all missing -Wformat flags into configure.
2016-02-17Replaced some now unnecessary includes with forward declarations in header filesHaru1-0/+1
Added some forgotten <stdio.h> and "common/conf.h" includes to .c files, that were previously masked by the above. Signed-off-by: Haru <haru@dotalux.com>
2016-02-17Removed unnecessary typedefs from libconfigHaru1-2/+2
Signed-off-by: Haru <haru@dotalux.com>
2016-02-17Renamed config->read_file to config->load_fileHaru1-1/+1
- The return value is now consistent with the libconfig standard (CONFIG_TRUE/CONFIG_FALSE). - Removed some redundant error messages. Signed-off-by: Haru <haru@dotalux.com>
2016-01-12Whitespace cleanup (removed alignment tabs or trailing whitespace at line end)Haru1-1/+1
Signed-off-by: Haru <haru@dotalux.com>
2016-01-09Corrected various zero-argument function definitionsHaru1-6/+6
- Functions should always specify their arguments, even if they take none. In C, not specifying arguments is different than specifying (void). Signed-off-by: Haru <haru@dotalux.com>
2015-12-17Merge pull request #917 from dastgir/packetAndrei Karas1-1/+5
Update max packet size according to client date
2015-12-17Update max packet size according to client dateDastgir1-1/+5
2015-12-15Added GPL-compliant header to all sources and build scriptsHaru1-4/+20
Signed-off-by: Haru <haru@dotalux.com>
2015-12-02Fixed an issue with the socket send/receive timeouts in WindowsHaru1-12/+27
- According to https://msdn.microsoft.com/en-us/library/windows/desktop/ms740476(v=vs.85).aspx setsockopt() for SO_RCVTIMEO/SO_SNDTIMEO require a DWORD argument, unlike their POSIX equivalent, requiring a struct timeval. - Always keep in mind: When you see a Microsoft API function that looks like a duck, swims like a duck, quacks like a duck, it most certainly is not a duck. - Thanks to ultramage. Signed-off-by: Haru <haru@dotalux.com>
2015-10-19rename malloc.c/h to memmgr.Andrei Karas1-1/+1
2015-10-11Fixed various compiler warnings (follow-up to 5c22b63)Haru1-1/+1
Signed-off-by: Haru <haru@dotalux.com>
2015-10-11Changed various s_subnet arrays to VECTORsHaru1-76/+45
- sockt->lan_subnet was renamed to sockt->lan_subnets. - sockt->trusted_ip was renamed to sockt->trusted_ips. - sockt->allowed_ip was renamed to sockt->allowed_ips. - Convenience macros for checking IP ranges and subnets are provided (SUBNET_MATCH, APPLY_MASK). Signed-off-by: Haru <haru@dotalux.com>
2015-10-11Cleanup of the HPluginData implementation (second part)Haru1-2/+1
- Changed the hplugin_data_store's array into a VECTOR. Signed-off-by: Haru <haru@dotalux.com>
2015-10-11Cleanup of the HPluginData implementation (First part)Haru1-11/+2
- Several explicit casts are removed, to have a slightly better type-checking at compile time. - A destructor function is provided, to remove code duplication. Signed-off-by: Haru <haru@dotalux.com>
2015-09-25More aggressive whitespace cleanup. Follow up to 51329e6Haru1-9/+5
Signed-off-by: Haru <haru@dotalux.com>
2015-08-15HPM compatibility improvementsHaru1-0/+3
Improved compatibility, portability and standards conformance. - Since it is not possible to portably and reliably re-use the core's symbols in plugins, symbols are no longer exported unless explicitly required, in the UNIX builds. This mimics the Windows behavior and adds HPM compatibility to OSes such as FreeBSD. Credits to Andrei Karas for making this possible. - For convenience, it is no longer necessary to call GET_SYMBOL, since the plugin will automatically import all the available symbols when it's loaded, depending on the included headers. - Plugins are now supposed to include the "common/hercules.h" header before including anything else. Incluing common/HPMi.h, common/cbasetypes.h or conf/core.h is no longer necessary, as those are guaranteed to be automatically included by hercules.h. - HPM API version bumped to 1.1. Signed-off-by: Haru <haru@dotalux.com>
2015-08-15Moved session array into the socket interfaceHaru1-101/+98
Signed-off-by: Haru <haru@dotalux.com>
2015-08-15Cleaned up socket interfaceHaru1-45/+48
- 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-11subnet.conf overhaulHaru1-0/+187
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-06-19Cleaned up some #includesHaru1-1/+1
Signed-off-by: Haru <haru@dotalux.com>
2015-06-19Removed ".." from include directivesHaru1-10/+10
- Include directives are now directory-independent. - This will allow building plugins from other directories in future. Signed-off-by: Haru <haru@dotalux.com>