📄 macedon-conv-utils.h
字号:
//Copyright (c) 2004, Charles Killian, Adolfo Rodriguez, Dejan Kostic, Sooraj Bhat, and Amin Vahdat//All rights reserved.////Redistribution and use in source and binary forms, with or without//modification, are permitted provided that the following conditions are met://// * Redistributions of source code must retain the above copyright// notice, this list of conditions and the following disclaimer.// * Redistributions in binary form must reproduce the above copyright// notice, this list of conditions and the following disclaimer in// the documentation and/or other materials provided with the// distribution.// * Neither the names of Duke University nor The University of// California, San Diego, nor the names of its contributors// may be used to endorse or promote products derived from// this software without specific prior written permission.////THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE//IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE//DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE//FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL//DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR//SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE//USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.//#define GEN_TRACE#define PROFILE_AGENTS#define ADOLFO_TRANSPORTS #include "macedon-defines.h"//#define ALLINONEHDR#define API_num_types 15#define AD_IP 3#define AD_HASH 4#define LOCK_UNSPECIFIED 0#define LOCK_NONE 1#define LOCK_READ 2#define LOCK_WRITE 3static char * API_types[API_num_types] ={ "create_group", "join", "leave", "route", "routeIP", "multicast", "anycast", "collect", "notify", "error", "downcall_ext", "upcall_ext", "init", "status_change", "transport_error"};static char *API_prototype[API_num_types] ={ "macedon_create_group(macedon_key groupID)", "macedon_join(macedon_key groupID)", "macedon_leave(macedon_key groupID)", "macedon_route(macedon_key dest, char *msg, int size, int transport)", "macedon_routeIP(macedon_key dest, char *msg, int size, int transport)", "macedon_multicast(macedon_key groupID, char *msg, int size, int transport)", "macedon_anycast(macedon_key groupID, char *msg, int size, int transport)", "macedon_collect(macedon_key groupID, char *msg, int size, int transport)", "macedon_notify(int type, int size, int *neighbors)", "macedon_error(int type, int neighbor)", "actual_downcall_ext(int operation, void *arg)", "actual_upcall_ext(int operation, void *arg)", "macedon_init()", "macedon_status_change(int status)", "macedon_transport_error(int transport_error, int dest_addr, int port, int known_lost)"};static char *API_protoparams[API_num_types] ={ "(macedon_key groupID)", "(macedon_key groupID)", "(macedon_key groupID)", "(macedon_key dest, char *msg, int size, int transport)", "(macedon_key dest, char *msg, int size, int transport)", "(macedon_key groupID, char *msg, int size, int transport)", "(macedon_key groupID, char *msg, int size, int transport)", "(macedon_key groupID, char *msg, int size, int transport)", "(int type, int size, int *neighbors)", "(int type, int neighbor)", "(int operation, void *arg)", "(int operation, void *arg)", "()", "(int status)", "(int transport_error, int dest_addr, int port, int known_lost)"};static char *API_params[API_num_types] ={ "(groupID)", "(groupID)", "(groupID)", "(dest, msg, size, transport)", "(dest, msg, size, transport)", "(groupID, msg, size, transport)", "(groupID, msg, size, transport)", "(groupID, msg, size, transport)", "(type, size, neighbors)", "(type, neighbor)", "(operation, arg)", "(operation, arg)", "()", "(status)", "(transport_error, dest_addr, port, known_lost)"};static char *API_returns[API_num_types] ={ "int", "void", "void", "int", "int", "int", "int", "int", "void", "void", "int", "int", "void", "int", "int"};static int API_sendsdata[API_num_types] ={ 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0};static int API_unicast[API_num_types] ={ 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};static int API_needslocking[API_num_types] ={ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1};#define AUTOEXT_num_types 2/* Determines which direction ext calls it applies to */#define UP 0#define DOWN 1#define BOTH 2static char* ext_function_numbers[AUTOEXT_num_types] ={ "AUTOEXT_STATUS_CHANGE", "AUTOEXT_TRANSPORT_ERROR"};static char* ext_commands[AUTOEXT_num_types] ={ "macedon_status_change((int)arg)", "macedon_transport_error(((transport_error_struct*)arg)->transport_error, ((transport_error_struct*)arg)->dest_addr, ((transport_error_struct*)arg)->port, ((transport_error_struct*)arg)->known_lost)"};static int ext_direction[AUTOEXT_num_types] ={ UP, UP};static char *empty = " ";struct decl;typedef struct neigh_type { struct neigh_type *next; char *name; char *simple_name; char *size; char *class; struct decl *fields;} neighbor_type;typedef struct mf { struct mf *next; char *field_name; char *field_nickname; char *field_type; char *field_size; char *field_init; int field_dupe; neighbor_type *neighbor;} message_field;typedef struct con { struct con *next; char *constant_name; char *constant_simple_name;} constant;typedef struct tran { char *under; char *over; struct tran *next; char *type; int port; int queue; int threads;} transport;typedef struct m { struct m *next; char *message_name; char *simple_name; int num_fields; message_field *fields; transport *message_transport;} message;message *lookup_message(char *);typedef struct st { struct st *next; char *base_state_name; char *state_name; char *state_hint_name; int status;} state;typedef struct nt { struct nt *next; char *type_name; char *simple_name;} node_type;typedef struct decl { struct decl *next; char *name; char *type; int exported; int array; char *size; char *size2; char *size3; int failure; neighbor_type *neighbor; int nodump;} declare;typedef struct obvar { struct obvar *next; char *var; char *replace; char *fieldname; int count;} object_replace;typedef struct timdemux { struct timdemux *next; char *state; int notted; char *func; int locking;} timer_demux;typedef struct tim { struct tim *next; int timer_period; char *timer_name; char *timer_timeout; timer_demux *demux;} timer;timer * lookup_timer(char *);char *conv_name_timer(char *name);char *macedon_decipher(char *w);char *proc_object(char *in);typedef struct apidemux { struct apidemux *next; char *api; char *state; int notted; char *func; char *func2; int locking; int API_index;} api_demux;typedef struct msgdemux { struct msgdemux *next; char* msgfunc;} msg_demux;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -