1 /*
2 * Author: William Chia-Wei Cheng (bill.cheng@acm.org)
3 *
4 * Copyright (C) 2001-2009, William Chia-Wei Cheng.
5 *
6 * This file may be distributed under the terms of the Q Public License
7 * as defined by Trolltech AS of Norway and appearing in the file
8 * LICENSE.QPL included in the packaging of this file.
9 *
10 * THIS FILE IS PROVIDED AS IS WITH NO WARRANTY OF ANY KIND, INCLUDING
11 * THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
12 * PURPOSE. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL,
13 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
14 * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
15 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
16 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 *
18 * @(#)$Header: /mm2/home/cvs/bc-src/tgif/rm_intrf.c,v 1.17 2011/05/16 16:21:59 william Exp $
19 */
20
21 #define _INCLUDE_FROM_RM_INTRF_C_
22
23 #include "tgifdefs.h"
24 #include "cmdids.h"
25
26 #include "dialog.e"
27 #include "menu.e"
28 #include "msg.e"
29 #include "rm_intrf.e"
30 #include "strtbl.e"
31 #include "util.e"
32
33 #ifndef _NO_DL_SUPPORT
34 #define CLOSE_DL(handle) dlclose(handle)
35 #define OPEN_DL(path,flag) dlopen((path),(flag))
36 #define GET_DL_SYM(handle,symbol) dlsym((handle),(symbol))
37 #ifndef RTLD_NOW
38 #define OPEN_DL_MODE 1
39 #else /* RTLD_NOW */
40 #define OPEN_DL_MODE (RTLD_NOW|RTLD_GLOBAL)
41 #endif /* ~RTLD_NOW */
42 #else /* _NO_DL_SUPPORT */
43 #define CLOSE_DL(handle)
44 #define OPEN_DL(path,flag) NULL
45 #define GET_DL_SYM(handle,symbol) NULL
46 #define OPEN_DL_MODE 0
47 #endif /* ~_NO_DL_SUPPORT */
48
49 char cmdLineRMCastLibDir[MAXPATHLENGTH+1];
50 char cmdLineRMCastLibPath[MAXPATHLENGTH+1];
51 RMCastIntrfInfo gRMCastIntrfInfo;
52
53 /* ------------------ Utility Functions ------------------ */
54
55 /* ------------------ RMCastCleanUp() ------------------ */
56
RMCastCleanUp()57 void RMCastCleanUp()
58 {
59 #ifndef _NO_RMCAST_SO
60 if (gRMCastIntrfInfo.pSharedLibHandle != NULL) {
61 CLOSE_DL(gRMCastIntrfInfo.pSharedLibHandle);
62 }
63 #endif /* ~_NO_RMCAST_SO */
64 memset(&gRMCastIntrfInfo, 0, sizeof(RMCastIntrfInfo));
65 }
66
67 /* ------------------ RMCastInit() ------------------ */
68
69 static
GetEntryPointFailed(psz_funcname)70 int GetEntryPointFailed(psz_funcname)
71 char *psz_funcname;
72 {
73 snprintf(gszMsgBox, sizeof(gszMsgBox),
74 TgLoadString(STID_FAIL_GET_ENTRY_PT_IN_SHARELIB),
75 psz_funcname, gRMCastIntrfInfo.szPath);
76 fprintf(stderr, "%s\n", gszMsgBox);
77 if (gRMCastIntrfInfo.pSharedLibHandle != NULL) {
78 CLOSE_DL(gRMCastIntrfInfo.pSharedLibHandle);
79 }
80 memset(&gRMCastIntrfInfo, 0, sizeof(RMCastIntrfInfo));
81
82 return FALSE;
83 }
84
85 typedef struct tagInterfaceVerInfo {
86 char sz_interface_type[80];
87 int major_version;
88 char sz_other_version_info[80];
89 char sz_additional_info[MAXSTRING];
90 } InterfaceVerInfo;
91
92 static
ParseInterfaceVersion(buf,pivi)93 int ParseInterfaceVersion(buf, pivi)
94 char *buf;
95 InterfaceVerInfo *pivi;
96 {
97 char *psz=NULL, *psz2=NULL;
98
99 memset(pivi, 0, sizeof(InterfaceVerInfo));
100
101 psz = strchr(buf, ' ');
102 if (psz == NULL) return FALSE;
103 *psz = '\0';
104 UtilStrCpyN(pivi->sz_interface_type, sizeof(pivi->sz_interface_type), buf);
105 *psz++ = ' ';
106
107 buf = psz;
108 psz = strchr(buf, ' ');
109 if (psz != NULL) {
110 *psz = '\0';
111 UtilStrCpyN(pivi->sz_additional_info, sizeof(pivi->sz_additional_info),
112 &psz[1]);
113 }
114 psz2 = strchr(buf, '.');
115 if (psz2 == NULL) return FALSE;
116 *psz2 = '\0';
117 if (sscanf(buf, "%d", &pivi->major_version) != 1) {
118 *psz2 = '.';
119 return FALSE;
120 }
121 *psz2++ = '.';
122 UtilStrCpyN(pivi->sz_other_version_info,
123 sizeof(pivi->sz_other_version_info), psz2);
124 if (psz != NULL) {
125 *psz++ = ' ';
126 }
127 return TRUE;
128 }
129
130 static
RMCastInterface1Init(pivi)131 int RMCastInterface1Init(pivi)
132 InterfaceVerInfo *pivi;
133 {
134 gRMCastIntrfInfo.pfn_RM_initialize =
135 (RM_initialize_Func*)GET_DL_SYM(gRMCastIntrfInfo.pSharedLibHandle,
136 "RM_initialize");
137 if (gRMCastIntrfInfo.pfn_RM_initialize == NULL) {
138 return GetEntryPointFailed("RM_initialize");
139 }
140 gRMCastIntrfInfo.pfn_RM_joinGroup =
141 (RM_joinGroup_Func*)GET_DL_SYM(gRMCastIntrfInfo.pSharedLibHandle,
142 "RM_joinGroup");
143 if (gRMCastIntrfInfo.pfn_RM_joinGroup == NULL) {
144 return GetEntryPointFailed("RM_joinGroup");
145 }
146 gRMCastIntrfInfo.pfn_RM_leaveGroup =
147 (RM_leaveGroup_Func*)GET_DL_SYM(gRMCastIntrfInfo.pSharedLibHandle,
148 "RM_leaveGroup");
149 if (gRMCastIntrfInfo.pfn_RM_leaveGroup == NULL) {
150 return GetEntryPointFailed("RM_leaveGroup");
151 }
152 gRMCastIntrfInfo.pfn_RM_terminate =
153 (RM_terminate_Func*)GET_DL_SYM(gRMCastIntrfInfo.pSharedLibHandle,
154 "RM_terminate");
155 if (gRMCastIntrfInfo.pfn_RM_terminate == NULL) {
156 return GetEntryPointFailed("RM_terminate");
157 }
158 gRMCastIntrfInfo.pfn_RM_sendto =
159 (RM_sendto_Func*)GET_DL_SYM(gRMCastIntrfInfo.pSharedLibHandle,
160 "RM_sendto");
161 if (gRMCastIntrfInfo.pfn_RM_sendto == NULL) {
162 return GetEntryPointFailed("RM_sendto");
163 }
164 gRMCastIntrfInfo.pfn_RM_recv =
165 (RM_recv_Func*)GET_DL_SYM(gRMCastIntrfInfo.pSharedLibHandle,
166 "RM_recv");
167 if (gRMCastIntrfInfo.pfn_RM_recv == NULL) {
168 return GetEntryPointFailed("RM_recv");
169 }
170 gRMCastIntrfInfo.pfn_RM_getCurStatus =
171 (RM_getCurStatus_Func*)GET_DL_SYM(gRMCastIntrfInfo.pSharedLibHandle,
172 "RM_getCurStatus");
173 if (gRMCastIntrfInfo.pfn_RM_getCurStatus == NULL) {
174 return GetEntryPointFailed("RM_getCurStatus");
175 }
176 gRMCastIntrfInfo.pfn_RM_sendCurStatus =
177 (RM_sendCurStatus_Func*)GET_DL_SYM(gRMCastIntrfInfo.pSharedLibHandle,
178 "RM_sendCurStatus");
179 if (gRMCastIntrfInfo.pfn_RM_sendCurStatus == NULL) {
180 return GetEntryPointFailed("RM_sendCurStatus");
181 }
182 gRMCastIntrfInfo.pfn_RM_readConfigFile =
183 (RM_readConfigFile_Func*)GET_DL_SYM(gRMCastIntrfInfo.pSharedLibHandle,
184 "RM_readConfigFile");
185 if (gRMCastIntrfInfo.pfn_RM_readConfigFile == NULL) {
186 return GetEntryPointFailed("RM_readConfigFile");
187 }
188 gRMCastIntrfInfo.pfn_RM_getOption =
189 (RM_getOption_Func*)GET_DL_SYM(gRMCastIntrfInfo.pSharedLibHandle,
190 "RM_getOption");
191 if (gRMCastIntrfInfo.pfn_RM_getOption == NULL) {
192 return GetEntryPointFailed("RM_getOption");
193 }
194 gRMCastIntrfInfo.pfn_RM_setOption =
195 (RM_setOption_Func*)GET_DL_SYM(gRMCastIntrfInfo.pSharedLibHandle,
196 "RM_setOption");
197 if (gRMCastIntrfInfo.pfn_RM_setOption == NULL) {
198 return GetEntryPointFailed("RM_setOption");
199 }
200 gRMCastIntrfInfo.pfn_RM_setHostDelay =
201 (RM_setHostDelay_Func*)GET_DL_SYM(gRMCastIntrfInfo.pSharedLibHandle,
202 "RM_setHostDelay");
203 if (gRMCastIntrfInfo.pfn_RM_setHostDelay == NULL) {
204 return GetEntryPointFailed("RM_setHostDelay");
205 }
206 gRMCastIntrfInfo.pfn_RM_getHostDelay =
207 (RM_getHostDelay_Func*)GET_DL_SYM(gRMCastIntrfInfo.pSharedLibHandle,
208 "RM_getHostDelay");
209 if (gRMCastIntrfInfo.pfn_RM_getHostDelay == NULL) {
210 return GetEntryPointFailed("RM_getHostDelay");
211 }
212 gRMCastIntrfInfo.pfn_RMDEBUG_setpidip =
213 (RMDEBUG_setpidip_Func*)GET_DL_SYM(gRMCastIntrfInfo.pSharedLibHandle,
214 "RMDEBUG_setpidip");
215 if (gRMCastIntrfInfo.pfn_RMDEBUG_setpidip == NULL) {
216 return GetEntryPointFailed("RMDEBUG_setpidip");
217 }
218 gRMCastIntrfInfo.pfn_RMDEBUG_setsn =
219 (RMDEBUG_setsn_Func*)GET_DL_SYM(gRMCastIntrfInfo.pSharedLibHandle,
220 "RMDEBUG_setsn");
221 if (gRMCastIntrfInfo.pfn_RMDEBUG_setsn == NULL) {
222 return GetEntryPointFailed("RMDEBUG_setsn");
223 }
224 return TRUE;
225 }
226
227 #define LIBRMCAST_SO "librmcast.so"
228
RMCastInit()229 int RMCastInit()
230 {
231 #ifndef _NO_RMCAST_SO
232 char sz_interface_version[MAXSTRING];
233 InterfaceVerInfo ivi;
234
235 memset(&gRMCastIntrfInfo, 0, sizeof(RMCastIntrfInfo));
236 memset(&ivi, 0, sizeof(InterfaceVerInfo));
237
238 if (*cmdLineRMCastLibPath != '\0') {
239 UtilStrCpyN(gRMCastIntrfInfo.szPath, sizeof(gRMCastIntrfInfo.szPath),
240 cmdLineRMCastLibPath);
241 if (!UtilPathExists(gRMCastIntrfInfo.szPath)) {
242 snprintf(gszMsgBox, sizeof(gszMsgBox),
243 TgLoadString(STID_INVALID_RMCAST_DLIB_PATH),
244 gRMCastIntrfInfo.szPath, TOOL_NAME);
245 MsgBox(gszMsgBox, TOOL_NAME, STOP_MB);
246 SendCommandToSelf(CMDID_QUIT, 0);
247 return FALSE;
248 }
249 } else if (*cmdLineRMCastLibDir == '\0') {
250 char *psz=getenv("LD_LIBRARY_PATH"), *psz_copy=NULL, *psz_state=NULL;
251 int found=FALSE;
252
253 if (psz == NULL) {
254 snprintf(gRMCastIntrfInfo.szPath, sizeof(gRMCastIntrfInfo.szPath),
255 "%s", LIBRMCAST_SO);
256 gRMCastIntrfInfo.pSharedLibHandle = OPEN_DL(gRMCastIntrfInfo.szPath,
257 OPEN_DL_MODE);
258 if (gRMCastIntrfInfo.pSharedLibHandle == NULL) {
259 snprintf(gszMsgBox, sizeof(gszMsgBox),
260 TgLoadString(STID_NO_INFO_LIBRMCAST_SO),
261 LIBRMCAST_SO, LIBRMCAST_SO, TOOL_NAME, TOOL_NAME);
262 MsgBox(gszMsgBox, TOOL_NAME, STOP_MB);
263 SendCommandToSelf(CMDID_QUIT, 0);
264 return FALSE;
265 }
266 } else {
267 psz_copy = UtilStrDup(psz);
268 if (psz_copy == NULL) FailAllocMessage();
269 for (psz=UtilStrTok(psz_copy, ":", &psz_state); psz != NULL;
270 psz=UtilStrTok(NULL, ":", &psz_state)) {
271 snprintf(gRMCastIntrfInfo.szPath, sizeof(gRMCastIntrfInfo.szPath),
272 "%s%c%s", psz, DIR_SEP, LIBRMCAST_SO);
273 if (UtilPathExists(gRMCastIntrfInfo.szPath)) {
274 found = TRUE;
275 break;
276 }
277 }
278 UtilFree(psz_copy);
279 if (!found) {
280 snprintf(gRMCastIntrfInfo.szPath, sizeof(gRMCastIntrfInfo.szPath),
281 "%s", LIBRMCAST_SO);
282 gRMCastIntrfInfo.pSharedLibHandle = OPEN_DL(gRMCastIntrfInfo.szPath,
283 OPEN_DL_MODE);
284 if (gRMCastIntrfInfo.pSharedLibHandle == NULL) {
285 snprintf(gszMsgBox, sizeof(gszMsgBox),
286 TgLoadString(STID_NO_INFO_LIBRMCAST_SO),
287 LIBRMCAST_SO, LIBRMCAST_SO, TOOL_NAME, TOOL_NAME);
288 MsgBox(gszMsgBox, TOOL_NAME, STOP_MB);
289 SendCommandToSelf(CMDID_QUIT, 0);
290 return FALSE;
291 }
292 /* return FALSE; -- seems to not work with -parent, shouldn't really get here anyway */
293 }
294 }
295 } else {
296 snprintf(gRMCastIntrfInfo.szPath, sizeof(gRMCastIntrfInfo.szPath),
297 "%s%c%s", cmdLineRMCastLibDir, DIR_SEP, LIBRMCAST_SO);
298 if (!UtilPathExists(gRMCastIntrfInfo.szPath)) {
299 snprintf(gszMsgBox, sizeof(gszMsgBox),
300 TgLoadString(STID_INVALID_RMCAST_DLIB_PATH),
301 gRMCastIntrfInfo.szPath, TOOL_NAME);
302 MsgBox(gszMsgBox, TOOL_NAME, STOP_MB);
303 SendCommandToSelf(CMDID_QUIT, 0);
304 return FALSE;
305 }
306 }
307 if (gRMCastIntrfInfo.pSharedLibHandle == NULL) {
308 gRMCastIntrfInfo.pSharedLibHandle = OPEN_DL(gRMCastIntrfInfo.szPath,
309 OPEN_DL_MODE);
310 if (gRMCastIntrfInfo.pSharedLibHandle == NULL) {
311 snprintf(gszMsgBox, sizeof(gszMsgBox),
312 TgLoadString(STID_FAIL_LOAD_SHARELIB),
313 gRMCastIntrfInfo.szPath);
314 MsgBox(gszMsgBox, TOOL_NAME, INFO_MB);
315 return FALSE;
316 }
317 }
318 gRMCastIntrfInfo.pfn_RM_getVersion =
319 (RM_getVersion_Func*)GET_DL_SYM(
320 gRMCastIntrfInfo.pSharedLibHandle, "RM_getVersion");
321 if (gRMCastIntrfInfo.pfn_RM_getVersion == NULL) {
322 return GetEntryPointFailed("RM_getVersion");
323 }
324 RM_getVersion(sz_interface_version, sizeof(sz_interface_version));
325 if (!ParseInterfaceVersion(sz_interface_version, &ivi)) {
326 snprintf(gszMsgBox, sizeof(gszMsgBox),
327 TgLoadString(STID_BAD_VER_RMCAST_DLIB),
328 sz_interface_version, gRMCastIntrfInfo.szPath);
329 fprintf(stderr, "%s\n", gszMsgBox);
330 CLOSE_DL(gRMCastIntrfInfo.pSharedLibHandle);
331 memset(&gRMCastIntrfInfo, 0, sizeof(RMCastIntrfInfo));
332 return FALSE;
333 }
334 if (strcmp(ivi.sz_interface_type, "RMCAST") == 0 &&
335 ivi.major_version == 2) {
336 return RMCastInterface1Init(&ivi);
337 } else {
338 snprintf(gszMsgBox, sizeof(gszMsgBox),
339 TgLoadString(STID_CANNOT_HANDLE_VER_RMCAST_DLIB),
340 TOOL_NAME, sz_interface_version, gRMCastIntrfInfo.szPath);
341 fprintf(stderr, "%s\n", gszMsgBox);
342 CLOSE_DL(gRMCastIntrfInfo.pSharedLibHandle);
343 memset(&gRMCastIntrfInfo, 0, sizeof(RMCastIntrfInfo));
344 return FALSE;
345 }
346 #else /* ~_NO_RMCAST_SO */
347 memset(&gRMCastIntrfInfo, 0, sizeof(RMCastIntrfInfo));
348 #endif /* _NO_RMCAST_SO */
349
350 return FALSE;
351 }
352
353 /* ------------------ Functions in RMCAST library ------------------ */
354
355 #ifndef _NO_RMCAST_SO
RM_getVersion(buf,buf_sz)356 void RM_getVersion(buf, buf_sz)
357 char *buf;
358 int buf_sz;
359 {
360 if (gRMCastIntrfInfo.pSharedLibHandle != NULL &&
361 gRMCastIntrfInfo.pfn_RM_getVersion != NULL) {
362 (gRMCastIntrfInfo.pfn_RM_getVersion)(buf, buf_sz);
363 return;
364 }
365 TgAssert(FALSE, "RM_getVersion() called when it's not available.",
366 NULL);
367 }
368
RM_initialize(void * callbackterm (void))369 int RM_initialize(void *callbackterm( void ))
370 {
371 if (gRMCastIntrfInfo.pSharedLibHandle != NULL &&
372 gRMCastIntrfInfo.pfn_RM_initialize != NULL) {
373 return (gRMCastIntrfInfo.pfn_RM_initialize)(*callbackterm);
374 }
375 TgAssert(FALSE, "RM_initialize() called when it's not available.", NULL);
376
377 return 0;
378 }
379
RM_joinGroup(group,port)380 int RM_joinGroup(group, port)
381 char *group;
382 int port;
383 {
384 if (gRMCastIntrfInfo.pSharedLibHandle != NULL &&
385 gRMCastIntrfInfo.pfn_RM_joinGroup != NULL) {
386 return (gRMCastIntrfInfo.pfn_RM_joinGroup)(group, port);
387 }
388 TgAssert(FALSE, "RM_joinGroup() called when it's not available.", NULL);
389
390 return 0;
391 }
392
RM_leaveGroup(sock,group)393 void RM_leaveGroup(sock, group)
394 int sock;
395 char *group;
396 {
397 if (gRMCastIntrfInfo.pSharedLibHandle != NULL &&
398 gRMCastIntrfInfo.pfn_RM_leaveGroup != NULL) {
399 (gRMCastIntrfInfo.pfn_RM_leaveGroup)(sock, group);
400 return;
401 }
402 TgAssert(FALSE, "RM_leaveGroup() called when it's not available.", NULL);
403 }
404
RM_terminate()405 void RM_terminate()
406 {
407 if (gRMCastIntrfInfo.pSharedLibHandle != NULL &&
408 gRMCastIntrfInfo.pfn_RM_terminate != NULL) {
409 (gRMCastIntrfInfo.pfn_RM_terminate)();
410 return ;
411 }
412 TgAssert(FALSE, "RM_terminate() called when it's not available.", NULL);
413 }
414
RM_sendto(socket,buffer,buffsize)415 int RM_sendto(socket, buffer, buffsize)
416 int socket, buffsize;
417 void *buffer;
418 {
419 if (gRMCastIntrfInfo.pSharedLibHandle != NULL &&
420 gRMCastIntrfInfo.pfn_RM_sendto != NULL) {
421 return (gRMCastIntrfInfo.pfn_RM_sendto)(socket, buffer, buffsize);
422 }
423 TgAssert(FALSE, "RM_sendto() called when it's not available.", NULL);
424
425 return 0;
426 }
427
RM_recv(socket,buffer,buffsize)428 int RM_recv(socket, buffer, buffsize)
429 int socket, buffsize;
430 void *buffer;
431 {
432 if (gRMCastIntrfInfo.pSharedLibHandle != NULL &&
433 gRMCastIntrfInfo.pfn_RM_recv != NULL) {
434 return (gRMCastIntrfInfo.pfn_RM_recv)(socket, buffer, buffsize);
435 }
436 TgAssert(FALSE, "RM_recv() called when it's not available.", NULL);
437
438 return 0;
439 }
440
RM_getCurStatus(group,port,c)441 int RM_getCurStatus(group, port, c)
442 char *group;
443 int port;
444 CurStatus *c;
445 {
446 if (gRMCastIntrfInfo.pSharedLibHandle != NULL &&
447 gRMCastIntrfInfo.pfn_RM_getCurStatus != NULL) {
448 return (gRMCastIntrfInfo.pfn_RM_getCurStatus)(group, port, c);
449 }
450 TgAssert(FALSE, "RM_getCurStatus() called when it's not available.", NULL);
451
452 return 0;
453 }
454
RM_sendCurStatus(connfd,buff,buffsize)455 int RM_sendCurStatus(connfd, buff, buffsize)
456 int connfd, buffsize;
457 char *buff;
458 {
459 if (gRMCastIntrfInfo.pSharedLibHandle != NULL &&
460 gRMCastIntrfInfo.pfn_RM_sendCurStatus != NULL) {
461 return (gRMCastIntrfInfo.pfn_RM_sendCurStatus)(connfd, buff, buffsize);
462 }
463 TgAssert(FALSE, "RM_sendCurStatus() called when it's not available.", NULL);
464
465 return 0;
466 }
467
RM_readConfigFile(filename,show_config_file)468 int RM_readConfigFile(filename, show_config_file)
469 char *filename, show_config_file;
470 {
471 if (gRMCastIntrfInfo.pSharedLibHandle != NULL &&
472 gRMCastIntrfInfo.pfn_RM_readConfigFile != NULL) {
473 return (gRMCastIntrfInfo.pfn_RM_readConfigFile)(filename,
474 show_config_file);
475 }
476 TgAssert(FALSE, "RM_readConfigFile() called when it's not available.", NULL);
477
478 return 0;
479 }
480
RM_getOption(opt,return_value)481 void RM_getOption(opt, return_value)
482 int opt;
483 void *return_value;
484 {
485 if (gRMCastIntrfInfo.pSharedLibHandle != NULL &&
486 gRMCastIntrfInfo.pfn_RM_getOption != NULL) {
487 (gRMCastIntrfInfo.pfn_RM_getOption)(opt, return_value);
488 return;
489 }
490 TgAssert(FALSE, "RM_getOption() called when it's not available.", NULL);
491 }
492
RM_setOption(opt,optvalue)493 void RM_setOption(opt, optvalue)
494 int opt;
495 void *optvalue;
496 {
497 if (gRMCastIntrfInfo.pSharedLibHandle != NULL &&
498 gRMCastIntrfInfo.pfn_RM_setOption != NULL) {
499 (gRMCastIntrfInfo.pfn_RM_setOption)(opt, optvalue);
500 return;
501 }
502 TgAssert(FALSE, "RM_setOption() called when it's not available.", NULL);
503 }
504
RM_setHostDelay(hostname,estimated_one_way_delay)505 int RM_setHostDelay(hostname, estimated_one_way_delay)
506 char *hostname;
507 int estimated_one_way_delay;
508 {
509 if (gRMCastIntrfInfo.pSharedLibHandle != NULL &&
510 gRMCastIntrfInfo.pfn_RM_setHostDelay != NULL) {
511 return (gRMCastIntrfInfo.pfn_RM_setHostDelay)(hostname,
512 estimated_one_way_delay);
513 }
514 TgAssert(FALSE, "RM_setHostDelay() called when it's not available.", NULL);
515
516 return 0;
517 }
518
RM_getHostDelay(hostname,estimated_one_way_delay)519 int RM_getHostDelay(hostname, estimated_one_way_delay)
520 char *hostname;
521 int *estimated_one_way_delay;
522 {
523 if (gRMCastIntrfInfo.pSharedLibHandle != NULL &&
524 gRMCastIntrfInfo.pfn_RM_getHostDelay != NULL) {
525 return (gRMCastIntrfInfo.pfn_RM_getHostDelay)(hostname,
526 estimated_one_way_delay);
527 }
528 TgAssert(FALSE, "RM_getHostDelay() called when it's not available.", NULL);
529
530 return 0;
531 }
532
RMDEBUG_setpidip(pid,ip)533 void RMDEBUG_setpidip(pid, ip)
534 int pid;
535 char *ip;
536 {
537 if (gRMCastIntrfInfo.pSharedLibHandle != NULL &&
538 gRMCastIntrfInfo.pfn_RMDEBUG_setpidip != NULL) {
539 (gRMCastIntrfInfo.pfn_RMDEBUG_setpidip)(pid, ip);
540 return;
541 }
542 TgAssert(FALSE, "RMDEBUG_setpidip() called when it's not available.", NULL);
543 }
544
RMDEBUG_setsn(sn)545 void RMDEBUG_setsn(sn)
546 int sn;
547 {
548 if (gRMCastIntrfInfo.pSharedLibHandle != NULL &&
549 gRMCastIntrfInfo.pfn_RMDEBUG_setsn != NULL) {
550 (gRMCastIntrfInfo.pfn_RMDEBUG_setsn)(sn);
551 return;
552 }
553 TgAssert(FALSE, "RMDEBUG_setsn() called when it's not available.", NULL);
554 }
555 #endif /* _NO_RMCAST_SO */
556
557