AddressToStr | HostToLong | HostToShort | LongToHost | SetSSL | ShortToHost | StrToAddress
ClientSocket | NetClient | NetLookup | NetSocket | Proxy
Converts an IPAddress structure to an IPAddress in dotted string form.
Parameter | Description |
---|---|
IPAddress | A pointer to the IPAddress structure. |
Converts an IPAddress structure to a string containing the IPAddress in dotted format. Please free the resulting string with FreeResource() once it is no longer required.
The IP address is returned as an allocated string.
Converts a 32 bit (unsigned) long from host to network byte order.
Parameter | Description |
---|---|
Value | Data in host byte order to be converted to network byte order |
Converts a 32 bit (unsigned) long from host to network byte order.
The long in network byte order
Converts a 16 bit (unsigned) word from host to network byte order.
Parameter | Description |
---|---|
Value | Data in host byte order to be converted to network byte order |
Converts a 16 bit (unsigned) word from host to network byte order.
The word in network byte order
Converts a 32 bit (unsigned) long from network to host byte order.
Parameter | Description |
---|---|
Value | Data in network byte order to be converted to host byte order |
Converts a 32 bit (unsigned) long from network to host byte order.
The Value in host byte order.
Alters SSL settings on an initialised NetSocket object.
Parameter | Description |
---|---|
NetSocket | The target NetSocket object. |
Command | Name of a command or option to set (case-sensitive, camel-case). |
Value | Value to set for the command or option. |
Use the SetSSL() function to adjust the SSL capabilities of a NetSocket object. The following commands are currently available:
If a failure occurs when executing a command, the execution of all further commands is aborted and the error code is returned immediately.
SetSSL() can also be used to check if SSL is supported in the current build, in which case ERR::NoSupport
will be the return value if all other arguments are NULL
.
Okay | Operation successful. |
---|---|
NoSupport | SSL support is disabled in this build. |
NullArgs | The NetSocket argument was not specified. |
Converts a 16 bit (unsigned) word from network to host byte order.
Parameter | Description |
---|---|
Value | Data in network byte order to be converted to host byte order |
Converts a 16 bit (unsigned) word from network to host byte order.
The Value in host byte order
Converts an IP Address in string form to an IPAddress structure.
Parameter | Description |
---|---|
String | A null-terminated string containing the IP Address in dotted format. |
Address | Must point to an IPAddress structure that will be filled in. |
Converts an IPv4 or an IPv6 address in string format to an IPAddress structure. The String
must be of form 1.2.3.4
(IPv4) or 2001:db8::1
(IPv6). IPv6 addresses are automatically detected by the presence of colons.
struct IPAddress addr; if (!StrToAddress("127.0.0.1", &addr)) { ... }
Okay | The Address was converted successfully. |
---|---|
Failed | The String was not a valid IP Address. |
NullArgs | Function call missing argument value(s) |
Address types for the IPAddress structure.
Name | Description |
---|---|
IPADDR::V4 | |
IPADDR::V6 |
Options for NetLookup
Name | Description |
---|---|
NLF::NO_CACHE | Contact the name service and do not use the local DNS cache. |
Name | Description |
---|---|
NSF::BROADCAST | Enable broadcast (UDP only). |
NSF::DISABLE_SERVER_VERIFY | Disable SSL certificate verification (for testing only). |
NSF::LOG_ALL | Print extra log messages. |
NSF::MULTI_CONNECT | Allow multiple connections from the same IP when in server mode. |
NSF::SERVER | Puts the socket into server mode. In this state the netsocket object will wait for incoming connections from clients. |
NSF::SSL | Use Secure Sockets Layer for all communication. |
NSF::SYNCHRONOUS | Use synchronous (blocking) network calls. |
NSF::UDP | Use UDP (connectionless datagram protocol) instead of TCP. |
NetSocket states
Name | Description |
---|---|
NTC::CONNECTED | There is an active connection at present. |
NTC::CONNECTING | A connection is being established. |
NTC::DISCONNECTED | There is no connection. |
NTC::HANDSHAKING | An SSL connection is being established. |
NTC::MULTISTATE | In server mode the NetSocket will be set to MULTISTATE to indicate one or more client connections. |
NTC::RESOLVING | The host name is being resolved. |
These error codes for certificate validation match the OpenSSL error codes (X509 definitions)
Name | Description |
---|---|
SCV::AKID_ISSUER_SERIAL_MISMATCH | |
SCV::AKID_SKID_MISMATCH | |
SCV::APPLICATION_VERIFICATION | |
SCV::CERT_CHAIN_TOO_LONG | |
SCV::CERT_HAS_EXPIRED | |
SCV::CERT_NOT_YET_VALID | |
SCV::CERT_REJECTED | |
SCV::CERT_REVOKED | |
SCV::CERT_SIGNATURE_FAILURE | |
SCV::CERT_UNTRUSTED | |
SCV::CRL_HAS_EXPIRED | |
SCV::CRL_NOT_YET_VALID | |
SCV::CRL_SIGNATURE_FAILURE | |
SCV::DEPTH_ZERO_SELF_SIGNED_CERT | |
SCV::ERROR_IN_CERT_NOT_AFTER_FIELD | |
SCV::ERROR_IN_CERT_NOT_BEFORE_FIELD | |
SCV::ERROR_IN_CRL_LAST_UPDATE_FIELD | |
SCV::ERROR_IN_CRL_NEXT_UPDATE_FIELD | |
SCV::INVALID_CA | |
SCV::INVALID_PURPOSE | |
SCV::KEYUSAGE_NO_CERTSIGN | |
SCV::OK | |
SCV::OUT_OF_MEM | |
SCV::PATH_LENGTH_EXCEEDED | |
SCV::SELF_SIGNED_CERT_IN_CHAIN | |
SCV::SUBJECT_ISSUER_MISMATCH | |
SCV::UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY | |
SCV::UNABLE_TO_DECRYPT_CERT_SIGNATURE | |
SCV::UNABLE_TO_DECRYPT_CRL_SIGNATURE | |
SCV::UNABLE_TO_GET_CRL | |
SCV::UNABLE_TO_GET_ISSUER_CERT | |
SCV::UNABLE_TO_GET_ISSUER_CERT_LOCALLY | |
SCV::UNABLE_TO_VERIFY_LEAF_SIGNATURE |
Field | Type | Description |
---|---|---|
Data | INT | 128-bit array for supporting both V4 (32-bit host order) and V6 (8-bit byte order) IP addresses. |
Type | IPADDR | Identifies the address Data value as a V4 or V6 address type. |
Port | INT | For UDP packets, identifies the client port number in host byte order. |