Network Callbacks
The application supplies network callbacks so SK400VOP can use the target platform's networking implementation without embedding platform-specific socket code in the signaling stack.
The callback interface follows Berkeley/BSD Sockets concepts and compatible address structures. On platforms that use different APIs, the application should provide a mapping layer with equivalent behavior.
| Callback | Purpose |
|---|---|
SOCK_CREATE_CB | Creates a socket or equivalent network endpoint (socket() semantics). |
SOCK_CLOSE_CB | Closes a socket or network endpoint (close() / closesocket() semantics). |
SOCK_BIND_CB | Binds an endpoint to a local address and port (bind() semantics). |
SOCK_SENDTO_CB | Sends a datagram or packet to a destination (sendto() semantics). |
SOCK_RECEIVEFROM_CB | Receives a datagram or packet and source address (recvfrom() semantics). |
SOCK_IOCTL_CB | Performs socket-control operations (ioctl() / ioctlsocket() semantics). |
INET_PTON_CB | Converts a presentation-format IPv4/IPv6 address to binary form (inet_pton() semantics). |
INET_NTOP_CB | Converts a binary IPv4/IPv6 address to presentation format (inet_ntop() semantics). |
NET_MATCH_SUBNET_CB | Determines whether two addresses belong to the same local subnet according to the application's network configuration. |
NET_GET_LOCAL_ADDR_CB | Returns the local/interface address that SK400VOP should use for the requested network path. This is the local address, not the public NAT mapping. |
NET_GET_MAPPED_ADDR_CB | Returns the externally mapped/public address corresponding to a local interface when NAT traversal is required. The application may implement STUN or another environment-specific mapping method. |
NET_RESOLVE_HOST_CB | Resolves a hostname/FQDN to an IPv4 or IPv6 address in the form expected by the stack. |
Local address versus mapped address
These two callbacks serve different purposes and should not return the same value automatically:
NET_GET_LOCAL_ADDR_CBidentifies the address assigned to, or selected for, the local interface.NET_GET_MAPPED_ADDR_CBidentifies the externally visible address when a NAT device translates the local endpoint.
On a host with a directly routable address, the application can choose to return equivalent addresses when that matches the deployment, but the callbacks remain logically distinct.
Platform notes
Windows uses functions such as closesocket() and ioctlsocket(), while POSIX-like systems commonly use close() and ioctl(). The callback layer exists so application code can hide those differences from SK400VOP.
For dual-stack targets, ensure the conversion, bind and resolver callbacks preserve the address family and structure layout expected by the supplied SK400VOP headers.