aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/nifs/common/socket_util.c
AgeCommit message (Collapse)Author
2019-03-18[socket|net] Temporary fix for absence of clock_gettime(CLOCK_REALTIMEMicael Karlberg
We use clock_gettime(CLOCK_REALTIME, ...) to create a simple timestamp. This is used both for debugging and when writing error/warning messages (from the nif-code). The workaround for the absence of this function (on some platforms, old versions of darwin for example) is to simply skip the timestamp.
2019-03-04[socket] Fixed various type size and unused function warningsMicael Karlberg
Fixed some type size warnings (SCTP related). E.g: On Solaris 11 (OpenIndiana Hipster) long and int is size 4, but the way Sint32 def works it first "tests" for long size and if that is correct, that is chosen (which it is on Solaris 11). On linux long is size 8, so Sint32 will be defined as int. ... On Solaris 11 the flags TCP_CONGESTION and SO_BINDTODEVICE does not exist, so the function(s) n[set|get]opt_str_opt is never used. So, in order to keep the compiler quiet, we add some if-def to exclude these functions in this case.
2019-02-01[socket-nif] nosup expection of win32 and type(s) replacementsMicael Karlberg
The nif callback functions (nif_open) now instead cause an 'nosup' exception if called (instead of badarg). The basic type uint16_t, uint32_t and int32_t (C99) replaced "own" (that is, defined by "us") types Uint16, Uint32 and Sint32. The point of this is that our Windows build system seems to be a bit lacking when it comes to types... Removed "some stuff" that was if-defed. Different solution when win32 support for sockets has been improved. Make sure the socket_*.c util modules are not included in the building for windows. OTP-15526
2018-10-16[socket-nif] Recv handling of closing socketsMicael Karlberg
Fixed more issues regarding closing sockets. Specifically with respect to recv calls. Also, added demonitor for all *current* processes. Also fixed a buffer overflow problem when writing an warning message (the timestamp buffer was not large enough). OTP-14831
2018-09-28[socket-nif] Add support for socket (level otp) buffer optionsMicael Karlberg
Add support for otp level socket options rcvbuf, rcvctrlbuf and sndctrlbuf. These options define default sizes for these buffers. The 'rcvbuf' is used when receiving messages when calling the recv, recvfrom and recvmsg functions. The 'rcvctrlbuf' is used for the control message header info when calling the recvmsg function. The 'sndctrlbuf' is used for the control message header info when calling the sendmsg function. OTP-14831
2018-09-20[socket-nif] Various fixes related to FreeBSD environmentMicael Karlberg
2018-09-18[socket-nif] Add preliminary support for sendmsgMicael Karlberg
Added function sendmsg/2,3,4. Actually worked on the first try. Something must be wrong... Still no supported cmsghdr's (only support headers where the data part is already a binary, which therefor does not require any processing). So if the cmsghdrs actually work is unclear. OTP-14831
2018-09-18[socket-nif] Processing of more cmsg headersMicael Karlberg
Added processing or more cmsg headers (for more options). Now (also) supports: socket:timestamp. Also various fixes and cleanups. For some reason calling getopt(Sock, 0, {13, int}) (or similar) fails with badarg even though the nif-function (nif_getopt) actually returns a valid value (for instance: {ok, 0}). OTP-14831
2018-09-18[socket-nif] Add more control message decodingMicael Karlberg
Added decoding of the "known" control message options: pktinfo, recvtos, recvttl and recvorigdstaddr). OTP-14831
2018-09-18[socket-nif] Debugged and stuffMicael Karlberg
It seems to work, with atleast some of the cmsg options. More testing needed... OTP-14831
2018-09-18[socket-nif] Add support for recvmsgMicael Karlberg
Added preliminary support for function recvmsg. At the moment this only works on *nix (Windows has another function, WSARecvMsg, which has a slightly different API). Also we have "no" cmsg decode at the moment (just level and type). OTP-14831
2018-09-18[net+socket-nif] Updated on_load stuffMicael Karlberg
The net nif-module had debug on by default. Fixed this and also made it an option, just as for the socket nif-module. OTP-14831
2018-09-18[socket-nif] Add support for socket (level ip) option multicast_ifMicael Karlberg
Added support for the IP option MULTICAST_IF. OTP-14831
2018-09-18[net-nif] Changed return type of getaddrinfoMicael Karlberg
The returned address info was supposed to be a map, by was instead (still) a record. OTP-14831
2018-09-18[socket-nif] Fixed (stream) recvMicael Karlberg
Fixed handling of closed in the recv function. We still need to properly handle when we get 0 bytes of data for other types ock sockets then stream (its valid for dgram for instance). OTP-14831
2018-09-18[socket+net-nif] Moved common functions into util filesMicael Karlberg
The common stuff, like decode and encode of common types (soch as socket address), has been moved into a util file (socket_util). The debug stuff has also been moved into its own file. Also introduced a common include file for common macros and types. OTP-14831
2018-09-18[socket+net-nif] BackupMicael Karlberg
2018-09-18[socket+net-nif] Introduced a couple of common filesMicael Karlberg
Started to move the common stuff, such as common utility functions, debug and encode / decode of basic types. OTP-14831