Choco OS  V.0.16.9.0
Join to the chocolate world
oc_tcp_server.c File Reference

Stores implementation of TCP server functions. More...

#include <oc_tcp.h>
#include <oc_object.h>
#include <oc_stdio.h>
#include <oc_thread.h>
#include <oc_dynamic_config.h>
#include <oc_semaphore.h>
#include <oc_intman.h>

Go to the source code of this file.

Data Structures

struct  ConnectionSlot_t
 stores data for handling connections array More...
 
struct  Server_t
 stores TCP server data More...
 

Typedefs

typedef oC_Tcp_ConnectionFinishedFunction_t ConnFinishedFunction_t
 redefinition of type for storing pointer to the connection finished function
 

Functions

static void ConnectionFinished (oC_Tcp_Connection_t Connection, oC_Tcp_Server_t Server)
 function called, when the connection has been finished
 
static void ServerThread (oC_Tcp_Server_t Server)
 main thread of TCP servers
 
oC_Tcp_Server_t oC_Tcp_Server_New (const oC_Net_Address_t *ListenAddress, uint32_t MaxConnections)
 creates TCP server More...
 
bool oC_Tcp_Server_Delete (oC_Tcp_Server_t *Server, oC_Time_t Timeout)
 deletes TCP server More...
 
bool oC_Tcp_Server_IsCorrect (oC_Tcp_Server_t Server)
 checks if the TCP server object is correct More...
 
bool oC_Tcp_Server_IsRunning (oC_Tcp_Server_t Server)
 checks if the TCP server is already running More...
 
oC_ErrorCode_t oC_Tcp_Server_SetConnectionConfig (oC_Tcp_Server_t Server, const oC_Tcp_Connection_Config_t *Config)
 sets connection configuration More...
 
oC_ErrorCode_t oC_Tcp_Server_Run (oC_Tcp_Server_t Server)
 starts the TCP server More...
 
oC_ErrorCode_t oC_Tcp_Server_Stop (oC_Tcp_Server_t Server)
 stops the TCP server More...
 
oC_ErrorCode_t oC_Tcp_Server_WaitForConnection (oC_Tcp_Server_t Server, oC_Tcp_Connection_t *outConnection, oC_Time_t Timeout)
 Waits for new TCP connection. More...
 
bool oC_Tcp_Server_ContainsConnection (oC_Tcp_Server_t Server, oC_Tcp_Connection_t Connection)
 checks if the server contains the connection More...
 
oC_ErrorCode_t oC_Tcp_Server_AcceptConnection (oC_Tcp_Server_t Server, oC_Tcp_Connection_t Connection, oC_Time_t Timeout)
 accepts TCP connection More...
 
oC_ErrorCode_t oC_Tcp_Server_RejectConnection (oC_Tcp_Server_t Server, oC_Tcp_Connection_t Connection, oC_Time_t Timeout)
 rejects TCP connection More...
 
oC_ErrorCode_t oC_Tcp_Server_AddConnection (oC_Tcp_Server_t Server, oC_Tcp_Connection_t Connection, oC_Time_t Timeout)
 adds connection to server's connections list More...
 
oC_ErrorCode_t oC_Tcp_Server_RemoveConnection (oC_Tcp_Server_t Server, oC_Tcp_Connection_t Connection)
 removes connection from server's connections list More...
 
oC_Process_t oC_Tcp_Server_GetProcess (oC_Tcp_Server_t Server)
 returns process associated with the server More...
 
oC_Tcp_Port_t oC_Tcp_Server_GetPort (oC_Tcp_Server_t Server)
 returns local port of the server More...
 
oC_ErrorCode_t oC_Tcp_Server_SetConnectionFinished (oC_Tcp_Server_t Server, oC_Tcp_ConnectionFinishedFunction_t Function, void *Parameter)
 sets a pointer for 'connection finished function'
 

Detailed Description


Author
Patryk Kubiak
Note
Copyright (C) 2016 Patryk Kubiak patry.nosp@m.k.ku.nosp@m.biak@.nosp@m.choc.nosp@m.oos.c.nosp@m.om

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Definition in file oc_tcp_server.c.