Choco OS  V.0.16.9.0
Join to the chocolate world
Tcp - Transmission Control Protocol

Module that handles transmission in the TCP IP. More...

Data Structures

struct  oC_Tcp_Header_t
 stores TCP header More...
 
union  oC_Tcp_Packet_t
 
struct  oC_Tcp_Connection_Config_t
 

Typedefs

typedef struct Tcp_Connection_toC_Tcp_Connection_t
 stores TCP connection data
 
typedef struct Server_toC_Tcp_Server_t
 stores TCP server object data More...
 

Enumerations

Functions

oC_ErrorCode_t oC_Tcp_TurnOn (oC_Time_t Timeout)
 turns on TCP module More...
 
oC_ErrorCode_t oC_Tcp_TurnOff (oC_Time_t Timeout)
 turns off TCP module More...
 
oC_ErrorCode_t oC_Tcp_CloseProcess (oC_Process_t Process, oC_Time_t Timeout)
 closes all objects related with the process More...
 
oC_ErrorCode_t oC_Tcp_ReservePort (oC_Tcp_Port_t *Port, oC_Time_t Timeout)
 reserves TCP port More...
 
oC_ErrorCode_t oC_Tcp_ReleasePort (oC_Tcp_Port_t Port, oC_Time_t Timeout)
 releases TCP port More...
 
bool oC_Tcp_IsPortReserved (oC_Tcp_Port_t Port)
 checks if the port is reserved
 
bool oC_Tcp_IsPortReservedBy (oC_Tcp_Port_t Port, oC_Process_t Process)
 checks if the port is reserved by the given process
 
oC_ErrorCode_t oC_Tcp_Connect (const oC_Net_Address_t *Destination, oC_Tcp_Port_t LocalPort, oC_Tcp_Connection_t *outConnection, oC_Time_t Timeout)
 connects to the remote TCP server More...
 
oC_ErrorCode_t oC_Tcp_Disconnect (oC_Tcp_Connection_t *Connection, oC_Time_t Timeout)
 disconnects TCP connection More...
 
oC_ErrorCode_t oC_Tcp_Listen (const oC_Net_Address_t *Source, oC_Tcp_Server_t *outServer, uint32_t MaxConnections, oC_Time_t Timeout)
 starts a server that listen at the given address More...
 
oC_ErrorCode_t oC_Tcp_StopListen (oC_Tcp_Server_t *Server, oC_Time_t Timeout)
 stops listen at the given TCP port More...
 
oC_ErrorCode_t oC_Tcp_Accept (oC_Tcp_Server_t Server, oC_Tcp_Connection_t *outConnection, oC_Time_t Timeout)
 waits for new connection and accepts it More...
 
oC_ErrorCode_t oC_Tcp_Send (oC_Tcp_Connection_t Connection, const void *Buffer, oC_MemorySize_t Size, oC_Time_t Timeout)
 sends data by using TCP connection More...
 
oC_ErrorCode_t oC_Tcp_Receive (oC_Tcp_Connection_t Connection, void *outBuffer, oC_MemorySize_t Size, oC_Time_t Timeout)
 receives data by using TCP connection More...
 
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'
 
oC_Tcp_Packet_toC_Tcp_Packet_New (const oC_Net_Address_t *Source, const oC_Net_Address_t *Destination, uint16_t HeaderSize, const void *Data, uint16_t Size)
 Allocates memory for a TCP packet. More...
 
bool oC_Tcp_Packet_Delete (oC_Tcp_Packet_t **outPacket)
 releases memory allocated for a packet More...
 
oC_ErrorCode_t oC_Tcp_Packet_SetData (oC_Tcp_Packet_t *Packet, const void *Data, uint16_t Size)
 sets data in the TCP packet
 
oC_ErrorCode_t oC_Tcp_Packet_ReadData (oC_Tcp_Packet_t *Packet, void *outData, oC_MemorySize_t Size)
 reads data of the TCP packet
 
void oC_Tcp_Packet_SetSize (oC_Tcp_Packet_t *Packet, uint16_t Size)
 sets size of the TCP packet
 
void * oC_Tcp_Packet_GetDataReference (oC_Tcp_Packet_t *Packet)
 returns pointer to the data inside the packet More...
 
uint16_t oC_Tcp_Packet_GetDataSize (oC_Tcp_Packet_t *Packet)
 returns size of data section inside TCP packet More...
 
bool oC_Tcp_Packet_AddOption (oC_Tcp_Packet_t *Packet, oC_Tcp_OptionKind_t OptionKind, const void *Data, uint8_t Size)
 Adds TCP option to the packet. More...
 
oC_ErrorCode_t oC_Tcp_Packet_ReadOption (oC_Tcp_Packet_t *Packet, oC_Tcp_OptionKind_t OptionKind, void *outData, uint8_t *Size)
 reads option from the TCP packet More...
 
bool oC_Tcp_Packet_ClearOptions (oC_Tcp_Packet_t *Packet)
 clears options in the TCP packet More...
 
uint16_t oC_Tcp_Packet_CalculateChecksum (oC_Tcp_Packet_t *Packet)
 calculates checksum for TCP packet
 
oC_Tcp_Header_toC_Tcp_Packet_GetHeaderReference (oC_Tcp_Packet_t *Packet)
 returns TCP header reference
 
bool oC_Tcp_Packet_ConvertFromNetworkEndianess (oC_Tcp_Packet_t *Packet)
 converts packet from network endianess
 
bool oC_Tcp_Packet_ConvertToNetworkEndianess (oC_Tcp_Packet_t *Packet)
 converts packet to network endianess
 
oC_Tcp_Connection_t oC_Tcp_Connection_New (const oC_Tcp_Connection_Config_t *Config)
 allocates memory for a new TCP connection object More...
 

Detailed Description

Typedef Documentation

typedef struct Server_t* oC_Tcp_Server_t

The type is for storing TCP server data. It should be created by using the function oC_Tcp_Server_New and deleted by the function oC_Tcp_Server_Delete. All data inside are private and should be changed only by TCP server interface functions.

Definition at line 421 of file oc_tcp.h.

Enumeration Type Documentation

Enumerator
oC_Tcp_Port_Empty 

Special value for marks port as not filled.

oC_Tcp_Port_MAX 

maximum number of ports

oC_Tcp_Port_IsSpecified 

is specified.

oC_Tcp_Port_RemoteJobEntry 

Remote job entry.

oC_Tcp_Port_EchoProtocol 

Echo Protocol.

oC_Tcp_Port_DiscardProtocol 

Discard Protocol.

oC_Tcp_Port_ActiveUsers 

Active Users.

oC_Tcp_Port_DaytimeProtocol 

Daytime Protocol.

oC_Tcp_Port_PreviouslyNetstatService 

Previously netstat service.

oC_Tcp_Port_QOTD 

Quote of the Day.

oC_Tcp_Port_MessageSendProtocol 

Message Send Protocol.

oC_Tcp_Port_CHARGEN 

Character Generator Protocol.

oC_Tcp_Port_FTPDataTransfer 

File Transfer Protocol data transfer.

oC_Tcp_Port_FTPControl 

File Transfer Protocol control.

oC_Tcp_Port_SSH 

Secure Shell , secure logins, file transfers and port forwarding.

oC_Tcp_Port_TelnetProtocolUnencrypted 

Telnet protocol—unencrypted text communications.

oC_Tcp_Port_SMTP 

Simple Mail Transfer Protocol , used for e-mail routing between mail servers.

oC_Tcp_Port_TimeProtocol 

Time Protocol.

oC_Tcp_Port_RAP 

Route Access Protocol.

oC_Tcp_Port_RLPused 

Resource Location Protocol —used for determining the location of higher level services from hosts on a network.

oC_Tcp_Port_HostNameServerProtocol 

Host Name Server Protocol.

oC_Tcp_Port_WHOISProtocol 

WHOIS protocol.

oC_Tcp_Port_TACACS 

TACACS+ Login Host protocol.

oC_Tcp_Port_RemoteMailCheckingProtocol 

Remote Mail Checking Protocol.

oC_Tcp_Port_PreviouslyInterfaceMessageProcessorlogical 

Previously Interface Message Processor logical address management.

oC_Tcp_Port_XNSTimeProtocol 

Xerox Network Systems Time Protocol.

oC_Tcp_Port_DNS 

Domain Name System.

oC_Tcp_Port_XNSClearinghouse 

Xerox Network Systems clearinghouse.

oC_Tcp_Port_XNSAuthentication 

Xerox Network Systems authentication.

oC_Tcp_Port_AnyPrivateTerminalAccess 

Any private terminal access.

oC_Tcp_Port_XNSMail 

Xerox Network Systems Mail.

oC_Tcp_Port_BOOTPServer 

Bootstrap Protocol server; also used by Dynamic Host Configuration Protocol.

oC_Tcp_Port_BOOTPClient 

Bootstrap Protocol client; also used by Dynamic Host Configuration Protocol.

oC_Tcp_Port_TFTP 

Trivial File Transfer Protocol.

oC_Tcp_Port_GopherProtocol 

Gopher protocol.

oC_Tcp_Port_NETRJSProtocol 

NETRJS protocol.

oC_Tcp_Port_AnyPrivateDialOutService 

Any private dial out service.

oC_Tcp_Port_AnyPrivateRemotejob 

Any private Remote job entry.

oC_Tcp_Port_FingerProtocol 

Finger protocol.

oC_Tcp_Port_HTTP 

Hypertext Transfer Protocol.

oC_Tcp_Port_TorParkOnionRouting 

TorPark onion routing.

oC_Tcp_Port_KerberosAuthenticationSystem 

Kerberos authentication system.

oC_Tcp_Port_DnsixSecuritAttributeTokenMap 

dnsix Securit Attribute Token Map

oC_Tcp_Port_dotcom 

PointCast.

oC_Tcp_Port_WIPMessageProtocol 

WIP message protocol.

oC_Tcp_Port_NICHostName 

NIC host name.

oC_Tcp_Port_TSAPClass0 

ISO Transport Service Access Point Class 0 protocol;.

oC_Tcp_Port_DigitalImagingand 

Digital Imaging and Communications in Medicine.

oC_Tcp_Port_CCSONameserver 

CCSO Nameserver.

oC_Tcp_Port_RTelnet 

Remote User Telnet Service.

oC_Tcp_Port_SNAGatewayAccessServer 

IBM Systems Network Architecture gateway access server.

oC_Tcp_Port_PostOfficeProtocolVer2 

Post Office Protocol, version 2.

oC_Tcp_Port_PostOfficeProtocolVer3 

Post Office Protocol, version 3.

oC_Tcp_Port_OpenNetworkComputingRemoteProcedureCall 

Open Network Computing Remote Procedure Call.

oC_Tcp_Port_Ident 

Ident, authentication service/identification protocol, used by IRC servers to identify users.

oC_Tcp_Port_Connection 

connection.

oC_Tcp_Port_SimpleFileTransferProtocol 

Simple File Transfer Protocol.

oC_Tcp_Port_UUCPMappingProject 

UUCP Mapping Project.

oC_Tcp_Port_SQLServices 

Structured Query Language Services.

oC_Tcp_Port_NNTP 

Network News Transfer Protocol , retrieval of newsgroup messages.

oC_Tcp_Port_NTP 

Network Time Protocol , used for time synchronization.

oC_Tcp_Port_FormerlyUnisysUnitaryLogin 

Formerly Unisys Unitary Login, renamed by Unisys to NXEdit.

Used by Unisys Programmer's Workbench for Clearpath MCP, an IDE for Unisys MCP software development

oC_Tcp_Port_DCEEndpointResolution 

DCE endpoint resolution.

oC_Tcp_Port_MicrosoftEPMAP 

Microsoft EPMAP , also known as DCE/RPC Locator service, used to remotely manage services including DHCP server, DNS server and WINS.

Also used by DCOM

oC_Tcp_Port_NetBIOSNameService 

NetBIOS Name Service, used for name registration and resolution.

oC_Tcp_Port_NetBIOSDatagramService 

NetBIOS Datagram Service.

oC_Tcp_Port_NetBIOSSessionService 

NetBIOS Session Service.

oC_Tcp_Port_Imap 

Internet Message Access Protocol , management of electronic mail messages on a server.

oC_Tcp_Port_BFTP 

Background File Transfer Program.

oC_Tcp_Port_SGMP 

Simple Gateway Monitoring Protocol , a protocol for remote inspection and alteration of gateway management information.

oC_Tcp_Port_SQLService 

Structured Query Language Service.

oC_Tcp_Port_DistributedMailSystemProtocol 

Distributed Mail System Protocol.

oC_Tcp_Port_SNMP 

Simple Network Management Protocol.

oC_Tcp_Port_SNMPTRAP 

Simple Network Management Protocol Trap.

oC_Tcp_Port_PrintServer 

Print server.

oC_Tcp_Port_XDMCP 

X Display Manager Control Protocol , used for remote logins to an X Display Manager server.

oC_Tcp_Port_BGP 

Border Gateway Protocol , used to exchange routing and reachability information among autonomous systems on the Internet.

oC_Tcp_Port_IRC 

Internet Relay Chat.

oC_Tcp_Port_SMUX 

SNMP multiplexing protocol.

oC_Tcp_Port_AppleTalkRoutingMaintenance 

AppleTalk Routing Maintenance.

oC_Tcp_Port_QuickMailTransferProtocol 

Quick Mail Transfer Protocol.

oC_Tcp_Port_ANSIZ3950 

ANSI Z39.50.

oC_Tcp_Port_IPX 

Internetwork Packet Exchange.

oC_Tcp_Port_MPP 

Message posting protocol.

oC_Tcp_Port_ImapVer3 

Internet Message Access Protocol , version 3.

oC_Tcp_Port_ESRO 

Efficient Short Remote Operations.

oC_Tcp_Port_Arcisdms 

Arcisdms.

oC_Tcp_Port_BGMP 

Border Gateway Multicast Protocol.

oC_Tcp_Port_Httpmgmt 

http-mgmt

oC_Tcp_Port_ThinLincWebAccess 

ThinLinc Web Access.

oC_Tcp_Port_NovastorOnlineBackup 

Novastor Online Backup.

oC_Tcp_Port_MacOSXServerAdmin 

Mac OS X Server Admin.

oC_Tcp_Port_TSP 

PKIX Time Stamp Protocol.

oC_Tcp_Port_MATIPTypeA 

Mapping of Airline Traffic over Internet Protocol type A.

oC_Tcp_Port_MATIPTypeB 

MATIP type B.

oC_Tcp_Port_Cloantonet 

cloanto-net-1

oC_Tcp_Port_OnDemand 

On-Demand Mail Relay.

oC_Tcp_Port_Rpc2portmap 

Rpc2portmap.

oC_Tcp_Port_Codaauth2 

codaauth2, Coda authentication server

oC_Tcp_Port_ClearCaseAlbd 

ClearCase albd.

oC_Tcp_Port_HPDataAlarmManager 

HP data alarm manager.

oC_Tcp_Port_ARemoteNetworkServerSystem 

A Remote Network Server System.

oC_Tcp_Port_AURP 

AURP.

oC_Tcp_Port_LDAP 

Lightweight Directory Access Protocol.

oC_Tcp_Port_DigitalEquipmentCorporationDECnet 

Digital Equipment Corporation DECnet over TCP/IP.

oC_Tcp_Port_UPS 

Uninterruptible power supply.

oC_Tcp_Port_SLP 

Service Location Protocol.

oC_Tcp_Port_NNSP 

NNSP, part of Network News Transfer Protocol.

oC_Tcp_Port_MobileIPAgent 

Mobile IP Agent.

oC_Tcp_Port_HypertextTransferProtocolover 

Hypertext Transfer Protocol over TLS/SSL.

oC_Tcp_Port_SNPP 

Simple Network Paging Protocol , RFC 1568.

oC_Tcp_Port_WellKnownSlitherio 

Well known Slither.io port.

oC_Tcp_Port_MicrosoftDS 

Microsoft-DS Active Directory, Windows shares.

oC_Tcp_Port_SMBFS 

Microsoft-DS SMB file sharing.

oC_Tcp_Port_KerberosChangeSet 

Kerberos Change/Set password.

oC_Tcp_Port_URLRendezvousDirectoryfor 

URL Rendezvous Directory for SSM.

oC_Tcp_Port_AuthenticatedSMTPover 

Authenticated SMTP over TLS/SSL.

oC_Tcp_Port_Tcpnethaspsrv 

tcpnethaspsrv, Aladdin Knowledge Systems Hasp services

oC_Tcp_Port_GOGlobal 

GO-Global remote access and application publishing software.

oC_Tcp_Port_DantzRetrospect 

Dantz Retrospect.

oC_Tcp_Port_ISAKMPInternetKeyExchange 

Internet Security Association and Key Management Protocol / Internet Key Exchange.

oC_Tcp_Port_ModbusProtocol 

Modbus Protocol.

oC_Tcp_Port_Citadel 

Citadel, multiservice protocol for dedicated clients for the Citadel groupware system.

oC_Tcp_Port_FCP 

FirstClass Protocol , used by FirstClass client/server groupware system.

oC_Tcp_Port_Rexec 

Rexec, Remote Process Execution.

oC_Tcp_Port_Rlogin 

rlogin

oC_Tcp_Port_RemoteShell 

Remote Shell, used to execute non-interactive commands on a remote system.

oC_Tcp_Port_LPD 

Line Printer Daemon , print service.

oC_Tcp_Port_Efs 

efs, extended file name server

oC_Tcp_Port_NCPIsUsedForAVarietyThingsSuchAsAccessToPrimaryNetWareserver 

NetWare Core Protocol is used for a variety things such as access to primary NetWare server resources, Time Synchronization, etc.

oC_Tcp_Port_RPC 

Remote procedure call.

oC_Tcp_Port_AOLInstantMessenger 

AOL Instant Messenger.

oC_Tcp_Port_Netnews 

netnews

oC_Tcp_Port_Unixto 

Unix-to-Unix Copy Protocol.

oC_Tcp_Port_Commerce 

commerce

oC_Tcp_Port_Klogin 

klogin, Kerberos login

oC_Tcp_Port_Kshell 

kshell, Kerberos Remote shell

oC_Tcp_Port_VMS 

OSIsoft PI , OSISoft PI Server Client Access.

oC_Tcp_Port_DHCPv6Client 

DHCPv6 client.

oC_Tcp_Port_DHCPv6Server 

DHCPv6 server.

oC_Tcp_Port_AFPOverTCP 

Apple Filing Protocol over TCP.

oC_Tcp_Port_Newrwho 

new-rwho, new-who

oC_Tcp_Port_RTSP 

Real Time Streaming Protocol.

oC_Tcp_Port_Remotefs 

Remotefs, RFS, rfs_server.

oC_Tcp_Port_NNTPOverTLSSSL 

NNTP over TLS/SSL.

oC_Tcp_Port_9P 

9P

oC_Tcp_Port_Email 

e-mail message submission

oC_Tcp_Port_FileMaker6 

FileMaker 6.0 Web Sharing.

oC_Tcp_Port_HTTPRPCEpMap 

HTTP RPC Ep Map, Remote procedure call over Hypertext Transfer Protocol, often used by Distributed Component Object Model services and Microsoft Exchange Server.

oC_Tcp_Port_ReliableSyslogService 

Reliable Syslog Service — used for system logging.

oC_Tcp_Port_TUNNELProfile 

TUNNEL profile, a protocol for BEEP peers to form an application layer tunnel.

oC_Tcp_Port_ODProxy 

Open Directory Proxy.

oC_Tcp_Port_IPP 

Internet Printing Protocol.

oC_Tcp_Port_CUPSAdministrationConsole 

Common Unix Printing System administration console.

oC_Tcp_Port_RLZDBase 

RLZ DBase.

oC_Tcp_Port_LightweightDirectoryAccessProtocolover 

Lightweight Directory Access Protocol over TLS/SSL.

oC_Tcp_Port_MSDP 

MSDP, Multicast Source Discovery Protocol.

oC_Tcp_Port_SupportSoftNexusRemoteCommand 

SupportSoft Nexus Remote Command , a proxy gateway connecting remote control traffic.

oC_Tcp_Port_SANity 

SANity.

oC_Tcp_Port_LDP 

Label Distribution Protocol , a routing protocol used in MPLS networks.

oC_Tcp_Port_DHCPFailoverProtocol 

DHCP Failover protocol.

oC_Tcp_Port_RRP 

Registry Registrar Protocol.

oC_Tcp_Port_IEEEMMS 

IEEE-MMS.

oC_Tcp_Port_data 

SupportSoft Nexus Remote Command , a proxy gateway connecting remote control traffic.

oC_Tcp_Port_MMSMediaManagementProtocol 

Media Management System Media Management Protocol.

oC_Tcp_Port_TincVPNdaemon 

Tinc VPN daemon.

oC_Tcp_Port_IBMRMC 

IBM RMC protocol, used by System p5 AIX Integrated Virtualization Manager and Hardware Management Console to connect managed logical partitions to enable dynamic partition reconfiguration.

oC_Tcp_Port_MacOSXServeradministration 

Mac OS X Server administration, version 10.4 and earlier.

oC_Tcp_Port_Doom 

Doom, first online first-person shooter.

oC_Tcp_Port_Airservng 

airserv-ng, aircrack-ng's server for remote-controlling wireless devices

oC_Tcp_Port_ACAP 

Application Configuration Access Protocol.

oC_Tcp_Port_REALMRUSD 

REALM-RUSD.

oC_Tcp_Port_VATP 

Velneo Application Transfer Protocol.

oC_Tcp_Port_MSExchangeRouting 

MS Exchange Routing.

oC_Tcp_Port_LinuxHA 

Linux-HA high-availability heartbeat.

oC_Tcp_Port_IEEEMediaManagementSystemover 

IEEE Media Management System over SSL.

oC_Tcp_Port_EPP 

Extensible Provisioning Protocol , a protocol for communication between domain name registries and registrars.

oC_Tcp_Port_LMP 

Link Management Protocol , a protocol that runs between a pair of nodes and is used to manage traffic engineering links.

oC_Tcp_Port_IRISOverBEEP 

IRIS over BEEP.

oC_Tcp_Port_SILC 

Secure Internet Live Conferencing.

oC_Tcp_Port_CiscoTagDistributionProtocolbeing 

Cisco Tag Distribution Protocol—being replaced by the MPLS Label Distribution Protocol.

oC_Tcp_Port_TopologyBroadcastbased 

Topology Broadcast based on Reverse-Path Forwarding routing protocol.

oC_Tcp_Port_protocolAdministration 

Kerberos administration.

oC_Tcp_Port_Kerberos_master 

kerberos_master, Kerberos authentication

oC_Tcp_Port_RRH 

Reverse Routing Header.

oC_Tcp_Port_TellSend 

tell send

oC_Tcp_Port_Krb5_prop 

krb5_prop, Kerberos v5 slave propagation

oC_Tcp_Port_KrbupdateKerberosregistration 

krbupdate , Kerberos registration

oC_Tcp_Port_ConserverSerialconsole 

Conserver serial-console management server.

oC_Tcp_Port_SpamAssassinSpamdDaemon 

SpamAssassin spamd daemon.

oC_Tcp_Port_Mdbsdaemon 

mdbs-daemon

oC_Tcp_Port_PortSharingService 

Port Sharing Service.

oC_Tcp_Port_CertificateManagementProtocol 

Certificate Management Protocol.

oC_Tcp_Port_NETCONFOverSSH 

NETCONF over SSH.

oC_Tcp_Port_NETCONFOverBEEP 

NETCONF over BEEP.

oC_Tcp_Port_NETCONFForSOAPoverHttps 

NETCONF for SOAP over HTTPS.

oC_Tcp_Port_NETCONFForSOAPoverBeep 

NETCONF for SOAP over BEEP.

oC_Tcp_Port_AdobeFlash 

Adobe Flash.

oC_Tcp_Port_DHCPFailoverProtocol2 

DHCP Failover protocol.

oC_Tcp_Port_GDOIProtocol 

Group Domain Of Interpretation protocol.

oC_Tcp_Port_DNSOverTLS 

DNS over TLS.

oC_Tcp_Port_ISCSI 

iSCSI

oC_Tcp_Port_OWAMPControl 

OWAMP control.

oC_Tcp_Port_TWAMPControl 

TWAMP control.

oC_Tcp_Port_RsyncFileSynchronizationProtocol 

rsync file synchronization protocol

oC_Tcp_Port_Cddbp 

cddbp, CD DataBase protocol

oC_Tcp_Port_IBMEndpointManagerRemoteControl 

IBM Endpoint Manager Remote Control.

oC_Tcp_Port_BrocadeSmisRpc 

Brocade SMI-S RPC.

oC_Tcp_Port_BrocadeSmisSsl 

Brocade SMI-S RPC SSL.

oC_Tcp_Port_VMwareESXi_902 

VMware ESXi.

oC_Tcp_Port_VMwareESXi_903 

VMware ESXi.

oC_Tcp_Port_RNDC 

BIND remote name daemon control.

oC_Tcp_Port_RemoteHTTPSmanagement 

Remote HTTPS management for firewall devices running embedded Check Point VPN-1 software.

oC_Tcp_Port_MicrosoftWindowsSBSSharePoint 

Microsoft Windows SBS SharePoint.

oC_Tcp_Port_FTPSData 

FTPS Protocol , FTP over TLS/SSL.

oC_Tcp_Port_FTPSControl 

FTPS Protocol , FTP over TLS/SSL.

oC_Tcp_Port_NAS 

Netnews Administration System.

oC_Tcp_Port_TelnetProtocolOverTLSSSL 

Telnet protocol over TLS/SSL.

oC_Tcp_Port_InternetMessageAccessProtocolover 

Internet Message Access Protocol over TLS/SSL.

oC_Tcp_Port_InternetRelayChatover 

Internet Relay Chat over TLS/SSL.

oC_Tcp_Port_PostOfficeProtocol3 

Post Office Protocol 3 over TLS/SSL.

oC_Tcp_Port_ScimoreDBDatabaseSystem 

ScimoreDB Database System.

oC_Tcp_Port_ThinLincWebbased 

ThinLinc web-based administration interface.

Definition at line 75 of file oc_tcp.h.

Function Documentation

oC_ErrorCode_t oC_Tcp_Accept ( oC_Tcp_Server_t  Server,
oC_Tcp_Connection_t outConnection,
oC_Time_t  Timeout 
)

The function waits for the new TCP connection, accepts it and returns it for the user by using outConnection parameter.

Parameters
ServerServer object received from the function oC_Tcp_Listen
outConnectionDestination address for a new TCP connection
TimeoutMaximum time to wait for a connection
Returns
code of error or oC_ErrorCode_None if success

List of standard error codes, that can be returned by the function:

Code of error Description
oC_ErrorCode_ModuleNotStartedYet Module is turned off - you should enable the module first
oC_ErrorCode_ObjectNotCorrect Server stores incorrect object pointer
oC_ErrorCode_OutputAddressNotInRAM outConnection is not correct RAM address
oC_ErrorCode_TimeNotCorrect The Timeout is below 0
oC_ErrorCode_ModuleBusy Maximum time to wait has expired and the module is still busy
oC_ErrorCode_ServerNotStarted Server has not started yet

More error codes can be returned by the functions oC_Tcp_Server_WaitForConnection and oC_Tcp_Server_AcceptConnection

See also
oC_Tcp_Listen, oC_Tcp_Send, oC_Tcp_Receive

Definition at line 759 of file oc_tcp.c.

oC_ErrorCode_t oC_Tcp_CloseProcess ( oC_Process_t  Process,
oC_Time_t  Timeout 
)

The function is for closing all TCP servers and connections that are related with the given process.

Parameters
ProcessPointer to the process to close
TimeoutMaximum time to wait for the closing operation
Returns
code of error or oC_ErrorCode_None if success

List of standard error codes, that can be returned by the function:

Code of error Description
oC_ErrorCode_ModuleNotStartedYet Module is turned off - you should enable the module first
oC_ErrorCode_ProcessNotCorrect Process is not correct or not valid anymore
oC_ErrorCode_TimeNotCorrect Timeout is below zero
oC_ErrorCode_PermissionDenied You are not logged as root user
oC_ErrorCode_ModuleBusy Module is currently in use
oC_ErrorCode_CannotRemoveObjectFromList a Server or a Connection cannot be removed from servers or connections list
oC_ErrorCode_ReleaseError There was some memory release error
Note
More error codes can be returned by the function oC_PortMan_ReleaseAllPortsOf

Definition at line 261 of file oc_tcp.c.

oC_ErrorCode_t oC_Tcp_Connect ( const oC_Net_Address_t Destination,
oC_Tcp_Port_t  LocalPort,
oC_Tcp_Connection_t outConnection,
oC_Time_t  Timeout 
)

The function creates new TCP connection object, connects it into the remote TCP server and push it to the local TCP connections list.

Parameters
DestinationDestination IP address and destination TCP port to connect
LocalPortLocal TCP port to reserve for this connection or 0 if first free port number should be used
outConnectionDestination for the connection object
TimeoutMaximum time to wait for the connection
Returns
code of error or oC_ErrorCode_None if success

List of standard error codes, that can be returned by the function:

Code of error Description
oC_ErrorCode_ModuleNotStartedYet Module is turned off - you should enable the module first
oC_ErrorCode_WrongAddress The Destination does not point to the correct RAM or ROM address
oC_ErrorCode_IpAddressNotCorrect The Destination structure stores incorrect IP address (the field Type is not set?)
oC_ErrorCode_PortNotCorrect The field Port inside the Destination structure cannot be 0!
oC_ErrorCode_OutputAddressNotInRAM The outConnection is not correct RAM address
oC_ErrorCode_TimeNotCorrect The Timeout is below 0
oC_ErrorCode_ModuleBusy Maximum time to wait has expired and the module is still busy
oC_ErrorCode_AllocationError There was some problem with allocation memory for the connection
oC_ErrorCode_CannotAddObjectToList Connection cannot be added to the local connections list

More error codes can be returned by the function oC_Tcp_ReservePort and #oC_Tcp_Connection_Connect

See also
oC_Tcp_ReservePort, oC_Tcp_Connection_Connect, oC_Tcp_Send, oC_Tcp_Receive

Definition at line 443 of file oc_tcp.c.

oC_Tcp_Connection_t oC_Tcp_Connection_New ( const oC_Tcp_Connection_Config_t Config)

The function is designed for allocating a memory for a TCP connection object. The object is required for handling TCP connection with the remote TCP client or server. The function initializes sub-objects required by the

Parameters

Definition at line 270 of file oc_tcp_connection.c.

oC_ErrorCode_t oC_Tcp_Disconnect ( oC_Tcp_Connection_t Connection,
oC_Time_t  Timeout 
)

The function disconnects TCP connection, removes object from the local TCP connections list (or from TCP servers connection list) and releases memory allocated for the connection. It can be used for connections received from functions oC_Tcp_Connect and oC_Tcp_Accept

Parameters
ConnectionAn address to variable with Connection object received from function oC_Tcp_Connect or oC_Tcp_Accept
TimeoutMaximum time for disconnection process
Returns
code of error or oC_ErrorCode_None if success

List of standard error codes, that can be returned by the function:

Code of error Description
oC_ErrorCode_ModuleNotStartedYet Module is turned off - you should enable the module first
oC_ErrorCode_AddressNotInRam The Connection does not point to the correct RAM address
oC_ErrorCode_ObjectNotCorrect The Connection points to incorrect connection object
oC_ErrorCode_NotConnected The Connection is currently not connected
oC_ErrorCode_TimeNotCorrect The Timeout is below 0
oC_ErrorCode_ModuleBusy Maximum time to wait has expired and the module is still busy
oC_ErrorCode_ObjectNotFoundOnList The Connection is not from function oC_Tcp_Connect nor oC_Tcp_Accept
oC_ErrorCode_CannotRemoveObjectFromList Connection cannot be removed from the local connections list
oC_ErrorCode_ReleaseError The was a problem with releasing memory allocated for the Connection object

More error codes can be returned by the functions called internally

See also
oC_Tcp_Connect, oC_Tcp_Accept

Definition at line 532 of file oc_tcp.c.

oC_ErrorCode_t oC_Tcp_Listen ( const oC_Net_Address_t Source,
oC_Tcp_Server_t outServer,
uint32_t  MaxConnections,
oC_Time_t  Timeout 
)

The function starts a new TCP server that will listen at the given IP address (and the given TCP port). After call of the function it is possible to accept connections by calling the function oC_Tcp_Accept. Remember, that the function also reserves a TCP port for the current process and it has to be closed by function oC_Tcp_StopListen

Parameters
SourceSource IP address (with the Port field filled)
outServerDestination address to return the new created server
MaxConnectionsMaximum number of connections that the server can handle at once
TimeoutMaximum time for the operation
Returns
code of error or oC_ErrorCode_None if success

List of standard error codes, that can be returned by the function:

Code of error Description
oC_ErrorCode_ModuleNotStartedYet Module is turned off - you should enable the module first
oC_ErrorCode_WrongAddress Source is not correct address of RAM or ROM
oC_ErrorCode_IpAddressNotCorrect Source points to incorrect IP address (is Type field filled?)
oC_ErrorCode_PortNotCorrect Port in the Source structure is not filled (it is 0!)
oC_ErrorCode_OutputAddressNotInRAM The outServer does not point to the correct RAM address
oC_ErrorCode_MaximumValueNotCorrect The MaxConnections has to be grower than 0
oC_ErrorCode_TimeNotCorrect The Timeout is below 0
oC_ErrorCode_ModuleBusy Maximum time to wait has expired and the module is still busy
oC_ErrorCode_AllocationError There was a problem with memory allocation
oC_ErrorCode_CannotAddObjectToList Some error occurred during adding server to the servers list

More error codes can be returned by the function oC_Tcp_ReservePort

See also
oC_Tcp_Accept, oC_Tcp_Send, oC_Tcp_Receive

Definition at line 615 of file oc_tcp.c.

bool oC_Tcp_Packet_AddOption ( oC_Tcp_Packet_t Packet,
oC_Tcp_OptionKind_t  OptionKind,
const void *  Data,
uint8_t  Size 
)

The function is for adding options to the TCP packet. Please check TCP RFC 2780 for more informations.

Parameters
PacketTCP packet allocated by the function oC_Tcp_Packet_New
OptionKindKind of the option to add
DataPointer to data to put inside the option or NULL if not used (in this case Size must be set to 0)
SizeSize (Length) of the option's data (please check the RFC to find out what size can be given for the option - the function does not check if the size is correct)
Returns
true if option has been added

Definition at line 360 of file oc_tcp_packet.c.

bool oC_Tcp_Packet_ClearOptions ( oC_Tcp_Packet_t Packet)

The function clears options list in the TCP packet

Parameters
PacketTCP packet allocated by the function oC_Tcp_Packet_New
Returns
true if success

Definition at line 459 of file oc_tcp_packet.c.

bool oC_Tcp_Packet_Delete ( oC_Tcp_Packet_t **  Packet)

The function is for releasing memory allocated by the function oC_Tcp_Packet_New.

Parameters
PacketPointer to the variable that keeps allocated packet - it will be set to NULL after usage
Returns
true if packet was deleted
See also
oC_Tcp_Packet_New

Definition at line 170 of file oc_tcp_packet.c.

void* oC_Tcp_Packet_GetDataReference ( oC_Tcp_Packet_t Packet)

The function returns pointer to the data inside TCP packet.

Parameters
PacketTCP packet allocated by the function oC_Tcp_Packet_New
Returns
pointer to the data section inside TCP packet

Definition at line 283 of file oc_tcp_packet.c.

uint16_t oC_Tcp_Packet_GetDataSize ( oC_Tcp_Packet_t Packet)

The function returns size of the data inside TCP packet

Parameters
PacketTCP packet allocated by the function oC_Tcp_Packet_New
Returns
size of data inside TCP packet

Definition at line 317 of file oc_tcp_packet.c.

oC_Tcp_Packet_t* oC_Tcp_Packet_New ( const oC_Net_Address_t Source,
const oC_Net_Address_t Destination,
uint16_t  HeaderSize,
const void *  Data,
uint16_t  Size 
)

The function is for creating new TCP packet. It allocates memory for a TCP header, user data and IP header. It also fills basic required fields.

Parameters
SourceSource IP address (sender)
DestinationDestination IP address (receiver)
HeaderSizeSize of the TCP header (minimum sizeof(oC_Tcp_Header_t) ). It is required, because TCP allows for adding options to the header
DataNULL if not used or pointer to the buffer with data to copy inside TCP packet
SizeSize of the data to put inside the TCP packet
Returns
pointer to the allocated packet or NULL in case of error
See also
oC_Tcp_Packet_Delete

Definition at line 98 of file oc_tcp_packet.c.

oC_ErrorCode_t oC_Tcp_Packet_ReadOption ( oC_Tcp_Packet_t Packet,
oC_Tcp_OptionKind_t  OptionKind,
void *  outData,
uint8_t *  Size 
)

The function reads option's data from the TCP packet. Please check TCP RFC 2780 for more informations.

Parameters
PacketTCP packet allocated by the function oC_Tcp_Packet_New
OptionKindKind of the TCP option to find
outDataDestination for option data or NULL if not used
SizeDestination for the option size on output and size of the outData buffer on input
Returns
code of error or oC_ErrorCode_None if success.

Here is the list of standard error codes that can be returned by the function:

ErrorCode Description
oC_ErrorCode_AddressNotInRam Packet or Size are not correct RAM address
oC_ErrorCode_ValueTooBig OptionKind is too big
oC_ErrorCode_OptionNotFound The given OptionKind has not been found in the TCP packet
oC_ErrorCode_OutputAddressNotInRAM outData is not in RAM but it is required (size of the option is not 0)

Definition at line 415 of file oc_tcp_packet.c.

oC_ErrorCode_t oC_Tcp_Receive ( oC_Tcp_Connection_t  Connection,
void *  outBuffer,
oC_MemorySize_t  Size,
oC_Time_t  Timeout 
)

The function is for receiving data by using TCP connection received from functions oC_Tcp_Accept or oC_Tcp_Connect.

Note
You can also use directly the function #oC_Tcp_Connection_Receive
Parameters
ConnectionTCP connection object received from oC_Tcp_Accept or oC_Tcp_Connect
outBufferBuffer for received data
SizeSize of the buffer
TimeoutMaximum time to wait for sending
Returns
code of error or oC_ErrorCode_None if success

List of standard error codes, that can be returned by the function:

Code of error Description
oC_ErrorCode_ModuleNotStartedYet Module is turned off - you should enable the module first

More error codes can be returned by the function #oC_Tcp_Connection_Receive

See also
oC_Tcp_Accept, oC_Tcp_Connect, oC_Tcp_Connection_Receive, oC_Tcp_Receive

Definition at line 858 of file oc_tcp.c.

oC_ErrorCode_t oC_Tcp_ReleasePort ( oC_Tcp_Port_t  Port,
oC_Time_t  Timeout 
)

The function is for releasing TCP ports that has been previously reserved by the function oC_Tcp_ReservePort and are not required any more.

Warning
Only the process that has reserved the port earlier can release it. Exception from this rule is the root user that can release each port.
Parameters
PortTCP port to release (reserved by the function #oc_Tcp_ReservePort)
TimeoutMaximum time to wait for releasing the port
Returns
code of error or oC_ErrorCode_None if success

List of standard error codes, that can be returned by the function:

Code of error Description
oC_ErrorCode_ModuleNotStartedYet Module is turned off - you should enable the module first
oC_ErrorCode_PortNotCorrect The Port is not correct (it cannot be 0)
oC_ErrorCode_TimeNotCorrect Timeout is below zero

More error codes can be returned by the function oC_PortMan_ReleasePort

See also
oC_PortMan_ReleasePort

Definition at line 371 of file oc_tcp.c.

oC_ErrorCode_t oC_Tcp_ReservePort ( oC_Tcp_Port_t Port,
oC_Time_t  Timeout 
)

To prevent using the same TCP port by two different processes at the same time, each process has to reserve the TCP port before using it. This function allows to do by manual. It is also possible to reserve a first available TCP port by setting a Port variable to 0.

Warning
If you are using functions oC_Tcp_Connect or oC_Tcp_Listen you should not reserve the port because these functions reserve it by their own.
Parameters
PortPointer to the variable where the TCP port is stored. If it points to 0, the module will find a first available TCP port and set it inside this variable
TimeoutMaximum time for the reservation operation
Returns
code of error or oC_ErrorCode_None if success

List of standard error codes, that can be returned by the function:

Code of error Description
oC_ErrorCode_ModuleNotStartedYet Module is turned off - you should enable the module first
oC_ErrorCode_AddressNotInRam The Port is not correct RAM address
oC_ErrorCode_TimeNotCorrect Timeout is below zero

More error codes can be returned by the function oC_PortMan_ReservePort

See also
oC_PortMan_ReservePort

Definition at line 319 of file oc_tcp.c.

oC_ErrorCode_t oC_Tcp_Send ( oC_Tcp_Connection_t  Connection,
const void *  Buffer,
oC_MemorySize_t  Size,
oC_Time_t  Timeout 
)

The function is for sending data by using TCP connection received from functions oC_Tcp_Accept or oC_Tcp_Connect.

Note
You can also use directly the function #oC_Tcp_Connection_Send
Parameters
ConnectionTCP connection object received from oC_Tcp_Accept or oC_Tcp_Connect
BufferBuffer with data to send
SizeSize of the buffer to send
TimeoutMaximum time to wait for sending
Returns
code of error or oC_ErrorCode_None if success

List of standard error codes, that can be returned by the function:

Code of error Description
oC_ErrorCode_ModuleNotStartedYet Module is turned off - you should enable the module first

More error codes can be returned by the function #oC_Tcp_Connection_Send

See also
oC_Tcp_Accept, oC_Tcp_Connect, oC_Tcp_Connection_Send, oC_Tcp_Receive

Definition at line 819 of file oc_tcp.c.

oC_ErrorCode_t oC_Tcp_Server_AcceptConnection ( oC_Tcp_Server_t  Server,
oC_Tcp_Connection_t  Connection,
oC_Time_t  Timeout 
)

The function is for accepting the TCP connections received from the function oC_Tcp_Server_WaitForConnection. After call of this function, data can be sending and receiving by using #oC_Tcp_Connection_Send and #oC_Tcp_Connection_Receive

See also
oC_Tcp_Server_WaitForConnection, oC_Tcp_Server_RejectConnection, oC_Tcp_Connection_Send, oC_Tcp_Connection_Receive
Warning
Remember, that in case of failure of this function removes the given TCP connection from the servers connections list, otherwise it would block the slot in the list. To prevent memory leakage, it also has to delete the connection, so it cannot be used anymore.
Parameters
ServerTCP Server object created by the function oC_Tcp_Server_New
ConnectionTCP Connection object received from the function oC_Tcp_Server_WaitForConnection
TimeoutMaximum time to wait for the connection
Returns
code of error or oC_ErrorCode_None if success

List of standard error codes, that can be returned by the function:

Code of error Description
oC_ErrorCode_ObjectNotCorrect Server or Connection is not correct (address is not correct or not valid anymore)
oC_ErrorCode_NotRunning The server is not running (the function oC_Tcp_Server_Run has not been called)
oC_ErrorCode_TimeNotCorrect The given Timeout is below zero
oC_ErrorCode_ConnectionFromDifferentServer The giv server->Process = getcurprocess();en Connection is not related with the given Server
oC_ErrorCode_Timeout Maximum time to wait has expired

Note, that more error code can be received from the function #oC_Tcp_Connection_Accept

Definition at line 539 of file oc_tcp_server.c.

oC_ErrorCode_t oC_Tcp_Server_AddConnection ( oC_Tcp_Server_t  Server,
oC_Tcp_Connection_t  Connection,
oC_Time_t  Timeout 
)

The function is for adding TCP connection to the TCP Sever's connections list.

Parameters
ServerTCP Server object created by the function oC_Tcp_Server_New
ConnectionTCP Connection object received from the function oC_Tcp_Server_WaitForConnection
TimeoutMaximum time for operation
Returns
code of error or oC_ErrorCode_None if success

List of standard error codes, that can be returned by the function:

Code of error Description
oC_ErrorCode_ObjectNotCorrect Server or Connection is not correct (address is not correct or not valid anymore)
oC_ErrorCode_FoundOnList The given Server is already associated with the given Connection
oC_ErrorCode_NoFreeSlots There is no more free slots for TCP connections in the server

Definition at line 646 of file oc_tcp_server.c.

bool oC_Tcp_Server_ContainsConnection ( oC_Tcp_Server_t  Server,
oC_Tcp_Connection_t  Connection 
)

The function is for checking if the given TCP server handles the given TCP connection

Parameters
ServerTCP Server object created by the function oC_Tcp_Server_New
ConnectionTCP Connection object received from the function oC_Tcp_Server_WaitForConnection
Returns
true if the given connection is related with the given server

Definition at line 482 of file oc_tcp_server.c.

bool oC_Tcp_Server_Delete ( oC_Tcp_Server_t Server,
oC_Time_t  Timeout 
)

The function release memory allocated for the TCP Server object and deletes all children TCP connections.

Parameters
ServerPointer to the variable that stores TCP server (it will be cleared in case of success
TimeoutMaximum time for operation
Returns
true if the TCP server has been deleted

Definition at line 197 of file oc_tcp_server.c.

oC_Tcp_Port_t oC_Tcp_Server_GetPort ( oC_Tcp_Server_t  Server)

The function returns local TCP port, that the server listen to.

Parameters
ServerTCP Server object created by the function oC_Tcp_Server_New
Returns
local TCP port

Definition at line 772 of file oc_tcp_server.c.

oC_Process_t oC_Tcp_Server_GetProcess ( oC_Tcp_Server_t  Server)

The function returns process associated with the given TCP server - it is the process, that called the function oC_Tcp_Server_New.

Parameters
ServerTCP Server object created by the function oC_Tcp_Server_New
Returns
process associated with the given TCP server

Definition at line 749 of file oc_tcp_server.c.

bool oC_Tcp_Server_IsCorrect ( oC_Tcp_Server_t  Server)

The function checks if the TCP server object is correct (if it is allocated by the function oC_Tcp_Server_New and if it has not been deleted by the function oC_Tcp_Server_Delete)

Parameters
ServerTCP Server object created by the function oC_Tcp_Server_New
Returns
true if the given TCP Server object is correct

Definition at line 255 of file oc_tcp_server.c.

bool oC_Tcp_Server_IsRunning ( oC_Tcp_Server_t  Server)

The function checks if the TCP server is running (if the function oC_Tcp_Server_Run has been called).

Parameters
ServerTCP Server object created by the function oC_Tcp_Server_New
Returns
true if the given TCP Server is running

Definition at line 271 of file oc_tcp_server.c.

oC_Tcp_Server_t oC_Tcp_Server_New ( const oC_Net_Address_t ListenAddress,
uint32_t  MaxConnections 
)

The function is for allocating memory for the new TCP server.

Note
The function will associate the current process with the server. It will be destroyed when the process will be killed
Warning
The TCP port has to be reserved before by calling the function oC_Tcp_ReservePort !
Parameters
ListenAddressAddress to listen (with with filled field Port)
MaxConnectionsMaximum number of connections handled by the server
Returns
allocated TCP server

Definition at line 122 of file oc_tcp_server.c.

oC_ErrorCode_t oC_Tcp_Server_RejectConnection ( oC_Tcp_Server_t  Server,
oC_Tcp_Connection_t  Connection,
oC_Time_t  Timeout 
)

The function is for rejecting TCP connection received from the function oC_Tcp_Server_WaitForConnection.

Warning
The function also removes the given connection from the TCP server's connections list and deletes the TCP connection object. It causes that it cannot be used anymore.
Parameters
ServerTCP Server object created by the function oC_Tcp_Server_New
ConnectionTCP Connection object received from the function oC_Tcp_Server_WaitForConnection
TimeoutMaximum time to wait for the connection
Returns
code of error or oC_ErrorCode_None if success

List of standard error codes, that can be returned by the function:

Code of error Description
oC_ErrorCode_ObjectNotCorrect Server or Connection is not correct (address is not correct or not valid anymore)
oC_ErrorCode_NotRunning The server is not running (the function oC_Tcp_Server_Run has not been called)
oC_ErrorCode_TimeNotCorrect The given Timeout is below zero
oC_ErrorCode_ConnectionFromDifferentServer The given Connection is not related with the given Server
oC_ErrorCode_Timeout Maximum time to wait has expired

Note, that more error code can be received from the functions #oC_Tcp_Connection_Reject and oC_Tcp_Server_RemoveConnection

Definition at line 595 of file oc_tcp_server.c.

oC_ErrorCode_t oC_Tcp_Server_RemoveConnection ( oC_Tcp_Server_t  Server,
oC_Tcp_Connection_t  Connection 
)

The function removes TCP connection from TCP server's connection list.

Parameters
ServerTCP Server object created by the function oC_Tcp_Server_New
ConnectionTCP Connection object received from the function oC_Tcp_Server_WaitForConnection
Returns
code of error or oC_ErrorCode_None if success

List of standard error codes, that can be returned by the function:

Code of error Description
oC_ErrorCode_ObjectNotCorrect Server or Connection is not correct (address is not correct or not valid anymore)
oC_ErrorCode_ObjectNotFoundOnList The given Server is not associated with the given Connection

Definition at line 705 of file oc_tcp_server.c.

oC_ErrorCode_t oC_Tcp_Server_Run ( oC_Tcp_Server_t  Server)

The function is for running the TCP server. It starts the TCP Server thread.

Parameters
ServerTCP Server object created by the function oC_Tcp_Server_New
Returns
code of error or oC_ErrorCode_None if success

List of standard error codes, that can be returned by the function:

Code of error Description
oC_ErrorCode_ObjectNotCorrect Server is not correct (address is not correct or not valid anymore)
oC_ErrorCode_AlreadyRunning The function has been called before and the server is running already
oC_ErrorCode_CannotRunThread There was a problem with running the thread

Definition at line 340 of file oc_tcp_server.c.

oC_ErrorCode_t oC_Tcp_Server_SetConnectionConfig ( oC_Tcp_Server_t  Server,
const oC_Tcp_Connection_Config_t Config 
)

The function is for changing configuration of the connections related with the server. The change will be applied only to new connections

Parameters
ServerTCP Server object created by the function oC_Tcp_Server_New
ConfigPointer to the configuration to copy
Returns
code of error or oC_ErrorCode_None if success

List of standard error codes, that can be returned by the function:

Code of error Description
oC_ErrorCode_ObjectNotCorrect Server is not correct (address is not correct or not valid anymore)
oC_ErrorCode_WrongAddress Config address is not correct
oC_ErrorCode_TimeNotCorrect ConfirmationTimeout field in Config is not correct
oC_ErrorCode_PortNotCorrect LocalAddress.Port field in Config is not correct
oC_ErrorCode_SizeNotCorrect LocalWindowSize field in Config is not correct
oC_ErrorCode_PortNotReserved LocalAddress.Port has to be reserved before
oC_ErrorCode_PortReservedByDifferentProcess LocalAddress.Port has been reserved by different process

Definition at line 300 of file oc_tcp_server.c.

oC_ErrorCode_t oC_Tcp_Server_Stop ( oC_Tcp_Server_t  Server)

The function is for stopping accepting new connections by the TCP server. After call of the function no new connection will be handled at the server. Connections, that are currently active will work until the server will be deleted by the function oC_Tcp_Server_Delete.

See also
oC_Tcp_Server_Run
Parameters
ServerTCP Server object created by the function oC_Tcp_Server_New
Returns
code of error or oC_ErrorCode_None if success

List of standard error codes, that can be returned by the function:

Code of error Description
oC_ErrorCode_ObjectNotCorrect Server is not correct (address is not correct or not valid anymore)
oC_ErrorCode_NotRunning The server is not running (the function oC_Tcp_Server_Run has not been called)
oC_ErrorCode_CannotDeleteThread There was a problem with deleting the thread

Definition at line 379 of file oc_tcp_server.c.

oC_ErrorCode_t oC_Tcp_Server_WaitForConnection ( oC_Tcp_Server_t  Server,
oC_Tcp_Connection_t outConnection,
oC_Time_t  Timeout 
)

The function waits for a new TCP connection.

Warning
The connection has to be accepted or rejected as soon as possible, otherwise it can expire.
See also
oC_Tcp_Server_AcceptConnection, oC_Tcp_Server_RejectConnection
Parameters
ServerTCP Server object created by the function oC_Tcp_Server_New
outConnectionPointer to the variable where new TCP connection should be stored
TimeoutMaximum time to wait for the connection
Returns
code of error or oC_ErrorCode_None if success

List of standard error codes, that can be returned by the function:

Code of error Description
oC_ErrorCode_ObjectNotCorrect Server is not correct (address is not correct or not valid anymore)
oC_ErrorCode_NotRunning The server is not running (the function oC_Tcp_Server_Run has not been called)
oC_ErrorCode_OutputAddressNotInRAM outConnection is not the correct RAM address
oC_ErrorCode_TimeNotCorrect The given Timeout is below zero
oC_ErrorCode_Timeout Maximum time to wait has expired

Definition at line 438 of file oc_tcp_server.c.

oC_ErrorCode_t oC_Tcp_StopListen ( oC_Tcp_Server_t Server,
oC_Time_t  Timeout 
)

The function is for stopping listening at the given TCP port. It should be called for servers received from the function oC_Tcp_Listen. The function releases memory allocated for the TCP server and releases port reserved for it.

Parameters
ServerPointer to server object received from the function oC_Tcp_Listen, it will be set to NULL on output
TimeoutMaximum time for server stopping
Returns
code of error or oC_ErrorCode_None if success

List of standard error codes, that can be returned by the function:

Code of error Description
oC_ErrorCode_ModuleNotStartedYet Module is turned off - you should enable the module first
oC_ErrorCode_AddressNotInRam Server is not correct RAM address
oC_ErrorCode_ObjectNotCorrect Server stores incorrect object pointer
oC_ErrorCode_TimeNotCorrect The Timeout is below 0
oC_ErrorCode_ModuleBusy Maximum time to wait has expired and the module is still busy
oC_ErrorCode_ServerNotStarted Server has not started yet
oC_ErrorCode_ReleaseError There was a problem with releasing memory of TCP server
oC_ErrorCode_CannotRemoveObjectFromList The given server cannot be removed from servers list

More error codes can be returned by the functions oC_PortMan_ReleasePort and oC_Tcp_Server_Stop

See also
oC_Tcp_Listen, oC_Tcp_Send, oC_Tcp_Receive

Definition at line 693 of file oc_tcp.c.

oC_ErrorCode_t oC_Tcp_TurnOff ( oC_Time_t  Timeout)

The function is for turning off the TCP module.

Warning
Only root user can turn off the module!
Parameters
TimeoutMaximum time for the turning off operation
Returns
code of error or oC_ErrorCode_None if success

List of standard error codes, that can be returned by the function:

Code of error Description
oC_ErrorCode_ModuleNotStartedYet Module is turned off - call of this function is not required.
oC_ErrorCode_ReleaseError There was a problem with releasing memory
oC_ErrorCode_TimeNotCorrect Timeout is below 0
oC_ErrorCode_PermissionDenied Currently logged user is not root
oC_ErrorCode_ModuleBusy Module is busy and maximum time for the operation has expired

More error codes can be returned by the function oC_PortMan_UnregisterModule

See also
oC_Tcp_TurnOn

Definition at line 185 of file oc_tcp.c.

oC_ErrorCode_t oC_Tcp_TurnOn ( oC_Time_t  Timeout)

The function is for turning on the TCP module. It has to be called before any other TCP call. The module requires also PortMan module to work and it should enabled before all of this function.

Parameters
TimeoutMaximum time for turning on the module
Note
Only root user can enable the module
Warning
Remember to enable PortMan module before!
Returns
code of error or oC_ErrorCode_None if success

List of standard error codes, that can be returned by the function:

Code of error Description
oC_ErrorCode_ModuleIsTurnedOn Module is already turned on - please turn it off first if you want to restart it.
oC_ErrorCode_AllocationError There is a problem with memory allocation
oC_ErrorCode_RequiredModuleNotEnabled PortMan module has not been enabled before
oC_ErrorCode_PermissionDenied Only root user can enable the module

More error codes can be returned by the function oC_PortMan_RegisterModule

Definition at line 118 of file oc_tcp.c.