00001 /* SVN FILE INFO 00002 * $Revision: 560 $ : Last Committed Revision 00003 * $Date: 2010-08-30 15:09:20 -0700 (Mon, 30 Aug 2010) $ : Last Committed Date */ 00004 /*[ 00005 * Copyright (c) 2007 Integration Engineering Laboratory 00006 University of California, Davis 00007 * 00008 * Permission to use, copy, and distribute this software and its 00009 * documentation for any purpose with or without fee is hereby granted, 00010 * provided that the above copyright notice appear in all copies and 00011 * that both that copyright notice and this permission notice appear 00012 * in supporting documentation. 00013 * 00014 * Permission to modify the software is granted, but not the right to 00015 * distribute the complete modified source code. Modifications are to 00016 * be distributed as patches to the released version. Permission to 00017 * distribute binaries produced by compiling modified sources is granted, 00018 * provided you 00019 * 1. distribute the corresponding source modifications from the 00020 * released version in the form of a patch file along with the binaries, 00021 * 2. add special version identification to distinguish your version 00022 * in addition to the base release version number, 00023 * 3. provide your name and address as the primary contact for the 00024 * support of your modified version, and 00025 * 4. retain our contact information in regard to use of the base 00026 * software. 00027 * Permission to distribute the released version of the source code along 00028 * with corresponding source modifications in the form of a patch file is 00029 * granted with same provisions 2 through 4 for binary distributions. 00030 * 00031 * This software is provided "as is" without express or implied warranty 00032 * to the extent permitted by applicable law. 00033 ]*/ 00034 00035 #ifndef _MC_PLATFORM_H_ 00036 #define _MC_PLATFORM_H_ 00037 #include "acc.h" 00038 #include "ams.h" 00039 #include "barrier.h" 00040 #include "cmd_prompt.h" 00041 #include "config.h" 00042 #include "connection.h" 00043 #include "df.h" 00044 #include "libmc.h" 00045 #include "../mc_sync/sync_list.h" 00046 #include "../mc_list/list.h" 00047 #include "../security/asm.h" 00048 00049 struct mc_platform_s{ 00050 #ifdef _WIN32 00051 WSADATA wsaData; 00052 #endif 00053 int err; 00054 #ifdef MC_SECURITY 00055 int enable_security; 00056 #endif 00057 00058 char* hostname; 00059 unsigned short port; 00060 int initInterps; 00061 00062 /* These are the standard agency data structs. */ 00063 list_t* asm_message_queue; /* holds message_t data type */ 00064 #ifdef MC_SECURITY 00065 list_t* asm_queue; /* Holds encryption info for each remote hoste */ 00066 #endif 00067 list_t* message_queue; 00068 list_t* agent_queue; 00069 list_t* connection_queue; 00070 int agent_processing; /* This flag is set if the user calles the 00071 MC_AgentProcessingBegin() function */ 00072 00073 df_p df; 00074 ams_p ams; 00075 acc_p acc; 00076 cmd_prompt_p cmd_prompt; 00077 #ifdef MC_SECURITY 00078 mc_asm_p security_manager; 00079 #endif 00080 00081 list_t* syncList; 00082 list_t* barrier_queue; 00083 00084 listen_thread_arg_p listen_thread_arg; 00085 listen_thread_arg_p client_thread_arg; 00086 00087 int default_agentstatus; 00088 00089 int stack_size[MC_THREAD_ALL]; 00090 00091 ChOptions_t *interp_options; 00092 00093 /* MC Cond Signal System */ 00094 COND_T *MC_signal_cond; 00095 COND_T *MC_sync_cond; 00096 MUTEX_T *MC_signal_lock; 00097 MUTEX_T *MC_sync_lock; 00098 enum MC_Signal_e MC_signal; 00099 00100 /* MC Steer System */ 00101 enum MC_SteerCommand_e MC_steer_command; 00102 MUTEX_T *MC_steer_lock; 00103 COND_T *MC_steer_cond; 00104 00105 /* giant lock : Threads will pause if giant==0. 00106 * giant_lock and giant_cond protect giant. */ 00107 int giant; 00108 MUTEX_T *giant_lock; 00109 COND_T *giant_cond; 00110 00111 int quit; 00112 MUTEX_T *quit_lock; 00113 COND_T *quit_cond; 00114 int sockfd; /* File Descriptor for listen socket */ 00115 char private_key[1210]; // private key of agency 00116 00117 MCAgency_t agency; /* A pointer to the platform's agency structure */ 00118 00119 /* Need a linked list of Ch interpreters. */ 00120 list_t* interpreter_queue; 00121 00122 /* Are we using bluetooth? */ 00123 int bluetooth; 00124 }; 00125 typedef struct mc_platform_s mc_platform_t; 00126 typedef mc_platform_t* mc_platform_p; 00127 00128 mc_platform_p 00129 mc_platform_Initialize(MCAgency_t agency, ChOptions_t* ch_options); 00130 00131 int 00132 mc_platform_Destroy(mc_platform_p mc_platform); 00133 00134 ChInterp_t* interpreter_queue_CreateRetrieve( 00135 list_t *queue , ChOptions_t* interp_options); 00136 00137 list_t* mc_platform_GetQueue(mc_platform_p platform, enum MC_QueueIndex_e index); 00138 #endif