Main header file for the mUPnP for C library.
This is the primary include file for applications using mUPnP for C. It provides access to all major UPnP functionality through a single include.
mUPnP for C is a development package that simplifies the creation of UPnP™ devices and control points by abstracting the underlying protocols (SSDP, SOAP, GENA, HTTP, HTTPU) and providing a clean, easy-to-use API.
Key Components
Control Point (Client) API
Control points discover and interact with UPnP devices on the network:
- mUpnpControlPoint - Main control point interface
- Device discovery via M-SEARCH (SSDP)
- Action invocation via SOAP
- Event subscription and notification (GENA)
Device (Server) API
Devices advertise services and respond to control point requests:
- mUpnpDevice - Device implementation interface
- Service advertisement via SSDP
- Action handling via SOAP
- Event notification to subscribers
Service and Action Model
Services contain actions and state variables:
- mUpnpService - Service container
- mUpnpAction - Remote procedure calls
- mUpnpStateVariable - Service state with optional eventing
Basic Usage
Control Point Example
printf("Device added: %s\n", udn);
}
}
int main() {
return 0;
}
void mupnp_controlpoint_delete(mUpnpControlPoint *ctrlPoint)
Destroy a control point and free all associated resources.
Definition controlpoint.c:123
bool mupnp_controlpoint_search(mUpnpControlPoint *ctrlPoint, const char *target)
Send an M-SEARCH multicast message to discover UPnP devices.
Definition controlpoint.c:740
bool mupnp_controlpoint_start(mUpnpControlPoint *ctrlPoint)
Activate the control point and start network listeners.
Definition controlpoint.c:164
bool mupnp_controlpoint_stop(mUpnpControlPoint *ctrlPoint)
Stop the control point and shut down network listeners.
Definition controlpoint.c:236
mUpnpControlPoint * mupnp_controlpoint_new(void)
Create a new control point instance.
Definition controlpoint.c:70
enum _mUpnpDeviceStatus mUpnpDeviceStatus
@ mUpnpDeviceStatusAdded
Definition controlpoint.h:72
#define mupnp_controlpoint_setdevicelistener(ctrlPoint, func)
Definition controlpoint.h:523
Definition controlpoint.h:85
Main header file for the mUPnP for C library.
Device Example
if (strcmp(name, "GetStatus") == 0) {
return true;
}
return false;
}
int main() {
mupnp_device_loaddescriptionfile(dev, "description.xml");
return 0;
}
mUpnpArgument * mupnp_action_getargumentbyname(mUpnpAction *action, const char *name)
Definition action.c:147
#define mupnp_action_getname(action)
Definition action.h:185
#define mupnp_argument_setvalue(arg, data)
Definition argument.h:252
mUpnpDevice * mupnp_device_new(void)
Create a new UPnP device instance.
Definition device.c:41
void mupnp_device_delete(mUpnpDevice *dev)
Delete a UPnP device and free all associated resources.
Definition device.c:95
bool mupnp_device_start(mUpnpDevice *dev)
Start a UPnP device and begin advertising on the network.
Definition device.c:1373
bool mupnp_device_stop(mUpnpDevice *dev)
Stop a UPnP device and cease network advertising.
Definition device.c:1439
void mupnp_device_setactionlistener(mUpnpDevice *dev, MUPNP_ACTION_LISTNER actionListner)
Definition device.c:1784
The generic UPnP device structure.
Definition device.h:122
Thread Safety
The mUPnP library is designed for multi-threaded environments:
- Most objects have internal mutexes for thread safety
- Control points should be locked when accessing device lists
- Listener callbacks may be invoked from multiple threads
- See individual function documentation for specific thread-safety notes
Platform Support
mUPnP for C supports multiple platforms:
- Linux/Unix (POSIX)
- Windows (Win32)
- macOS
- Embedded systems (ITRON, T-Engine, BTRON)
- Note
- UPnP™ is a certification mark of the UPnP™ Implementers Corporation.
- See also
- http://cybergarage.github.io/mupnp/ for documentation
-
https://github.com/cybergarage/mupnp for source code
- Version
- 3.0.2