1 |
/* |
/* |
2 |
* Cisco 7200 (Predator) simulation platform. |
* Cisco router simulation platform. |
3 |
* Copyright (c) 2006 Christophe Fillot (cf@utc.fr) |
* Copyright (c) 2006 Christophe Fillot (cf@utc.fr) |
4 |
* |
* |
5 |
* Hypervisor routines. |
* Hypervisor routines. |
35 |
#define HSC_ERR_FILE 211 /* file error */ |
#define HSC_ERR_FILE 211 /* file error */ |
36 |
#define HSC_ERR_BAD_OBJ 212 /* Bad object */ |
#define HSC_ERR_BAD_OBJ 212 /* Bad object */ |
37 |
|
|
|
/* Hypervisor connection */ |
|
38 |
typedef struct hypervisor_conn hypervisor_conn_t; |
typedef struct hypervisor_conn hypervisor_conn_t; |
39 |
|
typedef struct hypervisor_cmd hypervisor_cmd_t; |
40 |
|
typedef struct hypervisor_module hypervisor_module_t; |
41 |
|
|
42 |
|
/* Hypervisor connection */ |
43 |
struct hypervisor_conn { |
struct hypervisor_conn { |
44 |
pthread_t tid; /* Thread identifier */ |
pthread_t tid; /* Thread identifier */ |
45 |
volatile int active; /* Connection is active ? */ |
volatile int active; /* Connection is active ? */ |
46 |
int client_fd; /* Client FD */ |
int client_fd; /* Client FD */ |
47 |
FILE *in,*out; /* I/O buffered streams */ |
FILE *in,*out; /* I/O buffered streams */ |
48 |
|
hypervisor_module_t *cur_module; /* Module of current command */ |
49 |
hypervisor_conn_t *next,**pprev; |
hypervisor_conn_t *next,**pprev; |
50 |
}; |
}; |
51 |
|
|
54 |
char *argv[]); |
char *argv[]); |
55 |
|
|
56 |
/* Hypervisor command */ |
/* Hypervisor command */ |
|
typedef struct hypervisor_cmd hypervisor_cmd_t; |
|
57 |
struct hypervisor_cmd { |
struct hypervisor_cmd { |
58 |
char *name; |
char *name; |
59 |
int min_param,max_param; |
int min_param,max_param; |
62 |
}; |
}; |
63 |
|
|
64 |
/* Hypervisor module */ |
/* Hypervisor module */ |
|
typedef struct hypervisor_module hypervisor_module_t; |
|
65 |
struct hypervisor_module { |
struct hypervisor_module { |
66 |
char *name; |
char *name; |
67 |
|
void *opt; |
68 |
hypervisor_cmd_t *cmd_list; |
hypervisor_cmd_t *cmd_list; |
69 |
hypervisor_module_t *next; |
hypervisor_module_t *next; |
70 |
}; |
}; |
90 |
/* Hypervisor VM debugging initialization */ |
/* Hypervisor VM debugging initialization */ |
91 |
extern int hypervisor_vm_debug_init(void); |
extern int hypervisor_vm_debug_init(void); |
92 |
|
|
|
/* Hypervisor C7200 initialization */ |
|
|
extern int hypervisor_c7200_init(void); |
|
|
|
|
|
/* Hypervisor C3600 initialization */ |
|
|
extern int hypervisor_c3600_init(void); |
|
|
|
|
|
/* Hypervisor C2691 initialization */ |
|
|
extern int hypervisor_c2691_init(void); |
|
|
|
|
|
/* Hypervisor C3725 initialization */ |
|
|
extern int hypervisor_c3725_init(void); |
|
|
|
|
|
/* Hypervisor C3745 initialization */ |
|
|
extern int hypervisor_c3745_init(void); |
|
|
|
|
93 |
/* Send a reply */ |
/* Send a reply */ |
94 |
int hypervisor_send_reply(hypervisor_conn_t *conn,int code,int done, |
int hypervisor_send_reply(hypervisor_conn_t *conn,int code,int done, |
95 |
char *format,...); |
char *format,...); |
104 |
void *hypervisor_find_object(hypervisor_conn_t *conn,char *name,int obj_type); |
void *hypervisor_find_object(hypervisor_conn_t *conn,char *name,int obj_type); |
105 |
|
|
106 |
/* Find a VM in the registry */ |
/* Find a VM in the registry */ |
107 |
void *hypervisor_find_vm(hypervisor_conn_t *conn,char *name,int vm_type); |
void *hypervisor_find_vm(hypervisor_conn_t *conn,char *name); |
108 |
|
|
109 |
/* Register a module */ |
/* Register a module */ |
110 |
hypervisor_module_t *hypervisor_register_module(char *name); |
hypervisor_module_t *hypervisor_register_module(char *name,void *opt); |
111 |
|
|
112 |
/* Register a list of commands */ |
/* Register a list of commands */ |
113 |
int hypervisor_register_cmd_list(hypervisor_module_t *module, |
int hypervisor_register_cmd_list(hypervisor_module_t *module, |
121 |
int hypervisor_stopsig(void); |
int hypervisor_stopsig(void); |
122 |
|
|
123 |
/* Hypervisor TCP server */ |
/* Hypervisor TCP server */ |
124 |
int hypervisor_tcp_server(int tcp_port); |
int hypervisor_tcp_server(char *ip_addr,int tcp_port); |
125 |
|
|
126 |
#endif |
#endif |