Commit a0c63082 authored by Leigh B Stoller's avatar Leigh B Stoller

Merge branch 'master' of git-public.flux.utah.edu:/flux/git/emulab-devel

parents 9edc2757 6b65cda3
......@@ -4,6 +4,13 @@
# All rights reserved.
#
#
# NB: Any changes to this document should be reflected in the Wiki page:
# http://users.emulab.net/trac/emulab/wiki/EventAPI
#
The Emulab event system API:
* event_register: Register with the testbed event system
#include <event.h>
......@@ -68,6 +75,7 @@
successful, 0 otherwise. Should only be called by single-threaded
programs.
* event_stop_main: Force event_main to return
#include <event.h>
......@@ -78,6 +86,7 @@
main loop to return, either to check for a completion condition or
to handle other, non event related processing.
* event_notify: Send an event notification
#include <event.h>
......@@ -133,14 +142,17 @@
#include <event.h>
event_notification_t event_notification_alloc(event_handle_t handle,
char *host,
event_type_t type);
Allocate an event notification. The HOST parameter specifies
the hostname of the node that should receive the notification,
or EVENT_HOST_ANY if the notification should go to all hosts.
The TYPE parameter specifies the event type. Returns
a pointer to an event notification structure if the operation
address_tuple_t tuple);
Allocate an event notification destined for a particular target.
The TUPLE parameter describes the target of the notification.
It contains a set of strings for a standard set of Emulab attributes
including the Emulab site and host, the project and experiment names,
the target object type and name, and the event type, group and timeline.
All are optional and will be given default "any" values if not specified
by the caller.
Returns a pointer to an event notification structure if the operation
is successful, 0 otherwise.
......@@ -155,6 +167,17 @@
operation is successful, 0 otherwise.
* event_notification_clone: create a (deep) copy of a notification
event_notification_t
event_notification_clone(event_handle_t handle,
event_notification_t notification);
Create an exact copy of NOTIFICATION.
Returns a pointer to an event notification structure if the operation
is successful, 0 otherwise.
* event_notification_get_*: Get an attribute from an event notification
#include <event.h>
......@@ -181,6 +204,12 @@
char *name,
char *buffer,
int length);
int event_notification_get_opaque_length(event_handle_t handle,
event_notification_t notification,
char *name)
int event_notification_get_string_length(event_handle_t handle,
event_notification_t notification,
char *name)
Get the attribute with name NAME from the event notification
NOTIFICATION.
......@@ -192,6 +221,49 @@
For _opaque and _string: Writes LENGTH bytes into *BUFFER and
returns non-zero if the named attribute is found, 0 otherwise.
The _length functions return the length of the named attribute,
and can be used to size buffers for subsequent get_* calls.
* event_notification_get_<tuple-arg>: extract notification tuple info
int event_notification_get_site(event_handle_t handle,
event_notification_t notification,
void *buffer,
int length);
int event_notification_get_host(event_handle_t handle,
event_notification_t notification,
void *buffer,
int length);
int event_notification_get_expt(event_handle_t handle,
event_notification_t notification,
void *buffer,
int length);
int event_notification_get_objtype(event_handle_t handle,
event_notification_t notification,
void *buffer,
int length);
int event_notification_get_objname(event_handle_t handle,
event_notification_t notification,
void *buffer,
int length);
int event_notification_get_eventtype(event_handle_t handle,
event_notification_t notification,
void *buffer,
int length);
int event_notification_get_group(event_handle_t handle,
event_notification_t notification,
void *buffer,
int length);
int event_notification_get_timeline(event_handle_t handle,
event_notification_t notification,
void *buffer,
int length);
Convenience functions for extracting subscription attributes from a
notification. Wrappers for event_notification_get_string using the
specific NAME value.
* event_notification_put_*: Add an attribute to an event notification
......@@ -220,13 +292,12 @@
Add an attribute with name NAME to the event notification
NOTIFICATION. For _double, _int32, _int64, and _string: The value
is specified in VALUE. For _opaque: The value is specified
in the buffer BUFFER which has length LENGTH. Returns non-zero if
the operation is successful, 0 otherwise.
is specified in VALUE (strings are null-terminated). For _opaque:
The value is specified in the buffer BUFFER which has length LENGTH.
Returns non-zero if the operation is successful, 0 otherwise.
* event_notification_attr_remove: Remove an attribute from an event
notification
* event_notification_remove: Remove an attribute from an event notification
#include <event.h>
......@@ -245,25 +316,38 @@
event_subscription_t event_subscribe(event_handle_t handle,
event_notify_callback_t callback,
event_type_t type,
address_tuple_t tuple,
void *data);
Subscribe to events of type TYPE. Event notifications that match
TYPE will be passed to the callback function CALLBACK; DATA is
an arbitrary pointer that will be passed to the callback function.
Callback functions are of the form
Subscribe to events matching the information in TUPLE, arranging for
CALLBACK to be called with DATA as an argument when an event occurs.
Returns a pointer to an event subscription structure if the operation
is successful, 0 otherwise.
The information in TUPLE is used to create a pubsub boolean expression
that is a conjunction of all the tuple elements. DATA is an arbitrary
pointer that will be passed to the callback function. CALLBACK functions
are of the form:
void callback(event_handle_t handle,
event_notification_t notification,
char *host,
event_type_t type,
void *data);
where HANDLE is the handle to the event server, NOTIFICATION is the
event notification, HOST and TYPE are the respective attributes of
the event notification, and DATA is the arbitrary pointer passed to
event_subscribe. Returns a pointer to an event
subscription structure if the operation is successful, 0 otherwise.
event notification, and DATA is the arbitrary pointer passed to
event_subscribe. The various event_notification_get_* functions can
be applied to the notification to extract information.
* event_unsubscribe: Clear a subscription for an event
#include <event.h>
int event_unsubscribe(event_handle_t handle, event_subscription_t es);
Unregister an interest in the specified subscription. ES is a subscription
object returned from a previous event_subscribe call.
* event_poll: Poll for new events
......@@ -274,6 +358,7 @@
Polls for new events. Calls callbacks for all pending events. Does
not block - simply processes events that are currently queued.
* event_poll_blocking: Poll for new events
#include <event.h>
......@@ -281,10 +366,10 @@
int event_poll_blocking(event_handle_t handle, unsigned int timeout);
Same as event_poll, but blocks waiting for an event. Times out
after the given amount of time (which is in millseconds), or doesn't time
after the given amount of time (which is in milliseconds), or doesn't time
out if 0 is given.
IMPORTANT: elvin uses timeouts internally. So, this function does
NOT guarantee that when it returns, either an event has been
recieved or your timeout has passed. This should not be much of
received or your timeout has passed. This should not be much of
a problem, but you have been warned!
......@@ -671,8 +671,7 @@ sub Create($$$$$$)
$sliver_uuid = $vnode->uuid();
$resource_id = $vnode->node_id();
$hostname = GeniUtil::FindHostname($vnode->node_id());
$sshdport = $vnode->sshdport()
if (!defined($vnode->jailip()));
$sshdport = $vnode->sshdport();
}
else {
$hrn = "${PGENIDOMAIN}." . $node->node_id();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment