/[dynamips]/upstream/dynamips-0.2.6-RC2/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

Contents of /upstream/dynamips-0.2.6-RC2/hypervisor.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (show annotations)
Sat Oct 6 16:03:58 2007 UTC (16 years, 5 months ago) by dpavlin
Original Path: upstream/dynamips-0.2.6-RC1/hypervisor.h
File MIME type: text/plain
File size: 4043 byte(s)
import dynamips-0.2.6-RC1

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 /* Hypervisor VM debugging initialization */
88 extern int hypervisor_vm_debug_init(void);
89
90 /* Hypervisor C7200 initialization */
91 extern int hypervisor_c7200_init(void);
92
93 /* Hypervisor C3600 initialization */
94 extern int hypervisor_c3600_init(void);
95
96 /* Send a reply */
97 int hypervisor_send_reply(hypervisor_conn_t *conn,int code,int done,
98 char *format,...);
99
100 /* Find a module */
101 hypervisor_module_t *hypervisor_find_module(char *name);
102
103 /* Find a command in a module */
104 hypervisor_cmd_t *hypervisor_find_cmd(hypervisor_module_t *module,char *name);
105
106 /* Find an object in the registry */
107 void *hypervisor_find_object(hypervisor_conn_t *conn,char *name,int obj_type);
108
109 /* Find a VM in the registry */
110 void *hypervisor_find_vm(hypervisor_conn_t *conn,char *name,int vm_type);
111
112 /* Register a module */
113 hypervisor_module_t *hypervisor_register_module(char *name);
114
115 /* Register a list of commands */
116 int hypervisor_register_cmd_list(hypervisor_module_t *module,
117 hypervisor_cmd_t *cmd_list);
118
119 /* Register an array of commands */
120 int hypervisor_register_cmd_array(hypervisor_module_t *module,
121 hypervisor_cmd_t *cmd_array);
122
123 /* Stop hypervisor from sighandler */
124 int hypervisor_stopsig(void);
125
126 /* Hypervisor TCP server */
127 int hypervisor_tcp_server(int tcp_port);
128
129 #endif

  ViewVC Help
Powered by ViewVC 1.1.26