/[dynamips]/upstream/dynamips-0.2.6-RC3/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 /upstream/dynamips-0.2.6-RC3/hypervisor.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4 - (hide annotations)
Sat Oct 6 16:06:49 2007 UTC (16 years, 5 months ago) by dpavlin
File MIME type: text/plain
File size: 4280 byte(s)
dynamips-0.2.6-RC3

1 dpavlin 1 /*
2     * Cisco 7200 (Predator) simulation platform.
3     * 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     /* Hypervisor connection */
39     typedef struct hypervisor_conn hypervisor_conn_t;
40     struct hypervisor_conn {
41     pthread_t tid; /* Thread identifier */
42     volatile int active; /* Connection is active ? */
43     int client_fd; /* Client FD */
44     FILE *in,*out; /* I/O buffered streams */
45     hypervisor_conn_t *next,**pprev;
46     };
47    
48     /* Hypervisor command handler */
49     typedef int (*hypervisor_cmd_handler)(hypervisor_conn_t *conn,int argc,
50     char *argv[]);
51    
52     /* Hypervisor command */
53     typedef struct hypervisor_cmd hypervisor_cmd_t;
54     struct hypervisor_cmd {
55     char *name;
56     int min_param,max_param;
57     hypervisor_cmd_handler handler;
58     hypervisor_cmd_t *next;
59     };
60    
61     /* Hypervisor module */
62     typedef struct hypervisor_module hypervisor_module_t;
63     struct hypervisor_module {
64     char *name;
65     hypervisor_cmd_t *cmd_list;
66     hypervisor_module_t *next;
67     };
68    
69     /* Hypervisor NIO initialization */
70     extern int hypervisor_nio_init(void);
71    
72     /* Hypervisor NIO bridge initialization */
73     extern int hypervisor_nio_bridge_init(void);
74    
75     /* Hypervisor Frame-Relay switch initialization */
76     extern int hypervisor_frsw_init(void);
77    
78     /* Hypervisor ATM switch initialization */
79     extern int hypervisor_atmsw_init(void);
80    
81     /* Hypervisor Ethernet switch initialization */
82     extern int hypervisor_ethsw_init(void);
83    
84     /* Hypervisor VM initialization */
85     extern int hypervisor_vm_init(void);
86    
87 dpavlin 2 /* Hypervisor VM debugging initialization */
88     extern int hypervisor_vm_debug_init(void);
89    
90 dpavlin 1 /* Hypervisor C7200 initialization */
91     extern int hypervisor_c7200_init(void);
92    
93     /* Hypervisor C3600 initialization */
94     extern int hypervisor_c3600_init(void);
95    
96 dpavlin 4 /* Hypervisor C2691 initialization */
97     extern int hypervisor_c2691_init(void);
98    
99     /* Hypervisor C3725 initialization */
100     extern int hypervisor_c3725_init(void);
101    
102     /* Hypervisor C3745 initialization */
103     extern int hypervisor_c3745_init(void);
104    
105 dpavlin 1 /* Send a reply */
106     int hypervisor_send_reply(hypervisor_conn_t *conn,int code,int done,
107     char *format,...);
108    
109     /* Find a module */
110     hypervisor_module_t *hypervisor_find_module(char *name);
111    
112     /* Find a command in a module */
113     hypervisor_cmd_t *hypervisor_find_cmd(hypervisor_module_t *module,char *name);
114    
115     /* Find an object in the registry */
116     void *hypervisor_find_object(hypervisor_conn_t *conn,char *name,int obj_type);
117    
118     /* Find a VM in the registry */
119     void *hypervisor_find_vm(hypervisor_conn_t *conn,char *name,int vm_type);
120    
121     /* Register a module */
122     hypervisor_module_t *hypervisor_register_module(char *name);
123    
124     /* Register a list of commands */
125     int hypervisor_register_cmd_list(hypervisor_module_t *module,
126     hypervisor_cmd_t *cmd_list);
127    
128     /* Register an array of commands */
129     int hypervisor_register_cmd_array(hypervisor_module_t *module,
130     hypervisor_cmd_t *cmd_array);
131    
132     /* Stop hypervisor from sighandler */
133     int hypervisor_stopsig(void);
134    
135     /* Hypervisor TCP server */
136     int hypervisor_tcp_server(int tcp_port);
137    
138     #endif

  ViewVC Help
Powered by ViewVC 1.1.26