#include "config.h"
#include "liblogging.h"
#include "sockets.h"
#include "assert.h"
#include "socketsUnix.c"
Functions | |
srRetVal | sbSockConstruct (sbSockObj **pThis) |
Construct a socket object (just in-memory representation, no socket calls). | |
int | sbSockGetLastSockError (sbSockObj *pThis) |
get last error code | |
int | sbSockPeekRcvChar (sbSockObj *pThis) |
Peek at the next character from the stream. | |
int | sbSockGetRcvChar (sbSockObj *pThis) |
Read the next character from the stream. | |
srRetVal | sbSockExit (struct sbSockObject *pThis) |
int | sbSockHasReceiveData (struct sbSockObject *pThis) |
srRetVal | sbSockWaitReceiveData (struct sbSockObject *pThis) |
Wait until the socket has some receive data. | |
sbSockObj * | sbSockInitListenSock (srRetVal *iRet, int iType, char *szBindToAddress, unsigned uBindToPort) |
Initialize a listen socket. | |
srRetVal | sbSockAcceptConnection (sbSockObj *pThis, sbSockObj **pNew) |
This method accepts an incoming connection and creates a new socket object out of it. | |
srRetVal | sbSockGetRemoteHostIP (sbSockObj *pThis, char **ppszHost) |
Return the IP Address of the remote host as a string. | |
srRetVal | sbSockGetIPusedForSending (sbSockObj *pThis, char **ppsz) |
Provide the (local) IP address this session is sending to the remote peer on as a string. | |
srRetVal | sbSockRecvFrom (sbSockObj *pThis, char *pRecvBuf, int *piBufLen, char **ppFrom) |
Enhanced recvfrom() clone. |
This file implements the socket layer. It contains all those methods that are upper layer. It also includes lower layer files which do the actual OS-dependant socket API handling. Thanks to Devin Kowatch, there is now a UNIX as well as a Win32 lower layer available.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of Adiscon GmbH or Rainer Gerhards nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
Provide the (local) IP address this session is sending to the remote peer on as a string. OK, the short description is probably not very well ;) What it does is, it looks up the local IP address that is used to talk to the remote Peer. This is especially important on multihomed machines, as different interfaces can be used to forward data (depending on which one is closest to the recipient). Then, it formats this as an IP Address string that then is handed back to the caller. Please note: the socket MUST be connected before you can use this method! It should NOT be used on UDP sockets.
|
|
get last error code
|
|
Read the next character from the stream. The character is removed from the stream. If no data is ready on the stream, a blocking read is carried out. So this function can block!
|
|
Return the IP Address of the remote host as a string. The caller must free the returned string. |
|
Initialize a listen socket. This includes everything so that the next call can be listen().
|
|
Peek at the next character from the stream. The character is NOT removed from the stream. If no data is ready on the stream, a blocking read is carried out. So this function can block!
|
|
Enhanced recvfrom() clone. Will receive an C sz String. That is, any received as part of the string will be replaced by ABNF SP (' ').
|
|
Wait until the socket has some receive data. This is a blocking call. |