Changeset 18058
- Timestamp:
- 01/03/15 18:26:23 (10 years ago)
- Location:
- trunk/FACT++/dim
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/dim/README_v20.txt
r15282 r18058 1 1 2 DIM version 20r 7Release Notes2 DIM version 20r11 Release Notes 3 3 4 4 Notes 1 and 2 for Unix Users only … … 17 17 Dns </dev/null >& dns.log & 18 18 19 NOTE 3: The Version Number service provided by servers is now set to 2007. 19 NOTE 3: The Version Number service provided by servers is now set to 2011. 20 21 24/10/2014 22 Changes for version 2011: 23 - Increased the Max. num of connections for DNS and servers to 16384 (from 8192) 24 - Increased also slightly the DNS hash table 25 26 27 17/09/2014 28 Changes for version 2010: 29 - When a client connects to a server using the IP Address, instead of IP name, 30 a reverse lookup "validity" test is no longer performed. 31 - Fixed the Error reporting for tcpip connections, messages like: 32 "(ERROR) Client Connecting to XXX on YYY: Success" 33 should no longer exist. 34 - The "C" version can now be called directly from C++ using only dis.h or dic.h 35 instead of dis.hxx or dic.hxx. 36 (several const definitions and "extern "C" added in included prototypes) 37 38 39 17/07/2014 40 Changes for version 2009: 41 - Tried to fix more "Invalid Service ID" messages when creating/deleting services/commands in a server. 42 (By protecting the service/command creation/destruction in C++) 43 - Fixed a problem for Raspberry Pi (where "char" is "unsigned char" by default) 44 - The feature of increasing the maximum nember of connections stopped working with glibc 2.19. 45 Fixed. 46 20 47 21 48 05/04/2013 -
trunk/FACT++/dim/WebDID/did.js
r14939 r18058 99 99 { 100 100 storeServices.load(); 101 serviceInfo .setVisible(1);101 serviceInfoArea.setVisible(1); 102 102 commandInfoArea.setVisible(0); 103 serviceInfo .update("");103 serviceInfoArea.update(""); 104 104 } 105 105 106 var serviceInfo = Ext.create('Ext.Panel', {106 var serviceInfoArea = Ext.create('Ext.Panel', { 107 107 layout: 'fit', 108 108 id: 'details-panel', … … 112 112 autoScroll: true, 113 113 border: false, 114 html: '' 115 }); 116 114 html: '', 115 tools: [{ 116 type: 'gear', 117 id: 'update', 118 handler: function(e, toolEl, panel, tc) { 119 UpdateButton = tc; 120 if(UpdateService) 121 { 122 UpdateService = 0; 123 tc.setType('refresh'); 124 // tc.show(); 125 //console.log("changed icon 1", UpdateService); 126 } 127 else 128 { 129 UpdateService = 1; 130 tc.setType('gear'); 131 // tc.show(); 132 //console.log("changed icon 2", UpdateService); 133 } 134 } 135 }] 136 }); 137 138 var serviceButton = Ext.create('Ext.Button', { 139 text: 'Stop Updating', 140 margin: '5 5 5 5', 141 handler: function() { 142 //console.log('changed icon'); 143 // var pattern = commandData.getRawValue(); 144 // query(pattern, -1); 145 } 146 }); 147 /* 148 var serviceInfoArea = Ext.create('Ext.form.Panel', { 149 layout: 'vbox', 150 id: 'svc-details-panel', 151 title: 'Service Info', 152 width: 580, 153 // flex: 3, 154 // autoScroll: true, 155 border: false, 156 // html: 'Command test' 157 align:'stretch', 158 tools: [{ 159 type: 'gear', 160 handler: function(e, toolEl, panel, tc) { 161 UpdateButton = tc; 162 if(UpdateService) 163 { 164 UpdateService = 0; 165 tc.setType('refresh'); 166 // tc.show(); 167 //console.log("changed icon 1", UpdateService); 168 } 169 else 170 { 171 UpdateService = 1; 172 tc.setType('gear'); 173 // tc.show(); 174 doGetService(); 175 //console.log("changed icon 2", UpdateService); 176 } 177 } 178 }], 179 items: [serviceButton,serviceInfo] 180 }); 181 */ 117 182 var commandInfo = Ext.create('Ext.Panel', { 118 183 layout: 'fit', … … 164 229 }); 165 230 166 var service InfoArea = Ext.create('Ext.form.Panel', {231 var serviceCommandArea = Ext.create('Ext.form.Panel', { 167 232 layout: 'vbox', 168 233 // title: 'Service Info', … … 170 235 region: 'east', 171 236 align:'stretch', 172 items: [serviceInfo , commandInfoArea]237 items: [serviceInfoArea, commandInfoArea] 173 238 }); 174 239 /* … … 200 265 var OldNnodes = 0; 201 266 var OldNSearch = -1; 267 var UpdateService = 1; 268 var UpdateButton = 0; 269 270 202 271 function poll() 203 272 { … … 274 343 function doGetService() 275 344 { 276 getService(LastService, LastId); 345 if(LastService != "") 346 getService(LastService, LastId); 277 347 } 278 348 function getService(name, id) … … 285 355 { 286 356 forceUpdate = 1; 357 UpdateService = 1; 358 if(UpdateButton) 359 UpdateButton.setType('gear'); 287 360 LastService = name; 288 361 LastId = id; … … 304 377 CurrService = name1; 305 378 requestNumber = requestNumber + 1; 306 HTTPPacket.open( "GET", "/didServiceData.json/src?dimservice="+name1+"&id=src&reqNr="+requestNumber+"&reqId="+randomNumber+"&force="+forceUpdate, true ); 307 HTTPPacket.send( null ); 379 if(UpdateService) 380 { 381 HTTPPacket.open( "GET", "/didServiceData.json/src?dimservice="+name1+"&id=src&reqNr="+requestNumber+"&reqId="+randomNumber+"&force="+forceUpdate, true ); 382 HTTPPacket.send( null ); 383 } 308 384 } 309 385 function process() 310 386 { 311 serviceInfo .update("Updating - state "+HTTPPacket.readyState+"...");387 serviceInfoArea.update("Updating - state "+HTTPPacket.readyState+"..."); 312 388 if ( HTTPPacket.readyState != 4 ) 313 389 return; … … 320 396 if(forceUpdate != -1) 321 397 { 322 serviceInfo.update(HTTPPacket.responseText); 323 serviceInfo.setVisible(1); 324 commandInfoArea.setVisible(0); 398 // if(UpdateService) 399 // { 400 serviceInfoArea.update(HTTPPacket.responseText); 401 serviceInfoArea.setVisible(1); 402 commandInfoArea.setVisible(0); 403 // } 325 404 } 326 405 else 327 406 { 328 407 commandInfo.update(HTTPPacket.responseText); 329 serviceInfo .setVisible(0);408 serviceInfoArea.setVisible(0); 330 409 commandInfoArea.setVisible(1); 331 410 } … … 526 605 minSize: 100, 527 606 maxSize: 600, 528 items: [service InfoArea]607 items: [serviceCommandArea] 529 608 } 530 609 ], -
trunk/FACT++/dim/WebDID/index.html
r14939 r18058 5 5 <link rel="icon" href="favicon.ico" type="image/x-icon"> 6 6 <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> 7 <link rel="stylesheet" type="text/css" href="ext-4. 1.1a/resources/css/ext-all.css" />7 <link rel="stylesheet" type="text/css" href="ext-4.2.1.883/resources/css/ext-all.css" /> 8 8 9 9 <!-- GC --> 10 10 11 <script type="text/javascript" src="ext-4. 1.1a/ext-all.js"></script>11 <script type="text/javascript" src="ext-4.2.1.883/ext-all.js"></script> 12 12 <script type="text/javascript" src="did.js"></script> 13 13 </head> -
trunk/FACT++/dim/dim/dic.h
r14575 r18058 21 21 22 22 /* Routine definition */ 23 #ifdef __cplusplus 24 extern "C" { 25 #define __CXX_CONST const 26 #else 27 #define __CXX_CONST 28 #endif 23 29 24 _DIM_PROTOE( unsigned dic_info_service, ( char *service_name, int req_type,30 _DIM_PROTOE( unsigned dic_info_service, (__CXX_CONST char *service_name, int req_type, 25 31 int req_timeout, void *service_address, 26 32 int service_size, void (*usr_routine)(void*, void*, int*), 27 33 dim_long tag, void *fill_addr, int fill_size) ); 28 _DIM_PROTOE( unsigned dic_info_service_stamped, ( char *service_name, int req_type,34 _DIM_PROTOE( unsigned dic_info_service_stamped, (__CXX_CONST char *service_name, int req_type, 29 35 int req_timeout, void *service_address, 30 36 int service_size, void (*usr_routine)(void*, void*, int*), 31 37 dim_long tag, void *fill_addr, int fill_size) ); 32 _DIM_PROTOE( int dic_cmnd_callback, ( char *service_name, void *service_address,38 _DIM_PROTOE( int dic_cmnd_callback, (__CXX_CONST char *service_name, void *service_address, 33 39 int service_size, void (*usr_routine)(void*, int*), 34 40 dim_long tag) ); 35 _DIM_PROTOE( int dic_cmnd_service, ( char *service_name, void *service_address,41 _DIM_PROTOE( int dic_cmnd_service, (__CXX_CONST char *service_name, void *service_address, 36 42 int service_size) ); 37 43 _DIM_PROTOE( void dic_change_address, (unsigned service_id, void *service_address, 38 44 int service_size) ); 39 45 _DIM_PROTOE( void dic_release_service, (unsigned service_id) ); 40 _DIM_PROTOE( int dic_find_service, ( char *service_name) );41 _DIM_PROTOE( int dic_get_id, ( char *name) );46 _DIM_PROTOE( int dic_find_service, (__CXX_CONST char *service_name) ); 47 _DIM_PROTOE( int dic_get_id, (__CXX_CONST char *name) ); 42 48 _DIM_PROTOE( int dic_get_quality, (unsigned service_id) ); 43 49 _DIM_PROTOE( int dic_get_timestamp, (unsigned service_id, int *secs, int *milisecs) ); … … 53 59 _DIM_PROTOE( int dic_get_server_pid, (int *pid ) ); 54 60 61 #ifdef __cplusplus 62 #undef __CXX_CONST 63 } 64 #endif 65 55 66 #endif 56 67 -
trunk/FACT++/dim/dim/dim.h
r15282 r18058 14 14 #include "dim_common.h" 15 15 16 #define DIM_VERSION_NUMBER 20 0716 #define DIM_VERSION_NUMBER 2011 17 17 18 18 … … 483 483 484 484 /* PROTOTYPES */ 485 #ifdef __cplusplus 486 extern "C" { 487 #define __CXX_CONST const 488 #else 489 #define __CXX_CONST 490 #endif 485 491 486 492 /* DNA */ 487 493 _DIM_PROTOE( int dna_start_read, (int conn_id, int size) ); 488 494 _DIM_PROTOE( void dna_test_write, (int conn_id) ); 489 _DIM_PROTOE( int dna_write, (int conn_id, void *buffer, int size) );490 _DIM_PROTOE( int dna_write_nowait, (int conn_id, void *buffer, int size) );491 _DIM_PROTOE( int dna_open_server, ( char *task, void (*read_ast)(), int *protocol,495 _DIM_PROTOE( int dna_write, (int conn_id, __CXX_CONST void *buffer, int size) ); 496 _DIM_PROTOE( int dna_write_nowait, (int conn_id, __CXX_CONST void *buffer, int size) ); 497 _DIM_PROTOE( int dna_open_server, (__CXX_CONST char *task, void (*read_ast)(), int *protocol, 492 498 int *port, void (*error_ast)()) ); 493 499 _DIM_PROTOE( int dna_get_node_task, (int conn_id, char *node, char *task) ); 494 _DIM_PROTOE( int dna_open_client, ( char *server_node,char *server_task, int port,500 _DIM_PROTOE( int dna_open_client, (__CXX_CONST char *server_node, __CXX_CONST char *server_task, int port, 495 501 int server_protocol, void (*read_ast)(), void (*error_ast)(), SRC_TYPES src_type )); 496 502 _DIM_PROTOE( int dna_close, (int conn_id) ); … … 582 588 _DIM_PROTO( void _swaps_buffer, (short *sout, short *sin, int n) ); 583 589 590 #ifdef __cplusplus 591 #undef __CXX_CONST 592 } 593 #endif 594 595 584 596 #define SIZEOF_CHAR 1 585 597 #define SIZEOF_SHORT 2 -
trunk/FACT++/dim/dim/dim_common.h
r15282 r18058 153 153 #include <pthread.h> 154 154 155 #ifdef __cplusplus 156 extern "C" { 157 #endif 158 155 159 _DIM_PROTOE( void dim_lock, () ); 156 160 _DIM_PROTOE( void dim_unlock, () ); 157 161 _DIM_PROTOE( void dim_wait_cond, () ); 158 162 _DIM_PROTOE( void dim_signal_cond, () ); 163 #ifdef __cplusplus 164 } 165 #endif 159 166 160 167 #define DIM_LOCK dim_lock(); … … 175 182 #endif 176 183 184 #ifdef __cplusplus 185 extern "C" { 186 #define __CXX_CONST const 187 #else 188 #define __CXX_CONST 189 #endif 177 190 178 191 _DIM_PROTOE( int id_get, (void *ptr, int type) ); … … 187 200 _DIM_PROTOE( void dna_set_test_write, (int conn_id, int time) ); 188 201 _DIM_PROTOE( void dna_rem_test_write, (int conn_id) ); 189 _DIM_PROTOE( int dim_set_dns_node, ( char *node) );202 _DIM_PROTOE( int dim_set_dns_node, (__CXX_CONST char *node) ); 190 203 _DIM_PROTOE( int dim_get_dns_node, (char *node) ); 191 204 _DIM_PROTOE( int dim_set_dns_port, (int port) ); … … 193 206 _DIM_PROTOE( void dic_set_debug_on, () ); 194 207 _DIM_PROTOE( void dic_set_debug_off, () ); 195 _DIM_PROTOE( void dim_print_msg, ( char *msg, int severity) );208 _DIM_PROTOE( void dim_print_msg, (__CXX_CONST char *msg, int severity) ); 196 209 _DIM_PROTOE( void dim_print_date_time, () ); 197 210 _DIM_PROTOE( void dim_set_write_timeout, (int secs) ); … … 204 217 _DIM_PROTOE( int dim_get_scheduler_class, (int *sched_class) ); 205 218 _DIM_PROTOE( dim_long dim_start_thread, (void(*rout)(void*), void *tag) ); 206 _DIM_PROTOE( int dic_set_dns_node, ( char *node) );219 _DIM_PROTOE( int dic_set_dns_node, (__CXX_CONST char *node) ); 207 220 _DIM_PROTOE( int dic_get_dns_node, (char *node) ); 208 221 _DIM_PROTOE( int dic_set_dns_port, (int port) ); 209 222 _DIM_PROTOE( int dic_get_dns_port, () ); 210 _DIM_PROTOE( int dis_set_dns_node, ( char *node) );223 _DIM_PROTOE( int dis_set_dns_node, (__CXX_CONST char *node) ); 211 224 _DIM_PROTOE( int dis_get_dns_node, (char *node) ); 212 225 _DIM_PROTOE( int dis_set_dns_port, (int port) ); … … 214 227 _DIM_PROTOE( void dim_stop, () ); 215 228 _DIM_PROTOE( int dim_stop_thread, (dim_long tid) ); 216 _DIM_PROTOE( dim_long dis_add_dns, ( char *node, int port) );217 _DIM_PROTOE( dim_long dic_add_dns, ( char *node, int port) );218 _DIM_PROTOE( int dim_get_env_var, ( char *env_var, char *value, int value_size) );229 _DIM_PROTOE( dim_long dis_add_dns, (__CXX_CONST char *node, int port) ); 230 _DIM_PROTOE( dim_long dic_add_dns, (__CXX_CONST char *node, int port) ); 231 _DIM_PROTOE( int dim_get_env_var, (__CXX_CONST char *env_var, char *value, int value_size) ); 219 232 _DIM_PROTOE( int dim_set_write_buffer_size, (int bytes) ); 220 233 _DIM_PROTOE( int dim_get_write_buffer_size, () ); … … 246 259 #endif 247 260 261 #ifdef __cplusplus 262 } 263 #undef __CXX_CONST 264 #endif 265 248 266 _DIM_PROTOE( void dim_print_date_time_millis, () ); 249 267 -
trunk/FACT++/dim/dim/dim_tcpip.h
r11071 r18058 6 6 7 7 #ifdef WIN32 8 #define FD_SETSIZE 81928 #define FD_SETSIZE 16384 9 9 #else 10 10 #ifdef linux 11 11 #ifndef NOMORECONNS 12 12 /* CG: Copied here bits/typesizes.h */ 13 #ifndef 14 #define _BITS_TYPESIZES_H113 #ifndef _BITS_TYPESIZES_H 14 #define _BITS_TYPESIZES_H 1 15 15 16 16 /* See <bits/types.h> for the meaning of these macros. This file exists so 17 17 that <bits/types.h> need not vary across different GNU platforms. */ 18 18 19 #define __DEV_T_TYPE __UQUAD_TYPE 20 #define __UID_T_TYPE __U32_TYPE 21 #define __GID_T_TYPE __U32_TYPE 22 #define __INO_T_TYPE __ULONGWORD_TYPE 23 #define __INO64_T_TYPE __UQUAD_TYPE 24 #define __MODE_T_TYPE __U32_TYPE 25 #define __NLINK_T_TYPE __UWORD_TYPE 26 #define __OFF_T_TYPE __SLONGWORD_TYPE 27 #define __OFF64_T_TYPE __SQUAD_TYPE 28 #define __PID_T_TYPE __S32_TYPE 29 #define __RLIM_T_TYPE __ULONGWORD_TYPE 30 #define __RLIM64_T_TYPE __UQUAD_TYPE 31 #define __BLKCNT_T_TYPE __SLONGWORD_TYPE 32 #define __BLKCNT64_T_TYPE __SQUAD_TYPE 33 #define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE 34 #define __FSBLKCNT64_T_TYPE __UQUAD_TYPE 35 #define __FSFILCNT_T_TYPE __ULONGWORD_TYPE 36 #define __FSFILCNT64_T_TYPE __UQUAD_TYPE 37 #define __ID_T_TYPE __U32_TYPE 38 #define __CLOCK_T_TYPE __SLONGWORD_TYPE 39 #define __TIME_T_TYPE __SLONGWORD_TYPE 40 #define __USECONDS_T_TYPE __U32_TYPE 41 #define __SUSECONDS_T_TYPE __SLONGWORD_TYPE 42 #define __DADDR_T_TYPE __S32_TYPE 19 #define __DEV_T_TYPE __UQUAD_TYPE 20 #define __UID_T_TYPE __U32_TYPE 21 #define __GID_T_TYPE __U32_TYPE 22 #define __INO_T_TYPE __ULONGWORD_TYPE 23 #define __INO64_T_TYPE __UQUAD_TYPE 24 #define __MODE_T_TYPE __U32_TYPE 25 #define __NLINK_T_TYPE __UWORD_TYPE 26 #define __OFF_T_TYPE __SLONGWORD_TYPE 27 #define __OFF64_T_TYPE __SQUAD_TYPE 28 #define __PID_T_TYPE __S32_TYPE 29 #define __RLIM_T_TYPE __ULONGWORD_TYPE 30 #define __RLIM64_T_TYPE __UQUAD_TYPE 31 #define __BLKCNT_T_TYPE __SLONGWORD_TYPE 32 #define __BLKCNT64_T_TYPE __SQUAD_TYPE 33 #define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE 34 #define __FSBLKCNT64_T_TYPE __UQUAD_TYPE 35 #define __FSFILCNT_T_TYPE __ULONGWORD_TYPE 36 #define __FSFILCNT64_T_TYPE __UQUAD_TYPE 37 #define __FSWORD_T_TYPE __SWORD_TYPE 38 #define __ID_T_TYPE __U32_TYPE 39 #define __CLOCK_T_TYPE __SLONGWORD_TYPE 40 #define __TIME_T_TYPE __SLONGWORD_TYPE 41 #define __USECONDS_T_TYPE __U32_TYPE 42 #define __SUSECONDS_T_TYPE __SLONGWORD_TYPE 43 #define __DADDR_T_TYPE __S32_TYPE 43 44 #define __SWBLK_T_TYPE __SLONGWORD_TYPE 44 #define __KEY_T_TYPE __S32_TYPE 45 #define __CLOCKID_T_TYPE __S32_TYPE 46 #define __TIMER_T_TYPE __S32_TYPE 47 #define __BLKSIZE_T_TYPE __SLONGWORD_TYPE 48 #define __FSID_T_TYPE struct { int __val[2]; } 49 #define __SSIZE_T_TYPE __SWORD_TYPE 45 #define __KEY_T_TYPE __S32_TYPE 46 #define __CLOCKID_T_TYPE __S32_TYPE 47 #define __TIMER_T_TYPE void * 48 #define __BLKSIZE_T_TYPE __SLONGWORD_TYPE 49 #define __FSID_T_TYPE struct { int __val[2]; } 50 #define __SSIZE_T_TYPE __SWORD_TYPE 51 #define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE 52 #define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE 53 54 #ifdef __LP64__ 55 /* Tell the libc code that off_t and off64_t are actually the same type 56 for all ABI purposes, even if possibly expressed as different base types 57 for C type-checking purposes. */ 58 # define __OFF_T_MATCHES_OFF64_T 1 59 60 /* Same for ino_t and ino64_t. */ 61 # define __INO_T_MATCHES_INO64_T 1 62 #endif 50 63 51 64 /* Number of descriptors that can fit in an `fd_set'. */ 52 #define __FD_SETSIZE 819265 #define __FD_SETSIZE 16384 53 66 54 #endif /* bits/typesizes.h */ 67 68 #endif /* bits/typesizes.h */ 55 69 56 70 /* CG: Copied here linux/posix_types.h */ … … 64 78 65 79 #undef __FD_SETSIZE 66 #define __FD_SETSIZE 819280 #define __FD_SETSIZE 16384 67 81 68 82 #undef __FDSET_LONGS … … 84 98 /* Type of a SYSV IPC key. */ 85 99 typedef int __kernel_key_t; 100 typedef int __kernel_mqd_t; 86 101 87 102 #include <asm/posix_types.h> -
trunk/FACT++/dim/dim/dis.h
r14575 r18058 25 25 #define dis_get_timestamp dis_get_timestamp_ 26 26 27 _DIM_PROTOE( int dis_start_serving, (char *task_name) ); 27 #ifdef __cplusplus 28 extern "C" { 29 #define __CXX_CONST const 30 #else 31 #define __CXX_CONST 32 #endif 33 34 _DIM_PROTOE( int dis_start_serving, (__CXX_CONST char *task_name) ); 28 35 _DIM_PROTOE( void dis_stop_serving, () ); 29 36 _DIM_PROTOE( int dis_get_next_cmnd, (dim_long *tag, int *buffer, int *size ) ); 30 37 _DIM_PROTOE( int dis_get_client, (char *name ) ); 31 38 _DIM_PROTOE( int dis_get_conn_id, () ); 32 _DIM_PROTOE( unsigned dis_add_service, ( char *service_name,char *service_type,39 _DIM_PROTOE( unsigned dis_add_service, (__CXX_CONST char *service_name, __CXX_CONST char *service_type, 33 40 void *service_address, int service_size, 34 41 void (*usr_routine)(void*,void**,int*,int*), dim_long tag) ); 35 _DIM_PROTOE( unsigned dis_add_cmnd, ( char *service_name,char *service_type,42 _DIM_PROTOE( unsigned dis_add_cmnd, (__CXX_CONST char *service_name, __CXX_CONST char *service_type, 36 43 void (*usr_routine)(void*,void*,int*), dim_long tag) ); 37 44 _DIM_PROTOE( void dis_add_client_exit_handler,(void (*usr_routine)(int*)) ); … … 39 46 _DIM_PROTOE( void dis_add_exit_handler,(void (*usr_routine)(int*)) ); 40 47 _DIM_PROTOE( void dis_add_error_handler,(void (*usr_routine)(int, int, char*)) ); 41 _DIM_PROTOE( void dis_report_service, ( char *service_name) );48 _DIM_PROTOE( void dis_report_service, (__CXX_CONST char *service_name) ); 42 49 _DIM_PROTOE( int dis_update_service, (unsigned service_id) ); 43 50 _DIM_PROTOE( int dis_remove_service, (unsigned service_id) ); … … 54 61 _DIM_PROTOE( char *dis_get_error_services, () ); 55 62 _DIM_PROTOE( char *dis_get_client_services, (int conn_id) ); 56 _DIM_PROTOE( int dis_start_serving_dns, (dim_long dns_id, char *task_name/*, int *id_list*/) );63 _DIM_PROTOE( int dis_start_serving_dns, (dim_long dns_id, __CXX_CONST char *task_name/*, int *id_list*/) ); 57 64 _DIM_PROTOE( void dis_stop_serving_dns, (dim_long dns_id) ); 58 _DIM_PROTOE( unsigned dis_add_service_dns, (dim_long dns_id, char *service_name,char *service_type,65 _DIM_PROTOE( unsigned dis_add_service_dns, (dim_long dns_id, __CXX_CONST char *service_name, __CXX_CONST char *service_type, 59 66 void *service_address, int service_size, 60 67 void (*usr_routine)(void*,void**,int*,int*), dim_long tag) ); 61 _DIM_PROTOE( unsigned dis_add_cmnd_dns, (dim_long dns_id, char *service_name,char *service_type,68 _DIM_PROTOE( unsigned dis_add_cmnd_dns, (dim_long dns_id, __CXX_CONST char *service_name, __CXX_CONST char *service_type, 62 69 void (*usr_routine)(void*,void*,int*), dim_long tag) ); 63 70 _DIM_PROTOE( int dis_get_n_clients, (unsigned service_id) ); 64 71 _DIM_PROTOE( int dis_get_timestamp, (unsigned service_id, 65 72 int *secs, int *millisecs) ); 73 #ifdef __cplusplus 74 #undef __CXX_CONST 75 } 76 #endif 66 77 67 78 #endif -
trunk/FACT++/dim/src/benchmark/benchClient.cxx
r14936 r18058 35 35 36 36 if(argc){} 37 if(arg c){}37 if(argv){} 38 38 br.getServices("BENCH_SERVICE_*"); 39 39 -
trunk/FACT++/dim/src/dic.c
r15282 r18058 1363 1363 } 1364 1364 node_name = packet->node_name; 1365 if(node_name[0] == -1)1365 if(node_name[0] == (char)0xFF) 1366 1366 { 1367 1367 error_handler(0, DIM_FATAL, DIMDNSREFUS, "DIM_DNS refuses connection"); -
trunk/FACT++/dim/src/discpp.cxx
r15282 r18058 83 83 void DimService::storeIt(void *data, int size) 84 84 { 85 85 DISABLE_AST 86 if(!itsId) 87 { 88 ENABLE_AST 89 return; 90 } 86 91 if(!itsDataSize) 87 92 { … … 97 102 memcpy(itsData, data, (size_t)size); 98 103 itsSize = size; 104 ENABLE_AST 99 105 } 100 106 … … 131 137 { 132 138 // itsTagId = 0; 139 itsId = 0; 133 140 itsDns = dns; 134 141 itsName = new char[(int)strlen(name)+1]; … … 241 248 { 242 249 // itsTagId = 0; 250 itsIdIn = 0; 251 itsIdOut = 0; 243 252 itsDns = dns; 244 253 itsName = new char[(int)strlen(name)+1]; … … 287 296 void DimRpc::storeIt(void *data, int size) 288 297 { 289 298 DISABLE_AST 299 if(!itsIdIn) 300 { 301 ENABLE_AST 302 return; 303 } 290 304 if(!itsDataOutSize) 291 305 { … … 301 315 memcpy(itsDataOut, data, (size_t)size); 302 316 itsSizeOut = size; 317 ENABLE_AST 303 318 } 304 319 … … 776 791 { 777 792 // itsTagId = 0; 793 itsId = 0; 794 itsName = 0; 778 795 } 779 796 780 797 DimService::DimService(const char *name, int &value) 781 798 { 799 itsId = 0; 800 itsName = 0; 782 801 itsData = &value; 783 802 itsSize = sizeof(int); … … 788 807 DimService::DimService(const char *name, float &value) 789 808 { 809 itsId = 0; 810 itsName = 0; 790 811 itsData = &value; 791 812 itsSize = sizeof(float); … … 796 817 DimService::DimService(const char *name, double &value) 797 818 { 819 itsId = 0; 820 itsName = 0; 798 821 itsData = &value; 799 822 itsSize = sizeof(double); … … 804 827 DimService::DimService(const char *name, longlong &value) 805 828 { 829 itsId = 0; 830 itsName = 0; 806 831 itsData = &value; 807 832 itsSize = sizeof(longlong); … … 812 837 DimService::DimService(const char *name, short &value) 813 838 { 839 itsId = 0; 840 itsName = 0; 814 841 itsData = &value; 815 842 itsSize = sizeof(short); … … 820 847 DimService::DimService(const char *name, char *string) 821 848 { 849 itsId = 0; 850 itsName = 0; 822 851 itsData = string; 823 852 itsSize = (int)strlen(string)+1; … … 828 857 DimService::DimService(const char *name, char *format, void *structure, int size) 829 858 { 859 itsId = 0; 860 itsName = 0; 830 861 itsData = structure; 831 862 itsSize = size; … … 836 867 DimService::DimService(const char *name, char *format, DimServiceHandler *handler) 837 868 { 869 itsId = 0; 870 itsName = 0; 838 871 itsData = 0; 839 872 itsSize = 0; … … 844 877 DimService::DimService(const char *name, const char *format, void *structure, int size) 845 878 { 879 itsId = 0; 880 itsName = 0; 846 881 itsData = structure; 847 882 itsSize = size; … … 852 887 DimService::DimService(const char *name, const char *format, DimServiceHandler *handler) 853 888 { 889 itsId = 0; 890 itsName = 0; 854 891 itsData = 0; 855 892 itsSize = 0; … … 862 899 DimService::DimService(DimServerDns *dns, const char *name, int &value) 863 900 { 901 itsId = 0; 902 itsName = 0; 864 903 itsData = &value; 865 904 itsSize = sizeof(int); … … 870 909 DimService::DimService(DimServerDns *dns, const char *name, float &value) 871 910 { 911 itsId = 0; 912 itsName = 0; 872 913 itsData = &value; 873 914 itsSize = sizeof(float); … … 878 919 DimService::DimService(DimServerDns *dns, const char *name, double &value) 879 920 { 921 itsId = 0; 922 itsName = 0; 880 923 itsData = &value; 881 924 itsSize = sizeof(double); … … 886 929 DimService::DimService(DimServerDns *dns, const char *name, longlong &value) 887 930 { 931 itsId = 0; 932 itsName = 0; 888 933 itsData = &value; 889 934 itsSize = sizeof(longlong); … … 894 939 DimService::DimService(DimServerDns *dns, const char *name, short &value) 895 940 { 941 itsId = 0; 942 itsName = 0; 896 943 itsData = &value; 897 944 itsSize = sizeof(short); … … 902 949 DimService::DimService(DimServerDns *dns, const char *name, char *string) 903 950 { 951 itsId = 0; 952 itsName = 0; 904 953 itsData = string; 905 954 itsSize = (int)strlen(string)+1; … … 910 959 DimService::DimService(DimServerDns *dns, const char *name, char *format, void *structure, int size) 911 960 { 961 itsId = 0; 962 itsName = 0; 912 963 itsData = structure; 913 964 itsSize = size; … … 918 969 DimService::DimService(DimServerDns *dns, const char *name, char *format, DimServiceHandler *handler) 919 970 { 971 itsId = 0; 972 itsName = 0; 920 973 itsData = 0; 921 974 itsSize = 0; … … 927 980 DimService::DimService(DimServerDns *dns, const char *name, const char *format, void *structure, int size) 928 981 { 982 itsId = 0; 983 itsName = 0; 929 984 itsData = structure; 930 985 itsSize = size; … … 935 990 DimService::DimService(DimServerDns *dns, const char *name, const char *format, DimServiceHandler *handler) 936 991 { 992 itsId = 0; 993 itsName = 0; 937 994 itsData = 0; 938 995 itsSize = 0; … … 944 1001 DimService::~DimService() 945 1002 { 946 delete[] itsName; 1003 DISABLE_AST 1004 if(itsName) 1005 delete[] itsName; 947 1006 if(itsDataSize) 948 1007 delete[] (char *)itsData; 949 1008 // if(itsTagId) 950 1009 // id_free(itsTagId, SRC_DIS); 951 dis_remove_service( itsId ); 1010 if(itsId) 1011 dis_remove_service( itsId ); 1012 itsId = 0; 1013 ENABLE_AST 952 1014 } 953 1015 954 1016 int DimService::updateService() 955 1017 { 1018 if(!itsId) 1019 return 0; 956 1020 return dis_update_service( itsId ); 957 1021 } … … 959 1023 int DimService::updateService( int &value ) 960 1024 { 1025 if(!itsId) 1026 return 0; 961 1027 if( itsType == DisINT) 962 1028 { … … 969 1035 int DimService::updateService( float &value ) 970 1036 { 1037 if(!itsId) 1038 return 0; 971 1039 if( itsType == DisFLOAT) { 972 1040 itsData = &value; … … 978 1046 int DimService::updateService( double &value ) 979 1047 { 1048 if(!itsId) 1049 return 0; 980 1050 if( itsType == DisDOUBLE) { 981 1051 itsData = &value; … … 987 1057 int DimService::updateService( longlong &value ) 988 1058 { 1059 if(!itsId) 1060 return 0; 989 1061 if( itsType == DisXLONG) 990 1062 { … … 997 1069 int DimService::updateService( short &value ) 998 1070 { 1071 if(!itsId) 1072 return 0; 999 1073 if( itsType == DisSHORT) 1000 1074 { … … 1007 1081 int DimService::updateService( char *string ) 1008 1082 { 1083 if(!itsId) 1084 return 0; 1009 1085 if( itsType == DisSTRING) 1010 1086 { … … 1018 1094 int DimService::updateService( void *structure, int size ) 1019 1095 { 1096 if(!itsId) 1097 return 0; 1020 1098 if( itsType == DisPOINTER) 1021 1099 { … … 1029 1107 int DimService::selectiveUpdateService(int *cids) 1030 1108 { 1109 if(!itsId) 1110 return 0; 1031 1111 if( cids == 0) 1032 1112 { … … 1041 1121 int DimService::selectiveUpdateService( int &value, int *cids) 1042 1122 { 1123 if(!itsId) 1124 return 0; 1043 1125 if( itsType == DisINT) 1044 1126 { … … 1058 1140 int DimService::selectiveUpdateService( float &value, int *cids ) 1059 1141 { 1142 if(!itsId) 1143 return 0; 1060 1144 if( itsType == DisFLOAT) 1061 1145 { … … 1075 1159 int DimService::selectiveUpdateService( double &value, int *cids ) 1076 1160 { 1161 if(!itsId) 1162 return 0; 1077 1163 if( itsType == DisDOUBLE) 1078 1164 { … … 1092 1178 int DimService::selectiveUpdateService( longlong &value, int *cids ) 1093 1179 { 1180 if(!itsId) 1181 return 0; 1094 1182 if( itsType == DisXLONG) 1095 1183 { … … 1109 1197 int DimService::selectiveUpdateService( short &value, int *cids ) 1110 1198 { 1199 if(!itsId) 1200 return 0; 1111 1201 if( itsType == DisSHORT) 1112 1202 { … … 1126 1216 int DimService::selectiveUpdateService( char *string, int *cids ) 1127 1217 { 1218 if(!itsId) 1219 return 0; 1128 1220 if( itsType == DisSTRING) 1129 1221 { … … 1144 1236 int DimService::selectiveUpdateService( void *structure, int size, int *cids ) 1145 1237 { 1238 if(!itsId) 1239 return 0; 1146 1240 if( itsType == DisPOINTER) 1147 1241 { … … 1162 1256 void DimService::setQuality(int quality) 1163 1257 { 1258 if(!itsId) 1259 return; 1164 1260 dis_set_quality( itsId, quality ); 1165 1261 } … … 1167 1263 void DimService::setTimestamp(int secs, int millisecs) 1168 1264 { 1265 if(!itsId) 1266 return; 1169 1267 dis_set_timestamp( itsId, secs, millisecs ); 1170 1268 } … … 1357 1455 1358 1456 if(secs == 0) 1359 dis_get_timestamp(itsId, &secs, &millisecs); 1457 { 1458 DISABLE_AST 1459 if(itsId) 1460 dis_get_timestamp(itsId, &secs, &millisecs); 1461 ENABLE_AST 1462 } 1360 1463 return(secs); 1361 1464 } … … 1384 1487 DimCommand::~DimCommand() 1385 1488 { 1489 DISABLE_AST 1386 1490 delete[] itsName; 1387 1491 delete[] itsFormat; 1388 1492 // if(itsTagId) 1389 1493 // id_free(itsTagId, SRC_DIS); 1390 dis_remove_service( itsId ); 1494 if(itsId) 1495 dis_remove_service( itsId ); 1496 itsId = 0; 1497 ENABLE_AST 1391 1498 } 1392 1499 … … 1407 1514 DimRpc::~DimRpc() 1408 1515 { 1516 DISABLE_AST 1409 1517 delete[] itsName; 1410 1518 delete[] itsNameIn; … … 1412 1520 // if(itsTagId) 1413 1521 // id_free(itsTagId, SRC_DIS); 1414 dis_remove_service( itsIdIn ); 1415 dis_remove_service( itsIdOut ); 1522 if(itsIdIn) 1523 dis_remove_service( itsIdIn ); 1524 if(itsIdOut) 1525 dis_remove_service( itsIdOut ); 1526 itsIdIn = 0; 1527 itsIdOut = 0; 1528 ENABLE_AST 1416 1529 } 1417 1530 -
trunk/FACT++/dim/src/dns.c
r15282 r18058 21 21 #define MAX_HASH_ENTRIES 5000 22 22 */ 23 #define MAX_HASH_ENTRIES 2 000023 #define MAX_HASH_ENTRIES 25000 24 24 FILE *foutptr; 25 25 … … 260 260 { 261 261 if(!get_dns_accepted_domains(DNS_accepted_domains)) 262 DNS_accepted_domains[0] = -1;263 } 264 if((DNS_accepted_domains[0] != -1) && (strcmp(Dns_conns[conn_id].task_name,"DIS_DNS")))262 DNS_accepted_domains[0] = (char)0xFF; 263 } 264 if((DNS_accepted_domains[0] != (char)0xFF) && (strcmp(Dns_conns[conn_id].task_name,"DIS_DNS"))) 265 265 { 266 266 ptr = DNS_accepted_domains; … … 683 683 { 684 684 if(!get_dns_accepted_nodes(DNS_accepted_nodes)) 685 DNS_accepted_nodes[0] = -1;686 } 687 if(DNS_accepted_nodes[0] != -1)685 DNS_accepted_nodes[0] = (char)0xFF; 686 } 687 if(DNS_accepted_nodes[0] != (char)0xFF) 688 688 { 689 689 ptr = DNS_accepted_nodes; … … 712 712 { 713 713 dic_packet.service_id = serv_regp->service_id; 714 dic_packet.node_name[0] = -1;714 dic_packet.node_name[0] = (char)0xFF; 715 715 dic_packet.task_name[0] = 0; 716 716 dic_packet.node_addr[0] = 0; -
trunk/FACT++/dim/src/examples/pvss_dim_client.cxx
r11071 r18058 19 19 } 20 20 public : 21 SimpleService(c har *name) : DimInfo(name, -1.0) {};21 SimpleService(const char *name) : DimInfo(name, -1.0) {}; 22 22 }; 23 23 … … 39 39 } 40 40 public : 41 DimDoubleArray(c har *name) : DimInfo(name, no_link_darray, 8*sizeof(double)) {};41 DimDoubleArray(const char *name) : DimInfo(name, no_link_darray, 8*sizeof(double)) {}; 42 42 }; 43 43 … … 76 76 } 77 77 public : 78 ComplexService(c har *name) : DimInfo(name, -1.0) {};78 ComplexService(const char *name) : DimInfo(name, -1.0) {}; 79 79 }; 80 80 … … 88 88 cout << "RPC Service received: " << value << "\n" << endl; 89 89 } 90 RpcService(c har *name, int timeout) : DimRpcInfo(name, timeout, -1) {};90 RpcService(const char *name, int timeout) : DimRpcInfo(name, timeout, -1) {}; 91 91 }; 92 92 -
trunk/FACT++/dim/src/examples/pvss_dim_server.cxx
r15282 r18058 31 31 } 32 32 public : 33 RecvCommand(c har *name) : DimCommand(name,"C") {reset_flag = 0;};33 RecvCommand(const char *name) : DimCommand(name,"C") {reset_flag = 0;}; 34 34 int isReset() {return reset_flag;}; 35 35 void clearReset() {reset_flag = 0;}; … … 47 47 } 48 48 public : 49 RecvCommandComplex(c har *name) : DimCommand(name,"I:1;C:1;I:1;F:1;C") {};49 RecvCommandComplex(const char *name) : DimCommand(name,"I:1;C:1;I:1;F:1;C") {}; 50 50 }; 51 51 /* … … 95 95 } 96 96 public: 97 RpcService(c har *name): DimRpc(name,"I","I") {val = 0;};97 RpcService(const char *name): DimRpc(name,"I","I") {val = 0;}; 98 98 }; 99 99 -
trunk/FACT++/dim/src/examples/rpc_client.cxx
r14575 r18058 2 2 #include <iostream> 3 3 using namespace std; 4 #include <stdio.h> 4 5 5 6 class Rpc : public DimRpcInfo … … 10 11 cout << "Callback RPC Received : " << getInt() << endl; 11 12 } 12 Rpc(c har *name) : DimRpcInfo(name, 1, -1) {};13 Rpc(const char *name) : DimRpcInfo(name, 1, -1) {}; 13 14 }; 14 15 … … 31 32 cout << val->str1 << " " << val->str2 << " " << val->int1 << endl; 32 33 } 33 RpcStruct(c har *name) : DimRpcInfo(name,"dead") {};34 RpcStruct(const char *name) : DimRpcInfo(name, (char *)"dead") {}; 34 35 }; 35 36 … … 41 42 int out, in; 42 43 43 sprintf(name,"TESTRPC% d/INT",(dim_long)tag);44 sprintf(name,"TESTRPC%ld/INT",(dim_long)tag); 44 45 myRpc = new DimRpcInfo(name, 10, -1); 45 46 // myRpc = new Rpc(name); … … 65 66 Rpc *myRpc; 66 67 char name[64]; 67 int out , in;68 int out; 68 69 69 70 sprintf(name,"TESTRPC/INT"); -
trunk/FACT++/dim/src/examples/rpc_server.cxx
r15282 r18058 3 3 #include <iostream> 4 4 using namespace std; 5 #include <stdio.h> 5 6 6 7 class RpcInt : public DimRpc … … 20 21 } 21 22 public: 22 RpcInt(c har *name): DimRpc(name,"I","I") {val = 0;};23 RpcInt(const char *name): DimRpc(name,"I","I") {val = 0;}; 23 24 }; 24 25 … … 56 57 } 57 58 public: 58 RpcStruct(c har *name): DimRpc(name,"C:16;I:5;C:18;F:4;I:1;F:16",59 RpcStruct(const char *name): DimRpc(name,"C:16;I:5;C:18;F:4;I:1;F:16", 59 60 "C:16;I:5;C:18;F:4;I:1;F:16") {val = 0;}; 60 61 }; … … 75 76 } 76 77 public: 77 JeffRpcStruct(c har *name): DimRpc(name,"C:1;C:1;C:1;C",78 JeffRpcStruct(const char *name): DimRpc(name,"C:1;C:1;C:1;C", 78 79 "I:1;C:1;C") {counter = 0;}; 79 80 }; -
trunk/FACT++/dim/src/tcpip.c
r15282 r18058 436 436 return(1); 437 437 } 438 439 #ifdef __linux__ 440 int tcpip_get_send_space(int conn_id) 441 { 442 int ret, n_bytes; 443 444 ret = ioctl(Net_conns[conn_id].channel, TIOCOUTQ, &n_bytes ); 445 if(ret == -1) 446 { 447 #ifdef DEBUG 448 printf("Couln't get send buffer free size, ret = %d\n", ret); 449 #endif 450 return(0); 451 } 452 /* 453 printf("tcpip_get_send_space %d\n", Write_buffer_size - n_bytes); 454 */ 455 return(Write_buffer_size - n_bytes); 456 } 457 #endif 438 458 439 459 /* … … 905 925 ipaddr[3] = (unsigned char)d; 906 926 host_number = 1; 927 /* 907 928 #ifndef VxWorks 908 929 if( gethostbyaddr(ipaddr, sizeof(ipaddr), AF_INET) == (struct hostent *)0 ) … … 913 934 ret = WSAGetLastError(); 914 935 #endif 915 if((ret == HOST_NOT_FOUND) || (ret == NO_DATA)) 916 { 917 if(!check_node_addr(node, ipaddr)) 918 return(0); 919 } 920 } 921 #endif 936 // if((ret == HOST_NOT_FOUND) || (ret == NO_DATA)) 937 // { 938 // if(!check_node_addr(node, ipaddr)) 939 // return(0); 940 // } 941 } 942 #endif 943 */ 922 944 } 923 945 #ifndef VxWorks … … 1306 1328 1307 1329 set_non_blocking(Net_conns[conn_id].channel); 1330 /* 1331 #ifdef __linux__ 1332 tcpip_get_send_space(conn_id); 1333 #endif 1334 */ 1308 1335 wrote = (int)writesock( Net_conns[conn_id].channel, buffer, (size_t)size, 0 ); 1309 1336 #ifndef WIN32 … … 1696 1723 #ifndef WIN32 1697 1724 if(code){} 1698 if((errno == ENOENT) && (h_errno == HOST_NOT_FOUND))1725 if((errno == 0) && (h_errno == HOST_NOT_FOUND)) 1699 1726 strcpy(str,"Host not found"); 1700 1727 else -
trunk/FACT++/dim/src/util/dim_get_service.c
r11071 r18058 46 46 else 47 47 { 48 sprintf(str, argv[1]);48 sprintf(str,"%s",argv[1]); 49 49 } 50 50 dic_info_service(str,ONCE_ONLY,60,0,0,rout,0,&no_link,4); -
trunk/FACT++/dim/src/webDid/webDid.c
r15282 r18058 46 46 CURR_SERVICE *Curr_service_head = (CURR_SERVICE *)0; 47 47 48 typedef struct objstate{ 49 char name[MAX_NAME]; 50 char state[512]; 51 int sid; 52 int mode_index; 53 void *browserp; 54 }OBJSTATE; 55 /* 56 typedef struct domainitem{ 57 char name[MAX_NAME]; 58 OBJSTATE objs[1]; 59 }CURR_SMIDOMAIN; 60 */ 48 61 typedef struct bitem{ 49 62 struct bitem *next; … … 53 66 time_t last_updated; 54 67 time_t last_polled; 68 time_t last_changed; 55 69 int conn_id; 56 70 int n_services; … … 60 74 char *JSONBuffer; 61 75 int JSONBufferSize; 76 char *JSONSmiBuffer; 77 int JSONSmiBufferSize; 62 78 char pattern[256]; 63 79 char curr_command[MAX_NAME]; 64 80 char *service_format_ptr; 81 int isSMI; 82 int n_domains; 83 char curr_smidomain[MAX_NAME]; 84 int curr_smidomain_size; 85 int curr_smidomain_nobjs; 86 OBJSTATE *smidomainp; 65 87 }BROWSER; 66 88 BROWSER *Browser_head = (BROWSER *)0; … … 69 91 int JSONBufferSize = 0; 70 92 char JSONHeader[256] = {'\0'}; 93 char JSONSmiHeader[256] = {'\0'}; 94 95 char *JSONSmiBuffer = 0; 96 int JSONSmiBufferSize = 0; 71 97 72 98 int First_time = 1; … … 80 106 int N_services = 0; 81 107 static char no_link = -1; 108 static char no_link_str[5] = "DEAD"; 82 109 int no_link_int = -1; 83 110 FILE *fptr; … … 424 451 NODE *nodep; 425 452 SERVER *servp; 426 char *ptr ;453 char *ptr = 0; 427 454 BROWSER *browserp; 428 455 char *prepareJSONServiceList(); … … 441 468 { 442 469 ptr = prepareJSONServiceList(servp, node, pid, browserp); 470 } 471 } 472 return ptr; 473 } 474 475 void got_update_smi_objects(BROWSER **tag, char *buffer, int *size) 476 { 477 BROWSER *browserp; 478 479 if(size){} 480 browserp = (BROWSER *)*tag; 481 if(browserp->service_format_ptr) 482 free(browserp->service_format_ptr); 483 browserp->service_format_ptr = (char *)malloc(strlen(buffer)+1); 484 strcpy(browserp->service_format_ptr, buffer); 485 } 486 487 char *update_smi_objects(char *node, char *server, int pid, int browser) 488 { 489 char str[MAX_NAME]; 490 NODE *nodep; 491 SERVER *servp; 492 char *ptr = 0; 493 BROWSER *browserp; 494 char *prepareJSONSmiObjectList(); 495 BROWSER *create_browser(); 496 497 if(!(browserp = find_browser(browser))) 498 { 499 browserp = create_browser(browser); 500 browserp->isSMI = 1; 501 } 502 if(server){} 503 sprintf(str,"%s/SERVICE_LIST",server); 504 dic_info_service(str,ONCE_ONLY,20,0,0, 505 got_update_smi_objects,(dim_long)browserp,"None",5); 506 if((nodep = find_node(node))) 507 { 508 if((servp = find_server(nodep, pid))) 509 { 510 ptr = prepareJSONSmiObjectList(servp, node, pid, browserp); 443 511 } 444 512 } … … 604 672 browserp = (BROWSER *)malloc(sizeof(BROWSER)); 605 673 browserp->id = id; 606 674 browserp->last_subscribed = 0; 607 675 browserp->last_updated = 0; 608 676 browserp->last_polled = 0; 677 browserp->last_changed = 0; 609 678 browserp->n_nodes = 0; 610 679 browserp->n_servers = 0; … … 613 682 browserp->JSONBuffer = 0; 614 683 browserp->JSONBufferSize = 0; 684 browserp->JSONSmiBuffer = 0; 685 browserp->JSONSmiBufferSize = 0; 615 686 browserp->pattern[0] = '\0'; 616 687 browserp->service_format_ptr = 0; 617 688 browserp->curr_command[0] = '\0'; 689 browserp->curr_smidomain[0] = '\0'; 690 browserp->smidomainp = 0; 618 691 sll_insert_queue((SLL *)Browser_head,(SLL *)browserp); 619 692 dtq_start_timer(10, check_browser, browserp); … … 744 817 } 745 818 } 819 } 820 } 821 if(browserp->isSMI) 822 { 823 if((browserp->last_changed >= browserp->last_polled) || (force)) 824 { 825 service_changed = 1; 746 826 } 747 827 } … … 1177 1257 if(isprint(asc[j])) 1178 1258 { 1179 sprintf(str,"%c",asc[j]); 1259 if(asc[j] == ' ') 1260 sprintf(str," "); 1261 else if(asc[j] == '<') 1262 sprintf(str,"<"); 1263 else if(asc[j] == '>') 1264 sprintf(str,">"); 1265 else if(asc[j] == '&') 1266 sprintf(str,"&"); 1267 else 1268 sprintf(str,"%c",asc[j]); 1180 1269 strcat(tmp,str); 1181 1270 } … … 1345 1434 } 1346 1435 1347 char *getJSONHeader() 1436 char *getJSONSmiBuffer(char *node, int browser) 1437 { 1438 BROWSER *browserp; 1439 int prepareJSONSmiTree(); 1440 1441 if(!(browserp = find_browser(browser))) 1442 { 1443 browserp = create_browser(browser); 1444 browserp->isSMI = 1; 1445 strcpy(browserp->pattern,"SMI/"); 1446 } 1447 if(browser) 1448 { 1449 if((browserp = find_browser(browser))) 1450 { 1451 if(browserp->pattern[0] != '\0') 1452 { 1453 prepareJSONSmiTree(node, browserp); 1454 return(browserp->JSONSmiBuffer); 1455 } 1456 // browserp->n_services = 0; 1457 // browserp->n_servers = 0; 1458 // browserp->n_nodes = 0; 1459 } 1460 } 1461 prepareJSONSmiTree(node, 0); 1462 return(JSONSmiBuffer); 1463 } 1464 1465 char *getJSONHeader(int isSMI) 1348 1466 { 1349 1467 int prepareJSONHeader(); 1350 1468 1469 if(isSMI){} 1351 1470 if(JSONHeader[0] == '\0') 1352 1471 prepareJSONHeader(); … … 1526 1645 printf(" Nodes&Servers %s\n",browserp->JSONBuffer); 1527 1646 */ 1647 return(1); 1648 } 1649 1650 int prepareJSONSmiTree(char *node, BROWSER *browserp) 1651 { 1652 char *ptr; 1653 NODE *nodep; 1654 SERVER *servp; 1655 char str[256], aux[128]; 1656 int selective = 0; 1657 int n_nodes, tot_n_nodes; 1658 int n_servers, tot_n_servers; 1659 int ret, n_found = 0; 1660 char pattern[256] = {'\0'}; 1661 char *sptr; 1662 1663 if(browserp) 1664 { 1665 if(browserp->pattern[0] != '\0') 1666 { 1667 selective = 1; 1668 strcpy(pattern, browserp->pattern); 1669 } 1670 // else 1671 // return(0); 1672 } 1673 // selective = 1; 1674 // strcpy(pattern,"SMI/*"); 1675 if(!selective) 1676 { 1677 if(JSONSmiBufferSize == 0) 1678 { 1679 JSONSmiBuffer = malloc((size_t)(N_nodes*128+N_servers*128)); 1680 } 1681 else if (JSONSmiBufferSize < N_nodes*128+N_servers*128) 1682 { 1683 free(JSONSmiBuffer); 1684 JSONSmiBuffer = malloc((size_t)(N_nodes*128+N_servers*128)); 1685 } 1686 ptr = JSONSmiBuffer; 1687 } 1688 else 1689 { 1690 if(browserp->JSONSmiBufferSize == 0) 1691 { 1692 browserp->JSONSmiBuffer = malloc((size_t)(N_nodes*128+N_servers*128)); 1693 } 1694 else if (browserp->JSONSmiBufferSize < N_nodes*128+N_servers*128) 1695 { 1696 free(browserp->JSONSmiBuffer); 1697 browserp->JSONSmiBuffer = malloc((size_t)(N_nodes*128+N_servers*128)); 1698 } 1699 ptr = browserp->JSONSmiBuffer; 1700 } 1701 *ptr = '\0'; 1702 if(!strcmp(node, "src")) 1703 { 1704 ptr = addJSONStart(ptr); 1705 ptr = addJSONNodeStart(ptr,"children"); 1706 sprintf(str,"text: \"%s\", id: \"Nodes\", expanded: false", Title); 1707 ptr = addJSONChildStart(ptr,str,1); 1708 ptr = addJSONNodeStart(ptr,"children"); 1709 nodep = Node_head; 1710 tot_n_nodes = 0; 1711 while( (nodep = (NODE *)sll_get_next((SLL *)nodep)) ) 1712 { 1713 nodep->match = 1; 1714 if(selective) 1715 { 1716 if(!(ret = find_service_pattern(nodep, 0, pattern, &tot_n_servers))) 1717 { 1718 nodep->match = 0; 1719 continue; 1720 } 1721 else 1722 { 1723 n_found += ret; 1724 } 1725 } 1726 tot_n_nodes++; 1727 } 1728 n_nodes = 0; 1729 nodep = Node_head; 1730 while( (nodep = (NODE *)sll_get_next((SLL *)nodep)) ) 1731 { 1732 if(!nodep->match) 1733 continue; 1734 getNodeLabel(nodep->name, aux); 1735 sprintf(str,"text: \"%s\", id: \"%s\", qtip: \"%s\"", 1736 aux, nodep->name, nodep->name); 1737 ptr = addJSONChildStart(ptr,str,0); 1738 n_nodes++; 1739 if(WebDID_Debug) 1740 printf("adding %s %d %d\n",nodep->name, n_nodes, tot_n_nodes); 1741 if(n_nodes < tot_n_nodes) 1742 ptr = addJSONChildEnd(ptr,1); 1743 else 1744 ptr = addJSONChildEnd(ptr,0); 1745 } 1746 ptr = addJSONNodeEnd(ptr); 1747 ptr = addJSONChildEnd(ptr,0); 1748 ptr = addJSONNodeEnd(ptr); 1749 ptr = addJSONEnd(ptr); 1750 if(selective) 1751 { 1752 browserp->n_services = n_found; 1753 browserp->n_servers = tot_n_servers; 1754 browserp->n_nodes = tot_n_nodes; 1755 } 1756 } 1757 else 1758 { 1759 if((nodep = find_node(node))) 1760 { 1761 ptr = addJSONStart(ptr); 1762 ptr = addJSONNodeStart(ptr,"children"); 1763 servp = nodep->server_head; 1764 tot_n_servers = 0; 1765 while( (servp = (SERVER *)sll_get_next((SLL *)servp)) ) 1766 { 1767 servp->match = 1; 1768 if(servp->busy != 1) 1769 { 1770 servp->match = 0; 1771 continue; 1772 } 1773 if(selective) 1774 { 1775 if(!(ret = find_service_pattern(nodep, servp, pattern, 0))) 1776 { 1777 servp->match = 0; 1778 continue; 1779 } 1780 else 1781 { 1782 n_found += ret; 1783 } 1784 } 1785 tot_n_servers++; 1786 } 1787 n_servers = 0; 1788 servp = nodep->server_head; 1789 while( (servp = (SERVER *)sll_get_next((SLL *)servp)) ) 1790 { 1791 if(!servp->match) 1792 continue; 1793 strcpy(aux, servp->name); 1794 sptr = strstr(aux,"_SMI"); 1795 if(sptr) 1796 *sptr = '\0'; 1797 sprintf(str,"text: \"%s\", id: \"%d\", leaf: true, icon: \"server.png\", name: \"%s\"",aux, servp->server.pid, servp->name); 1798 ptr = addJSONChildStart(ptr,str,0); 1799 n_servers++; 1800 if(n_servers < tot_n_servers) 1801 ptr = addJSONChildEnd(ptr,1); 1802 else 1803 ptr = addJSONChildEnd(ptr,0); 1804 } 1805 ptr = addJSONNodeEnd(ptr); 1806 ptr = addJSONEnd(ptr); 1807 } 1808 } 1809 /* 1810 if(!selective) 1811 printf(" Nodes&Servers %s\n",JSONBuffer); 1812 else 1813 printf(" Nodes&Servers %s\n",browserp->JSONBuffer); 1814 */ 1815 printf("%s\n",browserp->JSONSmiBuffer); 1528 1816 return(1); 1529 1817 } … … 1566 1854 if(JSONServicesSize == 0) 1567 1855 { 1568 JSONServices = malloc((size_t)(n_services*256)); 1856 JSONServicesSize = n_services*256; 1857 JSONServices = malloc((size_t)JSONServicesSize); 1569 1858 } 1570 1859 else if (JSONServicesSize < n_services*256) 1571 1860 { 1572 1861 free(JSONServices); 1573 JSONServices = malloc((size_t)(n_services*256)); 1862 JSONServicesSize = n_services*256; 1863 JSONServices = malloc((size_t)JSONServicesSize); 1574 1864 } 1575 1865 if(browserp) … … 1626 1916 ptr = addJSONEnd(ptr); 1627 1917 return JSONServices; 1918 } 1919 1920 char *JSONSmiServices = 0; 1921 int JSONSmiServicesSize = 0; 1922 1923 char *prepareJSONSmiObjectList(SERVER *servp, char *node, int pid, BROWSER *browserp) 1924 { 1925 DNS_SERVICE_INFO *servicep; 1926 char *ptr; 1927 int n_services, i; 1928 char str[512], type_str[512]; 1929 int selective = 0; 1930 int n_found = 0, n, mode_index; 1931 char aux[512], *sptr, state[512], *stptr; 1932 OBJSTATE *smidomainp; 1933 int findSmiServices(); 1934 1935 printf("prepareJSONSmiObjectList name %s\n", servp->name); 1936 servicep = servp->service_ptr; 1937 n_services = servp->server.n_services; 1938 if(JSONSmiServicesSize == 0) 1939 { 1940 JSONSmiServicesSize = n_services*512; 1941 JSONSmiServices = malloc((size_t)JSONSmiServicesSize); 1942 } 1943 else if (JSONSmiServicesSize < n_services*512) 1944 { 1945 free(JSONSmiServices); 1946 JSONSmiServicesSize = n_services*512; 1947 JSONSmiServices = malloc((size_t)JSONSmiServicesSize); 1948 } 1949 if(browserp) 1950 { 1951 if(browserp->pattern[0] != '\0') 1952 selective = 1; 1953 } 1954 n_found = n_services; 1955 /* 1956 if(selective) 1957 { 1958 n_found = find_server_service_pattern(servp, browserp->pattern); 1959 } 1960 */ 1961 1962 n_found = findSmiServices(browserp, servp); 1963 smidomainp = browserp->smidomainp; 1964 1965 printf("prepareJSONSmiObjectList1 name %s\n", servp->name); 1966 1967 1968 ptr = JSONSmiServices; 1969 *ptr = '\0'; 1970 ptr = addJSONStart(ptr); 1971 ptr = addJSONNodeStart(ptr,"children"); 1972 /* 1973 if(selective) 1974 sprintf(str,"name: \"%s (%d/%d services, pid %d)\"",servp->name, n_found, n_services, servp->server.pid); 1975 else 1976 sprintf(str,"name: \"%s (%d services, pid %d)\"",servp->name, n_services, servp->server.pid); 1977 */ 1978 sprintf(str,"name: \"%s (%d objects, pid %d)\"",servp->name, n_found, servp->server.pid); 1979 ptr = addJSONChildStart(ptr,str,1); 1980 ptr = addJSONNodeStart(ptr,"children"); 1981 servicep = servp->service_ptr; 1982 n = 0; 1983 for(i = 0; i < n_services; i++) 1984 { 1985 /* 1986 printf("Service type = %d\n",servicep->type); 1987 */ 1988 printf("prepareJSONSmiObjectList2 obj name %s\n", servicep->name); 1989 if((!selective) || (strstr(servicep->name, browserp->pattern))) 1990 { 1991 /* 1992 if(servicep->type == 1) 1993 { 1994 sprintf(type_str,"%d@%s|%s|CMD", pid, node, servicep->name); 1995 sprintf(str,"name: \"%s\", id: \"%s\", leaf: true, icon: \"leaf_cmd.gif\"",servicep->name, type_str); 1996 } 1997 else 1998 { 1999 sprintf(type_str,"%d@%s|%s", pid, node, servicep->name); 2000 sprintf(str,"name: \"%s\", state: \"RUNNING\", id: \"%s\", leaf: true",servicep->name, type_str); 2001 } 2002 */ 2003 if(servicep->status == 2) 2004 { 2005 sprintf(type_str,"%d@%s|%s", pid, node, servicep->name); 2006 strcpy(aux, servicep->name); 2007 sptr = strchr(aux,'/'); 2008 if(sptr) 2009 { 2010 sptr++; 2011 sptr = strchr(sptr,'/'); 2012 if(sptr) 2013 sptr++; 2014 } 2015 strcpy(state, smidomainp[i].state); 2016 stptr = strchr(state,'/'); 2017 if(stptr) 2018 { 2019 *stptr = '\0'; 2020 } 2021 mode_index = smidomainp[i].mode_index; 2022 // sprintf(str,"name: \"%s\", state: \"%s\", id: \"%s\", leaf: true, fname: \"%s\"",sptr, state, type_str, servicep->name); 2023 sprintf(str,"name: \"%s\", state: \"%s\", mode: \"%s\",id: \"%s\", leaf: true, fname: \"%s\"", 2024 sptr, state, smidomainp[mode_index].state, type_str, servicep->name); 2025 2026 ptr = addJSONChildStart(ptr,str,0); 2027 n++; 2028 if(n < n_found) 2029 ptr = addJSONChildEnd(ptr,1); 2030 else 2031 ptr = addJSONChildEnd(ptr,0); 2032 } 2033 } 2034 servicep++; 2035 } 2036 ptr = addJSONNodeEnd(ptr); 2037 ptr = addJSONChildEnd(ptr,0); 2038 ptr = addJSONNodeEnd(ptr); 2039 ptr = addJSONEnd(ptr); 2040 printf("%s\n",JSONSmiServices); 2041 return JSONSmiServices; 2042 } 2043 2044 void update_smi_state(OBJSTATE **tag, char *data, int *size) 2045 { 2046 OBJSTATE *servicep; 2047 time_t tsecs; 2048 2049 if(*size){} 2050 servicep = *tag; 2051 2052 if(strcmp(servicep->state, data)) 2053 { 2054 strcpy(servicep->state, data); 2055 tsecs = time((time_t *)0); 2056 ((BROWSER *)(servicep->browserp))->last_changed = tsecs; 2057 } 2058 //printf("SMI State %s %s %08x\n", servicep->name, servicep->state, (unsigned int)servicep); 2059 } 2060 2061 int findSmiServices(BROWSER *browserp, SERVER *servp) 2062 { 2063 DNS_SERVICE_INFO *servicep; 2064 int n_services, i, index; 2065 int n_found = 0, sid; 2066 int checkSmiObjName(); 2067 int findSmiModeObj(); 2068 2069 n_services = servp->server.n_services; 2070 if(strcmp(browserp->curr_smidomain,servp->name)) 2071 { 2072 if(browserp->curr_smidomain[0] != '\0') 2073 { 2074 // unsubscribe; free 2075 for(i = 0; i < browserp->curr_smidomain_size; i++) 2076 { 2077 if(browserp->smidomainp[i].sid) 2078 dic_release_service(browserp->smidomainp[i].sid); 2079 } 2080 free(browserp->smidomainp); 2081 browserp->curr_smidomain[0] = '\0'; 2082 browserp->curr_smidomain_size = 0; 2083 } 2084 strcpy(browserp->curr_smidomain, servp->name); 2085 browserp->smidomainp = malloc(n_services * sizeof(OBJSTATE)); 2086 browserp->curr_smidomain_size = n_services; 2087 } 2088 else 2089 return browserp->curr_smidomain_nobjs; 2090 servicep = servp->service_ptr; 2091 for(i = 0; i < n_services; i++) 2092 { 2093 browserp->smidomainp[i].sid = 0; 2094 browserp->smidomainp[i].state[0] = '\0'; 2095 if(checkSmiObjName(servicep)) 2096 { 2097 strcpy(browserp->smidomainp[i].name, servicep->name); 2098 // strcpy(browserp->smidomainp[i].state, ""); 2099 browserp->smidomainp[i].browserp = browserp; 2100 //printf("address %s %08x\n",browserp->smidomainp[i].name, (unsigned int)&(browserp->smidomainp[i])); 2101 sid = dic_info_service(servicep->name,MONITORED,0,0,0,update_smi_state, &(browserp->smidomainp[i]), 2102 no_link_str, 5); 2103 browserp->smidomainp[i].sid = sid; 2104 if(servicep->status == 2) 2105 n_found++; 2106 } 2107 servicep++; 2108 } 2109 servicep = servp->service_ptr; 2110 for(i = 0; i < n_services; i++) 2111 { 2112 if(servicep->status == 2) 2113 { 2114 index = findSmiModeObj(servp->service_ptr, n_services, servicep->name); 2115 browserp->smidomainp[i].mode_index = index; 2116 } 2117 servicep++; 2118 } 2119 browserp->curr_smidomain_nobjs = n_found; 2120 return n_found; 2121 } 2122 2123 int findSmiModeObj(DNS_SERVICE_INFO *serviceptr, int n_services, char *name) 2124 { 2125 int i; 2126 DNS_SERVICE_INFO *servicep; 2127 char mode_name[256], *ptr, *ptr1, *ptr2; 2128 2129 servicep = serviceptr; 2130 strcpy(mode_name, name); 2131 ptr1 = mode_name; 2132 if((ptr = strstr(mode_name,"::"))) 2133 { 2134 *ptr = '\0'; 2135 ptr2 = ptr1; 2136 while((ptr1 = strchr(ptr1,'/'))) 2137 { 2138 ptr1++; 2139 ptr2 = ptr1; 2140 } 2141 if(strcmp(ptr2, ptr+2)) 2142 *ptr = ':'; 2143 } 2144 strcat(mode_name,"_FWM"); 2145 printf("Find SMI Mode %s %s\n",name, mode_name); 2146 for(i = 0; i < n_services; i++) 2147 { 2148 if(servicep->status == 3) 2149 { 2150 if(!strcmp(servicep->name, mode_name)) 2151 { 2152 printf("Find SMI Mode index %s %s %d\n",mode_name, servicep->name, i); 2153 return i; 2154 } 2155 } 2156 servicep++; 2157 } 2158 return 0; 2159 } 2160 2161 int checkSmiObjName(DNS_SERVICE_INFO *servicep) 2162 { 2163 int ismode = 0, ret = 0; 2164 char *name; 2165 int matchString(); 2166 2167 name = servicep->name; 2168 if(matchString(name,"SMI/*")) 2169 { 2170 ret = 1; 2171 if(matchString(name,"*&ALLOC*")) 2172 ret = 0; 2173 else if(matchString(name,"*/ACTIONS&PARS")) 2174 ret = 0; 2175 else if(matchString(name,"*/BUSY")) 2176 ret = 0; 2177 else if(matchString(name,"*/CMD")) 2178 ret = 0; 2179 else if(matchString(name,"*/OBJECTSET_LIST")) 2180 ret = 0; 2181 else if(matchString(name,"*/OBJECT_LIST")) 2182 ret = 0; 2183 else if(matchString(name,"*/SMI_VERSION_NUMBER")) 2184 ret = 0; 2185 else if(matchString(name,"*/SET/*")) 2186 ret = 0; 2187 // If JCOP framework 2188 else if(matchString(name,"*_FWDM")) 2189 ret = 0; 2190 else if(matchString(name,"*_FWCNM")) 2191 ret = 0; 2192 else if(matchString(name,"*_FWM")) 2193 { 2194 ismode = 1; 2195 if(matchString(name,"*::*")) 2196 ret = 0; 2197 } 2198 } 2199 if(ret) 2200 { 2201 if(ismode) 2202 servicep->status = 3; 2203 else 2204 servicep->status = 2; 2205 } 2206 return ret; 1628 2207 } 1629 2208 -
trunk/FACT++/dim/src/webDid/webServer.c
r15282 r18058 257 257 if(type == 0) 258 258 { 259 ptr = getJSONHeader( );259 ptr = getJSONHeader(0); 260 260 } 261 261 else if(type == 1) … … 350 350 char node[128], server[256], service[256]; 351 351 int pid, ret, req, browser, force; 352 extern char *update_services() ;352 extern char *update_services(), *update_smi_objects(); 353 353 extern char *update_service_data(); 354 354 extern char *getJSONHeader(); 355 extern char *getJSONBuffer() ;355 extern char *getJSONBuffer(), *getJSONSmiBuffer(); 356 356 char datatype[128]; 357 357 char *conv_buffer; … … 361 361 if(type == 0) 362 362 { 363 ptr = getJSONHeader( );363 ptr = getJSONHeader(1); 364 364 } 365 365 else if(type == 1) 366 366 { 367 367 ret = getNodeParameters(conv_buffer, node, &browser); 368 ptr = getJSON Buffer(node, browser);368 ptr = getJSONSmiBuffer(node, browser); 369 369 } 370 370 else if(type == 2) … … 378 378 else 379 379 { 380 ptr = update_s ervices(node, server, pid, browser);380 ptr = update_smi_objects(node, server, pid, browser); 381 381 } 382 382 } … … 550 550 return; 551 551 } 552 else if(!strncmp(&buffer[5],"smiObjects",11)) 552 else if(!strncmp(&buffer[5],"smiData",7)) 553 { 554 sendSmiData(conn_id, &buffer[5], 1); 555 return; 556 } 557 else if(!strncmp(&buffer[5],"smiObjects",10)) 553 558 { 554 559 sendSmiData(conn_id, &buffer[5], 2);
Note:
See TracChangeset
for help on using the changeset viewer.