Scroll to navigation

LIBSCAMPERCTRL(3) Library Functions Manual LIBSCAMPERCTRL(3)

NAME

libscamperctrlscamper control library

LIBRARY

scamper control library (libscamperctrl -lscamperctrl)

SYNOPSIS

#include <libscamperctrl.h>

DESCRIPTION

The libscamperctrl library provides an application programming interface (API) to execute measurements using the control mechanisms available for a set of external scamper(1) processes.

SCAMPER_CTRL_T ROUTINES

scamper_ctrl_t * (scamper_ctrl_cb_t cb)
Allocate a control structure for managing a set of scamper(1) instances. The caller must pass a callback function, which must be defined as follows:

void (scamper_inst_t *inst, uint8_t type, scamper_task_t *task, const void *data, size_t len)

() calls this function every time there is an event. It passes a pointer to the scamper instance that the event is in relation to in the first parameter. The second parameter identifies the type of the event, which could be one of the following.

int (scamper_ctrl_t *ctrl, struct timeval *to)
Wait for events from the collection of scamper(1) instances. If the timeout parameter is null, then the wait function will block indefinitely until an event occurs. Otherwise, this function will return after the length of time specified in the timeout parameter has elapsed, or after it has called the callback function for an event.

void (scamper_ctrl_t *ctrl)
Cleanup the resources associated with managing the set of scamper(1) instances.

int (scamper_ctrl_t *ctrl)
Returns 0 if there is at least one active scamper instance. Returns non-zero if there are no active scamper instances.

void (scamper_ctrl_t *ctrl, void *param)
Associates the specified pointer with the scamper_ctrl_t structure.

void * (const scamper_ctrl_t *ctrl)
Returns the current value of the parameter set with scamper_ctrl_param_set().

const char * (const scamper_ctrl_t *ctrl)
Returns a pointer to the contents of the error buffer held internally by scamper_ctrl_t, which is set when a function associated with the scamper_ctrl_t encounters an error.

SCAMPER_MUX_T ROUTINES

scamper_mux_t * (scamper_ctrl_t *ctrl, const char *path)
Adds a sc_remoted(1) mux socket found at the specified path in the filesystem to the scamper_ctrl_t.

scamper_mux_t * (scamper_ctrl_t *ctrl, const char *ip, uint16_t port)
Add a sc_remoted(1) mux socket found at the specified IP address and port to the scamper_ctrl_t. Note that sc_remoted(1) currently has no ability to provide a mux socket itself on IP socket, but it is possible to forward a sc_remoted(1) mux socket from a unix domain socket to an IP socket using socat(1) or ssh(1).

SCAMPER_VPSET_T ROUTINES

scamper_vpset_t * (const scamper_mux_t *mux)
Return an opaque scamper_vpset_t pointer that refers to a set of scamper_vp_t. The contents of a given scamper_vpset_t does not change for the lifetime of the program. The caller must use scamper_vpset_free() to deallocate the scamper_vpset_t once it is no longer needed.

void (scamper_vpset_t *vps)
Free the opaque scamper_vpset_t.

size_t (const scamper_vpset_t *vps)
Return the number of scamper_vp_t items in the scamper_vpset_t.

scamper_vp_t * (const scamper_vpset_t *vps, size_t i)
Return the opaque scamper_vp_t referred to at the given index. Valid index values are between zero and scamper_vpset_vp_count() - 1, inclusive, for the specified scamper_vpset_t.

SCAMPER_VP_T ROUTINES

scamper_vp_t * scamper_vp_use(scamper_vp_t *vp)
Advise libscamperctrl(3) that the programmer is keeping a copy of the vp in their program.

void (scamper_vp_t *vp)
Free vp resources, if the programmer previously called () to advise libscamperctrl(3) that the programmer would also be keeping a copy of a vp pointer.

const char * (const scamper_vp_t *vp)
Returns a pointer to a string that contains the full name of a remote scamper vantage point, or NULL.

const char * (const scamper_vp_t *vp)
Returns a pointer to a string that contains the short name of a remote scamper vantage point, or NULL.

const char * (const scamper_vp_t *vp)
Returns a pointer to a string that contains the IPv4 address observed by sc_remoted(1).

const char * (const scamper_vp_t *vp)
Returns a pointer to a string that contains an ASN value associated with the IPv4 address of the VP.

const char * (const scamper_vp_t *vp)
Returns a pointer to a string that contains the IPv6 address observed by sc_remoted(1).

const char * (const scamper_vp_t *vp)
Returns a pointer to a string that contains an ASN value associated with the IPv6 address of the VP.

const char * (const scamper_vp_t *vp)
Returns a pointer to a string that contains, by convention, an uppercase ISO-3166 2-letter country code associated with the VP.

const char * (const scamper_vp_t *vp)
Returns a pointer to a string that contains, by convention, an uppercase ISO-3166 state code associated with the VP.

const char * (const scamper_vp_t *vp)
Returns a pointer to a string that contains the name of the city or town where the VP is located.

const char * (const scamper_vp_t *vp)
Returns a pointer to a string that contains, by convention, the latitude and longitude values where the VP is located, separated by a comma.

const char * (const scamper_vp_t *vp)
Returns a pointer to a string that contains, by convention, an uppercase 3-letter IATA airport code closes to the VP.

size_t (const scamper_vp_t *vp)
Returns the number of tags associated with the VP.

const char * (const scamper_vp_t *vp, size_t i)
Returns a pointer to a string containing the specified tag, or NULL. Tag numbers are zero-indexed, so valid tag numbers are between zero and scamper_vp_tagc_get() - 1, inclusive, for the specified scamper_vpset_t.

SCAMPER_INST_T ROUTINES

scamper_inst_t * (scamper_ctrl_t *ctrl, scamper_vp_t *vp)
Attach to a remote scamper instance specified in the scamper_vp_t.

scamper_inst_t * (scamper_ctrl_t *ctrl, const char *str)
Attach to a remote scamper instance connected to an sc_remoted(1) mux at the specified path. If the mux socket is in the file system at /path/to/mux, and the name of the VP to connect is hlz2-nz, then the string parameter should be /path/to/mux/hlz2-nz. Internally, the name of the VP can be either the short name or full name of the VP, and scamper_inst_muxvp() will match the first one.

scamper_inst_t * (scamper_ctrl_t *ctrl, const scamper_attp_t *attp, const char *path)
Attach to a local scamper instance via the unix domain socket at the supplied path. Attach parameters for local scamper instances can be supplied via the scamper_attp_t parameter.

scamper_inst_t * (scamper_ctrl_t *ctrl, const scamper_attp_t *attp, const char *addr, uint16_t port)
Attach to a local scamper instance via the supplied IP address and port. Attach parameters for local scamper instances can be supplied via the scamper_attp_t parameter.

scamper_inst_t * (scamper_ctrl_t *ctrl, const char *path)
Attach to a remote scamper instance via the instance-specific unix domain socket at the supplied path. The remote scamper instance is connected to the local machine using a sc_remoted(1) process.

void (scamper_inst_t *inst)
Disconnect and then free the resources associated with the instance.

scamper_task_t * (scamper_inst_t *inst, const char *cmd)
Issue a command on the supplied instance. The returned task pointer uniquely identifes the task. If a programmer wishes to keep a copy of the task pointer in the process, they must call scamper_task_use() to keep a reference, and then call scamper_task_free() once done with it.

int (scamper_inst_t *inst)
Send a done command, which will cause the scamper(1) instance to disconnect when it has returned all completed measurements.

void (scamper_inst_t *inst, void *param)
Associates the specified pointer with the scamper_inst_t structure.

void * (const scamper_inst_t *inst)
Returns the current value of the parameter set with scamper_inst_param_set().

int (const scamper_inst_t *inst)
Returns non-zero if the instance is associated with a sc_remoted(1) mux.

int (const scamper_inst_t *inst)
Returns non-zero if the instance is associated with a local scamper instance directly reachable via an IP address.

int (const scamper_inst_t *inst)
Returns non-zero if the instance is associated with a local scamper instance directly reachable via a unix domain socket.

int (const scamper_inst_t *inst)
Returns non-zero if the instance is associated with a remote scamper instance reachable via a unix domain socket from sc_remoted(1).

const char * (const scamper_inst_t *inst)
Returns a pointer to a string that contains the name of the instance. For instances from a mux, it will be the name of the VP. For other types of instance, the name will be derived from how the instance is reached.

uint8_t (const scamper_inst_t *inst)
Returns one of the following values, identifying the type of instance:

const char * (const scamper_inst_t *inst)
Returns a pointer to the contents of the error buffer held internally by scamper_inst_t, which is set when a function associated with the scamper_inst_t encounters an error.

scamper_ctrl_t * (const scamper_inst_t *inst)
Returns a pointer to the scamper_ctrl_t associated with the supplied scamper_inst_t.

scamper_vp_t * (const scamper_inst_t *inst)
Returns a pointer to the scamper_vp_t associated with the supplied scamper_inst_t, if the scamper_inst_t were created via an sc_remoted(3) mux.

SCAMPER_TASK_T ROUTINES

int (scamper_task_t *task)
Issue a halt command for the task. If the command has not been issued to scamper yet, then no DATA object will be returned; otherwise, a DATA object will be returned.

void (scamper_task_t *task)
Free task resources, if the programmer previously called scamper_task_use() to advise libscamperctrl(3) that the programmer would also be keeping a copy of a task pointer.

scamper_task_t * (scamper_task_t *task)
Advise libscamperctrl(3) that the programmer is keeping a copy of the task in their program.

SCAMPER_ATTP_T ROUTINES

scamper_attp_t * (void)
Allocate an opaque scamper_attp_t structure that can be used with scamper_inst_unix() and scamper_inst_inet() to specify parameters to a local scamper during the attach phase. It is the responsibility of the caller to free the scamper_attp_t once it is no longer needed with scamper_attp_free()

void (scamper_attp_t *attp)
Free the scamper_attp_t structure.

void (scamper_attp_t *attp, uint32_t id)
Set the list ID parameter that will be passed to scamper during the attach phase.

int (scamper_attp_t *attp, char *name)
Set the list name parameter that will be passed to scamper during the attach phase. This function returns zero on success.

int (scamper_attp_t *attp, char *descr)
Set the list description parameter that will be passed to scamper during the attach phase. This function returns zero on success.

int (scamper_attp_t *attp, char *monitor)
Set the list monitor name parameter that will be passed to scamper during the attach phase. This function returns zero on success.

void (scamper_attp_t *attp, uint32_t id)
Set the cycle ID parameter that will be passed to scamper during the attach phase.

void (scamper_attp_t *attp, uint32_t priority)
Set the cycle priority parameter that will be passed to scamper during the attach phase. This parameter controls the mixing rate of tasks from the associated source relative to other sources also managed by the same scamper process.

SEE ALSO

scamper(1), sc_remoted(1), libscamperfile(3),

M. Luckie, Scamper: a Scalable and Extensible Packet Prober for Active Measurement of the Internet, Proc. ACM/SIGCOMM Internet Measurement Conference 2010.

AUTHORS

libscamperctrl was written by Matthew Luckie <mjl@luckie.org.nz>.

April 10, 2026 Linux 6.4.0-150700.53.52-default