Prosody generic: API: sm_udp_collector_create

Prototype Definition

int sm_udp_collector_create(struct sm_udp_collector_create_parms *dp)

Parameters

*dp
a structure of the following type:
typedef struct sm_udp_collector_create_parms {
	tSMCollectorId collector;				/* out */
	tSMModuleId module;					/* in */
	enum kSMCollectorType {
		kSMCollectorTypeIPv4,
		kSMCollectorTypeIPv6,
	} type;							/* in */
	struct in_addr address;					/* in */
	struct in6_addr ipv6_address;				/* in */
} SM_UDP_COLLECTOR_CREATE_PARMS;

Description

Allocates, on a specific module, a new UDP collector to receive incoming UDP data. If the call completes successfully, the parameter collector will be set to the identifier for that collector.

A collector is automatically allocated a port number for incoming UDP data, this information may be obtained from sm_collector_status().

This requires the module fromudp to have been downloaded.

Fields

collector
The newly created collector.
module
A value obtained from sm_open_module() which indicates the module where the collector to be allocated.
type
One of these values:
kSMCollectorTypeIPv4
The collector is to receive IPv4 packets
kSMCollectorTypeIPv6
The collector is to receive IPv6 packets
address
The address on which this UDP collector is to listen if type is kSMCollectorTypeIPv4.
ipv6_address
The address on which this UDP collector is to listen if type is kSMCollectorTypeIPv6.

Returns

0 if call completed successfully, otherwise a standard error such as:


This function is part of the Prosody generic API.