* $Id: ortespy.c,v 0.0.0.1 2003/10/07
*
* DEBUG: section ortespy
- * AUTHOR: Petr Smolik petr.smolik@wo.cz
*
- * ORTE - OCERA Real-Time Ethernet http://www.ocera.org/
+ * -------------------------------------------------------------------
+ * ORTE
+ * Open Real-Time Ethernet
+ *
+ * Copyright (C) 2001-2006
+ * Department of Control Engineering FEE CTU Prague, Czech Republic
+ * http://dce.felk.cvut.cz
+ * http://www.ocera.org
+ *
+ * Author: Petr Smolik petr@smoliku.cz
+ * Advisor: Pavel Pisa
+ * Project Responsible: Zdenek Hanzalek
* --------------------------------------------------------------------
*
* This program is free software; you can redistribute it and/or modify
#ifndef _WIN32
#include <signal.h>
#endif
-#include "orte_api.h"
+#include "orte.h"
#ifdef HAVE_CONFIG_H
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
#include "string.h"
-ORTEDomain *d;
-NtpTime deadline,minimumSeparation;
-int32_t instanceRecv;
+#ifdef MAIN_RENAMED
+#define main orte_spy_main
+#define exit return
+#endif
+
+static ORTEDomain *d;
+static NtpTime deadline,minimumSeparation;
+static int32_t instanceRecv;
-void
+static void
recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam) {
char lbuff[MAX_STRING_NTPTIME_LENGTH];
char rbuff[MAX_STRING_NTPTIME_LENGTH];
NtpTimeToStringUs(info->remoteTimePublished, rbuff));
break;
case DEADLINE:
-// printf("deadline occured\n");
+// printf("deadline occurred\n");
break;
}
}
ORTESubscription*
subscriptionCallBack(const char *topic, const char *type, void *param) {
- ORTETypeRegisterAdd(d,type,NULL,NULL,0);
- if (strcmp(topic,"Red")==0) return NULL;
+ ORTETypeRegisterAdd(d,type,NULL,NULL,NULL,0);
+ if (strcmp((const char *)topic, (const char*)"Red")==0) return NULL;
return ORTESubscriptionCreate(
d,
IMMEDIATE,
&deadline,
&minimumSeparation,
recvCallBack,
- NULL);
+ NULL,
+ IPADDRESS_INVALID);
}
static void usage(void) {
printf(" -R, --refresh <s> refresh period in second(s)\n");
printf(" -P, --purge <s> purge time in second(s)\n");
printf(" -e, --expiration <s> expiration time of manager in second(s)\n");
+ printf(" -I, --metaMulticast <IPAdd> use multicast IPAddr for metatraffic comm.\n");
printf(" -l, --logfile <filename> set log file name\n");
printf(" -V, --version show version\n");
printf(" -h, --help this usage screen\n");
{ "refresh",1,0, 'R' },
{ "purge",1,0, 'P' },
{ "expiration",1,0, 'E' },
+ { "metaMulticast",1,0, 'I' },
{ "logfile",1,0, 'l' },
{ "version",0,0, 'V' },
{ "help", 0, 0, 'h' },
NTPTIME_BUILD(minimumSeparation,0);
#if defined HAVE_GETOPT_LONG || defined HAVE_GETOPT_LONG_ORTE
- while ((opt = getopt_long(argc, argv, "d:v:R:E:P:l:Vh",&long_opts[0], NULL)) != EOF) {
+ while ((opt = getopt_long(argc, argv, "d:v:R:E:I:P:l:Vh",&long_opts[0], NULL)) != EOF) {
#else
- while ((opt = getopt(argc, argv, "d:v:R:E:P:l:Vh")) != EOF) {
+ while ((opt = getopt(argc, argv, "d:v:R:E:I:P:l:Vh")) != EOF) {
#endif
switch (opt) {
case 'd':
case 'E':
NtpTimeAssembFromMs(dp.baseProp.expirationTime,strtol(optarg,NULL,0),0);
break;
+ case 'I':
+ dp.multicast.enabled=ORTE_TRUE;
+ dp.multicast.ipAddress=StringToIPAddress(optarg);
+ break;
case 'l':
ORTEVerbositySetLogFile(optarg);
case 'V':
- printf("Ocera Real-Time Ethernet (%s).\n",dp.version);
+ printf("Open Real-Time Ethernet (%s).\n",dp.version);
exit(0);
break;
case 'h':
printf("|------------------------------------------------------------------------------|\n");
d=ORTEDomainAppCreate(domain,&dp,NULL,ORTE_TRUE);
ORTEDomainAppSubscriptionPatternAdd(d,"*","*",subscriptionCallBack,NULL);
- ORTEDomainStart(d,ORTE_TRUE,ORTE_TRUE,ORTE_TRUE);
+ ORTEDomainStart(d,ORTE_TRUE,ORTE_FALSE,ORTE_TRUE,ORTE_FALSE,ORTE_TRUE);
while (1) {
ORTESleepMs(1000);
}