API/ickP2p
Contents |
Overview
The ickP2P protocol is used for automatic announcement and discovery on the local network all device to device communication is handled through the ickP2P protocol. It's a C component with a C API, provided as static library libickp2p.a and the include file ickP2p.h. The general principle when used on third party platform is that you build it for the architecture you want to use and bundle it with your application.
Basic usage
Each ickstream device is defined by its UUID and logically represented by an ickstream context of type ickP2pContext_t. I.e. an application can host several logical devices by managing multiple contexts.
The life-cycle of a context is
- Creation - Define context with basic features
- Setup - Add additional features and define callbacks
- Activation - Activate the context, i.e. announce the device and react on messages
- Deletion - Remove the device and clean up
Data Types
The ickP2P library makes use of the following data types:
- ickP2pContext_t - ickStream context descriptor
- ickErrcode_t - Library error code
- ickP2pLibState_t - Library state
- ickP2pDeviceState_t - Device state
- ickP2pServicetype_t - ickStream service type
- ickP2pMessageFlag_t - Flags for message callback
- ickUpnpNames_t - Definitions of UPnP announcement strings
List of API functions
The following API functions are global, i.e. do affect all contexts.
Versions
- ickP2pGetVersion - Get version of library
- ickP2pGitVersion - Get full git version of library
String conversion
- ickStrError - Convert library error code to human readable string
- ickLibState2Str - Convert context status code to human readable string
- ickLibDeviceState2Str - Convert device status code to human readable string
Logging
- ickP2pSetLogging - Setup log level and default logging facility
- ickP2pGetLogContent - get content of in-memory logging of default logging facility
- ickP2pSetLogFacility - Set a user logging facility
Context life-cycle
- ickP2pCreate - Create an ickstream device context
- ickP2pResume - Activate an ickstream device context
- ickP2pSuspend - Suspend an ickstream device context
- ickP2pEnd - Delete an ickstream device context
Context configuration
Interfaces and connections
- ickP2pAddInterface - Add a network interface
- ickP2pUpnpLoopback - Enable context loopback
- ickP2pSetConnectMatrix - Set a user defined connection matrix
Callbacks for device discovery and message handling
- ickP2pRegisterDiscoveryCallback - Register a device discovery callback
- ickP2pRemoveDiscoveryCallback - Remove a device discovery callback
- ickP2pRegisterMessageCallback - Register a message receiver callback
- ickP2pRemoveMessageCallback - Remove a message receiver callback
Inquiring context features
- ickP2pGetState - Get context state
- ickP2pGetName - Get friendly device name of context
- ickP2pGetDeviceUuid - Get device UUID of context
- ickP2pGetServices - Get ickstream services as announced by context
- ickP2pGetUpnpLoopback - Get loopback status of context
- ickP2pGetUpnpFolder - Get path to folder served by context
- ickP2pGetLifetime - Get SSDP life time as announced by context
- ickP2pGetLwsPort - Get libwebsockets server port of context
- ickP2pGetUpnpPort - Get SSDP port of context
- ickP2pGetBootId - Get SSDP boot id as announced by context
- ickP2pGetConfigId - Get SSDP config id as announced by context
- ickP2pGetOsName - Get operating system string as announced by context
Get features of discovered devices
- ickP2pGetDeviceName - Get friendly name
- ickP2pGetDeviceServices - Get announced services
- ickP2pGetDeviceLocation - Get UPnP location string
- ickP2pGetDeviceLifetime - Get announced lifetime
- ickP2pGetDeviceUpnpVersion - Get announced UPnP service version
- ickP2pGetDeviceConnect - Get device connection state
- ickP2pGetDeviceMessagesPending - Get number of unsent messages for device
- ickP2pGetDeviceMessagesSent - Get number of messages sent to device
- ickP2pGetDeviceMessagesReceived - Get number of messages received from device
- ickP2pGetDeviceTimeCreated - Get time stamp of device discovery
- ickP2pGetDeviceTimeConnected - Get time stamp of device connection
Messaging
- ickP2pSendMsg - Send a message
Debugging
- ickP2pSetHttpDebugging - Enable or disable HTTP debugging interface
- ickP2pGetDebugInfo - Get debugging info as string
- ickP2pGetDebugPath - Get debugging URI for a discovered device