aboutsummaryrefslogtreecommitdiff
path: root/drivers/tcpip/tcpclient.h
blob: 5ed075aeb2b279c2f9cc7316f24f379005ca9ec5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifndef tcpclient_INCLUDED
#define tcpclient_INCLUDED

#ifdef __cplusplus
extern "C" {
#endif

//return port handle or -1 if fails
int OpenTCPPort(const char * ip_addr, int port);
int PollTCPPort(int, unsigned char *, int);
int SendTCPByte(int, unsigned char);
int SendTCPBuf(int, unsigned char *, int);
void CloseTCPport(int);


//accepted TCP/IP address format is nnn.nnn.nnn.nnn:pppp where n is IP address numbers and p is port number
int validateIpAddress(const char *s, const char **pip_end,
                             const char **pport_start);
int parseIpAddress(const char *s, char *ip, size_t ipsize, short *port);


#ifdef __cplusplus
} /* extern "C" */
#endif

#endif