?? hypervisor.h
字號:
/* * Cisco 7200 (Predator) simulation platform. * Copyright (c) 2006 Christophe Fillot (cf@utc.fr) * * Hypervisor routines. */#ifndef __HYPERVISOR_H__#define __HYPERVISOR_H__/* Default TCP port */#define HYPERVISOR_TCP_PORT 7200/* Maximum listening socket number */#define HYPERVISOR_MAX_FD 10/* Maximum tokens per line */#define HYPERVISOR_MAX_TOKENS 16/* Hypervisor status codes */#define HSC_INFO_OK 100 /* ok */#define HSC_INFO_MSG 101 /* informative message */#define HSC_INFO_DEBUG 102 /* debugging message */#define HSC_ERR_PARSING 200 /* parse error */#define HSC_ERR_UNK_MODULE 201 /* unknown module */#define HSC_ERR_UNK_CMD 202 /* unknown command */#define HSC_ERR_BAD_PARAM 203 /* bad number of parameters */#define HSC_ERR_INV_PARAM 204 /* invalid parameter */#define HSC_ERR_BINDING 205 /* binding error */#define HSC_ERR_CREATE 206 /* unable to create object */#define HSC_ERR_DELETE 207 /* unable to delete object */#define HSC_ERR_UNK_OBJ 208 /* unknown object */#define HSC_ERR_START 209 /* unable to start object */#define HSC_ERR_STOP 210 /* unable to stop object */#define HSC_ERR_FILE 211 /* file error */#define HSC_ERR_BAD_OBJ 212 /* Bad object *//* Hypervisor connection */typedef struct hypervisor_conn hypervisor_conn_t;struct hypervisor_conn { pthread_t tid; /* Thread identifier */ volatile int active; /* Connection is active ? */ int client_fd; /* Client FD */ FILE *in,*out; /* I/O buffered streams */ hypervisor_conn_t *next,**pprev;};/* Hypervisor command handler */typedef int (*hypervisor_cmd_handler)(hypervisor_conn_t *conn,int argc, char *argv[]);/* Hypervisor command */typedef struct hypervisor_cmd hypervisor_cmd_t;struct hypervisor_cmd { char *name; int min_param,max_param; hypervisor_cmd_handler handler; hypervisor_cmd_t *next;};/* Hypervisor module */typedef struct hypervisor_module hypervisor_module_t;struct hypervisor_module { char *name; hypervisor_cmd_t *cmd_list; hypervisor_module_t *next;};/* Hypervisor NIO initialization */extern int hypervisor_nio_init(void);/* Hypervisor NIO bridge initialization */extern int hypervisor_nio_bridge_init(void);/* Hypervisor Frame-Relay switch initialization */extern int hypervisor_frsw_init(void);/* Hypervisor ATM switch initialization */extern int hypervisor_atmsw_init(void);/* Hypervisor Ethernet switch initialization */extern int hypervisor_ethsw_init(void);/* Hypervisor VM initialization */extern int hypervisor_vm_init(void);/* Hypervisor VM debugging initialization */extern int hypervisor_vm_debug_init(void);/* 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);/* Send a reply */int hypervisor_send_reply(hypervisor_conn_t *conn,int code,int done, char *format,...);/* Find a module */hypervisor_module_t *hypervisor_find_module(char *name);/* Find a command in a module */hypervisor_cmd_t *hypervisor_find_cmd(hypervisor_module_t *module,char *name);/* Find an object in the registry */void *hypervisor_find_object(hypervisor_conn_t *conn,char *name,int obj_type);/* Find a VM in the registry */void *hypervisor_find_vm(hypervisor_conn_t *conn,char *name,int vm_type);/* Register a module */hypervisor_module_t *hypervisor_register_module(char *name);/* Register a list of commands */int hypervisor_register_cmd_list(hypervisor_module_t *module, hypervisor_cmd_t *cmd_list);/* Register an array of commands */int hypervisor_register_cmd_array(hypervisor_module_t *module, hypervisor_cmd_t *cmd_array);/* Stop hypervisor from sighandler */int hypervisor_stopsig(void);/* Hypervisor TCP server */int hypervisor_tcp_server(int tcp_port);#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -