CC3000
1.12
|
Classes | |
struct | _in_addr_t |
struct | _sockaddr_t |
struct | _sockaddr_in_t |
struct | fd_set |
Macros | |
#define | SOCKET_OPEN_PARAMS_LEN (12) |
#define | SOCKET_CLOSE_PARAMS_LEN (4) |
#define | SOCKET_ACCEPT_PARAMS_LEN (4) |
#define | SOCKET_BIND_PARAMS_LEN (20) |
#define | SOCKET_LISTEN_PARAMS_LEN (8) |
#define | SOCKET_GET_HOST_BY_NAME_PARAMS_LEN (9) |
#define | SOCKET_CONNECT_PARAMS_LEN (20) |
#define | SOCKET_SELECT_PARAMS_LEN (44) |
#define | SOCKET_SET_SOCK_OPT_PARAMS_LEN (20) |
#define | SOCKET_GET_SOCK_OPT_PARAMS_LEN (12) |
#define | SOCKET_RECV_FROM_PARAMS_LEN (12) |
#define | SOCKET_SENDTO_PARAMS_LEN (24) |
#define | SOCKET_MDNS_ADVERTISE_PARAMS_LEN (12) |
#define | SOCKET_GET_MSS_VALUE_PARAMS_LEN (4) |
#define | HCI_CMND_SEND_ARG_LENGTH (16) |
#define | SELECT_TIMEOUT_MIN_MICRO_SECONDS 5000 |
#define | HEADERS_SIZE_DATA (SPI_HEADER_SIZE + 5) |
#define | SIMPLE_LINK_HCI_CMND_TRANSPORT_HEADER_SIZE (SPI_HEADER_SIZE + SIMPLE_LINK_HCI_CMND_HEADER_SIZE) |
#define | MDNS_DEVICE_SERVICE_MAX_LENGTH (32) |
#define | HOSTNAME_MAX_LENGTH (230) |
#define | AF_INET 2 |
#define | AF_INET6 23 |
#define | SOCK_STREAM 1 |
#define | SOCK_DGRAM 2 |
#define | SOCK_RAW 3 |
#define | SOCK_RDM 4 |
#define | SOCK_SEQPACKET 5 |
#define | IPPROTO_IP 0 |
#define | IPPROTO_ICMP 1 |
#define | IPPROTO_IPV4 IPPROTO_IP |
#define | IPPROTO_TCP 6 |
#define | IPPROTO_UDP 17 |
#define | IPPROTO_IPV6 41 |
#define | IPPROTO_NONE 59 |
#define | IPPROTO_RAW 255 |
#define | IPPROTO_MAX 256 |
#define | SOC_ERROR (-1) |
#define | SOC_IN_PROGRESS (-2) |
#define | SOL_SOCKET 0xffff |
#define | SOCKOPT_RECV_NONBLOCK 0 |
#define | SOCKOPT_RECV_TIMEOUT 1 |
#define | SOCKOPT_ACCEPT_NONBLOCK 2 |
#define | SOCK_ON 0 |
#define | SOCK_OFF 1 |
#define | MAX_PACKET_SIZE 1500 |
#define | MAX_LISTEN_QUEUE 4 |
#define | IOCTL_SOCKET_EVENTMASK |
#define | ENOBUFS 55 |
#define | __FD_SETSIZE 32 |
#define | ASIC_ADDR_LEN 8 |
#define | NO_QUERY_RECIVED -3 |
#define | __NFDBITS (8 * sizeof (__fd_mask)) |
#define | __FDELT(d) ((d) / __NFDBITS) |
#define | __FDMASK(d) ((__fd_mask) 1 << ((d) % __NFDBITS)) |
#define | __FD_ZERO(set) |
#define | __FD_SET(d, set) (__FDS_BITS (set)[__FDELT (d)] |= __FDMASK (d)) |
#define | __FD_CLR(d, set) (__FDS_BITS (set)[__FDELT (d)] &= ~__FDMASK (d)) |
#define | __FD_ISSET(d, set) (__FDS_BITS (set)[__FDELT (d)] & __FDMASK (d)) |
#define | FD_SET(fd, fdsetp) __FD_SET (fd, fdsetp) |
#define | FD_CLR(fd, fdsetp) __FD_CLR (fd, fdsetp) |
#define | FD_ISSET(fd, fdsetp) __FD_ISSET (fd, fdsetp) |
#define | FD_ZERO(fdsetp) __FD_ZERO (fdsetp) |
#define | htonl(A) |
#define | ntohl htonl |
#define | htons(A) |
#define | ntohs htons |
#define | SET_mDNS_ADD(sockaddr) |
Typedefs | |
typedef struct _in_addr_t | in_addr |
typedef struct _sockaddr_t | sockaddr |
typedef struct _sockaddr_in_t | sockaddr_in |
typedef UINT32 | socklen_t |
typedef INT32 | __fd_mask |
Functions | |
INT16 | HostFlowControlConsumeBuff (INT16 sd) |
if SEND_NON_BLOCKING not define - block until have free buffer becomes available, else return immediately with correct status regarding the buffers available. More... | |
INT16 | socket (INT32 domain, INT32 type, INT32 protocol) |
create an endpoint for communication The socket function creates a socket that is bound to a specific transport service provider. This function is called by the application layer to obtain a socket handle. More... | |
INT32 | closesocket (INT32 sd) |
The socket function closes a created socket. More... | |
INT32 | accept (INT32 sd, sockaddr *addr, socklen_t *addrlen) |
accept a connection on a socket: This function is used with connection-based socket types (SOCK_STREAM). It extracts the first connection request on the queue of pending connections, creates a new connected socket, and returns a new file descriptor referring to that socket. The newly created socket is not in the listening state. The original socket sd is unaffected by this call. The argument sd is a socket that has been created with socket(), bound to a local address with bind(), and is listening for connections after a listen(). The argument addr is a pointer to a sockaddr structure. This structure is filled in with the address of the peer socket, as known to the communications layer. The exact format of the address returned addr is determined by the socket's address family. The addrlen argument is a value-result argument: it should initially contain the size of the structure pointed to by addr, on return it will contain the actual length (in bytes) of the address returned. More... | |
INT32 | bind (INT32 sd, const sockaddr *addr, INT32 addrlen) |
assign a name to a socket This function gives the socket the local address addr. addr is addrlen bytes long. Traditionally, this is called when a socket is created with socket, it exists in a name space (address family) but has no name assigned. It is necessary to assign a local address before a SOCK_STREAM socket may receive connections. More... | |
INT32 | listen (INT32 sd, INT32 backlog) |
listen for connections on a socket The willingness to accept incoming connections and a queue limit for incoming connections are specified with listen(), and then the connections are accepted with accept. The listen() call applies only to sockets of type SOCK_STREAM The backlog parameter defines the maximum length the queue of pending connections may grow to. More... | |
INT16 | gethostbyname (CHAR *hostname, UINT16 usNameLen, UINT32 *out_ip_addr) |
Get host IP by name. Obtain the IP Address of machine on network, by its name. More... | |
INT32 | connect (INT32 sd, const sockaddr *addr, INT32 addrlen) |
initiate a connection on a socket Function connects the socket referred to by the socket descriptor sd, to the address specified by addr. The addrlen argument specifies the size of addr. The format of the address in addr is determined by the address space of the socket. If it is of type SOCK_DGRAM, this call specifies the peer with which the socket is to be associated; this address is that to which datagrams are to be sent, and the only address from which datagrams are to be received. If the socket is of type SOCK_STREAM, this call attempts to make a connection to another socket. The other socket is specified by address, which is an address in the communications space of the socket. Note that the function implements only blocking behavior thus the caller will be waiting either for the connection establishment or for the connection establishment failure. More... | |
INT16 | select (INT32 nfds, fd_set *readsds, fd_set *writesds, fd_set *exceptsds, struct timeval *timeout) |
Monitor socket activity Select allow a program to monitor multiple file descriptors, waiting until one or more of the file descriptors become "ready" for some class of I/O operation. More... | |
INT16 | setsockopt (INT32 sd, INT32 level, INT32 optname, const void *optval, socklen_t optlen) |
set socket options This function manipulate the options associated with a socket. Options may exist at multiple protocol levels; they are always present at the uppermost socket level. When manipulating socket options the level at which the option resides and the name of the option must be specified. To manipulate options at the socket level, level is specified as SOL_SOCKET. To manipulate options at any other level the protocol number of the appropriate protocol controlling the option is supplied. For example, to indicate that an option is to be interpreted by the TCP protocol, level should be set to the protocol number of TCP; The parameters optval and optlen are used to access optval - use for setsockopt(). For getsockopt() they identify a buffer in which the value for the requested option(s) are to be returned. For getsockopt(), optlen is a value-result parameter, initially containing the size of the buffer pointed to by option_value, and modified on return to indicate the actual size of the value returned. If no option value is to be supplied or returned, option_value may be NULL. More... | |
INT16 | getsockopt (INT32 sd, INT32 level, INT32 optname, void *optval, socklen_t *optlen) |
set socket options This function manipulate the options associated with a socket. Options may exist at multiple protocol levels; they are always present at the uppermost socket level. When manipulating socket options the level at which the option resides and the name of the option must be specified. To manipulate options at the socket level, level is specified as SOL_SOCKET. To manipulate options at any other level the protocol number of the appropriate protocol controlling the option is supplied. For example, to indicate that an option is to be interpreted by the TCP protocol, level should be set to the protocol number of TCP; The parameters optval and optlen are used to access optval - use for setsockopt(). For getsockopt() they identify a buffer in which the value for the requested option(s) are to be returned. For getsockopt(), optlen is a value-result parameter, initially containing the size of the buffer pointed to by option_value, and modified on return to indicate the actual size of the value returned. If no option value is to be supplied or returned, option_value may be NULL. More... | |
INT16 | simple_link_recv (INT32 sd, void *buf, INT32 len, INT32 flags, sockaddr *from, socklen_t *fromlen, INT32 opcode) |
Read data from socket Return the length of the message on successful completion. If a message is too long to fit in the supplied buffer, excess bytes may be discarded depending on the type of socket the message is received from. More... | |
INT16 | recv (INT32 sd, void *buf, INT32 len, INT32 flags) |
function receives a message from a connection-mode socket More... | |
INT16 | recvfrom (INT32 sd, void *buf, INT32 len, INT32 flags, sockaddr *from, socklen_t *fromlen) |
read data from socket function receives a message from a connection-mode or connectionless-mode socket. Note that raw sockets are not supported. More... | |
INT16 | simple_link_send (INT32 sd, const void *buf, INT32 len, INT32 flags, const sockaddr *to, INT32 tolen, INT32 opcode) |
This function is used to transmit a message to another socket. More... | |
INT16 | send (INT32 sd, const void *buf, INT32 len, INT32 flags) |
Write data to TCP socket This function is used to transmit a message to another socket. More... | |
INT16 | sendto (INT32 sd, const void *buf, INT32 len, INT32 flags, const sockaddr *to, socklen_t tolen) |
Write data to TCP socket This function is used to transmit a message to another socket. More... | |
INT16 | mdnsAdvertiser (UINT16 mdnsEnabled, CHAR *deviceServiceName, UINT16 deviceServiceNameLength) |
Set CC3000 in mDNS advertiser mode in order to advertise itself. More... | |
UINT16 | getmssvalue (INT32 sd) |
Returns the MSS value of a TCP connection according to the socket descriptor. More... | |
#define __FD_ZERO | ( | set | ) |
#define htonl | ( | A | ) |
#define htons | ( | A | ) |
#define SET_mDNS_ADD | ( | sockaddr | ) |
INT32 accept | ( | INT32 | sd, |
sockaddr * | addr, | ||
socklen_t * | addrlen | ||
) |
accept a connection on a socket: This function is used with connection-based socket types (SOCK_STREAM). It extracts the first connection request on the queue of pending connections, creates a new connected socket, and returns a new file descriptor referring to that socket. The newly created socket is not in the listening state. The original socket sd is unaffected by this call. The argument sd is a socket that has been created with socket(), bound to a local address with bind(), and is listening for connections after a listen(). The argument addr is a pointer to a sockaddr structure. This structure is filled in with the address of the peer socket, as known to the communications layer. The exact format of the address returned addr is determined by the socket's address family. The addrlen argument is a value-result argument: it should initially contain the size of the structure pointed to by addr, on return it will contain the actual length (in bytes) of the address returned.
accept
[in] | sd | socket descriptor (handle) |
[out] | addr | the argument addr is a pointer to a sockaddr structure This structure is filled in with the address of the peer socket, as known to the communications layer. determined. The exact format of the address returned addr is by the socket's address sockaddr. On this version only AF_INET is supported. This argument returns in network order. |
[out] | addrlen | the addrlen argument is a value-result argument: it should initially contain the size of the structure pointed to by addr. |
INT32 bind | ( | INT32 | sd, |
const sockaddr * | addr, | ||
INT32 | addrlen | ||
) |
assign a name to a socket This function gives the socket the local address addr. addr is addrlen bytes long. Traditionally, this is called when a socket is created with socket, it exists in a name space (address family) but has no name assigned. It is necessary to assign a local address before a SOCK_STREAM socket may receive connections.
bind
[in] | sd | socket descriptor (handle) |
[out] | addr | specifies the destination address. On this version only AF_INET is supported. |
[out] | addrlen | contains the size of the structure pointed to by addr. |
INT32 closesocket | ( | INT32 | sd | ) |
The socket function closes a created socket.
closesocket
sd | socket handle. |
INT32 connect | ( | INT32 | sd, |
const sockaddr * | addr, | ||
INT32 | addrlen | ||
) |
initiate a connection on a socket Function connects the socket referred to by the socket descriptor sd, to the address specified by addr. The addrlen argument specifies the size of addr. The format of the address in addr is determined by the address space of the socket. If it is of type SOCK_DGRAM, this call specifies the peer with which the socket is to be associated; this address is that to which datagrams are to be sent, and the only address from which datagrams are to be received. If the socket is of type SOCK_STREAM, this call attempts to make a connection to another socket. The other socket is specified by address, which is an address in the communications space of the socket. Note that the function implements only blocking behavior thus the caller will be waiting either for the connection establishment or for the connection establishment failure.
connect
[in] | sd | socket descriptor (handle) |
[in] | addr | specifies the destination addr. On this version only AF_INET is supported. |
[out] | addrlen | contains the size of the structure pointed to by addr |
INT16 gethostbyname | ( | CHAR * | hostname, |
UINT16 | usNameLen, | ||
UINT32 * | out_ip_addr | ||
) |
Get host IP by name. Obtain the IP Address of machine on network, by its name.
gethostbyname
[in] | hostname | host name |
[in] | usNameLen | name length |
[out] | out_ip_addr | This parameter is filled in with host IP address. In case that host name is not resolved, out_ip_addr is zero. |
UINT16 getmssvalue | ( | INT32 | sd | ) |
Returns the MSS value of a TCP connection according to the socket descriptor.
getmssvalue
[in] | sd | socket descriptor |
INT16 getsockopt | ( | INT32 | sd, |
INT32 | level, | ||
INT32 | optname, | ||
void * | optval, | ||
socklen_t * | optlen | ||
) |
set socket options This function manipulate the options associated with a socket. Options may exist at multiple protocol levels; they are always present at the uppermost socket level. When manipulating socket options the level at which the option resides and the name of the option must be specified. To manipulate options at the socket level, level is specified as SOL_SOCKET. To manipulate options at any other level the protocol number of the appropriate protocol controlling the option is supplied. For example, to indicate that an option is to be interpreted by the TCP protocol, level should be set to the protocol number of TCP; The parameters optval and optlen are used to access optval - use for setsockopt(). For getsockopt() they identify a buffer in which the value for the requested option(s) are to be returned. For getsockopt(), optlen is a value-result parameter, initially containing the size of the buffer pointed to by option_value, and modified on return to indicate the actual size of the value returned. If no option value is to be supplied or returned, option_value may be NULL.
getsockopt
[in] | sd | socket handle |
[in] | level | defines the protocol level for this option |
[in] | optname | defines the option name to Interrogate |
[out] | optval | specifies a value for the option |
[out] | optlen | specifies the length of the option value |
On this version the following two socket options are enabled: The only protocol level supported in this version is SOL_SOCKET (level).
INT16 HostFlowControlConsumeBuff | ( | INT16 | sd | ) |
if SEND_NON_BLOCKING not define - block until have free buffer becomes available, else return immediately with correct status regarding the buffers available.
HostFlowControlConsumeBuff
sd | socket descriptor |
INT32 listen | ( | INT32 | sd, |
INT32 | backlog | ||
) |
listen for connections on a socket The willingness to accept incoming connections and a queue limit for incoming connections are specified with listen(), and then the connections are accepted with accept. The listen() call applies only to sockets of type SOCK_STREAM The backlog parameter defines the maximum length the queue of pending connections may grow to.
listen
[in] | sd | socket descriptor (handle) |
[in] | backlog | specifies the listen queue depth. On this version backlog is not supported. |
INT16 mdnsAdvertiser | ( | UINT16 | mdnsEnabled, |
CHAR * | deviceServiceName, | ||
UINT16 | deviceServiceNameLength | ||
) |
Set CC3000 in mDNS advertiser mode in order to advertise itself.
mdnsAdvertiser
[in] | mdnsEnabled | flag to enable/disable the mDNS feature |
[in] | deviceServiceName | Service name as part of the published canonical domain name |
[in] | deviceServiceNameLength | Length of the service name - up to 32 chars |
INT16 recv | ( | INT32 | sd, |
void * | buf, | ||
INT32 | len, | ||
INT32 | flags | ||
) |
function receives a message from a connection-mode socket
recv
[in] | sd | socket handle |
[out] | buf | Points to the buffer where the message should be stored |
[in] | len | Specifies the length in bytes of the buffer pointed to by the buffer argument. |
[in] | flags | Specifies the type of message reception. On this version, this parameter is not supported. |
On this version, only blocking mode is supported.
INT16 recvfrom | ( | INT32 | sd, |
void * | buf, | ||
INT32 | len, | ||
INT32 | flags, | ||
sockaddr * | from, | ||
socklen_t * | fromlen | ||
) |
read data from socket function receives a message from a connection-mode or connectionless-mode socket. Note that raw sockets are not supported.
recvfrom
[in] | sd | socket handle |
[out] | buf | Points to the buffer where the message should be stored |
[in] | len | Specifies the length in bytes of the buffer pointed to by the buffer argument. |
[in] | flags | Specifies the type of message reception. On this version, this parameter is not supported. |
[in] | from | pointer to an address structure indicating the source address: sockaddr. On this version only AF_INET is supported. |
[in] | fromlen | source address tructure size |
On this version, only blocking mode is supported.
recvfrom
[in] | sd | socket handle |
[out] | buf | Points to the buffer where the message should be stored |
[in] | len | Specifies the length in bytes of the buffer pointed to by the buffer argument. |
[in] | flags | Specifies the type of message reception. On this version, this parameter is not supported. |
[in] | from | pointer to an address structure indicating the source address: sockaddr. On this version only AF_INET is supported. |
[in] | fromlen | source address structure size |
On this version, only blocking mode is supported.
INT16 select | ( | INT32 | nfds, |
fd_set * | readsds, | ||
fd_set * | writesds, | ||
fd_set * | exceptsds, | ||
struct timeval * | timeout | ||
) |
Monitor socket activity Select allow a program to monitor multiple file descriptors, waiting until one or more of the file descriptors become "ready" for some class of I/O operation.
select
[in] | nfds | the highest-numbered file descriptor in any of the three sets, plus 1. |
[out] | writesds | socket descriptors list for write monitoring |
[out] | readsds | socket descriptors list for read monitoring |
[out] | exceptsds | socket descriptors list for exception monitoring |
[in] | timeout | is an upper bound on the amount of time elapsed before select() returns. Null means infinity timeout. The minimum timeout is 5 milliseconds, less than 5 milliseconds will be set automatically to 5 milliseconds. |
If the timeout value set to less than 5ms it will automatically set to 5ms to prevent overload of the system
INT16 send | ( | INT32 | sd, |
const void * | buf, | ||
INT32 | len, | ||
INT32 | flags | ||
) |
Write data to TCP socket This function is used to transmit a message to another socket.
send
sd | socket handle |
buf | Points to a buffer containing the message to be sent |
len | message size in bytes |
flags | On this version, this parameter is not supported |
On this version, only blocking mode is supported.
INT16 sendto | ( | INT32 | sd, |
const void * | buf, | ||
INT32 | len, | ||
INT32 | flags, | ||
const sockaddr * | to, | ||
socklen_t | tolen | ||
) |
Write data to TCP socket This function is used to transmit a message to another socket.
sendto
sd | socket handle |
buf | Points to a buffer containing the message to be sent |
len | message size in bytes |
flags | On this version, this parameter is not supported |
to | pointer to an address structure indicating the destination address: sockaddr. On this version only AF_INET is supported. |
tolen | destination address structure size |
On this version, only blocking mode is supported.
INT16 setsockopt | ( | INT32 | sd, |
INT32 | level, | ||
INT32 | optname, | ||
const void * | optval, | ||
socklen_t | optlen | ||
) |
set socket options This function manipulate the options associated with a socket. Options may exist at multiple protocol levels; they are always present at the uppermost socket level. When manipulating socket options the level at which the option resides and the name of the option must be specified. To manipulate options at the socket level, level is specified as SOL_SOCKET. To manipulate options at any other level the protocol number of the appropriate protocol controlling the option is supplied. For example, to indicate that an option is to be interpreted by the TCP protocol, level should be set to the protocol number of TCP; The parameters optval and optlen are used to access optval - use for setsockopt(). For getsockopt() they identify a buffer in which the value for the requested option(s) are to be returned. For getsockopt(), optlen is a value-result parameter, initially containing the size of the buffer pointed to by option_value, and modified on return to indicate the actual size of the value returned. If no option value is to be supplied or returned, option_value may be NULL.
setsockopt
[in] | sd | socket handle |
[in] | level | defines the protocol level for this option |
[in] | optname | defines the option name to Interrogate |
[in] | optval | specifies a value for the option |
[in] | optlen | specifies the length of the option value |
On this version the following two socket options are enabled: The only protocol level supported in this version is SOL_SOCKET (level).
INT16 simple_link_recv | ( | INT32 | sd, |
void * | buf, | ||
INT32 | len, | ||
INT32 | flags, | ||
sockaddr * | from, | ||
socklen_t * | fromlen, | ||
INT32 | opcode | ||
) |
Read data from socket Return the length of the message on successful completion. If a message is too long to fit in the supplied buffer, excess bytes may be discarded depending on the type of socket the message is received from.
simple_link_recv
sd | socket handle |
buf | read buffer |
len | buffer length |
flags | indicates blocking or non-blocking operation |
from | pointer to an address structure indicating source address |
fromlen | source address structure size |
INT16 simple_link_send | ( | INT32 | sd, |
const void * | buf, | ||
INT32 | len, | ||
INT32 | flags, | ||
const sockaddr * | to, | ||
INT32 | tolen, | ||
INT32 | opcode | ||
) |
This function is used to transmit a message to another socket.
simple_link_send
sd | socket handle |
buf | write buffer |
len | buffer length |
flags | On this version, this parameter is not supported |
to | pointer to an address structure indicating destination address |
tolen | destination address structure size |
INT16 socket | ( | INT32 | domain, |
INT32 | type, | ||
INT32 | protocol | ||
) |
create an endpoint for communication The socket function creates a socket that is bound to a specific transport service provider. This function is called by the application layer to obtain a socket handle.
socket
domain | selects the protocol family which will be used for communication. On this version only AF_INET is supported |
type | specifies the communication semantics. On this version only SOCK_STREAM, SOCK_DGRAM, SOCK_RAW are supported |
protocol | specifies a particular protocol to be used with the socket IPPROTO_TCP, IPPROTO_UDP or IPPROTO_RAW are supported. |