/[dynamips]/trunk/hypervisor.h
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/hypervisor.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 12 - (hide annotations)
Sat Oct 6 16:45:40 2007 UTC (16 years, 6 months ago) by dpavlin
File MIME type: text/plain
File size: 4020 byte(s)
make working copy

1 dpavlin 1 /*
2 dpavlin 7 * Cisco router simulation platform.
3 dpavlin 1 * Copyright (c) 2006 Christophe Fillot (cf@utc.fr)
4     *
5     * Hypervisor routines.
6     */
7    
8     #ifndef __HYPERVISOR_H__
9     #define __HYPERVISOR_H__
10    
11     /* Default TCP port */
12     #define HYPERVISOR_TCP_PORT 7200
13    
14     /* Maximum listening socket number */
15     #define HYPERVISOR_MAX_FD 10
16    
17     /* Maximum tokens per line */
18     #define HYPERVISOR_MAX_TOKENS 16
19    
20     /* Hypervisor status codes */
21     #define HSC_INFO_OK 100 /* ok */
22     #define HSC_INFO_MSG 101 /* informative message */
23     #define HSC_INFO_DEBUG 102 /* debugging message */
24     #define HSC_ERR_PARSING 200 /* parse error */
25     #define HSC_ERR_UNK_MODULE 201 /* unknown module */
26     #define HSC_ERR_UNK_CMD 202 /* unknown command */
27     #define HSC_ERR_BAD_PARAM 203 /* bad number of parameters */
28     #define HSC_ERR_INV_PARAM 204 /* invalid parameter */
29     #define HSC_ERR_BINDING 205 /* binding error */
30     #define HSC_ERR_CREATE 206 /* unable to create object */
31     #define HSC_ERR_DELETE 207 /* unable to delete object */
32     #define HSC_ERR_UNK_OBJ 208 /* unknown object */
33     #define HSC_ERR_START 209 /* unable to start object */
34     #define HSC_ERR_STOP 210 /* unable to stop object */
35     #define HSC_ERR_FILE 211 /* file error */
36     #define HSC_ERR_BAD_OBJ 212 /* Bad object */
37    
38 dpavlin 11 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 dpavlin 1 /* Hypervisor connection */
43     struct hypervisor_conn {
44 dpavlin 11 pthread_t tid; /* Thread identifier */
45     volatile int active; /* Connection is active ? */
46     int client_fd; /* Client FD */
47     FILE *in,*out; /* I/O buffered streams */
48     hypervisor_module_t *cur_module; /* Module of current command */
49 dpavlin 1 hypervisor_conn_t *next,**pprev;
50     };
51    
52     /* Hypervisor command handler */
53     typedef int (*hypervisor_cmd_handler)(hypervisor_conn_t *conn,int argc,
54     char *argv[]);
55    
56     /* Hypervisor command */
57     struct hypervisor_cmd {
58     char *name;
59     int min_param,max_param;
60     hypervisor_cmd_handler handler;
61     hypervisor_cmd_t *next;
62     };
63    
64     /* Hypervisor module */
65     struct hypervisor_module {
66     char *name;
67 dpavlin 11 void *opt;
68 dpavlin 1 hypervisor_cmd_t *cmd_list;
69     hypervisor_module_t *next;
70     };
71    
72     /* Hypervisor NIO initialization */
73     extern int hypervisor_nio_init(void);
74    
75     /* Hypervisor NIO bridge initialization */
76     extern int hypervisor_nio_bridge_init(void);
77    
78     /* Hypervisor Frame-Relay switch initialization */
79     extern int hypervisor_frsw_init(void);
80    
81     /* Hypervisor ATM switch initialization */
82     extern int hypervisor_atmsw_init(void);
83    
84     /* Hypervisor Ethernet switch initialization */
85     extern int hypervisor_ethsw_init(void);
86    
87     /* Hypervisor VM initialization */
88     extern int hypervisor_vm_init(void);
89    
90 dpavlin 2 /* Hypervisor VM debugging initialization */
91     extern int hypervisor_vm_debug_init(void);
92    
93 dpavlin 1 /* Send a reply */
94     int hypervisor_send_reply(hypervisor_conn_t *conn,int code,int done,
95     char *format,...);
96    
97     /* Find a module */
98     hypervisor_module_t *hypervisor_find_module(char *name);
99    
100     /* Find a command in a module */
101     hypervisor_cmd_t *hypervisor_find_cmd(hypervisor_module_t *module,char *name);
102    
103     /* Find an object in the registry */
104     void *hypervisor_find_object(hypervisor_conn_t *conn,char *name,int obj_type);
105    
106     /* Find a VM in the registry */
107 dpavlin 11 void *hypervisor_find_vm(hypervisor_conn_t *conn,char *name);
108 dpavlin 1
109     /* Register a module */
110 dpavlin 11 hypervisor_module_t *hypervisor_register_module(char *name,void *opt);
111 dpavlin 1
112     /* Register a list of commands */
113     int hypervisor_register_cmd_list(hypervisor_module_t *module,
114     hypervisor_cmd_t *cmd_list);
115    
116     /* Register an array of commands */
117     int hypervisor_register_cmd_array(hypervisor_module_t *module,
118     hypervisor_cmd_t *cmd_array);
119    
120     /* Stop hypervisor from sighandler */
121     int hypervisor_stopsig(void);
122    
123     /* Hypervisor TCP server */
124 dpavlin 11 int hypervisor_tcp_server(char *ip_addr,int tcp_port);
125 dpavlin 1
126     #endif

  ViewVC Help
Powered by ViewVC 1.1.26