rpc.h 2.46 KB
Newer Older
1
2
/*
 * EMULAB-COPYRIGHT
Timothy Stack's avatar
   
Timothy Stack committed
3
 * Copyright (c) 2004, 2005 University of Utah and the Flux Group.
4
5
6
 * All rights reserved.
 */

Timothy Stack's avatar
   
Timothy Stack committed
7
8
9
10
11
#ifndef _event_sched_rpc_h
#define _event_sched_rpc_h

#include "event-sched.h"

12
#ifdef __cplusplus
Timothy Stack's avatar
   
Timothy Stack committed
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

#include <ulxmlrpcpp.h>  // always first header
#include <iostream>
#include <ulxr_tcpip_connection.h>  // first, don't move: msvc #include bug
#include <ulxr_ssl_connection.h> 
#include <ulxr_http_protocol.h> 
#include <ulxr_requester.h>
#include <ulxr_value.h>
#include <ulxr_except.h>
#include <emulab_proxy.h>

int RPC_invoke(char *method,
	       emulab::EmulabResponse *er_out,
	       emulab::spa_attr_t tag,
	       ...);

struct rpc_conn_proto {
	ulxr::Connection *conn;
	ulxr::Protocol *proto;
};

struct r_rpc_data {
	const char *certpath;
	const char *host;
	unsigned short port;
	int refcount;
	struct rpc_conn_proto conn_proto;
	pthread_mutex_t mutex;
};

extern struct r_rpc_data rpc_data;

45
46
#endif

Timothy Stack's avatar
   
Timothy Stack committed
47
48
49
#define DEFAULT_RPC_PORT 3069

#define ROBOT_TIMEOUT 10 * 60 /* seconds */
50

Timothy Stack's avatar
   
Timothy Stack committed
51
52
#ifdef __cplusplus
extern "C" {
53
54
#endif

Timothy Stack's avatar
   
Timothy Stack committed
55
56
extern const char *topography_name; // XXX temporary

Timothy Stack's avatar
   
Timothy Stack committed
57
58
59
60
typedef enum {
	ES_UNKNOWN,
	ES_ACTIVATING,
	ES_ACTIVE,
61
	ES_MODIFY_RESWAP,
Timothy Stack's avatar
   
Timothy Stack committed
62
63
} expt_state_t;
	
Timothy Stack's avatar
   
Timothy Stack committed
64
65
66
67
int RPC_init(const char *certpath, const char *host, unsigned short port);
int RPC_grab(void);
void RPC_drop(void);

Timothy Stack's avatar
   
Timothy Stack committed
68
int RPC_metadata(char *pid, char *eid);
Timothy Stack's avatar
   
Timothy Stack committed
69
int RPC_waitforrobots(event_handle_t handle, char *pid, char *eid);
Timothy Stack's avatar
   
Timothy Stack committed
70
expt_state_t RPC_expt_state(char *pid, char *eid);
Timothy Stack's avatar
   
Timothy Stack committed
71
int RPC_waitforactive(char *pid, char *eid);
Timothy Stack's avatar
   
Timothy Stack committed
72
int RPC_notifystart(char *pid, char *eid, char *timeline, int set_or_clear);
Timothy Stack's avatar
   
Timothy Stack committed
73
74
75
int RPC_agentlist(event_handle_t handle, char *pid, char *eid);
int RPC_grouplist(event_handle_t handle, char *pid, char *eid);
int RPC_eventlist(char *pid, char *eid,
Timothy Stack's avatar
   
Timothy Stack committed
76
		  event_handle_t handle, address_tuple_t tuple);
Timothy Stack's avatar
   
Timothy Stack committed
77

Timothy Stack's avatar
   
Timothy Stack committed
78
79
80
extern int SetExpPath(const char *path);
extern int AddUserEnv(char *name, char *value);

Timothy Stack's avatar
   
Timothy Stack committed
81
82
83
extern int AddAgent(event_handle_t handle,
		    char *vname, char *vnode, char *nodeid,
		    char *ipaddr, char *type);
84

Timothy Stack's avatar
   
Timothy Stack committed
85
extern int AddGroup(event_handle_t handle, char *groupname, char *agentname);
86

Timothy Stack's avatar
   
Timothy Stack committed
87
88
extern int AddEvent(event_handle_t handle, address_tuple_t tuple,
		    char *exidx, char *ftime, char *objname, char *exargs,
89
		    char *objtype, char *evttype, char *parent, char *triggertype);
90

Timothy Stack's avatar
   
Timothy Stack committed
91
92
93
94
95
96
extern int AddRobot(event_handle_t handle,
		    struct agent *agent,
		    double init_x,
		    double init_y,
		    double init_orientation);

Timothy Stack's avatar
   
Timothy Stack committed
97
extern const char *XMLRPC_ROOT;
Timothy Stack's avatar
   
Timothy Stack committed
98
99
100
101
102
#ifdef __cplusplus
}
#endif

#endif