]> rtime.felk.cvut.cz Git - orte.git/commitdiff
Reformat the sources with orte/uncrustify script
authorMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 9 Feb 2015 16:45:53 +0000 (17:45 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 9 Feb 2015 16:47:02 +0000 (17:47 +0100)
149 files changed:
orte/contrib/decoder/decode_msg.c
orte/contrib/pharlap/ortedll.c
orte/contrib/pharlap/ortedll.h
orte/examples/hello/h_publisher.c
orte/examples/hello/h_subscriber.c
orte/examples/mpo/ddso/ddso_cb.c
orte/examples/mpo/ddso/ddso_cb.h
orte/examples/mpo/ddso/ddsop.c
orte/examples/mpo/ddso/ddsos.c
orte/examples/multicast/m_subscriber.c
orte/examples/ping/orteping.c
orte/examples/reliable/r_publisher.c
orte/examples/reliable/r_subscriber_besteffort.c
orte/examples/reliable/r_subscriber_reliable.c
orte/examples/robot/publisher.c
orte/examples/robot/subscriber.c
orte/examples/rtems-shell/app_def.h
orte/examples/rtems-shell/init.c
orte/examples/rtems-shell/networkconfig-i386-qemu.h
orte/examples/rtems-shell/networkconfig-static.h
orte/examples/rtems-shell/networkconfig.h
orte/examples/rtems-shell/orte_rtems_shell.c
orte/examples/rtems-shell/orte_rtems_shell.h
orte/examples/rtems-shell/system.h
orte/examples/schneider/schneider_subscriber.c
orte/examples/spy/ortespy.c
orte/include/defines.h
orte/include/globals.h
orte/include/jorte/4all.h
orte/include/jorte/jorte_protos_api.h
orte/include/jorte/jorte_typedefs_defines.h
orte/include/jorte/org_ocera_orte_Domain.h
orte/include/jorte/org_ocera_orte_DomainApp.h
orte/include/jorte/org_ocera_orte_DomainMgr.h
orte/include/jorte/org_ocera_orte_JOrte.h
orte/include/jorte/org_ocera_orte_Publication.h
orte/include/jorte/org_ocera_orte_Subscription.h
orte/include/jorte/org_ocera_orte_tools_Conversions.h
orte/include/jorte/org_ocera_orte_tools_GetORTEConstant.h
orte/include/jorte/org_ocera_orte_types_DomainEvents.h
orte/include/jorte/org_ocera_orte_types_DomainProp.h
orte/include/jorte/org_ocera_orte_types_NtpTime.h
orte/include/orte.h
orte/include/orte/basic_types.h
orte/include/orte/cdr.h
orte/include/orte/defines_api.h
orte/include/orte/ew_types.h
orte/include/orte/protos_api.h
orte/include/orte/typedefs_api.h
orte/include/orte/typedefs_defines_rtps.h
orte/include/orte_all.h
orte/include/orte_headers.h
orte/include/protos.h
orte/include/rtai/compat.h
orte/include/rtl/compat_onetd.h
orte/include/rtl/compat_rtlwip.h
orte/include/rtl/rwlock.h
orte/include/rtps_endian.h
orte/include/typedefs.h
orte/libjorte/JGetORTEConstant.c
orte/libjorte/JIPAddressToString.c
orte/libjorte/JNtpTimeToStringMs.c
orte/libjorte/JNtpTimeToStringUs.c
orte/libjorte/JORTEDomainAppCreate.c
orte/libjorte/JORTEDomainAppDestroy.c
orte/libjorte/JORTEDomainEvents.c
orte/libjorte/JORTEDomainEventsDestroy.c
orte/libjorte/JORTEDomainInitEvents.c
orte/libjorte/JORTEDomainMgrCreate.c
orte/libjorte/JORTEDomainMgrDestroy.c
orte/libjorte/JORTEDomainPropDefaultGet.c
orte/libjorte/JORTEDomainPropDestroy.c
orte/libjorte/JORTEDomainPropSet.c
orte/libjorte/JORTEDomainStart.c
orte/libjorte/JORTEInit.c
orte/libjorte/JORTEPublicationCreate.c
orte/libjorte/JORTEPublicationDestroy.c
orte/libjorte/JORTEPublicationGetStatus.c
orte/libjorte/JORTEPublicationPropertiesGet.c
orte/libjorte/JORTEPublicationPropertiesSet.c
orte/libjorte/JORTEPublicationSend.c
orte/libjorte/JORTEPublicationWaitForSubscriptions.c
orte/libjorte/JORTESleepMs.c
orte/libjorte/JORTESubscriptionCreate.c
orte/libjorte/JORTESubscriptionDestroy.c
orte/libjorte/JORTESubscriptionGetStatus.c
orte/libjorte/JORTESubscriptionPropertiesGet.c
orte/libjorte/JORTESubscriptionPropertiesSet.c
orte/libjorte/JORTESubscriptionPull.c
orte/libjorte/JORTESubscriptionWaitForPublications.c
orte/libjorte/JORTETypeRegisterAdd.c
orte/libjorte/JORTETypeRegisterDestroyAll.c
orte/libjorte/JORTEVerbositySetLogFile.c
orte/libjorte/JORTEVerbositySetOptions.c
orte/libjorte/JStringToIPAddress.c
orte/libjorte/createAppInfo.c
orte/libjorte/createPubInfo.c
orte/libjorte/createSubInfo.c
orte/libjorte/getNtpTime.c
orte/libjorte/onLoad.c
orte/libjorte/setRecvInfo.c
orte/libjorte/setTopic.c
orte/libjorte/setType.c
orte/liborte/ORTEAppRecvThread.c
orte/liborte/ORTEAppSendThread.c
orte/liborte/ORTEDomain.c
orte/liborte/ORTEDomainApp.c
orte/liborte/ORTEDomainMgr.c
orte/liborte/ORTEInit.c
orte/liborte/ORTEMisc.c
orte/liborte/ORTEPattern.c
orte/liborte/ORTEPublication.c
orte/liborte/ORTEPublicationTimer.c
orte/liborte/ORTESubscription.c
orte/liborte/ORTEThreadUtils.c
orte/liborte/ORTETypeRegister.c
orte/liborte/ORTEVerbosity.c
orte/liborte/RTPSAck.c
orte/liborte/RTPSCSTReader.c
orte/liborte/RTPSCSTReaderProc.c
orte/liborte/RTPSCSTReaderTimer.c
orte/liborte/RTPSCSTWriter.c
orte/liborte/RTPSCSTWriterTimer.c
orte/liborte/RTPSGap.c
orte/liborte/RTPSHeader.c
orte/liborte/RTPSHeardBeat.c
orte/liborte/RTPSInfoDST.c
orte/liborte/RTPSInfoREPLY.c
orte/liborte/RTPSInfoSRC.c
orte/liborte/RTPSInfoTS.c
orte/liborte/RTPSIssue.c
orte/liborte/RTPSPad.c
orte/liborte/RTPSUtils.c
orte/liborte/RTPSVar.c
orte/liborte/cdr.c
orte/liborte/conv.c
orte/liborte/debug.c
orte/liborte/event.c
orte/liborte/fnmatch.c
orte/liborte/htimerNtp.c
orte/liborte/objectEntry.c
orte/liborte/objectEntryTimer.c
orte/liborte/objectUtils.c
orte/liborte/parameter.c
orte/liborte/sock.c
orte/manager/ortemanager.c
orte/manager/service.c
orte/templates/templates.c
orte/templates/templates.h

index 045505991034167d1d13685d569f6f1c6b1473ee..2eb0476e6027066e2c6e6dd541f25db95ad3734b 100644 (file)
 #include <typedefs_defines_rtps.h>
 
 // global variables
-  FILE *ptr_in, *ptr_out;
+FILE *ptr_in, *ptr_out;
 
 
 /**********************************************************************************/
-void conv_u32(uint32_t *x,uint8_t ef) {
+void
+conv_u32(uint32_t *x, uint8_t ef)
+{
   #if __BYTE_ORDER == __LITTLE_ENDIAN
-     if(ef) bswap_32(*x);
+  if (ef)
+    bswap_32(*x);
   #elif __BYTE_ORDER == __BIG_ENDIAN
-     if(!ef)bswap_32(*x);
+  if (!ef)
+    bswap_32(*x);
   #endif
 }
 
 /**********************************************************************************/
-void print_obj(void *obj) {
-  fprintf(ptr_out," (");
-  switch (bswap_32(*((uint32_t*)obj))) {
+void
+print_obj(void *obj)
+{
+  fprintf(ptr_out, " (");
+  switch (bswap_32(*((uint32_t *)obj))) {
     case OID_APP:
-      fprintf(ptr_out,"ManagedApplicaton or Manager");
+      fprintf(ptr_out, "ManagedApplicaton or Manager");
       break;
     case OID_WRITE_APPSELF:
-      fprintf(ptr_out,"Write appself");
+      fprintf(ptr_out, "Write appself");
       break;
     case OID_WRITE_APP:
-      fprintf(ptr_out,"Write app");
+      fprintf(ptr_out, "Write app");
       break;
     case OID_READ_APP:
-      fprintf(ptr_out,"Read app");
+      fprintf(ptr_out, "Read app");
       break;
     case OID_WRITE_MGR:
-      fprintf(ptr_out,"Write mgr");
+      fprintf(ptr_out, "Write mgr");
       break;
     case OID_READ_MGR:
-      fprintf(ptr_out,"Read mgr");
+      fprintf(ptr_out, "Read mgr");
       break;
     case OID_WRITE_PUBL:
-      fprintf(ptr_out,"Write publ");
+      fprintf(ptr_out, "Write publ");
       break;
     case OID_READ_PUBL:
-      fprintf(ptr_out,"Read publ");
+      fprintf(ptr_out, "Read publ");
       break;
     case OID_WRITE_SUBS:
-      fprintf(ptr_out,"Write subs");
+      fprintf(ptr_out, "Write subs");
       break;
     case OID_READ_SUBS:
-      fprintf(ptr_out,"Read subs");
+      fprintf(ptr_out, "Read subs");
       break;
     default:
-      fprintf(ptr_out,"unknown");
+      fprintf(ptr_out, "unknown");
       break;
   }
-  fprintf(ptr_out,")\n");
-}                    
+  fprintf(ptr_out, ")\n");
+}
 
 /**********************************************************************************/
-void print_app(uint8_t app) {
+void
+print_app(uint8_t app)
+{
   switch (app) {
     case MANAGEDAPPLICATION:
-      fprintf(ptr_out,"(managed application)\n");
+      fprintf(ptr_out, "(managed application)\n");
       break;
     case MANAGER:
-      fprintf(ptr_out,"(manager)\n");
+      fprintf(ptr_out, "(manager)\n");
       break;
     default:
-      fprintf(ptr_out,"(unknown class)\n");
-      break;    
+      fprintf(ptr_out, "(unknown class)\n");
+      break;
   }
-}                         
+}
 
 /**********************************************************************************/
-void decode_parametr_sequence(uint8_t *msg) {
+void
+decode_parametr_sequence(uint8_t *msg)
+{
   NtpTime            ts;
   ProtocolVersion    pv;
   VendorId           vid;
   SequenceNumber     sn;
-  uint8_t      i,j,l;
+  uint8_t      i, j, l;
   uint8_t      *k;
 
-  while(*((ParameterId*)msg)!=PID_SENTINEL) {
-    printf("id%d,len%d\n",*((ParameterId*)msg),*((ParameterLength*)(msg+2)));
-    if ((*((ParameterLength*)(msg+2)))==0) break;
-    switch(*(ParameterId*)msg) {
+  while (*((ParameterId *)msg) != PID_SENTINEL) {
+    printf("id%d,len%d\n", *((ParameterId *)msg), *((ParameterLength *)(msg+2)));
+    if ((*((ParameterLength *)(msg+2))) == 0)
+      break;
+    switch (*(ParameterId *)msg) {
       case PID_PAD:
-        fprintf(ptr_out,"     PID_PAD                              :\n");
-        break;
+       fprintf(ptr_out, "     PID_PAD                              :\n");
+       break;
       case PID_EXPIRATION_TIME:
-        ts=*((NtpTime*)(msg+4));
-        fprintf(ptr_out,"     PID_EXPIRATION_TIME                  : %u,%u\n",
-                       ts.seconds,ts.fraction);
-        break;
+       ts = *((NtpTime *)(msg+4));
+       fprintf(ptr_out, "     PID_EXPIRATION_TIME                  : %u,%u\n",
+               ts.seconds, ts.fraction);
+       break;
       case PID_PERSISTENCE:
-        ts=*((NtpTime*)(msg+4));
-        fprintf(ptr_out,"     PID_PERSISTENCE                      : %u,%u\n",
-                       ts.seconds,ts.fraction);
-        break;
+       ts = *((NtpTime *)(msg+4));
+       fprintf(ptr_out, "     PID_PERSISTENCE                      : %u,%u\n",
+               ts.seconds, ts.fraction);
+       break;
       case PID_MINIMUM_SEPARATION:
-        ts=*((NtpTime*)(msg+4));
-        fprintf(ptr_out,"     PID_MINIMUM_SEPARATION               : %u,%u\n",
-                       ts.seconds,ts.fraction);
-        break;
+       ts = *((NtpTime *)(msg+4));
+       fprintf(ptr_out, "     PID_MINIMUM_SEPARATION               : %u,%u\n",
+               ts.seconds, ts.fraction);
+       break;
       case PID_TOPIC:
-        fprintf(ptr_out,"     PID_TOPIC                            :\n");
-        k=msg+4;
+       fprintf(ptr_out, "     PID_TOPIC                            :\n");
+       k = msg+4;
        //len of message is also in message (first ulong)
-        l=(*(uint32_t*)(msg+4))+4;
-        while(l!=0) {
-          if (l>8) j=8;
-         else j=l;
-         l-=j; 
-          fprintf(ptr_out,"                    : ");
-          for(i=0;i<j;i++,k++) fprintf(ptr_out,"%02X ",k[0]);
-          if (l==0) {
-            for(i=j;i<8;i++) fprintf(ptr_out,"   ");
-         } 
-         k-=j;
-          for(i=0;i<j;i++,k++) fprintf(ptr_out,"%c",k[0]);
-          fprintf(ptr_out,"\n");
-        } 
-        break;
+       l = (*(uint32_t *)(msg+4))+4;
+       while (l != 0) {
+         if (l > 8)
+           j = 8;
+         else
+           j = l;
+         l -= j;
+         fprintf(ptr_out, "                    : ");
+         for (i = 0; i < j; i++, k++)
+           fprintf(ptr_out, "%02X ", k[0]);
+         if (l == 0) {
+           for (i = j; i < 8; i++)
+             fprintf(ptr_out, "   ");
+         }
+         k -= j;
+         for (i = 0; i < j; i++, k++)
+           fprintf(ptr_out, "%c", k[0]);
+         fprintf(ptr_out, "\n");
+       }
+       break;
       case PID_STRENGTH:
-        fprintf(ptr_out,"     PID_STRENGTH                         : %u\n",
-                       *(uint32_t*)(msg+4));
-        break;
+       fprintf(ptr_out, "     PID_STRENGTH                         : %u\n",
+               *(uint32_t *)(msg+4));
+       break;
       case PID_TYPE_NAME:
-        fprintf(ptr_out,"     PID_TYPE_NAME                        :\n");
-        k=msg+4;
+       fprintf(ptr_out, "     PID_TYPE_NAME                        :\n");
+       k = msg+4;
        //len of message is also in message (first ulong)
-        l=(*(uint32_t*)(msg+4))+4;
-        while(l!=0) {
-          if (l>8) j=8;
-         else j=l;
-         l-=j; 
-          fprintf(ptr_out,"                    : ");
-          for(i=0;i<j;i++,k++) fprintf(ptr_out,"%02X ",k[0]);
-          if (l==0) {
-            for(i=j;i<8;i++) fprintf(ptr_out,"   ");
-         } 
-         k-=j;
-          for(i=0;i<j;i++,k++) fprintf(ptr_out,"%c",k[0]);
-          fprintf(ptr_out,"\n");
-        } 
-        break;
+       l = (*(uint32_t *)(msg+4))+4;
+       while (l != 0) {
+         if (l > 8)
+           j = 8;
+         else
+           j = l;
+         l -= j;
+         fprintf(ptr_out, "                    : ");
+         for (i = 0; i < j; i++, k++)
+           fprintf(ptr_out, "%02X ", k[0]);
+         if (l == 0) {
+           for (i = j; i < 8; i++)
+             fprintf(ptr_out, "   ");
+         }
+         k -= j;
+         for (i = 0; i < j; i++, k++)
+           fprintf(ptr_out, "%c", k[0]);
+         fprintf(ptr_out, "\n");
+       }
+       break;
       case PID_TYPE_CHECKSUM:
-        fprintf(ptr_out,"     PID_TYPE_CHECKSUM                    : %u\n",
-                       *(TypeChecksum*)(msg+4));
-        break;
+       fprintf(ptr_out, "     PID_TYPE_CHECKSUM                    : %u\n",
+               *(TypeChecksum *)(msg+4));
+       break;
       case RTPS_PID_TYPE2_NAME:
-        fprintf(ptr_out,"     RTPS_PID_TYPE2_NAME                  :\n");
-        break;
+       fprintf(ptr_out, "     RTPS_PID_TYPE2_NAME                  :\n");
+       break;
       case RTPS_PID_TYPE2_CHECKSUM:
-        fprintf(ptr_out,"     RTPS_PID_TYPE2_CHECKSUM              :\n");
-        break;
+       fprintf(ptr_out, "     RTPS_PID_TYPE2_CHECKSUM              :\n");
+       break;
       case PID_MATATRAFFIC_MULTICAST_IPADDRESS:
-        fprintf(ptr_out,"     PID_MATATRAFFIC_MULTICAST_IPADDRESS  : %u.%u.%u.%u\n",
-                       msg[7],msg[6],msg[5],msg[4]);
-        break;
+       fprintf(ptr_out, "     PID_MATATRAFFIC_MULTICAST_IPADDRESS  : %u.%u.%u.%u\n",
+               msg[7], msg[6], msg[5], msg[4]);
+       break;
       case PID_APP_IPADDRESS:
-        fprintf(ptr_out,"     PID_APP_IPADDRESS                    : %u.%u.%u.%u\n",
-                       msg[7],msg[6],msg[5],msg[4]);
-        break;
+       fprintf(ptr_out, "     PID_APP_IPADDRESS                    : %u.%u.%u.%u\n",
+               msg[7], msg[6], msg[5], msg[4]);
+       break;
       case PID_METATRAFFIC_UNICAST_PORT:
-        fprintf(ptr_out,"     PID_METATRAFFIC_UNICAST_PORT         : %u\n",
-                       *(Port*)(msg+4));
-        break;
+       fprintf(ptr_out, "     PID_METATRAFFIC_UNICAST_PORT         : %u\n",
+               *(Port *)(msg+4));
+       break;
       case PID_USERDATA_UNICAST_PORT:
-        fprintf(ptr_out,"     PID_USERDATA_UNICAST_PORT            : %u\n",
-                       *(Port*)(msg+4));
-        break;
+       fprintf(ptr_out, "     PID_USERDATA_UNICAST_PORT            : %u\n",
+               *(Port *)(msg+4));
+       break;
       case PID_EXPECTS_ACK:
-        fprintf(ptr_out,"     PID_EXPECTS_ACK                      : %u\n",
-                       *(uint32_t*)(msg+4));
-        break;
+       fprintf(ptr_out, "     PID_EXPECTS_ACK                      : %u\n",
+               *(uint32_t *)(msg+4));
+       break;
       case PID_USERDATA_MULTICAST_IPADDRESS:
-        fprintf(ptr_out,"     PID_USERDATA_MULTICAST_IPADDRESS     : %u.%u.%u.%u\n",
-                       msg[7],msg[6],msg[5],msg[4]);
-        break;
+       fprintf(ptr_out, "     PID_USERDATA_MULTICAST_IPADDRESS     : %u.%u.%u.%u\n",
+               msg[7], msg[6], msg[5], msg[4]);
+       break;
       case PID_MANAGER_KEY:
-        fprintf(ptr_out,"     PID_MANAGER_KEY                      : 0x%02x%02x%02x%02x (%u.%u.%u.%u)\n",
-                       msg[7],msg[6],msg[5],msg[4],msg[7],msg[6],msg[5],msg[4]);
-        break;
+       fprintf(ptr_out, "     PID_MANAGER_KEY                      : 0x%02x%02x%02x%02x (%u.%u.%u.%u)\n",
+               msg[7], msg[6], msg[5], msg[4], msg[7], msg[6], msg[5], msg[4]);
+       break;
       case PID_SEND_QUEUE_SIZE:
-        fprintf(ptr_out,"     PID_SEND_QUEUE_SIZE                  : %u\n",
-                       *(uint32_t*)(msg+4));
-        break;
+       fprintf(ptr_out, "     PID_SEND_QUEUE_SIZE                  : %u\n",
+               *(uint32_t *)(msg+4));
+       break;
       case PID_PROTOCOL_VERSION:
-        pv=*((ProtocolVersion*)(msg+4));
-        fprintf(ptr_out,"     PID_PROTOCOL_VERSION                 : %u.%u\n",
-               pv.major,pv.minor);
-        break;
+       pv = *((ProtocolVersion *)(msg+4));
+       fprintf(ptr_out, "     PID_PROTOCOL_VERSION                 : %u.%u\n",
+               pv.major, pv.minor);
+       break;
       case PID_VENDOR_ID:
-        vid=*((VendorId*)(msg+4));
-        fprintf(ptr_out,"     PID_VENDOR_ID                        : %u.%u\n",
-               vid.major,vid.minor);
-        break;
+       vid = *((VendorId *)(msg+4));
+       fprintf(ptr_out, "     PID_VENDOR_ID                        : %u.%u\n",
+               vid.major, vid.minor);
+       break;
       case PID_VARGAPPS_SEQUENCE_NUMBER_LAST:
-        sn=*((SequenceNumber*)(msg+4));
-        fprintf(ptr_out,"     PID_VARGAPPS_SEQUENCE_NUMBER_LAST    : %u\n",sn.low);
-        break;
+       sn = *((SequenceNumber *)(msg+4));
+       fprintf(ptr_out, "     PID_VARGAPPS_SEQUENCE_NUMBER_LAST    : %u\n", sn.low);
+       break;
       case PID_RECV_QUEUE_SIZE:
-        fprintf(ptr_out,"     PID_RECV_QUEUE_SIZE                  : %u\n",
-                       *(uint32_t*)(msg+4));
-        break;
+       fprintf(ptr_out, "     PID_RECV_QUEUE_SIZE                  : %u\n",
+               *(uint32_t *)(msg+4));
+       break;
       case PID_RELIABILITY_OFFERED:
-        fprintf(ptr_out,"     PID_RELIABILITY_OFFERED              : %u\n",
-                       *(uint32_t*)(msg+4));
-        break;
+       fprintf(ptr_out, "     PID_RELIABILITY_OFFERED              : %u\n",
+               *(uint32_t *)(msg+4));
+       break;
       case PID_RELIABILITY_REQUESTED:
-        fprintf(ptr_out,"     PID_RELIABILITY_REQUESTED            : %u\n",
-                       *(uint32_t*)(msg+4));
-        break;
+       fprintf(ptr_out, "     PID_RELIABILITY_REQUESTED            : %u\n",
+               *(uint32_t *)(msg+4));
+       break;
       default:
-        fprintf(ptr_out,"     unknow paramerId                 : %d len : %d\n",
-                *((ParameterId*)msg),*((ParameterLength*)(msg+2)));
-       break;      
+       fprintf(ptr_out, "     unknow paramerId                 : %d len : %d\n",
+               *((ParameterId *)msg), *((ParameterLength *)(msg+2)));
+       break;
     }
-    msg+=(*((ParameterLength*)(msg+2)))+4;                      /* next message */
+    msg += (*((ParameterLength *)(msg+2)))+4;                      /* next message */
   }
-  msg+=(*((ParameterLength*)(msg+2)))+4;                        /* message end*/
+  msg += (*((ParameterLength *)(msg+2)))+4;                        /* message end*/
 }
 
 
 /**********************************************************************************/
-int decode_header(uint8_t *msg, unsigned len, MessageInterpret *mi) {
-  if (len<16) return -1;                          /* message is to small */
-  if (msg[0]!='R') return -2;                     /* header is invalid */
-  if (msg[1]!='T') return -2;                     /* header is invalid */
-  if (msg[2]!='P') return -2;                     /* header is invalid */
-  if (msg[3]!='S') return -2;                     /* header is invalid */
-  mi->sourceVersion=*((ProtocolVersion*)(msg+4)); /* ProtocolVersion */
-  mi->sourceVendorId=*((VendorId*)(msg+6));       /* Vendor Id */
-  mi->sourceHostId=*((HostId*)(msg+8));           /* Host Id */
-  mi->sourceAppId=*((AppId*)(msg+12));            /* App Id */
-  mi->haveTimestamp=0;                           /* false */
+int
+decode_header(uint8_t *msg, unsigned len, MessageInterpret *mi)
+{
+  if (len < 16)
+    return -1;                                    /* message is to small */
+  if (msg[0] != 'R')
+    return -2;                                    /* header is invalid */
+  if (msg[1] != 'T')
+    return -2;                                    /* header is invalid */
+  if (msg[2] != 'P')
+    return -2;                                    /* header is invalid */
+  if (msg[3] != 'S')
+    return -2;                                    /* header is invalid */
+  mi->sourceVersion = *((ProtocolVersion *)(msg+4)); /* ProtocolVersion */
+  mi->sourceVendorId = *((VendorId *)(msg+6));       /* Vendor Id */
+  mi->sourceHostId = *((HostId *)(msg+8));           /* Host Id */
+  mi->sourceAppId = *((AppId *)(msg+12));            /* App Id */
+  mi->haveTimestamp = 0;                            /* false */
   return 0;
 }
 
 /**********************************************************************************/
-int decode_submessage(uint8_t *msg, int ptr, MessageInterpret *mi) {
+int
+decode_submessage(uint8_t *msg, int ptr, MessageInterpret *mi)
+{
   IPAddress          ipa;
   Port               port;
-  ObjectId           roid,woid,oid;
-  SequenceNumber     fsn,lsn,wsn;
-  uint8_t      i,j,l;
+  ObjectId           roid, woid, oid;
+  SequenceNumber     fsn, lsn, wsn;
+  uint8_t      i, j, l;
   uint8_t      *k;
   HostId             hid;
   AppId              aid;
@@ -257,189 +287,203 @@ int decode_submessage(uint8_t *msg, int ptr, MessageInterpret *mi) {
 
   switch ((SubmessageId)msg[ptr]) {
     case PAD:
-      fprintf(ptr_out,"   PAD\n");
+      fprintf(ptr_out, "   PAD\n");
       break;
     case VAR:
-      fprintf(ptr_out,"   VAR\n");
-      fprintf(ptr_out,"     h-bit          : %d\n",(msg[ptr+1] & 8) ? 1:0);
-      fprintf(ptr_out,"     alive-bit      : %d\n",(msg[ptr+1] & 4) ? 1:0);
-      fprintf(ptr_out,"     p-bit          : %d\n",(msg[ptr+1] & 2) ? 1:0);
-      roid=*((ObjectId*)(msg+ptr+4));
-      fprintf(ptr_out,"     ObjectId       : %d.%d.%d.%02x",
-                        *(uint8_t*)&roid,*(((uint8_t*)&roid)+1),*(((uint8_t*)&roid)+2),*(((uint8_t*)&roid)+3));
-      print_obj(&roid);                      
-      woid=*((ObjectId*)(msg+ptr+8));
-      fprintf(ptr_out,"     ObjectId       : %d.%d.%d.%02x",
-                        *(uint8_t*)&woid,*(((uint8_t*)&woid)+1),*(((uint8_t*)&woid)+2),*(((uint8_t*)&woid)+3));
-      print_obj(&woid);                      
+      fprintf(ptr_out, "   VAR\n");
+      fprintf(ptr_out, "     h-bit          : %d\n", (msg[ptr+1] & 8) ? 1 : 0);
+      fprintf(ptr_out, "     alive-bit      : %d\n", (msg[ptr+1] & 4) ? 1 : 0);
+      fprintf(ptr_out, "     p-bit          : %d\n", (msg[ptr+1] & 2) ? 1 : 0);
+      roid = *((ObjectId *)(msg+ptr+4));
+      fprintf(ptr_out, "     ObjectId       : %d.%d.%d.%02x",
+             *(uint8_t *)&roid, *(((uint8_t *)&roid)+1), *(((uint8_t *)&roid)+2), *(((uint8_t *)&roid)+3));
+      print_obj(&roid);
+      woid = *((ObjectId *)(msg+ptr+8));
+      fprintf(ptr_out, "     ObjectId       : %d.%d.%d.%02x",
+             *(uint8_t *)&woid, *(((uint8_t *)&woid)+1), *(((uint8_t *)&woid)+2), *(((uint8_t *)&woid)+3));
+      print_obj(&woid);
       if (msg[ptr+1] & 8) {
-        hid=*((HostId*)(msg+ptr+12));                   /* hostId */
-        aid=*((AppId*)(msg+ptr+16));                   /* appId */
-        fprintf(ptr_out,"     HostId         : %d.%d.%d.%d\n",
-                        *(uint8_t*)&hid,*(((uint8_t*)&hid)+1),*(((uint8_t*)&hid)+2),*(((uint8_t*)&hid)+3));
-        fprintf(ptr_out,"     AppId          : %d.%d.%d.%d ",
-                        *(uint8_t*)&aid,*(((uint8_t*)&aid)+1),*(((uint8_t*)&aid)+2),*(((uint8_t*)&aid)+3));
-        print_app(*(((uint8_t*)&aid)+3));
-        ptr_off=8;
-      } else ptr_off=0;
-      oid=*((ObjectId*)(msg+ptr+12+ptr_off));
-      fprintf(ptr_out,"     ObjectId       : %d.%d.%d.%02x",
-                        *(uint8_t*)&oid,*(((uint8_t*)&oid)+1),*(((uint8_t*)&oid)+2),*(((uint8_t*)&oid)+3));
-      print_obj(&oid);               
-      wsn=*((SequenceNumber*)(msg+ptr+16+ptr_off));
-      fprintf(ptr_out,"     sequenceNumber : %u\n",wsn.low);                 
+       hid = *((HostId *)(msg+ptr+12));                   /* hostId */
+       aid = *((AppId *)(msg+ptr+16));                   /* appId */
+       fprintf(ptr_out, "     HostId         : %d.%d.%d.%d\n",
+               *(uint8_t *)&hid, *(((uint8_t *)&hid)+1), *(((uint8_t *)&hid)+2), *(((uint8_t *)&hid)+3));
+       fprintf(ptr_out, "     AppId          : %d.%d.%d.%d ",
+               *(uint8_t *)&aid, *(((uint8_t *)&aid)+1), *(((uint8_t *)&aid)+2), *(((uint8_t *)&aid)+3));
+       print_app(*(((uint8_t *)&aid)+3));
+       ptr_off = 8;
+      } else
+       ptr_off = 0;
+      oid = *((ObjectId *)(msg+ptr+12+ptr_off));
+      fprintf(ptr_out, "     ObjectId       : %d.%d.%d.%02x",
+             *(uint8_t *)&oid, *(((uint8_t *)&oid)+1), *(((uint8_t *)&oid)+2), *(((uint8_t *)&oid)+3));
+      print_obj(&oid);
+      wsn = *((SequenceNumber *)(msg+ptr+16+ptr_off));
+      fprintf(ptr_out, "     sequenceNumber : %u\n", wsn.low);
       if (msg[ptr+1] & 2) {
-        decode_parametr_sequence(msg+ptr+24+ptr_off);
+       decode_parametr_sequence(msg+ptr+24+ptr_off);
       }
       break;
     case ISSUE:
-      fprintf(ptr_out,"   ISSUE\n");
-      roid=*((ObjectId*)(msg+ptr+4));woid=*((ObjectId*)(msg+ptr+8));
-      fsn=*((SequenceNumber*)(msg+ptr+12));
-      fprintf(ptr_out,"     p-bit          : %d\n",(msg[ptr+1] & 2) ? 1:0);
-      fprintf(ptr_out,"     readerObjectId : %d.%d.%d.%02x",
-                      *(uint8_t*)&roid,*(((uint8_t*)&roid)+1),*(((uint8_t*)&roid)+2),*(((uint8_t*)&roid)+3));
-      print_obj(&roid);                      
-      fprintf(ptr_out,"     writeObjectId  : %d.%d.%d.%02x",
-                      *(uint8_t*)&woid,*(((uint8_t*)&woid)+1),*(((uint8_t*)&woid)+2),*(((uint8_t*)&woid)+3));
-      print_obj(&woid);                      
-      fprintf(ptr_out,"     issueSeqNumber : %u\n",fsn.low);                 
-      k=msg+ptr+20;
+      fprintf(ptr_out, "   ISSUE\n");
+      roid = *((ObjectId *)(msg+ptr+4));
+      woid = *((ObjectId *)(msg+ptr+8));
+      fsn = *((SequenceNumber *)(msg+ptr+12));
+      fprintf(ptr_out, "     p-bit          : %d\n", (msg[ptr+1] & 2) ? 1 : 0);
+      fprintf(ptr_out, "     readerObjectId : %d.%d.%d.%02x",
+             *(uint8_t *)&roid, *(((uint8_t *)&roid)+1), *(((uint8_t *)&roid)+2), *(((uint8_t *)&roid)+3));
+      print_obj(&roid);
+      fprintf(ptr_out, "     writeObjectId  : %d.%d.%d.%02x",
+             *(uint8_t *)&woid, *(((uint8_t *)&woid)+1), *(((uint8_t *)&woid)+2), *(((uint8_t *)&woid)+3));
+      print_obj(&woid);
+      fprintf(ptr_out, "     issueSeqNumber : %u\n", fsn.low);
+      k = msg+ptr+20;
       if (msg[ptr+1] & 2) {
-        decode_parametr_sequence(k);          /* after k is set to end of paramseq. */
+       decode_parametr_sequence(k);          /* after k is set to end of paramseq. */
       }
 //      l=(*(unsigned*)(msg+ptr+2))-(k-(msg+ptr+20)+16);
-      //len of message is also in message (first ulong), internaly defined by RTI !!! 
-      l=(*(uint32_t*)k)+4;
-      while(l!=0) {
-        if (l>8) j=8;
-       else j=l;
-       l-=j; 
-        fprintf(ptr_out,"                    : ");
-        for(i=0;i<j;i++,k++) fprintf(ptr_out,"%02X ",k[0]);
-        if (l==0) {
-          for(i=j;i<8;i++) fprintf(ptr_out,"   ");
-        } 
-       k-=j;
-        for(i=0;i<j;i++,k++) fprintf(ptr_out,"%c",k[0]);
-        fprintf(ptr_out,"\n");
-      }        
+      //len of message is also in message (first ulong), internaly defined by RTI !!!
+      l = (*(uint32_t *)k)+4;
+      while (l != 0) {
+       if (l > 8)
+         j = 8;
+       else
+         j = l;
+       l -= j;
+       fprintf(ptr_out, "                    : ");
+       for (i = 0; i < j; i++, k++)
+         fprintf(ptr_out, "%02X ", k[0]);
+       if (l == 0) {
+         for (i = j; i < 8; i++)
+           fprintf(ptr_out, "   ");
+       }
+       k -= j;
+       for (i = 0; i < j; i++, k++)
+         fprintf(ptr_out, "%c", k[0]);
+       fprintf(ptr_out, "\n");
+      }
       break;
     case ACK:
-      fprintf(ptr_out,"   ACK\n");
-      roid=*((ObjectId*)(msg+ptr+4));woid=*((ObjectId*)(msg+ptr+8));
-      fprintf(ptr_out,"     final-bit      : %d\n",(msg[ptr+1] & 2) ? 1:0);
-      fprintf(ptr_out,"     readerObjectId : %d.%d.%d.%02x",
-                      *(uint8_t*)&roid,*(((uint8_t*)&roid)+1),*(((uint8_t*)&roid)+2),*(((uint8_t*)&roid)+3));
-      print_obj(&roid);                      
-      fprintf(ptr_out,"     writeObjectId  : %d.%d.%d.%02x",
-                      *(uint8_t*)&woid,*(((uint8_t*)&woid)+1),*(((uint8_t*)&woid)+2),*(((uint8_t*)&woid)+3));
-      print_obj(&woid);                      
-      fprintf(ptr_out,"     bitmap         : %u/%u:",*((uint32_t*)(msg+ptr+16)),
-                      *((uint32_t*)(msg+ptr+20)));
-      for(i=0;i<msg[ptr+20]/8;) {
-        for(j=128;j!=0;j>>=1) fprintf(ptr_out,"%d",(msg[ptr+24+i] & j) ? 1:0);
-       fprintf(ptr_out," ");
-       if ((!(++i % 4)) && (i<msg[ptr+20]/8)) 
-         fprintf(ptr_out,"\n                          :");
+      fprintf(ptr_out, "   ACK\n");
+      roid = *((ObjectId *)(msg+ptr+4));
+      woid = *((ObjectId *)(msg+ptr+8));
+      fprintf(ptr_out, "     final-bit      : %d\n", (msg[ptr+1] & 2) ? 1 : 0);
+      fprintf(ptr_out, "     readerObjectId : %d.%d.%d.%02x",
+             *(uint8_t *)&roid, *(((uint8_t *)&roid)+1), *(((uint8_t *)&roid)+2), *(((uint8_t *)&roid)+3));
+      print_obj(&roid);
+      fprintf(ptr_out, "     writeObjectId  : %d.%d.%d.%02x",
+             *(uint8_t *)&woid, *(((uint8_t *)&woid)+1), *(((uint8_t *)&woid)+2), *(((uint8_t *)&woid)+3));
+      print_obj(&woid);
+      fprintf(ptr_out, "     bitmap         : %u/%u:", *((uint32_t *)(msg+ptr+16)),
+             *((uint32_t *)(msg+ptr+20)));
+      for (i = 0; i < msg[ptr+20]/8; ) {
+       for (j = 128; j != 0; j >>= 1)
+         fprintf(ptr_out, "%d", (msg[ptr+24+i] & j) ? 1 : 0);
+       fprintf(ptr_out, " ");
+       if ((!(++i % 4)) && (i < msg[ptr+20]/8))
+         fprintf(ptr_out, "\n                          :");
       }
-      fprintf(ptr_out,"\n");                 
+      fprintf(ptr_out, "\n");
       break;
     case HEARTBEAT:
-      fprintf(ptr_out,"   HEARTBEAT\n");
-      roid=*((ObjectId*)(msg+ptr+4));woid=*((ObjectId*)(msg+ptr+8));
-      fsn=*((SequenceNumber*)(msg+ptr+12));lsn=*((SequenceNumber*)(msg+ptr+20));
-      fprintf(ptr_out,"     final-bit      : %d\n",(msg[ptr+1] & 2) ? 1:0);
-      fprintf(ptr_out,"     readerObjectId : %d.%d.%d.%02x",
-                      *(uint8_t*)&roid,*(((uint8_t*)&roid)+1),*(((uint8_t*)&roid)+2),*(((uint8_t*)&roid)+3));
-      print_obj(&roid);                      
-      fprintf(ptr_out,"     writeObjectId  : %d.%d.%d.%02x",
-                      *(uint8_t*)&woid,*(((uint8_t*)&woid)+1),*(((uint8_t*)&woid)+2),*(((uint8_t*)&woid)+3));
-      print_obj(&woid);                      
-      fprintf(ptr_out,"     firstSeqNumber : %u\n",fsn.low);                 
-      fprintf(ptr_out,"     lastSeqNumber  : %u\n",lsn.low);                 
+      fprintf(ptr_out, "   HEARTBEAT\n");
+      roid = *((ObjectId *)(msg+ptr+4));
+      woid = *((ObjectId *)(msg+ptr+8));
+      fsn = *((SequenceNumber *)(msg+ptr+12));
+      lsn = *((SequenceNumber *)(msg+ptr+20));
+      fprintf(ptr_out, "     final-bit      : %d\n", (msg[ptr+1] & 2) ? 1 : 0);
+      fprintf(ptr_out, "     readerObjectId : %d.%d.%d.%02x",
+             *(uint8_t *)&roid, *(((uint8_t *)&roid)+1), *(((uint8_t *)&roid)+2), *(((uint8_t *)&roid)+3));
+      print_obj(&roid);
+      fprintf(ptr_out, "     writeObjectId  : %d.%d.%d.%02x",
+             *(uint8_t *)&woid, *(((uint8_t *)&woid)+1), *(((uint8_t *)&woid)+2), *(((uint8_t *)&woid)+3));
+      print_obj(&woid);
+      fprintf(ptr_out, "     firstSeqNumber : %u\n", fsn.low);
+      fprintf(ptr_out, "     lastSeqNumber  : %u\n", lsn.low);
       break;
     case GAP:
-      fprintf(ptr_out,"   GAP\n");
-      roid=*((ObjectId*)(msg+ptr+4));woid=*((ObjectId*)(msg+ptr+8));
-      fsn=*((SequenceNumber*)(msg+ptr+12));
-      lsn=*((SequenceNumber*)(msg+ptr+20));
-      fprintf(ptr_out,"     readerObjectId : %d.%d.%d.%02x",
-                      *(uint8_t*)&roid,*(((uint8_t*)&roid)+1),*(((uint8_t*)&roid)+2),*(((uint8_t*)&roid)+3));
-      print_obj(&roid);                      
-      fprintf(ptr_out,"     writeObjectId  : %d.%d.%d.%02x",
-                      *(uint8_t*)&woid,*(((uint8_t*)&woid)+1),*(((uint8_t*)&woid)+2),*(((uint8_t*)&woid)+3));
-      print_obj(&woid);                      
-      fprintf(ptr_out,"     firstSeqNumber : %u\n",fsn.low);                 
-      fprintf(ptr_out,"     bitmap         : %u/%u:",lsn.low,
-                      *((uint32_t*)(msg+ptr+28)));
-      for(i=0;i<(*((uint32_t*)(msg+ptr+28)));i++) {
-        l=((*(((uint32_t*)(msg+ptr+32))+i/32)) & (1<<(31-i%32))) ? 1:0;
-        fprintf(ptr_out,"%d",l);
+      fprintf(ptr_out, "   GAP\n");
+      roid = *((ObjectId *)(msg+ptr+4));
+      woid = *((ObjectId *)(msg+ptr+8));
+      fsn = *((SequenceNumber *)(msg+ptr+12));
+      lsn = *((SequenceNumber *)(msg+ptr+20));
+      fprintf(ptr_out, "     readerObjectId : %d.%d.%d.%02x",
+             *(uint8_t *)&roid, *(((uint8_t *)&roid)+1), *(((uint8_t *)&roid)+2), *(((uint8_t *)&roid)+3));
+      print_obj(&roid);
+      fprintf(ptr_out, "     writeObjectId  : %d.%d.%d.%02x",
+             *(uint8_t *)&woid, *(((uint8_t *)&woid)+1), *(((uint8_t *)&woid)+2), *(((uint8_t *)&woid)+3));
+      print_obj(&woid);
+      fprintf(ptr_out, "     firstSeqNumber : %u\n", fsn.low);
+      fprintf(ptr_out, "     bitmap         : %u/%u:", lsn.low,
+             *((uint32_t *)(msg+ptr+28)));
+      for (i = 0; i < (*((uint32_t *)(msg+ptr+28))); i++) {
+       l = ((*(((uint32_t *)(msg+ptr+32))+i/32)) & (1<<(31-i%32))) ? 1 : 0;
+       fprintf(ptr_out, "%d", l);
       }
-      fprintf(ptr_out,"\n");                 
+      fprintf(ptr_out, "\n");
       break;
     case INFO_TS:
-      fprintf(ptr_out,"   INFO_TS\n");
-      fprintf(ptr_out,"     i-bit          : %d\n",(msg[ptr+1] & 2) ? 1:0);
+      fprintf(ptr_out, "   INFO_TS\n");
+      fprintf(ptr_out, "     i-bit          : %d\n", (msg[ptr+1] & 2) ? 1 : 0);
       if (!(msg[ptr+1]&2)) {
-        mi->timestamp=*((NtpTime*)(msg+ptr+4));
-        fprintf(ptr_out,"     ntpTimeStamp   : %u,%u\n",
-                       mi->timestamp.seconds,mi->timestamp.fraction);
-      }        
+       mi->timestamp = *((NtpTime *)(msg+ptr+4));
+       fprintf(ptr_out, "     ntpTimeStamp   : %u,%u\n",
+               mi->timestamp.seconds, mi->timestamp.fraction);
+      }
       break;
     case INFO_SRC:
-      fprintf(ptr_out,"   INFO_SRC\n");
+      fprintf(ptr_out, "   INFO_SRC\n");
       break;
     case INFO_REPLY:
-      fprintf(ptr_out,"   INFO_REPLY\n");
-      ipa=*((uint32_t*)(msg+ptr+4));                  /* unicastReplyIPAddress */
-      port=*((uint32_t*)(msg+ptr+8));                 /* unicastReplyPort */
-      fprintf(ptr_out,"     unicastReplyIPAddress   : %d.%d.%d.%d\n",
-                      *(uint8_t*)&ipa,*(((uint8_t*)&ipa)+1),*(((uint8_t*)&ipa)+2),*(((uint8_t*)&ipa)+3));
-      fprintf(ptr_out,"     unicastReplyPort        : %u\n",port);
-      if (ipa!=IPADDRESS_INVALID) {
-        mi->unicastReplyIPAddress=ipa;
+      fprintf(ptr_out, "   INFO_REPLY\n");
+      ipa = *((uint32_t *)(msg+ptr+4));                  /* unicastReplyIPAddress */
+      port = *((uint32_t *)(msg+ptr+8));                 /* unicastReplyPort */
+      fprintf(ptr_out, "     unicastReplyIPAddress   : %d.%d.%d.%d\n",
+             *(uint8_t *)&ipa, *(((uint8_t *)&ipa)+1), *(((uint8_t *)&ipa)+2), *(((uint8_t *)&ipa)+3));
+      fprintf(ptr_out, "     unicastReplyPort        : %u\n", port);
+      if (ipa != IPADDRESS_INVALID) {
+       mi->unicastReplyIPAddress = ipa;
       }
-      mi->unicastReplyPort=port; 
-      if ((msg[ptr+1] & 0x02) !=0) {
-        ipa=*((uint32_t*)(msg+ptr+12));               /* multicastReplyIPAddress */
-        port=*((uint32_t*)(msg+ptr+16));              /* multicastReplyPort */
-        fprintf(ptr_out,"     multicastReplyIPAddress : %d.%d.%d.%d\n",
-                      *(uint8_t*)&ipa,*(((uint8_t*)&ipa)+1),*(((uint8_t*)&ipa)+2),*(((uint8_t*)&ipa)+3));
-        fprintf(ptr_out,"     multicastReplyPort      : %u\n",port);
-        mi->multicastReplyIPAddress=ipa;
-        mi->multicastReplyPort=port; 
+      mi->unicastReplyPort = port;
+      if ((msg[ptr+1] & 0x02) != 0) {
+       ipa = *((uint32_t *)(msg+ptr+12));               /* multicastReplyIPAddress */
+       port = *((uint32_t *)(msg+ptr+16));              /* multicastReplyPort */
+       fprintf(ptr_out, "     multicastReplyIPAddress : %d.%d.%d.%d\n",
+               *(uint8_t *)&ipa, *(((uint8_t *)&ipa)+1), *(((uint8_t *)&ipa)+2), *(((uint8_t *)&ipa)+3));
+       fprintf(ptr_out, "     multicastReplyPort      : %u\n", port);
+       mi->multicastReplyIPAddress = ipa;
+       mi->multicastReplyPort = port;
       } else {
-        mi->multicastReplyIPAddress=IPADDRESS_INVALID;
-       mi->multicastReplyPort     =PORT_INVALID; 
+       mi->multicastReplyIPAddress = IPADDRESS_INVALID;
+       mi->multicastReplyPort     = PORT_INVALID;
       }
       break;
     case INFO_DST:
-      fprintf(ptr_out,"   INFO_DST\n");
-      hid=*((HostId*)(msg+ptr+4));                   /* hostId */
-      aid=*((AppId*)(msg+ptr+8));                   /* appId */
-      fprintf(ptr_out,"     HostId                  : %d.%d.%d.%d\n",
-                        *(uint8_t*)&hid,*(((uint8_t*)&hid)+1),*(((uint8_t*)&hid)+2),*(((uint8_t*)&hid)+3));
-      fprintf(ptr_out,"     AppId                   : %d.%d.%d.%d ",
-                        *(uint8_t*)&aid,*(((uint8_t*)&aid)+1),*(((uint8_t*)&aid)+2),*(((uint8_t*)&aid)+3));
-      print_app(*(((uint8_t*)&aid)+3));
-      break;                
+      fprintf(ptr_out, "   INFO_DST\n");
+      hid = *((HostId *)(msg+ptr+4));                   /* hostId */
+      aid = *((AppId *)(msg+ptr+8));                   /* appId */
+      fprintf(ptr_out, "     HostId                  : %d.%d.%d.%d\n",
+             *(uint8_t *)&hid, *(((uint8_t *)&hid)+1), *(((uint8_t *)&hid)+2), *(((uint8_t *)&hid)+3));
+      fprintf(ptr_out, "     AppId                   : %d.%d.%d.%d ",
+             *(uint8_t *)&aid, *(((uint8_t *)&aid)+1), *(((uint8_t *)&aid)+2), *(((uint8_t *)&aid)+3));
+      print_app(*(((uint8_t *)&aid)+3));
+      break;
     default:
-      fprintf(ptr_out,"   undefined submessage code\n");
-      break;  
-  }  
+      fprintf(ptr_out, "   undefined submessage code\n");
+      break;
+  }
   return 0;
 }
 
 
 /**********************************************************************************/
-int main(int argc, char * argv[]) {
-  uint8_t rtps_msg[16384],rtps_msg_c[3]={0,0,0};
-  unsigned rtps_msg_ptr=0,rtps_msg_len,rtps_submsg_cnt,submsg_len;
-  int err,c,no_lchar=1;
+int
+main(int argc, char *argv[])
+{
+  uint8_t rtps_msg[16384], rtps_msg_c[3] = {0, 0, 0};
+  unsigned rtps_msg_ptr = 0, rtps_msg_len, rtps_submsg_cnt, submsg_len;
+  int err, c, no_lchar = 1;
   MessageInterpret mi;
-  
+
   printf("-------------------------------------------------------------------------------\n");
   printf("             RTPS messages decoder                OCERA project                \n");
   printf("                                                                               \n");
@@ -448,75 +492,82 @@ int main(int argc, char * argv[]) {
     printf(" syntax :    decode_msg 'filename to decode' 'output file'\n\n");
     return 0;
   }
-  printf(" decode file    : %s\n output file    : %s\n\n",argv[1],argv[2]);
-  ptr_in = fopen(argv[1],"r");                            /* open input file */
+  printf(" decode file    : %s\n output file    : %s\n\n", argv[1], argv[2]);
+  ptr_in = fopen(argv[1], "r");                            /* open input file */
   if (ferror(ptr_in)) {
-    printf(" unable to open %s\n",argv[1]);
+    printf(" unable to open %s\n", argv[1]);
   }
-  ptr_out = fopen(argv[2],"w");                           /* create output file */
+  ptr_out = fopen(argv[2], "w");                           /* create output file */
   if (ferror(ptr_out)) {
-    printf(" unable to create %s\n",argv[2]);
+    printf(" unable to create %s\n", argv[2]);
   }
-  while ((c = fgetc(ptr_in)) !=EOF) {                     /* read one character */
-    if (((no_lchar==1) && (!isdigit(c))) || (no_lchar==0)) { /* outside RTPS line */
+  while ((c = fgetc(ptr_in)) != EOF) {                     /* read one character */
+    if (((no_lchar == 1) && (!isdigit(c))) || (no_lchar == 0)) { /* outside RTPS line */
       if (rtps_msg_ptr) {                                 /* proc. data read data ? */
-        rtps_msg[rtps_msg_ptr]=0;                        /* end of rtps data */
-       rtps_msg_len=rtps_msg_ptr;rtps_msg_ptr=0;
-        printf(" message length : %d\n",rtps_msg_len);
+       rtps_msg[rtps_msg_ptr] = 0;                         /* end of rtps data */
+       rtps_msg_len = rtps_msg_ptr;
+       rtps_msg_ptr = 0;
+       printf(" message length : %d\n", rtps_msg_len);
        /* decoded message - msg stored in rtps_msg, length msg in rtps_msg_len */
-        if ((err=decode_header(rtps_msg,rtps_msg_len,&mi))==0) {
-         fprintf(ptr_out,"message length      : %d\n",rtps_msg_len);
-         fprintf(ptr_out," Header\n");
-         fprintf(ptr_out,"   protocol version : %d.%d \
+       if ((err = decode_header(rtps_msg, rtps_msg_len, &mi)) == 0) {
+         fprintf(ptr_out, "message length      : %d\n", rtps_msg_len);
+         fprintf(ptr_out, " Header\n");
+         fprintf(ptr_out, "   protocol version : %d.%d \
                         \n   vendorId         : %d.%d \
                         \n   hostId           : %d.%d.%d.%d \
                         \n   appId            : %d.%d.%d.%d ",
-                          mi.sourceVersion.major,mi.sourceVersion.minor,mi.sourceVendorId.major,
-                          mi.sourceVendorId.minor,*(u_char*)&mi.sourceHostId,*(((u_char*)&mi.sourceHostId)+1),
-                          *(((u_char*)&mi.sourceHostId)+2),*(((u_char*)&mi.sourceHostId)+3),*(((u_char*)&mi.sourceAppId)),
-                          *(((u_char*)&mi.sourceAppId)+1),*(((u_char*)&mi.sourceAppId)+2),*(((u_char*)&mi.sourceAppId)+3));
-         print_app(*(((u_char*)&mi.sourceAppId)+3));
-         rtps_msg_ptr=16;rtps_submsg_cnt=1;
+                 mi.sourceVersion.major, mi.sourceVersion.minor, mi.sourceVendorId.major,
+                 mi.sourceVendorId.minor, *(u_char *)&mi.sourceHostId, *(((u_char *)&mi.sourceHostId)+1),
+                 *(((u_char *)&mi.sourceHostId)+2), *(((u_char *)&mi.sourceHostId)+3), *(((u_char *)&mi.sourceAppId)),
+                 *(((u_char *)&mi.sourceAppId)+1), *(((u_char *)&mi.sourceAppId)+2), *(((u_char *)&mi.sourceAppId)+3));
+         print_app(*(((u_char *)&mi.sourceAppId)+3));
+         rtps_msg_ptr = 16;
+         rtps_submsg_cnt = 1;
          do {
-           fprintf(ptr_out," Submessage : %d",rtps_submsg_cnt++);
-           if ((rtps_msg_ptr+3)<=rtps_msg_len) {  /* len. submessage header is OK */
-             submsg_len=rtps_msg[rtps_msg_ptr+2]+rtps_msg[rtps_msg_ptr+3]*0x100;
-             fprintf(ptr_out," len : %d\n",submsg_len+4);
-             if ((submsg_len+rtps_msg_ptr+3)<=rtps_msg_len) {
-                /* decode submessage */
-               decode_submessage(rtps_msg,rtps_msg_ptr,&mi);
-               rtps_msg_ptr+=submsg_len+4;
-             } else rtps_msg_ptr=rtps_msg_len;    /* submessage is too small */        
+           fprintf(ptr_out, " Submessage : %d", rtps_submsg_cnt++);
+           if ((rtps_msg_ptr+3) <= rtps_msg_len) {  /* len. submessage header is OK */
+             submsg_len = rtps_msg[rtps_msg_ptr+2]+rtps_msg[rtps_msg_ptr+3]*0x100;
+             fprintf(ptr_out, " len : %d\n", submsg_len+4);
+             if ((submsg_len+rtps_msg_ptr+3) <= rtps_msg_len) {
+               /* decode submessage */
+               decode_submessage(rtps_msg, rtps_msg_ptr, &mi);
+               rtps_msg_ptr += submsg_len+4;
+             } else
+               rtps_msg_ptr = rtps_msg_len;       /* submessage is too small */
            } else {
-             rtps_msg_ptr=rtps_msg_len;           /* submessage is too small */
-             fprintf(ptr_out,"\n");
-           }  
-         } while (rtps_msg_ptr<rtps_msg_len);
+             rtps_msg_ptr = rtps_msg_len;           /* submessage is too small */
+             fprintf(ptr_out, "\n");
+           }
+         } while (rtps_msg_ptr < rtps_msg_len);
        } else {
-         fprintf(ptr_out,"invalid header - error code : %d\n",err);
+         fprintf(ptr_out, "invalid header - error code : %d\n", err);
        }
-        rtps_msg_ptr=0;
+       rtps_msg_ptr = 0;
       }
-      no_lchar=0;
-      if (c=='\n') no_lchar=1;
-      fputc(c,ptr_out);                                   /* copy to output file */
-    }  
-    if (no_lchar>1) {                                     /* reading RTPS message*/
+      no_lchar = 0;
+      if (c == '\n')
+       no_lchar = 1;
+      fputc(c, ptr_out);                                   /* copy to output file */
+    }
+    if (no_lchar > 1) {                                     /* reading RTPS message*/
       no_lchar++;
-      if (c=='\n') no_lchar=1;
+      if (c == '\n')
+       no_lchar = 1;
       else {
-        if ((no_lchar>5) && (no_lchar<57)) {              /* converted data from */ 
-         if ((rtps_msg_c[0]!=0) && (isxdigit(c))) {      /* position 6 to 56    */
-           rtps_msg_c[1]=(uint8_t)c;
-           rtps_msg[rtps_msg_ptr++]=(uint8_t)strtol(rtps_msg_c,NULL,16);
-           rtps_msg_c[0]=0;
+       if ((no_lchar > 5) && (no_lchar < 57)) {              /* converted data from */
+         if ((rtps_msg_c[0] != 0) && (isxdigit(c))) {      /* position 6 to 56    */
+           rtps_msg_c[1] = (uint8_t)c;
+           rtps_msg[rtps_msg_ptr++] = (uint8_t)strtol(rtps_msg_c, NULL, 16);
+           rtps_msg_c[0] = 0;
          } else {
-           if ((rtps_msg_c[0]==0) && (isxdigit(c))) rtps_msg_c[0]=(uint8_t)c;
+           if ((rtps_msg_c[0] == 0) && (isxdigit(c)))
+             rtps_msg_c[0] = (uint8_t)c;
          }
        }
       }
     }
-    if ((no_lchar==1) && (isxdigit(c))) no_lchar++;        /* is begin RTPS line ? */
+    if ((no_lchar == 1) && (isxdigit(c)))
+      no_lchar++;                                          /* is begin RTPS line ? */
   }
   fclose(ptr_in);
   fclose(ptr_out);
index ed24f1df773c09bdd373e44546bff0f504d59f11..feaaef973071015b80e6d32c553158bbb9271630 100644 (file)
 #include <assert.h>\r
 \r
 #ifdef _DEBUG\r
-       #define ASSERT(x)               assert(x)\r
+       #define ASSERT(x)               assert(x)\r
 #else\r
        #define ASSERT(x)\r
 #endif\r
 \r
 \r
-#define COUNTOF(arr)           (sizeof(arr)/sizeof((arr)[0]))\r
+#define COUNTOF(arr)            (sizeof(arr)/sizeof((arr)[0]))\r
 \r
 #ifdef _DEBUG\r
-       #define __ORTE_DLL_NAME         "orted.dll"\r
+       #define __ORTE_DLL_NAME         "orted.dll"\r
 #else\r
-       #define __ORTE_DLL_NAME         "orte.dll"\r
+       #define __ORTE_DLL_NAME         "orte.dll"\r
 #endif\r
 \r
 struct __ORTE_DLL __orte;\r
 \r
 static const LPCSTR orteFnNames[] = {\r
-       "ORTEInit",\r
-       "ORTEDomainStart",\r
-       "ORTEDomainPropDefaultGet",\r
-       "ORTEDomainInitEvents",\r
-       "ORTEDomainAppCreate",\r
-       "ORTEDomainAppDestroy",\r
-       "ORTEDomainAppSubscriptionPatternAdd",\r
-       "ORTEDomainAppSubscriptionPatternRemove",\r
-       "ORTEDomainAppSubscriptionPatternDestroy",\r
-       "ORTEDomainMgrCreate",\r
-       "ORTEDomainMgrDestroy",\r
-       "ORTEPublicationCreate",\r
-       "ORTEPublicationDestroy",\r
-       "ORTEPublicationPropertiesGet",\r
-       "ORTEPublicationPropertiesSet",\r
-       "ORTEPublicationWaitForSubscriptions",\r
-       "ORTEPublicationGetStatus",\r
-       "ORTEPublicationSend",\r
-       "ORTEPublicationSendEx",\r
-       "ORTESubscriptionCreate",\r
-       "ORTESubscriptionDestroy",\r
-       "ORTESubscriptionPropertiesGet",\r
-       "ORTESubscriptionPropertiesSet",\r
-       "ORTESubscriptionWaitForPublications",\r
-       "ORTESubscriptionGetStatus",\r
-       "ORTESubscriptionPull",\r
-       "ORTETypeRegisterAdd",\r
-       "ORTETypeRegisterDestroyAll",\r
-       "ORTEVerbositySetOptions",\r
-       "ORTEVerbositySetLogFile",\r
-       "ORTESleepMs",\r
-       "IPAddressToString",\r
-       "StringToIPAddress",\r
-       "NtpTimeToStringMs",\r
-       "NtpTimeToStringUs"\r
+  "ORTEInit",\r
+  "ORTEDomainStart",\r
+  "ORTEDomainPropDefaultGet",\r
+  "ORTEDomainInitEvents",\r
+  "ORTEDomainAppCreate",\r
+  "ORTEDomainAppDestroy",\r
+  "ORTEDomainAppSubscriptionPatternAdd",\r
+  "ORTEDomainAppSubscriptionPatternRemove",\r
+  "ORTEDomainAppSubscriptionPatternDestroy",\r
+  "ORTEDomainMgrCreate",\r
+  "ORTEDomainMgrDestroy",\r
+  "ORTEPublicationCreate",\r
+  "ORTEPublicationDestroy",\r
+  "ORTEPublicationPropertiesGet",\r
+  "ORTEPublicationPropertiesSet",\r
+  "ORTEPublicationWaitForSubscriptions",\r
+  "ORTEPublicationGetStatus",\r
+  "ORTEPublicationSend",\r
+  "ORTEPublicationSendEx",\r
+  "ORTESubscriptionCreate",\r
+  "ORTESubscriptionDestroy",\r
+  "ORTESubscriptionPropertiesGet",\r
+  "ORTESubscriptionPropertiesSet",\r
+  "ORTESubscriptionWaitForPublications",\r
+  "ORTESubscriptionGetStatus",\r
+  "ORTESubscriptionPull",\r
+  "ORTETypeRegisterAdd",\r
+  "ORTETypeRegisterDestroyAll",\r
+  "ORTEVerbositySetOptions",\r
+  "ORTEVerbositySetLogFile",\r
+  "ORTESleepMs",\r
+  "IPAddressToString",\r
+  "StringToIPAddress",\r
+  "NtpTimeToStringMs",\r
+  "NtpTimeToStringUs"\r
 };\r
 \r
-DWORD GetProcAddresses(\r
-       HINSTANCE hInst,\r
-       FARPROC *functionTable,\r
-       const LPCSTR *names,\r
-       unsigned count\r
-)\r
+DWORD\r
+GetProcAddresses(\r
+  HINSTANCE hInst,\r
+  FARPROC *functionTable,\r
+  const LPCSTR *names,\r
+  unsigned count\r
+  )\r
 {\r
-       FARPROC *pfnMax = functionTable + count;\r
+  FARPROC *pfnMax = functionTable + count;\r
 \r
-       while (functionTable < pfnMax) {\r
-               *functionTable = GetProcAddress(hInst, *names);\r
-               if (!*functionTable)\r
-                       return GetLastError();\r
-               ++functionTable;\r
-               ++names;\r
-       }\r
+  while (functionTable < pfnMax) {\r
+    *functionTable = GetProcAddress(hInst, *names);\r
+    if (!*functionTable)\r
+      return GetLastError();\r
+    ++functionTable;\r
+    ++names;\r
+  }\r
 \r
-       return ERROR_SUCCESS;\r
+  return ERROR_SUCCESS;\r
 }\r
 \r
 #if 0\r
-#define ORTE_GET_PROC_ADDRESS(symbol)  __orte.apis.symbol = (PFN_##symbol)GetProcAddress(__orte.hInstance, #symbol)\r
+#define ORTE_GET_PROC_ADDRESS(symbol)   __orte.apis.symbol = (PFN_ ## symbol)GetProcAddress(__orte.hInstance, # symbol)\r
 \r
-int SomePointerNull(FARPROC *functionTable, unsigned count)\r
+int\r
+SomePointerNull(FARPROC *functionTable, unsigned count)\r
 {\r
-       FARPROC *max = functionTable + count;\r
+  FARPROC *max = functionTable + count;\r
 \r
-       while (functionTable < max) {\r
-               if (*functionTable == NULL)\r
-                       return 1;\r
-               ++functionTable;\r
-       }\r
+  while (functionTable < max) {\r
+    if (*functionTable == NULL)\r
+      return 1;\r
+    ++functionTable;\r
+  }\r
 \r
-       return 0;\r
+  return 0;\r
 }\r
 #endif\r
 \r
-DWORD __ORTEDllLoad(void)\r
+DWORD\r
+__ORTEDllLoad(void)\r
 {\r
-       if (!__orte.cLoads && !__orte.fLoadTried) {\r
-               __orte.fLoadTried = 1;\r
-               \r
-               __orte.hInstance = LoadLibrary(__ORTE_DLL_NAME);\r
-               \r
-               if (__orte.hInstance) {\r
-                       \r
-                       ASSERT(sizeof(struct __ORTE_APIS) / sizeof(FARPROC) == COUNTOF(orteFnNames));\r
-\r
-                       __orte.dwResult = GetProcAddresses(\r
-                               __orte.hInstance,\r
-                               (FARPROC*)&__orte.apis,\r
-                               orteFnNames,\r
-                               COUNTOF(orteFnNames));\r
-                       \r
-                       if (__orte.dwResult != ERROR_SUCCESS) {\r
-                               FreeLibrary(__orte.hInstance);\r
-                               __orte.hInstance = NULL;\r
-                       } else {\r
-                               __orte.dwResult = ERROR_SUCCESS;\r
-                       }\r
-               } else {\r
-                       __orte.dwResult = GetLastError();\r
-               }\r
-       }\r
-\r
-       if (__orte.dwResult == ERROR_SUCCESS)\r
-               InterlockedIncrement(&__orte.cLoads);\r
-\r
-       return __orte.dwResult;\r
+  if (!__orte.cLoads && !__orte.fLoadTried) {\r
+    __orte.fLoadTried = 1;\r
+\r
+    __orte.hInstance = LoadLibrary(__ORTE_DLL_NAME);\r
+\r
+    if (__orte.hInstance) {\r
+\r
+      ASSERT(sizeof(struct __ORTE_APIS) / sizeof(FARPROC) == COUNTOF(orteFnNames));\r
+\r
+      __orte.dwResult = GetProcAddresses(\r
+       __orte.hInstance,\r
+       (FARPROC *)&__orte.apis,\r
+       orteFnNames,\r
+       COUNTOF(orteFnNames));\r
+\r
+      if (__orte.dwResult != ERROR_SUCCESS) {\r
+       FreeLibrary(__orte.hInstance);\r
+       __orte.hInstance = NULL;\r
+      } else {\r
+       __orte.dwResult = ERROR_SUCCESS;\r
+      }\r
+    } else {\r
+      __orte.dwResult = GetLastError();\r
+    }\r
+  }\r
+\r
+  if (__orte.dwResult == ERROR_SUCCESS)\r
+    InterlockedIncrement(&__orte.cLoads);\r
+\r
+  return __orte.dwResult;\r
 }\r
 \r
-DWORD __ORTEInit(void)\r
+DWORD\r
+__ORTEInit(void)\r
 {\r
-       DWORD res = __ORTEDllLoad();\r
+  DWORD res = __ORTEDllLoad();\r
 \r
-       if (res == ERROR_SUCCESS)\r
-               __orte.apis.pfnORTEInit();\r
+  if (res == ERROR_SUCCESS)\r
+    __orte.apis.pfnORTEInit();\r
 \r
-       return res;\r
+  return res;\r
 }\r
index 7709eeb5774b5a3c6f83671d52a39a50653ba424..086ab6fd494dac049c2644f85abaa12245597053 100644 (file)
@@ -1,8 +1,8 @@
 /*\r
-       ortedll.h\r
+        ortedll.h\r
 \r
-       Historie zmen:\r
-               2005-08-23      vytvoril        Milan\r
+        Historie zmen:\r
+                2005-08-23     vytvoril        Milan\r
 */\r
 \r
 #pragma once\r
 #include <orte.h>\r
 \r
 #ifdef __cplusplus\r
-       extern "C" {\r
+extern "C" {\r
 #endif\r
 \r
 typedef void (*PFN_ORTEInit)(void);\r
 \r
 typedef void (*PFN_ORTEDomainStart)(ORTEDomain, Boolean, Boolean, Boolean,\r
-       Boolean, Boolean);\r
+                                   Boolean, Boolean);\r
 \r
 typedef Boolean (*PFN_ORTEDomainPropDefaultGet)(ORTEDomainProp *);\r
 \r
 typedef Boolean (*PFN_ORTEDomainInitEvents)(ORTEDomainAppEvents *);\r
 \r
-typedef ORTEDomain* (*PFN_ORTEDomainAppCreate)(int, ORTEDomainProp *,\r
-       ORTEDomainAppEvents *, Boolean suspended);\r
+typedef ORTEDomain * (*PFN_ORTEDomainAppCreate)(int, ORTEDomainProp *,\r
+                                               ORTEDomainAppEvents *, Boolean suspended);\r
 \r
 typedef Boolean (*PFN_ORTEDomainAppDestroy)(ORTEDomain *);\r
 \r
 typedef Boolean (*PFN_ORTEDomainAppSubscriptionPatternAdd)(ORTEDomain *,\r
-       const char *, const char *, ORTESubscriptionPatternCallBack, \r
-       void *);\r
+                                                          const char *, const char *, ORTESubscriptionPatternCallBack,\r
+                                                          void *);\r
 \r
 typedef Boolean (*PFN_ORTEDomainAppSubscriptionPatternRemove)(ORTEDomain *,\r
-       const char *, const char *);\r
+                                                             const char *, const char *);\r
 \r
 typedef Boolean (*PFN_ORTEDomainAppSubscriptionPatternDestroy)(ORTEDomain *);\r
 \r
-typedef ORTEDomain* (*PFN_ORTEDomainMgrCreate)(int, ORTEDomainProp *,\r
-       ORTEDomainAppEvents *, Boolean);\r
+typedef ORTEDomain * (*PFN_ORTEDomainMgrCreate)(int, ORTEDomainProp *,\r
+                                               ORTEDomainAppEvents *, Boolean);\r
 \r
 typedef Boolean (*PFN_ORTEDomainMgrDestroy)(ORTEDomain *);\r
 \r
-typedef ORTEPublication* (*PFN_ORTEPublicationCreate)(ORTEDomain *,\r
-       const char *, const char *, void *, NtpTime *, int,\r
-       ORTESendCallBack, void *, NtpTime *);\r
+typedef ORTEPublication * (*PFN_ORTEPublicationCreate)(ORTEDomain *,\r
+                                                      const char *, const char *, void *, NtpTime *, int,\r
+                                                      ORTESendCallBack, void *, NtpTime *);\r
 \r
 typedef int (*PFN_ORTEPublicationDestroy)(ORTEPublication *);\r
 \r
 typedef int (*PFN_ORTEPublicationPropertiesGet)(ORTEPublication *,\r
-       ORTEPublProp *);\r
+                                               ORTEPublProp *);\r
 \r
 typedef int (*PFN_ORTEPublicationPropertiesSet)(ORTEPublication *,\r
-       ORTEPublProp *);\r
+                                               ORTEPublProp *);\r
 \r
 typedef int (*PFN_ORTEPublicationWaitForSubscriptions)(\r
-       ORTEPublication *, NtpTime, unsigned int, unsigned int);\r
+  ORTEPublication *, NtpTime, unsigned int, unsigned int);\r
 \r
 typedef int (*PFN_ORTEPublicationGetStatus)(ORTEPublication *,\r
-       ORTEPublStatus *);\r
+                                           ORTEPublStatus *);\r
 \r
 typedef int (*PFN_ORTEPublicationSend)(ORTEPublication *);\r
 \r
 typedef int (*PFN_ORTEPublicationSendEx)(ORTEPublication *,\r
-       ORTEPublicationSendParam *);\r
+                                        ORTEPublicationSendParam *);\r
 \r
-typedef ORTESubscription* (*PFN_ORTESubscriptionCreate)(ORTEDomain *,\r
-       SubscriptionMode, SubscriptionType, const char *, const char *,\r
-       void *, NtpTime *, NtpTime *, ORTERecvCallBack, void *,\r
-       IPAddress);\r
+typedef ORTESubscription * (*PFN_ORTESubscriptionCreate)(ORTEDomain *,\r
+                                                        SubscriptionMode, SubscriptionType, const char *, const char *,\r
+                                                        void *, NtpTime *, NtpTime *, ORTERecvCallBack, void *,\r
+                                                        IPAddress);\r
 \r
 typedef int (*PFN_ORTESubscriptionDestroy)(ORTESubscription *);\r
 \r
 typedef int (*PFN_ORTESubscriptionPropertiesGet)(ORTESubscription *,\r
-       ORTESubsProp *);\r
+                                                ORTESubsProp *);\r
 \r
 typedef int (*PFN_ORTESubscriptionPropertiesSet)(ORTESubscription *,\r
-       ORTESubsProp *);\r
+                                                ORTESubsProp *);\r
 \r
 typedef int (*PFN_ORTESubscriptionWaitForPublications)(ORTESubscription *,\r
-       NtpTime, unsigned int,unsigned int);\r
+                                                      NtpTime, unsigned int, unsigned int);\r
 \r
 typedef int (*PFN_ORTESubscriptionGetStatus)(ORTESubscription *,\r
-       ORTESubsStatus *);\r
+                                            ORTESubsStatus *);\r
 \r
 typedef int (*PFN_ORTESubscriptionPull)(ORTESubscription *);\r
 \r
 typedef int (*PFN_ORTETypeRegisterAdd)(ORTEDomain *, const char *,\r
-       ORTETypeSerialize, ORTETypeDeserialize, ORTETypeGetMaxSize,\r
-       unsigned int);\r
+                                      ORTETypeSerialize, ORTETypeDeserialize, ORTETypeGetMaxSize,\r
+                                      unsigned int);\r
 \r
 typedef int (*PFN_ORTETypeRegisterDestroyAll)(ORTEDomain *);\r
 \r
@@ -98,104 +98,106 @@ typedef void (*PFN_ORTEVerbositySetLogFile)(const char *);
 \r
 typedef void (*PFN_ORTESleepMs)(unsigned int);\r
 \r
-typedef char* (*PFN_IPAddressToString)(IPAddress, char *);\r
+typedef char * (*PFN_IPAddressToString)(IPAddress, char *);\r
 \r
 typedef IPAddress (*PFN_StringToIPAddress)(const char *);\r
 \r
-typedef char* (*PFN_NtpTimeToStringMs)(NtpTime, char *);\r
+typedef char * (*PFN_NtpTimeToStringMs)(NtpTime, char *);\r
 \r
-typedef char* (*PFN_NtpTimeToStringUs)(NtpTime, char *);\r
+typedef char * (*PFN_NtpTimeToStringUs)(NtpTime, char *);\r
 \r
-#define __ORTE_API_ENTRY(symbol)       PFN_##symbol    pfn##symbol;\r
-#define __ORTE_API_DECL(symbol)                __orte.apis.pfn##symbol\r
+#define __ORTE_API_ENTRY(symbol)        PFN_ ## symbol    pfn ## symbol;\r
+#define __ORTE_API_DECL(symbol)         __orte.apis.pfn ## symbol\r
 \r
 struct __ORTE_APIS {\r
-       __ORTE_API_ENTRY(ORTEInit)\r
-       __ORTE_API_ENTRY(ORTEDomainStart)\r
-       __ORTE_API_ENTRY(ORTEDomainPropDefaultGet)\r
-       __ORTE_API_ENTRY(ORTEDomainInitEvents)\r
-       __ORTE_API_ENTRY(ORTEDomainAppCreate)\r
-       __ORTE_API_ENTRY(ORTEDomainAppDestroy)\r
-       __ORTE_API_ENTRY(ORTEDomainAppSubscriptionPatternAdd)\r
-       __ORTE_API_ENTRY(ORTEDomainAppSubscriptionPatternRemove)\r
-       __ORTE_API_ENTRY(ORTEDomainAppSubscriptionPatternDestroy)\r
-       __ORTE_API_ENTRY(ORTEDomainMgrCreate)\r
-       __ORTE_API_ENTRY(ORTEDomainMgrDestroy)\r
-       __ORTE_API_ENTRY(ORTEPublicationCreate)\r
-       __ORTE_API_ENTRY(ORTEPublicationDestroy)\r
-       __ORTE_API_ENTRY(ORTEPublicationPropertiesGet)\r
-       __ORTE_API_ENTRY(ORTEPublicationPropertiesSet)\r
-       __ORTE_API_ENTRY(ORTEPublicationWaitForSubscriptions)\r
-       __ORTE_API_ENTRY(ORTEPublicationGetStatus)\r
-       __ORTE_API_ENTRY(ORTEPublicationSend)\r
-       __ORTE_API_ENTRY(ORTEPublicationSendEx)\r
-       __ORTE_API_ENTRY(ORTESubscriptionCreate)\r
-       __ORTE_API_ENTRY(ORTESubscriptionDestroy)\r
-       __ORTE_API_ENTRY(ORTESubscriptionPropertiesGet)\r
-       __ORTE_API_ENTRY(ORTESubscriptionPropertiesSet)\r
-       __ORTE_API_ENTRY(ORTESubscriptionWaitForPublications)\r
-       __ORTE_API_ENTRY(ORTESubscriptionGetStatus)\r
-       __ORTE_API_ENTRY(ORTESubscriptionPull)\r
-       __ORTE_API_ENTRY(ORTETypeRegisterAdd)\r
-       __ORTE_API_ENTRY(ORTETypeRegisterDestroyAll)\r
-       __ORTE_API_ENTRY(ORTEVerbositySetOptions)\r
-       __ORTE_API_ENTRY(ORTEVerbositySetLogFile)\r
-       __ORTE_API_ENTRY(ORTESleepMs)\r
-       __ORTE_API_ENTRY(IPAddressToString)\r
-       __ORTE_API_ENTRY(StringToIPAddress)\r
-       __ORTE_API_ENTRY(NtpTimeToStringMs)\r
-       __ORTE_API_ENTRY(NtpTimeToStringUs)\r
+  __ORTE_API_ENTRY(ORTEInit)\r
+  __ORTE_API_ENTRY(ORTEDomainStart)\r
+  __ORTE_API_ENTRY(ORTEDomainPropDefaultGet)\r
+  __ORTE_API_ENTRY(ORTEDomainInitEvents)\r
+  __ORTE_API_ENTRY(ORTEDomainAppCreate)\r
+  __ORTE_API_ENTRY(ORTEDomainAppDestroy)\r
+  __ORTE_API_ENTRY(ORTEDomainAppSubscriptionPatternAdd)\r
+  __ORTE_API_ENTRY(ORTEDomainAppSubscriptionPatternRemove)\r
+  __ORTE_API_ENTRY(ORTEDomainAppSubscriptionPatternDestroy)\r
+  __ORTE_API_ENTRY(ORTEDomainMgrCreate)\r
+  __ORTE_API_ENTRY(ORTEDomainMgrDestroy)\r
+  __ORTE_API_ENTRY(ORTEPublicationCreate)\r
+  __ORTE_API_ENTRY(ORTEPublicationDestroy)\r
+  __ORTE_API_ENTRY(ORTEPublicationPropertiesGet)\r
+  __ORTE_API_ENTRY(ORTEPublicationPropertiesSet)\r
+  __ORTE_API_ENTRY(ORTEPublicationWaitForSubscriptions)\r
+  __ORTE_API_ENTRY(ORTEPublicationGetStatus)\r
+  __ORTE_API_ENTRY(ORTEPublicationSend)\r
+  __ORTE_API_ENTRY(ORTEPublicationSendEx)\r
+  __ORTE_API_ENTRY(ORTESubscriptionCreate)\r
+  __ORTE_API_ENTRY(ORTESubscriptionDestroy)\r
+  __ORTE_API_ENTRY(ORTESubscriptionPropertiesGet)\r
+  __ORTE_API_ENTRY(ORTESubscriptionPropertiesSet)\r
+  __ORTE_API_ENTRY(ORTESubscriptionWaitForPublications)\r
+  __ORTE_API_ENTRY(ORTESubscriptionGetStatus)\r
+  __ORTE_API_ENTRY(ORTESubscriptionPull)\r
+  __ORTE_API_ENTRY(ORTETypeRegisterAdd)\r
+  __ORTE_API_ENTRY(ORTETypeRegisterDestroyAll)\r
+  __ORTE_API_ENTRY(ORTEVerbositySetOptions)\r
+  __ORTE_API_ENTRY(ORTEVerbositySetLogFile)\r
+  __ORTE_API_ENTRY(ORTESleepMs)\r
+  __ORTE_API_ENTRY(IPAddressToString)\r
+  __ORTE_API_ENTRY(StringToIPAddress)\r
+  __ORTE_API_ENTRY(NtpTimeToStringMs)\r
+  __ORTE_API_ENTRY(NtpTimeToStringUs)\r
 };\r
 \r
 struct __ORTE_DLL {\r
-       HINSTANCE hInstance;\r
-       DWORD dwResult;\r
-       LONG cLoads;\r
-       int fLoadTried;\r
-       struct __ORTE_APIS apis;\r
+  HINSTANCE hInstance;\r
+  DWORD dwResult;\r
+  LONG cLoads;\r
+  int fLoadTried;\r
+  struct __ORTE_APIS apis;\r
 };\r
 \r
 extern struct __ORTE_DLL __orte;\r
 \r
-DWORD __ORTEDllLoad(void);\r
-DWORD __ORTEInit(void);\r
-\r
-#define ORTEInit()                             __ORTEInit()\r
-#define ORTEDomainStart                                __ORTE_API_DECL(ORTEDomainStart)\r
-#define ORTEDomainPropDefaultGet               __ORTE_API_DECL(ORTEDomainPropDefaultGet)\r
-#define ORTEDomainInitEvents                   __ORTE_API_DECL(ORTEDomainInitEvents)\r
-#define ORTEDomainAppCreate                    __ORTE_API_DECL(ORTEDomainAppCreate)\r
-#define ORTEDomainAppDestroy                   __ORTE_API_DECL(ORTEDomainAppDestroy)\r
-#define ORTEDomainAppSubscriptionPatternAdd    __ORTE_API_DECL(ORTEDomainAppSubscriptionPatternAdd)\r
-#define ORTEDomainAppSubscriptionPatternRemove __ORTE_API_DECL(ORTEDomainAppSubscriptionPatternRemove)\r
-#define ORTEDomainAppSubscriptionPatternDestroy        __ORTE_API_DECL(ORTEDomainAppSubscriptionPatternDestroy)\r
-#define ORTEDomainMgrCreate                    __ORTE_API_DECL(ORTEDomainMgrCreate)\r
-#define ORTEDomainMgrDestroy                   __ORTE_API_DECL(ORTEDomainMgrDestroy)\r
-#define ORTEPublicationCreate                  __ORTE_API_DECL(ORTEPublicationCreate)\r
-#define ORTEPublicationDestroy                 __ORTE_API_DECL(ORTEPublicationDestroy)\r
-#define ORTEPublicationPropertiesGet           __ORTE_API_DECL(ORTEPublicationPropertiesGet)\r
-#define ORTEPublicationPropertiesSet           __ORTE_API_DECL(ORTEPublicationPropertiesSet)\r
-#define ORTEPublicationWaitForSubscriptions    __ORTE_API_DECL(ORTEPublicationWaitForSubscriptions)\r
-#define ORTEPublicationGetStatus               __ORTE_API_DECL(ORTEPublicationGetStatus)\r
-#define ORTEPublicationSend                    __ORTE_API_DECL(ORTEPublicationSend)\r
-#define ORTEPublicationSendEx                  __ORTE_API_DECL(ORTEPublicationSendEx)\r
-#define ORTESubscriptionCreate                 __ORTE_API_DECL(ORTESubscriptionCreate)\r
-#define ORTESubscriptionDestroy                        __ORTE_API_DECL(ORTESubscriptionDestroy)\r
-#define ORTESubscriptionPropertiesGet          __ORTE_API_DECL(ORTESubscriptionPropertiesGet)\r
-#define ORTESubscriptionPropertiesSet          __ORTE_API_DECL(ORTESubscriptionPropertiesSet)\r
-#define ORTESubscriptionWaitForPublications    __ORTE_API_DECL(ORTESubscriptionWaitForPublications)\r
-#define ORTESubscriptionGetStatus              __ORTE_API_DECL(ORTESubscriptionGetStatus)\r
-#define ORTESubscriptionPull                   __ORTE_API_DECL(ORTESubscriptionPull)\r
-#define ORTETypeRegisterAdd                    __ORTE_API_DECL(ORTETypeRegisterAdd)\r
-#define ORTETypeRegisterDestroyAll             __ORTE_API_DECL(ORTETypeRegisterDestroyAll)\r
-#define ORTEVerbositySetOptions                        __ORTE_API_DECL(ORTEVerbositySetOptions)\r
-#define ORTEVerbositySetLogFile                        __ORTE_API_DECL(ORTEVerbositySetLogFile)\r
-#define ORTESleepMs                            __ORTE_API_DECL(ORTESleepMs)\r
-#define IPAddressToString                      __ORTE_API_DECL(IPAddressToString)\r
-#define StringToIPAddress                      __ORTE_API_DECL(StringToIPAddress)\r
-#define NtpTimeToStringMs                      __ORTE_API_DECL(NtpTimeToStringMs)\r
-#define NtpTimeToStringUs                      __ORTE_API_DECL(NtpTimeToStringUs)\r
+DWORD\r
+__ORTEDllLoad(void);\r
+DWORD\r
+__ORTEInit(void);\r
+\r
+#define ORTEInit()                              __ORTEInit()\r
+#define ORTEDomainStart                         __ORTE_API_DECL(ORTEDomainStart)\r
+#define ORTEDomainPropDefaultGet                __ORTE_API_DECL(ORTEDomainPropDefaultGet)\r
+#define ORTEDomainInitEvents                    __ORTE_API_DECL(ORTEDomainInitEvents)\r
+#define ORTEDomainAppCreate                     __ORTE_API_DECL(ORTEDomainAppCreate)\r
+#define ORTEDomainAppDestroy                    __ORTE_API_DECL(ORTEDomainAppDestroy)\r
+#define ORTEDomainAppSubscriptionPatternAdd     __ORTE_API_DECL(ORTEDomainAppSubscriptionPatternAdd)\r
+#define ORTEDomainAppSubscriptionPatternRemove  __ORTE_API_DECL(ORTEDomainAppSubscriptionPatternRemove)\r
+#define ORTEDomainAppSubscriptionPatternDestroy __ORTE_API_DECL(ORTEDomainAppSubscriptionPatternDestroy)\r
+#define ORTEDomainMgrCreate                     __ORTE_API_DECL(ORTEDomainMgrCreate)\r
+#define ORTEDomainMgrDestroy                    __ORTE_API_DECL(ORTEDomainMgrDestroy)\r
+#define ORTEPublicationCreate                   __ORTE_API_DECL(ORTEPublicationCreate)\r
+#define ORTEPublicationDestroy                  __ORTE_API_DECL(ORTEPublicationDestroy)\r
+#define ORTEPublicationPropertiesGet            __ORTE_API_DECL(ORTEPublicationPropertiesGet)\r
+#define ORTEPublicationPropertiesSet            __ORTE_API_DECL(ORTEPublicationPropertiesSet)\r
+#define ORTEPublicationWaitForSubscriptions     __ORTE_API_DECL(ORTEPublicationWaitForSubscriptions)\r
+#define ORTEPublicationGetStatus                __ORTE_API_DECL(ORTEPublicationGetStatus)\r
+#define ORTEPublicationSend                     __ORTE_API_DECL(ORTEPublicationSend)\r
+#define ORTEPublicationSendEx                   __ORTE_API_DECL(ORTEPublicationSendEx)\r
+#define ORTESubscriptionCreate                  __ORTE_API_DECL(ORTESubscriptionCreate)\r
+#define ORTESubscriptionDestroy                 __ORTE_API_DECL(ORTESubscriptionDestroy)\r
+#define ORTESubscriptionPropertiesGet           __ORTE_API_DECL(ORTESubscriptionPropertiesGet)\r
+#define ORTESubscriptionPropertiesSet           __ORTE_API_DECL(ORTESubscriptionPropertiesSet)\r
+#define ORTESubscriptionWaitForPublications     __ORTE_API_DECL(ORTESubscriptionWaitForPublications)\r
+#define ORTESubscriptionGetStatus               __ORTE_API_DECL(ORTESubscriptionGetStatus)\r
+#define ORTESubscriptionPull                    __ORTE_API_DECL(ORTESubscriptionPull)\r
+#define ORTETypeRegisterAdd                     __ORTE_API_DECL(ORTETypeRegisterAdd)\r
+#define ORTETypeRegisterDestroyAll              __ORTE_API_DECL(ORTETypeRegisterDestroyAll)\r
+#define ORTEVerbositySetOptions                 __ORTE_API_DECL(ORTEVerbositySetOptions)\r
+#define ORTEVerbositySetLogFile                 __ORTE_API_DECL(ORTEVerbositySetLogFile)\r
+#define ORTESleepMs                             __ORTE_API_DECL(ORTESleepMs)\r
+#define IPAddressToString                       __ORTE_API_DECL(IPAddressToString)\r
+#define StringToIPAddress                       __ORTE_API_DECL(StringToIPAddress)\r
+#define NtpTimeToStringMs                       __ORTE_API_DECL(NtpTimeToStringMs)\r
+#define NtpTimeToStringUs                       __ORTE_API_DECL(NtpTimeToStringUs)\r
 \r
 #ifdef __cplusplus\r
-       }\r
-#endif
\ No newline at end of file
+}\r
+#endif\r
index 9835bc58f879c883fae20c20d427c1b4ea0875bb..1d3ac207721800c0394a8d64f488482fd932e6c6 100644 (file)
@@ -3,18 +3,18 @@
  *
  *  DEBUG:  section                     h_publisher
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
@@ -35,7 +35,7 @@
   #define printf rtl_printf
 #elif defined CONFIG_ORTE_RTAI
   #include <linux/module.h>
-  #include <rtai/compat.h>  
+  #include <rtai/compat.h>
   #define printf rt_printk
 #else
   #include <stdio.h>
 #define exit return
 #endif
 
-static ORTEDomain        *d=NULL;
+static ORTEDomain        *d = NULL;
 static char              instance2Send[64];
-static int               counter=0;
+static int               counter = 0;
 
 static void
-sendCallBack(const ORTESendInfo *info,void *vinstance, void *sendCallBackParam) {
-  char *instance=(char*)vinstance;
+sendCallBack(const ORTESendInfo *info, void *vinstance, void *sendCallBackParam)
+{
+  char *instance = (char *)vinstance;
 
   switch (info->status) {
     case NEED_DATA:
       printf("Sampling publication, count %d\n", counter);
-      sprintf(instance,"Hello Universe! (%d)",counter++);
+      sprintf(instance, "Hello Universe! (%d)", counter++);
       break;
     case CQL:  //criticalQueueLevel
       break;
@@ -65,23 +66,24 @@ sendCallBack(const ORTESendInfo *info,void *vinstance, void *sendCallBackParam)
 }
 
 void *
-publisherCreate(void *arg) {
+publisherCreate(void *arg)
+{
   ORTEPublication     *p;
   NtpTime             persistence, delay;
 
-  ORTETypeRegisterAdd(d,"HelloMsg",NULL,NULL,NULL,sizeof(instance2Send));
-  NTPTIME_BUILD(persistence,3);
-  NTPTIME_BUILD(delay,1); 
-  p=ORTEPublicationCreate(
-       d,
-      "Example HelloMsg",
-      "HelloMsg",
-      &instance2Send,
-      &persistence,
-      1,
-      sendCallBack,
-      NULL,
-      &delay);
+  ORTETypeRegisterAdd(d, "HelloMsg", NULL, NULL, NULL, sizeof(instance2Send));
+  NTPTIME_BUILD(persistence, 3);
+  NTPTIME_BUILD(delay, 1);
+  p = ORTEPublicationCreate(
+    d,
+    "Example HelloMsg",
+    "HelloMsg",
+    &instance2Send,
+    &persistence,
+    1,
+    sendCallBack,
+    NULL,
+    &delay);
   if (p == NULL) {
     printf("ORTEPublicationCreate failed\n");
   }
@@ -92,16 +94,17 @@ publisherCreate(void *arg) {
 #ifndef CONFIG_ORTE_RT
 
 int
-main(int argc, char *args[]) {
+main(int argc, char *args[])
+{
   ORTEInit();
   ORTEVerbositySetOptions("ALL.10");
-  d=ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN,NULL,NULL,ORTE_FALSE);
+  d = ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN, NULL, NULL, ORTE_FALSE);
   if (!d) {
     printf("ORTEDomainAppCreate failed!\n");
     return 0;
   }
-  publisherCreate((void*)d);
-  while(1) 
+  publisherCreate((void *)d);
+  while (1)
     ORTESleepMs(1000);
 
   ORTESleepMs(10000);
@@ -111,42 +114,46 @@ main(int argc, char *args[]) {
 }
 
 #else
-char *verbosity="";
-MODULE_PARM(verbosity,"1s");
-MODULE_PARM_DESC(verbosity,"set verbosity level SECTION, up to LEVEL:...");
-char *manager="127.0.0.1";
-MODULE_PARM(manager,"1s");
-MODULE_PARM_DESC(manager,"IP address of local manager");
+char *verbosity = "";
+MODULE_PARM(verbosity, "1s");
+MODULE_PARM_DESC(verbosity, "set verbosity level SECTION, up to LEVEL:...");
+char *manager = "127.0.0.1";
+MODULE_PARM(manager, "1s");
+MODULE_PARM_DESC(manager, "IP address of local manager");
 MODULE_LICENSE("GPL");
 pthread_t thread;
 
 void *
-domainInit(void *arg) {
+domainInit(void *arg)
+{
   ORTEDomainProp dp;
 
   ORTEVerbositySetOptions(verbosity);
   ORTEDomainPropDefaultGet(&dp);
-  dp.appLocalManager=StringToIPAddress(manager);
-  d=ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN,&dp,NULL,ORTE_TRUE);
+  dp.appLocalManager = StringToIPAddress(manager);
+  d = ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN, &dp, NULL, ORTE_TRUE);
   return arg;
 }
 
 void *
-domainDestroy(void *arg) {
-  if (!d) return NULL;
+domainDestroy(void *arg)
+{
+  if (!d)
+    return NULL;
   ORTEDomainAppDestroy(d);
   return arg;
 }
 
 int
-init_module(void) {
+init_module(void)
+{
 
   ORTEInit();
-  pthread_create(&thread,NULL,&domainInit,NULL);  //allocate resources in RT 
-  pthread_join(thread,NULL);
+  pthread_create(&thread, NULL, &domainInit, NULL);  //allocate resources in RT
+  pthread_join(thread, NULL);
   if (d) {
-    ORTEDomainStart(d,ORTE_TRUE,ORTE_FALSE,ORTE_TRUE,ORTE_FALSE,ORTE_TRUE); //application start
-    if (pthread_create(&thread,NULL,&publisherCreate,NULL)!=0)
+    ORTEDomainStart(d, ORTE_TRUE, ORTE_FALSE, ORTE_TRUE, ORTE_FALSE, ORTE_TRUE); //application start
+    if (pthread_create(&thread, NULL, &publisherCreate, NULL) != 0)
       printf("pthread_create failed!\n");
   } else
     printf("ORTEDomainAppCreate failed!\n");
@@ -155,13 +162,13 @@ init_module(void) {
 
 
 void
-cleanup_module(void) {
-  if (!d) return;
-  pthread_join(thread,NULL);
-  pthread_create(&thread,NULL,&domainDestroy,NULL);
-  pthread_join(thread,NULL);
+cleanup_module(void)
+{
+  if (!d)
+    return;
+  pthread_join(thread, NULL);
+  pthread_create(&thread, NULL, &domainDestroy, NULL);
+  pthread_join(thread, NULL);
 }
 
-#endif
-
-
+#endif /* ifndef CONFIG_ORTE_RT */
index fc8163cec72368ce1997998885eb7827e8d1225f..4282f04b8582f298306fd0b499eef07b2325ec0b 100644 (file)
@@ -3,18 +3,18 @@
  *
  *  DEBUG:  section                     h_subscriber
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
@@ -35,7 +35,7 @@
   #define printf rtl_printf
 #elif defined CONFIG_ORTE_RTAI
   #include <linux/module.h>
-  #include <rtai/compat.h>  
+  #include <rtai/compat.h>
   #define printf rt_printk
 #else
   #include <stdio.h>
@@ -50,12 +50,13 @@ static ORTEDomain        *d = NULL;
 static char              instance2Recv[64];
 
 static void
-recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam) {
-  char *instance=(char*)vinstance;
+recvCallBack(const ORTERecvInfo *info, void *vinstance, void *recvCallBackParam)
+{
+  char *instance = (char *)vinstance;
 
   switch (info->status) {
     case NEW_DATA:
-      printf("%s\n",instance);
+      printf("%s\n", instance);
       break;
     case DEADLINE:
       printf("deadline occurred\n");
@@ -65,25 +66,26 @@ recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam)
 
 
 static void *
-subscriberCreate(void *arg) {
+subscriberCreate(void *arg)
+{
   ORTESubscription    *s;
-  NtpTime             deadline,minimumSeparation;
-
-  ORTETypeRegisterAdd(d,"HelloMsg",NULL,NULL,NULL,sizeof(instance2Recv));
-  NTPTIME_BUILD(deadline,10);
-  NTPTIME_BUILD(minimumSeparation,0);
-  s=ORTESubscriptionCreate(
-       d,
-       IMMEDIATE,
-       BEST_EFFORTS,
-       "Example HelloMsg",
-       "HelloMsg",
-       &instance2Recv,
-       &deadline,
-       &minimumSeparation,
-       recvCallBack,
-       NULL,
-       IPADDRESS_INVALID);
+  NtpTime             deadline, minimumSeparation;
+
+  ORTETypeRegisterAdd(d, "HelloMsg", NULL, NULL, NULL, sizeof(instance2Recv));
+  NTPTIME_BUILD(deadline, 10);
+  NTPTIME_BUILD(minimumSeparation, 0);
+  s = ORTESubscriptionCreate(
+    d,
+    IMMEDIATE,
+    BEST_EFFORTS,
+    "Example HelloMsg",
+    "HelloMsg",
+    &instance2Recv,
+    &deadline,
+    &minimumSeparation,
+    recvCallBack,
+    NULL,
+    IPADDRESS_INVALID);
   if (s == NULL) {
     printf("ORTESubscriptionCreate failed\n");
   }
@@ -94,10 +96,11 @@ subscriberCreate(void *arg) {
 #ifndef CONFIG_ORTE_RT
 
 int
-main(int argc, char *args[]) {
+main(int argc, char *args[])
+{
   ORTEInit();
   ORTEVerbositySetOptions("ALL.10");
-  d=ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN,NULL,NULL,ORTE_FALSE);
+  d = ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN, NULL, NULL, ORTE_FALSE);
   if (!d) {
     printf("ORTEDomainAppCreate failed!\n");
     return 0;
@@ -109,42 +112,46 @@ main(int argc, char *args[]) {
 }
 
 #else
-char *verbosity="";
-MODULE_PARM(verbosity,"1s");
-MODULE_PARM_DESC(verbosity,"set verbosity level SECTION, up to LEVEL:...");
-char *manager="127.0.0.1";
-MODULE_PARM(manager,"s");
-MODULE_PARM_DESC(manager,"IP address of local manager");
+char *verbosity = "";
+MODULE_PARM(verbosity, "1s");
+MODULE_PARM_DESC(verbosity, "set verbosity level SECTION, up to LEVEL:...");
+char *manager = "127.0.0.1";
+MODULE_PARM(manager, "s");
+MODULE_PARM_DESC(manager, "IP address of local manager");
 MODULE_LICENSE("GPL");
 pthread_t thread;
 
 void *
-domainInit(void *arg) {
+domainInit(void *arg)
+{
   ORTEDomainProp dp;
-  
+
   ORTEDomainPropDefaultGet(&dp);
   ORTEVerbositySetOptions(verbosity);
-  dp.appLocalManager=StringToIPAddress(manager);
-  d=ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN,&dp,NULL,ORTE_TRUE);
+  dp.appLocalManager = StringToIPAddress(manager);
+  d = ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN, &dp, NULL, ORTE_TRUE);
   return arg;
 }
 
 void *
-domainDestroy(void *arg) {
-  if (!d) return NULL;
+domainDestroy(void *arg)
+{
+  if (!d)
+    return NULL;
   ORTEDomainAppDestroy(d);
   return arg;
 }
 
 int
-init_module(void) {
+init_module(void)
+{
   ORTEInit();
-  pthread_create(&thread,NULL,&domainInit,NULL);  //allocate resources in RT 
-  pthread_join(thread,NULL);
+  pthread_create(&thread, NULL, &domainInit, NULL);  //allocate resources in RT
+  pthread_join(thread, NULL);
   if (d) {
-    ORTEDomainStart(d,ORTE_TRUE,ORTE_FALSE,ORTE_TRUE,ORTE_FALSE,ORTE_TRUE); //application start
-    if (pthread_create(&thread,NULL,&subscriberCreate,NULL)!=0)
-      printf("pthread_create failed!\n");    
+    ORTEDomainStart(d, ORTE_TRUE, ORTE_FALSE, ORTE_TRUE, ORTE_FALSE, ORTE_TRUE); //application start
+    if (pthread_create(&thread, NULL, &subscriberCreate, NULL) != 0)
+      printf("pthread_create failed!\n");
   } else
     printf("ORTEDomainAppCreate failed!\n");
   return 0;
@@ -152,17 +159,13 @@ init_module(void) {
 
 
 void
-cleanup_module(void) {
-  if (!d) return;
-  pthread_join(thread,NULL);
-  pthread_create(&thread,NULL,&domainDestroy,NULL);
-  pthread_join(thread,NULL);
+cleanup_module(void)
+{
+  if (!d)
+    return;
+  pthread_join(thread, NULL);
+  pthread_create(&thread, NULL, &domainDestroy, NULL);
+  pthread_join(thread, NULL);
 }
 
-#endif
-
-
-
-
-
-
+#endif /* ifndef CONFIG_ORTE_RT */
index 089229faf79810c994ab6431c2a59c58485d5de2..70bc5a65ed01a9c0517854c9ce24814bf5a387a3 100644 (file)
@@ -3,79 +3,85 @@
 #include <ddso.h>
 
 void
-ofb_cbs_octet(const ORTESendInfo *info,void *vinstance, void *sendCallBackParam) {
-  ofb_octet *instance=(ofb_octet*)vinstance;
+ofb_cbs_octet(const ORTESendInfo *info, void *vinstance, void *sendCallBackParam)
+{
+  ofb_octet *instance = (ofb_octet *)vinstance;
 
   switch (info->status) {
     case NEED_DATA:
-        instance->value++;
+      instance->value++;
       break;
     case CQL:  //criticalQueueLevel
       break;
   }
-} 
+}
 
 void
-ofb_cbr_octet(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam) {
-  ofb_octet *instance=(ofb_octet*)vinstance;
+ofb_cbr_octet(const ORTERecvInfo *info, void *vinstance, void *recvCallBackParam)
+{
+  ofb_octet *instance = (ofb_octet *)vinstance;
 
   switch (info->status) {
     case NEW_DATA:
-        printf("GUID:0x%x, value:%d\n",instance->guid,instance->value);
+      printf("GUID:0x%x, value:%d\n", instance->guid, instance->value);
       break;
     case CQL:  //criticalQueueLevel
       break;
   }
-} 
+}
 
 void
-ofb_cbs_short(const ORTESendInfo *info,void *vinstance, void *sendCallBackParam) {
-  ofb_short *instance=(ofb_short*)vinstance;
+ofb_cbs_short(const ORTESendInfo *info, void *vinstance, void *sendCallBackParam)
+{
+  ofb_short *instance = (ofb_short *)vinstance;
 
   switch (info->status) {
     case NEED_DATA:
-        instance->value++;
+      instance->value++;
       break;
     case CQL:  //criticalQueueLevel
       break;
   }
-} 
+}
 
 void
-ofb_cbr_short(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam) {
-  ofb_short *instance=(ofb_short*)vinstance;
+ofb_cbr_short(const ORTERecvInfo *info, void *vinstance, void *recvCallBackParam)
+{
+  ofb_short *instance = (ofb_short *)vinstance;
 
   switch (info->status) {
     case NEW_DATA:
-        printf("GUID:0x%x, value:%d\n",instance->guid,instance->value);
+      printf("GUID:0x%x, value:%d\n", instance->guid, instance->value);
       break;
     case CQL:  //criticalQueueLevel
       break;
   }
-} 
+}
 
 void
-ofb_cbs_long(const ORTESendInfo *info,void *vinstance, void *sendCallBackParam) {
-  ofb_long *instance=(ofb_long*)vinstance;
+ofb_cbs_long(const ORTESendInfo *info, void *vinstance, void *sendCallBackParam)
+{
+  ofb_long *instance = (ofb_long *)vinstance;
 
   switch (info->status) {
     case NEED_DATA:
-        instance->value++;
+      instance->value++;
       break;
     case CQL:  //criticalQueueLevel
       break;
   }
-} 
+}
 
 void
-ofb_cbr_long(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam) {
-  ofb_long *instance=(ofb_long*)vinstance;
+ofb_cbr_long(const ORTERecvInfo *info, void *vinstance, void *recvCallBackParam)
+{
+  ofb_long *instance = (ofb_long *)vinstance;
 
   switch (info->status) {
     case NEW_DATA:
-        printf("GUID:0x%x, value:%d\n",instance->guid,instance->value);
+      printf("GUID:0x%x, value:%d\n", instance->guid, instance->value);
       break;
     case CQL:  //criticalQueueLevel
       break;
   }
-} 
+}
index 62973fc152bc09359c1fad95d8026ae9852bb16b..25e383f8e8135163a895825480b8b9eb08aaaa96 100644 (file)
@@ -7,12 +7,18 @@ extern "C" {
 
 typedef int (*ofb_get_value)();
 
-void ofb_cbs_octet(const ORTESendInfo *info,void *vinstance, void *sendCallBackParam);
-void ofb_cbr_octet(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam);
-void ofb_cbs_short(const ORTESendInfo *info,void *vinstance, void *sendCallBackParam);
-void ofb_cbr_short(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam);
-void ofb_cbs_long(const ORTESendInfo *info,void *vinstance, void *sendCallBackParam);
-void ofb_cbr_long(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam);
+void
+ofb_cbs_octet(const ORTESendInfo *info, void *vinstance, void *sendCallBackParam);
+void
+ofb_cbr_octet(const ORTERecvInfo *info, void *vinstance, void *recvCallBackParam);
+void
+ofb_cbs_short(const ORTESendInfo *info, void *vinstance, void *sendCallBackParam);
+void
+ofb_cbr_short(const ORTERecvInfo *info, void *vinstance, void *recvCallBackParam);
+void
+ofb_cbs_long(const ORTESendInfo *info, void *vinstance, void *sendCallBackParam);
+void
+ofb_cbr_long(const ORTERecvInfo *info, void *vinstance, void *recvCallBackParam);
 
 #ifdef __cplusplus
 }
index 5a143b201e048fefaedde1a62fe7db0e3bc02d91..19ce8478cc925c361061ec43aa032d292877b5c1 100644 (file)
@@ -3,7 +3,7 @@
 #include <ddso.h>
 #include "ddso_cb.h"
 
-ORTEDomain        *d=NULL; 
+ORTEDomain        *d = NULL;
 NtpTime           persistence, delay;
 ORTEPublication   *p_octet;
 ORTEPublication   *p_short;
@@ -13,19 +13,22 @@ ofb_octet         i2s_octet;
 ofb_short         i2s_short;
 ofb_long          i2s_long;
 
-int main(int argc,char *argv[]) {
+int
+main(int argc, char *argv[])
+{
   //init
   ORTEInit();
-  d=ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN,NULL,NULL,ORTE_FALSE);
-  if (!d) return -1;
-  NTPTIME_BUILD(persistence,3);  //3s
-  NTPTIME_BUILD(delay,1);        //1s
-  i2s_octet.guid=0x123456;
-  i2s_octet.value=0;
-  i2s_short.guid=0x654321;
-  i2s_short.value=0;
-  i2s_long.guid=0x123654;
-  i2s_long.value=0;
+  d = ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN, NULL, NULL, ORTE_FALSE);
+  if (!d)
+    return -1;
+  NTPTIME_BUILD(persistence, 3);  //3s
+  NTPTIME_BUILD(delay, 1);        //1s
+  i2s_octet.guid = 0x123456;
+  i2s_octet.value = 0;
+  i2s_short.guid = 0x654321;
+  i2s_short.value = 0;
+  i2s_long.guid = 0x123654;
+  i2s_long.value = 0;
 
   //register serialization/deserealization functions for a given types
   ofb_octet_type_register(d);
@@ -35,39 +38,38 @@ int main(int argc,char *argv[]) {
   ofb_double_type_register(d);
 
   //create of services
-  p_octet=ORTEPublicationCreate(
-       d,
-      "GUID_octet",
-      "ofb_octet",
-      &i2s_octet,
-      &persistence,
-      1,
-      &ofb_cbs_octet,
-      NULL,
-      &delay);
-  p_short=ORTEPublicationCreate(
-       d,
-      "GUID_short",
-      "ofb_short",
-      &i2s_short,
-      &persistence,
-      1,
-      &ofb_cbs_short,
-      NULL,
-      &delay);
-  p_long=ORTEPublicationCreate(
-       d,
-      "GUID_long",
-      "ofb_long",
-      &i2s_long,
-      &persistence,
-      1,
-      &ofb_cbs_long,
-      NULL,
-      &delay);
-  
-  while(1) {
+  p_octet = ORTEPublicationCreate(
+    d,
+    "GUID_octet",
+    "ofb_octet",
+    &i2s_octet,
+    &persistence,
+    1,
+    &ofb_cbs_octet,
+    NULL,
+    &delay);
+  p_short = ORTEPublicationCreate(
+    d,
+    "GUID_short",
+    "ofb_short",
+    &i2s_short,
+    &persistence,
+    1,
+    &ofb_cbs_short,
+    NULL,
+    &delay);
+  p_long = ORTEPublicationCreate(
+    d,
+    "GUID_long",
+    "ofb_long",
+    &i2s_long,
+    &persistence,
+    1,
+    &ofb_cbs_long,
+    NULL,
+    &delay);
+
+  while (1)
     ORTESleepMs(1);
-  }
   return 0;
 }
index 3b15ab7de5f1bdf834e2ef4fa05a2a403a595702..55ee2596d152c7ac972f1cc024337270c008c197 100644 (file)
@@ -3,8 +3,8 @@
 #include <ddso.h>
 #include "ddso_cb.h"
 
-ORTEDomain        *d=NULL; 
-NtpTime           deadline,minimumSeparation; 
+ORTEDomain        *d = NULL;
+NtpTime           deadline, minimumSeparation;
 ORTESubscription  *s_octet;
 ORTESubscription  *s_short;
 ORTESubscription  *s_long;
@@ -13,13 +13,16 @@ ofb_octet         i2r_octet;
 ofb_short         i2r_short;
 ofb_long          i2r_long;
 
-int main(int argc,char *argv[]) {
+int
+main(int argc, char *argv[])
+{
   //init
   ORTEInit();
-  d=ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN,NULL,NULL,ORTE_FALSE);
-  if (!d) return -1;
-  NTPTIME_BUILD(deadline,10);         //10s
-  NTPTIME_BUILD(minimumSeparation,0); //0s
+  d = ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN, NULL, NULL, ORTE_FALSE);
+  if (!d)
+    return -1;
+  NTPTIME_BUILD(deadline, 10);         //10s
+  NTPTIME_BUILD(minimumSeparation, 0); //0s
 
   //register serialization/deserealization functions for a given types
   ofb_octet_type_register(d);
@@ -29,45 +32,44 @@ int main(int argc,char *argv[]) {
   ofb_double_type_register(d);
 
   //create of services
-  s_octet=ORTESubscriptionCreate(
-       d,
-       IMMEDIATE,
-       BEST_EFFORTS,
-       "GUID_octet",
-       "ofb_octet",
-       &i2r_octet,
-       &deadline,
-       &minimumSeparation,
-       ofb_cbr_octet,
-       NULL,
-       IPADDRESS_INVALID); 
-  s_short=ORTESubscriptionCreate(
-       d,
-       IMMEDIATE,
-       BEST_EFFORTS,
-       "GUID_short",
-       "ofb_short",
-       &i2r_short,
-       &deadline,
-       &minimumSeparation,
-       ofb_cbr_short,
-       NULL,
-       IPADDRESS_INVALID); 
-  s_long=ORTESubscriptionCreate(
-       d,
-       IMMEDIATE,
-       BEST_EFFORTS,
-       "GUID_long",
-       "ofb_long",
-       &i2r_long,
-       &deadline,
-       &minimumSeparation,
-       ofb_cbr_long,
-       NULL,
-       IPADDRESS_INVALID); 
-  
-  while(1) {
+  s_octet = ORTESubscriptionCreate(
+    d,
+    IMMEDIATE,
+    BEST_EFFORTS,
+    "GUID_octet",
+    "ofb_octet",
+    &i2r_octet,
+    &deadline,
+    &minimumSeparation,
+    ofb_cbr_octet,
+    NULL,
+    IPADDRESS_INVALID);
+  s_short = ORTESubscriptionCreate(
+    d,
+    IMMEDIATE,
+    BEST_EFFORTS,
+    "GUID_short",
+    "ofb_short",
+    &i2r_short,
+    &deadline,
+    &minimumSeparation,
+    ofb_cbr_short,
+    NULL,
+    IPADDRESS_INVALID);
+  s_long = ORTESubscriptionCreate(
+    d,
+    IMMEDIATE,
+    BEST_EFFORTS,
+    "GUID_long",
+    "ofb_long",
+    &i2r_long,
+    &deadline,
+    &minimumSeparation,
+    ofb_cbr_long,
+    NULL,
+    IPADDRESS_INVALID);
+
+  while (1)
     ORTESleepMs(1);
-  }
   return 0;
 }
index 21ae25ba645f0d160d38e90ccf96439d8dbdbed4..3e93a304782fbd947ce5bfcf5b1335b5cc21c931 100644 (file)
@@ -3,18 +3,18 @@
  *
  *  DEBUG:  section                     m_subscriber
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
 static ORTEDomain        *d = NULL;
 static char              instance2Recv[64];
 
-int maxDataSize(ORTEGetMaxSizeParam *gms, int num) {
+int
+maxDataSize(ORTEGetMaxSizeParam *gms, int num)
+{
   return gms->max_size;
 }
 
 static void
-recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam) {
-  char *instance=(char*)vinstance;
+recvCallBack(const ORTERecvInfo *info, void *vinstance, void *recvCallBackParam)
+{
+  char *instance = (char *)vinstance;
 
   switch (info->status) {
     case NEW_DATA:
-      printf("%s\n",instance);
+      printf("%s\n", instance);
       break;
     case DEADLINE:
       printf("deadline occurred\n");
@@ -59,25 +62,26 @@ recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam)
 
 
 static void *
-subscriberCreate(void *arg) {
+subscriberCreate(void *arg)
+{
   ORTESubscription    *s;
-  NtpTime             deadline,minimumSeparation;
+  NtpTime             deadline, minimumSeparation;
 
-  ORTETypeRegisterAdd(d,"HelloMsg",NULL,NULL,maxDataSize,sizeof(instance2Recv));
-  NTPTIME_BUILD(deadline,10);
-  NTPTIME_BUILD(minimumSeparation,0);
-  s=ORTESubscriptionCreate(
-       d,
-       IMMEDIATE,
-       BEST_EFFORTS,
-       "Example HelloMsg",
-       "HelloMsg",
-       &instance2Recv,
-       &deadline,
-       &minimumSeparation,
-       recvCallBack,
-       NULL,
-       StringToIPAddress("225.0.0.2"));
+  ORTETypeRegisterAdd(d, "HelloMsg", NULL, NULL, maxDataSize, sizeof(instance2Recv));
+  NTPTIME_BUILD(deadline, 10);
+  NTPTIME_BUILD(minimumSeparation, 0);
+  s = ORTESubscriptionCreate(
+    d,
+    IMMEDIATE,
+    BEST_EFFORTS,
+    "Example HelloMsg",
+    "HelloMsg",
+    &instance2Recv,
+    &deadline,
+    &minimumSeparation,
+    recvCallBack,
+    NULL,
+    StringToIPAddress("225.0.0.2"));
   if (s == NULL) {
     printf("ORTESubscriptionCreate failed\n");
   }
@@ -85,15 +89,16 @@ subscriberCreate(void *arg) {
 }
 
 int
-main(int argc, char *args[]) {
+main(int argc, char *args[])
+{
   ORTEDomainProp dp;
-  
+
   ORTEInit();
   ORTEDomainPropDefaultGet(&dp);
-  dp.multicast.enabled=ORTE_TRUE;
-  dp.multicast.ipAddress=StringToIPAddress("225.0.0.1");
+  dp.multicast.enabled = ORTE_TRUE;
+  dp.multicast.ipAddress = StringToIPAddress("225.0.0.1");
   ORTEVerbositySetOptions("ALL.10");
-  d=ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN,&dp,NULL,ORTE_FALSE);
+  d = ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN, &dp, NULL, ORTE_FALSE);
   if (!d) {
     printf("ORTEDomainAppCreate failed!\n");
     return 0;
@@ -103,4 +108,3 @@ main(int argc, char *args[]) {
     ORTESleepMs(1000);
   return 0;
 }
-
index 15975d942b9cf42e9d56b90ac5871668270770af..238f29ed1bd57a1094a5ea507538289d5f960596 100644 (file)
@@ -1,33 +1,33 @@
 /*
- *  $Id: orteping.c,v 0.0.0.1           2003/10/07 
+ *  $Id: orteping.c,v 0.0.0.1           2003/10/07
  *
  *  DEBUG:  section                     orteping
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include <stdio.h>
 #include <stdlib.h>
 #define exit return
 #endif
 
-Boolean                 quite=ORTE_FALSE;
-int                    regfail=0;
+Boolean                 quite = ORTE_FALSE;
+int                     regfail = 0;
 
 //event system
 void
-onRegFail(void *param) {
+onRegFail(void *param)
+{
   printf("registration to a manager failed\n");
-  regfail=1;
+  regfail = 1;
 }
 
 static void
-recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam) {
-  uint32_t *instance=(uint32_t*)vinstance;
-  
+recvCallBack(const ORTERecvInfo *info, void *vinstance, void *recvCallBackParam)
+{
+  uint32_t *instance = (uint32_t *)vinstance;
+
   switch (info->status) {
     case NEW_DATA:
       if (!quite)
-        printf("received fresh issue %"PRIu32"\n",*instance);
+       printf("received fresh issue %" PRIu32 "\n", *instance);
       break;
     case DEADLINE:
       printf("deadline occurred\n");
@@ -85,21 +87,24 @@ recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam)
 }
 
 static void
-sendCallBack(const ORTESendInfo *info,void *vinstance, void *sendCallBackParam) {
-  uint32_t *instance=(uint32_t*)vinstance;
-  
+sendCallBack(const ORTESendInfo *info, void *vinstance, void *sendCallBackParam)
+{
+  uint32_t *instance = (uint32_t *)vinstance;
+
   switch (info->status) {
     case NEED_DATA:
       (*instance)++;
       if (!quite)
-        printf("sent issue %"PRIu32"\n",*instance);
+       printf("sent issue %" PRIu32 "\n", *instance);
       break;
     case CQL:  //criticalQueueLevel
       break;
   }
 }
 
-static void usage(void) {
+static void
+usage(void)
+{
   printf("usage: orteping <parameters> \n");
   printf("  -d, --domain <domain>         working application domain\n");
   printf("  -p, --publisher               create publisher Ping,PingData\n");
@@ -111,7 +116,7 @@ static void usage(void) {
   printf("  -E, --expiration <s>          expiration time of application\n");
   printf("  -m, --minimumSeparation <s>   minimumSeparation between two issues\n");
   printf("  -I, --metaMulticast <IPAdd>   use multicast IPAddr for metatraffic comm.\n");
-  printf("  -i, --dataMulticast <IPAdd>   use multicast IPAddr for userdata comm.\n");  
+  printf("  -i, --dataMulticast <IPAdd>   use multicast IPAddr for userdata comm.\n");
   printf("  -t, --timetolive <number>     time-to-live for multicast packets\n");
   printf("  -v, --verbosity <level>       set verbosity level SECTION, up to LEVEL:...\n");
   printf("      examples: ORTEManager -v 51.7:32.5 sections 51 and 32\n");
@@ -122,158 +127,159 @@ static void usage(void) {
   printf("  -h, --help                    this usage screen\n");
 }
 
-int main(int argc,char *argv[]) {
+int
+main(int argc, char *argv[])
+{
 #if defined HAVE_GETOPT_LONG || defined HAVE_GETOPT_LONG_ORTE
   static struct option long_opts[] = {
-    { "domain",1,0, 'd' },
-    { "publisher",0,0, 'p' },
-    { "strength",1,0, 'S' },
-    { "subscriber",0,0, 's' },
-    { "refresh",1,0, 'R' },
-    { "purge",1,0, 'P' },
-    { "expiration",1,0, 'E' },
-    { "minimumSeparation",1,0, 'm' },
-    { "metaMulticast",1,0, 'I' },
-    { "dataMulticast",1,0, 'i' },
-    { "timetolive",1,0, 't' },
-    { "delay",1,0, 'D' },
-    { "verbosity",1,0, 'v' },
-    { "quiet",0,0, 'q' },
-    { "logfile",1,0, 'l' },
-    { "version",0,0, 'V' },
+    { "domain", 1, 0, 'd' },
+    { "publisher", 0, 0, 'p' },
+    { "strength", 1, 0, 'S' },
+    { "subscriber", 0, 0, 's' },
+    { "refresh", 1, 0, 'R' },
+    { "purge", 1, 0, 'P' },
+    { "expiration", 1, 0, 'E' },
+    { "minimumSeparation", 1, 0, 'm' },
+    { "metaMulticast", 1, 0, 'I' },
+    { "dataMulticast", 1, 0, 'i' },
+    { "timetolive", 1, 0, 't' },
+    { "delay", 1, 0, 'D' },
+    { "verbosity", 1, 0, 'v' },
+    { "quiet", 0, 0, 'q' },
+    { "logfile", 1, 0, 'l' },
+    { "version", 0, 0, 'V' },
     { "help",  0, 0, 'h' },
     { 0, 0, 0, 0}
   };
 #endif
   ORTEDomain              *d;
-  ORTEDomainProp          dp; 
-  ORTEPublication         *p=NULL;
-  ORTESubscription        *s=NULL;
-  int                     opt,domain=ORTE_DEFAULT_DOMAIN;
-  int32_t                 strength=1;
-  int32_t                 instanceSend=0,instanceRecv=0;
-  NtpTime                 persistence,deadline,minimumSeparation,delay;
-  Boolean                 havePublisher=ORTE_FALSE;
-  Boolean                 haveSubscriber=ORTE_FALSE;
-  IPAddress              smIPAddress=IPADDRESS_INVALID;
+  ORTEDomainProp          dp;
+  ORTEPublication         *p = NULL;
+  ORTESubscription        *s = NULL;
+  int                     opt, domain = ORTE_DEFAULT_DOMAIN;
+  int32_t                 strength = 1;
+  int32_t                 instanceSend = 0, instanceRecv = 0;
+  NtpTime                 persistence, deadline, minimumSeparation, delay;
+  Boolean                 havePublisher = ORTE_FALSE;
+  Boolean                 haveSubscriber = ORTE_FALSE;
+  IPAddress               smIPAddress = IPADDRESS_INVALID;
   ORTEDomainAppEvents     events;
-  
+
   ORTEInit();
   ORTEDomainPropDefaultGet(&dp);
-  NTPTIME_BUILD(minimumSeparation,0); 
-  NTPTIME_BUILD(delay,1); //1s
+  NTPTIME_BUILD(minimumSeparation, 0);
+  NTPTIME_BUILD(delay, 1); //1s
 
 #if defined HAVE_GETOPT_LONG || defined HAVE_GETOPT_LONG_ORTE
-  while ((opt = getopt_long(argc, argv, "m:S:d:v:R:E:P:l:I:i:t:D:Vhpsq",&long_opts[0], NULL)) != EOF) {
+  while ((opt = getopt_long(argc, argv, "m:S:d:v:R:E:P:l:I:i:t:D:Vhpsq", &long_opts[0], NULL)) != EOF) {
 #else
   while ((opt = getopt(argc, argv, "m:S:d:v:R:E:P:l:I:i:t:D:Vhpsq")) != EOF) {
 #endif
     switch (opt) {
       case 'S':
-        strength=strtol(optarg,NULL,0);
-        break;
+       strength = strtol(optarg, NULL, 0);
+       break;
       case 'd':
-        domain=strtol(optarg,NULL,0);
-        break;
+       domain = strtol(optarg, NULL, 0);
+       break;
       case 'p':
-          havePublisher=ORTE_TRUE;
-        break;
+       havePublisher = ORTE_TRUE;
+       break;
       case 's':
-          haveSubscriber=ORTE_TRUE;
-        break;
+       haveSubscriber = ORTE_TRUE;
+       break;
       case 'v':
-        ORTEVerbositySetOptions(optarg);
-        break;
+       ORTEVerbositySetOptions(optarg);
+       break;
       case 'R':
-        NtpTimeAssembFromMs(dp.baseProp.refreshPeriod,strtol(optarg,NULL,0),0);
-        break;
+       NtpTimeAssembFromMs(dp.baseProp.refreshPeriod, strtol(optarg, NULL, 0), 0);
+       break;
       case 'P':
-        NtpTimeAssembFromMs(dp.baseProp.purgeTime,strtol(optarg,NULL,0),0);
-        break;
+       NtpTimeAssembFromMs(dp.baseProp.purgeTime, strtol(optarg, NULL, 0), 0);
+       break;
       case 'E':
-        NtpTimeAssembFromMs(dp.baseProp.expirationTime,strtol(optarg,NULL,0),0);
-        break;
+       NtpTimeAssembFromMs(dp.baseProp.expirationTime, strtol(optarg, NULL, 0), 0);
+       break;
       case 'm':
-        NtpTimeAssembFromMs(minimumSeparation,strtol(optarg,NULL,0),0);
-        break;
+       NtpTimeAssembFromMs(minimumSeparation, strtol(optarg, NULL, 0), 0);
+       break;
       case 'D':
-        NtpTimeAssembFromMs(delay,strtol(optarg,NULL,0)/1000,strtol(optarg,NULL,0)%1000);
-        break;
+       NtpTimeAssembFromMs(delay, strtol(optarg, NULL, 0)/1000, strtol(optarg, NULL, 0)%1000);
+       break;
       case 'I':
-        dp.multicast.enabled=ORTE_TRUE;
-        dp.multicast.ipAddress=StringToIPAddress(optarg);
-        break;
+       dp.multicast.enabled = ORTE_TRUE;
+       dp.multicast.ipAddress = StringToIPAddress(optarg);
+       break;
       case 'i':
-        dp.multicast.enabled=ORTE_TRUE;
-        smIPAddress=StringToIPAddress(optarg);
-        break;
+       dp.multicast.enabled = ORTE_TRUE;
+       smIPAddress = StringToIPAddress(optarg);
+       break;
       case 't':
-        dp.multicast.ttl=strtol(optarg,NULL,0);
-        break;
+       dp.multicast.ttl = strtol(optarg, NULL, 0);
+       break;
       case 'l':
-        ORTEVerbositySetLogFile(optarg);
+       ORTEVerbositySetLogFile(optarg);
       case 'q':
-        quite=ORTE_TRUE;
-        break;
+       quite = ORTE_TRUE;
+       break;
       case 'V':
-        printf("Ocera Real-Time Ethernet (%s).\n",dp.version);
-        exit(0);
-        break;
+       printf("Ocera Real-Time Ethernet (%s).\n", dp.version);
+       exit(0);
+       break;
       case 'h':
       default:
-        usage();
-        exit(opt == 'h' ? 0 : 1);
+       usage();
+       exit(opt == 'h' ? 0 : 1);
     }
   }
 
   //initiate event system
   ORTEDomainInitEvents(&events);
-  events.onRegFail=onRegFail;
+  events.onRegFail = onRegFail;
 
-  //Create application     
-  d=ORTEDomainAppCreate(domain,&dp,&events,ORTE_FALSE);
+  //Create application
+  d = ORTEDomainAppCreate(domain, &dp, &events, ORTE_FALSE);
   //Register ser./deser. rutines with maximal size 4 Bytes
-  ORTETypeRegisterAdd(d,"PingData",NULL,NULL,NULL,4);   
+  ORTETypeRegisterAdd(d, "PingData", NULL, NULL, NULL, 4);
   //Create publisher
   if (havePublisher) {
-    NTPTIME_BUILD(persistence,5); 
-    p=ORTEPublicationCreate(
-         d,
-         "Ping",
-         "PingData",
-         &instanceSend,
-         &persistence,
-         strength,
-         sendCallBack,
-         NULL,
-         &delay);
-   if (p == NULL) {
-     printf("ORTEPublicationCreate failed\n");
-     exit(1);
-   }
+    NTPTIME_BUILD(persistence, 5);
+    p = ORTEPublicationCreate(
+      d,
+      "Ping",
+      "PingData",
+      &instanceSend,
+      &persistence,
+      strength,
+      sendCallBack,
+      NULL,
+      &delay);
+    if (p == NULL) {
+      printf("ORTEPublicationCreate failed\n");
+      exit(1);
+    }
   }
   if (haveSubscriber) {
-    NTPTIME_BUILD(deadline,3); 
-    s=ORTESubscriptionCreate(
-         d,
-         IMMEDIATE,
-         BEST_EFFORTS,
-         "Ping",
-         "PingData",
-         &instanceRecv,
-         &deadline,
-         &minimumSeparation,
-         recvCallBack,
-         NULL,
-        smIPAddress);
-   if (s == NULL) {
-     printf("ORTESubscriptionCreate failed\n");
-     exit(1);
-   }
+    NTPTIME_BUILD(deadline, 3);
+    s = ORTESubscriptionCreate(
+      d,
+      IMMEDIATE,
+      BEST_EFFORTS,
+      "Ping",
+      "PingData",
+      &instanceRecv,
+      &deadline,
+      &minimumSeparation,
+      recvCallBack,
+      NULL,
+      smIPAddress);
+    if (s == NULL) {
+      printf("ORTESubscriptionCreate failed\n");
+      exit(1);
+    }
   }
   //never ending loop
-  while (!regfail) 
+  while (!regfail)
     ORTESleepMs(1000);
   exit(0);
 }
-
index 2e2139c6d631d3d822c168430c1dcbb64ac1d499..1a270f371c36b5c64b58525989fdfc93c2a3a6cc 100644 (file)
@@ -1,33 +1,33 @@
 /*
- *  $Id: publisher.c,v 0.0.0.1          2003/12/27 
+ *  $Id: publisher.c,v 0.0.0.1          2003/12/27
  *
  *  DEBUG:  section                     publisher
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include <stdio.h>
 #ifdef __RTL__
 
 static ORTEDomain        *d;
 static char              instance2Send[64];
-static int               counter=0;
+static int               counter = 0;
 
 static void
-sendCallBack(const ORTESendInfo *info,void *vinstance, void *sendCallBackParam) {
-  char *instance=(char*)vinstance;
+sendCallBack(const ORTESendInfo *info, void *vinstance, void *sendCallBackParam)
+{
+  char *instance = (char *)vinstance;
 
   switch (info->status) {
     case NEED_DATA:
       printf("Sampling publication, count %d\n", counter);
-      sprintf(instance,"Hello Universe! (%d)",counter++);
+      sprintf(instance, "Hello Universe! (%d)", counter++);
       break;
     case CQL:  //criticalQueueLevel
       break;
@@ -59,49 +60,51 @@ sendCallBack(const ORTESendInfo *info,void *vinstance, void *sendCallBackParam)
 }
 
 
-int 
-main(int argc, char *args[]) {
+int
+main(int argc, char *args[])
+{
   ORTEPublication *p;
-  NtpTime         persistence,repeating;
+  NtpTime         persistence, repeating;
 
   ORTEInit();
-  d=ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN,NULL,NULL,ORTE_FALSE);
-  ORTETypeRegisterAdd(d,"HelloMsg",NULL,NULL,NULL,sizeof(instance2Send));
-  NTPTIME_BUILD(persistence,3); 
-  NTPTIME_BUILD(repeating,1); 
-  p=ORTEPublicationCreate(
-       d,
-      "Reliable HelloMsg",
-      "HelloMsg",
-      &instance2Send,
-      &persistence,
-      1,
-      sendCallBack,
-      NULL,
-      &repeating);
+  d = ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN, NULL, NULL, ORTE_FALSE);
+  ORTETypeRegisterAdd(d, "HelloMsg", NULL, NULL, NULL, sizeof(instance2Send));
+  NTPTIME_BUILD(persistence, 3);
+  NTPTIME_BUILD(repeating, 1);
+  p = ORTEPublicationCreate(
+    d,
+    "Reliable HelloMsg",
+    "HelloMsg",
+    &instance2Send,
+    &persistence,
+    1,
+    sendCallBack,
+    NULL,
+    &repeating);
   if (p == NULL) {
     printf("ORTEPublicationCreate failed\n");
     return 1;
   }
   #ifndef CONFIG_ORTE_RT
-  while(1) {
+  while (1)
     ORTESleepMs(1000);
-  }
+
   #endif
   return 0;
 }
 
 #ifdef CONFIG_ORTE_RT
-void 
-hello_init(void) {
-  main(0,NULL);
+void
+hello_init(void)
+{
+  main(0, NULL);
 }
-void 
-hello_exit(void) {
+void
+hello_exit(void)
+{
   ORTEDomainAppDestroy(d);
 }
 MODULE_LICENSE("GPL");
 module_init(hello_init);
 module_exit(hello_exit);
 #endif
-
index 8ebafb8f97865204539fa780a8a9da113553f5bd..63832dfdc36afc0133458a987a046efbf1047d70 100644 (file)
@@ -1,33 +1,33 @@
 /*
- *  $Id: subscriberbesteffort.c,v 0.0.0.1 2003/12/27 
+ *  $Id: subscriberbesteffort.c,v 0.0.0.1 2003/12/27
  *
  *  DEBUG:  section                     Subscriber BestEffort
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include <stdio.h>
 #ifdef __RTL__
@@ -44,12 +44,13 @@ static ORTEDomain        *d;
 static char              instance2Recv[64];
 
 static void
-recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam) {
-  char *instance=(char*)vinstance;
-  
+recvCallBack(const ORTERecvInfo *info, void *vinstance, void *recvCallBackParam)
+{
+  char *instance = (char *)vinstance;
+
   switch (info->status) {
     case NEW_DATA:
-      printf("%s\n",instance);
+      printf("%s\n", instance);
       break;
     case DEADLINE:
       printf("deadline occurred\n");
@@ -58,51 +59,53 @@ recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam)
 }
 
 
-int 
-main(int argc, char *args[]) {
+int
+main(int argc, char *args[])
+{
   ORTESubscription *s;
-  NtpTime         deadline,minimumSeparation;
+  NtpTime         deadline, minimumSeparation;
 
   ORTEInit();
   //ORTEVerbositySetOptions("ALL,10");
-  d=ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN,NULL,NULL,ORTE_FALSE);
-  ORTETypeRegisterAdd(d,"HelloMsg",NULL,NULL,NULL,sizeof(instance2Recv));
-  NTPTIME_BUILD(deadline,3); 
-  NTPTIME_BUILD(minimumSeparation,0); 
-  s=ORTESubscriptionCreate(
-       d,
-       IMMEDIATE,
-       BEST_EFFORTS,
-       "Reliable HelloMsg",
-       "HelloMsg",
-       &instance2Recv,
-       &deadline,
-       &minimumSeparation,
-       recvCallBack,
-       NULL,
-       IPADDRESS_INVALID);
+  d = ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN, NULL, NULL, ORTE_FALSE);
+  ORTETypeRegisterAdd(d, "HelloMsg", NULL, NULL, NULL, sizeof(instance2Recv));
+  NTPTIME_BUILD(deadline, 3);
+  NTPTIME_BUILD(minimumSeparation, 0);
+  s = ORTESubscriptionCreate(
+    d,
+    IMMEDIATE,
+    BEST_EFFORTS,
+    "Reliable HelloMsg",
+    "HelloMsg",
+    &instance2Recv,
+    &deadline,
+    &minimumSeparation,
+    recvCallBack,
+    NULL,
+    IPADDRESS_INVALID);
   if (s == NULL) {
     printf("ORTESubscriptionCreate failed\n");
     return 1;
   }
   #ifndef CONFIG_ORTE_RT
-  while (1) 
+  while (1)
     ORTESleepMs(1000);
   #endif
   return 0;
 }
 
 #ifdef CONFIG_ORTE_RT
-void 
-hello_init(void) {
-  main(0,NULL);
+void
+hello_init(void)
+{
+  main(0, NULL);
 }
-void 
-hello_exit(void) {
+void
+hello_exit(void)
+{
   ORTEDomainAppDestroy(d);
 }
 MODULE_LICENSE("GPL");
 module_init(hello_init);
 module_exit(hello_exit);
 #endif
-
index 844415d9f1a35f784ee8e77f2322ea10e972a66a..953c5a16afdb92caf830573dd2aadc4b3453c0da 100644 (file)
@@ -1,33 +1,33 @@
 /*
- *  $Id: subscriberreliable.c,v 0.0.0.1 2003/12/27 
+ *  $Id: subscriberreliable.c,v 0.0.0.1 2003/12/27
  *
  *  DEBUG:  section                     subscriber reliable
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include <stdio.h>
 #ifdef __RTL__
@@ -44,12 +44,13 @@ static ORTEDomain        *d;
 static char              instance2Recv[64];
 
 static void
-recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam) {
-  char *instance=(char*)vinstance;
-  
+recvCallBack(const ORTERecvInfo *info, void *vinstance, void *recvCallBackParam)
+{
+  char *instance = (char *)vinstance;
+
   switch (info->status) {
     case NEW_DATA:
-      printf("%s\n",instance);
+      printf("%s\n", instance);
       break;
     case DEADLINE:
       printf("deadline occurred\n");
@@ -58,51 +59,53 @@ recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam)
 }
 
 
-int 
-main(int argc, char *args[]) {
+int
+main(int argc, char *args[])
+{
   ORTESubscription *s;
-  NtpTime         deadline,minimumSeparation;
+  NtpTime         deadline, minimumSeparation;
 
   ORTEInit();
   //ORTEVerbositySetOptions("ALL,10");
-  d=ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN,NULL,NULL,ORTE_FALSE);
-  ORTETypeRegisterAdd(d,"HelloMsg",NULL,NULL,NULL,sizeof(instance2Recv));
-  NTPTIME_BUILD(deadline,3); 
-  NTPTIME_BUILD(minimumSeparation,0); 
-  s=ORTESubscriptionCreate(
-       d,
-       IMMEDIATE,
-       STRICT_RELIABLE,
-       "Reliable HelloMsg",
-       "HelloMsg",
-       &instance2Recv,
-       &deadline,
-       &minimumSeparation,
-       recvCallBack,
-       NULL,
-       IPADDRESS_INVALID);
+  d = ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN, NULL, NULL, ORTE_FALSE);
+  ORTETypeRegisterAdd(d, "HelloMsg", NULL, NULL, NULL, sizeof(instance2Recv));
+  NTPTIME_BUILD(deadline, 3);
+  NTPTIME_BUILD(minimumSeparation, 0);
+  s = ORTESubscriptionCreate(
+    d,
+    IMMEDIATE,
+    STRICT_RELIABLE,
+    "Reliable HelloMsg",
+    "HelloMsg",
+    &instance2Recv,
+    &deadline,
+    &minimumSeparation,
+    recvCallBack,
+    NULL,
+    IPADDRESS_INVALID);
   if (s == NULL) {
     printf("ORTESubscriptionCreate failed\n");
     return 1;
   }
   #ifndef CONFIG_ORTE_RT
-  while (1) 
+  while (1)
     ORTESleepMs(1000);
   #endif
   return 0;
 }
 
 #ifdef CONFIG_ORTE_RT
-void 
-hello_init(void) {
-  main(0,NULL);
+void
+hello_init(void)
+{
+  main(0, NULL);
 }
-void 
-hello_exit(void) {
+void
+hello_exit(void)
+{
   ORTEDomainAppDestroy(d);
 }
 MODULE_LICENSE("GPL");
 module_init(hello_init);
 module_exit(hello_exit);
 #endif
-
index ac30b9cfbc90fcd2a24032f8ed60e80d8d17d42e..5ad9c9a33c8197e8d98c8711fcfbef39e96f3149 100644 (file)
 
 typedef struct motion_speed_type motion_speed;
 struct motion_speed_type {
-       CORBA_short left;
-       CORBA_short right;
+  CORBA_short left;
+  CORBA_short right;
 };
 
 struct robottype_orte_data {
-       ORTEDomain *orte_domain;
-       int strength;
+  ORTEDomain *orte_domain;
+  int strength;
 
-       struct motion_speed_type motion_speed;
-       ORTEPublication *publication_motion_speed;
+  struct motion_speed_type motion_speed;
+  ORTEPublication *publication_motion_speed;
 };
 
 struct robottype_orte_data orte;
 
-void send_dummy_cb(const ORTESendInfo *info, void *vinstance, void *sendCallBackParam)
+void
+send_dummy_cb(const ORTESendInfo *info, void *vinstance, void *sendCallBackParam)
 {
-       struct motion_speed_type *m = (struct motion_speed_type *)vinstance;
-
-       switch(info->status) {
-               case NEED_DATA:
-                       printf("Odeslana data: left: %d, right: %d\n", m->left, m->right);
-                       break;
-               case CQL:
-                       printf("Kriticka uroven fronty zprav na odeslani.\n");
-                       break;
-       }
+  struct motion_speed_type *m = (struct motion_speed_type *)vinstance;
+
+  switch (info->status) {
+    case NEED_DATA:
+      printf("Odeslana data: left: %d, right: %d\n", m->left, m->right);
+      break;
+    case CQL:
+      printf("Kriticka uroven fronty zprav na odeslani.\n");
+      break;
+  }
 }
 
-int robottype_roboorte_init(struct robottype_orte_data *data) {
-       int rv = 0;
-       ORTEDomainProp prop;
-       ORTEInit();
-
-       if (data->strength < 0)
-               data->strength = 1;
-
-       ORTEVerbositySetOptions("ALL.0");
-       ORTEDomainPropDefaultGet(&prop);
-       NTPTIME_BUILD(prop.baseProp.refreshPeriod, 3);
-       NTPTIME_BUILD(prop.baseProp.expirationTime, 10);
-       data->orte_domain = ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN, &prop, NULL, ORTE_FALSE);
-       if (!data->orte_domain) {
-               printf("ORTEDomainAppCreate failed!\n");
-               rv = -1;
-       }
-
-       return rv;
+int
+robottype_roboorte_init(struct robottype_orte_data *data)
+{
+  int rv = 0;
+  ORTEDomainProp prop;
+
+  ORTEInit();
+
+  if (data->strength < 0)
+    data->strength = 1;
+
+  ORTEVerbositySetOptions("ALL.0");
+  ORTEDomainPropDefaultGet(&prop);
+  NTPTIME_BUILD(prop.baseProp.refreshPeriod, 3);
+  NTPTIME_BUILD(prop.baseProp.expirationTime, 10);
+  data->orte_domain = ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN, &prop, NULL, ORTE_FALSE);
+  if (!data->orte_domain) {
+    printf("ORTEDomainAppCreate failed!\n");
+    rv = -1;
+  }
+
+  return rv;
 }
 
-void motion_speed_serialize(CDR_Codec *cdrCodec, motion_speed *object) {
-       CORBA_short_serialize(cdrCodec,&(object->left));
+void
+motion_speed_serialize(CDR_Codec *cdrCodec, motion_speed *object)
+{
+  CORBA_short_serialize(cdrCodec, &(object->left));
 
-       CORBA_short_serialize(cdrCodec,&(object->right));
+  CORBA_short_serialize(cdrCodec, &(object->right));
 
 }
 
-void motion_speed_deserialize(CDR_Codec *cdrCodec, motion_speed *object) {
-       CORBA_short_deserialize(cdrCodec,&(object->left));
+void
+motion_speed_deserialize(CDR_Codec *cdrCodec, motion_speed *object)
+{
+  CORBA_short_deserialize(cdrCodec, &(object->left));
 
-       CORBA_short_deserialize(cdrCodec,&(object->right));
+  CORBA_short_deserialize(cdrCodec, &(object->right));
 
 }
 
-int motion_speed_get_max_size(ORTEGetMaxSizeParam *gms, int num) {
-       int loop_lim=2;
-       int csize_save;
-       while(num) {
-               if (!loop_lim--) {
-                       gms->csize+=num*(gms->csize-csize_save);
-                       return gms->csize;
-               }
-               num--;
-               csize_save=gms->csize;
-               CORBA_short_get_max_size(gms, 1);
-               CORBA_short_get_max_size(gms, 1);
-       }
-       return gms->csize;
+int
+motion_speed_get_max_size(ORTEGetMaxSizeParam *gms, int num)
+{
+  int loop_lim = 2;
+  int csize_save;
+
+  while (num) {
+    if (!loop_lim--) {
+      gms->csize += num*(gms->csize-csize_save);
+      return gms->csize;
+    }
+    num--;
+    csize_save = gms->csize;
+    CORBA_short_get_max_size(gms, 1);
+    CORBA_short_get_max_size(gms, 1);
+  }
+  return gms->csize;
 }
 
 Boolean
-motion_speed_type_register(ORTEDomain *d) {
-       Boolean ret;
-
-       ret=ORTETypeRegisterAdd(d,
-                               "motion_speed",
-                               (ORTETypeSerialize)motion_speed_serialize,
-                               (ORTETypeDeserialize)motion_speed_deserialize,
-                               motion_speed_get_max_size,
-                               0);
+motion_speed_type_register(ORTEDomain *d)
+{
+  Boolean ret;
+
+  ret = ORTETypeRegisterAdd(d,
+                           "motion_speed",
+                           (ORTETypeSerialize)motion_speed_serialize,
+                           (ORTETypeDeserialize)motion_speed_deserialize,
+                           motion_speed_get_max_size,
+                           0);
 }
 
-void robottype_publisher_motion_speed_create(struct robottype_orte_data *data, ORTESendCallBack callback, void *arg) {
-       NtpTime persistance, delay;
+void
+robottype_publisher_motion_speed_create(struct robottype_orte_data *data, ORTESendCallBack callback, void *arg)
+{
+  NtpTime persistance, delay;
 
-       motion_speed_type_register(data->orte_domain);
-       NtpTimeAssembFromMs(persistance, 3, 0);
-       NtpTimeAssembFromMs(delay, 0, 100);
-       printf("delay: s = %d, f = %d\n", delay.seconds, delay.fraction);
-       data->publication_motion_speed = ORTEPublicationCreate(data->orte_domain, "motion_speed", "motion_speed", &data->motion_speed, &persistance, data->strength, callback, arg, &delay);
+  motion_speed_type_register(data->orte_domain);
+  NtpTimeAssembFromMs(persistance, 3, 0);
+  NtpTimeAssembFromMs(delay, 0, 100);
+  printf("delay: s = %d, f = %d\n", delay.seconds, delay.fraction);
+  data->publication_motion_speed = ORTEPublicationCreate(data->orte_domain, "motion_speed", "motion_speed", &data->motion_speed, &persistance, data->strength, callback, arg, &delay);
 }
 
-void destroy(int sig) {
-       ORTEPublicationDestroy(orte.publication_motion_speed);
-       ORTETypeRegisterDestroyAll(orte.orte_domain);
-       ORTEDomainAppDestroy(orte.orte_domain);
+void
+destroy(int sig)
+{
+  ORTEPublicationDestroy(orte.publication_motion_speed);
+  ORTETypeRegisterDestroyAll(orte.orte_domain);
+  ORTEDomainAppDestroy(orte.orte_domain);
 }
 
-int main(void) {
-       orte.strength = 30;
-       robottype_roboorte_init(&orte);
-       robottype_publisher_motion_speed_create(&orte, send_dummy_cb, &orte);
+int
+main(void)
+{
+  orte.strength = 30;
+  robottype_roboorte_init(&orte);
+  robottype_publisher_motion_speed_create(&orte, send_dummy_cb, &orte);
 
-       orte.motion_speed.right = -19000;
-       orte.motion_speed.left = 20000;
-       ORTEPublicationSend(orte.publication_motion_speed);
+  orte.motion_speed.right = -19000;
+  orte.motion_speed.left = 20000;
+  ORTEPublicationSend(orte.publication_motion_speed);
 
-       signal(SIGINT, &destroy);
-       signal(SIGTERM, &destroy);
-       pause();
+  signal(SIGINT, &destroy);
+  signal(SIGTERM, &destroy);
+  pause();
 
-       return 0;
+  return 0;
 }
index c396c0416df052a9906a1db2cab207b613b6c70a..789f5adeac0ad8ee6e3f07100b61feff3f14e768 100644 (file)
 
 typedef struct motion_speed_type motion_speed;
 struct motion_speed_type {
-       CORBA_short left;
-       CORBA_short right;
+  CORBA_short left;
+  CORBA_short right;
 };
 
 struct robottype_orte_data {
-       ORTEDomain *orte_domain;
-       int strength;
+  ORTEDomain *orte_domain;
+  int strength;
 
-       struct motion_speed_type motion_speed;
-       ORTEPublication *publication_motion_speed;
+  struct motion_speed_type motion_speed;
+  ORTEPublication *publication_motion_speed;
 };
 
 struct robottype_orte_data orte;
 ORTESubscription *s;
 
-int robottype_roboorte_init(struct robottype_orte_data *data) {
-       int rv = 0;
-       ORTEDomainProp prop;
-       ORTEInit();
-
-       if (data->strength < 0)
-               data->strength = 1;
-
-       ORTEVerbositySetOptions("ALL.0");
-       ORTEDomainPropDefaultGet(&prop);
-       NTPTIME_BUILD(prop.baseProp.refreshPeriod, 3);
-       NTPTIME_BUILD(prop.baseProp.expirationTime, 10);
-       data->orte_domain = ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN, &prop, NULL, ORTE_FALSE);
-       if (!data->orte_domain) {
-               printf("ORTEDomainAppCreate failed!\n");
-               rv = -1;
-       }
-
-       return rv;
+int
+robottype_roboorte_init(struct robottype_orte_data *data)
+{
+  int rv = 0;
+  ORTEDomainProp prop;
+
+  ORTEInit();
+
+  if (data->strength < 0)
+    data->strength = 1;
+
+  ORTEVerbositySetOptions("ALL.0");
+  ORTEDomainPropDefaultGet(&prop);
+  NTPTIME_BUILD(prop.baseProp.refreshPeriod, 3);
+  NTPTIME_BUILD(prop.baseProp.expirationTime, 10);
+  data->orte_domain = ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN, &prop, NULL, ORTE_FALSE);
+  if (!data->orte_domain) {
+    printf("ORTEDomainAppCreate failed!\n");
+    rv = -1;
+  }
+
+  return rv;
 }
 
-void motion_speed_serialize(CDR_Codec *cdrCodec, motion_speed *object) {
-       CORBA_short_serialize(cdrCodec,&(object->left));
+void
+motion_speed_serialize(CDR_Codec *cdrCodec, motion_speed *object)
+{
+  CORBA_short_serialize(cdrCodec, &(object->left));
 
-       CORBA_short_serialize(cdrCodec,&(object->right));
+  CORBA_short_serialize(cdrCodec, &(object->right));
 
 }
 
-void motion_speed_deserialize(CDR_Codec *cdrCodec, motion_speed *object) {
-       CORBA_short_deserialize(cdrCodec,&(object->left));
+void
+motion_speed_deserialize(CDR_Codec *cdrCodec, motion_speed *object)
+{
+  CORBA_short_deserialize(cdrCodec, &(object->left));
 
-       CORBA_short_deserialize(cdrCodec,&(object->right));
+  CORBA_short_deserialize(cdrCodec, &(object->right));
 
 }
 
-int motion_speed_get_max_size(ORTEGetMaxSizeParam *gms, int num) {
-       int loop_lim=2;
-       int csize_save;
-       while(num) {
-               if (!loop_lim--) {
-                       gms->csize+=num*(gms->csize-csize_save);
-                       return gms->csize;
-               }
-               num--;
-               csize_save=gms->csize;
-               CORBA_short_get_max_size(gms, 1);
-               CORBA_short_get_max_size(gms, 1);
-       }
-       return gms->csize;
+int
+motion_speed_get_max_size(ORTEGetMaxSizeParam *gms, int num)
+{
+  int loop_lim = 2;
+  int csize_save;
+
+  while (num) {
+    if (!loop_lim--) {
+      gms->csize += num*(gms->csize-csize_save);
+      return gms->csize;
+    }
+    num--;
+    csize_save = gms->csize;
+    CORBA_short_get_max_size(gms, 1);
+    CORBA_short_get_max_size(gms, 1);
+  }
+  return gms->csize;
 }
 
 Boolean
-motion_speed_type_register(ORTEDomain *d) {
-       Boolean ret;
-
-       ret=ORTETypeRegisterAdd(d,
-                               "motion_speed",
-                               (ORTETypeSerialize)motion_speed_serialize,
-                               (ORTETypeDeserialize)motion_speed_deserialize,
-                               motion_speed_get_max_size,
-                               0);
+motion_speed_type_register(ORTEDomain *d)
+{
+  Boolean ret;
+
+  ret = ORTETypeRegisterAdd(d,
+                           "motion_speed",
+                           (ORTETypeSerialize)motion_speed_serialize,
+                           (ORTETypeDeserialize)motion_speed_deserialize,
+                           motion_speed_get_max_size,
+                           0);
 }
 
-void robottype_subscriber_motion_speed_create(struct robottype_orte_data *data, ORTERecvCallBack callback, void *arg) {
-       NtpTime deadline, minimumSeparation;
+void
+robottype_subscriber_motion_speed_create(struct robottype_orte_data *data, ORTERecvCallBack callback, void *arg)
+{
+  NtpTime deadline, minimumSeparation;
 
-       motion_speed_type_register(data->orte_domain);
+  motion_speed_type_register(data->orte_domain);
 
-       NtpTimeAssembFromMs(deadline, 0, 300);
-       NtpTimeAssembFromMs(minimumSeparation, 0, 0);
-       s = ORTESubscriptionCreate(
-                       data->orte_domain, IMMEDIATE, BEST_EFFORTS,
-                       "motion_speed", "motion_speed",
-                       &data->motion_speed, &deadline, &minimumSeparation,
-                       callback, arg, IPADDRESS_INVALID);
+  NtpTimeAssembFromMs(deadline, 0, 300);
+  NtpTimeAssembFromMs(minimumSeparation, 0, 0);
+  s = ORTESubscriptionCreate(
+    data->orte_domain, IMMEDIATE, BEST_EFFORTS,
+    "motion_speed", "motion_speed",
+    &data->motion_speed, &deadline, &minimumSeparation,
+    callback, arg, IPADDRESS_INVALID);
 }
 
-void rcv_motion_speed_cb(const ORTERecvInfo *info, void *vinstance,
-                       void *recvCallBackParam)
+void
+rcv_motion_speed_cb(const ORTERecvInfo *info, void *vinstance,
+                   void *recvCallBackParam)
 {
-       struct motion_speed_type *m = (struct motion_speed_type *)vinstance;
-
-       switch (info->status) {
-               case NEW_DATA:
-                       printf("Prijata data: left: %d, right: %d\n", m->left, m->right);
-                       break;
-               case DEADLINE:
-                       printf("ORTE deadline occurred - motion_speed receive\n");
-                       break;
-       }
+  struct motion_speed_type *m = (struct motion_speed_type *)vinstance;
+
+  switch (info->status) {
+    case NEW_DATA:
+      printf("Prijata data: left: %d, right: %d\n", m->left, m->right);
+      break;
+    case DEADLINE:
+      printf("ORTE deadline occurred - motion_speed receive\n");
+      break;
+  }
 }
 
-void destroy(int sig) {
-       ORTESubscriptionDestroy(s);
-       ORTETypeRegisterDestroyAll(orte.orte_domain);
-       ORTEDomainAppDestroy(orte.orte_domain);
+void
+destroy(int sig)
+{
+  ORTESubscriptionDestroy(s);
+  ORTETypeRegisterDestroyAll(orte.orte_domain);
+  ORTEDomainAppDestroy(orte.orte_domain);
 }
 
-int main(void) {
-       orte.strength = 30;
-       robottype_roboorte_init(&orte);
-       robottype_subscriber_motion_speed_create(&orte, rcv_motion_speed_cb, &orte);
+int
+main(void)
+{
+  orte.strength = 30;
+  robottype_roboorte_init(&orte);
+  robottype_subscriber_motion_speed_create(&orte, rcv_motion_speed_cb, &orte);
 
-       signal(SIGINT, &destroy);
-       signal(SIGTERM, &destroy);
-       pause();
+  signal(SIGINT, &destroy);
+  signal(SIGTERM, &destroy);
+  pause();
 
-       return 0;
+  return 0;
 }
index 1f5b249de0a0fcd287784dfcb50b5bd06728f2f8..6329d4805a7bc1cadba68b0759f645b8e064f35f 100644 (file)
 extern "C" {
 #endif
 
-void bad_rtems_status(rtems_status_code status, int fail_level, const char *text);
+void
+bad_rtems_status(rtems_status_code status, int fail_level, const char *text);
 
 static inline
-void check_rtems_status(rtems_status_code status, int fail_level, const char *text)
+void
+check_rtems_status(rtems_status_code status, int fail_level, const char *text)
 {
-   if(!rtems_is_status_successful(status))
-     bad_rtems_status(status, fail_level, text);
+  if (!rtems_is_status_successful(status))
+    bad_rtems_status(status, fail_level, text);
 }
 
 #define TASK_1_PRIORITY     30
index 37293b40002f2f478ff14e482037cb5f598ee843..907aa6af237236693711b43ab0832de2d4ebe8f0 100644 (file)
 
 #include <rtems/shellconfig.h>
 
-#define BUILD_VERSION_STRING(major,minor,patch) \
-        __XSTRING(major) "." __XSTRING(minor) "." __XSTRING(patch)
+#define BUILD_VERSION_STRING(major, minor, patch) \
+  __XSTRING(major) "." __XSTRING(minor) "." __XSTRING(patch)
 
 #ifndef VER_CODE
-  #define VER_CODE(major,minor,patch) (major*0x10000+minor*0x100+patch)
+  #define VER_CODE(major, minor, patch) (major*0x10000+minor*0x100+patch)
 #endif
 
-#define RTEMS_VER_CODE VER_CODE(__RTEMS_MAJOR__ ,__RTEMS_MINOR__ ,__RTEMS_REVISION__)
+#define RTEMS_VER_CODE VER_CODE(__RTEMS_MAJOR__, __RTEMS_MINOR__, __RTEMS_REVISION__)
 
-#if RTEMS_VER_CODE < VER_CODE(4,10,99)
+#if RTEMS_VER_CODE < VER_CODE(4, 10, 99)
   #ifndef RTEMS_USE_LOOPBACK
     #define RTEMS_USE_LOOPBACK 1
   #endif
 
 #include "networkconfig.h"
 
-#if RTEMS_VER_CODE < VER_CODE(4,7,99)
+#if RTEMS_VER_CODE < VER_CODE(4, 7, 99)
   #define rtems_shell_add_cmd shell_add_cmd
-  #define rtems_shell_init(m_task_name,m_task_stacksize,m_task_priority,m_devname,m_forever,m_wait,m_login_check) \
-                shell_init(m_task_name,m_task_stacksize,m_task_priority,m_devname,B19200 | CS8,m_forever)
-#elif RTEMS_VER_CODE < VER_CODE(4,9,99)
-  #define rtems_shell_init(m_task_name,m_task_stacksize,m_task_priority,m_devname,m_forever,m_wait,m_login_check) \
-          rtems_shell_init(m_task_name,m_task_stacksize,m_task_priority,m_devname,m_forever,m_wait)
+  #define rtems_shell_init(m_task_name, m_task_stacksize, m_task_priority, m_devname, m_forever, m_wait, m_login_check)        \
+  shell_init(m_task_name, m_task_stacksize, m_task_priority, m_devname, B19200 | CS8, m_forever)
+#elif RTEMS_VER_CODE < VER_CODE(4, 9, 99)
+  #define rtems_shell_init(m_task_name, m_task_stacksize, m_task_priority, m_devname, m_forever, m_wait, m_login_check)        \
+  rtems_shell_init(m_task_name, m_task_stacksize, m_task_priority, m_devname, m_forever, m_wait)
 #endif
 
 void
 bad_rtems_status(rtems_status_code status, int fail_level, const char *text)
 {
   printf("ERROR: %s status %s", text, rtems_status_text(status));
-  status = rtems_task_delete( RTEMS_SELF );
+  status = rtems_task_delete(RTEMS_SELF);
 }
 
-int testcmd_forshell(int argc, char **argv)
+int
+testcmd_forshell(int argc, char **argv)
 {
   int i;
-  printf("Command %s called\n",argv[0]);
-  for(i=1;i<argc;i++)
-    if(argv[i])
-      printf("%s",argv[i]);
+
+  printf("Command %s called\n", argv[0]);
+  for (i = 1; i < argc; i++)
+    if (argv[i])
+      printf("%s", argv[i]);
   printf("\n");
   return 0;
 }
 
-rtems_task Init(
+rtems_task
+Init(
   rtems_task_argument ignored
-)
+  )
 {
   rtems_status_code status;
 
-  printf( "\n\nRTEMS v "
-          BUILD_VERSION_STRING(__RTEMS_MAJOR__ ,__RTEMS_MINOR__ ,__RTEMS_REVISION__)
-         "\n");
+  printf("\n\nRTEMS v "
+        BUILD_VERSION_STRING(__RTEMS_MAJOR__, __RTEMS_MINOR__, __RTEMS_REVISION__)
+        "\n");
 
   rtems_monitor_init(RTEMS_MONITOR_SUSPEND|RTEMS_MONITOR_GLOBAL);
   /*rtems_capture_cli_init (0);*/
 
   if (rtems_bsdnet_initialize_network() < 0)
-    printf( "Network initialization failed\n");
+    printf("Network initialization failed\n");
   else
-    printf( "Network initialization OK\n");
+    printf("Network initialization OK\n");
 
 
-  printf( "Starting shell with ORTE commands included\n" );
+  printf("Starting shell with ORTE commands included\n");
 
-  rtems_shell_init("SHLL",RTEMS_MINIMUM_STACK_SIZE+0x1000,
-              SHELL_TASK_PRIORITY,"/dev/console",1,0, NULL);
+  rtems_shell_init("SHLL", RTEMS_MINIMUM_STACK_SIZE+0x1000,
+                  SHELL_TASK_PRIORITY, "/dev/console", 1, 0, NULL);
 
   rtems_shell_add_cmd("testcmd", "app",
-                "test command for shell",
-                testcmd_forshell);
+                     "test command for shell",
+                     testcmd_forshell);
 
  #ifdef CONFIG_OC_ETH_ORTE_MANAGER
   rtems_shell_add_cmd("ortemanager", "orte",
-                "start orte manager",
-                ortemanager_main);
+                     "start orte manager",
+                     ortemanager_main);
  #endif /*CONFIG_OC_ETH_ORTE_MANAGER*/
 
  #ifdef CONFIG_OC_ETH_ORTE_EXAMPLES
   rtems_shell_add_cmd("orte_h_publisher", "orte",
-                "start orte_h_publisher",
-                orte_h_publisher_main);
+                     "start orte_h_publisher",
+                     orte_h_publisher_main);
 
   rtems_shell_add_cmd("orte_h_subscriber", "orte",
-                "start orte_h_subscriber",
-                orte_h_subscriber_main);
+                     "start orte_h_subscriber",
+                     orte_h_subscriber_main);
 
   rtems_shell_add_cmd("orte_m_subscriber", "orte",
-                "start orte_m_subscriber",
-                orte_m_subscriber_main);
+                     "start orte_m_subscriber",
+                     orte_m_subscriber_main);
 
   rtems_shell_add_cmd("orteping", "orte",
-                "start orteping",
-                orte_ping_main);
+                     "start orteping",
+                     orte_ping_main);
 
   rtems_shell_add_cmd("orte_spy", "orte",
-                "start orte_spy",
-                orte_spy_main);
+                     "start orte_spy",
+                     orte_spy_main);
 
   rtems_shell_add_cmd("orte_r_publisher", "orte",
-                "start orte_r_publisher",
-                orte_r_publisher_main);
+                     "start orte_r_publisher",
+                     orte_r_publisher_main);
 
   rtems_shell_add_cmd("orte_r_subscriber_besteffort", "orte",
-                "start orte_r_subscriber_besteffort",
-                orte_r_subscriber_besteffort_main);
+                     "start orte_r_subscriber_besteffort",
+                     orte_r_subscriber_besteffort_main);
 
   rtems_shell_add_cmd("orte_r_subscriber_reliable", "orte",
-                "start orte_r_subscriber_reliable",
-                orte_r_subscriber_reliable_main);
+                     "start orte_r_subscriber_reliable",
+                     orte_r_subscriber_reliable_main);
  #endif /*CONFIG_OC_ETH_ORTE_EXAMPLES*/
 
   rtems_shell_add_cmd("spawn", "orte",
-                "spawn task or command in background",
-                orte_spawn_main);
+                     "spawn task or command in background",
+                     orte_spawn_main);
 
   //rtems_monitor_wakeup();
 
-  status = rtems_task_delete( RTEMS_SELF );
+  status = rtems_task_delete(RTEMS_SELF);
 
-  printf( "*** END OF TEST2 ***\n" );
-  exit( 0 );
+  printf("*** END OF TEST2 ***\n");
+  exit(0);
 }
index 3b23a6aa884a9cbeebfc6c29f871aeb00a881eb1..fd9a5640d67de6d6dc15fd9a58be68fdde8750eb 100644 (file)
@@ -7,65 +7,65 @@
 
 #ifdef RTEMS_USE_LOOPBACK
 
-int rtems_bsdnet_loopattach(struct rtems_bsdnet_ifconfig *, int);
+int
+rtems_bsdnet_loopattach(struct rtems_bsdnet_ifconfig *, int);
 
 #ifdef RTEMS_USE_LOOPBACK_ONLY
 static struct rtems_bsdnet_ifconfig netdriver_config = {
 #else
 static struct rtems_bsdnet_ifconfig loopback_config = {
 #endif
-       .name = "lo0",
-       .attach = rtems_bsdnet_loopattach,
-       .next = NULL,
-       .ip_address = "127.0.0.1",
-       .ip_netmask = "255.0.0.0",
+  .name = "lo0",
+  .attach = rtems_bsdnet_loopattach,
+  .next = NULL,
+  .ip_address = "127.0.0.1",
+  .ip_netmask = "255.0.0.0",
 };
 
 #endif /*RTEMS_USE_LOOPBACK*/
 
 #ifndef RTEMS_USE_LOOPBACK_ONLY
 static struct rtems_bsdnet_ifconfig netdriver_config = {
-       .name = BSP_NE2000_NETWORK_DRIVER_NAME,
-       .attach = BSP_NE2000_NETWORK_DRIVER_ATTACH,
+  .name = BSP_NE2000_NETWORK_DRIVER_NAME,
+  .attach = BSP_NE2000_NETWORK_DRIVER_ATTACH,
 #ifdef RTEMS_USE_LOOPBACK
-       .next = &loopback_config,
+  .next = &loopback_config,
 #else /*RTEMS_USE_LOOPBACK*/
-       .next = NULL,
+  .next = NULL,
 #endif /*RTEMS_USE_LOOPBACK*/
-       .ip_address = "192.168.3.66",
-       .ip_netmask = "255.255.255.0",
-       .hardware_address = NULL,
-       .ignore_broadcast = 0,
-       .mtu = 0,
-       .rbuf_count = 0,
-       .xbuf_count = 0,
-       .port = 0x300,
-       .irno = 9,
-       .bpar = 0,
-       .drv_ctrl = NULL
+  .ip_address = "192.168.3.66",
+  .ip_netmask = "255.255.255.0",
+  .hardware_address = NULL,
+  .ignore_broadcast = 0,
+  .mtu = 0,
+  .rbuf_count = 0,
+  .xbuf_count = 0,
+  .port = 0x300,
+  .irno = 9,
+  .bpar = 0,
+  .drv_ctrl = NULL
 };
 #endif /*RTEMS_USE_LOOPBACK_ONLY*/
 
 struct rtems_bsdnet_config rtems_bsdnet_config = {
-       .ifconfig = &netdriver_config,
+  .ifconfig = &netdriver_config,
 /*     .bootp = rtems_bsdnet_do_bootp,*/
 /*     .bootp = rtems_bsdnet_do_dhcp,*/
-       .bootp = rtems_bsdnet_do_dhcp_failsafe,
-       .network_task_priority = 0,             /* 100        */
-       .mbuf_bytecount = 256 * 1024,           /* 64 kbytes  */
-       .mbuf_cluster_bytecount = 256 * 1024,   /* 128 kbytes */
-       .hostname = NULL,
-       .domainname = NULL,
-       .gateway = "192.168.3.1",
-       .log_host = NULL,
-       .name_server = { "NULL" },
-       .ntp_server = { "NULL" },
-       .sb_efficiency = 0,
-       .udp_tx_buf_size = 0,                   /* UDP TX: 9216 bytes */
-       .udp_rx_buf_size = 0,                   /* UDP RX: 40 * (1024 + sizeof(struct sockaddr_in)) */
-       .tcp_tx_buf_size = 0,                   /* TCP TX: 16 * 1024 bytes */
-       .tcp_rx_buf_size = 0,                   /* TCP TX: 16 * 1024 bytes */
+  .bootp = rtems_bsdnet_do_dhcp_failsafe,
+  .network_task_priority = 0,                   /* 100        */
+  .mbuf_bytecount = 256 * 1024,                 /* 64 kbytes  */
+  .mbuf_cluster_bytecount = 256 * 1024,         /* 128 kbytes */
+  .hostname = NULL,
+  .domainname = NULL,
+  .gateway = "192.168.3.1",
+  .log_host = NULL,
+  .name_server = { "NULL" },
+  .ntp_server = { "NULL" },
+  .sb_efficiency = 0,
+  .udp_tx_buf_size = 0,                         /* UDP TX: 9216 bytes */
+  .udp_rx_buf_size = 0,                         /* UDP RX: 40 * (1024 + sizeof(struct sockaddr_in)) */
+  .tcp_tx_buf_size = 0,                         /* TCP TX: 16 * 1024 bytes */
+  .tcp_rx_buf_size = 0,                         /* TCP TX: 16 * 1024 bytes */
 };
 
-#endif
-
+#endif /* ifndef __NETWORKCONFIG_H__ */
index a5ba84ec6fd3a0bde08b39560d0abbf6e11f132e..844be299496dcc6d47090468f3e0593462d8078b 100644 (file)
@@ -8,63 +8,63 @@ static char ethernet_address[6] = {0x00, 0x04, 0x9F, 0x00, 0x27, 0x50 };
 
 #ifdef RTEMS_USE_LOOPBACK
 
-int rtems_bsdnet_loopattach(struct rtems_bsdnet_ifconfig *, int);
+int
+rtems_bsdnet_loopattach(struct rtems_bsdnet_ifconfig *, int);
 
 #ifdef RTEMS_USE_LOOPBACK_ONLY
 static struct rtems_bsdnet_ifconfig netdriver_config = {
 #else
 static struct rtems_bsdnet_ifconfig loopback_config = {
 #endif
-       .name = "lo0",
-       .attach = rtems_bsdnet_loopattach,
-       .next = NULL,
-       .ip_address = "127.0.0.1",
-       .ip_netmask = "255.0.0.0",
+  .name = "lo0",
+  .attach = rtems_bsdnet_loopattach,
+  .next = NULL,
+  .ip_address = "127.0.0.1",
+  .ip_netmask = "255.0.0.0",
 };
 
 #endif /*RTEMS_USE_LOOPBACK*/
 
 #ifndef RTEMS_USE_LOOPBACK_ONLY
 static struct rtems_bsdnet_ifconfig netdriver_config = {
-       .name = RTEMS_BSP_NETWORK_DRIVER_NAME,
-       .attach = RTEMS_BSP_NETWORK_DRIVER_ATTACH,
+  .name = RTEMS_BSP_NETWORK_DRIVER_NAME,
+  .attach = RTEMS_BSP_NETWORK_DRIVER_ATTACH,
 #ifdef RTEMS_USE_LOOPBACK
-       .next = &loopback_config,
+  .next = &loopback_config,
 #else /*RTEMS_USE_LOOPBACK*/
-       .next = NULL,
+  .next = NULL,
 #endif /*RTEMS_USE_LOOPBACK*/
-       .ip_address = "192.168.2.3",
-       .ip_netmask = "255.255.255.0",
-       .hardware_address = ethernet_address,
-       .ignore_broadcast = 0,
-       .mtu = 0,
-       .rbuf_count = 0,
-       .xbuf_count = 0,
-       .port = 0,
-       .irno = 0,
-       .bpar = 0,
-       .drv_ctrl = NULL
+  .ip_address = "192.168.2.3",
+  .ip_netmask = "255.255.255.0",
+  .hardware_address = ethernet_address,
+  .ignore_broadcast = 0,
+  .mtu = 0,
+  .rbuf_count = 0,
+  .xbuf_count = 0,
+  .port = 0,
+  .irno = 0,
+  .bpar = 0,
+  .drv_ctrl = NULL
 };
 #endif /*RTEMS_USE_LOOPBACK_ONLY*/
 
 struct rtems_bsdnet_config rtems_bsdnet_config = {
-       .ifconfig = &netdriver_config,
-       .bootp = NULL,
-       .network_task_priority = 0,             /* 100        */
-       .mbuf_bytecount = 256 * 1024,           /* 64 kbytes  */
-       .mbuf_cluster_bytecount = 256 * 1024,   /* 128 kbytes */
-       .hostname = NULL,
-       .domainname = NULL,
-       .gateway = NULL,
-       .log_host = NULL,
-       .name_server = { "NULL" },
-       .ntp_server = { "NULL" },
-       .sb_efficiency = 0,
-       .udp_tx_buf_size = 0,                   /* UDP TX: 9216 bytes */
-       .udp_rx_buf_size = 0,                   /* UDP RX: 40 * (1024 + sizeof(struct sockaddr_in)) */
-       .tcp_tx_buf_size = 0,                   /* TCP TX: 16 * 1024 bytes */
-       .tcp_rx_buf_size = 0,                   /* TCP TX: 16 * 1024 bytes */
+  .ifconfig = &netdriver_config,
+  .bootp = NULL,
+  .network_task_priority = 0,                   /* 100        */
+  .mbuf_bytecount = 256 * 1024,                 /* 64 kbytes  */
+  .mbuf_cluster_bytecount = 256 * 1024,         /* 128 kbytes */
+  .hostname = NULL,
+  .domainname = NULL,
+  .gateway = NULL,
+  .log_host = NULL,
+  .name_server = { "NULL" },
+  .ntp_server = { "NULL" },
+  .sb_efficiency = 0,
+  .udp_tx_buf_size = 0,                         /* UDP TX: 9216 bytes */
+  .udp_rx_buf_size = 0,                         /* UDP RX: 40 * (1024 + sizeof(struct sockaddr_in)) */
+  .tcp_tx_buf_size = 0,                         /* TCP TX: 16 * 1024 bytes */
+  .tcp_rx_buf_size = 0,                         /* TCP TX: 16 * 1024 bytes */
 };
 
-#endif
-
+#endif /* ifndef __NETWORKCONFIG_H__ */
index 7c3dccfa91ffe9666e474ca0b895b6599b384edf..cff978b4de38146daeb517e39e760feb249ca3f4 100644 (file)
@@ -9,65 +9,65 @@ static char ethernet_address[6] = {0x00, 0x04, 0x9F, 0x00, 0x27, 0x50 };
 
 #ifdef RTEMS_USE_LOOPBACK
 
-int rtems_bsdnet_loopattach(struct rtems_bsdnet_ifconfig *, int);
+int
+rtems_bsdnet_loopattach(struct rtems_bsdnet_ifconfig *, int);
 
 #ifdef RTEMS_USE_LOOPBACK_ONLY
 static struct rtems_bsdnet_ifconfig netdriver_config = {
 #else
 static struct rtems_bsdnet_ifconfig loopback_config = {
 #endif
-       .name = "lo0",
-       .attach = rtems_bsdnet_loopattach,
-       .next = NULL,
-       .ip_address = "127.0.0.1",
-       .ip_netmask = "255.0.0.0",
+  .name = "lo0",
+  .attach = rtems_bsdnet_loopattach,
+  .next = NULL,
+  .ip_address = "127.0.0.1",
+  .ip_netmask = "255.0.0.0",
 };
 
 #endif /*RTEMS_USE_LOOPBACK*/
 
 #ifndef RTEMS_USE_LOOPBACK_ONLY
 static struct rtems_bsdnet_ifconfig netdriver_config = {
-       .name = RTEMS_BSP_NETWORK_DRIVER_NAME,
-       .attach = RTEMS_BSP_NETWORK_DRIVER_ATTACH,
+  .name = RTEMS_BSP_NETWORK_DRIVER_NAME,
+  .attach = RTEMS_BSP_NETWORK_DRIVER_ATTACH,
 #ifdef RTEMS_USE_LOOPBACK
-       .next = &loopback_config,
+  .next = &loopback_config,
 #else /*RTEMS_USE_LOOPBACK*/
-       .next = NULL,
+  .next = NULL,
 #endif /*RTEMS_USE_LOOPBACK*/
-       .ip_address = "192.168.3.66",
-       .ip_netmask = "255.255.255.0",
-       .hardware_address = ethernet_address,
-       .ignore_broadcast = 0,
-       .mtu = 0,
-       .rbuf_count = 0,
-       .xbuf_count = 0,
-       .port = 0,
-       .irno = 0,
-       .bpar = 0,
-       .drv_ctrl = NULL
+  .ip_address = "192.168.3.66",
+  .ip_netmask = "255.255.255.0",
+  .hardware_address = ethernet_address,
+  .ignore_broadcast = 0,
+  .mtu = 0,
+  .rbuf_count = 0,
+  .xbuf_count = 0,
+  .port = 0,
+  .irno = 0,
+  .bpar = 0,
+  .drv_ctrl = NULL
 };
 #endif /*RTEMS_USE_LOOPBACK_ONLY*/
 
 struct rtems_bsdnet_config rtems_bsdnet_config = {
-       .ifconfig = &netdriver_config,
+  .ifconfig = &netdriver_config,
 /*     .bootp = rtems_bsdnet_do_bootp,*/
 /*     .bootp = rtems_bsdnet_do_dhcp,*/
-       .bootp = rtems_bsdnet_do_dhcp_failsafe,
-       .network_task_priority = 0,             /* 100        */
-       .mbuf_bytecount = 256 * 1024,           /* 64 kbytes  */
-       .mbuf_cluster_bytecount = 256 * 1024,   /* 128 kbytes */
-       .hostname = NULL,
-       .domainname = NULL,
-       .gateway = "192.168.3.1",
-       .log_host = NULL,
-       .name_server = { "NULL" },
-       .ntp_server = { "NULL" },
-       .sb_efficiency = 0,
-       .udp_tx_buf_size = 0,                   /* UDP TX: 9216 bytes */
-       .udp_rx_buf_size = 0,                   /* UDP RX: 40 * (1024 + sizeof(struct sockaddr_in)) */
-       .tcp_tx_buf_size = 0,                   /* TCP TX: 16 * 1024 bytes */
-       .tcp_rx_buf_size = 0,                   /* TCP TX: 16 * 1024 bytes */
+  .bootp = rtems_bsdnet_do_dhcp_failsafe,
+  .network_task_priority = 0,                   /* 100        */
+  .mbuf_bytecount = 256 * 1024,                 /* 64 kbytes  */
+  .mbuf_cluster_bytecount = 256 * 1024,         /* 128 kbytes */
+  .hostname = NULL,
+  .domainname = NULL,
+  .gateway = "192.168.3.1",
+  .log_host = NULL,
+  .name_server = { "NULL" },
+  .ntp_server = { "NULL" },
+  .sb_efficiency = 0,
+  .udp_tx_buf_size = 0,                         /* UDP TX: 9216 bytes */
+  .udp_rx_buf_size = 0,                         /* UDP RX: 40 * (1024 + sizeof(struct sockaddr_in)) */
+  .tcp_tx_buf_size = 0,                         /* TCP TX: 16 * 1024 bytes */
+  .tcp_rx_buf_size = 0,                         /* TCP TX: 16 * 1024 bytes */
 };
 
-#endif
-
+#endif /* ifndef __NETWORKCONFIG_H__ */
index f97be56295d2edb4870412b4c575699b95320992..bbbbf1dec0d7754208e74439dbb8c23b773ce96d 100644 (file)
@@ -16,11 +16,12 @@ typedef struct orte_spawn_args {
   char *argv[];
 } orte_spawn_args_t;
 
-void *orte_spawn_task_func(void *arg_pack)
+void *
+orte_spawn_task_func(void *arg_pack)
 {
-  rtems_shell_cmd_tshell_cmd;
+  rtems_shell_cmd_t *shell_cmd;
   int                errorlevel = 0;
-  orte_spawn_args_t  *spawn_args = (orte_spawn_args_t*)arg_pack;
+  orte_spawn_args_t  *spawn_args = (orte_spawn_args_t *)arg_pack;
   int                argc = spawn_args->argc;
   char               **argv = &(spawn_args->argv[0]);
 
@@ -29,9 +30,9 @@ void *orte_spawn_task_func(void *arg_pack)
 
   if (argc) {
     shell_cmd = rtems_shell_lookup_cmd(argv[0]);
-    if ( argv[1] == NULL ) {
+    if (argv[1] == NULL) {
       errorlevel = -1;
-    } else if ( shell_cmd == NULL ) {
+    } else if (shell_cmd == NULL) {
       errorlevel = rtems_shell_script_file(argc, &argv[0]);
     } else {
       errorlevel = shell_cmd->command(argc, &argv[0]);
@@ -39,10 +40,11 @@ void *orte_spawn_task_func(void *arg_pack)
   }
 
   free(arg_pack);
-  return (void*)errorlevel;
+  return (void *)errorlevel;
 }
 
-int orte_spawn_main(int argc, char **argv)
+int
+orte_spawn_main(int argc, char **argv)
 {
   orte_spawn_args_t  *spawn_args;
   int       sparg_size;
@@ -55,25 +57,25 @@ int orte_spawn_main(int argc, char **argv)
   argv++;
   argc--;
 
-  sparg_str_offs = sizeof(orte_spawn_args_t) + (argc + 1) *sizeof(char*);
+  sparg_str_offs = sizeof(orte_spawn_args_t) + (argc + 1) *sizeof(char *);
   sparg_size = sparg_str_offs;
 
   for (i = 0; i < argc; i++)
-     sparg_size += strlen(argv[i]) + 1;
+    sparg_size += strlen(argv[i]) + 1;
 
   spawn_args = malloc(sparg_size);
   if (spawn_args == NULL)
-     return 1;
+    return 1;
 
   spawn_args->argc = argc;
 
-  p = (char*)spawn_args + sparg_str_offs;
+  p = (char *)spawn_args + sparg_str_offs;
   for (i = 0; i < argc; i++) {
-     int len = strlen(argv[i]);
-     spawn_args->argv[i] = p;
-     memcpy(p, argv[i], len);
-     p += len;
-     *(p++) = 0;
+    int len = strlen(argv[i]);
+    spawn_args->argv[i] = p;
+    memcpy(p, argv[i], len);
+    p += len;
+    *(p++) = 0;
   }
   spawn_args->argv[argc] = NULL;
 
@@ -81,5 +83,5 @@ int orte_spawn_main(int argc, char **argv)
   if (status == 0)
     pthread_detach(task_id);
 
-  return status?1:0;
+  return status ? 1 : 0;
 }
index a09da8c81982a56014ef7e336f49aaebb3666c4e..b255548ae1056e22787754ebc6db6f6aab58e1e7 100644 (file)
@@ -1,17 +1,27 @@
 #ifndef ORTE_RTEMS_SHELL_H
 #define ORTE_RTEMS_SHELL_H
 
-int ortemanager_main(int argc, char **argv);
+int
+ortemanager_main(int argc, char **argv);
 
-int orte_h_publisher_main(int argc, char **argv);
-int orte_h_subscriber_main(int argc, char **argv);
-int orte_m_subscriber_main(int argc, char **argv);
-int orte_ping_main(int argc, char **argv);
-int orte_spy_main(int argc, char **argv);
-int orte_r_publisher_main(int argc, char **argv);
-int orte_r_subscriber_besteffort_main(int argc, char **argv);
-int orte_r_subscriber_reliable_main(int argc, char **argv);
+int
+orte_h_publisher_main(int argc, char **argv);
+int
+orte_h_subscriber_main(int argc, char **argv);
+int
+orte_m_subscriber_main(int argc, char **argv);
+int
+orte_ping_main(int argc, char **argv);
+int
+orte_spy_main(int argc, char **argv);
+int
+orte_r_publisher_main(int argc, char **argv);
+int
+orte_r_subscriber_besteffort_main(int argc, char **argv);
+int
+orte_r_subscriber_reliable_main(int argc, char **argv);
 
-int orte_spawn_main(int argc, char **argv);
+int
+orte_spawn_main(int argc, char **argv);
 
 #endif /*ORTE_RTEMS_SHELL_H*/
index b99dd06b290c94cad494e0746bdd7867a606a40b..7698193b70544756f3924ae1d71683ec24069ee6 100644 (file)
 
 /* functions */
 
-rtems_task Init(
+rtems_task
+Init(
   rtems_task_argument argument
-);
+  );
 
 /* configuration information */
 
@@ -91,9 +92,9 @@ rtems_task Init(
 #define CONFIGURE_INIT_TASK_STACK_SIZE  (10*1024)
 #define CONFIGURE_INIT_TASK_PRIORITY    120
 #define CONFIGURE_INIT_TASK_INITIAL_MODES (RTEMS_PREEMPT | \
-                                           RTEMS_NO_TIMESLICE | \
-                                           RTEMS_NO_ASR | \
-                                           RTEMS_INTERRUPT_LEVEL(0))
+                                          RTEMS_NO_TIMESLICE | \
+                                          RTEMS_NO_ASR | \
+                                          RTEMS_INTERRUPT_LEVEL(0))
 
 #include <rtems/confdefs.h>
 
index 43d6119acb286a5760564b4b21e4470141b89dda..ac560435f321f5efa02d30bde220ebf25bd2cfde 100644 (file)
@@ -3,18 +3,18 @@
  *
  *  DEBUG:  section                     m_subscriber
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
 static ORTEDomain        *d = NULL;
 static char              instance2Recv[64];
 
-int maxDataSize(ORTEGetMaxSizeParam *gms, int num) {
+int
+maxDataSize(ORTEGetMaxSizeParam *gms, int num)
+{
   return gms->max_size;
 }
 
 static void
-recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam) {
-  char *instance=(char*)vinstance;
+recvCallBack(const ORTERecvInfo *info, void *vinstance, void *recvCallBackParam)
+{
+  char *instance = (char *)vinstance;
 
   switch (info->status) {
     case NEW_DATA:
-      printf("%s\n",instance);
+      printf("%s\n", instance);
       break;
     case DEADLINE:
       printf("deadline occurred\n");
@@ -59,27 +62,28 @@ recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam)
 
 
 static void *
-subscriberCreate(void *arg) {
+subscriberCreate(void *arg)
+{
   ORTESubscription    *s;
-  NtpTime             deadline,minimumSeparation;
+  NtpTime             deadline, minimumSeparation;
 
-  ORTETypeRegisterAdd(d,"IDA_OCTETSTRING",NULL,NULL,maxDataSize,sizeof(instance2Recv));
-  NTPTIME_BUILD(deadline,10);
-  NTPTIME_BUILD(minimumSeparation,0);
-  s=ORTESubscriptionCreate(
-       d,
-       IMMEDIATE,
-       BEST_EFFORTS,
-       "IDA_TOPIC0001",
-       "IDA_OCTETSTRING",
-       &instance2Recv,
-       &deadline,
-       &minimumSeparation,
-       recvCallBack,
-       NULL,
+  ORTETypeRegisterAdd(d, "IDA_OCTETSTRING", NULL, NULL, maxDataSize, sizeof(instance2Recv));
+  NTPTIME_BUILD(deadline, 10);
+  NTPTIME_BUILD(minimumSeparation, 0);
+  s = ORTESubscriptionCreate(
+    d,
+    IMMEDIATE,
+    BEST_EFFORTS,
+    "IDA_TOPIC0001",
+    "IDA_OCTETSTRING",
+    &instance2Recv,
+    &deadline,
+    &minimumSeparation,
+    recvCallBack,
+    NULL,
 //       StringToIPAddress("225.0.0.2")
-       IPADDRESS_INVALID
-       );
+    IPADDRESS_INVALID
+    );
   if (s == NULL) {
     printf("ORTESubscriptionCreate failed\n");
   }
@@ -87,15 +91,16 @@ subscriberCreate(void *arg) {
 }
 
 int
-main(int argc, char *args[]) {
+main(int argc, char *args[])
+{
   ORTEDomainProp dp;
-  
+
   ORTEInit();
   ORTEDomainPropDefaultGet(&dp);
 //  dp.multicast.enabled=ORTE_TRUE;
 //  dp.multicast.ipAddress=StringToIPAddress("225.0.0.1");
   ORTEVerbositySetOptions("ALL.5");
-  d=ORTEDomainAppCreate(1,&dp,NULL,ORTE_FALSE);
+  d = ORTEDomainAppCreate(1, &dp, NULL, ORTE_FALSE);
   if (!d) {
     printf("ORTEDomainAppCreate failed!\n");
     return 0;
@@ -105,4 +110,3 @@ main(int argc, char *args[]) {
     ORTESleepMs(1000);
   return 0;
 }
-
index cfcc751aa5bd9d6671bbb2cdd1c022c1de2f1f3e..3d29671ea460e2e9beb197d7eaa1f4a4711ebbd4 100644 (file)
@@ -1,33 +1,33 @@
 /*
- *  $Id: ortespy.c,v 0.0.0.1            2003/10/07 
+ *  $Id: ortespy.c,v 0.0.0.1            2003/10/07
  *
  *  DEBUG:  section                     ortespy
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include <stdio.h>
 #include <stdlib.h>
 #endif
 
 static ORTEDomain              *d;
-static NtpTime                 deadline,minimumSeparation;
+static NtpTime                 deadline, minimumSeparation;
 static int32_t                 instanceRecv;
 
 static void
-recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam) {
+recvCallBack(const ORTERecvInfo *info, void *vinstance, void *recvCallBackParam)
+{
   char lbuff[MAX_STRING_NTPTIME_LENGTH];
   char rbuff[MAX_STRING_NTPTIME_LENGTH];
+
   switch (info->status) {
     case NEW_DATA:
       printf("| %-10s | %-9s | %-9s | %-18s | %-18s |\n",
-             "NEW_DATA",
-             info->topic,
-             info->type,
-             NtpTimeToStringUs(info->localTimeReceived, lbuff),
-             NtpTimeToStringUs(info->remoteTimePublished, rbuff));
+            "NEW_DATA",
+            info->topic,
+            info->type,
+            NtpTimeToStringUs(info->localTimeReceived, lbuff),
+            NtpTimeToStringUs(info->remoteTimePublished, rbuff));
       break;
     case DEADLINE:
 //      printf("deadline occurred\n");
@@ -75,25 +77,29 @@ recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam)
   }
 }
 
-ORTESubscription*
-subscriptionCallBack(const char *topic, const char *type, void *param) {
-  ORTETypeRegisterAdd(d,type,NULL,NULL,NULL,0);   
-  if (strcmp((const char *)topic, (const char*)"Red")==0) return NULL;
+ORTESubscription *
+subscriptionCallBack(const char *topic, const char *type, void *param)
+{
+  ORTETypeRegisterAdd(d, type, NULL, NULL, NULL, 0);
+  if (strcmp((const char *)topic, (const char *)"Red") == 0)
+    return NULL;
   return ORTESubscriptionCreate(
-        d,
-        IMMEDIATE,
-        BEST_EFFORTS,
-        topic,
-        type,
-        &instanceRecv,
-        &deadline,
-        &minimumSeparation,
-        recvCallBack,
-        NULL,
-        IPADDRESS_INVALID);
+          d,
+          IMMEDIATE,
+          BEST_EFFORTS,
+          topic,
+          type,
+          &instanceRecv,
+          &deadline,
+          &minimumSeparation,
+          recvCallBack,
+          NULL,
+          IPADDRESS_INVALID);
 }
 
-static void usage(void) {
+static void
+usage(void)
+{
   printf("usage: ortespy <parameters> \n");
   printf("  -d, --domain <domain>         working manager domain\n");
   printf("  -v, --verbosity <level>       set verbosity level SECTION, up to LEVEL:...\n");
@@ -108,77 +114,77 @@ static void usage(void) {
   printf("  -h, --help                    this usage screen\n");
 }
 
-int main(int argc,char *argv[]) {
+int
+main(int argc, char *argv[])
+{
 #if defined HAVE_GETOPT_LONG || defined HAVE_GETOPT_LONG_ORTE
   static struct option long_opts[] = {
-    { "domain",1,0, 'd' },
-    { "verbosity",1,0, 'v' },
-    { "refresh",1,0, 'R' },
-    { "purge",1,0, 'P' },
-    { "expiration",1,0, 'E' },
-    { "metaMulticast",1,0, 'I' },
-    { "logfile",1,0, 'l' },
-    { "version",0,0, 'V' },
+    { "domain", 1, 0, 'd' },
+    { "verbosity", 1, 0, 'v' },
+    { "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' },
     { 0, 0, 0, 0}
   };
 #endif
-  ORTEDomainProp          dp; 
-  int                     opt,domain=ORTE_DEFAULT_DOMAIN;
-  
+  ORTEDomainProp          dp;
+  int                     opt, domain = ORTE_DEFAULT_DOMAIN;
+
   ORTEInit();
   ORTEDomainPropDefaultGet(&dp);
-  NTPTIME_BUILD(deadline,3); 
-  NTPTIME_BUILD(minimumSeparation,0); 
+  NTPTIME_BUILD(deadline, 3);
+  NTPTIME_BUILD(minimumSeparation, 0);
 
 #if defined HAVE_GETOPT_LONG || defined HAVE_GETOPT_LONG_ORTE
-  while ((opt = getopt_long(argc, argv, "d:v:R:E:I: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:I:P:l:Vh")) != EOF) {
 #endif
     switch (opt) {
       case 'd':
-        domain=strtol(optarg,NULL,0);
-        break;
+       domain = strtol(optarg, NULL, 0);
+       break;
       case 'v':
-        ORTEVerbositySetOptions(optarg);
-        break;
+       ORTEVerbositySetOptions(optarg);
+       break;
       case 'R':
-        NtpTimeAssembFromMs(dp.baseProp.refreshPeriod,strtol(optarg,NULL,0),0);
-        break;
+       NtpTimeAssembFromMs(dp.baseProp.refreshPeriod, strtol(optarg, NULL, 0), 0);
+       break;
       case 'P':
-        NtpTimeAssembFromMs(dp.baseProp.purgeTime,strtol(optarg,NULL,0),0);
-        break;
+       NtpTimeAssembFromMs(dp.baseProp.purgeTime, strtol(optarg, NULL, 0), 0);
+       break;
       case 'E':
-        NtpTimeAssembFromMs(dp.baseProp.expirationTime,strtol(optarg,NULL,0),0);
-        break;
+       NtpTimeAssembFromMs(dp.baseProp.expirationTime, strtol(optarg, NULL, 0), 0);
+       break;
       case 'I':
-        dp.multicast.enabled=ORTE_TRUE;
-        dp.multicast.ipAddress=StringToIPAddress(optarg);
-        break; 
+       dp.multicast.enabled = ORTE_TRUE;
+       dp.multicast.ipAddress = StringToIPAddress(optarg);
+       break;
       case 'l':
-        ORTEVerbositySetLogFile(optarg);
+       ORTEVerbositySetLogFile(optarg);
       case 'V':
-        printf("Open Real-Time Ethernet (%s).\n",dp.version);
-        exit(0);
-        break;
+       printf("Open Real-Time Ethernet (%s).\n", dp.version);
+       exit(0);
+       break;
       case 'h':
       default:
-        usage();
-        exit(opt == 'h' ? 0 : 1);
+       usage();
+       exit(opt == 'h' ? 0 : 1);
     }
   }
-  //Create application     
+  //Create application
   printf("|------------------------------------------------------------------------------|\n");
-  printf("| %-10s | %-9s | %-9s | %-18s | %-18s |\n", 
-         "status", "type","topic","time received", "time sent");
+  printf("| %-10s | %-9s | %-9s | %-18s | %-18s |\n",
+        "status", "type", "topic", "time received", "time sent");
   printf("|------------------------------------------------------------------------------|\n");
-  d=ORTEDomainAppCreate(domain,&dp,NULL,ORTE_TRUE);
-  ORTEDomainAppSubscriptionPatternAdd(d,"*","*",subscriptionCallBack,NULL);
-  ORTEDomainStart(d,ORTE_TRUE,ORTE_FALSE,ORTE_TRUE,ORTE_FALSE,ORTE_TRUE);
-  while (1) {
+  d = ORTEDomainAppCreate(domain, &dp, NULL, ORTE_TRUE);
+  ORTEDomainAppSubscriptionPatternAdd(d, "*", "*", subscriptionCallBack, NULL);
+  ORTEDomainStart(d, ORTE_TRUE, ORTE_FALSE, ORTE_TRUE, ORTE_FALSE, ORTE_TRUE);
+  while (1)
     ORTESleepMs(1000);
-  }
   exit(0);
 }
-
index 75c0c55307756423e55e20abd803c9c7dd60207b..721f2c3dba82ba40f883e8e54d99e8d2e49da6d2 100644 (file)
@@ -1,30 +1,30 @@
 /*
- *  $Id: defines.h,v 0.0.0.1            2003/08/21 
+ *  $Id: defines.h,v 0.0.0.1            2003/08/21
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
+ *
  */
 
 #ifndef _DEFINES_H
@@ -46,16 +46,16 @@ extern "C" {
 #define MAX_DEBUG_SECTIONS          100
 #define MAX_DEBUG_LEVEL             10
 #define debug(SECTION, LEVEL) \
-        ((LEVEL) > MAX_DEBUG_LEVEL) ? (void) 0 : \
-        ((db_level = (LEVEL)) > debugLevels[SECTION]) ? (void) 0 : db_print
+  ((LEVEL) > MAX_DEBUG_LEVEL) ? (void)0 : \
+  ((db_level = (LEVEL)) > debugLevels[SECTION]) ? (void)0 : db_print
 #ifndef ENABLE_MEM_CHECK
   #define MALLOC malloc
   #define FREE   free
 #else
   #define MALLOC mem_check_malloc
   #define FREE   mem_check_free
-#endif        
-        
+#endif
+
 //////////////////////////////////////////////////////////////////////////////
 // fnmatch
 // We #undef these before defining them because some losing systems
@@ -81,7 +81,7 @@ extern "C" {
 #define HASH_INUSE       0x11111111
 #define HASH_DELETED     0xffffffff
 
-#define GUID_PRINTF(g) (g).hid,(g).aid,(g).oid
+#define GUID_PRINTF(g) (g).hid, (g).aid, (g).oid
 
 
 #ifdef __cplusplus
index 9300e395cd3c4f359359054777083c43dd0eaf09..c039dabf72fc9510c4a9738f82c9dd6423b41c6a 100644 (file)
@@ -1,30 +1,30 @@
 /*
- *  $Id: globals.h,v 0.0.0.1            2003/08/21 
+ *  $Id: globals.h,v 0.0.0.1            2003/08/21
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
+ *
  */
 
 #ifndef _GLOBALS_H
@@ -38,7 +38,7 @@ extern "C" {
 extern int db_level;
 extern int debugLevels[MAX_DEBUG_SECTIONS];
 extern int mem_check_counter;
-extern NtpTime zNtpTime,iNtpTime;
+extern NtpTime zNtpTime, iNtpTime;
 extern SequenceNumber noneSN;
 
 #ifdef __cplusplus
index e6360536bca008113e6f13b23e2948a495d62131..6f0781a3d8410fcece68e8410c68b623e124ee4e 100644 (file)
@@ -17,7 +17,7 @@ typedef struct
 #ifdef __ANDROID__
 
 #include <android/log.h>
-#define printf(...)            __android_log_print(ANDROID_LOG_INFO, "ORTE", __VA_ARGS__)
+#define printf(...)             __android_log_print(ANDROID_LOG_INFO, "ORTE", __VA_ARGS__)
 
 #endif
 #endif
index bcd07d3c28e57589901594df9a91ae9bc5aa8cde..a42f0123aa87c85144d1193b317a070e3705ec35 100644 (file)
@@ -25,37 +25,37 @@ extern NtpTime
 getNtpTime(JNIEnv *env, jobject obj);
 
 extern Boolean
-onSubDelete(const struct ORTEAppInfo *appInfo,const struct ORTESubInfo *subInfo,void *param);
+onSubDelete(const struct ORTEAppInfo *appInfo, const struct ORTESubInfo *subInfo, void *param);
 
 extern Boolean
-onSubRemoteChanged(const struct ORTEAppInfo *appInfo,const struct ORTESubInfo *subInfo,void *param);
+onSubRemoteChanged(const struct ORTEAppInfo *appInfo, const struct ORTESubInfo *subInfo, void *param);
 
 extern Boolean
-onSubRemoteNew(const struct ORTEAppInfo *appInfo,const struct ORTESubInfo *subInfo,void *param);
+onSubRemoteNew(const struct ORTEAppInfo *appInfo, const struct ORTESubInfo *subInfo, void *param);
 
 extern Boolean
-onPubDelete(const struct ORTEAppInfo *appInfo,const struct ORTEPubInfo *pubInfo,void *param);
+onPubDelete(const struct ORTEAppInfo *appInfo, const struct ORTEPubInfo *pubInfo, void *param);
 
 extern Boolean
-onPubRemoteChanged(const struct ORTEAppInfo *appInfo,const struct ORTEPubInfo *pubInfo,void *param);
+onPubRemoteChanged(const struct ORTEAppInfo *appInfo, const struct ORTEPubInfo *pubInfo, void *param);
 
 extern Boolean
-onPubRemoteNew(const struct ORTEAppInfo *appInfo,const struct ORTEPubInfo *pubInfo,void *param);
+onPubRemoteNew(const struct ORTEAppInfo *appInfo, const struct ORTEPubInfo *pubInfo, void *param);
 
 extern Boolean
-onAppDelete(const struct ORTEAppInfo *appInfo,void *param);
+onAppDelete(const struct ORTEAppInfo *appInfo, void *param);
 
 extern Boolean
-onAppRemoteNew(const struct ORTEAppInfo *appInfo,void *param);
+onAppRemoteNew(const struct ORTEAppInfo *appInfo, void *param);
 
 extern Boolean
-onMgrDelete(const struct ORTEAppInfo *appInfo,void *param);
+onMgrDelete(const struct ORTEAppInfo *appInfo, void *param);
 
 extern Boolean
-onMgrNew(const struct ORTEAppInfo *appInfo,void *param);
+onMgrNew(const struct ORTEAppInfo *appInfo, void *param);
 
 extern Boolean
 onRegFail(void *param);
 
 extern jclass
-findClass(JNIEnv *env, const charname);
+findClass(JNIEnv *env, const char *name);
index cb0f50d3ffbd031e46eede36b6bc7ccbe4077e34..14b31ac4499a88c1eaf3103ee89d66d8570f8572 100644 (file)
   */
 
 
-typedef struct
-{
- JavaVM        *jvm;
- jobject        obj;
- jobject        rinfo;
- jobject        msg;
- jobject        obj_buf;  // byte buffer object
- CDR_Endianness cur_endian;
+typedef struct {
+  JavaVM        *jvm;
+  jobject        obj;
+  jobject        rinfo;
+  jobject        msg;
+  jobject        obj_buf; // byte buffer object
+  CDR_Endianness cur_endian;
 } JORTECallbackContext_t;
 
 
-typedef struct
-{
- JavaVM        *jvm;
- jobject        obj_de;  // domain events
+typedef struct {
+  JavaVM        *jvm;
+  jobject        obj_de; // domain events
 } JORTEDomainEventsContext_t;
 
 
 typedef enum {
-        ON_REG_FAIL       = 1,
-        ON_MGR_NEW        = 2,
-        ON_MGR_DELETE     = 3,
-        ON_APP_REMOTE_NEW = 4,
-        ON_APP_DELETE     = 5,
-        ON_PUB_REMOTE     = 6,
-        ON_PUB_DELETE     = 7,
-        ON_SUB_REMOTE     = 8,
-        ON_SUB_DELETE     = 9
-      } JORTEDomainEvents_t;
+  ON_REG_FAIL       = 1,
+  ON_MGR_NEW        = 2,
+  ON_MGR_DELETE     = 3,
+  ON_APP_REMOTE_NEW = 4,
+  ON_APP_DELETE     = 5,
+  ON_PUB_REMOTE     = 6,
+  ON_PUB_DELETE     = 7,
+  ON_SUB_REMOTE     = 8,
+  ON_SUB_DELETE     = 9
+} JORTEDomainEvents_t;
index 1ea97d496901577b6cb6c4ffe34f592ee8cf0b7a..cdbf28f0abe19a18747b84ebca7ccf9a52759cc2 100644 (file)
@@ -12,7 +12,8 @@ extern "C" {
  * Method:    jORTEDomainStart
  * Signature: (JZZZ)V
  */
-JNIEXPORT void JNICALL Java_org_ocera_orte_Domain_jORTEDomainStart
+JNIEXPORT void JNICALL
+Java_org_ocera_orte_Domain_jORTEDomainStart
   (JNIEnv *, jclass, jlong, jboolean, jboolean, jboolean);
 
 #ifdef __cplusplus
index 9fbe1d43fd17e18babbf367cb93735e90f91e2d8..9211c4849fede93c5a5e5d31a454f800ed2aef0a 100644 (file)
@@ -12,7 +12,8 @@ extern "C" {
  * Method:    jORTEDomainDefaultAppCreate
  * Signature: (IZ)J
  */
-JNIEXPORT jlong JNICALL Java_org_ocera_orte_DomainApp_jORTEDomainDefaultAppCreate
+JNIEXPORT jlong JNICALL
+Java_org_ocera_orte_DomainApp_jORTEDomainDefaultAppCreate
   (JNIEnv *, jobject, jint, jboolean);
 
 /*
@@ -20,7 +21,8 @@ JNIEXPORT jlong JNICALL Java_org_ocera_orte_DomainApp_jORTEDomainDefaultAppCreat
  * Method:    jORTEDomainAppCreate
  * Signature: (IJJLorg/ocera/orte/types/DomainEvents;Z)J
  */
-JNIEXPORT jlong JNICALL Java_org_ocera_orte_DomainApp_jORTEDomainAppCreate
+JNIEXPORT jlong JNICALL
+Java_org_ocera_orte_DomainApp_jORTEDomainAppCreate
   (JNIEnv *, jobject, jint, jlong, jlong, jobject, jboolean);
 
 /*
@@ -28,7 +30,8 @@ JNIEXPORT jlong JNICALL Java_org_ocera_orte_DomainApp_jORTEDomainAppCreate
  * Method:    jORTEDomainAppDestroy
  * Signature: (J)Z
  */
-JNIEXPORT jboolean JNICALL Java_org_ocera_orte_DomainApp_jORTEDomainAppDestroy
+JNIEXPORT jboolean JNICALL
+Java_org_ocera_orte_DomainApp_jORTEDomainAppDestroy
   (JNIEnv *, jobject, jlong);
 
 /*
@@ -36,7 +39,8 @@ JNIEXPORT jboolean JNICALL Java_org_ocera_orte_DomainApp_jORTEDomainAppDestroy
  * Method:    jORTETypeRegisterAdd
  * Signature: (JLjava/lang/String;J)I
  */
-JNIEXPORT jint JNICALL Java_org_ocera_orte_DomainApp_jORTETypeRegisterAdd
+JNIEXPORT jint JNICALL
+Java_org_ocera_orte_DomainApp_jORTETypeRegisterAdd
   (JNIEnv *, jobject, jlong, jstring, jlong);
 
 /*
@@ -44,10 +48,11 @@ JNIEXPORT jint JNICALL Java_org_ocera_orte_DomainApp_jORTETypeRegisterAdd
  * Method:    jORTETypeRegisterDestroyAll
  * Signature: (J)Z
  */
-JNIEXPORT jboolean JNICALL Java_org_ocera_orte_DomainApp_jORTETypeRegisterDestroyAll
+JNIEXPORT jboolean JNICALL
+Java_org_ocera_orte_DomainApp_jORTETypeRegisterDestroyAll
   (JNIEnv *, jobject, jlong);
 
 #ifdef __cplusplus
 }
 #endif
-#endif
+#endif /* ifndef _Included_org_ocera_orte_DomainApp */
index bc9e0c1f181f7a5ec0a153b83919ab20392e1a8f..1914f046924f7bce3abc6bf4f47b63f3ead38d03 100644 (file)
@@ -12,7 +12,8 @@ extern "C" {
  * Method:    jORTEDomainDefaultMgrCreate
  * Signature: (IZ)J
  */
-JNIEXPORT jlong JNICALL Java_org_ocera_orte_DomainMgr_jORTEDomainDefaultMgrCreate
+JNIEXPORT jlong JNICALL
+Java_org_ocera_orte_DomainMgr_jORTEDomainDefaultMgrCreate
   (JNIEnv *, jobject, jint, jboolean);
 
 /*
@@ -20,7 +21,8 @@ JNIEXPORT jlong JNICALL Java_org_ocera_orte_DomainMgr_jORTEDomainDefaultMgrCreat
  * Method:    jORTEDomainMgrCreate
  * Signature: (IJJZ)J
  */
-JNIEXPORT jlong JNICALL Java_org_ocera_orte_DomainMgr_jORTEDomainMgrCreate
+JNIEXPORT jlong JNICALL
+Java_org_ocera_orte_DomainMgr_jORTEDomainMgrCreate
   (JNIEnv *, jobject, jint, jlong, jlong, jobject obj_de, jboolean);
 
 /*
@@ -28,7 +30,8 @@ JNIEXPORT jlong JNICALL Java_org_ocera_orte_DomainMgr_jORTEDomainMgrCreate
  * Method:    jORTEDomainMgrDestroy
  * Signature: (J)Z
  */
-JNIEXPORT jboolean JNICALL Java_org_ocera_orte_DomainMgr_jORTEDomainMgrDestroy
+JNIEXPORT jboolean JNICALL
+Java_org_ocera_orte_DomainMgr_jORTEDomainMgrDestroy
   (JNIEnv *, jobject, jlong);
 
 #ifdef __cplusplus
index 3c8cf5dfbf6979b7cb06194ec906a44da6e34cc3..df34c7e74346d704ce9d826cee759f4cf6d135a8 100644 (file)
@@ -12,7 +12,8 @@ extern "C" {
  * Method:    jORTEInit
  * Signature: ()V
  */
-JNIEXPORT void JNICALL Java_org_ocera_orte_JOrte_jORTEInit
+JNIEXPORT void JNICALL
+Java_org_ocera_orte_JOrte_jORTEInit
   (JNIEnv *, jclass);
 
 /*
@@ -20,7 +21,8 @@ JNIEXPORT void JNICALL Java_org_ocera_orte_JOrte_jORTEInit
  * Method:    jORTESleepMs
  * Signature: (J)V
  */
-JNIEXPORT void JNICALL Java_org_ocera_orte_JOrte_jORTESleepMs
+JNIEXPORT void JNICALL
+Java_org_ocera_orte_JOrte_jORTESleepMs
   (JNIEnv *, jclass, jlong);
 
 /*
@@ -28,7 +30,8 @@ JNIEXPORT void JNICALL Java_org_ocera_orte_JOrte_jORTESleepMs
  * Method:    jORTEVerbositySetOptions
  * Signature: (Ljava/lang/String;)V
  */
-JNIEXPORT void JNICALL Java_org_ocera_orte_JOrte_jORTEVerbositySetOptions
+JNIEXPORT void JNICALL
+Java_org_ocera_orte_JOrte_jORTEVerbositySetOptions
   (JNIEnv *, jclass, jstring);
 
 /*
@@ -36,7 +39,8 @@ JNIEXPORT void JNICALL Java_org_ocera_orte_JOrte_jORTEVerbositySetOptions
  * Method:    jORTEVerbositySetLogFile
  * Signature: (Ljava/lang/String;)V
  */
-JNIEXPORT void JNICALL Java_org_ocera_orte_JOrte_jORTEVerbositySetLogFile
+JNIEXPORT void JNICALL
+Java_org_ocera_orte_JOrte_jORTEVerbositySetLogFile
   (JNIEnv *, jclass, jstring);
 
 /*
@@ -44,10 +48,11 @@ JNIEXPORT void JNICALL Java_org_ocera_orte_JOrte_jORTEVerbositySetLogFile
  * Method:    jORTEAppSendThread
  * Signature: (J)V
  */
-JNIEXPORT void JNICALL Java_org_ocera_orte_JOrte_jORTEAppSendThread
+JNIEXPORT void JNICALL
+Java_org_ocera_orte_JOrte_jORTEAppSendThread
   (JNIEnv *, jclass, jlong);
 
 #ifdef __cplusplus
 }
 #endif
-#endif
+#endif /* ifndef _Included_org_ocera_orte_JOrte */
index 8b467b0e491a1097c272048ad24b9b75b71b8cdc..d6d9ff2f535f0e16b42e3eb6a1f811b1c82c1418 100644 (file)
@@ -12,7 +12,8 @@ extern "C" {
  * Method:    jORTEPublicationCreate
  * Signature: (JLjava/lang/String;Ljava/lang/String;ILjava/nio/ByteBuffer;Lorg/ocera/orte/types/NtpTime;I)J
  */
-JNIEXPORT jlong JNICALL Java_org_ocera_orte_Publication_jORTEPublicationCreate
+JNIEXPORT jlong JNICALL
+Java_org_ocera_orte_Publication_jORTEPublicationCreate
   (JNIEnv *, jobject, jlong, jstring, jstring, jobject, jobject, jint);
 
 /*
@@ -20,7 +21,8 @@ JNIEXPORT jlong JNICALL Java_org_ocera_orte_Publication_jORTEPublicationCreate
  * Method:    jORTEPublicationDestroy
  * Signature: (J)Z
  */
-JNIEXPORT jboolean JNICALL Java_org_ocera_orte_Publication_jORTEPublicationDestroy
+JNIEXPORT jboolean JNICALL
+Java_org_ocera_orte_Publication_jORTEPublicationDestroy
   (JNIEnv *, jobject, jlong);
 
 /*
@@ -28,7 +30,8 @@ JNIEXPORT jboolean JNICALL Java_org_ocera_orte_Publication_jORTEPublicationDestr
  * Method:    jORTEPublicationSend
  * Signature: (JLorg/ocera/orte/types/MessageData;)Z
  */
-JNIEXPORT jboolean JNICALL Java_org_ocera_orte_Publication_jORTEPublicationSend
+JNIEXPORT jboolean JNICALL
+Java_org_ocera_orte_Publication_jORTEPublicationSend
   (JNIEnv *, jobject, jlong);
 
 /*
@@ -36,7 +39,8 @@ JNIEXPORT jboolean JNICALL Java_org_ocera_orte_Publication_jORTEPublicationSend
  * Method:    jORTEPublicationPropertiesGet
  * Signature: (J)Lorg/ocera/orte/types/PublProp;
  */
-JNIEXPORT jobject JNICALL Java_org_ocera_orte_Publication_jORTEPublicationPropertiesGet
+JNIEXPORT jobject JNICALL
+Java_org_ocera_orte_Publication_jORTEPublicationPropertiesGet
   (JNIEnv *, jobject, jlong);
 
 /*
@@ -44,7 +48,8 @@ JNIEXPORT jobject JNICALL Java_org_ocera_orte_Publication_jORTEPublicationProper
  * Method:    jORTEPublicationPropertiesSet
  * Signature: (JLorg/ocera/orte/types/PublProp;)Z
  */
-JNIEXPORT jboolean JNICALL Java_org_ocera_orte_Publication_jORTEPublicationPropertiesSet
+JNIEXPORT jboolean JNICALL
+Java_org_ocera_orte_Publication_jORTEPublicationPropertiesSet
   (JNIEnv *, jobject, jlong, jobject);
 
 /*
@@ -52,7 +57,8 @@ JNIEXPORT jboolean JNICALL Java_org_ocera_orte_Publication_jORTEPublicationPrope
  * Method:    jORTEPublicationGetStatus
  * Signature: (J)Lorg/ocera/orte/types/Status;
  */
-JNIEXPORT jobject JNICALL Java_org_ocera_orte_Publication_jORTEPublicationGetStatus
+JNIEXPORT jobject JNICALL
+Java_org_ocera_orte_Publication_jORTEPublicationGetStatus
   (JNIEnv *, jobject, jlong);
 
 /*
@@ -60,10 +66,11 @@ JNIEXPORT jobject JNICALL Java_org_ocera_orte_Publication_jORTEPublicationGetSta
  * Method:    jORTEPublicationWaitForSubscriptions
  * Signature: (JLorg/ocera/orte/types/NtpTime;JJ)I
  */
-JNIEXPORT jint JNICALL Java_org_ocera_orte_Publication_jORTEPublicationWaitForSubscriptions
+JNIEXPORT jint JNICALL
+Java_org_ocera_orte_Publication_jORTEPublicationWaitForSubscriptions
   (JNIEnv *, jobject, jlong, jobject, jlong, jlong);
 
 #ifdef __cplusplus
 }
 #endif
-#endif
+#endif /* ifndef _Included_org_ocera_orte_Publication */
index 9b7598cd96ca82ce094aa57067149a00ef37d224..b6ecf126c7151835e16d0b57f69be2abd99f96a8 100644 (file)
@@ -12,7 +12,8 @@ extern "C" {
  * Method:    jORTESubscriptionCreate
  * Signature: (JIILjava/lang/String;Ljava/lang/String;ILorg/ocera/orte/types/MessageData;Lorg/ocera/orte/types/NtpTime;Lorg/ocera/orte/types/NtpTime;Lorg/ocera/orte/SubscriptionCallback;J)J
  */
-JNIEXPORT jlong JNICALL Java_org_ocera_orte_Subscription_jORTESubscriptionCreate
+JNIEXPORT jlong JNICALL
+Java_org_ocera_orte_Subscription_jORTESubscriptionCreate
   (JNIEnv *, jobject, jlong, jint, jint, jstring, jstring, jobject, jint, jobject, jobject, jobject, jobject, jlong);
 
 /*
@@ -20,7 +21,8 @@ JNIEXPORT jlong JNICALL Java_org_ocera_orte_Subscription_jORTESubscriptionCreate
  * Method:    jORTESubscriptionDestroy
  * Signature: (J)Z
  */
-JNIEXPORT jboolean JNICALL Java_org_ocera_orte_Subscription_jORTESubscriptionDestroy
+JNIEXPORT jboolean JNICALL
+Java_org_ocera_orte_Subscription_jORTESubscriptionDestroy
   (JNIEnv *, jobject, jlong);
 
 /*
@@ -28,7 +30,8 @@ JNIEXPORT jboolean JNICALL Java_org_ocera_orte_Subscription_jORTESubscriptionDes
  * Method:    jORTESubscriptionPropertiesGet
  * Signature: (J)Lorg/ocera/orte/types/SubsProp;
  */
-JNIEXPORT jobject JNICALL Java_org_ocera_orte_Subscription_jORTESubscriptionPropertiesGet
+JNIEXPORT jobject JNICALL
+Java_org_ocera_orte_Subscription_jORTESubscriptionPropertiesGet
   (JNIEnv *, jobject, jlong);
 
 /*
@@ -36,7 +39,8 @@ JNIEXPORT jobject JNICALL Java_org_ocera_orte_Subscription_jORTESubscriptionProp
  * Method:    jORTESubscriptionPropertiesSet
  * Signature: (JLorg/ocera/orte/types/SubsProp;)Z
  */
-JNIEXPORT jboolean JNICALL Java_org_ocera_orte_Subscription_jORTESubscriptionPropertiesSet
+JNIEXPORT jboolean JNICALL
+Java_org_ocera_orte_Subscription_jORTESubscriptionPropertiesSet
   (JNIEnv *, jobject, jlong, jobject);
 
 /*
@@ -44,7 +48,8 @@ JNIEXPORT jboolean JNICALL Java_org_ocera_orte_Subscription_jORTESubscriptionPro
  * Method:    jORTESubscriptionGetStatus
  * Signature: (J)Lorg/ocera/orte/types/Status;
  */
-JNIEXPORT jobject JNICALL Java_org_ocera_orte_Subscription_jORTESubscriptionGetStatus
+JNIEXPORT jobject JNICALL
+Java_org_ocera_orte_Subscription_jORTESubscriptionGetStatus
   (JNIEnv *, jobject, jlong);
 
 /*
@@ -52,7 +57,8 @@ JNIEXPORT jobject JNICALL Java_org_ocera_orte_Subscription_jORTESubscriptionGetS
  * Method:    jORTESubscriptionWaitForPublications
  * Signature: (JLorg/ocera/orte/types/NtpTime;JJ)I
  */
-JNIEXPORT jint JNICALL Java_org_ocera_orte_Subscription_jORTESubscriptionWaitForPublications
+JNIEXPORT jint JNICALL
+Java_org_ocera_orte_Subscription_jORTESubscriptionWaitForPublications
   (JNIEnv *, jobject, jlong, jobject, jlong, jlong);
 
 /*
@@ -60,10 +66,11 @@ JNIEXPORT jint JNICALL Java_org_ocera_orte_Subscription_jORTESubscriptionWaitFor
  * Method:    jORTESubscriptionPull
  * Signature: (J)I
  */
-JNIEXPORT jint JNICALL Java_org_ocera_orte_Subscription_jORTESubscriptionPull
+JNIEXPORT jint JNICALL
+Java_org_ocera_orte_Subscription_jORTESubscriptionPull
   (JNIEnv *, jobject, jlong);
 
 #ifdef __cplusplus
 }
 #endif
-#endif
+#endif /* ifndef _Included_org_ocera_orte_Subscription */
index e382d78cba27ac61211ab72ba4bd3f65d6301e81..240e8f1fae4f4b754440e335a03a96c1ca5de88b 100644 (file)
@@ -12,7 +12,8 @@ extern "C" {
  * Method:    IPAddressToString
  * Signature: (J)Ljava/lang/String;
  */
-JNIEXPORT jstring JNICALL Java_org_ocera_orte_tools_Conversions_IPAddressToString
+JNIEXPORT jstring JNICALL
+Java_org_ocera_orte_tools_Conversions_IPAddressToString
   (JNIEnv *, jclass, jlong);
 
 /*
@@ -20,7 +21,8 @@ JNIEXPORT jstring JNICALL Java_org_ocera_orte_tools_Conversions_IPAddressToStrin
  * Method:    StringToIPAddress
  * Signature: (Ljava/lang/String;)J
  */
-JNIEXPORT jlong JNICALL Java_org_ocera_orte_tools_Conversions_StringToIPAddress
+JNIEXPORT jlong JNICALL
+Java_org_ocera_orte_tools_Conversions_StringToIPAddress
   (JNIEnv *, jclass, jstring);
 
 #ifdef __cplusplus
index f9b323efd1d02959da4f5bda3c0c1c3f84cc17b3..39051281e77060faac397f4648da4c484c968aed 100644 (file)
@@ -12,7 +12,8 @@ extern "C" {
  * Method:    getConstant
  * Signature: (Ljava/lang/String;)I
  */
-JNIEXPORT jint JNICALL Java_org_ocera_orte_tools_GetORTEConstant_getConstant
+JNIEXPORT jint JNICALL
+Java_org_ocera_orte_tools_GetORTEConstant_getConstant
   (JNIEnv *, jobject, jstring);
 
 #ifdef __cplusplus
index 810b8332b4a3c571e9dd807f4d63e8da7d80b495..a3e320466b87f45511feeb4af1184fdb7c9b8f6a 100644 (file)
@@ -12,7 +12,8 @@ extern "C" {
  * Method:    jORTEDomainInitEvents
  * Signature: ()J
  */
-JNIEXPORT jlong JNICALL Java_org_ocera_orte_types_DomainEvents_jORTEDomainInitEvents
+JNIEXPORT jlong JNICALL
+Java_org_ocera_orte_types_DomainEvents_jORTEDomainInitEvents
   (JNIEnv *, jobject);
 
 /*
@@ -20,7 +21,8 @@ JNIEXPORT jlong JNICALL Java_org_ocera_orte_types_DomainEvents_jORTEDomainInitEv
  * Method:    jORTEDomainEventsDestroy
  * Signature: (J)Z
  */
-JNIEXPORT jboolean JNICALL Java_org_ocera_orte_types_DomainEvents_jORTEDomainEventsDestroy
+JNIEXPORT jboolean JNICALL
+Java_org_ocera_orte_types_DomainEvents_jORTEDomainEventsDestroy
   (JNIEnv *, jobject, jlong);
 
 #ifdef __cplusplus
index ef1f34c499576370b83a9e129cbed872b33f5d8d..b78a56e89727317a980f6c9042f77b439623ed4f 100644 (file)
@@ -12,7 +12,8 @@ extern "C" {
  * Method:    jORTEDomainPropDefaultGet
  * Signature: ()J
  */
-JNIEXPORT jlong JNICALL Java_org_ocera_orte_types_DomainProp_jORTEDomainPropDefaultGet
+JNIEXPORT jlong JNICALL
+Java_org_ocera_orte_types_DomainProp_jORTEDomainPropDefaultGet
   (JNIEnv *, jclass);
 
 /*
@@ -20,7 +21,8 @@ JNIEXPORT jlong JNICALL Java_org_ocera_orte_types_DomainProp_jORTEDomainPropDefa
  * Method:    jORTEDomainPropSet
  * Signature: (JLjava/lang/String;)Z
  */
-JNIEXPORT jboolean JNICALL Java_org_ocera_orte_types_DomainProp_jORTEDomainPropSet
+JNIEXPORT jboolean JNICALL
+Java_org_ocera_orte_types_DomainProp_jORTEDomainPropSet
   (JNIEnv *, jobject, jlong, jstring);
 
 /*
@@ -28,7 +30,8 @@ JNIEXPORT jboolean JNICALL Java_org_ocera_orte_types_DomainProp_jORTEDomainPropS
  * Method:    jORTEDomainPropDestroy
  * Signature: (JLjava/lang/String;)Z
  */
-JNIEXPORT jboolean JNICALL Java_org_ocera_orte_types_DomainProp_jORTEDomainPropDestroy
+JNIEXPORT jboolean JNICALL
+Java_org_ocera_orte_types_DomainProp_jORTEDomainPropDestroy
   (JNIEnv *, jobject, jlong, jstring);
 
 #ifdef __cplusplus
index 45275158c6452c60015186ec1c13d7fd1e63e296..54237331697053c880af019256cc1877a3011659 100644 (file)
@@ -12,7 +12,8 @@ extern "C" {
  * Method:    NtpTimeToStringMs
  * Signature: (Lorg/ocera/orte/types/NtpTime;)Ljava/lang/String;
  */
-JNIEXPORT jstring JNICALL Java_org_ocera_orte_types_NtpTime_NtpTimeToStringMs
+JNIEXPORT jstring JNICALL
+Java_org_ocera_orte_types_NtpTime_NtpTimeToStringMs
   (JNIEnv *, jclass, jobject);
 
 /*
@@ -20,7 +21,8 @@ JNIEXPORT jstring JNICALL Java_org_ocera_orte_types_NtpTime_NtpTimeToStringMs
  * Method:    NtpTimeToStringUs
  * Signature: (Lorg/ocera/orte/types/NtpTime;)Ljava/lang/String;
  */
-JNIEXPORT jstring JNICALL Java_org_ocera_orte_types_NtpTime_NtpTimeToStringUs
+JNIEXPORT jstring JNICALL
+Java_org_ocera_orte_types_NtpTime_NtpTimeToStringUs
   (JNIEnv *, jclass, jobject);
 
 #ifdef __cplusplus
index 7ddf67af5892e734b06b3143cc63fb5dd8de205d..9864cb7ede5e2e3a403a7145a0e4a68f8eb578c3 100644 (file)
@@ -1,18 +1,18 @@
 /*
  *  $Id: orte_api.h.h,v 0.0.0.1         2003/08/21
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
index 61449e3aa7f0209ca1ecc73ec722c62d3931a519..254413c1d1f548f99fad06cf9dd1504060cc39dd 100644 (file)
@@ -3,8 +3,8 @@
 
 
 enum {
-       CORBA_FALSE = 0,
-       CORBA_TRUE  = 1
+  CORBA_FALSE = 0,
+  CORBA_TRUE  = 1
 };
 
 typedef int16_t   CORBA_short;
@@ -13,7 +13,7 @@ typedef uint16_t  CORBA_unsigned_short;
 typedef uint32_t  CORBA_unsigned_long;
 typedef float     CORBA_float;
 typedef double    CORBA_double;
-typedef char     CORBA_char;
+typedef char      CORBA_char;
 typedef int16_t   CORBA_wchar;
 typedef uint8_t   CORBA_boolean;
 typedef uint8_t   CORBA_octet;
index 7f415156e3d8d9a0321472e90f28180fd227e402..6782603dd7ea07ec97f24571b5bb4b94b4069760 100644 (file)
@@ -1,30 +1,30 @@
 /*
- *  $Id: cdr.h,v 0.0.0.1                2004/11/26 
+ *  $Id: cdr.h,v 0.0.0.1                2004/11/26
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
+ *
  *  Original of source was from ORBit: A CORBA v2.2 ORB
  */
 #ifndef _ORTE_CDR_H_
 #define ORTE_ALIGNOF_CORBA_POINTER      4
 
 typedef enum {
-       BigEndian=0,
-       LittleEndian=1
+  BigEndian = 0,
+  LittleEndian = 1
 } CDR_Endianness;
 
 /**
  * struct CDR_Codec - used for serialization/deserialization
- * @host_endian: 
- * @data_endian: 
+ * @host_endian:
+ * @data_endian:
  * @buffer: buffer for data
  * @buf_len: buffer length
- * @wptr_max: maximal size of writing data 
+ * @wptr_max: maximal size of writing data
  * @wptr: write pointer
  * @rptr: read pointer
- * @readonly: readonly attribute 
+ * @readonly: readonly attribute
  * @release_buffer: use CORBA_TRUE if is necessary to free buffer memory after destruction of structure
  *
  * Struct @CDR_Codec is used by serialization and deserialization functions.
  */
 typedef struct CDR_Codec {
-       CDR_Endianness host_endian;
-       CDR_Endianness data_endian;
-       CORBA_octet *buffer;
-       unsigned int buf_len;
-       unsigned int wptr_max;
-       unsigned int wptr;
-       unsigned int rptr;
-       CORBA_boolean readonly;
-       CORBA_boolean release_buffer;
+  CDR_Endianness host_endian;
+  CDR_Endianness data_endian;
+  CORBA_octet *buffer;
+  unsigned int buf_len;
+  unsigned int wptr_max;
+  unsigned int wptr;
+  unsigned int rptr;
+  CORBA_boolean readonly;
+  CORBA_boolean release_buffer;
 } CDR_Codec;
 
-#define HEXDIGIT(c) (isdigit((guchar)(c))?(c)-'0':tolower((guchar)(c))-'a'+10)
-#define HEXOCTET(a,b) ((HEXDIGIT((a)) << 4) | HEXDIGIT((b)))
+#define HEXDIGIT(c) (isdigit((guchar)(c)) ? (c)-'0' : tolower((guchar)(c))-'a'+10)
+#define HEXOCTET(a, b) ((HEXDIGIT((a)) << 4) | HEXDIGIT((b)))
 
-extern CORBA_boolean CDR_buffer_init(CDR_Codec *codec, const unsigned int size);
-extern CDR_Codec *CDR_codec_init(void);
-extern CDR_Codec *CDR_codec_init_static(CDR_Codec *codec);
-extern void CDR_codec_release_buffer(CDR_Codec *codec);
-extern void CDR_codec_free(CDR_Codec *);
+extern CORBA_boolean
+CDR_buffer_init(CDR_Codec *codec, const unsigned int size);
+extern CDR_Codec *
+CDR_codec_init(void);
+extern CDR_Codec *
+CDR_codec_init_static(CDR_Codec *codec);
+extern void
+CDR_codec_release_buffer(CDR_Codec *codec);
+extern void
+CDR_codec_free(CDR_Codec *);
 
-extern CORBA_boolean CDR_buffer_puts(CDR_Codec *codec, const void *data, const unsigned int len);
-extern CORBA_boolean CDR_buffer_gets(CDR_Codec *codec, void *dest, const unsigned int len);
+extern CORBA_boolean
+CDR_buffer_puts(CDR_Codec *codec, const void *data, const unsigned int len);
+extern CORBA_boolean
+CDR_buffer_gets(CDR_Codec *codec, void *dest, const unsigned int len);
 
-extern CORBA_boolean CDR_put_short(CDR_Codec *codec, CORBA_short s);
-extern CORBA_boolean CDR_put_ushort(CDR_Codec *codec, CORBA_unsigned_short us);
-extern CORBA_boolean CDR_put_long(CDR_Codec *codec, CORBA_long l);
-extern CORBA_boolean CDR_put_ulong(CDR_Codec *codec, CORBA_unsigned_long ul);
+extern CORBA_boolean
+CDR_put_short(CDR_Codec *codec, CORBA_short s);
+extern CORBA_boolean
+CDR_put_ushort(CDR_Codec *codec, CORBA_unsigned_short us);
+extern CORBA_boolean
+CDR_put_long(CDR_Codec *codec, CORBA_long l);
+extern CORBA_boolean
+CDR_put_ulong(CDR_Codec *codec, CORBA_unsigned_long ul);
 #ifdef HAVE_CORBA_LONG_LONG
-extern CORBA_boolean CDR_put_long_long(CDR_Codec *codec, CORBA_long_long ll);
-extern CORBA_boolean CDR_put_ulong_long(CDR_Codec *codec, CORBA_unsigned_long_long ull);
-extern CORBA_boolean CDR_get_ulong_long(CDR_Codec *codec, CORBA_unsigned_long_long *ul);
-extern CORBA_boolean CDR_get_long_long(CDR_Codec *codec, CORBA_long_long *ul);
+extern CORBA_boolean
+CDR_put_long_long(CDR_Codec *codec, CORBA_long_long ll);
+extern CORBA_boolean
+CDR_put_ulong_long(CDR_Codec *codec, CORBA_unsigned_long_long ull);
+extern CORBA_boolean
+CDR_get_ulong_long(CDR_Codec *codec, CORBA_unsigned_long_long *ul);
+extern CORBA_boolean
+CDR_get_long_long(CDR_Codec *codec, CORBA_long_long *ul);
 #endif
-extern CORBA_boolean CDR_put_float(CDR_Codec *codec, CORBA_float f);
-extern CORBA_boolean CDR_put_double(CDR_Codec *codec, CORBA_double d);
-extern CORBA_boolean CDR_put_long_double(CDR_Codec *codec, CORBA_long_double ld);
-extern CORBA_boolean CDR_put_octet(CDR_Codec *codec, CORBA_octet datum);
-extern CORBA_boolean CDR_put_octets(CDR_Codec *codec, void *data, unsigned long len);
-extern CORBA_boolean CDR_put_char(CDR_Codec *codec, CORBA_char c);
-extern CORBA_boolean CDR_put_boolean(CDR_Codec *codec, CORBA_boolean datum);
-extern CORBA_boolean CDR_put_string(CDR_Codec *codec, const char *str);
-extern CORBA_boolean CDR_buffer_gets(CDR_Codec *codec, void *dest, const unsigned int len);
-extern CORBA_boolean CDR_get_short(CDR_Codec *codec, CORBA_short *us);
-extern CORBA_boolean CDR_get_ushort(CDR_Codec *codec, CORBA_unsigned_short *us);
-extern CORBA_boolean CDR_get_long(CDR_Codec *codec, CORBA_long *l);
-extern CORBA_boolean CDR_get_ulong(CDR_Codec *codec, CORBA_unsigned_long *ul);
-extern CORBA_boolean CDR_get_octet(CDR_Codec *codec, CORBA_octet *datum);
-extern CORBA_boolean CDR_get_boolean(CDR_Codec *codec, CORBA_boolean *b);
-extern CORBA_boolean CDR_get_char(CDR_Codec *codec, CORBA_char *c);
-extern CORBA_boolean CDR_get_string(CDR_Codec *codec, CORBA_char **str);
-extern CORBA_boolean CDR_get_string_buff(CDR_Codec *codec, CORBA_char *str);
-extern CORBA_boolean CDR_get_string_static(CDR_Codec *codec, CORBA_char **str);
-extern CORBA_boolean CDR_get_seq_begin(CDR_Codec *codec, CORBA_unsigned_long *ul);
-extern CORBA_boolean CDR_get_float(CDR_Codec *codec, CORBA_float *f);
-extern CORBA_boolean CDR_get_double(CDR_Codec *codec, CORBA_double *d);
+extern CORBA_boolean
+CDR_put_float(CDR_Codec *codec, CORBA_float f);
+extern CORBA_boolean
+CDR_put_double(CDR_Codec *codec, CORBA_double d);
+extern CORBA_boolean
+CDR_put_long_double(CDR_Codec *codec, CORBA_long_double ld);
+extern CORBA_boolean
+CDR_put_octet(CDR_Codec *codec, CORBA_octet datum);
+extern CORBA_boolean
+CDR_put_octets(CDR_Codec *codec, void *data, unsigned long len);
+extern CORBA_boolean
+CDR_put_char(CDR_Codec *codec, CORBA_char c);
+extern CORBA_boolean
+CDR_put_boolean(CDR_Codec *codec, CORBA_boolean datum);
+extern CORBA_boolean
+CDR_put_string(CDR_Codec *codec, const char *str);
+extern CORBA_boolean
+CDR_buffer_gets(CDR_Codec *codec, void *dest, const unsigned int len);
+extern CORBA_boolean
+CDR_get_short(CDR_Codec *codec, CORBA_short *us);
+extern CORBA_boolean
+CDR_get_ushort(CDR_Codec *codec, CORBA_unsigned_short *us);
+extern CORBA_boolean
+CDR_get_long(CDR_Codec *codec, CORBA_long *l);
+extern CORBA_boolean
+CDR_get_ulong(CDR_Codec *codec, CORBA_unsigned_long *ul);
+extern CORBA_boolean
+CDR_get_octet(CDR_Codec *codec, CORBA_octet *datum);
+extern CORBA_boolean
+CDR_get_boolean(CDR_Codec *codec, CORBA_boolean *b);
+extern CORBA_boolean
+CDR_get_char(CDR_Codec *codec, CORBA_char *c);
+extern CORBA_boolean
+CDR_get_string(CDR_Codec *codec, CORBA_char **str);
+extern CORBA_boolean
+CDR_get_string_buff(CDR_Codec *codec, CORBA_char *str);
+extern CORBA_boolean
+CDR_get_string_static(CDR_Codec *codec, CORBA_char **str);
+extern CORBA_boolean
+CDR_get_seq_begin(CDR_Codec *codec, CORBA_unsigned_long *ul);
+extern CORBA_boolean
+CDR_get_float(CDR_Codec *codec, CORBA_float *f);
+extern CORBA_boolean
+CDR_get_double(CDR_Codec *codec, CORBA_double *d);
 
 
 /* serialization functions */
-#define CORBA_short_serialize(x,y)             CDR_put_short((x),*(y))
-#define CORBA_long_serialize(x,y)              CDR_put_long((x),*(y))
-#define CORBA_unsigned_short_serialize(x,y)    CDR_put_ushort((x),*(y))
-#define CORBA_unsigned_long_serialize(x,y)     CDR_put_ulong((x),*(y))
-#define CORBA_float_serialize(x,y)             CDR_put_float((x),*(y))
-#define CORBA_double_serialize(x,y)            CDR_put_double((x),*(y))
-#define CORBA_char_serialize(x,y)              CDR_put_char((x),*(y))
-#define CORBA_boolean_serialize(x,y)           CDR_put_boolean((x),*(y))
-#define CORBA_octet_serialize(x,y)             CDR_put_octet((x),*(y))
-#define CORBA_long_double_serialize(x,y)       CDR_put_long_double((x),*(y))
-#define CORBA_string_serialize(x,y)            CDR_put_string((x),*(y))
+#define CORBA_short_serialize(x, y)             CDR_put_short((x), *(y))
+#define CORBA_long_serialize(x, y)              CDR_put_long((x), *(y))
+#define CORBA_unsigned_short_serialize(x, y)    CDR_put_ushort((x), *(y))
+#define CORBA_unsigned_long_serialize(x, y)     CDR_put_ulong((x), *(y))
+#define CORBA_float_serialize(x, y)             CDR_put_float((x), *(y))
+#define CORBA_double_serialize(x, y)            CDR_put_double((x), *(y))
+#define CORBA_char_serialize(x, y)              CDR_put_char((x), *(y))
+#define CORBA_boolean_serialize(x, y)           CDR_put_boolean((x), *(y))
+#define CORBA_octet_serialize(x, y)             CDR_put_octet((x), *(y))
+#define CORBA_long_double_serialize(x, y)       CDR_put_long_double((x), *(y))
+#define CORBA_string_serialize(x, y)            CDR_put_string((x), *(y))
 
 /* deserialization functions */
-#define CORBA_short_deserialize(x,y)           CDR_get_short((x),(y))
-#define CORBA_long_deserialize(x,y)            CDR_get_long((x),(y))
-#define CORBA_unsigned_short_deserialize(x,y)  CDR_get_ushort((x),(y))
-#define CORBA_unsigned_long_deserialize(x,y)   CDR_get_ulong((x),(y))
-#define CORBA_float_deserialize(x,y)           CDR_get_float((x),(y))
-#define CORBA_double_deserialize(x,y)          CDR_get_double((x),(y))
-#define CORBA_char_deserialize(x,y)            CDR_get_char((x),(y))
-#define CORBA_boolean_deserialize(x,y)         CDR_get_boolean((x),(y))
-#define CORBA_octet_deserialize(x,y)           CDR_get_octet((x),(y))
-#define CORBA_long_double_deserialize(x,y)     CDR_get_long_double((x),(y))
-#define CORBA_string_deserialize(x,y)          CDR_get_string((x),(y))
+#define CORBA_short_deserialize(x, y)           CDR_get_short((x), (y))
+#define CORBA_long_deserialize(x, y)            CDR_get_long((x), (y))
+#define CORBA_unsigned_short_deserialize(x, y)  CDR_get_ushort((x), (y))
+#define CORBA_unsigned_long_deserialize(x, y)   CDR_get_ulong((x), (y))
+#define CORBA_float_deserialize(x, y)           CDR_get_float((x), (y))
+#define CORBA_double_deserialize(x, y)          CDR_get_double((x), (y))
+#define CORBA_char_deserialize(x, y)            CDR_get_char((x), (y))
+#define CORBA_boolean_deserialize(x, y)         CDR_get_boolean((x), (y))
+#define CORBA_octet_deserialize(x, y)           CDR_get_octet((x), (y))
+#define CORBA_long_double_deserialize(x, y)     CDR_get_long_double((x), (y))
+#define CORBA_string_deserialize(x, y)          CDR_get_string((x), (y))
 
 /* get_max_size functions */
-#define CORBA_short_get_max_size(x, num)            ((x)->csize=\
-       (unsigned long)ALIGN_ADDRESS((x)->csize,ORTE_ALIGNOF_CORBA_SHORT)+(num)*ORTE_ALIGNOF_CORBA_SHORT)
-#define CORBA_long_get_max_size(x, num)             ((x)->csize=\
-       (unsigned long)ALIGN_ADDRESS((x)->csize,ORTE_ALIGNOF_CORBA_LONG)+(num)*ORTE_ALIGNOF_CORBA_LONG)
-#define CORBA_unsigned_short_get_max_size(x, num)   ((x)->csize=\
-       (unsigned long)ALIGN_ADDRESS((x)->csize,ORTE_ALIGNOF_CORBA_SHORT)+(num)*ORTE_ALIGNOF_CORBA_SHORT)
-#define CORBA_unsigned_long_get_max_size(x, num)    ((x)->csize=\
-       (unsigned long)ALIGN_ADDRESS((x)->csize,ORTE_ALIGNOF_CORBA_LONG)+(num)*ORTE_ALIGNOF_CORBA_LONG)
-#define CORBA_float_get_max_size(x, num)            ((x)->csize=\
-       (unsigned long)ALIGN_ADDRESS((x)->csize,ORTE_ALIGNOF_CORBA_FLOAT)+(num)*ORTE_ALIGNOF_CORBA_FLOAT)
-#define CORBA_double_get_max_size(x, num)           ((x)->csize=\
-       (unsigned long)ALIGN_ADDRESS((x)->csize,ORTE_ALIGNOF_CORBA_DOUBLE)+(num)*ORTE_ALIGNOF_CORBA_DOUBLE)
-#define CORBA_char_get_max_size(x, num)             ((x)->csize=\
-       (unsigned long)ALIGN_ADDRESS((x)->csize,ORTE_ALIGNOF_CORBA_CHAR)+(num)*ORTE_ALIGNOF_CORBA_CHAR)
-#define CORBA_boolean_get_max_size(x, num)          ((x)->csize=\
-       (unsigned long)ALIGN_ADDRESS((x)->csize,ORTE_ALIGNOF_CORBA_BOOLEAN)+(num)*ORTE_ALIGNOF_CORBA_BOOLEAN)
-#define CORBA_octet_get_max_size(x, num)            ((x)->csize=\
-       (unsigned long)ALIGN_ADDRESS((x)->csize,ORTE_ALIGNOF_CORBA_OCTET)+(num)*ORTE_ALIGNOF_CORBA_OCTET)
-#define CORBA_long_double_get_max_size(x, num)      ((x)->csize=\
-       (unsigned long)ALIGN_ADDRESS((x)->csize,ORTE_ALIGNOF_CORBA_LONG_DOUBLE)+(num)*ORTE_ALIGNOF_CORBA_DOUBLE)
-#define CORBA_string_get_max_size(x,y)         \
-       ((x)->csize=(unsigned long)ALIGN_ADDRESS((x)->csize,ORTE_ALIGNOF_CORBA_LONG) + ORTE_ALIGNOF_CORBA_LONG + y + 1)
+#define CORBA_short_get_max_size(x, num)            ((x)->csize = \
+                                                      (unsigned long)ALIGN_ADDRESS((x)->csize, ORTE_ALIGNOF_CORBA_SHORT)+(num)*ORTE_ALIGNOF_CORBA_SHORT)
+#define CORBA_long_get_max_size(x, num)             ((x)->csize = \
+                                                      (unsigned long)ALIGN_ADDRESS((x)->csize, ORTE_ALIGNOF_CORBA_LONG)+(num)*ORTE_ALIGNOF_CORBA_LONG)
+#define CORBA_unsigned_short_get_max_size(x, num)   ((x)->csize = \
+                                                      (unsigned long)ALIGN_ADDRESS((x)->csize, ORTE_ALIGNOF_CORBA_SHORT)+(num)*ORTE_ALIGNOF_CORBA_SHORT)
+#define CORBA_unsigned_long_get_max_size(x, num)    ((x)->csize = \
+                                                      (unsigned long)ALIGN_ADDRESS((x)->csize, ORTE_ALIGNOF_CORBA_LONG)+(num)*ORTE_ALIGNOF_CORBA_LONG)
+#define CORBA_float_get_max_size(x, num)            ((x)->csize = \
+                                                      (unsigned long)ALIGN_ADDRESS((x)->csize, ORTE_ALIGNOF_CORBA_FLOAT)+(num)*ORTE_ALIGNOF_CORBA_FLOAT)
+#define CORBA_double_get_max_size(x, num)           ((x)->csize = \
+                                                      (unsigned long)ALIGN_ADDRESS((x)->csize, ORTE_ALIGNOF_CORBA_DOUBLE)+(num)*ORTE_ALIGNOF_CORBA_DOUBLE)
+#define CORBA_char_get_max_size(x, num)             ((x)->csize = \
+                                                      (unsigned long)ALIGN_ADDRESS((x)->csize, ORTE_ALIGNOF_CORBA_CHAR)+(num)*ORTE_ALIGNOF_CORBA_CHAR)
+#define CORBA_boolean_get_max_size(x, num)          ((x)->csize = \
+                                                      (unsigned long)ALIGN_ADDRESS((x)->csize, ORTE_ALIGNOF_CORBA_BOOLEAN)+(num)*ORTE_ALIGNOF_CORBA_BOOLEAN)
+#define CORBA_octet_get_max_size(x, num)            ((x)->csize = \
+                                                      (unsigned long)ALIGN_ADDRESS((x)->csize, ORTE_ALIGNOF_CORBA_OCTET)+(num)*ORTE_ALIGNOF_CORBA_OCTET)
+#define CORBA_long_double_get_max_size(x, num)      ((x)->csize = \
+                                                      (unsigned long)ALIGN_ADDRESS((x)->csize, ORTE_ALIGNOF_CORBA_LONG_DOUBLE)+(num)*ORTE_ALIGNOF_CORBA_DOUBLE)
+#define CORBA_string_get_max_size(x, y)                \
+  ((x)->csize = (unsigned long)ALIGN_ADDRESS((x)->csize, ORTE_ALIGNOF_CORBA_LONG) + ORTE_ALIGNOF_CORBA_LONG + y + 1)
 
 #endif /* !_ORTE_CDR_H_ */
index 58f4cac1c9f9108839d7761dc2b472f865072d7f..f7e89a70afda2a55a49cae0e52b1faa6ffaef43d 100644 (file)
@@ -1,30 +1,30 @@
 /*
- *  $Id: defines_api.h,v 0.0.0.1        2003/08/21 
+ *  $Id: defines_api.h,v 0.0.0.1        2003/08/21
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
+ *
  */
 
 #ifndef _DEFINES_API_H
@@ -41,17 +41,17 @@ extern "C" {
 
 ////////////////////////////////////////////////////////////////////////////////
 //Return values
-#define ORTE_OK                          0
-#define ORTE_BAD_HANDLE                  -1
-#define ORTE_TIMEOUT             -2
-#define ORTE_QUEUE_FULL                  -3
+#define ORTE_OK                   0
+#define ORTE_BAD_HANDLE           -1
+#define ORTE_TIMEOUT              -2
+#define ORTE_QUEUE_FULL           -3
 
 ////////////////////////////////////////////////////////////////////////////////
 //Logging - flags
-#define LOG_FNONE                0x00
-#define LOG_FEXCEPTION           0x01
-#define LOG_FWARN                0x02
-#define LOG_FLOCAL_OBJECT        0x04  
+#define LOG_FNONE                 0x00
+#define LOG_FEXCEPTION            0x01
+#define LOG_FWARN                 0x02
+#define LOG_FLOCAL_OBJECT         0x04
 #define LOG_FREMOTE_OBJECT        0x08
 #define LOG_FPERIODIC             0x10
 #define LOG_FCONTENT              0x20
@@ -61,16 +61,16 @@ extern "C" {
  * SeqNumberCmp - comparison of two sequence numbers
  * @sn1: source sequential number 1
  * @sn2: source sequential number 2
- * 
+ *
  * Return:  1 if sn1 > sn2
  *         -1 if sn1 < sn2
  *          0 if sn1 = sn2
  */
-#define SeqNumberCmp(sn1, sn2) (                 \
-          (sn1).high>(sn2).high ? 1 :            \
-        ((sn1).high<(sn2).high ? -1 :            \
-          ((sn1).low>(sn2).low ? 1 :             \
-            ((sn1).low<(sn2).low ? -1 : 0)))     \
+#define SeqNumberCmp(sn1, sn2) (                \
+    (sn1).high > (sn2).high ? 1 :           \
+    ((sn1).high < (sn2).high ? -1 :           \
+     ((sn1).low > (sn2).low ? 1 :            \
+      ((sn1).low < (sn2).low ? -1 : 0)))     \
     )
 
 /*****************************************************************/
@@ -78,13 +78,14 @@ extern "C" {
  * SeqNumberInc - incrementation of a sequence number
  * @res: result
  * @sn: sequential number to be incremented
- * 
+ *
  * res = sn + 1
  */
-#define SeqNumberInc(res,sn) {                   \
-      (res) = (sn);                              \
-          if (++(res).low==0) (res).high++;      \
-        }
+#define SeqNumberInc(res, sn) {                          \
+    (res) = (sn);                             \
+    if (++(res).low == 0) \
+      (res).high++;     \
+}
 
 
 /*****************************************************************/
@@ -96,13 +97,13 @@ extern "C" {
  *
  * res = sn1 + sn2
  */
-#define SeqNumberAdd(res,sn1,sn2) {              \
-    (res).low = (sn1).low+(sn2).low;             \
-    (res).high = (sn1).high+(sn2).high;          \
-    if (((res).low < (sn1).low) ||               \
-        ((res).low < (sn2).low)) {               \
-      (res).high++;                              \
-    }                                            \
+#define SeqNumberAdd(res, sn1, sn2) {             \
+    (res).low = (sn1).low+(sn2).low;            \
+    (res).high = (sn1).high+(sn2).high;                 \
+    if (((res).low < (sn1).low) ||              \
+       ((res).low < (sn2).low)) {               \
+      (res).high++;                             \
+    }                                           \
 }
 
 /*****************************************************************/
@@ -110,13 +111,14 @@ extern "C" {
  * SeqNumberDec - decrementation of a sequence number
  * @res: result
  * @sn: sequential number to be decremented
- * 
+ *
  * res = sn - 1
  */
-#define SeqNumberDec(res,sn) {                   \
-      (res) = (sn);                              \
-          if ((res).low--==0) (res).high--;      \
-        }
+#define SeqNumberDec(res, sn) {                          \
+    (res) = (sn);                             \
+    if ((res).low-- == 0) \
+      (res).high--;     \
+}
 
 /*****************************************************************/
 /**
@@ -127,12 +129,12 @@ extern "C" {
  *
  * res = sn1 - sn2
  */
-#define SeqNumberSub(res,sn1,sn2) {                  \
-    (res).low = (sn1).low-(sn2).low;                 \
-    (res).high = (sn1).high-(sn2).high;              \
-    if ((res).low > (sn1).low) {                     \
-      (res).high--;                                  \
-    }                                                \
+#define SeqNumberSub(res, sn1, sn2) {                 \
+    (res).low = (sn1).low-(sn2).low;                \
+    (res).high = (sn1).high-(sn2).high;                     \
+    if ((res).low > (sn1).low) {                    \
+      (res).high--;                                 \
+    }                                               \
 }
 
 /*****************************************************************/
@@ -142,15 +144,15 @@ extern "C" {
  * @time2: source time 2
  *
  * Return value:
- * 1 if time 1 > time 2 
+ * 1 if time 1 > time 2
  * -1 if time 1 < time 2
  * 0 if time 1 = time 2
  */
-#define NtpTimeCmp(time1, time2)                     \
-((((time1).seconds) > ((time2).seconds)) ? 1 :       \
- ((((time1).seconds) < ((time2).seconds)) ? -1 :     \
-  ((((time1).fraction) > ((time2).fraction)) ? 1 :   \
-   ((((time1).fraction) < ((time2).fraction)) ? -1 : 0))))
+#define NtpTimeCmp(time1, time2)                    \
+  ((((time1).seconds) > ((time2).seconds)) ? 1 :       \
  ((((time1).seconds) < ((time2).seconds)) ? -1 :     \
+    ((((time1).fraction) > ((time2).fraction)) ? 1 :   \
+     ((((time1).fraction) < ((time2).fraction)) ? -1 : 0))))
 
 
 /*****************************************************************/
@@ -162,13 +164,13 @@ extern "C" {
  *
  * res = time1 + time2
  */
-#define NtpTimeAdd(res, time1, time2) {              \
-    (res).seconds  = (time1).seconds + (time2).seconds;   \
+#define NtpTimeAdd(res, time1, time2) {                     \
+    (res).seconds  = (time1).seconds + (time2).seconds;          \
     (res).fraction = (time1).fraction + (time2).fraction; \
-    if (((res).fraction < (time1).fraction) ||       \
-        ((res).fraction < (time2).fraction)) {       \
-      (res).seconds++;                               \
-    }                                                \
+    if (((res).fraction < (time1).fraction) ||      \
+       ((res).fraction < (time2).fraction)) {       \
+      (res).seconds++;                              \
+    }                                               \
 }
 
 /*****************************************************************/
@@ -180,12 +182,12 @@ extern "C" {
  *
  * res = time1 - time2
  */
-#define NtpTimeSub(res, time1, time2) {              \
-   (res).seconds  = (time1).seconds - (time2).seconds;   \
-   (res).fraction = (time1).fraction - (time2).fraction; \
-   if ((res).fraction > (time1).fraction) {          \
-     (res).seconds--;                                \
-                                                   \
+#define NtpTimeSub(res, time1, time2) {                     \
+    (res).seconds  = (time1).seconds - (time2).seconds;          \
+    (res).fraction = (time1).fraction - (time2).fraction; \
+    if ((res).fraction > (time1).fraction) {         \
+      (res).seconds--;                               \
+    }                                                \
 }
 
 /*****************************************************************/
@@ -195,10 +197,10 @@ extern "C" {
  * @s: seconds portion of given time
  * @msec: miliseconds portion of given time
  */
-#define NtpTimeAssembFromMs(time, s, msec) {         \
-    register uint32_t ms = msec;                     \
-    (time).seconds  = s;                             \
-    (time).fraction = (ms<<22) + ((ms*393)<<8);      \
+#define NtpTimeAssembFromMs(time, s, msec) {        \
+    register uint32_t ms = msec;                    \
+    (time).seconds  = s;                            \
+    (time).fraction = (ms<<22) + ((ms*393)<<8);             \
 }
 
 /**
@@ -207,11 +209,11 @@ extern "C" {
  * @msec: miliseconds portion of given time
  * @time: time given in NtpTime structure
  */
-#define NtpTimeDisAssembToMs(s, msec, time) {        \
-    s    = (time).seconds;                           \
+#define NtpTimeDisAssembToMs(s, msec, time) {       \
+    s    = (time).seconds;                          \
     msec = ((time).fraction - ((time).fraction>>6) - \
-           ((time).fraction>>7) + (1<<21))>>22;      \
-    if ((msec) >= 1000 ) { (msec) -= 1000; (s)++; }  \
+           ((time).fraction>>7) + (1<<21))>>22;      \
+    if ((msec) >= 1000) { (msec) -= 1000; (s)++; }  \
 }
 
 /**
@@ -220,9 +222,9 @@ extern "C" {
  * @s: seconds portion of given time
  * @usec: microseconds portion of given time
  */
-#define NtpTimeAssembFromUs(time, s, usec) {         \
-    register uint32_t us = usec;                     \
-    (time).seconds  = s;                             \
+#define NtpTimeAssembFromUs(time, s, usec) {        \
+    register uint32_t us = usec;                    \
+    (time).seconds  = s;                            \
     (time).fraction = (us<<12)+ ((us*99)<<1)+ ((us*15 + ((us*61)>>7))>>4); \
 }
 
@@ -232,12 +234,12 @@ extern "C" {
  * @usec: microseconds portion of given time
  * @time: time given in NtpTime structure
  */
-#define NtpTimeDisAssembToUs(s, usec, time) {        \
+#define NtpTimeDisAssembToUs(s, usec, time) {       \
     register uint32_t NtpTemp = (time).fraction;     \
-    s    = (time).seconds;                           \
+    s    = (time).seconds;                          \
     usec = ((time).fraction - (NtpTemp>>5)-(NtpTemp>>7)-(NtpTemp>>8)- \
-            (NtpTemp>>9)-(NtpTemp>>10) - (NtpTemp>>12) - \
-            (NtpTemp>>13)-(NtpTemp>>14) + (1<<11)) >> 12; \
+           (NtpTemp>>9)-(NtpTemp>>10) - (NtpTemp>>12) - \
+           (NtpTemp>>13)-(NtpTemp>>14) + (1<<11)) >> 12; \
     if ((usec) >= 1000000) { (usec) -= 1000000; (s)++; } \
 }
 
@@ -246,8 +248,8 @@ extern "C" {
  * @d: domain
  * @p: port
  */
-#define Domain2Port(d,p) {                   \
-  p = RTPS_DEFAULT_PORT + d*10;              \
+#define Domain2Port(d, p) {                  \
+    p = RTPS_DEFAULT_PORT + d*10;             \
 }
 
 /**
@@ -255,8 +257,8 @@ extern "C" {
  * @d: domain
  * @p: port
  */
-#define Domain2PortMulticastUserdata(d,p) {  \
-    p = RTPS_DEFAULT_PORT + d*10+1;          \
+#define Domain2PortMulticastUserdata(d, p) {  \
+    p = RTPS_DEFAULT_PORT + d*10+1;         \
 }
 
 /**
@@ -264,8 +266,8 @@ extern "C" {
  * @d: domain
  * @p: port
  */
-#define Domain2PortMulticastMetatraffic(d,p) {        \
-    p = RTPS_DEFAULT_PORT + d*10+2;          \
+#define Domain2PortMulticastMetatraffic(d, p) {               \
+    p = RTPS_DEFAULT_PORT + d*10+2;         \
 }
 
 
@@ -279,7 +281,7 @@ extern "C" {
  */
 
 #define ALIGN_ADDRESS(this, boundary) \
-  ((void*)((( ((unsigned long)(this)) + (((unsigned long)(boundary)) -1)) & (~(((unsigned long)(boundary))-1)))))
+  ((void *)((( ((unsigned long)(this)) + (((unsigned long)(boundary)) -1)) & (~(((unsigned long)(boundary))-1)))))
 
 
 #ifdef __cplusplus
index 1e9002de48545a52adbdd6b6c6ee67e98b8d0d93..c8aebca2e7c3b3110117208c0c89e23943107613 100644 (file)
@@ -1,30 +1,30 @@
 /*
  *  $Id: ew_types.h,v 0.0.0.1         2003/09/10
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
+ *
  */
 
 #ifndef _EW_TYPES_H
@@ -46,4 +46,3 @@ extern "C" {
 #endif
 
 #endif  /* _MSC_TYPES_H */
-
index e7475e81782b4c3bfb0aeb70ad021d6de32a91c8..e30e307e7c8ad03af7025963760f2a9ac9fbb94a 100644 (file)
@@ -1,30 +1,30 @@
 /*
- *  $Id: protos_api.h,v 0.0.0.1             2003/09/10 
- *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  $Id: protos_api.h,v 0.0.0.1             2003/09/10
+ *
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
+ *
  */
 
 #ifndef _PROTOS_API_H
@@ -36,15 +36,15 @@ extern "C" {
 
 ///////////////////////////////////////////////////////////////////////////////
 // conv.c
-/** 
+/**
  * IPAddressToString - converts IP address IPAddress to its string representation
  * @ipAddress: source IP address
  * @buff: output buffer
  */
-extern char
-IPAddressToString(IPAddress ipAddress,char *buff);
+extern char *
+IPAddressToString(IPAddress ipAddress, char *buff);
 
-/** 
+/**
  * StringToIPAddress - converts IP address from string into IPAddress
  * @string: source string
  */
@@ -57,7 +57,7 @@ StringToIPAddress(const char *string);
  * @buff: output buffer
  */
 extern char *
-NtpTimeToStringMs(NtpTime time,char *buff);
+NtpTimeToStringMs(NtpTime time, char *buff);
 
 /**
  * NtpTimeToStringUs - converts NtpTime to its text representation in microseconds
@@ -65,7 +65,7 @@ NtpTimeToStringMs(NtpTime time,char *buff);
  * @buff: output buffer
  */
 extern char *
-NtpTimeToStringUs(NtpTime time,char *buff);
+NtpTimeToStringUs(NtpTime time, char *buff);
 
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -84,10 +84,10 @@ NtpTimeToStringUs(NtpTime time,char *buff);
  */
 extern void
 ORTEDomainStart(ORTEDomain *d,
-                Boolean recvUnicastMetatrafficThread,
-                Boolean recvMulticastMetatrafficThread,
-               Boolean recvUnicastUserdataThread,
-               Boolean recvMulticastUserdataThread,
+               Boolean recvUnicastMetatrafficThread,
+               Boolean recvMulticastMetatrafficThread,
+               Boolean recvUnicastUserdataThread,
+               Boolean recvMulticastUserdataThread,
                Boolean sendThread);
 /**
  * ORTEDomainPropDefaultGet - returns default properties of a domain
@@ -114,15 +114,15 @@ ORTEDomainInitEvents(ORTEDomainAppEvents *events);
  * ORTEDomainAppCreate - creates an application object within given domain
  * @domain: given domain
  * @prop: properties of application
- * @events: events associated with application or NULL 
+ * @events: events associated with application or NULL
  * @suspended: specifies whether threads of this application should be started as well (ORTE_FALSE) or stay suspended (ORTE_TRUE). See @ORTEDomainStart for details how to resume
  * suspended threads
  *
  * Creates new Application object and sets its properties and events. Return handle to created object or NULL in case of any error.
  */
-extern ORTEDomain * 
-ORTEDomainAppCreate(int domain,ORTEDomainProp *prop,ORTEDomainAppEvents *events,
-    Boolean suspended);
+extern ORTEDomain *
+ORTEDomainAppCreate(int domain, ORTEDomainProp *prop, ORTEDomainAppEvents *events,
+                   Boolean suspended);
 
 /**
  * ORTEDomainAppDestroy - destroy Application object
@@ -134,29 +134,29 @@ extern Boolean
 ORTEDomainAppDestroy(ORTEDomain *d);
 
 /**
- * ORTEDomainAppSubscriptionPatternAdd - create pattern-based subscription 
- * @d: domain object 
+ * ORTEDomainAppSubscriptionPatternAdd - create pattern-based subscription
+ * @d: domain object
  * @topic: pattern for topic
- * @type: pattern for type 
+ * @type: pattern for type
  * @subscriptionCallBack: pointer to callback function which will be called whenever any data are received through this subscription
  * @param: user params for callback function
  *
- * This function is intended to be used in application interesded in more published data from possibly more remote applications, which should be received through single 
- * subscription. These different publications are specified by pattern given to @topic and @type parameters. 
+ * This function is intended to be used in application interesded in more published data from possibly more remote applications, which should be received through single
+ * subscription. These different publications are specified by pattern given to @topic and @type parameters.
  *
- * For example suppose there are publications of topics like @temperatureEngine1, @temperatureEngine2, @temperatureEngine1Backup and @temperatureEngine2Backup 
- * somewhere on our network. We can subscribe to each of Engine1 temperations by creating single subscription with pattern for topic set to "temperatureEngine1*". 
+ * For example suppose there are publications of topics like @temperatureEngine1, @temperatureEngine2, @temperatureEngine1Backup and @temperatureEngine2Backup
+ * somewhere on our network. We can subscribe to each of Engine1 temperations by creating single subscription with pattern for topic set to "temperatureEngine1*".
  * Or, if we are interested only in values from backup measurements, we can use pattern "*Backup".
- * 
- * Syntax for patterns is the same as syntax for @fnmatch function, which is employed for pattern recognition.  
- * 
+ *
+ * Syntax for patterns is the same as syntax for @fnmatch function, which is employed for pattern recognition.
+ *
  * Returns ORTE_TRUE if successful or ORTE_FALSE in case of any error.
  */
 
-extern Boolean 
-ORTEDomainAppSubscriptionPatternAdd(ORTEDomain *d,const char *topic,
-    const char *type,ORTESubscriptionPatternCallBack subscriptionCallBack, 
-    void *param);
+extern Boolean
+ORTEDomainAppSubscriptionPatternAdd(ORTEDomain *d, const char *topic,
+                                   const char *type, ORTESubscriptionPatternCallBack subscriptionCallBack,
+                                   void *param);
 
 /**
  * ORTEDomainAppSubscriptionPatternRemove - remove subscription pattern
@@ -164,14 +164,14 @@ ORTEDomainAppSubscriptionPatternAdd(ORTEDomain *d,const char *topic,
  * @topic: pattern to be removed
  * @type: pattern to be removed
  *
- * Removes subscritions created by @ORTEDomainAppSubscriptionPatternAdd. Patterns for @type and @topic must be exactly the same strings as when 
+ * Removes subscritions created by @ORTEDomainAppSubscriptionPatternAdd. Patterns for @type and @topic must be exactly the same strings as when
  * @ORTEDomainAppSubscriptionPatternAdd function was called.
  *
  * Returns ORTE_TRUE if successful or ORTE_FALSE if none matching record was found
  */
-extern Boolean 
-ORTEDomainAppSubscriptionPatternRemove(ORTEDomain *d,const char *topic,
-    const char *type);
+extern Boolean
+ORTEDomainAppSubscriptionPatternRemove(ORTEDomain *d, const char *topic,
+                                      const char *type);
 
 /**
  * ORTEDomainAppSubscriptionPatternDestroy - destroys all subscription patterns
@@ -181,7 +181,7 @@ ORTEDomainAppSubscriptionPatternRemove(ORTEDomain *d,const char *topic,
  *
  * Returns ORTE_TRUE if successful or ORTE_FALSE in case of any error.
  */
-extern Boolean 
+extern Boolean
 ORTEDomainAppSubscriptionPatternDestroy(ORTEDomain *d);
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -191,15 +191,15 @@ ORTEDomainAppSubscriptionPatternDestroy(ORTEDomain *d);
  * ORTEDomainMgrCreate - create manager object in given domain
  * @domain: given domain
  * @prop: desired manager's properties
- * @events: manager's event handlers or NULL   
+ * @events: manager's event handlers or NULL
  * @suspended: specifies whether threads of this manager should be started as well (ORTE_FALSE) or stay suspended (ORTE_TRUE). See @ORTEDomainStart for details how to resume
- * suspended threads 
+ * suspended threads
  *
  * Creates new manager object and sets its properties and events. Return handle to created object or NULL in case of any error.
  */
 extern ORTEDomain *
 ORTEDomainMgrCreate(int domain, ORTEDomainProp *prop,
-    ORTEDomainAppEvents *events,Boolean suspended);
+                   ORTEDomainAppEvents *events, Boolean suspended);
 
 /**
  * ORTEDomainMgrDestroy - destroy manager object
@@ -214,25 +214,25 @@ ORTEDomainMgrDestroy(ORTEDomain *d);
 // ORTEPublication.c
 /**
  * ORTEAppPubAdd - creates new publication
- * @d: pointer to application object 
+ * @d: pointer to application object
  * @topic: name of topic
  * @typeName: data type description
  * @instance: output buffer where application stores data for publication
  * @persistence: persistence of publication
  * @strength: strength of publication
- * @sendCallBack: pointer to callback function 
+ * @sendCallBack: pointer to callback function
  * @sendCallBackParam: user parameters for callback function
  * @sendCallBackDelay: periode for timer which issues callback function
  *
  * Creates new publication object with specified parameters. The @sendCallBack function is called periodically with @sendCallBackDelay periode. In strict reliable mode the @sendCallBack
  * function will be called only if there is enough room in transmitting queue in order to prevent any data loss. The @sendCallBack function should prepare data to be published by
- * this publication and place them into @instance buffer. 
+ * this publication and place them into @instance buffer.
  *
  * Returns handle to publication object.
  */
-extern ORTEPublication * 
+extern ORTEPublication *
 ORTEPublicationCreate(ORTEDomain *d,
-                      const char *topic,
+                     const char *topic,
                      const char *typeName,
                      void *instance,
                      NtpTime *persistence,
@@ -257,7 +257,7 @@ ORTEPublicationDestroy(ORTEPublication *cstWriter);
  * Returns ORTE_OK if successful or ORTE_BAD_HANDLE if @cstWriter is not valid cstWriter handle.
  */
 extern int
-ORTEPublicationPropertiesGet(ORTEPublication *cstWriter,ORTEPublProp *pp);
+ORTEPublicationPropertiesGet(ORTEPublication *cstWriter, ORTEPublProp *pp);
 
 /**
  * ORTEPublicationPropertiesSet - set properties of a publication
@@ -267,7 +267,7 @@ ORTEPublicationPropertiesGet(ORTEPublication *cstWriter,ORTEPublProp *pp);
  * Returns ORTE_OK if successful or ORTE_BAD_HANDLE if @cstWriter is not valid publication handle.
  */
 extern int
-ORTEPublicationPropertiesSet(ORTEPublication *cstWriter,ORTEPublProp *pp);
+ORTEPublicationPropertiesSet(ORTEPublication *cstWriter, ORTEPublProp *pp);
 
 /*
  * ORTEAppPublWaitForSubs - waits for given number of subscriptions
@@ -280,20 +280,20 @@ ORTEPublicationPropertiesSet(ORTEPublication *cstWriter,ORTEPublProp *pp);
 */
 extern int
 ORTEPublicationWaitForSubscriptions(ORTEPublication *cstWriter,
-                                    NtpTime wait,
+                                   NtpTime wait,
                                    unsigned int retries,
                                    unsigned int noSubscriptions);
 
 /**
  * ORTEPublicationGetStatus - removes a publication
  * @cstWriter: pointer to cstWriter object which provides this publication
- * @status: pointer to ORTEPublStatus structure 
+ * @status: pointer to ORTEPublStatus structure
  *
  * Returns ORTE_OK if successful or ORTE_BAD_HANDLE if @happ is not valid publication handle.
  */
 
 extern int
-ORTEPublicationGetStatus(ORTEPublication *cstWriter,ORTEPublStatus *status);
+ORTEPublicationGetStatus(ORTEPublication *cstWriter, ORTEPublStatus *status);
 
 /**
  * ORTEPublicationSend - force publication object to issue new data
@@ -301,7 +301,7 @@ ORTEPublicationGetStatus(ORTEPublication *cstWriter,ORTEPublStatus *status);
  *
  * Returns ORTE_OK if successful.
  */
-extern int 
+extern int
 ORTEPublicationSend(ORTEPublication *cstWriter);
 
 /**
@@ -313,7 +313,7 @@ ORTEPublicationSend(ORTEPublication *cstWriter);
  */
 extern int
 ORTEPublicationSendEx(ORTEPublication *cstWriter,
-    ORTEPublicationSendParam *psp);
+                     ORTEPublicationSendParam *psp);
 
 /**
  * ORTEPublicationGetInstance - return pointer to an instance
@@ -336,18 +336,18 @@ ORTEPublicationGetInstance(ORTEPublication *cstWriter);
  * @topic: name of topic
  * @typeName: name of data type
  * @instance: pointer to output buffer
- * @deadline: deadline 
+ * @deadline: deadline
  * @minimumSeparation: minimum time interval between two publications sent by Publisher as requested by Subscriber (strict - minumSep musi byt 0)
  * @recvCallBack: callback function called when new Subscription has been received or if any change of subscription's status occures
- * @recvCallBackParam: user parameters for @recvCallBack 
+ * @recvCallBackParam: user parameters for @recvCallBack
  * @multicastIPAddress: in case multicast subscripton specify multicast IP address or use IPADDRESS_INVALID to unicast communication
  *
  * Returns handle to Subscription object.
  */
-extern ORTESubscription * 
+extern ORTESubscription *
 ORTESubscriptionCreate(ORTEDomain *d,
-                       SubscriptionMode mode,
-                      SubscriptionType sType,    
+                      SubscriptionMode mode,
+                      SubscriptionType sType,
                       const char *topic,
                       const char *typeName,
                       void *instance,
@@ -356,7 +356,7 @@ ORTESubscriptionCreate(ORTEDomain *d,
                       ORTERecvCallBack recvCallBack,
                       void *recvCallBackParam,
                       IPAddress multicastIPAddress);
-                      
+
 /**
  * ORTESubscriptionDestroy - removes a subscription
  * @cstReader: handle to subscriotion to be removed
@@ -369,20 +369,20 @@ ORTESubscriptionDestroy(ORTESubscription *cstReader);
 /**
  * ORTESubscriptionPropertiesGet - get properties of a subscription
  * @cstReader: handle to publication
- * @sp: pointer to ORTESubsProp structure where properties of subscrition will be stored 
+ * @sp: pointer to ORTESubsProp structure where properties of subscrition will be stored
  */
 extern int
-ORTESubscriptionPropertiesGet(ORTESubscription *cstReader,ORTESubsProp *sp);
+ORTESubscriptionPropertiesGet(ORTESubscription *cstReader, ORTESubsProp *sp);
 
 /**
  * ORTESubscriptionPropertiesSet - set properties of a subscription
  * @cstReader: handle to publication
  * @sp: pointer to ORTESubsProp structure containing desired properties of the subscription
  *
- * Returns ORTE_OK if successful or ORTE_BAD_HANDLE if @cstReader is not valid subscription handle. 
+ * Returns ORTE_OK if successful or ORTE_BAD_HANDLE if @cstReader is not valid subscription handle.
  */
 extern int
-ORTESubscriptionPropertiesSet(ORTESubscription *cstReader,ORTESubsProp *sp);
+ORTESubscriptionPropertiesSet(ORTESubscription *cstReader, ORTESubsProp *sp);
 
 /**
  * ORTESubscriptionWaitForPublications - waits for given number of publications
@@ -394,8 +394,8 @@ ORTESubscriptionPropertiesSet(ORTESubscription *cstReader,ORTESubsProp *sp);
  * Returns ORTE_OK if successful or ORTE_BAD_HANDLE if @cstReader is not valid subscription handle or ORTE_TIMEOUT if number of retries has been exhausted..
  */
 extern int
-ORTESubscriptionWaitForPublications(ORTESubscription *cstReader,NtpTime wait,
-    unsigned int retries,unsigned int noPublications);
+ORTESubscriptionWaitForPublications(ORTESubscription *cstReader, NtpTime wait,
+                                   unsigned int retries, unsigned int noPublications);
 
 /**
  * ORTESubscriptionGetStatus - get status of a subscription
@@ -405,7 +405,7 @@ ORTESubscriptionWaitForPublications(ORTESubscription *cstReader,NtpTime wait,
  * Returns ORTE_OK if successful or ORTE_BAD_HANDLE if @cstReader is not valid subscription handle.
  */
 extern int
-ORTESubscriptionGetStatus(ORTESubscription *cstReader,ORTESubsStatus *status);
+ORTESubscriptionGetStatus(ORTESubscription *cstReader, ORTESubsStatus *status);
 
 /**
  * ORTESubscriptionPull - read data from receiving buffer
@@ -445,8 +445,8 @@ ORTESubscriptionGetInstance(ORTESubscription *cstReader);
  * Returns ORTE_OK if new data type has been succesfully registered.
  */
 extern int
-ORTETypeRegisterAdd(ORTEDomain *d,const char *typeName,ORTETypeSerialize ts,
-                    ORTETypeDeserialize ds,ORTETypeGetMaxSize gms,unsigned int ms);
+ORTETypeRegisterAdd(ORTEDomain *d, const char *typeName, ORTETypeSerialize ts,
+                   ORTETypeDeserialize ds, ORTETypeGetMaxSize gms, unsigned int ms);
 /**
  * ORTETypeRegisterDestroyAll - destroy all registered data types
  * @d: domain object handle
@@ -467,7 +467,7 @@ ORTETypeRegisterDestroyAll(ORTEDomain *d);
  * There are 10 levels of verbosity ranging from 1 (lowest) to 10 (highest).
  * It is possible to specify certain level of verbosity for each module of ORTE library. List of all supported modules can be found in  linorte/usedSections.txt file.
  * Every module has been aasigned with a number as can be seen in usedSections.txt file.
- * 
+ *
  * For instance:
  * options = "ALL,7"
  * Verbosity will be set to level 7 for all modules.
@@ -475,12 +475,12 @@ ORTETypeRegisterDestroyAll(ORTEDomain *d);
  * options = "51,7:32,5"
  * Modules 51 (RTPSCSTWrite.c) will use verbosity level 7 and module 32 (ORTEPublicationTimer.c) will use verbosity level 5.
  *
- * Maximum number of modules and verbosity levels can be changed in order to save some memory space if small memory footprint is neccessary. These values are defined as macros 
+ * Maximum number of modules and verbosity levels can be changed in order to save some memory space if small memory footprint is neccessary. These values are defined as macros
  * MAX_DEBUG_SECTIONS and MAX_DEBUG_LEVEL in file @include/defines.h.
  *
  * Return ORTE_OK if desired verbosity levels were successfuly set.
  */
-extern void 
+extern void
 ORTEVerbositySetOptions(const char *options);
 
 /**
@@ -489,7 +489,7 @@ ORTEVerbositySetOptions(const char *options);
  *
  * Sets output file where debug messages will be writen to. By default these messages are written to stdout.
  */
-extern void 
+extern void
 ORTEVerbositySetLogFile(const char *logfile);
 
 
@@ -499,8 +499,9 @@ ORTEVerbositySetLogFile(const char *logfile);
 /**
  * ORTEInit - initialization of ORTE layer (musi se zavolat)
 */
-extern void ORTEInit(void);
+
+extern void
+ORTEInit(void);
 
 ///////////////////////////////////////////////////////////////////////////////
 // ORTEMisc.c
index d70d3a8e8762f7d38773c0bf539adcf0196a8bee..6a202b0ce475df205efbd7700bbb58c2843e9af2 100644 (file)
@@ -1,30 +1,30 @@
 /*
- *  $Id: typedefs_api.h,v 0.0.0.1       2003/08/21 
+ *  $Id: typedefs_api.h,v 0.0.0.1       2003/08/21
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
+ *
  */
 
 #ifndef _TYPEDEFS_API_H
@@ -41,14 +41,14 @@ typedef struct CSTReader ORTESubscription;        //forward declaration
 /**
  * enum SubscriptionMode - mode of subscription
  * @PULLED: polled
- * @IMMEDIATE: using callback function 
+ * @IMMEDIATE: using callback function
  *
  * Specifies whether user application will poll for data or whether a callback function will be called by ORTE middleware when new data will be available.
  */
 typedef enum SubscriptionMode {
-        PULLED           = 0x01,
-        IMMEDIATE        = 0x02
-      } SubscriptionMode;
+  PULLED           = 0x01,
+  IMMEDIATE        = 0x02
+} SubscriptionMode;
 
 /**
  * enum SubscriptionType - type of subcsription
@@ -58,21 +58,21 @@ typedef enum SubscriptionMode {
  * Specifies which mode will be used for this subscription.
  */
 typedef enum SubscriptionType {
-        BEST_EFFORTS     = 0x01,
-        STRICT_RELIABLE  = 0x02
-      } SubscriptionType;
+  BEST_EFFORTS     = 0x01,
+  STRICT_RELIABLE  = 0x02
+} SubscriptionType;
 
 /**
  * enum ORTERecvStatus - status of a subscription
  * @NEW_DATA: new data has arrived
- * @DEADLINE: deadline has occurred 
+ * @DEADLINE: deadline has occurred
  *
  * Specifies which event has occurred in the subscription object.
  */
 typedef enum ORTERecvStatus {
-        NEW_DATA         = 0x01, 
-        DEADLINE         = 0x02
-      } ORTERecvStatus;
+  NEW_DATA         = 0x01,
+  DEADLINE         = 0x02
+} ORTERecvStatus;
 
 /**
  * enum ORTESendStatus - status of a publication
@@ -82,12 +82,12 @@ typedef enum ORTERecvStatus {
  * Specifies which event has occurred in the publication object. Critical level of transmit queue is specified as one of publication properties (ORTEPublProp.criticalQueueLevel).
  */
 typedef enum ORTESendStatus {
-        NEED_DATA        = 0x01,
-        CQL              = 0x02
-      } ORTESendStatus;
+  NEED_DATA        = 0x01,
+  CQL              = 0x02
+} ORTESendStatus;
 
 /**
- * struct ORTEIFProp - interface flags 
+ * struct ORTEIFProp - interface flags
  * @ifFlags: flags
  * @ipAddress: IP address
  *
@@ -103,7 +103,7 @@ typedef struct ORTEIFProp {
  * @enabled: ORTE_TRUE if multicast enabled otherwise ORTE_FALSE
  * @ttl: time-to-live (TTL) for sent datagrams
  * @loopBackEnabled: ORTE_TRUE if data should be received by sender itself otherwise ORTE_FALSE
- * @ipAddress: desired multicast IP address 
+ * @ipAddress: desired multicast IP address
  *
  * Properties for ORTE multicast subsystem which is not fully supported yet. Multicast IP address is assigned by the ORTE middleware itself.
  */
@@ -117,11 +117,11 @@ typedef struct ORTEMulticastProp {
 
 /**
  * struct ORTETypeGetMaxSizeParam - parameters for function ORTETypeGetMaxSize
- * @host_endian: 
- * @data_endian: 
- * @data: 
- * @max_size: 
- * @recv_size: 
+ * @host_endian:
+ * @data_endian:
+ * @data:
+ * @max_size:
+ * @recv_size:
  * @csize:
  *
  * It used to determine maximal size of intermal buffer for incomming data
@@ -143,7 +143,7 @@ typedef int (*ORTETypeGetMaxSize)(ORTEGetMaxSizeParam *gms, int num);
 
 /**
  * struct ORTETypeRegister - registered data type
- * @typeName: name of data type 
+ * @typeName: name of data type
  * @serialize: pointer to serialization function
  * @deserialize: pointer to deserialization function
  * @getMaxSize: pointer to function given maximal data length
@@ -156,7 +156,7 @@ typedef struct ORTETypeRegister {
   ORTETypeSerialize      serialize;
   ORTETypeDeserialize    deserialize;
   ORTETypeGetMaxSize     getMaxSize;
-  unsigned int          maxSize;
+  unsigned int           maxSize;
 } ORTETypeRegister;
 
 /**
@@ -179,10 +179,10 @@ typedef struct ORTETypeRegister {
  * @maxBlockTime: timeout for send functions if sending queue is full (default 30s)
  */
 typedef struct ORTEDomainBaseProp {
-  unsigned int          registrationMgrRetries;
-  NtpTime               registrationMgrPeriod;
-  unsigned int          registrationAppRetries;
-  NtpTime               registrationAppPeriod;
+  unsigned int           registrationMgrRetries;
+  NtpTime                registrationMgrPeriod;
+  unsigned int           registrationAppRetries;
+  NtpTime                registrationAppPeriod;
   NtpTime                expirationTime;
   NtpTime                refreshPeriod;
   NtpTime                purgeTime;
@@ -200,7 +200,7 @@ typedef struct ORTEDomainBaseProp {
  * @metaBytesPerPacket: maximum number of bytes in single frame (default 1500B)
  * @metaBytesPerFastPacket: maximum number of bytes in single frame if transmitting queue has reached @criticalQueueLevel level (see @ORTEPublProp struct)
  * @metabitsPerACKBitmap: not supported yet (default 32)
- * @userMaxSerDeserSize: maximum number of user data in frame (default 0x3000B) 
+ * @userMaxSerDeserSize: maximum number of user data in frame (default 0x3000B)
  */
 typedef struct ORTEDomainWireProp {
   unsigned int           metaBytesPerPacket;
@@ -212,14 +212,14 @@ typedef struct ORTEDomainWireProp {
 /**
  * struct ORTEPublProp - properties of a publication
  * @topic: the name of the information in the Network that is published or subscribed to
- * @typeName: the name of the type of this data 
+ * @typeName: the name of the type of this data
  * @typeChecksum: a checksum that identifies the CDR-representation of the data
  * @expectsAck: indicates wherther publication expects to receive ACKs to its messages
  * @persistence: indicates how long the issue is valid
  * @reliabilityOffered: reliability policy as offered by the publication
  * @sendQueueSize: size of transmitting queue
  * @strength: precedence of the issue sent by the publication
- * @criticalQueueLevel: treshold for transmitting queue content length indicating the queue can became full immediately 
+ * @criticalQueueLevel: treshold for transmitting queue content length indicating the queue can became full immediately
  * @HBNornalRate: how often send HBs to subscription objects
  * @HBCQLRate: how often send HBs to subscription objects if transmittiong queue has reached @criticalQueueLevel
  * @HBMaxRetries: how many times retransmit HBs if no replay from target object has not been received
@@ -227,7 +227,7 @@ typedef struct ORTEDomainWireProp {
  */
 typedef struct ORTEPublProp {
   PathName               topic;
-  TypeName               typeName; 
+  TypeName               typeName;
   TypeChecksum           typeChecksum;
   Boolean                expectsAck;
   NtpTime                persistence;
@@ -263,11 +263,11 @@ typedef struct ORTESubsProp {
   //additional parameters
   NtpTime                deadline;
   uint32_t               mode;
-  IPAddress             multicast;
+  IPAddress              multicast;
 }  ORTESubsProp;
 
 /**
- * struct ORTEAppInfo - 
+ * struct ORTEAppInfo -
  * @hostId: hostId of application
  * @appId: appId of application
  * @unicastIPAddressList: unicast IP addresses of the host on which the application runs (there can be multiple addresses on a multi-NIC host)
@@ -308,7 +308,7 @@ typedef struct ORTEPubInfo {
  * struct ORTEPubInfo - information about subscription
  * @topic: the name of the information in the Network that is published or subscribed to
  * @type: the name of the type of this data
- * @objectId: object with this subscription 
+ * @objectId: object with this subscription
  */
 typedef struct ORTESubInfo {
   const char            *topic;
@@ -348,7 +348,7 @@ typedef struct ORTESubsStatus {
  * @senderGUID: GUID of object who sent this information
  * @localTimeReceived: local timestamp when data were received
  * @remoteTimePublished: remote timestam when data were published
- * @sn: sequencial number of data 
+ * @sn: sequencial number of data
  * @data_endian: endianness of received data
  */
 typedef struct ORTERecvInfo {
@@ -368,7 +368,7 @@ typedef struct ORTERecvInfo {
  * @topic: the name of the information
  * @type: the name of the type of this information
  * @senderGUID: GUID of object who sent this information
- * @sn: sequencial number of information 
+ * @sn: sequencial number of information
  */
 typedef struct ORTESendInfo {
   ORTESendStatus        status;
@@ -380,11 +380,11 @@ typedef struct ORTESendInfo {
 
 //CallBackRoutines
 
-typedef void 
-(*ORTERecvCallBack)(const ORTERecvInfo *info,void *instance, void *recvCallBackParam);
-typedef void 
-(*ORTESendCallBack)(const ORTESendInfo *info,void *instance, void *sendCallBackParam);
-typedef ORTESubscription*
+typedef void
+(*ORTERecvCallBack)(const ORTERecvInfo *info, void *instance, void *recvCallBackParam);
+typedef void
+(*ORTESendCallBack)(const ORTESendInfo *info, void *instance, void *sendCallBackParam);
+typedef ORTESubscription *
 (*ORTESubscriptionPatternCallBack)(const char *topic, const char *type, void *Param);
 
 /**
@@ -394,49 +394,49 @@ typedef ORTESubscription*
  */
 typedef struct ORTEPublicationSendParam {
   void                  *instance;
-  int                  data_endian;
+  int                   data_endian;
 } ORTEPublicationSendParam;
 
 //Pattern
 typedef Boolean
 (*ORTEPatternCheck)(const char *string);
 typedef Boolean
-(*ORTEPatternMatch)(const char *topic,const char *pattern,void *param);
+(*ORTEPatternMatch)(const char *topic, const char *pattern, void *param);
 extern Boolean
 ORTEPatternCheckDefault(const char *topic);
 extern Boolean
-ORTEPatternMatchDefault(const char *topic,const char *pattern,void *param);
+ORTEPatternMatchDefault(const char *topic, const char *pattern, void *param);
 extern void
-ORTEPatternRegister(ORTEDomain *d,ORTEPatternCheck check,
-     ORTEPatternMatch match,void *param);
+ORTEPatternRegister(ORTEDomain *d, ORTEPatternCheck check,
+                   ORTEPatternMatch match, void *param);
 
 
 //Manager
 typedef void
 (*ORTEOnRegFail)(void *param);
-typedef Boolean 
+typedef Boolean
 (*ORTEOnMgrNew)(const struct ORTEAppInfo *appInfo, void *param);
-typedef void 
+typedef void
 (*ORTEOnMgrDelete)(const struct ORTEAppInfo *appInfo, void *param);
 //Application
-typedef Boolean 
+typedef Boolean
 (*ORTEOnAppRemoteNew)(const struct ORTEAppInfo *appInfo, void *param);
 typedef void (*ORTEOnAppDelete)
-(const struct ORTEAppInfo *appInfo, void *param);
+  (const struct ORTEAppInfo *appInfo, void *param);
 //Publication
-typedef Boolean 
+typedef Boolean
 (*ORTEOnPubRemote)(const struct ORTEAppInfo *appInfo,
-                   const struct ORTEPubInfo *pubInfo, void *param);
-typedef void 
+                  const struct ORTEPubInfo *pubInfo, void *param);
+typedef void
 (*ORTEOnPubDelete)(const struct ORTEAppInfo *appInfo,
-                   const struct ORTEPubInfo *pubInfo, void *param);
+                  const struct ORTEPubInfo *pubInfo, void *param);
 //Subscription
-typedef Boolean 
+typedef Boolean
 (*ORTEOnSubRemote)(const struct ORTEAppInfo *appInfo,
-                   const struct ORTESubInfo *subInfo, void *param);
-typedef void 
+                  const struct ORTESubInfo *subInfo, void *param);
+typedef void
 (*ORTEOnSubDelete)(const struct ORTEAppInfo *appInfo,
-                   const struct ORTESubInfo *subInfo, void *param);
+                  const struct ORTESubInfo *subInfo, void *param);
 
 /**
  * struct ORTEDomainAppEvents - Domain event handlers of an application
@@ -491,12 +491,12 @@ typedef struct ORTEDomainAppEvents {
 } ORTEDomainAppEvents;
 
 /**
- * struct ORTETaskProp - ORTE task properties, not supported 
+ * struct ORTETaskProp - ORTE task properties, not supported
  * @realTimeEnabled: not supported
  * @smtStackSize: not supported
  * @smtPriority: not supported
  * @rmtStackSize: not supported
- * @rmtPriority: not supported 
+ * @rmtPriority: not supported
  */
 typedef struct ORTETasksProp {
   Boolean                realTimeEnabled;
@@ -504,21 +504,21 @@ typedef struct ORTETasksProp {
   int                    smtPriority;
   int                    rmtStackSize;
   int                    rmtPriority;
-} ORTETasksProp; 
+} ORTETasksProp;
 
 /**
- * struct ORTEDomainApp - domain properties 
+ * struct ORTEDomainApp - domain properties
  * @tasksProp: task properties
  * @IFProp: properties of network interfaces
- * @IFCount: number of network interfaces             
+ * @IFCount: number of network interfaces
  * @baseProp: base properties (see @ORTEDomainBaseProp for details)
  * @wireProp: wire properties (see @ORTEDomainWireProp for details)
- * @multicast: multicast properties (see @ORTEMulticastProp for details)              
- * @publPropDefault: default properties of publiciations (see @ORTEPublProp for details)      
+ * @multicast: multicast properties (see @ORTEMulticastProp for details)
+ * @publPropDefault: default properties of publiciations (see @ORTEPublProp for details)
  * @subsPropDefault: default properties of subscriptions (see @ORTESubsProp for details)
- * @mgrs: list of known managers              
- * @keys: access keys for managers            
- * @appLocalManager: IP address of local manager (default localhost)      
+ * @mgrs: list of known managers
+ * @keys: access keys for managers
+ * @appLocalManager: IP address of local manager (default localhost)
  * @listen: IP address to listen on
  * @version: string product version
  * @recvBuffSize: receiving queue length
@@ -539,7 +539,7 @@ typedef struct ORTEDomainProp {
   IPAddress              listen;
   char                   version[60];             //string product version
   int                    recvBuffSize;
-  int                    sendBuffSize;      
+  int                    sendBuffSize;
 } ORTEDomainProp;
 
 #ifdef __cplusplus
@@ -547,4 +547,3 @@ typedef struct ORTEDomainProp {
 #endif
 
 #endif  /* _TYPEDEFS_API_H */
-
index ea1c2ac13740a5bf017e3492d913d7779d490bcb..8703c25cac09d2df76a72be93dbb459bd7b66c84 100644 (file)
@@ -1,32 +1,32 @@
 /*
- *  $Id: typedefs_defines_rtps.h,v 0.0.0.1 2003/08/21 
+ *  $Id: typedefs_defines_rtps.h,v 0.0.0.1 2003/08/21
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
+ *
  */
+
 #ifndef _TYPEDEFS_DEFINES_RTPS_H
 #define _TYPEDEFS_DEFINES_RTPS_H
 
@@ -52,10 +52,10 @@ typedef int32_t                  TypeChecksum;
 /*             Wire Protocol Specification (WPS)                 */
 /*****************************************************************/
 
-         
+
 /*
   Host identifier.
-   
+
   for example: IP address working nodes
 */
 typedef uint32_t                 HostId;
@@ -63,9 +63,9 @@ typedef uint32_t                 HostId;
 
 /*
   Application identifier.
+
   composed from: 3 bytes - instance Id
-                 1 byte  - appKind (1 - ManagedApplication, 2 - Manager) 
+                 1 byte  - appKind (1 - ManagedApplication, 2 - Manager)
 */
 typedef uint32_t                 AppId;
 #define AID_UNKNOWN              0x00
@@ -74,9 +74,9 @@ typedef uint32_t                 AppId;
 
 /*
   Object identifier.
-   
+
   composed from: 3 bytes - instance Id
-                 1 byte  - objKind  
+                 1 byte  - objKind
 */
 typedef uint32_t                 ObjectId;
 
@@ -105,45 +105,45 @@ typedef uint32_t                 ObjectId;
 #define OID_RESMETAOBJ       0xC0
 
 typedef struct {
-       HostId                hid;
-       AppId                 aid;
-       ObjectId              oid;
-     } GUID_RTPS;    
+  HostId                hid;
+  AppId                 aid;
+  ObjectId              oid;
+} GUID_RTPS;
 
 typedef struct {
-       int8_t                major;
-       int8_t                minor;
-     } VendorId;
+  int8_t                major;
+  int8_t                minor;
+} VendorId;
 
-#define VENDOR_ID_UNKNOWN(id)    {id.major=0;id.minor=0;}
-#define VENDOR_ID_RTI(id)        {id.major=1;id.minor=1;}
-#define VENDOR_ID_OCERA(id)      {id.major=0;id.minor=0;}
+#define VENDOR_ID_UNKNOWN(id)    {id.major = 0; id.minor = 0; }
+#define VENDOR_ID_RTI(id)        {id.major = 1; id.minor = 1; }
+#define VENDOR_ID_OCERA(id)      {id.major = 0; id.minor = 0; }
 
 typedef struct {
-       int8_t                major;
-       int8_t                minor;
-     } ProtocolVersion;
+  int8_t                major;
+  int8_t                minor;
+} ProtocolVersion;
 
-#define PROTOCOL_VERSION_1_0(pv) {pv.major=1;pv.minor=0;}
+#define PROTOCOL_VERSION_1_0(pv) {pv.major = 1; pv.minor = 0; }
 
 typedef struct {
-       int32_t               high;
-       int32_t               low;
-     } SequenceNumber;
+  int32_t               high;
+  int32_t               low;
+} SequenceNumber;
 
 
-#define SEQUENCE_NUMBER_NONE(sn)    {sn.high=0;sn.low=0;}
-#define SEQUENCE_NUMBER_UNKNOWN(sn) {sn.high=0x7fffffff;sn.low=0xffffffff;}
+#define SEQUENCE_NUMBER_NONE(sn)    {sn.high = 0; sn.low = 0; }
+#define SEQUENCE_NUMBER_UNKNOWN(sn) {sn.high = 0x7fffffff; sn.low = 0xffffffff; }
 
 
 typedef struct {
-       int32_t               seconds;    /* time in seconds */
-       uint32_t              fraction;   /* time in seconds / 2^32 */
-     } NtpTime;
+  int32_t               seconds;         /* time in seconds */
+  uint32_t              fraction;        /* time in seconds / 2^32 */
+} NtpTime;
 
-#define NTPTIME_ZERO(t)          {t.seconds=0;t.fraction=0;}
-#define NTPTIME_BUILD(t,s)       {t.seconds=s;t.fraction=0;}
-#define NTPTIME_INFINITE(t)      {t.seconds=0xffffffff;t.fraction=0;}
+#define NTPTIME_ZERO(t)          {t.seconds = 0; t.fraction = 0; }
+#define NTPTIME_BUILD(t, s)       {t.seconds = s; t.fraction = 0; }
+#define NTPTIME_INFINITE(t)      {t.seconds = 0xffffffff; t.fraction = 0; }
 
 typedef uint32_t                 IPAddress;
 
@@ -154,38 +154,38 @@ typedef uint32_t                 Port;
 #define PORT_INVALID             0
 
 typedef enum {
-       PAD                       = 0x01,
-       VAR                       = 0x02,
-       ISSUE                     = 0x03,
-       ACK                       = 0x06,
-       HEARTBEAT                 = 0x07,
-       GAP                       = 0x08,
-       INFO_TS                   = 0x09,
-       INFO_SRC                  = 0x0c,
-       INFO_REPLY                = 0x0d,
-       INFO_DST                  = 0x0e,
-       APP_QUIT                  = 0x90
-     } SubmessageId;
+  PAD                       = 0x01,
+  VAR                       = 0x02,
+  ISSUE                     = 0x03,
+  ACK                       = 0x06,
+  HEARTBEAT                 = 0x07,
+  GAP                       = 0x08,
+  INFO_TS                   = 0x09,
+  INFO_SRC                  = 0x0c,
+  INFO_REPLY                = 0x0d,
+  INFO_DST                  = 0x0e,
+  APP_QUIT                  = 0x90
+} SubmessageId;
 
 typedef struct {
-       ProtocolVersion           sourceVersion;
-       VendorId                  sourceVendorId;
-       HostId                    sourceHostId;
-       AppId                     sourceAppId;
-       HostId                    destHostId;
-       AppId                     destAppId;
-       IPAddress                 unicastReplyIPAddress;
-       Port                      unicastReplyPort;
-       IPAddress                 multicastReplyIPAddress;
-       Port                      multicastReplyPort;
-       Boolean                   haveTimestamp;
-       NtpTime                   timestamp;          
-     } MessageInterpret;
+  ProtocolVersion           sourceVersion;
+  VendorId                  sourceVendorId;
+  HostId                    sourceHostId;
+  AppId                     sourceAppId;
+  HostId                    destHostId;
+  AppId                     destAppId;
+  IPAddress                 unicastReplyIPAddress;
+  Port                      unicastReplyPort;
+  IPAddress                 multicastReplyIPAddress;
+  Port                      multicastReplyPort;
+  Boolean                   haveTimestamp;
+  NtpTime                   timestamp;
+} MessageInterpret;
 
 
 #define PID_PAD                             0x00
 #define PID_SENTINEL                        0x01
-#define PID_EXPIRATION_TIME                 0x02     
+#define PID_EXPIRATION_TIME                 0x02
 #define PID_PERSISTENCE                     0x03
 #define PID_MINIMUM_SEPARATION              0x04
 #define PID_TOPIC                           0x05
@@ -220,40 +220,40 @@ typedef uint16_t ParameterLength;
 
 /* State Machines */
 typedef enum {
-        MAYSENDHB                           = 0x01,
-        MUSTSENDHB                          = 0x02,
-        SENDHB                              = 0x03
-      } StateMachineHB;
+  MAYSENDHB                           = 0x01,
+  MUSTSENDHB                          = 0x02,
+  SENDHB                              = 0x03
+} StateMachineHB;
 
 typedef enum {
-        NOTHNIGTOSEND                       = 0x01,
-        MUSTSENDDATA                        = 0x02
-      } StateMachineSend;
+  NOTHNIGTOSEND                       = 0x01,
+  MUSTSENDDATA                        = 0x02
+} StateMachineSend;
 
 typedef enum {
-        NEW                                 = 0x01,
-        TOSEND                              = 0x02,
-        UNDERWAY                            = 0x03,
-        UNACKNOWLEDGED                      = 0x04,
-        ANNOUCED                            = 0x05,
-        ACKNOWLEDGED                        = 0x06
-      } StateMachineChFReader;
+  NEW                                 = 0x01,
+  TOSEND                              = 0x02,
+  UNDERWAY                            = 0x03,
+  UNACKNOWLEDGED                      = 0x04,
+  ANNOUCED                            = 0x05,
+  ACKNOWLEDGED                        = 0x06
+} StateMachineChFReader;
 
 typedef enum {
-        WAITING                             = 0x01,
-        PULLING                             = 0x02,
-        ACKPENDING                          = 0x03
-      } StateMachineACK;
+  WAITING                             = 0x01,
+  PULLING                             = 0x02,
+  ACKPENDING                          = 0x03
+} StateMachineACK;
 
 typedef enum {
-        FUTURE                              = 0x01,
-        REQUESTED                           = 0x02,
-        MISSING                             = 0x03,
-        RECEIVED                            = 0x04
-      } StateMachineChFWriter;
+  FUTURE                              = 0x01,
+  REQUESTED                           = 0x02,
+  MISSING                             = 0x03,
+  RECEIVED                            = 0x04
+} StateMachineChFWriter;
 
 #ifdef __cplusplus
 } /* extern "C"*/
 #endif
-            
+
 #endif /* _TYPEDEFS_DEFINES_RTPS_H */
index 00e694c8c3fcffa09209346f26d8627863b87a12..b96b1fcbff30a2b13ac59d02c63e23b160e186bd 100644 (file)
@@ -1,30 +1,30 @@
 /*
- *  $Id: orte.h,v 0.0.0.1               2003/08/21 
+ *  $Id: orte.h,v 0.0.0.1               2003/08/21
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
+ *
  */
 
 #ifndef _ORTE_H
@@ -44,7 +44,7 @@ extern "C" {
 #include "ul_gavlrepcust.h"
 #include "ul_list.h"
 #include "orte/typedefs_defines_rtps.h"
-#include "ul_htimer.h"          //after typedefs_defines_rtps.h 
+#include "ul_htimer.h"          //after typedefs_defines_rtps.h
 #include "defines.h"
 #include "orte/defines_api.h"
 #include "orte/typedefs_api.h"
index 23167ca956b60c545c61046dda991411ab845598..8160831a6b4f023d0f1eeb078509cb104ba01eff 100644 (file)
@@ -1,30 +1,30 @@
 /*
- *  $Id: orte_headers.h,v 0.0.0.1       2003/08/21 
+ *  $Id: orte_headers.h,v 0.0.0.1       2003/08/21
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
+ *
  */
 
 #ifndef _ORTE_ALL_H
@@ -185,9 +185,9 @@ extern "C" {
 #endif
 
 #ifdef CONFIG_ORTE_UNIX
-  #define SOCK_BSD       
+  #define SOCK_BSD
 #elif CONFIG_ORTE_CYGWIN
-  #define SOCK_BSD         
+  #define SOCK_BSD
 #elif CONFIG_ORTE_MINGW
   #define SOCK_WIN
   #ifndef HAVE_PTHREAD_H
@@ -204,7 +204,7 @@ extern "C" {
 #elif defined CONFIG_ORTE_RTL
   #include <rtl/rwlock.h>
   #ifdef CONFIG_ORTE_RTL_ONETD
-    #define SOCK_BSD         
+    #define SOCK_BSD
     #include <rtl/compat_onetd.h>
   #elif CONFIG_ORTE_RTL_WIP
     #define SOCK_RTLWIP
@@ -213,7 +213,7 @@ extern "C" {
     #error "no UDP stack for RTLinux"
   #endif
 #elif defined CONFIG_ORTE_RTAI
-  #define SOCK_BSD  
+  #define SOCK_BSD
   #include <rtai/compat.h>
 #elif defined _MSC_VER
   #define SOCK_WIN
@@ -245,7 +245,7 @@ extern "C" {
   #define ioctl ioctlsocket
   #define ORTE_PACKAGE_STRING "orte 0.3.4"
   #define CONFIG_ORTE_WIN
-#endif
+#endif /* ifdef CONFIG_ORTE_UNIX */
 
 #ifdef __cplusplus
 } /* extern "C"*/
index 93eb344624e38cb570316b0f701349ef4d532ff8..5e7fe28d3ba7052171cece211debf765983ec5be 100644 (file)
@@ -1,30 +1,30 @@
 /*
- *  $Id: protos.h,v 0.0.0.1             2003/08/21 
+ *  $Id: protos.h,v 0.0.0.1             2003/08/21
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
+ *
  */
 
 #ifndef _PROTOS_H
@@ -45,75 +45,75 @@ sock_init_udp(sock_t *sock);
 extern void
 sock_cleanup(sock_t *sock);
 extern int
-sock_setsockopt(sock_t *sock,int level,int optname,const char *optval, int optlen);
+sock_setsockopt(sock_t *sock, int level, int optname, const char *optval, int optlen);
 extern int
-sock_getsockopt(sock_t *sock,int level,int optname,char *optval, int *optlen);
+sock_getsockopt(sock_t *sock, int level, int optname, char *optval, int *optlen);
 extern int
-sock_bind(sock_t *sock,uint16_t port, IPAddress listen);
+sock_bind(sock_t *sock, uint16_t port, IPAddress listen);
 extern int
-sock_recvfrom(sock_t *sock, void *buf, int max_len,struct sockaddr_in *des,int des_len);
+sock_recvfrom(sock_t *sock, void *buf, int max_len, struct sockaddr_in *des, int des_len);
 extern int
-sock_sendto(sock_t *sock, void *buf, int len,struct sockaddr_in *des,int des_len);
+sock_sendto(sock_t *sock, void *buf, int len, struct sockaddr_in *des, int des_len);
 extern int
 sock_ioctl(sock_t *sock, long cmd, unsigned long *arg);
 extern int
-sock_get_local_interfaces(sock_t *sock,ORTEIFProp *IFProp,char *IFCount);
+sock_get_local_interfaces(sock_t *sock, ORTEIFProp *IFProp, char *IFCount);
 
 ///////////////////////////////////////////////////////////////////////////////
 // conv.c
 extern int
-getStringPart(char *string,char divChar,int *iterator,char *buff);
+getStringPart(char *string, char divChar, int *iterator, char *buff);
 
 ///////////////////////////////////////////////////////////////////////////////
 // htimerNtp.c
 // htimerRoot
-UL_HTIMER_DEC(htimerRoot,          /* prefix */
-             ObjectEntry,          /* queue_t */
-             HTimFncRootNode,      /* timer_t */
-             htimRoot,             /* queue_field */
-             htim)                 /* timer_field */
-extern void
-htimerRoot_run_expired(ORTEDomain *d, 
-      ul_htim_time_t *pact_time);
+UL_HTIMER_DEC(htimerRoot,           /* prefix */
+             ObjectEntry,          /* queue_t */
+             HTimFncRootNode,      /* timer_t */
+             htimRoot,             /* queue_field */
+             htim)                 /* timer_field */
+extern void
+htimerRoot_run_expired(ORTEDomain *d,
+                      ul_htim_time_t *pact_time);
 // htimerUnicastCommon
 UL_HTIMER_DEC(htimerUnicastCommon,  /* prefix */
-             ObjectEntryAID,       /* queue_t */
-             HTimFncUserNode,      /* timer_t */
+             ObjectEntryAID,       /* queue_t */
+             HTimFncUserNode,      /* timer_t */
              htimUnicast.common,   /* queue_field */
-             htim)                 /* timer_field */
+             htim)                 /* timer_field */
 extern void
 htimerUnicastCommon_update_root_timer(ObjectEntry *objectEntry,
-      ObjectEntryAID *objectEntryAID);
-extern void 
+                                     ObjectEntryAID *objectEntryAID);
+extern void
 htimerUnicastCommon_run_expired(ORTEDomain *d,
-      ObjectEntryAID *objectEntryAID, 
-      ul_htim_time_t *pact_time);
+                               ObjectEntryAID *objectEntryAID,
+                               ul_htim_time_t *pact_time);
 // htimerUnicastSendMetatraffic
 UL_HTIMER_DEC(htimerUnicastSendMetatraffic,  /* prefix */
-             ObjectEntryAID,                /* queue_t */
-             HTimFncUserNode,               /* timer_t */
+             ObjectEntryAID,                /* queue_t */
+             HTimFncUserNode,               /* timer_t */
              htimUnicast.sendMetatraffic,   /* queue_field */
-             htim)                          /* timer_field */
+             htim)                          /* timer_field */
 extern void
 htimerUnicastSendMetatraffic_update_root_timer(ObjectEntry *objectEntry,
-      ObjectEntryAID *objectEntryAID);
-extern void 
+                                              ObjectEntryAID *objectEntryAID);
+extern void
 htimerUnicastSendMetatraffic_run_expired(ORTEDomain *d,
-      ObjectEntryAID *objectEntryAID, 
-      ul_htim_time_t *pact_time);
+                                        ObjectEntryAID *objectEntryAID,
+                                        ul_htim_time_t *pact_time);
 // htimerUnicastSendUserData
 UL_HTIMER_DEC(htimerUnicastSendUserData,     /* prefix */
-             ObjectEntryAID,                /* queue_t */
-             HTimFncUserNode,               /* timer_t */
-             htimUnicast.sendUserData,      /* queue_field */
-             htim)                          /* timer_field */
+             ObjectEntryAID,                /* queue_t */
+             HTimFncUserNode,               /* timer_t */
+             htimUnicast.sendUserData,      /* queue_field */
+             htim)                          /* timer_field */
 extern void
 htimerUnicastSendUserData_update_root_timer(ObjectEntry *objectEntry,
-      ObjectEntryAID *objectEntryAID);
-extern void 
+                                           ObjectEntryAID *objectEntryAID);
+extern void
 htimerUnicastSendUserData_run_expired(ORTEDomain *d,
-      ObjectEntryAID *objectEntryAID, 
-      ul_htim_time_t *pact_time);
+                                     ObjectEntryAID *objectEntryAID,
+                                     ul_htim_time_t *pact_time);
 extern NtpTime
 getActualNtpTime(void);
 
@@ -125,322 +125,326 @@ db_init(const char *logfile, const char *options);
 extern void
 debug_options(const char *options);
 extern void
-db_print(const char *format,...);
+db_print(const char *format, ...);
 extern void
 debug_open_log(const char *logfile);
 #ifdef ENABLE_MEM_CHECK
-extern void * 
+extern void *
 mem_check_malloc(size_t size);
-extern void 
+extern void
 mem_check_free(void *ptr);
 #endif
 
 ///////////////////////////////////////////////////////////////////////////////
 // fnmatch.c
 extern int
-fnmatch(const char *__pattern,const char *__string,int __flags);
+fnmatch(const char *__pattern, const char *__string, int __flags);
 
 ///////////////////////////////////////////////////////////////////////////////
 // objectEntry.c
-UL_LIST_CUST_DEC(ObjectEntryMulticast,   /* prefix */
-                ObjectEntryOID,          /* head_t */
-                CSTRemoteReader,         /* item_t */
+UL_LIST_CUST_DEC(ObjectEntryMulticast,    /* prefix */
+                ObjectEntryOID,          /* head_t */
+                CSTRemoteReader,         /* item_t */
                 multicastRemoteReaders,  /* head_field */
-                multicastNode);          /* node_field */
-
-GAVL_CUST_NODE_INT_DEC(ObjectEntryHID,   /* prefix */
-                      ObjectEntry,       /* root_t */
-                      ObjectEntryHID,    /* item_t */
-                      HostId,            /* key_t */
-                      objRoot,           /* root_node */
-                      hidNode,           /* item_node */
-                      hid,               /* item_key */
-                      gavl_cmp_int)      /* cmp_fnc */
-
-GAVL_CUST_NODE_INT_DEC(ObjectEntryAID,   /* prefix */
-                      ObjectEntryHID,    /* root_t */
-                      ObjectEntryAID,    /* item_t */
-                      AppId,             /* key_t */
-                      aidRoot,           /* root_node */
-                      aidNode,           /* item_node */
-                      aid,               /* item_key */
-                      gavl_cmp_int)      /* cmp_fnc */
-
-GAVL_CUST_NODE_INT_DEC(ObjectEntryOID,   /* prefix */
-                      ObjectEntryAID,    /* root_t */
-                      ObjectEntryOID,    /* item_t */
-                      ObjectId,          /* key_t */
-                      oidRoot,           /* root_node */
-                      oidNode,           /* item_node */
-                      oid,               /* item_key */
-                      gavl_cmp_int)      /* cmp_fnc */
-
-extern void
-objectEntryRefreshApp(ORTEDomain *d,ObjectEntryOID *objectEntryOID);
+                multicastNode);          /* node_field */
+
+GAVL_CUST_NODE_INT_DEC(ObjectEntryHID,    /* prefix */
+                      ObjectEntry,       /* root_t */
+                      ObjectEntryHID,    /* item_t */
+                      HostId,            /* key_t */
+                      objRoot,           /* root_node */
+                      hidNode,           /* item_node */
+                      hid,               /* item_key */
+                      gavl_cmp_int)      /* cmp_fnc */
+
+GAVL_CUST_NODE_INT_DEC(ObjectEntryAID,    /* prefix */
+                      ObjectEntryHID,    /* root_t */
+                      ObjectEntryAID,    /* item_t */
+                      AppId,             /* key_t */
+                      aidRoot,           /* root_node */
+                      aidNode,           /* item_node */
+                      aid,               /* item_key */
+                      gavl_cmp_int)      /* cmp_fnc */
+
+GAVL_CUST_NODE_INT_DEC(ObjectEntryOID,    /* prefix */
+                      ObjectEntryAID,    /* root_t */
+                      ObjectEntryOID,    /* item_t */
+                      ObjectId,          /* key_t */
+                      oidRoot,           /* root_node */
+                      oidNode,           /* item_node */
+                      oid,               /* item_key */
+                      gavl_cmp_int)      /* cmp_fnc */
+
+extern void
+objectEntryRefreshApp(ORTEDomain *d, ObjectEntryOID *objectEntryOID);
 extern ObjectEntryOID *
-objectEntryFind(ORTEDomain *d,GUID_RTPS *guid);
+objectEntryFind(ORTEDomain *d, GUID_RTPS *guid);
 extern ObjectEntryOID *
-objectEntryAdd(ORTEDomain *d,GUID_RTPS *guid,void *params);
+objectEntryAdd(ORTEDomain *d, GUID_RTPS *guid, void *params);
 extern int
-objectEntryDelete(ORTEDomain *d,ObjectEntryOID *objectEntryOID,Boolean destroy);
+objectEntryDelete(ORTEDomain *d, ObjectEntryOID *objectEntryOID, Boolean destroy);
 extern void
-objectEntryDeleteAll(ORTEDomain *d,ObjectEntry *objectEntry);
+objectEntryDeleteAll(ORTEDomain *d, ObjectEntry *objectEntry);
 extern void
 objectEntryDump(ObjectEntry *objectEntry);
 
 ///////////////////////////////////////////////////////////////////////////////
 // ObjectUtils.c
-extern void 
+extern void
 AppParamsInit(AppParams *ap);
-extern void 
+extern void
 PublParamsInit(ORTEPublProp *sp);
-extern void 
+extern void
 SubsParamsInit(ORTESubsProp *sp);
 extern void
-updateORTEAppInfo(AppParams *appParams,ORTEAppInfo *appInfo);
+updateORTEAppInfo(AppParams *appParams, ORTEAppInfo *appInfo);
 extern Boolean
-generateEvent(ORTEDomain *d,GUID_RTPS *guid,void *params,Boolean live);
+generateEvent(ORTEDomain *d, GUID_RTPS *guid, void *params, Boolean live);
 extern Boolean
-getTypeApp(ORTEDomain *d,AppParams *ap,IPAddress senderIPAddress);
-extern void 
-appSelfParamChanged(ORTEDomain *d,Boolean lock,Boolean unlock,
-   Boolean forWM,Boolean alive);
+getTypeApp(ORTEDomain *d, AppParams *ap, IPAddress senderIPAddress);
+extern void
+appSelfParamChanged(ORTEDomain *d, Boolean lock, Boolean unlock,
+                   Boolean forWM, Boolean alive);
 extern Boolean
-matchMulticastAddresses(ObjectEntryOID *o1,ObjectEntryOID *o2);
+matchMulticastAddresses(ObjectEntryOID *o1, ObjectEntryOID *o2);
 extern ObjectEntryOID *
-getAppO2SRemoteReader(ORTEDomain *d,ObjectEntryOID *objectEntryOID,
-    AppParams *ap);
+getAppO2SRemoteReader(ORTEDomain *d, ObjectEntryOID *objectEntryOID,
+                     AppParams *ap);
 extern ObjectEntryOID *
-getSubsO2SRemoteReader(ORTEDomain *d,ObjectEntryOID *objectEntryOID,
-    ORTESubsProp *sp);
+getSubsO2SRemoteReader(ORTEDomain *d, ObjectEntryOID *objectEntryOID,
+                      ORTESubsProp *sp);
 
 ///////////////////////////////////////////////////////////////////////////////
 // event.c
-extern int32_t 
-eventAdd(ORTEDomain *d,ObjectEntryAID *objectEntryAID,HTimFncUserNode *fncNode,
-         int where,const char *name,EVH2 *func,pthread_rwlock_t *lock,
-         void *arg1,NtpTime *when_expire);
 extern int32_t
-eventDetach(ORTEDomain *d,               
-            ObjectEntryAID *objectEntryAID,
-            HTimFncUserNode *fncNode,
-            int where);
+eventAdd(ORTEDomain *d, ObjectEntryAID *objectEntryAID, HTimFncUserNode *fncNode,
+        int where, const char *name, EVH2 *func, pthread_rwlock_t *lock,
+        void *arg1, NtpTime *when_expire);
+extern int32_t
+eventDetach(ORTEDomain *d,
+           ObjectEntryAID *objectEntryAID,
+           HTimFncUserNode *fncNode,
+           int where);
 
 ///////////////////////////////////////////////////////////////////////////////
 // parameter.c
-UL_LIST_CUST_DEC(CSChangeAttributes,     /* prefix */
-                CSChange,                /* head_t */
-                ParameterSequence,       /* item_t */
-                attributes,              /* head_field */
-                node);                   /* node_field */
+UL_LIST_CUST_DEC(CSChangeAttributes,      /* prefix */
+                CSChange,                /* head_t */
+                ParameterSequence,       /* item_t */
+                attributes,              /* head_field */
+                node);                   /* node_field */
 extern int
 parameterGetDataLength(CSChange *csChange);
 extern int
 parameterDelete(CSChange *csChange);
 extern int
-parameterCodeCodecFromCSChange(CSChange *csChange,CDR_Codec *cdrCodec);
+parameterCodeCodecFromCSChange(CSChange *csChange, CDR_Codec *cdrCodec);
 extern int
-parameterDecodeCodecToCSChange(CSChange *csChange,CDR_Codec *cdrCodec);
+parameterDecodeCodecToCSChange(CSChange *csChange, CDR_Codec *cdrCodec);
 extern int
 parameterUpdateCSChange(
-     CSChange *csChange,AppParams *ap,Boolean Manager);
+  CSChange *csChange, AppParams *ap, Boolean Manager);
 extern int
-parameterUpdateCSChangeFromPublication(CSChange *csChange,ORTEPublProp *pp);
+parameterUpdateCSChangeFromPublication(CSChange *csChange, ORTEPublProp *pp);
 extern int
-parameterUpdateCSChangeFromSubscription(CSChange *csChange,ORTESubsProp *sp);
+parameterUpdateCSChangeFromSubscription(CSChange *csChange, ORTESubsProp *sp);
 extern int
-parameterUpdateApplication(CSChange *csChange,AppParams *ap);
+parameterUpdateApplication(CSChange *csChange, AppParams *ap);
 extern int
-parameterUpdatePublication(CSChange *csChange,ORTEPublProp *pp);
+parameterUpdatePublication(CSChange *csChange, ORTEPublProp *pp);
 extern int
-parameterUpdateSubscription(CSChange *csChange,ORTESubsProp *sp);
+parameterUpdateSubscription(CSChange *csChange, ORTESubsProp *sp);
 
 ///////////////////////////////////////////////////////////////////////////////
 // objectEntryTimer.c
 extern int
-objectEntryPurgeTimer(ORTEDomain *d,void *vobjectEntryOID);
+objectEntryPurgeTimer(ORTEDomain *d, void *vobjectEntryOID);
 extern int
-objectEntryExpirationTimer(ORTEDomain *d,void *vobjectEntryOID);
+objectEntryExpirationTimer(ORTEDomain *d, void *vobjectEntryOID);
 
 ///////////////////////////////////////////////////////////////////////////////
 // ORTETypeRegister.c
-GAVL_CUST_NODE_INT_DEC(ORTEType,             /* prefix */
-                      TypeEntry,             /* root_t */
-                      TypeNode,              /* item_t */
-                      const char *,          /* key_t */
-                      types,                 /* root_node */
-                      node,                  /* item_node */
+GAVL_CUST_NODE_INT_DEC(ORTEType,              /* prefix */
+                      TypeEntry,             /* root_t */
+                      TypeNode,              /* item_t */
+                      const char *,          /* key_t */
+                      types,                 /* root_node */
+                      node,                  /* item_node */
                       typeRegister.typeName, /* item_key */
-                      gavl_cmp_str)          /* cmp_fnc */
+                      gavl_cmp_str)          /* cmp_fnc */
 
 
 ///////////////////////////////////////////////////////////////////////////////
 // ORTEThreadUtils.c
 extern void
-ORTEDomainWakeUpReceivingThread(ORTEDomain *d,sock_t *sock,uint16_t port);
+ORTEDomainWakeUpReceivingThread(ORTEDomain *d, sock_t *sock, uint16_t port);
 extern void
 ORTEDomainWakeUpSendingThread(ObjectEntry *objectEntry);
 
 ///////////////////////////////////////////////////////////////////////////////
 // ORTEAppRecvMetatrafficThread.c
-extern void 
+extern void
 ORTEAppRecvThread(TaskProp *tp);
 
 
 ///////////////////////////////////////////////////////////////////////////////
 // ORTEAppSendThread.c
-extern void 
-ORTESendData(ORTEDomain *d,ObjectEntryAID *objectEntryAID,Boolean meta);
-extern void 
+extern void
+ORTESendData(ORTEDomain *d, ObjectEntryAID *objectEntryAID, Boolean meta);
+extern void
 ORTEAppSendThread(TaskProp *tp);
 
 ///////////////////////////////////////////////////////////////////////////////
 // RTPSHeader.c
 extern int
-RTPSHeaderCreate(CDR_Codec *cdrCodec,HostId hid,AppId aid);
-extern int 
-RTPSHeaderCheck(CDR_Codec *cdrCodec,int32_t len,MessageInterpret *mi);
+RTPSHeaderCreate(CDR_Codec *cdrCodec, HostId hid, AppId aid);
+extern int
+RTPSHeaderCheck(CDR_Codec *cdrCodec, int32_t len, MessageInterpret *mi);
 
 ///////////////////////////////////////////////////////////////////////////////
 // RTPSPad.c
-extern void 
-RTPSPad(CDR_Codec *cdrCodec,MessageInterpret *mi);
+extern void
+RTPSPad(CDR_Codec *cdrCodec, MessageInterpret *mi);
 
 ///////////////////////////////////////////////////////////////////////////////
 // RTPSInfoDST.c
-extern void 
-RTPSInfoDST(CDR_Codec *cdrCodec,MessageInterpret *mi);
+extern void
+RTPSInfoDST(CDR_Codec *cdrCodec, MessageInterpret *mi);
 
 ///////////////////////////////////////////////////////////////////////////////
 // RTPSInfoREPLY.c
-extern int 
-RTPSInfoREPLYCreate(CDR_Codec *cdrCodec,IPAddress ipaddress,Port port);
-void 
-RTPSInfoREPLY(CDR_Codec *cdrCodec,MessageInterpret *mi);
+extern int
+RTPSInfoREPLYCreate(CDR_Codec *cdrCodec, IPAddress ipaddress, Port port);
+void
+RTPSInfoREPLY(CDR_Codec *cdrCodec, MessageInterpret *mi);
 
 ///////////////////////////////////////////////////////////////////////////////
 // RTPSInfoSRC.c
-extern void 
-RTPSInfoSRC(CDR_Codec *cdrCodec,MessageInterpret *mi);
+extern void
+RTPSInfoSRC(CDR_Codec *cdrCodec, MessageInterpret *mi);
 
 ///////////////////////////////////////////////////////////////////////////////
 // RTPSInfoTS.c
 extern int
-RTPSInfoTSCreate(CDR_Codec *cdrCodec,NtpTime time);
-extern void 
-RTPSInfoTS(CDR_Codec *cdrCodec,MessageInterpret *mi);
+RTPSInfoTSCreate(CDR_Codec *cdrCodec, NtpTime time);
+extern void
+RTPSInfoTS(CDR_Codec *cdrCodec, MessageInterpret *mi);
 
 ///////////////////////////////////////////////////////////////////////////////
 // RTPSVar.c
-extern int 
-RTPSVarCreate(CDR_Codec *cdrCodec,ObjectId roid,ObjectId woid,CSChange *csChange);
-extern void 
-RTPSVar(ORTEDomain *d,CDR_Codec *cdrCodec,MessageInterpret *mi,IPAddress senderIPAddress);
+extern int
+RTPSVarCreate(CDR_Codec *cdrCodec, ObjectId roid, ObjectId woid, CSChange *csChange);
+extern void
+RTPSVar(ORTEDomain *d, CDR_Codec *cdrCodec, MessageInterpret *mi, IPAddress senderIPAddress);
 
 ///////////////////////////////////////////////////////////////////////////////
 // RTPSAck.c
 extern int
 RTPSAckCreate(CDR_Codec *cdrCodec,
-    SequenceNumber *seqNumber,
-    ObjectId roid,ObjectId woid,Boolean f_bit);
-extern void 
-RTPSAck(ORTEDomain *d,CDR_Codec *cdrCodec,MessageInterpret *mi,IPAddress senderIPAddress);
+             SequenceNumber *seqNumber,
+             ObjectId roid, ObjectId woid, Boolean f_bit);
+extern void
+RTPSAck(ORTEDomain *d, CDR_Codec *cdrCodec, MessageInterpret *mi, IPAddress senderIPAddress);
 
 ///////////////////////////////////////////////////////////////////////////////
 // RTPSHeardBeat.c
-extern int 
+extern int
 RTPSHeartBeatCreate(CDR_Codec *cdrCodec,
-    SequenceNumber *fsn,SequenceNumber *lsn,
-    ObjectId roid,ObjectId woid,Boolean f_bit);
-extern void 
-RTPSHeartBeat(ORTEDomain *d,CDR_Codec *cdrCodec,MessageInterpret *mi);
+                   SequenceNumber *fsn, SequenceNumber *lsn,
+                   ObjectId roid, ObjectId woid, Boolean f_bit);
+extern void
+RTPSHeartBeat(ORTEDomain *d, CDR_Codec *cdrCodec, MessageInterpret *mi);
 
 ///////////////////////////////////////////////////////////////////////////////
 // RTPSGap.c
-extern int 
-RTPSGapCreate(CDR_Codec *cdrCodec,ObjectId roid,ObjectId woid,CSChange *csChange);
-void 
-RTPSGap(ORTEDomain *d,CDR_Codec *cdrCodec,MessageInterpret *mi,IPAddress senderIPAddress);
+extern int
+RTPSGapCreate(CDR_Codec *cdrCodec, ObjectId roid, ObjectId woid, CSChange *csChange);
+void
+RTPSGap(ORTEDomain *d, CDR_Codec *cdrCodec, MessageInterpret *mi, IPAddress senderIPAddress);
 
 ///////////////////////////////////////////////////////////////////////////////
 // RTPSIssue.c
 extern int
-RTPSIssueCreateHeader(CDR_Codec *cdrCodec,uint32_t length,
-    ObjectId roid,ObjectId woid,SequenceNumber sn);
-extern void 
-RTPSIssue(ORTEDomain *d,CDR_Codec *cdrCodec,MessageInterpret *mi,IPAddress senderIPAddress);
+RTPSIssueCreateHeader(CDR_Codec *cdrCodec, uint32_t length,
+                     ObjectId roid, ObjectId woid, SequenceNumber sn);
+extern void
+RTPSIssue(ORTEDomain *d, CDR_Codec *cdrCodec, MessageInterpret *mi, IPAddress senderIPAddress);
 
 ///////////////////////////////////////////////////////////////////////////////
 // RTPSUtils.c
-extern int gavl_cmp_ntp_time(const NtpTime *a,const NtpTime *b);
-extern int gavl_cmp_sn(const SequenceNumber *a, const SequenceNumber *b); 
-extern int gavl_cmp_guid(const GUID_RTPS *a, const GUID_RTPS *b); 
-extern int gavl_cmp_str(const char *const *a,const char *const *b);
+extern int
+gavl_cmp_ntp_time(const NtpTime *a, const NtpTime *b);
+extern int
+gavl_cmp_sn(const SequenceNumber *a, const SequenceNumber *b);
+extern int
+gavl_cmp_guid(const GUID_RTPS *a, const GUID_RTPS *b);
+extern int
+gavl_cmp_str(const char *const *a, const char *const *b);
 
 ///////////////////////////////////////////////////////////////////////////////
 // RTPSCSTWriter.c
-UL_LIST_CUST_DEC(CSTWriterCSChange,      /* prefix */
-                CSTWriter,               /* head_t */
-                CSChange,                /* item_t */
-                csChanges,               /* head_field */
-                nodeList);               /* node_field */
-
-UL_LIST_CUST_DEC(CSChangeParticipant,    /* prefix */
-                CSChange,                /* head_t */
-                CSChangeForReader,       /* item_t */
-                writerParticipants,      /* head_field */
-                participantNode);        /* node_field */
-
-GAVL_CUST_NODE_INT_DEC(CSTWriter,        /* prefix */
-                      CSTPublications,   /* root_t */
-                      CSTWriter,         /* item_t */
-                      GUID_RTPS,         /* key_t */
-                      cstWriter,         /* root_node */
-                      node,              /* item_node */
-                      guid,              /* item_key */
-                      gavl_cmp_guid);    /* cmp_fnc */
-
-GAVL_CUST_NODE_INT_DEC(CSTRemoteReader,          /* prefix */
-                      CSTWriter,         /* root_t */
-                      CSTRemoteReader,   /* item_t */
-                      GUID_RTPS,         /* key_t */
-                      cstRemoteReader,   /* root_node */
-                      node,              /* item_node */
-                      guid,              /* item_key */
-                      gavl_cmp_guid);    /* cmp_fnc */
+UL_LIST_CUST_DEC(CSTWriterCSChange,       /* prefix */
+                CSTWriter,               /* head_t */
+                CSChange,                /* item_t */
+                csChanges,               /* head_field */
+                nodeList);               /* node_field */
+
+UL_LIST_CUST_DEC(CSChangeParticipant,     /* prefix */
+                CSChange,                /* head_t */
+                CSChangeForReader,       /* item_t */
+                writerParticipants,      /* head_field */
+                participantNode);        /* node_field */
+
+GAVL_CUST_NODE_INT_DEC(CSTWriter,         /* prefix */
+                      CSTPublications,   /* root_t */
+                      CSTWriter,         /* item_t */
+                      GUID_RTPS,         /* key_t */
+                      cstWriter,         /* root_node */
+                      node,              /* item_node */
+                      guid,              /* item_key */
+                      gavl_cmp_guid);    /* cmp_fnc */
+
+GAVL_CUST_NODE_INT_DEC(CSTRemoteReader,   /* prefix */
+                      CSTWriter,         /* root_t */
+                      CSTRemoteReader,   /* item_t */
+                      GUID_RTPS,         /* key_t */
+                      cstRemoteReader,   /* root_node */
+                      node,              /* item_node */
+                      guid,              /* item_key */
+                      gavl_cmp_guid);    /* cmp_fnc */
 
 GAVL_CUST_NODE_INT_DEC(CSChangeForReader, /* prefix */
-                      CSTRemoteReader,   /* root_t */
+                      CSTRemoteReader,   /* root_t */
                       CSChangeForReader, /* item_t */
-                      SequenceNumber,    /* key_t */
+                      SequenceNumber,    /* key_t */
                       csChangeForReader, /* root_node */
-                      node,              /* item_node */
-                      csChange->sn,      /* item_key */
-                      gavl_cmp_sn);      /* cmp_fnc */
+                      node,              /* item_node */
+                      csChange->sn,      /* item_key */
+                      gavl_cmp_sn);      /* cmp_fnc */
 
 extern void
-CSTWriterInit(ORTEDomain *d,CSTWriter *cstWriter,ObjectEntryOID *object,
-    ObjectId oid,CSTWriterParams *params,ORTETypeRegister *typeRegister);
-extern void 
-CSTWriterDelete(ORTEDomain *d,CSTWriter *cstWriter);
+CSTWriterInit(ORTEDomain *d, CSTWriter *cstWriter, ObjectEntryOID *object,
+             ObjectId oid, CSTWriterParams *params, ORTETypeRegister *typeRegister);
+extern void
+CSTWriterDelete(ORTEDomain *d, CSTWriter *cstWriter);
 extern CSTRemoteReader *
-CSTWriterAddRemoteReader(ORTEDomain *d,CSTWriter *cstWriter,ObjectEntryOID *pobject,
-    ObjectId oid,ObjectEntryOID *sobject);
-extern void 
-CSTWriterDestroyRemoteReader(ORTEDomain *d,CSTRemoteReader *cstRemoteReader);
+CSTWriterAddRemoteReader(ORTEDomain *d, CSTWriter *cstWriter, ObjectEntryOID *pobject,
+                        ObjectId oid, ObjectEntryOID *sobject);
 extern void
-CSTWriterMakeGAP(ORTEDomain *d,CSTWriter *cstWriter,GUID_RTPS *guid);
+CSTWriterDestroyRemoteReader(ORTEDomain *d, CSTRemoteReader *cstRemoteReader);
 extern void
-CSTWriterAddCSChange(ORTEDomain *d,CSTWriter *cstWriter,CSChange *csChange);
+CSTWriterMakeGAP(ORTEDomain *d, CSTWriter *cstWriter, GUID_RTPS *guid);
+extern void
+CSTWriterAddCSChange(ORTEDomain *d, CSTWriter *cstWriter, CSChange *csChange);
 extern void
 CSTWriterDestroyCSChangeForReader(CSChangeForReader *csChangeForReader,
-   Boolean destroyCSChange);
-extern void 
-CSTWriterDestroyCSChange(ORTEDomain *d,CSTWriter *cstWriter,CSChange *csChange);
+                                 Boolean destroyCSChange);
+extern void
+CSTWriterDestroyCSChange(ORTEDomain *d, CSTWriter *cstWriter, CSChange *csChange);
 extern Boolean
 CSTWriterTryDestroyBestEffortIssue(CSTWriter *cstWriter);
 extern void
-CSTWriterRefreshAllCSChanges(ORTEDomain *d,CSTRemoteReader *cstRemoteReader);
+CSTWriterRefreshAllCSChanges(ORTEDomain *d, CSTRemoteReader *cstRemoteReader);
 extern int
 CSTWriterCSChangeForReaderNewState(CSChangeForReader *csChangeForReader);
 extern void
@@ -448,128 +452,128 @@ CSTWriterMulticast(CSChangeForReader *csChangeForReader);
 
 ///////////////////////////////////////////////////////////////////////////////
 // RTPSCSTWriterTimer.c
-extern int 
-CSTWriterRegistrationTimer(ORTEDomain *d,void *vcstWriter);
 extern int
-CSTWriterRefreshTimer(ORTEDomain *d,void *vcstWriter);
-extern int 
-CSTWriterAnnounceTimer(ORTEDomain *d,void *vcstRemoteReader);
-extern int 
-CSChangeForReaderUnderwayTimer(ORTEDomain *da,void *vcsChangeForReader);
+CSTWriterRegistrationTimer(ORTEDomain *d, void *vcstWriter);
+extern int
+CSTWriterRefreshTimer(ORTEDomain *d, void *vcstWriter);
+extern int
+CSTWriterAnnounceTimer(ORTEDomain *d, void *vcstRemoteReader);
+extern int
+CSChangeForReaderUnderwayTimer(ORTEDomain *da, void *vcsChangeForReader);
 extern int
-CSTWriterSendBestEffortTimer(ORTEDomain *d,void *vcstRemoteReader);
+CSTWriterSendBestEffortTimer(ORTEDomain *d, void *vcstRemoteReader);
 extern int
-CSTWriterSendStrictTimer(ORTEDomain *d,void *vcstRemoteReader);
+CSTWriterSendStrictTimer(ORTEDomain *d, void *vcstRemoteReader);
 extern int
-CSTWriterSendTimer(ORTEDomain *d,void *vcstRemoteReader);
-        
+CSTWriterSendTimer(ORTEDomain *d, void *vcstRemoteReader);
+
 ///////////////////////////////////////////////////////////////////////////////
 // RTPSCSTReader.c
-UL_LIST_CUST_DEC(CSTReaderCSChange,      /* prefix */
-                CSTReader,               /* head_t */
-                CSChange,                /* item_t */
-                csChanges,               /* head_field */
-                nodeList);               /* node_field */
+UL_LIST_CUST_DEC(CSTReaderCSChange,       /* prefix */
+                CSTReader,               /* head_t */
+                CSChange,                /* item_t */
+                csChanges,               /* head_field */
+                nodeList);               /* node_field */
 
-GAVL_CUST_NODE_INT_DEC(CSTReader,        /* prefix */
+GAVL_CUST_NODE_INT_DEC(CSTReader,         /* prefix */
                       CSTSubscriptions,  /* root_t */
-                      CSTReader,         /* item_t */
-                      GUID_RTPS,         /* key_t */
-                      cstReader,         /* root_node */
-                      node,              /* item_node */
-                      guid,              /* item_key */
-                      gavl_cmp_guid);    /* cmp_fnc */
-
-GAVL_CUST_NODE_INT_DEC(CSTRemoteWriter,          /* prefix */
-                      CSTReader,         /* root_t */
-                      CSTRemoteWriter,   /* item_t */
-                      GUID_RTPS,         /* key_t */
-                      cstRemoteWriter,   /* root_node */
-                      node,              /* item_node */
-                      guid,              /* item_key */
-                      gavl_cmp_guid);    /* cmp_fnc */
-
-GAVL_CUST_NODE_INT_DEC(CSChangeFromWriter,/* prefix */
-                      CSTRemoteWriter,   /* root_t */
-                      CSChangeFromWriter,/* item_t */
-                      SequenceNumber,    /* key_t */
-                      csChangeFromWriter,/* root_node */
-                      node,              /* item_node */
-                      csChange->sn,      /* item_key */
-                      gavl_cmp_sn);      /* cmp_fnc */
-extern void 
-CSTReaderInit(ORTEDomain *d,CSTReader *cstReader,ObjectEntryOID *object,
-    ObjectId oid,CSTReaderParams *params,ORTETypeRegister *typeRegister);
-extern void 
-CSTReaderDelete(ORTEDomain *d,CSTReader *cstReader);
+                      CSTReader,         /* item_t */
+                      GUID_RTPS,         /* key_t */
+                      cstReader,         /* root_node */
+                      node,              /* item_node */
+                      guid,              /* item_key */
+                      gavl_cmp_guid);    /* cmp_fnc */
+
+GAVL_CUST_NODE_INT_DEC(CSTRemoteWriter,   /* prefix */
+                      CSTReader,         /* root_t */
+                      CSTRemoteWriter,   /* item_t */
+                      GUID_RTPS,         /* key_t */
+                      cstRemoteWriter,   /* root_node */
+                      node,              /* item_node */
+                      guid,              /* item_key */
+                      gavl_cmp_guid);    /* cmp_fnc */
+
+GAVL_CUST_NODE_INT_DEC(CSChangeFromWriter, /* prefix */
+                      CSTRemoteWriter,   /* root_t */
+                      CSChangeFromWriter, /* item_t */
+                      SequenceNumber,    /* key_t */
+                      csChangeFromWriter, /* root_node */
+                      node,              /* item_node */
+                      csChange->sn,      /* item_key */
+                      gavl_cmp_sn);      /* cmp_fnc */
+extern void
+CSTReaderInit(ORTEDomain *d, CSTReader *cstReader, ObjectEntryOID *object,
+             ObjectId oid, CSTReaderParams *params, ORTETypeRegister *typeRegister);
+extern void
+CSTReaderDelete(ORTEDomain *d, CSTReader *cstReader);
 extern CSTRemoteWriter *
-CSTReaderAddRemoteWriter(ORTEDomain *d,CSTReader *cstReader,ObjectEntryOID *object,
-    ObjectId oid);
-extern void 
-CSTReaderDestroyRemoteWriter(ORTEDomain *d,CSTRemoteWriter *cstRemoteWriter);
+CSTReaderAddRemoteWriter(ORTEDomain *d, CSTReader *cstReader, ObjectEntryOID *object,
+                        ObjectId oid);
+extern void
+CSTReaderDestroyRemoteWriter(ORTEDomain *d, CSTRemoteWriter *cstRemoteWriter);
 extern void
-CSTReaderAddCSChange(CSTRemoteWriter *cstRemoteWriter,CSChange *csChange);
+CSTReaderAddCSChange(CSTRemoteWriter *cstRemoteWriter, CSChange *csChange);
 extern void
 CSTReaderDestroyCSChangeFromWriter(CSTRemoteWriter *cstRemoteWriter,
-    CSChangeFromWriter *csChangeFromWriter,Boolean keepCSChange);
-extern void 
-CSTReaderDestroyCSChange(CSTRemoteWriter *cstRemoteWriter,SequenceNumber *sn,
-    Boolean keepCSChange);
-extern void 
+                                  CSChangeFromWriter *csChangeFromWriter, Boolean keepCSChange);
+extern void
+CSTReaderDestroyCSChange(CSTRemoteWriter *cstRemoteWriter, SequenceNumber *sn,
+                        Boolean keepCSChange);
+extern void
 CSTReaderSetupState(CSTRemoteWriter *cstRemoteWriter);
-        
+
 ///////////////////////////////////////////////////////////////////////////////
 // RTPSCSTReaderProc.c
-extern void 
-CSTReaderProcCSChanges(ORTEDomain *d,CSTRemoteWriter *cstRemoteWriter);
-extern void 
-CSTReaderProcCSChangesIssue(CSTRemoteWriter *cstRemoteWriter,Boolean pullCalled);
+extern void
+CSTReaderProcCSChanges(ORTEDomain *d, CSTRemoteWriter *cstRemoteWriter);
+extern void
+CSTReaderProcCSChangesIssue(CSTRemoteWriter *cstRemoteWriter, Boolean pullCalled);
 
 ///////////////////////////////////////////////////////////////////////////////
 // RTPSCSTReaderTimer.c
 extern int
-CSTReaderResponceTimer(ORTEDomain *d,void *vcstRemoteWriter);
-extern int 
-CSTReaderQueryTimer(ORTEDomain *d,void *vcstRemoteWriter);
-extern int 
-CSTReaderDeadlineTimer(ORTEDomain *d,void *vcstReader);
-extern int 
-CSTReaderPersistenceTimer(ORTEDomain *d,void *vcstReader);
+CSTReaderResponceTimer(ORTEDomain *d, void *vcstRemoteWriter);
+extern int
+CSTReaderQueryTimer(ORTEDomain *d, void *vcstRemoteWriter);
+extern int
+CSTReaderDeadlineTimer(ORTEDomain *d, void *vcstReader);
+extern int
+CSTReaderPersistenceTimer(ORTEDomain *d, void *vcstReader);
 
 ///////////////////////////////////////////////////////////////////////////////
 // ORTEDomain.c
-ORTEDomain * 
+ORTEDomain *
 ORTEDomainCreate(int domain, ORTEDomainProp *prop,
-               ORTEDomainAppEvents *events,Boolean manager);
+                ORTEDomainAppEvents *events, Boolean manager);
 Boolean
-ORTEDomainDestroy(ORTEDomain *d,Boolean manager);
+ORTEDomainDestroy(ORTEDomain *d, Boolean manager);
 
 ///////////////////////////////////////////////////////////////////////////////
 // ORTEDomainApp.c
-UL_LIST_CUST_DEC(Pattern,      /* prefix */
-                PatternEntry,  /* head_t */
-                PatternNode,   /* item_t */
-                patterns,      /* head_field */
-                node);         /* node_field */
-                                                   
+UL_LIST_CUST_DEC(Pattern,       /* prefix */
+                PatternEntry,  /* head_t */
+                PatternNode,   /* item_t */
+                patterns,      /* head_field */
+                node);         /* node_field */
+
 ///////////////////////////////////////////////////////////////////////////////
 // ORTETypeRegister.c
 extern Boolean
-ORTETypeRegisterFind(ORTEDomain *d,const char *typeName);
+ORTETypeRegisterFind(ORTEDomain *d, const char *typeName);
 
 ///////////////////////////////////////////////////////////////////////////////
 // ORTEPublication.c
-GAVL_CUST_NODE_INT_DEC(PublicationList,          /* prefix */
-                      PSEntry,           /* root_t */
-                      ObjectEntryOID,    /* item_t */
-                      GUID_RTPS,         /* key_t */
-                      publications,      /* root_node */
-                      psNode,            /* item_node */
-                      guid,              /* item_key */
-                      gavl_cmp_guid);    /* cmp_fnc */
+GAVL_CUST_NODE_INT_DEC(PublicationList,   /* prefix */
+                      PSEntry,           /* root_t */
+                      ObjectEntryOID,    /* item_t */
+                      GUID_RTPS,         /* key_t */
+                      publications,      /* root_node */
+                      psNode,            /* item_node */
+                      guid,              /* item_key */
+                      gavl_cmp_guid);    /* cmp_fnc */
 extern int
 ORTEPublicationSendLocked(ORTEPublication *cstWriter,
-    ORTEPublicationSendParam *psp);
+                         ORTEPublicationSendParam *psp);
 
 ///////////////////////////////////////////////////////////////////////////////
 // ORTESubcription.c
@@ -579,18 +583,18 @@ ORTESubscriptionDestroyLocked(ORTESubscription *cstReader);
 ///////////////////////////////////////////////////////////////////////////////
 // ORTEPublicationTimer.c
 extern int
-PublicationCallBackTimer(ORTEDomain *d,void *vcstWriter);
+PublicationCallBackTimer(ORTEDomain *d, void *vcstWriter);
 
 ///////////////////////////////////////////////////////////////////////////////
 // ORTESubscription.c
 GAVL_CUST_NODE_INT_DEC(SubscriptionList,  /* prefix */
-                      PSEntry,           /* root_t */
-                      ObjectEntryOID,    /* item_t */
-                      GUID_RTPS,         /* key_t */
-                      subscriptions,     /* root_node */
-                      psNode,            /* item_node */
-                      guid,              /* item_key */
-                      gavl_cmp_guid);    /* cmp_fnc */
+                      PSEntry,           /* root_t */
+                      ObjectEntryOID,    /* item_t */
+                      GUID_RTPS,         /* key_t */
+                      subscriptions,     /* root_node */
+                      psNode,            /* item_node */
+                      guid,              /* item_key */
+                      gavl_cmp_guid);    /* cmp_fnc */
 
 #ifdef __cplusplus
 } /* extern "C"*/
index 0e69bffb5997e17d8dcd8a4401dd730675848580..de74c6011affa85cf89944497b8204df8763b71f 100644 (file)
@@ -1,19 +1,19 @@
 /*
  *  $Id: compat.h,v 0.0.0.1             2004/11/14
  *
- *  -------------------------------------------------------------------  
- *                                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
+ *  -------------------------------------------------------------------
+ *                                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
  *  Author - this code:         Jan Kiszka        jan.kiszka@web.de
- *  Advisor:            Pavel Pisa                                   
- *  Project Responsible: Zdenek Hanzalek                              
+ *  Advisor:             Pavel Pisa
+ *  Project Responsible: Zdenek Hanzalek
  *  --------------------------------------------------------------------
  *
  *  This program is free software; you can redistribute it and/or modify
 
 typedef __u32 in_addr_t;
 
-static inline in_addr_t inet_addr(const char *cp)
+static inline in_addr_t
+inet_addr(const char *cp)
 {
-    return rt_inet_aton(cp);
+  return rt_inet_aton(cp);
 }
 
 
 static char inet_ntoa_buf[16];
 
-static inline char *inet_ntoa(struct in_addr in)
+static inline char *
+inet_ntoa(struct in_addr in)
 {
-    unsigned char *octet;
+  unsigned char *octet;
 
-    octet = (unsigned char *)&(in.s_addr);
-    sprintf(inet_ntoa_buf, "%u.%u.%u.%u", octet[0], octet[1], octet[2], octet[3]);
+  octet = (unsigned char *)&(in.s_addr);
+  sprintf(inet_ntoa_buf, "%u.%u.%u.%u", octet[0], octet[1], octet[2], octet[3]);
 
-    return inet_ntoa_buf;
+  return inet_ntoa_buf;
 }
 
 
 #define CLOCK_REALTIME  0
 
-static inline void clock_gettime(int dummy, struct timespec *time)
+static inline void
+clock_gettime(int dummy, struct timespec *time)
 {
-    count2timespec(rt_get_time(), time);
+  count2timespec(rt_get_time(), time);
 }
 
 
-static inline int atoi(const char* nptr)
+static inline int
+atoi(const char *nptr)
 {
-    return simple_strtol(nptr, (char **)NULL, 10);
+  return simple_strtol(nptr, (char **)NULL, 10);
 }
 
 
@@ -114,13 +118,14 @@ static inline int atoi(const char* nptr)
 #define recvfrom                    recvfrom_rt
 #define sendto                      sendto_rt
 
-static inline int close(int s)
+static inline int
+close(int s)
 {
-    int result;
+  int result;
 
-    while ((result = close_rt(s)) == -EAGAIN)
-        rt_sleep(nano2count(100000000));
-    return result;
+  while ((result = close_rt(s)) == -EAGAIN)
+    rt_sleep(nano2count(100000000));
+  return result;
 }
 
 #endif /* _COMPAT_H */
index d704f7a8247913ce4fb7b79605dc624c100747e4..34804ea1c2b476e68c833b960c16fd2e096f1dca 100644 (file)
@@ -1,31 +1,31 @@
 /*
- *  $Id: compat.h,v 0.0.0.1             2003/12/19 
+ *  $Id: compat.h,v 0.0.0.1             2003/12/19
  *
- *  -------------------------------------------------------------------  
- *                                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
+ *  -------------------------------------------------------------------
+ *                                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
  *  Author - this code:         Michal Sojka      sojka1@fel.cvut.cz
- *  Advisor:            Pavel Pisa                                   
- *  Project Responsible: Zdenek Hanzalek                              
+ *  Advisor:             Pavel Pisa
+ *  Project Responsible: Zdenek Hanzalek
  *  --------------------------------------------------------------------
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
+ *
  */
 
 #ifndef _COMPAT_H
 #define sendto                      ocn_sendto
 #define close                       ocn_close
 
-static inline int atoi(const char* nptr)
+static inline int
+atoi(const char *nptr)
 {
-    return simple_strtol(nptr, (char **)NULL, 10);
+  return simple_strtol(nptr, (char **)NULL, 10);
 }
 
-static inline __u32 inet_addr(const char *cp)
+static inline __u32
+inet_addr(const char *cp)
 {
-                   return in_aton(cp);
+  return in_aton(cp);
 }
 
 static char inet_ntoa_buf[16];
-static inline char *inet_ntoa(struct in_addr in) {
+static inline char *
+inet_ntoa(struct in_addr in)
+{
   unsigned char *octet;
 
   octet = (unsigned char *)&(in.s_addr);
index 124bc1eb0f6629a6f4a877490daa757b5c2ea230..d0882e477fdfaa6abfa2d555eb70f7908b34c1f0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  $Id: compat.h,v 0.0.0.1             2003/12/19 
+ *  $Id: compat.h,v 0.0.0.1             2003/12/19
  *
  *  AUTHOR: Michal Sojka                sojka1@fel.cvut.cz
  *
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
+ *
  */
 
 #ifndef _COMPAT_H
 #define ioctl(a, b, c) (-1)
 
 
-static inline int atoi(const char* nptr)
+static inline int
+atoi(const char *nptr)
 {
-    return simple_strtol(nptr, (char **)NULL, 10);
+  return simple_strtol(nptr, (char **)NULL, 10);
 }
 
 #endif /* _COMPAT_H */
index 68ac7de795cc3f4c1610651a3f47b399ec2f7e44..9a3eb6b9f88fbfe7cdb2c28c9dc713f500b7a714 100644 (file)
@@ -1,37 +1,37 @@
 /*
- *  $Id: rwlock.h,v 0.0.0.1             2003/12/19 
+ *  $Id: rwlock.h,v 0.0.0.1             2003/12/19
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
+ *
  */
 
 #ifndef _RWLOCK_H
 #define _RWLOCK_H
 
 #define PTW32_RWLOCK_MAGIC 0xfacade2
-#define PTHREAD_RWLOCK_INITIALIZER ((pthread_rwlock_t) -1)
+#define PTHREAD_RWLOCK_INITIALIZER ((pthread_rwlock_t)-1)
 
 typedef struct pthread_rwlock_t_ *pthread_rwlock_t;
 typedef struct pthread_rwlockattr_t_ *pthread_rwlockattr_t;
@@ -44,45 +44,59 @@ struct pthread_rwlock_t_ {
   int               nCompletedSharedAccessCount;
   int               nMagic;
 };
-             
+
 struct pthread_rwlockattr_t_ {
   int               pshared;
 };
-extern void ptw32_rwlock_cancelwrwait(void * arg);
+extern void
+ptw32_rwlock_cancelwrwait(void *arg);
 
 extern int
 ptw32_rwlock_check_need_init(pthread_rwlock_t *rwlock);
 
-extern int pthread_rwlock_init(pthread_rwlock_t *lock,
-                              const pthread_rwlockattr_t *attr);
+extern int
+pthread_rwlock_init(pthread_rwlock_t *lock,
+                   const pthread_rwlockattr_t *attr);
 
-extern int pthread_rwlock_destroy(pthread_rwlock_t *lock);
+extern int
+pthread_rwlock_destroy(pthread_rwlock_t *lock);
 
-extern int pthread_rwlock_tryrdlock(pthread_rwlock_t *);
+extern int
+pthread_rwlock_tryrdlock(pthread_rwlock_t *);
 
-extern int pthread_rwlock_trywrlock(pthread_rwlock_t *);
+extern int
+pthread_rwlock_trywrlock(pthread_rwlock_t *);
 
-extern int pthread_rwlock_rdlock(pthread_rwlock_t *lock);
+extern int
+pthread_rwlock_rdlock(pthread_rwlock_t *lock);
 
-extern int pthread_rwlock_timedrdlock(pthread_rwlock_t *lock,
-                                     const struct timespec *abstime);
+extern int
+pthread_rwlock_timedrdlock(pthread_rwlock_t *lock,
+                          const struct timespec *abstime);
 
-extern int pthread_rwlock_wrlock(pthread_rwlock_t *lock);
+extern int
+pthread_rwlock_wrlock(pthread_rwlock_t *lock);
 
-extern int pthread_rwlock_timedwrlock(pthread_rwlock_t *lock,
-                                     const struct timespec *abstime);
+extern int
+pthread_rwlock_timedwrlock(pthread_rwlock_t *lock,
+                          const struct timespec *abstime);
 
-extern int pthread_rwlock_unlock(pthread_rwlock_t *lock);
+extern int
+pthread_rwlock_unlock(pthread_rwlock_t *lock);
 
-extern int pthread_rwlockattr_init(pthread_rwlockattr_t * attr);
+extern int
+pthread_rwlockattr_init(pthread_rwlockattr_t *attr);
 
-extern int pthread_rwlockattr_destroy(pthread_rwlockattr_t * attr);
+extern int
+pthread_rwlockattr_destroy(pthread_rwlockattr_t *attr);
 
-extern int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t * attr,
-                                         int *pshared);
+extern int
+pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *attr,
+                             int *pshared);
 
-extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t * attr,
-                                         int pshared);
+extern int
+pthread_rwlockattr_setpshared(pthread_rwlockattr_t *attr,
+                             int pshared);
 
 
 #endif /* _RWLOCK_H */
index fe46399abb37ab0f2f4ef8ed0556e07ada652933..e2c6dec5d09cbd00f72d7cca9d9b84d37ce77892 100644 (file)
@@ -7,23 +7,25 @@
 #if WORDS_BIGENDIAN
 
 # define FLAG_ENDIANNESS FLAG_BIG_ENDIAN
-# define conversion_needed(to_endianness) ((to_endianness)!=FLAG_BIG_ENDIAN)
+# define conversion_needed(to_endianness) ((to_endianness) != FLAG_BIG_ENDIAN)
 
 #else
 
 # define FLAG_ENDIANNESS FLAG_LITTLE_ENDIAN
-# define conversion_needed(to_endianness) ((to_endianness)!=FLAG_LITTLE_ENDIAN)
+# define conversion_needed(to_endianness) ((to_endianness) != FLAG_LITTLE_ENDIAN)
 
 #endif
 
-static inline 
-void rtps_byteswap(uint8_t *outdata,
-                         const uint8_t *data,
-                         uint32_t datalen)
+static inline
+void
+rtps_byteswap(uint8_t *outdata,
+             const uint8_t *data,
+             uint32_t datalen)
 {
   const uint8_t *source_ptr = data;
   uint8_t *dest_ptr = outdata + datalen - 1;
-  while(dest_ptr >= outdata)
+
+  while (dest_ptr >= outdata)
     *dest_ptr-- = *source_ptr++;
 }
 
index caaa0e05ec865a2a31fd0ecb19ddb4352ebc77a4..dd38688e5bc31d1b7251e8be5d04cfe9bb8bc2ef 100644 (file)
@@ -1,30 +1,30 @@
 /*
- *  $Id: typedefs.h,v 0.0.0.1           2003/08/21 
+ *  $Id: typedefs.h,v 0.0.0.1           2003/08/21
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
+ *
  */
 
 #ifndef _TYPEDEFS_H
@@ -35,15 +35,15 @@ extern "C" {
 #endif
 
 typedef struct CSTWriter CSTWriter;               //forward declarations
-typedef struct CSTRemoteReader CSTRemoteReader;               
-typedef struct CSTReader CSTReader;               
+typedef struct CSTRemoteReader CSTRemoteReader;
+typedef struct CSTReader CSTReader;
 typedef struct ObjectEntryOID ObjectEntryOID;
 typedef struct ObjectEntryHID ObjectEntryHID;
 typedef struct ObjectEntryAID ObjectEntryAID;
-typedef struct ObjectEntry ObjectEntry; 
+typedef struct ObjectEntry ObjectEntry;
 
 /**
- * struct sock_t - 
+ * struct sock_t -
  */
 typedef struct sock_t {
   int         fd;
@@ -54,25 +54,25 @@ typedef struct sock_t {
  * struct  - MessageBuffer
  */
 typedef struct MessageBuffer {
-  CDR_Codec             cdrCodec;
+  CDR_Codec              cdrCodec;
   CDR_Codec              *cdrCodecDirect;
   Boolean                needSend;
   Boolean                containsInfoReply;
 } MessageBuffer;
 /**
- * struct TaskProp - 
+ * struct TaskProp -
  */
 typedef struct TaskProp {
   sock_t                 sock;
   pthread_t              thread;
   Boolean                terminate;
-  MessageBuffer                 mb;
-  ORTEDomain            *d;
+  MessageBuffer          mb;
+  ORTEDomain             *d;
 } TaskProp;
 
 
 /**
- * struct typeEntry - 
+ * struct typeEntry -
  */
 typedef struct TypeEntry {
   gavl_cust_root_field_t types;        //Types
@@ -80,7 +80,7 @@ typedef struct TypeEntry {
 } TypeEntry;
 
 /**
- * struct typeNode - 
+ * struct typeNode -
  */
 typedef struct TypeNode {
   gavl_node_t            node;
@@ -88,7 +88,7 @@ typedef struct TypeNode {
 } TypeNode;
 
 /**
- * struct PatternsNode - 
+ * struct PatternsNode -
  */
 typedef struct PatternNode {
   ul_list_node_t         node;
@@ -99,7 +99,7 @@ typedef struct PatternNode {
 } PatternNode;
 
 /**
- * struct PatternEntry - 
+ * struct PatternEntry -
  */
 typedef struct PatternEntry {
   ul_list_head_t         patterns;
@@ -108,7 +108,7 @@ typedef struct PatternEntry {
   void                   *param;
   pthread_rwlock_t       lock;
 } PatternEntry;
-  
+
 /**
  * struct AppParams - Manager & ManagedApplication
  */
@@ -119,7 +119,7 @@ typedef struct AppParams {
   unsigned char          unicastIPAddressCount;
   IPAddress              metatrafficMulticastIPAddressList[MAX_INTERFACES];
   unsigned char          metatrafficMulticastIPAddressCount;
-  IPAddress              managerKeyList[MAX_INTERFACES];//useful only for manager
+  IPAddress              managerKeyList[MAX_INTERFACES]; //useful only for manager
   unsigned char          managerKeyCount;           //useful only for manager
   Port                   metatrafficUnicastPort;
   Port                   userdataUnicastPort;
@@ -129,9 +129,9 @@ typedef struct AppParams {
   SequenceNumber         vargAppsSequenceNumber;    //useful only for manager
 } AppParams;
 
-typedef void EVH1(ORTEDomain *,ObjectEntryAID *,ul_htim_time_t *);
+typedef void EVH1(ORTEDomain *, ObjectEntryAID *, ul_htim_time_t *);
 /**
- * struct HTimFncRootNode - 
+ * struct HTimFncRootNode -
  */
 typedef struct HTimFncRootNode {
   ul_htim_node_t        htim;
@@ -141,10 +141,10 @@ typedef struct HTimFncRootNode {
 } HTimFncRootNode;
 
 /**
- * struct HTimNode - 
+ * struct HTimNode -
  */
 typedef struct HTimNode {
-  ul_htim_queue_t        common;              //timing queue for a timer function  
+  ul_htim_queue_t        common;              //timing queue for a timer function
   HTimFncRootNode        commonNode;          //root node
   ul_htim_queue_t        sendMetatraffic;     //timing queue for sendMetatraffic
   HTimFncRootNode        sendMetatrafficNode; //root node
@@ -153,9 +153,9 @@ typedef struct HTimNode {
 } HTimNode;
 
 /**
- * struct HTimFncUserNode - 
+ * struct HTimFncUserNode -
  */
-typedef int EVH2(ORTEDomain *,void *);
+typedef int EVH2(ORTEDomain *, void *);
 typedef struct HTimFncUserNode {
   ul_htim_node_t        htim;
   const char            *name;
@@ -177,7 +177,7 @@ struct ObjectEntryOID{
   void                   *attributes;  //atributes of object
   Boolean                appMOM;
   Boolean                privateCreated;  //object created by me self app
-  HTimFncUserNode       expirationPurgeTimer;
+  HTimFncUserNode        expirationPurgeTimer;
   //only for private CSTPublication,CSTSubscription
   void                   *instance;    //data Codec
   ORTERecvCallBack       recvCallBack;
@@ -189,7 +189,7 @@ struct ObjectEntryOID{
   gavl_node_t            psNode;
   //multicast
   ul_list_head_t         multicastRemoteReaders;
-  int                   multicastPort;
+  int                    multicastPort;
 };
 struct ObjectEntryAID {
   gavl_node_t            aidNode;
@@ -209,14 +209,14 @@ struct ObjectEntry{
   pthread_rwlock_t       objRootLock;
   ul_htim_queue_t        htimRoot;     //root of tree htimers
   pthread_rwlock_t       htimRootLock;
-  pthread_cond_t        htimSendCond; //for wake up
-  pthread_mutex_t       htimSendMutex;
-  int                   htimSendCondValue;
+  pthread_cond_t         htimSendCond; //for wake up
+  pthread_mutex_t        htimSendMutex;
+  int                    htimSendCondValue;
   Boolean                htimNeedWakeUp;
 };
 
 /**
- * struct ParameterSequence - 
+ * struct ParameterSequence -
  */
 typedef struct ParameterSequence {
   ul_list_node_t         node;
@@ -224,22 +224,22 @@ typedef struct ParameterSequence {
   ParameterLength        parameterLength;
   union {
     u_char               asStr[MAX_PARAMETER_LOCAL_LENGTH];
-    NtpTime             asNtpTime;
+    NtpTime              asNtpTime;
     CORBA_unsigned_long  asLong;
-    VendorId            asVendorId;
-    ProtocolVersion     asProtocolVersion;
-    SequenceNumber      asSequenceNumber;
-    CORBA_octet                 asOctet;
-    IPAddress           asIPAddress;
-    Port                asPort;
-    uint32_t            asUInt32;
-    TypeChecksum        asTypeChecksum;
+    VendorId             asVendorId;
+    ProtocolVersion      asProtocolVersion;
+    SequenceNumber       asSequenceNumber;
+    CORBA_octet          asOctet;
+    IPAddress            asIPAddress;
+    Port                 asPort;
+    uint32_t             asUInt32;
+    TypeChecksum         asTypeChecksum;
   } parameterLocal;
   u_char                 *parameter;
-} ParameterSequence; 
+} ParameterSequence;
 
 /**
- * struct CSChange - 
+ * struct CSChange -
  */
 typedef struct CSChange {
   ul_list_node_t         nodeList;
@@ -259,14 +259,14 @@ typedef struct CSChange {
   //receiving informations
   NtpTime                remoteTimePublished;
   NtpTime                localTimeReceived;
-} CSChange; 
+} CSChange;
 
 /**
- * struct CSTWriterParams - 
+ * struct CSTWriterParams -
  */
 typedef struct CSTWriterParams {
-  unsigned int          registrationRetries;
-  NtpTime               registrationPeriod;
+  unsigned int           registrationRetries;
+  NtpTime                registrationPeriod;
   NtpTime                waitWhileDataUnderwayTime;
   NtpTime                repeatAnnounceTime;
   NtpTime                delayResponceTime;
@@ -276,7 +276,7 @@ typedef struct CSTWriterParams {
 } CSTWriterParams;
 
 /**
- * struct CSChangeForReader - 
+ * struct CSChangeForReader -
  */
 typedef struct CSChangeForReader {
   gavl_node_t            node;
@@ -288,7 +288,7 @@ typedef struct CSChangeForReader {
 } CSChangeForReader;
 
 /**
- * struct CSTRemoteReader - 
+ * struct CSTRemoteReader -
  */
 struct CSTRemoteReader {
   gavl_node_t            node;
@@ -296,30 +296,30 @@ struct CSTRemoteReader {
   ObjectEntryOID         *sobject; /* to send object */
   ObjectEntryOID         *pobject; /* physical object (for multicast is differnet than sobject) */
   GUID_RTPS              guid;
-  
+
   gavl_cust_root_field_t csChangeForReader;
   unsigned int           csChangesCounter;
 
   //comm states
   StateMachineHB         commStateHB;
   StateMachineSend       commStateSend;
-  unsigned int          commStateToSentCounter;
+  unsigned int           commStateToSentCounter;
 
   //timing properties
   HTimFncUserNode        delayResponceTimer;
   HTimFncUserNode        repeatAnnounceTimer;
 
   unsigned int           HBRetriesCounter;
-  
+
   NtpTime                lastSentIssueTime;
-  
+
   //multicast
   ul_list_node_t         multicastNode; //connected into objectEntryOID
 };
 
 typedef struct CSTPublications CSTPublications;
 /**
- * struct CSTWriter - 
+ * struct CSTWriter -
  */
 struct CSTWriter {
   ORTEDomain             *domain;
@@ -340,22 +340,22 @@ struct CSTWriter {
 
   HTimFncUserNode        refreshPeriodTimer;
 
-  unsigned int          registrationCounter;
+  unsigned int           registrationCounter;
   HTimFncUserNode        registrationTimer;
-  
+
   //ser./deser. function
   ORTETypeRegister       *typeRegister;
-  
+
   //only for CSTPublications
   unsigned int           strictReliableCounter;
   unsigned int           bestEffortsCounter;
-  pthread_cond_t        condCSChangeDestroyed; //for wake up
-  pthread_mutex_t       mutexCSChangeDestroyed;
-  int                   condValueCSChangeDestroyed;
+  pthread_cond_t         condCSChangeDestroyed; //for wake up
+  pthread_mutex_t        mutexCSChangeDestroyed;
+  int                    condValueCSChangeDestroyed;
 };
 
 /**
- * struct CSTReaderParams - 
+ * struct CSTReaderParams -
  */
 typedef struct CSTReaderParams {
   NtpTime                delayResponceTimeMin;
@@ -366,7 +366,7 @@ typedef struct CSTReaderParams {
 } CSTReaderParams;
 
 /**
- * struct CSChangeFromWriter - 
+ * struct CSChangeFromWriter -
  */
 typedef struct CSChangeFromWriter {
   gavl_node_t            node;
@@ -375,17 +375,17 @@ typedef struct CSChangeFromWriter {
 } CSChangeFromWriter;
 
 /**
- * struct CSTRemoteWriter - 
+ * struct CSTRemoteWriter -
  */
 typedef struct CSTRemoteWriter {
   gavl_node_t            node;
   CSTReader              *cstReader;
   ObjectEntryOID         *spobject;   /* sender, physical object */
   GUID_RTPS              guid;
-  
+
   gavl_cust_root_field_t csChangeFromWriter;
   unsigned int           csChangesCounter;
-  
+
   SequenceNumber         sn;
   SequenceNumber         firstSN;
   SequenceNumber         lastSN;
@@ -402,7 +402,7 @@ typedef struct CSTRemoteWriter {
 
 typedef struct CSTSubscriptions CSTSubscriptions;
 /**
- * struct CSTReader - 
+ * struct CSTReader -
  */
 struct CSTReader {
   ORTEDomain             *domain;
@@ -416,10 +416,10 @@ struct CSTReader {
   gavl_cust_root_field_t cstRemoteWriter;
   unsigned int           cstRemoteWriterCounter;
   pthread_rwlock_t       lock;
-  
+
   //ser./deser. function
   ORTETypeRegister       *typeRegister;
-  
+
   //only for CSTSubcriptions
   CSTRemoteWriter       *cstRemoteWriterSubscribed;
   HTimFncUserNode        deadlineTimer;
@@ -427,47 +427,47 @@ struct CSTReader {
 
   unsigned int           strictReliableCounter;
   unsigned int           bestEffortsCounter;
-  
+
   Boolean                createdByPattern;
 };
 
 /**
- * struct CSTPublications - 
+ * struct CSTPublications -
  */
 struct CSTPublications {
   gavl_cust_root_field_t cstWriter;
-  pthread_rwlock_t       lock;        
-  uint32_t               counter;  
+  pthread_rwlock_t       lock;
+  uint32_t               counter;
 };
-  
+
 /**
- * struct CSTSubscriptions - 
+ * struct CSTSubscriptions -
  */
 struct CSTSubscriptions {
   gavl_cust_root_field_t cstReader;
-  pthread_rwlock_t       lock;        
-  uint32_t               counter;  
+  pthread_rwlock_t       lock;
+  uint32_t               counter;
 };
 
 /**
- * struct PSEntry - 
+ * struct PSEntry -
  */
 typedef struct PSEntry {
   gavl_cust_root_field_t publications;
-  pthread_rwlock_t       publicationsLock;        
+  pthread_rwlock_t       publicationsLock;
   gavl_cust_root_field_t subscriptions;
-  pthread_rwlock_t       subscriptionsLock;        
-} PSEntry ;
-  
+  pthread_rwlock_t       subscriptionsLock;
+} PSEntry;
+
 /**
- * struct ORTEDomain - 
+ * struct ORTEDomain -
  */
 struct ORTEDomain {
   uint32_t               domain;      //domain value
   GUID_RTPS              guid;        //guid of self application
   AppParams              *appParams;  //self parameters (share from objectEntry)
-  ObjectEntryOID         *objectEntryOID;//entry point for self OID
-  
+  ObjectEntryOID         *objectEntryOID; //entry point for self OID
+
   ////////////////////////////////////////////////////
   //variables for tasks
   TaskProp               taskRecvUnicastMetatraffic;
@@ -485,15 +485,15 @@ struct ORTEDomain {
 
   ORTEDomainProp         domainProp;
   ORTEDomainAppEvents    domainEvents;
-  
+
   ////////////////////////////////////////////////////
   //information used by event system
   ORTEAppInfo            appInfo;
   ORTEPubInfo            pubInfo;
   ORTESubInfo            subInfo;
-    
+
   ////////////////////////////////////////////////////
-  //communication objects 
+  //communication objects
   CSTWriter              writerApplicationSelf;  //Manager,App
   CSTReader              readerManagers;         //Manager,App
   CSTReader              readerApplications;     //Manager,App
@@ -513,4 +513,3 @@ struct ORTEDomain {
 #endif
 
 #endif  /* _TYPEDEFS_H */
-
index 6c2be0a0c773c180d80fcf67a8ed01e015a2797b..c95f3c1770f78f911f69e760c0476555a5946711 100644 (file)
@@ -32,7 +32,7 @@
 
 /* macro for comparing 2 strings */
 /* if(a==b) -> strcmp = 0 */
-#define compare(a,b) ((strcmp((const char *)(a), (const char*)(b)) == 0) ? 1 : 0)
+#define compare(a, b) ((strcmp((const char *)(a), (const char *)(b)) == 0) ? 1 : 0)
 
 
 /* global variables */
@@ -47,13 +47,13 @@ jmethodID  globalMid;
 /* native function - prototype declared in pregenerated header */
 JNIEXPORT jint JNICALL
 Java_org_ocera_tools_GetORTEConstant_getConstant
-(JNIEnv *env, jobject jobj, jstring jname)
+  (JNIEnv *env, jobject jobj, jstring jname)
 {
   const char    *constant;
   int            const_value = 0;
 
   /* get the constant name from JAVA Enviromnent*/
-  constant = (*env)->GetStringUTFChars(env,jname,0);
+  constant = (*env)->GetStringUTFChars(env, jname, 0);
 
 
 
@@ -64,36 +64,36 @@ Java_org_ocera_tools_GetORTEConstant_getConstant
 
   /* RTPS_HEADER_LENGTH */
   #ifdef RTPS_HEADER_LENGTH
-    if (compare(constant,"RTPS_HEADER_LENGTH"))
-      const_value = RTPS_HEADER_LENGTH;
+  if (compare(constant, "RTPS_HEADER_LENGTH"))
+    const_value = RTPS_HEADER_LENGTH;
   #endif
 
 
   /* MAX_PATHNAME */
   #ifdef MAX_PATHNAME
-    if (compare(constant,"MAX_PATHNAME"))
-      const_value = MAX_PATHNAME;
+  if (compare(constant, "MAX_PATHNAME"))
+    const_value = MAX_PATHNAME;
   #endif
 
 
   /* MAX_TYPENAME */
   #ifdef MAX_TYPENAME
-    if (compare(constant,"MAX_TYPENAME"))
-      const_value = MAX_TYPENAME;
+  if (compare(constant, "MAX_TYPENAME"))
+    const_value = MAX_TYPENAME;
   #endif
 
 
   /* ORTE_TRUE */
   #ifdef ORTE_TRUE
-    if (compare(constant,"ORTE_TRUE"))
-      const_value = ORTE_TRUE;
+  if (compare(constant, "ORTE_TRUE"))
+    const_value = ORTE_TRUE;
   #endif
 
 
   /* ORTE_FALSE */
   #ifdef ORTE_FALSE
-    if (compare(constant,"ORTE_FALSE"))
-      const_value = ORTE_FALSE;
+  if (compare(constant, "ORTE_FALSE"))
+    const_value = ORTE_FALSE;
   #endif
 
 /*
@@ -116,7 +116,8 @@ OID_WRITE_APPSELF
 
 
   /* return the result value*/
-  if (const_value == 0) return (-1);
+  if (const_value == 0)
+    return (-1);
 
   return (const_value);
 
@@ -153,7 +154,3 @@ int get_const(char *konstanta)
 // napoveda cpp
 
 */
-
-
-
-
index ffc7c01a8a0e46e7524321d675e83efaa0a32776..1ef829c5ad49e14c57ad281380dada209d1513a7 100644 (file)
@@ -1,8 +1,8 @@
 /* IPAdressToString.c */
 /**
   * This code provides conversion between JAVA a C environments.
-  * The C functions are calling here and results are send to JAVA 
-  * native functions. It uses the header pregenerated by JAVA 
+  * The C functions are calling here and results are send to JAVA
+  * native functions. It uses the header pregenerated by JAVA
   * (by command 'javah -jni class_with_native_function')
   *
   * @author Lukas Pokorny (lukas_pokorny@centrum.cz)
 /* native function - prototype declared in pregenerated header */
 JNIEXPORT jstring JNICALL
 Java_org_ocera_orte_tools_JORTEConversions_IPAddressToString
-(JNIEnv *env, jclass class, jlong long_ipAddr)
+  (JNIEnv *env, jclass class, jlong long_ipAddr)
 {
   char             buff[16];
   IPAddress        ip;
 
   // conversion between data types
-  ip = (IPAddress) long_ipAddr;
+  ip = (IPAddress)long_ipAddr;
   // call the original liborte function
   IPAddressToString(ip, buff);
   // send the result to JAVA Environment
index 2a29efa45cae6c97b282d867c93bfb42b71201be..091dc3df49515b6f496a797d5815ea3f0056cf5d 100644 (file)
 /* native function - prototype declared in pregenerated header */
 JNIEXPORT jstring JNICALL
 Java_org_ocera_orte_types_NtpTime_NtpTimeToStringMs
-(JNIEnv *env, jclass class, jobject j_ntpTime)
+  (JNIEnv *env, jclass class, jobject j_ntpTime)
 {
   char             buff[65];  // 32 + 32 + 1 end char
-  NtpTime          time;      
-  jfieldID         fieldID;     
+  NtpTime          time;
+  jfieldID         fieldID;
   jclass           ntpTimeClass;
 
 
@@ -47,24 +47,24 @@ Java_org_ocera_orte_types_NtpTime_NtpTimeToStringMs
   ntpTimeClass = (*env)->GetObjectClass(env, j_ntpTime);
 
   // seconds - get object field ID
-  fieldID = (*env)->GetFieldID(env,ntpTimeClass,"seconds","I");
-  if(fieldID == NULL)
+  fieldID = (*env)->GetFieldID(env, ntpTimeClass, "seconds", "I");
+  if (fieldID == NULL)
     return((*env)->NewStringUTF(env, "error when reading Java-ntpTime"));
   // get objects value
-  time.seconds = (int32_t) (*env)->GetIntField(env,j_ntpTime,fieldID);
+  time.seconds = (int32_t)(*env)->GetIntField(env, j_ntpTime, fieldID);
 
   // reset pointer
   fieldID = NULL;
 
   // fraction - get object field ID
-  fieldID = (*env)->GetFieldID(env,ntpTimeClass,"fraction","J");
-  if(fieldID == NULL)
+  fieldID = (*env)->GetFieldID(env, ntpTimeClass, "fraction", "J");
+  if (fieldID == NULL)
     return((*env)->NewStringUTF(env, "error when reading Java-ntpTime"));
   // get object's value
-  time.fraction = (uint32_t) (*env)->GetLongField(env,j_ntpTime,fieldID);
+  time.fraction = (uint32_t)(*env)->GetLongField(env, j_ntpTime, fieldID);
 
   // calling original liborte function
-  NtpTimeToStringMs(time,buff);
+  NtpTimeToStringMs(time, buff);
   // return result of the conversion
   return((*env)->NewStringUTF(env, buff));
 }
index 340f5acbe62724a4234792c10767ca080b4e0795..415f9720cba652272c2bb7437c7d840afcbcdd97 100644 (file)
@@ -35,7 +35,7 @@
 /* native function - prototype declared in pregenerated header */
 JNIEXPORT jstring JNICALL
 Java_org_ocera_orte_types_NtpTime_NtpTimeToStringUs
-(JNIEnv *env, jclass class, jobject j_ntpTime)
+  (JNIEnv *env, jclass class, jobject j_ntpTime)
 {
   char             buff[65];  // 32 + 32 + 1 end char
   NtpTime          time;
@@ -47,24 +47,24 @@ Java_org_ocera_orte_types_NtpTime_NtpTimeToStringUs
   ntpTimeClass = (*env)->GetObjectClass(env, j_ntpTime);
 
   // seconds - get object field ID
-  fieldID = (*env)->GetFieldID(env,ntpTimeClass,"seconds","I");
-  if(fieldID == NULL)
+  fieldID = (*env)->GetFieldID(env, ntpTimeClass, "seconds", "I");
+  if (fieldID == NULL)
     return((*env)->NewStringUTF(env, "error when reading Java NtpTime"));
   // get objects value
-  time.seconds = (int32_t) (*env)->GetIntField(env,j_ntpTime,fieldID);
+  time.seconds = (int32_t)(*env)->GetIntField(env, j_ntpTime, fieldID);
 
   // reset pointer
   fieldID = NULL;
 
   // fraction - get object field ID
-  fieldID = (*env)->GetFieldID(env,ntpTimeClass,"fraction","J");
-  if(fieldID == NULL)
+  fieldID = (*env)->GetFieldID(env, ntpTimeClass, "fraction", "J");
+  if (fieldID == NULL)
     return((*env)->NewStringUTF(env, "error when reading Java NtpTime"));
   // get object's value
-  time.fraction = (uint32_t) (*env)->GetLongField(env,j_ntpTime,fieldID);
+  time.fraction = (uint32_t)(*env)->GetLongField(env, j_ntpTime, fieldID);
 
   // calling an orte's function
-  NtpTimeToStringUs(time,buff);
+  NtpTimeToStringUs(time, buff);
   // return result of the conversion
   return((*env)->NewStringUTF(env, buff));
 }
index 93be29d9197686e66089ea056ca89607990c331d..daef24561efbd4d7c23f4e88ad17aac547e80800 100644 (file)
 // /////////////////////////////////////////////////////////////////////
 JNIEXPORT jlong JNICALL
 Java_org_ocera_orte_DomainApp_jORTEDomainDefaultAppCreate
-(JNIEnv *env, jobject obj, jint jdomain, jboolean jsusp)
+  (JNIEnv *env, jobject obj, jint jdomain, jboolean jsusp)
 {
   jlong     d;
 
   #ifdef TEST_STAGE
-    printf(":c: jsem pred ORTEDomainDefaultAppCreate() \n");
+  printf(":c: jsem pred ORTEDomainDefaultAppCreate() \n");
   #endif
   // call ORTE function
-  d = (jlong) ORTEDomainAppCreate((int)jdomain,
-                                 NULL,
-                                 NULL,
-                                 (Boolean) jsusp);
-  if(!d) {
+  d = (jlong)ORTEDomainAppCreate((int)jdomain,
+                                NULL,
+                                NULL,
+                                (Boolean)jsusp);
+  if (!d) {
     printf(":!c: ORTEDomainDefaultAppCreate() FAILED.. \n");
     return 0;
   }
   #ifdef TEST_STAGE
-    printf(":c: ORTEDomainDefautlAppCreate() ok.. + %#"PRIxPTR"\n", (intptr_t)d);
+  printf(":c: ORTEDomainDefautlAppCreate() ok.. + %#" PRIxPTR "\n", (intptr_t)d);
   #endif
   return (d);
 }
@@ -70,12 +70,12 @@ Java_org_ocera_orte_DomainApp_jORTEDomainDefaultAppCreate
 // //////////////////////////////////////////////////////////////////////
 JNIEXPORT jlong JNICALL
 Java_org_ocera_orte_DomainApp_jORTEDomainAppCreate
-(JNIEnv *env, jobject obj,
- jint jdomain,
- jlong propHandle,
- jlong eventsHandle,
- jobject obj_de,
- jboolean jsusp)
+  (JNIEnv *env, jobject obj,
 jint jdomain,
 jlong propHandle,
 jlong eventsHandle,
 jobject obj_de,
 jboolean jsusp)
 {
   // jni varibles
   JavaVM                 *jvm;
@@ -87,16 +87,15 @@ Java_org_ocera_orte_DomainApp_jORTEDomainAppCreate
   JORTEDomainEventsContext_t  *domain_events_cont;
 
   #ifdef TEST_STAGE
-    printf(":c: ORTEDomainAppCreate() called.. \n");
+  printf(":c: ORTEDomainAppCreate() called.. \n");
   #endif
   //assign domain events only if not null
-  if(obj_de != NULL) {
+  if (obj_de != NULL) {
     // memory alocation
-    domain_events_cont = (JORTEDomainEventsContext_t *) malloc(sizeof(JORTEDomainEventsContext_t));
+    domain_events_cont = (JORTEDomainEventsContext_t *)malloc(sizeof(JORTEDomainEventsContext_t));
     // get jvm
-    jint b = (*env)->GetJavaVM(env,&jvm);
-    if (b < 0)
-    {
+    jint b = (*env)->GetJavaVM(env, &jvm);
+    if (b < 0) {
       printf(":!c: getJavaVM() failed! \n");
       return 0;
     }
@@ -105,79 +104,77 @@ Java_org_ocera_orte_DomainApp_jORTEDomainAppCreate
     // domain events
     domain_events_cont->obj_de = (*env)->NewGlobalRef(env, obj_de);
     // get new events
-    dom_events = (ORTEDomainAppEvents *) eventsHandle;
+    dom_events = (ORTEDomainAppEvents *)eventsHandle;
     ////////////////////////////////////////////////
     // set new events & their prarameters
     // onRegFail
-    dom_events->onRegFail = (ORTEOnRegFail) onRegFail;
-    dom_events->onRegFailParam = (void *) domain_events_cont;
+    dom_events->onRegFail = (ORTEOnRegFail)onRegFail;
+    dom_events->onRegFailParam = (void *)domain_events_cont;
     // onMgrNew
-    dom_events->onMgrNew = (ORTEOnMgrNew) onMgrNew;
-    dom_events->onMgrNewParam = (void *) domain_events_cont;
+    dom_events->onMgrNew = (ORTEOnMgrNew)onMgrNew;
+    dom_events->onMgrNewParam = (void *)domain_events_cont;
     // onMgrDelete
-    dom_events->onMgrDelete = (ORTEOnMgrDelete) onMgrDelete;
-    dom_events->onMgrDeleteParam = (void *) domain_events_cont;
+    dom_events->onMgrDelete = (ORTEOnMgrDelete)onMgrDelete;
+    dom_events->onMgrDeleteParam = (void *)domain_events_cont;
     // onAppRemoteNew
-    dom_events->onAppRemoteNew = (ORTEOnAppRemoteNew) onAppRemoteNew;
-    dom_events->onAppRemoteNewParam = (void *) domain_events_cont;
+    dom_events->onAppRemoteNew = (ORTEOnAppRemoteNew)onAppRemoteNew;
+    dom_events->onAppRemoteNewParam = (void *)domain_events_cont;
     // onAppDelete
-    dom_events->onAppDelete = (ORTEOnAppDelete) onAppDelete;
-    dom_events->onAppDeleteParam = (void *) domain_events_cont;
+    dom_events->onAppDelete = (ORTEOnAppDelete)onAppDelete;
+    dom_events->onAppDeleteParam = (void *)domain_events_cont;
     // onPubRemoteNew
-    dom_events->onPubRemoteNew = (ORTEOnPubRemote) onPubRemoteNew;
-    dom_events->onPubRemoteNewParam = (void *) domain_events_cont;
+    dom_events->onPubRemoteNew = (ORTEOnPubRemote)onPubRemoteNew;
+    dom_events->onPubRemoteNewParam = (void *)domain_events_cont;
     // onPubRemoteChanged
-    dom_events->onPubRemoteChanged = (ORTEOnPubRemote) onPubRemoteChanged;
-    dom_events->onPubRemoteChangedParam = (void *) domain_events_cont;
+    dom_events->onPubRemoteChanged = (ORTEOnPubRemote)onPubRemoteChanged;
+    dom_events->onPubRemoteChangedParam = (void *)domain_events_cont;
     // onPubDelete
-    dom_events->onPubDelete = (ORTEOnPubDelete) onPubDelete;
-    dom_events->onPubDeleteParam = (void *) domain_events_cont;
+    dom_events->onPubDelete = (ORTEOnPubDelete)onPubDelete;
+    dom_events->onPubDeleteParam = (void *)domain_events_cont;
     // onSubRemoteNew
-    dom_events->onSubRemoteNew = (ORTEOnSubRemote) onSubRemoteNew;
-    dom_events->onSubRemoteNewParam = (void *) domain_events_cont;
+    dom_events->onSubRemoteNew = (ORTEOnSubRemote)onSubRemoteNew;
+    dom_events->onSubRemoteNewParam = (void *)domain_events_cont;
     // onSubRemoteChanged
-    dom_events->onSubRemoteChanged = (ORTEOnSubRemote) onSubRemoteChanged;
-    dom_events->onSubRemoteChangedParam = (void *) domain_events_cont;
+    dom_events->onSubRemoteChanged = (ORTEOnSubRemote)onSubRemoteChanged;
+    dom_events->onSubRemoteChangedParam = (void *)domain_events_cont;
     // onSubDelete
-    dom_events->onSubDelete = (ORTEOnSubDelete) onSubDelete;
-    dom_events->onSubDeleteParam = (void *) domain_events_cont;
+    dom_events->onSubDelete = (ORTEOnSubDelete)onSubDelete;
+    dom_events->onSubDeleteParam = (void *)domain_events_cont;
     ////////////////////////////////////////////////
     cls = (*env)->GetObjectClass(env, obj);
-    if(cls == 0)
-    {
+    if (cls == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: cls = NULL \n");
+      printf(":!c: cls = NULL \n");
       #endif
       return 0;
     }
     // fieldID - domainEventsContextHandle
     fid = (*env)->GetFieldID(env,
-                             cls,
-                             "domainEventsContextHandle",
-                             "J");
-    if(fid == 0)
-    {
+                            cls,
+                            "domainEventsContextHandle",
+                            "J");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       return 0;
     }
     (*env)->SetLongField(env,
-                        obj,
-                        fid,
-                        (jlong) domain_events_cont);
+                        obj,
+                        fid,
+                        (jlong)domain_events_cont);
   }
   // call ORTE function
-  d = (jlong) ORTEDomainAppCreate((int)jdomain,
-                                 (ORTEDomainProp *) propHandle,
-                                 (ORTEDomainAppEvents *) eventsHandle,
-                                 (Boolean) jsusp);
-  if(!d) {
+  d = (jlong)ORTEDomainAppCreate((int)jdomain,
+                                (ORTEDomainProp *)propHandle,
+                                (ORTEDomainAppEvents *)eventsHandle,
+                                (Boolean)jsusp);
+  if (!d) {
     printf(":!c: creating app domain failed! [NULL handle]  \n");
     return 0;
   }
   #ifdef TEST_STAGE
-    printf(":c: ORTEDomainAppCreate() ok.. + %#"PRIxPTR"\n", (intptr_t)d);
+  printf(":c: ORTEDomainAppCreate() ok.. + %#" PRIxPTR "\n", (intptr_t)d);
   #endif
   return (d);
 }
index 460682b34863f9d2400df29c9283dba3c6328f1e..d7087cd16c5c68e3e87f18ca27aba89583e82b74 100644 (file)
@@ -36,7 +36,7 @@
 
 JNIEXPORT jboolean JNICALL
 Java_org_ocera_orte_DomainApp_jORTEDomainAppDestroy
-(JNIEnv *env, jobject obj, jlong dhandle)
+  (JNIEnv *env, jobject obj, jlong dhandle)
 {
   jlong       h;
   jclass      cls;
@@ -45,16 +45,14 @@ Java_org_ocera_orte_DomainApp_jORTEDomainAppDestroy
 
   do {
     // check domain handle
-    if (dhandle == 0)
-    {
+    if (dhandle == 0) {
       printf(":!c: ORTEDomainAppDestroy failed! [bad handle] \n");
       break;
     }
     // call ORTE function
-    if (!ORTEDomainAppDestroy((ORTEDomain *) dhandle))
-    {
+    if (!ORTEDomainAppDestroy((ORTEDomain *)dhandle)) {
       #ifdef TEST_STAGE
-         printf(":c: ORTEDomainAppDestroy failed.. \n");
+      printf(":c: ORTEDomainAppDestroy failed.. \n");
       #endif
       break;
     }
@@ -62,45 +60,40 @@ Java_org_ocera_orte_DomainApp_jORTEDomainAppDestroy
     // free domainEvents object
     // find cls
     cls = (*env)->GetObjectClass(env, obj);
-    if(cls == 0)
-    {
+    if (cls == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: cls = NULL! \n");
+      printf(":!c: cls = NULL! \n");
       #endif
       break;
     }
     // fieldID
     fid = (*env)->GetFieldID(env,
-                             cls,
-                             "domainEventsContextHandle",
-                             "J");
-    if(fid == 0)
-    {
+                            cls,
+                            "domainEventsContextHandle",
+                            "J");
+    if (fid == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: fid = NULL! \n");
+      printf(":!c: fid = NULL! \n");
      #endif
-     break;
+      break;
     }
     // get value
     h = (*env)->GetLongField(env, obj, fid);
-    if(h)
-    {
-      JORTEDomainEventsContext_t *ctx = (JORTEDomainEventsContext_t*)h;
-      if(ctx->obj_de)
-      {
-        #ifdef TEST_STAGE
-          printf(":c: deleting ctx->obj_de \n");
-        #endif
-        (*env)->DeleteGlobalRef(env, ctx->obj_de);
+    if (h) {
+      JORTEDomainEventsContext_t *ctx = (JORTEDomainEventsContext_t *)h;
+      if (ctx->obj_de) {
+       #ifdef TEST_STAGE
+       printf(":c: deleting ctx->obj_de \n");
+       #endif
+       (*env)->DeleteGlobalRef(env, ctx->obj_de);
       }
       //
-      free((void*)h);
+      free((void *)h);
     }
     flag_ok = 1;
-  } while(0);
+  } while (0);
 
-  if(flag_ok == 0)
-  {
+  if (flag_ok == 0) {
     printf(":!c: ORTEDomainAppDestroy failed!  \n");
     return 0;
   }
index 1241d7b4b2566af2a0e00976808628307fda1661..825742bbb653e758ed67fd8067781b57c3d530db 100644 (file)
@@ -18,74 +18,67 @@ onRegFail(void *param)
   jclass           cls;
   jmethodID        mid;
   //
-  JORTEDomainEventsContext_t   *domain_events_cont = (JORTEDomainEventsContext_t*) param;
+  JORTEDomainEventsContext_t   *domain_events_cont = (JORTEDomainEventsContext_t *)param;
   int flag_ok = 0;
 
   #ifdef TEST_STAGE
-      printf(":c: event func. 'onRegFail()' called.. \n");
+  printf(":c: event func. 'onRegFail()' called.. \n");
   #endif
 
-  do
-  {
+  do {
 // ///////////////////////////////// SPOLECNA CAST //
-    if(domain_events_cont->jvm == 0)
-    {
+    if (domain_events_cont->jvm == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: jvm = NULL! \n");
+      printf(":!c: jvm = NULL! \n");
      #endif
-     break;
+      break;
     }
     jvm = domain_events_cont->jvm;
     // get env
     (*jvm)->AttachCurrentThread(jvm,
-                                #ifdef __ANDROID__
-                                  &env,
-                                #else
-                                  (void **)&env,
-                                #endif
-                                NULL);
-    if(env == 0)
-    {
+                               #ifdef __ANDROID__
+                               &env,
+                               #else
+                               (void **)&env,
+                               #endif
+                               NULL);
+    if (env == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: env = NULL! \n");
+      printf(":!c: env = NULL! \n");
      #endif
-     break;
+      break;
     }
     // find class
     cls = findClass(env, "org.ocera.orte.types.DomainEvents");
-    if(cls == 0)
-    {
+    if (cls == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: cls = NULL! \n");
+      printf(":!c: cls = NULL! \n");
      #endif
-     break;
+      break;
     }
 // ///////////////////////////////// SPOLECNA CAST //
     // get method ID
     mid = (*env)->GetMethodID(env,
-                              cls,
-                              "onRegFail",
-                              "()V");
-    if(mid == 0)
-    {
+                             cls,
+                             "onRegFail",
+                             "()V");
+    if (mid == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: mid = NULL! \n");
+      printf(":!c: mid = NULL! \n");
      #endif
-     break;
+      break;
     }
     // call method
     (*env)->CallVoidMethod(env,
-                           domain_events_cont->obj_de,
-                           mid);
+                          domain_events_cont->obj_de,
+                          mid);
     flag_ok = 1;
-  } while(0);
+  } while (0);
   // while broken
-  if(flag_ok)
-  {
-    if((*jvm)->DetachCurrentThread(jvm) != 0)
-    {
+  if (flag_ok) {
+    if ((*jvm)->DetachCurrentThread(jvm) != 0) {
       printf(":c!: DetachCurrentThread fault! \n");
-      return  ORTE_FALSE;
+      return ORTE_FALSE;
     }
   }
 
@@ -106,84 +99,76 @@ onMgrNew(const struct ORTEAppInfo *appInfo, void *param)
   jobject          obj_ainfo;
   jmethodID        mid;
   //
-  JORTEDomainEventsContext_t   *domain_events_cont = (JORTEDomainEventsContext_t*) param;
+  JORTEDomainEventsContext_t   *domain_events_cont = (JORTEDomainEventsContext_t *)param;
   int flag_ok = 0;
 
   #ifdef TEST_STAGE
-      printf(":c: event func. 'onMgrNew()' called.. \n");
+  printf(":c: event func. 'onMgrNew()' called.. \n");
   #endif
 
-  do
-  {
+  do {
 // ///////////////////////////////// SPOLECNA CAST //
-    if(domain_events_cont->jvm == 0)
-    {
+    if (domain_events_cont->jvm == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: jvm = NULL! \n");
+      printf(":!c: jvm = NULL! \n");
      #endif
-     break;
+      break;
     }
     jvm = domain_events_cont->jvm;
     // get env
     (*jvm)->AttachCurrentThread(jvm,
-                                #ifdef __ANDROID__
-                                  &env,
-                                #else
-                                  (void **)&env,
-                                #endif
-                                NULL);
-    if(env == 0)
-    {
+                               #ifdef __ANDROID__
+                               &env,
+                               #else
+                               (void **)&env,
+                               #endif
+                               NULL);
+    if (env == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: env = NULL! \n");
+      printf(":!c: env = NULL! \n");
      #endif
-     break;
+      break;
     }
     // find class
     cls = findClass(env, "org.ocera.orte.types.DomainEvents");
-    if(cls == 0)
-    {
+    if (cls == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: cls = NULL! \n");
+      printf(":!c: cls = NULL! \n");
      #endif
-     break;
+      break;
     }
     // create AppInfo instance
     obj_ainfo = createAppInfo(env, appInfo);
-    if(obj_ainfo == 0)
-    {
+    if (obj_ainfo == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: obj_ainfo = NULL! \n");
+      printf(":!c: obj_ainfo = NULL! \n");
      #endif
-     break;
+      break;
     }
 // ///////////////////////////////// SPOLECNA CAST //
     // get method ID
     mid = (*env)->GetMethodID(env,
-                              cls,
-                              "onMgrNew",
-                              "(Lorg/ocera/orte/types/AppInfo;)V");
-    if(mid == 0)
-    {
+                             cls,
+                             "onMgrNew",
+                             "(Lorg/ocera/orte/types/AppInfo;)V");
+    if (mid == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: mid = NULL! \n");
+      printf(":!c: mid = NULL! \n");
      #endif
-     break;
+      break;
     }
     // call method
     (*env)->CallVoidMethod(env,
-                           domain_events_cont->obj_de,
-                           mid,
-                           obj_ainfo);
+                          domain_events_cont->obj_de,
+                          mid,
+                          obj_ainfo);
     flag_ok = 1;
-  } while(0);
+  } while (0);
   // while broken
-  if(flag_ok)
-  {
-    if((*jvm)->DetachCurrentThread(jvm) != 0)
-    {
+  if (flag_ok) {
+    if ((*jvm)->DetachCurrentThread(jvm) != 0) {
       printf(":c!: DetachCurrentThread fault! \n");
-      return  ORTE_FALSE;
+      return ORTE_FALSE;
     }
   }
 
@@ -204,84 +189,76 @@ onMgrDelete(const struct ORTEAppInfo *appInfo, void *param)
   jobject          obj_ainfo;
   jmethodID        mid;
   //
-  JORTEDomainEventsContext_t   *domain_events_cont = (JORTEDomainEventsContext_t*) param;
+  JORTEDomainEventsContext_t   *domain_events_cont = (JORTEDomainEventsContext_t *)param;
   int flag_ok = 0;
 
   #ifdef TEST_STAGE
-      printf(":c: event func. 'onMgrDelete()' called.. \n");
+  printf(":c: event func. 'onMgrDelete()' called.. \n");
   #endif
 
-  do
-  {
+  do {
 // ///////////////////////////////// SPOLECNA CAST //
-    if(domain_events_cont->jvm == 0)
-    {
+    if (domain_events_cont->jvm == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: jvm = NULL! \n");
+      printf(":!c: jvm = NULL! \n");
      #endif
-     break;
+      break;
     }
     jvm = domain_events_cont->jvm;
     // get env
     (*jvm)->AttachCurrentThread(jvm,
-                                #ifdef __ANDROID__
-                                  &env,
-                                #else
-                                  (void **)&env,
-                                #endif
-                                NULL);
-    if(env == 0)
-    {
+                               #ifdef __ANDROID__
+                               &env,
+                               #else
+                               (void **)&env,
+                               #endif
+                               NULL);
+    if (env == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: env = NULL! \n");
+      printf(":!c: env = NULL! \n");
      #endif
-     break;
+      break;
     }
     // find class
     cls = findClass(env, "org.ocera.orte.types.DomainEvents");
-    if(cls == 0)
-    {
+    if (cls == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: cls = NULL! \n");
+      printf(":!c: cls = NULL! \n");
      #endif
-     break;
+      break;
     }
     // create AppInfo instance
     obj_ainfo = createAppInfo(env, appInfo);
-    if(obj_ainfo == 0)
-    {
+    if (obj_ainfo == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: obj_ainfo = NULL! \n");
+      printf(":!c: obj_ainfo = NULL! \n");
      #endif
-     break;
+      break;
     }
 // ///////////////////////////////// SPOLECNA CAST //
     // get method ID
     mid = (*env)->GetMethodID(env,
-                              cls,
-                              "onMgrDelete",
-                              "(Lorg/ocera/orte/types/AppInfo;)V");
-    if(mid == 0)
-    {
+                             cls,
+                             "onMgrDelete",
+                             "(Lorg/ocera/orte/types/AppInfo;)V");
+    if (mid == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: mid = NULL! \n");
+      printf(":!c: mid = NULL! \n");
      #endif
-     break;
+      break;
     }
     // call method
     (*env)->CallVoidMethod(env,
-                           domain_events_cont->obj_de,
-                           mid,
-                           obj_ainfo);
+                          domain_events_cont->obj_de,
+                          mid,
+                          obj_ainfo);
     flag_ok = 1;
-  } while(0);
+  } while (0);
   // while broken
-  if(flag_ok)
-  {
-    if((*jvm)->DetachCurrentThread(jvm) != 0)
-    {
+  if (flag_ok) {
+    if ((*jvm)->DetachCurrentThread(jvm) != 0) {
       printf(":c!: DetachCurrentThread fault! \n");
-      return  ORTE_FALSE;
+      return ORTE_FALSE;
     }
   }
 
@@ -303,85 +280,77 @@ onAppRemoteNew(const struct ORTEAppInfo *appInfo, void *param)
   jobject          obj_ainfo;
   jmethodID        mid;
   //
-  JORTEDomainEventsContext_t   *domain_events_cont = (JORTEDomainEventsContext_t*) param;
+  JORTEDomainEventsContext_t   *domain_events_cont = (JORTEDomainEventsContext_t *)param;
   int flag_ok = 0;
 
   #ifdef TEST_STAGE
-      printf(":c: event func. 'onAppRemoteNew()' called.. \n");
+  printf(":c: event func. 'onAppRemoteNew()' called.. \n");
   #endif
 
-  do
-  {
+  do {
 // ///////////////////////////////// SPOLECNA CAST //
-    if(domain_events_cont->jvm == 0)
-    {
+    if (domain_events_cont->jvm == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: jvm = NULL! \n");
+      printf(":!c: jvm = NULL! \n");
      #endif
-     break;
+      break;
     }
     jvm = domain_events_cont->jvm;
     // get env
     (*jvm)->AttachCurrentThread(jvm,
-                                #ifdef __ANDROID__
-                                  &env,
-                                #else
-                                  (void **)&env,
-                                #endif
-                                NULL);
-    if(env == 0)
-    {
+                               #ifdef __ANDROID__
+                               &env,
+                               #else
+                               (void **)&env,
+                               #endif
+                               NULL);
+    if (env == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: env = NULL! \n");
+      printf(":!c: env = NULL! \n");
      #endif
-     break;
+      break;
     }
     // find class
     cls = findClass(env, "org.ocera.orte.types.DomainEvents");
-    if(cls == 0)
-    {
+    if (cls == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: cls = NULL! \n");
+      printf(":!c: cls = NULL! \n");
      #endif
-     break;
+      break;
     }
     // create AppInfo instance
     obj_ainfo = createAppInfo(env, appInfo);
-    if(obj_ainfo == 0)
-    {
+    if (obj_ainfo == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: obj_ainfo = NULL! \n");
+      printf(":!c: obj_ainfo = NULL! \n");
      #endif
-     break;
+      break;
     }
 // ///////////////////////////////// SPOLECNA CAST //
 
     // get method ID
     mid = (*env)->GetMethodID(env,
-                              cls,
-                              "onAppRemoteNew",
-                              "(Lorg/ocera/orte/types/AppInfo;)V");
-    if(mid == 0)
-    {
+                             cls,
+                             "onAppRemoteNew",
+                             "(Lorg/ocera/orte/types/AppInfo;)V");
+    if (mid == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: mid = NULL! \n");
+      printf(":!c: mid = NULL! \n");
      #endif
-     break;
+      break;
     }
     // call method
     (*env)->CallVoidMethod(env,
-                           domain_events_cont->obj_de,
-                           mid,
-                           obj_ainfo);
+                          domain_events_cont->obj_de,
+                          mid,
+                          obj_ainfo);
     flag_ok = 1;
-  } while(0);
+  } while (0);
   // while broken
-  if(flag_ok)
-  {
-    if((*jvm)->DetachCurrentThread(jvm) != 0)
-    {
+  if (flag_ok) {
+    if ((*jvm)->DetachCurrentThread(jvm) != 0) {
       printf(":c!: DetachCurrentThread fault! \n");
-      return  ORTE_FALSE;
+      return ORTE_FALSE;
     }
   }
 
@@ -402,84 +371,76 @@ onAppDelete(const struct ORTEAppInfo *appInfo, void *param)
   jobject          obj_ainfo;
   jmethodID        mid;
   //
-  JORTEDomainEventsContext_t   *domain_events_cont = (JORTEDomainEventsContext_t*) param;
+  JORTEDomainEventsContext_t   *domain_events_cont = (JORTEDomainEventsContext_t *)param;
   int flag_ok = 0;
 
   #ifdef TEST_STAGE
-      printf(":c: event func. 'onAppDelete()' called.. \n");
+  printf(":c: event func. 'onAppDelete()' called.. \n");
   #endif
 
-  do
-  {
+  do {
 // ///////////////////////////////// SPOLECNA CAST //
-    if(domain_events_cont->jvm == 0)
-    {
+    if (domain_events_cont->jvm == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: jvm = NULL! \n");
+      printf(":!c: jvm = NULL! \n");
      #endif
-     break;
+      break;
     }
     jvm = domain_events_cont->jvm;
     // get env
     (*jvm)->AttachCurrentThread(jvm,
-                                #ifdef __ANDROID__
-                                  &env,
-                                #else
-                                  (void **)&env,
-                                #endif
-                                NULL);
-    if(env == 0)
-    {
+                               #ifdef __ANDROID__
+                               &env,
+                               #else
+                               (void **)&env,
+                               #endif
+                               NULL);
+    if (env == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: env = NULL! \n");
+      printf(":!c: env = NULL! \n");
      #endif
-     break;
+      break;
     }
     // find class
     cls = findClass(env, "org.ocera.orte.types.DomainEvents");
-    if(cls == 0)
-    {
+    if (cls == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: cls = NULL! \n");
+      printf(":!c: cls = NULL! \n");
      #endif
-     break;
+      break;
     }
     // create AppInfo instance
     obj_ainfo = createAppInfo(env, appInfo);
-    if(obj_ainfo == 0)
-    {
+    if (obj_ainfo == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: obj_ainfo = NULL! \n");
+      printf(":!c: obj_ainfo = NULL! \n");
      #endif
-     break;
+      break;
     }
 // ///////////////////////////////// SPOLECNA CAST //
     // get method ID
     mid = (*env)->GetMethodID(env,
-                              cls,
-                              "onAppDelete",
-                              "(Lorg/ocera/orte/types/AppInfo;)V");
-    if(mid == 0)
-    {
+                             cls,
+                             "onAppDelete",
+                             "(Lorg/ocera/orte/types/AppInfo;)V");
+    if (mid == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: mid = NULL! \n");
+      printf(":!c: mid = NULL! \n");
      #endif
-     break;
+      break;
     }
     // call method
     (*env)->CallVoidMethod(env,
-                           domain_events_cont->obj_de,
-                           mid,
-                           obj_ainfo);
+                          domain_events_cont->obj_de,
+                          mid,
+                          obj_ainfo);
     flag_ok = 1;
-  } while(0);
+  } while (0);
   // while broken
-  if(flag_ok)
-  {
-    if((*jvm)->DetachCurrentThread(jvm) != 0)
-    {
+  if (flag_ok) {
+    if ((*jvm)->DetachCurrentThread(jvm) != 0) {
       printf(":c!: DetachCurrentThread fault! \n");
-      return  ORTE_FALSE;
+      return ORTE_FALSE;
     }
   }
 
@@ -492,8 +453,8 @@ onAppDelete(const struct ORTEAppInfo *appInfo, void *param)
 // /////////////////////////////////////////////////////////////////////
 Boolean
 onPubRemoteNew(const struct ORTEAppInfo *appInfo,
-               const struct ORTEPubInfo *pubInfo,
-               void *param)
+              const struct ORTEPubInfo *pubInfo,
+              void *param)
 {
 // ///////////////////////////////// SPOLECNA CAST //
   JavaVM          *jvm = NULL;
@@ -503,94 +464,85 @@ onPubRemoteNew(const struct ORTEAppInfo *appInfo,
   jobject          obj_pinfo;
   jmethodID        mid;
   //
-  JORTEDomainEventsContext_t   *domain_events_cont = (JORTEDomainEventsContext_t*) param;
+  JORTEDomainEventsContext_t   *domain_events_cont = (JORTEDomainEventsContext_t *)param;
   int flag_ok = 0;
 
   #ifdef TEST_STAGE
-      printf(":c: event func. 'onPubRemoteNew()' called.. \n");
+  printf(":c: event func. 'onPubRemoteNew()' called.. \n");
   #endif
 
-  do
-  {
+  do {
 // ///////////////////////////////// SPOLECNA CAST //
-    if(domain_events_cont->jvm == 0)
-    {
+    if (domain_events_cont->jvm == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: jvm = NULL! \n");
+      printf(":!c: jvm = NULL! \n");
      #endif
-     break;
+      break;
     }
     jvm = domain_events_cont->jvm;
     // get env
     (*jvm)->AttachCurrentThread(jvm,
-                                #ifdef __ANDROID__
-                                  &env,
-                                #else
-                                  (void **)&env,
-                                #endif
-                                NULL);
-    if(env == 0)
-    {
+                               #ifdef __ANDROID__
+                               &env,
+                               #else
+                               (void **)&env,
+                               #endif
+                               NULL);
+    if (env == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: env = NULL! \n");
+      printf(":!c: env = NULL! \n");
      #endif
-     break;
+      break;
     }
     // find class
     cls = findClass(env, "org.ocera.orte.types.DomainEvents");
-    if(cls == 0)
-    {
+    if (cls == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: cls = NULL! \n");
+      printf(":!c: cls = NULL! \n");
      #endif
-     break;
+      break;
     }
     // create AppInfo instance
     obj_ainfo = createAppInfo(env, appInfo);
-    if(obj_ainfo == 0)
-    {
+    if (obj_ainfo == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: obj_ainfo = NULL! \n");
+      printf(":!c: obj_ainfo = NULL! \n");
      #endif
-     break;
+      break;
     }
     // create PubInfo instance
     obj_pinfo = createPubInfo(env, pubInfo);
-    if(obj_pinfo == 0)
-    {
+    if (obj_pinfo == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: obj_pinfo = NULL! \n");
+      printf(":!c: obj_pinfo = NULL! \n");
      #endif
-     break;
+      break;
     }
 // ///////////////////////////////// SPOLECNA CAST //
     // get method ID
     mid = (*env)->GetMethodID(env,
-                              cls,
-                              "onPubRemoteNew",
-                              "(Lorg/ocera/orte/types/AppInfo;Lorg/ocera/orte/types/PubInfo;)V");
-    if(mid == 0)
-    {
+                             cls,
+                             "onPubRemoteNew",
+                             "(Lorg/ocera/orte/types/AppInfo;Lorg/ocera/orte/types/PubInfo;)V");
+    if (mid == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: mid = NULL! \n");
+      printf(":!c: mid = NULL! \n");
      #endif
-     break;
+      break;
     }
     // call method
     (*env)->CallVoidMethod(env,
-                           domain_events_cont->obj_de,
-                           mid,
-                           obj_ainfo,
-                           obj_pinfo);
+                          domain_events_cont->obj_de,
+                          mid,
+                          obj_ainfo,
+                          obj_pinfo);
     flag_ok = 1;
-  } while(0);
+  } while (0);
   // while broken
-  if(flag_ok)
-  {
-    if((*jvm)->DetachCurrentThread(jvm) != 0)
-    {
+  if (flag_ok) {
+    if ((*jvm)->DetachCurrentThread(jvm) != 0) {
       printf(":c!: DetachCurrentThread fault! \n");
-      return  ORTE_FALSE;
+      return ORTE_FALSE;
     }
   }
 
@@ -603,8 +555,8 @@ onPubRemoteNew(const struct ORTEAppInfo *appInfo,
 // /////////////////////////////////////////////////////////////////////
 Boolean
 onPubRemoteChanged(const struct ORTEAppInfo *appInfo,
-                   const struct ORTEPubInfo *pubInfo,
-                   void *param)
+                  const struct ORTEPubInfo *pubInfo,
+                  void *param)
 {
 // ///////////////////////////////// SPOLECNA CAST //
   JavaVM          *jvm = NULL;
@@ -614,94 +566,85 @@ onPubRemoteChanged(const struct ORTEAppInfo *appInfo,
   jobject          obj_pinfo;
   jmethodID        mid;
   //
-  JORTEDomainEventsContext_t   *domain_events_cont = (JORTEDomainEventsContext_t*) param;
+  JORTEDomainEventsContext_t   *domain_events_cont = (JORTEDomainEventsContext_t *)param;
   int flag_ok = 0;
 
   #ifdef TEST_STAGE
-      printf(":c: event func. 'onPubRemoteChanged()' called.. \n");
+  printf(":c: event func. 'onPubRemoteChanged()' called.. \n");
   #endif
 
-  do
-  {
+  do {
 // ///////////////////////////////// SPOLECNA CAST //
-    if(domain_events_cont->jvm == 0)
-    {
+    if (domain_events_cont->jvm == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: jvm = NULL! \n");
+      printf(":!c: jvm = NULL! \n");
      #endif
-     break;
+      break;
     }
     jvm = domain_events_cont->jvm;
     // get env
     (*jvm)->AttachCurrentThread(jvm,
-                                #ifdef __ANDROID__
-                                  &env,
-                                #else
-                                  (void **)&env,
-                                #endif
-                                NULL);
-    if(env == 0)
-    {
+                               #ifdef __ANDROID__
+                               &env,
+                               #else
+                               (void **)&env,
+                               #endif
+                               NULL);
+    if (env == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: env = NULL! \n");
+      printf(":!c: env = NULL! \n");
      #endif
-     break;
+      break;
     }
     // find class
     cls = findClass(env, "org.ocera.orte.types.DomainEvents");
-    if(cls == 0)
-    {
+    if (cls == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: cls = NULL! \n");
+      printf(":!c: cls = NULL! \n");
      #endif
-     break;
+      break;
     }
     // create AppInfo instance
     obj_ainfo = createAppInfo(env, appInfo);
-    if(obj_ainfo == 0)
-    {
+    if (obj_ainfo == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: obj_ainfo = NULL! \n");
+      printf(":!c: obj_ainfo = NULL! \n");
      #endif
-     break;
+      break;
     }
     // create PubInfo instance
     obj_pinfo = createPubInfo(env, pubInfo);
-    if(obj_pinfo == 0)
-    {
+    if (obj_pinfo == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: obj_pinfo = NULL! \n");
+      printf(":!c: obj_pinfo = NULL! \n");
      #endif
-     break;
+      break;
     }
 // ///////////////////////////////// SPOLECNA CAST //
     // get method ID
     mid = (*env)->GetMethodID(env,
-                              cls,
-                              "onPubRemoteChanged",
-                              "(Lorg/ocera/orte/types/AppInfo;Lorg/ocera/orte/types/PubInfo;)V");
-    if(mid == 0)
-    {
+                             cls,
+                             "onPubRemoteChanged",
+                             "(Lorg/ocera/orte/types/AppInfo;Lorg/ocera/orte/types/PubInfo;)V");
+    if (mid == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: mid = NULL! \n");
+      printf(":!c: mid = NULL! \n");
      #endif
-     break;
+      break;
     }
     // call method
     (*env)->CallVoidMethod(env,
-                           domain_events_cont->obj_de,
-                           mid,
-                           obj_ainfo,
-                           obj_pinfo);
+                          domain_events_cont->obj_de,
+                          mid,
+                          obj_ainfo,
+                          obj_pinfo);
     flag_ok = 1;
-  } while(0);
+  } while (0);
   // while broken
-  if(flag_ok)
-  {
-    if((*jvm)->DetachCurrentThread(jvm) != 0)
-    {
+  if (flag_ok) {
+    if ((*jvm)->DetachCurrentThread(jvm) != 0) {
       printf(":c!: DetachCurrentThread fault! \n");
-      return  ORTE_FALSE;
+      return ORTE_FALSE;
     }
   }
 
@@ -716,8 +659,8 @@ onPubRemoteChanged(const struct ORTEAppInfo *appInfo,
 // /////////////////////////////////////////////////////////////////////
 Boolean
 onPubDelete(const struct ORTEAppInfo *appInfo,
-            const struct ORTEPubInfo *pubInfo,
-            void *param)
+           const struct ORTEPubInfo *pubInfo,
+           void *param)
 {
 // ///////////////////////////////// SPOLECNA CAST //
   JavaVM          *jvm = NULL;
@@ -727,94 +670,85 @@ onPubDelete(const struct ORTEAppInfo *appInfo,
   jobject          obj_pinfo;
   jmethodID        mid;
   //
-  JORTEDomainEventsContext_t   *domain_events_cont = (JORTEDomainEventsContext_t*) param;
+  JORTEDomainEventsContext_t   *domain_events_cont = (JORTEDomainEventsContext_t *)param;
   int flag_ok = 0;
 
   #ifdef TEST_STAGE
-      printf(":c: event func. 'onPubDelete()' called.. \n");
+  printf(":c: event func. 'onPubDelete()' called.. \n");
   #endif
 
-  do
-  {
+  do {
 // ///////////////////////////////// SPOLECNA CAST //
-    if(domain_events_cont->jvm == 0)
-    {
+    if (domain_events_cont->jvm == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: jvm = NULL! \n");
+      printf(":!c: jvm = NULL! \n");
      #endif
-     break;
+      break;
     }
     jvm = domain_events_cont->jvm;
     // get env
     (*jvm)->AttachCurrentThread(jvm,
-                                #ifdef __ANDROID__
-                                  &env,
-                                #else
-                                  (void **)&env,
-                                #endif
-                                NULL);
-    if(env == 0)
-    {
+                               #ifdef __ANDROID__
+                               &env,
+                               #else
+                               (void **)&env,
+                               #endif
+                               NULL);
+    if (env == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: env = NULL! \n");
+      printf(":!c: env = NULL! \n");
      #endif
-     break;
+      break;
     }
     // find class
     cls = findClass(env, "org.ocera.orte.types.DomainEvents");
-    if(cls == 0)
-    {
+    if (cls == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: cls = NULL! \n");
+      printf(":!c: cls = NULL! \n");
      #endif
-     break;
+      break;
     }
     // create AppInfo instance
     obj_ainfo = createAppInfo(env, appInfo);
-    if(obj_ainfo == 0)
-    {
+    if (obj_ainfo == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: obj_ainfo = NULL! \n");
+      printf(":!c: obj_ainfo = NULL! \n");
      #endif
-     break;
+      break;
     }
     // create PubInfo instance
     obj_pinfo = createPubInfo(env, pubInfo);
-    if(obj_pinfo == 0)
-    {
+    if (obj_pinfo == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: obj_pinfo = NULL! \n");
+      printf(":!c: obj_pinfo = NULL! \n");
      #endif
-     break;
+      break;
     }
 // ///////////////////////////////// SPOLECNA CAST //
     // get method ID
     mid = (*env)->GetMethodID(env,
-                              cls,
-                              "onPubDelete",
-                              "(Lorg/ocera/orte/types/AppInfo;Lorg/ocera/orte/types/PubInfo;)V");
-    if(mid == 0)
-    {
+                             cls,
+                             "onPubDelete",
+                             "(Lorg/ocera/orte/types/AppInfo;Lorg/ocera/orte/types/PubInfo;)V");
+    if (mid == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: mid = NULL! \n");
+      printf(":!c: mid = NULL! \n");
      #endif
-     break;
+      break;
     }
     // call method
     (*env)->CallVoidMethod(env,
-                           domain_events_cont->obj_de,
-                           mid,
-                           obj_ainfo,
-                           obj_pinfo);
+                          domain_events_cont->obj_de,
+                          mid,
+                          obj_ainfo,
+                          obj_pinfo);
     flag_ok = 1;
-  } while(0);
+  } while (0);
   // while broken
-  if(flag_ok)
-  {
-    if((*jvm)->DetachCurrentThread(jvm) != 0)
-    {
+  if (flag_ok) {
+    if ((*jvm)->DetachCurrentThread(jvm) != 0) {
       printf(":c!: DetachCurrentThread fault! \n");
-      return  ORTE_FALSE;
+      return ORTE_FALSE;
     }
   }
 
@@ -827,8 +761,8 @@ onPubDelete(const struct ORTEAppInfo *appInfo,
 // /////////////////////////////////////////////////////////////////////
 Boolean
 onSubRemoteNew(const struct ORTEAppInfo *appInfo,
-               const struct ORTESubInfo *subInfo,
-               void *param)
+              const struct ORTESubInfo *subInfo,
+              void *param)
 {
 // ///////////////////////////////// SPOLECNA CAST //
   JavaVM          *jvm = NULL;
@@ -838,94 +772,85 @@ onSubRemoteNew(const struct ORTEAppInfo *appInfo,
   jclass           cls;
   jmethodID        mid;
   //
-  JORTEDomainEventsContext_t   *domain_events_cont = (JORTEDomainEventsContext_t*) param;
+  JORTEDomainEventsContext_t   *domain_events_cont = (JORTEDomainEventsContext_t *)param;
   int flag_ok = 0;
 
   #ifdef TEST_STAGE
-      printf(":c: event func. 'onSubRemoteNew()' called.. \n");
+  printf(":c: event func. 'onSubRemoteNew()' called.. \n");
   #endif
 
-  do
-  {
+  do {
 // ///////////////////////////////// SPOLECNA CAST //
-    if(domain_events_cont->jvm == 0)
-    {
+    if (domain_events_cont->jvm == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: jvm = NULL! \n");
+      printf(":!c: jvm = NULL! \n");
      #endif
-     break;
+      break;
     }
     jvm = domain_events_cont->jvm;
     // get env
     (*jvm)->AttachCurrentThread(jvm,
-                                #ifdef __ANDROID__
-                                  &env,
-                                #else
-                                  (void **)&env,
-                                #endif
-                                NULL);
-    if(env == 0)
-    {
+                               #ifdef __ANDROID__
+                               &env,
+                               #else
+                               (void **)&env,
+                               #endif
+                               NULL);
+    if (env == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: env = NULL! \n");
+      printf(":!c: env = NULL! \n");
      #endif
-     break;
+      break;
     }
     // find class
     cls = findClass(env, "org.ocera.orte.types.DomainEvents");
-    if(cls == 0)
-    {
+    if (cls == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: cls = NULL! \n");
+      printf(":!c: cls = NULL! \n");
      #endif
-     break;
+      break;
     }
     // create AppInfo instance
     obj_ainfo = createAppInfo(env, appInfo);
-    if(obj_ainfo == 0)
-    {
+    if (obj_ainfo == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: obj_ainfo = NULL! \n");
+      printf(":!c: obj_ainfo = NULL! \n");
      #endif
-     break;
+      break;
     }
     // create SubInfo instance
     obj_sinfo = createSubInfo(env, subInfo);
-    if(obj_sinfo == 0)
-    {
+    if (obj_sinfo == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: obj_sinfo = NULL! \n");
+      printf(":!c: obj_sinfo = NULL! \n");
      #endif
-     break;
+      break;
     }
 // ///////////////////////////////// SPOLECNA CAST //
     // get method ID
     mid = (*env)->GetMethodID(env,
-                              cls,
-                              "onSubRemoteNew",
-                              "(Lorg/ocera/orte/types/AppInfo;Lorg/ocera/orte/types/SubInfo;)V");
-    if(mid == 0)
-    {
+                             cls,
+                             "onSubRemoteNew",
+                             "(Lorg/ocera/orte/types/AppInfo;Lorg/ocera/orte/types/SubInfo;)V");
+    if (mid == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: mid = NULL! \n");
+      printf(":!c: mid = NULL! \n");
      #endif
-     break;
+      break;
     }
     // call method
     (*env)->CallVoidMethod(env,
-                           domain_events_cont->obj_de,
-                           mid,
-                           obj_ainfo,
-                           obj_sinfo);
+                          domain_events_cont->obj_de,
+                          mid,
+                          obj_ainfo,
+                          obj_sinfo);
     flag_ok = 1;
-  } while(0);
+  } while (0);
   // while broken
-  if(flag_ok)
-  {
-    if((*jvm)->DetachCurrentThread(jvm) != 0)
-    {
+  if (flag_ok) {
+    if ((*jvm)->DetachCurrentThread(jvm) != 0) {
       printf(":c!: DetachCurrentThread fault! \n");
-      return  ORTE_FALSE;
+      return ORTE_FALSE;
     }
   }
 
@@ -938,8 +863,8 @@ onSubRemoteNew(const struct ORTEAppInfo *appInfo,
 // /////////////////////////////////////////////////////////////////////
 Boolean
 onSubRemoteChanged(const struct ORTEAppInfo *appInfo,
-                   const struct ORTESubInfo *subInfo,
-                   void *param)
+                  const struct ORTESubInfo *subInfo,
+                  void *param)
 {
 // ///////////////////////////////// SPOLECNA CAST //
   JavaVM          *jvm = NULL;
@@ -949,94 +874,85 @@ onSubRemoteChanged(const struct ORTEAppInfo *appInfo,
   jobject          obj_sinfo;
   jmethodID        mid;
   //
-  JORTEDomainEventsContext_t   *domain_events_cont = (JORTEDomainEventsContext_t*) param;
+  JORTEDomainEventsContext_t   *domain_events_cont = (JORTEDomainEventsContext_t *)param;
   int flag_ok = 0;
 
   #ifdef TEST_STAGE
-      printf(":c: event func. 'onSubRemoteChanged()' called.. \n");
+  printf(":c: event func. 'onSubRemoteChanged()' called.. \n");
   #endif
 
-  do
-  {
+  do {
 // ///////////////////////////////// SPOLECNA CAST //
-    if(domain_events_cont->jvm == 0)
-    {
+    if (domain_events_cont->jvm == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: jvm = NULL! \n");
+      printf(":!c: jvm = NULL! \n");
      #endif
-     break;
+      break;
     }
     jvm = domain_events_cont->jvm;
     // get env
     (*jvm)->AttachCurrentThread(jvm,
-                                #ifdef __ANDROID__
-                                  &env,
-                                #else
-                                  (void **)&env,
-                                #endif
-                                NULL);
-    if(env == 0)
-    {
+                               #ifdef __ANDROID__
+                               &env,
+                               #else
+                               (void **)&env,
+                               #endif
+                               NULL);
+    if (env == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: env = NULL! \n");
+      printf(":!c: env = NULL! \n");
      #endif
-     break;
+      break;
     }
     // find class
     cls = findClass(env, "org.ocera.orte.types.DomainEvents");
-    if(cls == 0)
-    {
+    if (cls == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: cls = NULL! \n");
+      printf(":!c: cls = NULL! \n");
      #endif
-     break;
+      break;
     }
     // create AppInfo instance
     obj_ainfo = createAppInfo(env, appInfo);
-    if(obj_ainfo == 0)
-    {
+    if (obj_ainfo == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: obj_ainfo = NULL! \n");
+      printf(":!c: obj_ainfo = NULL! \n");
      #endif
-     break;
+      break;
     }
     // create SubInfo instance
     obj_sinfo = createSubInfo(env, subInfo);
-    if(obj_sinfo == 0)
-    {
+    if (obj_sinfo == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: obj_sinfo = NULL! \n");
+      printf(":!c: obj_sinfo = NULL! \n");
      #endif
-     break;
+      break;
     }
 // ///////////////////////////////// SPOLECNA CAST //
     // get method ID
     mid = (*env)->GetMethodID(env,
-                              cls,
-                              "onSubRemoteChanged",
-                              "(Lorg/ocera/orte/types/AppInfo;Lorg/ocera/orte/types/SubInfo;)V");
-    if(mid == 0)
-    {
+                             cls,
+                             "onSubRemoteChanged",
+                             "(Lorg/ocera/orte/types/AppInfo;Lorg/ocera/orte/types/SubInfo;)V");
+    if (mid == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: mid = NULL! \n");
+      printf(":!c: mid = NULL! \n");
      #endif
-     break;
+      break;
     }
     // call method
     (*env)->CallVoidMethod(env,
-                           domain_events_cont->obj_de,
-                           mid,
-                           obj_ainfo,
-                           obj_sinfo);
+                          domain_events_cont->obj_de,
+                          mid,
+                          obj_ainfo,
+                          obj_sinfo);
     flag_ok = 1;
-  } while(0);
+  } while (0);
   // while broken
-  if(flag_ok)
-  {
-    if((*jvm)->DetachCurrentThread(jvm) != 0)
-    {
+  if (flag_ok) {
+    if ((*jvm)->DetachCurrentThread(jvm) != 0) {
       printf(":c!: DetachCurrentThread fault! \n");
-      return  ORTE_FALSE;
+      return ORTE_FALSE;
     }
   }
 
@@ -1049,8 +965,8 @@ onSubRemoteChanged(const struct ORTEAppInfo *appInfo,
 // /////////////////////////////////////////////////////////////////////
 Boolean
 onSubDelete(const struct ORTEAppInfo *appInfo,
-            const struct ORTESubInfo *subInfo,
-            void *param)
+           const struct ORTESubInfo *subInfo,
+           void *param)
 {
 // ///////////////////////////////// SPOLECNA CAST //
   JavaVM          *jvm = NULL;
@@ -1060,94 +976,85 @@ onSubDelete(const struct ORTEAppInfo *appInfo,
   jobject          obj_sinfo;
   jmethodID        mid;
   //
-  JORTEDomainEventsContext_t   *domain_events_cont = (JORTEDomainEventsContext_t*) param;
+  JORTEDomainEventsContext_t   *domain_events_cont = (JORTEDomainEventsContext_t *)param;
   int flag_ok = 0;
 
   #ifdef TEST_STAGE
-      printf(":c: event func. 'onSubDelete()' called.. \n");
+  printf(":c: event func. 'onSubDelete()' called.. \n");
   #endif
 
-  do
-  {
+  do {
 // ///////////////////////////////// SPOLECNA CAST //
-    if(domain_events_cont->jvm == 0)
-    {
+    if (domain_events_cont->jvm == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: jvm = NULL! \n");
+      printf(":!c: jvm = NULL! \n");
      #endif
-     break;
+      break;
     }
     jvm = domain_events_cont->jvm;
     // get env
     (*jvm)->AttachCurrentThread(jvm,
-                                #ifdef __ANDROID__
-                                  &env,
-                                #else
-                                  (void **)&env,
-                                #endif
-                                NULL);
-    if(env == 0)
-    {
+                               #ifdef __ANDROID__
+                               &env,
+                               #else
+                               (void **)&env,
+                               #endif
+                               NULL);
+    if (env == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: env = NULL! \n");
+      printf(":!c: env = NULL! \n");
      #endif
-     break;
+      break;
     }
     // find class
     cls = findClass(env, "org.ocera.orte.types.DomainEvents");
-    if(cls == 0)
-    {
+    if (cls == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: cls = NULL! \n");
+      printf(":!c: cls = NULL! \n");
      #endif
-     break;
+      break;
     }
     // create AppInfo instance
     obj_ainfo = createAppInfo(env, appInfo);
-    if(obj_ainfo == 0)
-    {
+    if (obj_ainfo == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: obj_ainfo = NULL! \n");
+      printf(":!c: obj_ainfo = NULL! \n");
      #endif
-     break;
+      break;
     }
     // create SubInfo instance
     obj_sinfo = createSubInfo(env, subInfo);
-    if(obj_sinfo == 0)
-    {
+    if (obj_sinfo == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: obj_sinfo = NULL! \n");
+      printf(":!c: obj_sinfo = NULL! \n");
      #endif
-     break;
+      break;
     }
 // ///////////////////////////////// SPOLECNA CAST //
     // get method ID
     mid = (*env)->GetMethodID(env,
-                              cls,
-                              "onSubDelete",
-                              "(Lorg/ocera/orte/types/AppInfo;Lorg/ocera/orte/types/SubInfo;)V");
-    if(mid == 0)
-    {
+                             cls,
+                             "onSubDelete",
+                             "(Lorg/ocera/orte/types/AppInfo;Lorg/ocera/orte/types/SubInfo;)V");
+    if (mid == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: mid = NULL! \n");
+      printf(":!c: mid = NULL! \n");
      #endif
-     break;
+      break;
     }
     // call method
     (*env)->CallVoidMethod(env,
-                           domain_events_cont->obj_de,
-                           mid,
-                           obj_ainfo,
-                           obj_sinfo);
+                          domain_events_cont->obj_de,
+                          mid,
+                          obj_ainfo,
+                          obj_sinfo);
     flag_ok = 1;
-  } while(0);
+  } while (0);
   // while broken
-  if(flag_ok)
-  {
-    if((*jvm)->DetachCurrentThread(jvm) != 0)
-    {
+  if (flag_ok) {
+    if ((*jvm)->DetachCurrentThread(jvm) != 0) {
       printf(":c!: DetachCurrentThread fault! \n");
-      return  ORTE_FALSE;
+      return ORTE_FALSE;
     }
   }
 
index b9dda005cf36b68256e86c65d47de37311ce79be..42aaf99fcb06492b1dc4bab9aaf96d6ac31cbb66 100644 (file)
@@ -8,12 +8,12 @@
 
 JNIEXPORT jboolean JNICALL
 Java_org_ocera_orte_types_DomainEvents_jORTEDomainEventsDestroy
-(JNIEnv *env, jobject obj, jlong handle)
+  (JNIEnv *env, jobject obj, jlong handle)
 {
-  free((void*)handle);
+  free((void *)handle);
 
   #ifdef TEST_STAGE
-     printf(":c: events destroyed.. \n");
+  printf(":c: events destroyed.. \n");
   #endif
 
   return 1;
index 3bd004f75532b33094ef76d90413500c20c354fb..01cc45c916fe4cf471aa601833c3d41e9ebd402e 100644 (file)
 
 JNIEXPORT jlong JNICALL
 Java_org_ocera_orte_types_DomainEvents_jORTEDomainInitEvents
-(JNIEnv *env, jobject obj)
+  (JNIEnv *env, jobject obj)
 {
   ORTEDomainAppEvents *evs;
 
   // memory allocation
-  evs = (ORTEDomainAppEvents *) malloc(sizeof(ORTEDomainAppEvents));
-  if(evs == 0)
-  {
+  evs = (ORTEDomainAppEvents *)malloc(sizeof(ORTEDomainAppEvents));
+  if (evs == 0) {
     printf(":!c: evs = NULL [not enough memory] \n");
     return 0;
   }
   // call the liborte function
-  if (!ORTEDomainInitEvents(evs))
-  {
+  if (!ORTEDomainInitEvents(evs)) {
     printf(":!c: events not initialized! \n");
     free(evs);
     return 0;
   }
   #ifdef TEST_STAGE
-     printf(":c: events initialized.. \n");
+  printf(":c: events initialized.. \n");
   #endif
 
-  return ((jlong) evs);
+  return ((jlong)evs);
 
 }
index 5fb4c9669c94d205fffb0d0a3d42d0a572ed4aaf..8eab5d57fde2ada60a2a153e4e76b93e61ae59cc 100644 (file)
  * ****************************** */
 JNIEXPORT jlong JNICALL
 Java_org_ocera_orte_DomainMgr_jORTEDomainDefaultMgrCreate
-(JNIEnv *env, jobject obj, jint jdomain, jboolean susp)
+  (JNIEnv *env, jobject obj, jint jdomain, jboolean susp)
 {
   jlong      d;
 
   // call ORTE function
-  d = (jlong) ORTEDomainMgrCreate((int)jdomain,
-                                 NULL,
-                                 NULL,
-                                 (Boolean) susp);
-  if(d == 0)
-  {
+  d = (jlong)ORTEDomainMgrCreate((int)jdomain,
+                                NULL,
+                                NULL,
+                                (Boolean)susp);
+  if (d == 0) {
     printf(":!c: creating mgrDomain failed! \n");
     return 0;
   }
   #ifdef TEST_STAGE
-     printf(":c: mgrDomain created.. \n");
+  printf(":c: mgrDomain created.. \n");
   #endif
   return (d);
 }
@@ -65,12 +64,12 @@ Java_org_ocera_orte_DomainMgr_jORTEDomainDefaultMgrCreate
  * *************************** */
 JNIEXPORT jlong JNICALL
 Java_org_ocera_orte_DomainMgr_jORTEDomainMgrCreate
-(JNIEnv *env, jobject obj,
- jint jdomain,
- jlong propHandle,
- jlong eventsHandle,
- jobject obj_de,
- jboolean susp)
+  (JNIEnv *env, jobject obj,
 jint jdomain,
 jlong propHandle,
 jlong eventsHandle,
 jobject obj_de,
 jboolean susp)
 {
   JavaVM     *jvm;
   jclass      cls;
@@ -79,14 +78,14 @@ Java_org_ocera_orte_DomainMgr_jORTEDomainMgrCreate
   //
   ORTEDomainAppEvents    *dom_events;
   JORTEDomainEventsContext_t  *domain_events_cont;
+
   //assign domain events only if not null
-  if(obj_de != NULL) {
+  if (obj_de != NULL) {
     // memory alocation
-    domain_events_cont = (JORTEDomainEventsContext_t *) malloc(sizeof(JORTEDomainEventsContext_t));
+    domain_events_cont = (JORTEDomainEventsContext_t *)malloc(sizeof(JORTEDomainEventsContext_t));
     // get jvm
-    jint b = (*env)->GetJavaVM(env,&jvm);
-    if (b < 0)
-    {
+    jint b = (*env)->GetJavaVM(env, &jvm);
+    if (b < 0) {
       printf(":!c: getJavaVM() failed! \n");
       return 0;
     }
@@ -95,80 +94,77 @@ Java_org_ocera_orte_DomainMgr_jORTEDomainMgrCreate
     // domain events
     domain_events_cont->obj_de = (*env)->NewGlobalRef(env, obj_de);
     // get new events
-    dom_events = (ORTEDomainAppEvents *) eventsHandle;
+    dom_events = (ORTEDomainAppEvents *)eventsHandle;
     ////////////////////////////////////////////////
     // set new events & their prarameters
     // onRegFail
-    dom_events->onRegFail = (ORTEOnRegFail) onRegFail;
-    dom_events->onRegFailParam = (void *) domain_events_cont;
+    dom_events->onRegFail = (ORTEOnRegFail)onRegFail;
+    dom_events->onRegFailParam = (void *)domain_events_cont;
     // onMgrNew
-    dom_events->onMgrNew = (ORTEOnMgrNew) onMgrNew;
-    dom_events->onMgrNewParam = (void *) domain_events_cont;
+    dom_events->onMgrNew = (ORTEOnMgrNew)onMgrNew;
+    dom_events->onMgrNewParam = (void *)domain_events_cont;
     // onMgrDelete
-    dom_events->onMgrDelete = (ORTEOnMgrDelete) onMgrDelete;
-    dom_events->onMgrDeleteParam = (void *) domain_events_cont;
+    dom_events->onMgrDelete = (ORTEOnMgrDelete)onMgrDelete;
+    dom_events->onMgrDeleteParam = (void *)domain_events_cont;
     // onAppRemoteNew
-    dom_events->onAppRemoteNew = (ORTEOnAppRemoteNew) onAppRemoteNew;
-    dom_events->onAppRemoteNewParam = (void *) domain_events_cont;
+    dom_events->onAppRemoteNew = (ORTEOnAppRemoteNew)onAppRemoteNew;
+    dom_events->onAppRemoteNewParam = (void *)domain_events_cont;
     // onAppDelete
-    dom_events->onAppDelete = (ORTEOnAppDelete) onAppDelete;
-    dom_events->onAppDeleteParam = (void *) domain_events_cont;
+    dom_events->onAppDelete = (ORTEOnAppDelete)onAppDelete;
+    dom_events->onAppDeleteParam = (void *)domain_events_cont;
     // onPubRemoteNew
-    dom_events->onPubRemoteNew = (ORTEOnPubRemote) onPubRemoteNew;
-    dom_events->onPubRemoteNewParam = (void *) domain_events_cont;
+    dom_events->onPubRemoteNew = (ORTEOnPubRemote)onPubRemoteNew;
+    dom_events->onPubRemoteNewParam = (void *)domain_events_cont;
     // onPubRemoteChanged
-    dom_events->onPubRemoteChanged = (ORTEOnPubRemote) onPubRemoteChanged;
-    dom_events->onPubRemoteChangedParam = (void *) domain_events_cont;
+    dom_events->onPubRemoteChanged = (ORTEOnPubRemote)onPubRemoteChanged;
+    dom_events->onPubRemoteChangedParam = (void *)domain_events_cont;
     // onPubDelete
-    dom_events->onPubDelete = (ORTEOnPubDelete) onPubDelete;
-    dom_events->onPubDeleteParam = (void *) domain_events_cont;
+    dom_events->onPubDelete = (ORTEOnPubDelete)onPubDelete;
+    dom_events->onPubDeleteParam = (void *)domain_events_cont;
     // onSubRemoteNew
-    dom_events->onSubRemoteNew = (ORTEOnSubRemote) onSubRemoteNew;
-    dom_events->onSubRemoteNewParam = (void *) domain_events_cont;
+    dom_events->onSubRemoteNew = (ORTEOnSubRemote)onSubRemoteNew;
+    dom_events->onSubRemoteNewParam = (void *)domain_events_cont;
     // onSubRemoteChanged
-    dom_events->onSubRemoteChanged = (ORTEOnSubRemote) onSubRemoteChanged;
-    dom_events->onSubRemoteChangedParam = (void *) domain_events_cont;
+    dom_events->onSubRemoteChanged = (ORTEOnSubRemote)onSubRemoteChanged;
+    dom_events->onSubRemoteChangedParam = (void *)domain_events_cont;
     // onSubDelete
-    dom_events->onSubDelete = (ORTEOnSubDelete) onSubDelete;
-    dom_events->onSubDeleteParam = (void *) domain_events_cont;
+    dom_events->onSubDelete = (ORTEOnSubDelete)onSubDelete;
+    dom_events->onSubDeleteParam = (void *)domain_events_cont;
     ////////////////////////////////////////////////
     cls = (*env)->GetObjectClass(env, obj);
-    if(cls == 0)
-    {
+    if (cls == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: cls = NULL \n");
+      printf(":!c: cls = NULL \n");
       #endif
       return 0;
     }
     // fieldID - domainEventsContextHandle
     fid = (*env)->GetFieldID(env,
-                             cls,
-                             "domainEventsContextHandle",
-                             "J");
-    if(fid == 0)
-    {
+                            cls,
+                            "domainEventsContextHandle",
+                            "J");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       return 0;
     }
     (*env)->SetLongField(env,
-                        obj,
-                        fid,
-                        (jlong) domain_events_cont);
+                        obj,
+                        fid,
+                        (jlong)domain_events_cont);
   }
   // call ORTE function
-  d = (jlong) ORTEDomainMgrCreate((int)jdomain,
-                                  (ORTEDomainProp *) propHandle,
-                                  (ORTEDomainAppEvents *) eventsHandle,
-                                  (Boolean) susp);
-  if(d == 0)
-  {
+  d = (jlong)ORTEDomainMgrCreate((int)jdomain,
+                                (ORTEDomainProp *)propHandle,
+                                (ORTEDomainAppEvents *)eventsHandle,
+                                (Boolean)susp);
+  if (d == 0) {
     printf(":!c: creating mgrDomain failed! \n");
     return 0;
   }
   #ifdef TEST_STAGE
-     printf(":c: mgrDomain created.. \n");
+  printf(":c: mgrDomain created.. \n");
   #endif
   return (d);
 }
index e80ff49fccf35100a362ddb8008534eafeeafb3b..e5f6aebac085f203419a9d5a1bb37605a48582da 100644 (file)
@@ -37,7 +37,7 @@
 
 JNIEXPORT jboolean JNICALL
 Java_org_ocera_orte_DomainMgr_jORTEDomainMgrDestroy
-(JNIEnv *env, jobject obj, jlong dhandle)
+  (JNIEnv *env, jobject obj, jlong dhandle)
 {
   jlong       h;
   jclass      cls;
@@ -46,61 +46,54 @@ Java_org_ocera_orte_DomainMgr_jORTEDomainMgrDestroy
 
   do {
     // check domain handle
-    if (dhandle == 0)
-    {
+    if (dhandle == 0) {
       printf(":!c: ORTEDomainAppDestroy failed! [bad handle] \n");
       break;
     }
     // call ORTE function
-    if(!ORTEDomainMgrDestroy((ORTEDomain *) dhandle))
-    {
+    if (!ORTEDomainMgrDestroy((ORTEDomain *)dhandle)) {
       #ifdef TEST_STAGE
-        printf(":c: mgrDomain destroy failed.. \n");
+      printf(":c: mgrDomain destroy failed.. \n");
       #endif
       break;
     }
     // free domainEvents object
     // find cls
     cls = (*env)->GetObjectClass(env, obj);
-    if(cls == 0)
-    {
+    if (cls == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: cls = NULL! \n");
+      printf(":!c: cls = NULL! \n");
       #endif
       break;
     }
     // fieldID
     fid = (*env)->GetFieldID(env,
-                             cls,
-                             "domainEventsContextHandle",
-                             "J");
-    if(fid == 0)
-    {
+                            cls,
+                            "domainEventsContextHandle",
+                            "J");
+    if (fid == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: fid = NULL! \n");
+      printf(":!c: fid = NULL! \n");
      #endif
-     break;
+      break;
     }
     // get value
     h = (*env)->GetLongField(env, obj, fid);
-    if(h)
-    {
-      JORTEDomainEventsContext_t *ctx = (JORTEDomainEventsContext_t*)h;
-      if(ctx->obj_de)
-      {
-        #ifdef TEST_STAGE
-          printf(":c: deleting ctx->obj_de \n");
-        #endif
-        (*env)->DeleteGlobalRef(env, ctx->obj_de);
+    if (h) {
+      JORTEDomainEventsContext_t *ctx = (JORTEDomainEventsContext_t *)h;
+      if (ctx->obj_de) {
+       #ifdef TEST_STAGE
+       printf(":c: deleting ctx->obj_de \n");
+       #endif
+       (*env)->DeleteGlobalRef(env, ctx->obj_de);
       }
       //
-      free((void*)h);
+      free((void *)h);
     }
     flag_ok = 1;
-  } while(0);
+  } while (0);
 
-  if(flag_ok == 0)
-  {
+  if (flag_ok == 0) {
     printf(":!c: ORTEDomainMgrDestroy failed!  \n");
     return 0;
   }
index 3913eb04cecbe55aa52cad6782f6911e4bfb8238..368667cd3a9ed14f7aeda82075f2926ddf0bb1e8 100644 (file)
 
 JNIEXPORT jlong JNICALL
 Java_org_ocera_orte_types_DomainProp_jORTEDomainPropDefaultGet
-(JNIEnv *env, jclass cls)
+  (JNIEnv *env, jclass cls)
 {
   ORTEDomainProp *dprop;
 
   // memory allocation
-  dprop = (ORTEDomainProp *) malloc(sizeof(ORTEDomainProp));
-  if (dprop == NULL)
-  {
-     printf(":!c: not enough memory to alocate DomainProp!");
-     return 0;
+  dprop = (ORTEDomainProp *)malloc(sizeof(ORTEDomainProp));
+  if (dprop == NULL) {
+    printf(":!c: not enough memory to alocate DomainProp!");
+    return 0;
   }
   // call ORTE function
-  if (!ORTEDomainPropDefaultGet(dprop))
-  {
+  if (!ORTEDomainPropDefaultGet(dprop)) {
     printf(":!c: ORTEDomainPropDefaultGet() failed.. \n");
     free(dprop);
     return 0;
   }
   #ifdef TEST_STAGE
-    printf(":c: default domain properties created.. \n");
+  printf(":c: default domain properties created.. \n");
   #endif
-  return ((jlong) dprop);
+  return ((jlong)dprop);
 }
index a0a33a0860c1de0e9700a7d7bdb10c09a8eb3023..43b79a15692a7d680ea99b5bf47d153b4e68d656 100644 (file)
@@ -5,44 +5,45 @@
 
 #include "jorte/org_ocera_orte_types_DomainProp.h"
 
-  JNIEXPORT jboolean JNICALL Java_org_ocera_orte_types_DomainProp_jORTEDomainPropDestroy
-  (
-   JNIEnv *env,
-   jobject obj,
-   jlong propshandle,        //ORTEDomainProp handle
-   jstring mgrs              //Managers
-  )
-  {
-    int flag_ok = 0;
-    ORTEDomainProp *dp = NULL;
+JNIEXPORT jboolean JNICALL
+Java_org_ocera_orte_types_DomainProp_jORTEDomainPropDestroy
+(
+  JNIEnv *env,
+  jobject obj,
+  jlong propshandle,         //ORTEDomainProp handle
+  jstring mgrs               //Managers
+)
+{
+  int flag_ok = 0;
+  ORTEDomainProp *dp = NULL;
 
     #ifdef TEST_STAGE
-      printf(":c: jORTEDomainPropDestroy() called.. \n");
+  printf(":c: jORTEDomainPropDestroy() called.. \n");
     #endif
 
-    do {
-      dp = (ORTEDomainProp *) propshandle;
-      if(dp == 0) {
-        #ifdef TEST_STAGE
-          printf(":!c: *dp = NULL \n");
-        #endif
-        break;
-      }
+  do {
+    dp = (ORTEDomainProp *)propshandle;
+    if (dp == 0) {
+       #ifdef TEST_STAGE
+      printf(":!c: *dp = NULL \n");
+       #endif
+      break;
+    }
 
-      if (mgrs != NULL) {
-        //release fellow managers string
-        (*env)->ReleaseStringUTFChars(env,mgrs,dp->mgrs);
-      }
+    if (mgrs != NULL) {
+      //release fellow managers string
+      (*env)->ReleaseStringUTFChars(env, mgrs, dp->mgrs);
+    }
 
-      //free DomainProperties memory
-      free(dp);
+    //free DomainProperties memory
+    free(dp);
 
-      flag_ok = 1;
-    } while (0);
+    flag_ok = 1;
+  } while (0);
 
-    if(flag_ok) {
-      return  ORTE_TRUE;
-    }
-
-    return ORTE_FALSE;
+  if (flag_ok) {
+    return ORTE_TRUE;
   }
+
+  return ORTE_FALSE;
+}
index fe6abd80255c8592116a7221e520360c58ff6e44..f9459327434e107fd9f7bdf52b70741a64008067 100644 (file)
@@ -5,45 +5,46 @@
 
 #include "jorte/org_ocera_orte_types_DomainProp.h"
 
-  JNIEXPORT jboolean JNICALL Java_org_ocera_orte_types_DomainProp_jORTEDomainPropSet
-  (
-   JNIEnv *env,
-   jobject obj,
-   jlong propshandle,        //ORTEDomainProp handle
-   jstring mgrs              //Managers
-  )
-  {
-    const char     *str = NULL;
-    //
-    int flag_ok = 0;
-
-    ORTEDomainProp *dp = NULL;
+JNIEXPORT jboolean JNICALL
+Java_org_ocera_orte_types_DomainProp_jORTEDomainPropSet
+(
+  JNIEnv *env,
+  jobject obj,
+  jlong propshandle,         //ORTEDomainProp handle
+  jstring mgrs               //Managers
+)
+{
+  const char     *str = NULL;
+  //
+  int flag_ok = 0;
+
+  ORTEDomainProp *dp = NULL;
 
     #ifdef TEST_STAGE
-      printf(":c: jORTEDomainPropSet() called.. \n");
+  printf(":c: jORTEDomainPropSet() called.. \n");
     #endif
 
-    do {
-      dp = (ORTEDomainProp *) propshandle;
-      if(dp == 0) {
-        #ifdef TEST_STAGE
-          printf(":!c: *dp = NULL \n");
-        #endif
-        break;
-      }
-
-      //call ReleaseStringUTFChars from destructor !!
-      str = (*env)->GetStringUTFChars(env,mgrs,0);
-      
-      //set managers
-      dp->mgrs=(char *)str;
-
-      flag_ok = 1;
-    } while (0);
-
-    if(flag_ok) {
-      return  ORTE_TRUE;
+  do {
+    dp = (ORTEDomainProp *)propshandle;
+    if (dp == 0) {
+       #ifdef TEST_STAGE
+      printf(":!c: *dp = NULL \n");
+       #endif
+      break;
     }
 
-    return ORTE_FALSE;
-  }
\ No newline at end of file
+    //call ReleaseStringUTFChars from destructor !!
+    str = (*env)->GetStringUTFChars(env, mgrs, 0);
+
+    //set managers
+    dp->mgrs = (char *)str;
+
+    flag_ok = 1;
+  } while (0);
+
+  if (flag_ok) {
+    return ORTE_TRUE;
+  }
+
+  return ORTE_FALSE;
+}
index e9a1527d78144950e73a8518c2e419c4498d0528..f179e488da8b70bdfecda5a242736a4eb747e6e4 100644 (file)
 // ve fci chybi 2 Multicast argumenty - maji se dodat???
 JNIEXPORT void JNICALL
 Java_org_ocera_orte_Domain_jORTEDomainStart
-(JNIEnv *env, jclass cls, jlong dom_handle,
- jboolean recvUnicastMetatrafficThread,
- jboolean recvUnicastUserDataThread,
- jboolean sendThread)
+  (JNIEnv *env, jclass cls, jlong dom_handle,
 jboolean recvUnicastMetatrafficThread,
 jboolean recvUnicastUserDataThread,
 jboolean sendThread)
 {
   // vyresit problemy s booleanem
-  ORTEDomainStart((ORTEDomain *) dom_handle,
-                  (Boolean) recvUnicastMetatrafficThread,
-                  ORTE_FALSE, // Multicast !
-                  (Boolean) recvUnicastUserDataThread,
-                  ORTE_FALSE, // Multicast !
-                  (Boolean) sendThread);
+  ORTEDomainStart((ORTEDomain *)dom_handle,
+                 (Boolean)recvUnicastMetatrafficThread,
+                 ORTE_FALSE, // Multicast !
+                 (Boolean)recvUnicastUserDataThread,
+                 ORTE_FALSE, // Multicast !
+                 (Boolean)sendThread);
   #ifdef TEST_STAGE
-    printf(":c: starting domain thread [ORTEDomainStart()].. \n");
+  printf(":c: starting domain thread [ORTEDomainStart()].. \n");
   #endif
 }
-
index 33ea9dcd6ab8289b7f1311d34a4761e0916c58f2..6a3420db132605069bd3da4a5455ff65c8edb971 100644 (file)
 
 JNIEXPORT void JNICALL
 Java_org_ocera_orte_JOrte_jORTEInit
-(JNIEnv *env, jclass cls)
+  (JNIEnv *env, jclass cls)
 {
   ORTEInit();
   #ifdef TEST_STAGE
-    printf(":c: ORTE initialized [ORTEInit()].. \n");
+  printf(":c: ORTE initialized [ORTEInit()].. \n");
   #endif
 }
-
index 4cabf34c1fa623ab9d5f3e321ad13edf8ef8307e..75379320eced49fea9f5c3bad2cb975fd250d04d 100644 (file)
@@ -40,7 +40,7 @@
 int counter = 0;
 
 void
-sendCallBack(const ORTESendInfo *info,void *vinstance, void *sendCallBackParam)
+sendCallBack(const ORTESendInfo *info, void *vinstance, void *sendCallBackParam)
 {
 
   printf(":c: zacatek sendCallBack()..\n");
@@ -62,14 +62,14 @@ sendCallBack(const ORTESendInfo *info,void *vinstance, void *sendCallBackParam)
 // native method
 JNIEXPORT jlong JNICALL
 Java_org_ocera_orte_Publication_jORTEPublicationCreate
-(JNIEnv   *env ,
- jobject   obj,
- jlong     dom_handle,
- jstring   j_topic,
- jstring   j_type_name,
- jobject   j_instance,
- jobject   j_persistence,
- jint      j_strength)
+  (JNIEnv   *env,
 jobject   obj,
 jlong     dom_handle,
 jstring   j_topic,
 jstring   j_type_name,
 jobject   j_instance,
 jobject   j_persistence,
 jint      j_strength)
 {
   ORTEPublication  *p = 0;
   ORTEDomain       *d;
@@ -81,75 +81,68 @@ Java_org_ocera_orte_Publication_jORTEPublicationCreate
   int               flag_ok = 0;
 
   // check domain handle
-  d = (ORTEDomain *) dom_handle;
-  if(d == 0)
-  {
+  d = (ORTEDomain *)dom_handle;
+  if (d == 0) {
     printf(":!c: publication create failed! [bad domain handle] \n");
     return 0;
   }
   // get topic
   topic = (*env)->GetStringUTFChars(env, j_topic, 0);
-  if(topic == 0)
-  {
+  if (topic == 0) {
     // OutOfMemoryError already thrown
     #ifdef TEST_STAGE
-      printf(":!c: topic = NULL \n");
+    printf(":!c: topic = NULL \n");
     #endif
     return 0;
   }
   // get typeName
   typeName = (*env)->GetStringUTFChars(env, j_type_name, 0);
-  if(typeName == 0)
-  {
+  if (typeName == 0) {
     // OutOfMemoryError already thrown
     #ifdef TEST_STAGE
-      printf(":!c: typeName = NULL \n");
+    printf(":!c: typeName = NULL \n");
     #endif
     // free memory
     (*env)->ReleaseStringUTFChars(env, j_topic, topic);
     return 0;
   }
 
-  do
-  {
+  do {
     // get persistence
     persistence = getNtpTime(env, j_persistence);
     // get strenght
-    strength = (int) j_strength;
+    strength = (int)j_strength;
     // get direct ByteBuffer pointer from Java
     buffer = (*env)->GetDirectBufferAddress(env, j_instance);
-    if(buffer == 0)
-    {
+    if (buffer == 0) {
       printf(":!c: buffer create failed! \n");
       break;
     }
     // call ORTE function
     p = ORTEPublicationCreate(d,
-                              topic,
-                              typeName,
-                              buffer,
-                              &persistence,
-                              strength,
-                              sendCallBack, // BUDE NULL!!
-                              NULL,
-                              NULL);
-    if(p == 0)
-    {
+                             topic,
+                             typeName,
+                             buffer,
+                             &persistence,
+                             strength,
+                             sendCallBack, // BUDE NULL!!
+                             NULL,
+                             NULL);
+    if (p == 0) {
       printf(":!c: publication create failed! \n");
       break;
     }
     // set flag
     flag_ok = 1;
-  }  while(0);
+  }  while (0);
 
   // free memory in every case
   (*env)->ReleaseStringUTFChars(env, j_topic, topic);
   (*env)->ReleaseStringUTFChars(env, j_type_name, typeName);
   //
-  if (flag_ok == 0)
-  {
+  if (flag_ok == 0) {
     return 0;
   }
-  return ((jlong) p);
+  return ((jlong)p);
 
 }
index 8eb9b365c3ed2ef65b3d431e28a313d3c809c403..9e71e1d5e33be871db726286826308afbc42111c 100644 (file)
 
 JNIEXPORT jboolean JNICALL
 Java_org_ocera_orte_Publication_jORTEPublicationDestroy
-(JNIEnv *env, jclass cls, jlong pub_handle)
+  (JNIEnv *env, jclass cls, jlong pub_handle)
 {
   int8_t    b;
 
   // call ORTE function
-  b = ORTEPublicationDestroy((ORTEPublication *) pub_handle);
-  if (b == ORTE_BAD_HANDLE)
-  {
+  b = ORTEPublicationDestroy((ORTEPublication *)pub_handle);
+  if (b == ORTE_BAD_HANDLE) {
     printf(":!c: publication destroy failed! [bad publication handle] \n");
     return 1;
   }
   #ifdef TEST_STAGE
-    printf(":c: publication destroyed successfully.. \n");
+  printf(":c: publication destroyed successfully.. \n");
   #endif
   return 1;
 }
-
index a8bf3cc68ccfd903874251b18e5d00ecbebbad2d..3f965b305d082c0c482c8e6597ba78eaa44fee04 100644 (file)
@@ -38,7 +38,7 @@
 
 JNIEXPORT jobject JNICALL
 Java_org_ocera_orte_Publication_jORTEPublicationGetStatus
-(JNIEnv *env, jobject obj, jlong j_appDomain_handle)
+  (JNIEnv *env, jobject obj, jlong j_appDomain_handle)
 {
   // jni types
   jclass           cls_ps = NULL; // class of PubStatus
@@ -52,42 +52,37 @@ Java_org_ocera_orte_Publication_jORTEPublicationGetStatus
   ORTEPublStatus  *publ_stat = &ps;
 
   #ifdef TEST_STAGE
-    printf(":c: ORTEPublicationGetStatus() called.. \n");
+  printf(":c: ORTEPublicationGetStatus() called.. \n");
   #endif
 
-  do
-  {
+  do {
     // call ORTE function
     b = ORTEPublicationGetStatus((ORTEPublication *)j_appDomain_handle, publ_stat);
-    if(b == ORTE_BAD_HANDLE)
-    {
-     printf(":!c: publicationGetStatus() failed! [bad pub handle] \n");
-     break;
+    if (b == ORTE_BAD_HANDLE) {
+      printf(":!c: publicationGetStatus() failed! [bad pub handle] \n");
+      break;
     }
     // find cls
-    cls_ps = findClass(env,"org.ocera.orte.types.Status");
-    if(cls_ps == 0)
-    {
+    cls_ps = findClass(env, "org.ocera.orte.types.Status");
+    if (cls_ps == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: cls_ps = NULL \n");
+      printf(":!c: cls_ps = NULL \n");
       #endif
       break;
     }
     // call object constructor
-    mid = (*env)->GetMethodID(env,cls_ps,"<init>","()V");
-    if(mid == 0)
-    {
+    mid = (*env)->GetMethodID(env, cls_ps, "<init>", "()V");
+    if (mid == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: mid = NULL \n");
+      printf(":!c: mid = NULL \n");
       #endif
       break;
     }
     // new object
     obj_ps = (*env)->NewObject(env, cls_ps, mid);
-    if(obj_ps == 0)
-    {
+    if (obj_ps == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: obj_ps = NULL \n");
+      printf(":!c: obj_ps = NULL \n");
       #endif
       break;
     }
@@ -95,59 +90,55 @@ Java_org_ocera_orte_Publication_jORTEPublicationGetStatus
     // setting object's fields
     // fieldID - strict
     fid = (*env)->GetFieldID(env,
-                             cls_ps,
-                             "strict",
-                             "J");
-    if(fid == NULL)
-    {
+                            cls_ps,
+                            "strict",
+                            "J");
+    if (fid == NULL) {
       #ifdef TEST_STAGE
-       printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     (*env)->SetLongField(env,
-                         obj_ps,
-                         fid,
-                         (jlong) publ_stat->strict);
+                        obj_ps,
+                        fid,
+                        (jlong)publ_stat->strict);
     // fieldID - bestEffort
     fid = (*env)->GetFieldID(env,
-                             cls_ps,
-                             "bestEffort",
-                             "J");
-    if(fid == NULL)
-    {
+                            cls_ps,
+                            "bestEffort",
+                            "J");
+    if (fid == NULL) {
       #ifdef TEST_STAGE
-       printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     (*env)->SetLongField(env,
-                         obj_ps,
-                         fid,
-                         (jlong) publ_stat->bestEffort);
+                        obj_ps,
+                        fid,
+                        (jlong)publ_stat->bestEffort);
     // fieldID - issues
     fid = (*env)->GetFieldID(env,
-                             cls_ps,
-                             "issues",
-                             "J");
-    if(fid == NULL)
-    {
+                            cls_ps,
+                            "issues",
+                            "J");
+    if (fid == NULL) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     (*env)->SetLongField(env,
-                         obj_ps,
-                         fid,
-                         (jlong) publ_stat->issues);
+                        obj_ps,
+                        fid,
+                        (jlong)publ_stat->issues);
     // set flag
     flag_ok = 1;
 
-  } while(0);
+  } while (0);
 
-  if(flag_ok == 0)
-  {
+  if (flag_ok == 0) {
     return NULL;
   }
   return obj_ps;
index 3e70197d591b824d61f6eb8be419fa4e04b0690e..cdda158a13d7ebff6843508600b82ecd33f2d065 100644 (file)
 
 JNIEXPORT jobject JNICALL
 Java_org_ocera_orte_Publication_jORTEPublicationPropertiesGet
-(JNIEnv *env, jobject obj, jlong j_appDomain_handle)
+  (JNIEnv *env, jobject obj, jlong j_appDomain_handle)
 {
   // jni types
   jclass         cls_pp   = NULL; // PublProp class
   jclass         cls_ntpT = NULL; // NtpTime class
   jobject        obj_pp   = NULL; // instance of PublProp
-  jobject        obj_ntpT = NULL ;// instance of NtpTime
+  jobject        obj_ntpT = NULL// instance of NtpTime
   jfieldID       fid      = NULL;
   jmethodID      mid;
   jboolean       jbool = 0;
@@ -56,353 +56,330 @@ Java_org_ocera_orte_Publication_jORTEPublicationPropertiesGet
 
   // calling original orte function
   #ifdef TEST_STAGE
-    printf(":c: ORTEPublicationPropertiesGet() called.. \n");
+  printf(":c: ORTEPublicationPropertiesGet() called.. \n");
   #endif
 
   // create new PublProps instance and set its fields
-  do
-  {
+  do {
     // call ORTE function
-    b = ORTEPublicationPropertiesGet((ORTEPublication *) j_appDomain_handle,
-                                   publ_prop);
-    if(b == ORTE_BAD_HANDLE)
-    {
+    b = ORTEPublicationPropertiesGet((ORTEPublication *)j_appDomain_handle,
+                                    publ_prop);
+    if (b == ORTE_BAD_HANDLE) {
       printf(":!c: PublicationPropertiesGet() failed! [bad pub handle] \n");
       break;
     }
     // find class
     cls_pp = findClass(env, "org.ocera.orte.types.PublProp");
-    if(cls_pp == 0)
-    {
+    if (cls_pp == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: cls_pp = NULL \n");
+      printf(":!c: cls_pp = NULL \n");
       #endif
       break;
     }
     // call object constructor
     mid = (*env)->GetMethodID(env, cls_pp, "<init>", "()V");
-    if(mid == 0)
-    {
+    if (mid == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: mid = NULL \n");
+      printf(":!c: mid = NULL \n");
       #endif
       break;
     }
     // new object
     obj_pp = (*env)->NewObject(env, cls_pp, mid);
-    if(obj_pp == 0)
-    {
+    if (obj_pp == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: obj_pp = NULL \n");
+      printf(":!c: obj_pp = NULL \n");
       #endif
       break;
     }
     #ifdef TEST_STAGE
-      printf(":c: instance of 'org.ocera.orte.types.PublProp' created..\n");
+    printf(":c: instance of 'org.ocera.orte.types.PublProp' created..\n");
     #endif
     // ///////////////////////////////////////////////
     // setting object's fields
     /////////////////////////////////////////////////
     // set topic
-    if(!setTopic(env,cls_pp,obj_pp,(const char *)publ_prop->topic))
-    {
+    if (!setTopic(env, cls_pp, obj_pp, (const char *)publ_prop->topic)) {
       #ifdef TEST_STAGE
-        printf(":!c: setTopic() failed! \n");
+      printf(":!c: setTopic() failed! \n");
       #endif
       break;
     }
     /////////////////////////////////////////////////
     // set type
-    if(!setType(env,cls_pp,obj_pp,(const char *)publ_prop->typeName))
-    {
+    if (!setType(env, cls_pp, obj_pp, (const char *)publ_prop->typeName)) {
       #ifdef TEST_STAGE
-        printf(":!c: setType() failed! \n");
+      printf(":!c: setType() failed! \n");
       #endif
       break;
     }
     /////////////////////////////////////////////////
     // fieldID - typeChecksum
     fid = (*env)->GetFieldID(env,
-                             cls_pp,
-                             "typeChecksum",
-                             "I");
-    if(fid == 0)
-    {
+                            cls_pp,
+                            "typeChecksum",
+                            "I");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     (*env)->SetIntField(env,
-                        obj_pp,
-                        fid,
-                        (jint) publ_prop->typeChecksum);
+                       obj_pp,
+                       fid,
+                       (jint)publ_prop->typeChecksum);
     /////////////////////////////////////////////////
     // fieldID - expectsAck
     fid = (*env)->GetFieldID(env,
-                             cls_pp,
-                             "expectsAck",
-                             "Z");
-    if(fid == 0)
-    {
+                            cls_pp,
+                            "expectsAck",
+                            "Z");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
-    if(publ_prop->expectsAck == ORTE_FALSE) jbool = 0;
-      else jbool = 1;
+    if (publ_prop->expectsAck == ORTE_FALSE)
+      jbool = 0;
+    else
+      jbool = 1;
     (*env)->SetBooleanField(env,
-                            obj_pp,
-                            fid,
-                            jbool);
+                           obj_pp,
+                           fid,
+                           jbool);
     /////////////////////////////////////////////////
     // fieldID - persistence
     cls_ntpT = findClass(env, "org.ocera.orte.types.NtpTime");
-    if(cls_ntpT == 0)
-    {
+    if (cls_ntpT == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: cls_ntpT = NULL \n");
+      printf(":!c: cls_ntpT = NULL \n");
       #endif
       break;
     }
     // call object constructor
     mid = (*env)->GetMethodID(env, cls_ntpT, "<init>", "(IJ)V");
-    if(mid == 0)
-    {
+    if (mid == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: mid = NULL \n");
+      printf(":!c: mid = NULL \n");
       #endif
       break;
     }
     // new object
     obj_ntpT = (*env)->NewObject(env,
-                                 cls_ntpT,
-                                 mid,
-                                 (jint)  publ_prop->persistence.seconds,
-                                 (jlong) publ_prop->persistence.fraction);
-    if(obj_ntpT == 0)
-    {
+                                cls_ntpT,
+                                mid,
+                                (jint)publ_prop->persistence.seconds,
+                                (jlong)publ_prop->persistence.fraction);
+    if (obj_ntpT == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: obj_ntpT = NULL \n");
+      printf(":!c: obj_ntpT = NULL \n");
       #endif
       break;
     }
     #ifdef TEST_STAGE
-      printf(":c: instance of 'org.ocera.orte.types.NtpTime' created..\n");
+    printf(":c: instance of 'org.ocera.orte.types.NtpTime' created..\n");
     #endif
     // set 'PublProp' NtpTime's field
     fid = (*env)->GetFieldID(env,
-                             cls_pp,
-                             "persistence",
-                             "Lorg/ocera/orte/types/NtpTime;");
-    if(fid == 0)
-    {
+                            cls_pp,
+                            "persistence",
+                            "Lorg/ocera/orte/types/NtpTime;");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     (*env)->SetObjectField(env,
-                           obj_pp,
-                           fid,
-                           obj_ntpT);
+                          obj_pp,
+                          fid,
+                          obj_ntpT);
     /////////////////////////////////////////////////
     // fieldID - HBNornalRate
     // cls_ntpT and obj_ntpT already readed!!
     // new object
     obj_ntpT = (*env)->NewObject(env,
-                                 cls_ntpT,
-                                 mid,
-                                 (jint)  publ_prop->HBNornalRate.seconds,
-                                 (jlong) publ_prop->HBNornalRate.fraction);
-    if(obj_ntpT == 0)
-    {
+                                cls_ntpT,
+                                mid,
+                                (jint)publ_prop->HBNornalRate.seconds,
+                                (jlong)publ_prop->HBNornalRate.fraction);
+    if (obj_ntpT == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: obj_ntpT = NULL \n");
+      printf(":!c: obj_ntpT = NULL \n");
       #endif
       break;
     }
     #ifdef TEST_STAGE
-      printf(":c: instance of 'org.ocera.orte.types.NtpTime' created..\n");
+    printf(":c: instance of 'org.ocera.orte.types.NtpTime' created..\n");
     #endif
     // set 'PublProp' NtpTime's field
     fid = (*env)->GetFieldID(env,
-                             cls_pp,
-                             "HBNornalRate",
-                             "Lorg/ocera/orte/types/NtpTime;");
-    if(fid == 0)
-    {
+                            cls_pp,
+                            "HBNornalRate",
+                            "Lorg/ocera/orte/types/NtpTime;");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     (*env)->SetObjectField(env,
-                           obj_pp,
-                           fid,
-                           obj_ntpT);
+                          obj_pp,
+                          fid,
+                          obj_ntpT);
     /////////////////////////////////////////////////
     // fieldID - HBCQLRate
     // cls_ntpT and obj_ntpT already readed!!
     // new object
     obj_ntpT = (*env)->NewObject(env,
-                                 cls_ntpT,
-                                 mid,
-                                 (jint)  publ_prop->HBCQLRate.seconds,
-                                 (jlong) publ_prop->HBCQLRate.fraction);
-    if(obj_ntpT == 0)
-    {
+                                cls_ntpT,
+                                mid,
+                                (jint)publ_prop->HBCQLRate.seconds,
+                                (jlong)publ_prop->HBCQLRate.fraction);
+    if (obj_ntpT == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: obj_ntpT = NULL \n");
+      printf(":!c: obj_ntpT = NULL \n");
       #endif
       break;
     }
     #ifdef TEST_STAGE
-      printf(":c: instance of 'org.ocera.orte.types.NtpTime' created..\n");
+    printf(":c: instance of 'org.ocera.orte.types.NtpTime' created..\n");
     #endif
     // set 'PublProp' NtpTime's field
     fid = (*env)->GetFieldID(env,
-                             cls_pp,
-                             "HBCQLRate",
-                             "Lorg/ocera/orte/types/NtpTime;");
-    if(fid == 0)
-    {
+                            cls_pp,
+                            "HBCQLRate",
+                            "Lorg/ocera/orte/types/NtpTime;");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     (*env)->SetObjectField(env,
-                           obj_pp,
-                           fid,
-                           obj_ntpT);
+                          obj_pp,
+                          fid,
+                          obj_ntpT);
     /////////////////////////////////////////////////
     // fieldID - HBCQLRate
     // cls_ntpT and obj_ntpT already readed!!
     // new object
     obj_ntpT = (*env)->NewObject(env,
-                                 cls_ntpT,
-                                 mid,
-                                 (jint)  publ_prop->maxBlockTime.seconds,
-                                 (jlong) publ_prop->maxBlockTime.fraction);
-    if(obj_ntpT == 0)
-    {
+                                cls_ntpT,
+                                mid,
+                                (jint)publ_prop->maxBlockTime.seconds,
+                                (jlong)publ_prop->maxBlockTime.fraction);
+    if (obj_ntpT == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: obj_ntpT = NULL \n");
+      printf(":!c: obj_ntpT = NULL \n");
       #endif
       break;
     }
     #ifdef TEST_STAGE
-      printf(":c: instance of 'org.ocera.orte.types.NtpTime' created..\n");
+    printf(":c: instance of 'org.ocera.orte.types.NtpTime' created..\n");
     #endif
     // set 'PublProp' NtpTime's field
     fid = (*env)->GetFieldID(env,
-                             cls_pp,
-                             "maxBlockTime",
-                             "Lorg/ocera/orte/types/NtpTime;");
-    if(fid == 0)
-    {
+                            cls_pp,
+                            "maxBlockTime",
+                            "Lorg/ocera/orte/types/NtpTime;");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     (*env)->SetObjectField(env,
-                           obj_pp,
-                           fid,
-                           obj_ntpT);
+                          obj_pp,
+                          fid,
+                          obj_ntpT);
     /////////////////////////////////////////////////
     // fieldID - reliabilityOffered
     fid = (*env)->GetFieldID(env,
-                             cls_pp,
-                             "reliabilityOffered",
-                             "J");
-    if(fid == 0)
-    {
+                            cls_pp,
+                            "reliabilityOffered",
+                            "J");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     (*env)->SetLongField(env,
-                         obj_pp,
-                         fid,
-                         (jlong) publ_prop->reliabilityOffered);
+                        obj_pp,
+                        fid,
+                        (jlong)publ_prop->reliabilityOffered);
     /////////////////////////////////////////////////
     // fieldID - sendQueueSize
     fid = (*env)->GetFieldID(env,
-                             cls_pp,
-                             "sendQueueSize",
-                             "J");
-    if(fid == 0)
-    {
+                            cls_pp,
+                            "sendQueueSize",
+                            "J");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     (*env)->SetLongField(env,
-                         obj_pp,
-                         fid,
-                         (jlong) publ_prop->sendQueueSize);
+                        obj_pp,
+                        fid,
+                        (jlong)publ_prop->sendQueueSize);
     /////////////////////////////////////////////////
     // fieldID - strength
     fid = (*env)->GetFieldID(env,
-                             cls_pp,
-                             "strength",
-                             "I");
-    if(fid == 0)
-    {
+                            cls_pp,
+                            "strength",
+                            "I");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     (*env)->SetIntField(env,
-                        obj_pp,
-                        fid,
-                        (jint) publ_prop->strength);
+                       obj_pp,
+                       fid,
+                       (jint)publ_prop->strength);
     /////////////////////////////////////////////////
     // fieldID - criticalQueueLevel
     fid = (*env)->GetFieldID(env,
-                             cls_pp,
-                             "criticalQueueLevel",
-                             "J");
-    if(fid == 0)
-    {
+                            cls_pp,
+                            "criticalQueueLevel",
+                            "J");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     (*env)->SetLongField(env,
-                         obj_pp,
-                         fid,
-                         (jlong) publ_prop->criticalQueueLevel);
+                        obj_pp,
+                        fid,
+                        (jlong)publ_prop->criticalQueueLevel);
     /////////////////////////////////////////////////
     // fieldID - HBMaxRetries
     fid = (*env)->GetFieldID(env,
-                             cls_pp,
-                             "HBMaxRetries",
-                             "J");
-    if(fid == 0)
-    {
+                            cls_pp,
+                            "HBMaxRetries",
+                            "J");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     (*env)->SetLongField(env,
-                         obj_pp,
-                         fid,
-                         (jlong) publ_prop->HBMaxRetries);
+                        obj_pp,
+                        fid,
+                        (jlong)publ_prop->HBMaxRetries);
     // set flag
     flag_ok = 1;
-  } while(0);
+  } while (0);
 
-  if(flag_ok == 0)
-  {
+  if (flag_ok == 0) {
     return NULL;
   }
 
index bf24b3f6dbbdff711f9452ad226a04731255510c..4fe354641789d5a4c4c431c9720b5207a03cd015 100644 (file)
@@ -40,7 +40,7 @@
 
 JNIEXPORT jboolean JNICALL
 Java_org_ocera_orte_Publication_jORTEPublicationPropertiesSet
-(JNIEnv *env, jobject obj, jlong j_appDomain_handle, jobject obj_pp)
+  (JNIEnv *env, jobject obj, jlong j_appDomain_handle, jobject obj_pp)
 {
   // jni types
   jclass         cls_pp = NULL;
@@ -56,19 +56,17 @@ Java_org_ocera_orte_Publication_jORTEPublicationPropertiesSet
   ORTEPublProp  *publ_prop = &pp;
 
   #ifdef TEST_STAGE
-    printf(":c: jORTEPublicationPropertiesSet() called.. \n");
+  printf(":c: jORTEPublicationPropertiesSet() called.. \n");
   #endif
 
-  do
-  {
+  do {
     // get 'SubProp' instance's class
     cls_pp = (*env)->GetObjectClass(env, obj_pp);
     // second way how to get 'PublProp' instance's class
     //cls_pp = (*env)->FindClass(env,"org/ocera/orte/types/PublProp");
-    if(cls_pp == 0)
-    {
+    if (cls_pp == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: cls_pp = NULL \n");
+      printf(":!c: cls_pp = NULL \n");
       #endif
       break;
     }
@@ -77,296 +75,278 @@ Java_org_ocera_orte_Publication_jORTEPublicationPropertiesSet
     /////////////////////////////////////////////////
     // set topic
     fid = (*env)->GetFieldID(env,
-                             cls_pp,
-                             "topic",
-                             "Ljava/lang/String;");
-    if(fid == 0)
-    {
+                            cls_pp,
+                            "topic",
+                            "Ljava/lang/String;");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     obj_str = (*env)->GetObjectField(env, obj_pp, fid);
-    if(obj_str == 0)
-    {
+    if (obj_str == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: obj_str = NULL \n");
+      printf(":!c: obj_str = NULL \n");
       #endif
       break;
     }
-    str = (*env)->GetStringUTFChars(env,obj_str,0);
+    str = (*env)->GetStringUTFChars(env, obj_str, 0);
     // set structure's field
-    strncpy((char *)publ_prop->topic, (const char*)str, strlen(str) + 1);
+    strncpy((char *)publ_prop->topic, (const char *)str, strlen(str) + 1);
     #ifdef TEST_STAGE
-      printf(":c: topic = %s, publ_prop->topic = %s \n",
-             str, publ_prop->topic);
+    printf(":c: topic = %s, publ_prop->topic = %s \n",
+          str, publ_prop->topic);
     #endif
     // free the memory
     (*env)->ReleaseStringUTFChars(env, obj_str, str);
     /////////////////////////////////////////////////
     // set typeName
     fid = (*env)->GetFieldID(env,
-                             cls_pp,
-                             "typeName",
-                             "Ljava/lang/String;");
-    if (fid == 0)
-    {
+                            cls_pp,
+                            "typeName",
+                            "Ljava/lang/String;");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     obj_str = (*env)->GetObjectField(env, obj_pp, fid);
-    if(obj_str == 0)
-    {
+    if (obj_str == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: obj_str = NULL \n");
+      printf(":!c: obj_str = NULL \n");
       #endif
       break;
     }
-    str = (*env)->GetStringUTFChars(env,obj_str,0);
+    str = (*env)->GetStringUTFChars(env, obj_str, 0);
     // set structure's field
-    strncpy((char *)publ_prop->typeName, (const char*)str, strlen(str) + 1);
+    strncpy((char *)publ_prop->typeName, (const char *)str, strlen(str) + 1);
     #ifdef TEST_STAGE
-      printf(":c: typeName = %s, publ_prop->typeName = %s \n",
-             str, publ_prop->typeName);
+    printf(":c: typeName = %s, publ_prop->typeName = %s \n",
+          str, publ_prop->typeName);
     #endif
     // free the memory
     (*env)->ReleaseStringUTFChars(env, obj_str, str);
     /////////////////////////////////////////////////
     // set typeChecksum
-    fid = (*env)->GetFieldID(env,cls_pp,"typeChecksum","I");
-    if (fid == 0)
-    {
+    fid = (*env)->GetFieldID(env, cls_pp, "typeChecksum", "I");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
-    publ_prop->typeChecksum = (TypeChecksum) (*env)->GetIntField(env, obj_pp, fid);
+    publ_prop->typeChecksum = (TypeChecksum)(*env)->GetIntField(env, obj_pp, fid);
     #ifdef TEST_STAGE
-      printf(":c: check: publ_prop->typeChecksum = %"PRId32"\n",
-             publ_prop->typeChecksum);
+    printf(":c: check: publ_prop->typeChecksum = %" PRId32 "\n",
+          publ_prop->typeChecksum);
     #endif
     /////////////////////////////////////////////////
     // set expectsAck
-    fid = (*env)->GetFieldID(env,cls_pp,"expectsAck","Z");
-    if (fid == 0)
-    {
+    fid = (*env)->GetFieldID(env, cls_pp, "expectsAck", "Z");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     jbool = (*env)->GetBooleanField(env, obj_pp, fid);
-    if (jbool == 0) publ_prop->expectsAck = ORTE_FALSE;
-      else publ_prop->expectsAck = ORTE_TRUE;
+    if (jbool == 0)
+      publ_prop->expectsAck = ORTE_FALSE;
+    else
+      publ_prop->expectsAck = ORTE_TRUE;
     #ifdef TEST_STAGE
-      printf(":c: check: publ_prop->expectsAck = %"PRId8"\n", publ_prop->expectsAck);
+    printf(":c: check: publ_prop->expectsAck = %" PRId8 "\n", publ_prop->expectsAck);
     #endif
     /////////////////////////////////////////////////
     // set persistence
     fid = (*env)->GetFieldID(env,
-                             cls_pp,
-                             "persistence",
-                             "Lorg/ocera/orte/types/NtpTime;");
-    if (fid == 0)
-    {
+                            cls_pp,
+                            "persistence",
+                            "Lorg/ocera/orte/types/NtpTime;");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     obj_ntpT = (*env)->GetObjectField(env, obj_pp, fid);
-    if (obj_ntpT == 0)
-    {
+    if (obj_ntpT == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: obj_ntpT = NULL \n");
+      printf(":!c: obj_ntpT = NULL \n");
       #endif
       break;
     }
     publ_prop->persistence = getNtpTime(env, obj_ntpT);
     #ifdef TEST_STAGE
-      printf(":c: check: publ_prop->persistence: sec = %"PRId32", fract = %"PRIu32"  \n",
-             publ_prop->persistence.seconds, publ_prop->persistence.fraction);
+    printf(":c: check: publ_prop->persistence: sec = %" PRId32 ", fract = %" PRIu32 "  \n",
+          publ_prop->persistence.seconds, publ_prop->persistence.fraction);
     #endif
     /////////////////////////////////////////////////
     // set reliabilityOffered
     fid = (*env)->GetFieldID(env,
-                             cls_pp,
-                             "reliabilityOffered",
-                             "J");
-    if (fid == 0)
-    {
+                            cls_pp,
+                            "reliabilityOffered",
+                            "J");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
-    publ_prop->reliabilityOffered = (uint32_t) (*env)->GetLongField(env, obj_pp, fid);
+    publ_prop->reliabilityOffered = (uint32_t)(*env)->GetLongField(env, obj_pp, fid);
     #ifdef TEST_STAGE
-      printf(":c: check: publ_prop->reliabilityOffered = %"PRIu32" \n",
-             publ_prop->reliabilityOffered);
+    printf(":c: check: publ_prop->reliabilityOffered = %" PRIu32 " \n",
+          publ_prop->reliabilityOffered);
     #endif
     /////////////////////////////////////////////////
     // set sendQueueSize
     fid = (*env)->GetFieldID(env,
-                             cls_pp,
-                             "sendQueueSize",
-                             "J");
-    if (fid == 0)
-    {
+                            cls_pp,
+                            "sendQueueSize",
+                            "J");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
-    publ_prop->sendQueueSize = (uint32_t) (*env)->GetLongField(env,obj_pp,fid);
+    publ_prop->sendQueueSize = (uint32_t)(*env)->GetLongField(env, obj_pp, fid);
     #ifdef TEST_STAGE
-      printf(":c: check: publ_prop->sendQueueSize = %"PRIu32" \n",
-             publ_prop->sendQueueSize);
+    printf(":c: check: publ_prop->sendQueueSize = %" PRIu32 " \n",
+          publ_prop->sendQueueSize);
     #endif
     /////////////////////////////////////////////////
     // set strength
     fid = (*env)->GetFieldID(env,
-                             cls_pp,
-                             "strength",
-                             "I");
-    if (fid == 0)
-    {
+                            cls_pp,
+                            "strength",
+                            "I");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
-    publ_prop->strength = (int32_t) (*env)->GetIntField(env,obj_pp,fid);
+    publ_prop->strength = (int32_t)(*env)->GetIntField(env, obj_pp, fid);
     #ifdef TEST_STAGE
-      printf(":c: check: publ_prop->strength = %"PRId32" \n",
-             publ_prop->strength);
+    printf(":c: check: publ_prop->strength = %" PRId32 " \n",
+          publ_prop->strength);
     #endif
     /////////////////////////////////////////////////
     // set criticalQueueLevel
     fid = (*env)->GetFieldID(env,
-                             cls_pp,
-                             "criticalQueueLevel",
-                             "J");
-    if (fid == 0)
-    {
+                            cls_pp,
+                            "criticalQueueLevel",
+                            "J");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
-    publ_prop->criticalQueueLevel = (uint32_t) (*env)->GetLongField(env, obj_pp, fid);
+    publ_prop->criticalQueueLevel = (uint32_t)(*env)->GetLongField(env, obj_pp, fid);
     #ifdef TEST_STAGE
-      printf(":c: check: publ_prop->criticalQueueLevel = %"PRIu32" \n",
-             publ_prop->criticalQueueLevel);
+    printf(":c: check: publ_prop->criticalQueueLevel = %" PRIu32 " \n",
+          publ_prop->criticalQueueLevel);
     #endif
     /////////////////////////////////////////////////
     // set HBNornalRate
     fid = (*env)->GetFieldID(env,
-                             cls_pp,
-                             "HBNornalRate",
-                             "Lorg/ocera/orte/types/NtpTime;");
-    if (fid == 0)
-    {
+                            cls_pp,
+                            "HBNornalRate",
+                            "Lorg/ocera/orte/types/NtpTime;");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     obj_ntpT = (*env)->GetObjectField(env, obj_pp, fid);
     publ_prop->HBNornalRate = getNtpTime(env, obj_ntpT);
     #ifdef TEST_STAGE
-    printf(":c: check: publ_prop->HBNornalRate: sec = %"PRId32", fract = %"PRIu32"  \n",
-           publ_prop->HBNornalRate.seconds, publ_prop->HBNornalRate.fraction);
+    printf(":c: check: publ_prop->HBNornalRate: sec = %" PRId32 ", fract = %" PRIu32 "  \n",
+          publ_prop->HBNornalRate.seconds, publ_prop->HBNornalRate.fraction);
     #endif
     /////////////////////////////////////////////////
     // set HBCQLRate
     fid = (*env)->GetFieldID(env,
-                             cls_pp,
-                             "HBCQLRate",
-                             "Lorg/ocera/orte/types/NtpTime;");
-    if (fid == 0)
-    {
+                            cls_pp,
+                            "HBCQLRate",
+                            "Lorg/ocera/orte/types/NtpTime;");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     obj_ntpT = (*env)->GetObjectField(env, obj_pp, fid);
-    if (obj_ntpT == 0)
-    {
+    if (obj_ntpT == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: obj_ntpT = NULL \n");
+      printf(":!c: obj_ntpT = NULL \n");
       #endif
       break;
     }
     publ_prop->HBCQLRate = getNtpTime(env, obj_ntpT);
     #ifdef TEST_STAGE
-      printf(":c: check: publ_prop->HBCQLRate: sec = %"PRId32", fract = %"PRIu32"  \n",
-             publ_prop->HBCQLRate.seconds, publ_prop->HBCQLRate.fraction);
+    printf(":c: check: publ_prop->HBCQLRate: sec = %" PRId32 ", fract = %" PRIu32 "  \n",
+          publ_prop->HBCQLRate.seconds, publ_prop->HBCQLRate.fraction);
     #endif
     /////////////////////////////////////////////////
     // set HBMaxRetries
     fid = (*env)->GetFieldID(env,
-                             cls_pp,
-                             "HBMaxRetries",
-                             "J");
-    if (fid == 0)
-    {
+                            cls_pp,
+                            "HBMaxRetries",
+                            "J");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
-    publ_prop->HBMaxRetries = (unsigned int) (*env)->GetLongField(env, obj_pp, fid);
+    publ_prop->HBMaxRetries = (unsigned int)(*env)->GetLongField(env, obj_pp, fid);
     #ifdef TEST_STAGE
-      printf(":c: check: publ_prop->HBMaxRetries = %u \n",
-             publ_prop->HBMaxRetries);
+    printf(":c: check: publ_prop->HBMaxRetries = %u \n",
+          publ_prop->HBMaxRetries);
     #endif
     /////////////////////////////////////////////////
     // set maxBlockTime
     fid = (*env)->GetFieldID(env,
-                             cls_pp,
-                             "maxBlockTime",
-                             "Lorg/ocera/orte/types/NtpTime;");
-    if (fid == 0)
-    {
+                            cls_pp,
+                            "maxBlockTime",
+                            "Lorg/ocera/orte/types/NtpTime;");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     obj_ntpT = (*env)->GetObjectField(env, obj_pp, fid);
-    if (obj_ntpT == 0)
-    {
+    if (obj_ntpT == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: obj_ntpT = NULL \n");
+      printf(":!c: obj_ntpT = NULL \n");
       #endif
       break;
     }
     publ_prop->maxBlockTime = getNtpTime(env, obj_ntpT);
     #ifdef TEST_STAGE
-      printf(":c: check: publ_prop->maxBlockTime: sec = %"PRId32", fract = %"PRIu32"  \n",
-             publ_prop->maxBlockTime.seconds, publ_prop->maxBlockTime.fraction);
+    printf(":c: check: publ_prop->maxBlockTime: sec = %" PRId32 ", fract = %" PRIu32 "  \n",
+          publ_prop->maxBlockTime.seconds, publ_prop->maxBlockTime.fraction);
     #endif
     /////////////////////////////////////////////////
     // calling original native method
-    b = ORTEPublicationPropertiesSet((ORTEPublication *) j_appDomain_handle,
-                                     publ_prop);
-    if (b == ORTE_BAD_HANDLE)
-    {
+    b = ORTEPublicationPropertiesSet((ORTEPublication *)j_appDomain_handle,
+                                    publ_prop);
+    if (b == ORTE_BAD_HANDLE) {
       printf(":c!: set pub properties failed! [bad pub handle] \n");
       break;
     }
     // set flag
     flag_ok = 1;
-  } while(0);
+  } while (0);
 
-  if(flag_ok == 0)
-  {
+  if (flag_ok == 0) {
     return 0;
   }
 
index 9b67ba21282842ee3cc44ea7c65ba128a1001d18..b771c6666ff9145cb16c7d69134159096dd43a08 100644 (file)
 
 JNIEXPORT jboolean JNICALL
 Java_org_ocera_orte_Publication_jORTEPublicationSend
-(JNIEnv *env, jobject obj, jlong pub_handle)
+  (JNIEnv *env, jobject obj, jlong pub_handle)
 {
   int       flag_ok = 0;
   int8_t    b;
+
   //
 
   #ifdef TEST_STAGE
-    printf(":c: jORTEPublicationSend() called.. \n");
+  printf(":c: jORTEPublicationSend() called.. \n");
   #endif
 
-  do
-  {
+  do {
     /////////////////////////////////////////////////
     // call ORTE function
-    b = ORTEPublicationSend((ORTEPublication *) pub_handle);
+    b = ORTEPublicationSend((ORTEPublication *)pub_handle);
     #ifdef TEST_STAGE
-      printf(":c: b = ORTEPublicationSend() = %d \n",b);
+    printf(":c: b = ORTEPublicationSend() = %d \n", b);
     #endif
-    if (b == ORTE_BAD_HANDLE)
-    {
+    if (b == ORTE_BAD_HANDLE) {
      #ifdef TEST_STAGE
-       printf(":!c: data not sent! [bad pub handle] \n");
+      printf(":!c: data not sent! [bad pub handle] \n");
      #endif
-     break;
+      break;
     }
-    if(b == ORTE_OK)
-    {
+    if (b == ORTE_OK) {
      #ifdef TEST_STAGE
-       printf(":c: data sent succesfuly.. \n");
+      printf(":c: data sent succesfuly.. \n");
      #endif
     }
     // set flag
     flag_ok = 1;
-  } while(0);
+  } while (0);
 
-  if(flag_ok == 0)
-  {
+  if (flag_ok == 0) {
     return 0;
   }
 
index 4b9b377f09f1e2ab74182a67ff94c46901d7419f..27b4f033e199c51ccea2107b3117ea5fc3e62b08 100644 (file)
 
 JNIEXPORT jint JNICALL
 Java_org_ocera_orte_Publication_jORTEPublicationWaitForSubscriptions
-(JNIEnv *env, jobject obj, jlong j_appDomain_handle,
- jobject obj_ntpT, jlong jretries, jlong jnoSubscriptions)
+  (JNIEnv *env, jobject obj, jlong j_appDomain_handle,
 jobject obj_ntpT, jlong jretries, jlong jnoSubscriptions)
 {
   int            i;
   NtpTime        wait;
 
   #ifdef TEST_STAGE
-    printf(":c: jORTEPublicationWaitForSubscriptions called.. \n");
+  printf(":c: jORTEPublicationWaitForSubscriptions called.. \n");
   #endif
 
   wait = getNtpTime(env, obj_ntpT);
   #ifdef TEST_STAGE
-    printf(":c: check: wait: sec = %"PRId32", fract = %"PRIu32"  \n",
-           wait.seconds, wait.fraction);
+  printf(":c: check: wait: sec = %" PRId32 ", fract = %" PRIu32 "  \n",
+        wait.seconds, wait.fraction);
   #endif
 
   // calling original native method
-  i = ORTEPublicationWaitForSubscriptions((ORTEPublication *) j_appDomain_handle,
-                                          wait,
-                                          (unsigned int) jretries,
-                                          (unsigned int) jnoSubscriptions);
-  if (i == ORTE_BAD_HANDLE)
-  {
+  i = ORTEPublicationWaitForSubscriptions((ORTEPublication *)j_appDomain_handle,
+                                         wait,
+                                         (unsigned int)jretries,
+                                         (unsigned int)jnoSubscriptions);
+  if (i == ORTE_BAD_HANDLE) {
     printf(":c!: wait for subscription failed! [bad sub handle] \n");
     return ORTE_BAD_HANDLE;
   }
-  if (i == ORTE_TIMEOUT)
-  {
+  if (i == ORTE_TIMEOUT) {
     printf(":c!: wait for subscriptions - timeout! [number of subscriptions exhausted] \n");
     return ORTE_TIMEOUT;
   }
-  if (i == ORTE_OK);
+  if (i == ORTE_OK) ;
   return ORTE_OK;
 }
index 9bf2bfdaa99811516975a095cd9926eb6700c1fa..afc8f1beaa1ff1a812d0f4a0eaf7918f584e3879 100644 (file)
 
 JNIEXPORT void JNICALL
 Java_org_ocera_orte_JOrte_jORTESleepMs
-(JNIEnv *env, jclass cls, jlong milisec)
+  (JNIEnv *env, jclass cls, jlong milisec)
 {
   #ifdef TEST_STAGE
-    printf(":c: orteSleep() called.. ZZzzzz \n");
+  printf(":c: orteSleep() called.. ZZzzzz \n");
   #endif
-  ORTESleepMs((unsigned int) milisec);
+  ORTESleepMs((unsigned int)milisec);
 }
-
index f82d3ea1b65e99971936607b88445f3fa17cbe8b..0a9c87767bded0a16080c9f48b05e71fdfa5d07f 100644 (file)
@@ -44,7 +44,7 @@
  * ****************************************************************** */
 
 void
-recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam)
+recvCallBack(const ORTERecvInfo *info, void *vinstance, void *recvCallBackParam)
 {
   // jni varialbles
   JavaVM          *jvm = 0;
@@ -57,113 +57,106 @@ recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam)
   jfieldID         fid = 0;
   jmethodID        mid = 0;
   jmethodID        mid_callback = 0;
+
   //
   // if the subscriber has been destroyed, return
-  if((*(JORTECallbackContext_t**)recvCallBackParam) == 0)
+  if ((*(JORTECallbackContext_t **)recvCallBackParam) == 0)
     return;
 
-  JORTECallbackContext_t   *callback_cont = *((JORTECallbackContext_t**)recvCallBackParam);
+  JORTECallbackContext_t   *callback_cont = *((JORTECallbackContext_t **)recvCallBackParam);
 
   #ifdef TEST_STAGE
-    printf("\n\n:c: --------------- recvCallBack called.. --------------- \n");
+  printf("\n\n:c: --------------- recvCallBack called.. --------------- \n");
   #endif
 
-  do
-  {
+  do {
     // set local variables from struct
-    if(callback_cont->jvm == 0)
-    {
+    if (callback_cont->jvm == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: jvm = NULL \n");
+      printf(":!c: jvm = NULL \n");
       #endif
       break;
     }
     jvm = callback_cont->jvm;
     // get env
     (*jvm)->AttachCurrentThread(jvm,
-                                #ifdef __ANDROID__
-                                  &env,
-                                #else
-                                  (void **)&env,
-                                #endif
-                                NULL);
-    if(env == 0)
-    {
+                               #ifdef __ANDROID__
+                               &env,
+                               #else
+                               (void **)&env,
+                               #endif
+                               NULL);
+    if (env == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: env = NULL \n");
+      printf(":!c: env = NULL \n");
       #endif
       break;
     }
     //
     // set byte order only if it differs from that currently set
-    if(info->data_endian != callback_cont->cur_endian) {
+    if (info->data_endian != callback_cont->cur_endian) {
       //prepare ByteOrder
       cls = (*env)->FindClass(env, "java/nio/ByteOrder");
       if (cls == 0) {
-        #ifdef TEST_STAGE
-          printf(":!c: cls = NULL \n");
-        #endif
-      }
-      if(info->data_endian == BigEndian) {
-        fid = (*env)->GetStaticFieldID(env,
-                                       cls,
-                                       "BIG_ENDIAN",
-                                       "Ljava/nio/ByteOrder;");
-        callback_cont->cur_endian = BigEndian;
+       #ifdef TEST_STAGE
+       printf(":!c: cls = NULL \n");
+       #endif
       }
-      else {
-        fid = (*env)->GetStaticFieldID(env,
-                                       cls,
-                                       "LITTLE_ENDIAN",
-                                       "Ljava/nio/ByteOrder;");
-        callback_cont->cur_endian = LittleEndian;
+      if (info->data_endian == BigEndian) {
+       fid = (*env)->GetStaticFieldID(env,
+                                      cls,
+                                      "BIG_ENDIAN",
+                                      "Ljava/nio/ByteOrder;");
+       callback_cont->cur_endian = BigEndian;
+      } else {
+       fid = (*env)->GetStaticFieldID(env,
+                                      cls,
+                                      "LITTLE_ENDIAN",
+                                      "Ljava/nio/ByteOrder;");
+       callback_cont->cur_endian = LittleEndian;
       }
-      if(fid == 0) {
-        #ifdef TEST_STAGE
-          printf(":!c: fid = NULL \n");
-        #endif
+      if (fid == 0) {
+       #ifdef TEST_STAGE
+       printf(":!c: fid = NULL \n");
+       #endif
       }
       obj_bo = (*env)->GetStaticObjectField(env, cls, fid);
-      if(obj_bo == 0) {
-        #ifdef TEST_STAGE
-          printf(":!c: cls = NULL \n");
-        #endif
+      if (obj_bo == 0) {
+       #ifdef TEST_STAGE
+       printf(":!c: cls = NULL \n");
+       #endif
       }
 
       // set byte order to ByteBuffer
       // get BB class
       cls = (*env)->GetObjectClass(env, callback_cont->obj_buf);
-      if(cls == 0)
-      {
-        #ifdef TEST_STAGE
-          printf(":!c: cls = NULL \n");
-        #endif
+      if (cls == 0) {
+       #ifdef TEST_STAGE
+       printf(":!c: cls = NULL \n");
+       #endif
       }
       // get methodID - order(ByteOrder)
       mid = (*env)->GetMethodID(env,
-                                cls,
-                                "order",
-                                "(Ljava/nio/ByteOrder;)Ljava/nio/ByteBuffer;");
-      if(mid == 0)
-      {
-        #ifdef TEST_STAGE
-          printf(":!c: mid = NULL \n");
-        #endif
+                               cls,
+                               "order",
+                               "(Ljava/nio/ByteOrder;)Ljava/nio/ByteBuffer;");
+      if (mid == 0) {
+       #ifdef TEST_STAGE
+       printf(":!c: mid = NULL \n");
+       #endif
       }
 
       // set ByteOrder
-      if((*env)->CallObjectMethod(env,callback_cont->obj_buf,mid,obj_bo) == 0)
-      {
-        #ifdef TEST_STAGE
-          printf(":!c: set byte order failed.. \n");
-        #endif
+      if ((*env)->CallObjectMethod(env, callback_cont->obj_buf, mid, obj_bo) == 0) {
+       #ifdef TEST_STAGE
+       printf(":!c: set byte order failed.. \n");
+       #endif
       }
     }
     //
-    if(callback_cont->obj == 0)
-    {
+    if (callback_cont->obj == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: obj = NULL \n");
+      printf(":!c: obj = NULL \n");
       #endif
       break;
     }
@@ -173,154 +166,144 @@ recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam)
 
 
       #ifdef TEST_STAGE
-         printf(":c: #0 \n");
-         printf(":c: env = %#"PRIxPTR", obj_msg = %#"PRIxPTR" \n", (intptr_t)env, (intptr_t)obj_msg);
+    printf(":c: #0 \n");
+    printf(":c: env = %#" PRIxPTR ", obj_msg = %#" PRIxPTR " \n", (intptr_t)env, (intptr_t)obj_msg);
       #endif
 
 
-       //
-    if(rinfo == 0)
-    {
+    //
+    if (rinfo == 0) {
       // find cls
       cls = findClass(env, "org.ocera.orte.types.RecvInfo");
-      if(cls == 0)
-      {
-        #ifdef TEST_STAGE
-          printf(":!c: cls = NULL \n");
-        #endif
-        break;
+      if (cls == 0) {
+       #ifdef TEST_STAGE
+       printf(":!c: cls = NULL \n");
+       #endif
+       break;
       }
       // call object constructor
       mid = (*env)->GetMethodID(env, cls, "<init>", "()V");
-      if(mid == 0)
-      {
-        #ifdef TEST_STAGE
-          printf(":!c: constructor failed! \n");
-        #endif
-        break;
+      if (mid == 0) {
+       #ifdef TEST_STAGE
+       printf(":!c: constructor failed! \n");
+       #endif
+       break;
       }
       // create new object
       rinfo = (*env)->NewObject(env, cls, mid);
-      if(rinfo == 0)
-      {
-        #ifdef TEST_STAGE
-          printf(":!c: rinfo = NULL \n");
-        #endif
-        break;
+      if (rinfo == 0) {
+       #ifdef TEST_STAGE
+       printf(":!c: rinfo = NULL \n");
+       #endif
+       break;
       }
       // create global reference
       callback_cont->rinfo = (*env)->NewGlobalRef(env, rinfo);
-      if (callback_cont->rinfo == 0)
-      {
-        #ifdef TEST_STAGE
-          printf(":!c: callback_cont->rinfo = NULL \n");
-        #endif
-        break;
+      if (callback_cont->rinfo == 0) {
+       #ifdef TEST_STAGE
+       printf(":!c: callback_cont->rinfo = NULL \n");
+       #endif
+       break;
       }
     }
     ////////////////////////////////////////////////////
     // set RecvInfo instance
-    if(setRecvInfo(env,info,callback_cont->rinfo) == 0)
-    {
+    if (setRecvInfo(env, info, callback_cont->rinfo) == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: setRecvInfo() failed! \n");
+      printf(":!c: setRecvInfo() failed! \n");
       #endif
       break;
     }
     ////////////////////////////////////////////////////
     // control print - only in TEST_STAGE
     #ifdef TEST_STAGE
-      printf(":c: rinfo created :] \n");
-      printf(":c:----- ORTERecvInfo members  ------ \n");
-      printf(":c:    recvStatus: %#x \n", info->status);
-      printf(":c:    senderGuid: hid = %#"PRIx32", aid = %#"PRIx32", oid = %#"PRIx32" \n",
-             info->senderGUID.hid,info->senderGUID.aid,info->senderGUID.oid);
-      printf(":c:         topic: %s \n",info->topic);
-      printf(":c:          type: %s \n",info->type);
-      printf(":c: localTimeRecv: sec = %"PRId32", fract = %"PRIu32" \n",
-             info->localTimeReceived.seconds,info->localTimeReceived.fraction);
-      printf(":c: remoteTimePub: sec = %"PRId32", fract = %"PRIu32" \n",
-             info->remoteTimePublished.seconds,info->remoteTimePublished.fraction);
-      printf(":c:         seqNr: high = %"PRId32", low = %"PRIu32" \n",info->sn.high,info->sn.low);
-      printf(":c:---------------------------------- \n");
+    printf(":c: rinfo created :] \n");
+    printf(":c:----- ORTERecvInfo members  ------ \n");
+    printf(":c:    recvStatus: %#x \n", info->status);
+    printf(":c:    senderGuid: hid = %#" PRIx32 ", aid = %#" PRIx32 ", oid = %#" PRIx32 " \n",
+          info->senderGUID.hid, info->senderGUID.aid, info->senderGUID.oid);
+    printf(":c:         topic: %s \n", info->topic);
+    printf(":c:          type: %s \n", info->type);
+    printf(":c: localTimeRecv: sec = %" PRId32 ", fract = %" PRIu32 " \n",
+          info->localTimeReceived.seconds, info->localTimeReceived.fraction);
+    printf(":c: remoteTimePub: sec = %" PRId32 ", fract = %" PRIu32 " \n",
+          info->remoteTimePublished.seconds, info->remoteTimePublished.fraction);
+    printf(":c:         seqNr: high = %" PRId32 ", low = %" PRIu32 " \n", info->sn.high, info->sn.low);
+    printf(":c:---------------------------------- \n");
     #endif
     ////////////////////////////////////////////////////
     // update MessageData instance
     // get cls
     cls_msg = (*env)->GetObjectClass(env, obj_msg);
-    if(cls_msg == 0)
-    {
+    if (cls_msg == 0) {
       #ifdef TEST_STAGE
-         printf(":!c: cls_msg = NULL \n");
+      printf(":!c: cls_msg = NULL \n");
       #endif
       break;
     }
     /////////////////////////////////////////////////////
     // methodID - read()
     mid = (*env)->GetMethodID(env,
-                              cls_msg,
-                              "read",
-                              "()V");
-    if(mid == 0)
-    {
+                             cls_msg,
+                             "read",
+                             "()V");
+    if (mid == 0) {
       #ifdef TEST_STAGE
-         printf(":!c: mid = NULL \n");
+      printf(":!c: mid = NULL \n");
       #endif
       break;
     }
     // call method
     (*env)->CallVoidMethod(env,
-                           obj_msg,
-                           mid);
+                          obj_msg,
+                          mid);
 
-   /* *************************** *
-    *  call JAVA CallBack method  *
-    * *************************** */
+    /* *************************** *
+     *  call JAVA CallBack method  *
+     * *************************** */
       #ifdef TEST_STAGE
-        printf(":c: call JAVA CallBack method \n");
+    printf(":c: call JAVA CallBack method \n");
       #endif
 
 
-       // get class
-    cls = (*env)->GetObjectClass(env,callback_cont->obj);
-    if(cls == 0)
-    {
+    // get class
+    cls = (*env)->GetObjectClass(env, callback_cont->obj);
+    if (cls == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: cls = NULL \n");
+      printf(":!c: cls = NULL \n");
       #endif
       break;
     }
     // get method ID
     mid = (*env)->GetMethodID(env,
-                              cls,
-                              "callback",
-                              "(Lorg/ocera/orte/types/RecvInfo;Lorg/ocera/orte/types/MessageData;)V");
-    if(mid == 0)
-    {
+                             cls,
+                             "callback",
+                             "(Lorg/ocera/orte/types/RecvInfo;Lorg/ocera/orte/types/MessageData;)V");
+    if (mid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: cls = NULL \n");
+      printf(":!c: cls = NULL \n");
       #endif
       break;
     }
     mid_callback = mid;
     //
     #ifdef TEST_STAGE
-      printf(":c: volam callback metodu.. halo jsi tam?? \n");
+    printf(":c: volam callback metodu.. halo jsi tam?? \n");
     #endif
     // call object's method
     (*env)->CallVoidMethod(env,
-                           callback_cont->obj, /*obj*/
-                           mid_callback,
-                           callback_cont->rinfo,
-                           obj_msg);
-  } while(0);
+                          callback_cont->obj, /*obj*/
+                          mid_callback,
+                          callback_cont->rinfo,
+                          obj_msg);
+  } while (0);
 
   // detach current thread
-  if((*jvm)->DetachCurrentThread(jvm) != 0)
-     printf(":c!: DetachCurrentThread failed! \n");
+  if ((*jvm)->DetachCurrentThread(jvm) != 0)
+    printf(":c!: DetachCurrentThread failed! \n");
   //
   #ifdef TEST_STAGE
-     printf(":c: ------------ thats all from recvCallBack ------------ \n\n");
+  printf(":c: ------------ thats all from recvCallBack ------------ \n\n");
   #endif
 
 }
@@ -330,20 +313,20 @@ recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam)
  * ****************************************************************** */
 JNIEXPORT jlong JNICALL
 Java_org_ocera_orte_Subscription_jORTESubscriptionCreate
-(JNIEnv   *env,
- jobject   obj,
jlong     dhandle,   // appDomain handle
jint      jsmode,    // subs mode
jint      jstype,    // subs type
jstring   jtopic,    // subs topic
jstring   jtname,    // subs typeName
- jobject   jinstance, // direct ByteBuffer
jint      jbyteOrder,// byte order of ByteBuffer
jobject   obj_msg,   // messageData instance
- jobject   jdeadline,
- jobject   jminSeparation,
- jobject   obj_callback,
- jlong     j_multicastIP)
+  (JNIEnv   *env,
 jobject   obj,
 jlong     dhandle,  // appDomain handle
 jint      jsmode,   // subs mode
 jint      jstype,   // subs type
 jstring   jtopic,   // subs topic
 jstring   jtname,   // subs typeName
 jobject   jinstance, // direct ByteBuffer
 jint      jbyteOrder, // byte order of ByteBuffer
 jobject   obj_msg,  // messageData instance
 jobject   jdeadline,
 jobject   jminSeparation,
 jobject   obj_callback,
 jlong     j_multicastIP)
 {
   // jni variables
   JavaVM                 *jvm;
@@ -365,69 +348,63 @@ Java_org_ocera_orte_Subscription_jORTESubscriptionCreate
   const char             *typename = 0;
   void                   *buffer;
   int                     flag_ok = 0;
+
   // memory alocation
   // don't forget use free() funct.!!
-  callback_cont = (JORTECallbackContext_t*)malloc(sizeof(JORTECallbackContext_t));
-  callback_cont_ptr = (JORTECallbackContext_t**)malloc(sizeof(JORTECallbackContext_t*));
+  callback_cont = (JORTECallbackContext_t *)malloc(sizeof(JORTECallbackContext_t));
+  callback_cont_ptr = (JORTECallbackContext_t **)malloc(sizeof(JORTECallbackContext_t *));
   *callback_cont_ptr = callback_cont;
 
-  do
-  {
+  do {
 
     // get direct ByteBuffer pointer from Java
     buffer = (*env)->GetDirectBufferAddress(env, jinstance);
     // check obj_callback
-    if (obj_callback == 0)
-    {
+    if (obj_callback == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: obj_callback = NULL \n");
+      printf(":!c: obj_callback = NULL \n");
       #endif
       break;
     }
     // get jvm
-    jint b = (*env)->GetJavaVM(env,&jvm);
-    if (b <  0)
-    {
+    jint b = (*env)->GetJavaVM(env, &jvm);
+    if (b <  0) {
       #ifdef TEST_STAGE
-        printf(":!c: getJavaVM() failed! \n");
+      printf(":!c: getJavaVM() failed! \n");
       #endif
       break;
     }
-    if (b == 0)
-    {
+    if (b == 0) {
       #ifdef TEST_STAGE
-        printf(":c: getJavaVM succesfull.. \n");
+      printf(":c: getJavaVM succesfull.. \n");
       #endif
     }
     callback_cont->jvm = jvm;
-    callback_cont->cur_endian = (CDR_Endianness) jbyteOrder;
+    callback_cont->cur_endian = (CDR_Endianness)jbyteOrder;
     // create global references
     callback_cont->obj = (*env)->NewGlobalRef(env, obj_callback);
     //
-    if (callback_cont->obj == 0)
-    {
+    if (callback_cont->obj == 0) {
       #ifdef TEST_STAGE
-        printf(":c: global reference not created! \n");
+      printf(":c: global reference not created! \n");
       #endif
       break;
     }
     // create global references
     callback_cont->obj_buf = (*env)->NewGlobalRef(env, jinstance);
     //
-    if (callback_cont->obj_buf == 0)
-    {
+    if (callback_cont->obj_buf == 0) {
       #ifdef TEST_STAGE
-        printf(":c: global reference not created! \n");
+      printf(":c: global reference not created! \n");
       #endif
       break;
     }
     // create global references
     callback_cont->msg = (*env)->NewGlobalRef(env, obj_msg);
     //
-    if (callback_cont->msg == 0)
-    {
+    if (callback_cont->msg == 0) {
       #ifdef TEST_STAGE
-        printf(":c: global reference not created! \n");
+      printf(":c: global reference not created! \n");
       #endif
       break;
     }
@@ -435,77 +412,74 @@ Java_org_ocera_orte_Subscription_jORTESubscriptionCreate
     callback_cont->rinfo = 0;
     //
     cls = (*env)->GetObjectClass(env, obj);
-    if(cls == 0)
-    {
+    if (cls == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: cls = NULL \n");
+      printf(":!c: cls = NULL \n");
       #endif
       break;
     }
     // fieldID - callbackContextHandle
     fid = (*env)->GetFieldID(env,
-                             cls,
-                             "callbackContextHandle",
-                             "J");
-    if(fid == 0)
-    {
+                            cls,
+                            "callbackContextHandle",
+                            "J");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     (*env)->SetLongField(env,
-                        obj,
-                        fid,
-                        (jlong) callback_cont_ptr);
+                        obj,
+                        fid,
+                        (jlong)callback_cont_ptr);
     #ifdef TEST_STAGE
-       printf(":c: ORTESubscriptionCreate() calling..\n");
+    printf(":c: ORTESubscriptionCreate() calling..\n");
     #endif
     //
-    d = (ORTEDomain *) dhandle;
-    if (d == 0)
-    {
+    d = (ORTEDomain *)dhandle;
+    if (d == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: d = NULL [bad domain handle] \n");
+      printf(":!c: d = NULL [bad domain handle] \n");
       #endif
       break;
     }
     //
-    smode = (SubscriptionMode) jsmode;
-    stype = (SubscriptionType) jstype;
+    smode = (SubscriptionMode)jsmode;
+    stype = (SubscriptionType)jstype;
     topic = (*env)->GetStringUTFChars(env, jtopic, 0);
     typename = (*env)->GetStringUTFChars(env, jtname, 0);
-    deadline = getNtpTime(env, jdeadline);//
-    minSeparation = getNtpTime(env, jminSeparation);//
+    deadline = getNtpTime(env, jdeadline); //
+    minSeparation = getNtpTime(env, jminSeparation); //
     // call ORTE function
     s = ORTESubscriptionCreate(d,
-                               smode,
-                               stype,
-                               topic,
-                               typename,
-                               buffer,
-                               &deadline,
-                               &minSeparation,
-                               recvCallBack,
-                               (void*)callback_cont_ptr,
-                               (uint32_t) j_multicastIP);
-    if (s == 0)
-    {
+                              smode,
+                              stype,
+                              topic,
+                              typename,
+                              buffer,
+                              &deadline,
+                              &minSeparation,
+                              recvCallBack,
+                              (void *)callback_cont_ptr,
+                              (uint32_t)j_multicastIP);
+    if (s == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: s = NULL [subscription not created] \n");
+      printf(":!c: s = NULL [subscription not created] \n");
       #endif
       break;
     }
 
     // set flag
     flag_ok = 1;
-  } while(0);
+  } while (0);
 
   // free memory
   (*env)->ReleaseStringUTFChars(env, jtopic, topic);
   (*env)->ReleaseStringUTFChars(env, jtname, typename);
   // returns handle of new created Subscription
-  if(flag_ok == 0) return 0;
-  return ((jlong) s);
+  if (flag_ok == 0)
+    return 0;
+  return ((jlong)s);
 
 }
index 5d5569ed6f738204ee116979a847ddc67011d1ab..833070c739418c702bb7119a4893090a30e5e1d6 100644 (file)
@@ -38,7 +38,7 @@
 
 JNIEXPORT jboolean JNICALL
 Java_org_ocera_orte_Subscription_jORTESubscriptionDestroy
-(JNIEnv *env, jobject obj, jlong subs_handle)
+  (JNIEnv *env, jobject obj, jlong subs_handle)
 {
   int8_t        b;
   jlong         h;
@@ -47,96 +47,85 @@ Java_org_ocera_orte_Subscription_jORTESubscriptionDestroy
   int           flag_ok = 0;
 
   #ifdef TEST_STAGE
-    printf(":c: ORTESubscriptionDestroy() called.. \n");
+  printf(":c: ORTESubscriptionDestroy() called.. \n");
   #endif
 
-  do
-  {
-    if(subs_handle)
-    {
+  do {
+    if (subs_handle) {
       // call ORTE function
-      b = ORTESubscriptionDestroy((ORTESubscription *) subs_handle);
-      if (b == ORTE_BAD_HANDLE)
-      {
-        printf(":!c: subscription destroy failed! [bad sub handle] \n");
-        break;
+      b = ORTESubscriptionDestroy((ORTESubscription *)subs_handle);
+      if (b == ORTE_BAD_HANDLE) {
+       printf(":!c: subscription destroy failed! [bad sub handle] \n");
+       break;
       }
       #ifdef TEST_STAGE
-        printf(":c: subscription destroy succesfuly.. \n");
+      printf(":c: subscription destroy succesfuly.. \n");
       #endif
     }
 
     // free callBack object
     // find cls
     cls = (*env)->GetObjectClass(env, obj);
-    if(cls == 0)
-    {
+    if (cls == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: cls = NULL! \n");
+      printf(":!c: cls = NULL! \n");
      #endif
-     break;
+      break;
     }
     // fieldID
     fid = (*env)->GetFieldID(env,
-                             cls,
-                             "callbackContextHandle",
-                             "J");
-    if(fid == 0)
-    {
+                            cls,
+                            "callbackContextHandle",
+                            "J");
+    if (fid == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: fid = NULL! \n");
+      printf(":!c: fid = NULL! \n");
      #endif
-     break;
+      break;
     }
     // get value
     h = (*env)->GetLongField(env, obj, fid);
-    if(h)
-    {
+    if (h) {
       //JavaVM *jvm;
       //jint ret;
-      JORTECallbackContext_t *ctx = *((JORTECallbackContext_t**)h);
-      *((JORTECallbackContext_t**)h) = 0;
-      if(ctx->obj)
-      {
-        #ifdef TEST_STAGE
-          printf(":c: deleting ctx->obj \n");
-        #endif
-        (*env)->DeleteGlobalRef(env, ctx->obj);
+      JORTECallbackContext_t *ctx = *((JORTECallbackContext_t **)h);
+      *((JORTECallbackContext_t **)h) = 0;
+      if (ctx->obj) {
+       #ifdef TEST_STAGE
+       printf(":c: deleting ctx->obj \n");
+       #endif
+       (*env)->DeleteGlobalRef(env, ctx->obj);
       }
-      if(ctx->rinfo)
-      {
-        #ifdef TEST_STAGE
-          printf(":c: deleting ctx->rinfo\n");
-        #endif
-        (*env)->DeleteGlobalRef(env, ctx->rinfo);
+      if (ctx->rinfo) {
+       #ifdef TEST_STAGE
+       printf(":c: deleting ctx->rinfo\n");
+       #endif
+       (*env)->DeleteGlobalRef(env, ctx->rinfo);
       }
-      if(ctx->msg)
-      {
-        #ifdef TEST_STAGE
-          printf(":c: deleting ctx->msg\n");
-        #endif
-        (*env)->DeleteGlobalRef(env, ctx->msg);
+      if (ctx->msg) {
+       #ifdef TEST_STAGE
+       printf(":c: deleting ctx->msg\n");
+       #endif
+       (*env)->DeleteGlobalRef(env, ctx->msg);
       }
-      if(ctx->obj_buf)
-      {
-        #ifdef TEST_STAGE
-          printf(":c: deleting ctx->obj_buf\n");
-        #endif
-        (*env)->DeleteGlobalRef(env, ctx->obj_buf);
+      if (ctx->obj_buf) {
+       #ifdef TEST_STAGE
+       printf(":c: deleting ctx->obj_buf\n");
+       #endif
+       (*env)->DeleteGlobalRef(env, ctx->obj_buf);
       }
       //
       free(ctx);
     }
     // set flag
     flag_ok = 1;
-  } while(0);
+  } while (0);
 
   #ifdef TEST_STAGE
-     printf(":c: flag_ok = %d \n",flag_ok);
+  printf(":c: flag_ok = %d \n", flag_ok);
   #endif
 
-  if(flag_ok == 0)
-  {
+  if (flag_ok == 0) {
     return 0;
   }
 
index 6ba6b05342bbab466e714622e307b65cdb3f2f95..d6593d97330774b59d80e9b5e316a093940d02a5 100644 (file)
@@ -38,7 +38,7 @@
 
 JNIEXPORT jobject JNICALL
 Java_org_ocera_orte_Subscription_jORTESubscriptionGetStatus
-(JNIEnv *env, jobject obj, jlong j_appDomain_handle)
+  (JNIEnv *env, jobject obj, jlong j_appDomain_handle)
 {
   // jni types
   jclass           cls_ss = NULL; // class of SubsStatus
@@ -52,43 +52,38 @@ Java_org_ocera_orte_Subscription_jORTESubscriptionGetStatus
   ORTESubsStatus  *subs_stat = &ss;
 
   #ifdef TEST_STAGE
-    printf(":c: ORTEPublicationGetStatus() called.. \n");
+  printf(":c: ORTEPublicationGetStatus() called.. \n");
   #endif
 
   // create new Status instance and set its fields
-  do
-  {
+  do {
     // call ORTE function
     b = ORTESubscriptionGetStatus((ORTESubscription *)j_appDomain_handle, subs_stat);
-    if(b == ORTE_BAD_HANDLE)
-    {
-     printf(":!c: publicationGetStatus() failed! [bad pub handle] \n");
-     break;
+    if (b == ORTE_BAD_HANDLE) {
+      printf(":!c: publicationGetStatus() failed! [bad pub handle] \n");
+      break;
     }
     // find cls
-    cls_ss = findClass(env,"org.ocera.orte.types.Status");
-    if(cls_ss == 0)
-    {
+    cls_ss = findClass(env, "org.ocera.orte.types.Status");
+    if (cls_ss == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: cls_ss = NULL \n");
+      printf(":!c: cls_ss = NULL \n");
       #endif
       break;
     }
     // call object constructor
-    mid = (*env)->GetMethodID(env,cls_ss,"<init>","()V");
-    if(mid == 0)
-    {
+    mid = (*env)->GetMethodID(env, cls_ss, "<init>", "()V");
+    if (mid == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: mid = NULL \n");
+      printf(":!c: mid = NULL \n");
       #endif
       break;
     }
     // new object
     obj_ss = (*env)->NewObject(env, cls_ss, mid);
-    if(obj_ss == 0)
-    {
+    if (obj_ss == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: obj_ss = NULL \n");
+      printf(":!c: obj_ss = NULL \n");
       #endif
       break;
     }
@@ -96,59 +91,55 @@ Java_org_ocera_orte_Subscription_jORTESubscriptionGetStatus
     // setting object's fields
     // fieldID - strict
     fid = (*env)->GetFieldID(env,
-                             cls_ss,
-                             "strict",
-                             "J");
-    if(fid == NULL)
-    {
+                            cls_ss,
+                            "strict",
+                            "J");
+    if (fid == NULL) {
       #ifdef TEST_STAGE
-       printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     (*env)->SetLongField(env,
-                         obj_ss,
-                         fid,
-                         (jlong) subs_stat->strict);
+                        obj_ss,
+                        fid,
+                        (jlong)subs_stat->strict);
     // fieldID - bestEffort
     fid = (*env)->GetFieldID(env,
-                             cls_ss,
-                             "bestEffort",
-                             "J");
-    if(fid == NULL)
-    {
+                            cls_ss,
+                            "bestEffort",
+                            "J");
+    if (fid == NULL) {
       #ifdef TEST_STAGE
-       printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     (*env)->SetLongField(env,
-                         obj_ss,
-                         fid,
-                         (jlong) subs_stat->bestEffort);
+                        obj_ss,
+                        fid,
+                        (jlong)subs_stat->bestEffort);
     // fieldID - issues
     fid = (*env)->GetFieldID(env,
-                             cls_ss,
-                             "issues",
-                             "J");
-    if(fid == NULL)
-    {
+                            cls_ss,
+                            "issues",
+                            "J");
+    if (fid == NULL) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     (*env)->SetLongField(env,
-                         obj_ss,
-                         fid,
-                         (jlong) subs_stat->issues);
+                        obj_ss,
+                        fid,
+                        (jlong)subs_stat->issues);
     // set flag
     flag_ok = 1;
 
-  } while(0);
+  } while (0);
 
-  if(flag_ok == 0)
-  {
+  if (flag_ok == 0) {
     return NULL;
   }
 
index 0e1c6525bdf19cf94bab99b399bdce0abb42abaf..e06c4992dc924f0ae64bae7401a0449675d7f155 100644 (file)
 
 JNIEXPORT jobject JNICALL
 Java_org_ocera_orte_Subscription_jORTESubscriptionPropertiesGet
-(JNIEnv *env, jobject obj, jlong j_appDomain_handle)
+  (JNIEnv *env, jobject obj, jlong j_appDomain_handle)
 {
   // jni types
   jclass         cls_sp   = NULL; // SubsProp class
   jclass         cls_ntpT = NULL; // NtpTime class
   jobject        obj_sp   = NULL; // instance of SubsProp
-  jobject        obj_ntpT = NULL ;// instance of NtpTime
+  jobject        obj_ntpT = NULL// instance of NtpTime
   jfieldID       fid      = NULL;
   jmethodID      mid;
   //
@@ -53,249 +53,230 @@ Java_org_ocera_orte_Subscription_jORTESubscriptionPropertiesGet
   ORTESubsProp  *subs_prop = &sp;
 
   #ifdef TEST_STAGE
-    printf(":c: ORTESubscriptionPropertiesGet() called.. \n");
+  printf(":c: ORTESubscriptionPropertiesGet() called.. \n");
   #endif
 
   // create new SubsProps instance and set its fields
-  do
-  {
+  do {
     // calling ORTE function
     b = ORTESubscriptionPropertiesGet((ORTESubscription *)j_appDomain_handle,
-                                      subs_prop);
-    if(b == ORTE_BAD_HANDLE)
-    {
-     printf(":!c: subscription get properties failed!  [bad sub handle] \n");
-     break;
+                                     subs_prop);
+    if (b == ORTE_BAD_HANDLE) {
+      printf(":!c: subscription get properties failed!  [bad sub handle] \n");
+      break;
     }
     // get cls
     cls_sp = findClass(env, "org.ocera.orte.types.SubsProp");
-    if(cls_sp == 0)
-    {
+    if (cls_sp == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: cls_sp = NULL \n");
+      printf(":!c: cls_sp = NULL \n");
       #endif
       break;
     }
     // call object constructor
     mid = (*env)->GetMethodID(env, cls_sp, "<init>", "()V");
-    if(mid == 0)
-    {
+    if (mid == 0) {
     #ifdef TEST_STAGE
-       printf(":!c: mid = NULL \n");
+      printf(":!c: mid = NULL \n");
       #endif
       break;
     }
     // new object
     obj_sp = (*env)->NewObject(env, cls_sp, mid);
-    if(obj_sp == 0)
-    {
+    if (obj_sp == 0) {
     #ifdef TEST_STAGE
-       printf(":!c: obj_sp = NULL \n");
+      printf(":!c: obj_sp = NULL \n");
       #endif
       break;
     }
     #ifdef TEST_STAGE
-      printf(":c: instance of 'org.ocera.orte.types.SubsProp' created..\n");
+    printf(":c: instance of 'org.ocera.orte.types.SubsProp' created..\n");
     #endif
     // ///////////////////////////////////////////////
     // setting object's fields
     /////////////////////////////////////////////////
     // set topic
-    if(!setTopic(env,cls_sp,obj_sp,(const char *)subs_prop->topic))
-    {
+    if (!setTopic(env, cls_sp, obj_sp, (const char *)subs_prop->topic)) {
       #ifdef TEST_STAGE
-        printf(":!c: setTopic() failed! \n");
+      printf(":!c: setTopic() failed! \n");
       #endif
       break;
     }
     /////////////////////////////////////////////////
     // set type
-    if(!setType(env,cls_sp,obj_sp,(const char *)subs_prop->typeName))
-    {
+    if (!setType(env, cls_sp, obj_sp, (const char *)subs_prop->typeName)) {
       #ifdef TEST_STAGE
-        printf(":!c: setType() failed! \n");
+      printf(":!c: setType() failed! \n");
       #endif
       break;
     }
     /////////////////////////////////////////////////
     // fieldID - typeChecksum
     fid = (*env)->GetFieldID(env,
-                             cls_sp,
-                             "typeChecksum",
-                             "I");
-    if(fid == 0)
-    {
+                            cls_sp,
+                            "typeChecksum",
+                            "I");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     (*env)->SetIntField(env,
-                        obj_sp,
-                        fid,
-                        (jint) subs_prop->typeChecksum);
+                       obj_sp,
+                       fid,
+                       (jint)subs_prop->typeChecksum);
     /////////////////////////////////////////////////
     // fieldID - minSeparation
     cls_ntpT = findClass(env, "org.ocera.orte.types.NtpTime");
-    if(cls_ntpT == 0)
-    {
+    if (cls_ntpT == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: cls_ntpT = NULL \n");
+      printf(":!c: cls_ntpT = NULL \n");
       #endif
       break;
     }
     // call object constructor
     mid = (*env)->GetMethodID(env, cls_ntpT, "<init>", "(IJ)V");
-    if(mid == 0)
-    {
+    if (mid == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: mid = NULL \n");
+      printf(":!c: mid = NULL \n");
       #endif
       break;
     }
     // new object
     obj_ntpT = (*env)->NewObject(env,
-                                 cls_ntpT,
-                                 mid,
-                                 (jint)  subs_prop->minimumSeparation.seconds,
-                                 (jlong) subs_prop->minimumSeparation.fraction);
-    if(obj_ntpT == 0)
-    {
+                                cls_ntpT,
+                                mid,
+                                (jint)subs_prop->minimumSeparation.seconds,
+                                (jlong)subs_prop->minimumSeparation.fraction);
+    if (obj_ntpT == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: obj_ntpT = NULL \n");
+      printf(":!c: obj_ntpT = NULL \n");
       #endif
       break;
     }
     #ifdef TEST_STAGE
-      printf(":c: instance of 'org.ocera.orte.types.NtpTime' created..\n");
+    printf(":c: instance of 'org.ocera.orte.types.NtpTime' created..\n");
     #endif
     // set 'SubsProp' NtpTime's field
     fid = (*env)->GetFieldID(env,
-                             cls_sp,
-                             "minSeparation",
-                             "Lorg/ocera/orte/types/NtpTime;");
-    if(fid == 0)
-    {
+                            cls_sp,
+                            "minSeparation",
+                            "Lorg/ocera/orte/types/NtpTime;");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     (*env)->SetObjectField(env,
-                           obj_sp,
-                           fid,
-                           obj_ntpT);
+                          obj_sp,
+                          fid,
+                          obj_ntpT);
     /////////////////////////////////////////////////
     // fieldID - deadline
     // pointers cls_ntpT, obj_ntpT already set
     // new object
     obj_ntpT = (*env)->NewObject(env,
-                                 cls_ntpT,
-                                 mid,
-                                 (jint)  subs_prop->deadline.seconds,
-                                 (jlong) subs_prop->deadline.fraction);
-    if(obj_ntpT == 0)
-    {
+                                cls_ntpT,
+                                mid,
+                                (jint)subs_prop->deadline.seconds,
+                                (jlong)subs_prop->deadline.fraction);
+    if (obj_ntpT == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: obj_ntpT = NULL \n");
+      printf(":!c: obj_ntpT = NULL \n");
       #endif
       break;
     }
     #ifdef TEST_STAGE
-      printf(":c: instance of 'org.ocera.orte.types.NtpTime' created..\n");
+    printf(":c: instance of 'org.ocera.orte.types.NtpTime' created..\n");
     #endif
     // set 'SubsProp' NtpTime's field
     fid = (*env)->GetFieldID(env,
-                             cls_sp,
-                             "deadline",
-                             "Lorg/ocera/orte/types/NtpTime;");
-    if(fid == 0)
-    {
+                            cls_sp,
+                            "deadline",
+                            "Lorg/ocera/orte/types/NtpTime;");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-       printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     (*env)->SetObjectField(env,
-                           obj_sp,
-                           fid,
-                           obj_ntpT);
+                          obj_sp,
+                          fid,
+                          obj_ntpT);
     /////////////////////////////////////////////////
     // fieldID - recvQueueSize
     fid = (*env)->GetFieldID(env,
-                             cls_sp,
-                             "recvQueueSize",
-                             "J");
-    if(fid == 0)
-    {
+                            cls_sp,
+                            "recvQueueSize",
+                            "J");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     (*env)->SetLongField(env,
-                         obj_sp,
-                         fid,
-                         (jlong) subs_prop->recvQueueSize);
+                        obj_sp,
+                        fid,
+                        (jlong)subs_prop->recvQueueSize);
     /////////////////////////////////////////////////
     // fieldID - reliabilityRequested
     fid = (*env)->GetFieldID(env,
-                             cls_sp,
-                             "reliabilityRequested",
-                             "J");
-    if(fid == 0)
-    {
+                            cls_sp,
+                            "reliabilityRequested",
+                            "J");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     (*env)->SetLongField(env,
-                         obj_sp,
-                         fid,
-                         (jlong) subs_prop->reliabilityRequested);
+                        obj_sp,
+                        fid,
+                        (jlong)subs_prop->reliabilityRequested);
     /////////////////////////////////////////////////
     // fieldID - mode
     fid = (*env)->GetFieldID(env,
-                             cls_sp,
-                             "mode",
-                             "I");
-    if(fid == 0)
-    {
+                            cls_sp,
+                            "mode",
+                            "I");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     (*env)->SetIntField(env,
-                        obj_sp,
-                        fid,
-                        (jint) subs_prop->mode);
+                       obj_sp,
+                       fid,
+                       (jint)subs_prop->mode);
     /////////////////////////////////////////////////
     // fieldID - multicastIPAddr
     fid = (*env)->GetFieldID(env,
-                             cls_sp,
-                             "multicastIPAddr",
-                             "J");
-    if(fid == 0)
-    {
+                            cls_sp,
+                            "multicastIPAddr",
+                            "J");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     (*env)->SetLongField(env,
-                         obj_sp,
-                         fid,
-                         (jlong) subs_prop->multicast);
+                        obj_sp,
+                        fid,
+                        (jlong)subs_prop->multicast);
     // set flag
     flag_ok = 1;
 
-  } while(0);
+  } while (0);
 
   // return created object
-  if(flag_ok == 0)
-  {
+  if (flag_ok == 0) {
     return NULL;
   }
 
index 06a5c4c79bd5544b77f0d419851eae53e1f4b248..636e698f13e9c92c398135e0750c0563c37f6a0c 100644 (file)
@@ -40,7 +40,7 @@
 
 JNIEXPORT jboolean JNICALL
 Java_org_ocera_orte_Subscription_jORTESubscriptionPropertiesSet
-(JNIEnv *env, jobject obj, jlong j_appDomain_handle, jobject obj_sp)
+  (JNIEnv *env, jobject obj, jlong j_appDomain_handle, jobject obj_sp)
 {
   // jni types
   jclass         cls_sp = NULL;
@@ -56,17 +56,15 @@ Java_org_ocera_orte_Subscription_jORTESubscriptionPropertiesSet
   ORTESubsProp  *subs_prop = &sp;
 
   #ifdef TEST_STAGE
-    printf(":c: jORTESubscriptionPropertiesSet() called.. \n");
+  printf(":c: jORTESubscriptionPropertiesSet() called.. \n");
   #endif
 
-  do
-  {
+  do {
     // get SubsProp instance's class
     cls_sp = (*env)->GetObjectClass(env, obj_sp);
     // second way how to get 'SubProp' instance's class
     //cls_sp = (*env)->FindClass(env,"org/ocera/orte/types/SubsProp");
-    if(cls_sp == 0)
-    {
+    if (cls_sp == 0) {
       printf(":!c: class 'org.ocera.orte.types.SubsProp' not found! \n");
       break;
     }
@@ -75,161 +73,151 @@ Java_org_ocera_orte_Subscription_jORTESubscriptionPropertiesSet
     /////////////////////////////////////////////////
     // set topic
     fid = (*env)->GetFieldID(env,
-                             cls_sp,
-                             "topic",
-                             "Ljava/lang/String;");
-    if(fid == 0)
-    {
+                            cls_sp,
+                            "topic",
+                            "Ljava/lang/String;");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     obj_str = (*env)->GetObjectField(env, obj_sp, fid);
-    if(obj_str == 0)
-    {
+    if (obj_str == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: obj_str = NULL \n");
+      printf(":!c: obj_str = NULL \n");
       #endif
       break;
     }
-    str = (*env)->GetStringUTFChars(env,obj_str,0);
+    str = (*env)->GetStringUTFChars(env, obj_str, 0);
     // Set the structure field.
-    strncpy((char *)subs_prop->topic, (const char*)str, strlen(str) + 1);
+    strncpy((char *)subs_prop->topic, (const char *)str, strlen(str) + 1);
     #ifdef TEST_STAGE
-      printf(":c: topic = %s, subs_prop->topic = %s \n",
-             str, subs_prop->topic);
+    printf(":c: topic = %s, subs_prop->topic = %s \n",
+          str, subs_prop->topic);
     #endif
     // free the memory
     (*env)->ReleaseStringUTFChars(env, obj_str, str);
     /////////////////////////////////////////////////
     // set topic - typeName
     fid = (*env)->GetFieldID(env,
-                             cls_sp,
-                             "typeName",
-                             "Ljava/lang/String;");
-    if(fid == 0)
-    {
+                            cls_sp,
+                            "typeName",
+                            "Ljava/lang/String;");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     obj_str = (*env)->GetObjectField(env, obj_sp, fid);
-    if(obj_str == 0)
-    {
+    if (obj_str == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: obj_str = NULL \n");
+      printf(":!c: obj_str = NULL \n");
       #endif
       break;
     }
-    str = (*env)->GetStringUTFChars(env,obj_str,0);
+    str = (*env)->GetStringUTFChars(env, obj_str, 0);
     // Set the structure field.
-    strncpy((char *)subs_prop->typeName, (const char*)str, strlen(str) + 1);
+    strncpy((char *)subs_prop->typeName, (const char *)str, strlen(str) + 1);
     #ifdef TEST_STAGE
-      printf(":c: typeName = %s, subs_prop->typeName = %s \n",
-             str, subs_prop->typeName);
+    printf(":c: typeName = %s, subs_prop->typeName = %s \n",
+          str, subs_prop->typeName);
     #endif
     // free the memory
     (*env)->ReleaseStringUTFChars(env, obj_str, str);
     /////////////////////////////////////////////////
     // set topic - typeChecksum
-    fid = (*env)->GetFieldID(env,cls_sp,"typeChecksum","I");
-    if(fid == 0)
-    {
+    fid = (*env)->GetFieldID(env, cls_sp, "typeChecksum", "I");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
-    subs_prop->typeChecksum = (TypeChecksum) (*env)->GetIntField(env, obj_sp, fid);
+    subs_prop->typeChecksum = (TypeChecksum)(*env)->GetIntField(env, obj_sp, fid);
     #ifdef TEST_STAGE
-      printf(":c: check: subs_prop->typeChecksum = %"PRId32"\n",
-             subs_prop->typeChecksum);
+    printf(":c: check: subs_prop->typeChecksum = %" PRId32 "\n",
+          subs_prop->typeChecksum);
     #endif
     /////////////////////////////////////////////////
     // set topic - minimumSeparation
     fid = (*env)->GetFieldID(env,
-                             cls_sp,
-                             "minSeparation",
-                             "Lorg/ocera/orte/types/NtpTime;");
-    if(fid == 0)
-    {
+                            cls_sp,
+                            "minSeparation",
+                            "Lorg/ocera/orte/types/NtpTime;");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     j_minSeparation = (*env)->GetObjectField(env, obj_sp, fid);
     subs_prop->minimumSeparation = getNtpTime(env, j_minSeparation);
     #ifdef TEST_STAGE
-      printf(":c: check: subs_prop->minimumSeparation: sec = %"PRId32", fract = %"PRIu32" \n",
-             subs_prop->minimumSeparation.seconds,
-             subs_prop->minimumSeparation.fraction);
+    printf(":c: check: subs_prop->minimumSeparation: sec = %" PRId32 ", fract = %" PRIu32 " \n",
+          subs_prop->minimumSeparation.seconds,
+          subs_prop->minimumSeparation.fraction);
     #endif
     /////////////////////////////////////////////////
     // set topic - recvQueueSize
-    fid = (*env)->GetFieldID(env,cls_sp,"recvQueueSize","J");
-    if(fid == 0)
-    {
+    fid = (*env)->GetFieldID(env, cls_sp, "recvQueueSize", "J");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
-    subs_prop->recvQueueSize = (uint32_t) (*env)->GetLongField(env, obj_sp, fid);
+    subs_prop->recvQueueSize = (uint32_t)(*env)->GetLongField(env, obj_sp, fid);
     #ifdef TEST_STAGE
-      printf(":c: check: subs_prop->recvQueueSize = %"PRIu32" \n",
-             subs_prop->recvQueueSize);
+    printf(":c: check: subs_prop->recvQueueSize = %" PRIu32 " \n",
+          subs_prop->recvQueueSize);
     #endif
     /////////////////////////////////////////////////
     // set topic - reliabilityRequested
-    fid = (*env)->GetFieldID(env,cls_sp,"reliabilityRequested","J");
-    if(fid == 0)
-    {
+    fid = (*env)->GetFieldID(env, cls_sp, "reliabilityRequested", "J");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
-    subs_prop->reliabilityRequested = (uint32_t) (*env)->GetLongField(env, obj_sp, fid);
+    subs_prop->reliabilityRequested = (uint32_t)(*env)->GetLongField(env, obj_sp, fid);
     #ifdef TEST_STAGE
-      printf(":c: check: subs_prop->reliabilityRequested = %"PRIu32" \n",
-             subs_prop->reliabilityRequested);
+    printf(":c: check: subs_prop->reliabilityRequested = %" PRIu32 " \n",
+          subs_prop->reliabilityRequested);
     #endif
     /////////////////////////////////////////////////
     // set topic - deadline
     fid = (*env)->GetFieldID(env,
-                             cls_sp,
-                             "deadline",
-                             "Lorg/ocera/orte/types/NtpTime;");
-    if(fid == 0)
-    {
+                            cls_sp,
+                            "deadline",
+                            "Lorg/ocera/orte/types/NtpTime;");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     j_deadline = (*env)->GetObjectField(env, obj_sp, fid);
     subs_prop->deadline = getNtpTime(env, j_deadline);
     #ifdef TEST_STAGE
-      printf(":c: check: subs_prop->deadline: sec = %"PRId32", fract = %"PRIu32"  \n",
-             subs_prop->deadline.seconds, subs_prop->deadline.fraction);
+    printf(":c: check: subs_prop->deadline: sec = %" PRId32 ", fract = %" PRIu32 "  \n",
+          subs_prop->deadline.seconds, subs_prop->deadline.fraction);
     #endif
     /////////////////////////////////////////////////
     // set topic - mode
-    fid = (*env)->GetFieldID(env,cls_sp,"mode","I");
-    if(fid == 0)
-    {
+    fid = (*env)->GetFieldID(env, cls_sp, "mode", "I");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
-    subs_prop->mode = (uint32_t) (*env)->GetIntField(env, obj_sp, fid);
+    subs_prop->mode = (uint32_t)(*env)->GetIntField(env, obj_sp, fid);
     #ifdef TEST_STAGE
-      printf(":c: check: subs_prop->mode = %"PRIu32" \n",
-             subs_prop->mode);
+    printf(":c: check: subs_prop->mode = %" PRIu32 " \n",
+          subs_prop->mode);
     #endif
 /*
     /////////////////////////////////////////////////
@@ -249,18 +237,16 @@ Java_org_ocera_orte_Subscription_jORTESubscriptionPropertiesSet
     #endif
 */
     // calling original native method
-    b = ORTESubscriptionPropertiesSet((ORTESubscription *) j_appDomain_handle, subs_prop);
-    if (b == ORTE_BAD_HANDLE)
-    {
+    b = ORTESubscriptionPropertiesSet((ORTESubscription *)j_appDomain_handle, subs_prop);
+    if (b == ORTE_BAD_HANDLE) {
       printf(":c!: cannot set new Subscription Properties! [bad sub handle] \n");
       break;
     }
     // set flag
     flag_ok = 1;
-  } while(0);
+  } while (0);
 
-  if(flag_ok == 0)
-  {
+  if (flag_ok == 0) {
     return 0;
   }
 
index 938f9934c6ab603ffb2f2095b5c97ba39692f146..991143f9e9e50cfb018743bed447705b94727c86 100644 (file)
@@ -4,8 +4,7 @@
 
 JNIEXPORT jint JNICALL
 Java_org_ocera_orte_Subscription_jORTESubscriptionPull
-(JNIEnv *env, jobject obj, jlong sub_handle)
+  (JNIEnv *env, jobject obj, jlong sub_handle)
 {
-  return ORTESubscriptionPull((ORTESubscription*)sub_handle);
+  return ORTESubscriptionPull((ORTESubscription *)sub_handle);
 }
-
index 7852648e8d5cb0f56d785297ea025f34ba708852..d839e204a8953e062808aa875ca4393c697f918d 100644 (file)
 
 JNIEXPORT jint JNICALL
 Java_org_ocera_orte_Subscription_jORTESubscriptionWaitForPublications
-(JNIEnv *env, jobject obj, jlong j_appDomain_handle,
- jobject obj_ntpT, jlong jretries, jlong jnoPublications)
+  (JNIEnv *env, jobject obj, jlong j_appDomain_handle,
 jobject obj_ntpT, jlong jretries, jlong jnoPublications)
 {
   int            i;
   NtpTime        wait;
 
   #ifdef TEST_STAGE
-    printf(":c: jORTESubscriptionWaitForPublications() called.. \n");
+  printf(":c: jORTESubscriptionWaitForPublications() called.. \n");
   #endif
   //
   wait = getNtpTime(env, obj_ntpT);
   #ifdef TEST_STAGE
-    printf(":c: check: wait: sec = %"PRId32", fract = %"PRIu32"  \n",
-           wait.seconds, wait.fraction);
+  printf(":c: check: wait: sec = %" PRId32 ", fract = %" PRIu32 "  \n",
+        wait.seconds, wait.fraction);
   #endif
   // calling ORTE function
-  i = ORTESubscriptionWaitForPublications((ORTESubscription *) j_appDomain_handle,
-                                          wait,
-                                          (unsigned int) jretries,
-                                          (unsigned int) jnoPublications);
-  if (i == ORTE_BAD_HANDLE)
-  {
+  i = ORTESubscriptionWaitForPublications((ORTESubscription *)j_appDomain_handle,
+                                         wait,
+                                         (unsigned int)jretries,
+                                         (unsigned int)jnoPublications);
+  if (i == ORTE_BAD_HANDLE) {
     printf(":c!: wait for subscriptions failed! [bad sub handle] \n");
     return ORTE_BAD_HANDLE;
   }
-  if (i == ORTE_TIMEOUT)
-  {
+  if (i == ORTE_TIMEOUT) {
     printf(":c!: wait for subscriptions: timeout! [number of subscriptions exhausted] \n");
     return ORTE_TIMEOUT;
   }
-  if (i == ORTE_OK);
+  if (i == ORTE_OK) ;
   return ORTE_OK;
 }
index 73e9c640ad6080bbe9424df5de4d4a4dae3d6c69..bbcb96c6bd9507d49c0a1b5ef40c830f9a5fdcf5 100644 (file)
 
 JNIEXPORT jint JNICALL
 Java_org_ocera_orte_DomainApp_jORTETypeRegisterAdd
-(JNIEnv *env, jclass cls, jlong handle, jstring jname, jlong jlength)
+  (JNIEnv *env, jclass cls, jlong handle, jstring jname, jlong jlength)
 {
   const char     *name;
   int            b;
 
   // get type name from JAVA env
-  name = (*env)->GetStringUTFChars(env,jname,0);
+  name = (*env)->GetStringUTFChars(env, jname, 0);
   // call ORTE function
-  b = ORTETypeRegisterAdd((ORTEDomain *) handle,
-                          name,
-                          NULL,
-                          NULL,
-                          NULL,
-                          (unsigned int) jlength);
+  b = ORTETypeRegisterAdd((ORTEDomain *)handle,
+                         name,
+                         NULL,
+                         NULL,
+                         NULL,
+                         (unsigned int)jlength);
   // free memmory space
-  (*env)->ReleaseStringUTFChars(env,jname,name);
+  (*env)->ReleaseStringUTFChars(env, jname, name);
   #ifdef TEST_STAGE
   printf(":c: jORTETypeRegisterAdd vraci %d [%d = ORTE_OK, %d = ORTE_BAD_HANDLE] \n",
-         b,ORTE_OK,ORTE_BAD_HANDLE);
+        b, ORTE_OK, ORTE_BAD_HANDLE);
   #endif
   return b;
 
index cea627eaa157cd40200db8a74e994be9315afbe9..7914a044b4eb56a86bdf5840b870f48b4ef0a8ed 100644 (file)
 
 JNIEXPORT jboolean JNICALL
 Java_org_ocera_orte_DomainApp_jORTETypeRegisterDestroyAll
-(JNIEnv *env, jclass cls, jlong j_app_domain_handle)
+  (JNIEnv *env, jclass cls, jlong j_app_domain_handle)
 {
   int b;
 
-  if(j_app_domain_handle == 0)
-  {
+  if (j_app_domain_handle == 0) {
     printf(":!c: can not destroy all reg. types! [bad handle] \n");
     return 0;
   }
   // call ORTE function
-  b = ORTETypeRegisterDestroyAll((ORTEDomain *) j_app_domain_handle);
-  if(b == ORTE_OK) return 1;
+  b = ORTETypeRegisterDestroyAll((ORTEDomain *)j_app_domain_handle);
+  if (b == ORTE_OK)
+    return 1;
   return 0;
 }
index 1059e2547408c9412419ca3d19ca5ff00b587a72..750141e8ee4ce324ff94f9da5c399d3642c0bd75 100644 (file)
 /* native function - prototype declared in pregenerated header */
 JNIEXPORT void JNICALL
 Java_org_ocera_orte_JOrte_jORTEVerbositySetLogFile
-(JNIEnv *env, jclass cls, jstring j_logfile)
+  (JNIEnv *env, jclass cls, jstring j_logfile)
 {
-  const char * logfile;
+  const char *logfile;
 
   // get logfile
-  logfile = (*env)->GetStringUTFChars(env,j_logfile,0);
+  logfile = (*env)->GetStringUTFChars(env, j_logfile, 0);
   // call ORTE function
   ORTEVerbositySetLogFile(logfile);
   // free memory
index 84aaf5d3430a9aad456cfce2c5a2bc7b936521fb..b61cab492890f5dd06b121b1e173ef87d136e98e 100644 (file)
 /* native function - prototype declared in pregenerated header */
 JNIEXPORT void JNICALL
 Java_org_ocera_orte_JOrte_jORTEVerbositySetOptions
-(JNIEnv *env, jclass cls, jstring j_options)
+  (JNIEnv *env, jclass cls, jstring j_options)
 {
-  const char * options;
+  const char *options;
 
-  // get options 
-  options = (*env)->GetStringUTFChars(env,j_options,0);
+  // get options
+  options = (*env)->GetStringUTFChars(env, j_options, 0);
   // call ORTE function
   ORTEVerbositySetOptions(options);
   // free memory
index a1f86142719791a7df0687396464030abe00a248..427e9f9064ff95ab1567b47a4e28474fd66736af 100644 (file)
 /* native function - prototype declared in pregenerated header */
 JNIEXPORT jlong JNICALL
 Java_org_ocera_orte_tools_JORTEConversions_StringToIPAddress
-(JNIEnv *env, jclass class, jstring jstrIP)
+  (JNIEnv *env, jclass class, jstring jstrIP)
 {
   const char *charIP;
   long        longIP;
 
   // get IP
-  charIP = (*env)->GetStringUTFChars(env,jstrIP,0);
+  charIP = (*env)->GetStringUTFChars(env, jstrIP, 0);
   // call ORTE function
   longIP = (long)StringToIPAddress(charIP);
   // free memory
   (*env)->ReleaseStringUTFChars(env, jstrIP, charIP);
   return(longIP);
 }
-
index 1d06bbe1338da62cc951f0867095581cc0d042c3..e195795b003b575ab1590001eaeb0996179dce23 100644 (file)
@@ -6,7 +6,8 @@
 #include "jorte/jorte_protos_api.h"
 #include <inttypes.h>
 
-jobject createAppInfo(JNIEnv *env, const ORTEAppInfo *ainfo)
+jobject
+createAppInfo(JNIEnv *env, const ORTEAppInfo *ainfo)
 {
   jclass    cls;
   jclass    cls_tmp;
@@ -17,290 +18,269 @@ jobject createAppInfo(JNIEnv *env, const ORTEAppInfo *ainfo)
   //
   int flag_ok = 0;
 
-  do
-  {
+  do {
     // find cls
     cls = findClass(env, "org.ocera.orte.types.AppInfo");
-    if(cls == 0)
-    {
+    if (cls == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: cls = NULL \n");
+      printf(":!c: cls = NULL \n");
       #endif
       break;
     }
     // call object constructor
     mid = (*env)->GetMethodID(env, cls, "<init>", "()V");
-    if(mid == 0)
-    {
+    if (mid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: constructor failed! \n");
+      printf(":!c: constructor failed! \n");
       #endif
       break;
     }
     // create new object
     obj = (*env)->NewObject(env, cls, mid);
-    if(obj == 0)
-    {
+    if (obj == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: obj = NULL \n");
+      printf(":!c: obj = NULL \n");
       #endif
       break;
     }
     // field ID - hostID
-    fid = (*env)->GetFieldID(env,cls,"hostId","J");
-    if(fid == 0)
-    {
+    fid = (*env)->GetFieldID(env, cls, "hostId", "J");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     #ifdef TEST_STAGE
-       printf(":c: ainfo.hostId = %#"PRIx32" \n",ainfo->hostId);
+    printf(":c: ainfo.hostId = %#" PRIx32 " \n", ainfo->hostId);
     #endif
     (*env)->SetLongField(env,
-                         obj,
-                         fid,
-                         (jlong) ainfo->hostId);
+                        obj,
+                        fid,
+                        (jlong)ainfo->hostId);
 
     // field ID - appID
-    fid = (*env)->GetFieldID(env,cls,"appId","J");
-    if(fid == 0)
-    {
+    fid = (*env)->GetFieldID(env, cls, "appId", "J");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     #ifdef TEST_STAGE
-       printf(":c: ainfo.appId = %#"PRIx32" \n",ainfo->appId);
+    printf(":c: ainfo.appId = %#" PRIx32 " \n", ainfo->appId);
     #endif
     (*env)->SetLongField(env,
-                         obj,
-                         fid,
-                         (jlong) ainfo->appId);
+                        obj,
+                        fid,
+                        (jlong)ainfo->appId);
     // field ID - unicastIPAddressTemp
-    fid = (*env)->GetFieldID(env,cls,"unicastIPAddressTemp","J");
-    if(fid == 0)
-    {
+    fid = (*env)->GetFieldID(env, cls, "unicastIPAddressTemp", "J");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid uniIPAddrTemp = NULL \n");
+      printf(":!c: fid uniIPAddrTemp = NULL \n");
       #endif
       break;
     }
     #ifdef TEST_STAGE
-       printf(":c: ainfo.unicastIPAddressList = %#"PRIxPTR"\n",(intptr_t)ainfo->unicastIPAddressList);
+    printf(":c: ainfo.unicastIPAddressList = %#" PRIxPTR "\n", (intptr_t)ainfo->unicastIPAddressList);
     #endif
     (*env)->SetLongField(env,
-                         obj,
-                         fid,
-                         (jlong) *ainfo->unicastIPAddressList);
+                        obj,
+                        fid,
+                        (jlong) *ainfo->unicastIPAddressList);
     // field ID - unicastIPcount
-    fid = (*env)->GetFieldID(env,cls,"unicastIPcount","B");
-    if(fid == 0)
-    {
+    fid = (*env)->GetFieldID(env, cls, "unicastIPcount", "B");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     #ifdef TEST_STAGE
-       printf(":c: ainfo.unicastIPcount = %hhu \n",
-              ainfo->unicastIPAddressCount);
+    printf(":c: ainfo.unicastIPcount = %hhu \n",
+          ainfo->unicastIPAddressCount);
     #endif
     (*env)->SetByteField(env,
-                         obj,
-                         fid,
-                         (jbyte) ainfo->unicastIPAddressCount);
+                        obj,
+                        fid,
+                        (jbyte)ainfo->unicastIPAddressCount);
     // field ID - multicastIPAddressTemp
-    fid = (*env)->GetFieldID(env,cls,"mettaTrafficMulticastIPAddressTemp","J");
-    if(fid == 0)
-    {
+    fid = (*env)->GetFieldID(env, cls, "mettaTrafficMulticastIPAddressTemp", "J");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid multiIPAddrTemp = NULL \n");
+      printf(":!c: fid multiIPAddrTemp = NULL \n");
       #endif
       break;
     }
     #ifdef TEST_STAGE
-       printf(":c: ainfo.multicastIPAddressList = %#"PRIxPTR"\n",
-              (intptr_t)ainfo->metatrafficMulticastIPAddressList);
+    printf(":c: ainfo.multicastIPAddressList = %#" PRIxPTR "\n",
+          (intptr_t)ainfo->metatrafficMulticastIPAddressList);
     #endif
     (*env)->SetLongField(env,
-                         obj,
-                         fid,
-                         (jlong) *ainfo->metatrafficMulticastIPAddressList);
+                        obj,
+                        fid,
+                        (jlong) *ainfo->metatrafficMulticastIPAddressList);
     // field ID - multicastIPcount
-    fid = (*env)->GetFieldID(env,cls,"multicastIPcount","B");
-    if(fid == 0)
-    {
+    fid = (*env)->GetFieldID(env, cls, "multicastIPcount", "B");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     #ifdef TEST_STAGE
-       printf(":c: ainfo.metatrafficMulticastIPAddressCount = %hhu \n",
-              ainfo->metatrafficMulticastIPAddressCount);
+    printf(":c: ainfo.metatrafficMulticastIPAddressCount = %hhu \n",
+          ainfo->metatrafficMulticastIPAddressCount);
     #endif
     (*env)->SetByteField(env,
-                         obj,
-                         fid,
-                         (jbyte) ainfo->metatrafficMulticastIPAddressCount);
+                        obj,
+                        fid,
+                        (jbyte)ainfo->metatrafficMulticastIPAddressCount);
 
     // field ID - mettatraficUnicastPort
-    fid = (*env)->GetFieldID(env,cls,"metatrafficUniPort","J");
-    if(fid == 0)
-    {
+    fid = (*env)->GetFieldID(env, cls, "metatrafficUniPort", "J");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     #ifdef TEST_STAGE
-       printf(":c: ainfo.metatrafficUnicastPort = %"PRIu32" \n",
-              ainfo->metatrafficUnicastPort);
+    printf(":c: ainfo.metatrafficUnicastPort = %" PRIu32 " \n",
+          ainfo->metatrafficUnicastPort);
     #endif
     (*env)->SetLongField(env,
-                         obj,
-                         fid,
-                         (jlong) ainfo->metatrafficUnicastPort);
+                        obj,
+                        fid,
+                        (jlong)ainfo->metatrafficUnicastPort);
 
     // field ID - userdataUnicastPort
-    fid = (*env)->GetFieldID(env,cls,"userdataUniPort","J");
-    if(fid == 0)
-    {
+    fid = (*env)->GetFieldID(env, cls, "userdataUniPort", "J");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     #ifdef TEST_STAGE
-       printf(":c: ainfo.userdataUnicastPort = %"PRIu32" \n",
-              ainfo->userdataUnicastPort);
+    printf(":c: ainfo.userdataUnicastPort = %" PRIu32 " \n",
+          ainfo->userdataUnicastPort);
     #endif
     (*env)->SetLongField(env,
-                         obj,
-                         fid,
-                         (jlong) ainfo->userdataUnicastPort);
+                        obj,
+                        fid,
+                        (jlong)ainfo->userdataUnicastPort);
 
     // find cls - VendorID
     cls_tmp = findClass(env, "org.ocera.orte.types.VendorId");
-    if(cls_tmp == 0)
-    {
+    if (cls_tmp == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: cls_tmp = NULL \n");
+      printf(":!c: cls_tmp = NULL \n");
       #endif
       break;
     }
     // call object constructor
     mid = (*env)->GetMethodID(env,
-                              cls_tmp,
-                              "<init>",
-                              "(BB)V");
-    if(mid == 0)
-    {
+                             cls_tmp,
+                             "<init>",
+                             "(BB)V");
+    if (mid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: constructor failed! \n");
+      printf(":!c: constructor failed! \n");
       #endif
       break;
     }
     // create new object
     obj_tmp = (*env)->NewObject(env,
-                                cls_tmp,
-                                mid,
-                                ainfo->vendorId.major,
-                                ainfo->vendorId.minor);
-    if(obj_tmp == 0)
-    {
+                               cls_tmp,
+                               mid,
+                               ainfo->vendorId.major,
+                               ainfo->vendorId.minor);
+    if (obj_tmp == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: obj = NULL \n");
+      printf(":!c: obj = NULL \n");
       #endif
       break;
     }
     // set AppInfo's field
     fid = (*env)->GetFieldID(env,
-                             cls,
-                             "vendorId",
-                             "Lorg/ocera/orte/types/VendorId;");
-    if(fid == 0)
-    {
+                            cls,
+                            "vendorId",
+                            "Lorg/ocera/orte/types/VendorId;");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     #ifdef TEST_STAGE
-       printf(":c: ainfo.vendorId: major = %"PRId8", minor = %"PRId8" \n",
-              ainfo->vendorId.major, ainfo->vendorId.minor);
+    printf(":c: ainfo.vendorId: major = %" PRId8 ", minor = %" PRId8 " \n",
+          ainfo->vendorId.major, ainfo->vendorId.minor);
     #endif
     (*env)->SetObjectField(env,
-                           obj,
-                           fid,
-                           obj_tmp);
+                          obj,
+                          fid,
+                          obj_tmp);
 
     // find cls - VendorID
     cls_tmp = findClass(env, "org.ocera.orte.types.ProtocolVersion");
-    if(cls_tmp == 0)
-    {
+    if (cls_tmp == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: cls_tmp = NULL \n");
+      printf(":!c: cls_tmp = NULL \n");
       #endif
       break;
     }
     // call object constructor
     mid = (*env)->GetMethodID(env,
-                              cls_tmp,
-                              "<init>",
-                              "(BB)V");
-    if(mid == 0)
-    {
+                             cls_tmp,
+                             "<init>",
+                             "(BB)V");
+    if (mid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: constructor failed! \n");
+      printf(":!c: constructor failed! \n");
       #endif
       break;
     }
     // create new object
     obj_tmp = (*env)->NewObject(env,
-                                cls_tmp,
-                                mid,
-                                ainfo->protocolVersion.major,
-                                ainfo->protocolVersion.minor);
-    if(obj_tmp == 0)
-    {
+                               cls_tmp,
+                               mid,
+                               ainfo->protocolVersion.major,
+                               ainfo->protocolVersion.minor);
+    if (obj_tmp == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: obj = NULL \n");
+      printf(":!c: obj = NULL \n");
       #endif
       break;
     }
     // set AppInfo's field
     fid = (*env)->GetFieldID(env,
-                             cls,
-                             "protocolVersion",
-                             "Lorg/ocera/orte/types/ProtocolVersion;");
-    if(fid == 0)
-    {
+                            cls,
+                            "protocolVersion",
+                            "Lorg/ocera/orte/types/ProtocolVersion;");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     #ifdef TEST_STAGE
-       printf(":c: ainfo.protocolVersion: major = %"PRId8", minor = %"PRId8" \n",
-              ainfo->protocolVersion.major, ainfo->protocolVersion.minor);
+    printf(":c: ainfo.protocolVersion: major = %" PRId8 ", minor = %" PRId8 " \n",
+          ainfo->protocolVersion.major, ainfo->protocolVersion.minor);
     #endif
     (*env)->SetObjectField(env,
-                           obj,
-                           fid,
-                           obj_tmp);
+                          obj,
+                          fid,
+                          obj_tmp);
 
     flag_ok = 1;
-  } while(0);
+  } while (0);
 
-  if(!flag_ok)
-  {
+  if (!flag_ok) {
     //detach...()
     return NULL;
   }
 
-return obj;
+  return obj;
 }
index 16c2ac13b56072e9370136812584a3144aa17d08..22a25214a1f8a56e90e521977808499ef749eedb 100644 (file)
@@ -5,7 +5,8 @@
 #include "jorte/4all.h"
 #include "jorte/jorte_protos_api.h"
 
-jobject createPubInfo(JNIEnv *env, const ORTEPubInfo *pinfo)
+jobject
+createPubInfo(JNIEnv *env, const ORTEPubInfo *pinfo)
 {
   jclass    cls;
   jobject   obj;
@@ -13,62 +14,55 @@ jobject createPubInfo(JNIEnv *env, const ORTEPubInfo *pinfo)
   //
   int flag_ok = 0;
 
-  do
-  {
+  do {
     // find cls
     cls = findClass(env, "org.ocera.orte.types.PubInfo");
-    if(cls == 0)
-    {
+    if (cls == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: cls = NULL \n");
+      printf(":!c: cls = NULL \n");
       #endif
       break;
     }
     // call object constructor
     mid = (*env)->GetMethodID(env, cls, "<init>", "()V");
-    if(mid == 0)
-    {
+    if (mid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: constructor failed! \n");
+      printf(":!c: constructor failed! \n");
       #endif
       break;
     }
     // create new object
     obj = (*env)->NewObject(env, cls, mid);
-    if(obj == 0)
-    {
+    if (obj == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: obj = NULL \n");
+      printf(":!c: obj = NULL \n");
       #endif
       break;
     }
 /////////////////////////////////////////////////
     // set topic
-    if(!setTopic(env,cls,obj,pinfo->topic))
-    {
+    if (!setTopic(env, cls, obj, pinfo->topic)) {
       #ifdef TEST_STAGE
-        printf(":!c: seTopic() failed! \n");
+      printf(":!c: seTopic() failed! \n");
       #endif
       break;
     }
     // set type
-    if(!setType(env,cls,obj,pinfo->type))
-    {
+    if (!setType(env, cls, obj, pinfo->type)) {
       #ifdef TEST_STAGE
-        printf(":!c: seType() failed! \n");
+      printf(":!c: seType() failed! \n");
       #endif
       break;
     }
 /////////////////////////////////////////////////
 
     flag_ok = 1;
-  } while(0);
+  } while (0);
 
-  if(!flag_ok)
-  {
+  if (!flag_ok) {
     //detach...()
     return NULL;
   }
 
-return obj;
+  return obj;
 }
index d9190042b7d1e3815f49546808b5eb88153c1d4e..634b91307fa43f12a1dd07c1123f2608d3cacc7f 100644 (file)
@@ -5,7 +5,8 @@
 #include "jorte/4all.h"
 #include "jorte/jorte_protos_api.h"
 
-jobject createSubInfo(JNIEnv *env, const ORTESubInfo *sinfo)
+jobject
+createSubInfo(JNIEnv *env, const ORTESubInfo *sinfo)
 {
   jclass    cls;
   jobject   obj;
@@ -14,62 +15,55 @@ jobject createSubInfo(JNIEnv *env, const ORTESubInfo *sinfo)
   //
   int flag_ok = 0;
 
-  do
-  {
+  do {
     // find cls
     cls = findClass(env, "org.ocera.orte.types.SubInfo");
-    if(cls == 0)
-    {
+    if (cls == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: cls = NULL \n");
+      printf(":!c: cls = NULL \n");
       #endif
       break;
     }
     // call object constructor
     mid = (*env)->GetMethodID(env, cls, "<init>", "()V");
-    if(mid == 0)
-    {
+    if (mid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: constructor failed! \n");
+      printf(":!c: constructor failed! \n");
       #endif
       break;
     }
     // create new object
     obj = (*env)->NewObject(env, cls, mid);
-    if(obj == 0)
-    {
+    if (obj == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: obj = NULL \n");
+      printf(":!c: obj = NULL \n");
       #endif
       break;
     }
 /////////////////////////////////////////////////
     // set topic
-    if(!setTopic(env,cls,obj,sinfo->topic))
-    {
+    if (!setTopic(env, cls, obj, sinfo->topic)) {
       #ifdef TEST_STAGE
-        printf(":!c: seTopic() failed! \n");
+      printf(":!c: seTopic() failed! \n");
       #endif
       break;
     }
     // set type
-    if(!setType(env,cls,obj,sinfo->type))
-    {
+    if (!setType(env, cls, obj, sinfo->type)) {
       #ifdef TEST_STAGE
-        printf(":!c: seType() failed! \n");
+      printf(":!c: seType() failed! \n");
       #endif
       break;
     }
 /////////////////////////////////////////////////
 
     flag_ok = 1;
-  } while(0);
+  } while (0);
 
-  if(!flag_ok)
-  {
+  if (!flag_ok) {
     //detach...()
     return NULL;
   }
 
-return obj;
+  return obj;
 }
index fd49c1b1436264c09275f2bc7d3e94c4526cfc74..18907e7b92af42021bc0f7f2badc9b6b1e6573b3 100644 (file)
@@ -28,7 +28,8 @@
 #include  "jorte/jorte_protos_api.h"
 
 
-NtpTime getNtpTime(JNIEnv *env, jobject obj)
+NtpTime
+getNtpTime(JNIEnv *env, jobject obj)
 {
   NtpTime          time;
   jfieldID         fieldID;
@@ -38,19 +39,19 @@ NtpTime getNtpTime(JNIEnv *env, jobject obj)
   ntpTimeClass = (*env)->GetObjectClass(env, obj);
 
   /* get object field ID - NtpTime.seconds */
-  fieldID = (*env)->GetFieldID(env,ntpTimeClass,"seconds","I");
+  fieldID = (*env)->GetFieldID(env, ntpTimeClass, "seconds", "I");
 // if(fieldID == NULL) return(NTPTIME_ZERO(time)); // NEFUNGUJE
-  /* get objects value */
-  time.seconds = (int32_t) (*env)->GetIntField(env,obj,fieldID);
+/* get objects value */
+  time.seconds = (int32_t)(*env)->GetIntField(env, obj, fieldID);
 
   /* reset pointer  */
   fieldID = NULL;
 
   /* get object field ID  - NtpTime.fraction */
-  fieldID = (*env)->GetFieldID(env,ntpTimeClass,"fraction","J");
+  fieldID = (*env)->GetFieldID(env, ntpTimeClass, "fraction", "J");
 //  if(fieldID == NULL) return(NTPTIME_ZERO(time)); // NEFUNGUJE
-  /* get object's value */
-  time.fraction = (uint32_t) (*env)->GetLongField(env,obj,fieldID);
+/* get object's value */
+  time.fraction = (uint32_t)(*env)->GetLongField(env, obj, fieldID);
 
   return(time);
 
index f7b8e484e129802156fe0474b482b4f73485d4c5..0f624e7add504cf49f53aa3822dd88d721eff756 100644 (file)
@@ -5,7 +5,9 @@ static jmethodID findClassM;
 static jmethodID findLoadedClassM;
 static jobject classLoader;
 
-JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
+JNIEXPORT jint JNICALL
+JNI_OnLoad(JavaVM *vm, void *reserved)
+{
   JNIEnv *env;
   jclass testCl;
   jclass clClass;
@@ -26,7 +28,9 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
   return JNI_VERSION_1_6;
 }
 
-JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved) {
+JNIEXPORT void JNICALL
+JNI_OnUnload(JavaVM *vm, void *reserved)
+{
   JNIEnv *env;
 
   (*vm)->GetEnv(vm, (void **)&env, JNI_VERSION_1_6);
@@ -34,7 +38,9 @@ JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved) {
   (*env)->DeleteGlobalRef(env, classLoader);
 }
 
-jclass findClass(JNIEnv *env, const char* name) {
+jclass
+findClass(JNIEnv *env, const char *name)
+{
   jclass cl;
 
   if ((cl = (*env)->CallObjectMethod(env, classLoader, findLoadedClassM, (*env)->NewStringUTF(env, name))) == NULL) {
index 2816e33b5472dbc89ab6396278c7e73ba14bed64..6acb985b36b628b8cd7dfa6c099ba4eaf40978e2 100644 (file)
@@ -6,7 +6,8 @@
 #include "jorte/4all.h"
 #include "jorte/jorte_protos_api.h"
 
-int setRecvInfo(JNIEnv *env, const ORTERecvInfo *rinfo, jobject obj)
+int
+setRecvInfo(JNIEnv *env, const ORTERecvInfo *rinfo, jobject obj)
 {
   jclass    cls;
   jclass    cls_tmp;
@@ -16,169 +17,157 @@ int setRecvInfo(JNIEnv *env, const ORTERecvInfo *rinfo, jobject obj)
   jmethodID mid;
   //
   int flag_ok = 0;
+
   #ifdef TEST_STAGE
-    int32_t sec;
-    uint32_t us;
+  int32_t sec;
+  uint32_t us;
   #endif
 
-  do
-  {
+  do {
     // find cls
     cls = findClass(env, "org.ocera.orte.types.RecvInfo");
-    if(cls == 0)
-    {
+    if (cls == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: cls = NULL \n");
+      printf(":!c: cls = NULL \n");
       #endif
       break;
     }
     // field ID - status
-    fid = (*env)->GetFieldID(env,cls,"status","B");
-    if(fid == 0)
-    {
+    fid = (*env)->GetFieldID(env, cls, "status", "B");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     #ifdef TEST_STAGE
-       printf(":c: rinfo.status = %d \n",
-              rinfo->status);
+    printf(":c: rinfo.status = %d \n",
+          rinfo->status);
     #endif
     (*env)->SetByteField(env,
-                         obj,
-                         fid,
-                         (jbyte) rinfo->status);
+                        obj,
+                        fid,
+                        (jbyte)rinfo->status);
 /////////////////////////////////////////////////
     // set topic
-    if(!setTopic(env,cls,obj,rinfo->topic))
-    {
+    if (!setTopic(env, cls, obj, rinfo->topic)) {
       #ifdef TEST_STAGE
-        printf(":!c: seTopic() failed! \n");
+      printf(":!c: seTopic() failed! \n");
       #endif
       break;
     }
     // set type
-    if(!setType(env,cls,obj,rinfo->type))
-    {
+    if (!setType(env, cls, obj, rinfo->type)) {
       #ifdef TEST_STAGE
-        printf(":!c: seType() failed! \n");
+      printf(":!c: seType() failed! \n");
       #endif
       break;
     }
 /////////////////////////////////////////////////
     // find cls - GUID_RTPS
     cls_tmp = findClass(env, "org.ocera.orte.types.GUID_RTPS");
-    if(cls_tmp == 0)
-    {
+    if (cls_tmp == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: cls_tmp = NULL \n");
+      printf(":!c: cls_tmp = NULL \n");
       #endif
       break;
     }
     // call object constructor
     mid = (*env)->GetMethodID(env,
-                              cls_tmp,
-                              "<init>",
-                              "(JJJ)V");
-    if(mid == 0)
-    {
+                             cls_tmp,
+                             "<init>",
+                             "(JJJ)V");
+    if (mid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: constructor failed! \n");
+      printf(":!c: constructor failed! \n");
       #endif
       break;
     }
     // create new object
     obj_tmp = (*env)->NewObject(env,
-                                cls_tmp,
-                                mid,
-                                (jlong)rinfo->senderGUID.hid,
-                                (jlong)rinfo->senderGUID.aid,
-                                (jlong)rinfo->senderGUID.oid);
-    if(obj_tmp == 0)
-    {
+                               cls_tmp,
+                               mid,
+                               (jlong)rinfo->senderGUID.hid,
+                               (jlong)rinfo->senderGUID.aid,
+                               (jlong)rinfo->senderGUID.oid);
+    if (obj_tmp == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: obj = NULL \n");
+      printf(":!c: obj = NULL \n");
       #endif
       break;
     }
     // set AppInfo's field
     fid = (*env)->GetFieldID(env,
-                             cls,
-                             "senderGUID",
-                             "Lorg/ocera/orte/types/GUID_RTPS;");
-    if(fid == 0)
-    {
+                            cls,
+                            "senderGUID",
+                            "Lorg/ocera/orte/types/GUID_RTPS;");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     #ifdef TEST_STAGE
-       printf(":c: rinfo.senderGUID: hid = %#"PRIx32", aid = %#"PRIx32", oid = %#"PRIx32" \n",
-              rinfo->senderGUID.hid,rinfo->senderGUID.aid,rinfo->senderGUID.oid);
+    printf(":c: rinfo.senderGUID: hid = %#" PRIx32 ", aid = %#" PRIx32 ", oid = %#" PRIx32 " \n",
+          rinfo->senderGUID.hid, rinfo->senderGUID.aid, rinfo->senderGUID.oid);
     #endif
     (*env)->SetObjectField(env,
-                           obj,
-                           fid,
-                           obj_tmp);
+                          obj,
+                          fid,
+                          obj_tmp);
 /////////////////////////////////////////////////
     // find cls - NtpTime
     cls_tmp = findClass(env, "org.ocera.orte.types.NtpTime");
-    if(cls_tmp == 0)
-    {
+    if (cls_tmp == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: cls_tmp = NULL \n");
+      printf(":!c: cls_tmp = NULL \n");
       #endif
       break;
     }
     // call object constructor
     mid = (*env)->GetMethodID(env,
-                              cls_tmp,
-                              "<init>",
-                              "(IJ)V");
-    if(mid == 0)
-    {
+                             cls_tmp,
+                             "<init>",
+                             "(IJ)V");
+    if (mid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: constructor failed! \n");
+      printf(":!c: constructor failed! \n");
       #endif
       break;
     }
     // create new object
     obj_tmp = (*env)->NewObject(env,
-                                cls_tmp,
-                                mid,
-                                (jint)rinfo->localTimeReceived.seconds,
-                                (jlong)rinfo->localTimeReceived.fraction);
-    if(obj_tmp == 0)
-    {
+                               cls_tmp,
+                               mid,
+                               (jint)rinfo->localTimeReceived.seconds,
+                               (jlong)rinfo->localTimeReceived.fraction);
+    if (obj_tmp == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: obj = NULL \n");
+      printf(":!c: obj = NULL \n");
       #endif
       break;
     }
     // set AppInfo's field
     fid = (*env)->GetFieldID(env,
-                             cls,
-                             "localTimeRecv",
-                             "Lorg/ocera/orte/types/NtpTime;");
-    if(fid == 0)
-    {
+                            cls,
+                            "localTimeRecv",
+                            "Lorg/ocera/orte/types/NtpTime;");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     #ifdef TEST_STAGE
-       NtpTimeDisAssembToUs(sec, us, rinfo->localTimeReceived);
-       printf(":c: rinfo.NtpTime: %"PRId32".%"PRIu32" (sec = %"PRId32" fract = %"PRIu32") \n",
-              sec, us,
-              rinfo->localTimeReceived.seconds,rinfo->localTimeReceived.fraction);
+    NtpTimeDisAssembToUs(sec, us, rinfo->localTimeReceived);
+    printf(":c: rinfo.NtpTime: %" PRId32 ".%" PRIu32 " (sec = %" PRId32 " fract = %" PRIu32 ") \n",
+          sec, us,
+          rinfo->localTimeReceived.seconds, rinfo->localTimeReceived.fraction);
     #endif
     (*env)->SetObjectField(env,
-                           obj,
-                           fid,
-                           obj_tmp);
+                          obj,
+                          fid,
+                          obj_tmp);
 /////////////////////////////////////////////////
     // find cls - NtpTime
 /*
@@ -205,104 +194,97 @@ int setRecvInfo(JNIEnv *env, const ORTERecvInfo *rinfo, jobject obj)
 */
     // create new object
     obj_tmp = (*env)->NewObject(env,
-                                cls_tmp,
-                                mid,
-                                (jint)rinfo->remoteTimePublished.seconds,
-                                (jlong)rinfo->remoteTimePublished.fraction);
-    if(obj_tmp == 0)
-    {
+                               cls_tmp,
+                               mid,
+                               (jint)rinfo->remoteTimePublished.seconds,
+                               (jlong)rinfo->remoteTimePublished.fraction);
+    if (obj_tmp == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: obj = NULL \n");
+      printf(":!c: obj = NULL \n");
       #endif
       break;
     }
     // set AppInfo's field
     fid = (*env)->GetFieldID(env,
-                             cls,
-                             "remoteTimePub",
-                             "Lorg/ocera/orte/types/NtpTime;");
-    if(fid == 0)
-    {
+                            cls,
+                            "remoteTimePub",
+                            "Lorg/ocera/orte/types/NtpTime;");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     #ifdef TEST_STAGE
-       NtpTimeDisAssembToUs(sec, us, rinfo->remoteTimePublished);
-       printf(":c: rinfo.remoteTimePub: %"PRId32".%"PRIu32" (sec = %"PRId32" fract = %"PRIu32") \n",
-              sec, us,
-              rinfo->remoteTimePublished.seconds,rinfo->remoteTimePublished.fraction);
+    NtpTimeDisAssembToUs(sec, us, rinfo->remoteTimePublished);
+    printf(":c: rinfo.remoteTimePub: %" PRId32 ".%" PRIu32 " (sec = %" PRId32 " fract = %" PRIu32 ") \n",
+          sec, us,
+          rinfo->remoteTimePublished.seconds, rinfo->remoteTimePublished.fraction);
     #endif
     (*env)->SetObjectField(env,
-                           obj,
-                           fid,
-                           obj_tmp);
+                          obj,
+                          fid,
+                          obj_tmp);
 /////////////////////////////////////////////////
     // find cls - SequenceNumber
-    cls_tmp = findClass(env,"org.ocera.orte.types.SequenceNumber");
-    if(cls_tmp == 0)
-    {
+    cls_tmp = findClass(env, "org.ocera.orte.types.SequenceNumber");
+    if (cls_tmp == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: cls_tmp = NULL \n");
+      printf(":!c: cls_tmp = NULL \n");
       #endif
       break;
     }
     // call object constructor
     mid = (*env)->GetMethodID(env,
-                              cls_tmp,
-                              "<init>",
-                              "(IJ)V");
-    if(mid == 0)
-    {
+                             cls_tmp,
+                             "<init>",
+                             "(IJ)V");
+    if (mid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: constructor failed! # \n");
+      printf(":!c: constructor failed! # \n");
       #endif
       break;
     }
     // create new object
     obj_tmp = (*env)->NewObject(env,
-                                cls_tmp,
-                                mid,
-                                (jint)rinfo->sn.high,
-                                (jlong)rinfo->sn.low);
-    if(obj_tmp == 0)
-    {
+                               cls_tmp,
+                               mid,
+                               (jint)rinfo->sn.high,
+                               (jlong)rinfo->sn.low);
+    if (obj_tmp == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: obj = NULL \n");
+      printf(":!c: obj = NULL \n");
       #endif
       break;
     }
     // set AppInfo's field
     fid = (*env)->GetFieldID(env,
-                             cls,
-                             "sn",
-                             "Lorg/ocera/orte/types/SequenceNumber;");
-    if(fid == 0)
-    {
+                            cls,
+                            "sn",
+                            "Lorg/ocera/orte/types/SequenceNumber;");
+    if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: fid = NULL \n");
+      printf(":!c: fid = NULL \n");
       #endif
       break;
     }
     #ifdef TEST_STAGE
-       printf(":c: rinfo.sn: %"PRId64" (high = %"PRId32" low = %"PRId32") \n",
-              (((int64_t)rinfo->sn.high << 32) + rinfo->sn.low),rinfo->sn.high,rinfo->sn.low);
+    printf(":c: rinfo.sn: %" PRId64 " (high = %" PRId32 " low = %" PRId32 ") \n",
+          (((int64_t)rinfo->sn.high << 32) + rinfo->sn.low), rinfo->sn.high, rinfo->sn.low);
     #endif
     (*env)->SetObjectField(env,
-                           obj,
-                           fid,
-                           obj_tmp);
+                          obj,
+                          fid,
+                          obj_tmp);
 /////////////////////////////////////////////////
 
     flag_ok = 1;
-  } while(0);
+  } while (0);
 
-  if(!flag_ok)
-  {
+  if (!flag_ok) {
     //detach...()
     return 0;
   }
 
-return 1;
+  return 1;
 }
index 455d58b1370eedba0b9d685e12588ba0a062be76..3e36e9a977ab89cfba942cb2e416fde51878f1f9 100644 (file)
@@ -4,38 +4,37 @@
 #include "jorte/4all.h"
 #include "jorte/jorte_protos_api.h"
 
-int setTopic(JNIEnv *env, jclass cls, jobject obj, const char *topic)
+int
+setTopic(JNIEnv *env, jclass cls, jobject obj, const char *topic)
 {
-    jfieldID  fid;
-    jstring   jstr;
+  jfieldID  fid;
+  jstring   jstr;
 
-    // field ID - topic
-    fid = (*env)->GetFieldID(env,
-                             cls,
-                             "topic",
-                             "Ljava/lang/String;");
-    if(fid == 0)
-    {
+  // field ID - topic
+  fid = (*env)->GetFieldID(env,
+                          cls,
+                          "topic",
+                          "Ljava/lang/String;");
+  if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: topic - fid = NULL \n");
+    printf(":!c: topic - fid = NULL \n");
       #endif
-      return 0;
-    }
+    return 0;
+  }
     #ifdef TEST_STAGE
-       printf(":c: topic = %s \n",topic);
+  printf(":c: topic = %s \n", topic);
     #endif
-   // create a new string
-   jstr = (*env)->NewStringUTF(env, topic);
-   if (jstr == 0)
-   {
+  // create a new string
+  jstr = (*env)->NewStringUTF(env, topic);
+  if (jstr == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: topic - fid = NULL \n");
+    printf(":!c: topic - fid = NULL \n");
      #endif
-     return 0;
-   }
-   // set field
-   (*env)->SetObjectField(env, obj, fid, jstr);
+    return 0;
+  }
+  // set field
+  (*env)->SetObjectField(env, obj, fid, jstr);
 
-   return 1;
+  return 1;
 
 }
index 436f0e8eb8fea8d0cd31246fe2166f812de24352..b433ee521eec51d62d3105406c4719d970bfb878 100644 (file)
@@ -4,38 +4,37 @@
 #include "jorte/4all.h"
 #include "jorte/jorte_protos_api.h"
 
-int setType(JNIEnv *env, jclass cls, jobject obj, const char *typeName)
+int
+setType(JNIEnv *env, jclass cls, jobject obj, const char *typeName)
 {
-    jfieldID  fid;
-    jstring   jstr;
+  jfieldID  fid;
+  jstring   jstr;
 
-    // field ID - type
-    fid = (*env)->GetFieldID(env,
-                             cls,
-                             "typeName",
-                             "Ljava/lang/String;");
-    if(fid == 0)
-    {
+  // field ID - type
+  fid = (*env)->GetFieldID(env,
+                          cls,
+                          "typeName",
+                          "Ljava/lang/String;");
+  if (fid == 0) {
       #ifdef TEST_STAGE
-        printf(":!c: type - fid = NULL \n");
+    printf(":!c: type - fid = NULL \n");
       #endif
-      return 0;
-    }
+    return 0;
+  }
     #ifdef TEST_STAGE
-       printf(":c: type = %s \n",typeName);
+  printf(":c: type = %s \n", typeName);
     #endif
-   // create a new string
-   jstr = (*env)->NewStringUTF(env,typeName);
-   if (jstr == 0)
-   {
+  // create a new string
+  jstr = (*env)->NewStringUTF(env, typeName);
+  if (jstr == 0) {
      #ifdef TEST_STAGE
-       printf(":!c: type - fid = NULL \n");
+    printf(":!c: type - fid = NULL \n");
      #endif
-     return 0;
-   }
-   // set field
-   (*env)->SetObjectField(env, obj, fid, jstr);
+    return 0;
+  }
+  // set field
+  (*env)->SetObjectField(env, obj, fid, jstr);
 
-   return 1;
+  return 1;
 
 }
index 72420f47aa161259157fda712930577625bc9691..14420941575a03687bb073742a40478e726faab4 100644 (file)
 /*
- *  $Id: ORTEAppRecvThread.c,v 0.0.0.1  2005/01/3 
+ *  $Id: ORTEAppRecvThread.c,v 0.0.0.1  2005/01/3
  *
  *  DEBUG:  section 22                  Receiving thread
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
+ *
 
- */ 
+ */
 
 #include "orte_all.h"
 
 /* ThreadKind to String */
-char* TK2S(TaskProp *tp) 
+char *
+TK2S(TaskProp *tp)
 {
-  ORTEDomain           *d=tp->d;
+  ORTEDomain            *d = tp->d;
 
-  if (tp==&d->taskRecvUnicastMetatraffic) 
+  if (tp == &d->taskRecvUnicastMetatraffic)
     return "UM";
 
-  if (tp==&d->taskRecvMulticastMetatraffic) 
+  if (tp == &d->taskRecvMulticastMetatraffic)
     return "MM";
 
-  if (tp==&d->taskRecvUnicastUserdata) 
+  if (tp == &d->taskRecvUnicastUserdata)
     return "UU";
 
-  if (tp==&d->taskRecvMulticastUserdata) 
+  if (tp == &d->taskRecvMulticastUserdata)
     return "MU";
 
   return "";
 }
 
 /*****************************************************************************/
-void ORTEAppRecvThread(TaskProp *tp) {
+void
+ORTEAppRecvThread(TaskProp *tp)
+{
   struct sockaddr_in    des;
-  int32_t              RTPS_Codec_len;
-  MessageInterpret      mi; 
-  CDR_Codec            *cdrCodec=&tp->mb.cdrCodec;
-  ORTEDomain           *d=tp->d;
-  unsigned int         rptr;
+  int32_t               RTPS_Codec_len;
+  MessageInterpret      mi;
+  CDR_Codec             *cdrCodec = &tp->mb.cdrCodec;
+  ORTEDomain            *d = tp->d;
+  unsigned int          rptr;
 
-  debug(22,10) ("ORTEAppRecvThread %s: start\n",TK2S(tp));
+  debug(22, 10) ("ORTEAppRecvThread %s: start\n", TK2S(tp));
 
   while (!tp->terminate) {
-    debug(22,7) ("ORTEAppRecvThread %s: receiving\n",TK2S(tp));
-    
+    debug(22, 7) ("ORTEAppRecvThread %s: receiving\n", TK2S(tp));
+
     //prepare cdrCodec
-    cdrCodec->wptr=cdrCodec->rptr=0;
+    cdrCodec->wptr = cdrCodec->rptr = 0;
     RTPS_Codec_len = sock_recvfrom(
-                  &tp->sock,                    //socked handle
-                  cdrCodec->buffer,             //buffer
-                  cdrCodec->buf_len,            //max length of message
-                  &des,sizeof(des));             //info from sending host
+      &tp->sock,                                 //socked handle
+      cdrCodec->buffer,                         //buffer
+      cdrCodec->buf_len,                        //max length of message
+      &des, sizeof(des));                        //info from sending host
 
     if (RTPS_Codec_len == -1) {
-           perror("ORTEAppRecvThread: sock_recvfrom");
-           return;
+      perror("ORTEAppRecvThread: sock_recvfrom");
+      return;
     }
 
-    debug(22,7) ("ORTEAppRecvThread %s: fired, msg_len: 0x%x\n",TK2S(tp),RTPS_Codec_len);
+    debug(22, 7) ("ORTEAppRecvThread %s: fired, msg_len: 0x%x\n", TK2S(tp), RTPS_Codec_len);
 
     //is it header of valid RTPS packet?
-    if (RTPSHeaderCheck(cdrCodec,RTPS_Codec_len,&mi)<0) {
-      debug(22,2) ("ORTEAppRecvThread: not valid RTPS header!\n");
+    if (RTPSHeaderCheck(cdrCodec, RTPS_Codec_len, &mi) < 0) {
+      debug(22, 2) ("ORTEAppRecvThread: not valid RTPS header!\n");
       continue;
-    } 
+    }
 
-    debug(22,7) ("ORTEAppRecvThread: RTPS Heard OK\n");
-    debug(22,7) ("  PV: %d.%d VID:%d.%d HID:0x%x AID:0x%x\n",
-                    mi.sourceVersion.major,mi.sourceVersion.minor,
-                   mi.sourceVendorId.major,mi.sourceVendorId.minor,
-                   mi.sourceHostId,mi.sourceAppId);
+    debug(22, 7) ("ORTEAppRecvThread: RTPS Heard OK\n");
+    debug(22, 7) ("  PV: %d.%d VID:%d.%d HID:0x%x AID:0x%x\n",
+                 mi.sourceVersion.major, mi.sourceVersion.minor,
+                 mi.sourceVendorId.major, mi.sourceVendorId.minor,
+                 mi.sourceHostId, mi.sourceAppId);
     do {
       // check if length of submessage header is OK
-      if ((cdrCodec->rptr+3)<=RTPS_Codec_len) {
-        CORBA_char flags,sub_id;
+      if ((cdrCodec->rptr+3) <= RTPS_Codec_len) {
+       CORBA_char flags, sub_id;
        CORBA_unsigned_short sub_len;
 
        CDR_get_octet(cdrCodec, (CORBA_octet *)&sub_id);
        CDR_get_octet(cdrCodec, (CORBA_octet *)&flags);
-       if (flags & 0x01)         
-           cdrCodec->data_endian=FLAG_LITTLE_ENDIAN;
-        else
-           cdrCodec->data_endian=FLAG_BIG_ENDIAN;
-       CDR_get_ushort(cdrCodec,&sub_len);
+       if (flags & 0x01)
+         cdrCodec->data_endian = FLAG_LITTLE_ENDIAN;
+       else
+         cdrCodec->data_endian = FLAG_BIG_ENDIAN;
+       CDR_get_ushort(cdrCodec, &sub_len);
 
-        debug(22,7) ("ORTEAppRecvThread %s: sub_id: 0x%x, sub_len 0x%x: %u\n",
-                      TK2S(tp),sub_id,sub_len);
+       debug(22, 7) ("ORTEAppRecvThread %s: sub_id: 0x%x, sub_len 0x%x: %u\n",
+                     TK2S(tp), sub_id, sub_len);
 
        // check if length of submessage OK
-       if ((sub_len+cdrCodec->rptr)<=RTPS_Codec_len) {
-          pthread_rwlock_wrlock(&d->objectEntry.objRootLock);    
-          pthread_rwlock_wrlock(&d->objectEntry.htimRootLock);
-         rptr=cdrCodec->rptr;
-          switch ((SubmessageId)sub_id) {
-            case VAR:
-              RTPSVar(d,cdrCodec,&mi,ntohl(des.sin_addr.s_addr));
-            break;
-            case ACK:
-              RTPSAck(d,cdrCodec,&mi,ntohl(des.sin_addr.s_addr));
-            break;
-            case HEARTBEAT:
-              RTPSHeartBeat(d,cdrCodec,&mi);
-            break;
-            case GAP:
-              RTPSGap(d,cdrCodec,&mi,ntohl(des.sin_addr.s_addr));
-            break;
-            case INFO_TS:
-              RTPSInfoTS(cdrCodec,&mi);
-            break;
-            case INFO_SRC:
-              RTPSInfoSRC(cdrCodec,&mi);
-            break;
-            case INFO_REPLY:
-              RTPSInfoREPLY(cdrCodec,&mi);
-            break;
-            case INFO_DST:
-              RTPSInfoDST(cdrCodec,&mi);
-            break;
-            case PAD:
-              RTPSPad(cdrCodec,&mi);
-            break;
-            case ISSUE:
-              RTPSIssue(d,cdrCodec,&mi,ntohl(des.sin_addr.s_addr));
-            break;
-            default:
-              debug(22,5) ("ORTEAppRecvThread: unknown message :0x%x\n",sub_id);
-            break;
-          }  
-         cdrCodec->rptr=rptr+sub_len;
-          pthread_rwlock_unlock(&d->objectEntry.htimRootLock);
-          pthread_rwlock_unlock(&d->objectEntry.objRootLock);    
-        } else break;          /* submessage is too big */
-      } else break;            /* submessage is too big */
-    } while (cdrCodec->rptr<RTPS_Codec_len);
-    debug(22,7) ("ORTEAppRecvThread: processing of message(s) finnished\n");
-  } 
-
-  debug(22,10) ("ORTEAppRecvThread %s: finished\n",TK2S(tp));
+       if ((sub_len+cdrCodec->rptr) <= RTPS_Codec_len) {
+         pthread_rwlock_wrlock(&d->objectEntry.objRootLock);
+         pthread_rwlock_wrlock(&d->objectEntry.htimRootLock);
+         rptr = cdrCodec->rptr;
+         switch ((SubmessageId)sub_id) {
+           case VAR:
+             RTPSVar(d, cdrCodec, &mi, ntohl(des.sin_addr.s_addr));
+             break;
+           case ACK:
+             RTPSAck(d, cdrCodec, &mi, ntohl(des.sin_addr.s_addr));
+             break;
+           case HEARTBEAT:
+             RTPSHeartBeat(d, cdrCodec, &mi);
+             break;
+           case GAP:
+             RTPSGap(d, cdrCodec, &mi, ntohl(des.sin_addr.s_addr));
+             break;
+           case INFO_TS:
+             RTPSInfoTS(cdrCodec, &mi);
+             break;
+           case INFO_SRC:
+             RTPSInfoSRC(cdrCodec, &mi);
+             break;
+           case INFO_REPLY:
+             RTPSInfoREPLY(cdrCodec, &mi);
+             break;
+           case INFO_DST:
+             RTPSInfoDST(cdrCodec, &mi);
+             break;
+           case PAD:
+             RTPSPad(cdrCodec, &mi);
+             break;
+           case ISSUE:
+             RTPSIssue(d, cdrCodec, &mi, ntohl(des.sin_addr.s_addr));
+             break;
+           default:
+             debug(22, 5) ("ORTEAppRecvThread: unknown message :0x%x\n", sub_id);
+             break;
+         }
+         cdrCodec->rptr = rptr+sub_len;
+         pthread_rwlock_unlock(&d->objectEntry.htimRootLock);
+         pthread_rwlock_unlock(&d->objectEntry.objRootLock);
+       } else
+         break;               /* submessage is too big */
+      } else
+       break;                 /* submessage is too big */
+    } while (cdrCodec->rptr < RTPS_Codec_len);
+    debug(22, 7) ("ORTEAppRecvThread: processing of message(s) finnished\n");
+  }
+
+  debug(22, 10) ("ORTEAppRecvThread %s: finished\n", TK2S(tp));
   pthread_exit(NULL);
 }
index 61389ae6b5ae69c243aac35c16be89e4eb952e0e..707ef0de4a37fb94dffe09e401860d28d16684d3 100644 (file)
 /*
- *  $Id: ORTEAppSendThread.c,v 0.0.0.1  2003/08/21 
+ *  $Id: ORTEAppSendThread.c,v 0.0.0.1  2003/08/21
  *
  *  DEBUG:  section 24                  Sending thread
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
 /*****************************************************************************/
-void ORTESendData(ORTEDomain *d,ObjectEntryAID *objectEntryAID,Boolean meta) {
-  struct sockaddr_in  des; 
+void
+ORTESendData(ORTEDomain *d, ObjectEntryAID *objectEntryAID, Boolean meta)
+{
+  struct sockaddr_in  des;
   ObjectEntryOID      *object;
   AppParams           *appParams;
   int                 i;
-  CDR_Codec          *cdrCodec=&d->taskSend.mb.cdrCodec;
-  Port               port;
+  CDR_Codec           *cdrCodec = &d->taskSend.mb.cdrCodec;
+  Port                port;
 
-  object=objectEntryAID->aobject;
+  object = objectEntryAID->aobject;
   if (object) {
-    appParams=(AppParams*)object->attributes;
+    appParams = (AppParams *)object->attributes;
     if (!ObjectEntryMulticast_is_empty(object)) {
-      for(i=0;i<appParams->metatrafficMulticastIPAddressCount;i++) {
-        des.sin_family=AF_INET; 
-        des.sin_addr.s_addr = htonl(appParams->metatrafficMulticastIPAddressList[i]);
-        des.sin_port = htons((uint16_t)object->multicastPort); 
-        if (d->taskSend.mb.cdrCodecDirect) {
-          sock_sendto (&d->taskSend.sock,
-                       d->taskSend.mb.cdrCodecDirect->buffer,
-                       d->taskSend.mb.cdrCodecDirect->wptr,
-                       &des,
-                       sizeof(des)); 
-        } else {
-          sock_sendto (&d->taskSend.sock,
-                      cdrCodec->buffer,
-                       cdrCodec->wptr,
-                       &des,
-                       sizeof(des)); 
-        }
+      for (i = 0; i < appParams->metatrafficMulticastIPAddressCount; i++) {
+       des.sin_family = AF_INET;
+       des.sin_addr.s_addr = htonl(appParams->metatrafficMulticastIPAddressList[i]);
+       des.sin_port = htons((uint16_t)object->multicastPort);
+       if (d->taskSend.mb.cdrCodecDirect) {
+         sock_sendto(&d->taskSend.sock,
+                     d->taskSend.mb.cdrCodecDirect->buffer,
+                     d->taskSend.mb.cdrCodecDirect->wptr,
+                     &des,
+                     sizeof(des));
+       } else {
+         sock_sendto(&d->taskSend.sock,
+                     cdrCodec->buffer,
+                     cdrCodec->wptr,
+                     &des,
+                     sizeof(des));
+       }
       }
     } else {
-      for(i=0;i<appParams->unicastIPAddressCount;i++) {
-        des.sin_family=AF_INET; 
-        des.sin_addr.s_addr = htonl(appParams->unicastIPAddressList[i]);
-        if (meta) {
-         port=appParams->metatrafficUnicastPort;
-        } else {
-          port=appParams->userdataUnicastPort; 
-        }
-        des.sin_port = htons((uint16_t)port); 
-        if (d->taskSend.mb.cdrCodecDirect) {
-          sock_sendto (&d->taskSend.sock,
-                       d->taskSend.mb.cdrCodecDirect->buffer,
-                       d->taskSend.mb.cdrCodecDirect->wptr,
-                       &des,
-                       sizeof(des)); 
-        } else {
-          sock_sendto (&d->taskSend.sock,
-                      cdrCodec->buffer,
-                       cdrCodec->wptr,
-                       &des,
-                       sizeof(des)); 
-        }
+      for (i = 0; i < appParams->unicastIPAddressCount; i++) {
+       des.sin_family = AF_INET;
+       des.sin_addr.s_addr = htonl(appParams->unicastIPAddressList[i]);
+       if (meta) {
+         port = appParams->metatrafficUnicastPort;
+       } else {
+         port = appParams->userdataUnicastPort;
+       }
+       des.sin_port = htons((uint16_t)port);
+       if (d->taskSend.mb.cdrCodecDirect) {
+         sock_sendto(&d->taskSend.sock,
+                     d->taskSend.mb.cdrCodecDirect->buffer,
+                     d->taskSend.mb.cdrCodecDirect->wptr,
+                     &des,
+                     sizeof(des));
+       } else {
+         sock_sendto(&d->taskSend.sock,
+                     cdrCodec->buffer,
+                     cdrCodec->wptr,
+                     &des,
+                     sizeof(des));
+       }
       }
     }
   } else {
-    debug(24,1) ("ORTEAppSendThread: no aobjectEntryOID connected to objectEntryAID!\n");
+    debug(24, 1) ("ORTEAppSendThread: no aobjectEntryOID connected to objectEntryAID!\n");
   }
   //prepare buffer for next sending
-  cdrCodec->wptr=RTPS_HEADER_LENGTH;
-  d->taskSend.mb.needSend=ORTE_FALSE;
-  d->taskSend.mb.containsInfoReply=ORTE_FALSE;
-  d->taskSend.mb.cdrCodecDirect=NULL;
+  cdrCodec->wptr = RTPS_HEADER_LENGTH;
+  d->taskSend.mb.needSend = ORTE_FALSE;
+  d->taskSend.mb.containsInfoReply = ORTE_FALSE;
+  d->taskSend.mb.cdrCodecDirect = NULL;
 }
 
 /*****************************************************************************/
-void ORTEAppSendThread(TaskProp *tp) {
-  struct timespec     wtime; 
-  NtpTime             actTime,nextExpire,whenExpire,sleepingTime;
-  int32_t             s,ms;
-  ORTEDomain          *d=tp->d;
+void
+ORTEAppSendThread(TaskProp *tp)
+{
+  struct timespec     wtime;
+  NtpTime             actTime, nextExpire, whenExpire, sleepingTime;
+  int32_t             s, ms;
+  ORTEDomain          *d = tp->d;
 
-  debug(24,10) ("ORTEAppSendThread: start\n");
-  d->objectEntry.htimNeedWakeUp=ORTE_TRUE;
+  debug(24, 10) ("ORTEAppSendThread: start\n");
+  d->objectEntry.htimNeedWakeUp = ORTE_TRUE;
 
   while (!tp->terminate) {
-    actTime=getActualNtpTime();
+    actTime = getActualNtpTime();
 
     pthread_rwlock_wrlock(&d->objectEntry.htimRootLock);
-    if (htimerRoot_next_expire(&d->objectEntry,&nextExpire)==0) {
-      NTPTIME_BUILD(whenExpire,300); //max time for sleeping (no. events)
-      NtpTimeAdd(nextExpire,actTime,whenExpire);
+    if (htimerRoot_next_expire(&d->objectEntry, &nextExpire) == 0) {
+      NTPTIME_BUILD(whenExpire, 300); //max time for sleeping (no. events)
+      NtpTimeAdd(nextExpire, actTime, whenExpire);
     }
     pthread_rwlock_unlock(&d->objectEntry.htimRootLock);
-    NtpTimeDisAssembToUs(wtime.tv_sec,wtime.tv_nsec,nextExpire);
-    wtime.tv_nsec*=1000;  //conver to nano seconds
-    NtpTimeSub(sleepingTime,nextExpire,actTime);
-    NtpTimeDisAssembToMs(s,ms,sleepingTime);
-    if (s<0) s=ms=0;
+    NtpTimeDisAssembToUs(wtime.tv_sec, wtime.tv_nsec, nextExpire);
+    wtime.tv_nsec *= 1000;  //conver to nano seconds
+    NtpTimeSub(sleepingTime, nextExpire, actTime);
+    NtpTimeDisAssembToMs(s, ms, sleepingTime);
+    if (s < 0)
+      s = ms = 0;
 
-    debug(24,4) ("ORTEAppSendThread: sleeping for %lis %lims\n",s,ms);
-    if (!((wtime.tv_sec==0) && (wtime.tv_nsec==0))) {
+    debug(24, 4) ("ORTEAppSendThread: sleeping for %lis %lims\n", s, ms);
+    if (!((wtime.tv_sec == 0) && (wtime.tv_nsec == 0))) {
       pthread_mutex_lock(&d->objectEntry.htimSendMutex);
-      if (d->objectEntry.htimSendCondValue==0) {
-        pthread_cond_timedwait(&d->objectEntry.htimSendCond,
-                              &d->objectEntry.htimSendMutex,
+      if (d->objectEntry.htimSendCondValue == 0) {
+       pthread_cond_timedwait(&d->objectEntry.htimSendCond,
+                              &d->objectEntry.htimSendMutex,
                               &wtime);
       }
-      d->objectEntry.htimSendCondValue=0;
+      d->objectEntry.htimSendCondValue = 0;
       pthread_mutex_unlock(&d->objectEntry.htimSendMutex);
     }
 
-    debug(24,7) ("ORTEAppSendThread: fired\n");
-    actTime=getActualNtpTime();
+    debug(24, 7) ("ORTEAppSendThread: fired\n");
+    actTime = getActualNtpTime();
     pthread_rwlock_wrlock(&d->objectEntry.objRootLock);
     pthread_rwlock_wrlock(&d->objectEntry.htimRootLock);
-    d->objectEntry.htimNeedWakeUp=ORTE_FALSE;
+    d->objectEntry.htimNeedWakeUp = ORTE_FALSE;
 
-    htimerRoot_run_expired(d,&actTime);
+    htimerRoot_run_expired(d, &actTime);
 
-    d->objectEntry.htimNeedWakeUp=ORTE_TRUE;
+    d->objectEntry.htimNeedWakeUp = ORTE_TRUE;
     pthread_rwlock_unlock(&d->objectEntry.htimRootLock);
     pthread_rwlock_unlock(&d->objectEntry.objRootLock);
   }
-  debug(24,10) ("ORTEAppSendThread: finished\n");
+  debug(24, 10) ("ORTEAppSendThread: finished\n");
   pthread_exit(NULL);
 }
-
index 0ad73e1d02bbfcb794c53fcb14ec2577ce907429..533cc738797652bb7993ff9477b38a43141af4d8 100644 (file)
  *
  *  DEBUG:  section 30                  Domain functions
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
 /*****************************************************************************/
 void
-ORTEDomainRecvThreadStart(TaskProp *tp) 
+ORTEDomainRecvThreadStart(TaskProp *tp)
 {
   if (tp->terminate) {
-    tp->terminate=ORTE_FALSE;
+    tp->terminate = ORTE_FALSE;
     pthread_create(&(tp->thread), NULL,
-                  (void*)&ORTEAppRecvThread, (void *)tp); 
+                  (void *)&ORTEAppRecvThread, (void *)tp);
   }
 }
 
 /*****************************************************************************/
 void
-ORTEDomainSendThreadStart(TaskProp *tp) 
+ORTEDomainSendThreadStart(TaskProp *tp)
 {
   if (tp->terminate) {
-    tp->terminate=ORTE_FALSE;
+    tp->terminate = ORTE_FALSE;
     pthread_create(&(tp->thread), NULL,
-                  (void*)&ORTEAppSendThread, (void *)tp); 
+                  (void *)&ORTEAppSendThread, (void *)tp);
   }
 }
 
 /*****************************************************************************/
 void
-ORTEDomainRecvThreadStop(TaskProp *tp) 
+ORTEDomainRecvThreadStop(TaskProp *tp)
 {
-  ORTEDomain *d=tp->d;
+  ORTEDomain *d = tp->d;
 
   if (!tp->terminate) {
-    tp->terminate=ORTE_TRUE;
+    tp->terminate = ORTE_TRUE;
     ORTEDomainWakeUpReceivingThread(d,
-        &d->taskSend.sock,tp->sock.port); 
-    pthread_join(tp->thread,NULL); 
+                                   &d->taskSend.sock, tp->sock.port);
+    pthread_join(tp->thread, NULL);
   }
 }
 
 /*****************************************************************************/
 void
-ORTEDomainSendThreadStop(TaskProp *tp) 
+ORTEDomainSendThreadStop(TaskProp *tp)
 {
-  ORTEDomain *d=tp->d;
+  ORTEDomain *d = tp->d;
 
   if (!tp->terminate) {
-    tp->terminate=ORTE_TRUE;
-    ORTEDomainWakeUpSendingThread(&d->objectEntry); 
-    pthread_join(tp->thread,NULL); 
+    tp->terminate = ORTE_TRUE;
+    ORTEDomainWakeUpSendingThread(&d->objectEntry);
+    pthread_join(tp->thread, NULL);
   }
 }
 
 /*****************************************************************************/
 void
 ORTEDomainStart(ORTEDomain *d,
-    Boolean recvUnicastMetatrafficThread,
-    Boolean recvMulticastMetatrafficThread,
-    Boolean recvUnicastUserdataThread,
-    Boolean recvMulticastUserdataThread,
-    Boolean sendThread) {
+               Boolean recvUnicastMetatrafficThread,
+               Boolean recvMulticastMetatrafficThread,
+               Boolean recvUnicastUserdataThread,
+               Boolean recvMulticastUserdataThread,
+               Boolean sendThread)
+{
 
-  if(!d) return;
+  if (!d)
+    return;
 
-  if (recvUnicastMetatrafficThread) 
+  if (recvUnicastMetatrafficThread)
     ORTEDomainRecvThreadStart(&d->taskRecvUnicastMetatraffic);
 
-  if (recvMulticastMetatrafficThread) 
+  if (recvMulticastMetatrafficThread)
     ORTEDomainRecvThreadStart(&d->taskRecvMulticastMetatraffic);
 
-  if (recvUnicastUserdataThread) 
+  if (recvUnicastUserdataThread)
     ORTEDomainRecvThreadStart(&d->taskRecvUnicastUserdata);
 
-  if (recvMulticastUserdataThread) 
+  if (recvMulticastUserdataThread)
     ORTEDomainRecvThreadStart(&d->taskRecvMulticastUserdata);
 
-  if (sendThread) 
+  if (sendThread)
     ORTEDomainSendThreadStart(&d->taskSend);
 }
 
 /*****************************************************************************/
 Boolean
-ORTEDomainPropDefaultGet(ORTEDomainProp *prop) {
+ORTEDomainPropDefaultGet(ORTEDomainProp *prop)
+{
   sock_t        sock;
 
   memset(prop, 0, sizeof(*prop));
 
-  prop->multicast.enabled=ORTE_FALSE;
-  prop->multicast.ttl=1;
-  prop->multicast.loopBackEnabled=ORTE_TRUE;
+  prop->multicast.enabled = ORTE_FALSE;
+  prop->multicast.ttl = 1;
+  prop->multicast.loopBackEnabled = ORTE_TRUE;
 
   //IFProp
   sock_init_udp(&sock);
-  if (sock_bind(&sock,0,INADDR_ANY) == -1) {
+  if (sock_bind(&sock, 0, INADDR_ANY) == -1) {
     return ORTE_FALSE;
   }
-  sock_get_local_interfaces(&sock,prop->IFProp, (char *)&prop->IFCount);
-  sock_cleanup(&sock); 
-
-  prop->mgrs=NULL; //only from localhost
-  prop->appLocalManager=StringToIPAddress("127.0.0.1");
-  prop->listen=INADDR_ANY;
-  prop->keys=NULL; //are assign be orte
-  sprintf(prop->version,ORTE_PACKAGE_STRING\
-                        ", compiled: "\
-                        __DATE__\
-                        " "\
-                        __TIME__);
-                        
-  prop->recvBuffSize=0x4000;
-  prop->sendBuffSize=0x4000; 
-  prop->wireProp.metaBytesPerPacket=1500;
-  prop->wireProp.metaBytesPerFastPacket=1000; //not used
-  prop->wireProp.metabitsPerACKBitmap=32;     //not used
-  prop->wireProp.userBytesPerPacket=0x3000;
-  
+  sock_get_local_interfaces(&sock, prop->IFProp, (char *)&prop->IFCount);
+  sock_cleanup(&sock);
+
+  prop->mgrs = NULL; //only from localhost
+  prop->appLocalManager = StringToIPAddress("127.0.0.1");
+  prop->listen = INADDR_ANY;
+  prop->keys = NULL; //are assign be orte
+  sprintf(prop->version, ORTE_PACKAGE_STRING \
+         ", compiled: " \
+         __DATE__ \
+         " " \
+         __TIME__);
+
+  prop->recvBuffSize = 0x4000;
+  prop->sendBuffSize = 0x4000;
+  prop->wireProp.metaBytesPerPacket = 1500;
+  prop->wireProp.metaBytesPerFastPacket = 1000; //not used
+  prop->wireProp.metabitsPerACKBitmap = 32;     //not used
+  prop->wireProp.userBytesPerPacket = 0x3000;
+
   //domainBaseProp
-  prop->baseProp.registrationMgrRetries=0;
-  NTPTIME_BUILD(prop->baseProp.registrationMgrPeriod,0);//0s
-  prop->baseProp.registrationAppRetries=3;
-  NtpTimeAssembFromMs(prop->baseProp.registrationAppPeriod,0,500);//500ms
-  NTPTIME_BUILD(prop->baseProp.expirationTime,180);  //180s
-  NTPTIME_BUILD(prop->baseProp.refreshPeriod,72);    //72s - refresh self parameters
-  NTPTIME_BUILD(prop->baseProp.purgeTime,60);        //60s - purge time of parameters
-  NTPTIME_BUILD(prop->baseProp.repeatAnnounceTime,72);//72s - announcement by HB
-  NTPTIME_BUILD(prop->baseProp.repeatActiveQueryTime,72);//72s - announcement by ACK
-  NtpTimeAssembFromMs(prop->baseProp.delayResponceTimeACKMin,0,10);//10ms - delay before send ACK
-  NtpTimeAssembFromMs(prop->baseProp.delayResponceTimeACKMax,1,0);//1s
-  NtpTimeAssembFromMs(prop->baseProp.maxBlockTime,20,0);//20s
-  prop->baseProp.ACKMaxRetries=10;
-  prop->baseProp.HBMaxRetries=10;
-  
+  prop->baseProp.registrationMgrRetries = 0;
+  NTPTIME_BUILD(prop->baseProp.registrationMgrPeriod, 0); //0s
+  prop->baseProp.registrationAppRetries = 3;
+  NtpTimeAssembFromMs(prop->baseProp.registrationAppPeriod, 0, 500); //500ms
+  NTPTIME_BUILD(prop->baseProp.expirationTime, 180);  //180s
+  NTPTIME_BUILD(prop->baseProp.refreshPeriod, 72);    //72s - refresh self parameters
+  NTPTIME_BUILD(prop->baseProp.purgeTime, 60);        //60s - purge time of parameters
+  NTPTIME_BUILD(prop->baseProp.repeatAnnounceTime, 72); //72s - announcement by HB
+  NTPTIME_BUILD(prop->baseProp.repeatActiveQueryTime, 72); //72s - announcement by ACK
+  NtpTimeAssembFromMs(prop->baseProp.delayResponceTimeACKMin, 0, 10); //10ms - delay before send ACK
+  NtpTimeAssembFromMs(prop->baseProp.delayResponceTimeACKMax, 1, 0); //1s
+  NtpTimeAssembFromMs(prop->baseProp.maxBlockTime, 20, 0); //20s
+  prop->baseProp.ACKMaxRetries = 10;
+  prop->baseProp.HBMaxRetries = 10;
+
   PublParamsInit(&prop->publPropDefault);
   SubsParamsInit(&prop->subsPropDefault);
-  
+
   return ORTE_TRUE;
 }
 
 /*****************************************************************************/
 Boolean
-ORTEDomainInitEvents(ORTEDomainAppEvents *events) {
-  memset(events,0,sizeof(ORTEDomainAppEvents));
+ORTEDomainInitEvents(ORTEDomainAppEvents *events)
+{
+  memset(events, 0, sizeof(ORTEDomainAppEvents));
   return ORTE_TRUE;
 }
 
 
 /*****************************************************************************/
-ORTEDomain * 
+ORTEDomain *
 ORTEDomainCreate(int domain, ORTEDomainProp *prop,
-               ORTEDomainAppEvents *events,Boolean manager) {
+                ORTEDomainAppEvents *events, Boolean manager)
+{
   ORTEDomain        *d;
   ObjectEntryOID    *objectEntryOID;
   AppParams         *appParams;
@@ -186,87 +191,88 @@ ORTEDomainCreate(int domain, ORTEDomainProp *prop,
   char              sIPAddress[MAX_STRING_IPADDRESS_LENGTH];
   char              sbuff[128];
   int               i;
-  uint16_t          port=0;
-  int              errno_save = 0;
+  uint16_t          port = 0;
+  int               errno_save = 0;
 
-  debug(30,2)  ("ORTEDomainCreate: %s compiled: %s,%s\n",
-                ORTE_PACKAGE_STRING,__DATE__,__TIME__);
+  debug(30, 2)  ("ORTEDomainCreate: %s compiled: %s,%s\n",
+                ORTE_PACKAGE_STRING, __DATE__, __TIME__);
 
-  debug(30,10) ("ORTEDomainCreate: start\n");
+  debug(30, 10) ("ORTEDomainCreate: start\n");
   //Create domainApplication
-  d=MALLOC(sizeof(ORTEDomain));
-  if (!d) return NULL;  //no memory
+  d = MALLOC(sizeof(ORTEDomain));
+  if (!d)
+    return NULL;        //no memory
   //initialization local values
-  d->domain=domain;
-  d->taskRecvUnicastMetatraffic.d=d;
-  d->taskRecvUnicastMetatraffic.terminate=ORTE_TRUE;
-  d->taskRecvMulticastMetatraffic.d=d;
-  d->taskRecvMulticastMetatraffic.terminate=ORTE_TRUE;
-  d->taskRecvUnicastUserdata.d=d;
-  d->taskRecvUnicastUserdata.terminate=ORTE_TRUE;
-  d->taskRecvMulticastUserdata.d=d;
-  d->taskRecvMulticastUserdata.terminate=ORTE_TRUE;
-  d->taskSend.d=d;
-  d->taskSend.terminate=ORTE_TRUE;
-  d->taskRecvUnicastMetatraffic.sock.port=0;
-  d->taskRecvMulticastMetatraffic.sock.port=0;
-  d->taskRecvUnicastUserdata.sock.port=0;
-  d->taskRecvMulticastUserdata.sock.port=0;
-  d->taskSend.sock.port=0;
+  d->domain = domain;
+  d->taskRecvUnicastMetatraffic.d = d;
+  d->taskRecvUnicastMetatraffic.terminate = ORTE_TRUE;
+  d->taskRecvMulticastMetatraffic.d = d;
+  d->taskRecvMulticastMetatraffic.terminate = ORTE_TRUE;
+  d->taskRecvUnicastUserdata.d = d;
+  d->taskRecvUnicastUserdata.terminate = ORTE_TRUE;
+  d->taskRecvMulticastUserdata.d = d;
+  d->taskRecvMulticastUserdata.terminate = ORTE_TRUE;
+  d->taskSend.d = d;
+  d->taskSend.terminate = ORTE_TRUE;
+  d->taskRecvUnicastMetatraffic.sock.port = 0;
+  d->taskRecvMulticastMetatraffic.sock.port = 0;
+  d->taskRecvUnicastUserdata.sock.port = 0;
+  d->taskRecvMulticastUserdata.sock.port = 0;
+  d->taskSend.sock.port = 0;
   //init structure objectEntry
   ObjectEntryHID_init_root_field(&d->objectEntry);
-  pthread_rwlock_init(&d->objectEntry.objRootLock,NULL);
+  pthread_rwlock_init(&d->objectEntry.objRootLock, NULL);
   htimerRoot_init_queue(&d->objectEntry);
-  pthread_rwlock_init(&d->objectEntry.htimRootLock,NULL);
-  pthread_cond_init(&d->objectEntry.htimSendCond,NULL);
-  pthread_mutex_init(&d->objectEntry.htimSendMutex,NULL);
-  d->objectEntry.htimSendCondValue=0;
-  d->objectEntry.htimNeedWakeUp=ORTE_TRUE;
+  pthread_rwlock_init(&d->objectEntry.htimRootLock, NULL);
+  pthread_cond_init(&d->objectEntry.htimSendCond, NULL);
+  pthread_mutex_init(&d->objectEntry.htimSendMutex, NULL);
+  d->objectEntry.htimSendCondValue = 0;
+  d->objectEntry.htimNeedWakeUp = ORTE_TRUE;
   //publication,subscriptions
-  d->publications.counter=d->subscriptions.counter=0;
+  d->publications.counter = d->subscriptions.counter = 0;
   CSTWriter_init_root_field(&d->publications);
   CSTReader_init_root_field(&d->subscriptions);
-  pthread_rwlock_init(&d->publications.lock,NULL);
-  pthread_rwlock_init(&d->subscriptions.lock,NULL);
+  pthread_rwlock_init(&d->publications.lock, NULL);
+  pthread_rwlock_init(&d->subscriptions.lock, NULL);
   //publication,subscriptions lists
   PublicationList_init_root_field(&d->psEntry);
-  pthread_rwlock_init(&d->psEntry.publicationsLock,NULL);
+  pthread_rwlock_init(&d->psEntry.publicationsLock, NULL);
   SubscriptionList_init_root_field(&d->psEntry);
-  pthread_rwlock_init(&d->psEntry.subscriptionsLock,NULL);
-  
+  pthread_rwlock_init(&d->psEntry.subscriptionsLock, NULL);
+
   //pattern
-  pthread_rwlock_init(&d->patternEntry.lock,NULL);
-  ORTEPatternRegister(d,ORTEPatternCheckDefault,ORTEPatternMatchDefault,NULL);
+  pthread_rwlock_init(&d->patternEntry.lock, NULL);
+  ORTEPatternRegister(d, ORTEPatternCheckDefault, ORTEPatternMatchDefault, NULL);
   Pattern_init_head(&d->patternEntry);
-    
-  //create domainProp 
-  if (prop!=NULL) {
-    memcpy(&d->domainProp,prop,sizeof(ORTEDomainProp));
+
+  //create domainProp
+  if (prop != NULL) {
+    memcpy(&d->domainProp, prop, sizeof(ORTEDomainProp));
   } else {
     if (!ORTEDomainPropDefaultGet(&d->domainProp)) {
       goto err_domainProp;
     }
   }
-  
+
   //print local IP addresses
-  iflocal[0]=0;
+  iflocal[0] = 0;
   if (d->domainProp.IFCount) {
-    for(i=0;i<d->domainProp.IFCount;i++)
-      strcat(iflocal,IPAddressToString(d->domainProp.IFProp[i].ipAddress,sIPAddress));
-    debug(30,2) ("ORTEDomainCreate: localIPAddres(es) %s\n",iflocal);
-  } else{
-    debug(30,2) ("ORTEDomainCreate: no active interface card\n");
+    for (i = 0; i < d->domainProp.IFCount; i++)
+      strcat(iflocal, IPAddressToString(d->domainProp.IFProp[i].ipAddress, sIPAddress));
+    debug(30, 2) ("ORTEDomainCreate: localIPAddres(es) %s\n", iflocal);
+  } else {
+    debug(30, 2) ("ORTEDomainCreate: no active interface card\n");
     if (d->domainProp.multicast.enabled) {
-       debug(30,0) ("ORTEDomainCreate: for multicast have to be active an interface\n");
-       goto err_domainProp;
+      debug(30, 0) ("ORTEDomainCreate: for multicast have to be active an interface\n");
+      goto err_domainProp;
     }
   }
 
   //DomainEvents
-  if (events!=NULL) {
-    memcpy(&d->domainEvents,events,sizeof(ORTEDomainAppEvents));
+  if (events != NULL) {
+    memcpy(&d->domainEvents, events, sizeof(ORTEDomainAppEvents));
   } else {
-    memset(&d->domainEvents,0,sizeof(ORTEDomainAppEvents));
+    memset(&d->domainEvents, 0, sizeof(ORTEDomainAppEvents));
   }
 
   //local buffers
@@ -279,22 +285,22 @@ ORTEDomainCreate(int domain, ORTEDomainProp *prop,
                  d->domainProp.recvBuffSize);
   CDR_buffer_init(&d->taskSend.mb.cdrCodec,
                  d->domainProp.sendBuffSize);
-  d->taskSend.mb.cdrCodec.wptr_max=d->domainProp.wireProp.metaBytesPerPacket;
+  d->taskSend.mb.cdrCodec.wptr_max = d->domainProp.wireProp.metaBytesPerPacket;
   if (!manager) {
     CDR_buffer_init(&d->taskRecvUnicastUserdata.mb.cdrCodec,
-                   d->domainProp.recvBuffSize);
+                   d->domainProp.recvBuffSize);
     if (d->domainProp.multicast.enabled) {
       CDR_buffer_init(&d->taskRecvMulticastMetatraffic.mb.cdrCodec,
-                     d->domainProp.recvBuffSize);
+                     d->domainProp.recvBuffSize);
       CDR_buffer_init(&d->taskRecvMulticastUserdata.mb.cdrCodec,
-                     d->domainProp.recvBuffSize);
+                     d->domainProp.recvBuffSize);
     }
   }
   d->taskSend.mb.cdrCodec.data_endian = FLAG_ENDIANNESS;
 
   //TypeRegister
   ORTEType_init_root_field(&d->typeEntry);
-  pthread_rwlock_init(&d->typeEntry.lock,NULL);
+  pthread_rwlock_init(&d->typeEntry.lock, NULL);
 
   //Sockets
   sock_init_udp(&d->taskRecvUnicastMetatraffic.sock);
@@ -305,48 +311,48 @@ ORTEDomainCreate(int domain, ORTEDomainProp *prop,
 
   /************************************************************************/
   /* UnicastMetatraffic */
-  Domain2Port(d->domain,port);
+  Domain2Port(d->domain, port);
   if (manager) {
     if (d->domainProp.multicast.enabled) {
       char sIPAddress[MAX_STRING_IPADDRESS_LENGTH];
       struct ip_mreq mreq;
-      int reuse=1,loop=0;
-    
+      int reuse = 1, loop = 0;
+
       //reuseaddr
-      sock_setsockopt(&d->taskRecvUnicastMetatraffic.sock, SOL_SOCKET, 
-                   SO_REUSEADDR, (const char *)&reuse, sizeof(reuse));
-      debug(30,2) ("ORTEDomainCreate: set value SO_REUSEADDR: %u\n",
-                   reuse);
+      sock_setsockopt(&d->taskRecvUnicastMetatraffic.sock, SOL_SOCKET,
+                     SO_REUSEADDR, (const char *)&reuse, sizeof(reuse));
+      debug(30, 2) ("ORTEDomainCreate: set value SO_REUSEADDR: %u\n",
+                   reuse);
 
       //multicast loop
-      sock_setsockopt(&d->taskRecvUnicastMetatraffic.sock, IPPROTO_IP, 
-                   IP_MULTICAST_LOOP, (const char *)&loop, 
-                   sizeof(loop));
-      debug(30,2) ("ORTEDomainCreate: set value IP_MULTICAST_LOOP: %u\n",
-                 loop);
-      
+      sock_setsockopt(&d->taskRecvUnicastMetatraffic.sock, IPPROTO_IP,
+                     IP_MULTICAST_LOOP, (const char *)&loop,
+                     sizeof(loop));
+      debug(30, 2) ("ORTEDomainCreate: set value IP_MULTICAST_LOOP: %u\n",
+                   loop);
+
       //joint to multicast group
       memset(&mreq, 0, sizeof(mreq));
-      mreq.imr_multiaddr.s_addr=htonl(d->domainProp.multicast.ipAddress);
-      mreq.imr_interface.s_addr=htonl(INADDR_ANY);
-      if(sock_setsockopt(&d->taskRecvUnicastMetatraffic.sock,IPPROTO_IP,
-         IP_ADD_MEMBERSHIP, (const char *)&mreq, sizeof(mreq))>=0) {
-        debug(30,2) ("ORTEDomainCreate: joint to mgroup %s\n",
-                      IPAddressToString(d->domainProp.multicast.ipAddress,sIPAddress));
+      mreq.imr_multiaddr.s_addr = htonl(d->domainProp.multicast.ipAddress);
+      mreq.imr_interface.s_addr = htonl(INADDR_ANY);
+      if (sock_setsockopt(&d->taskRecvUnicastMetatraffic.sock, IPPROTO_IP,
+                         IP_ADD_MEMBERSHIP, (const char *)&mreq, sizeof(mreq)) >= 0) {
+       debug(30, 2) ("ORTEDomainCreate: joint to mgroup %s\n",
+                     IPAddressToString(d->domainProp.multicast.ipAddress, sIPAddress));
       } else
-             goto err_sock;
+       goto err_sock;
     }
-    if (sock_bind(&d->taskRecvUnicastMetatraffic.sock,port,d->domainProp.listen) == -1) {
+    if (sock_bind(&d->taskRecvUnicastMetatraffic.sock, port, d->domainProp.listen) == -1) {
       goto err_sock;
     }
   } else {
     /* give me receiving port (metatraffic) */
-    if (sock_bind(&d->taskRecvUnicastMetatraffic.sock,0,d->domainProp.listen) == -1) {
+    if (sock_bind(&d->taskRecvUnicastMetatraffic.sock, 0, d->domainProp.listen) == -1) {
       goto err_sock;
     }
   }
-  debug(30,2) ("ORTEDomainCreate: bind on port(RecvUnicastMetatraffic): %u\n",
-               d->taskRecvUnicastMetatraffic.sock.port);
+  debug(30, 2) ("ORTEDomainCreate: bind on port(RecvUnicastMetatraffic): %u\n",
+               d->taskRecvUnicastMetatraffic.sock.port);
 
   /************************************************************************/
   /* MulticastMetatraffic */
@@ -354,377 +360,378 @@ ORTEDomainCreate(int domain, ORTEDomainProp *prop,
     char sIPAddress[MAX_STRING_IPADDRESS_LENGTH];
     struct ip_mreq mreq;
     Port mport;
-    int reuse=1;
-    
+    int reuse = 1;
+
     //reuseaddr
-    sock_setsockopt(&d->taskRecvMulticastMetatraffic.sock, SOL_SOCKET, 
+    sock_setsockopt(&d->taskRecvMulticastMetatraffic.sock, SOL_SOCKET,
                    SO_REUSEADDR, (const char *)&reuse, sizeof(reuse));
-    debug(30,2) ("ORTEDomainCreate: set value SO_REUSEADDR: %u\n",
+    debug(30, 2) ("ORTEDomainCreate: set value SO_REUSEADDR: %u\n",
                  reuse);
 
     //multicast loop
-    sock_setsockopt(&d->taskRecvMulticastMetatraffic.sock, IPPROTO_IP, 
-                   IP_MULTICAST_LOOP, (const char *)&d->domainProp.multicast.loopBackEnabled, 
+    sock_setsockopt(&d->taskRecvMulticastMetatraffic.sock, IPPROTO_IP,
+                   IP_MULTICAST_LOOP, (const char *)&d->domainProp.multicast.loopBackEnabled,
                    sizeof(d->domainProp.multicast.loopBackEnabled));
-    debug(30,2) ("ORTEDomainCreate: set value IP_MULTICAST_LOOP: %u\n",
+    debug(30, 2) ("ORTEDomainCreate: set value IP_MULTICAST_LOOP: %u\n",
                  d->domainProp.multicast.loopBackEnabled);
-    
+
     //joint to multicast group
-    mreq.imr_multiaddr.s_addr=htonl(d->domainProp.multicast.ipAddress);
-    mreq.imr_interface.s_addr=htonl(INADDR_ANY);
-    if(sock_setsockopt(&d->taskRecvMulticastMetatraffic.sock,IPPROTO_IP,
-        IP_ADD_MEMBERSHIP, (const char *)&mreq, sizeof(mreq))>=0) {
-      debug(30,2) ("ORTEDomainCreate: joint to mgroup %s\n",
-                    IPAddressToString(d->domainProp.multicast.ipAddress,sIPAddress));
+    mreq.imr_multiaddr.s_addr = htonl(d->domainProp.multicast.ipAddress);
+    mreq.imr_interface.s_addr = htonl(INADDR_ANY);
+    if (sock_setsockopt(&d->taskRecvMulticastMetatraffic.sock, IPPROTO_IP,
+                       IP_ADD_MEMBERSHIP, (const char *)&mreq, sizeof(mreq)) >= 0) {
+      debug(30, 2) ("ORTEDomainCreate: joint to mgroup %s\n",
+                   IPAddressToString(d->domainProp.multicast.ipAddress, sIPAddress));
     }
-    
+
     /* receiving multicast port (metatraffic) */
-    Domain2PortMulticastMetatraffic(d->domain,mport);
-    if (sock_bind(&d->taskRecvMulticastMetatraffic.sock,(uint16_t)mport,d->domainProp.listen) == -1) {
+    Domain2PortMulticastMetatraffic(d->domain, mport);
+    if (sock_bind(&d->taskRecvMulticastMetatraffic.sock, (uint16_t)mport, d->domainProp.listen) == -1) {
       goto err_sock;
     }
-    debug(30,2) ("ORTEDomainCreate: bind on port(RecvMulticastMetatraffic): %u\n",
-                  d->taskRecvMulticastMetatraffic.sock.port);
+    debug(30, 2) ("ORTEDomainCreate: bind on port(RecvMulticastMetatraffic): %u\n",
+                 d->taskRecvMulticastMetatraffic.sock.port);
   }
 
   /************************************************************************/
   /* UserData */
   if (!manager) {
     /* give me receiving port (userdata) */
-    if (sock_bind(&d->taskRecvUnicastUserdata.sock,0,d->domainProp.listen) == -1) {
+    if (sock_bind(&d->taskRecvUnicastUserdata.sock, 0, d->domainProp.listen) == -1) {
       goto err_sock;
     }
-    debug(30,2) ("ORTEDomainCreate: bind on port(RecvUnicatUserdata): %u\n",
-                  d->taskRecvUnicastUserdata.sock.port);
+    debug(30, 2) ("ORTEDomainCreate: bind on port(RecvUnicatUserdata): %u\n",
+                 d->taskRecvUnicastUserdata.sock.port);
 
     if (d->domainProp.multicast.enabled) {
       Port mport;
-      int reuse=1;
-    
+      int reuse = 1;
+
       //reuseaddr
-      sock_setsockopt(&d->taskRecvMulticastUserdata.sock, SOL_SOCKET, 
-                     SO_REUSEADDR, (const char *)&reuse, sizeof(reuse));
-      debug(30,2) ("ORTEDomainCreate: set value SO_REUSEADDR: %u\n",
-                     reuse);
+      sock_setsockopt(&d->taskRecvMulticastUserdata.sock, SOL_SOCKET,
+                     SO_REUSEADDR, (const char *)&reuse, sizeof(reuse));
+      debug(30, 2) ("ORTEDomainCreate: set value SO_REUSEADDR: %u\n",
+                   reuse);
 
       //multicast loop
-      sock_setsockopt(&d->taskRecvMulticastUserdata.sock, IPPROTO_IP, 
-                     IP_MULTICAST_LOOP, (const char *)&d->domainProp.multicast.loopBackEnabled, 
+      sock_setsockopt(&d->taskRecvMulticastUserdata.sock, IPPROTO_IP,
+                     IP_MULTICAST_LOOP, (const char *)&d->domainProp.multicast.loopBackEnabled,
                      sizeof(d->domainProp.multicast.loopBackEnabled));
-      debug(30,2) ("ORTEDomainCreate: set value IP_MULTICAST_LOOP: %u\n",
+      debug(30, 2) ("ORTEDomainCreate: set value IP_MULTICAST_LOOP: %u\n",
                    d->domainProp.multicast.loopBackEnabled);
-      
+
       /* receiving multicast port (userdata) */
-      Domain2PortMulticastUserdata(d->domain,mport);
-      if (sock_bind(&d->taskRecvMulticastUserdata.sock,(uint16_t)mport,d->domainProp.listen) == -1) {
+      Domain2PortMulticastUserdata(d->domain, mport);
+      if (sock_bind(&d->taskRecvMulticastUserdata.sock, (uint16_t)mport, d->domainProp.listen) == -1) {
        goto err_sock;
       }
-      debug(30,2) ("ORTEDomainCreate: bind on port(RecvMulticastUserdata): %u\n",
-                    d->taskRecvMulticastUserdata.sock.port);
+      debug(30, 2) ("ORTEDomainCreate: bind on port(RecvMulticastUserdata): %u\n",
+                   d->taskRecvMulticastUserdata.sock.port);
     }
   }
 
   /************************************************************************/
   /* Send */
   /* give me sending port */
-  if (sock_bind(&d->taskSend.sock,0,d->domainProp.listen) == -1) {
+  if (sock_bind(&d->taskSend.sock, 0, d->domainProp.listen) == -1) {
     goto err_sock;
   }
-  debug(30,2) ("ORTEDomainCreate: bind on port(Send): %u\n",
-               d->taskSend.sock.port);
+  debug(30, 2) ("ORTEDomainCreate: bind on port(Send): %u\n",
+               d->taskSend.sock.port);
   if (d->domainProp.multicast.enabled) {
     //ttl
-    if(sock_setsockopt(&d->taskSend.sock,IPPROTO_IP,IP_MULTICAST_TTL, (const char *)&d->domainProp.multicast.ttl,sizeof(d->domainProp.multicast.ttl))>=0) {
-      debug(30,2) ("ORTEDomainCreate: ttl set on: %u\n",
-           d->domainProp.multicast.ttl);
-    } 
+    if (sock_setsockopt(&d->taskSend.sock, IPPROTO_IP, IP_MULTICAST_TTL, (const char *)&d->domainProp.multicast.ttl, sizeof(d->domainProp.multicast.ttl)) >= 0) {
+      debug(30, 2) ("ORTEDomainCreate: ttl set on: %u\n",
+                   d->domainProp.multicast.ttl);
+    }
   }
 
   /************************************************************************/
   /* tests for valid resources */
-  if ((d->taskRecvUnicastMetatraffic.sock.fd<0) || 
-      (d->taskSend.sock.fd<0) ||
+  if ((d->taskRecvUnicastMetatraffic.sock.fd < 0) ||
+      (d->taskSend.sock.fd < 0) ||
+      (d->domainProp.multicast.enabled &&
+       (d->taskRecvUnicastUserdata.sock.fd < 0)) ||
       (d->domainProp.multicast.enabled &&
-       (d->taskRecvUnicastUserdata.sock.fd<0)) ||
+       (d->taskRecvMulticastUserdata.sock.fd < 0)) ||
       (d->domainProp.multicast.enabled &&
-       (d->taskRecvMulticastUserdata.sock.fd<0)) ||
-      (d->domainProp.multicast.enabled && 
-       (d->taskRecvMulticastMetatraffic.sock.fd<0))) {
-    debug(30,0) ("ORTEDomainCreate: Error creating socket(s).\n");
+       (d->taskRecvMulticastMetatraffic.sock.fd < 0))) {
+    debug(30, 0) ("ORTEDomainCreate: Error creating socket(s).\n");
     goto err_sock;
   }
 
-  if ((!d->taskRecvUnicastMetatraffic.mb.cdrCodec.buffer) || 
+  if ((!d->taskRecvUnicastMetatraffic.mb.cdrCodec.buffer) ||
       (!d->taskSend.mb.cdrCodec.buffer) ||
       (d->domainProp.multicast.enabled && !manager &&
-       !d->taskRecvUnicastUserdata.mb.cdrCodec.buffer) || 
+       !d->taskRecvUnicastUserdata.mb.cdrCodec.buffer) ||
       (d->domainProp.multicast.enabled && !manager &&
-       !d->taskRecvMulticastUserdata.mb.cdrCodec.buffer) || 
+       !d->taskRecvMulticastUserdata.mb.cdrCodec.buffer) ||
       (d->domainProp.multicast.enabled && !manager &&
        !d->taskRecvMulticastMetatraffic.mb.cdrCodec.buffer)) {    //no a memory
-    debug(30,0) ("ORTEDomainCreate: Error creating buffer(s).\n");
+    debug(30, 0) ("ORTEDomainCreate: Error creating buffer(s).\n");
     goto err_sock;
-  } 
+  }
 
   /************************************************************************/
   //Generates local GUID
-  if (d->domainProp.IFCount>0) 
-    d->guid.hid=d->domainProp.IFProp[0].ipAddress;
+  if (d->domainProp.IFCount > 0)
+    d->guid.hid = d->domainProp.IFProp[0].ipAddress;
   else
-    d->guid.hid=StringToIPAddress("127.0.0.1");
+    d->guid.hid = StringToIPAddress("127.0.0.1");
   if (manager) {
-    d->guid.aid=(d->taskSend.sock.port<<8)+MANAGER; 
+    d->guid.aid = (d->taskSend.sock.port<<8)+MANAGER;
   } else {
-    d->guid.aid=(d->taskSend.sock.port<<8)+MANAGEDAPPLICATION; 
+    d->guid.aid = (d->taskSend.sock.port<<8)+MANAGEDAPPLICATION;
   }
-  d->guid.oid=OID_APP;
-  debug(30,2) ("ORTEDomainCreate: GUID: %#10.8x,%#10.8x,%#10.8x\n",
-               GUID_PRINTF(d->guid)); 
+  d->guid.oid = OID_APP;
+  debug(30, 2) ("ORTEDomainCreate: GUID: %#10.8x,%#10.8x,%#10.8x\n",
+               GUID_PRINTF(d->guid));
 
   //create HEADER of message for sending task
-  RTPSHeaderCreate(&d->taskSend.mb.cdrCodec,d->guid.hid,d->guid.aid);
-  d->taskSend.mb.needSend=ORTE_FALSE;
-  d->taskSend.mb.containsInfoReply=ORTE_FALSE;  
-  d->taskSend.mb.cdrCodecDirect=NULL;
-  
+  RTPSHeaderCreate(&d->taskSend.mb.cdrCodec, d->guid.hid, d->guid.aid);
+  d->taskSend.mb.needSend = ORTE_FALSE;
+  d->taskSend.mb.containsInfoReply = ORTE_FALSE;
+  d->taskSend.mb.cdrCodecDirect = NULL;
+
   //Self object data & fellow managers object data
-  appParams=(AppParams*)MALLOC(sizeof(AppParams));
+  appParams = (AppParams *)MALLOC(sizeof(AppParams));
   if (!appParams) {
     goto err_sock;
   }
   AppParamsInit(appParams);
-  appParams->expirationTime=d->domainProp.baseProp.expirationTime;
+  appParams->expirationTime = d->domainProp.baseProp.expirationTime;
   VENDOR_ID_OCERA(appParams->vendorId);
-  appParams->hostId=d->guid.hid;
-  appParams->appId=d->guid.aid;
-  appParams->metatrafficUnicastPort=d->taskRecvUnicastMetatraffic.sock.port;
-  appParams->userdataUnicastPort=d->taskRecvUnicastUserdata.sock.port;  
+  appParams->hostId = d->guid.hid;
+  appParams->appId = d->guid.aid;
+  appParams->metatrafficUnicastPort = d->taskRecvUnicastMetatraffic.sock.port;
+  appParams->userdataUnicastPort = d->taskRecvUnicastUserdata.sock.port;
   //fill unicast/multicast ip addresses
   if (d->domainProp.IFCount) {
-    for(i=0;i<d->domainProp.IFCount;i++)
-      appParams->unicastIPAddressList[i]=d->domainProp.IFProp[i].ipAddress;
-    appParams->unicastIPAddressCount=d->domainProp.IFCount;
+    for (i = 0; i < d->domainProp.IFCount; i++)
+      appParams->unicastIPAddressList[i] = d->domainProp.IFProp[i].ipAddress;
+    appParams->unicastIPAddressCount = d->domainProp.IFCount;
   }
   if (d->domainProp.multicast.enabled &&
       IN_MULTICAST(d->domainProp.multicast.ipAddress)) {
-    appParams->metatrafficMulticastIPAddressList[appParams->metatrafficMulticastIPAddressCount]=
-       d->domainProp.multicast.ipAddress;
+    appParams->metatrafficMulticastIPAddressList[appParams->metatrafficMulticastIPAddressCount] =
+      d->domainProp.multicast.ipAddress;
     appParams->metatrafficMulticastIPAddressCount++;
   } else {
     if (!d->domainProp.IFCount) {
-      appParams->unicastIPAddressList[appParams->unicastIPAddressCount]=
-           StringToIPAddress("127.0.0.1");
+      appParams->unicastIPAddressList[appParams->unicastIPAddressCount] =
+       StringToIPAddress("127.0.0.1");
       appParams->unicastIPAddressCount++;
     }
   }
   //KeyList
   if (!d->domainProp.keys) {
-    appParams->managerKeyList[0]=StringToIPAddress("127.0.0.1");
-    for(i=0;i<d->domainProp.IFCount;i++)
-      appParams->managerKeyList[i+1]=d->domainProp.IFProp[i].ipAddress;
+    appParams->managerKeyList[0] = StringToIPAddress("127.0.0.1");
+    for (i = 0; i < d->domainProp.IFCount; i++)
+      appParams->managerKeyList[i+1] = d->domainProp.IFProp[i].ipAddress;
     if (d->domainProp.multicast.enabled &&
-        IN_MULTICAST(d->domainProp.multicast.ipAddress)) {
-      appParams->managerKeyList[i+1]=d->domainProp.multicast.ipAddress;
+       IN_MULTICAST(d->domainProp.multicast.ipAddress)) {
+      appParams->managerKeyList[i+1] = d->domainProp.multicast.ipAddress;
       i++;
     }
-    appParams->managerKeyCount=i+1;
+    appParams->managerKeyCount = i+1;
   } else {
-    appParams->managerKeyCount=i=0;
-    while (getStringPart(d->domainProp.keys,':',&i,sbuff)) {
-      appParams->managerKeyList[appParams->managerKeyCount++]=
-          StringToIPAddress(sbuff);
-    }    
+    appParams->managerKeyCount = i = 0;
+    while (getStringPart(d->domainProp.keys, ':', &i, sbuff))
+      appParams->managerKeyList[appParams->managerKeyCount++] =
+       StringToIPAddress(sbuff);
   }
-  d->appParams=appParams;
+  d->appParams = appParams;
   //insert object, doesn't need to be locked
-  d->objectEntryOID=objectEntryAdd(d,&d->guid,(void*)appParams);
-  d->objectEntryOID->privateCreated=ORTE_TRUE;
+  d->objectEntryOID = objectEntryAdd(d, &d->guid, (void *)appParams);
+  d->objectEntryOID->privateCreated = ORTE_TRUE;
+
 
-  
   /************************************************************************/
   //CST objects
   //  writerApplicationSelf (WAS)
   NTPTIME_ZERO(cstWriterParams.waitWhileDataUnderwayTime);
-  cstWriterParams.refreshPeriod=d->domainProp.baseProp.refreshPeriod;
-  cstWriterParams.repeatAnnounceTime=d->domainProp.baseProp.repeatAnnounceTime;
+  cstWriterParams.refreshPeriod = d->domainProp.baseProp.refreshPeriod;
+  cstWriterParams.repeatAnnounceTime = d->domainProp.baseProp.repeatAnnounceTime;
   NTPTIME_ZERO(cstWriterParams.delayResponceTime);
-  cstWriterParams.HBMaxRetries=d->domainProp.baseProp.HBMaxRetries;
+  cstWriterParams.HBMaxRetries = d->domainProp.baseProp.HBMaxRetries;
   if (manager) {
-    cstWriterParams.registrationRetries=d->domainProp.baseProp.registrationMgrRetries; 
-    cstWriterParams.registrationPeriod=d->domainProp.baseProp.registrationMgrPeriod; 
-    cstWriterParams.fullAcknowledge=ORTE_FALSE;
+    cstWriterParams.registrationRetries = d->domainProp.baseProp.registrationMgrRetries;
+    cstWriterParams.registrationPeriod = d->domainProp.baseProp.registrationMgrPeriod;
+    cstWriterParams.fullAcknowledge = ORTE_FALSE;
   } else {
-    cstWriterParams.registrationRetries=d->domainProp.baseProp.registrationAppRetries; 
-    cstWriterParams.registrationPeriod=d->domainProp.baseProp.registrationAppPeriod; 
-    cstWriterParams.fullAcknowledge=ORTE_TRUE;
+    cstWriterParams.registrationRetries = d->domainProp.baseProp.registrationAppRetries;
+    cstWriterParams.registrationPeriod = d->domainProp.baseProp.registrationAppPeriod;
+    cstWriterParams.fullAcknowledge = ORTE_TRUE;
   }
-  CSTWriterInit(d,&d->writerApplicationSelf,d->objectEntryOID,
-      OID_WRITE_APPSELF,&cstWriterParams,NULL);
+  CSTWriterInit(d, &d->writerApplicationSelf, d->objectEntryOID,
+               OID_WRITE_APPSELF, &cstWriterParams, NULL);
   if (manager) {
-    i=0;
-    while (getStringPart(d->domainProp.mgrs,':',&i,sbuff)>0) {
+    i = 0;
+    while (getStringPart(d->domainProp.mgrs, ':', &i, sbuff) > 0) {
       GUID_RTPS guid;
-      IPAddress ipAddress=StringToIPAddress(sbuff);
-      guid.hid=ipAddress;
-      guid.aid=AID_UNKNOWN;
-      guid.oid=OID_APP;
-      if (!objectEntryFind(d,&guid)) {
-        CSTRemoteReader *cstRemoteReader;
-        appParams=(AppParams*)MALLOC(sizeof(AppParams));
-        AppParamsInit(appParams);
-        appParams->hostId=guid.hid;
-        appParams->appId=guid.aid;
-        appParams->metatrafficUnicastPort=d->appParams->metatrafficUnicastPort;
-        objectEntryOID=objectEntryAdd(d,&guid,(void*)appParams);
-        if (d->domainProp.multicast.enabled && IN_MULTICAST(ipAddress)) {
-          appParams->metatrafficMulticastIPAddressList[0]=ipAddress;
-          appParams->metatrafficMulticastIPAddressCount=1;
-          objectEntryOID->multicastPort=port;
-        } else {
-          appParams->unicastIPAddressList[0]=ipAddress;
-          appParams->unicastIPAddressCount=1;
-          objectEntryOID->multicastPort=0;
-        }
-        appParams->userdataUnicastPort=0;  //Manager support only metatraffic
-        cstRemoteReader=CSTWriterAddRemoteReader(d,
-                                &d->writerApplicationSelf,
-                                objectEntryOID,
-                                OID_READ_MGR,
-                                objectEntryOID);
-        debug(29,2) ("ORTEDomainCreate: add fellow manager (%s)\n",
-                    IPAddressToString(ipAddress,sIPAddress));
+      IPAddress ipAddress = StringToIPAddress(sbuff);
+      guid.hid = ipAddress;
+      guid.aid = AID_UNKNOWN;
+      guid.oid = OID_APP;
+      if (!objectEntryFind(d, &guid)) {
+       CSTRemoteReader *cstRemoteReader;
+       appParams = (AppParams *)MALLOC(sizeof(AppParams));
+       AppParamsInit(appParams);
+       appParams->hostId = guid.hid;
+       appParams->appId = guid.aid;
+       appParams->metatrafficUnicastPort = d->appParams->metatrafficUnicastPort;
+       objectEntryOID = objectEntryAdd(d, &guid, (void *)appParams);
+       if (d->domainProp.multicast.enabled && IN_MULTICAST(ipAddress)) {
+         appParams->metatrafficMulticastIPAddressList[0] = ipAddress;
+         appParams->metatrafficMulticastIPAddressCount = 1;
+         objectEntryOID->multicastPort = port;
+       } else {
+         appParams->unicastIPAddressList[0] = ipAddress;
+         appParams->unicastIPAddressCount = 1;
+         objectEntryOID->multicastPort = 0;
+       }
+       appParams->userdataUnicastPort = 0;  //Manager support only metatraffic
+       cstRemoteReader = CSTWriterAddRemoteReader(d,
+                                                  &d->writerApplicationSelf,
+                                                  objectEntryOID,
+                                                  OID_READ_MGR,
+                                                  objectEntryOID);
+       debug(29, 2) ("ORTEDomainCreate: add fellow manager (%s)\n",
+                     IPAddressToString(ipAddress, sIPAddress));
       }
     }
   } else {
     //  add to WAS remote writer(s)
     if (d->domainProp.appLocalManager) {
       GUID_RTPS guid;
-      guid.hid=d->domainProp.appLocalManager;
-      guid.aid=AID_UNKNOWN;
-      guid.oid=OID_APP;
-      if (!objectEntryFind(d,&guid)) {
-        appParams=(AppParams*)MALLOC(sizeof(AppParams));
-        AppParamsInit(appParams);
-        appParams->hostId=guid.hid;
-        appParams->appId=guid.aid;
-        appParams->metatrafficUnicastPort=port;
-        appParams->userdataUnicastPort=0;  //Manager support only metatraffic
-        appParams->unicastIPAddressList[0]=d->domainProp.appLocalManager;
-        appParams->unicastIPAddressCount=1;
-        objectEntryOID=objectEntryAdd(d,&guid,(void*)appParams);
-        CSTWriterAddRemoteReader(d,
-                                &d->writerApplicationSelf,
-                                objectEntryOID,
-                                OID_READ_MGR,
-                                objectEntryOID);
-        debug(30,2) ("ORTEDomainCreate: add manager (%s)\n",
-                      IPAddressToString(d->domainProp.appLocalManager,sIPAddress));
+      guid.hid = d->domainProp.appLocalManager;
+      guid.aid = AID_UNKNOWN;
+      guid.oid = OID_APP;
+      if (!objectEntryFind(d, &guid)) {
+       appParams = (AppParams *)MALLOC(sizeof(AppParams));
+       AppParamsInit(appParams);
+       appParams->hostId = guid.hid;
+       appParams->appId = guid.aid;
+       appParams->metatrafficUnicastPort = port;
+       appParams->userdataUnicastPort = 0;  //Manager support only metatraffic
+       appParams->unicastIPAddressList[0] = d->domainProp.appLocalManager;
+       appParams->unicastIPAddressCount = 1;
+       objectEntryOID = objectEntryAdd(d, &guid, (void *)appParams);
+       CSTWriterAddRemoteReader(d,
+                                &d->writerApplicationSelf,
+                                objectEntryOID,
+                                OID_READ_MGR,
+                                objectEntryOID);
+       debug(30, 2) ("ORTEDomainCreate: add manager (%s)\n",
+                     IPAddressToString(d->domainProp.appLocalManager, sIPAddress));
       }
     }
   }
 
   //  readerManagers
-  cstReaderParams.delayResponceTimeMin=d->domainProp.baseProp.delayResponceTimeACKMin;
-  cstReaderParams.delayResponceTimeMax=d->domainProp.baseProp.delayResponceTimeACKMax;
-  cstReaderParams.ACKMaxRetries=d->domainProp.baseProp.ACKMaxRetries;
+  cstReaderParams.delayResponceTimeMin = d->domainProp.baseProp.delayResponceTimeACKMin;
+  cstReaderParams.delayResponceTimeMax = d->domainProp.baseProp.delayResponceTimeACKMax;
+  cstReaderParams.ACKMaxRetries = d->domainProp.baseProp.ACKMaxRetries;
   if (manager) {
-    cstReaderParams.ACKMaxRetries=d->domainProp.baseProp.ACKMaxRetries;
-    cstReaderParams.repeatActiveQueryTime=iNtpTime;  //RM cann't repeatly send ACKf
+    cstReaderParams.ACKMaxRetries = d->domainProp.baseProp.ACKMaxRetries;
+    cstReaderParams.repeatActiveQueryTime = iNtpTime;  //RM cann't repeatly send ACKf
   } else {
-    cstReaderParams.repeatActiveQueryTime=d->domainProp.baseProp.repeatActiveQueryTime;
-    cstReaderParams.fullAcknowledge=ORTE_TRUE;      
+    cstReaderParams.repeatActiveQueryTime = d->domainProp.baseProp.repeatActiveQueryTime;
+    cstReaderParams.fullAcknowledge = ORTE_TRUE;
   }
-  CSTReaderInit(d,&d->readerManagers,d->objectEntryOID,
-      OID_READ_MGR,&cstReaderParams,NULL);
+  CSTReaderInit(d, &d->readerManagers, d->objectEntryOID,
+               OID_READ_MGR, &cstReaderParams, NULL);
 
   //  readerApplications
-  cstReaderParams.delayResponceTimeMin=d->domainProp.baseProp.delayResponceTimeACKMin;
-  cstReaderParams.delayResponceTimeMax=d->domainProp.baseProp.delayResponceTimeACKMax;
-  cstReaderParams.ACKMaxRetries=d->domainProp.baseProp.ACKMaxRetries;
-  cstReaderParams.repeatActiveQueryTime=d->domainProp.baseProp.repeatActiveQueryTime;
-  cstReaderParams.fullAcknowledge=ORTE_TRUE;      
-  CSTReaderInit(d,&d->readerApplications,d->objectEntryOID,
-      OID_READ_APP,&cstReaderParams,NULL);
+  cstReaderParams.delayResponceTimeMin = d->domainProp.baseProp.delayResponceTimeACKMin;
+  cstReaderParams.delayResponceTimeMax = d->domainProp.baseProp.delayResponceTimeACKMax;
+  cstReaderParams.ACKMaxRetries = d->domainProp.baseProp.ACKMaxRetries;
+  cstReaderParams.repeatActiveQueryTime = d->domainProp.baseProp.repeatActiveQueryTime;
+  cstReaderParams.fullAcknowledge = ORTE_TRUE;
+  CSTReaderInit(d, &d->readerApplications, d->objectEntryOID,
+               OID_READ_APP, &cstReaderParams, NULL);
 
   if (manager) {
     //  writerApplications
-    cstWriterParams.registrationRetries=0; 
-    NTPTIME_ZERO(cstWriterParams.registrationPeriod); 
+    cstWriterParams.registrationRetries = 0;
+    NTPTIME_ZERO(cstWriterParams.registrationPeriod);
     NTPTIME_ZERO(cstWriterParams.waitWhileDataUnderwayTime);
-    cstWriterParams.refreshPeriod=iNtpTime;  //only WAS,WM can refresh csChange(s)
-    cstWriterParams.repeatAnnounceTime=d->domainProp.baseProp.repeatAnnounceTime;
-    NtpTimeAssembFromMs(cstWriterParams.delayResponceTime,0,20);
-    cstWriterParams.HBMaxRetries=d->domainProp.baseProp.HBMaxRetries;
-    cstWriterParams.fullAcknowledge=ORTE_FALSE;
-    CSTWriterInit(d,&d->writerApplications,d->objectEntryOID,
-        OID_WRITE_APP,&cstWriterParams,NULL);
+    cstWriterParams.refreshPeriod = iNtpTime;  //only WAS,WM can refresh csChange(s)
+    cstWriterParams.repeatAnnounceTime = d->domainProp.baseProp.repeatAnnounceTime;
+    NtpTimeAssembFromMs(cstWriterParams.delayResponceTime, 0, 20);
+    cstWriterParams.HBMaxRetries = d->domainProp.baseProp.HBMaxRetries;
+    cstWriterParams.fullAcknowledge = ORTE_FALSE;
+    CSTWriterInit(d, &d->writerApplications, d->objectEntryOID,
+                 OID_WRITE_APP, &cstWriterParams, NULL);
 
     //  writerManagers
-    cstWriterParams.registrationRetries=0; 
-    NTPTIME_ZERO(cstWriterParams.registrationPeriod); 
+    cstWriterParams.registrationRetries = 0;
+    NTPTIME_ZERO(cstWriterParams.registrationPeriod);
     NTPTIME_ZERO(cstWriterParams.waitWhileDataUnderwayTime);
-    cstWriterParams.refreshPeriod=d->domainProp.baseProp.refreshPeriod; 
-    cstWriterParams.repeatAnnounceTime=d->domainProp.baseProp.repeatAnnounceTime;
-    NtpTimeAssembFromMs(cstWriterParams.delayResponceTime,0,20);
-    cstWriterParams.HBMaxRetries=d->domainProp.baseProp.HBMaxRetries;
-    cstWriterParams.fullAcknowledge=ORTE_TRUE;
-    CSTWriterInit(d,&d->writerManagers,d->objectEntryOID,
-        OID_WRITE_MGR,&cstWriterParams,NULL);
+    cstWriterParams.refreshPeriod = d->domainProp.baseProp.refreshPeriod;
+    cstWriterParams.repeatAnnounceTime = d->domainProp.baseProp.repeatAnnounceTime;
+    NtpTimeAssembFromMs(cstWriterParams.delayResponceTime, 0, 20);
+    cstWriterParams.HBMaxRetries = d->domainProp.baseProp.HBMaxRetries;
+    cstWriterParams.fullAcknowledge = ORTE_TRUE;
+    CSTWriterInit(d, &d->writerManagers, d->objectEntryOID,
+                 OID_WRITE_MGR, &cstWriterParams, NULL);
   }
 
   if (!manager) {
     //  writerPublications
-    cstWriterParams.registrationRetries=0; 
-    NTPTIME_ZERO(cstWriterParams.registrationPeriod); 
+    cstWriterParams.registrationRetries = 0;
+    NTPTIME_ZERO(cstWriterParams.registrationPeriod);
     NTPTIME_ZERO(cstWriterParams.waitWhileDataUnderwayTime);
-    cstWriterParams.refreshPeriod=d->domainProp.baseProp.refreshPeriod; 
-    cstWriterParams.repeatAnnounceTime=d->domainProp.baseProp.repeatAnnounceTime;
-    NtpTimeAssembFromMs(cstWriterParams.delayResponceTime,0,20);
-    cstWriterParams.HBMaxRetries=d->domainProp.baseProp.HBMaxRetries;
-    cstWriterParams.fullAcknowledge=ORTE_TRUE;
-    CSTWriterInit(d,&d->writerPublications,d->objectEntryOID,
-        OID_WRITE_PUBL,&cstWriterParams,NULL);
+    cstWriterParams.refreshPeriod = d->domainProp.baseProp.refreshPeriod;
+    cstWriterParams.repeatAnnounceTime = d->domainProp.baseProp.repeatAnnounceTime;
+    NtpTimeAssembFromMs(cstWriterParams.delayResponceTime, 0, 20);
+    cstWriterParams.HBMaxRetries = d->domainProp.baseProp.HBMaxRetries;
+    cstWriterParams.fullAcknowledge = ORTE_TRUE;
+    CSTWriterInit(d, &d->writerPublications, d->objectEntryOID,
+                 OID_WRITE_PUBL, &cstWriterParams, NULL);
     //  writerSubscriptions
-    cstWriterParams.registrationRetries=0; 
-    NTPTIME_ZERO(cstWriterParams.registrationPeriod); 
+    cstWriterParams.registrationRetries = 0;
+    NTPTIME_ZERO(cstWriterParams.registrationPeriod);
     NTPTIME_ZERO(cstWriterParams.waitWhileDataUnderwayTime);
-    cstWriterParams.refreshPeriod=d->domainProp.baseProp.refreshPeriod; 
-    cstWriterParams.repeatAnnounceTime=d->domainProp.baseProp.repeatAnnounceTime;
-    NtpTimeAssembFromMs(cstWriterParams.delayResponceTime,0,20);
-    cstWriterParams.HBMaxRetries=d->domainProp.baseProp.HBMaxRetries;
-    cstWriterParams.fullAcknowledge=ORTE_TRUE;
-    CSTWriterInit(d,&d->writerSubscriptions,d->objectEntryOID,
-        OID_WRITE_SUBS,&cstWriterParams,NULL);
+    cstWriterParams.refreshPeriod = d->domainProp.baseProp.refreshPeriod;
+    cstWriterParams.repeatAnnounceTime = d->domainProp.baseProp.repeatAnnounceTime;
+    NtpTimeAssembFromMs(cstWriterParams.delayResponceTime, 0, 20);
+    cstWriterParams.HBMaxRetries = d->domainProp.baseProp.HBMaxRetries;
+    cstWriterParams.fullAcknowledge = ORTE_TRUE;
+    CSTWriterInit(d, &d->writerSubscriptions, d->objectEntryOID,
+                 OID_WRITE_SUBS, &cstWriterParams, NULL);
     //  readerPublications
-    cstReaderParams.delayResponceTimeMin=d->domainProp.baseProp.delayResponceTimeACKMin;
-    cstReaderParams.delayResponceTimeMax=d->domainProp.baseProp.delayResponceTimeACKMax;
-    cstReaderParams.ACKMaxRetries=d->domainProp.baseProp.ACKMaxRetries;
-    cstReaderParams.repeatActiveQueryTime=d->domainProp.baseProp.repeatActiveQueryTime;
-    cstReaderParams.fullAcknowledge=ORTE_TRUE;      
-    CSTReaderInit(d,&d->readerPublications,d->objectEntryOID,
-        OID_READ_PUBL,&cstReaderParams,NULL);
+    cstReaderParams.delayResponceTimeMin = d->domainProp.baseProp.delayResponceTimeACKMin;
+    cstReaderParams.delayResponceTimeMax = d->domainProp.baseProp.delayResponceTimeACKMax;
+    cstReaderParams.ACKMaxRetries = d->domainProp.baseProp.ACKMaxRetries;
+    cstReaderParams.repeatActiveQueryTime = d->domainProp.baseProp.repeatActiveQueryTime;
+    cstReaderParams.fullAcknowledge = ORTE_TRUE;
+    CSTReaderInit(d, &d->readerPublications, d->objectEntryOID,
+                 OID_READ_PUBL, &cstReaderParams, NULL);
     //  readerSubscriptions
-    cstReaderParams.delayResponceTimeMin=d->domainProp.baseProp.delayResponceTimeACKMin;
-    cstReaderParams.delayResponceTimeMax=d->domainProp.baseProp.delayResponceTimeACKMax;
-    cstReaderParams.ACKMaxRetries=d->domainProp.baseProp.ACKMaxRetries;
-    cstReaderParams.repeatActiveQueryTime=d->domainProp.baseProp.repeatActiveQueryTime;
-    cstReaderParams.fullAcknowledge=ORTE_TRUE;      
-    CSTReaderInit(d,&d->readerSubscriptions,d->objectEntryOID,
-        OID_READ_SUBS,&cstReaderParams,NULL);
+    cstReaderParams.delayResponceTimeMin = d->domainProp.baseProp.delayResponceTimeACKMin;
+    cstReaderParams.delayResponceTimeMax = d->domainProp.baseProp.delayResponceTimeACKMax;
+    cstReaderParams.ACKMaxRetries = d->domainProp.baseProp.ACKMaxRetries;
+    cstReaderParams.repeatActiveQueryTime = d->domainProp.baseProp.repeatActiveQueryTime;
+    cstReaderParams.fullAcknowledge = ORTE_TRUE;
+    CSTReaderInit(d, &d->readerSubscriptions, d->objectEntryOID,
+                 OID_READ_SUBS, &cstReaderParams, NULL);
   }
 
   //add csChange for WAS
-  appSelfParamChanged(d,ORTE_FALSE,ORTE_FALSE,ORTE_FALSE,ORTE_TRUE);
+  appSelfParamChanged(d, ORTE_FALSE, ORTE_FALSE, ORTE_FALSE, ORTE_TRUE);
 
-  debug(30,10) ("ORTEDomainCreate: finished\n");
+  debug(30, 10) ("ORTEDomainCreate: finished\n");
   return d;
 
 //err:
-  if (!errno_save) errno_save = errno;
+  if (!errno_save)
+    errno_save = errno;
   /* TODO */
   FREE(appParams);
 err_sock:
-  if (!errno_save) errno_save = errno;
+  if (!errno_save)
+    errno_save = errno;
   sock_cleanup(&d->taskRecvUnicastMetatraffic.sock);
   sock_cleanup(&d->taskRecvMulticastMetatraffic.sock);
   sock_cleanup(&d->taskRecvUnicastUserdata.sock);
@@ -740,7 +747,8 @@ err_sock:
   }
   CDR_codec_release_buffer(&d->taskRecvUnicastMetatraffic.mb.cdrCodec);
 err_domainProp:
-  if (!errno_save) errno_save = errno;
+  if (!errno_save)
+    errno_save = errno;
   pthread_rwlock_destroy(&d->patternEntry.lock);
   pthread_rwlock_destroy(&d->psEntry.subscriptionsLock);
   pthread_rwlock_destroy(&d->psEntry.publicationsLock);
@@ -756,16 +764,18 @@ err_domainProp:
 
 /*****************************************************************************/
 Boolean
-ORTEDomainDestroy(ORTEDomain *d,Boolean manager) {
+ORTEDomainDestroy(ORTEDomain *d, Boolean manager)
+{
   CSTWriter             *cstWriter;
   CSTReader             *cstReader;
 
-  debug(30,10) ("ORTEDomainDestroy: start\n");
-  if (!d) return ORTE_FALSE;
+  debug(30, 10) ("ORTEDomainDestroy: start\n");
+  if (!d)
+    return ORTE_FALSE;
 
   pthread_rwlock_wrlock(&d->objectEntry.objRootLock);
   pthread_rwlock_wrlock(&d->objectEntry.htimRootLock);
-  appSelfParamChanged(d,ORTE_TRUE,ORTE_TRUE,ORTE_FALSE,ORTE_FALSE);    
+  appSelfParamChanged(d, ORTE_TRUE, ORTE_TRUE, ORTE_FALSE, ORTE_FALSE);
   pthread_rwlock_unlock(&d->objectEntry.htimRootLock);
   pthread_rwlock_unlock(&d->objectEntry.objRootLock);
 
@@ -775,34 +785,34 @@ ORTEDomainDestroy(ORTEDomain *d,Boolean manager) {
   ORTEDomainRecvThreadStop(&d->taskRecvUnicastUserdata);
   ORTEDomainRecvThreadStop(&d->taskRecvMulticastUserdata);
   ORTEDomainSendThreadStop(&d->taskSend);
-  debug(30,3) ("ORTEDomainDestroy: threads stoped\n");
-  
+  debug(30, 3) ("ORTEDomainDestroy: threads stoped\n");
+
   //CSTReaders and CSTWriters
-  CSTWriterDelete(d,&d->writerApplicationSelf);
-  CSTReaderDelete(d,&d->readerManagers);
-  CSTReaderDelete(d,&d->readerApplications);
+  CSTWriterDelete(d, &d->writerApplicationSelf);
+  CSTReaderDelete(d, &d->readerManagers);
+  CSTReaderDelete(d, &d->readerApplications);
   if (manager) {
-    CSTWriterDelete(d,&d->writerManagers);
-    CSTWriterDelete(d,&d->writerApplications);
-  } else { 
-    CSTWriterDelete(d,&d->writerPublications);
-    CSTWriterDelete(d,&d->writerSubscriptions);
-    CSTReaderDelete(d,&d->readerPublications);
-    CSTReaderDelete(d,&d->readerSubscriptions);
+    CSTWriterDelete(d, &d->writerManagers);
+    CSTWriterDelete(d, &d->writerApplications);
+  } else {
+    CSTWriterDelete(d, &d->writerPublications);
+    CSTWriterDelete(d, &d->writerSubscriptions);
+    CSTReaderDelete(d, &d->readerPublications);
+    CSTReaderDelete(d, &d->readerSubscriptions);
 
     while ((cstWriter = CSTWriter_cut_first(&d->publications))) {
-      CSTWriterDelete(d,cstWriter);
+      CSTWriterDelete(d, cstWriter);
       FREE(cstWriter);
-    }  
+    }
     while ((cstReader = CSTReader_cut_first(&d->subscriptions))) {
-      CSTReaderDelete(d,cstReader);
+      CSTReaderDelete(d, cstReader);
       FREE(cstReader);
     }
-  }  
-    
+  }
+
   //objects in objectsEntry
-  objectEntryDeleteAll(d,&d->objectEntry);
-  debug(30,3) ("ORTEDomainDestroy: deleted all objects\n");
+  objectEntryDeleteAll(d, &d->objectEntry);
+  debug(30, 3) ("ORTEDomainDestroy: deleted all objects\n");
 
   //Sockets
   sock_cleanup(&d->taskRecvUnicastMetatraffic.sock);
@@ -826,22 +836,22 @@ ORTEDomainDestroy(ORTEDomain *d,Boolean manager) {
 
   //TypeRegister
   ORTETypeRegisterDestroyAll(d);
-  
+
   //Pattern
   ORTEDomainAppSubscriptionPatternDestroy(d);
   pthread_rwlock_destroy(&d->patternEntry.lock);
-  
-  //Release buffers  
+
+  //Release buffers
   CDR_codec_release_buffer(&d->taskRecvUnicastMetatraffic.mb.cdrCodec);
   CDR_codec_release_buffer(&d->taskRecvMulticastMetatraffic.mb.cdrCodec);
   CDR_codec_release_buffer(&d->taskRecvUnicastUserdata.mb.cdrCodec);
   CDR_codec_release_buffer(&d->taskRecvMulticastUserdata.mb.cdrCodec);
   CDR_codec_release_buffer(&d->taskSend.mb.cdrCodec);
-  
+
   //Free domain instance
   FREE(d);
-  
-  debug(30,10) ("ORTEDomainDestroy: finished\n");
-  
+
+  debug(30, 10) ("ORTEDomainDestroy: finished\n");
+
   return ORTE_TRUE;
 }
index ee5331945ca4a0f0d4b3dc25e758337011835559..a64ed9d6e157054b9e5acdcae4eae9d275eb5bbe 100644 (file)
 /*
- *  $Id: ORTEDomainApp.c,v 0.0.0.1      2003/08/21 
+ *  $Id: ORTEDomainApp.c,v 0.0.0.1      2003/08/21
  *
  *  DEBUG:  section 21                  Domain application
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
 /*****************************************************************************/
-ORTEDomain * 
+ORTEDomain *
 ORTEDomainAppCreate(int domain, ORTEDomainProp *prop,
-                    ORTEDomainAppEvents *events,Boolean suspended) {
-  ORTEDomain           *d;
+                   ORTEDomainAppEvents *events, Boolean suspended)
+{
+  ORTEDomain            *d;
 
-  debug(21,10) ("ORTEDomainAppCreate: start\n");
+  debug(21, 10) ("ORTEDomainAppCreate: start\n");
 
-  d=ORTEDomainCreate(domain,prop,events,ORTE_FALSE);
+  d = ORTEDomainCreate(domain, prop, events, ORTE_FALSE);
   if (!d)
     return NULL;
-  
+
   //Start threads
   if (!suspended) {
-    ORTEDomainStart(d,                                 /* domain */
-                   ORTE_TRUE,                          /* recvUnicastMetarafficThread */
+    ORTEDomainStart(d,                                  /* domain */
+                   ORTE_TRUE,                          /* recvUnicastMetarafficThread */
                    d->domainProp.multicast.enabled,    /* recvMulticastMetarafficThread */
-                   ORTE_TRUE,                          /* recvUnicastUserdataThread */
-                   d->domainProp.multicast.enabled,    /* recvMulticastUserdataThread */
-                   ORTE_TRUE);                         /* sendThread */
+                   ORTE_TRUE,                          /* recvUnicastUserdataThread */
+                   d->domainProp.multicast.enabled,    /* recvMulticastUserdataThread */
+                   ORTE_TRUE);                         /* sendThread */
   }
-  debug(21,10) ("ORTEDomainAppCreate: finished\n");
+  debug(21, 10) ("ORTEDomainAppCreate: finished\n");
   return d;
 }
 
 /*****************************************************************************/
 Boolean
-ORTEDomainAppDestroy(ORTEDomain *d) {
+ORTEDomainAppDestroy(ORTEDomain *d)
+{
   Boolean ret;
 
-  debug(21,10) ("ORTEDomainAppDestroy: start\n");
+  debug(21, 10) ("ORTEDomainAppDestroy: start\n");
 
-  ret=ORTEDomainDestroy(d,ORTE_FALSE);
+  ret = ORTEDomainDestroy(d, ORTE_FALSE);
 
-  debug(21,10) ("ORTEDomainAppDestroy: finished\n");
+  debug(21, 10) ("ORTEDomainAppDestroy: finished\n");
   return ret;
 }
 
 /*****************************************************************************/
-Boolean 
-ORTEDomainAppSubscriptionPatternAdd(ORTEDomain *d,const char *topic,
-    const char *type,ORTESubscriptionPatternCallBack subscriptionCallBack, 
-    void *param) {
+Boolean
+ORTEDomainAppSubscriptionPatternAdd(ORTEDomain *d, const char *topic,
+                                   const char *type, ORTESubscriptionPatternCallBack subscriptionCallBack,
+                                   void *param)
+{
   PatternNode *pnode;
-  
-  if (!d) return ORTE_FALSE;
-  pnode=(PatternNode*)MALLOC(sizeof(PatternNode));
-  strcpy((char *)pnode->topic,topic);
-  strcpy((char *)pnode->type,type);
-  pnode->subscriptionCallBack=subscriptionCallBack;
-  pnode->param=param;
+
+  if (!d)
+    return ORTE_FALSE;
+  pnode = (PatternNode *)MALLOC(sizeof(PatternNode));
+  strcpy((char *)pnode->topic, topic);
+  strcpy((char *)pnode->type, type);
+  pnode->subscriptionCallBack = subscriptionCallBack;
+  pnode->param = param;
   pthread_rwlock_wrlock(&d->patternEntry.lock);
-  Pattern_insert(&d->patternEntry,pnode);
+  Pattern_insert(&d->patternEntry, pnode);
   pthread_rwlock_unlock(&d->patternEntry.lock);
   return ORTE_TRUE;
 }
 
 /*****************************************************************************/
-Boolean 
-ORTEDomainAppSubscriptionPatternRemove(ORTEDomain *d,const char *topic,
-    const char *type) {
+Boolean
+ORTEDomainAppSubscriptionPatternRemove(ORTEDomain *d, const char *topic,
+                                      const char *type)
+{
   PatternNode *pnode;
-  
-  if (!d) return ORTE_FALSE;
+
+  if (!d)
+    return ORTE_FALSE;
   pthread_rwlock_wrlock(&d->patternEntry.lock);
-  ul_list_for_each(Pattern,&d->patternEntry,pnode) {
-    if ((strcmp((const char *)pnode->topic, (const char*)topic)==0) &&
-        (strcmp((const char *)pnode->type, (const char*)type)==0)) {
-      Pattern_delete(&d->patternEntry,pnode);
+  ul_list_for_each(Pattern, &d->patternEntry, pnode) {
+    if ((strcmp((const char *)pnode->topic, (const char *)topic) == 0) &&
+       (strcmp((const char *)pnode->type, (const char *)type) == 0)) {
+      Pattern_delete(&d->patternEntry, pnode);
       FREE(pnode);
       return ORTE_TRUE;
     }
@@ -109,15 +115,16 @@ ORTEDomainAppSubscriptionPatternRemove(ORTEDomain *d,const char *topic,
 }
 
 /*****************************************************************************/
-Boolean 
-ORTEDomainAppSubscriptionPatternDestroy(ORTEDomain *d) {
+Boolean
+ORTEDomainAppSubscriptionPatternDestroy(ORTEDomain *d)
+{
   PatternNode *pnode;
-  
-  if (!d) return ORTE_FALSE;
+
+  if (!d)
+    return ORTE_FALSE;
   pthread_rwlock_wrlock(&d->patternEntry.lock);
-  while((pnode=Pattern_cut_first(&d->patternEntry))) {
+  while ((pnode = Pattern_cut_first(&d->patternEntry)))
     FREE(pnode);
-  }
   pthread_rwlock_unlock(&d->patternEntry.lock);
   return ORTE_TRUE;
 }
index 29fa02bc80dad03a0c063336632fffc23cd6eafa..21269ad09a9d17b07f9ba13a33269de75880142f 100644 (file)
@@ -3,69 +3,71 @@
  *
  *  DEBUG:  section 29                  Domain manager
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
 /*****************************************************************************/
 ORTEDomain *
 ORTEDomainMgrCreate(int domain, ORTEDomainProp *prop,
-                    ORTEDomainAppEvents *events,Boolean suspended) {
+                   ORTEDomainAppEvents *events, Boolean suspended)
+{
   ORTEDomain        *d;
 
-  debug(29,10) ("ORTEDomainMgrCreate: start\n");
+  debug(29, 10) ("ORTEDomainMgrCreate: start\n");
 
-  d=ORTEDomainCreate(domain,prop,events,ORTE_TRUE);
+  d = ORTEDomainCreate(domain, prop, events, ORTE_TRUE);
   if (!d)
     return NULL;
-  
+
   //Start threads
   if (!suspended) {
-    ORTEDomainStart(d,                                 /* domain */
-                   ORTE_TRUE,                          /* recvUnicastMetarafficThread */
+    ORTEDomainStart(d,                                  /* domain */
+                   ORTE_TRUE,                          /* recvUnicastMetarafficThread */
                    ORTE_FALSE,                         /* recvMulticastMetarafficThread */
-                   ORTE_FALSE,                         /* recvUnicastUserdataThread */
-                   ORTE_FALSE,                         /* recvMulticastUserdataThread */
-                   ORTE_TRUE);                         /* sendThread */
+                   ORTE_FALSE,                         /* recvUnicastUserdataThread */
+                   ORTE_FALSE,                         /* recvMulticastUserdataThread */
+                   ORTE_TRUE);                         /* sendThread */
   }
 
-  debug(29,10) ("ORTEDomainMgrCreate: finished\n");
+  debug(29, 10) ("ORTEDomainMgrCreate: finished\n");
   return d;
 }
 
 /*****************************************************************************/
 Boolean
-ORTEDomainMgrDestroy(ORTEDomain *d) {
+ORTEDomainMgrDestroy(ORTEDomain *d)
+{
   Boolean ret;
 
-  debug(29,10) ("ORTEDomainMgrDestroy: start\n");
+  debug(29, 10) ("ORTEDomainMgrDestroy: start\n");
 
-  ret=ORTEDomainDestroy(d,ORTE_TRUE);
+  ret = ORTEDomainDestroy(d, ORTE_TRUE);
 
-  debug(29,10) ("ORTEDomainMgrDestroy: finished\n");
+  debug(29, 10) ("ORTEDomainMgrDestroy: finished\n");
   return ret;
 }
index c32c696a620609c50972836afde47819e3e68e49..7aa4ed5e21303f4a2114fff93665b04c3b095cc0 100644 (file)
@@ -1,33 +1,33 @@
 /*
- *  $Id: ORTEInit.c,v 0.0.0.1           2003/08/21 
+ *  $Id: ORTEInit.c,v 0.0.0.1           2003/08/21
  *
  *  DEBUG:  section 20                  Initialization of ORTE
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 #ifdef __RTL__
@@ -39,16 +39,11 @@ MODULE_LICENSE("GPL");
 
 /*****************************************************************************/
 void
-ORTEInit(void) {
+ORTEInit(void)
+{
   SEQUENCE_NUMBER_NONE(noneSN);
   NTPTIME_ZERO(zNtpTime);
   NTPTIME_INFINITE(iNtpTime);
   sock_start();
-  db_init(NULL,"");              //no debug info
+  db_init(NULL, "");              //no debug info
 }
-
-
-
-
-
-
index adf40ac6729a396ee07633c92f47bf0fb256bbb1..5489a3a130be230ed3fc675278e6024e5b817247 100644 (file)
@@ -1,46 +1,47 @@
 /*
- *  $Id: ORTEMisc.c,v 0.0.0.1           2004/01/27 
+ *  $Id: ORTEMisc.c,v 0.0.0.1           2004/01/27
  *
  *  DEBUG:  section 34                  miscellaneous functions
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
+
 #include "orte_all.h"
 
-inline void 
-ORTESleepMs(unsigned int ms) {
+inline void
+ORTESleepMs(unsigned int ms)
+{
   #if defined(CONFIG_ORTE_UNIX) && defined (HAVE_UNISTD_H)
-    usleep(ms*1000);
-  #elif defined CONFIG_ORTE_RTL 
-    usleep(ms*1000);
-  #elif defined CONFIG_ORTE_WIN 
-    Sleep(ms);
+  usleep(ms*1000);
+  #elif defined CONFIG_ORTE_RTL
+  usleep(ms*1000);
+  #elif defined CONFIG_ORTE_WIN
+  Sleep(ms);
   #elif defined CONFIG_ORTE_RTAI
-    rt_sleep(nano2count(ms*1000000));
+  rt_sleep(nano2count(ms*1000000));
   #else
     #error "NOT DEFINED SLEEP FUNCTION!"
   #endif
index 414d9636fa87929481884cb5d454e3c5f8cc0cc1..45e44cf8f1ff1e59d1e37d3d21d93f335d5f9acd 100644 (file)
@@ -1,58 +1,61 @@
 /*
- *  $Id: ORTEPattern.c,v 0.0.0.1        2003/07/12 
+ *  $Id: ORTEPattern.c,v 0.0.0.1        2003/07/12
  *
  *  DEBUG:  section 28                  Pattern
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
 /**********************************************************************************/
 Boolean
-ORTEPatternCheckDefault(const char *topic) {
-  if (strchr(topic, '*')!=NULL) 
+ORTEPatternCheckDefault(const char *topic)
+{
+  if (strchr(topic, '*') != NULL)
     return ORTE_TRUE;
   return ORTE_FALSE;
 }
 
 /**********************************************************************************/
 Boolean
-ORTEPatternMatchDefault(const char *topic,const char *pattern,void *param) {
-  fnmatch((const char *)pattern, (const char*)topic,0);
+ORTEPatternMatchDefault(const char *topic, const char *pattern, void *param)
+{
+  fnmatch((const char *)pattern, (const char *)topic, 0);
   return ORTE_FALSE;
 }
 
 /**********************************************************************************/
 void
-ORTEPatternRegister(ORTEDomain *d,ORTEPatternCheck check,
-     ORTEPatternMatch match,void *param) {
+ORTEPatternRegister(ORTEDomain *d, ORTEPatternCheck check,
+                   ORTEPatternMatch match, void *param)
+{
   pthread_rwlock_wrlock(&d->patternEntry.lock);
-  d->patternEntry.check=check;
-  d->patternEntry.match=match;
-  d->patternEntry.param=param;
+  d->patternEntry.check = check;
+  d->patternEntry.match = match;
+  d->patternEntry.param = param;
   pthread_rwlock_unlock(&d->patternEntry.lock);
 }
index de0887e58b34f56f5bd927efb982de0f2475c287..6cc7fa77b2492b9a617e1d836bfbd4252d6a082a 100644 (file)
  *
  *  DEBUG:  section 31                  Functions working over publication
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
-GAVL_CUST_NODE_INT_IMP(PublicationList, 
-                       PSEntry, ObjectEntryOID, GUID_RTPS,
-                       publications, psNode, guid, gavl_cmp_guid);
+GAVL_CUST_NODE_INT_IMP(PublicationList,
+                      PSEntry, ObjectEntryOID, GUID_RTPS,
+                      publications, psNode, guid, gavl_cmp_guid);
 
 /*****************************************************************************/
-ORTEPublication * 
-ORTEPublicationCreate(ORTEDomain *d,const char *topic,const char *typeName,
-    void *instance,NtpTime *persistence,int strength,
-    ORTESendCallBack sendCallBack,void *sendCallBackParam,
-    NtpTime *sendCallBackDelay) {
+ORTEPublication *
+ORTEPublicationCreate(ORTEDomain *d, const char *topic, const char *typeName,
+                     void *instance, NtpTime *persistence, int strength,
+                     ORTESendCallBack sendCallBack, void *sendCallBackParam,
+                     NtpTime *sendCallBackDelay)
+{
   GUID_RTPS             guid;
   CSTWriter             *cstWriter;
   CSTWriterParams       cstWriterParams;
   ORTEPublProp          *pp;
-  ObjectEntryOID        *objectEntryOID;   
+  ObjectEntryOID        *objectEntryOID;
   CSChange              *csChange;
   TypeNode              *typeNode;
-  
-  debug(31,10) ("ORTEPublicationCreate: start\n");
-  cstWriter=(CSTWriter*)MALLOC(sizeof(CSTWriter));
-  if (!cstWriter) return NULL;
-  debug(31,10) ("ORTEPublicationCreate: memory OK\n");
+
+  debug(31, 10) ("ORTEPublicationCreate: start\n");
+  cstWriter = (CSTWriter *)MALLOC(sizeof(CSTWriter));
+  if (!cstWriter)
+    return NULL;
+  debug(31, 10) ("ORTEPublicationCreate: memory OK\n");
   pthread_rwlock_wrlock(&d->objectEntry.objRootLock);
   pthread_rwlock_wrlock(&d->objectEntry.htimRootLock);
-  pthread_rwlock_rdlock(&d->typeEntry.lock);    
-  if (!(typeNode=ORTEType_find(&d->typeEntry,&typeName))) {
-    pthread_rwlock_unlock(&d->typeEntry.lock);    
+  pthread_rwlock_rdlock(&d->typeEntry.lock);
+  if (!(typeNode = ORTEType_find(&d->typeEntry, &typeName))) {
+    pthread_rwlock_unlock(&d->typeEntry.lock);
     pthread_rwlock_unlock(&d->objectEntry.objRootLock);
     pthread_rwlock_unlock(&d->objectEntry.htimRootLock);
     printf("before call ORTEPublicationCreate is necessary to register \n\
             ser./deser. function for a given typeName!!!\n");
     FREE(cstWriter);
     return NULL;
-  }  
+  }
   pthread_rwlock_wrlock(&d->publications.lock);
   //generate new guid of publisher
   d->publications.counter++;
-  guid.hid=d->guid.hid;guid.aid=d->guid.aid;
-  guid.oid=(d->publications.counter<<8)|OID_PUBLICATION;
-  pp=(ORTEPublProp*)MALLOC(sizeof(ORTEPublProp));
-  memcpy(pp,&d->domainProp.publPropDefault,sizeof(ORTEPublProp));
-  strcpy((char *)pp->topic,topic);
-  strcpy((char *)pp->typeName,typeName);
-  pp->persistence=*persistence;
-  pp->strength=strength;
-  pp->reliabilityOffered=PID_VALUE_RELIABILITY_BEST_EFFORTS | 
-                         PID_VALUE_RELIABILITY_STRICT;
+  guid.hid = d->guid.hid;
+  guid.aid = d->guid.aid;
+  guid.oid = (d->publications.counter<<8)|OID_PUBLICATION;
+  pp = (ORTEPublProp *)MALLOC(sizeof(ORTEPublProp));
+  memcpy(pp, &d->domainProp.publPropDefault, sizeof(ORTEPublProp));
+  strcpy((char *)pp->topic, topic);
+  strcpy((char *)pp->typeName, typeName);
+  pp->persistence = *persistence;
+  pp->strength = strength;
+  pp->reliabilityOffered = PID_VALUE_RELIABILITY_BEST_EFFORTS |
+                          PID_VALUE_RELIABILITY_STRICT;
   //insert object to structure objectEntry
-  objectEntryOID=objectEntryAdd(d,&guid,(void*)pp);
-  objectEntryOID->privateCreated=ORTE_TRUE;
-  objectEntryOID->instance=instance;
-  objectEntryOID->sendCallBack=sendCallBack;
-  objectEntryOID->callBackParam=sendCallBackParam;
-  if (objectEntryOID->sendCallBack!=NULL) {  
-    if (sendCallBackDelay!=NULL) {
-      objectEntryOID->sendCallBackDelay=*sendCallBackDelay;
+  objectEntryOID = objectEntryAdd(d, &guid, (void *)pp);
+  objectEntryOID->privateCreated = ORTE_TRUE;
+  objectEntryOID->instance = instance;
+  objectEntryOID->sendCallBack = sendCallBack;
+  objectEntryOID->callBackParam = sendCallBackParam;
+  if (objectEntryOID->sendCallBack != NULL) {
+    if (sendCallBackDelay != NULL) {
+      objectEntryOID->sendCallBackDelay = *sendCallBackDelay;
       eventAdd(d,
-          objectEntryOID->objectEntryAID,
-          &objectEntryOID->sendCallBackDelayTimer,
-          0,   
-          "PublicationCallBackTimer",
-          PublicationCallBackTimer,
-          &cstWriter->lock,
-          cstWriter,
-          &objectEntryOID->sendCallBackDelay);               
+              objectEntryOID->objectEntryAID,
+              &objectEntryOID->sendCallBackDelayTimer,
+              0,
+              "PublicationCallBackTimer",
+              PublicationCallBackTimer,
+              &cstWriter->lock,
+              cstWriter,
+              &objectEntryOID->sendCallBackDelay);
     }
   }
   //create writerPublication
-  cstWriterParams.registrationRetries=0; 
-  NTPTIME_ZERO(cstWriterParams.registrationPeriod); 
+  cstWriterParams.registrationRetries = 0;
+  NTPTIME_ZERO(cstWriterParams.registrationPeriod);
   NTPTIME_ZERO(cstWriterParams.waitWhileDataUnderwayTime);
   NTPTIME_ZERO(cstWriterParams.delayResponceTime);
-  cstWriterParams.refreshPeriod=iNtpTime;  //can't refresh csChange(s)
-  cstWriterParams.repeatAnnounceTime=pp->HBNornalRate;
-  cstWriterParams.HBMaxRetries=pp->HBMaxRetries;
-  cstWriterParams.fullAcknowledge=ORTE_TRUE;
-  CSTWriterInit(d,cstWriter,objectEntryOID,guid.oid,&cstWriterParams,
-                &typeNode->typeRegister);
+  cstWriterParams.refreshPeriod = iNtpTime;  //can't refresh csChange(s)
+  cstWriterParams.repeatAnnounceTime = pp->HBNornalRate;
+  cstWriterParams.HBMaxRetries = pp->HBMaxRetries;
+  cstWriterParams.fullAcknowledge = ORTE_TRUE;
+  CSTWriterInit(d, cstWriter, objectEntryOID, guid.oid, &cstWriterParams,
+               &typeNode->typeRegister);
   //insert cstWriter to list of publications
-  CSTWriter_insert(&d->publications,cstWriter);
+  CSTWriter_insert(&d->publications, cstWriter);
   //generate csChange for writerPublisher
   pthread_rwlock_wrlock(&d->writerPublications.lock);
-  csChange=(CSChange*)MALLOC(sizeof(CSChange));
-  parameterUpdateCSChangeFromPublication(csChange,pp);
-  csChange->guid=guid;
-  csChange->alive=ORTE_TRUE;
-  csChange->cdrCodec.buffer=NULL;
-  debug(31,10) ("ORTEPublicationCreate: add CSChange\n");
-  CSTWriterAddCSChange(d,&d->writerPublications,csChange);
+  csChange = (CSChange *)MALLOC(sizeof(CSChange));
+  parameterUpdateCSChangeFromPublication(csChange, pp);
+  csChange->guid = guid;
+  csChange->alive = ORTE_TRUE;
+  csChange->cdrCodec.buffer = NULL;
+  debug(31, 10) ("ORTEPublicationCreate: add CSChange\n");
+  CSTWriterAddCSChange(d, &d->writerPublications, csChange);
   pthread_rwlock_unlock(&d->writerPublications.lock);
   pthread_rwlock_unlock(&d->publications.lock);
-  pthread_rwlock_unlock(&d->typeEntry.lock);    
+  pthread_rwlock_unlock(&d->typeEntry.lock);
   pthread_rwlock_unlock(&d->objectEntry.htimRootLock);
   pthread_rwlock_unlock(&d->objectEntry.objRootLock);
-  debug(31,10) ("ORTEPublicationCreate: finished\n");
+  debug(31, 10) ("ORTEPublicationCreate: finished\n");
   return cstWriter;
 }
 
 /*****************************************************************************/
 int
-ORTEPublicationDestroy(ORTEPublication *cstWriter) {
+ORTEPublicationDestroy(ORTEPublication *cstWriter)
+{
   CSChange              *csChange;
 
-  if (!cstWriter) return ORTE_BAD_HANDLE;
+  if (!cstWriter)
+    return ORTE_BAD_HANDLE;
   //generate csChange for writerPublisher
   pthread_rwlock_wrlock(&cstWriter->domain->objectEntry.objRootLock);
   pthread_rwlock_wrlock(&cstWriter->domain->objectEntry.htimRootLock);
   pthread_rwlock_wrlock(&cstWriter->domain->writerPublications.lock);
-  if (cstWriter->objectEntryOID->sendCallBack!=NULL) {  
+  if (cstWriter->objectEntryOID->sendCallBack != NULL) {
     eventDetach(cstWriter->domain,
-        cstWriter->objectEntryOID->objectEntryAID,
-        &cstWriter->objectEntryOID->sendCallBackDelayTimer,
-        0);
+               cstWriter->objectEntryOID->objectEntryAID,
+               &cstWriter->objectEntryOID->sendCallBackDelayTimer,
+               0);
   }
-  csChange=(CSChange*)MALLOC(sizeof(CSChange));
+  csChange = (CSChange *)MALLOC(sizeof(CSChange));
   CSChangeAttributes_init_head(csChange);
-  csChange->cdrCodec.buffer=NULL;
-  csChange->guid=cstWriter->guid;
-  csChange->alive=ORTE_FALSE;
+  csChange->cdrCodec.buffer = NULL;
+  csChange->guid = cstWriter->guid;
+  csChange->alive = ORTE_FALSE;
   CSTWriterAddCSChange(cstWriter->domain,
-                       &cstWriter->domain->writerPublications,
-                       csChange);
+                      &cstWriter->domain->writerPublications,
+                      csChange);
   pthread_rwlock_unlock(&cstWriter->domain->writerPublications.lock);
   pthread_rwlock_unlock(&cstWriter->domain->objectEntry.htimRootLock);
   pthread_rwlock_unlock(&cstWriter->domain->objectEntry.objRootLock);
@@ -162,11 +167,13 @@ ORTEPublicationDestroy(ORTEPublication *cstWriter) {
 
 /*****************************************************************************/
 int
-ORTEPublicationPropertiesGet(ORTEPublication *cstWriter,ORTEPublProp *pp) {
-  if (!cstWriter) return ORTE_BAD_HANDLE;
+ORTEPublicationPropertiesGet(ORTEPublication *cstWriter, ORTEPublProp *pp)
+{
+  if (!cstWriter)
+    return ORTE_BAD_HANDLE;
   pthread_rwlock_rdlock(&cstWriter->domain->objectEntry.objRootLock);
   pthread_rwlock_rdlock(&cstWriter->lock);
-  *pp=*(ORTEPublProp*)cstWriter->objectEntryOID->attributes;
+  *pp = *(ORTEPublProp *)cstWriter->objectEntryOID->attributes;
   pthread_rwlock_unlock(&cstWriter->lock);
   pthread_rwlock_unlock(&cstWriter->domain->objectEntry.objRootLock);
   return ORTE_OK;
@@ -174,21 +181,23 @@ ORTEPublicationPropertiesGet(ORTEPublication *cstWriter,ORTEPublProp *pp) {
 
 /*****************************************************************************/
 int
-ORTEPublicationPropertiesSet(ORTEPublication *cstWriter,ORTEPublProp *pp) {
+ORTEPublicationPropertiesSet(ORTEPublication *cstWriter, ORTEPublProp *pp)
+{
   CSChange              *csChange;
 
-  if (!cstWriter) return ORTE_BAD_HANDLE;
+  if (!cstWriter)
+    return ORTE_BAD_HANDLE;
   pthread_rwlock_wrlock(&cstWriter->domain->objectEntry.objRootLock);
   pthread_rwlock_wrlock(&cstWriter->domain->objectEntry.htimRootLock);
   pthread_rwlock_wrlock(&cstWriter->domain->writerPublications.lock);
   pthread_rwlock_rdlock(&cstWriter->lock);
-  csChange=(CSChange*)MALLOC(sizeof(CSChange));
-  parameterUpdateCSChangeFromPublication(csChange,pp);
-  csChange->guid=cstWriter->guid;
-  csChange->alive=ORTE_TRUE;
-  csChange->cdrCodec.buffer=NULL;
+  csChange = (CSChange *)MALLOC(sizeof(CSChange));
+  parameterUpdateCSChangeFromPublication(csChange, pp);
+  csChange->guid = cstWriter->guid;
+  csChange->alive = ORTE_TRUE;
+  csChange->cdrCodec.buffer = NULL;
   CSTWriterAddCSChange(cstWriter->domain,
-      &cstWriter->domain->writerPublications,csChange);
+                      &cstWriter->domain->writerPublications, csChange);
   pthread_rwlock_unlock(&cstWriter->lock);
   pthread_rwlock_unlock(&cstWriter->domain->writerPublications.lock);
   pthread_rwlock_unlock(&cstWriter->domain->objectEntry.htimRootLock);
@@ -198,39 +207,43 @@ ORTEPublicationPropertiesSet(ORTEPublication *cstWriter,ORTEPublProp *pp) {
 
 /*****************************************************************************/
 int
-ORTEPublicationWaitForSubscriptions(ORTEPublication *cstWriter,NtpTime wait,
-    unsigned int retries,unsigned int noSubscriptions) {
+ORTEPublicationWaitForSubscriptions(ORTEPublication *cstWriter, NtpTime wait,
+                                   unsigned int retries, unsigned int noSubscriptions)
+{
   unsigned int rSubscriptions;
-  uint32_t sec,ms;
+  uint32_t sec, ms;
 
-  if (!cstWriter) return ORTE_BAD_HANDLE;
-  NtpTimeDisAssembToMs(sec,ms,wait);
+  if (!cstWriter)
+    return ORTE_BAD_HANDLE;
+  NtpTimeDisAssembToMs(sec, ms, wait);
   do {
     pthread_rwlock_rdlock(&cstWriter->domain->objectEntry.objRootLock);
     pthread_rwlock_rdlock(&cstWriter->lock);
-    rSubscriptions=cstWriter->cstRemoteReaderCounter;
+    rSubscriptions = cstWriter->cstRemoteReaderCounter;
     pthread_rwlock_unlock(&cstWriter->lock);
     pthread_rwlock_unlock(&cstWriter->domain->objectEntry.objRootLock);
-    if (rSubscriptions>=noSubscriptions)
+    if (rSubscriptions >= noSubscriptions)
       return ORTE_OK;
     ORTESleepMs(sec*1000+ms);
   } while (retries--);
-  return ORTE_TIMEOUT;  
+  return ORTE_TIMEOUT;
 }
 
 /*****************************************************************************/
 int
-ORTEPublicationGetStatus(ORTEPublication *cstWriter,ORTEPublStatus *status) {
+ORTEPublicationGetStatus(ORTEPublication *cstWriter, ORTEPublStatus *status)
+{
   CSChange *csChange;
 
-  if (!cstWriter) return ORTE_BAD_HANDLE;
+  if (!cstWriter)
+    return ORTE_BAD_HANDLE;
   pthread_rwlock_rdlock(&cstWriter->domain->objectEntry.objRootLock);
   pthread_rwlock_rdlock(&cstWriter->lock);
-  status->strict=cstWriter->strictReliableCounter;
-  status->bestEffort=cstWriter->bestEffortsCounter;
-  status->issues=0;
-  ul_list_for_each(CSTWriterCSChange,cstWriter,csChange)
-    status->issues++;
+  status->strict = cstWriter->strictReliableCounter;
+  status->bestEffort = cstWriter->bestEffortsCounter;
+  status->issues = 0;
+  ul_list_for_each(CSTWriterCSChange, cstWriter, csChange)
+  status->issues++;
   pthread_rwlock_unlock(&cstWriter->lock);
   pthread_rwlock_unlock(&cstWriter->domain->objectEntry.objRootLock);
   return ORTE_OK;
@@ -238,38 +251,40 @@ ORTEPublicationGetStatus(ORTEPublication *cstWriter,ORTEPublStatus *status) {
 
 /*****************************************************************************/
 int
-ORTEPublicationPrepareQueue(ORTEPublication *cstWriter) {
+ORTEPublicationPrepareQueue(ORTEPublication *cstWriter)
+{
   ORTEPublProp          *pp;
-  
-  if (!cstWriter) return ORTE_BAD_HANDLE;
+
+  if (!cstWriter)
+    return ORTE_BAD_HANDLE;
   pthread_rwlock_wrlock(&cstWriter->lock);
-  pp=(ORTEPublProp*)cstWriter->objectEntryOID->attributes;
-  if (cstWriter->csChangesCounter>=pp->sendQueueSize) {
+  pp = (ORTEPublProp *)cstWriter->objectEntryOID->attributes;
+  if (cstWriter->csChangesCounter >= pp->sendQueueSize) {
     if (!CSTWriterTryDestroyBestEffortIssue(cstWriter)) {
-      NtpTime             expire,atime=getActualNtpTime();
-      struct timespec     wtime; 
+      NtpTime             expire, atime = getActualNtpTime();
+      struct timespec     wtime;
       //count max block time
-      NtpTimeAdd(expire,atime,cstWriter->domain->domainProp.baseProp.maxBlockTime);
-      NtpTimeDisAssembToUs(wtime.tv_sec,wtime.tv_nsec,expire);
-      wtime.tv_nsec*=1000;  //conver to nano seconds
-      while(cstWriter->csChangesCounter>=pp->sendQueueSize) {
-        pthread_rwlock_unlock(&cstWriter->lock);    
-        //wait till a message will be processed
-        pthread_mutex_lock(&cstWriter->mutexCSChangeDestroyed);
-        if (cstWriter->condValueCSChangeDestroyed==0) {
-          if (pthread_cond_timedwait(&cstWriter->condCSChangeDestroyed,
-                                &cstWriter->mutexCSChangeDestroyed,
-                                &wtime)==ETIMEDOUT) {
-            debug(31,5) ("Publication: queue level (%d), queue full!!!\n",
-                          cstWriter->csChangesCounter);
-            pthread_mutex_unlock(&cstWriter->mutexCSChangeDestroyed);
-            pthread_rwlock_unlock(&cstWriter->lock);
-            return ORTE_QUEUE_FULL;
+      NtpTimeAdd(expire, atime, cstWriter->domain->domainProp.baseProp.maxBlockTime);
+      NtpTimeDisAssembToUs(wtime.tv_sec, wtime.tv_nsec, expire);
+      wtime.tv_nsec *= 1000;  //conver to nano seconds
+      while (cstWriter->csChangesCounter >= pp->sendQueueSize) {
+       pthread_rwlock_unlock(&cstWriter->lock);
+       //wait till a message will be processed
+       pthread_mutex_lock(&cstWriter->mutexCSChangeDestroyed);
+       if (cstWriter->condValueCSChangeDestroyed == 0) {
+         if (pthread_cond_timedwait(&cstWriter->condCSChangeDestroyed,
+                                    &cstWriter->mutexCSChangeDestroyed,
+                                    &wtime) == ETIMEDOUT) {
+           debug(31, 5) ("Publication: queue level (%d), queue full!!!\n",
+                         cstWriter->csChangesCounter);
+           pthread_mutex_unlock(&cstWriter->mutexCSChangeDestroyed);
+           pthread_rwlock_unlock(&cstWriter->lock);
+           return ORTE_QUEUE_FULL;
          }
-        }
-        cstWriter->condValueCSChangeDestroyed=0;
-        pthread_mutex_unlock(&cstWriter->mutexCSChangeDestroyed);
-        pthread_rwlock_wrlock(&cstWriter->lock);    
+       }
+       cstWriter->condValueCSChangeDestroyed = 0;
+       pthread_mutex_unlock(&cstWriter->mutexCSChangeDestroyed);
+       pthread_rwlock_wrlock(&cstWriter->lock);
       }
     }
   }
@@ -280,77 +295,79 @@ ORTEPublicationPrepareQueue(ORTEPublication *cstWriter) {
 /*****************************************************************************/
 int
 ORTEPublicationSendLocked(ORTEPublication *cstWriter,
-    ORTEPublicationSendParam *psp) {
+                         ORTEPublicationSendParam *psp)
+{
   CSChange              *csChange;
   SequenceNumber        snNext;
-  int                  max_size;
-  
-  if (!cstWriter) return ORTE_BAD_HANDLE;
-  pthread_rwlock_rdlock(&cstWriter->domain->typeEntry.lock);    
+  int                   max_size;
+
+  if (!cstWriter)
+    return ORTE_BAD_HANDLE;
+  pthread_rwlock_rdlock(&cstWriter->domain->typeEntry.lock);
   pthread_rwlock_wrlock(&cstWriter->domain->writerPublications.lock);
   if (!CSTRemoteReader_is_empty(cstWriter)) {
     ORTEGetMaxSizeParam gms;
 
-    csChange=(CSChange*)MALLOC(sizeof(CSChange));
+    csChange = (CSChange *)MALLOC(sizeof(CSChange));
     CSChangeAttributes_init_head(csChange);
-    csChange->guid=cstWriter->guid;
-    csChange->alive=ORTE_FALSE;
+    csChange->guid = cstWriter->guid;
+    csChange->alive = ORTE_FALSE;
     CDR_codec_init_static(&csChange->cdrCodec);
     csChange->cdrCodec.data_endian = FLAG_ENDIANNESS;
 
     if (psp) {
       csChange->cdrCodec.data_endian = psp->data_endian;
-      cstWriter->objectEntryOID->instance=psp->instance;
+      cstWriter->objectEntryOID->instance = psp->instance;
     }
 
     /* determine maximal size */
-    gms.host_endian=csChange->cdrCodec.host_endian;
-    gms.data_endian=csChange->cdrCodec.data_endian;
-    gms.data=cstWriter->objectEntryOID->instance;
-    gms.max_size=cstWriter->typeRegister->maxSize;
-    gms.recv_size=-1;
-    gms.csize=0;
+    gms.host_endian = csChange->cdrCodec.host_endian;
+    gms.data_endian = csChange->cdrCodec.data_endian;
+    gms.data = cstWriter->objectEntryOID->instance;
+    gms.max_size = cstWriter->typeRegister->maxSize;
+    gms.recv_size = -1;
+    gms.csize = 0;
     if (cstWriter->typeRegister->getMaxSize)
-      max_size=cstWriter->typeRegister->getMaxSize(&gms,1);
+      max_size = cstWriter->typeRegister->getMaxSize(&gms, 1);
     else
-      max_size=cstWriter->typeRegister->maxSize;
-    
+      max_size = cstWriter->typeRegister->maxSize;
+
     /* prepare csChange */
     CDR_buffer_init(&csChange->cdrCodec,
-                   RTPS_HEADER_LENGTH+12+20+max_size);     //HEADER+INFO_TS+ISSUE
-    csChange->cdrCodec.wptr_max=
-       cstWriter->domain->domainProp.wireProp.userBytesPerPacket;
+                   RTPS_HEADER_LENGTH+12+20+max_size);     //HEADER+INFO_TS+ISSUE
+    csChange->cdrCodec.wptr_max =
+      cstWriter->domain->domainProp.wireProp.userBytesPerPacket;
 
     /* SN for next issue */
-    SeqNumberInc(snNext,cstWriter->lastSN);
+    SeqNumberInc(snNext, cstWriter->lastSN);
 
     /* prepare data */
     RTPSHeaderCreate(&csChange->cdrCodec,
-                     cstWriter->domain->guid.hid,cstWriter->domain->guid.aid);
+                    cstWriter->domain->guid.hid, cstWriter->domain->guid.aid);
     RTPSInfoTSCreate(&csChange->cdrCodec,
-                     getActualNtpTime());
-    RTPSIssueCreateHeader(&csChange->cdrCodec,16+max_size,
-                    OID_UNKNOWN,cstWriter->guid.oid,snNext);
+                    getActualNtpTime());
+    RTPSIssueCreateHeader(&csChange->cdrCodec, 16+max_size,
+                         OID_UNKNOWN, cstWriter->guid.oid, snNext);
 
     //serialization routine
     if (cstWriter->typeRegister->serialize) {
       cstWriter->typeRegister->serialize(
-          &csChange->cdrCodec,
-          cstWriter->objectEntryOID->instance);
+       &csChange->cdrCodec,
+       cstWriter->objectEntryOID->instance);
     } else {
       //no deserialization -> memcpy
       CDR_buffer_puts(&csChange->cdrCodec,
-                     cstWriter->objectEntryOID->instance,max_size);
+                     cstWriter->objectEntryOID->instance, max_size);
     }
 
-    debug(31,10) ("ORTEPublicationCreate: message length:%d, sn(low):%u\n",
-                   max_size,snNext.low);
-                 
+    debug(31, 10) ("ORTEPublicationCreate: message length:%d, sn(low):%u\n",
+                  max_size, snNext.low);
+
     CSTWriterAddCSChange(cstWriter->domain,
-                        cstWriter,
-                        csChange);
+                        cstWriter,
+                        csChange);
   }
-  pthread_rwlock_unlock(&cstWriter->domain->typeEntry.lock);    
+  pthread_rwlock_unlock(&cstWriter->domain->typeEntry.lock);
   pthread_rwlock_unlock(&cstWriter->domain->writerPublications.lock);
   return ORTE_OK;
 }
@@ -358,19 +375,21 @@ ORTEPublicationSendLocked(ORTEPublication *cstWriter,
 /*****************************************************************************/
 int
 ORTEPublicationSendEx(ORTEPublication *cstWriter,
-    ORTEPublicationSendParam *psp) {
+                     ORTEPublicationSendParam *psp)
+{
   int             r;
 
-  if (!cstWriter) return ORTE_BAD_HANDLE;
+  if (!cstWriter)
+    return ORTE_BAD_HANDLE;
   //prepare sending queue
-  r=ORTEPublicationPrepareQueue(cstWriter);
-  if (r<0) 
+  r = ORTEPublicationPrepareQueue(cstWriter);
+  if (r < 0)
     return r;
   //send
   pthread_rwlock_wrlock(&cstWriter->domain->objectEntry.objRootLock);
   pthread_rwlock_wrlock(&cstWriter->domain->objectEntry.htimRootLock);
   pthread_rwlock_wrlock(&cstWriter->lock);
-  r=ORTEPublicationSendLocked(cstWriter,psp);
+  r = ORTEPublicationSendLocked(cstWriter, psp);
   pthread_rwlock_unlock(&cstWriter->lock);
   pthread_rwlock_unlock(&cstWriter->domain->objectEntry.htimRootLock);
   pthread_rwlock_unlock(&cstWriter->domain->objectEntry.objRootLock);
@@ -379,13 +398,15 @@ ORTEPublicationSendEx(ORTEPublication *cstWriter,
 
 /*****************************************************************************/
 inline int
-ORTEPublicationSend(ORTEPublication *cstWriter) {
-  return ORTEPublicationSendEx(cstWriter,NULL);
+ORTEPublicationSend(ORTEPublication *cstWriter)
+{
+  return ORTEPublicationSendEx(cstWriter, NULL);
 }
 
 
 /*****************************************************************************/
 inline void *
-ORTEPublicationGetInstance(ORTEPublication *cstWriter) {
+ORTEPublicationGetInstance(ORTEPublication *cstWriter)
+{
   return cstWriter->objectEntryOID->instance;
 }
index d024276c8387d3846e290dda32b1deb1fc4cfa91..45b7da6d326a164e00c905bb2fa73511e768ff49 100644 (file)
@@ -3,63 +3,64 @@
  *
  *  DEBUG:  section 32                  Publication Timer
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
 /*****************************************************************************/
 int
-PublicationCallBackTimer(ORTEDomain *d,void *vcstWriter) {
-  CSTWriter        *cstWriter=(CSTWriter*)vcstWriter;
+PublicationCallBackTimer(ORTEDomain *d, void *vcstWriter)
+{
+  CSTWriter        *cstWriter = (CSTWriter *)vcstWriter;
   ORTEPublProp     *pp;
-  ORTESendInfo     info;  
-  
-  pp=(ORTEPublProp*)cstWriter->objectEntryOID->attributes;
+  ORTESendInfo     info;
+
+  pp = (ORTEPublProp *)cstWriter->objectEntryOID->attributes;
   CSTWriterTryDestroyBestEffortIssue(cstWriter);
 
-  if (cstWriter->csChangesCounter<pp->sendQueueSize) {
-    info.status=NEED_DATA;
-    info.topic=(char*)pp->topic;
-    info.type=(char*)pp->typeName;
-    info.senderGUID=cstWriter->objectEntryOID->guid;
+  if (cstWriter->csChangesCounter < pp->sendQueueSize) {
+    info.status = NEED_DATA;
+    info.topic = (char *)pp->topic;
+    info.type = (char *)pp->typeName;
+    info.senderGUID = cstWriter->objectEntryOID->guid;
     cstWriter->objectEntryOID->sendCallBack(&info,
-                          cstWriter->objectEntryOID->instance,
-                          cstWriter->objectEntryOID->callBackParam);
-    ORTEPublicationSendLocked(cstWriter,NULL);
+                                           cstWriter->objectEntryOID->instance,
+                                           cstWriter->objectEntryOID->callBackParam);
+    ORTEPublicationSendLocked(cstWriter, NULL);
   }
 
   eventAdd(d,
-      cstWriter->objectEntryOID->objectEntryAID,
-      &cstWriter->objectEntryOID->sendCallBackDelayTimer,
-      0,   
-      "PublicationCallBackTimer",
-      PublicationCallBackTimer,
-      &cstWriter->lock,
-      cstWriter,
-      &cstWriter->objectEntryOID->sendCallBackDelay);               
+          cstWriter->objectEntryOID->objectEntryAID,
+          &cstWriter->objectEntryOID->sendCallBackDelayTimer,
+          0,
+          "PublicationCallBackTimer",
+          PublicationCallBackTimer,
+          &cstWriter->lock,
+          cstWriter,
+          &cstWriter->objectEntryOID->sendCallBackDelay);
   return 0;
 }
index 3cbc8596a20b7cea3902b2940291f4110e5e18ee..1c076f9257f067a6533c701548adfdbe31765c1b 100644 (file)
  *
  *  DEBUG:  section 33                  Functions working over subscription
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
-GAVL_CUST_NODE_INT_IMP(SubscriptionList, 
-                       PSEntry, ObjectEntryOID, GUID_RTPS,
-                       subscriptions, psNode, guid, gavl_cmp_guid);
+GAVL_CUST_NODE_INT_IMP(SubscriptionList,
+                      PSEntry, ObjectEntryOID, GUID_RTPS,
+                      subscriptions, psNode, guid, gavl_cmp_guid);
 
 /*****************************************************************************/
-ORTESubscription * 
-ORTESubscriptionCreate(ORTEDomain *d,SubscriptionMode mode,SubscriptionType sType,
-    const char *topic,const char *typeName,void *instance,NtpTime *deadline,
-    NtpTime *minimumSeparation,ORTERecvCallBack recvCallBack,
-    void *recvCallBackParam, IPAddress multicastIPAddress) {
+ORTESubscription *
+ORTESubscriptionCreate(ORTEDomain *d, SubscriptionMode mode, SubscriptionType sType,
+                      const char *topic, const char *typeName, void *instance, NtpTime *deadline,
+                      NtpTime *minimumSeparation, ORTERecvCallBack recvCallBack,
+                      void *recvCallBackParam, IPAddress multicastIPAddress)
+{
   GUID_RTPS             guid;
   CSTReader             *cstReader;
   CSTReaderParams       cstReaderParams;
   ORTESubsProp          *sp;
-  ObjectEntryOID        *objectEntryOID;   
+  ObjectEntryOID        *objectEntryOID;
   CSChange              *csChange;
   TypeNode              *typeNode;
-  
-  cstReader=(CSTReader*)MALLOC(sizeof(CSTReader));
-  if (!cstReader) return NULL;
+
+  cstReader = (CSTReader *)MALLOC(sizeof(CSTReader));
+  if (!cstReader)
+    return NULL;
   pthread_rwlock_wrlock(&d->objectEntry.objRootLock);
   pthread_rwlock_wrlock(&d->objectEntry.htimRootLock);
-  pthread_rwlock_rdlock(&d->typeEntry.lock);    
-  if (!(typeNode=ORTEType_find(&d->typeEntry,&typeName))) {
-    pthread_rwlock_unlock(&d->typeEntry.lock);    
+  pthread_rwlock_rdlock(&d->typeEntry.lock);
+  if (!(typeNode = ORTEType_find(&d->typeEntry, &typeName))) {
+    pthread_rwlock_unlock(&d->typeEntry.lock);
     pthread_rwlock_unlock(&d->objectEntry.objRootLock);
     pthread_rwlock_unlock(&d->objectEntry.htimRootLock);
     printf("before call ORTESubscriptionCreateBestEffort is necessary to register \n\
             ser./deser. function for a given typeName!!!\n");
     FREE(cstReader);
     return NULL;
-  }  
+  }
   pthread_rwlock_wrlock(&d->subscriptions.lock);
   // join to multicast group
   if (IN_MULTICAST(multicastIPAddress)) {
     char sIPAddress[MAX_STRING_IPADDRESS_LENGTH];
     struct ip_mreq mreq;
 
-    mreq.imr_multiaddr.s_addr=htonl(multicastIPAddress);
-    mreq.imr_interface.s_addr=htonl(INADDR_ANY);
-    if(sock_setsockopt(&d->taskRecvMulticastUserdata.sock,IPPROTO_IP,
-         IP_ADD_MEMBERSHIP, (const char *)&mreq, sizeof(mreq))>=0) {
-        debug(33,2) ("ORTESubscriptionCreate: listening to mgroup %s\n",
-                      IPAddressToString(multicastIPAddress,sIPAddress));
+    mreq.imr_multiaddr.s_addr = htonl(multicastIPAddress);
+    mreq.imr_interface.s_addr = htonl(INADDR_ANY);
+    if (sock_setsockopt(&d->taskRecvMulticastUserdata.sock, IPPROTO_IP,
+                       IP_ADD_MEMBERSHIP, (const char *)&mreq, sizeof(mreq)) >= 0) {
+      debug(33, 2) ("ORTESubscriptionCreate: listening to mgroup %s\n",
+                   IPAddressToString(multicastIPAddress, sIPAddress));
     }
   }
   //generate new guid of publisher
   d->subscriptions.counter++;
-  guid.hid=d->guid.hid;guid.aid=d->guid.aid;
-  guid.oid=(d->subscriptions.counter<<8)|OID_SUBSCRIPTION;
-  sp=(ORTESubsProp*)MALLOC(sizeof(ORTESubsProp));
-  memcpy(sp,&d->domainProp.subsPropDefault,sizeof(ORTESubsProp));
-  strcpy((char *)sp->topic,topic);
-  strcpy((char *)sp->typeName,typeName);
-  sp->deadline=*deadline;
-  sp->minimumSeparation=*minimumSeparation;
-  sp->multicast=multicastIPAddress;
+  guid.hid = d->guid.hid;
+  guid.aid = d->guid.aid;
+  guid.oid = (d->subscriptions.counter<<8)|OID_SUBSCRIPTION;
+  sp = (ORTESubsProp *)MALLOC(sizeof(ORTESubsProp));
+  memcpy(sp, &d->domainProp.subsPropDefault, sizeof(ORTESubsProp));
+  strcpy((char *)sp->topic, topic);
+  strcpy((char *)sp->typeName, typeName);
+  sp->deadline = *deadline;
+  sp->minimumSeparation = *minimumSeparation;
+  sp->multicast = multicastIPAddress;
   switch (sType) {
     case BEST_EFFORTS:
-      sp->reliabilityRequested=PID_VALUE_RELIABILITY_BEST_EFFORTS;
+      sp->reliabilityRequested = PID_VALUE_RELIABILITY_BEST_EFFORTS;
       break;
     case STRICT_RELIABLE:
-      sp->reliabilityRequested=PID_VALUE_RELIABILITY_STRICT;
+      sp->reliabilityRequested = PID_VALUE_RELIABILITY_STRICT;
       break;
   }
-  sp->mode=mode;
+  sp->mode = mode;
   //insert object to structure objectEntry
-  objectEntryOID=objectEntryAdd(d,&guid,(void*)sp);
-  objectEntryOID->privateCreated=ORTE_TRUE;
-  objectEntryOID->instance=instance;
-  objectEntryOID->recvCallBack=recvCallBack;
-  objectEntryOID->callBackParam=recvCallBackParam;
+  objectEntryOID = objectEntryAdd(d, &guid, (void *)sp);
+  objectEntryOID->privateCreated = ORTE_TRUE;
+  objectEntryOID->instance = instance;
+  objectEntryOID->recvCallBack = recvCallBack;
+  objectEntryOID->callBackParam = recvCallBackParam;
   //create writerSubscription
-  cstReaderParams.delayResponceTimeMin=zNtpTime;
-  cstReaderParams.delayResponceTimeMax=zNtpTime;
-  cstReaderParams.ACKMaxRetries=d->domainProp.baseProp.ACKMaxRetries;
-  cstReaderParams.repeatActiveQueryTime=iNtpTime;
-  cstReaderParams.fullAcknowledge=ORTE_FALSE;      
-  CSTReaderInit(d,cstReader,objectEntryOID,guid.oid,&cstReaderParams,
-                &typeNode->typeRegister);
+  cstReaderParams.delayResponceTimeMin = zNtpTime;
+  cstReaderParams.delayResponceTimeMax = zNtpTime;
+  cstReaderParams.ACKMaxRetries = d->domainProp.baseProp.ACKMaxRetries;
+  cstReaderParams.repeatActiveQueryTime = iNtpTime;
+  cstReaderParams.fullAcknowledge = ORTE_FALSE;
+  CSTReaderInit(d, cstReader, objectEntryOID, guid.oid, &cstReaderParams,
+               &typeNode->typeRegister);
   //insert cstWriter to list of subscriberes
-  CSTReader_insert(&d->subscriptions,cstReader);
+  CSTReader_insert(&d->subscriptions, cstReader);
   //generate csChange for writerSubscriberes
   pthread_rwlock_wrlock(&d->writerSubscriptions.lock);
-  csChange=(CSChange*)MALLOC(sizeof(CSChange));
-  parameterUpdateCSChangeFromSubscription(csChange,sp);
-  csChange->guid=guid;
-  csChange->alive=ORTE_TRUE;
+  csChange = (CSChange *)MALLOC(sizeof(CSChange));
+  parameterUpdateCSChangeFromSubscription(csChange, sp);
+  csChange->guid = guid;
+  csChange->alive = ORTE_TRUE;
   CDR_codec_init_static(&csChange->cdrCodec);
-  CSTWriterAddCSChange(d,&d->writerSubscriptions,csChange);
+  CSTWriterAddCSChange(d, &d->writerSubscriptions, csChange);
   pthread_rwlock_unlock(&d->writerSubscriptions.lock);
   pthread_rwlock_unlock(&d->subscriptions.lock);
-  pthread_rwlock_unlock(&d->typeEntry.lock);    
+  pthread_rwlock_unlock(&d->typeEntry.lock);
   pthread_rwlock_unlock(&d->objectEntry.objRootLock);
   pthread_rwlock_unlock(&d->objectEntry.htimRootLock);
 
@@ -132,33 +135,38 @@ ORTESubscriptionCreate(ORTEDomain *d,SubscriptionMode mode,SubscriptionType sTyp
 
 /*****************************************************************************/
 int
-ORTESubscriptionDestroyLocked(ORTESubscription *cstReader) {
+ORTESubscriptionDestroyLocked(ORTESubscription *cstReader)
+{
   CSChange              *csChange;
-  
-  if (!cstReader) return ORTE_BAD_HANDLE;
+
+  if (!cstReader)
+    return ORTE_BAD_HANDLE;
   pthread_rwlock_wrlock(&cstReader->domain->writerSubscriptions.lock);
-  csChange=(CSChange*)MALLOC(sizeof(CSChange));
+  csChange = (CSChange *)MALLOC(sizeof(CSChange));
   CSChangeAttributes_init_head(csChange);
-  csChange->guid=cstReader->guid;
-  csChange->alive=ORTE_FALSE;
-  csChange->cdrCodec.buffer=NULL;
+  csChange->guid = cstReader->guid;
+  csChange->alive = ORTE_FALSE;
+  csChange->cdrCodec.buffer = NULL;
   CSTWriterAddCSChange(cstReader->domain,
-                       &cstReader->domain->writerSubscriptions,
-                       csChange);
+                      &cstReader->domain->writerSubscriptions,
+                      csChange);
   pthread_rwlock_unlock(&cstReader->domain->writerSubscriptions.lock);
   return ORTE_OK;
 }
 
 /*****************************************************************************/
 int
-ORTESubscriptionDestroy(ORTESubscription *cstReader) {
+ORTESubscriptionDestroy(ORTESubscription *cstReader)
+{
   int r;
-  if (!cstReader) return ORTE_BAD_HANDLE;
+
+  if (!cstReader)
+    return ORTE_BAD_HANDLE;
   //generate csChange for writerSubscriptions
   pthread_rwlock_rdlock(&cstReader->domain->objectEntry.objRootLock);
   pthread_rwlock_wrlock(&cstReader->domain->objectEntry.htimRootLock);
   pthread_rwlock_wrlock(&cstReader->lock);
-  r=ORTESubscriptionDestroyLocked(cstReader);
+  r = ORTESubscriptionDestroyLocked(cstReader);
   pthread_rwlock_unlock(&cstReader->lock);
   pthread_rwlock_unlock(&cstReader->domain->objectEntry.htimRootLock);
   pthread_rwlock_unlock(&cstReader->domain->objectEntry.objRootLock);
@@ -168,11 +176,13 @@ ORTESubscriptionDestroy(ORTESubscription *cstReader) {
 
 /*****************************************************************************/
 int
-ORTESubscriptionPropertiesGet(ORTESubscription *cstReader,ORTESubsProp *sp) {
-  if (!cstReader) return ORTE_BAD_HANDLE;
+ORTESubscriptionPropertiesGet(ORTESubscription *cstReader, ORTESubsProp *sp)
+{
+  if (!cstReader)
+    return ORTE_BAD_HANDLE;
   pthread_rwlock_rdlock(&cstReader->domain->objectEntry.objRootLock);
   pthread_rwlock_rdlock(&cstReader->lock);
-  *sp=*(ORTESubsProp*)cstReader->objectEntryOID->attributes;
+  *sp = *(ORTESubsProp *)cstReader->objectEntryOID->attributes;
   pthread_rwlock_unlock(&cstReader->lock);
   pthread_rwlock_unlock(&cstReader->domain->objectEntry.objRootLock);
   return ORTE_OK;
@@ -180,21 +190,23 @@ ORTESubscriptionPropertiesGet(ORTESubscription *cstReader,ORTESubsProp *sp) {
 
 /*****************************************************************************/
 int
-ORTESubscriptionPropertiesSet(ORTESubscription *cstReader,ORTESubsProp *sp) {
+ORTESubscriptionPropertiesSet(ORTESubscription *cstReader, ORTESubsProp *sp)
+{
   CSChange              *csChange;
 
-  if (!cstReader) return ORTE_BAD_HANDLE;
+  if (!cstReader)
+    return ORTE_BAD_HANDLE;
   pthread_rwlock_rdlock(&cstReader->domain->objectEntry.objRootLock);
   pthread_rwlock_wrlock(&cstReader->domain->objectEntry.htimRootLock);
   pthread_rwlock_wrlock(&cstReader->domain->writerSubscriptions.lock);
   pthread_rwlock_rdlock(&cstReader->lock);
-  csChange=(CSChange*)MALLOC(sizeof(CSChange));
-  parameterUpdateCSChangeFromSubscription(csChange,sp);
-  csChange->guid=cstReader->guid;
-  csChange->alive=ORTE_TRUE;
-  csChange->cdrCodec.buffer=NULL;
+  csChange = (CSChange *)MALLOC(sizeof(CSChange));
+  parameterUpdateCSChangeFromSubscription(csChange, sp);
+  csChange->guid = cstReader->guid;
+  csChange->alive = ORTE_TRUE;
+  csChange->cdrCodec.buffer = NULL;
   CSTWriterAddCSChange(cstReader->domain,
-      &cstReader->domain->writerSubscriptions,csChange);
+                      &cstReader->domain->writerSubscriptions, csChange);
   pthread_rwlock_unlock(&cstReader->lock);
   pthread_rwlock_unlock(&cstReader->domain->writerSubscriptions.lock);
   pthread_rwlock_unlock(&cstReader->domain->objectEntry.htimRootLock);
@@ -204,39 +216,43 @@ ORTESubscriptionPropertiesSet(ORTESubscription *cstReader,ORTESubsProp *sp) {
 
 /*****************************************************************************/
 int
-ORTESubscriptionWaitForPublications(ORTESubscription *cstReader,NtpTime wait,
-    unsigned int retries,unsigned int noPublications) {
+ORTESubscriptionWaitForPublications(ORTESubscription *cstReader, NtpTime wait,
+                                   unsigned int retries, unsigned int noPublications)
+{
   unsigned int wPublications;
-  uint32_t sec,ms;
+  uint32_t sec, ms;
 
-  if (!cstReader) return ORTE_BAD_HANDLE;
-  NtpTimeDisAssembToMs(sec,ms,wait);
+  if (!cstReader)
+    return ORTE_BAD_HANDLE;
+  NtpTimeDisAssembToMs(sec, ms, wait);
   do {
     pthread_rwlock_rdlock(&cstReader->domain->objectEntry.objRootLock);
     pthread_rwlock_rdlock(&cstReader->lock);
-    wPublications=cstReader->cstRemoteWriterCounter;
+    wPublications = cstReader->cstRemoteWriterCounter;
     pthread_rwlock_unlock(&cstReader->lock);
     pthread_rwlock_unlock(&cstReader->domain->objectEntry.objRootLock);
-    if (wPublications>=noPublications)
+    if (wPublications >= noPublications)
       return ORTE_OK;
     ORTESleepMs(sec*1000+ms);
   } while (retries--);
-  return ORTE_TIMEOUT;  
+  return ORTE_TIMEOUT;
 }
 
 /*****************************************************************************/
 int
-ORTESubscriptionGetStatus(ORTESubscription *cstReader,ORTESubsStatus *status) {
+ORTESubscriptionGetStatus(ORTESubscription *cstReader, ORTESubsStatus *status)
+{
   CSChange *csChange;
 
-  if (!cstReader) return ORTE_BAD_HANDLE;
+  if (!cstReader)
+    return ORTE_BAD_HANDLE;
   pthread_rwlock_rdlock(&cstReader->domain->objectEntry.objRootLock);
   pthread_rwlock_rdlock(&cstReader->lock);
-  status->strict=cstReader->strictReliableCounter;
-  status->bestEffort=cstReader->bestEffortsCounter;
-  status->issues=0;
-  ul_list_for_each(CSTReaderCSChange,cstReader,csChange)
-    status->issues++;
+  status->strict = cstReader->strictReliableCounter;
+  status->bestEffort = cstReader->bestEffortsCounter;
+  status->issues = 0;
+  ul_list_for_each(CSTReaderCSChange, cstReader, csChange)
+  status->issues++;
   pthread_rwlock_unlock(&cstReader->lock);
   pthread_rwlock_unlock(&cstReader->domain->objectEntry.objRootLock);
   return ORTE_OK;
@@ -244,35 +260,37 @@ ORTESubscriptionGetStatus(ORTESubscription *cstReader,ORTESubsStatus *status) {
 
 /*****************************************************************************/
 int
-ORTESubscriptionPull(ORTESubscription *cstReader) {
+ORTESubscriptionPull(ORTESubscription *cstReader)
+{
   ORTESubsProp         *sp;
   ORTERecvInfo         info;
   NtpTime              timeNext;
-  
-  if (!cstReader) return ORTE_BAD_HANDLE;
+
+  if (!cstReader)
+    return ORTE_BAD_HANDLE;
   pthread_rwlock_rdlock(&cstReader->domain->objectEntry.objRootLock);
   pthread_rwlock_wrlock(&cstReader->domain->objectEntry.htimRootLock);
   pthread_rwlock_rdlock(&cstReader->domain->writerSubscriptions.lock);
   pthread_rwlock_wrlock(&cstReader->lock);
-  sp=(ORTESubsProp*)cstReader->objectEntryOID->attributes;
-  if ((sp->mode==PULLED) && 
+  sp = (ORTESubsProp *)cstReader->objectEntryOID->attributes;
+  if ((sp->mode == PULLED) &&
       (cstReader->objectEntryOID->recvCallBack)) {
     if (NtpTimeCmp(
-          getActualNtpTime(),
-          htimerUnicastCommon_get_expire(&cstReader->deadlineTimer))>=0) {
-      memset(&info,0,sizeof(info));
-      info.status=DEADLINE;
-      info.topic=(char*)sp->topic;
-      info.type=(char*)sp->typeName;
+         getActualNtpTime(),
+         htimerUnicastCommon_get_expire(&cstReader->deadlineTimer)) >= 0) {
+      memset(&info, 0, sizeof(info));
+      info.status = DEADLINE;
+      info.topic = (char *)sp->topic;
+      info.type = (char *)sp->typeName;
       cstReader->objectEntryOID->recvCallBack(&info,
-          cstReader->objectEntryOID->instance,
-          cstReader->objectEntryOID->callBackParam);
+                                             cstReader->objectEntryOID->instance,
+                                             cstReader->objectEntryOID->callBackParam);
       NtpTimeAdd(timeNext,
-                (getActualNtpTime()),
-                sp->deadline);
-      htimerUnicastCommon_set_expire(&cstReader->deadlineTimer,timeNext);
+                (getActualNtpTime()),
+                sp->deadline);
+      htimerUnicastCommon_set_expire(&cstReader->deadlineTimer, timeNext);
     }
-    CSTReaderProcCSChangesIssue(cstReader->cstRemoteWriterSubscribed,ORTE_TRUE);
+    CSTReaderProcCSChangesIssue(cstReader->cstRemoteWriterSubscribed, ORTE_TRUE);
   }
   pthread_rwlock_unlock(&cstReader->lock);
   pthread_rwlock_unlock(&cstReader->domain->writerSubscriptions.lock);
@@ -284,7 +302,7 @@ ORTESubscriptionPull(ORTESubscription *cstReader) {
 
 /*****************************************************************************/
 inline void *
-ORTESubscriptionGetInstance(ORTESubscription *cstReader) {
+ORTESubscriptionGetInstance(ORTESubscription *cstReader)
+{
   return cstReader->objectEntryOID->instance;
 }
-
index 4c0b7f484f5b8aac30fc121d13120df7a1c9c177..0639abe459529c2ea2b5a54065759c9a222e1452 100644 (file)
@@ -1,39 +1,40 @@
 /*
- *  $Id: ORTEThreadUtils.c,v 0.0.0.1    2003/08/21 
+ *  $Id: ORTEThreadUtils.c,v 0.0.0.1    2003/08/21
  *
  *  DEBUG:  section 25                   Thread utility
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
 /*****************************************************************************/
 void
-ORTEDomainWakeUpReceivingThread(ORTEDomain *d,sock_t *sock,uint16_t port) {
+ORTEDomainWakeUpReceivingThread(ORTEDomain *d, sock_t *sock, uint16_t port)
+{
   struct sockaddr_in    des;
   char                  sIPAddress[MAX_STRING_IPADDRESS_LENGTH];
   int                   i;
@@ -41,36 +42,34 @@ ORTEDomainWakeUpReceivingThread(ORTEDomain *d,sock_t *sock,uint16_t port) {
   des.sin_family = AF_INET;
   des.sin_port = htons(port);             //to receiving port
   if (d->domainProp.IFCount) {
-    for(i=0;i<d->domainProp.IFCount;i++) {
-      des.sin_addr.s_addr=htonl(d->domainProp.IFProp[i].ipAddress);
-      sock_sendto(sock,&i,1,&des,sizeof(des));
-      debug(25,2) ("Sent wake up signal to: %s.%d\n",
-                    IPAddressToString(ntohl(des.sin_addr.s_addr),sIPAddress),
-      port);
+    for (i = 0; i < d->domainProp.IFCount; i++) {
+      des.sin_addr.s_addr = htonl(d->domainProp.IFProp[i].ipAddress);
+      sock_sendto(sock, &i, 1, &des, sizeof(des));
+      debug(25, 2) ("Sent wake up signal to: %s.%d\n",
+                   IPAddressToString(ntohl(des.sin_addr.s_addr), sIPAddress),
+                   port);
     }
   } else {
     des.sin_addr.s_addr = inet_addr("127.0.0.1"); //local IPAddress
-    sock_sendto(sock,&i,1,&des,sizeof(des));
-    debug(25,2) ("Sent wake up signal to: %s.%d\n",
-                  IPAddressToString(ntohl(des.sin_addr.s_addr),sIPAddress),
-                  port);
+    sock_sendto(sock, &i, 1, &des, sizeof(des));
+    debug(25, 2) ("Sent wake up signal to: %s.%d\n",
+                 IPAddressToString(ntohl(des.sin_addr.s_addr), sIPAddress),
+                 port);
   }
 }
 
 /*****************************************************************************/
 void
-ORTEDomainWakeUpSendingThread(ObjectEntry *objectEntry) {
-  debug(25,10) ("WakeUpSendingThread : start\n");
+ORTEDomainWakeUpSendingThread(ObjectEntry *objectEntry)
+{
+  debug(25, 10) ("WakeUpSendingThread : start\n");
   if (objectEntry->htimNeedWakeUp) {
     pthread_mutex_lock(&objectEntry->htimSendMutex);
-    if (objectEntry->htimSendCondValue==0) {
-      debug(25,8) ("WakeUpSendingThread : send wakeup signal\n");
+    if (objectEntry->htimSendCondValue == 0) {
+      debug(25, 8) ("WakeUpSendingThread : send wakeup signal\n");
       pthread_cond_signal(&objectEntry->htimSendCond);
-      objectEntry->htimSendCondValue=1;
+      objectEntry->htimSendCondValue = 1;
     }
     pthread_mutex_unlock(&objectEntry->htimSendMutex);
   }
 }
-
-
-
index d46086a7b9bb7bfe4eff2fbc9eb26f3f11c488ea..93e2918cd3a2304cbf4b577ba3ee2303ad6a64c0 100644 (file)
 /*
- *  $Id: ORTETypeRegister.c,v 0.0.0.1   2003/08/21 
+ *  $Id: ORTETypeRegister.c,v 0.0.0.1   2003/08/21
  *
  *  DEBUG:  section 26                  Type register
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
 GAVL_CUST_NODE_INT_IMP(ORTEType, TypeEntry, TypeNode, const char *,
-    types, node, typeRegister.typeName, gavl_cmp_str)
-    
+                      types, node, typeRegister.typeName, gavl_cmp_str)
+
 
 /*****************************************************************************/
 Boolean
-ORTETypeRegisterFind(ORTEDomain *d,const char *typeName) {
-  Boolean            result=ORTE_FALSE;
-  
-  if (!d) 
+ORTETypeRegisterFind(ORTEDomain *d, const char *typeName)
+{
+  Boolean            result = ORTE_FALSE;
+
+  if (!d)
     return ORTE_FALSE;  //bat handle
 
-  pthread_rwlock_rdlock(&d->typeEntry.lock);    
-  if (ORTEType_find(&d->typeEntry,&typeName)) 
-    result=ORTE_TRUE;
-  pthread_rwlock_unlock(&d->typeEntry.lock);    
+  pthread_rwlock_rdlock(&d->typeEntry.lock);
+  if (ORTEType_find(&d->typeEntry, &typeName))
+    result = ORTE_TRUE;
+  pthread_rwlock_unlock(&d->typeEntry.lock);
   return result;
 }
 
 /*****************************************************************************/
 int
-ORTETypeRegisterAdd(ORTEDomain *d,const char *typeName,ORTETypeSerialize ts,
-                    ORTETypeDeserialize ds,ORTETypeGetMaxSize gms,unsigned int ms) {
+ORTETypeRegisterAdd(ORTEDomain *d, const char *typeName, ORTETypeSerialize ts,
+                   ORTETypeDeserialize ds, ORTETypeGetMaxSize gms, unsigned int ms)
+{
   TypeNode           *tn;
-  
-  if (!d) 
+
+  if (!d)
     return ORTE_BAD_HANDLE;       //bat handle
 
   if (gms) {
-    if (d->domainProp.wireProp.userBytesPerPacket<ms) 
+    if (d->domainProp.wireProp.userBytesPerPacket < ms)
       return -2;
   }
 
-  pthread_rwlock_wrlock(&d->typeEntry.lock);    
-  tn=ORTEType_find(&d->typeEntry,&typeName);
+  pthread_rwlock_wrlock(&d->typeEntry.lock);
+  tn = ORTEType_find(&d->typeEntry, &typeName);
   if (!tn) {
-    tn=(TypeNode*)MALLOC(sizeof(TypeNode));
-    tn->typeRegister.typeName=(char*)MALLOC(strlen(typeName)+1);
+    tn = (TypeNode *)MALLOC(sizeof(TypeNode));
+    tn->typeRegister.typeName = (char *)MALLOC(strlen(typeName)+1);
     if (tn->typeRegister.typeName) {
-      memcpy((void*)tn->typeRegister.typeName, 
-            typeName, 
+      memcpy((void *)tn->typeRegister.typeName,
+            typeName,
             strlen(typeName) + 1);
-    }    
-    ORTEType_insert(&d->typeEntry,tn);
-    debug(26,3) ("ORTETypeRegisterAdd: created\n");
+    }
+    ORTEType_insert(&d->typeEntry, tn);
+    debug(26, 3) ("ORTETypeRegisterAdd: created\n");
   }
-  tn->typeRegister.serialize=ts;
-  tn->typeRegister.deserialize=ds;
-  tn->typeRegister.getMaxSize=gms;
-  tn->typeRegister.maxSize=ms;
-  pthread_rwlock_unlock(&d->typeEntry.lock);    
-  debug(26,3) ("ORTETypeRegisterAdd: registered type:%s\n",typeName);
+  tn->typeRegister.serialize = ts;
+  tn->typeRegister.deserialize = ds;
+  tn->typeRegister.getMaxSize = gms;
+  tn->typeRegister.maxSize = ms;
+  pthread_rwlock_unlock(&d->typeEntry.lock);
+  debug(26, 3) ("ORTETypeRegisterAdd: registered type:%s\n", typeName);
   return ORTE_OK;
 }
 
 /*****************************************************************************/
 int
-ORTETypeRegisterDestroyAll(ORTEDomain *d) {
+ORTETypeRegisterDestroyAll(ORTEDomain *d)
+{
   TypeNode           *tn;
-  
-  if (!d) 
+
+  if (!d)
     return ORTE_BAD_HANDLE;  //bat handle
 
-  pthread_rwlock_wrlock(&d->typeEntry.lock);    
-  while((tn=ORTEType_cut_first(&d->typeEntry))) {
-    FREE((char*)tn->typeRegister.typeName);
+  pthread_rwlock_wrlock(&d->typeEntry.lock);
+  while ((tn = ORTEType_cut_first(&d->typeEntry))) {
+    FREE((char *)tn->typeRegister.typeName);
     FREE(tn);
   }
-  pthread_rwlock_unlock(&d->typeEntry.lock);    
+  pthread_rwlock_unlock(&d->typeEntry.lock);
   return ORTE_OK;
 }
-
-
-
-
-
index 7e44b951a02c390c9683188a11ae18055d9fbfce..fd10b1e72c9bd96caf9666b6a3a9b014ff5332a8 100644 (file)
@@ -1,49 +1,46 @@
 /*
- *  $Id: ORTEVerbosity.c,v 0.0.0.1  2003/08/21 
+ *  $Id: ORTEVerbosity.c,v 0.0.0.1  2003/08/21
  *
- *  DEBUG:  section 27                  Verbosity function                  
+ *  DEBUG:  section 27                  Verbosity function
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
 /*****************************************************************************/
-inline void 
-ORTEVerbositySetOptions(const char *options) {
+inline void
+ORTEVerbositySetOptions(const char *options)
+{
   debug_options(options);
 }
 
 /*****************************************************************************/
-inline void 
-ORTEVerbositySetLogFile(const char *logfile) {
+inline void
+ORTEVerbositySetLogFile(const char *logfile)
+{
   debug_open_log(logfile);
 }
-
-
-
-
-
index aae5de6a7cc2105de236c12a60325943fde6ac0a..0f61346841e7b66f7911b76079905359a9332243 100644 (file)
 /*
- *  $Id: RTPSAck.c,v 0.0.0.1            2003/10/07 
+ *  $Id: RTPSAck.c,v 0.0.0.1            2003/10/07
  *
  *  DEBUG:  section 47                  RTPS message ACK
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
 /**********************************************************************************/
 int
 RTPSAckCreate(CDR_Codec *cdrCodec,
-    SequenceNumber *seqNumber,
-    ObjectId roid,ObjectId woid,Boolean f_bit) 
+             SequenceNumber *seqNumber,
+             ObjectId roid, ObjectId woid, Boolean f_bit)
 {
-  SequenceNumber     sn_tmp;                    
+  SequenceNumber     sn_tmp;
   CDR_Endianness     data_endian;
-  CORBA_octet       flags;
+  CORBA_octet        flags;
 
-  if (cdrCodec->buf_len<cdrCodec->wptr+28) return -1;
+  if (cdrCodec->buf_len < cdrCodec->wptr+28)
+    return -1;
 
   /* submessage id */
-  CDR_put_octet(cdrCodec,ACK);
+  CDR_put_octet(cdrCodec, ACK);
 
   /* flags */
-  flags=cdrCodec->data_endian;
-  if (f_bit) flags|=2;
-  CDR_put_octet(cdrCodec,flags);
+  flags = cdrCodec->data_endian;
+  if (f_bit)
+    flags |= 2;
+  CDR_put_octet(cdrCodec, flags);
 
   /* length */
-  CDR_put_ushort(cdrCodec,24);
+  CDR_put_ushort(cdrCodec, 24);
 
   /* next data are sent in big endianing */
-  data_endian=cdrCodec->data_endian;
-  cdrCodec->data_endian=FLAG_BIG_ENDIAN;
+  data_endian = cdrCodec->data_endian;
+  cdrCodec->data_endian = FLAG_BIG_ENDIAN;
 
   /* readerObjectId */
-  CDR_put_ulong(cdrCodec,roid);
-  
+  CDR_put_ulong(cdrCodec, roid);
+
   /* writerObjectId */
-  CDR_put_ulong(cdrCodec,woid);
+  CDR_put_ulong(cdrCodec, woid);
 
-  cdrCodec->data_endian=data_endian;
+  cdrCodec->data_endian = data_endian;
 
-  SeqNumberInc(sn_tmp,*seqNumber);
+  SeqNumberInc(sn_tmp, *seqNumber);
 
   /* SeqNumber */
-  CDR_put_ulong(cdrCodec,sn_tmp.high);
-  CDR_put_ulong(cdrCodec,sn_tmp.low);
+  CDR_put_ulong(cdrCodec, sn_tmp.high);
+  CDR_put_ulong(cdrCodec, sn_tmp.low);
 
   /* bitmap - bits */
-  CDR_put_ulong(cdrCodec,32);
-  CDR_put_ulong(cdrCodec,0);
+  CDR_put_ulong(cdrCodec, 32);
+  CDR_put_ulong(cdrCodec, 0);
 
   return 28;
-} 
+}
 
 /**********************************************************************************/
-void 
-RTPSAck(ORTEDomain *d,CDR_Codec *cdrCodec,MessageInterpret *mi,IPAddress senderIPAddress) {
+void
+RTPSAck(ORTEDomain *d, CDR_Codec *cdrCodec, MessageInterpret *mi, IPAddress senderIPAddress)
+{
   GUID_RTPS          readerGUID;
-  CSTWriter          *cstWriter=NULL;
+  CSTWriter          *cstWriter = NULL;
   CSTRemoteReader    *cstRemoteReader;
   CSChangeForReader  *csChangeForReader;
   StateMachineSend   stateMachineSendNew;
-  ObjectId          roid,woid;
-  SequenceNumber     sn,isn;   
-  char               queue=1;
+  ObjectId           roid, woid;
+  SequenceNumber     sn, isn;
+  char               queue = 1;
   CDR_Endianness     data_endian;
-  CORBA_octet       flags;
-  char              f_bit;
+  CORBA_octet        flags;
+  char               f_bit;
 
   /* restore flag possition in submessage */
-  cdrCodec->rptr-=3;
+  cdrCodec->rptr -= 3;
 
   /* flags */
   CDR_get_octet(cdrCodec, (CORBA_octet *)&flags);
-  f_bit=flags & 2;
+  f_bit = flags & 2;
 
   /* move reading possition to begin of submessage */
-  cdrCodec->rptr+=2;
+  cdrCodec->rptr += 2;
 
   /* next data are sent in big endianing */
-  data_endian=cdrCodec->data_endian;
-  cdrCodec->data_endian=FLAG_BIG_ENDIAN;
+  data_endian = cdrCodec->data_endian;
+  cdrCodec->data_endian = FLAG_BIG_ENDIAN;
 
   /* readerObjectId */
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&roid);
-  
+
   /* writerObjectId */
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&woid);
 
-  cdrCodec->data_endian=data_endian;
+  cdrCodec->data_endian = data_endian;
 
   /* SeqNumber */
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&sn.high);
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&sn.low);
 
-  readerGUID.hid=mi->sourceHostId;
-  readerGUID.aid=mi->sourceAppId;
-  readerGUID.oid=roid;
+  readerGUID.hid = mi->sourceHostId;
+  readerGUID.aid = mi->sourceAppId;
+  readerGUID.oid = roid;
+
+  debug(47, 3) ("recv: RTPS ACK%c(0x%x) from 0x%x-0x%x\n",
+               f_bit ? 'F' : 'f',
+               woid, mi->sourceHostId, mi->sourceAppId);
 
-  debug(47,3) ("recv: RTPS ACK%c(0x%x) from 0x%x-0x%x\n",
-                f_bit ? 'F':'f',
-                woid,mi->sourceHostId,mi->sourceAppId);
-  
   /* Manager */
-  if ((d->guid.aid & 0x03)==MANAGER) {
+  if ((d->guid.aid & 0x03) == MANAGER) {
     switch (woid) {
       case OID_WRITE_APPSELF:
-        pthread_rwlock_wrlock(&d->writerApplicationSelf.lock);
-        cstWriter=&d->writerApplicationSelf;
-        readerGUID.hid=senderIPAddress;
-        readerGUID.aid=AID_UNKNOWN;
-        readerGUID.oid=roid;
-        eventDetach(d,
-           cstWriter->objectEntryOID->objectEntryAID,
-           &cstWriter->registrationTimer,
-           0);   //common timer
-        break;
+       pthread_rwlock_wrlock(&d->writerApplicationSelf.lock);
+       cstWriter = &d->writerApplicationSelf;
+       readerGUID.hid = senderIPAddress;
+       readerGUID.aid = AID_UNKNOWN;
+       readerGUID.oid = roid;
+       eventDetach(d,
+                   cstWriter->objectEntryOID->objectEntryAID,
+                   &cstWriter->registrationTimer,
+                   0); //common timer
+       break;
       case OID_WRITE_MGR:
-        pthread_rwlock_wrlock(&d->writerManagers.lock);
-        cstWriter=&d->writerManagers;
-        break;
+       pthread_rwlock_wrlock(&d->writerManagers.lock);
+       cstWriter = &d->writerManagers;
+       break;
       case OID_WRITE_APP:
-        pthread_rwlock_wrlock(&d->writerApplications.lock);
-        cstWriter=&d->writerApplications;
-        break;
+       pthread_rwlock_wrlock(&d->writerApplications.lock);
+       cstWriter = &d->writerApplications;
+       break;
     }
   }
 
   /* Application */
-  if ((d->guid.aid & 0x03)==MANAGEDAPPLICATION) {
+  if ((d->guid.aid & 0x03) == MANAGEDAPPLICATION) {
     switch (roid) {
       case OID_READ_APP:
       case OID_READ_APPSELF:
-        pthread_rwlock_wrlock(&d->writerApplicationSelf.lock);
-        cstWriter=&d->writerApplicationSelf;
-        eventDetach(d,
-           cstWriter->objectEntryOID->objectEntryAID,
-           &cstWriter->registrationTimer,
-           0);   //common timer
-        break;
+       pthread_rwlock_wrlock(&d->writerApplicationSelf.lock);
+       cstWriter = &d->writerApplicationSelf;
+       eventDetach(d,
+                   cstWriter->objectEntryOID->objectEntryAID,
+                   &cstWriter->registrationTimer,
+                   0); //common timer
+       break;
       case OID_READ_PUBL:
-        pthread_rwlock_wrlock(&d->writerPublications.lock);
-        cstWriter=&d->writerPublications;
-        break;
+       pthread_rwlock_wrlock(&d->writerPublications.lock);
+       cstWriter = &d->writerPublications;
+       break;
       case OID_READ_SUBS:
-        pthread_rwlock_wrlock(&d->writerSubscriptions.lock);
-        cstWriter=&d->writerSubscriptions;
-        break;
+       pthread_rwlock_wrlock(&d->writerSubscriptions.lock);
+       cstWriter = &d->writerSubscriptions;
+       break;
       default:
-        if ((woid & 0x07) == OID_PUBLICATION) {
-          GUID_RTPS  guid=d->guid;
-          guid.oid=woid;
-          pthread_rwlock_rdlock(&d->publications.lock);
-          cstWriter=CSTWriter_find(&d->publications,&guid);
-          pthread_rwlock_wrlock(&cstWriter->lock);
-          queue=2;
-        }
-        break;
+       if ((woid & 0x07) == OID_PUBLICATION) {
+         GUID_RTPS  guid = d->guid;
+         guid.oid = woid;
+         pthread_rwlock_rdlock(&d->publications.lock);
+         cstWriter = CSTWriter_find(&d->publications, &guid);
+         pthread_rwlock_wrlock(&cstWriter->lock);
+         queue = 2;
+       }
+       break;
     }
   }
 
   if (!cstWriter) {
-    if ((woid & 0x07) == OID_PUBLICATION) 
+    if ((woid & 0x07) == OID_PUBLICATION)
       pthread_rwlock_unlock(&d->publications.lock);
     return;
   }
-  cstRemoteReader=CSTRemoteReader_find(cstWriter,&readerGUID);
+  cstRemoteReader = CSTRemoteReader_find(cstWriter, &readerGUID);
   if (!cstRemoteReader) {
     pthread_rwlock_unlock(&cstWriter->lock);
-    if ((woid & 0x07) == OID_PUBLICATION) 
+    if ((woid & 0x07) == OID_PUBLICATION)
       pthread_rwlock_unlock(&d->publications.lock);
     return;
   }
 
-  stateMachineSendNew=NOTHNIGTOSEND;
-  csChangeForReader=CSChangeForReader_first(cstRemoteReader);
-  while(csChangeForReader) {
-    isn=csChangeForReader->csChange->sn;
-    if (SeqNumberCmp(csChangeForReader->csChange->gapSN,noneSN)>0) {
-      SeqNumberAdd(isn,csChangeForReader->csChange->sn,csChangeForReader->csChange->gapSN);
-      SeqNumberDec(isn,isn);
+  stateMachineSendNew = NOTHNIGTOSEND;
+  csChangeForReader = CSChangeForReader_first(cstRemoteReader);
+  while (csChangeForReader) {
+    isn = csChangeForReader->csChange->sn;
+    if (SeqNumberCmp(csChangeForReader->csChange->gapSN, noneSN) > 0) {
+      SeqNumberAdd(isn, csChangeForReader->csChange->sn, csChangeForReader->csChange->gapSN);
+      SeqNumberDec(isn, isn);
     }
-    if (SeqNumberCmp(isn,sn)<0)   {   //ACK
-      if (csChangeForReader->commStateChFReader!=ACKNOWLEDGED) {
-        CSChangeForReader *csChangeForReaderDestroyed;
-        csChangeForReaderDestroyed=csChangeForReader;
-        csChangeForReader->commStateChFReader=ACKNOWLEDGED;
-        csChangeForReader=
-          CSChangeForReader_next(cstRemoteReader,csChangeForReader);
-        if ((woid & 0x07) == OID_PUBLICATION) {
-          CSTWriterDestroyCSChangeForReader(
-            csChangeForReaderDestroyed,ORTE_TRUE);
-        }
+    if (SeqNumberCmp(isn, sn) < 0) {     //ACK
+      if (csChangeForReader->commStateChFReader != ACKNOWLEDGED) {
+       CSChangeForReader *csChangeForReaderDestroyed;
+       csChangeForReaderDestroyed = csChangeForReader;
+       csChangeForReader->commStateChFReader = ACKNOWLEDGED;
+       csChangeForReader =
+         CSChangeForReader_next(cstRemoteReader, csChangeForReader);
+       if ((woid & 0x07) == OID_PUBLICATION) {
+         CSTWriterDestroyCSChangeForReader(
+           csChangeForReaderDestroyed, ORTE_TRUE);
+       }
       } else {
-        csChangeForReader=
-          CSChangeForReader_next(cstRemoteReader,csChangeForReader);
+       csChangeForReader =
+         CSChangeForReader_next(cstRemoteReader, csChangeForReader);
       }
     } else {                                                      //NACK
-      if (csChangeForReader->commStateChFReader!=TOSEND) {
-        csChangeForReader->commStateChFReader=TOSEND;
-        cstRemoteReader->commStateToSentCounter++;
+      if (csChangeForReader->commStateChFReader != TOSEND) {
+       csChangeForReader->commStateChFReader = TOSEND;
+       cstRemoteReader->commStateToSentCounter++;
       }
-      stateMachineSendNew=MUSTSENDDATA;
-      csChangeForReader=
-        CSChangeForReader_next(cstRemoteReader,csChangeForReader);
+      stateMachineSendNew = MUSTSENDDATA;
+      csChangeForReader =
+       CSChangeForReader_next(cstRemoteReader, csChangeForReader);
     }
   }
 
-  if ((cstRemoteReader->commStateSend==NOTHNIGTOSEND) && 
-      (stateMachineSendNew==MUSTSENDDATA)) {
-    cstRemoteReader->commStateSend=stateMachineSendNew;
+  if ((cstRemoteReader->commStateSend == NOTHNIGTOSEND) &&
+      (stateMachineSendNew == MUSTSENDDATA)) {
+    cstRemoteReader->commStateSend = stateMachineSendNew;
     eventDetach(d,
-        cstRemoteReader->sobject->objectEntryAID,
-        &cstRemoteReader->delayResponceTimer,
-        queue);
-    if (queue==1) {
+               cstRemoteReader->sobject->objectEntryAID,
+               &cstRemoteReader->delayResponceTimer,
+               queue);
+    if (queue == 1) {
       eventAdd(d,
-          cstRemoteReader->sobject->objectEntryAID,
-          &cstRemoteReader->delayResponceTimer,
-          queue,   //metatraffic timer
-          "CSTWriterSendTimer",
-          CSTWriterSendTimer,
-          &cstRemoteReader->cstWriter->lock,
-          cstRemoteReader,
-          &cstRemoteReader->cstWriter->params.delayResponceTime);               
+              cstRemoteReader->sobject->objectEntryAID,
+              &cstRemoteReader->delayResponceTimer,
+              queue, //metatraffic timer
+              "CSTWriterSendTimer",
+              CSTWriterSendTimer,
+              &cstRemoteReader->cstWriter->lock,
+              cstRemoteReader,
+              &cstRemoteReader->cstWriter->params.delayResponceTime);
     } else {
       eventAdd(d,
-          cstRemoteReader->sobject->objectEntryAID,
-          &cstRemoteReader->delayResponceTimer,
-          queue,   //userdata timer
-          "CSTWriterSendStrictTimer",
-          CSTWriterSendStrictTimer,
-          &cstRemoteReader->cstWriter->lock,
-          cstRemoteReader,
-          &cstRemoteReader->cstWriter->params.delayResponceTime);               
+              cstRemoteReader->sobject->objectEntryAID,
+              &cstRemoteReader->delayResponceTimer,
+              queue, //userdata timer
+              "CSTWriterSendStrictTimer",
+              CSTWriterSendStrictTimer,
+              &cstRemoteReader->cstWriter->lock,
+              cstRemoteReader,
+              &cstRemoteReader->cstWriter->params.delayResponceTime);
     }
-  } 
+  }
 
-  if (stateMachineSendNew==NOTHNIGTOSEND) {
-    cstRemoteReader->commStateSend=NOTHNIGTOSEND;
-    if (queue==1) {
+  if (stateMachineSendNew == NOTHNIGTOSEND) {
+    cstRemoteReader->commStateSend = NOTHNIGTOSEND;
+    if (queue == 1) {
       eventDetach(d,
-          cstRemoteReader->sobject->objectEntryAID,
-          &cstRemoteReader->delayResponceTimer,
-          queue);
+                 cstRemoteReader->sobject->objectEntryAID,
+                 &cstRemoteReader->delayResponceTimer,
+                 queue);
     } else {
       eventDetach(d,
-          cstRemoteReader->sobject->objectEntryAID,
-          &cstRemoteReader->repeatAnnounceTimer,
-          queue);
+                 cstRemoteReader->sobject->objectEntryAID,
+                 &cstRemoteReader->repeatAnnounceTimer,
+                 queue);
     }
-  }  
+  }
 
-  if ((!f_bit) && (cstRemoteReader->commStateSend==NOTHNIGTOSEND)) {
-    cstRemoteReader->commStateHB=MUSTSENDHB;
+  if ((!f_bit) && (cstRemoteReader->commStateSend == NOTHNIGTOSEND)) {
+    cstRemoteReader->commStateHB = MUSTSENDHB;
     eventDetach(d,
-        cstRemoteReader->sobject->objectEntryAID,
-        &cstRemoteReader->delayResponceTimer,
-        queue);
-    if (queue==1) {
+               cstRemoteReader->sobject->objectEntryAID,
+               &cstRemoteReader->delayResponceTimer,
+               queue);
+    if (queue == 1) {
       eventAdd(d,
-          cstRemoteReader->sobject->objectEntryAID,
-          &cstRemoteReader->delayResponceTimer,
-          queue,   //metatraffic timer
-          "CSTWriterSendTimer",
-          CSTWriterSendTimer,
-          &cstRemoteReader->cstWriter->lock,
-          cstRemoteReader,
-          &cstRemoteReader->cstWriter->params.delayResponceTime);               
+              cstRemoteReader->sobject->objectEntryAID,
+              &cstRemoteReader->delayResponceTimer,
+              queue, //metatraffic timer
+              "CSTWriterSendTimer",
+              CSTWriterSendTimer,
+              &cstRemoteReader->cstWriter->lock,
+              cstRemoteReader,
+              &cstRemoteReader->cstWriter->params.delayResponceTime);
     } else {
       eventAdd(d,
-          cstRemoteReader->sobject->objectEntryAID,
-          &cstRemoteReader->delayResponceTimer,
-          queue,   //userdata timer
-          "CSTWriterSendStrictTimer",
-          CSTWriterSendStrictTimer,
-          &cstRemoteReader->cstWriter->lock,
-          cstRemoteReader,
-          &cstRemoteReader->cstWriter->params.delayResponceTime);               
+              cstRemoteReader->sobject->objectEntryAID,
+              &cstRemoteReader->delayResponceTimer,
+              queue, //userdata timer
+              "CSTWriterSendStrictTimer",
+              CSTWriterSendStrictTimer,
+              &cstRemoteReader->cstWriter->lock,
+              cstRemoteReader,
+              &cstRemoteReader->cstWriter->params.delayResponceTime);
     }
-  } 
+  }
 
   pthread_rwlock_unlock(&cstWriter->lock);
-  if ((woid & 0x07) == OID_PUBLICATION) 
+  if ((woid & 0x07) == OID_PUBLICATION)
     pthread_rwlock_unlock(&d->publications.lock);
-} 
-
-
+}
index 1745cf40dd4d09f4eb6749f03a94d1e76c13a180..dacafd474229d7253b908d71116a08e6a743601c 100644 (file)
 /*
- *  $Id: RTPSCSTReader.c,v 0.0.0.1      2003/09/13 
+ *  $Id: RTPSCSTReader.c,v 0.0.0.1      2003/09/13
  *
  *  DEBUG:  section 53                  CSTReader
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
-GAVL_CUST_NODE_INT_IMP(CSTReader, 
-                       CSTSubscriptions, CSTReader, GUID_RTPS,
-                       cstReader, node, guid, gavl_cmp_guid);
-GAVL_CUST_NODE_INT_IMP(CSTRemoteWriter, 
-                       CSTReader, CSTRemoteWriter, GUID_RTPS,
-                       cstRemoteWriter, node, guid, gavl_cmp_guid);
+GAVL_CUST_NODE_INT_IMP(CSTReader,
+                      CSTSubscriptions, CSTReader, GUID_RTPS,
+                      cstReader, node, guid, gavl_cmp_guid);
+GAVL_CUST_NODE_INT_IMP(CSTRemoteWriter,
+                      CSTReader, CSTRemoteWriter, GUID_RTPS,
+                      cstRemoteWriter, node, guid, gavl_cmp_guid);
 GAVL_CUST_NODE_INT_IMP(CSChangeFromWriter,
-                       CSTRemoteWriter, CSChangeFromWriter, SequenceNumber,
-                       csChangeFromWriter, node, csChange->sn, gavl_cmp_sn);
+                      CSTRemoteWriter, CSChangeFromWriter, SequenceNumber,
+                      csChangeFromWriter, node, csChange->sn, gavl_cmp_sn);
 
 /*****************************************************************************/
-void 
-CSTReaderInit(ORTEDomain *d,CSTReader *cstReader,ObjectEntryOID *object,
-    ObjectId oid,CSTReaderParams *params,ORTETypeRegister *typeRegister) {
+void
+CSTReaderInit(ORTEDomain *d, CSTReader *cstReader, ObjectEntryOID *object,
+             ObjectId oid, CSTReaderParams *params, ORTETypeRegister *typeRegister)
+{
 
-  debug(53,10) ("CSTReaderInit: start\n");
+  debug(53, 10) ("CSTReaderInit: start\n");
   //init values of cstReader
-  cstReader->guid.hid=object->objectEntryHID->hid;
-  cstReader->guid.aid=object->objectEntryAID->aid;
-  cstReader->guid.oid=oid;
-  cstReader->objectEntryOID=object;
-  memcpy(&cstReader->params,params,sizeof(CSTReaderParams));
-  cstReader->strictReliableCounter=0;
-  cstReader->bestEffortsCounter=0;
-  cstReader->cstRemoteWriterCounter=0;
-  cstReader->createdByPattern=ORTE_FALSE;
+  cstReader->guid.hid = object->objectEntryHID->hid;
+  cstReader->guid.aid = object->objectEntryAID->aid;
+  cstReader->guid.oid = oid;
+  cstReader->objectEntryOID = object;
+  memcpy(&cstReader->params, params, sizeof(CSTReaderParams));
+  cstReader->strictReliableCounter = 0;
+  cstReader->bestEffortsCounter = 0;
+  cstReader->cstRemoteWriterCounter = 0;
+  cstReader->createdByPattern = ORTE_FALSE;
   CSTReaderCSChange_init_head(cstReader);
   CSTRemoteWriter_init_root_field(cstReader);
-  pthread_rwlock_init(&cstReader->lock,NULL);
-  cstReader->domain=d;
-  cstReader->typeRegister=typeRegister;
+  pthread_rwlock_init(&cstReader->lock, NULL);
+  cstReader->domain = d;
+  cstReader->typeRegister = typeRegister;
   ul_htim_queue_init_detached(&cstReader->deadlineTimer.htim);
   ul_htim_queue_init_detached(&cstReader->persistenceTimer.htim);
-  cstReader->cstRemoteWriterSubscribed=NULL;
+  cstReader->cstRemoteWriterSubscribed = NULL;
   if ((oid & 0x07) == OID_SUBSCRIPTION) {
     ORTESubsProp *sp;
-    sp=(ORTESubsProp*)cstReader->objectEntryOID->attributes;
-    if (NtpTimeCmp(sp->deadline,zNtpTime)!=0) {
-      if (sp->mode==IMMEDIATE) {
-        eventAdd(d,
-            cstReader->objectEntryOID->objectEntryAID,
-            &cstReader->deadlineTimer,
-            0,   //common timer
-            "CSTReaderDeadlineTimer",
-            CSTReaderDeadlineTimer,
-            &cstReader->lock,
-            cstReader,
-            &sp->deadline);
+    sp = (ORTESubsProp *)cstReader->objectEntryOID->attributes;
+    if (NtpTimeCmp(sp->deadline, zNtpTime) != 0) {
+      if (sp->mode == IMMEDIATE) {
+       eventAdd(d,
+                cstReader->objectEntryOID->objectEntryAID,
+                &cstReader->deadlineTimer,
+                0, //common timer
+                "CSTReaderDeadlineTimer",
+                CSTReaderDeadlineTimer,
+                &cstReader->lock,
+                cstReader,
+                &sp->deadline);
       }
-      if (sp->mode==PULLED) {
-        NtpTime timeNext;
-        NtpTimeAdd(timeNext,
-                  (getActualNtpTime()),
-                  sp->deadline);
-        htimerUnicastCommon_set_expire(&cstReader->deadlineTimer,timeNext);
+      if (sp->mode == PULLED) {
+       NtpTime timeNext;
+       NtpTimeAdd(timeNext,
+                  (getActualNtpTime()),
+                  sp->deadline);
+       htimerUnicastCommon_set_expire(&cstReader->deadlineTimer, timeNext);
       }
     }
   }
-  debug(53,4) ("CSTReaderInit: 0x%x-0x%x-0x%x\n",
-                cstReader->guid.hid,
-                cstReader->guid.aid,
-                cstReader->guid.oid);
-  debug(53,10) ("CSTReaderInit: finished\n");
+  debug(53, 4) ("CSTReaderInit: 0x%x-0x%x-0x%x\n",
+               cstReader->guid.hid,
+               cstReader->guid.aid,
+               cstReader->guid.oid);
+  debug(53, 10) ("CSTReaderInit: finished\n");
 }
 
 /*****************************************************************************/
-void 
-CSTReaderDelete(ORTEDomain *d,CSTReader *cstReader) {
+void
+CSTReaderDelete(ORTEDomain *d, CSTReader *cstReader)
+{
   CSTRemoteWriter     *cstRemoteWriter;
-  
-  debug(53,10)("CSTReaderDelete: start\n");
-  debug(53,4) ("CSTReaderDelete: 0x%x-0x%x-0x%x\n",
-                cstReader->guid.hid,
-                cstReader->guid.aid,
-                cstReader->guid.oid);
+
+  debug(53, 10) ("CSTReaderDelete: start\n");
+  debug(53, 4) ("CSTReaderDelete: 0x%x-0x%x-0x%x\n",
+               cstReader->guid.hid,
+               cstReader->guid.aid,
+               cstReader->guid.oid);
   //Destroy all cstRemoteReader connected on cstWriter
-  while((cstRemoteWriter=CSTRemoteWriter_first(cstReader))) {
-    CSTReaderDestroyRemoteWriter(d,cstRemoteWriter);
-  }
+  while ((cstRemoteWriter = CSTRemoteWriter_first(cstReader)))
+    CSTReaderDestroyRemoteWriter(d, cstRemoteWriter);
   eventDetach(d,
-      cstReader->objectEntryOID->objectEntryAID,
-      &cstReader->deadlineTimer,
-      0);
+             cstReader->objectEntryOID->objectEntryAID,
+             &cstReader->deadlineTimer,
+             0);
   eventDetach(d,
-      cstReader->objectEntryOID->objectEntryAID,
-      &cstReader->persistenceTimer,
-      0);   //common timer
+             cstReader->objectEntryOID->objectEntryAID,
+             &cstReader->persistenceTimer,
+             0); //common timer
   pthread_rwlock_destroy(&cstReader->lock);
-  debug(53,10) ("CSTReaderDelete: finished\n");
+  debug(53, 10) ("CSTReaderDelete: finished\n");
 }
 
 /*****************************************************************************/
 CSTRemoteWriter *
-CSTReaderAddRemoteWriter(ORTEDomain *d,CSTReader *cstReader,ObjectEntryOID *object,
-    ObjectId oid) {
+CSTReaderAddRemoteWriter(ORTEDomain *d, CSTReader *cstReader, ObjectEntryOID *object,
+                        ObjectId oid)
+{
   CSTRemoteWriter     *cstRemoteWriter;
-  
+
   cstReader->cstRemoteWriterCounter++;
-  cstRemoteWriter=(CSTRemoteWriter*)MALLOC(sizeof(CSTRemoteWriter));
-  cstRemoteWriter->guid.hid=object->objectEntryHID->hid;
-  cstRemoteWriter->guid.aid=object->objectEntryAID->aid;
-  cstRemoteWriter->guid.oid=oid;
-  cstRemoteWriter->spobject=object;
-  cstRemoteWriter->cstReader=cstReader;
-  cstRemoteWriter->csChangesCounter=0;
-  cstRemoteWriter->ACKRetriesCounter=0;
-  cstRemoteWriter->commStateACK=WAITING;  
+  cstRemoteWriter = (CSTRemoteWriter *)MALLOC(sizeof(CSTRemoteWriter));
+  cstRemoteWriter->guid.hid = object->objectEntryHID->hid;
+  cstRemoteWriter->guid.aid = object->objectEntryAID->aid;
+  cstRemoteWriter->guid.oid = oid;
+  cstRemoteWriter->spobject = object;
+  cstRemoteWriter->cstReader = cstReader;
+  cstRemoteWriter->csChangesCounter = 0;
+  cstRemoteWriter->ACKRetriesCounter = 0;
+  cstRemoteWriter->commStateACK = WAITING;
   CSChangeFromWriter_init_root_field(cstRemoteWriter);
   SEQUENCE_NUMBER_NONE(cstRemoteWriter->sn);
   SEQUENCE_NUMBER_NONE(cstRemoteWriter->firstSN);
   SEQUENCE_NUMBER_NONE(cstRemoteWriter->lastSN);
   ul_htim_queue_init_detached(&cstRemoteWriter->delayResponceTimer.htim);
   ul_htim_queue_init_detached(&cstRemoteWriter->repeatActiveQueryTimer.htim);
-  CSTRemoteWriter_insert(cstReader,cstRemoteWriter);
+  CSTRemoteWriter_insert(cstReader, cstRemoteWriter);
   //add event for repeatActiveTime
-  if (NtpTimeCmp(cstReader->params.repeatActiveQueryTime,iNtpTime)!=0) {
+  if (NtpTimeCmp(cstReader->params.repeatActiveQueryTime, iNtpTime) != 0) {
     eventAdd(d,
-        cstRemoteWriter->spobject->objectEntryAID,
-        &cstRemoteWriter->repeatActiveQueryTimer,
-        1,   //metatraffic timer
-        "CSTReaderQueryTimer",
-        CSTReaderQueryTimer,
-        &cstRemoteWriter->cstReader->lock,
-        cstRemoteWriter,
-        NULL);               
+            cstRemoteWriter->spobject->objectEntryAID,
+            &cstRemoteWriter->repeatActiveQueryTimer,
+            1, //metatraffic timer
+            "CSTReaderQueryTimer",
+            CSTReaderQueryTimer,
+            &cstRemoteWriter->cstReader->lock,
+            cstRemoteWriter,
+            NULL);
   }
-  if ((cstReader->guid.oid & 0x07)==OID_SUBSCRIPTION) {
-    ORTEPublProp *pp=(ORTEPublProp*)object->attributes;
-    if ((pp->reliabilityOffered & PID_VALUE_RELIABILITY_STRICT)!=0)
+  if ((cstReader->guid.oid & 0x07) == OID_SUBSCRIPTION) {
+    ORTEPublProp *pp = (ORTEPublProp *)object->attributes;
+    if ((pp->reliabilityOffered & PID_VALUE_RELIABILITY_STRICT) != 0)
       cstReader->strictReliableCounter++;
     else {
-      if ((pp->reliabilityOffered & PID_VALUE_RELIABILITY_BEST_EFFORTS)!=0)
-        cstReader->bestEffortsCounter++;
+      if ((pp->reliabilityOffered & PID_VALUE_RELIABILITY_BEST_EFFORTS) != 0)
+       cstReader->bestEffortsCounter++;
     }
-  }  
-  debug(53,4) ("CSTReaderAddRemoteWriter: 0x%x-0x%x-0x%x\n",
-                cstRemoteWriter->guid.hid,
-                cstRemoteWriter->guid.aid,
-                cstRemoteWriter->guid.oid);
+  }
+  debug(53, 4) ("CSTReaderAddRemoteWriter: 0x%x-0x%x-0x%x\n",
+               cstRemoteWriter->guid.hid,
+               cstRemoteWriter->guid.aid,
+               cstRemoteWriter->guid.oid);
   return cstRemoteWriter;
 }
 
 /*****************************************************************************/
-void 
-CSTReaderDestroyRemoteWriter(ORTEDomain *d,CSTRemoteWriter *cstRemoteWriter) {
+void
+CSTReaderDestroyRemoteWriter(ORTEDomain *d, CSTRemoteWriter *cstRemoteWriter)
+{
   CSChangeFromWriter   *csChangeFromWriter;
-  
-  if (!cstRemoteWriter) return;
+
+  if (!cstRemoteWriter)
+    return;
   cstRemoteWriter->cstReader->cstRemoteWriterCounter--;
-  debug(53,4) ("CSTReaderDestroyRemoteWriter: 0x%x-0x%x-0x%x\n",
-                cstRemoteWriter->guid.hid,
-                cstRemoteWriter->guid.aid,
-                cstRemoteWriter->guid.oid);
-  if ((cstRemoteWriter->cstReader->guid.oid & 0x07)==OID_SUBSCRIPTION) {
+  debug(53, 4) ("CSTReaderDestroyRemoteWriter: 0x%x-0x%x-0x%x\n",
+               cstRemoteWriter->guid.hid,
+               cstRemoteWriter->guid.aid,
+               cstRemoteWriter->guid.oid);
+  if ((cstRemoteWriter->cstReader->guid.oid & 0x07) == OID_SUBSCRIPTION) {
     ORTEPublProp *pp;
-    pp=(ORTEPublProp*)cstRemoteWriter->spobject->attributes;
-    if ((pp->reliabilityOffered & PID_VALUE_RELIABILITY_STRICT)!=0)
+    pp = (ORTEPublProp *)cstRemoteWriter->spobject->attributes;
+    if ((pp->reliabilityOffered & PID_VALUE_RELIABILITY_STRICT) != 0)
       cstRemoteWriter->cstReader->strictReliableCounter++;
     else {
-      if ((pp->reliabilityOffered & PID_VALUE_RELIABILITY_BEST_EFFORTS)!=0)
-        cstRemoteWriter->cstReader->bestEffortsCounter++;
+      if ((pp->reliabilityOffered & PID_VALUE_RELIABILITY_BEST_EFFORTS) != 0)
+       cstRemoteWriter->cstReader->bestEffortsCounter++;
     }
   }
-  if (cstRemoteWriter->cstReader->cstRemoteWriterSubscribed==cstRemoteWriter)
-    cstRemoteWriter->cstReader->cstRemoteWriterSubscribed=NULL;
-  while((csChangeFromWriter=CSChangeFromWriter_first(cstRemoteWriter))) {
+  if (cstRemoteWriter->cstReader->cstRemoteWriterSubscribed == cstRemoteWriter)
+    cstRemoteWriter->cstReader->cstRemoteWriterSubscribed = NULL;
+  while ((csChangeFromWriter = CSChangeFromWriter_first(cstRemoteWriter)))
     CSTReaderDestroyCSChangeFromWriter(cstRemoteWriter,
-        csChangeFromWriter,ORTE_FALSE);
-  }
+                                      csChangeFromWriter, ORTE_FALSE);
   eventDetach(d,
-      cstRemoteWriter->spobject->objectEntryAID,
-      &cstRemoteWriter->delayResponceTimer,
-      1);   //metatraffic timer
+             cstRemoteWriter->spobject->objectEntryAID,
+             &cstRemoteWriter->delayResponceTimer,
+             1); //metatraffic timer
   eventDetach(d,
-      cstRemoteWriter->spobject->objectEntryAID,
-      &cstRemoteWriter->repeatActiveQueryTimer,
-      1);   //metatraffic timer
-  CSTRemoteWriter_delete(cstRemoteWriter->cstReader,cstRemoteWriter);
+             cstRemoteWriter->spobject->objectEntryAID,
+             &cstRemoteWriter->repeatActiveQueryTimer,
+             1); //metatraffic timer
+  CSTRemoteWriter_delete(cstRemoteWriter->cstReader, cstRemoteWriter);
   FREE(cstRemoteWriter);
 }
 
 /*****************************************************************************/
 void
-CSTReaderAddCSChange(CSTRemoteWriter *cstRemoteWriter,CSChange *csChange) {
+CSTReaderAddCSChange(CSTRemoteWriter *cstRemoteWriter, CSChange *csChange)
+{
   CSChangeFromWriter   *csChangeFromWriter;
-  
+
   cstRemoteWriter->csChangesCounter++;
-  cstRemoteWriter->ACKRetriesCounter=0;
-  csChangeFromWriter=(CSChangeFromWriter*)MALLOC(sizeof(CSChangeFromWriter));
-  csChangeFromWriter->csChange=csChange;
-  csChangeFromWriter->commStateChFWriter=RECEIVED;
-  CSChangeFromWriter_insert(cstRemoteWriter,csChangeFromWriter);
-  CSTReaderCSChange_insert(cstRemoteWriter->cstReader,csChange);
+  cstRemoteWriter->ACKRetriesCounter = 0;
+  csChangeFromWriter = (CSChangeFromWriter *)MALLOC(sizeof(CSChangeFromWriter));
+  csChangeFromWriter->csChange = csChange;
+  csChangeFromWriter->commStateChFWriter = RECEIVED;
+  CSChangeFromWriter_insert(cstRemoteWriter, csChangeFromWriter);
+  CSTReaderCSChange_insert(cstRemoteWriter->cstReader, csChange);
 }
 
 /*****************************************************************************/
-void 
+void
 CSTReaderDestroyCSChangeFromWriter(CSTRemoteWriter *cstRemoteWriter,
-    CSChangeFromWriter *csChangeFromWriter,Boolean keepCSChange) {
-  
-  if ((!csChangeFromWriter) || (!cstRemoteWriter)) return;
+                                  CSChangeFromWriter *csChangeFromWriter, Boolean keepCSChange)
+{
+
+  if ((!csChangeFromWriter) || (!cstRemoteWriter))
+    return;
   CSTReaderCSChange_delete(cstRemoteWriter->cstReader,
-                           csChangeFromWriter->csChange);
+                          csChangeFromWriter->csChange);
   if (!keepCSChange) {
     if (csChangeFromWriter->csChange->cdrCodec.buffer)
       FREE(csChangeFromWriter->csChange->cdrCodec.buffer);
     parameterDelete(csChangeFromWriter->csChange);
     FREE(csChangeFromWriter->csChange);
   }
-  CSChangeFromWriter_delete(cstRemoteWriter,csChangeFromWriter);
+  CSChangeFromWriter_delete(cstRemoteWriter, csChangeFromWriter);
   FREE(csChangeFromWriter);
   cstRemoteWriter->csChangesCounter--;
 }
 
 /*****************************************************************************/
-void 
-CSTReaderDestroyCSChange(CSTRemoteWriter *cstRemoteWriter,SequenceNumber *sn,
-    Boolean keepCSChange) {
+void
+CSTReaderDestroyCSChange(CSTRemoteWriter *cstRemoteWriter, SequenceNumber *sn,
+                        Boolean keepCSChange)
+{
   CSChangeFromWriter   *csChangeFromWriter;
-  
-  csChangeFromWriter=CSChangeFromWriter_find(cstRemoteWriter,sn);
-  if (csChangeFromWriter) {  
+
+  csChangeFromWriter = CSChangeFromWriter_find(cstRemoteWriter, sn);
+  if (csChangeFromWriter) {
     CSTReaderDestroyCSChangeFromWriter(cstRemoteWriter,
-         csChangeFromWriter,keepCSChange);
-  }    
+                                      csChangeFromWriter, keepCSChange);
+  }
 }
 
 /*****************************************************************************/
-void 
-CSTReaderSetupState(CSTRemoteWriter *cstRemoteWriter) {
-  
-  if (CSChangeFromWriter_first(cstRemoteWriter)==NULL) { //no csChanges
-    if (SeqNumberCmp(cstRemoteWriter->sn,cstRemoteWriter->lastSN)!=0) {
-      if (cstRemoteWriter->commStateACK!=WAITING) {
-        cstRemoteWriter->commStateACK=PULLING;
-        cstRemoteWriter->ACKRetriesCounter=0;
-        eventDetach(cstRemoteWriter->cstReader->domain,
-            cstRemoteWriter->spobject->objectEntryAID,
-            &cstRemoteWriter->repeatActiveQueryTimer,
-            1);  //metatraffic timer
-        eventDetach(cstRemoteWriter->cstReader->domain,
-            cstRemoteWriter->spobject->objectEntryAID,
-            &cstRemoteWriter->delayResponceTimer,
-            1);   //metatraffic timer
-        eventAdd(cstRemoteWriter->cstReader->domain,
-            cstRemoteWriter->spobject->objectEntryAID,
-            &cstRemoteWriter->delayResponceTimer,
-            1,   //metatraffic timer
-            "CSTReaderResponceTimer",
-            CSTReaderResponceTimer,
-            &cstRemoteWriter->cstReader->lock,
-            cstRemoteWriter,
-            &cstRemoteWriter->cstReader->params.delayResponceTimeMin);
+void
+CSTReaderSetupState(CSTRemoteWriter *cstRemoteWriter)
+{
+
+  if (CSChangeFromWriter_first(cstRemoteWriter) == NULL) { //no csChanges
+    if (SeqNumberCmp(cstRemoteWriter->sn, cstRemoteWriter->lastSN) != 0) {
+      if (cstRemoteWriter->commStateACK != WAITING) {
+       cstRemoteWriter->commStateACK = PULLING;
+       cstRemoteWriter->ACKRetriesCounter = 0;
+       eventDetach(cstRemoteWriter->cstReader->domain,
+                   cstRemoteWriter->spobject->objectEntryAID,
+                   &cstRemoteWriter->repeatActiveQueryTimer,
+                   1); //metatraffic timer
+       eventDetach(cstRemoteWriter->cstReader->domain,
+                   cstRemoteWriter->spobject->objectEntryAID,
+                   &cstRemoteWriter->delayResponceTimer,
+                   1); //metatraffic timer
+       eventAdd(cstRemoteWriter->cstReader->domain,
+                cstRemoteWriter->spobject->objectEntryAID,
+                &cstRemoteWriter->delayResponceTimer,
+                1, //metatraffic timer
+                "CSTReaderResponceTimer",
+                CSTReaderResponceTimer,
+                &cstRemoteWriter->cstReader->lock,
+                cstRemoteWriter,
+                &cstRemoteWriter->cstReader->params.delayResponceTimeMin);
       }
     } else {
-      if (cstRemoteWriter->commStateACK==PULLING) {
-        cstRemoteWriter->commStateACK=WAITING;
-        cstRemoteWriter->ACKRetriesCounter=0;
-        eventDetach(cstRemoteWriter->cstReader->domain,
-            cstRemoteWriter->spobject->objectEntryAID,
-            &cstRemoteWriter->delayResponceTimer,
-            1);   //metatraffic timer
-        if (NtpTimeCmp(cstRemoteWriter->cstReader->params.repeatActiveQueryTime,
-                       iNtpTime)!=0) {
-          eventDetach(cstRemoteWriter->cstReader->domain,
-              cstRemoteWriter->spobject->objectEntryAID,
-              &cstRemoteWriter->repeatActiveQueryTimer,
-              1);   //metatraffic timer
-          eventAdd(cstRemoteWriter->cstReader->domain,
-              cstRemoteWriter->spobject->objectEntryAID,
-              &cstRemoteWriter->repeatActiveQueryTimer,
-              1,   //metatraffic timer
-              "CSTReaderQueryTimer",
-              CSTReaderQueryTimer,
-              &cstRemoteWriter->cstReader->lock,
-              cstRemoteWriter,
-              &cstRemoteWriter->cstReader->params.repeatActiveQueryTime);
-        }
+      if (cstRemoteWriter->commStateACK == PULLING) {
+       cstRemoteWriter->commStateACK = WAITING;
+       cstRemoteWriter->ACKRetriesCounter = 0;
+       eventDetach(cstRemoteWriter->cstReader->domain,
+                   cstRemoteWriter->spobject->objectEntryAID,
+                   &cstRemoteWriter->delayResponceTimer,
+                   1); //metatraffic timer
+       if (NtpTimeCmp(cstRemoteWriter->cstReader->params.repeatActiveQueryTime,
+                      iNtpTime) != 0) {
+         eventDetach(cstRemoteWriter->cstReader->domain,
+                     cstRemoteWriter->spobject->objectEntryAID,
+                     &cstRemoteWriter->repeatActiveQueryTimer,
+                     1); //metatraffic timer
+         eventAdd(cstRemoteWriter->cstReader->domain,
+                  cstRemoteWriter->spobject->objectEntryAID,
+                  &cstRemoteWriter->repeatActiveQueryTimer,
+                  1, //metatraffic timer
+                  "CSTReaderQueryTimer",
+                  CSTReaderQueryTimer,
+                  &cstRemoteWriter->cstReader->lock,
+                  cstRemoteWriter,
+                  &cstRemoteWriter->cstReader->params.repeatActiveQueryTime);
+       }
       }
     }
   } else {
-    if (cstRemoteWriter->commStateACK==WAITING) {
-      cstRemoteWriter->commStateACK=PULLING;
-      cstRemoteWriter->ACKRetriesCounter=0;
+    if (cstRemoteWriter->commStateACK == WAITING) {
+      cstRemoteWriter->commStateACK = PULLING;
+      cstRemoteWriter->ACKRetriesCounter = 0;
       eventDetach(cstRemoteWriter->cstReader->domain,
-          cstRemoteWriter->spobject->objectEntryAID,
-          &cstRemoteWriter->repeatActiveQueryTimer,
-          1);   //metatraffic timer
+                 cstRemoteWriter->spobject->objectEntryAID,
+                 &cstRemoteWriter->repeatActiveQueryTimer,
+                 1); //metatraffic timer
       eventDetach(cstRemoteWriter->cstReader->domain,
-          cstRemoteWriter->spobject->objectEntryAID,
-          &cstRemoteWriter->delayResponceTimer,
-          1);   //metatraffic timer
+                 cstRemoteWriter->spobject->objectEntryAID,
+                 &cstRemoteWriter->delayResponceTimer,
+                 1); //metatraffic timer
       eventAdd(cstRemoteWriter->cstReader->domain,
-          cstRemoteWriter->spobject->objectEntryAID,
-          &cstRemoteWriter->delayResponceTimer,
-          1,   //metatraffic timer
-          "CSTReaderResponceTimer",
-          CSTReaderResponceTimer,
-          &cstRemoteWriter->cstReader->lock,
-          cstRemoteWriter,
-          &cstRemoteWriter->cstReader->params.delayResponceTimeMin);
+              cstRemoteWriter->spobject->objectEntryAID,
+              &cstRemoteWriter->delayResponceTimer,
+              1, //metatraffic timer
+              "CSTReaderResponceTimer",
+              CSTReaderResponceTimer,
+              &cstRemoteWriter->cstReader->lock,
+              cstRemoteWriter,
+              &cstRemoteWriter->cstReader->params.delayResponceTimeMin);
     }
   }
 }
index 3651c144b9a2a125b37f96262b7051e6bd581a5f..ae1a442dc9815850916a0c752ed8cc72754e1945 100644 (file)
 /*
- *  $Id: RTPSCSTReaderProc.c,v 0.0.0.1 2003/09/13 
+ *  $Id: RTPSCSTReaderProc.c,v 0.0.0.1 2003/09/13
  *
  *  DEBUG:  section 54                  CSChanges processing
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
 /*****************************************************************************/
 void
-CSTReaderProcCSChangesManager(ORTEDomain *d,CSTRemoteWriter *cstRemoteWriter,
-    CSChangeFromWriter *csChangeFromWriter) {
+CSTReaderProcCSChangesManager(ORTEDomain *d, CSTRemoteWriter *cstRemoteWriter,
+                             CSChangeFromWriter *csChangeFromWriter)
+{
   CSChange           *csChange;
   ObjectEntryOID     *objectEntryOID;
 
-  
-  csChange=csChangeFromWriter->csChange;
-  objectEntryOID=objectEntryFind(d,&csChangeFromWriter->csChange->guid);
-  if (!objectEntryOID) return;
+
+  csChange = csChangeFromWriter->csChange;
+  objectEntryOID = objectEntryFind(d, &csChangeFromWriter->csChange->guid);
+  if (!objectEntryOID)
+    return;
   if (!csChange->alive) {
     eventDetach(d,
-            objectEntryOID->objectEntryAID,
-            &objectEntryOID->expirationPurgeTimer,
-            0);
+               objectEntryOID->objectEntryAID,
+               &objectEntryOID->expirationPurgeTimer,
+               0);
     eventAdd(d,
-            objectEntryOID->objectEntryAID,
-            &objectEntryOID->expirationPurgeTimer,
-            0,
-            "ExpirationTimer",
-            objectEntryExpirationTimer,
-            NULL,
-            objectEntryOID,
-            NULL);
-   return;
+            objectEntryOID->objectEntryAID,
+            &objectEntryOID->expirationPurgeTimer,
+            0,
+            "ExpirationTimer",
+            objectEntryExpirationTimer,
+            NULL,
+            objectEntryOID,
+            NULL);
+    return;
   }
   switch (csChange->guid.aid & 0x03) {
     case MANAGER:
       //update parameters of object
-      parameterUpdateApplication(csChange,(AppParams*)objectEntryOID->attributes);
+      parameterUpdateApplication(csChange, (AppParams *)objectEntryOID->attributes);
       //copy csChange to writerManagers
       CSTReaderDestroyCSChangeFromWriter(cstRemoteWriter,
-                               csChangeFromWriter,
-                               ORTE_TRUE);
+                                        csChangeFromWriter,
+                                        ORTE_TRUE);
       pthread_rwlock_wrlock(&d->writerManagers.lock);
-      CSTWriterAddCSChange(d,&d->writerManagers,csChange);
+      CSTWriterAddCSChange(d, &d->writerManagers, csChange);
       pthread_rwlock_unlock(&d->writerManagers.lock);
-    break;
-    case MANAGEDAPPLICATION: 
+      break;
+    case MANAGEDAPPLICATION:
       //update parameters of object
-      parameterUpdateApplication(csChange,(AppParams*)objectEntryOID->attributes);
+      parameterUpdateApplication(csChange, (AppParams *)objectEntryOID->attributes);
       //changes can make only local Apps
       if (cstRemoteWriter->spobject->appMOM) {
-        CSTReaderDestroyCSChangeFromWriter(cstRemoteWriter,
-                                 csChangeFromWriter,
-                                 ORTE_TRUE);
-        pthread_rwlock_wrlock(&d->writerApplications.lock);
-        CSTWriterAddCSChange(d,&d->writerApplications,csChange);
-        pthread_rwlock_unlock(&d->writerApplications.lock);
+       CSTReaderDestroyCSChangeFromWriter(cstRemoteWriter,
+                                          csChangeFromWriter,
+                                          ORTE_TRUE);
+       pthread_rwlock_wrlock(&d->writerApplications.lock);
+       CSTWriterAddCSChange(d, &d->writerApplications, csChange);
+       pthread_rwlock_unlock(&d->writerApplications.lock);
       }
-    break;
+      break;
   }
 }
 
 /*****************************************************************************/
-void 
-CSTReaderProcCSChangesApp(ORTEDomain *d,CSTRemoteWriter *cstRemoteWriter,
-    CSChangeFromWriter *csChangeFromWriter) {
+void
+CSTReaderProcCSChangesApp(ORTEDomain *d, CSTRemoteWriter *cstRemoteWriter,
+                         CSChangeFromWriter *csChangeFromWriter)
+{
   CSChange           *csChange;
   ObjectEntryOID     *objectEntryOID;
-    
-  csChange=csChangeFromWriter->csChange;
-  objectEntryOID=objectEntryFind(d,&csChange->guid);
-  if (!objectEntryOID) return;
+
+  csChange = csChangeFromWriter->csChange;
+  objectEntryOID = objectEntryFind(d, &csChange->guid);
+  if (!objectEntryOID)
+    return;
   if (!csChange->alive) {
     eventDetach(d,
-            objectEntryOID->objectEntryAID,
-            &objectEntryOID->expirationPurgeTimer,
-            0);
+               objectEntryOID->objectEntryAID,
+               &objectEntryOID->expirationPurgeTimer,
+               0);
     eventAdd(d,
-            objectEntryOID->objectEntryAID,
-            &objectEntryOID->expirationPurgeTimer,
-            0,
-            "ExpirationTimer",
-            objectEntryExpirationTimer,
-            NULL,
-            objectEntryOID,
-            NULL);
+            objectEntryOID->objectEntryAID,
+            &objectEntryOID->expirationPurgeTimer,
+            0,
+            "ExpirationTimer",
+            objectEntryExpirationTimer,
+            NULL,
+            objectEntryOID,
+            NULL);
     return;
   }
   switch (csChange->guid.oid & 0x07) {
     case OID_APPLICATION:
       break;
-    case OID_PUBLICATION:      
+    case OID_PUBLICATION:
       parameterUpdatePublication(csChange,
-          (ORTEPublProp*)objectEntryOID->attributes);
+                                (ORTEPublProp *)objectEntryOID->attributes);
       break;
-    case OID_SUBSCRIPTION: 
+    case OID_SUBSCRIPTION:
       parameterUpdateSubscription(csChange,
-          (ORTESubsProp*)objectEntryOID->attributes);
+                                 (ORTESubsProp *)objectEntryOID->attributes);
       break;
   }
 }
 
 /*****************************************************************************/
-void 
-CSTReaderProcCSChanges(ORTEDomain *d,CSTRemoteWriter *cstRemoteWriter) {
+void
+CSTReaderProcCSChanges(ORTEDomain *d, CSTRemoteWriter *cstRemoteWriter)
+{
   CSChangeFromWriter *csChangeFromWriter;
-  SequenceNumber     sn,snNext,lastGapSN;
+  SequenceNumber     sn, snNext, lastGapSN;
 
-  debug(54,10) ("CSTReaderProcCSChanges: start\n");
-  if (!cstRemoteWriter) return;
+  debug(54, 10) ("CSTReaderProcCSChanges: start\n");
+  if (!cstRemoteWriter)
+    return;
   while (1) {
-    csChangeFromWriter=CSChangeFromWriter_first(cstRemoteWriter);
-    if (!csChangeFromWriter) break;
-    sn=csChangeFromWriter->csChange->sn;
-    if (SeqNumberCmp(sn,cstRemoteWriter->firstSN)>=0) {
-      SeqNumberInc(snNext,cstRemoteWriter->sn);
-      debug(54,10) ("CSTReaderProcCSChanges: processing sn:%u,change sn:%u, gapsn:%u\n",snNext.low,
-                                             csChangeFromWriter->csChange->sn.low,
-                                             csChangeFromWriter->csChange->gapSN.low);
-      if ((SeqNumberCmp(sn,snNext)==0) &&
-          (csChangeFromWriter->commStateChFWriter==RECEIVED)) {
-        if (SeqNumberCmp(csChangeFromWriter->csChange->gapSN,noneSN)==0) {
-          if ((d->guid.aid & 0x03)==MANAGER) 
-              CSTReaderProcCSChangesManager(d,cstRemoteWriter,
-                                            csChangeFromWriter);
-          if ((d->guid.aid & 0x03)==MANAGEDAPPLICATION) 
-              CSTReaderProcCSChangesApp(d,cstRemoteWriter,
-                                        csChangeFromWriter);
-          SeqNumberInc(cstRemoteWriter->sn,cstRemoteWriter->sn);
-        } else {
-          //GAP
-          SeqNumberAdd(cstRemoteWriter->sn,
-                      cstRemoteWriter->sn,
-                      csChangeFromWriter->csChange->gapSN);
-        }
-        CSTReaderDestroyCSChange(cstRemoteWriter,  //note:csChange can be coped to another CSTWriter!!!
-            &snNext,ORTE_FALSE);
+    csChangeFromWriter = CSChangeFromWriter_first(cstRemoteWriter);
+    if (!csChangeFromWriter)
+      break;
+    sn = csChangeFromWriter->csChange->sn;
+    if (SeqNumberCmp(sn, cstRemoteWriter->firstSN) >= 0) {
+      SeqNumberInc(snNext, cstRemoteWriter->sn);
+      debug(54, 10) ("CSTReaderProcCSChanges: processing sn:%u,change sn:%u, gapsn:%u\n", snNext.low,
+                    csChangeFromWriter->csChange->sn.low,
+                    csChangeFromWriter->csChange->gapSN.low);
+      if ((SeqNumberCmp(sn, snNext) == 0) &&
+         (csChangeFromWriter->commStateChFWriter == RECEIVED)) {
+       if (SeqNumberCmp(csChangeFromWriter->csChange->gapSN, noneSN) == 0) {
+         if ((d->guid.aid & 0x03) == MANAGER)
+           CSTReaderProcCSChangesManager(d, cstRemoteWriter,
+                                         csChangeFromWriter);
+         if ((d->guid.aid & 0x03) == MANAGEDAPPLICATION)
+           CSTReaderProcCSChangesApp(d, cstRemoteWriter,
+                                     csChangeFromWriter);
+         SeqNumberInc(cstRemoteWriter->sn, cstRemoteWriter->sn);
+       } else {
+         //GAP
+         SeqNumberAdd(cstRemoteWriter->sn,
+                      cstRemoteWriter->sn,
+                      csChangeFromWriter->csChange->gapSN);
+       }
+       CSTReaderDestroyCSChange(cstRemoteWriter,  //note:csChange can be coped to another CSTWriter!!!
+                                &snNext, ORTE_FALSE);
       } else {
-        if (SeqNumberCmp(csChangeFromWriter->csChange->gapSN,noneSN)>0) {
-          //GAP
-          SeqNumberAdd(lastGapSN,sn,csChangeFromWriter->csChange->gapSN);
-          SeqNumberDec(lastGapSN,lastGapSN);
-          CSTReaderDestroyCSChange(cstRemoteWriter,&sn,ORTE_FALSE);
-          //is first gapped sn lower then cstRemoteWrite sn and last gapped sn higher then cstRemoteWrite sn?
-          if ((SeqNumberCmp(sn,cstRemoteWriter->sn)<=0) &&
-              (SeqNumberCmp(lastGapSN,cstRemoteWriter->sn)>=0)) {
-            cstRemoteWriter->sn=lastGapSN;
-          } 
-        } else {
-          if (SeqNumberCmp(sn,cstRemoteWriter->sn)<=0) {
-            CSTReaderDestroyCSChange(cstRemoteWriter,&sn,ORTE_FALSE);
-          } else
-            /* stop processing of csChanges */
-            break;
-        }
+       if (SeqNumberCmp(csChangeFromWriter->csChange->gapSN, noneSN) > 0) {
+         //GAP
+         SeqNumberAdd(lastGapSN, sn, csChangeFromWriter->csChange->gapSN);
+         SeqNumberDec(lastGapSN, lastGapSN);
+         CSTReaderDestroyCSChange(cstRemoteWriter, &sn, ORTE_FALSE);
+         //is first gapped sn lower then cstRemoteWrite sn and last gapped sn higher then cstRemoteWrite sn?
+         if ((SeqNumberCmp(sn, cstRemoteWriter->sn) <= 0) &&
+             (SeqNumberCmp(lastGapSN, cstRemoteWriter->sn) >= 0)) {
+           cstRemoteWriter->sn = lastGapSN;
+         }
+       } else {
+         if (SeqNumberCmp(sn, cstRemoteWriter->sn) <= 0) {
+           CSTReaderDestroyCSChange(cstRemoteWriter, &sn, ORTE_FALSE);
+         } else
+           /* stop processing of csChanges */
+           break;
+       }
       }
     } else {
       CSTReaderDestroyCSChangeFromWriter(cstRemoteWriter,
-          csChangeFromWriter,ORTE_FALSE);
+                                        csChangeFromWriter, ORTE_FALSE);
     }
   }
-  CSTReaderSetupState(cstRemoteWriter);    
-  debug(54,10) ("CSTReaderProcCSChanges: finished\n");
+  CSTReaderSetupState(cstRemoteWriter);
+  debug(54, 10) ("CSTReaderProcCSChanges: finished\n");
 }
 
 /*****************************************************************************/
 void
 CSTReaderNewData(CSTRemoteWriter *cstRemoteWriter,
-    CSChangeFromWriter *csChangeFromWriter) {
-  CSChange             *csChange=csChangeFromWriter->csChange;
-  ORTERecvInfo         info;  
+                CSChangeFromWriter *csChangeFromWriter)
+{
+  CSChange             *csChange = csChangeFromWriter->csChange;
+  ORTERecvInfo         info;
   ORTESubsProp         *sp;
   ObjectEntryOID       *objectEntryOID;
-  unsigned int                max_size;
-        
-  if (cstRemoteWriter==NULL) return;
-  objectEntryOID=cstRemoteWriter->cstReader->objectEntryOID;
-  sp=(ORTESubsProp*)cstRemoteWriter->cstReader->objectEntryOID->attributes;
+  unsigned int         max_size;
+
+  if (cstRemoteWriter == NULL)
+    return;
+  objectEntryOID = cstRemoteWriter->cstReader->objectEntryOID;
+  sp = (ORTESubsProp *)cstRemoteWriter->cstReader->objectEntryOID->attributes;
   if (objectEntryOID->recvCallBack) {
     //deserialization routine
     if (cstRemoteWriter->cstReader->typeRegister->deserialize) {
       cstRemoteWriter->cstReader->typeRegister->deserialize(
-          &csChange->cdrCodec,
-          objectEntryOID->instance);
+       &csChange->cdrCodec,
+       objectEntryOID->instance);
     } else {
       //no deserialization -> memcpy
       ORTEGetMaxSizeParam gms;
 
       /* determine maximal size */
-      gms.host_endian=csChange->cdrCodec.host_endian;
-      gms.data_endian=csChange->cdrCodec.data_endian;
-      gms.data=csChange->cdrCodec.buffer;
-      gms.max_size=cstRemoteWriter->cstReader->typeRegister->maxSize;
-      gms.recv_size=csChange->cdrCodec.buf_len;
-      gms.csize=0;
+      gms.host_endian = csChange->cdrCodec.host_endian;
+      gms.data_endian = csChange->cdrCodec.data_endian;
+      gms.data = csChange->cdrCodec.buffer;
+      gms.max_size = cstRemoteWriter->cstReader->typeRegister->maxSize;
+      gms.recv_size = csChange->cdrCodec.buf_len;
+      gms.csize = 0;
       if (cstRemoteWriter->cstReader->typeRegister->getMaxSize)
-        max_size=cstRemoteWriter->cstReader->typeRegister->getMaxSize(&gms,1);
+       max_size = cstRemoteWriter->cstReader->typeRegister->getMaxSize(&gms, 1);
       else
-        max_size=cstRemoteWriter->cstReader->typeRegister->maxSize;
-      if (max_size>csChange->cdrCodec.buf_len)
-        max_size=csChange->cdrCodec.buf_len;
+       max_size = cstRemoteWriter->cstReader->typeRegister->maxSize;
+      if (max_size > csChange->cdrCodec.buf_len)
+       max_size = csChange->cdrCodec.buf_len;
       memcpy(objectEntryOID->instance,
-             csChange->cdrCodec.buffer,
-             max_size);
+            csChange->cdrCodec.buffer,
+            max_size);
     }
-    info.status=NEW_DATA;
-    info.topic=(char*)sp->topic;
-    info.type=(char*)sp->typeName;
-    info.senderGUID=csChange->guid;
-    info.localTimeReceived=csChange->localTimeReceived;
-    info.remoteTimePublished=csChange->remoteTimePublished;
-    info.sn=csChange->sn;
-    info.data_endian=csChange->cdrCodec.data_endian;
+    info.status = NEW_DATA;
+    info.topic = (char *)sp->topic;
+    info.type = (char *)sp->typeName;
+    info.senderGUID = csChange->guid;
+    info.localTimeReceived = csChange->localTimeReceived;
+    info.remoteTimePublished = csChange->remoteTimePublished;
+    info.sn = csChange->sn;
+    info.data_endian = csChange->cdrCodec.data_endian;
     objectEntryOID->recvCallBack(&info,
-                            objectEntryOID->instance,
-                            objectEntryOID->callBackParam);
-    if (sp->mode==IMMEDIATE) {
+                                objectEntryOID->instance,
+                                objectEntryOID->callBackParam);
+    if (sp->mode == IMMEDIATE) {
       //setup new time for deadline timer
       eventDetach(cstRemoteWriter->cstReader->domain,
-          cstRemoteWriter->cstReader->objectEntryOID->objectEntryAID,
-          &cstRemoteWriter->cstReader->deadlineTimer,
-          0);
+                 cstRemoteWriter->cstReader->objectEntryOID->objectEntryAID,
+                 &cstRemoteWriter->cstReader->deadlineTimer,
+                 0);
       eventAdd(cstRemoteWriter->cstReader->domain,
-          cstRemoteWriter->cstReader->objectEntryOID->objectEntryAID,
-          &cstRemoteWriter->cstReader->deadlineTimer,
-          0,   //common timer
-          "CSTReaderDeadlineTimer",
-          CSTReaderDeadlineTimer,
-          &cstRemoteWriter->cstReader->lock,
-          cstRemoteWriter->cstReader,
-          &sp->deadline);
+              cstRemoteWriter->cstReader->objectEntryOID->objectEntryAID,
+              &cstRemoteWriter->cstReader->deadlineTimer,
+              0, //common timer
+              "CSTReaderDeadlineTimer",
+              CSTReaderDeadlineTimer,
+              &cstRemoteWriter->cstReader->lock,
+              cstRemoteWriter->cstReader,
+              &sp->deadline);
     }
-    if (sp->mode==PULLED) {
+    if (sp->mode == PULLED) {
       NtpTime timeNext;
       NtpTimeAdd(timeNext,
-                (getActualNtpTime()),
-                sp->deadline);
+                (getActualNtpTime()),
+                sp->deadline);
       htimerUnicastCommon_set_expire(&cstRemoteWriter->
-                cstReader->deadlineTimer,timeNext);
+                                    cstReader->deadlineTimer, timeNext);
     }
   }
 }
 
 /*****************************************************************************/
-void 
-CSTReaderProcCSChangesIssue(CSTRemoteWriter *cstRemoteWriter,Boolean pullCalled) {
+void
+CSTReaderProcCSChangesIssue(CSTRemoteWriter *cstRemoteWriter, Boolean pullCalled)
+{
   ORTESubsProp         *sp;
   CSChangeFromWriter   *csChangeFromWriter;
-  SequenceNumber       sn,snNext,lastGapSN;
-  debug(54,10) ("CSTReaderProcIssue: start\n");
-  if (cstRemoteWriter==NULL) return;
-  sp=(ORTESubsProp*)cstRemoteWriter->cstReader->objectEntryOID->attributes;
-  if ((sp->reliabilityRequested & PID_VALUE_RELIABILITY_STRICT)!=0) {
+  SequenceNumber       sn, snNext, lastGapSN;
+
+  debug(54, 10) ("CSTReaderProcIssue: start\n");
+  if (cstRemoteWriter == NULL)
+    return;
+  sp = (ORTESubsProp *)cstRemoteWriter->cstReader->objectEntryOID->attributes;
+  if ((sp->reliabilityRequested & PID_VALUE_RELIABILITY_STRICT) != 0) {
     //Strict
-    if ((sp->mode==PULLED) && (pullCalled==ORTE_FALSE)) return;
+    if ((sp->mode == PULLED) && (pullCalled == ORTE_FALSE))
+      return;
     while (1) {
-      csChangeFromWriter=CSChangeFromWriter_first(cstRemoteWriter);
-      if (!csChangeFromWriter) break;
-      sn=csChangeFromWriter->csChange->sn;
-      if (SeqNumberCmp(sn,cstRemoteWriter->firstSN)>=0) {
-        SeqNumberInc(snNext,cstRemoteWriter->sn);
-        if ((SeqNumberCmp(sn,snNext)==0) &&
-            (csChangeFromWriter->commStateChFWriter==RECEIVED)) {
-          if (SeqNumberCmp(csChangeFromWriter->csChange->gapSN,noneSN)==0) {
-            if ((cstRemoteWriter==
-                 cstRemoteWriter->cstReader->cstRemoteWriterSubscribed) &&
-                (cstRemoteWriter->cstReader->cstRemoteWriterSubscribed!=NULL)) {
-              //NewData                
-              CSTReaderNewData(cstRemoteWriter,csChangeFromWriter);
-            } 
-            SeqNumberInc(cstRemoteWriter->sn,cstRemoteWriter->sn);
-          } else {
-            //GAP
-            SeqNumberAdd(cstRemoteWriter->sn,
-                        cstRemoteWriter->sn,
-                        csChangeFromWriter->csChange->gapSN);
-          }
-          CSTReaderDestroyCSChange(cstRemoteWriter,
-              &snNext,ORTE_FALSE);
-        } else {
-          if (SeqNumberCmp(csChangeFromWriter->csChange->gapSN,noneSN)>0) {
-            //GAP
-            SeqNumberAdd(lastGapSN,sn,csChangeFromWriter->csChange->gapSN);
-            SeqNumberDec(lastGapSN,lastGapSN);
-            CSTReaderDestroyCSChange(cstRemoteWriter,&sn,ORTE_FALSE);
-            //is first gapped sn lower then cstRemoteWrite sn and last gapped sn higher then cstRemoteWrite sn?
-            if ((SeqNumberCmp(sn,cstRemoteWriter->sn)<=0) &&
-                (SeqNumberCmp(lastGapSN,cstRemoteWriter->sn)>=0)) {
-              cstRemoteWriter->sn=lastGapSN;
-            }
-          } else {
-            if (SeqNumberCmp(sn,cstRemoteWriter->sn)<=0) {
-              CSTReaderDestroyCSChange(cstRemoteWriter,&sn,ORTE_FALSE);
-            } else
-              /* stop processing of csChanges */
-              break;
-          }
+      csChangeFromWriter = CSChangeFromWriter_first(cstRemoteWriter);
+      if (!csChangeFromWriter)
+       break;
+      sn = csChangeFromWriter->csChange->sn;
+      if (SeqNumberCmp(sn, cstRemoteWriter->firstSN) >= 0) {
+       SeqNumberInc(snNext, cstRemoteWriter->sn);
+       if ((SeqNumberCmp(sn, snNext) == 0) &&
+           (csChangeFromWriter->commStateChFWriter == RECEIVED)) {
+         if (SeqNumberCmp(csChangeFromWriter->csChange->gapSN, noneSN) == 0) {
+           if ((cstRemoteWriter ==
+                cstRemoteWriter->cstReader->cstRemoteWriterSubscribed) &&
+               (cstRemoteWriter->cstReader->cstRemoteWriterSubscribed != NULL)) {
+             //NewData
+             CSTReaderNewData(cstRemoteWriter, csChangeFromWriter);
+           }
+           SeqNumberInc(cstRemoteWriter->sn, cstRemoteWriter->sn);
+         } else {
+           //GAP
+           SeqNumberAdd(cstRemoteWriter->sn,
+                        cstRemoteWriter->sn,
+                        csChangeFromWriter->csChange->gapSN);
+         }
+         CSTReaderDestroyCSChange(cstRemoteWriter,
+                                  &snNext, ORTE_FALSE);
+       } else {
+         if (SeqNumberCmp(csChangeFromWriter->csChange->gapSN, noneSN) > 0) {
+           //GAP
+           SeqNumberAdd(lastGapSN, sn, csChangeFromWriter->csChange->gapSN);
+           SeqNumberDec(lastGapSN, lastGapSN);
+           CSTReaderDestroyCSChange(cstRemoteWriter, &sn, ORTE_FALSE);
+           //is first gapped sn lower then cstRemoteWrite sn and last gapped sn higher then cstRemoteWrite sn?
+           if ((SeqNumberCmp(sn, cstRemoteWriter->sn) <= 0) &&
+               (SeqNumberCmp(lastGapSN, cstRemoteWriter->sn) >= 0)) {
+             cstRemoteWriter->sn = lastGapSN;
+           }
+         } else {
+           if (SeqNumberCmp(sn, cstRemoteWriter->sn) <= 0) {
+             CSTReaderDestroyCSChange(cstRemoteWriter, &sn, ORTE_FALSE);
+           } else
+             /* stop processing of csChanges */
+             break;
+         }
        }
       } else {
-        CSTReaderDestroyCSChangeFromWriter(cstRemoteWriter,
-            csChangeFromWriter,ORTE_FALSE);
+       CSTReaderDestroyCSChangeFromWriter(cstRemoteWriter,
+                                          csChangeFromWriter, ORTE_FALSE);
       }
     }
   } else {
     //Best Effort
-    if ((sp->reliabilityRequested & PID_VALUE_RELIABILITY_BEST_EFFORTS)!=0) {
-      if ((cstRemoteWriter!=
-           cstRemoteWriter->cstReader->cstRemoteWriterSubscribed) ||
-          (cstRemoteWriter->cstReader->cstRemoteWriterSubscribed==NULL)) 
-        return;
-      if ((sp->mode==PULLED) && (pullCalled==ORTE_FALSE)) return;
-      while((csChangeFromWriter=CSChangeFromWriter_first(cstRemoteWriter))) {
-        //NewData                
-        CSTReaderNewData(cstRemoteWriter,csChangeFromWriter);
+    if ((sp->reliabilityRequested & PID_VALUE_RELIABILITY_BEST_EFFORTS) != 0) {
+      if ((cstRemoteWriter !=
+          cstRemoteWriter->cstReader->cstRemoteWriterSubscribed) ||
+         (cstRemoteWriter->cstReader->cstRemoteWriterSubscribed == NULL))
+       return;
+      if ((sp->mode == PULLED) && (pullCalled == ORTE_FALSE))
+       return;
+      while ((csChangeFromWriter = CSChangeFromWriter_first(cstRemoteWriter))) {
+       //NewData
+       CSTReaderNewData(cstRemoteWriter, csChangeFromWriter);
 
-        cstRemoteWriter->sn=csChangeFromWriter->csChange->sn;
+       cstRemoteWriter->sn = csChangeFromWriter->csChange->sn;
 
-        CSTReaderDestroyCSChangeFromWriter(
-            cstRemoteWriter,
-            csChangeFromWriter,
-            ORTE_FALSE);
+       CSTReaderDestroyCSChangeFromWriter(
+         cstRemoteWriter,
+         csChangeFromWriter,
+         ORTE_FALSE);
       }
     }
-  }  
-  CSTReaderSetupState(cstRemoteWriter);    
-  debug(54,10) ("CSTReaderProcIssue: finished\n");
+  }
+  CSTReaderSetupState(cstRemoteWriter);
+  debug(54, 10) ("CSTReaderProcIssue: finished\n");
 }
index ad3ccb5c10efabe61497c667e6c65001ae10ad4d..79434956f25f3e277cbe969dd19fd72f28ca91f2 100644 (file)
 /*
- *  $Id: RTPSCSTReaderTimer.c,v 0.0.0.1 2003/11/03 
+ *  $Id: RTPSCSTReaderTimer.c,v 0.0.0.1 2003/11/03
  *
  *  DEBUG:  section 55                  CSTReader timer functions
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
 /*****************************************************************************/
-int 
-CSTReaderResponceTimer(ORTEDomain *d,void *vcstRemoteWriter) {
-  CSTRemoteWriter *cstRemoteWriter=(CSTRemoteWriter*)vcstRemoteWriter;
+int
+CSTReaderResponceTimer(ORTEDomain *d, void *vcstRemoteWriter)
+{
+  CSTRemoteWriter *cstRemoteWriter = (CSTRemoteWriter *)vcstRemoteWriter;
   int             len;
-  char            queue=1;
-  
-  if ((cstRemoteWriter->guid.oid & 0x07) == OID_PUBLICATION) 
-    queue=2;
-  if (!d->taskSend.mb.containsInfoReply) { 
-    if (queue==1) {
-      len=RTPSInfoREPLYCreate(
-          &d->taskSend.mb.cdrCodec,
-          IPADDRESS_INVALID,
-          ((AppParams*)cstRemoteWriter->cstReader->objectEntryOID->attributes)->metatrafficUnicastPort);
+  char            queue = 1;
+
+  if ((cstRemoteWriter->guid.oid & 0x07) == OID_PUBLICATION)
+    queue = 2;
+  if (!d->taskSend.mb.containsInfoReply) {
+    if (queue == 1) {
+      len = RTPSInfoREPLYCreate(
+       &d->taskSend.mb.cdrCodec,
+       IPADDRESS_INVALID,
+       ((AppParams *)cstRemoteWriter->cstReader->objectEntryOID->attributes)->metatrafficUnicastPort);
     } else {
-      len=RTPSInfoREPLYCreate(
-          &d->taskSend.mb.cdrCodec,
-          IPADDRESS_INVALID,
-          ((AppParams*)cstRemoteWriter->cstReader->objectEntryOID->attributes)->userdataUnicastPort);
+      len = RTPSInfoREPLYCreate(
+       &d->taskSend.mb.cdrCodec,
+       IPADDRESS_INVALID,
+       ((AppParams *)cstRemoteWriter->cstReader->objectEntryOID->attributes)->userdataUnicastPort);
     }
-    if (len<0) {
-      d->taskSend.mb.needSend=ORTE_TRUE;
+    if (len < 0) {
+      d->taskSend.mb.needSend = ORTE_TRUE;
       return 1;
     }
-    d->taskSend.mb.containsInfoReply=ORTE_TRUE;  
-    debug(55,3) ("sent: RTPS_InfoREPLY(0x%x) to 0x%x-0x%x\n",
-                  cstRemoteWriter->cstReader->guid.oid,
-                  cstRemoteWriter->guid.hid,
-                  cstRemoteWriter->guid.aid);
+    d->taskSend.mb.containsInfoReply = ORTE_TRUE;
+    debug(55, 3) ("sent: RTPS_InfoREPLY(0x%x) to 0x%x-0x%x\n",
+                 cstRemoteWriter->cstReader->guid.oid,
+                 cstRemoteWriter->guid.hid,
+                 cstRemoteWriter->guid.aid);
   }
-  len=RTPSAckCreate(
-       &d->taskSend.mb.cdrCodec,
-       &cstRemoteWriter->sn,
-       cstRemoteWriter->cstReader->guid.oid,
-       cstRemoteWriter->guid.oid,
-       ORTE_TRUE);
-  if (len<0) {
+  len = RTPSAckCreate(
+    &d->taskSend.mb.cdrCodec,
+    &cstRemoteWriter->sn,
+    cstRemoteWriter->cstReader->guid.oid,
+    cstRemoteWriter->guid.oid,
+    ORTE_TRUE);
+  if (len < 0) {
     //not enought space in sending buffer
-    d->taskSend.mb.needSend=ORTE_TRUE;
+    d->taskSend.mb.needSend = ORTE_TRUE;
     return 1;
   }
-  debug(55,3) ("sent: RTPS_ACKF(0x%x) to 0x%x-0x%x\n",
-                cstRemoteWriter->cstReader->guid.oid,
-                cstRemoteWriter->guid.hid,
-                cstRemoteWriter->guid.aid);
-  if (cstRemoteWriter->commStateACK==PULLING) {
+  debug(55, 3) ("sent: RTPS_ACKF(0x%x) to 0x%x-0x%x\n",
+               cstRemoteWriter->cstReader->guid.oid,
+               cstRemoteWriter->guid.hid,
+               cstRemoteWriter->guid.aid);
+  if (cstRemoteWriter->commStateACK == PULLING) {
     eventDetach(d,
-        cstRemoteWriter->spobject->objectEntryAID,
-        &cstRemoteWriter->delayResponceTimer,
-        queue); 
-    if (cstRemoteWriter->ACKRetriesCounter<
-        cstRemoteWriter->cstReader->params.ACKMaxRetries) {
+               cstRemoteWriter->spobject->objectEntryAID,
+               &cstRemoteWriter->delayResponceTimer,
+               queue);
+    if (cstRemoteWriter->ACKRetriesCounter <
+       cstRemoteWriter->cstReader->params.ACKMaxRetries) {
       cstRemoteWriter->ACKRetriesCounter++;
       eventAdd(d,
-          cstRemoteWriter->spobject->objectEntryAID,
-          &cstRemoteWriter->delayResponceTimer,
-          queue,
-          "CSTReaderResponceTimer",
-          CSTReaderResponceTimer,
-          &cstRemoteWriter->cstReader->lock,
-          cstRemoteWriter,
-          &cstRemoteWriter->cstReader->params.delayResponceTimeMin);
+              cstRemoteWriter->spobject->objectEntryAID,
+              &cstRemoteWriter->delayResponceTimer,
+              queue,
+              "CSTReaderResponceTimer",
+              CSTReaderResponceTimer,
+              &cstRemoteWriter->cstReader->lock,
+              cstRemoteWriter,
+              &cstRemoteWriter->cstReader->params.delayResponceTimeMin);
     } else {
-      debug(55,3) ("sent: maxRetries ritch upper level (%d).\n",
-                    cstRemoteWriter->cstReader->params.ACKMaxRetries);
+      debug(55, 3) ("sent: maxRetries ritch upper level (%d).\n",
+                   cstRemoteWriter->cstReader->params.ACKMaxRetries);
     }
   }
-  if (cstRemoteWriter->commStateACK==ACKPENDING) { 
-    cstRemoteWriter->commStateACK=WAITING;
+  if (cstRemoteWriter->commStateACK == ACKPENDING) {
+    cstRemoteWriter->commStateACK = WAITING;
     eventDetach(d,
-        cstRemoteWriter->spobject->objectEntryAID,
-        &cstRemoteWriter->repeatActiveQueryTimer,
-        queue); 
+               cstRemoteWriter->spobject->objectEntryAID,
+               &cstRemoteWriter->repeatActiveQueryTimer,
+               queue);
     if (NtpTimeCmp(cstRemoteWriter->cstReader->
-                   params.repeatActiveQueryTime,iNtpTime)!=0) {
+                  params.repeatActiveQueryTime, iNtpTime) != 0) {
       eventAdd(d,
-          cstRemoteWriter->spobject->objectEntryAID,
-          &cstRemoteWriter->repeatActiveQueryTimer,
-          queue,
-          "CSTReaderQueryTimer",
-          CSTReaderQueryTimer,
-          &cstRemoteWriter->cstReader->lock,
-          cstRemoteWriter,
-          &cstRemoteWriter->cstReader->params.repeatActiveQueryTime);
+              cstRemoteWriter->spobject->objectEntryAID,
+              &cstRemoteWriter->repeatActiveQueryTimer,
+              queue,
+              "CSTReaderQueryTimer",
+              CSTReaderQueryTimer,
+              &cstRemoteWriter->cstReader->lock,
+              cstRemoteWriter,
+              &cstRemoteWriter->cstReader->params.repeatActiveQueryTime);
     }
   }
   return 0;
@@ -123,162 +124,165 @@ CSTReaderResponceTimer(ORTEDomain *d,void *vcstRemoteWriter) {
 
 /*****************************************************************************/
 int
-CSTReaderQueryTimer(ORTEDomain *d,void *vcstRemoteWriter) {
-  CSTRemoteWriter *cstRemoteWriter=(CSTRemoteWriter*)vcstRemoteWriter;
+CSTReaderQueryTimer(ORTEDomain *d, void *vcstRemoteWriter)
+{
+  CSTRemoteWriter *cstRemoteWriter = (CSTRemoteWriter *)vcstRemoteWriter;
   int             len;
-  char            queue=1;
-  
-  if ((cstRemoteWriter->guid.oid & 0x07) == OID_PUBLICATION) 
-    queue=2;  
-  if (!d->taskSend.mb.containsInfoReply) { 
-    if (queue==1) {
-      len=RTPSInfoREPLYCreate(
-          &d->taskSend.mb.cdrCodec,
-          IPADDRESS_INVALID,
-          ((AppParams*)cstRemoteWriter->cstReader->objectEntryOID->attributes)->metatrafficUnicastPort);
+  char            queue = 1;
+
+  if ((cstRemoteWriter->guid.oid & 0x07) == OID_PUBLICATION)
+    queue = 2;
+  if (!d->taskSend.mb.containsInfoReply) {
+    if (queue == 1) {
+      len = RTPSInfoREPLYCreate(
+       &d->taskSend.mb.cdrCodec,
+       IPADDRESS_INVALID,
+       ((AppParams *)cstRemoteWriter->cstReader->objectEntryOID->attributes)->metatrafficUnicastPort);
     } else {
-      len=RTPSInfoREPLYCreate(
-          &d->taskSend.mb.cdrCodec,
-          IPADDRESS_INVALID,
-          ((AppParams*)cstRemoteWriter->cstReader->objectEntryOID->attributes)->userdataUnicastPort);
+      len = RTPSInfoREPLYCreate(
+       &d->taskSend.mb.cdrCodec,
+       IPADDRESS_INVALID,
+       ((AppParams *)cstRemoteWriter->cstReader->objectEntryOID->attributes)->userdataUnicastPort);
     }
-    if (len<0) {
-      d->taskSend.mb.needSend=ORTE_TRUE;
+    if (len < 0) {
+      d->taskSend.mb.needSend = ORTE_TRUE;
       return 1;
     }
-    d->taskSend.mb.containsInfoReply=ORTE_TRUE;  
-    debug(55,3) ("sent: RTPS_InfoREPLY(0x%x) to 0x%x-0x%x\n",
-                  cstRemoteWriter->cstReader->guid.oid,
-                  cstRemoteWriter->guid.hid,
-                  cstRemoteWriter->guid.aid);
+    d->taskSend.mb.containsInfoReply = ORTE_TRUE;
+    debug(55, 3) ("sent: RTPS_InfoREPLY(0x%x) to 0x%x-0x%x\n",
+                 cstRemoteWriter->cstReader->guid.oid,
+                 cstRemoteWriter->guid.hid,
+                 cstRemoteWriter->guid.aid);
   }
-  len=RTPSAckCreate(
-      &d->taskSend.mb.cdrCodec,
-      &cstRemoteWriter->sn,
-      cstRemoteWriter->cstReader->guid.oid,
-      cstRemoteWriter->guid.oid,
-      ORTE_FALSE);
-  if (len<0) {
-    d->taskSend.mb.needSend=ORTE_TRUE;
+  len = RTPSAckCreate(
+    &d->taskSend.mb.cdrCodec,
+    &cstRemoteWriter->sn,
+    cstRemoteWriter->cstReader->guid.oid,
+    cstRemoteWriter->guid.oid,
+    ORTE_FALSE);
+  if (len < 0) {
+    d->taskSend.mb.needSend = ORTE_TRUE;
     return 1;
   }
-  debug(55,3) ("sent: RTPS_ACKf(0x%x) to 0x%x-0x%x\n",
-                cstRemoteWriter->cstReader->guid.oid,
-                cstRemoteWriter->guid.hid,
-                cstRemoteWriter->guid.aid);
+  debug(55, 3) ("sent: RTPS_ACKf(0x%x) to 0x%x-0x%x\n",
+               cstRemoteWriter->cstReader->guid.oid,
+               cstRemoteWriter->guid.hid,
+               cstRemoteWriter->guid.aid);
   eventDetach(d,
-      cstRemoteWriter->spobject->objectEntryAID,
-      &cstRemoteWriter->repeatActiveQueryTimer,
-      queue);   
+             cstRemoteWriter->spobject->objectEntryAID,
+             &cstRemoteWriter->repeatActiveQueryTimer,
+             queue);
   if (NtpTimeCmp(cstRemoteWriter->cstReader->
-                 params.repeatActiveQueryTime,iNtpTime)!=0) {
+                params.repeatActiveQueryTime, iNtpTime) != 0) {
     eventAdd(d,
-        cstRemoteWriter->spobject->objectEntryAID,
-        &cstRemoteWriter->repeatActiveQueryTimer,
-        queue,
-        "CSTReaderQueryTimer",
-        CSTReaderQueryTimer,
-        &cstRemoteWriter->cstReader->lock,
-        cstRemoteWriter,
-        &cstRemoteWriter->cstReader->params.repeatActiveQueryTime);
+            cstRemoteWriter->spobject->objectEntryAID,
+            &cstRemoteWriter->repeatActiveQueryTimer,
+            queue,
+            "CSTReaderQueryTimer",
+            CSTReaderQueryTimer,
+            &cstRemoteWriter->cstReader->lock,
+            cstRemoteWriter,
+            &cstRemoteWriter->cstReader->params.repeatActiveQueryTime);
   }
-  return 0; 
+  return 0;
 }
 
 
 /*****************************************************************************/
 int
-CSTReaderDeadlineTimer(ORTEDomain *d,void *vcstReader) {
-  CSTReader            *cstReader=(CSTReader*)vcstReader;
+CSTReaderDeadlineTimer(ORTEDomain *d, void *vcstReader)
+{
+  CSTReader            *cstReader = (CSTReader *)vcstReader;
   ORTESubsProp         *sp;
-  ORTERecvInfo         info;  
-  
-  sp=(ORTESubsProp*)cstReader->objectEntryOID->attributes;
-  memset(&info,0,sizeof(info));
-  info.status=DEADLINE;
-  info.topic=(char*)sp->topic;
-  info.type=(char*)sp->typeName;
+  ORTERecvInfo         info;
+
+  sp = (ORTESubsProp *)cstReader->objectEntryOID->attributes;
+  memset(&info, 0, sizeof(info));
+  info.status = DEADLINE;
+  info.topic = (char *)sp->topic;
+  info.type = (char *)sp->typeName;
   if (cstReader->objectEntryOID->recvCallBack) {
     cstReader->objectEntryOID->recvCallBack(&info,
-        cstReader->objectEntryOID->instance,
-        cstReader->objectEntryOID->callBackParam);
+                                           cstReader->objectEntryOID->instance,
+                                           cstReader->objectEntryOID->callBackParam);
   }
   eventDetach(d,
-      cstReader->objectEntryOID->objectEntryAID,
-      &cstReader->deadlineTimer,
-      0);
+             cstReader->objectEntryOID->objectEntryAID,
+             &cstReader->deadlineTimer,
+             0);
   eventAdd(d,
-      cstReader->objectEntryOID->objectEntryAID,
-      &cstReader->deadlineTimer,
-      0,   //common timer
-      "CSTReaderDeadlineTimer",
-      CSTReaderDeadlineTimer,
-      &cstReader->lock,
-      cstReader,
-      &sp->deadline);
+          cstReader->objectEntryOID->objectEntryAID,
+          &cstReader->deadlineTimer,
+          0, //common timer
+          "CSTReaderDeadlineTimer",
+          CSTReaderDeadlineTimer,
+          &cstReader->lock,
+          cstReader,
+          &sp->deadline);
   return 0;
 }
 
 /*****************************************************************************/
 int
-CSTReaderPersistenceTimer(ORTEDomain *d,void *vcstReader) {
-  CSTReader            *cstReader=(CSTReader*)vcstReader;
+CSTReaderPersistenceTimer(ORTEDomain *d, void *vcstReader)
+{
+  CSTReader            *cstReader = (CSTReader *)vcstReader;
   CSTRemoteWriter      *cstRemoteWriter;
   CSChangeFromWriter   *csChangeFromWriter;
   ORTESubsProp         *sp;
   ORTEPublProp         *pp;
   int32_t            strength;
-  
-  if (cstReader->cstRemoteWriterSubscribed!=NULL) {
+
+  if (cstReader->cstRemoteWriterSubscribed != NULL) {
     //keep only one csChange (last)
-    while (cstReader->cstRemoteWriterSubscribed->csChangesCounter>1) {
-      csChangeFromWriter=
-        CSChangeFromWriter_first(cstReader->cstRemoteWriterSubscribed);
-      if (csChangeFromWriter) {  
-        CSTReaderDestroyCSChangeFromWriter(
-            cstReader->cstRemoteWriterSubscribed,
-            csChangeFromWriter,
-            ORTE_FALSE);
+    while (cstReader->cstRemoteWriterSubscribed->csChangesCounter > 1) {
+      csChangeFromWriter =
+       CSChangeFromWriter_first(cstReader->cstRemoteWriterSubscribed);
+      if (csChangeFromWriter) {
+       CSTReaderDestroyCSChangeFromWriter(
+         cstReader->cstRemoteWriterSubscribed,
+         csChangeFromWriter,
+         ORTE_FALSE);
       }
     }
   }
-  cstReader->cstRemoteWriterSubscribed=NULL;
-  sp=(ORTESubsProp*)cstReader->objectEntryOID->attributes;
-  strength=0;
-  gavl_cust_for_each(CSTRemoteWriter,cstReader,cstRemoteWriter) {
-    pp=(ORTEPublProp*)cstRemoteWriter->spobject->attributes;
-    csChangeFromWriter=CSChangeFromWriter_last(cstRemoteWriter);
-    if ((pp->strength>strength) && (csChangeFromWriter!=NULL)){
-      NtpTime persistence,persistenceExpired,actTime;
-      actTime=getActualNtpTime();
+  cstReader->cstRemoteWriterSubscribed = NULL;
+  sp = (ORTESubsProp *)cstReader->objectEntryOID->attributes;
+  strength = 0;
+  gavl_cust_for_each(CSTRemoteWriter, cstReader, cstRemoteWriter) {
+    pp = (ORTEPublProp *)cstRemoteWriter->spobject->attributes;
+    csChangeFromWriter = CSChangeFromWriter_last(cstRemoteWriter);
+    if ((pp->strength > strength) && (csChangeFromWriter != NULL)) {
+      NtpTime persistence, persistenceExpired, actTime;
+      actTime = getActualNtpTime();
       NtpTimeAdd(persistenceExpired,
-                 csChangeFromWriter->csChange->localTimeReceived,
-                 pp->persistence);
-      if (NtpTimeCmp(persistenceExpired,actTime)>0) {
-        NtpTimeSub(persistence,
-                   persistenceExpired,
-                   actTime);
-        eventDetach(d,
-            cstReader->objectEntryOID->objectEntryAID,
-            &cstReader->persistenceTimer,
-            0);   //common timer
-        eventAdd(d,
-            cstReader->objectEntryOID->objectEntryAID,
-            &cstReader->persistenceTimer,
-            0,   //common timer
-            "CSTReaderPersistenceTimer",
-            CSTReaderPersistenceTimer,
-            &cstReader->lock,
-            cstReader,
-            &persistence);
-        cstReader->cstRemoteWriterSubscribed=cstRemoteWriter;
+                csChangeFromWriter->csChange->localTimeReceived,
+                pp->persistence);
+      if (NtpTimeCmp(persistenceExpired, actTime) > 0) {
+       NtpTimeSub(persistence,
+                  persistenceExpired,
+                  actTime);
+       eventDetach(d,
+                   cstReader->objectEntryOID->objectEntryAID,
+                   &cstReader->persistenceTimer,
+                   0); //common timer
+       eventAdd(d,
+                cstReader->objectEntryOID->objectEntryAID,
+                &cstReader->persistenceTimer,
+                0, //common timer
+                "CSTReaderPersistenceTimer",
+                CSTReaderPersistenceTimer,
+                &cstReader->lock,
+                cstReader,
+                &persistence);
+       cstReader->cstRemoteWriterSubscribed = cstRemoteWriter;
       }
     }
   }
-  if ((cstReader->cstRemoteWriterSubscribed!=NULL) && 
-      (sp->mode==IMMEDIATE)) {
+  if ((cstReader->cstRemoteWriterSubscribed != NULL) &&
+      (sp->mode == IMMEDIATE)) {
     CSTReaderProcCSChangesIssue(
-        cstReader->cstRemoteWriterSubscribed,ORTE_FALSE);
+      cstReader->cstRemoteWriterSubscribed, ORTE_FALSE);
   }
   return 0;
 }
index 7cd43a730b7f8c82467f5e38b3d13ab963518dbe..6f4dfba1aede195b984206b9ee027d71faa9ea77 100644 (file)
 /*
- *  $Id: RTPSCSTWriter.c,v 0.0.0.1      2003/09/13 
+ *  $Id: RTPSCSTWriter.c,v 0.0.0.1      2003/09/13
  *
  *  DEBUG:  section 51                  CSTWriter
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
-GAVL_CUST_NODE_INT_IMP(CSTWriter, 
-                       CSTPublications, CSTWriter, GUID_RTPS,
-                       cstWriter, node, guid, gavl_cmp_guid);
-GAVL_CUST_NODE_INT_IMP(CSTRemoteReader, 
-                       CSTWriter, CSTRemoteReader, GUID_RTPS,
-                       cstRemoteReader, node, guid, gavl_cmp_guid);
+GAVL_CUST_NODE_INT_IMP(CSTWriter,
+                      CSTPublications, CSTWriter, GUID_RTPS,
+                      cstWriter, node, guid, gavl_cmp_guid);
+GAVL_CUST_NODE_INT_IMP(CSTRemoteReader,
+                      CSTWriter, CSTRemoteReader, GUID_RTPS,
+                      cstRemoteReader, node, guid, gavl_cmp_guid);
 GAVL_CUST_NODE_INT_IMP(CSChangeForReader,
-                       CSTRemoteReader, CSChangeForReader, SequenceNumber,
-                       csChangeForReader, node, csChange->sn, gavl_cmp_sn);
+                      CSTRemoteReader, CSChangeForReader, SequenceNumber,
+                      csChangeForReader, node, csChange->sn, gavl_cmp_sn);
 
 /*****************************************************************************/
-void 
-CSTWriterInit(ORTEDomain *d,CSTWriter *cstWriter,ObjectEntryOID *object,
-              ObjectId oid,CSTWriterParams *params,ORTETypeRegister *typeRegister) {
+void
+CSTWriterInit(ORTEDomain *d, CSTWriter *cstWriter, ObjectEntryOID *object,
+             ObjectId oid, CSTWriterParams *params, ORTETypeRegister *typeRegister)
+{
 
-  debug(51,10) ("CSTWriterInit: start\n");
+  debug(51, 10) ("CSTWriterInit: start\n");
   //init values of cstwriter
-  cstWriter->guid.hid=object->objectEntryHID->hid;
-  cstWriter->guid.aid=object->objectEntryAID->aid;
-  cstWriter->guid.oid=oid;
-  cstWriter->objectEntryOID=object;
-  memcpy(&cstWriter->params,params,sizeof(CSTWriterParams));
-  cstWriter->registrationCounter=0;
+  cstWriter->guid.hid = object->objectEntryHID->hid;
+  cstWriter->guid.aid = object->objectEntryAID->aid;
+  cstWriter->guid.oid = oid;
+  cstWriter->objectEntryOID = object;
+  memcpy(&cstWriter->params, params, sizeof(CSTWriterParams));
+  cstWriter->registrationCounter = 0;
   ul_htim_queue_init_detached(&cstWriter->registrationTimer.htim);
-  cstWriter->strictReliableCounter=0;
-  cstWriter->bestEffortsCounter=0;
-  cstWriter->csChangesCounter=0;
-  cstWriter->cstRemoteReaderCounter=0;
-  cstWriter->registrationCounter=cstWriter->params.registrationRetries;
+  cstWriter->strictReliableCounter = 0;
+  cstWriter->bestEffortsCounter = 0;
+  cstWriter->csChangesCounter = 0;
+  cstWriter->cstRemoteReaderCounter = 0;
+  cstWriter->registrationCounter = cstWriter->params.registrationRetries;
   SEQUENCE_NUMBER_NONE(cstWriter->firstSN);
   SEQUENCE_NUMBER_NONE(cstWriter->lastSN);
   CSTWriterCSChange_init_head(cstWriter);
   CSTRemoteReader_init_root_field(cstWriter);
-  pthread_rwlock_init(&cstWriter->lock,NULL);
+  pthread_rwlock_init(&cstWriter->lock, NULL);
   ul_htim_queue_init_detached(&cstWriter->refreshPeriodTimer.htim);
-  cstWriter->domain=d;
-  cstWriter->typeRegister=typeRegister;
-  if ((cstWriter->guid.oid & 0x07)==OID_PUBLICATION) {
-    pthread_cond_init(&cstWriter->condCSChangeDestroyed,NULL);
-    pthread_mutex_init(&cstWriter->mutexCSChangeDestroyed,NULL);
-    cstWriter->condValueCSChangeDestroyed=0;
+  cstWriter->domain = d;
+  cstWriter->typeRegister = typeRegister;
+  if ((cstWriter->guid.oid & 0x07) == OID_PUBLICATION) {
+    pthread_cond_init(&cstWriter->condCSChangeDestroyed, NULL);
+    pthread_mutex_init(&cstWriter->mutexCSChangeDestroyed, NULL);
+    cstWriter->condValueCSChangeDestroyed = 0;
   }
   //add event for refresh
-  if (NtpTimeCmp(cstWriter->params.refreshPeriod,iNtpTime)!=0) {
-    CSTWriterRefreshTimer(d,(void*)cstWriter);
+  if (NtpTimeCmp(cstWriter->params.refreshPeriod, iNtpTime) != 0) {
+    CSTWriterRefreshTimer(d, (void *)cstWriter);
   }
-  //add event for registration 
-  if (NtpTimeCmp(cstWriter->params.registrationPeriod,zNtpTime)!=0) {
-    CSTWriterRegistrationTimer(d,(void*)cstWriter);
+  //add event for registration
+  if (NtpTimeCmp(cstWriter->params.registrationPeriod, zNtpTime) != 0) {
+    CSTWriterRegistrationTimer(d, (void *)cstWriter);
   }
-  debug(51,4) ("CSTWriterInit: 0x%x-0x%x-0x%x\n",
-                GUID_PRINTF(cstWriter->guid));
-  debug(51,10) ("CSTWriterInit: finished\n");
+  debug(51, 4) ("CSTWriterInit: 0x%x-0x%x-0x%x\n",
+               GUID_PRINTF(cstWriter->guid));
+  debug(51, 10) ("CSTWriterInit: finished\n");
 }
 
 /*****************************************************************************/
-void 
-CSTWriterDelete(ORTEDomain *d,CSTWriter *cstWriter) {
+void
+CSTWriterDelete(ORTEDomain *d, CSTWriter *cstWriter)
+{
   CSTRemoteReader       *cstRemoteReader;
   CSChange              *csChange;
 
-  debug(51,10) ("CSTWriterDelete: start\n");
-  
-  debug(51,4) ("CSTWriterDelete: 0x%x-0x%x-0x%x\n",
-                GUID_PRINTF(cstWriter->guid));
+  debug(51, 10) ("CSTWriterDelete: start\n");
+
+  debug(51, 4) ("CSTWriterDelete: 0x%x-0x%x-0x%x\n",
+               GUID_PRINTF(cstWriter->guid));
   //Destroy all cstRemoteReader connected on cstWriter
-  while((cstRemoteReader=CSTRemoteReader_first(cstWriter))) {
-    CSTWriterDestroyRemoteReader(d,cstRemoteReader);
-  }
+  while ((cstRemoteReader = CSTRemoteReader_first(cstWriter)))
+    CSTWriterDestroyRemoteReader(d, cstRemoteReader);
   //Destroy all csChnages connected on cstWriter
-  while((csChange=CSTWriterCSChange_cut_first(cstWriter))) {
+  while ((csChange = CSTWriterCSChange_cut_first(cstWriter))) {
     parameterDelete(csChange);
     FREE(csChange);
   }
   eventDetach(d,
-      cstWriter->objectEntryOID->objectEntryAID,
-      &cstWriter->refreshPeriodTimer,
-      0);
+             cstWriter->objectEntryOID->objectEntryAID,
+             &cstWriter->refreshPeriodTimer,
+             0);
   eventDetach(d,
-      cstWriter->objectEntryOID->objectEntryAID,
-      &cstWriter->registrationTimer,
-      0);
-  if ((cstWriter->guid.oid & 0x07)==OID_PUBLICATION) {
+             cstWriter->objectEntryOID->objectEntryAID,
+             &cstWriter->registrationTimer,
+             0);
+  if ((cstWriter->guid.oid & 0x07) == OID_PUBLICATION) {
     pthread_cond_destroy(&cstWriter->condCSChangeDestroyed);
     pthread_mutex_destroy(&cstWriter->mutexCSChangeDestroyed);
   }
   pthread_rwlock_destroy(&cstWriter->lock);
-  debug(51,10) ("CSTWriterDelete: finished\n");
+  debug(51, 10) ("CSTWriterDelete: finished\n");
 }
 
 /*****************************************************************************/
 CSTRemoteReader *
-CSTWriterAddRemoteReader(ORTEDomain *d,CSTWriter *cstWriter,ObjectEntryOID *pobject,
-                        ObjectId oid,ObjectEntryOID *sobject) {
+CSTWriterAddRemoteReader(ORTEDomain *d, CSTWriter *cstWriter, ObjectEntryOID *pobject,
+                        ObjectId oid, ObjectEntryOID *sobject)
+{
   CSTRemoteReader     *cstRemoteReader;
   CSChangeForReader   *csChangeForReader;
-  CSChange            *csChange=NULL;
-  
+  CSChange            *csChange = NULL;
+
   cstWriter->cstRemoteReaderCounter++;
-  cstRemoteReader=(CSTRemoteReader*)MALLOC(sizeof(CSTRemoteReader));
-  cstRemoteReader->guid.hid=pobject->guid.hid;
-  cstRemoteReader->guid.aid=pobject->guid.aid;
-  cstRemoteReader->guid.oid=oid;
-  cstRemoteReader->sobject=sobject;
-  cstRemoteReader->pobject=pobject;
-  cstRemoteReader->cstWriter=cstWriter;
+  cstRemoteReader = (CSTRemoteReader *)MALLOC(sizeof(CSTRemoteReader));
+  cstRemoteReader->guid.hid = pobject->guid.hid;
+  cstRemoteReader->guid.aid = pobject->guid.aid;
+  cstRemoteReader->guid.oid = oid;
+  cstRemoteReader->sobject = sobject;
+  cstRemoteReader->pobject = pobject;
+  cstRemoteReader->cstWriter = cstWriter;
   CSChangeForReader_init_root_field(cstRemoteReader);
-  cstRemoteReader->commStateHB=MAYSENDHB;
-  cstRemoteReader->commStateSend=NOTHNIGTOSEND;
-  cstRemoteReader->HBRetriesCounter=0;
-  cstRemoteReader->csChangesCounter=0;
-  cstRemoteReader->commStateToSentCounter=0;
+  cstRemoteReader->commStateHB = MAYSENDHB;
+  cstRemoteReader->commStateSend = NOTHNIGTOSEND;
+  cstRemoteReader->HBRetriesCounter = 0;
+  cstRemoteReader->csChangesCounter = 0;
+  cstRemoteReader->commStateToSentCounter = 0;
   NTPTIME_ZERO(cstRemoteReader->lastSentIssueTime);
   ul_htim_queue_init_detached(&cstRemoteReader->delayResponceTimer.htim);
   ul_htim_queue_init_detached(&cstRemoteReader->repeatAnnounceTimer.htim);
-  //insert remote reader 
-  CSTRemoteReader_insert(cstWriter,cstRemoteReader);
+  //insert remote reader
+  CSTRemoteReader_insert(cstWriter, cstRemoteReader);
   //multicast case
   if (cstRemoteReader->sobject->multicastPort) {
-    debug(51,9) ("cstRemoteReader 0x%x-0x%x-0x%x added to multicast list on object 0x%x-0x%x-0x%x\n",
-                 GUID_PRINTF(cstRemoteReader->guid),
-                  GUID_PRINTF(cstRemoteReader->sobject->guid));
-   ObjectEntryMulticast_insert(cstRemoteReader->sobject,
-       cstRemoteReader);
+    debug(51, 9) ("cstRemoteReader 0x%x-0x%x-0x%x added to multicast list on object 0x%x-0x%x-0x%x\n",
+                 GUID_PRINTF(cstRemoteReader->guid),
+                 GUID_PRINTF(cstRemoteReader->sobject->guid));
+    ObjectEntryMulticast_insert(cstRemoteReader->sobject,
+                               cstRemoteReader);
   }
   //copy all csChanges (not for publication)
-  if ((cstWriter->guid.oid & 0x07)!=OID_PUBLICATION) {
-    ul_list_for_each(CSTWriterCSChange,cstWriter,csChange) {
-      csChange->remoteReaderCount++;  
+  if ((cstWriter->guid.oid & 0x07) != OID_PUBLICATION) {
+    ul_list_for_each(CSTWriterCSChange, cstWriter, csChange) {
+      csChange->remoteReaderCount++;
       cstRemoteReader->csChangesCounter++;
-      csChangeForReader=(CSChangeForReader*)MALLOC(sizeof(CSChangeForReader));
-      csChangeForReader->commStateChFReader=TOSEND;
+      csChangeForReader = (CSChangeForReader *)MALLOC(sizeof(CSChangeForReader));
+      csChangeForReader->commStateChFReader = TOSEND;
       cstRemoteReader->commStateToSentCounter++;
-      csChangeForReader->csChange=csChange;
-      csChangeForReader->cstRemoteReader=cstRemoteReader;
+      csChangeForReader->csChange = csChange;
+      csChangeForReader->cstRemoteReader = cstRemoteReader;
       ul_htim_queue_init_detached(&csChangeForReader->waitWhileDataUnderwayTimer.htim);
-      CSChangeParticipant_insert(csChange,csChangeForReader);
-      CSChangeForReader_insert(cstRemoteReader,csChangeForReader);
-      cstRemoteReader->commStateSend=MUSTSENDDATA;
+      CSChangeParticipant_insert(csChange, csChangeForReader);
+      CSChangeForReader_insert(cstRemoteReader, csChangeForReader);
+      cstRemoteReader->commStateSend = MUSTSENDDATA;
     }
-    if (cstRemoteReader->commStateSend==MUSTSENDDATA) {
+    if (cstRemoteReader->commStateSend == MUSTSENDDATA) {
       eventAdd(d,
-          cstRemoteReader->sobject->objectEntryAID,
-          &cstRemoteReader->delayResponceTimer,
-          1,   
-          "CSTWriterSendTimer",
-          CSTWriterSendTimer,
-          &cstRemoteReader->cstWriter->lock,
-          cstRemoteReader,
-          &cstRemoteReader->cstWriter->params.delayResponceTime);               
+              cstRemoteReader->sobject->objectEntryAID,
+              &cstRemoteReader->delayResponceTimer,
+              1,
+              "CSTWriterSendTimer",
+              CSTWriterSendTimer,
+              &cstRemoteReader->cstWriter->lock,
+              cstRemoteReader,
+              &cstRemoteReader->cstWriter->params.delayResponceTime);
     }
   } else {
     //Publication
-    ORTESubsProp *sp=(ORTESubsProp*)pobject->attributes;
-    if ((sp->reliabilityRequested & PID_VALUE_RELIABILITY_STRICT)!=0)
+    ORTESubsProp *sp = (ORTESubsProp *)pobject->attributes;
+    if ((sp->reliabilityRequested & PID_VALUE_RELIABILITY_STRICT) != 0)
       cstWriter->strictReliableCounter++;
     else {
-      if ((sp->reliabilityRequested & PID_VALUE_RELIABILITY_BEST_EFFORTS)!=0)
-        cstWriter->bestEffortsCounter++;
+      if ((sp->reliabilityRequested & PID_VALUE_RELIABILITY_BEST_EFFORTS) != 0)
+       cstWriter->bestEffortsCounter++;
     }
   }
-  debug(51,4) ("CSTWriterAddRemoteReader: 0x%x-0x%x-0x%x\n",
-                GUID_PRINTF(cstRemoteReader->guid));
+  debug(51, 4) ("CSTWriterAddRemoteReader: 0x%x-0x%x-0x%x\n",
+               GUID_PRINTF(cstRemoteReader->guid));
   return cstRemoteReader;
 }
 
 /*****************************************************************************/
-void 
-CSTWriterDestroyRemoteReader(ORTEDomain *d,CSTRemoteReader *cstRemoteReader) {
+void
+CSTWriterDestroyRemoteReader(ORTEDomain *d, CSTRemoteReader *cstRemoteReader)
+{
   CSChangeForReader   *csChangeForReader;
-  
-  if (!cstRemoteReader) return;
+
+  if (!cstRemoteReader)
+    return;
   cstRemoteReader->cstWriter->cstRemoteReaderCounter--;
-  debug(51,4) ("CSTWriterDestroyRemoteReader: 0x%x-0x%x-0x%x\n",
-                GUID_PRINTF(cstRemoteReader->guid));
-  if ((cstRemoteReader->cstWriter->guid.oid & 0x07)==OID_PUBLICATION) {
+  debug(51, 4) ("CSTWriterDestroyRemoteReader: 0x%x-0x%x-0x%x\n",
+               GUID_PRINTF(cstRemoteReader->guid));
+  if ((cstRemoteReader->cstWriter->guid.oid & 0x07) == OID_PUBLICATION) {
     ORTESubsProp *sp;
-    sp=(ORTESubsProp*)cstRemoteReader->pobject->attributes;
-    if ((sp->reliabilityRequested & PID_VALUE_RELIABILITY_STRICT)!=0)
+    sp = (ORTESubsProp *)cstRemoteReader->pobject->attributes;
+    if ((sp->reliabilityRequested & PID_VALUE_RELIABILITY_STRICT) != 0)
       cstRemoteReader->cstWriter->strictReliableCounter--;
     else {
-      if ((sp->reliabilityRequested & PID_VALUE_RELIABILITY_BEST_EFFORTS)!=0)
-        cstRemoteReader->cstWriter->bestEffortsCounter--;
+      if ((sp->reliabilityRequested & PID_VALUE_RELIABILITY_BEST_EFFORTS) != 0)
+       cstRemoteReader->cstWriter->bestEffortsCounter--;
     }
-  }  
-  while((csChangeForReader=CSChangeForReader_first(cstRemoteReader))) {
-    CSTWriterDestroyCSChangeForReader(
-        csChangeForReader,ORTE_TRUE);
   }
+  while ((csChangeForReader = CSChangeForReader_first(cstRemoteReader)))
+    CSTWriterDestroyCSChangeForReader(
+      csChangeForReader, ORTE_TRUE);
   eventDetach(d,
-      cstRemoteReader->sobject->objectEntryAID,
-      &cstRemoteReader->delayResponceTimer,
-      1);   //metatraffic timer
+             cstRemoteReader->sobject->objectEntryAID,
+             &cstRemoteReader->delayResponceTimer,
+             1); //metatraffic timer
   eventDetach(d,
-      cstRemoteReader->sobject->objectEntryAID,
-      &cstRemoteReader->delayResponceTimer,
-      2);   //userdata timer
+             cstRemoteReader->sobject->objectEntryAID,
+             &cstRemoteReader->delayResponceTimer,
+             2); //userdata timer
   eventDetach(d,
-      cstRemoteReader->sobject->objectEntryAID,
-      &cstRemoteReader->repeatAnnounceTimer,
-      1);   //metatraffic timer
+             cstRemoteReader->sobject->objectEntryAID,
+             &cstRemoteReader->repeatAnnounceTimer,
+             1); //metatraffic timer
   eventDetach(d,
-      cstRemoteReader->sobject->objectEntryAID,
-      &cstRemoteReader->repeatAnnounceTimer,
-      2);   //userdata timer
+             cstRemoteReader->sobject->objectEntryAID,
+             &cstRemoteReader->repeatAnnounceTimer,
+             2); //userdata timer
   //multicast case
   if (cstRemoteReader->sobject->multicastPort) {
     ObjectEntryOID *object;
 
-    object=cstRemoteReader->sobject;
+    object = cstRemoteReader->sobject;
 
-    ObjectEntryMulticast_delete(object,cstRemoteReader);
-    debug(51,9) ("cstRemoteReader 0x%x-0x%x-0x%x deleted from multicast list on object 0x%x-0x%x-0x%x\n",
-                 GUID_PRINTF(cstRemoteReader->guid),
-                  GUID_PRINTF(object->guid));
+    ObjectEntryMulticast_delete(object, cstRemoteReader);
+    debug(51, 9) ("cstRemoteReader 0x%x-0x%x-0x%x deleted from multicast list on object 0x%x-0x%x-0x%x\n",
+                 GUID_PRINTF(cstRemoteReader->guid),
+                 GUID_PRINTF(object->guid));
 
     if (ObjectEntryMulticast_is_empty(object)) {
-      objectEntryDelete(d,object,ORTE_TRUE);
+      objectEntryDelete(d, object, ORTE_TRUE);
     }
   }
-  CSTRemoteReader_delete(cstRemoteReader->cstWriter,cstRemoteReader);
+  CSTRemoteReader_delete(cstRemoteReader->cstWriter, cstRemoteReader);
   FREE(cstRemoteReader);
 }
 
 /*****************************************************************************/
 void
-CSTWriterMakeGAP(ORTEDomain *d,CSTWriter *cstWriter,GUID_RTPS *guid) {
-  CSChange            *csChange,*csChange1;
+CSTWriterMakeGAP(ORTEDomain *d, CSTWriter *cstWriter, GUID_RTPS *guid)
+{
+  CSChange            *csChange, *csChange1;
 
-  ul_list_for_each(CSTWriterCSChange,cstWriter,csChange) {
-    if ((!SeqNumberCmp(csChange->gapSN,noneSN)) &&
-        (!gavl_cmp_guid(&csChange->guid,guid))) {  //equal? (VAR)
+  ul_list_for_each(CSTWriterCSChange, cstWriter, csChange) {
+    if ((!SeqNumberCmp(csChange->gapSN, noneSN)) &&
+       (!gavl_cmp_guid(&csChange->guid, guid))) {  //equal? (VAR)
       //VAR->GAP - inc gap_sn_no
-      SeqNumberInc(csChange->gapSN,csChange->gapSN);  
+      SeqNumberInc(csChange->gapSN, csChange->gapSN);
       parameterDelete(csChange);
       //is Gap in prior or next position?
-      csChange1=CSTWriterCSChange_prev(cstWriter,csChange);
+      csChange1 = CSTWriterCSChange_prev(cstWriter, csChange);
       if (csChange1) {
-        if (SeqNumberCmp(csChange1->gapSN,noneSN)) {
-          SeqNumberAdd(csChange1->gapSN,
-                       csChange1->gapSN,
-                       csChange->gapSN);
-          CSTWriterDestroyCSChange(d,cstWriter,csChange);
-          csChange=csChange1;
-        }
+       if (SeqNumberCmp(csChange1->gapSN, noneSN)) {
+         SeqNumberAdd(csChange1->gapSN,
+                      csChange1->gapSN,
+                      csChange->gapSN);
+         CSTWriterDestroyCSChange(d, cstWriter, csChange);
+         csChange = csChange1;
+       }
       }
-      csChange1=CSTWriterCSChange_next(cstWriter,csChange);
+      csChange1 = CSTWriterCSChange_next(cstWriter, csChange);
       if (csChange1) {
-        if (SeqNumberCmp(csChange1->gapSN,noneSN)) {
-          SeqNumberAdd(csChange->gapSN,
-                       csChange->gapSN,
-                       csChange1->gapSN);
-          CSTWriterDestroyCSChange(d,cstWriter,csChange1);
-        }
+       if (SeqNumberCmp(csChange1->gapSN, noneSN)) {
+         SeqNumberAdd(csChange->gapSN,
+                      csChange->gapSN,
+                      csChange1->gapSN);
+         CSTWriterDestroyCSChange(d, cstWriter, csChange1);
+       }
       }
       break;
     }
@@ -293,194 +297,199 @@ CSTWriterMakeGAP(ORTEDomain *d,CSTWriter *cstWriter,GUID_RTPS *guid) {
 
 /*****************************************************************************/
 void
-CSTWriterAddCSChange(ORTEDomain *d,CSTWriter *cstWriter,CSChange *csChange) {
+CSTWriterAddCSChange(ORTEDomain *d, CSTWriter *cstWriter, CSChange *csChange)
+{
   CSChangeForReader   *csChangeForReader;
   CSTRemoteReader     *cstRemoteReader;
   CSChange            *csChangeFSN;
-  
-  debug(51,5) ("CSTWriterAddCSChange: cstWriter:0x%x-0x%x-0x%x\n",
-                GUID_PRINTF(cstWriter->guid));
+
+  debug(51, 5) ("CSTWriterAddCSChange: cstWriter:0x%x-0x%x-0x%x\n",
+               GUID_PRINTF(cstWriter->guid));
   cstWriter->csChangesCounter++;
   //look for old cschange
-  if ((cstWriter->guid.oid & 0x07)!=OID_PUBLICATION)
-    CSTWriterMakeGAP(d,cstWriter,&csChange->guid);
+  if ((cstWriter->guid.oid & 0x07) != OID_PUBLICATION)
+    CSTWriterMakeGAP(d, cstWriter, &csChange->guid);
   //insert cschange into database changes
-  SeqNumberInc(cstWriter->lastSN,cstWriter->lastSN);
-  csChange->sn=cstWriter->lastSN;
+  SeqNumberInc(cstWriter->lastSN, cstWriter->lastSN);
+  csChange->sn = cstWriter->lastSN;
   SEQUENCE_NUMBER_NONE(csChange->gapSN);
-  csChange->remoteReaderCount=cstWriter->cstRemoteReaderCounter;  
-  csChange->remoteReaderBest=0;
-  csChange->remoteReaderStrict=0;
+  csChange->remoteReaderCount = cstWriter->cstRemoteReaderCounter;
+  csChange->remoteReaderBest = 0;
+  csChange->remoteReaderStrict = 0;
   CSChangeParticipant_init_head(csChange);
-  CSTWriterCSChange_insert(cstWriter,csChange);
-  debug(51,5) ("CSTWriterAddCSChange: sn:0x%x\n",
-               csChange->sn.low);
+  CSTWriterCSChange_insert(cstWriter, csChange);
+  debug(51, 5) ("CSTWriterAddCSChange: sn:0x%x\n",
+               csChange->sn.low);
   //update FirstSN
-  csChangeFSN=CSTWriterCSChange_first(cstWriter);
-  if (SeqNumberCmp(csChangeFSN->gapSN,noneSN)>0) {
+  csChangeFSN = CSTWriterCSChange_first(cstWriter);
+  if (SeqNumberCmp(csChangeFSN->gapSN, noneSN) > 0) {
     //minimal are 2 SNs (GAP,VAR) ...
 //    CSTWriterDestroyCSChange(cstWriter,csChange);
   }
-  csChangeFSN=CSTWriterCSChange_first(cstWriter);
-  cstWriter->firstSN=csChangeFSN->sn;
+  csChangeFSN = CSTWriterCSChange_first(cstWriter);
+  cstWriter->firstSN = csChangeFSN->sn;
   //insert new cschange for each reader
-  gavl_cust_for_each(CSTRemoteReader,cstWriter,cstRemoteReader) {
+  gavl_cust_for_each(CSTRemoteReader, cstWriter, cstRemoteReader) {
     //csChangeForReader
-    debug(51,10) ("CSTWriterAddCSChange: sending to cstRemoteReader 0x%x-0x%x-0x%x\n",
+    debug(51, 10) ("CSTWriterAddCSChange: sending to cstRemoteReader 0x%x-0x%x-0x%x\n",
                   GUID_PRINTF(cstRemoteReader->guid));
-    csChangeForReader=(CSChangeForReader*)MALLOC(sizeof(CSChangeForReader));
-    csChangeForReader->commStateChFReader=TOSEND;
+    csChangeForReader = (CSChangeForReader *)MALLOC(sizeof(CSChangeForReader));
+    csChangeForReader->commStateChFReader = TOSEND;
     cstRemoteReader->commStateToSentCounter++;
-    csChangeForReader->csChange=csChange;
-    csChangeForReader->cstRemoteReader=cstRemoteReader;
+    csChangeForReader->csChange = csChange;
+    csChangeForReader->cstRemoteReader = cstRemoteReader;
     ul_htim_queue_init_detached(&csChangeForReader->waitWhileDataUnderwayTimer.htim);
-    CSChangeParticipant_insert(csChange,csChangeForReader);
-    CSChangeForReader_insert(cstRemoteReader,csChangeForReader);
+    CSChangeParticipant_insert(csChange, csChangeForReader);
+    CSChangeForReader_insert(cstRemoteReader, csChangeForReader);
     cstRemoteReader->csChangesCounter++;
-    cstRemoteReader->HBRetriesCounter=0;
-    cstRemoteReader->commStateSend=MUSTSENDDATA;
-    if ((cstWriter->guid.oid & 0x07)!=OID_PUBLICATION) {
+    cstRemoteReader->HBRetriesCounter = 0;
+    cstRemoteReader->commStateSend = MUSTSENDDATA;
+    if ((cstWriter->guid.oid & 0x07) != OID_PUBLICATION) {
       eventDetach(d,
-          cstRemoteReader->sobject->objectEntryAID,
-          &cstRemoteReader->delayResponceTimer,
-          1);
+                 cstRemoteReader->sobject->objectEntryAID,
+                 &cstRemoteReader->delayResponceTimer,
+                 1);
       eventAdd(d,
-          cstRemoteReader->sobject->objectEntryAID,
-          &cstRemoteReader->delayResponceTimer,
-          1,   
-          "CSTWriterSendTimer",
-          CSTWriterSendTimer,
-          &cstRemoteReader->cstWriter->lock,
-          cstRemoteReader,
-          NULL);
+              cstRemoteReader->sobject->objectEntryAID,
+              &cstRemoteReader->delayResponceTimer,
+              1,
+              "CSTWriterSendTimer",
+              CSTWriterSendTimer,
+              &cstRemoteReader->cstWriter->lock,
+              cstRemoteReader,
+              NULL);
     } else {
-      ORTESubsProp *sp=(ORTESubsProp*)cstRemoteReader->pobject->attributes;
-
-      if ((sp->reliabilityRequested & PID_VALUE_RELIABILITY_STRICT)!=0) {
-        //Strict reliable subscription
-        csChange->remoteReaderStrict++;
-        eventDetach(d,
-            cstRemoteReader->sobject->objectEntryAID,
-            &cstRemoteReader->delayResponceTimer,
-            2);
-        eventAdd(d,
-            cstRemoteReader->sobject->objectEntryAID,
-            &cstRemoteReader->delayResponceTimer,
-            2,   
-            "CSTWriterSendStrictTimer",
-            CSTWriterSendStrictTimer,
-            &cstRemoteReader->cstWriter->lock,
-            cstRemoteReader,
-            NULL);
+      ORTESubsProp *sp = (ORTESubsProp *)cstRemoteReader->pobject->attributes;
+
+      if ((sp->reliabilityRequested & PID_VALUE_RELIABILITY_STRICT) != 0) {
+       //Strict reliable subscription
+       csChange->remoteReaderStrict++;
+       eventDetach(d,
+                   cstRemoteReader->sobject->objectEntryAID,
+                   &cstRemoteReader->delayResponceTimer,
+                   2);
+       eventAdd(d,
+                cstRemoteReader->sobject->objectEntryAID,
+                &cstRemoteReader->delayResponceTimer,
+                2,
+                "CSTWriterSendStrictTimer",
+                CSTWriterSendStrictTimer,
+                &cstRemoteReader->cstWriter->lock,
+                cstRemoteReader,
+                NULL);
       } else {
-        if ((sp->reliabilityRequested & PID_VALUE_RELIABILITY_BEST_EFFORTS)!=0) {
-          //best efforts subscription
-          NtpTime nextIssueTime,nextIssueDelay,actTime;
-
-         actTime=getActualNtpTime();
-          csChange->remoteReaderBest++;
-          NtpTimeAdd(nextIssueTime,
-                    cstRemoteReader->lastSentIssueTime,
-                    sp->minimumSeparation);
-          NtpTimeSub(nextIssueDelay,
-                    nextIssueTime,
-                    actTime);
-          if (NtpTimeCmp(actTime,nextIssueTime)>=0) 
-            NTPTIME_ZERO(nextIssueDelay);
-          eventDetach(d,
-              cstRemoteReader->sobject->objectEntryAID,
-              &cstRemoteReader->delayResponceTimer,
-              2);
-          //schedule sent issue 
-          eventAdd(d,
-              cstRemoteReader->sobject->objectEntryAID,
-              &cstRemoteReader->delayResponceTimer,
-              2,   
-              "CSTWriterSendBestEffortTimer",
-              CSTWriterSendBestEffortTimer,
-              &cstRemoteReader->cstWriter->lock,
-              cstRemoteReader,
-              &nextIssueDelay);
-        } else {
-          //!Best_Effort & !Strict_Reliable
-          CSTWriterDestroyCSChangeForReader(csChangeForReader,
-            ORTE_TRUE);
-          debug(51,5) ("CSTWriterAddCSChange: destroyed\n");         
-        }
+       if ((sp->reliabilityRequested & PID_VALUE_RELIABILITY_BEST_EFFORTS) != 0) {
+         //best efforts subscription
+         NtpTime nextIssueTime, nextIssueDelay, actTime;
+
+         actTime = getActualNtpTime();
+         csChange->remoteReaderBest++;
+         NtpTimeAdd(nextIssueTime,
+                    cstRemoteReader->lastSentIssueTime,
+                    sp->minimumSeparation);
+         NtpTimeSub(nextIssueDelay,
+                    nextIssueTime,
+                    actTime);
+         if (NtpTimeCmp(actTime, nextIssueTime) >= 0)
+           NTPTIME_ZERO(nextIssueDelay);
+         eventDetach(d,
+                     cstRemoteReader->sobject->objectEntryAID,
+                     &cstRemoteReader->delayResponceTimer,
+                     2);
+         //schedule sent issue
+         eventAdd(d,
+                  cstRemoteReader->sobject->objectEntryAID,
+                  &cstRemoteReader->delayResponceTimer,
+                  2,
+                  "CSTWriterSendBestEffortTimer",
+                  CSTWriterSendBestEffortTimer,
+                  &cstRemoteReader->cstWriter->lock,
+                  cstRemoteReader,
+                  &nextIssueDelay);
+       } else {
+         //!Best_Effort & !Strict_Reliable
+         CSTWriterDestroyCSChangeForReader(csChangeForReader,
+                                           ORTE_TRUE);
+         debug(51, 5) ("CSTWriterAddCSChange: destroyed\n");
+       }
       }
     }
-    debug(51,5) ("CSTWriterAddCSChange: scheduled Var | Gap | Issue | HB \n");
+    debug(51, 5) ("CSTWriterAddCSChange: scheduled Var | Gap | Issue | HB \n");
   }
-  debug(51,5) ("CSTWriterAddCSChange: finished\n");
+  debug(51, 5) ("CSTWriterAddCSChange: finished\n");
 }
 
 /*****************************************************************************/
-void 
+void
 CSTWriterDestroyCSChangeForReader(CSChangeForReader *csChangeForReader,
-    Boolean destroyCSChange) {
+                                 Boolean destroyCSChange)
+{
   CSTRemoteReader *cstRemoteReader;
   CSChange *csChange;
-  
-  if (!csChangeForReader) return;
-  cstRemoteReader=csChangeForReader->cstRemoteReader;
-  csChange=csChangeForReader->csChange;
-  csChange->remoteReaderCount--;  
+
+  if (!csChangeForReader)
+    return;
+  cstRemoteReader = csChangeForReader->cstRemoteReader;
+  csChange = csChangeForReader->csChange;
+  csChange->remoteReaderCount--;
   cstRemoteReader->csChangesCounter--;
   if (!cstRemoteReader->csChangesCounter) {
-    cstRemoteReader->commStateSend=NOTHNIGTOSEND;
+    cstRemoteReader->commStateSend = NOTHNIGTOSEND;
   }
-  if (csChangeForReader->commStateChFReader==TOSEND) {
+  if (csChangeForReader->commStateChFReader == TOSEND) {
     cstRemoteReader->commStateToSentCounter--;
   }
-  if ((cstRemoteReader->cstWriter->guid.oid & 0x07)==OID_PUBLICATION) {
-    ORTESubsProp *sp=(ORTESubsProp*)cstRemoteReader->pobject->attributes;
-    if ((sp->reliabilityRequested & PID_VALUE_RELIABILITY_STRICT)!=0) {
-        csChange->remoteReaderStrict--;
+  if ((cstRemoteReader->cstWriter->guid.oid & 0x07) == OID_PUBLICATION) {
+    ORTESubsProp *sp = (ORTESubsProp *)cstRemoteReader->pobject->attributes;
+    if ((sp->reliabilityRequested & PID_VALUE_RELIABILITY_STRICT) != 0) {
+      csChange->remoteReaderStrict--;
     } else {
-      if ((sp->reliabilityRequested & PID_VALUE_RELIABILITY_BEST_EFFORTS)!=0) {
-        csChange->remoteReaderBest--;
+      if ((sp->reliabilityRequested & PID_VALUE_RELIABILITY_BEST_EFFORTS) != 0) {
+       csChange->remoteReaderBest--;
       }
     }
-  }  
+  }
   eventDetach(cstRemoteReader->cstWriter->domain,
-      cstRemoteReader->sobject->objectEntryAID,
-      &csChangeForReader->waitWhileDataUnderwayTimer,
-      0);
-  CSChangeParticipant_delete(csChange,csChangeForReader);
-  CSChangeForReader_delete(cstRemoteReader,csChangeForReader);
+             cstRemoteReader->sobject->objectEntryAID,
+             &csChangeForReader->waitWhileDataUnderwayTimer,
+             0);
+  CSChangeParticipant_delete(csChange, csChangeForReader);
+  CSChangeForReader_delete(cstRemoteReader, csChangeForReader);
   FREE(csChangeForReader);
 
-  if ((cstRemoteReader->cstWriter->guid.oid & 0x07)==OID_PUBLICATION) {
+  if ((cstRemoteReader->cstWriter->guid.oid & 0x07) == OID_PUBLICATION) {
     if (!csChange->remoteReaderCount) {
       if (destroyCSChange) {
-        CSTWriterDestroyCSChange(cstRemoteReader->cstWriter->domain,
-            cstRemoteReader->cstWriter,csChange);
+       CSTWriterDestroyCSChange(cstRemoteReader->cstWriter->domain,
+                                cstRemoteReader->cstWriter, csChange);
       }
       pthread_mutex_lock(&cstRemoteReader->cstWriter->mutexCSChangeDestroyed);
-      cstRemoteReader->cstWriter->condValueCSChangeDestroyed=1;
+      cstRemoteReader->cstWriter->condValueCSChangeDestroyed = 1;
       pthread_cond_signal(&cstRemoteReader->cstWriter->condCSChangeDestroyed);
       pthread_mutex_unlock(&cstRemoteReader->cstWriter->mutexCSChangeDestroyed);
-      debug(51,5) ("Publication: new queue level (%d)\n",
-                  cstRemoteReader->cstWriter->csChangesCounter);
+      debug(51, 5) ("Publication: new queue level (%d)\n",
+                   cstRemoteReader->cstWriter->csChangesCounter);
     }
   }
 }
 
 /*****************************************************************************/
-void 
-CSTWriterDestroyCSChange(ORTEDomain *d,CSTWriter *cstWriter,CSChange *csChange) {
+void
+CSTWriterDestroyCSChange(ORTEDomain *d, CSTWriter *cstWriter, CSChange *csChange)
+{
   CSTRemoteReader     *cstRemoteReader;
   CSChangeForReader   *csChangeForReader;
   CSChange            *csChangeFSN;
 
-  if (!csChange) return;
+  if (!csChange)
+    return;
 
   cstWriter->csChangesCounter--;
-  CSTWriterCSChange_delete(cstWriter,csChange);
-  gavl_cust_for_each(CSTRemoteReader,cstWriter,cstRemoteReader) {
-    csChangeForReader=CSChangeForReader_find(cstRemoteReader,&csChange->sn);
+  CSTWriterCSChange_delete(cstWriter, csChange);
+  gavl_cust_for_each(CSTRemoteReader, cstWriter, cstRemoteReader) {
+    csChangeForReader = CSChangeForReader_find(cstRemoteReader, &csChange->sn);
     CSTWriterDestroyCSChangeForReader(
-        csChangeForReader,ORTE_FALSE);
+      csChangeForReader, ORTE_FALSE);
   }
 
   if (csChange->cdrCodec.buffer)
@@ -489,22 +498,23 @@ CSTWriterDestroyCSChange(ORTEDomain *d,CSTWriter *cstWriter,CSChange *csChange)
   FREE(csChange);
 
   //update first SN
-  csChangeFSN=CSTWriterCSChange_first(cstWriter);
+  csChangeFSN = CSTWriterCSChange_first(cstWriter);
   if (csChangeFSN)
-    cstWriter->firstSN=csChangeFSN->sn;
+    cstWriter->firstSN = csChangeFSN->sn;
   else
-    cstWriter->firstSN=cstWriter->lastSN;
+    cstWriter->firstSN = cstWriter->lastSN;
 }
 
 /*****************************************************************************/
 Boolean
-CSTWriterTryDestroyBestEffortIssue(CSTWriter *cstWriter) {
+CSTWriterTryDestroyBestEffortIssue(CSTWriter *cstWriter)
+{
   CSChange *csChange;
 
-  ul_list_for_each(CSTWriterCSChange,cstWriter,csChange) {
+  ul_list_for_each(CSTWriterCSChange, cstWriter, csChange) {
 
     if (!csChange->remoteReaderStrict) {
-      CSTWriterDestroyCSChange(cstWriter->domain,cstWriter,csChange);
+      CSTWriterDestroyCSChange(cstWriter->domain, cstWriter, csChange);
       return ORTE_TRUE;
     }
   }
@@ -513,38 +523,39 @@ CSTWriterTryDestroyBestEffortIssue(CSTWriter *cstWriter) {
 
 /*****************************************************************************/
 void
-CSTWriterRefreshAllCSChanges(ORTEDomain *d,CSTRemoteReader *cstRemoteReader) {
+CSTWriterRefreshAllCSChanges(ORTEDomain *d, CSTRemoteReader *cstRemoteReader)
+{
   CSChangeForReader   *csChangeForReader;
-  int32_t             timerQueue=1;
-  
-  if ((cstRemoteReader->cstWriter->guid.oid & 0x07)==OID_PUBLICATION)
-    timerQueue=2; //userdata timer queue
+  int32_t             timerQueue = 1;
+
+  if ((cstRemoteReader->cstWriter->guid.oid & 0x07) == OID_PUBLICATION)
+    timerQueue = 2;  //userdata timer queue
 
-  gavl_cust_for_each(CSChangeForReader,cstRemoteReader,csChangeForReader) {
+  gavl_cust_for_each(CSChangeForReader, cstRemoteReader, csChangeForReader) {
 
     //refresh only VAR's
-    if (SeqNumberCmp(csChangeForReader->csChange->gapSN,noneSN)==0) { 
-      
-      if (csChangeForReader->commStateChFReader!=TOSEND) {
-        csChangeForReader->commStateChFReader=TOSEND;
-        cstRemoteReader->commStateToSentCounter++;
+    if (SeqNumberCmp(csChangeForReader->csChange->gapSN, noneSN) == 0) {
+
+      if (csChangeForReader->commStateChFReader != TOSEND) {
+       csChangeForReader->commStateChFReader = TOSEND;
+       cstRemoteReader->commStateToSentCounter++;
       }
 
-      if (cstRemoteReader->commStateSend==NOTHNIGTOSEND) {
-        cstRemoteReader->commStateSend=MUSTSENDDATA;
-        eventDetach(d,
-            cstRemoteReader->sobject->objectEntryAID,
-            &cstRemoteReader->delayResponceTimer,
-            timerQueue);
-        eventAdd(d,
-            cstRemoteReader->sobject->objectEntryAID,
-            &cstRemoteReader->delayResponceTimer,
-            timerQueue,  
-            "CSTWriterSendTimer",
-            CSTWriterSendTimer,
-            &cstRemoteReader->cstWriter->lock,
-            cstRemoteReader,
-            &cstRemoteReader->cstWriter->params.delayResponceTime);               
+      if (cstRemoteReader->commStateSend == NOTHNIGTOSEND) {
+       cstRemoteReader->commStateSend = MUSTSENDDATA;
+       eventDetach(d,
+                   cstRemoteReader->sobject->objectEntryAID,
+                   &cstRemoteReader->delayResponceTimer,
+                   timerQueue);
+       eventAdd(d,
+                cstRemoteReader->sobject->objectEntryAID,
+                &cstRemoteReader->delayResponceTimer,
+                timerQueue,
+                "CSTWriterSendTimer",
+                CSTWriterSendTimer,
+                &cstRemoteReader->cstWriter->lock,
+                cstRemoteReader,
+                &cstRemoteReader->cstWriter->params.delayResponceTime);
       }
     }
   }
@@ -552,81 +563,82 @@ CSTWriterRefreshAllCSChanges(ORTEDomain *d,CSTRemoteReader *cstRemoteReader) {
 
 /*****************************************************************************/
 int
-CSTWriterCSChangeForReaderNewState(CSChangeForReader *csChangeForReader) 
+CSTWriterCSChangeForReaderNewState(CSChangeForReader *csChangeForReader)
 {
-  CSTRemoteReader *cstRemoteReader=csChangeForReader->cstRemoteReader;
+  CSTRemoteReader *cstRemoteReader = csChangeForReader->cstRemoteReader;
 
   //setup new state for csChangeForReader
-  if (csChangeForReader->commStateChFReader!=TOSEND) return -1;
+  if (csChangeForReader->commStateChFReader != TOSEND)
+    return -1;
   cstRemoteReader->commStateToSentCounter--;
 
   if (!cstRemoteReader->commStateToSentCounter)
-       cstRemoteReader->commStateSend=NOTHNIGTOSEND;
+    cstRemoteReader->commStateSend = NOTHNIGTOSEND;
 
   if (NtpTimeCmp(zNtpTime,
-        cstRemoteReader->cstWriter->params.waitWhileDataUnderwayTime)==0) {
-       csChangeForReader->commStateChFReader=UNACKNOWLEDGED;
+                cstRemoteReader->cstWriter->params.waitWhileDataUnderwayTime) == 0) {
+    csChangeForReader->commStateChFReader = UNACKNOWLEDGED;
   } else {
-    csChangeForReader->commStateChFReader=UNDERWAY;
+    csChangeForReader->commStateChFReader = UNDERWAY;
     eventDetach(cstRemoteReader->cstWriter->domain,
-               cstRemoteReader->sobject->objectEntryAID,
-               &csChangeForReader->waitWhileDataUnderwayTimer,
-               0);
+               cstRemoteReader->sobject->objectEntryAID,
+               &csChangeForReader->waitWhileDataUnderwayTimer,
+               0);
     eventAdd(cstRemoteReader->cstWriter->domain,
-            cstRemoteReader->sobject->objectEntryAID,
-             &csChangeForReader->waitWhileDataUnderwayTimer,
-             0,   //common timer
-             "CSChangeForReaderUnderwayTimer",
-             CSChangeForReaderUnderwayTimer,
-             &cstRemoteReader->cstWriter->lock,
-             csChangeForReader,
-             &cstRemoteReader->cstWriter->params.waitWhileDataUnderwayTime);
+            cstRemoteReader->sobject->objectEntryAID,
+            &csChangeForReader->waitWhileDataUnderwayTimer,
+            0,   //common timer
+            "CSChangeForReaderUnderwayTimer",
+            CSChangeForReaderUnderwayTimer,
+            &cstRemoteReader->cstWriter->lock,
+            csChangeForReader,
+            &cstRemoteReader->cstWriter->params.waitWhileDataUnderwayTime);
   }
   return 0;
 }
 
 /*****************************************************************************/
 void
-CSTWriterMulticast(CSChangeForReader *csChangeForReader) 
+CSTWriterMulticast(CSChangeForReader *csChangeForReader)
 {
-    CSTRemoteReader     *cstRemoteReader;
-    ObjectEntryOID     *objectEntryOID;
-    CSChangeForReader   *csChangeForReader1;
-    char                queue=1;
-    
-    cstRemoteReader=csChangeForReader->cstRemoteReader;
-    objectEntryOID=cstRemoteReader->sobject;
-
-    //multicast can do an application with multicast interface
-    if (!objectEntryOID->multicastPort)
-        return;
-
-    ul_list_for_each(CSChangeParticipant,
-                    csChangeForReader->csChange,
-                    csChangeForReader1) {
-        ObjectEntryOID  *objectEntryOID1;
-        CSTRemoteReader *cstRemoteReader1;
-      
-        cstRemoteReader1=csChangeForReader1->cstRemoteReader;
-        objectEntryOID1=cstRemoteReader1->sobject;
-                  
-        /* are RRs from same GROUP */
-        if (objectEntryOID!=objectEntryOID1)
-          continue;
-
-        /* is the csChange in state TOSEND ? If yes, marks like proc. */
-        CSTWriterCSChangeForReaderNewState(csChangeForReader1);
-
-        /* if there are no messages, detach sending timer */
-        if (!(cstRemoteReader->commStateSend==NOTHNIGTOSEND) &&
-            !(cstRemoteReader->commStateHB==MAYSENDHB))
-           continue;
-
-        if ((cstRemoteReader->cstWriter->guid.oid & 0x07)==OID_PUBLICATION) 
-          queue=2;
-        eventDetach(cstRemoteReader->cstWriter->domain,
-                   cstRemoteReader->sobject->objectEntryAID,
-                   &cstRemoteReader->delayResponceTimer,
-                   queue);
-    }
+  CSTRemoteReader     *cstRemoteReader;
+  ObjectEntryOID      *objectEntryOID;
+  CSChangeForReader   *csChangeForReader1;
+  char                queue = 1;
+
+  cstRemoteReader = csChangeForReader->cstRemoteReader;
+  objectEntryOID = cstRemoteReader->sobject;
+
+  //multicast can do an application with multicast interface
+  if (!objectEntryOID->multicastPort)
+    return;
+
+  ul_list_for_each(CSChangeParticipant,
+                  csChangeForReader->csChange,
+                  csChangeForReader1) {
+    ObjectEntryOID  *objectEntryOID1;
+    CSTRemoteReader *cstRemoteReader1;
+
+    cstRemoteReader1 = csChangeForReader1->cstRemoteReader;
+    objectEntryOID1 = cstRemoteReader1->sobject;
+
+    /* are RRs from same GROUP */
+    if (objectEntryOID != objectEntryOID1)
+      continue;
+
+    /* is the csChange in state TOSEND ? If yes, marks like proc. */
+    CSTWriterCSChangeForReaderNewState(csChangeForReader1);
+
+    /* if there are no messages, detach sending timer */
+    if (!(cstRemoteReader->commStateSend == NOTHNIGTOSEND) &&
+       !(cstRemoteReader->commStateHB == MAYSENDHB))
+      continue;
+
+    if ((cstRemoteReader->cstWriter->guid.oid & 0x07) == OID_PUBLICATION)
+      queue = 2;
+    eventDetach(cstRemoteReader->cstWriter->domain,
+               cstRemoteReader->sobject->objectEntryAID,
+               &cstRemoteReader->delayResponceTimer,
+               queue);
+  }
 }
index c00dcf7a7cffac4b5cb7ec1f63597efedd66993c..09c9ba362125bee55c7d5d63423f66707d3beb0f 100644 (file)
 /*
- *  $Id: RTPSCSTWriterTimer.c,v 0.0.0.1 2003/10/19 
+ *  $Id: RTPSCSTWriterTimer.c,v 0.0.0.1 2003/10/19
  *
  *  DEBUG:  section 52                  CSTWriter timer functions
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
 /*****************************************************************************/
-int 
-CSTWriterRegistrationTimer(ORTEDomain *d,void *vcstWriter) {
-  CSTWriter *cstWriter=(CSTWriter*)vcstWriter;
+int
+CSTWriterRegistrationTimer(ORTEDomain *d, void *vcstWriter)
+{
+  CSTWriter *cstWriter = (CSTWriter *)vcstWriter;
   CSTRemoteReader *cstRemoteReader;
 
-  debug(52,10) ("CSTWriterRegistrationTimer: start\n");
+  debug(52, 10) ("CSTWriterRegistrationTimer: start\n");
 
-  debug(52,5) ("CSTWriterRegistrationTimer: OID: 0xx%x - retries = %d\n",
-               cstWriter->guid.oid,cstWriter->registrationCounter);
+  debug(52, 5) ("CSTWriterRegistrationTimer: OID: 0xx%x - retries = %d\n",
+               cstWriter->guid.oid, cstWriter->registrationCounter);
   eventDetach(d,
-      cstWriter->objectEntryOID->objectEntryAID,
-      &cstWriter->registrationTimer,
-      0);   //common timer
+             cstWriter->objectEntryOID->objectEntryAID,
+             &cstWriter->registrationTimer,
+             0); //common timer
 
-  if (cstWriter->registrationCounter!=0) {
+  if (cstWriter->registrationCounter != 0) {
     cstWriter->registrationCounter--;
-    gavl_cust_for_each(CSTRemoteReader,cstWriter,cstRemoteReader) {
-      CSTWriterRefreshAllCSChanges(d,cstRemoteReader);
+    gavl_cust_for_each(CSTRemoteReader, cstWriter, cstRemoteReader) {
+      CSTWriterRefreshAllCSChanges(d, cstRemoteReader);
     }
     eventAdd(d,
-        cstWriter->objectEntryOID->objectEntryAID,
-        &cstWriter->registrationTimer,
-        0,   //common timer
-        "CSTWriterRegistrationTimer",
-        CSTWriterRegistrationTimer,
-        &cstWriter->lock,
-        cstWriter,
-        &cstWriter->params.registrationPeriod);               
+            cstWriter->objectEntryOID->objectEntryAID,
+            &cstWriter->registrationTimer,
+            0, //common timer
+            "CSTWriterRegistrationTimer",
+            CSTWriterRegistrationTimer,
+            &cstWriter->lock,
+            cstWriter,
+            &cstWriter->params.registrationPeriod);
   } else {
     if (d->domainEvents.onRegFail) {
-       d->domainEvents.onRegFail(d->domainEvents.onRegFailParam);
+      d->domainEvents.onRegFail(d->domainEvents.onRegFailParam);
     }
   }
 
-  debug(52,10) ("CSTWriterRegistrationTimer: finished\n");
+  debug(52, 10) ("CSTWriterRegistrationTimer: finished\n");
   return 0;
 }
 
 
 /*****************************************************************************/
-int 
-CSTWriterRefreshTimer(ORTEDomain *d,void *vcstWriter) {
-  CSTWriter *cstWriter=(CSTWriter*)vcstWriter;
+int
+CSTWriterRefreshTimer(ORTEDomain *d, void *vcstWriter)
+{
+  CSTWriter *cstWriter = (CSTWriter *)vcstWriter;
   CSTRemoteReader *cstRemoteReader;
-  
-  debug(52,10) ("CSTWriterRefreshTimer: start\n");
-  
-  gavl_cust_for_each(CSTRemoteReader,cstWriter,cstRemoteReader) {
-    CSTWriterRefreshAllCSChanges(d,cstRemoteReader);
+
+  debug(52, 10) ("CSTWriterRefreshTimer: start\n");
+
+  gavl_cust_for_each(CSTRemoteReader, cstWriter, cstRemoteReader) {
+    CSTWriterRefreshAllCSChanges(d, cstRemoteReader);
   }
   eventDetach(d,
-      cstWriter->objectEntryOID->objectEntryAID,
-      &cstWriter->refreshPeriodTimer,
-      0);   //common timer
+             cstWriter->objectEntryOID->objectEntryAID,
+             &cstWriter->refreshPeriodTimer,
+             0); //common timer
   eventAdd(d,
-      cstWriter->objectEntryOID->objectEntryAID,
-      &cstWriter->refreshPeriodTimer,
-      0,   //common timer
-      "CSTWriterRefreshTimer",
-      CSTWriterRefreshTimer,
-      &cstWriter->lock,
-      cstWriter,
-      &cstWriter->params.refreshPeriod);               
-  debug(52,10) ("CSTWriterRefreshTimer: finished\n");
+          cstWriter->objectEntryOID->objectEntryAID,
+          &cstWriter->refreshPeriodTimer,
+          0, //common timer
+          "CSTWriterRefreshTimer",
+          CSTWriterRefreshTimer,
+          &cstWriter->lock,
+          cstWriter,
+          &cstWriter->params.refreshPeriod);
+  debug(52, 10) ("CSTWriterRefreshTimer: finished\n");
   return 0;
 }
 
 /*****************************************************************************/
-int 
-CSTWriterAnnounceTimer(ORTEDomain *d,void *vcstRemoteReader) {
-  CSTRemoteReader *cstRemoteReader=(CSTRemoteReader*)vcstRemoteReader;
+int
+CSTWriterAnnounceTimer(ORTEDomain *d, void *vcstRemoteReader)
+{
+  CSTRemoteReader *cstRemoteReader = (CSTRemoteReader *)vcstRemoteReader;
 
-  debug(52,10) ("CSTWriterAnnounceTimer: start\n");
-  if ((cstRemoteReader->commStateHB==MAYSENDHB) &&
-      ((!cstRemoteReader->cstWriter->params.fullAcknowledge))) {// ||
+  debug(52, 10) ("CSTWriterAnnounceTimer: start\n");
+  if ((cstRemoteReader->commStateHB == MAYSENDHB) &&
+      ((!cstRemoteReader->cstWriter->params.fullAcknowledge))) { // ||
 //       (cstRemoteReader->unacknowledgedCounter))) {
     //create HB
-    int len=RTPSHeartBeatCreate(
-        &d->taskSend.mb.cdrCodec,
-        &cstRemoteReader->cstWriter->firstSN,
-        &cstRemoteReader->cstWriter->lastSN,
-        OID_UNKNOWN,
-        cstRemoteReader->cstWriter->guid.oid,
-        ORTE_FALSE);
-    if (len<0) {
+    int len = RTPSHeartBeatCreate(
+      &d->taskSend.mb.cdrCodec,
+      &cstRemoteReader->cstWriter->firstSN,
+      &cstRemoteReader->cstWriter->lastSN,
+      OID_UNKNOWN,
+      cstRemoteReader->cstWriter->guid.oid,
+      ORTE_FALSE);
+    if (len < 0) {
       //not enought space in sending buffer
-      d->taskSend.mb.needSend=ORTE_TRUE;
+      d->taskSend.mb.needSend = ORTE_TRUE;
       return 1;
     }
-    debug(52,3) ("sent: RTPS_HBF(0x%x) to 0x%x-0x%x\n",
-                  cstRemoteReader->cstWriter->guid.oid,
-                  cstRemoteReader->guid.hid,
-                  cstRemoteReader->guid.aid);
+    debug(52, 3) ("sent: RTPS_HBF(0x%x) to 0x%x-0x%x\n",
+                 cstRemoteReader->cstWriter->guid.oid,
+                 cstRemoteReader->guid.hid,
+                 cstRemoteReader->guid.aid);
   }
   eventDetach(d,
-      cstRemoteReader->sobject->objectEntryAID,
-      &cstRemoteReader->repeatAnnounceTimer,
-      1);
+             cstRemoteReader->sobject->objectEntryAID,
+             &cstRemoteReader->repeatAnnounceTimer,
+             1);
   eventAdd(d,
-      cstRemoteReader->sobject->objectEntryAID,
-      &cstRemoteReader->repeatAnnounceTimer,
-      1,   //metatraffic timer
-      "CSTWriterAnnounceTimer",
-      CSTWriterAnnounceTimer,
-      &cstRemoteReader->cstWriter->lock,
-      cstRemoteReader,
-      &cstRemoteReader->cstWriter->params.repeatAnnounceTime);
-  debug(52,10) ("CSTWriterAnnounceTimer: finished\n");
+          cstRemoteReader->sobject->objectEntryAID,
+          &cstRemoteReader->repeatAnnounceTimer,
+          1, //metatraffic timer
+          "CSTWriterAnnounceTimer",
+          CSTWriterAnnounceTimer,
+          &cstRemoteReader->cstWriter->lock,
+          cstRemoteReader,
+          &cstRemoteReader->cstWriter->params.repeatAnnounceTime);
+  debug(52, 10) ("CSTWriterAnnounceTimer: finished\n");
   return 0;
 }
 
 /*****************************************************************************/
-int 
-CSTWriterAnnounceIssueTimer(ORTEDomain *d,void *vcstRemoteReader) {
-  CSTRemoteReader *cstRemoteReader=(CSTRemoteReader*)vcstRemoteReader;
+int
+CSTWriterAnnounceIssueTimer(ORTEDomain *d, void *vcstRemoteReader)
+{
+  CSTRemoteReader *cstRemoteReader = (CSTRemoteReader *)vcstRemoteReader;
   NtpTime         nextHB;
   ORTEPublProp    *pp;
   int             len;
 
-  debug(52,10) ("CSTWriterAnnounceIssueTimer: start\n");
-  pp=(ORTEPublProp*)cstRemoteReader->cstWriter->objectEntryOID->attributes;
+  debug(52, 10) ("CSTWriterAnnounceIssueTimer: start\n");
+  pp = (ORTEPublProp *)cstRemoteReader->cstWriter->objectEntryOID->attributes;
   //create HB
-  d->taskSend.mb.cdrCodecDirect=NULL;
-  len=RTPSHeartBeatCreate(
-      &d->taskSend.mb.cdrCodec,
-      &cstRemoteReader->cstWriter->firstSN,
-      &cstRemoteReader->cstWriter->lastSN,
-      OID_UNKNOWN,
-      cstRemoteReader->cstWriter->guid.oid,
-      ORTE_FALSE);
-  if (len<0) {
+  d->taskSend.mb.cdrCodecDirect = NULL;
+  len = RTPSHeartBeatCreate(
+    &d->taskSend.mb.cdrCodec,
+    &cstRemoteReader->cstWriter->firstSN,
+    &cstRemoteReader->cstWriter->lastSN,
+    OID_UNKNOWN,
+    cstRemoteReader->cstWriter->guid.oid,
+    ORTE_FALSE);
+  if (len < 0) {
     //not enought space in sending buffer
-    d->taskSend.mb.needSend=ORTE_TRUE;
+    d->taskSend.mb.needSend = ORTE_TRUE;
     return 1;
   }
-  debug(52,3) ("sent: RTPS_HBF(0x%x) to 0x%x-0x%x\n",
-                cstRemoteReader->cstWriter->guid.oid,
-                cstRemoteReader->guid.hid,
-                cstRemoteReader->guid.aid);
+  debug(52, 3) ("sent: RTPS_HBF(0x%x) to 0x%x-0x%x\n",
+               cstRemoteReader->cstWriter->guid.oid,
+               cstRemoteReader->guid.hid,
+               cstRemoteReader->guid.aid);
   //next HB
-  if (cstRemoteReader->cstWriter->csChangesCounter>=pp->criticalQueueLevel) {
-    nextHB=pp->HBCQLRate;
+  if (cstRemoteReader->cstWriter->csChangesCounter >= pp->criticalQueueLevel) {
+    nextHB = pp->HBCQLRate;
   } else {
-    nextHB=pp->HBNornalRate;
+    nextHB = pp->HBNornalRate;
   }
   cstRemoteReader->HBRetriesCounter++;
   eventDetach(d,
-      cstRemoteReader->sobject->objectEntryAID,
-      &cstRemoteReader->repeatAnnounceTimer,
-      2);
-  if (cstRemoteReader->HBRetriesCounter<pp->HBMaxRetries) {              
+             cstRemoteReader->sobject->objectEntryAID,
+             &cstRemoteReader->repeatAnnounceTimer,
+             2);
+  if (cstRemoteReader->HBRetriesCounter < pp->HBMaxRetries) {
     eventAdd(d,
-        cstRemoteReader->sobject->objectEntryAID,
-        &cstRemoteReader->repeatAnnounceTimer,
-        2,   //metatraffic timer
-        "CSTWriterAnnounceIssueTimer",
-        CSTWriterAnnounceIssueTimer,
-        &cstRemoteReader->cstWriter->lock,
-        cstRemoteReader,
-        &nextHB);
+            cstRemoteReader->sobject->objectEntryAID,
+            &cstRemoteReader->repeatAnnounceTimer,
+            2, //metatraffic timer
+            "CSTWriterAnnounceIssueTimer",
+            CSTWriterAnnounceIssueTimer,
+            &cstRemoteReader->cstWriter->lock,
+            cstRemoteReader,
+            &nextHB);
   } else {
     //destroy all csChangesForReader
     CSChangeForReader *csChangeForReader;
-    while ((csChangeForReader=CSChangeForReader_first(cstRemoteReader))) {
+    while ((csChangeForReader = CSChangeForReader_first(cstRemoteReader)))
       CSTWriterDestroyCSChangeForReader(
-          csChangeForReader,ORTE_TRUE);
-    }
-    debug(52,3) ("CSTWriterAnnounceIssueTimer: HB RR(0x%x-0x%x) ritch MaxRetries\n",
-                  cstRemoteReader->guid.hid,cstRemoteReader->guid.aid);
+       csChangeForReader, ORTE_TRUE);
+    debug(52, 3) ("CSTWriterAnnounceIssueTimer: HB RR(0x%x-0x%x) ritch MaxRetries\n",
+                 cstRemoteReader->guid.hid, cstRemoteReader->guid.aid);
   }
-  debug(52,10) ("CSTWriterAnnounceIssueTimer: finished\n");
+  debug(52, 10) ("CSTWriterAnnounceIssueTimer: finished\n");
   return 0;
 }
 
 /**********************************************************************************/
 int
-CSChangeForReaderUnderwayTimer(ORTEDomain *d,void *vcsChangeForReader) {
-  CSChangeForReader *csChangeForReader=(CSChangeForReader*)vcsChangeForReader;
-  csChangeForReader->commStateChFReader=UNACKNOWLEDGED;
+CSChangeForReaderUnderwayTimer(ORTEDomain *d, void *vcsChangeForReader)
+{
+  CSChangeForReader *csChangeForReader = (CSChangeForReader *)vcsChangeForReader;
+
+  csChangeForReader->commStateChFReader = UNACKNOWLEDGED;
   return 0;
 }
 
 /**********************************************************************************/
 int
-CSTWriterSendBestEffortTimer(ORTEDomain *d,void *vcstRemoteReader) {
-  CSTRemoteReader   *cstRemoteReader=(CSTRemoteReader*)vcstRemoteReader;
-  ORTESubsProp      *sp=(ORTESubsProp*)cstRemoteReader->pobject->attributes;
-  CSChangeForReader *csChangeForReader=NULL;
-        
-  debug(52,10) ("CSTWriterSendBestEffortTimer: start\n");
-  d->taskSend.mb.cdrCodecDirect=NULL;
-  if (cstRemoteReader->commStateSend!=NOTHNIGTOSEND) {
-    gavl_cust_for_each(CSChangeForReader,cstRemoteReader,csChangeForReader) {
-      if (csChangeForReader->commStateChFReader==TOSEND) {
-        CSChange *csChange=csChangeForReader->csChange;
-
-        csChangeForReader->commStateChFReader=UNDERWAY;
-        cstRemoteReader->commStateSend=MUSTSENDDATA;
-        cstRemoteReader->lastSentIssueTime=getActualNtpTime();
-        d->taskSend.mb.cdrCodecDirect=&csChange->cdrCodec;
-
-        if (cstRemoteReader->sobject) {
-          debug(52,3) ("sent: RTPS_ISSUE_BEST(0x%x) to 0x%x-0x%x-0x%x\n",
-                        cstRemoteReader->cstWriter->guid.oid,
-                        GUID_PRINTF(cstRemoteReader->sobject->guid));
-        }
-
-        ORTESendData(d,
-            cstRemoteReader->sobject->objectEntryAID,
-            ORTE_FALSE);
+CSTWriterSendBestEffortTimer(ORTEDomain *d, void *vcstRemoteReader)
+{
+  CSTRemoteReader   *cstRemoteReader = (CSTRemoteReader *)vcstRemoteReader;
+  ORTESubsProp      *sp = (ORTESubsProp *)cstRemoteReader->pobject->attributes;
+  CSChangeForReader *csChangeForReader = NULL;
+
+  debug(52, 10) ("CSTWriterSendBestEffortTimer: start\n");
+  d->taskSend.mb.cdrCodecDirect = NULL;
+  if (cstRemoteReader->commStateSend != NOTHNIGTOSEND) {
+    gavl_cust_for_each(CSChangeForReader, cstRemoteReader, csChangeForReader) {
+      if (csChangeForReader->commStateChFReader == TOSEND) {
+       CSChange *csChange = csChangeForReader->csChange;
+
+       csChangeForReader->commStateChFReader = UNDERWAY;
+       cstRemoteReader->commStateSend = MUSTSENDDATA;
+       cstRemoteReader->lastSentIssueTime = getActualNtpTime();
+       d->taskSend.mb.cdrCodecDirect = &csChange->cdrCodec;
+
+       if (cstRemoteReader->sobject) {
+         debug(52, 3) ("sent: RTPS_ISSUE_BEST(0x%x) to 0x%x-0x%x-0x%x\n",
+                       cstRemoteReader->cstWriter->guid.oid,
+                       GUID_PRINTF(cstRemoteReader->sobject->guid));
+       }
+
+       ORTESendData(d,
+                    cstRemoteReader->sobject->objectEntryAID,
+                    ORTE_FALSE);
 
        //it's not nessecary to NewState, there is setuped only new state & after is deleted
-        CSTWriterCSChangeForReaderNewState(csChangeForReader);
+       CSTWriterCSChangeForReaderNewState(csChangeForReader);
 
        /* mark multicast messages like processed */
-        CSTWriterMulticast(csChangeForReader);
-
-        CSTWriterDestroyCSChangeForReader(
-            csChangeForReader,ORTE_TRUE);
-
-        eventDetach(d,
-            cstRemoteReader->sobject->objectEntryAID,
-            &cstRemoteReader->delayResponceTimer,
-            2);   
-
-        //when is no csChange -> break processing 
-        if (cstRemoteReader->cstWriter->csChangesCounter==0) 
-          break;
-
-        eventAdd(d,
-            cstRemoteReader->sobject->objectEntryAID,
-            &cstRemoteReader->delayResponceTimer,
-            2,   
-            "CSTWriterSendBestEffortTimer",
-            CSTWriterSendBestEffortTimer,
-            &cstRemoteReader->cstWriter->lock,
-            cstRemoteReader,
-            &sp->minimumSeparation);
-        return 0;
+       CSTWriterMulticast(csChangeForReader);
+
+       CSTWriterDestroyCSChangeForReader(
+         csChangeForReader, ORTE_TRUE);
+
+       eventDetach(d,
+                   cstRemoteReader->sobject->objectEntryAID,
+                   &cstRemoteReader->delayResponceTimer,
+                   2);
+
+       //when is no csChange -> break processing
+       if (cstRemoteReader->cstWriter->csChangesCounter == 0)
+         break;
+
+       eventAdd(d,
+                cstRemoteReader->sobject->objectEntryAID,
+                &cstRemoteReader->delayResponceTimer,
+                2,
+                "CSTWriterSendBestEffortTimer",
+                CSTWriterSendBestEffortTimer,
+                &cstRemoteReader->cstWriter->lock,
+                cstRemoteReader,
+                &sp->minimumSeparation);
+       return 0;
 
       }
     }
   }
-  debug(52,10) ("CSTWriterSendBestEffortTimer: finished\n");
+  debug(52, 10) ("CSTWriterSendBestEffortTimer: finished\n");
   return 0;
 }
 
 /**********************************************************************************/
 int
-CSTWriterSendStrictTimer(ORTEDomain *d,void *vcstRemoteReader) {
-  CSTRemoteReader   *cstRemoteReader=(CSTRemoteReader*)vcstRemoteReader;
-  CSChangeForReader *csChangeForReader=NULL;
-  int               len,data_offset,wptr_max;
+CSTWriterSendStrictTimer(ORTEDomain *d, void *vcstRemoteReader)
+{
+  CSTRemoteReader   *cstRemoteReader = (CSTRemoteReader *)vcstRemoteReader;
+  CSChangeForReader *csChangeForReader = NULL;
+  int               len, data_offset, wptr_max;
   CSChange          *csChange;
-  Boolean           firstTrace=ORTE_TRUE;
-  
-  debug(52,10) ("CSTWriterSendStrictTimer: start\n");
-  if (cstRemoteReader->commStateSend!=NOTHNIGTOSEND) {
-    gavl_cust_for_each(CSChangeForReader,cstRemoteReader,csChangeForReader) {
-      csChange=csChangeForReader->csChange;
-      if (csChangeForReader->commStateChFReader==TOSEND) {
-        cstRemoteReader->commStateSend=MUSTSENDDATA;
-
-        wptr_max=d->taskSend.mb.cdrCodec.wptr_max;
-        d->taskSend.mb.cdrCodec.wptr_max=csChange->cdrCodec.wptr_max;
-       /* infoReply */
-        if ((firstTrace) && (cstRemoteReader->cstWriter->params.fullAcknowledge) &&
-            !d->taskSend.mb.containsInfoReply) {
-          AppParams *ap=cstRemoteReader->cstWriter->objectEntryOID->attributes;
-          firstTrace=ORTE_FALSE;
-          len=RTPSInfoREPLYCreate(&d->taskSend.mb.cdrCodec,
-              IPADDRESS_INVALID,
-              ap->userdataUnicastPort);
-          if (len<0) {
-            d->taskSend.mb.needSend=ORTE_TRUE;
-           d->taskSend.mb.cdrCodec.wptr_max=wptr_max;
-            return 1;
-          }
-          d->taskSend.mb.containsInfoReply=ORTE_TRUE;  
-          debug(52,3) ("sent: RTPS_InfoREPLY(0x%x) to 0x%x-0x%x\n",
-                       cstRemoteReader->cstWriter->guid.oid,
-                       cstRemoteReader->guid.hid,
-                       cstRemoteReader->guid.aid);
-        }
-
-       data_offset=RTPS_HEADER_LENGTH+12;
-        if (CDR_buffer_puts(&d->taskSend.mb.cdrCodec,
+  Boolean           firstTrace = ORTE_TRUE;
+
+  debug(52, 10) ("CSTWriterSendStrictTimer: start\n");
+  if (cstRemoteReader->commStateSend != NOTHNIGTOSEND) {
+    gavl_cust_for_each(CSChangeForReader, cstRemoteReader, csChangeForReader) {
+      csChange = csChangeForReader->csChange;
+      if (csChangeForReader->commStateChFReader == TOSEND) {
+       cstRemoteReader->commStateSend = MUSTSENDDATA;
+
+       wptr_max = d->taskSend.mb.cdrCodec.wptr_max;
+       d->taskSend.mb.cdrCodec.wptr_max = csChange->cdrCodec.wptr_max;
+       /* infoReply */
+       if ((firstTrace) && (cstRemoteReader->cstWriter->params.fullAcknowledge) &&
+           !d->taskSend.mb.containsInfoReply) {
+         AppParams *ap = cstRemoteReader->cstWriter->objectEntryOID->attributes;
+         firstTrace = ORTE_FALSE;
+         len = RTPSInfoREPLYCreate(&d->taskSend.mb.cdrCodec,
+                                   IPADDRESS_INVALID,
+                                   ap->userdataUnicastPort);
+         if (len < 0) {
+           d->taskSend.mb.needSend = ORTE_TRUE;
+           d->taskSend.mb.cdrCodec.wptr_max = wptr_max;
+           return 1;
+         }
+         d->taskSend.mb.containsInfoReply = ORTE_TRUE;
+         debug(52, 3) ("sent: RTPS_InfoREPLY(0x%x) to 0x%x-0x%x\n",
+                       cstRemoteReader->cstWriter->guid.oid,
+                       cstRemoteReader->guid.hid,
+                       cstRemoteReader->guid.aid);
+       }
+
+       data_offset = RTPS_HEADER_LENGTH+12;
+       if (CDR_buffer_puts(&d->taskSend.mb.cdrCodec,
                            csChange->cdrCodec.buffer+data_offset, //src
-                           csChange->cdrCodec.wptr-data_offset)==CORBA_FALSE) {
-            d->taskSend.mb.needSend=ORTE_TRUE;
-           d->taskSend.mb.cdrCodec.wptr_max=wptr_max;
-            return 1;
-        }
-    
-        d->taskSend.mb.cdrCodec.wptr_max=wptr_max;
+                           csChange->cdrCodec.wptr-data_offset) == CORBA_FALSE) {
+         d->taskSend.mb.needSend = ORTE_TRUE;
+         d->taskSend.mb.cdrCodec.wptr_max = wptr_max;
+         return 1;
+       }
+
+       d->taskSend.mb.cdrCodec.wptr_max = wptr_max;
 
        /* setup new state for csChangeForReader */
-        CSTWriterCSChangeForReaderNewState(csChangeForReader);
+       CSTWriterCSChangeForReaderNewState(csChangeForReader);
 
        /* mark multicast messages like processed */
-        CSTWriterMulticast(csChangeForReader);
+       CSTWriterMulticast(csChangeForReader);
 
-        debug(52,3) ("sent: RTPS_ISSUE_STRICT(0x%x) to 0x%x-0x%x\n",
-                    cstRemoteReader->cstWriter->guid.oid,
-                    cstRemoteReader->guid.hid,
-                    cstRemoteReader->guid.aid);
+       debug(52, 3) ("sent: RTPS_ISSUE_STRICT(0x%x) to 0x%x-0x%x\n",
+                     cstRemoteReader->cstWriter->guid.oid,
+                     cstRemoteReader->guid.hid,
+                     cstRemoteReader->guid.aid);
       }
     }
   }
-  debug(52,10) ("CSTWriterSendStrictTimer: finished\n");
-  //add HeardBeat  
-  return CSTWriterAnnounceIssueTimer(d,cstRemoteReader);
+  debug(52, 10) ("CSTWriterSendStrictTimer: finished\n");
+  //add HeardBeat
+  return CSTWriterAnnounceIssueTimer(d, cstRemoteReader);
 }
 
 /**********************************************************************************/
 int
-CSTWriterSendTimer(ORTEDomain *d,void *vcstRemoteReader) {
-  CSTRemoteReader   *cstRemoteReader=(CSTRemoteReader*)vcstRemoteReader;
-  CSChangeForReader *csChangeForReader=NULL;
-  Boolean           firstTrace=ORTE_TRUE,f_bit=ORTE_TRUE;
-  
-  debug(52,10) ("CSTWriterSendTimer: start\n");
+CSTWriterSendTimer(ORTEDomain *d, void *vcstRemoteReader)
+{
+  CSTRemoteReader   *cstRemoteReader = (CSTRemoteReader *)vcstRemoteReader;
+  CSChangeForReader *csChangeForReader = NULL;
+  Boolean           firstTrace = ORTE_TRUE, f_bit = ORTE_TRUE;
+
+  debug(52, 10) ("CSTWriterSendTimer: start\n");
 
   /* setup f_bit of object */
   if (cstRemoteReader->cstWriter->params.fullAcknowledge)
-    f_bit=ORTE_FALSE;
-
-  if (cstRemoteReader->commStateSend!=NOTHNIGTOSEND) {
-
-    gavl_cust_for_each(CSChangeForReader,cstRemoteReader,csChangeForReader) {
-
-      if (csChangeForReader->commStateChFReader==TOSEND) {
-        cstRemoteReader->commStateSend=MUSTSENDDATA;
-
-        /* infoReply */
-        if ((firstTrace) && (cstRemoteReader->cstWriter->params.fullAcknowledge) &&
-            !d->taskSend.mb.containsInfoReply) {
-          AppParams *ap=cstRemoteReader->cstWriter->objectEntryOID->attributes;
-          firstTrace=ORTE_FALSE;
-          if (RTPSInfoREPLYCreate(&d->taskSend.mb.cdrCodec,
-                                 IPADDRESS_INVALID,
-                                 ap->metatrafficUnicastPort) < 0) {
-            d->taskSend.mb.needSend=ORTE_TRUE;
-            return 1;
-          }
-          d->taskSend.mb.containsInfoReply=ORTE_TRUE;  
-          debug(52,3) ("sent: RTPS_InfoREPLY from 0x%x-0x%x-0x%x to 0x%x-0x%x-0x%x\n",
-                        GUID_PRINTF(cstRemoteReader->cstWriter->guid),
-                        GUID_PRINTF(cstRemoteReader->guid));
-        }
-
-        /* VAR */
-        if (SeqNumberCmp(csChangeForReader->csChange->gapSN,noneSN)==0) {
-          debug(52,3) ("sent: RTPS_VAR from 0x%x-0x%x-0x%x to 0x%x-0x%x-0x%x\n",
-                        GUID_PRINTF(cstRemoteReader->cstWriter->guid),
-                        GUID_PRINTF(cstRemoteReader->guid));
-
-          if (RTPSVarCreate(&d->taskSend.mb.cdrCodec,
+    f_bit = ORTE_FALSE;
+
+  if (cstRemoteReader->commStateSend != NOTHNIGTOSEND) {
+
+    gavl_cust_for_each(CSChangeForReader, cstRemoteReader, csChangeForReader) {
+
+      if (csChangeForReader->commStateChFReader == TOSEND) {
+       cstRemoteReader->commStateSend = MUSTSENDDATA;
+
+       /* infoReply */
+       if ((firstTrace) && (cstRemoteReader->cstWriter->params.fullAcknowledge) &&
+           !d->taskSend.mb.containsInfoReply) {
+         AppParams *ap = cstRemoteReader->cstWriter->objectEntryOID->attributes;
+         firstTrace = ORTE_FALSE;
+         if (RTPSInfoREPLYCreate(&d->taskSend.mb.cdrCodec,
+                                 IPADDRESS_INVALID,
+                                 ap->metatrafficUnicastPort) < 0) {
+           d->taskSend.mb.needSend = ORTE_TRUE;
+           return 1;
+         }
+         d->taskSend.mb.containsInfoReply = ORTE_TRUE;
+         debug(52, 3) ("sent: RTPS_InfoREPLY from 0x%x-0x%x-0x%x to 0x%x-0x%x-0x%x\n",
+                       GUID_PRINTF(cstRemoteReader->cstWriter->guid),
+                       GUID_PRINTF(cstRemoteReader->guid));
+       }
+
+       /* VAR */
+       if (SeqNumberCmp(csChangeForReader->csChange->gapSN, noneSN) == 0) {
+         debug(52, 3) ("sent: RTPS_VAR from 0x%x-0x%x-0x%x to 0x%x-0x%x-0x%x\n",
+                       GUID_PRINTF(cstRemoteReader->cstWriter->guid),
+                       GUID_PRINTF(cstRemoteReader->guid));
+
+         if (RTPSVarCreate(&d->taskSend.mb.cdrCodec,
                            OID_UNKNOWN,
-                            cstRemoteReader->cstWriter->guid.oid,
+                           cstRemoteReader->cstWriter->guid.oid,
                            csChangeForReader->csChange) < 0) {
-            d->taskSend.mb.needSend=ORTE_TRUE;
-            return 1;
-          }
+           d->taskSend.mb.needSend = ORTE_TRUE;
+           return 1;
+         }
 
-        } else {
-        /* GAP */
-          debug(52,3) ("sent: RTPS_GAP from 0x%x-0x%x-0x%x to 0x%x-0x%x-0x%x\n",
-                        GUID_PRINTF(cstRemoteReader->cstWriter->guid),
-                        GUID_PRINTF(cstRemoteReader->guid));
+       } else {
+         /* GAP */
+         debug(52, 3) ("sent: RTPS_GAP from 0x%x-0x%x-0x%x to 0x%x-0x%x-0x%x\n",
+                       GUID_PRINTF(cstRemoteReader->cstWriter->guid),
+                       GUID_PRINTF(cstRemoteReader->guid));
 
-          if (RTPSGapCreate(&d->taskSend.mb.cdrCodec,
+         if (RTPSGapCreate(&d->taskSend.mb.cdrCodec,
                            OID_UNKNOWN,
                            cstRemoteReader->cstWriter->guid.oid,
                            csChangeForReader->csChange) < 0) {
-            d->taskSend.mb.needSend=ORTE_TRUE;
-            return 1;
-          }
-        }
+           d->taskSend.mb.needSend = ORTE_TRUE;
+           return 1;
+         }
+       }
 
        /* setup new state for csChangeForReader */
        CSTWriterCSChangeForReaderNewState(csChangeForReader);
 
        /* mark multicast messages like processed */
-        CSTWriterMulticast(csChangeForReader);
+       CSTWriterMulticast(csChangeForReader);
 
       }
     } /* gavl_cust_for_each */
 
-    cstRemoteReader->commStateHB=MUSTSENDHB;
+    cstRemoteReader->commStateHB = MUSTSENDHB;
 
   }
 
-  if (cstRemoteReader->commStateHB==MUSTSENDHB) {
+  if (cstRemoteReader->commStateHB == MUSTSENDHB) {
     //add HeartBeat
     if (RTPSHeartBeatCreate(
-        &d->taskSend.mb.cdrCodec,
-        &cstRemoteReader->cstWriter->firstSN,
-        &cstRemoteReader->cstWriter->lastSN,
-        OID_UNKNOWN,
-        cstRemoteReader->cstWriter->guid.oid,
-        f_bit)<0) {
-      d->taskSend.mb.needSend=ORTE_TRUE;
+         &d->taskSend.mb.cdrCodec,
+         &cstRemoteReader->cstWriter->firstSN,
+         &cstRemoteReader->cstWriter->lastSN,
+         OID_UNKNOWN,
+         cstRemoteReader->cstWriter->guid.oid,
+         f_bit) < 0) {
+      d->taskSend.mb.needSend = ORTE_TRUE;
       return 1;
     } else {
       //schedule new time for Announce timer
       eventDetach(d,
-           cstRemoteReader->sobject->objectEntryAID,
-           &cstRemoteReader->repeatAnnounceTimer,
-           1);
+                 cstRemoteReader->sobject->objectEntryAID,
+                 &cstRemoteReader->repeatAnnounceTimer,
+                 1);
       eventAdd(d,
-           cstRemoteReader->sobject->objectEntryAID,
-           &cstRemoteReader->repeatAnnounceTimer,
-           1,   //metatraffic timer
-           "CSTWriterAnnounceTimer",
-           CSTWriterAnnounceTimer,
-           &cstRemoteReader->cstWriter->lock,
-           cstRemoteReader,
-           &cstRemoteReader->cstWriter->params.repeatAnnounceTime);
+              cstRemoteReader->sobject->objectEntryAID,
+              &cstRemoteReader->repeatAnnounceTimer,
+              1, //metatraffic timer
+              "CSTWriterAnnounceTimer",
+              CSTWriterAnnounceTimer,
+              &cstRemoteReader->cstWriter->lock,
+              cstRemoteReader,
+              &cstRemoteReader->cstWriter->params.repeatAnnounceTime);
     }
 
-    debug(52,3) ("sent: RTPS_HB from 0x%x-0x%x-0x%x to 0x%x-0x%x-0x%x\n",
-                  GUID_PRINTF(cstRemoteReader->cstWriter->guid),
-                  GUID_PRINTF(cstRemoteReader->guid));
+    debug(52, 3) ("sent: RTPS_HB from 0x%x-0x%x-0x%x to 0x%x-0x%x-0x%x\n",
+                 GUID_PRINTF(cstRemoteReader->cstWriter->guid),
+                 GUID_PRINTF(cstRemoteReader->guid));
 
-    cstRemoteReader->commStateHB=MAYSENDHB;
+    cstRemoteReader->commStateHB = MAYSENDHB;
   }
-  debug(52,10) ("CSTWriterSendTimer: finished\n");
+
+  debug(52, 10) ("CSTWriterSendTimer: finished\n");
   return 0;
 }
index 804c5d80b49a05a378b244ec7864b5f92b0a6591..3e34215721fb47bd960f87ae58c51bc3ddbad1ea 100644 (file)
 /*
- *  $Id: RTPSGap.c,v 0.0.0.1            2003/10/07 
+ *  $Id: RTPSGap.c,v 0.0.0.1            2003/10/07
  *
  *  DEBUG:  section 49                  RTPS message GAP
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
 /**********************************************************************************/
-int 
-RTPSGapCreate(CDR_Codec *cdrCodec,ObjectId roid,ObjectId woid,CSChange *csChange) 
+int
+RTPSGapCreate(CDR_Codec *cdrCodec, ObjectId roid, ObjectId woid, CSChange *csChange)
 {
   CDR_Endianness     data_endian;
   SequenceNumber     bsn;
   CORBA_octet        flags;
 
-  if (cdrCodec->buf_len<cdrCodec->wptr+32) return -1;
+  if (cdrCodec->buf_len < cdrCodec->wptr+32)
+    return -1;
 
   /* submessage id */
-  CDR_put_octet(cdrCodec,GAP);
+  CDR_put_octet(cdrCodec, GAP);
 
   /* flags */
-  flags=cdrCodec->data_endian;
-  CDR_put_octet(cdrCodec,flags);
+  flags = cdrCodec->data_endian;
+  CDR_put_octet(cdrCodec, flags);
 
   /* length */
-  CDR_put_ushort(cdrCodec,28);
+  CDR_put_ushort(cdrCodec, 28);
 
   /* next data are sent in big endianing */
-  data_endian=cdrCodec->data_endian;
-  cdrCodec->data_endian=FLAG_BIG_ENDIAN;
+  data_endian = cdrCodec->data_endian;
+  cdrCodec->data_endian = FLAG_BIG_ENDIAN;
 
   /* readerObjectId */
-  CDR_put_ulong(cdrCodec,roid);
-  
+  CDR_put_ulong(cdrCodec, roid);
+
   /* writerObjectId */
-  CDR_put_ulong(cdrCodec,woid);
+  CDR_put_ulong(cdrCodec, woid);
 
-  cdrCodec->data_endian=data_endian;
+  cdrCodec->data_endian = data_endian;
 
   /* firstSeqNumber */
-  CDR_put_ulong(cdrCodec,csChange->sn.high);
-  CDR_put_ulong(cdrCodec,csChange->sn.low);
+  CDR_put_ulong(cdrCodec, csChange->sn.high);
+  CDR_put_ulong(cdrCodec, csChange->sn.low);
 
   /* bitmap sn */
-  SeqNumberAdd(bsn,  
-               csChange->sn,
-               csChange->gapSN);
-  CDR_put_ulong(cdrCodec,bsn.high);
-  CDR_put_ulong(cdrCodec,bsn.low);
+  SeqNumberAdd(bsn,
+              csChange->sn,
+              csChange->gapSN);
+  CDR_put_ulong(cdrCodec, bsn.high);
+  CDR_put_ulong(cdrCodec, bsn.low);
 
   /* numbits */
-  CDR_put_ulong(cdrCodec,0);
+  CDR_put_ulong(cdrCodec, 0);
 
   return 32;
 }
 
 /*****************************************************************************/
-void 
-RTPSGapAdd(CSTRemoteWriter *cstRemoteWriter,GUID_RTPS *guid,SequenceNumber *fsn,
-    SequenceNumber *sn,uint32_t numbits,CDR_Codec *cdrCodec) {
-  SequenceNumber      lsn,ssn;
+void
+RTPSGapAdd(CSTRemoteWriter *cstRemoteWriter, GUID_RTPS *guid, SequenceNumber *fsn,
+          SequenceNumber *sn, uint32_t numbits, CDR_Codec *cdrCodec)
+{
+  SequenceNumber      lsn, ssn;
   uint32_t            i;
-  int8_t              bit,bit_last=0;
+  int8_t              bit, bit_last = 0;
   CSChange            *csChange;
   uint32_t            bitmap;
-  
-  if (SeqNumberCmp(*sn,cstRemoteWriter->sn)<0) return;//have to be sn>=writer_sn ! 
-  if (SeqNumberCmp(*fsn,*sn)==1) return;              //cannot be fsn>sn ! 
-  if (numbits>256) return;
+
+  if (SeqNumberCmp(*sn, cstRemoteWriter->sn) < 0)
+    return;                                           //have to be sn>=writer_sn !
+  if (SeqNumberCmp(*fsn, *sn) == 1)
+    return;                                           //cannot be fsn>sn !
+  if (numbits > 256)
+    return;
 
   //first case of GAP sn
-  if (SeqNumberCmp(*fsn,*sn)<0) {                        //if fsn<sn  
-    if (CSChangeFromWriter_find(cstRemoteWriter,fsn)) {
-      CSTReaderDestroyCSChange(cstRemoteWriter, 
-                               fsn,ORTE_FALSE);
+  if (SeqNumberCmp(*fsn, *sn) < 0) {                        //if fsn<sn
+    if (CSChangeFromWriter_find(cstRemoteWriter, fsn)) {
+      CSTReaderDestroyCSChange(cstRemoteWriter,
+                              fsn, ORTE_FALSE);
     }
-    csChange=(CSChange*)MALLOC(sizeof(CSChange));
-    csChange->cdrCodec.buffer=NULL;
-    csChange->sn=*fsn;
-    csChange->guid=*guid;
-    csChange->alive=ORTE_TRUE;
-    SeqNumberSub(csChange->gapSN,*sn,*fsn);            //setup flag GAP
+    csChange = (CSChange *)MALLOC(sizeof(CSChange));
+    csChange->cdrCodec.buffer = NULL;
+    csChange->sn = *fsn;
+    csChange->guid = *guid;
+    csChange->alive = ORTE_TRUE;
+    SeqNumberSub(csChange->gapSN, *sn, *fsn);            //setup flag GAP
     CSChangeAttributes_init_head(csChange);
-    CSTReaderAddCSChange(cstRemoteWriter,csChange);
+    CSTReaderAddCSChange(cstRemoteWriter, csChange);
   }
 
   //second case of GAP sn
-  lsn=ssn=*sn;bit=0;
-  for(i=0;i<numbits;i++) {
-    if ((i%32)==0) 
+  lsn = ssn = *sn;
+  bit = 0;
+  for (i = 0; i < numbits; i++) {
+    if ((i%32) == 0)
       CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&bitmap);
 
-    bit=(bitmap & (1<<(31-i%32))) ? 1:0;
-    if (i>0) {
+    bit = (bitmap & (1<<(31-i%32))) ? 1 : 0;
+    if (i > 0) {
       if (bit_last && !bit) {                           //end of GAP     1->0
-        if (!CSChangeFromWriter_find(cstRemoteWriter,&ssn)) {
-          if (SeqNumberCmp(ssn,cstRemoteWriter->sn)>0) {  
-            csChange=(CSChange*)MALLOC(sizeof(CSChange));
-            csChange->cdrCodec.buffer=NULL;
-            csChange->sn=ssn;
-            csChange->guid=*guid;
-            csChange->alive=ORTE_TRUE;
-            SeqNumberSub(csChange->gapSN,lsn,ssn);         //setup flag GAP
-            CSChangeAttributes_init_head(csChange);
-            CSTReaderAddCSChange(cstRemoteWriter,csChange);
-          }
-        }
+       if (!CSChangeFromWriter_find(cstRemoteWriter, &ssn)) {
+         if (SeqNumberCmp(ssn, cstRemoteWriter->sn) > 0) {
+           csChange = (CSChange *)MALLOC(sizeof(CSChange));
+           csChange->cdrCodec.buffer = NULL;
+           csChange->sn = ssn;
+           csChange->guid = *guid;
+           csChange->alive = ORTE_TRUE;
+           SeqNumberSub(csChange->gapSN, lsn, ssn);         //setup flag GAP
+           CSChangeAttributes_init_head(csChange);
+           CSTReaderAddCSChange(cstRemoteWriter, csChange);
+         }
+       }
       } else {
-        if (!bit_last && bit) {                         //begin GAP      0->1
-          ssn=lsn;                                      //start pointer
-        }
+       if (!bit_last && bit) {                         //begin GAP      0->1
+         ssn = lsn;                                      //start pointer
+       }
       }
-    }  
-    SeqNumberInc(lsn,lsn);
-    bit_last=bit;
+    }
+    SeqNumberInc(lsn, lsn);
+    bit_last = bit;
   }
 
   if (bit) {
-    if (!CSChangeFromWriter_find(cstRemoteWriter,&ssn)) {
-      if (SeqNumberCmp(ssn,cstRemoteWriter->sn)>0) {  
-        csChange=(CSChange*)MALLOC(sizeof(CSChange));
-        csChange->cdrCodec.buffer=NULL;
-        csChange->sn=ssn;
-        csChange->guid=*guid;
-        csChange->alive=ORTE_TRUE;
-        SeqNumberSub(csChange->gapSN,lsn,ssn);         //setup flag GAP
-        CSChangeAttributes_init_head(csChange);
-        CSTReaderAddCSChange(cstRemoteWriter,csChange);
+    if (!CSChangeFromWriter_find(cstRemoteWriter, &ssn)) {
+      if (SeqNumberCmp(ssn, cstRemoteWriter->sn) > 0) {
+       csChange = (CSChange *)MALLOC(sizeof(CSChange));
+       csChange->cdrCodec.buffer = NULL;
+       csChange->sn = ssn;
+       csChange->guid = *guid;
+       csChange->alive = ORTE_TRUE;
+       SeqNumberSub(csChange->gapSN, lsn, ssn);         //setup flag GAP
+       CSChangeAttributes_init_head(csChange);
+       CSTReaderAddCSChange(cstRemoteWriter, csChange);
       }
     }
   }
 }
 
 /**********************************************************************************/
-void 
-RTPSGap(ORTEDomain *d,CDR_Codec *cdrCodec,MessageInterpret *mi,IPAddress senderIPAddress) {
-  CSTReader          *cstReader=NULL;
+void
+RTPSGap(ORTEDomain *d, CDR_Codec *cdrCodec, MessageInterpret *mi, IPAddress senderIPAddress)
+{
+  CSTReader          *cstReader = NULL;
   CSTRemoteWriter    *cstRemoteWriter;
   GUID_RTPS          writerGUID;
-  ObjectId          roid,woid;
-  SequenceNumber     sn,fsn;
+  ObjectId           roid, woid;
+  SequenceNumber     sn, fsn;
   uint32_t           numbits;
   CDR_Endianness     data_endian;
 
   /* next data are sent in big endianing */
-  data_endian=cdrCodec->data_endian;
-  cdrCodec->data_endian=FLAG_BIG_ENDIAN;
+  data_endian = cdrCodec->data_endian;
+  cdrCodec->data_endian = FLAG_BIG_ENDIAN;
 
   /* readerObjectId */
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&roid);
-  
+
   /* writerObjectId */
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&woid);
 
-  cdrCodec->data_endian=data_endian;
+  cdrCodec->data_endian = data_endian;
 
   /* firstSeqNumber */
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&fsn.high);
@@ -191,63 +198,62 @@ RTPSGap(ORTEDomain *d,CDR_Codec *cdrCodec,MessageInterpret *mi,IPAddress senderI
   /* numbits  */
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&numbits);
 
-  writerGUID.hid=mi->sourceHostId;
-  writerGUID.aid=mi->sourceAppId;
-  writerGUID.oid=woid;
+  writerGUID.hid = mi->sourceHostId;
+  writerGUID.aid = mi->sourceAppId;
+  writerGUID.oid = woid;
+
+  debug(49, 3) ("recv: RTPS_GAP(0x%x) from 0x%x-0x%x fSN:%d, bSN:%d, numbits:%d\n",
+               woid, mi->sourceHostId, mi->sourceAppId, fsn.low, sn.low, numbits);
 
-  debug(49,3) ("recv: RTPS_GAP(0x%x) from 0x%x-0x%x fSN:%d, bSN:%d, numbits:%d\n",
-                woid,mi->sourceHostId,mi->sourceAppId,fsn.low,sn.low,numbits);
-  
   /* Manager */
-  if ((d->guid.aid & 0x03)==MANAGER) {
-    if ((writerGUID.oid==OID_WRITE_APPSELF) && 
-        ((writerGUID.aid & 0x03)==MANAGER)) {
+  if ((d->guid.aid & 0x03) == MANAGER) {
+    if ((writerGUID.oid == OID_WRITE_APPSELF) &&
+       ((writerGUID.aid & 0x03) == MANAGER)) {
       pthread_rwlock_wrlock(&d->readerManagers.lock);
-      cstReader=&d->readerManagers;
+      cstReader = &d->readerManagers;
     }
-    if (((writerGUID.oid==OID_WRITE_APPSELF) &&
-         ((writerGUID.aid & 0x03)==MANAGEDAPPLICATION)) ||
-        ((writerGUID.oid==OID_WRITE_APP) &&
-         ((writerGUID.aid & 0x03)==MANAGER))) {
+    if (((writerGUID.oid == OID_WRITE_APPSELF) &&
+        ((writerGUID.aid & 0x03) == MANAGEDAPPLICATION)) ||
+       ((writerGUID.oid == OID_WRITE_APP) &&
+        ((writerGUID.aid & 0x03) == MANAGER))) {
       pthread_rwlock_wrlock(&d->readerApplications.lock);
-      cstReader=&d->readerApplications;
+      cstReader = &d->readerApplications;
     }
   }
 
   /* Application */
-  if ((d->guid.aid & 3)==MANAGEDAPPLICATION) {
+  if ((d->guid.aid & 3) == MANAGEDAPPLICATION) {
     switch (writerGUID.oid) {
       case OID_WRITE_MGR:
-        pthread_rwlock_wrlock(&d->readerManagers.lock);
-        cstReader=&d->readerManagers;
-        break;
+       pthread_rwlock_wrlock(&d->readerManagers.lock);
+       cstReader = &d->readerManagers;
+       break;
       case OID_WRITE_APP:
-        pthread_rwlock_wrlock(&d->readerApplications.lock);
-        cstReader=&d->readerApplications;
-        break;
+       pthread_rwlock_wrlock(&d->readerApplications.lock);
+       cstReader = &d->readerApplications;
+       break;
       case OID_WRITE_PUBL:
-        pthread_rwlock_wrlock(&d->readerPublications.lock);
-        cstReader=&d->readerPublications;
-        break;
+       pthread_rwlock_wrlock(&d->readerPublications.lock);
+       cstReader = &d->readerPublications;
+       break;
       case OID_WRITE_SUBS:
-        pthread_rwlock_wrlock(&d->readerSubscriptions.lock);
-        cstReader=&d->readerSubscriptions;
-        break;
+       pthread_rwlock_wrlock(&d->readerSubscriptions.lock);
+       cstReader = &d->readerSubscriptions;
+       break;
     }
-  }  
+  }
 
-  if (!cstReader) return;
-  cstRemoteWriter=CSTRemoteWriter_find(cstReader,&writerGUID);
+  if (!cstReader)
+    return;
+  cstRemoteWriter = CSTRemoteWriter_find(cstReader, &writerGUID);
   if (!cstRemoteWriter) {
     pthread_rwlock_unlock(&cstReader->lock);
     return;
   }
 
-  RTPSGapAdd(cstRemoteWriter,&writerGUID,&fsn,&sn,numbits,
-             cdrCodec);
+  RTPSGapAdd(cstRemoteWriter, &writerGUID, &fsn, &sn, numbits,
+            cdrCodec);
 
-  CSTReaderProcCSChanges(d,cstRemoteWriter);
+  CSTReaderProcCSChanges(d, cstRemoteWriter);
   pthread_rwlock_unlock(&cstReader->lock);
-} 
-
-
+}
index 48c6649e8453fee2c01d347ff747014cc3c28cd8..d0404747bd85bd2f08c6d3f7be0ae45b7553c116 100644 (file)
 /*
- *  $Id: RTPSHeader.c,v 0.0.0.1  2003/08/21 
+ *  $Id: RTPSHeader.c,v 0.0.0.1  2003/08/21
  *
  *  DEBUG:  section 40          Operations with header of RTPS
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
 /**********************************************************************************/
 int
-RTPSHeaderCreate(CDR_Codec *cdrCodec,HostId hid,AppId aid) {
+RTPSHeaderCreate(CDR_Codec *cdrCodec, HostId hid, AppId aid)
+{
   CDR_Endianness  data_endian;
   ProtocolVersion pv;
   VendorId vid;
 
-  CDR_put_octet(cdrCodec,'R');
-  CDR_put_octet(cdrCodec,'T');
-  CDR_put_octet(cdrCodec,'P');
-  CDR_put_octet(cdrCodec,'S');
+  CDR_put_octet(cdrCodec, 'R');
+  CDR_put_octet(cdrCodec, 'T');
+  CDR_put_octet(cdrCodec, 'P');
+  CDR_put_octet(cdrCodec, 'S');
 
   /* Protocol version */
   PROTOCOL_VERSION_1_0(pv);
-  CDR_put_octet(cdrCodec,pv.major);
-  CDR_put_octet(cdrCodec,pv.minor);
+  CDR_put_octet(cdrCodec, pv.major);
+  CDR_put_octet(cdrCodec, pv.minor);
 
   //Vendor id
   VENDOR_ID_UNKNOWN(vid);
-  CDR_put_octet(cdrCodec,vid.major);
-  CDR_put_octet(cdrCodec,vid.minor);
+  CDR_put_octet(cdrCodec, vid.major);
+  CDR_put_octet(cdrCodec, vid.minor);
 
   /* next data are sent in big endianing */
-  data_endian=cdrCodec->data_endian;
-  cdrCodec->data_endian=FLAG_BIG_ENDIAN;
+  data_endian = cdrCodec->data_endian;
+  cdrCodec->data_endian = FLAG_BIG_ENDIAN;
 
   /* Host Id */
-  CDR_put_ulong(cdrCodec,hid);
+  CDR_put_ulong(cdrCodec, hid);
 
   /* App Id */
-  CDR_put_ulong(cdrCodec,aid);
+  CDR_put_ulong(cdrCodec, aid);
 
-  cdrCodec->data_endian=data_endian;
+  cdrCodec->data_endian = data_endian;
 
   return 16;
-} 
+}
 /**********************************************************************************/
 int
-RTPSHeaderCheck(CDR_Codec *cdrCodec,int32_t len,MessageInterpret *mi) {
+RTPSHeaderCheck(CDR_Codec *cdrCodec, int32_t len, MessageInterpret *mi)
+{
   CDR_Endianness  data_endian;
   CORBA_octet c;
 
-  if (len<16) return -1;                            /* message is too small */
+  if (len < 16)
+    return -1;                                      /* message is too small */
   CDR_get_octet(cdrCodec, (CORBA_octet *)&c);
-  if (c!='R') return -2;                            /* header is invalid */
+  if (c != 'R')
+    return -2;                                      /* header is invalid */
   CDR_get_octet(cdrCodec, (CORBA_octet *)&c);
-  if (c!='T') return -2;                            
+  if (c != 'T')
+    return -2;
   CDR_get_octet(cdrCodec, (CORBA_octet *)&c);
-  if (c!='P') return -2;                            
+  if (c != 'P')
+    return -2;
   CDR_get_octet(cdrCodec, (CORBA_octet *)&c);
-  if (c!='S') return -2;                            
+  if (c != 'S')
+    return -2;
 
   /* Protocol Version */
   CDR_get_octet(cdrCodec, (CORBA_octet *)&mi->sourceVersion.major);
   CDR_get_octet(cdrCodec, (CORBA_octet *)&mi->sourceVersion.minor);
 
-   /* Vendor Id */
+  /* Vendor Id */
   CDR_get_octet(cdrCodec, (CORBA_octet *)&mi->sourceVendorId.major);
   CDR_get_octet(cdrCodec, (CORBA_octet *)&mi->sourceVendorId.minor);
 
   /* next data are sent in big endianing */
-  data_endian=cdrCodec->data_endian;
-  cdrCodec->data_endian=FLAG_BIG_ENDIAN;
+  data_endian = cdrCodec->data_endian;
+  cdrCodec->data_endian = FLAG_BIG_ENDIAN;
 
   /* Host Id */
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&mi->sourceHostId);
@@ -101,10 +108,8 @@ RTPSHeaderCheck(CDR_Codec *cdrCodec,int32_t len,MessageInterpret *mi) {
   /* App Id */
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&mi->sourceAppId);
 
-  cdrCodec->data_endian=data_endian;
+  cdrCodec->data_endian = data_endian;
 
-  mi->haveTimestamp=ORTE_FALSE;                     /* false */
+  mi->haveTimestamp = ORTE_FALSE;                     /* false */
   return 0;
 }
-
-
index a3bdcdec7bd2e8dba05d17ff145d9703a93f160b..27ce3d77f1b9c3b2dffe517e60713fbd5f61c4ac 100644 (file)
 /*
- *  $Id: RTPSHeardBeat.c,v 0.0.0.1      2003/10/07 
+ *  $Id: RTPSHeardBeat.c,v 0.0.0.1      2003/10/07
  *
  *  DEBUG:  section 48                  RTPS message HeardBeat
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
 /**********************************************************************************/
-int 
+int
 RTPSHeartBeatCreate(CDR_Codec *cdrCodec,
-    SequenceNumber *fsn,SequenceNumber *lsn,
-    ObjectId roid,ObjectId woid,Boolean f_bit) 
+                   SequenceNumber *fsn, SequenceNumber *lsn,
+                   ObjectId roid, ObjectId woid, Boolean f_bit)
 {
   CDR_Endianness     data_endian;
-  CORBA_octet       flags;
+  CORBA_octet        flags;
 
-  if (cdrCodec->buf_len<cdrCodec->wptr+28) return -1;
+  if (cdrCodec->buf_len < cdrCodec->wptr+28)
+    return -1;
 
   /* submessage id */
-  CDR_put_octet(cdrCodec,HEARTBEAT);
+  CDR_put_octet(cdrCodec, HEARTBEAT);
 
   /* flags */
-  flags=cdrCodec->data_endian;
-  if (f_bit) flags|=2;
-  CDR_put_octet(cdrCodec,flags);
+  flags = cdrCodec->data_endian;
+  if (f_bit)
+    flags |= 2;
+  CDR_put_octet(cdrCodec, flags);
 
   /* length */
-  CDR_put_ushort(cdrCodec,24);
+  CDR_put_ushort(cdrCodec, 24);
 
   /* next data are sent in big endianing */
-  data_endian=cdrCodec->data_endian;
-  cdrCodec->data_endian=FLAG_BIG_ENDIAN;
+  data_endian = cdrCodec->data_endian;
+  cdrCodec->data_endian = FLAG_BIG_ENDIAN;
 
   /* readerObjectId */
-  CDR_put_ulong(cdrCodec,roid);
-  
+  CDR_put_ulong(cdrCodec, roid);
+
   /* writerObjectId */
-  CDR_put_ulong(cdrCodec,woid);
+  CDR_put_ulong(cdrCodec, woid);
 
-  cdrCodec->data_endian=data_endian;
+  cdrCodec->data_endian = data_endian;
 
   /* firstSeqNumber */
-  CDR_put_ulong(cdrCodec,fsn->high);
-  CDR_put_ulong(cdrCodec,fsn->low);
+  CDR_put_ulong(cdrCodec, fsn->high);
+  CDR_put_ulong(cdrCodec, fsn->low);
 
   /* lastSeqNumber */
-  CDR_put_ulong(cdrCodec,lsn->high);
-  CDR_put_ulong(cdrCodec,lsn->low);
+  CDR_put_ulong(cdrCodec, lsn->high);
+  CDR_put_ulong(cdrCodec, lsn->low);
 
   return 28;
 }
 
 /**********************************************************************************/
-void 
-HeartBeatProc(CSTReader *cstReader,GUID_RTPS *writerGUID,
-    SequenceNumber *fsn,SequenceNumber *lsn,char f_bit) {
+void
+HeartBeatProc(CSTReader *cstReader, GUID_RTPS *writerGUID,
+             SequenceNumber *fsn, SequenceNumber *lsn, char f_bit)
+{
   CSTRemoteWriter    *cstRemoteWriter;
-  
-  if (!cstReader) return;
-  cstRemoteWriter=CSTRemoteWriter_find(cstReader,writerGUID);
-  if (!cstRemoteWriter) return;
-
-  cstRemoteWriter->firstSN=*fsn;
-  cstRemoteWriter->lastSN=*lsn;
-  cstRemoteWriter->ACKRetriesCounter=0;
-
-  if (SeqNumberCmp(cstRemoteWriter->sn,*lsn)>0)
-    cstRemoteWriter->sn=*lsn;
-  if (SeqNumberCmp(cstRemoteWriter->sn,*fsn)<0) {
-    if (SeqNumberCmp(*fsn,noneSN)!=0) {
-      SeqNumberDec(cstRemoteWriter->sn,*fsn);
+
+  if (!cstReader)
+    return;
+  cstRemoteWriter = CSTRemoteWriter_find(cstReader, writerGUID);
+  if (!cstRemoteWriter)
+    return;
+
+  cstRemoteWriter->firstSN = *fsn;
+  cstRemoteWriter->lastSN = *lsn;
+  cstRemoteWriter->ACKRetriesCounter = 0;
+
+  if (SeqNumberCmp(cstRemoteWriter->sn, *lsn) > 0)
+    cstRemoteWriter->sn = *lsn;
+  if (SeqNumberCmp(cstRemoteWriter->sn, *fsn) < 0) {
+    if (SeqNumberCmp(*fsn, noneSN) != 0) {
+      SeqNumberDec(cstRemoteWriter->sn, *fsn);
     }
   }
 
   if ((writerGUID->oid & 0x07) == OID_PUBLICATION) {
-    CSTReaderProcCSChangesIssue(cstRemoteWriter,ORTE_FALSE);
+    CSTReaderProcCSChangesIssue(cstRemoteWriter, ORTE_FALSE);
   } else {
-    CSTReaderProcCSChanges(cstReader->domain,cstRemoteWriter);
+    CSTReaderProcCSChanges(cstReader->domain, cstRemoteWriter);
   }
 
-  if ((!f_bit) && (cstRemoteWriter->commStateACK==WAITING)) {
-    char queue=1;
-    cstRemoteWriter->commStateACK=ACKPENDING;
-    if ((cstRemoteWriter->guid.oid & 0x07) == OID_PUBLICATION) 
-      queue=2;
+  if ((!f_bit) && (cstRemoteWriter->commStateACK == WAITING)) {
+    char queue = 1;
+    cstRemoteWriter->commStateACK = ACKPENDING;
+    if ((cstRemoteWriter->guid.oid & 0x07) == OID_PUBLICATION)
+      queue = 2;
     eventDetach(cstReader->domain,
-        cstRemoteWriter->spobject->objectEntryAID,
-        &cstRemoteWriter->repeatActiveQueryTimer,
-        queue); 
+               cstRemoteWriter->spobject->objectEntryAID,
+               &cstRemoteWriter->repeatActiveQueryTimer,
+               queue);
     eventDetach(cstReader->domain,
-        cstRemoteWriter->spobject->objectEntryAID,
-        &cstRemoteWriter->delayResponceTimer,
-        queue);   //metatraffic timer
+               cstRemoteWriter->spobject->objectEntryAID,
+               &cstRemoteWriter->delayResponceTimer,
+               queue); //metatraffic timer
     eventAdd(cstReader->domain,
-        cstRemoteWriter->spobject->objectEntryAID,
-        &cstRemoteWriter->delayResponceTimer,
-        queue,    //metatraffic timer
-        "CSTReaderResponceTimer",
-        CSTReaderResponceTimer,
-        &cstRemoteWriter->cstReader->lock,
-        cstRemoteWriter,
-        &cstRemoteWriter->cstReader->params.delayResponceTimeMin);
+            cstRemoteWriter->spobject->objectEntryAID,
+            &cstRemoteWriter->delayResponceTimer,
+            queue, //metatraffic timer
+            "CSTReaderResponceTimer",
+            CSTReaderResponceTimer,
+            &cstRemoteWriter->cstReader->lock,
+            cstRemoteWriter,
+            &cstRemoteWriter->cstReader->params.delayResponceTimeMin);
   }
 }
 
 /**********************************************************************************/
-void 
-RTPSHeartBeat(ORTEDomain *d,CDR_Codec *cdrCodec,MessageInterpret *mi) {
+void
+RTPSHeartBeat(ORTEDomain *d, CDR_Codec *cdrCodec, MessageInterpret *mi)
+{
   GUID_RTPS          writerGUID;
-  ObjectId          roid,woid;
-  SequenceNumber     fsn,lsn;
-  CSTReader          *cstReader=NULL;
+  ObjectId           roid, woid;
+  SequenceNumber     fsn, lsn;
+  CSTReader          *cstReader = NULL;
   CDR_Endianness     data_endian;
-  CORBA_octet       flags;
-  char              f_bit;
+  CORBA_octet        flags;
+  char               f_bit;
 
   /* restore flag possition in submessage */
-  cdrCodec->rptr-=3;
+  cdrCodec->rptr -= 3;
 
   /* flags */
   CDR_get_octet(cdrCodec, (CORBA_octet *)&flags);
-  f_bit=flags & 2;
+  f_bit = flags & 2;
 
   /* move reading possition to begin of submessage */
-  cdrCodec->rptr+=2;
+  cdrCodec->rptr += 2;
 
   /* next data are sent in big endianing */
-  data_endian=cdrCodec->data_endian;
-  cdrCodec->data_endian=FLAG_BIG_ENDIAN;
+  data_endian = cdrCodec->data_endian;
+  cdrCodec->data_endian = FLAG_BIG_ENDIAN;
 
   /* readerObjectId */
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&roid);
-  
+
   /* writerObjectId */
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&woid);
 
-  cdrCodec->data_endian=data_endian;
+  cdrCodec->data_endian = data_endian;
 
   /* firstSeqNumber */
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&fsn.high);
@@ -170,63 +176,64 @@ RTPSHeartBeat(ORTEDomain *d,CDR_Codec *cdrCodec,MessageInterpret *mi) {
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&lsn.high);
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&lsn.low);
 
-  if (SeqNumberCmp(fsn,lsn)==1) return;                // lsn<fsn -> break
-  writerGUID.hid=mi->sourceHostId;
-  writerGUID.aid=mi->sourceAppId;
-  writerGUID.oid=woid;
+  if (SeqNumberCmp(fsn, lsn) == 1)
+    return;                                     // lsn<fsn -> break
+  writerGUID.hid = mi->sourceHostId;
+  writerGUID.aid = mi->sourceAppId;
+  writerGUID.oid = woid;
 
-  debug(48,3) ("recv: RTPS HB%c(0x%x) from 0x%x-0x%x\n",
-                f_bit ? 'F':'f',woid,mi->sourceHostId,mi->sourceAppId);
+  debug(48, 3) ("recv: RTPS HB%c(0x%x) from 0x%x-0x%x\n",
+               f_bit ? 'F' : 'f', woid, mi->sourceHostId, mi->sourceAppId);
 
-  if ((d->guid.aid & 0x03)==MANAGER) {
-    if ((writerGUID.oid==OID_WRITE_APPSELF) && 
-        ((writerGUID.aid & 0x03)==MANAGER)) {
+  if ((d->guid.aid & 0x03) == MANAGER) {
+    if ((writerGUID.oid == OID_WRITE_APPSELF) &&
+       ((writerGUID.aid & 0x03) == MANAGER)) {
       pthread_rwlock_wrlock(&d->readerManagers.lock);
-      cstReader=&d->readerManagers;
+      cstReader = &d->readerManagers;
     }
-    if (((writerGUID.oid==OID_WRITE_APPSELF) &&
-         ((writerGUID.aid & 0x03)==MANAGEDAPPLICATION)) ||
-        ((writerGUID.oid==OID_WRITE_APP) &&
-         ((writerGUID.aid & 0x03)==MANAGER))) {
+    if (((writerGUID.oid == OID_WRITE_APPSELF) &&
+        ((writerGUID.aid & 0x03) == MANAGEDAPPLICATION)) ||
+       ((writerGUID.oid == OID_WRITE_APP) &&
+        ((writerGUID.aid & 0x03) == MANAGER))) {
       pthread_rwlock_wrlock(&d->readerApplications.lock);
-      cstReader=&d->readerApplications;
+      cstReader = &d->readerApplications;
     }
   }
 
-  if ((d->guid.aid & 3)==MANAGEDAPPLICATION) {
+  if ((d->guid.aid & 3) == MANAGEDAPPLICATION) {
     switch (writerGUID.oid) {
       case OID_WRITE_MGR:
-        pthread_rwlock_wrlock(&d->readerManagers.lock);
-        cstReader=&d->readerManagers;
-        break;
+       pthread_rwlock_wrlock(&d->readerManagers.lock);
+       cstReader = &d->readerManagers;
+       break;
       case OID_WRITE_APP:
-        pthread_rwlock_wrlock(&d->readerApplications.lock);
-        cstReader=&d->readerApplications;
-        break;
+       pthread_rwlock_wrlock(&d->readerApplications.lock);
+       cstReader = &d->readerApplications;
+       break;
       case OID_WRITE_PUBL:
-        pthread_rwlock_wrlock(&d->readerPublications.lock);
-        cstReader=&d->readerPublications;
-        break;
+       pthread_rwlock_wrlock(&d->readerPublications.lock);
+       cstReader = &d->readerPublications;
+       break;
       case OID_WRITE_SUBS:
-        pthread_rwlock_wrlock(&d->readerSubscriptions.lock);
-        cstReader=&d->readerSubscriptions;
-        break;
+       pthread_rwlock_wrlock(&d->readerSubscriptions.lock);
+       cstReader = &d->readerSubscriptions;
+       break;
     }
 
     if ((writerGUID.oid & 0x07) == OID_PUBLICATION) {
       pthread_rwlock_rdlock(&d->subscriptions.lock);
-      gavl_cust_for_each(CSTReader,&d->subscriptions,cstReader) {
-        pthread_rwlock_wrlock(&cstReader->lock);
-        HeartBeatProc(cstReader,&writerGUID,&fsn,&lsn,f_bit);
-        pthread_rwlock_unlock(&cstReader->lock);    
+      gavl_cust_for_each(CSTReader, &d->subscriptions, cstReader) {
+       pthread_rwlock_wrlock(&cstReader->lock);
+       HeartBeatProc(cstReader, &writerGUID, &fsn, &lsn, f_bit);
+       pthread_rwlock_unlock(&cstReader->lock);
       }
       pthread_rwlock_unlock(&d->subscriptions.lock);
-      cstReader=NULL;
+      cstReader = NULL;
     }
-  }  
+  }
 
-  HeartBeatProc(cstReader,&writerGUID,&fsn,&lsn,f_bit);
+  HeartBeatProc(cstReader, &writerGUID, &fsn, &lsn, f_bit);
 
   if (cstReader)
     pthread_rwlock_unlock(&cstReader->lock);
-} 
+}
index 3b0487cc6074e5382cb64d2a7dbdd762e01f1b04..9edcf600acfd82c5b121b8f55c98c8aba5b36778 100644 (file)
@@ -3,42 +3,44 @@
  *
  *  DEBUG:  section 42                  message INFO DST
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
 /**********************************************************************************/
-void RTPSInfoDST(CDR_Codec *cdrCodec,MessageInterpret *mi) {
+void
+RTPSInfoDST(CDR_Codec *cdrCodec, MessageInterpret *mi)
+{
   CDR_Endianness     data_endian;
   HostId             hid;
   AppId              aid;
 
-  data_endian=cdrCodec->data_endian;
-  cdrCodec->data_endian=FLAG_BIG_ENDIAN;
+  data_endian = cdrCodec->data_endian;
+  cdrCodec->data_endian = FLAG_BIG_ENDIAN;
 
   /* Host Id */
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&hid);
@@ -46,17 +48,15 @@ void RTPSInfoDST(CDR_Codec *cdrCodec,MessageInterpret *mi) {
   /* App Id */
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&aid);
 
-  cdrCodec->data_endian=data_endian;
+  cdrCodec->data_endian = data_endian;
 
-  debug(42,3) ("  RTPSInfoDST:\n");
-  debug(42,4) ("    hid:0x%x, aid:0x%x\n",hid,aid);
+  debug(42, 3) ("  RTPSInfoDST:\n");
+  debug(42, 4) ("    hid:0x%x, aid:0x%x\n", hid, aid);
 
-  if (hid!=HID_UNKNOWN) {
-    mi->destHostId=hid;
+  if (hid != HID_UNKNOWN) {
+    mi->destHostId = hid;
   }
-  if (aid!=AID_UNKNOWN) {
-    mi->destAppId=aid;
+  if (aid != AID_UNKNOWN) {
+    mi->destAppId = aid;
   }
 }
-
-
index fe49f5556ca0cd36a91ece48d8cf704eb788e13d..aae7f8a38d242f58d7de155819443ef7423f76ab 100644 (file)
@@ -3,90 +3,91 @@
  *
  *  DEBUG:  section 43                  message INFO REPLY
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
 /**********************************************************************************/
-int 
-RTPSInfoREPLYCreate(CDR_Codec *cdrCodec,IPAddress ipaddress,Port port)
+int
+RTPSInfoREPLYCreate(CDR_Codec *cdrCodec, IPAddress ipaddress, Port port)
 {
   CORBA_octet flags;
 
-  if (cdrCodec->buf_len<cdrCodec->wptr+12) return -1;
+  if (cdrCodec->buf_len < cdrCodec->wptr+12)
+    return -1;
 
   /* submessage id */
-  CDR_put_octet(cdrCodec,INFO_REPLY);
+  CDR_put_octet(cdrCodec, INFO_REPLY);
 
   /* flags */
-  flags=cdrCodec->data_endian;
-  CDR_put_octet(cdrCodec,flags);
+  flags = cdrCodec->data_endian;
+  CDR_put_octet(cdrCodec, flags);
 
   /* length */
-  CDR_put_ushort(cdrCodec,8);
+  CDR_put_ushort(cdrCodec, 8);
 
   /* ipaddress */
-  CDR_put_ulong(cdrCodec,ipaddress);
+  CDR_put_ulong(cdrCodec, ipaddress);
 
   /* port */
-  CDR_put_ulong(cdrCodec,port);
+  CDR_put_ulong(cdrCodec, port);
   return 12;
-} 
+}
 
 /**********************************************************************************/
-void 
-RTPSInfoREPLY(CDR_Codec *cdrCodec,MessageInterpret *mi) 
+void
+RTPSInfoREPLY(CDR_Codec *cdrCodec, MessageInterpret *mi)
 {
-  CORBA_octet        flags;  
+  CORBA_octet        flags;
   IPAddress          ipa;
   Port               port;
 
   /* restore flag possition in submessage */
-  cdrCodec->rptr-=3;
+  cdrCodec->rptr -= 3;
 
   /* flags */
   CDR_get_octet(cdrCodec, (CORBA_octet *)&flags);
 
   /* move reading possition to begin of submessage */
-  cdrCodec->rptr+=2;
+  cdrCodec->rptr += 2;
 
   /* unicastReplyIPAddress */
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&ipa);
-  
+
   /* unicastReplyPort */
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&port);
-  
-  debug(43,3) ("recv: RTPS InfoREPLY from 0x%x-0x%x\n",
-                mi->sourceHostId,mi->sourceAppId);
 
-  if (ipa!=IPADDRESS_INVALID) {
-    mi->unicastReplyIPAddress=ipa;
+  debug(43, 3) ("recv: RTPS InfoREPLY from 0x%x-0x%x\n",
+               mi->sourceHostId, mi->sourceAppId);
+
+  if (ipa != IPADDRESS_INVALID) {
+    mi->unicastReplyIPAddress = ipa;
   }
-  mi->unicastReplyPort=port;
+  mi->unicastReplyPort = port;
 
   if (flags & 0x02) {
     /* multicastReplyIPAddress */
@@ -95,11 +96,10 @@ RTPSInfoREPLY(CDR_Codec *cdrCodec,MessageInterpret *mi)
     /* multicastReplyPort */
     CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&port);
 
-    mi->multicastReplyIPAddress=ipa;
-    mi->multicastReplyPort=port;
+    mi->multicastReplyIPAddress = ipa;
+    mi->multicastReplyPort = port;
   } else {
-    mi->multicastReplyIPAddress=IPADDRESS_INVALID;
-    mi->multicastReplyPort     =PORT_INVALID;
+    mi->multicastReplyIPAddress = IPADDRESS_INVALID;
+    mi->multicastReplyPort     = PORT_INVALID;
   }
 }
-
index fd43140e6a4c237c7f87e5152b43478224da7511..cb08e37c95fd08b77461e39b74f0bc9d97b97e07 100644 (file)
@@ -3,36 +3,38 @@
  *
  *  DEBUG:  section 44                  message INFO SRC
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
 /**********************************************************************************/
-void RTPSInfoSRC(CDR_Codec *cdrCodec,MessageInterpret *mi) {
+void
+RTPSInfoSRC(CDR_Codec *cdrCodec, MessageInterpret *mi)
+{
   IPAddress          ipa;
   ProtocolVersion    protocol;
   VendorId           vid;
@@ -43,7 +45,7 @@ void RTPSInfoSRC(CDR_Codec *cdrCodec,MessageInterpret *mi) {
 
   /* appIPAddress */
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&ipa);
-  
+
   /* ProtocolVersion */
   CDR_get_octet(cdrCodec, (CORBA_octet *)&protocol.major);
   CDR_get_octet(cdrCodec, (CORBA_octet *)&protocol.minor);
@@ -53,8 +55,8 @@ void RTPSInfoSRC(CDR_Codec *cdrCodec,MessageInterpret *mi) {
   CDR_get_octet(cdrCodec, (CORBA_octet *)&vid.minor);
 
   /* next data are sent in big endianing */
-  data_endian=cdrCodec->data_endian;
-  cdrCodec->data_endian=FLAG_BIG_ENDIAN;
+  data_endian = cdrCodec->data_endian;
+  cdrCodec->data_endian = FLAG_BIG_ENDIAN;
 
   /* HostId */
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&hid);
@@ -62,20 +64,20 @@ void RTPSInfoSRC(CDR_Codec *cdrCodec,MessageInterpret *mi) {
   /* AppId */
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&aid);
 
-  cdrCodec->data_endian=data_endian;
+  cdrCodec->data_endian = data_endian;
 
-  debug(44,3) ("  RTPSInfoSRC: \n");
-  debug(44,4) ("    appIPAddress:%s\n",IPAddressToString(ipa,sIPAddress));
-  debug(44,4) ("    pv:%lu,%lu vid:%lu,%lu hid:0x%x aid:0x%x\n",
-                             protocol.major,protocol.minor,vid.major,vid.minor,hid,aid);
+  debug(44, 3) ("  RTPSInfoSRC: \n");
+  debug(44, 4) ("    appIPAddress:%s\n", IPAddressToString(ipa, sIPAddress));
+  debug(44, 4) ("    pv:%lu,%lu vid:%lu,%lu hid:0x%x aid:0x%x\n",
+               protocol.major, protocol.minor, vid.major, vid.minor, hid, aid);
 
-  mi->sourceHostId=hid;
-  mi->sourceAppId=aid;
-  mi->sourceVersion=protocol;
-  mi->sourceVendorId=vid;
-  mi->unicastReplyIPAddress=ipa;
-  mi->unicastReplyPort=PORT_INVALID;
-  mi->multicastReplyIPAddress=IPADDRESS_INVALID;
-  mi->multicastReplyPort=PORT_INVALID;
-  mi->haveTimestamp=ORTE_FALSE;
+  mi->sourceHostId = hid;
+  mi->sourceAppId = aid;
+  mi->sourceVersion = protocol;
+  mi->sourceVendorId = vid;
+  mi->unicastReplyIPAddress = ipa;
+  mi->unicastReplyPort = PORT_INVALID;
+  mi->multicastReplyIPAddress = IPADDRESS_INVALID;
+  mi->multicastReplyPort = PORT_INVALID;
+  mi->haveTimestamp = ORTE_FALSE;
 }
index dbea6c87ead469acd81b1270734ceedb8ff4656b..ed17e873f36e99bca9cb66849de5e213981d4290 100644 (file)
@@ -3,91 +3,94 @@
  *
  *  DEBUG:  section 45                  message INFO TS
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
 /**********************************************************************************/
 int
-RTPSInfoTSCreate(CDR_Codec *cdrCodec,NtpTime time) {
+RTPSInfoTSCreate(CDR_Codec *cdrCodec, NtpTime time)
+{
   CORBA_octet flags;
 
-  if (cdrCodec->buf_len<cdrCodec->wptr+12) return -1;
+  if (cdrCodec->buf_len < cdrCodec->wptr+12)
+    return -1;
 
   /* submessage id */
-  CDR_put_octet(cdrCodec,INFO_TS);
+  CDR_put_octet(cdrCodec, INFO_TS);
 
   /* flags - I-bit=0 */
-  flags=cdrCodec->data_endian;
-  CDR_put_octet(cdrCodec,flags);
+  flags = cdrCodec->data_endian;
+  CDR_put_octet(cdrCodec, flags);
 
   /* length */
-  CDR_put_ushort(cdrCodec,8);
+  CDR_put_ushort(cdrCodec, 8);
 
   /* time in seconds */
-  CDR_put_long(cdrCodec,time.seconds);
+  CDR_put_long(cdrCodec, time.seconds);
 
   /* time in seconds / 2^32 */
-  CDR_put_ulong(cdrCodec,time.fraction);
+  CDR_put_ulong(cdrCodec, time.fraction);
 
   return 12;
 }
 
 /**********************************************************************************/
-void 
-RTPSInfoTS(CDR_Codec *cdrCodec,MessageInterpret *mi) {
-  char                      buff[MAX_STRING_NTPTIME_LENGTH];
-  CORBA_octet        flags;  
+void
+RTPSInfoTS(CDR_Codec *cdrCodec, MessageInterpret *mi)
+{
+  char               buff[MAX_STRING_NTPTIME_LENGTH];
+  CORBA_octet        flags;
 
   /* restore flag possition in submessage */
-  cdrCodec->rptr-=3;
+  cdrCodec->rptr -= 3;
 
   /* flags */
   CDR_get_octet(cdrCodec, (CORBA_octet *)&flags);
 
   /* move reading possition to begin of submessage */
-  cdrCodec->rptr+=2;
+  cdrCodec->rptr += 2;
 
 
-  if ((flags & 0x02)==0) {              /* I = bit */
-    mi->haveTimestamp=ORTE_TRUE;
+  if ((flags & 0x02) == 0) {              /* I = bit */
+    mi->haveTimestamp = ORTE_TRUE;
 
     /* time in seconds */
-    CDR_get_long(cdrCodec,&mi->timestamp.seconds);
+    CDR_get_long(cdrCodec, &mi->timestamp.seconds);
 
     /* time in seconds / 2^32 */
     CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&mi->timestamp.fraction);
   } else {
-    mi->haveTimestamp=ORTE_FALSE;
+    mi->haveTimestamp = ORTE_FALSE;
     NTPTIME_ZERO(mi->timestamp);
   }
   if (mi->haveTimestamp)
-    debug(45,3) ("recv: RTPSInfoTS, timestamp %s\n",
-                  NtpTimeToStringUs(mi->timestamp, buff));
+    debug(45, 3) ("recv: RTPSInfoTS, timestamp %s\n",
+                 NtpTimeToStringUs(mi->timestamp, buff));
   else
-    debug(45,3) ("recv: RTPSInfoTS\n");
+    debug(45, 3) ("recv: RTPSInfoTS\n");
 }
index 39e98f1dc6e86d6ee3dba650dc171f36089eb6c4..c73a680b7144fc3680a27f44c37e432f97870905 100644 (file)
@@ -3,94 +3,97 @@
  *
  *  DEBUG:  section 56                  message ISSUE
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
 /**********************************************************************************/
 int
-RTPSIssueCreateHeader(CDR_Codec *cdrCodec,uint32_t length,
-    ObjectId roid,ObjectId woid,SequenceNumber sn) {
+RTPSIssueCreateHeader(CDR_Codec *cdrCodec, uint32_t length,
+                     ObjectId roid, ObjectId woid, SequenceNumber sn)
+{
   CDR_Endianness     data_endian;
   CORBA_octet        flags;
-  
-  if (cdrCodec->buf_len<cdrCodec->wptr+20) return -1;
+
+  if (cdrCodec->buf_len < cdrCodec->wptr+20)
+    return -1;
 
   /* submessage id */
-  CDR_put_octet(cdrCodec,ISSUE);
+  CDR_put_octet(cdrCodec, ISSUE);
 
   /* flags */
-  flags=cdrCodec->data_endian;
-  CDR_put_octet(cdrCodec,flags);
+  flags = cdrCodec->data_endian;
+  CDR_put_octet(cdrCodec, flags);
 
   /* length */
-  CDR_put_ushort(cdrCodec,(CORBA_unsigned_short)length);
+  CDR_put_ushort(cdrCodec, (CORBA_unsigned_short)length);
 
-  data_endian=cdrCodec->data_endian;
-  cdrCodec->data_endian=FLAG_BIG_ENDIAN;
+  data_endian = cdrCodec->data_endian;
+  cdrCodec->data_endian = FLAG_BIG_ENDIAN;
 
   /* readerObjectId */
-  CDR_put_ulong(cdrCodec,roid);
+  CDR_put_ulong(cdrCodec, roid);
 
   /* writerObjectId */
-  CDR_put_ulong(cdrCodec,woid);
+  CDR_put_ulong(cdrCodec, woid);
+
+  cdrCodec->data_endian = data_endian;
 
-  cdrCodec->data_endian=data_endian;
-  
-  CDR_put_ulong(cdrCodec,sn.high);
-  CDR_put_ulong(cdrCodec,sn.low);
+  CDR_put_ulong(cdrCodec, sn.high);
+  CDR_put_ulong(cdrCodec, sn.low);
   return 0;
 }
 
 /**********************************************************************************/
-void 
-RTPSIssue(ORTEDomain *d,CDR_Codec *cdrCodec,MessageInterpret *mi,IPAddress senderIPAddress) {
-  GUID_RTPS          guid,writerGUID;
-  ObjectId           roid,woid;
-  SequenceNumber     sn,sn_tmp; 
-  CORBA_octet        flags;  
+void
+RTPSIssue(ORTEDomain *d, CDR_Codec *cdrCodec, MessageInterpret *mi, IPAddress senderIPAddress)
+{
+  GUID_RTPS          guid, writerGUID;
+  ObjectId           roid, woid;
+  SequenceNumber     sn, sn_tmp;
+  CORBA_octet        flags;
   CORBA_unsigned_short submsg_len;
   CSTReader          *cstReader;
   CSTRemoteWriter    *cstRemoteWriter;
-  CSChange           *csChange=NULL;
+  CSChange           *csChange = NULL;
   CDR_Endianness     data_endian;
 
   /* restore flag possition in submessage */
-  cdrCodec->rptr-=3;
+  cdrCodec->rptr -= 3;
 
   /* flags */
   CDR_get_octet(cdrCodec, (CORBA_octet *)&flags);
 
   /* submessage length */
-  CDR_get_ushort(cdrCodec,&submsg_len);
+  CDR_get_ushort(cdrCodec, &submsg_len);
 
   /* next data are sent in big endianing */
-  data_endian=cdrCodec->data_endian;
-  cdrCodec->data_endian=FLAG_BIG_ENDIAN;
+  data_endian = cdrCodec->data_endian;
+  cdrCodec->data_endian = FLAG_BIG_ENDIAN;
 
   /* readerObjectId */
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&roid);
@@ -98,121 +101,122 @@ RTPSIssue(ORTEDomain *d,CDR_Codec *cdrCodec,MessageInterpret *mi,IPAddress sende
   /* writerObjectId */
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&woid);
 
-  cdrCodec->data_endian=data_endian;
+  cdrCodec->data_endian = data_endian;
 
   /* sn */
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&sn.high);
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&sn.low);
 
   /* at this moment is not supported p_bit */
-  if (flags & 0x02) return;                     /* p_bit */
+  if (flags & 0x02)
+    return;                                     /* p_bit */
+
+  writerGUID.hid = mi->sourceHostId;
+  writerGUID.aid = mi->sourceAppId;
+  writerGUID.oid = woid;
 
-  writerGUID.hid=mi->sourceHostId;
-  writerGUID.aid=mi->sourceAppId;
-  writerGUID.oid=woid;
-  
-  debug(56,3) ("recv: RTPS_ISSUE(0x%x) from 0x%x-0x%x\n",
-                woid,mi->sourceHostId,mi->sourceAppId);
+  debug(56, 3) ("recv: RTPS_ISSUE(0x%x) from 0x%x-0x%x\n",
+               woid, mi->sourceHostId, mi->sourceAppId);
 
   pthread_rwlock_rdlock(&d->subscriptions.lock);
-  guid=d->guid;
-  guid.oid=roid;
+  guid = d->guid;
+  guid.oid = roid;
 
-  gavl_cust_for_each(CSTReader,&d->subscriptions,cstReader) {
-    if (roid!=OID_UNKNOWN)
-      cstReader=CSTReader_find(&d->subscriptions,&guid);
+  gavl_cust_for_each(CSTReader, &d->subscriptions, cstReader) {
+    if (roid != OID_UNKNOWN)
+      cstReader = CSTReader_find(&d->subscriptions, &guid);
     if (cstReader) {
       ORTESubsProp *sp;
       pthread_rwlock_wrlock(&cstReader->lock);
-      sp=(ORTESubsProp*)cstReader->objectEntryOID->attributes;
-      cstRemoteWriter=CSTRemoteWriter_find(cstReader,&writerGUID);
+      sp = (ORTESubsProp *)cstReader->objectEntryOID->attributes;
+      cstRemoteWriter = CSTRemoteWriter_find(cstReader, &writerGUID);
       if (cstRemoteWriter) {
-        ORTEPublProp *pp,*pps;
-        pp=(ORTEPublProp*)cstRemoteWriter->spobject->attributes;
-        if (cstReader->cstRemoteWriterSubscribed!=NULL) {
-          pps=(ORTEPublProp*)cstReader->cstRemoteWriterSubscribed->
-                            spobject->attributes;
-          if ((pp->strength>pps->strength) || (NtpTimeCmp(pps->persistence,zNtpTime)==0)) {
-            cstReader->cstRemoteWriterSubscribed=cstRemoteWriter;
-          }
-        } else {
-          cstReader->cstRemoteWriterSubscribed=cstRemoteWriter;
-        }
-        if (cstReader->cstRemoteWriterSubscribed==cstRemoteWriter) {
-          eventDetach(d,
-              cstReader->objectEntryOID->objectEntryAID,
-              &cstReader->persistenceTimer,
-              0);   //common timer
-          eventAdd(d,
-              cstReader->objectEntryOID->objectEntryAID,
-              &cstReader->persistenceTimer,
-              0,   //common timer
-              "CSTReaderPersistenceTimer",
-              CSTReaderPersistenceTimer,
-              &cstReader->lock,
-              cstReader,
-              &pp->persistence);
-        }
-
-        if ((SeqNumberCmp(sn,cstRemoteWriter->sn)>0) &&   //have to be sn>writer_sn
-            (CSChangeFromWriter_find(cstRemoteWriter,&sn)==NULL)) {
-
-          csChange=(CSChange*)MALLOC(sizeof(CSChange));
-          csChange->guid=writerGUID;
-          csChange->sn=sn;
-          SEQUENCE_NUMBER_NONE(csChange->gapSN);
-          CSChangeAttributes_init_head(csChange);
-
-          CDR_codec_init_static(&csChange->cdrCodec);
-          CDR_buffer_init(&csChange->cdrCodec,
-                         submsg_len-16);
-         csChange->cdrCodec.data_endian=cdrCodec->data_endian;
-
-          memcpy(csChange->cdrCodec.buffer,
-                &cdrCodec->buffer[cdrCodec->rptr],submsg_len-16);
-
-          if (SeqNumberCmp(sn,cstRemoteWriter->firstSN)>=0) { //sn>=firstSN
-            if ((sp->reliabilityRequested & PID_VALUE_RELIABILITY_STRICT)!=0) {
-              if (sp->recvQueueSize>cstRemoteWriter->csChangesCounter) {
-                sn_tmp.high=0;
-                sn_tmp.low=sp->recvQueueSize;
-                SeqNumberAdd(sn_tmp,
-                             cstRemoteWriter->sn,
-                             sn_tmp);
-                if (SeqNumberCmp(sn,sn_tmp)<=0) {         //sn<=(firstSN+QueueSize)
-                  csChange->remoteTimePublished=mi->timestamp;
-                  csChange->localTimeReceived=getActualNtpTime();
-                  CSTReaderAddCSChange(cstRemoteWriter,csChange);
-                  csChange=NULL;
-                }
-              }
-            } else {
-              if ((sp->reliabilityRequested & PID_VALUE_RELIABILITY_BEST_EFFORTS)!=0) {
-                if ((sp->recvQueueSize<=cstRemoteWriter->csChangesCounter) ||
-                    (cstReader->cstRemoteWriterSubscribed!=cstRemoteWriter)) {
-                  CSChangeFromWriter *csChangeFromWriter;
-                  csChangeFromWriter=CSChangeFromWriter_first(cstRemoteWriter);
-                  CSTReaderDestroyCSChangeFromWriter(cstRemoteWriter,
-                        csChangeFromWriter,
-                        ORTE_FALSE);
-                }
-                if (sp->recvQueueSize>cstRemoteWriter->csChangesCounter) {
-                  csChange->remoteTimePublished=mi->timestamp;
-                  csChange->localTimeReceived=getActualNtpTime();
-                  CSTReaderAddCSChange(cstRemoteWriter,csChange);
-                  csChange=NULL;
-                }
-              }
-            }
-          } 
-        }
-        if (csChange) {
-          FREE(csChange->cdrCodec.buffer);
-          FREE(csChange);
-        }
-        CSTReaderProcCSChangesIssue(cstRemoteWriter,ORTE_FALSE);
+       ORTEPublProp *pp, *pps;
+       pp = (ORTEPublProp *)cstRemoteWriter->spobject->attributes;
+       if (cstReader->cstRemoteWriterSubscribed != NULL) {
+         pps = (ORTEPublProp *)cstReader->cstRemoteWriterSubscribed->
+               spobject->attributes;
+         if ((pp->strength > pps->strength) || (NtpTimeCmp(pps->persistence, zNtpTime) == 0)) {
+           cstReader->cstRemoteWriterSubscribed = cstRemoteWriter;
+         }
+       } else {
+         cstReader->cstRemoteWriterSubscribed = cstRemoteWriter;
+       }
+       if (cstReader->cstRemoteWriterSubscribed == cstRemoteWriter) {
+         eventDetach(d,
+                     cstReader->objectEntryOID->objectEntryAID,
+                     &cstReader->persistenceTimer,
+                     0); //common timer
+         eventAdd(d,
+                  cstReader->objectEntryOID->objectEntryAID,
+                  &cstReader->persistenceTimer,
+                  0, //common timer
+                  "CSTReaderPersistenceTimer",
+                  CSTReaderPersistenceTimer,
+                  &cstReader->lock,
+                  cstReader,
+                  &pp->persistence);
+       }
+
+       if ((SeqNumberCmp(sn, cstRemoteWriter->sn) > 0) &&   //have to be sn>writer_sn
+           (CSChangeFromWriter_find(cstRemoteWriter, &sn) == NULL)) {
+
+         csChange = (CSChange *)MALLOC(sizeof(CSChange));
+         csChange->guid = writerGUID;
+         csChange->sn = sn;
+         SEQUENCE_NUMBER_NONE(csChange->gapSN);
+         CSChangeAttributes_init_head(csChange);
+
+         CDR_codec_init_static(&csChange->cdrCodec);
+         CDR_buffer_init(&csChange->cdrCodec,
+                         submsg_len-16);
+         csChange->cdrCodec.data_endian = cdrCodec->data_endian;
+
+         memcpy(csChange->cdrCodec.buffer,
+                &cdrCodec->buffer[cdrCodec->rptr], submsg_len-16);
+
+         if (SeqNumberCmp(sn, cstRemoteWriter->firstSN) >= 0) { //sn>=firstSN
+           if ((sp->reliabilityRequested & PID_VALUE_RELIABILITY_STRICT) != 0) {
+             if (sp->recvQueueSize > cstRemoteWriter->csChangesCounter) {
+               sn_tmp.high = 0;
+               sn_tmp.low = sp->recvQueueSize;
+               SeqNumberAdd(sn_tmp,
+                            cstRemoteWriter->sn,
+                            sn_tmp);
+               if (SeqNumberCmp(sn, sn_tmp) <= 0) {         //sn<=(firstSN+QueueSize)
+                 csChange->remoteTimePublished = mi->timestamp;
+                 csChange->localTimeReceived = getActualNtpTime();
+                 CSTReaderAddCSChange(cstRemoteWriter, csChange);
+                 csChange = NULL;
+               }
+             }
+           } else {
+             if ((sp->reliabilityRequested & PID_VALUE_RELIABILITY_BEST_EFFORTS) != 0) {
+               if ((sp->recvQueueSize <= cstRemoteWriter->csChangesCounter) ||
+                   (cstReader->cstRemoteWriterSubscribed != cstRemoteWriter)) {
+                 CSChangeFromWriter *csChangeFromWriter;
+                 csChangeFromWriter = CSChangeFromWriter_first(cstRemoteWriter);
+                 CSTReaderDestroyCSChangeFromWriter(cstRemoteWriter,
+                                                    csChangeFromWriter,
+                                                    ORTE_FALSE);
+               }
+               if (sp->recvQueueSize > cstRemoteWriter->csChangesCounter) {
+                 csChange->remoteTimePublished = mi->timestamp;
+                 csChange->localTimeReceived = getActualNtpTime();
+                 CSTReaderAddCSChange(cstRemoteWriter, csChange);
+                 csChange = NULL;
+               }
+             }
+           }
+         }
+       }
+       if (csChange) {
+         FREE(csChange->cdrCodec.buffer);
+         FREE(csChange);
+       }
+       CSTReaderProcCSChangesIssue(cstRemoteWriter, ORTE_FALSE);
       }
-      pthread_rwlock_unlock(&cstReader->lock);  
+      pthread_rwlock_unlock(&cstReader->lock);
     } else
       break;  //break traceing all cstReaders
   }
index fedb96d0bfa682c0dfc8e38b4646e41ccf4826c1..99ae737e78530f63a8b7c715803a8717a3e431aa 100644 (file)
@@ -1,42 +1,42 @@
 /*
- *  $Id: RTPSPad.c,v 0.0.0.1            2003/08/21 
+ *  $Id: RTPSPad.c,v 0.0.0.1            2003/08/21
  *
  *  DEBUG:  section 41                  message PAD
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
 /**********************************************************************************/
-void RTPSPad(CDR_Codec *cdrCodec,MessageInterpret *mi) {
+void
+RTPSPad(CDR_Codec *cdrCodec, MessageInterpret *mi)
+{
   //nothing to do
 
-  debug(41,3) ("  RTPSInfoPAD:\n");
-
-} 
-
+  debug(41, 3) ("  RTPSInfoPAD:\n");
 
+}
index 89ca08520bb311f287a806db5863b3b3485c3c94..01ca7c26c1fbd3228651b71366f1d7bb3a38b3cd 100644 (file)
@@ -1,64 +1,75 @@
 /*
- *  $Id: RTPSUtils.c,v 0.0.0.1          2003/09/13 
+ *  $Id: RTPSUtils.c,v 0.0.0.1          2003/09/13
  *
  *  DEBUG:  section 50          Utils
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
 /**********************************************************************************/
-int gavl_cmp_ntp_time(const NtpTime *a,const NtpTime *b) {
-  return NtpTimeCmp(*a,*b);
+int
+gavl_cmp_ntp_time(const NtpTime *a, const NtpTime *b)
+{
+  return NtpTimeCmp(*a, *b);
 }
 
 /**********************************************************************************/
-int gavl_cmp_sn(const SequenceNumber *a, const SequenceNumber *b) {
-  return SeqNumberCmp(*a,*b);
+int
+gavl_cmp_sn(const SequenceNumber *a, const SequenceNumber *b)
+{
+  return SeqNumberCmp(*a, *b);
 }
 
 /**********************************************************************************/
-int 
-gavl_cmp_guid(const GUID_RTPS *a, const GUID_RTPS *b) {
+int
+gavl_cmp_guid(const GUID_RTPS *a, const GUID_RTPS *b)
+{
   //HID
-  if (a->hid>b->hid) return 1;
-  if (a->hid<b->hid) return -1;
+  if (a->hid > b->hid)
+    return 1;
+  if (a->hid < b->hid)
+    return -1;
   //AID
-  if (a->aid>b->aid) return 1;
-  if (a->aid<b->aid) return -1;
+  if (a->aid > b->aid)
+    return 1;
+  if (a->aid < b->aid)
+    return -1;
   //OID
-  if (a->oid>b->oid) return 1;
-  if (a->oid<b->oid) return -1;
+  if (a->oid > b->oid)
+    return 1;
+  if (a->oid < b->oid)
+    return -1;
   return 0;
 }
 
 /**********************************************************************************/
-int 
-gavl_cmp_str(const char *const *a,const char *const *b) {
-  return strcmp((const char *)*a, (const char*)*b);
+int
+gavl_cmp_str(const char *const *a, const char *const *b)
+{
+  return strcmp((const char *)*a, (const char *)*b);
 }
-
index ef70b94b1dfb12200bd616b57f2b2265aecf53a2..9bf803011b335ea4903cf53d0594f8ad6f2db678 100644 (file)
-/*                            
- *  $Id: RTPSVar.c,v 0.0.0.2            2004/11/24 
+/*
+ *  $Id: RTPSVar.c,v 0.0.0.2            2004/11/24
  *
  *  DEBUG:  section 46                  RTPS message VAR
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
 /**********************************************************************************/
-int 
-RTPSVarCreate(CDR_Codec *cdrCodec,ObjectId roid,ObjectId woid,CSChange *csChange) 
+int
+RTPSVarCreate(CDR_Codec *cdrCodec, ObjectId roid, ObjectId woid, CSChange *csChange)
 {
   CDR_Endianness     data_endian;
   CORBA_octet        flags;
-  int               len,swptr;
+  int                len, swptr;
 
 
-  swptr=cdrCodec->wptr;
+  swptr = cdrCodec->wptr;
 
   /* submessage id */
-  CDR_put_octet(cdrCodec,VAR);
+  CDR_put_octet(cdrCodec, VAR);
 
   /* flags */
-  flags=cdrCodec->data_endian;
+  flags = cdrCodec->data_endian;
   if (!CSChangeAttributes_is_empty(csChange))
-    flags|=2;
-  if (csChange->alive) 
-    flags|=4;
-  if (csChange->guid.oid==OID_APP) 
-    flags|=8;
-  CDR_put_octet(cdrCodec,flags);
+    flags |= 2;
+  if (csChange->alive)
+    flags |= 4;
+  if (csChange->guid.oid == OID_APP)
+    flags |= 8;
+  CDR_put_octet(cdrCodec, flags);
 
   /* length */
-  cdrCodec->wptr+=2;
+  cdrCodec->wptr += 2;
 
   /* next data are sent in big endianing */
-  data_endian=cdrCodec->data_endian;
-  cdrCodec->data_endian=FLAG_BIG_ENDIAN;
+  data_endian = cdrCodec->data_endian;
+  cdrCodec->data_endian = FLAG_BIG_ENDIAN;
 
   /* readerObjectId */
-  CDR_put_ulong(cdrCodec,roid);
-  
+  CDR_put_ulong(cdrCodec, roid);
+
   /* writerObjectId */
-  CDR_put_ulong(cdrCodec,woid);
+  CDR_put_ulong(cdrCodec, woid);
 
-  if (csChange->guid.oid==OID_APP) {
-     /* hid */
-     CDR_put_ulong(cdrCodec,csChange->guid.hid);
+  if (csChange->guid.oid == OID_APP) {
+    /* hid */
+    CDR_put_ulong(cdrCodec, csChange->guid.hid);
 
-     /* aid */
-     CDR_put_ulong(cdrCodec,csChange->guid.aid);
+    /* aid */
+    CDR_put_ulong(cdrCodec, csChange->guid.aid);
   }
 
   /* oid */
-  CDR_put_ulong(cdrCodec,csChange->guid.oid);
+  CDR_put_ulong(cdrCodec, csChange->guid.oid);
 
-  cdrCodec->data_endian=data_endian;
+  cdrCodec->data_endian = data_endian;
 
   /* seqNumber */
-  CDR_put_ulong(cdrCodec,csChange->sn.high);
-  if (CDR_put_ulong(cdrCodec,csChange->sn.low)==CORBA_FALSE) {
-    cdrCodec->wptr=swptr;
+  CDR_put_ulong(cdrCodec, csChange->sn.high);
+  if (CDR_put_ulong(cdrCodec, csChange->sn.low) == CORBA_FALSE) {
+    cdrCodec->wptr = swptr;
     return -1;
   }
 
   /* parameters */
   if (!CSChangeAttributes_is_empty(csChange)) {
-    if (parameterCodeCodecFromCSChange(csChange,cdrCodec)<0) {
-      cdrCodec->wptr=swptr;
+    if (parameterCodeCodecFromCSChange(csChange, cdrCodec) < 0) {
+      cdrCodec->wptr = swptr;
       return -1;
     }
   }
+
   /* count length of message */
-  len=cdrCodec->wptr-swptr;
+  len = cdrCodec->wptr-swptr;
+
   /* length */
-  cdrCodec->wptr=swptr+2;
-  CDR_put_ushort(cdrCodec,(CORBA_unsigned_short)(len-4));
+  cdrCodec->wptr = swptr+2;
+  CDR_put_ushort(cdrCodec, (CORBA_unsigned_short)(len-4));
 
-  cdrCodec->wptr=swptr+len;
+  cdrCodec->wptr = swptr+len;
 
   return len;
 }
 
 /**********************************************************************************/
-void 
-RTPSVarFinish(CSTReader *cstReader,CSTRemoteWriter *cstRemoteWriter,
-    CSChange *csChange) {
+void
+RTPSVarFinish(CSTReader *cstReader, CSTRemoteWriter *cstRemoteWriter,
+             CSChange *csChange)
+{
 
   if (cstReader && cstRemoteWriter) {
-    debug(46,10) ("recv: processing CSChange\n");
-    if (SeqNumberCmp(csChange->sn,cstRemoteWriter->sn)>0) { //have to be sn>writer_sn
-      CSTReaderAddCSChange(cstRemoteWriter,csChange);
-      CSTReaderProcCSChanges(cstReader->domain,cstRemoteWriter);
-      csChange=NULL;
+    debug(46, 10) ("recv: processing CSChange\n");
+    if (SeqNumberCmp(csChange->sn, cstRemoteWriter->sn) > 0) { //have to be sn>writer_sn
+      CSTReaderAddCSChange(cstRemoteWriter, csChange);
+      CSTReaderProcCSChanges(cstReader->domain, cstRemoteWriter);
+      csChange = NULL;
     }
-  }  
+  }
 
   if (csChange) {
     //destroy csChange if any
@@ -134,69 +135,71 @@ RTPSVarFinish(CSTReader *cstReader,CSTRemoteWriter *cstRemoteWriter,
 }
 
 /**********************************************************************************/
-void 
-RTPSVarManager(ORTEDomain *d,CSChange *csChange,GUID_RTPS *writerGUID,
-    IPAddress senderIPAddress) 
+void
+RTPSVarManager(ORTEDomain *d, CSChange *csChange, GUID_RTPS *writerGUID,
+              IPAddress senderIPAddress)
 {
-  CSTReader          *cstReader=NULL;
-  CSTRemoteReader    *cstRemoteReader=NULL;
-  CSTRemoteWriter    *cstRemoteWriter=NULL;
+  CSTReader          *cstReader = NULL;
+  CSTRemoteReader    *cstRemoteReader = NULL;
+  CSTRemoteWriter    *cstRemoteWriter = NULL;
   ObjectEntryAID     *objectEntryAID;
   ObjectEntryOID     *objectEntryOID;
-  Boolean           usedMulticast=ORTE_FALSE;
+  Boolean            usedMulticast = ORTE_FALSE;
   int                i;
 
-  if ((d->guid.aid & 0x03)!=MANAGER) return;
+  if ((d->guid.aid & 0x03) != MANAGER)
+    return;
 
   /* readerManagers */
-  if ((writerGUID->oid==OID_WRITE_APPSELF) && 
-      ((writerGUID->aid & 0x03)==MANAGER)) {
+  if ((writerGUID->oid == OID_WRITE_APPSELF) &&
+      ((writerGUID->aid & 0x03) == MANAGER)) {
     pthread_rwlock_wrlock(&d->readerManagers.lock);
     pthread_rwlock_wrlock(&d->writerApplicationSelf.lock);
-    cstReader=&d->readerManagers;
+    cstReader = &d->readerManagers;
     gavl_cust_for_each(CSTRemoteReader,
-                       &d->writerApplicationSelf,
-                       cstRemoteReader) {
-      AppParams *ap=(AppParams*)cstRemoteReader->sobject->attributes;
-      for (i=0;i<ap->unicastIPAddressCount;i++) {
-       if (ap->unicastIPAddressList[i]==senderIPAddress) {
+                      &d->writerApplicationSelf,
+                      cstRemoteReader) {
+      AppParams *ap = (AppParams *)cstRemoteReader->sobject->attributes;
+
+      for (i = 0; i < ap->unicastIPAddressCount; i++) {
+       if (ap->unicastIPAddressList[i] == senderIPAddress) {
          break;
        }
       }
-      if (i!=ap->unicastIPAddressCount) 
+      if (i != ap->unicastIPAddressCount)
        break;
       if (matchMulticastAddresses(cstRemoteReader->sobject,
-                                 cstRemoteReader->cstWriter->objectEntryOID)) {
-       usedMulticast=ORTE_TRUE;
+                                 cstRemoteReader->cstWriter->objectEntryOID)) {
+       usedMulticast = ORTE_TRUE;
        break;
       }
     }
     if (cstRemoteReader) {
-      objectEntryOID=objectEntryFind(d,&csChange->guid);
+      objectEntryOID = objectEntryFind(d, &csChange->guid);
       if (!objectEntryOID) {
        //  create new RemoteReader
-       AppParams *ap=(AppParams*)MALLOC(sizeof(AppParams));
+       AppParams *ap = (AppParams *)MALLOC(sizeof(AppParams));
        AppParamsInit(ap);
-       parameterUpdateApplication(csChange,ap);
-       if (generateEvent(d,&csChange->guid,(void*)ap,csChange->alive) &&
-            csChange->alive) {
-         debug(46,2) ("manager 0x%x-0x%x accepted\n",
-                       csChange->guid.hid,csChange->guid.aid);
-         objectEntryOID=objectEntryAdd(d,&csChange->guid,(void*)ap);          
-         CSTWriterRefreshAllCSChanges(d,cstRemoteReader);
-         CSTReaderAddRemoteWriter(d,cstReader,objectEntryOID,writerGUID->oid);
+       parameterUpdateApplication(csChange, ap);
+       if (generateEvent(d, &csChange->guid, (void *)ap, csChange->alive) &&
+           csChange->alive) {
+         debug(46, 2) ("manager 0x%x-0x%x accepted\n",
+                       csChange->guid.hid, csChange->guid.aid);
+         objectEntryOID = objectEntryAdd(d, &csChange->guid, (void *)ap);
+         CSTWriterRefreshAllCSChanges(d, cstRemoteReader);
+         CSTReaderAddRemoteWriter(d, cstReader, objectEntryOID, writerGUID->oid);
          pthread_rwlock_wrlock(&d->readerApplications.lock);
          pthread_rwlock_wrlock(&d->writerApplications.lock);
-         CSTReaderAddRemoteWriter(d,&d->readerApplications,objectEntryOID,OID_WRITE_APP);
+         CSTReaderAddRemoteWriter(d, &d->readerApplications, objectEntryOID, OID_WRITE_APP);
          if (usedMulticast) {
-            /* connect to virual objectEntryOID of multicast manager */
-            CSTWriterAddRemoteReader(d,
+           /* connect to virual objectEntryOID of multicast manager */
+           CSTWriterAddRemoteReader(d,
                                     &d->writerApplications,
                                     objectEntryOID,
                                     OID_READ_APP,
                                     cstRemoteReader->sobject);
          } else {
-            CSTWriterAddRemoteReader(d,&d->writerApplications,
+           CSTWriterAddRemoteReader(d, &d->writerApplications,
                                     objectEntryOID,
                                     OID_READ_APP,
                                     objectEntryOID);
@@ -205,18 +208,19 @@ RTPSVarManager(ORTEDomain *d,CSChange *csChange,GUID_RTPS *writerGUID,
          pthread_rwlock_unlock(&d->readerApplications.lock);
          //all applications from manager node set expiration timer
          gavl_cust_for_each(ObjectEntryAID,
-                             objectEntryOID->objectEntryHID,objectEntryAID) {
-            ObjectEntryOID *objectEntryOID1;
-            objectEntryOID1=ObjectEntryOID_find(objectEntryAID,&csChange->guid.oid);
-            objectEntryRefreshApp(d,objectEntryOID1);
+                            objectEntryOID->objectEntryHID, objectEntryAID) {
+           ObjectEntryOID *objectEntryOID1;
+
+           objectEntryOID1 = ObjectEntryOID_find(objectEntryAID, &csChange->guid.oid);
+           objectEntryRefreshApp(d, objectEntryOID1);
          }
        } else {
          FREE(ap);
        }
       }
-      cstRemoteWriter=CSTRemoteWriter_find(cstReader,writerGUID);
-      if ((cstRemoteWriter) && (csChange->alive==ORTE_TRUE))
-       objectEntryRefreshApp(d,cstRemoteWriter->spobject);
+      cstRemoteWriter = CSTRemoteWriter_find(cstReader, writerGUID);
+      if ((cstRemoteWriter) && (csChange->alive == ORTE_TRUE))
+       objectEntryRefreshApp(d, cstRemoteWriter->spobject);
     } else {
       //deny Manager
     }
@@ -225,514 +229,524 @@ RTPSVarManager(ORTEDomain *d,CSChange *csChange,GUID_RTPS *writerGUID,
 
 
   /* readerApplication */
-  if (((writerGUID->oid==OID_WRITE_APPSELF) &&
-       ((writerGUID->aid & 0x03)==MANAGEDAPPLICATION)) ||
-      ((writerGUID->oid==OID_WRITE_APP) &&
-       ((writerGUID->aid & 0x03)==MANAGER))) {
+  if (((writerGUID->oid == OID_WRITE_APPSELF) &&
+       ((writerGUID->aid & 0x03) == MANAGEDAPPLICATION)) ||
+      ((writerGUID->oid == OID_WRITE_APP) &&
+       ((writerGUID->aid & 0x03) == MANAGER))) {
 
     pthread_rwlock_wrlock(&d->readerApplications.lock);
-    cstReader=&d->readerApplications;
-    objectEntryOID=objectEntryFind(d,&csChange->guid);
+    cstReader = &d->readerApplications;
+    objectEntryOID = objectEntryFind(d, &csChange->guid);
     if (!objectEntryOID) {
-      AppParams *ap=(AppParams*)MALLOC(sizeof(AppParams));
+      AppParams *ap = (AppParams *)MALLOC(sizeof(AppParams));
       AppParamsInit(ap);
-      parameterUpdateApplication(csChange,ap);
-      if (generateEvent(d,&csChange->guid,(void*)ap,csChange->alive) &&
-          csChange->alive) {
-        objectEntryOID=objectEntryAdd(d,&csChange->guid,(void*)ap);
-        objectEntryOID->appMOM=getTypeApp(d,ap,senderIPAddress);
-        if (objectEntryOID->appMOM) {
-          debug(46,2) ("MOM application 0x%x-0x%x accepted\n",
-                        csChange->guid.hid,csChange->guid.aid);
-          //increment vargAppsSequenceNumber and make csChange
-          SeqNumberInc(d->appParams->vargAppsSequenceNumber,
-                       d->appParams->vargAppsSequenceNumber);
-          //WAS & WM is locked inside next function
-          appSelfParamChanged(d,ORTE_TRUE,ORTE_FALSE,ORTE_TRUE,ORTE_TRUE);
-          CSTReaderAddRemoteWriter(d,cstReader,
-              objectEntryOID,writerGUID->oid);
-          CSTWriterAddRemoteReader(d,&d->writerManagers,
-              objectEntryOID,
-             OID_READ_MGR,
-              objectEntryOID);
-          pthread_rwlock_unlock(&d->writerApplicationSelf.lock);
-          pthread_rwlock_unlock(&d->writerManagers.lock);
-        } else {
-          debug(46,2) ("OAM application 0x%x-0x%x accepted\n",
-                        csChange->guid.hid,csChange->guid.aid);
-        }
-        pthread_rwlock_wrlock(&d->writerApplications.lock);
-        CSTWriterAddRemoteReader(d,&d->writerApplications,
-           objectEntryOID,
-           OID_READ_APP,
-           objectEntryOID);
-        pthread_rwlock_unlock(&d->writerApplications.lock);
+      parameterUpdateApplication(csChange, ap);
+      if (generateEvent(d, &csChange->guid, (void *)ap, csChange->alive) &&
+         csChange->alive) {
+       objectEntryOID = objectEntryAdd(d, &csChange->guid, (void *)ap);
+       objectEntryOID->appMOM = getTypeApp(d, ap, senderIPAddress);
+       if (objectEntryOID->appMOM) {
+         debug(46, 2) ("MOM application 0x%x-0x%x accepted\n",
+                       csChange->guid.hid, csChange->guid.aid);
+         //increment vargAppsSequenceNumber and make csChange
+         SeqNumberInc(d->appParams->vargAppsSequenceNumber,
+                      d->appParams->vargAppsSequenceNumber);
+         //WAS & WM is locked inside next function
+         appSelfParamChanged(d, ORTE_TRUE, ORTE_FALSE, ORTE_TRUE, ORTE_TRUE);
+         CSTReaderAddRemoteWriter(d, cstReader,
+                                  objectEntryOID, writerGUID->oid);
+         CSTWriterAddRemoteReader(d, &d->writerManagers,
+                                  objectEntryOID,
+                                  OID_READ_MGR,
+                                  objectEntryOID);
+         pthread_rwlock_unlock(&d->writerApplicationSelf.lock);
+         pthread_rwlock_unlock(&d->writerManagers.lock);
+       } else {
+         debug(46, 2) ("OAM application 0x%x-0x%x accepted\n",
+                       csChange->guid.hid, csChange->guid.aid);
+       }
+       pthread_rwlock_wrlock(&d->writerApplications.lock);
+       CSTWriterAddRemoteReader(d, &d->writerApplications,
+                                objectEntryOID,
+                                OID_READ_APP,
+                                objectEntryOID);
+       pthread_rwlock_unlock(&d->writerApplications.lock);
       } else {
-        FREE(ap);
-      }        
+       FREE(ap);
+      }
     }
     if (objectEntryOID) {
-      cstRemoteWriter=CSTRemoteWriter_find(cstReader,writerGUID);
+      cstRemoteWriter = CSTRemoteWriter_find(cstReader, writerGUID);
       if (objectEntryOID->appMOM) {
-        if (csChange->alive==ORTE_TRUE)
-          objectEntryRefreshApp(d,objectEntryOID);
+       if (csChange->alive == ORTE_TRUE)
+         objectEntryRefreshApp(d, objectEntryOID);
       } else {
-      //turn off expiration timer
-        eventDetach(d,
-            objectEntryOID->objectEntryAID,
-            &objectEntryOID->expirationPurgeTimer,
-            0);
-        debug(46,3) ("for application 0x%x-0x%x turn off expiration timer\n",
-                      objectEntryOID->guid.hid,objectEntryOID->guid.aid);
+       //turn off expiration timer
+       eventDetach(d,
+                   objectEntryOID->objectEntryAID,
+                   &objectEntryOID->expirationPurgeTimer,
+                   0);
+       debug(46, 3) ("for application 0x%x-0x%x turn off expiration timer\n",
+                     objectEntryOID->guid.hid, objectEntryOID->guid.aid);
       }
     }
   }
 
   /* try to proc csChange */
-  RTPSVarFinish(cstReader,cstRemoteWriter,csChange);
+  RTPSVarFinish(cstReader, cstRemoteWriter, csChange);
 }
 
 /**********************************************************************************/
-void 
-NewPublisher(ORTEDomain *d,ObjectEntryOID *op) {
+void
+NewPublisher(ORTEDomain *d, ObjectEntryOID *op)
+{
   ObjectEntryOID     *o;
   ORTEPublProp       *pp;
-  CSTWriter          *cstWriter=NULL;
-  CSTReader          *cstReader=NULL;
+  CSTWriter          *cstWriter = NULL;
+  CSTReader          *cstReader = NULL;
   PatternNode        *pnode;
-  
-  if ((d==NULL) || (op==NULL)) return;
-  pp=(ORTEPublProp*)op->attributes;
+
+  if ((d == NULL) || (op == NULL))
+    return;
+  pp = (ORTEPublProp *)op->attributes;
   //***************************************
-  //Pattern 
+  //Pattern
   //try to find if subscription exists
   pthread_rwlock_rdlock(&d->patternEntry.lock);
   pthread_rwlock_rdlock(&d->subscriptions.lock);
   gavl_cust_for_each(CSTReader,
-                     &d->subscriptions,cstReader) {
+                    &d->subscriptions, cstReader) {
     if (cstReader->createdByPattern) {
       ORTESubsProp       *sp;
-      sp=(ORTESubsProp*)cstReader->objectEntryOID->attributes;
-      if ((strcmp((const char *)sp->topic, (const char*)pp->topic)==0) &&
-          (strcmp((const char *)sp->typeName, (const char*)pp->typeName)==0)) 
-        break; //found
+      sp = (ORTESubsProp *)cstReader->objectEntryOID->attributes;
+      if ((strcmp((const char *)sp->topic, (const char *)pp->topic) == 0) &&
+         (strcmp((const char *)sp->typeName, (const char *)pp->typeName) == 0))
+       break;  //found
     }
   }
   pthread_rwlock_unlock(&d->subscriptions.lock);
   if (!cstReader) { //not exists
-    ul_list_for_each(Pattern,&d->patternEntry,pnode) {
-      if ((fnmatch((const char *)pnode->topic, (const char*)pp->topic,0)==0) &&
-          (fnmatch((const char *)pnode->type, (const char*)pp->typeName,0)==0)) {
-        //pattern matched
-        // free resources
-        pthread_rwlock_unlock(&d->readerPublications.lock);        
-        pthread_rwlock_unlock(&d->objectEntry.htimRootLock);
-        pthread_rwlock_unlock(&d->objectEntry.objRootLock);    
-        cstReader=pnode->subscriptionCallBack(
-            (char *)pp->topic,
-            (char *)pp->typeName,
-            pnode->param);
-        if (cstReader) {
-          cstReader->createdByPattern=ORTE_TRUE;
-        }
-        //allocate resources
-        pthread_rwlock_wrlock(&d->objectEntry.objRootLock);    
-        pthread_rwlock_wrlock(&d->objectEntry.htimRootLock);
-        pthread_rwlock_wrlock(&d->readerPublications.lock);        
-      }  
+    ul_list_for_each(Pattern, &d->patternEntry, pnode) {
+      if ((fnmatch((const char *)pnode->topic, (const char *)pp->topic, 0) == 0) &&
+         (fnmatch((const char *)pnode->type, (const char *)pp->typeName, 0) == 0)) {
+       //pattern matched
+       // free resources
+       pthread_rwlock_unlock(&d->readerPublications.lock);
+       pthread_rwlock_unlock(&d->objectEntry.htimRootLock);
+       pthread_rwlock_unlock(&d->objectEntry.objRootLock);
+       cstReader = pnode->subscriptionCallBack(
+         (char *)pp->topic,
+         (char *)pp->typeName,
+         pnode->param);
+       if (cstReader) {
+         cstReader->createdByPattern = ORTE_TRUE;
+       }
+       //allocate resources
+       pthread_rwlock_wrlock(&d->objectEntry.objRootLock);
+       pthread_rwlock_wrlock(&d->objectEntry.htimRootLock);
+       pthread_rwlock_wrlock(&d->readerPublications.lock);
+      }
     }
   }
   pthread_rwlock_unlock(&d->patternEntry.lock);
   //Pattern end
   pthread_rwlock_rdlock(&d->psEntry.subscriptionsLock);
-  gavl_cust_for_each(SubscriptionList,&d->psEntry,o) {
-    ORTESubsProp *sp=(ORTESubsProp*)o->attributes;
-    if ((strcmp((const char *)pp->topic, (const char*)sp->topic)==0) &&
-        (strcmp((const char *)pp->typeName, (const char*)sp->typeName)==0) &&
-        (pp->typeChecksum==sp->typeChecksum)) {
+  gavl_cust_for_each(SubscriptionList, &d->psEntry, o) {
+    ORTESubsProp *sp = (ORTESubsProp *)o->attributes;
+
+    if ((strcmp((const char *)pp->topic, (const char *)sp->topic) == 0) &&
+       (strcmp((const char *)pp->typeName, (const char *)sp->typeName) == 0) &&
+       (pp->typeChecksum == sp->typeChecksum)) {
       //add Subscription to Publisher (only if private)
       if (op->privateCreated) {
-        pthread_rwlock_rdlock(&d->publications.lock);
-        if ((cstWriter=CSTWriter_find(&d->publications,&op->guid))) {
-          pthread_rwlock_wrlock(&cstWriter->lock);
-          if (!CSTRemoteReader_find(cstWriter,&o->guid)) {
-            ObjectEntryOID     *so;
-
-           so=getSubsO2SRemoteReader(d,o,sp);
-            CSTWriterAddRemoteReader(d,cstWriter,o,
-                   o->oid,so);
-            debug(46,2) ("0x%x-0x%x-0x%x accepted 0x%x-0x%x-0x%x\n",
-                          op->guid.hid,op->guid.aid,op->guid.oid,
-                          o->guid.hid,o->guid.aid,o->guid.oid);
-          }
-          pthread_rwlock_unlock(&cstWriter->lock);
-        }
-        pthread_rwlock_unlock(&d->publications.lock);
+       pthread_rwlock_rdlock(&d->publications.lock);
+       if ((cstWriter = CSTWriter_find(&d->publications, &op->guid))) {
+         pthread_rwlock_wrlock(&cstWriter->lock);
+         if (!CSTRemoteReader_find(cstWriter, &o->guid)) {
+           ObjectEntryOID     *so;
+
+           so = getSubsO2SRemoteReader(d, o, sp);
+           CSTWriterAddRemoteReader(d, cstWriter, o,
+                                    o->oid, so);
+           debug(46, 2) ("0x%x-0x%x-0x%x accepted 0x%x-0x%x-0x%x\n",
+                         op->guid.hid, op->guid.aid, op->guid.oid,
+                         o->guid.hid, o->guid.aid, o->guid.oid);
+         }
+         pthread_rwlock_unlock(&cstWriter->lock);
+       }
+       pthread_rwlock_unlock(&d->publications.lock);
       }
       //add Publisher to Subscriber (only if private)
       if (o->privateCreated) {
-        pthread_rwlock_rdlock(&d->subscriptions.lock);
-        if ((cstReader=CSTReader_find(&d->subscriptions,&o->guid))) {
-          pthread_rwlock_wrlock(&cstReader->lock);
-          if (!CSTRemoteWriter_find(cstReader,&op->guid)) {
-            CSTReaderAddRemoteWriter(d,cstReader,op,op->oid);
-            debug(46,2) ("0x%x-0x%x-0x%x accepted 0x%x-0x%x-0x%x\n",
-                          o->guid.hid,o->guid.aid,o->guid.oid,
-                          op->guid.hid,op->guid.aid,op->guid.oid);
-          }
-          pthread_rwlock_unlock(&cstReader->lock);
-        }
-        pthread_rwlock_unlock(&d->subscriptions.lock);
+       pthread_rwlock_rdlock(&d->subscriptions.lock);
+       if ((cstReader = CSTReader_find(&d->subscriptions, &o->guid))) {
+         pthread_rwlock_wrlock(&cstReader->lock);
+         if (!CSTRemoteWriter_find(cstReader, &op->guid)) {
+           CSTReaderAddRemoteWriter(d, cstReader, op, op->oid);
+           debug(46, 2) ("0x%x-0x%x-0x%x accepted 0x%x-0x%x-0x%x\n",
+                         o->guid.hid, o->guid.aid, o->guid.oid,
+                         op->guid.hid, op->guid.aid, op->guid.oid);
+         }
+         pthread_rwlock_unlock(&cstReader->lock);
+       }
+       pthread_rwlock_unlock(&d->subscriptions.lock);
       }
     }
-  } 
+  }
   pthread_rwlock_unlock(&d->psEntry.subscriptionsLock);
-}              
+}
 
 /**********************************************************************************/
-void 
-NewSubscriber(ORTEDomain *d,ObjectEntryOID *os) {
+void
+NewSubscriber(ORTEDomain *d, ObjectEntryOID *os)
+{
   ObjectEntryOID     *o;
   ORTESubsProp       *sp;
   CSTWriter          *cstWriter;
   CSTReader          *cstReader;
-  
-  if ((d==NULL) || (os==NULL)) return;
-  sp=(ORTESubsProp*)os->attributes;
+
+  if ((d == NULL) || (os == NULL))
+    return;
+  sp = (ORTESubsProp *)os->attributes;
   pthread_rwlock_rdlock(&d->psEntry.publicationsLock);
-  gavl_cust_for_each(PublicationList,&d->psEntry,o) {
-    ORTEPublProp *pp=(ORTEPublProp*)o->attributes;
-    if ((strcmp((const char *)sp->topic, (const char*)pp->topic)==0) &&
-        (strcmp((const char *)sp->typeName, (const char*)pp->typeName)==0) &&
-        (sp->typeChecksum==pp->typeChecksum)) {
+  gavl_cust_for_each(PublicationList, &d->psEntry, o) {
+    ORTEPublProp *pp = (ORTEPublProp *)o->attributes;
+
+    if ((strcmp((const char *)sp->topic, (const char *)pp->topic) == 0) &&
+       (strcmp((const char *)sp->typeName, (const char *)pp->typeName) == 0) &&
+       (sp->typeChecksum == pp->typeChecksum)) {
       //add Publication to Subscription (only if private)
       if (os->privateCreated) {
-        pthread_rwlock_rdlock(&d->subscriptions.lock);
-        if ((cstReader=CSTReader_find(&d->subscriptions,&os->guid))) {
-          pthread_rwlock_wrlock(&cstReader->lock);
-          if (!CSTRemoteWriter_find(cstReader,&o->guid)) {
-            CSTReaderAddRemoteWriter(d,cstReader,o,o->oid);
-            debug(46,2) ("0x%x-0x%x-0x%x accepted 0x%x-0x%x-0x%x\n",
-                          os->guid.hid,os->guid.aid,os->guid.oid,
-                          o->guid.hid,o->guid.aid,o->guid.oid);
-          }
-          pthread_rwlock_unlock(&cstReader->lock);
-        }
-        pthread_rwlock_unlock(&d->subscriptions.lock);
+       pthread_rwlock_rdlock(&d->subscriptions.lock);
+       if ((cstReader = CSTReader_find(&d->subscriptions, &os->guid))) {
+         pthread_rwlock_wrlock(&cstReader->lock);
+         if (!CSTRemoteWriter_find(cstReader, &o->guid)) {
+           CSTReaderAddRemoteWriter(d, cstReader, o, o->oid);
+           debug(46, 2) ("0x%x-0x%x-0x%x accepted 0x%x-0x%x-0x%x\n",
+                         os->guid.hid, os->guid.aid, os->guid.oid,
+                         o->guid.hid, o->guid.aid, o->guid.oid);
+         }
+         pthread_rwlock_unlock(&cstReader->lock);
+       }
+       pthread_rwlock_unlock(&d->subscriptions.lock);
       }
       //add Subscriber to Publisher (only if private)
       if (o->privateCreated) {
-        pthread_rwlock_rdlock(&d->publications.lock);
-        if ((cstWriter=CSTWriter_find(&d->publications,&o->guid))) {
-          pthread_rwlock_wrlock(&cstWriter->lock);
-          if (!CSTRemoteReader_find(cstWriter,&os->guid)) {
-            ObjectEntryOID     *sos;
-
-           sos=getSubsO2SRemoteReader(d,os,sp);
-            CSTWriterAddRemoteReader(d,cstWriter,os,
-                   os->oid,sos);
-            debug(46,2) ("0x%x-0x%x-0x%x accepted 0x%x-0x%x-0x%x\n",
-                          GUID_PRINTF(o->guid),
-                          GUID_PRINTF(os->guid));
-          }
-          pthread_rwlock_unlock(&cstWriter->lock);
-        }
-        pthread_rwlock_unlock(&d->publications.lock);
+       pthread_rwlock_rdlock(&d->publications.lock);
+       if ((cstWriter = CSTWriter_find(&d->publications, &o->guid))) {
+         pthread_rwlock_wrlock(&cstWriter->lock);
+         if (!CSTRemoteReader_find(cstWriter, &os->guid)) {
+           ObjectEntryOID     *sos;
+
+           sos = getSubsO2SRemoteReader(d, os, sp);
+           CSTWriterAddRemoteReader(d, cstWriter, os,
+                                    os->oid, sos);
+           debug(46, 2) ("0x%x-0x%x-0x%x accepted 0x%x-0x%x-0x%x\n",
+                         GUID_PRINTF(o->guid),
+                         GUID_PRINTF(os->guid));
+         }
+         pthread_rwlock_unlock(&cstWriter->lock);
+       }
+       pthread_rwlock_unlock(&d->publications.lock);
       }
     }
-  } 
+  }
   pthread_rwlock_unlock(&d->psEntry.publicationsLock);
 }
 
 /**********************************************************************************/
-void 
-RTPSVarApp(ORTEDomain *d,CSChange *csChange,GUID_RTPS *writerGUID) 
+void
+RTPSVarApp(ORTEDomain *d, CSChange *csChange, GUID_RTPS *writerGUID)
 {
-  CSTReader          *cstReader=NULL;
-  CSTRemoteWriter    *cstRemoteWriter=NULL;
+  CSTReader          *cstReader = NULL;
+  CSTRemoteWriter    *cstRemoteWriter = NULL;
   ObjectEntryAID     *objectEntryAID;
-  ObjectEntryOID     *objectEntryOID,*sobjectEntryOID;
+  ObjectEntryOID     *objectEntryOID, *sobjectEntryOID;
 
-  if ((d->guid.aid & 3)!=MANAGEDAPPLICATION) return;
+  if ((d->guid.aid & 3) != MANAGEDAPPLICATION)
+    return;
 
   switch (writerGUID->oid) {
     case OID_WRITE_MGR:
-      pthread_rwlock_wrlock(&d->readerManagers.lock);        
-      cstReader=&d->readerManagers;
-      objectEntryOID=objectEntryFind(d,&csChange->guid);
+      pthread_rwlock_wrlock(&d->readerManagers.lock);
+      cstReader = &d->readerManagers;
+      objectEntryOID = objectEntryFind(d, &csChange->guid);
       if (!objectEntryOID) {
-        AppParams *ap=(AppParams*)MALLOC(sizeof(AppParams));
-        AppParamsInit(ap);
-        parameterUpdateApplication(csChange,ap);
-        if (generateEvent(d,&csChange->guid,(void*)ap,csChange->alive) &&
-            csChange->alive) {
-          debug(46,2) ("new manager 0x%x-0x%x accepted\n",
-                        csChange->guid.hid,csChange->guid.aid);
-          objectEntryOID=objectEntryAdd(d,&csChange->guid,(void*)ap);
-          objectEntryOID->privateCreated=ORTE_FALSE;
-          pthread_rwlock_wrlock(&d->readerApplications.lock);
-          CSTReaderAddRemoteWriter(d,&d->readerApplications,
-                                  objectEntryOID,OID_WRITE_APP);
-          pthread_rwlock_unlock(&d->readerApplications.lock);
-          //all applications from manager node set expiration timer
-          gavl_cust_for_each(ObjectEntryAID,
-                             objectEntryOID->objectEntryHID,objectEntryAID) {
-            ObjectEntryOID *objectEntryOID1;
-            objectEntryOID1=ObjectEntryOID_find(objectEntryAID,&csChange->guid.oid);
-            objectEntryRefreshApp(d,objectEntryOID1);
-          }
-        } else {
-          FREE(ap);
-        }
+       AppParams *ap = (AppParams *)MALLOC(sizeof(AppParams));
+       AppParamsInit(ap);
+       parameterUpdateApplication(csChange, ap);
+       if (generateEvent(d, &csChange->guid, (void *)ap, csChange->alive) &&
+           csChange->alive) {
+         debug(46, 2) ("new manager 0x%x-0x%x accepted\n",
+                       csChange->guid.hid, csChange->guid.aid);
+         objectEntryOID = objectEntryAdd(d, &csChange->guid, (void *)ap);
+         objectEntryOID->privateCreated = ORTE_FALSE;
+         pthread_rwlock_wrlock(&d->readerApplications.lock);
+         CSTReaderAddRemoteWriter(d, &d->readerApplications,
+                                  objectEntryOID, OID_WRITE_APP);
+         pthread_rwlock_unlock(&d->readerApplications.lock);
+         //all applications from manager node set expiration timer
+         gavl_cust_for_each(ObjectEntryAID,
+                            objectEntryOID->objectEntryHID, objectEntryAID) {
+           ObjectEntryOID *objectEntryOID1;
+
+           objectEntryOID1 = ObjectEntryOID_find(objectEntryAID, &csChange->guid.oid);
+           objectEntryRefreshApp(d, objectEntryOID1);
+         }
+       } else {
+         FREE(ap);
+       }
       } else {
-        GUID_RTPS guid_wapp=csChange->guid;
-        guid_wapp.oid=OID_WRITE_APP;
-        pthread_rwlock_wrlock(&d->readerApplications.lock);
-        cstRemoteWriter=CSTRemoteWriter_find(&d->readerApplications,&guid_wapp);
-        //setup state of cstRemoteWriter on send ACK to manager
-        if (cstRemoteWriter) {
-          if (cstRemoteWriter->commStateACK==WAITING) {
-            eventDetach(d,
-                cstRemoteWriter->spobject->objectEntryAID,
-                &cstRemoteWriter->repeatActiveQueryTimer,
-                1);   //metatraffic timer
-            eventAdd(d,
-                cstRemoteWriter->spobject->objectEntryAID,
-                &cstRemoteWriter->repeatActiveQueryTimer,
-                1,   //metatraffic timer
-                "CSTReaderQueryTimer",
-                CSTReaderQueryTimer,
-                &cstRemoteWriter->cstReader->lock,
-                cstRemoteWriter,
-                NULL);               
-          }
-        }
-        pthread_rwlock_unlock(&d->readerApplications.lock);
-      } 
-      if (csChange->alive==ORTE_TRUE)
-        objectEntryRefreshApp(d,objectEntryOID);
-      cstRemoteWriter=CSTRemoteWriter_find(cstReader,writerGUID);
+       GUID_RTPS guid_wapp = csChange->guid;
+       guid_wapp.oid = OID_WRITE_APP;
+       pthread_rwlock_wrlock(&d->readerApplications.lock);
+       cstRemoteWriter = CSTRemoteWriter_find(&d->readerApplications, &guid_wapp);
+       //setup state of cstRemoteWriter on send ACK to manager
+       if (cstRemoteWriter) {
+         if (cstRemoteWriter->commStateACK == WAITING) {
+           eventDetach(d,
+                       cstRemoteWriter->spobject->objectEntryAID,
+                       &cstRemoteWriter->repeatActiveQueryTimer,
+                       1); //metatraffic timer
+           eventAdd(d,
+                    cstRemoteWriter->spobject->objectEntryAID,
+                    &cstRemoteWriter->repeatActiveQueryTimer,
+                    1, //metatraffic timer
+                    "CSTReaderQueryTimer",
+                    CSTReaderQueryTimer,
+                    &cstRemoteWriter->cstReader->lock,
+                    cstRemoteWriter,
+                    NULL);
+         }
+       }
+       pthread_rwlock_unlock(&d->readerApplications.lock);
+      }
+      if (csChange->alive == ORTE_TRUE)
+       objectEntryRefreshApp(d, objectEntryOID);
+      cstRemoteWriter = CSTRemoteWriter_find(cstReader, writerGUID);
       if ((!cstRemoteWriter) &&
-          (csChange->guid.hid==writerGUID->hid) && 
-          (csChange->guid.aid==writerGUID->aid)) {
-        cstRemoteWriter=
-            CSTReaderAddRemoteWriter(d,cstReader,objectEntryOID,writerGUID->oid);
+         (csChange->guid.hid == writerGUID->hid) &&
+         (csChange->guid.aid == writerGUID->aid)) {
+       cstRemoteWriter =
+         CSTReaderAddRemoteWriter(d, cstReader, objectEntryOID, writerGUID->oid);
       }
       break;
     case OID_WRITE_APP:
-      pthread_rwlock_wrlock(&d->readerApplications.lock);        
-      cstReader=&d->readerApplications;
-      cstRemoteWriter=CSTRemoteWriter_find(cstReader,writerGUID);
+      pthread_rwlock_wrlock(&d->readerApplications.lock);
+      cstReader = &d->readerApplications;
+      cstRemoteWriter = CSTRemoteWriter_find(cstReader, writerGUID);
       if (cstRemoteWriter) {
-        AppParams *ap;
-        GUID_RTPS guid_tmp=csChange->guid;
-        guid_tmp.oid=OID_WRITE_PUBL;
-        objectEntryOID=objectEntryFind(d,&csChange->guid);
-        if (!CSTRemoteWriter_find(&d->readerPublications,&guid_tmp)) {
-          if (!objectEntryOID) {
-            ap=(AppParams*)MALLOC(sizeof(AppParams));
-            AppParamsInit(ap);
-            parameterUpdateApplication(csChange,ap);
-            if (generateEvent(d,&csChange->guid,(void*)ap,csChange->alive) &&
-                csChange->alive) {
-              debug(46,2) ("new application 0x%x-0x%x accepted\n",
-                            csChange->guid.hid,csChange->guid.aid);
-              objectEntryOID=objectEntryAdd(d,&csChange->guid,(void*)ap);
-              objectEntryOID->privateCreated=ORTE_FALSE;
-            } else {
-              FREE(ap);
-              break;
-            }
-          }
-
-         ap=(AppParams*)objectEntryOID->attributes;
-         sobjectEntryOID=getAppO2SRemoteReader(d,objectEntryOID,ap);
-
-          pthread_rwlock_wrlock(&d->readerPublications.lock);            
-          pthread_rwlock_wrlock(&d->readerSubscriptions.lock);            
-          pthread_rwlock_wrlock(&d->writerPublications.lock);            
-          pthread_rwlock_wrlock(&d->writerSubscriptions.lock);            
-          CSTReaderAddRemoteWriter(d,&d->readerPublications,
-                                   objectEntryOID,OID_WRITE_PUBL);
-          CSTReaderAddRemoteWriter(d,&d->readerSubscriptions,
-                                   objectEntryOID,OID_WRITE_SUBS);
-          CSTWriterAddRemoteReader(d,&d->writerPublications,
-                                   objectEntryOID,
-                                  OID_READ_PUBL,
-                                   sobjectEntryOID);
-          CSTWriterAddRemoteReader(d,&d->writerSubscriptions,
-                                   objectEntryOID,
-                                  OID_READ_SUBS,
-                                   sobjectEntryOID);
-          pthread_rwlock_unlock(&d->readerPublications.lock);            
-          pthread_rwlock_unlock(&d->readerSubscriptions.lock);            
-          pthread_rwlock_unlock(&d->writerPublications.lock);            
-          pthread_rwlock_unlock(&d->writerSubscriptions.lock);            
-        }
-        if (objectEntryOID) {
-          //turn off expiration timer
-          eventDetach(d,
-              objectEntryOID->objectEntryAID,
-              &objectEntryOID->expirationPurgeTimer,
-              0);
-          debug(46,3) ("for application 0x%x-0x%x turn off expiration timer\n",
-                        objectEntryOID->guid.hid,
-                        objectEntryOID->guid.aid);
-        }
+       AppParams *ap;
+       GUID_RTPS guid_tmp = csChange->guid;
+       guid_tmp.oid = OID_WRITE_PUBL;
+       objectEntryOID = objectEntryFind(d, &csChange->guid);
+       if (!CSTRemoteWriter_find(&d->readerPublications, &guid_tmp)) {
+         if (!objectEntryOID) {
+           ap = (AppParams *)MALLOC(sizeof(AppParams));
+           AppParamsInit(ap);
+           parameterUpdateApplication(csChange, ap);
+           if (generateEvent(d, &csChange->guid, (void *)ap, csChange->alive) &&
+               csChange->alive) {
+             debug(46, 2) ("new application 0x%x-0x%x accepted\n",
+                           csChange->guid.hid, csChange->guid.aid);
+             objectEntryOID = objectEntryAdd(d, &csChange->guid, (void *)ap);
+             objectEntryOID->privateCreated = ORTE_FALSE;
+           } else {
+             FREE(ap);
+             break;
+           }
+         }
+
+         ap = (AppParams *)objectEntryOID->attributes;
+         sobjectEntryOID = getAppO2SRemoteReader(d, objectEntryOID, ap);
+
+         pthread_rwlock_wrlock(&d->readerPublications.lock);
+         pthread_rwlock_wrlock(&d->readerSubscriptions.lock);
+         pthread_rwlock_wrlock(&d->writerPublications.lock);
+         pthread_rwlock_wrlock(&d->writerSubscriptions.lock);
+         CSTReaderAddRemoteWriter(d, &d->readerPublications,
+                                  objectEntryOID, OID_WRITE_PUBL);
+         CSTReaderAddRemoteWriter(d, &d->readerSubscriptions,
+                                  objectEntryOID, OID_WRITE_SUBS);
+         CSTWriterAddRemoteReader(d, &d->writerPublications,
+                                  objectEntryOID,
+                                  OID_READ_PUBL,
+                                  sobjectEntryOID);
+         CSTWriterAddRemoteReader(d, &d->writerSubscriptions,
+                                  objectEntryOID,
+                                  OID_READ_SUBS,
+                                  sobjectEntryOID);
+         pthread_rwlock_unlock(&d->readerPublications.lock);
+         pthread_rwlock_unlock(&d->readerSubscriptions.lock);
+         pthread_rwlock_unlock(&d->writerPublications.lock);
+         pthread_rwlock_unlock(&d->writerSubscriptions.lock);
+       }
+       if (objectEntryOID) {
+         //turn off expiration timer
+         eventDetach(d,
+                     objectEntryOID->objectEntryAID,
+                     &objectEntryOID->expirationPurgeTimer,
+                     0);
+         debug(46, 3) ("for application 0x%x-0x%x turn off expiration timer\n",
+                       objectEntryOID->guid.hid,
+                       objectEntryOID->guid.aid);
+       }
       }
       break;
     case OID_WRITE_PUBL:
-      pthread_rwlock_wrlock(&d->readerPublications.lock);        
-      cstReader=&d->readerPublications;
-      cstRemoteWriter=CSTRemoteWriter_find(cstReader,writerGUID);
+      pthread_rwlock_wrlock(&d->readerPublications.lock);
+      cstReader = &d->readerPublications;
+      cstRemoteWriter = CSTRemoteWriter_find(cstReader, writerGUID);
       if (cstRemoteWriter) {
-        objectEntryOID=objectEntryFind(d,&csChange->guid);
-        if (!objectEntryOID) {
-          ORTEPublProp *pp=(ORTEPublProp*)MALLOC(sizeof(ORTEPublProp));
-          PublParamsInit(pp);
-          parameterUpdatePublication(csChange,pp);
-          if (generateEvent(d,&csChange->guid,(void*)pp,csChange->alive) &&
-              csChange->alive) {
-            debug(46,2) ("new publisher 0x%x-0x%x-0x%x accepted\n",
-                          GUID_PRINTF(csChange->guid));
-            objectEntryOID=objectEntryAdd(d,&csChange->guid,(void*)pp);
-            objectEntryOID->privateCreated=ORTE_FALSE;
-            pthread_rwlock_wrlock(&d->psEntry.publicationsLock);
-            PublicationList_insert(&d->psEntry,objectEntryOID);
-            pthread_rwlock_unlock(&d->psEntry.publicationsLock);
-            NewPublisher(d,objectEntryOID);
-          } else
-            FREE(pp);
-        } else {
-          if ((!PublicationList_find(&d->psEntry,&csChange->guid)) &&
-              csChange->alive) {
-            pthread_rwlock_wrlock(&d->psEntry.publicationsLock);
-            PublicationList_insert(&d->psEntry,objectEntryOID);
-            pthread_rwlock_unlock(&d->psEntry.publicationsLock);
-            NewPublisher(d,objectEntryOID);
-          }
-        }
+       objectEntryOID = objectEntryFind(d, &csChange->guid);
+       if (!objectEntryOID) {
+         ORTEPublProp *pp = (ORTEPublProp *)MALLOC(sizeof(ORTEPublProp));
+         PublParamsInit(pp);
+         parameterUpdatePublication(csChange, pp);
+         if (generateEvent(d, &csChange->guid, (void *)pp, csChange->alive) &&
+             csChange->alive) {
+           debug(46, 2) ("new publisher 0x%x-0x%x-0x%x accepted\n",
+                         GUID_PRINTF(csChange->guid));
+           objectEntryOID = objectEntryAdd(d, &csChange->guid, (void *)pp);
+           objectEntryOID->privateCreated = ORTE_FALSE;
+           pthread_rwlock_wrlock(&d->psEntry.publicationsLock);
+           PublicationList_insert(&d->psEntry, objectEntryOID);
+           pthread_rwlock_unlock(&d->psEntry.publicationsLock);
+           NewPublisher(d, objectEntryOID);
+         } else
+           FREE(pp);
+       } else {
+         if ((!PublicationList_find(&d->psEntry, &csChange->guid)) &&
+             csChange->alive) {
+           pthread_rwlock_wrlock(&d->psEntry.publicationsLock);
+           PublicationList_insert(&d->psEntry, objectEntryOID);
+           pthread_rwlock_unlock(&d->psEntry.publicationsLock);
+           NewPublisher(d, objectEntryOID);
+         }
+       }
       }
       break;
     case OID_WRITE_SUBS:
-      pthread_rwlock_wrlock(&d->readerSubscriptions.lock);        
-      cstReader=&d->readerSubscriptions;
-      cstRemoteWriter=CSTRemoteWriter_find(cstReader,writerGUID);
+      pthread_rwlock_wrlock(&d->readerSubscriptions.lock);
+      cstReader = &d->readerSubscriptions;
+      cstRemoteWriter = CSTRemoteWriter_find(cstReader, writerGUID);
       if (cstRemoteWriter) {
-        objectEntryOID=objectEntryFind(d,&csChange->guid);
-        if (!objectEntryOID) {
-          ORTESubsProp *sp=(ORTESubsProp*)MALLOC(sizeof(ORTESubsProp));
-          SubsParamsInit(sp);
-          parameterUpdateSubscription(csChange,sp);
-          if (generateEvent(d,&csChange->guid,(void*)sp,csChange->alive) &&
-              csChange->alive) {
-            debug(46,2) ("new subscriber 0x%x-0x%x-0x%x accepted\n",
-                          GUID_PRINTF(csChange->guid));
-            objectEntryOID=objectEntryAdd(d,&csChange->guid,(void*)sp);
-            objectEntryOID->privateCreated=ORTE_FALSE;
-            pthread_rwlock_wrlock(&d->psEntry.subscriptionsLock);
-            SubscriptionList_insert(&d->psEntry,objectEntryOID);
-            pthread_rwlock_unlock(&d->psEntry.subscriptionsLock);
-            NewSubscriber(d,objectEntryOID);
-          } else
-            FREE(sp);
-        } else {
-          if ((!SubscriptionList_find(&d->psEntry,&csChange->guid)) && 
-              csChange->alive) {
-            pthread_rwlock_wrlock(&d->psEntry.subscriptionsLock);
-            SubscriptionList_insert(&d->psEntry,objectEntryOID);
-            pthread_rwlock_unlock(&d->psEntry.subscriptionsLock);
-            NewSubscriber(d,objectEntryOID);
-          }
-        }
+       objectEntryOID = objectEntryFind(d, &csChange->guid);
+       if (!objectEntryOID) {
+         ORTESubsProp *sp = (ORTESubsProp *)MALLOC(sizeof(ORTESubsProp));
+         SubsParamsInit(sp);
+         parameterUpdateSubscription(csChange, sp);
+         if (generateEvent(d, &csChange->guid, (void *)sp, csChange->alive) &&
+             csChange->alive) {
+           debug(46, 2) ("new subscriber 0x%x-0x%x-0x%x accepted\n",
+                         GUID_PRINTF(csChange->guid));
+           objectEntryOID = objectEntryAdd(d, &csChange->guid, (void *)sp);
+           objectEntryOID->privateCreated = ORTE_FALSE;
+           pthread_rwlock_wrlock(&d->psEntry.subscriptionsLock);
+           SubscriptionList_insert(&d->psEntry, objectEntryOID);
+           pthread_rwlock_unlock(&d->psEntry.subscriptionsLock);
+           NewSubscriber(d, objectEntryOID);
+         } else
+           FREE(sp);
+       } else {
+         if ((!SubscriptionList_find(&d->psEntry, &csChange->guid)) &&
+             csChange->alive) {
+           pthread_rwlock_wrlock(&d->psEntry.subscriptionsLock);
+           SubscriptionList_insert(&d->psEntry, objectEntryOID);
+           pthread_rwlock_unlock(&d->psEntry.subscriptionsLock);
+           NewSubscriber(d, objectEntryOID);
+         }
+       }
       }
       break;
   }
 
   /* try to proc csChange */
-  RTPSVarFinish(cstReader,cstRemoteWriter,csChange);
+  RTPSVarFinish(cstReader, cstRemoteWriter, csChange);
 }
 
 
 /**********************************************************************************/
-void 
-RTPSVar(ORTEDomain *d,CDR_Codec *cdrCodec,MessageInterpret *mi,IPAddress senderIPAddress) {
-  GUID_RTPS          objectGUID,writerGUID;
-  ObjectId           roid,woid;
-  SequenceNumber     sn;   
-  char               p_bit,a_bit,h_bit;
+void
+RTPSVar(ORTEDomain *d, CDR_Codec *cdrCodec, MessageInterpret *mi, IPAddress senderIPAddress)
+{
+  GUID_RTPS          objectGUID, writerGUID;
+  ObjectId           roid, woid;
+  SequenceNumber     sn;
+  char               p_bit, a_bit, h_bit;
   CORBA_unsigned_short submsg_len;
   CSChange           *csChange;
   CDR_Endianness     data_endian;
-  CORBA_octet       flags;
+  CORBA_octet        flags;
 
   /* restore flag possition in submessage */
-  cdrCodec->rptr-=3;
+  cdrCodec->rptr -= 3;
 
   /* flags */
   CDR_get_octet(cdrCodec, (CORBA_octet *)&flags);
-  p_bit=flags & 2;
-  a_bit=flags & 4;
-  h_bit=flags & 8;
+  p_bit = flags & 2;
+  a_bit = flags & 4;
+  h_bit = flags & 8;
 
   /* submessage length */
-  CDR_get_ushort(cdrCodec,&submsg_len);
+  CDR_get_ushort(cdrCodec, &submsg_len);
 
   /* next data are sent in big endianing */
-  data_endian=cdrCodec->data_endian;
-  cdrCodec->data_endian=FLAG_BIG_ENDIAN;
+  data_endian = cdrCodec->data_endian;
+  cdrCodec->data_endian = FLAG_BIG_ENDIAN;
 
   /* readerObjectId */
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&roid);
-  
+
   /* writerObjectId */
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&woid);
 
   if (h_bit) {
-     /* HostId         */
-     CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&objectGUID.hid);
+    /* HostId         */
+    CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&objectGUID.hid);
 
-     /* AppId          */
-     CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&objectGUID.aid);
+    /* AppId          */
+    CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&objectGUID.aid);
 
   } else {
-    objectGUID.hid=mi->sourceHostId;
-    objectGUID.aid=mi->sourceAppId;
+    objectGUID.hid = mi->sourceHostId;
+    objectGUID.aid = mi->sourceAppId;
   }
 
-   /* ObjectId       */
+  /* ObjectId       */
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&objectGUID.oid);
 
-  cdrCodec->data_endian=data_endian;
+  cdrCodec->data_endian = data_endian;
 
   /* writerSN       */
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&sn.high);
   CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&sn.low);
 
-  writerGUID.hid=mi->sourceHostId;
-  writerGUID.aid=mi->sourceAppId;
-  writerGUID.oid=woid;
+  writerGUID.hid = mi->sourceHostId;
+  writerGUID.aid = mi->sourceAppId;
+  writerGUID.oid = woid;
+
+  debug(46, 3) ("recv: RTPS_VAR(0x%x) from 0x%x-0x%x sn:%u\n",
+               woid, mi->sourceHostId, mi->sourceAppId, sn.low);
 
-  debug(46,3) ("recv: RTPS_VAR(0x%x) from 0x%x-0x%x sn:%u\n",
-                woid,mi->sourceHostId,mi->sourceAppId,sn.low);
-  
   //prepare csChange
-  csChange=(CSChange*)MALLOC(sizeof(CSChange));
-  csChange->cdrCodec.buffer=NULL;
-  csChange->guid=objectGUID;
-  if (a_bit) csChange->alive=ORTE_TRUE;
-  else csChange->alive=ORTE_FALSE;
+  csChange = (CSChange *)MALLOC(sizeof(CSChange));
+  csChange->cdrCodec.buffer = NULL;
+  csChange->guid = objectGUID;
+  if (a_bit)
+    csChange->alive = ORTE_TRUE;
+  else
+    csChange->alive = ORTE_FALSE;
   if (p_bit)
-    parameterDecodeCodecToCSChange(csChange,cdrCodec);
+    parameterDecodeCodecToCSChange(csChange, cdrCodec);
   else
     CSChangeAttributes_init_head(csChange);
-  csChange->sn=sn;
+  csChange->sn = sn;
   SEQUENCE_NUMBER_NONE(csChange->gapSN);
 
   /* Manager */
-  RTPSVarManager(d,csChange,&writerGUID,senderIPAddress);
+  RTPSVarManager(d, csChange, &writerGUID, senderIPAddress);
 
   /* Application */
-  RTPSVarApp(d,csChange,&writerGUID);
-} 
-
+  RTPSVarApp(d, csChange, &writerGUID);
+}
index 3fc253f2341b6be899efa6b596c50bdac80c1563..21101c955210855756c99e4e15e22012bc86c757 100644 (file)
@@ -3,18 +3,18 @@
  *
  *  DEBUG:  section 5                   CDR codeing
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
 
 #define CDR_GROW_AMOUNT 128
 
-CORBA_boolean 
+CORBA_boolean
 CDR_buffer_init(CDR_Codec *codec, const unsigned int size)
 {
 
-       if(codec->release_buffer) {
-               FREE(codec->buffer);
-       }
+  if (codec->release_buffer) {
+    FREE(codec->buffer);
+  }
 
-       codec->buffer=(CORBA_octet *)MALLOC(size);
-       codec->buf_len=size;
-        codec->wptr_max=size;
-       codec->rptr=codec->wptr=0;
-        codec->release_buffer=CORBA_TRUE;
+  codec->buffer = (CORBA_octet *)MALLOC(size);
+  codec->buf_len = size;
+  codec->wptr_max = size;
+  codec->rptr = codec->wptr = 0;
+  codec->release_buffer = CORBA_TRUE;
 
-       return CORBA_TRUE;
+  return CORBA_TRUE;
 }
 
 /*
-CORBA_boolean 
+CORBA_boolean
 CDR_buffer_grow(CDR_Codec *codec, const unsigned int growth)
 {
-       unsigned int real_growth,quot;
+        unsigned int real_growth,quot;
 
-       if(codec->release_buffer) {
+        if(codec->release_buffer) {
                 quot = growth / CDR_GROW_AMOUNT;
-               real_growth=CDR_GROW_AMOUNT * (quot+1);
-               
-               codec->buffer=(CORBA_octet *)REALLOC(codec->buffer,
-                                                    codec->buf_len
-                                                    +real_growth);
-       }
+                real_growth=CDR_GROW_AMOUNT * (quot+1);
 
-       return CORBA_TRUE;
+                codec->buffer=(CORBA_octet *)REALLOC(codec->buffer,
+                                                     codec->buf_len
+                                                     +real_growth);
+        }
+
+        return CORBA_TRUE;
 }
 */
-CORBA_boolean 
+CORBA_boolean
 CDR_buffer_puts(CDR_Codec *codec, const void *data, const unsigned int len)
 {
-       if(codec->wptr+len > codec->wptr_max) {
-               return CORBA_FALSE; 
-       }
+  if (codec->wptr+len > codec->wptr_max) {
+    return CORBA_FALSE;
+  }
 
-       memcpy(&codec->buffer[codec->wptr], data, len);
-       codec->wptr+=len;
+  memcpy(&codec->buffer[codec->wptr], data, len);
+  codec->wptr += len;
 
-       return CORBA_TRUE;
+  return CORBA_TRUE;
 }
 
-CORBA_boolean 
+CORBA_boolean
 CDR_buffer_gets(CDR_Codec *codec, void *dest, const unsigned int len)
 {
-       if(codec->rptr+len > codec->buf_len) {
-               return CORBA_FALSE; 
-       }
+  if (codec->rptr+len > codec->buf_len) {
+    return CORBA_FALSE;
+  }
 
-       memcpy(dest, &codec->buffer[codec->rptr], len);
-       codec->rptr+=len;
+  memcpy(dest, &codec->buffer[codec->rptr], len);
+  codec->rptr += len;
 
-       return CORBA_TRUE;
+  return CORBA_TRUE;
 }
 
-CORBA_boolean 
+CORBA_boolean
 CDR_buffer_put(CDR_Codec *codec, void *datum)
 {
-       if(codec->wptr+1 > codec->wptr_max) {
-               return(CORBA_FALSE);
-       }
+  if (codec->wptr+1 > codec->wptr_max) {
+    return(CORBA_FALSE);
+  }
 
-       codec->buffer[codec->wptr++]=*(unsigned char *)datum;
-       return CORBA_TRUE;
+  codec->buffer[codec->wptr++] = *(unsigned char *)datum;
+  return CORBA_TRUE;
 }
 
-CORBA_boolean 
+CORBA_boolean
 CDR_buffer_get(CDR_Codec *codec, void *dest)
 {
-       if(codec->rptr+1 > codec->buf_len) {
-               return(CORBA_FALSE);
-       }
+  if (codec->rptr+1 > codec->buf_len) {
+    return(CORBA_FALSE);
+  }
 
-       *(CORBA_octet *)dest=codec->buffer[codec->rptr++];
-       return CORBA_TRUE;
+  *(CORBA_octet *)dest = codec->buffer[codec->rptr++];
+  return CORBA_TRUE;
 }
 
 #define CDR_buffer_put2(codec, datum) CDR_buffer_putn(codec, datum, 2)
@@ -135,306 +135,307 @@ CDR_buffer_get(CDR_Codec *codec, void *dest)
 static CORBA_boolean
 CDR_buffer_getn(CDR_Codec *codec, void *dest, int bsize)
 {
-       codec->rptr = (unsigned long)ALIGN_ADDRESS(codec->rptr, bsize);
-       if(codec->host_endian==codec->data_endian)
-               memcpy(dest, codec->buffer + codec->rptr, bsize);
-       else
-               rtps_byteswap(dest, codec->buffer + codec->rptr, bsize);
-       codec->rptr += bsize;
+  codec->rptr = (unsigned long)ALIGN_ADDRESS(codec->rptr, bsize);
+  if (codec->host_endian == codec->data_endian)
+    memcpy(dest, codec->buffer + codec->rptr, bsize);
+  else
+    rtps_byteswap(dest, codec->buffer + codec->rptr, bsize);
+  codec->rptr += bsize;
 
-       return CORBA_TRUE;
+  return CORBA_TRUE;
 }
 
 static CORBA_boolean
 CDR_buffer_putn(CDR_Codec *codec, void *datum, int bsize)
 {
-        unsigned long forward,i;
-       
-       forward = (unsigned long)ALIGN_ADDRESS(codec->wptr, bsize);
-       if (forward+bsize > codec->wptr_max) {
-               return CORBA_FALSE;
-       }       
+  unsigned long forward, i;
+
+  forward = (unsigned long)ALIGN_ADDRESS(codec->wptr, bsize);
+  if (forward+bsize > codec->wptr_max) {
+    return CORBA_FALSE;
+  }
 
-       i = codec->wptr;
-        while(forward > i)
-               codec->buffer[i++] = '\0';
+  i = codec->wptr;
+  while (forward > i)
+    codec->buffer[i++] = '\0';
 
-       codec->wptr = forward;
-       if(codec->host_endian==codec->data_endian)
-               memcpy(codec->buffer + codec->wptr, datum, bsize);
-       else
-               rtps_byteswap(codec->buffer + codec->wptr, datum, bsize);
-       codec->wptr += bsize;
+  codec->wptr = forward;
+  if (codec->host_endian == codec->data_endian)
+    memcpy(codec->buffer + codec->wptr, datum, bsize);
+  else
+    rtps_byteswap(codec->buffer + codec->wptr, datum, bsize);
+  codec->wptr += bsize;
 
-       return CORBA_TRUE;
+  return CORBA_TRUE;
 }
 
-#define CDR_swap2(d,s) rtps_byteswap((d), (s), 2)
-#define CDR_swap4(d,s) rtps_byteswap((d), (s), 4)
-#define CDR_swap8(d,s) rtps_byteswap((d), (s), 8)
-#define CDR_swap16(d,s) rtps_byteswap((d), (s), 16)
+#define CDR_swap2(d, s) rtps_byteswap((d), (s), 2)
+#define CDR_swap4(d, s) rtps_byteswap((d), (s), 4)
+#define CDR_swap8(d, s) rtps_byteswap((d), (s), 8)
+#define CDR_swap16(d, s) rtps_byteswap((d), (s), 16)
 
-inline CORBA_boolean 
+inline CORBA_boolean
 CDR_put_short(CDR_Codec *codec, CORBA_short s)
 {
-       return CDR_buffer_put2(codec, &s);
+  return CDR_buffer_put2(codec, &s);
 }
 
-inline CORBA_boolean 
+inline CORBA_boolean
 CDR_get_short(CDR_Codec *codec, CORBA_short *s)
 {
-       return CDR_buffer_get2(codec, s);
+  return CDR_buffer_get2(codec, s);
 }
 
-inline CORBA_boolean 
+inline CORBA_boolean
 CDR_put_ushort(CDR_Codec *codec, CORBA_unsigned_short us)
 {
-       return CDR_buffer_put2(codec, &us);
+  return CDR_buffer_put2(codec, &us);
 }
 
-inline CORBA_boolean 
+inline CORBA_boolean
 CDR_get_ushort(CDR_Codec *codec, CORBA_unsigned_short *us)
 {
-       return CDR_buffer_get2(codec, us);
+  return CDR_buffer_get2(codec, us);
 }
 
-inline CORBA_boolean 
+inline CORBA_boolean
 CDR_put_long(CDR_Codec *codec, CORBA_long l)
 {
-       return CDR_buffer_put4(codec, &l);
+  return CDR_buffer_put4(codec, &l);
 }
 
-inline CORBA_boolean 
+inline CORBA_boolean
 CDR_get_long(CDR_Codec *codec, CORBA_long *l)
 {
-       return CDR_buffer_get4(codec, l);
+  return CDR_buffer_get4(codec, l);
 }
 
-inline CORBA_boolean 
+inline CORBA_boolean
 CDR_put_ulong(CDR_Codec *codec, CORBA_unsigned_long ul)
 {
-       return CDR_buffer_put4(codec, &ul);
+  return CDR_buffer_put4(codec, &ul);
 }
 
-inline CORBA_boolean 
+inline CORBA_boolean
 CDR_get_ulong(CDR_Codec *codec, CORBA_unsigned_long *ul)
 {
-       return CDR_buffer_get4(codec, ul);
+  return CDR_buffer_get4(codec, ul);
 }
 
 #ifdef HAVE_CORBA_LONG_LONG
-inline CORBA_boolean 
+inline CORBA_boolean
 CDR_get_long_long(CDR_Codec *codec, CORBA_long_long *ul)
 {
-       return CDR_buffer_get8(codec, ul);
+  return CDR_buffer_get8(codec, ul);
 }
 
-inline CORBA_boolean 
+inline CORBA_boolean
 CDR_put_long_long(CDR_Codec *codec, CORBA_long_long ll)
 {
-       return CDR_buffer_put8(codec, &ll);
+  return CDR_buffer_put8(codec, &ll);
 }
 
-inline CORBA_boolean 
+inline CORBA_boolean
 CDR_put_ulong_long(CDR_Codec *codec, CORBA_unsigned_long_long ll)
 {
-       return CDR_buffer_put8(codec, &ll);
+  return CDR_buffer_put8(codec, &ll);
 }
 
-inline CORBA_boolean 
+inline CORBA_boolean
 CDR_get_ulong_long(CDR_Codec *codec, CORBA_unsigned_long_long *ull)
 {
-       return CDR_buffer_get8(codec, ull);
+  return CDR_buffer_get8(codec, ull);
 }
 #endif
 
-inline CORBA_boolean 
+inline CORBA_boolean
 CDR_put_float(CDR_Codec *codec, CORBA_float f)
 {
-       return CDR_buffer_put4(codec, &f);
+  return CDR_buffer_put4(codec, &f);
 }
 
-inline CORBA_boolean 
+inline CORBA_boolean
 CDR_get_float(CDR_Codec *codec, CORBA_float *f)
 {
-       return CDR_buffer_get4(codec, f);
+  return CDR_buffer_get4(codec, f);
 }
 
-inline CORBA_boolean 
+inline CORBA_boolean
 CDR_put_double(CDR_Codec *codec, CORBA_double d)
 {
-       return CDR_buffer_put8(codec, &d);
+  return CDR_buffer_put8(codec, &d);
 }
 
-inline CORBA_boolean 
+inline CORBA_boolean
 CDR_get_double(CDR_Codec *codec, CORBA_double *d)
 {
-       return CDR_buffer_get8(codec, d);
+  return CDR_buffer_get8(codec, d);
 }
 
-inline CORBA_boolean 
+inline CORBA_boolean
 CDR_put_long_double(CDR_Codec *codec, CORBA_long_double ld)
 {
-       return CDR_buffer_put16(codec, &ld);
+  return CDR_buffer_put16(codec, &ld);
 }
 
-inline CORBA_boolean 
+inline CORBA_boolean
 CDR_put_octet(CDR_Codec *codec, CORBA_octet datum)
 {
-       return CDR_buffer_put(codec, &datum);
+  return CDR_buffer_put(codec, &datum);
 }
 
-inline CORBA_boolean 
+inline CORBA_boolean
 CDR_get_octet(CDR_Codec *codec, CORBA_octet *datum)
 {
-       return(CDR_buffer_get(codec, datum));
+  return(CDR_buffer_get(codec, datum));
 }
 
-inline CORBA_boolean 
+inline CORBA_boolean
 CDR_put_octets(CDR_Codec *codec, void *data, unsigned long len)
 {
-       return CDR_buffer_puts(codec, data, len);
+  return CDR_buffer_puts(codec, data, len);
 }
 
-inline CORBA_boolean 
+inline CORBA_boolean
 CDR_put_char(CDR_Codec *codec, CORBA_char c)
 {
-       return CDR_buffer_put(codec, &c);
+  return CDR_buffer_put(codec, &c);
 }
 
-inline CORBA_boolean 
+inline CORBA_boolean
 CDR_get_char(CDR_Codec *codec, CORBA_char *c)
 {
-       return CDR_buffer_get(codec, c);
+  return CDR_buffer_get(codec, c);
 }
 
-inline CORBA_boolean 
+inline CORBA_boolean
 CDR_put_boolean(CDR_Codec *codec, CORBA_boolean datum)
 {
-       datum = datum&&1;
-       return CDR_buffer_put(codec, &datum);
+  datum = datum && 1;
+  return CDR_buffer_put(codec, &datum);
 }
 
-inline CORBA_boolean 
+inline CORBA_boolean
 CDR_get_boolean(CDR_Codec *codec, CORBA_boolean *b)
 {
-       return CDR_buffer_get(codec, b);
+  return CDR_buffer_get(codec, b);
 }
 
-CORBA_boolean 
+CORBA_boolean
 CDR_put_string(CDR_Codec *codec, const char *str)
 {
-       unsigned int len;
+  unsigned int len;
 
-       len=strlen(str)+1;
+  len = strlen(str)+1;
 
-       if (CDR_put_ulong(codec, len)==CORBA_FALSE) return -1;
-       return CDR_buffer_puts(codec, str, len);
+  if (CDR_put_ulong(codec, len) == CORBA_FALSE)
+    return -1;
+  return CDR_buffer_puts(codec, str, len);
 }
 
-CORBA_boolean 
-CDR_get_string_static(CDR_Codec *codec,CORBA_char **str)
+CORBA_boolean
+CDR_get_string_static(CDR_Codec *codec, CORBA_char **str)
 {
-       CORBA_unsigned_long len;
+  CORBA_unsigned_long len;
 
-       if(CDR_get_ulong(codec, (CORBA_unsigned_long *)&len)==CORBA_FALSE)
-               return CORBA_FALSE;
+  if (CDR_get_ulong(codec, (CORBA_unsigned_long *)&len) == CORBA_FALSE)
+    return CORBA_FALSE;
 
-       if((codec->rptr + len) > codec->buf_len)
-               return CORBA_FALSE;
+  if ((codec->rptr + len) > codec->buf_len)
+    return CORBA_FALSE;
 
-       *str = ((CORBA_char *)codec->buffer) + codec->rptr;
+  *str = ((CORBA_char *)codec->buffer) + codec->rptr;
 
-       codec->rptr += len;
+  codec->rptr += len;
 
-       return CORBA_TRUE;
+  return CORBA_TRUE;
 }
 
-CORBA_boolean 
+CORBA_boolean
 CDR_get_string(CDR_Codec *codec, CORBA_char **str)
 {
-       CORBA_unsigned_long len;
+  CORBA_unsigned_long len;
 
-       if(CDR_get_ulong(codec, (CORBA_unsigned_long *)&len)==CORBA_FALSE)
-               return(CORBA_FALSE);
+  if (CDR_get_ulong(codec, (CORBA_unsigned_long *)&len) == CORBA_FALSE)
+    return(CORBA_FALSE);
 
-       if(len==0)
-               return(CORBA_FALSE);
+  if (len == 0)
+    return(CORBA_FALSE);
 
-       *str=MALLOC(len);
+  *str = MALLOC(len);
 
-       if(CDR_buffer_gets(codec, *str, len)==CORBA_FALSE) {
-               FREE(*str);
-               return(CORBA_FALSE);
-       }
+  if (CDR_buffer_gets(codec, *str, len) == CORBA_FALSE) {
+    FREE(*str);
+    return(CORBA_FALSE);
+  }
 
-       if((*str)[len-1]!='\0') {
-               (*str)[len-1]='\0';
-       }
+  if ((*str)[len-1] != '\0') {
+    (*str)[len-1] = '\0';
+  }
 
-       return(CORBA_TRUE);
+  return(CORBA_TRUE);
 }
 
-CORBA_boolean 
+CORBA_boolean
 CDR_get_string_buff(CDR_Codec *codec, CORBA_char *str)
 {
-       CORBA_unsigned_long len;
+  CORBA_unsigned_long len;
 
-       if(CDR_get_ulong(codec, (CORBA_unsigned_long *)&len)==CORBA_FALSE)
-               return(CORBA_FALSE);
+  if (CDR_get_ulong(codec, (CORBA_unsigned_long *)&len) == CORBA_FALSE)
+    return(CORBA_FALSE);
 
-       if(len==0)
-               return(CORBA_FALSE);
+  if (len == 0)
+    return(CORBA_FALSE);
 
-       if(CDR_buffer_gets(codec, str, len)==CORBA_FALSE) {
-               return(CORBA_FALSE);
-       }
+  if (CDR_buffer_gets(codec, str, len) == CORBA_FALSE) {
+    return(CORBA_FALSE);
+  }
 
-       if(str[len-1]!='\0') {
-               str[len-1]='\0';
-       }
+  if (str[len-1] != '\0') {
+    str[len-1] = '\0';
+  }
 
-       return(CORBA_TRUE);
+  return(CORBA_TRUE);
 }
 
-CORBA_boolean 
+CORBA_boolean
 CDR_get_seq_begin(CDR_Codec *codec, CORBA_unsigned_long *ul)
 {
-       return(CDR_get_ulong(codec, (CORBA_unsigned_long *)ul));
+  return(CDR_get_ulong(codec, (CORBA_unsigned_long *)ul));
 }
 
 CDR_Codec *
 CDR_codec_init_static(CDR_Codec *codec)
 {
-       memset(codec, 0, sizeof(CDR_Codec));
+  memset(codec, 0, sizeof(CDR_Codec));
 
-       codec->host_endian = FLAG_ENDIANNESS;
+  codec->host_endian = FLAG_ENDIANNESS;
 
-       return codec;
+  return codec;
 }
 
 CDR_Codec *
 CDR_codec_init(void)
 {
-       CDR_Codec *c;
+  CDR_Codec *c;
 
-       c=MALLOC(sizeof(CDR_Codec));
-       CDR_codec_init_static(c);
+  c = MALLOC(sizeof(CDR_Codec));
+  CDR_codec_init_static(c);
 
-       return(c);
+  return(c);
 }
 
-void 
+void
 CDR_codec_release_buffer(CDR_Codec *codec)
 {
-       if(codec->release_buffer)
-               FREE(codec->buffer);
+  if (codec->release_buffer)
+    FREE(codec->buffer);
 }
 
 
-void 
+void
 CDR_codec_free(CDR_Codec *codec)
 {
-       CDR_codec_release_buffer(codec);
-       FREE(codec);
+  CDR_codec_release_buffer(codec);
+  FREE(codec);
 }
index 05b5d408bef953d73664e73d54c454ba77ae9c51..7c096243d0e997fbdea7acd26d8d2fdfeacf80c8 100644 (file)
@@ -3,18 +3,18 @@
  *
  *  DEBUG:  section 7                 ordering conversion
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
 /**********************************************************************************/
 //get part of string, div. by semi.
 int
-getStringPart(char *string,char divChar,int *iterator,char *buff) {
+getStringPart(char *string, char divChar, int *iterator, char *buff)
+{
   char *cp;
   int len;
-  
-  if (!string || !buff) return -1;
-  len=strlen(string);
-  if (len<(*iterator)) return -2;
-  cp=string+(*iterator);
-  if (cp[0]!=0) {  //till is length>0
-    char *dcp,tcp; 
-    dcp=strchr(cp,divChar);
-    if (!dcp) dcp=cp+strlen(cp);
-    tcp=*dcp;         //save ending value
-    *dcp=0;           //temporary end of string
-    strcpy((char *)buff,cp);  
-    *dcp=tcp;         //restore value
-    if (dcp[0]!=0) (*iterator)+=dcp-cp+1;//next value
-    else (*iterator)=len;
+
+  if (!string || !buff)
+    return -1;
+  len = strlen(string);
+  if (len < (*iterator))
+    return -2;
+  cp = string+(*iterator);
+  if (cp[0] != 0) {  //till is length>0
+    char *dcp, tcp;
+    dcp = strchr(cp, divChar);
+    if (!dcp)
+      dcp = cp+strlen(cp);
+    tcp = *dcp;         //save ending value
+    *dcp = 0;           //temporary end of string
+    strcpy((char *)buff, cp);
+    *dcp = tcp;         //restore value
+    if (dcp[0] != 0)
+      (*iterator) += dcp-cp+1;           //next value
+    else
+      (*iterator) = len;
     return 1;
   }
   return 0;
 }
 
 /**********************************************************************************/
-char* 
-IPAddressToString(IPAddress ipAddress,char *buff) {
+char *
+IPAddressToString(IPAddress ipAddress, char *buff)
+{
   struct in_addr addr;
-  
-  addr.s_addr=htonl(ipAddress);
-  sprintf(buff,"%s",inet_ntoa(addr));
+
+  addr.s_addr = htonl(ipAddress);
+  sprintf(buff, "%s", inet_ntoa(addr));
   return buff;
 }
 
 /**********************************************************************************/
-IPAddress 
-StringToIPAddress(const char *string) {
-  IPAddress ipAddress=IPADDRESS_INVALID;
-#ifdef CONFIG_ORTE_MINGW   
+IPAddress
+StringToIPAddress(const char *string)
+{
+  IPAddress ipAddress = IPADDRESS_INVALID;
+
+#ifdef CONFIG_ORTE_MINGW
   unsigned long inetAddress = inet_addr(string);
 #else
   in_addr_t inetAddress = inet_addr(string);
 #endif
-  
-  if(inetAddress!=INADDR_NONE) {
-    ipAddress=ntohl(inetAddress);
+
+  if (inetAddress != INADDR_NONE) {
+    ipAddress = ntohl(inetAddress);
   }
 #if defined HAVE_GETHOSTBYNAME
   {
-    struct hostent *hostname; 
-    if (ipAddress==IPADDRESS_INVALID) {
-      if ((hostname=gethostbyname(string))) {
-        ipAddress=ntohl(*((long*)(hostname->h_addr_list[0])));
+    struct hostent *hostname;
+    if (ipAddress == IPADDRESS_INVALID) {
+      if ((hostname = gethostbyname(string))) {
+       ipAddress = ntohl(*((long *)(hostname->h_addr_list[0])));
       }
     }
   }
@@ -100,20 +109,22 @@ StringToIPAddress(const char *string) {
 
 /**********************************************************************************/
 char *
-NtpTimeToStringMs(NtpTime time,char *buff) {
-  int s,msec;
-  
+NtpTimeToStringMs(NtpTime time, char *buff)
+{
+  int s, msec;
+
   NtpTimeDisAssembToMs(s, msec, time);
-  sprintf(buff,"%d.%03d",s,msec);
+  sprintf(buff, "%d.%03d", s, msec);
   return buff;
 }
 
 /**********************************************************************************/
 char *
-NtpTimeToStringUs(NtpTime time,char *buff) {
-  int s,usec;
-  
+NtpTimeToStringUs(NtpTime time, char *buff)
+{
+  int s, usec;
+
   NtpTimeDisAssembToUs(s, usec, time);
-  sprintf(buff,"%d.%06d",s,usec);
+  sprintf(buff, "%d.%06d", s, usec);
   return buff;
 }
index 50007757e58d8165e39f49043bc81d8306b3d4ac..15cc43668596115886eb524d733fc6b45d6f5c06 100644 (file)
@@ -3,18 +3,18 @@
  *
  *  DEBUG:  section 1                   Debug
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
@@ -34,8 +34,8 @@
 /* global debug variables */
 int db_level;
 int debugLevels[MAX_DEBUG_SECTIONS];
-int mem_check_counter=0;
-NtpTime zNtpTime,iNtpTime;
+int mem_check_counter = 0;
+NtpTime zNtpTime, iNtpTime;
 SequenceNumber noneSN;
 
 /*********************************************************************/
@@ -47,7 +47,7 @@ db_print_output(const char *format);
 /* globals */
 
 #ifndef CONFIG_ORTE_RT
-FILE *debug_log=NULL;       /* NULL */
+FILE *debug_log = NULL;       /* NULL */
 #endif
 
 /*********************************************************************/
@@ -55,42 +55,47 @@ FILE *debug_log=NULL;       /* NULL */
 
 #ifdef CONFIG_ORTE_RT
 static const char *
-debug_log_time(void) {
+debug_log_time(void)
+{
   struct timespec        time;
   static char            buf[64];
 
   clock_gettime(CLOCK_REALTIME, &time);
-  sprintf(buf, "%li.%03li", time.tv_sec,time.tv_nsec/1000000);
+  sprintf(buf, "%li.%03li", time.tv_sec, time.tv_nsec/1000000);
   return buf;
 }
 #else
 static const char *
-debug_log_time(void) {
+debug_log_time(void)
+{
   struct timeval        time;
   static char         buf[64];
 
-  gettimeofday(&time,NULL);
-  sprintf(buf, "%li.%03li", time.tv_sec,time.tv_usec/1000);
+  gettimeofday(&time, NULL);
+  sprintf(buf, "%li.%03li", time.tv_sec, time.tv_usec/1000);
   return buf;
 }
 #endif /* CONFIG_ORTE_RT */
 
 void
-db_print(const char *format,...) {
+db_print(const char *format, ...)
+{
   char f[256];
   va_list ap;
 
   va_start(ap, format);
-  sprintf(f, "%s | ",debug_log_time());
-  vsprintf(f+strlen(f),format,ap);
+  sprintf(f, "%s | ", debug_log_time());
+  vsprintf(f+strlen(f), format, ap);
   va_end(ap);
-  db_print_output(f);    
+  db_print_output(f);
 }
 
 void
-db_print_output(const char *format) {
+db_print_output(const char *format)
+{
 #ifndef CONFIG_ORTE_RT
-  if (debug_log == NULL) return;
+  if (debug_log == NULL)
+    return;
   fprintf(debug_log, "%s", format);
   fflush(debug_log);
 #else
@@ -99,45 +104,50 @@ db_print_output(const char *format) {
 }
 
 void
-debug_arg(const char *arg) {
-  int32_t s=0,l=0,i;
+debug_arg(const char *arg)
+{
+  int32_t s = 0, l = 0, i;
 
   if (!strncmp(arg, "ALL", 3)) {
     s = -1;
     arg += 4;
   } else {
     s = atoi(arg);
-    while (*arg && *arg++ != '.');
+    while (*arg && *arg++ != '.') ;
   }
   l = atoi(arg);
-  if (l < 0) l = 0;
-  if (l > 10) l = 10;
+  if (l < 0)
+    l = 0;
+  if (l > 10)
+    l = 10;
   if (s >= 0) {
     debugLevels[s] = l;
     return;
   }
   for (i = 0; i < MAX_DEBUG_SECTIONS; i++)
     debugLevels[i] = l;
-} 
+}
 
-void 
-debug_options(const char *options) {
+void
+debug_options(const char *options)
+{
   char *p = NULL;
   char *s = NULL;
 
   if (options) {
-    p=(char*)MALLOC(strlen(options)+1);
+    p = (char *)MALLOC(strlen(options)+1);
     if (p) {
       memcpy(p, options, strlen(options) + 1);
-    }    
+    }
     for (s = strtok(p, ":"); s; s = strtok(NULL, ":"))
       debug_arg(s);
     FREE(p);
-  }     
+  }
 }
 
 void
-debug_open_log(const char *logfile) {
+debug_open_log(const char *logfile)
+{
 #ifndef CONFIG_ORTE_RT
   if (logfile == NULL) {
     debug_log = stderr;
@@ -157,7 +167,8 @@ debug_open_log(const char *logfile) {
 }
 
 void
-db_init(const char *logfile, const char *options) {
+db_init(const char *logfile, const char *options)
+{
   int i;
 
   for (i = 0; i < MAX_DEBUG_SECTIONS; i++)
@@ -167,22 +178,26 @@ db_init(const char *logfile, const char *options) {
 }
 
 #ifdef ENABLE_MEM_CHECK
-void *mem_check_malloc(size_t size) { 
+void *
+mem_check_malloc(size_t size)
+{
   void *ptr;
-  
-  if ((ptr=malloc(size))) {
+
+  if ((ptr = malloc(size))) {
     mem_check_counter++;
-    debug(1,9) ("mem check: inc %d\n",mem_check_counter);
+    debug(1, 9) ("mem check: inc %d\n", mem_check_counter);
   }
   return ptr;
 }
 
-void mem_check_free(void *ptr) {
-  if(!ptr) {
+void
+mem_check_free(void *ptr)
+{
+  if (!ptr) {
 //    LOG_FATAL(KERN_CRIT "ul_mem_check_free : triing to free NULL ptr\n");
-  }else{
+  } else {
     mem_check_counter--;
-    debug(1,9) ("mem check: dec %d\n",mem_check_counter);
+    debug(1, 9) ("mem check: dec %d\n", mem_check_counter);
     free(ptr);
   }
 }
index cf0b81ef0c2308135adb93261c153f2e91fe945a..6f07108ca649b6cc2b19c2c801ae478cdd5936d4 100644 (file)
@@ -3,31 +3,31 @@
  *
  *  DEBUG:  section 10                  Event system based on htimerNtp
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundtion; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
  * @d: pointer to Domain
  * @otAID: pointer to objectTreeAID or NULL for multicast event
  * @fncNode: pointer on structure fncNode or NULL
- * @where: in which timer queue is the event added 
+ * @where: in which timer queue is the event added
  *         0-UnicastCommon,1-UnicastSendMetatraffic,2-UnicastSendUserdata
  * @name: name called function
  * @lock: pointer on lock or NULL for unprotected agruments
- * @func: pointer to called function 
- * @arg1: first function argument 
- * @when: time when is needed call the function 
+ * @func: pointer to called function
+ * @arg1: first function argument
+ * @when: time when is needed call the function
  *
  */
-int32_t 
-eventAdd(ORTEDomain *d,               
-         ObjectEntryAID *objectEntryAID,
-         HTimFncUserNode *fncNode,
-         int where,          
-         const char *name,
-         EVH2 *func,                      
-         pthread_rwlock_t *lock,
-         void *arg1,                       
-         NtpTime *when) { 
-  NtpTime whenExpire,actualTime;
+int32_t
+eventAdd(ORTEDomain *d,
+        ObjectEntryAID *objectEntryAID,
+        HTimFncUserNode *fncNode,
+        int where,
+        const char *name,
+        EVH2 *func,
+        pthread_rwlock_t *lock,
+        void *arg1,
+        NtpTime *when)
+{
+  NtpTime whenExpire, actualTime;
 
-  debug(10,10) ("eventAdd: AID 0x%x %s\n",objectEntryAID->aid,name);
-  actualTime=getActualNtpTime();
-  if (when!=NULL) {
-    NtpTimeAdd(whenExpire,actualTime,*when);
+  debug(10, 10) ("eventAdd: AID 0x%x %s\n", objectEntryAID->aid, name);
+  actualTime = getActualNtpTime();
+  if (when != NULL) {
+    NtpTimeAdd(whenExpire, actualTime, *when);
   } else {
-    whenExpire=actualTime;
+    whenExpire = actualTime;
   }
   if (!fncNode) {
-    fncNode=(HTimFncUserNode*)MALLOC(sizeof(HTimFncUserNode));
+    fncNode = (HTimFncUserNode *)MALLOC(sizeof(HTimFncUserNode));
     htimerUnicastCommon_init_detached(fncNode);
   }
-  fncNode->name=name;
-  fncNode->lock=lock;
-  fncNode->func=func;
-  fncNode->arg1=arg1;
+  fncNode->name = name;
+  fncNode->lock = lock;
+  fncNode->func = func;
+  fncNode->arg1 = arg1;
   switch (where) {
     case 0:
-      htimerUnicastCommon_set_expire(fncNode,whenExpire);
-      htimerUnicastCommon_add(objectEntryAID,fncNode);
-      htimerUnicastCommon_update_root_timer(&d->objectEntry,objectEntryAID);
+      htimerUnicastCommon_set_expire(fncNode, whenExpire);
+      htimerUnicastCommon_add(objectEntryAID, fncNode);
+      htimerUnicastCommon_update_root_timer(&d->objectEntry, objectEntryAID);
       break;
     case 1:
-      htimerUnicastSendMetatraffic_set_expire(fncNode,whenExpire);
-      htimerUnicastSendMetatraffic_add(objectEntryAID,fncNode);
-      htimerUnicastSendMetatraffic_update_root_timer(&d->objectEntry,objectEntryAID);
+      htimerUnicastSendMetatraffic_set_expire(fncNode, whenExpire);
+      htimerUnicastSendMetatraffic_add(objectEntryAID, fncNode);
+      htimerUnicastSendMetatraffic_update_root_timer(&d->objectEntry, objectEntryAID);
       break;
     case 2:
-      htimerUnicastSendUserData_set_expire(fncNode,whenExpire);
-      htimerUnicastSendUserData_add(objectEntryAID,fncNode);
-      htimerUnicastSendUserData_update_root_timer(&d->objectEntry,objectEntryAID);
+      htimerUnicastSendUserData_set_expire(fncNode, whenExpire);
+      htimerUnicastSendUserData_add(objectEntryAID, fncNode);
+      htimerUnicastSendUserData_update_root_timer(&d->objectEntry, objectEntryAID);
       break;
     default:
       FREE(fncNode);
       return ORTE_FALSE;
       break;
   }
-  debug(10,10) ("eventAdd: finished\n");
+  debug(10, 10) ("eventAdd: finished\n");
   return ORTE_TRUE;
 }
 
 /*
  * ORTEEventDetach - detach a event from event system (root and application)
- * @d: pointer to Domain 
- * @otAID: pointer to objectTreeAID 
+ * @d: pointer to Domain
+ * @otAID: pointer to objectTreeAID
  * @fncNode: pointer on structure fncNode or NULL
- * @where: from which timer queue is the event detached 
+ * @where: from which timer queue is the event detached
  *         0-UnicastCommon,1-UnicastSendMetatraffic,2-UnicastSendUserdata
  *
  */
-int32_t 
-eventDetach(ORTEDomain *d,               
-            ObjectEntryAID *objectEntryAID,
-            HTimFncUserNode  *fncNode,
-            int where) {
-  debug(10,10) ("eventDetach: AID 0x%x\n",objectEntryAID->aid);
+int32_t
+eventDetach(ORTEDomain *d,
+           ObjectEntryAID *objectEntryAID,
+           HTimFncUserNode  *fncNode,
+           int where)
+{
+  debug(10, 10) ("eventDetach: AID 0x%x\n", objectEntryAID->aid);
   switch (where) {
     case 0:
-      htimerUnicastCommon_detach(objectEntryAID,fncNode);
-      htimerUnicastCommon_update_root_timer(&d->objectEntry,objectEntryAID);
+      htimerUnicastCommon_detach(objectEntryAID, fncNode);
+      htimerUnicastCommon_update_root_timer(&d->objectEntry, objectEntryAID);
       break;
     case 1:
-      htimerUnicastSendMetatraffic_detach(objectEntryAID,fncNode);
-      htimerUnicastSendMetatraffic_update_root_timer(&d->objectEntry,objectEntryAID);
+      htimerUnicastSendMetatraffic_detach(objectEntryAID, fncNode);
+      htimerUnicastSendMetatraffic_update_root_timer(&d->objectEntry, objectEntryAID);
       break;
     case 2:
-      htimerUnicastSendUserData_detach(objectEntryAID,fncNode);
-      htimerUnicastSendUserData_update_root_timer(&d->objectEntry,objectEntryAID);
+      htimerUnicastSendUserData_detach(objectEntryAID, fncNode);
+      htimerUnicastSendUserData_update_root_timer(&d->objectEntry, objectEntryAID);
       break;
     default:
       return ORTE_FALSE;
       break;
   }
-  debug(10,10) ("eventDetach: finished\n");
+  debug(10, 10) ("eventDetach: finished\n");
   return ORTE_TRUE;
 }
index 63bebabbb8dbdc2aa0d4942dad1ad851fa6b42a5..ff49eb2a36f942099954b2cd558027d20b4b8302 100644 (file)
 /*
- *  $Id: fnmatch.c,v 0.0.0.1            2003/08/21 
+ *  $Id: fnmatch.c,v 0.0.0.1            2003/08/21
  *
- *  DEBUG:  section 3                   
+ *  DEBUG:  section 3
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
 /* Match STRING against the filename pattern PATTERN, returning zero if
    it matches, nonzero if not.  */
 int
-fnmatch (const char *pattern,const char *string,int flags ) {
-    register const char *p = pattern, *n = string;
-    register unsigned char c;
+fnmatch(const char *pattern, const char *string, int flags)
+{
+  register const char *p = pattern, *n = string;
+  register unsigned char c;
 
 /* Note that this evalutes C many times.  */
-#define FOLD(c) ((flags & FNM_CASEFOLD) && isupper (c) ? tolower (c) : (c))
+#define FOLD(c) ((flags & FNM_CASEFOLD) && isupper(c) ? tolower(c) : (c))
 
 #ifdef _WIN32_ORTE
-    flags |= FNM_CASEFOLD;
+  flags |= FNM_CASEFOLD;
 #endif
 
-    while ((c = *p++) != '\0')
-    {
-        c = FOLD (c);
-
-        switch (c) {
-            case '?':
-                if (*n == '\0')
-                    return FNM_NOMATCH;
-                else if ((flags & FNM_FILE_NAME) && *n == '/')
-                    return FNM_NOMATCH;
-                else if ((flags & FNM_PERIOD) && *n == '.' &&
-                    (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/')))
-                    return FNM_NOMATCH;
-                break;
-
-            case '\\':
-                if (!(flags & FNM_NOESCAPE))
-                {
-                    c = *p++;
-                    c = FOLD (c);
-                }
-                if (FOLD ((unsigned char)*n) != c)
-                    return FNM_NOMATCH;
-                break;
-
-            case '*':
-                if ((flags & FNM_PERIOD) && *n == '.' &&
-                    (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/')))
-                    return FNM_NOMATCH;
-
-                for (c = *p++; c == '?' || c == '*'; c = *p++, ++n)
-                    if (((flags & FNM_FILE_NAME) && *n == '/') ||
-                        (c == '?' && *n == '\0'))
-                        return FNM_NOMATCH;
-
-                if (c == '\0')
-                    return 0;
-
-                {
-                    unsigned char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c;
-                    c1 = FOLD (c1);
-                    for (--p; *n != '\0'; ++n)
-                        if ((c == '[' || FOLD ((unsigned char)*n) == c1) &&
-                            fnmatch (p, n, flags & ~FNM_PERIOD) == 0)
-                            return 0;
-                    return FNM_NOMATCH;
-                }
-
-            case '[':
-                {
-                    /* Nonzero if the sense of the character class is inverted.  */
-                    register int not;
-
-                    if (*n == '\0')
-                        return FNM_NOMATCH;
-
-                    if ((flags & FNM_PERIOD) && *n == '.' &&
-                    (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/')))
-                        return FNM_NOMATCH;
-
-                    not = (*p == '!' || *p == '^');
-                    if (not)
-                        ++p;
-
-                    c = *p++;
-                    for (;;) {
-                        register unsigned char cstart = c, cend = c;
-
-                        if (!(flags & FNM_NOESCAPE) && c == '\\')
-                            cstart = cend = *p++;
-
-                        cstart = cend = FOLD (cstart);
-
-                        if (c == '\0')
-                        /* [ (unterminated) loses.  */
-                            return FNM_NOMATCH;
-
-                        c = *p++;
-                        c = FOLD (c);
-
-                        if ((flags & FNM_FILE_NAME) && c == '/')
-                        /* [/] can never match.  */
-                            return FNM_NOMATCH;
-
-                        if (c == '-' && *p != ']')
-                        {
-                            cend = *p++;
-                            if (!(flags & FNM_NOESCAPE) && cend == '\\')
-                                cend = *p++;
-                            if (cend == '\0')
-                                return FNM_NOMATCH;
-                            cend = FOLD (cend);
-
-                            c = *p++;
-                        }
-
-                        if (FOLD ((unsigned char)*n) >= cstart
-                        && FOLD ((unsigned char)*n) <= cend)
-                            goto matched;
-
-                        if (c == ']')
-                            break;
-                    }
-                    if (!not)
-                        return FNM_NOMATCH;
-                    break;
-
-                matched:;
-                    /* Skip the rest of the [...] that already matched.  */
-                    while (c != ']') {
-                        if (c == '\0')
-                        /* [... (unterminated) loses.  */
-                            return FNM_NOMATCH;
-
-                        c = *p++;
-                        if (!(flags & FNM_NOESCAPE) && c == '\\')
-                        /* XXX 1003.2d11 is unclear if this is right.  */
-                        ++p;
-                    }
-                    if (not)
-                        return FNM_NOMATCH;
-                }
-                break;
-
-            default:
-                if (c != FOLD ((unsigned char)*n))
-                    return FNM_NOMATCH;
-        }   // switch (c)
-
-        ++n;
-    }
-
-    if (*n == '\0')
-        return 0;
-
-    if ((flags & FNM_LEADING_DIR) && *n == '/')
+  while ((c = *p++) != '\0') {
+    c = FOLD(c);
+
+    switch (c) {
+      case '?':
+       if (*n == '\0')
+         return FNM_NOMATCH;
+       else if ((flags & FNM_FILE_NAME) && *n == '/')
+         return FNM_NOMATCH;
+       else if ((flags & FNM_PERIOD) && *n == '.' &&
+                (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/')))
+         return FNM_NOMATCH;
+       break;
+
+      case '\\':
+       if (!(flags & FNM_NOESCAPE)) {
+         c = *p++;
+         c = FOLD(c);
+       }
+       if (FOLD((unsigned char)*n) != c)
+         return FNM_NOMATCH;
+       break;
+
+      case '*':
+       if ((flags & FNM_PERIOD) && *n == '.' &&
+           (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/')))
+         return FNM_NOMATCH;
+
+       for (c = *p++; c == '?' || c == '*'; c = *p++, ++n)
+         if (((flags & FNM_FILE_NAME) && *n == '/') ||
+             (c == '?' && *n == '\0'))
+           return FNM_NOMATCH;
+
+       if (c == '\0')
+         return 0;
+
+       {
+         unsigned char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c;
+         c1 = FOLD(c1);
+         for (--p; *n != '\0'; ++n)
+           if ((c == '[' || FOLD((unsigned char)*n) == c1) &&
+               fnmatch(p, n, flags & ~FNM_PERIOD) == 0)
+             return 0;
+         return FNM_NOMATCH;
+       }
+
+      case '[':
+      {
+       /* Nonzero if the sense of the character class is inverted.  */
+       register int not;
+
+       if (*n == '\0')
+         return FNM_NOMATCH;
+
+       if ((flags & FNM_PERIOD) && *n == '.' &&
+           (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/')))
+         return FNM_NOMATCH;
+
+       not = (*p == '!' || *p == '^');
+       if (not)
+         ++p;
+
+       c = *p++;
+       for (;; ) {
+         register unsigned char cstart = c, cend = c;
+
+         if (!(flags & FNM_NOESCAPE) && c == '\\')
+           cstart = cend = *p++;
+
+         cstart = cend = FOLD(cstart);
+
+         if (c == '\0')
+           /* [ (unterminated) loses.  */
+           return FNM_NOMATCH;
+
+         c = *p++;
+         c = FOLD(c);
+
+         if ((flags & FNM_FILE_NAME) && c == '/')
+           /* [/] can never match.  */
+           return FNM_NOMATCH;
+
+         if (c == '-' && *p != ']') {
+           cend = *p++;
+           if (!(flags & FNM_NOESCAPE) && cend == '\\')
+             cend = *p++;
+           if (cend == '\0')
+             return FNM_NOMATCH;
+           cend = FOLD(cend);
+
+           c = *p++;
+         }
+
+         if (FOLD((unsigned char)*n) >= cstart
+             && FOLD((unsigned char)*n) <= cend)
+           goto matched;
+
+         if (c == ']')
+           break;
+       }
+       if (!not)
+         return FNM_NOMATCH;
+       break;
+
+matched:;
+       /* Skip the rest of the [...] that already matched.  */
+       while (c != ']') {
+         if (c == '\0')
+           /* [... (unterminated) loses.  */
+           return FNM_NOMATCH;
+
+         c = *p++;
+         if (!(flags & FNM_NOESCAPE) && c == '\\')
+           /* XXX 1003.2d11 is unclear if this is right.  */
+           ++p;
+       }
+       if (not)
+         return FNM_NOMATCH;
+      }
+      break;
+
+      default:
+       if (c != FOLD((unsigned char)*n))
+         return FNM_NOMATCH;
+    }       // switch (c)
+
+    ++n;
+  }
+
+  if (*n == '\0')
+    return 0;
+
+  if ((flags & FNM_LEADING_DIR) && *n == '/')
     /* The FNM_LEADING_DIR flag says that "foo*" matches "foobar/frobozz".  */
-        return 0;
+    return 0;
 
-    return FNM_NOMATCH;
+  return FNM_NOMATCH;
 }
index 282bda9c7bc71858e4ffcadcdcde71cb28000fa2..bf73b1de32846a7fe193f95b34a2fd358fcb40ed 100644 (file)
 /*
- *  $Id: htimerNtp.c,v 0.0.0.1          2003/08/21 
+ *  $Id: htimerNtp.c,v 0.0.0.1          2003/08/21
  *
  *  DEBUG:  section 2                   HTimer for NtpTime
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #define UL_HTIMER_INC_FROM_BASE
 
 #include "orte_all.h"
 
-GAVL_FLES_INT_DEC(ul_htim_queue,       /* prefix */
-                 ul_htim_queue_t,      /* root_t */
-                 ul_htim_node_t,       /* item_t */
-                 ul_htim_time_t,       /* key_t */
-                 timers,               /* root_field */
-                 node,                 /* item_node */
-                 expires,              /* item_key */
-                 ul_htimer_cmp_fnc)    /* cmp_fnc */
+GAVL_FLES_INT_DEC(ul_htim_queue,        /* prefix */
+                 ul_htim_queue_t,      /* root_t */
+                 ul_htim_node_t,       /* item_t */
+                 ul_htim_time_t,       /* key_t */
+                 timers,               /* root_field */
+                 node,                 /* item_node */
+                 expires,              /* item_key */
+                 ul_htimer_cmp_fnc)    /* cmp_fnc */
 
 
 GAVL_FLES_INT_IMP(ul_htim_queue, ul_htim_queue_t, ul_htim_node_t, ul_htim_time_t,
-      timers, node, expires, ul_htimer_cmp_fnc, GAVL_FAFTER, 
- root->first_changed=1,;,root->first_changed=1)
+                 timers, node, expires, ul_htimer_cmp_fnc, GAVL_FAFTER,
+                 root->first_changed = 1,;
+                 , root->first_changed = 1)
 
 /*****************************************************************************/
 UL_HTIMER_IMP(htimerRoot, \
-      ObjectEntry, \
-      HTimFncRootNode, \
-      htimRoot, \
-      htim) 
-void 
-htimerRoot_run_expired(ORTEDomain *d, 
-      ul_htim_time_t *pact_time) {
+             ObjectEntry, \
+             HTimFncRootNode, \
+             htimRoot, \
+             htim)
+void
+htimerRoot_run_expired(ORTEDomain *d,
+                      ul_htim_time_t *pact_time)
+{
   HTimFncRootNode *timer;
-  
-  debug(2,10) ("htimerRoot: start\n");               
-  while((timer=htimerRoot_cut_expired(&d->objectEntry, pact_time))){
-    debug(2,10) ("htimerRoot: AID-0x%x\n",timer->objectEntryAID->aid);               
-    timer->func(d,timer->objectEntryAID,pact_time);
+
+  debug(2, 10) ("htimerRoot: start\n");
+  while ((timer = htimerRoot_cut_expired(&d->objectEntry, pact_time))) {
+    debug(2, 10) ("htimerRoot: AID-0x%x\n", timer->objectEntryAID->aid);
+    timer->func(d, timer->objectEntryAID, pact_time);
   }
-  debug(2,10) ("htimerRoot: finished\n");               
-} 
+  debug(2, 10) ("htimerRoot: finished\n");
+}
 
 /*****************************************************************************/
 UL_HTIMER_IMP(htimerUnicastCommon, \
-      ObjectEntryAID, \
-      HTimFncUserNode, \
-      htimUnicast.common, \
-      htim) 
+             ObjectEntryAID, \
+             HTimFncUserNode, \
+             htimUnicast.common, \
+             htim)
 
-void 
+void
 htimerUnicastCommon_update_root_timer(ObjectEntry *objectEntry,
-      ObjectEntryAID *objectEntryAID) {
+                                     ObjectEntryAID *objectEntryAID)
+{
   NtpTime nextExpire;
 
   //if first item is changed -> update root timer queue
   if (htimerUnicastCommon_first_changed(objectEntryAID)) {
     //deatach old timer from this queue (if any)
     htimerRoot_detach(objectEntry,
-        &objectEntryAID->htimUnicast.commonNode);
-    if (htimerUnicastCommon_next_expire(objectEntryAID,&nextExpire)!=0) {
+                     &objectEntryAID->htimUnicast.commonNode);
+    if (htimerUnicastCommon_next_expire(objectEntryAID, &nextExpire) != 0) {
       //setup new values
-      objectEntryAID->htimUnicast.commonNode.func=
-          htimerUnicastCommon_run_expired;
-      objectEntryAID->htimUnicast.commonNode.objectEntryAID=
-          objectEntryAID;
+      objectEntryAID->htimUnicast.commonNode.func =
+       htimerUnicastCommon_run_expired;
+      objectEntryAID->htimUnicast.commonNode.objectEntryAID =
+       objectEntryAID;
       htimerRoot_set_expire(
-          &objectEntryAID->htimUnicast.commonNode,
-          nextExpire);
+       &objectEntryAID->htimUnicast.commonNode,
+       nextExpire);
       //insert new timer to root htimer node
       htimerRoot_add(objectEntry,
-          &objectEntryAID->htimUnicast.commonNode);
-      debug(2,10) ("htimerUnicastCommon: root updated, wakeup\n");               
+                    &objectEntryAID->htimUnicast.commonNode);
+      debug(2, 10) ("htimerUnicastCommon: root updated, wakeup\n");
       //wake-up sending thread to process event
       ORTEDomainWakeUpSendingThread(objectEntry);
     }
   }
 }
 
-void 
+void
 htimerUnicastCommon_run_expired(ORTEDomain *d,
-                       ObjectEntryAID *objectEntryAID, 
-                       ul_htim_time_t *pact_time) {
+                               ObjectEntryAID *objectEntryAID,
+                               ul_htim_time_t *pact_time)
+{
   HTimFncUserNode  *timer;
   int              retValue;
   pthread_rwlock_t *lock;
-  
-  while((timer=htimerUnicastCommon_cut_expired(objectEntryAID, pact_time))){
-    if ((lock=timer->lock)) //after proc. timer->func can be timer freed
+
+  while ((timer = htimerUnicastCommon_cut_expired(objectEntryAID, pact_time))) {
+    if ((lock = timer->lock)) //after proc. timer->func can be timer freed
       pthread_rwlock_wrlock(timer->lock);
-    debug(2,10) ("htimerUnicastCommon: %s\n",
-                  timer->name);               
-    retValue=timer->func(d,timer->arg1);
-    if (lock) 
+    debug(2, 10) ("htimerUnicastCommon: %s\n",
+                 timer->name);
+    retValue = timer->func(d, timer->arg1);
+    if (lock)
       pthread_rwlock_unlock(timer->lock);
-    if (retValue==2)  //object deleted
+    if (retValue == 2) //object deleted
       return;
   }
-  htimerUnicastCommon_update_root_timer(&d->objectEntry,objectEntryAID);
-} 
+  htimerUnicastCommon_update_root_timer(&d->objectEntry, objectEntryAID);
+}
 
 /*****************************************************************************/
 UL_HTIMER_IMP(htimerUnicastSendMetatraffic, \
-      ObjectEntryAID, \
-      HTimFncUserNode, \
-      htimUnicast.sendMetatraffic, \
-      htim) 
+             ObjectEntryAID, \
+             HTimFncUserNode, \
+             htimUnicast.sendMetatraffic, \
+             htim)
 
-void 
+void
 htimerUnicastSendMetatraffic_update_root_timer(ObjectEntry *objectEntry,
-      ObjectEntryAID *objectEntryAID) {
+                                              ObjectEntryAID *objectEntryAID)
+{
   NtpTime nextExpire;
 
   //if first item is changed -> update root timer queue
   if (htimerUnicastSendMetatraffic_first_changed(objectEntryAID)) {
     //deatach old timer from this queue (if any)
     htimerRoot_detach(objectEntry,
-        &objectEntryAID->htimUnicast.sendMetatrafficNode);
-    if (htimerUnicastSendMetatraffic_next_expire(objectEntryAID,&nextExpire)!=0) {
+                     &objectEntryAID->htimUnicast.sendMetatrafficNode);
+    if (htimerUnicastSendMetatraffic_next_expire(objectEntryAID, &nextExpire) != 0) {
       //setup new values
-      objectEntryAID->htimUnicast.sendMetatrafficNode.func=
-          htimerUnicastSendMetatraffic_run_expired;
-      objectEntryAID->htimUnicast.sendMetatrafficNode.objectEntryAID=
-          objectEntryAID;
+      objectEntryAID->htimUnicast.sendMetatrafficNode.func =
+       htimerUnicastSendMetatraffic_run_expired;
+      objectEntryAID->htimUnicast.sendMetatrafficNode.objectEntryAID =
+       objectEntryAID;
       htimerRoot_set_expire(
-          &objectEntryAID->htimUnicast.sendMetatrafficNode,
-          nextExpire);
+       &objectEntryAID->htimUnicast.sendMetatrafficNode,
+       nextExpire);
       //insert new timer to root htimer node
       htimerRoot_add(objectEntry,
-          &objectEntryAID->htimUnicast.sendMetatrafficNode);
-      debug(2,10) ("htimerUnicastMetatraffic: root updated, wakeup\n");               
+                    &objectEntryAID->htimUnicast.sendMetatrafficNode);
+      debug(2, 10) ("htimerUnicastMetatraffic: root updated, wakeup\n");
       //wake-up sending thread to process event
       ORTEDomainWakeUpSendingThread(objectEntry);
     }
   }
 }
 
-void 
+void
 htimerUnicastSendMetatraffic_run_expired(ORTEDomain *d,
-    ObjectEntryAID *objectEntryAID,
-    ul_htim_time_t *pact_time) {
+                                        ObjectEntryAID *objectEntryAID,
+                                        ul_htim_time_t *pact_time)
+{
   HTimFncUserNode *timer;
   int             retValue;
-  
-  while((timer=htimerUnicastSendMetatraffic_cut_expired(objectEntryAID, pact_time))){
+
+  while ((timer = htimerUnicastSendMetatraffic_cut_expired(objectEntryAID, pact_time))) {
     if (timer->lock)
       pthread_rwlock_wrlock(timer->lock);
-    debug(2,10) ("htimerUnicastMetatraffic: %s\n",
-                  timer->name);               
-    retValue=timer->func(d,timer->arg1);
+    debug(2, 10) ("htimerUnicastMetatraffic: %s\n",
+                 timer->name);
+    retValue = timer->func(d, timer->arg1);
     while (d->taskSend.mb.needSend) {
-      ORTESendData(d,objectEntryAID,ORTE_TRUE);
-      timer->func(d,timer->arg1);
+      ORTESendData(d, objectEntryAID, ORTE_TRUE);
+      timer->func(d, timer->arg1);
     }
     if (timer->lock)
       pthread_rwlock_unlock(timer->lock);
   }
-  htimerUnicastSendMetatraffic_update_root_timer(&d->objectEntry,objectEntryAID);
-  if (d->taskSend.mb.cdrCodec.wptr>RTPS_HEADER_LENGTH) {
-      ORTESendData(d,objectEntryAID,ORTE_TRUE);
+  htimerUnicastSendMetatraffic_update_root_timer(&d->objectEntry, objectEntryAID);
+  if (d->taskSend.mb.cdrCodec.wptr > RTPS_HEADER_LENGTH) {
+    ORTESendData(d, objectEntryAID, ORTE_TRUE);
   }
-} 
+}
 
 /*****************************************************************************/
 UL_HTIMER_IMP(htimerUnicastSendUserData, \
-      ObjectEntryAID, \
-      HTimFncUserNode, \
-      htimUnicast.sendUserData, \
-      htim) 
+             ObjectEntryAID, \
+             HTimFncUserNode, \
+             htimUnicast.sendUserData, \
+             htim)
 
-void 
+void
 htimerUnicastSendUserData_update_root_timer(ObjectEntry *objectEntry,
-      ObjectEntryAID *objectEntryAID) {
+                                           ObjectEntryAID *objectEntryAID)
+{
   NtpTime nextExpire;
 
   //if first item is changed -> update root timer queue
   if (htimerUnicastSendUserData_first_changed(objectEntryAID)) {
     //deatach old timer from this queue (if any)
     htimerRoot_detach(objectEntry,
-        &objectEntryAID->htimUnicast.sendUserDataNode);
-    if (htimerUnicastSendUserData_next_expire(objectEntryAID,&nextExpire)!=0) {
+                     &objectEntryAID->htimUnicast.sendUserDataNode);
+    if (htimerUnicastSendUserData_next_expire(objectEntryAID, &nextExpire) != 0) {
       //setup new values
-      objectEntryAID->htimUnicast.sendUserDataNode.func=
-          htimerUnicastSendUserData_run_expired;
-      objectEntryAID->htimUnicast.sendUserDataNode.objectEntryAID=
-          objectEntryAID;
+      objectEntryAID->htimUnicast.sendUserDataNode.func =
+       htimerUnicastSendUserData_run_expired;
+      objectEntryAID->htimUnicast.sendUserDataNode.objectEntryAID =
+       objectEntryAID;
       htimerRoot_set_expire(
-          &objectEntryAID->htimUnicast.sendUserDataNode,
-          nextExpire);
+       &objectEntryAID->htimUnicast.sendUserDataNode,
+       nextExpire);
       //insert new timer to root htimer node
       htimerRoot_add(objectEntry,
-          &objectEntryAID->htimUnicast.sendUserDataNode);
-      debug(2,10) ("htimerUnicastUserdata: root updated, wakeup\n");               
+                    &objectEntryAID->htimUnicast.sendUserDataNode);
+      debug(2, 10) ("htimerUnicastUserdata: root updated, wakeup\n");
       //wake-up sending thread to process event
       ORTEDomainWakeUpSendingThread(objectEntry);
     }
   }
 }
 
-void 
+void
 htimerUnicastSendUserData_run_expired(ORTEDomain *d,
-    ObjectEntryAID *objectEntryAID, 
-    ul_htim_time_t *pact_time) {
+                                     ObjectEntryAID *objectEntryAID,
+                                     ul_htim_time_t *pact_time)
+{
   HTimFncUserNode *timer;
   int             retValue;
-  
-  while((timer=htimerUnicastSendUserData_cut_expired(objectEntryAID, pact_time))){
+
+  while ((timer = htimerUnicastSendUserData_cut_expired(objectEntryAID, pact_time))) {
     if (timer->lock)
       pthread_rwlock_wrlock(timer->lock);
-    retValue=timer->func(d,timer->arg1);
+    retValue = timer->func(d, timer->arg1);
     while (d->taskSend.mb.needSend) {
-      ORTESendData(d,objectEntryAID,ORTE_FALSE);
-      timer->func(d,timer->arg1);
+      ORTESendData(d, objectEntryAID, ORTE_FALSE);
+      timer->func(d, timer->arg1);
     }
     if (timer->lock)
       pthread_rwlock_unlock(timer->lock);
   }
-  htimerUnicastSendUserData_update_root_timer(&d->objectEntry,objectEntryAID);
-  if (d->taskSend.mb.cdrCodec.wptr>RTPS_HEADER_LENGTH) {
-      ORTESendData(d,objectEntryAID,ORTE_FALSE);
+  htimerUnicastSendUserData_update_root_timer(&d->objectEntry, objectEntryAID);
+  if (d->taskSend.mb.cdrCodec.wptr > RTPS_HEADER_LENGTH) {
+    ORTESendData(d, objectEntryAID, ORTE_FALSE);
   }
 }
 
 /*********************************************************************/
 NtpTime
-getActualNtpTime(void) {
+getActualNtpTime(void)
+{
   NtpTime               result;
+
 #ifndef CONFIG_ORTE_RT
   struct timeval        time;
 
-  gettimeofday(&time,NULL);
-  NtpTimeAssembFromUs(result,time.tv_sec,time.tv_usec);
-  NtpTimeAssembFromUs(result,time.tv_sec,time.tv_usec);
+  gettimeofday(&time, NULL);
+  NtpTimeAssembFromUs(result, time.tv_sec, time.tv_usec);
+  NtpTimeAssembFromUs(result, time.tv_sec, time.tv_usec);
 #else
   struct timespec        time;
 
   clock_gettime(CLOCK_REALTIME, &time);
-  time.tv_nsec/=1000;  //conver to us
-  NtpTimeAssembFromUs(result,time.tv_sec,time.tv_nsec);
+  time.tv_nsec /= 1000;  //conver to us
+  NtpTimeAssembFromUs(result, time.tv_sec, time.tv_nsec);
 #endif
   return result;
 }
index ed66452518ab5a444fff721e805dc8f19d2e7717..9ff41ef49b17e15edcbc4cb4e4c0a8e62797736f 100644 (file)
-    /*
+/*
  *  $Id: objectEntry.c,v 0.0.0.1   2003/09/10
  *
  *  DEBUG:  section 8                   Functions with database of objects
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
 /*****************************************************************************/
 // Implementation of GAVL functions
 GAVL_CUST_NODE_INT_IMP(ObjectEntryHID, ObjectEntry, ObjectEntryHID, HostId,
-    objRoot, hidNode, hid, gavl_cmp_int)
+                      objRoot, hidNode, hid, gavl_cmp_int)
 GAVL_CUST_NODE_INT_IMP(ObjectEntryAID, ObjectEntryHID, ObjectEntryAID, AppId,
-    aidRoot, aidNode, aid, gavl_cmp_int)
+                      aidRoot, aidNode, aid, gavl_cmp_int)
 GAVL_CUST_NODE_INT_IMP(ObjectEntryOID, ObjectEntryAID, ObjectEntryOID, ObjectId,
-    oidRoot, oidNode, oid, gavl_cmp_int)
-  
+                      oidRoot, oidNode, oid, gavl_cmp_int)
+
 /*****************************************************************************/
 void
-objectEntryRefreshApp(ORTEDomain *d,ObjectEntryOID *objectEntryOID) {
-  if (!objectEntryOID) return;
-  if ((objectEntryOID->oid!=OID_APP) ||
-      (objectEntryOID->guid.aid==AID_UNKNOWN) ||
-      (!gavl_cmp_guid(&objectEntryOID->guid,&d->guid))) return;
+objectEntryRefreshApp(ORTEDomain *d, ObjectEntryOID *objectEntryOID)
+{
+  if (!objectEntryOID)
+    return;
+  if ((objectEntryOID->oid != OID_APP) ||
+      (objectEntryOID->guid.aid == AID_UNKNOWN) ||
+      (!gavl_cmp_guid(&objectEntryOID->guid, &d->guid)))
+    return;
   eventDetach(d,
-          objectEntryOID->objectEntryAID,
-          &objectEntryOID->expirationPurgeTimer,
-          0);
+             objectEntryOID->objectEntryAID,
+             &objectEntryOID->expirationPurgeTimer,
+             0);
   eventAdd(d,
-          objectEntryOID->objectEntryAID,
-          &objectEntryOID->expirationPurgeTimer,
-          0,
-          "ExpirationTimer",
-          objectEntryExpirationTimer,
-          NULL,
-          objectEntryOID,
-          &((AppParams*)objectEntryOID->attributes)->expirationTime);
-  debug(8,3) ("refreshed: 0x%x-0x%x\n",
-              objectEntryOID->objectEntryHID->hid,
-              objectEntryOID->objectEntryAID->aid);
+          objectEntryOID->objectEntryAID,
+          &objectEntryOID->expirationPurgeTimer,
+          0,
+          "ExpirationTimer",
+          objectEntryExpirationTimer,
+          NULL,
+          objectEntryOID,
+          &((AppParams *)objectEntryOID->attributes)->expirationTime);
+  debug(8, 3) ("refreshed: 0x%x-0x%x\n",
+              objectEntryOID->objectEntryHID->hid,
+              objectEntryOID->objectEntryAID->aid);
 }
 
 /*****************************************************************************/
 ObjectEntryOID *
-objectEntryFind(ORTEDomain *d,GUID_RTPS *guid) {
+objectEntryFind(ORTEDomain *d, GUID_RTPS *guid)
+{
   ObjectEntryHID *objectEntryHID;
   ObjectEntryAID *objectEntryAID;
 
-  objectEntryHID=ObjectEntryHID_find(&d->objectEntry,&guid->hid);
-  if (objectEntryHID==NULL) return NULL;
-  objectEntryAID=ObjectEntryAID_find(objectEntryHID,&guid->aid);
-  if (objectEntryAID==NULL) return NULL;
-  return ObjectEntryOID_find(objectEntryAID,&guid->oid);
+  objectEntryHID = ObjectEntryHID_find(&d->objectEntry, &guid->hid);
+  if (objectEntryHID == NULL)
+    return NULL;
+  objectEntryAID = ObjectEntryAID_find(objectEntryHID, &guid->aid);
+  if (objectEntryAID == NULL)
+    return NULL;
+  return ObjectEntryOID_find(objectEntryAID, &guid->oid);
 }
 
 /*
  * objectEntryAdd - Add a object to structure objectEntry
- * @objectEntry: pointer to root structure 
+ * @objectEntry: pointer to root structure
  * @guid: pointer to guid of object (hid,aid,oid)
  *
  * Return pointer to objectEntryOID
  */
 ObjectEntryOID *
-objectEntryAdd(ORTEDomain *d,GUID_RTPS *guid,void *params) {
+objectEntryAdd(ORTEDomain *d, GUID_RTPS *guid, void *params)
+{
   ObjectEntryHID *objectEntryHID;
   ObjectEntryAID *objectEntryAID;
   ObjectEntryOID *objectEntryOID;
 
-  debug(8,10) ("objectEntry: start\n");
-  objectEntryHID=ObjectEntryHID_find(&d->objectEntry,&guid->hid);
-  //not exists Host -> create 
-  if (objectEntryHID==NULL) {
-    objectEntryHID=(ObjectEntryHID*)MALLOC(sizeof(ObjectEntryHID));
+  debug(8, 10) ("objectEntry: start\n");
+  objectEntryHID = ObjectEntryHID_find(&d->objectEntry, &guid->hid);
+  //not exists Host -> create
+  if (objectEntryHID == NULL) {
+    objectEntryHID = (ObjectEntryHID *)MALLOC(sizeof(ObjectEntryHID));
     //initialization items of structure objectEntryHID
     ObjectEntryAID_init_root_field(objectEntryHID);
-    objectEntryHID->hid=guid->hid;
+    objectEntryHID->hid = guid->hid;
     //insert
-    ObjectEntryHID_insert(&d->objectEntry,objectEntryHID);
-    debug(8,5) ("objectEntry: Host  : %#10.8x created\n",guid->hid);
+    ObjectEntryHID_insert(&d->objectEntry, objectEntryHID);
+    debug(8, 5) ("objectEntry: Host  : %#10.8x created\n", guid->hid);
   }
-  objectEntryAID=ObjectEntryAID_find(objectEntryHID,&guid->aid);
-  //not exists Application -> create 
-  if (objectEntryAID==NULL) {
-    objectEntryAID=(ObjectEntryAID*)MALLOC(sizeof(ObjectEntryAID));
-    objectEntryAID->aobject=NULL;
+  objectEntryAID = ObjectEntryAID_find(objectEntryHID, &guid->aid);
+  //not exists Application -> create
+  if (objectEntryAID == NULL) {
+    objectEntryAID = (ObjectEntryAID *)MALLOC(sizeof(ObjectEntryAID));
+    objectEntryAID->aobject = NULL;
     //init items of structure objectEntryAID
-    objectEntryAID->aid=guid->aid;
+    objectEntryAID->aid = guid->aid;
     ObjectEntryOID_init_root_field(objectEntryAID);
     //init structure htimUnicast
     htimerUnicastCommon_init_queue(objectEntryAID);
@@ -119,92 +126,94 @@ objectEntryAdd(ORTEDomain *d,GUID_RTPS *guid,void *params) {
     htimerUnicastSendUserData_init_queue(objectEntryAID);
     ul_htim_queue_init_detached(&objectEntryAID->htimUnicast.sendUserDataNode.htim);
     //insert
-    ObjectEntryAID_insert(objectEntryHID,objectEntryAID);
-    debug(8,5) ("objectEntry: App   : %#10.8x created\n",guid->aid);
+    ObjectEntryAID_insert(objectEntryHID, objectEntryAID);
+    debug(8, 5) ("objectEntry: App   : %#10.8x created\n", guid->aid);
   }
-  objectEntryOID=ObjectEntryOID_find(objectEntryAID,&guid->oid);
-  //not exists Object -> create 
-  if (objectEntryOID==NULL) {
-    objectEntryOID=(ObjectEntryOID*)MALLOC(sizeof(ObjectEntryOID));
+  objectEntryOID = ObjectEntryOID_find(objectEntryAID, &guid->oid);
+  //not exists Object -> create
+  if (objectEntryOID == NULL) {
+    objectEntryOID = (ObjectEntryOID *)MALLOC(sizeof(ObjectEntryOID));
     //initialization items of structure objectEntryOID
-    objectEntryOID->guid=*guid;
-    objectEntryOID->oid=guid->oid;
-    objectEntryOID->objectEntryAID=objectEntryAID;
-    objectEntryOID->objectEntryHID=objectEntryHID;
-    objectEntryOID->attributes=params;
+    objectEntryOID->guid = *guid;
+    objectEntryOID->oid = guid->oid;
+    objectEntryOID->objectEntryAID = objectEntryAID;
+    objectEntryOID->objectEntryHID = objectEntryHID;
+    objectEntryOID->attributes = params;
     ul_htim_queue_init_detached(&objectEntryOID->expirationPurgeTimer.htim);
     ul_htim_queue_init_detached(&objectEntryOID->sendCallBackDelayTimer.htim);
     ObjectEntryMulticast_init_head(objectEntryOID);
-    objectEntryOID->multicastPort=0;
-    if (guid->oid==OID_APP) {
-      objectEntryAID->aobject=objectEntryOID;
-      debug(8,5) ("objectEntry: Object: %#10.8x connected to AID\n",guid->oid);
+    objectEntryOID->multicastPort = 0;
+    if (guid->oid == OID_APP) {
+      objectEntryAID->aobject = objectEntryOID;
+      debug(8, 5) ("objectEntry: Object: %#10.8x connected to AID\n", guid->oid);
     }
     //insert
-    ObjectEntryOID_insert(objectEntryAID,objectEntryOID);
-    debug(8,5) ("objectEntry: Object: %#10.8x created\n",guid->oid);
+    ObjectEntryOID_insert(objectEntryAID, objectEntryOID);
+    debug(8, 5) ("objectEntry: Object: %#10.8x created\n", guid->oid);
   }
-  debug(8,10) ("objectEntry: finished\n");
+  debug(8, 10) ("objectEntry: finished\n");
   return objectEntryOID;
 }
 
 /*
  * objectEntryDelete - Delete a object from structure objectEntry
- * @objectEntry: pointer to root structure 
+ * @objectEntry: pointer to root structure
  * @obejctEntryOID: pointer to the deleted objectEntryOID
  *
  * return 0-no obj. was deleted, 1-OID was deleted,2-OID,AID was deleted,
  *        3-OID,AID,HID was deleted
  */
 int
-objectEntryDelete(ORTEDomain *d,ObjectEntryOID *objectEntryOID,Boolean destroy) {
+objectEntryDelete(ORTEDomain *d, ObjectEntryOID *objectEntryOID, Boolean destroy)
+{
   ObjectEntryHID *objectEntryHID;
   ObjectEntryAID *objectEntryAID;
-  int            result=0;
+  int            result = 0;
 
-  debug(8,10) ("objectEntryDelete: start\n");
-  if (!objectEntryOID) return result;
-  objectEntryHID=objectEntryOID->objectEntryHID;
-  objectEntryAID=objectEntryOID->objectEntryAID;
+  debug(8, 10) ("objectEntryDelete: start\n");
+  if (!objectEntryOID)
+    return result;
+  objectEntryHID = objectEntryOID->objectEntryHID;
+  objectEntryAID = objectEntryOID->objectEntryAID;
   //Destroy object on level OID
   eventDetach(d,
-          objectEntryOID->objectEntryAID,
-          &objectEntryOID->expirationPurgeTimer,
-          0);
+             objectEntryOID->objectEntryAID,
+             &objectEntryOID->expirationPurgeTimer,
+             0);
   eventDetach(d,
-          objectEntryOID->objectEntryAID,
-          &objectEntryOID->sendCallBackDelayTimer,
-          0);
+             objectEntryOID->objectEntryAID,
+             &objectEntryOID->sendCallBackDelayTimer,
+             0);
   FREE(objectEntryOID->attributes);
-  if (objectEntryAID->aobject==objectEntryOID) {
-    objectEntryAID->aobject=NULL;
-    debug(8,5) ("objectEntry: Object: %#10.8x deleted from AID\n",objectEntryOID->oid);
+  if (objectEntryAID->aobject == objectEntryOID) {
+    objectEntryAID->aobject = NULL;
+    debug(8, 5) ("objectEntry: Object: %#10.8x deleted from AID\n", objectEntryOID->oid);
   }
   if (destroy) {
-    ObjectEntryOID_delete(objectEntryAID,objectEntryOID);
+    ObjectEntryOID_delete(objectEntryAID, objectEntryOID);
     FREE(objectEntryOID);
   }
-  debug(8,5) ("objectEntry: Object: %#10.8x deleted\n",objectEntryOID->oid);
-  result=1;
+  debug(8, 5) ("objectEntry: Object: %#10.8x deleted\n", objectEntryOID->oid);
+  result = 1;
   //Destroy object on level AID
   if (ObjectEntryOID_is_empty(objectEntryAID)) {
-    debug(8,5) ("objectEntry: App   : %#10.8x deleted\n",objectEntryAID->aid);
+    debug(8, 5) ("objectEntry: App   : %#10.8x deleted\n", objectEntryAID->aid);
     if (destroy) {
-      ObjectEntryAID_delete(objectEntryHID,objectEntryAID);
+      ObjectEntryAID_delete(objectEntryHID, objectEntryAID);
       FREE(objectEntryAID);
     }
-    result=2;
+    result = 2;
   }
   //Destroy object on level HID
   if (ObjectEntryAID_is_empty(objectEntryHID)) {
-    debug(8,5) ("objectEntry: Host  : %#10.8x deleted\n",objectEntryHID->hid);
+    debug(8, 5) ("objectEntry: Host  : %#10.8x deleted\n", objectEntryHID->hid);
     if (destroy) {
-      ObjectEntryHID_delete(&d->objectEntry,objectEntryHID);
+      ObjectEntryHID_delete(&d->objectEntry, objectEntryHID);
       FREE(objectEntryHID);
     }
-    result=3;
+    result = 3;
   }
-  debug(8,10) ("objectEntryDelete: finished\n");
+  debug(8, 10) ("objectEntryDelete: finished\n");
   return result;
 }
 
@@ -214,16 +223,17 @@ objectEntryDelete(ORTEDomain *d,ObjectEntryOID *objectEntryOID,Boolean destroy)
  *
  */
 void
-objectEntryDeleteAll(ORTEDomain *d,ObjectEntry *objectEntry) {
+objectEntryDeleteAll(ORTEDomain *d, ObjectEntry *objectEntry)
+{
   ObjectEntryHID *objectEntryHID;
   ObjectEntryAID *objectEntryAID;
   ObjectEntryOID *objectEntryOID;
 
-  while((objectEntryHID=ObjectEntryHID_cut_first(objectEntry))) {
-    while((objectEntryAID=ObjectEntryAID_cut_first(objectEntryHID))) {
-      while((objectEntryOID=ObjectEntryOID_cut_first(objectEntryAID))) {
-        objectEntryDelete(d,objectEntryOID,ORTE_FALSE);
-        FREE(objectEntryOID);
+  while ((objectEntryHID = ObjectEntryHID_cut_first(objectEntry))) {
+    while ((objectEntryAID = ObjectEntryAID_cut_first(objectEntryHID))) {
+      while ((objectEntryOID = ObjectEntryOID_cut_first(objectEntryAID))) {
+       objectEntryDelete(d, objectEntryOID, ORTE_FALSE);
+       FREE(objectEntryOID);
       }
       FREE(objectEntryAID);
     }
@@ -237,19 +247,19 @@ objectEntryDeleteAll(ORTEDomain *d,ObjectEntry *objectEntry) {
  *
  */
 void
-objectEntryDump(ObjectEntry *objectEntry) {
+objectEntryDump(ObjectEntry *objectEntry)
+{
   ObjectEntryHID *objectEntryHID;
   ObjectEntryAID *objectEntryAID;
   ObjectEntryOID *objectEntryOID;
 
-  gavl_cust_for_each(ObjectEntryHID,objectEntry,objectEntryHID) {
-    debug(8,5) ("hid:%x\n",objectEntryHID->hid);
-    gavl_cust_for_each(ObjectEntryAID,objectEntryHID,objectEntryAID) {
-      debug(8,5) ("  aid:%x\n",objectEntryAID->aid);
-      gavl_cust_for_each(ObjectEntryOID,objectEntryAID,objectEntryOID) {
-        debug(8,5) ("    oid:%x\n",objectEntryOID->oid,objectEntryOID);
+  gavl_cust_for_each(ObjectEntryHID, objectEntry, objectEntryHID) {
+    debug(8, 5) ("hid:%x\n", objectEntryHID->hid);
+    gavl_cust_for_each(ObjectEntryAID, objectEntryHID, objectEntryAID) {
+      debug(8, 5) ("  aid:%x\n", objectEntryAID->aid);
+      gavl_cust_for_each(ObjectEntryOID, objectEntryAID, objectEntryOID) {
+       debug(8, 5) ("    oid:%x\n", objectEntryOID->oid, objectEntryOID);
       }
     }
   }
 }
-
index 9e525f4c530c1f1e6c6bd293b3696599e424f9e3..c8744a297bcf9159bb2743510fb662181559583e 100644 (file)
  *
  *  DEBUG:  section 12                  Timer function on object from eventEntry
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
 /*****************************************************************************/
 int
-objectEntryPurgeTimer(ORTEDomain *d,void *vobjectEntryOID) {
-  ObjectEntryOID   *objectEntryOID=(ObjectEntryOID*)vobjectEntryOID;
+objectEntryPurgeTimer(ORTEDomain *d, void *vobjectEntryOID)
+{
+  ObjectEntryOID   *objectEntryOID = (ObjectEntryOID *)vobjectEntryOID;
   GUID_RTPS        guid;
-  
-  guid=objectEntryOID->guid;
+
+  guid = objectEntryOID->guid;
   if ((d->guid.aid & 0x03) == MANAGER) {
     if ((guid.aid & 0x03) == MANAGER) {
       pthread_rwlock_wrlock(&d->writerManagers.lock);
-      CSTWriterMakeGAP(d,&d->writerManagers,&guid);
+      CSTWriterMakeGAP(d, &d->writerManagers, &guid);
       pthread_rwlock_unlock(&d->writerManagers.lock);
     }
     if (((guid.aid & 0x03) == MANAGEDAPPLICATION) &&
-        (objectEntryOID->appMOM)) {
+       (objectEntryOID->appMOM)) {
       pthread_rwlock_wrlock(&d->writerApplications.lock);
-      CSTWriterMakeGAP(d,&d->writerApplications,&guid);
+      CSTWriterMakeGAP(d, &d->writerApplications, &guid);
       pthread_rwlock_unlock(&d->writerApplications.lock);
     }
   }
   if ((d->guid.aid & 0x03) == MANAGEDAPPLICATION) {
     switch (guid.oid & 0x07) {
       case OID_APPLICATION:
-        break;
+       break;
       case OID_PUBLICATION:
-        pthread_rwlock_wrlock(&d->writerPublications.lock);
-        CSTWriterMakeGAP(d,&d->writerPublications,&guid);
-        pthread_rwlock_unlock(&d->writerPublications.lock);
-        break;
-      case OID_SUBSCRIPTION: 
-        pthread_rwlock_wrlock(&d->writerSubscriptions.lock);
-        CSTWriterMakeGAP(d,&d->writerSubscriptions,&guid);
-        pthread_rwlock_unlock(&d->writerSubscriptions.lock);
-        break;
-    }  
+       pthread_rwlock_wrlock(&d->writerPublications.lock);
+       CSTWriterMakeGAP(d, &d->writerPublications, &guid);
+       pthread_rwlock_unlock(&d->writerPublications.lock);
+       break;
+      case OID_SUBSCRIPTION:
+       pthread_rwlock_wrlock(&d->writerSubscriptions.lock);
+       CSTWriterMakeGAP(d, &d->writerSubscriptions, &guid);
+       pthread_rwlock_unlock(&d->writerSubscriptions.lock);
+       break;
+    }
   }
-  debug(12,3) ("purged: 0x%x-0x%x-0x%x object removed\n",
-               objectEntryOID->objectEntryHID->hid,
-               objectEntryOID->objectEntryAID->aid,
-               objectEntryOID->oid);
-  objectEntryDelete(d,objectEntryOID,ORTE_TRUE);
+  debug(12, 3) ("purged: 0x%x-0x%x-0x%x object removed\n",
+               objectEntryOID->objectEntryHID->hid,
+               objectEntryOID->objectEntryAID->aid,
+               objectEntryOID->oid);
+  objectEntryDelete(d, objectEntryOID, ORTE_TRUE);
   objectEntryDump(&d->objectEntry);
-  
-  debug(12,10) ("objectEntryPurgeTimer: finished\n");
+
+  debug(12, 10) ("objectEntryPurgeTimer: finished\n");
   return 2;
 }
 
 /*****************************************************************************/
 void
-removeSubscriptionsOnLocalPublications(ORTEDomain *d,ObjectEntryOID *robjectEntryOID) {
+removeSubscriptionsOnLocalPublications(ORTEDomain *d, ObjectEntryOID *robjectEntryOID)
+{
   CSTWriter       *cstWriter;
   CSTRemoteReader *cstRemoteReader;
   ObjectEntryOID  *objectEntryOID;
-    
-  if ((!d) || (!robjectEntryOID)) return;
+
+  if ((!d) || (!robjectEntryOID))
+    return;
   pthread_rwlock_wrlock(&d->publications.lock);
   gavl_cust_for_each(CSTWriter,
-                     &d->publications,cstWriter) {
+                    &d->publications, cstWriter) {
     pthread_rwlock_wrlock(&cstWriter->lock);
     gavl_cust_for_each(ObjectEntryOID,
-                       robjectEntryOID->objectEntryAID,
-                       objectEntryOID) {
-      cstRemoteReader=CSTRemoteReader_find(cstWriter,&objectEntryOID->guid);
-      CSTWriterDestroyRemoteReader(d,cstRemoteReader);
+                      robjectEntryOID->objectEntryAID,
+                      objectEntryOID) {
+      cstRemoteReader = CSTRemoteReader_find(cstWriter, &objectEntryOID->guid);
+      CSTWriterDestroyRemoteReader(d, cstRemoteReader);
     }
     pthread_rwlock_unlock(&cstWriter->lock);
   }
@@ -103,27 +106,29 @@ removeSubscriptionsOnLocalPublications(ORTEDomain *d,ObjectEntryOID *robjectEntr
 
 /*****************************************************************************/
 void
-removePublicationsOnLocalSubscriptions(ORTEDomain *d,ObjectEntryOID *robjectEntryOID) {
+removePublicationsOnLocalSubscriptions(ORTEDomain *d, ObjectEntryOID *robjectEntryOID)
+{
   CSTReader       *cstReader;
   CSTRemoteWriter *cstRemoteWriter;
   ObjectEntryOID  *objectEntryOID;
-  
-  if ((!d) || (!robjectEntryOID)) return;
+
+  if ((!d) || (!robjectEntryOID))
+    return;
   pthread_rwlock_wrlock(&d->subscriptions.lock);
   gavl_cust_for_each(CSTReader,
-                     &d->subscriptions,cstReader) {
+                    &d->subscriptions, cstReader) {
     pthread_rwlock_wrlock(&cstReader->lock);
     gavl_cust_for_each(ObjectEntryOID,
-                       robjectEntryOID->objectEntryAID,
-                       objectEntryOID) {
-      cstRemoteWriter=CSTRemoteWriter_find(cstReader,&objectEntryOID->guid);
+                      robjectEntryOID->objectEntryAID,
+                      objectEntryOID) {
+      cstRemoteWriter = CSTRemoteWriter_find(cstReader, &objectEntryOID->guid);
       if (cstRemoteWriter) {
-        CSTReaderDestroyRemoteWriter(d,cstRemoteWriter);
-        if ((cstReader->cstRemoteWriterCounter==0) && (cstReader->createdByPattern)) {
-          debug(12,2) ("scheduled: 0x%x-0x%x-0x%x for remove (patternSubscription)\n",
-                      cstReader->guid.hid,cstReader->guid.aid,cstReader->guid.oid);               
-          ORTESubscriptionDestroyLocked(cstReader);
-        }
+       CSTReaderDestroyRemoteWriter(d, cstRemoteWriter);
+       if ((cstReader->cstRemoteWriterCounter == 0) && (cstReader->createdByPattern)) {
+         debug(12, 2) ("scheduled: 0x%x-0x%x-0x%x for remove (patternSubscription)\n",
+                       cstReader->guid.hid, cstReader->guid.aid, cstReader->guid.oid);
+         ORTESubscriptionDestroyLocked(cstReader);
+       }
       }
     }
     pthread_rwlock_unlock(&cstReader->lock);
@@ -133,113 +138,119 @@ removePublicationsOnLocalSubscriptions(ORTEDomain *d,ObjectEntryOID *robjectEntr
 
 /*****************************************************************************/
 void
-removeApplication(ORTEDomain *d,ObjectEntryOID *robjectEntryOID) {
+removeApplication(ORTEDomain *d, ObjectEntryOID *robjectEntryOID)
+{
   GUID_RTPS        guid;
   ObjectEntryOID   *objectEntryOID;
   CSTRemoteWriter  *cstRemoteWriter;
   CSTRemoteReader  *cstRemoteReader;
-  
-  if (!robjectEntryOID) return;
-  if (!gavl_cmp_guid(&robjectEntryOID->guid,&d->guid)) return;
-  debug(12,3) ("application removed - AID: 0%x\n",robjectEntryOID->guid.aid);
-  
-  guid=robjectEntryOID->guid;
+
+  if (!robjectEntryOID)
+    return;
+  if (!gavl_cmp_guid(&robjectEntryOID->guid, &d->guid))
+    return;
+  debug(12, 3) ("application removed - AID: 0%x\n", robjectEntryOID->guid.aid);
+
+  guid = robjectEntryOID->guid;
   //publication, subsription and application
   pthread_rwlock_wrlock(&d->writerPublications.lock);
-  guid.oid=OID_READ_PUBL;
-  cstRemoteReader=CSTRemoteReader_find(&d->writerPublications,&guid);
-  CSTWriterDestroyRemoteReader(d,cstRemoteReader);
+  guid.oid = OID_READ_PUBL;
+  cstRemoteReader = CSTRemoteReader_find(&d->writerPublications, &guid);
+  CSTWriterDestroyRemoteReader(d, cstRemoteReader);
   pthread_rwlock_unlock(&d->writerPublications.lock);
   pthread_rwlock_wrlock(&d->writerSubscriptions.lock);
-  guid.oid=OID_READ_SUBS;
-  cstRemoteReader=CSTRemoteReader_find(&d->writerSubscriptions,&guid);
-  CSTWriterDestroyRemoteReader(d,cstRemoteReader);
+  guid.oid = OID_READ_SUBS;
+  cstRemoteReader = CSTRemoteReader_find(&d->writerSubscriptions, &guid);
+  CSTWriterDestroyRemoteReader(d, cstRemoteReader);
   pthread_rwlock_unlock(&d->writerSubscriptions.lock);
   pthread_rwlock_wrlock(&d->readerPublications.lock);
-  guid.oid=OID_WRITE_PUBL;
-  cstRemoteWriter=CSTRemoteWriter_find(&d->readerPublications,&guid);
-  CSTReaderDestroyRemoteWriter(d,cstRemoteWriter);
+  guid.oid = OID_WRITE_PUBL;
+  cstRemoteWriter = CSTRemoteWriter_find(&d->readerPublications, &guid);
+  CSTReaderDestroyRemoteWriter(d, cstRemoteWriter);
   pthread_rwlock_unlock(&d->readerPublications.lock);
   pthread_rwlock_wrlock(&d->readerSubscriptions.lock);
-  guid.oid=OID_WRITE_SUBS;
-  cstRemoteWriter=CSTRemoteWriter_find(&d->readerSubscriptions,&guid);
-  CSTReaderDestroyRemoteWriter(d,cstRemoteWriter);
+  guid.oid = OID_WRITE_SUBS;
+  cstRemoteWriter = CSTRemoteWriter_find(&d->readerSubscriptions, &guid);
+  CSTReaderDestroyRemoteWriter(d, cstRemoteWriter);
   pthread_rwlock_unlock(&d->readerSubscriptions.lock);
   //destroy all services
-  removePublicationsOnLocalSubscriptions(d,robjectEntryOID);
-  removeSubscriptionsOnLocalPublications(d,robjectEntryOID);
+  removePublicationsOnLocalSubscriptions(d, robjectEntryOID);
+  removeSubscriptionsOnLocalPublications(d, robjectEntryOID);
   //destroy all object - the object will be disconneced in objectEntryDelete
-  objectEntryOID=ObjectEntryOID_first(robjectEntryOID->objectEntryAID);
+  objectEntryOID = ObjectEntryOID_first(robjectEntryOID->objectEntryAID);
   while (objectEntryOID) {
-    ObjectEntryOID *objectEntryOID_delete=objectEntryOID;
-    objectEntryOID=ObjectEntryOID_next(robjectEntryOID->objectEntryAID,objectEntryOID);
+    ObjectEntryOID *objectEntryOID_delete = objectEntryOID;
+    objectEntryOID = ObjectEntryOID_next(robjectEntryOID->objectEntryAID, objectEntryOID);
     switch (objectEntryOID_delete->oid & 0x07) {
       case OID_PUBLICATION:
-        pthread_rwlock_wrlock(&d->psEntry.publicationsLock);
-        PublicationList_delete(&d->psEntry,objectEntryOID_delete);
-        pthread_rwlock_unlock(&d->psEntry.publicationsLock);
-        break;
-      case OID_SUBSCRIPTION: 
-        pthread_rwlock_wrlock(&d->psEntry.subscriptionsLock);
-        SubscriptionList_delete(&d->psEntry,objectEntryOID_delete);
-        pthread_rwlock_unlock(&d->psEntry.subscriptionsLock);
-        break;
+       pthread_rwlock_wrlock(&d->psEntry.publicationsLock);
+       PublicationList_delete(&d->psEntry, objectEntryOID_delete);
+       pthread_rwlock_unlock(&d->psEntry.publicationsLock);
+       break;
+      case OID_SUBSCRIPTION:
+       pthread_rwlock_wrlock(&d->psEntry.subscriptionsLock);
+       SubscriptionList_delete(&d->psEntry, objectEntryOID_delete);
+       pthread_rwlock_unlock(&d->psEntry.subscriptionsLock);
+       break;
     }
-    objectEntryDelete(d,objectEntryOID_delete,ORTE_TRUE);
+    objectEntryDelete(d, objectEntryOID_delete, ORTE_TRUE);
   }
 }
 
 /*****************************************************************************/
 //Remove manager
 void
-removeManager(ORTEDomain *d,ObjectEntryOID *robjectEntryOID) {
+removeManager(ORTEDomain *d, ObjectEntryOID *robjectEntryOID)
+{
   CSTRemoteWriter  *cstRemoteWriter;
   ObjectEntryAID   *objectEntryAID;
   GUID_RTPS        guid;
 
-  if (!robjectEntryOID) return;
-  debug(12,3) ("manager removed\n");
-  
-  guid=robjectEntryOID->guid;
+  if (!robjectEntryOID)
+    return;
+  debug(12, 3) ("manager removed\n");
+
+  guid = robjectEntryOID->guid;
   //exists another live Manager on going down node
   gavl_cust_for_each(ObjectEntryAID,
-                     robjectEntryOID->objectEntryHID,objectEntryAID) {
+                    robjectEntryOID->objectEntryHID, objectEntryAID) {
     if (((objectEntryAID->aid & 0x03) == MANAGER) &&
-        (objectEntryAID->aid!=robjectEntryOID->guid.aid))
+       (objectEntryAID->aid != robjectEntryOID->guid.aid))
       break;  //yes
   }
-  if (!objectEntryAID) {  //not exists 
-    objectEntryAID=ObjectEntryAID_first(robjectEntryOID->objectEntryHID);
+  if (!objectEntryAID) {  //not exists
+    objectEntryAID = ObjectEntryAID_first(robjectEntryOID->objectEntryHID);
     while (objectEntryAID) {
-      ObjectEntryAID *objectEntryAID_delete=objectEntryAID;
-      objectEntryAID=ObjectEntryAID_next(robjectEntryOID->objectEntryHID,objectEntryAID);
+      ObjectEntryAID *objectEntryAID_delete = objectEntryAID;
+      objectEntryAID = ObjectEntryAID_next(robjectEntryOID->objectEntryHID, objectEntryAID);
       if ((objectEntryAID_delete->aid & 0x03) == MANAGEDAPPLICATION) {
-        ObjectEntryOID   *objectEntryOID;
-        objectEntryOID=ObjectEntryOID_find(objectEntryAID_delete,&guid.oid);
-        if (gavl_cmp_guid(&objectEntryOID->guid,&d->guid)) { //!=
-          removeApplication(d,objectEntryOID);
-        }
+       ObjectEntryOID   *objectEntryOID;
+       objectEntryOID = ObjectEntryOID_find(objectEntryAID_delete, &guid.oid);
+       if (gavl_cmp_guid(&objectEntryOID->guid, &d->guid)) { //!=
+         removeApplication(d, objectEntryOID);
+       }
       }
     }
-  } 
+  }
   pthread_rwlock_wrlock(&d->readerApplications.lock);
-  pthread_rwlock_wrlock(&d->readerManagers.lock);        
-  guid.oid=OID_WRITE_APP;      
-  cstRemoteWriter=CSTRemoteWriter_find(&d->readerApplications,&guid);
-  CSTReaderDestroyRemoteWriter(d,cstRemoteWriter);
-  guid.oid=OID_WRITE_MGR;      
-  cstRemoteWriter=CSTRemoteWriter_find(&d->readerManagers,&guid);
-  CSTReaderDestroyRemoteWriter(d,cstRemoteWriter);
+  pthread_rwlock_wrlock(&d->readerManagers.lock);
+  guid.oid = OID_WRITE_APP;
+  cstRemoteWriter = CSTRemoteWriter_find(&d->readerApplications, &guid);
+  CSTReaderDestroyRemoteWriter(d, cstRemoteWriter);
+  guid.oid = OID_WRITE_MGR;
+  cstRemoteWriter = CSTRemoteWriter_find(&d->readerManagers, &guid);
+  CSTReaderDestroyRemoteWriter(d, cstRemoteWriter);
   pthread_rwlock_unlock(&d->readerApplications.lock);
-  pthread_rwlock_unlock(&d->readerManagers.lock);        
-  objectEntryDelete(d,robjectEntryOID,ORTE_TRUE);
+  pthread_rwlock_unlock(&d->readerManagers.lock);
+  objectEntryDelete(d, robjectEntryOID, ORTE_TRUE);
 }
 
-       
+
 /*****************************************************************************/
 int
-objectEntryExpirationTimer(ORTEDomain *d,void *vobjectEntryOID) {
-  ObjectEntryOID   *objectEntryOID=(ObjectEntryOID*)vobjectEntryOID;
+objectEntryExpirationTimer(ORTEDomain *d, void *vobjectEntryOID)
+{
+  ObjectEntryOID   *objectEntryOID = (ObjectEntryOID *)vobjectEntryOID;
   ObjectEntryOID   *objectEntryOID1;
   ObjectEntryAID   *objectEntryAID;
   CSTWriter        *cstWriter;
@@ -248,64 +259,64 @@ objectEntryExpirationTimer(ORTEDomain *d,void *vobjectEntryOID) {
   CSTRemoteReader  *cstRemoteReader;
   CSChange         *csChange;
   GUID_RTPS        guid;
-  
+
   //Manager, Manager expired
-  guid=objectEntryOID->guid;
+  guid = objectEntryOID->guid;
   //Event
-  generateEvent(d,&guid,objectEntryOID->attributes,ORTE_FALSE);
-  debug(12,3) ("expired: 0x%x-0x%x-0x%x removed\n",
-               objectEntryOID->guid.hid,
-               objectEntryOID->guid.aid,
-               objectEntryOID->guid.oid);               
-  if (((d->guid.aid & 3) == MANAGER) && 
+  generateEvent(d, &guid, objectEntryOID->attributes, ORTE_FALSE);
+  debug(12, 3) ("expired: 0x%x-0x%x-0x%x removed\n",
+               objectEntryOID->guid.hid,
+               objectEntryOID->guid.aid,
+               objectEntryOID->guid.oid);
+  if (((d->guid.aid & 3) == MANAGER) &&
       ((guid.aid & 0x03) == MANAGER)) {
     pthread_rwlock_wrlock(&d->readerManagers.lock);
     pthread_rwlock_wrlock(&d->writerApplications.lock);
     pthread_rwlock_wrlock(&d->readerApplications.lock);
-    guid.oid=OID_WRITE_APPSELF;  
-    cstRemoteWriter=CSTRemoteWriter_find(&d->readerManagers,&guid);
-    CSTReaderDestroyRemoteWriter(d,cstRemoteWriter);
-    guid.oid=OID_WRITE_APP;      
-    cstRemoteWriter=CSTRemoteWriter_find(&d->readerApplications,&guid);
-    CSTReaderDestroyRemoteWriter(d,cstRemoteWriter);
-    guid.oid=OID_READ_APP;  
-    cstRemoteReader=CSTRemoteReader_find(&d->writerApplications,&guid);
-    CSTWriterDestroyRemoteReader(d,cstRemoteReader);
-    guid.oid=objectEntryOID->oid;  //restore oid
+    guid.oid = OID_WRITE_APPSELF;
+    cstRemoteWriter = CSTRemoteWriter_find(&d->readerManagers, &guid);
+    CSTReaderDestroyRemoteWriter(d, cstRemoteWriter);
+    guid.oid = OID_WRITE_APP;
+    cstRemoteWriter = CSTRemoteWriter_find(&d->readerApplications, &guid);
+    CSTReaderDestroyRemoteWriter(d, cstRemoteWriter);
+    guid.oid = OID_READ_APP;
+    cstRemoteReader = CSTRemoteReader_find(&d->writerApplications, &guid);
+    CSTWriterDestroyRemoteReader(d, cstRemoteReader);
+    guid.oid = objectEntryOID->oid;  //restore oid
     //generate csChange for writerManager with alive=FALSE
-    csChange=(CSChange*)MALLOC(sizeof(CSChange));
+    csChange = (CSChange *)MALLOC(sizeof(CSChange));
     CSChangeAttributes_init_head(csChange);
-    csChange->guid=guid;
-    csChange->alive=ORTE_FALSE;
-    csChange->cdrCodec.buffer=NULL;
-    CSTWriterAddCSChange(d,&d->writerManagers,csChange);
+    csChange->guid = guid;
+    csChange->alive = ORTE_FALSE;
+    csChange->cdrCodec.buffer = NULL;
+    CSTWriterAddCSChange(d, &d->writerManagers, csChange);
     gavl_cust_for_each(ObjectEntryAID,
-                       objectEntryOID->objectEntryHID,objectEntryAID) {
+                      objectEntryOID->objectEntryHID, objectEntryAID) {
       if (((objectEntryAID->aid & 0x03) == MANAGER) &&
-          (objectEntryAID->aid!=objectEntryOID->guid.aid))
-        break;  //yes
+         (objectEntryAID->aid != objectEntryOID->guid.aid))
+       break;  //yes
     }
     //if there is no another manager from expired node -> remove all app.
     if (!objectEntryAID) {
       gavl_cust_for_each(ObjectEntryAID,
-                         objectEntryOID->objectEntryHID,objectEntryAID) {
-        if ((objectEntryAID->aid & 0x03) == MANAGEDAPPLICATION) {
-          if ((objectEntryOID1=ObjectEntryOID_find(objectEntryAID,&guid.oid))) { 
-            eventDetach(d,
-                objectEntryOID1->objectEntryAID,
-                &objectEntryOID1->expirationPurgeTimer,
-                0);
-            eventAdd(d,
-                objectEntryOID1->objectEntryAID,
-                &objectEntryOID1->expirationPurgeTimer,
-                0,
-                "ExpirationTimer",
-                objectEntryExpirationTimer,
-                NULL,
-                objectEntryOID1,
-                NULL);
-          }
-        }
+                        objectEntryOID->objectEntryHID, objectEntryAID) {
+       if ((objectEntryAID->aid & 0x03) == MANAGEDAPPLICATION) {
+         if ((objectEntryOID1 = ObjectEntryOID_find(objectEntryAID, &guid.oid))) {
+           eventDetach(d,
+                       objectEntryOID1->objectEntryAID,
+                       &objectEntryOID1->expirationPurgeTimer,
+                       0);
+           eventAdd(d,
+                    objectEntryOID1->objectEntryAID,
+                    &objectEntryOID1->expirationPurgeTimer,
+                    0,
+                    "ExpirationTimer",
+                    objectEntryExpirationTimer,
+                    NULL,
+                    objectEntryOID1,
+                    NULL);
+         }
+       }
       }
     }
     pthread_rwlock_unlock(&d->readerApplications.lock);
@@ -313,138 +324,139 @@ objectEntryExpirationTimer(ORTEDomain *d,void *vobjectEntryOID) {
     pthread_rwlock_unlock(&d->readerManagers.lock);
   }
   //Manager, Application expired
-  if (((d->guid.aid & 3) == MANAGER) && 
+  if (((d->guid.aid & 3) == MANAGER) &&
       ((guid.aid & 0x03) == MANAGEDAPPLICATION)) {
-     pthread_rwlock_wrlock(&d->writerApplicationSelf.lock);
-     pthread_rwlock_wrlock(&d->writerManagers.lock);
-     pthread_rwlock_wrlock(&d->writerApplications.lock);
-     pthread_rwlock_wrlock(&d->readerApplications.lock);
-     guid.oid=OID_WRITE_APPSELF;  /* local app */
-     cstRemoteWriter=CSTRemoteWriter_find(&d->readerApplications,&guid);
-     CSTReaderDestroyRemoteWriter(d,cstRemoteWriter);
-     guid.oid=OID_WRITE_APP;      /* remote app */
-     cstRemoteWriter=CSTRemoteWriter_find(&d->readerApplications,&guid);
-     CSTReaderDestroyRemoteWriter(d,cstRemoteWriter);
-     guid.oid=OID_READ_APP;  
-     cstRemoteReader=CSTRemoteReader_find(&d->writerApplications,&guid);
-     CSTWriterDestroyRemoteReader(d,cstRemoteReader);
-     guid.oid=OID_READ_MGR;  
-     cstRemoteReader=CSTRemoteReader_find(&d->writerManagers,&guid);
-     CSTWriterDestroyRemoteReader(d,cstRemoteReader);
-     if (objectEntryOID->appMOM) {
-        guid.oid=objectEntryOID->oid;  //restore oid
-        //generate csChange for writerApplication with alive=FALSE
-        csChange=(CSChange*)MALLOC(sizeof(CSChange));
-        parameterUpdateCSChange(csChange,d->appParams,ORTE_TRUE);
-        csChange->guid=guid;
-        csChange->alive=ORTE_FALSE;
-        csChange->cdrCodec.buffer=NULL;
-        CSTWriterAddCSChange(d,&d->writerApplications,csChange);
-        //increment vargAppsSequenceNumber and make csChange
-        SeqNumberInc(d->appParams->vargAppsSequenceNumber,
-                     d->appParams->vargAppsSequenceNumber);
-        appSelfParamChanged(d,ORTE_FALSE,ORTE_FALSE,ORTE_TRUE,ORTE_TRUE);
-     } else {
-       objectEntryDelete(d,objectEntryOID,ORTE_TRUE);
-       objectEntryOID=NULL;  
-     }
-     pthread_rwlock_unlock(&d->writerApplicationSelf.lock);
-     pthread_rwlock_unlock(&d->writerManagers.lock);
-     pthread_rwlock_unlock(&d->writerApplications.lock);
-     pthread_rwlock_unlock(&d->readerApplications.lock);
+    pthread_rwlock_wrlock(&d->writerApplicationSelf.lock);
+    pthread_rwlock_wrlock(&d->writerManagers.lock);
+    pthread_rwlock_wrlock(&d->writerApplications.lock);
+    pthread_rwlock_wrlock(&d->readerApplications.lock);
+    guid.oid = OID_WRITE_APPSELF; /* local app */
+    cstRemoteWriter = CSTRemoteWriter_find(&d->readerApplications, &guid);
+    CSTReaderDestroyRemoteWriter(d, cstRemoteWriter);
+    guid.oid = OID_WRITE_APP;     /* remote app */
+    cstRemoteWriter = CSTRemoteWriter_find(&d->readerApplications, &guid);
+    CSTReaderDestroyRemoteWriter(d, cstRemoteWriter);
+    guid.oid = OID_READ_APP;
+    cstRemoteReader = CSTRemoteReader_find(&d->writerApplications, &guid);
+    CSTWriterDestroyRemoteReader(d, cstRemoteReader);
+    guid.oid = OID_READ_MGR;
+    cstRemoteReader = CSTRemoteReader_find(&d->writerManagers, &guid);
+    CSTWriterDestroyRemoteReader(d, cstRemoteReader);
+    if (objectEntryOID->appMOM) {
+      guid.oid = objectEntryOID->oid;  //restore oid
+      //generate csChange for writerApplication with alive=FALSE
+      csChange = (CSChange *)MALLOC(sizeof(CSChange));
+      parameterUpdateCSChange(csChange, d->appParams, ORTE_TRUE);
+      csChange->guid = guid;
+      csChange->alive = ORTE_FALSE;
+      csChange->cdrCodec.buffer = NULL;
+      CSTWriterAddCSChange(d, &d->writerApplications, csChange);
+      //increment vargAppsSequenceNumber and make csChange
+      SeqNumberInc(d->appParams->vargAppsSequenceNumber,
+                  d->appParams->vargAppsSequenceNumber);
+      appSelfParamChanged(d, ORTE_FALSE, ORTE_FALSE, ORTE_TRUE, ORTE_TRUE);
+    } else {
+      objectEntryDelete(d, objectEntryOID, ORTE_TRUE);
+      objectEntryOID = NULL;
+    }
+    pthread_rwlock_unlock(&d->writerApplicationSelf.lock);
+    pthread_rwlock_unlock(&d->writerManagers.lock);
+    pthread_rwlock_unlock(&d->writerApplications.lock);
+    pthread_rwlock_unlock(&d->readerApplications.lock);
   }
-  //Application 
+  //Application
   if ((d->guid.aid & 0x03) == MANAGEDAPPLICATION) {
     switch (guid.oid & 0x07) {
       case OID_APPLICATION:
-        if ((guid.aid & 0x03) == MANAGER) {                  //Manager
-          removeManager(d,objectEntryOID);
-          objectEntryOID=NULL;
-        }
-        if ((guid.aid & 0x03) == MANAGEDAPPLICATION) {       //Application
-          removeApplication(d,objectEntryOID);
-          objectEntryOID=NULL;
-         }
-        break;
+       if ((guid.aid & 0x03) == MANAGER) {                  //Manager
+         removeManager(d, objectEntryOID);
+         objectEntryOID = NULL;
+       }
+       if ((guid.aid & 0x03) == MANAGEDAPPLICATION) {       //Application
+         removeApplication(d, objectEntryOID);
+         objectEntryOID = NULL;
+       }
+       break;
       case OID_PUBLICATION:
-        pthread_rwlock_wrlock(&d->subscriptions.lock);
-        gavl_cust_for_each(CSTReader,&d->subscriptions,cstReader) {
-          pthread_rwlock_wrlock(&cstReader->lock);
-          cstRemoteWriter=CSTRemoteWriter_find(cstReader,&guid);
-          if (cstRemoteWriter) {
-            CSTReaderDestroyRemoteWriter(d,cstRemoteWriter);
-            if ((cstReader->cstRemoteWriterCounter==0) && (cstReader->createdByPattern)) {
-              debug(12,2) ("scheduled: 0x%x-0x%x-0x%x for remove (patternSubscription)\n",
-                          cstReader->guid.hid,cstReader->guid.aid,cstReader->guid.oid);               
-              ORTESubscriptionDestroyLocked(cstReader);
-            }
-          }
-          pthread_rwlock_unlock(&cstReader->lock);
-        }
-        pthread_rwlock_unlock(&d->subscriptions.lock);
-        pthread_rwlock_wrlock(&d->publications.lock);
-        cstWriter=CSTWriter_find(&d->publications,&guid);
-        if (cstWriter) {
-          CSTWriterDelete(d,cstWriter);
-          CSTWriter_delete(&d->publications,cstWriter);
-          FREE(cstWriter);
-        }
-        pthread_rwlock_unlock(&d->publications.lock);
-        pthread_rwlock_wrlock(&d->psEntry.publicationsLock);
-        PublicationList_delete(&d->psEntry,objectEntryOID);
-        pthread_rwlock_unlock(&d->psEntry.publicationsLock);
-        if (!objectEntryOID->privateCreated) { //not local object cann't be purged
-          objectEntryDelete(d,objectEntryOID,ORTE_TRUE);
-          objectEntryOID=NULL;
-        }
-        break;
-      case OID_SUBSCRIPTION: 
-        pthread_rwlock_wrlock(&d->publications.lock);
-        gavl_cust_for_each(CSTWriter,&d->publications,cstWriter) {
-          cstRemoteReader=CSTRemoteReader_find(cstWriter,&guid);
-          CSTWriterDestroyRemoteReader(d,cstRemoteReader);
-        }
-        pthread_rwlock_unlock(&d->publications.lock);
-        pthread_rwlock_wrlock(&d->subscriptions.lock);
-        cstReader=CSTReader_find(&d->subscriptions,&guid);
-        if (cstReader) {
-          CSTReaderDelete(d,cstReader);
-          CSTReader_delete(&d->subscriptions,cstReader);
-          FREE(cstReader);
-        }
-        pthread_rwlock_unlock(&d->subscriptions.lock);
-        pthread_rwlock_wrlock(&d->psEntry.subscriptionsLock);
-        SubscriptionList_delete(&d->psEntry,objectEntryOID);
-        pthread_rwlock_unlock(&d->psEntry.subscriptionsLock);
-        if (!objectEntryOID->privateCreated) { //local object cann't be purged immediately
-          objectEntryDelete(d,objectEntryOID,ORTE_TRUE);
-          objectEntryOID=NULL;
-        }
-        break;
+       pthread_rwlock_wrlock(&d->subscriptions.lock);
+       gavl_cust_for_each(CSTReader, &d->subscriptions, cstReader) {
+         pthread_rwlock_wrlock(&cstReader->lock);
+         cstRemoteWriter = CSTRemoteWriter_find(cstReader, &guid);
+         if (cstRemoteWriter) {
+           CSTReaderDestroyRemoteWriter(d, cstRemoteWriter);
+           if ((cstReader->cstRemoteWriterCounter == 0) && (cstReader->createdByPattern)) {
+             debug(12, 2) ("scheduled: 0x%x-0x%x-0x%x for remove (patternSubscription)\n",
+                           cstReader->guid.hid, cstReader->guid.aid, cstReader->guid.oid);
+             ORTESubscriptionDestroyLocked(cstReader);
+           }
+         }
+         pthread_rwlock_unlock(&cstReader->lock);
+       }
+       pthread_rwlock_unlock(&d->subscriptions.lock);
+       pthread_rwlock_wrlock(&d->publications.lock);
+       cstWriter = CSTWriter_find(&d->publications, &guid);
+       if (cstWriter) {
+         CSTWriterDelete(d, cstWriter);
+         CSTWriter_delete(&d->publications, cstWriter);
+         FREE(cstWriter);
+       }
+       pthread_rwlock_unlock(&d->publications.lock);
+       pthread_rwlock_wrlock(&d->psEntry.publicationsLock);
+       PublicationList_delete(&d->psEntry, objectEntryOID);
+       pthread_rwlock_unlock(&d->psEntry.publicationsLock);
+       if (!objectEntryOID->privateCreated) { //not local object cann't be purged
+         objectEntryDelete(d, objectEntryOID, ORTE_TRUE);
+         objectEntryOID = NULL;
+       }
+       break;
+      case OID_SUBSCRIPTION:
+       pthread_rwlock_wrlock(&d->publications.lock);
+       gavl_cust_for_each(CSTWriter, &d->publications, cstWriter) {
+         cstRemoteReader = CSTRemoteReader_find(cstWriter, &guid);
+         CSTWriterDestroyRemoteReader(d, cstRemoteReader);
+       }
+       pthread_rwlock_unlock(&d->publications.lock);
+       pthread_rwlock_wrlock(&d->subscriptions.lock);
+       cstReader = CSTReader_find(&d->subscriptions, &guid);
+       if (cstReader) {
+         CSTReaderDelete(d, cstReader);
+         CSTReader_delete(&d->subscriptions, cstReader);
+         FREE(cstReader);
+       }
+       pthread_rwlock_unlock(&d->subscriptions.lock);
+       pthread_rwlock_wrlock(&d->psEntry.subscriptionsLock);
+       SubscriptionList_delete(&d->psEntry, objectEntryOID);
+       pthread_rwlock_unlock(&d->psEntry.subscriptionsLock);
+       if (!objectEntryOID->privateCreated) { //local object cann't be purged immediately
+         objectEntryDelete(d, objectEntryOID, ORTE_TRUE);
+         objectEntryOID = NULL;
+       }
+       break;
     }
-  }      
+  }
   if (objectEntryOID) {
     eventDetach(d,
-            objectEntryOID->objectEntryAID,
-            &objectEntryOID->expirationPurgeTimer,
-            0);
+               objectEntryOID->objectEntryAID,
+               &objectEntryOID->expirationPurgeTimer,
+               0);
     eventAdd(d,
-            objectEntryOID->objectEntryAID,
-            &objectEntryOID->expirationPurgeTimer,
-            0,
-            "PurgeTimer",
-            objectEntryPurgeTimer,
-            NULL,
-            objectEntryOID,
-            &d->domainProp.baseProp.purgeTime);
-    debug(12,3) ("expired: 0x%x-0x%x-0x%x marked for remove(%ds)\n",
-                 objectEntryOID->objectEntryHID->hid,
-                 objectEntryOID->objectEntryAID->aid,
-                objectEntryOID->oid,
-                d->domainProp.baseProp.purgeTime.seconds);
+            objectEntryOID->objectEntryAID,
+            &objectEntryOID->expirationPurgeTimer,
+            0,
+            "PurgeTimer",
+            objectEntryPurgeTimer,
+            NULL,
+            objectEntryOID,
+            &d->domainProp.baseProp.purgeTime);
+    debug(12, 3) ("expired: 0x%x-0x%x-0x%x marked for remove(%ds)\n",
+                 objectEntryOID->objectEntryHID->hid,
+                 objectEntryOID->objectEntryAID->aid,
+                 objectEntryOID->oid,
+                 d->domainProp.baseProp.purgeTime.seconds);
   }
   objectEntryDump(&d->objectEntry);
-  debug(12,3) ("expired: finished\n");
-  if (!objectEntryOID) return 2;
-  return 0;  
+  debug(12, 3) ("expired: finished\n");
+  if (!objectEntryOID)
+    return 2;
+  return 0;
 }
index 09a5aae8a635596e7d97b2b4330e04739b08d015..9d25e20e99d8a8b07c317f6f4c63589449e4dce7 100644 (file)
@@ -1,51 +1,52 @@
-    /*
+/*
  *  $Id: objectUtils.c,v 0.0.0.1         2003/09/10
  *
  *  DEBUG:  section 9                   Functions with objets
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
 /*
  * AppParamsInit - Initalization default values of an application
- * @ap: pointer to an application 
+ * @ap: pointer to an application
  *
  */
-void 
-AppParamsInit(AppParams *ap) {
+void
+AppParamsInit(AppParams *ap)
+{
   PROTOCOL_VERSION_1_0(ap->protocolVersion);
   VENDOR_ID_UNKNOWN(ap->vendorId);
-  NTPTIME_BUILD(ap->expirationTime,180);
-  ap->metatrafficUnicastPort=PORT_INVALID;
-  ap->userdataUnicastPort=PORT_INVALID;
-  ap->unicastIPAddressCount=0;
-  ap->metatrafficMulticastIPAddressCount=0;
-  ap->managerKeyCount=0;
+  NTPTIME_BUILD(ap->expirationTime, 180);
+  ap->metatrafficUnicastPort = PORT_INVALID;
+  ap->userdataUnicastPort = PORT_INVALID;
+  ap->unicastIPAddressCount = 0;
+  ap->metatrafficMulticastIPAddressCount = 0;
+  ap->managerKeyCount = 0;
   SEQUENCE_NUMBER_NONE(ap->vargAppsSequenceNumber);
 }
 
@@ -54,22 +55,23 @@ AppParamsInit(AppParams *ap) {
  * @p: pointer to a publisher
  *
  */
-void 
-PublParamsInit(ORTEPublProp *pp) {
-  pp->expectsAck=ORTE_TRUE;
+void
+PublParamsInit(ORTEPublProp *pp)
+{
+  pp->expectsAck = ORTE_TRUE;
   NTPTIME_ZERO(pp->persistence);
-  pp->reliabilityOffered=0;
-  pp->sendQueueSize=1;
-  pp->strength=1;
-  strcpy((char *)pp->topic,"DefaultTopic");
-  strcpy((char *)pp->typeName,"");
-  pp->typeChecksum=0;
+  pp->reliabilityOffered = 0;
+  pp->sendQueueSize = 1;
+  pp->strength = 1;
+  strcpy((char *)pp->topic, "DefaultTopic");
+  strcpy((char *)pp->typeName, "");
+  pp->typeChecksum = 0;
   //additional params
-  NTPTIME_BUILD(pp->maxBlockTime,30);
-  pp->criticalQueueLevel=1;
-  NtpTimeAssembFromMs(pp->HBNornalRate,1,0);
-  NtpTimeAssembFromMs(pp->HBCQLRate,0,50);
-  pp->HBMaxRetries=10;
+  NTPTIME_BUILD(pp->maxBlockTime, 30);
+  pp->criticalQueueLevel = 1;
+  NtpTimeAssembFromMs(pp->HBNornalRate, 1, 0);
+  NtpTimeAssembFromMs(pp->HBCQLRate, 0, 50);
+  pp->HBMaxRetries = 10;
 }
 
 /*
@@ -77,46 +79,48 @@ PublParamsInit(ORTEPublProp *pp) {
  * @s: pointer to a subscription
  *
  */
-void 
-SubsParamsInit(ORTESubsProp *sp) {
+void
+SubsParamsInit(ORTESubsProp *sp)
+{
   NTPTIME_ZERO(sp->minimumSeparation);
-  sp->recvQueueSize=1;
-  sp->reliabilityRequested=0;
-  strcpy((char *)sp->topic,"DefaultTopic");
-  strcpy((char *)sp->typeName,"");
-  sp->typeChecksum=0;
+  sp->recvQueueSize = 1;
+  sp->reliabilityRequested = 0;
+  strcpy((char *)sp->topic, "DefaultTopic");
+  strcpy((char *)sp->typeName, "");
+  sp->typeChecksum = 0;
 //  s->rcvMessageCallBack=NULL;
 //  s->deadline=NTPTIME_ZERO;
 }
 
 /*
- * UpdateORTEAppInfo - 
+ * UpdateORTEAppInfo -
  * @appParams: pointer to a source of data
  * @appInfo: pointer to a destination of data
  *
  */
 void
-updateORTEAppInfo(AppParams *appParams,ORTEAppInfo *appInfo) {
-  appInfo->hostId=
-      appParams->hostId;
-  appInfo->appId=
-      appParams->appId;
-  appInfo->unicastIPAddressList=
-      appParams->unicastIPAddressList;
-  appInfo->unicastIPAddressCount=
-      appParams->unicastIPAddressCount;
-  appInfo->metatrafficMulticastIPAddressList=
-      appParams->metatrafficMulticastIPAddressList;
-  appInfo->metatrafficMulticastIPAddressCount=
-      appParams->metatrafficMulticastIPAddressCount;
-  appInfo->metatrafficUnicastPort=
-      appParams->metatrafficUnicastPort;
-  appInfo->userdataUnicastPort=
-      appParams->userdataUnicastPort;
-  appInfo->vendorId=
-      appParams->vendorId;
-  appInfo->protocolVersion=
-     appParams->protocolVersion;
+updateORTEAppInfo(AppParams *appParams, ORTEAppInfo *appInfo)
+{
+  appInfo->hostId =
+    appParams->hostId;
+  appInfo->appId =
+    appParams->appId;
+  appInfo->unicastIPAddressList =
+    appParams->unicastIPAddressList;
+  appInfo->unicastIPAddressCount =
+    appParams->unicastIPAddressCount;
+  appInfo->metatrafficMulticastIPAddressList =
+    appParams->metatrafficMulticastIPAddressList;
+  appInfo->metatrafficMulticastIPAddressCount =
+    appParams->metatrafficMulticastIPAddressCount;
+  appInfo->metatrafficUnicastPort =
+    appParams->metatrafficUnicastPort;
+  appInfo->userdataUnicastPort =
+    appParams->userdataUnicastPort;
+  appInfo->vendorId =
+    appParams->vendorId;
+  appInfo->protocolVersion =
+    appParams->protocolVersion;
 }
 
 /*
@@ -127,67 +131,70 @@ updateORTEAppInfo(AppParams *appParams,ORTEAppInfo *appInfo) {
  * Return: return ORTE_TRUE if object is acceptable by ORTE (new events)
  */
 Boolean
-generateEvent(ORTEDomain *d,GUID_RTPS *guid,void *params,Boolean live) {
+generateEvent(ORTEDomain *d, GUID_RTPS *guid, void *params, Boolean live)
+{
   ObjectEntryOID  *objectEntryOID;
   GUID_RTPS       guidapp;
-  Boolean         result=ORTE_TRUE;
-  
-  //generate event 
+  Boolean         result = ORTE_TRUE;
+
+  //generate event
   switch (guid->oid & 0x07) {
     case OID_APPLICATION:
-        updateORTEAppInfo((AppParams*)params,&d->appInfo);
-        if (((guid->aid & 0x03)==MANAGER) && 
-            (d->domainEvents.onMgrNew) && live) 
-          result=d->domainEvents.onMgrNew(&d->appInfo,
-                                          d->domainEvents.onMgrNewParam);
-        if (((guid->aid & 0x03)==MANAGER) && 
-            (d->domainEvents.onMgrDelete) && (!live)) 
-          d->domainEvents.onMgrDelete(&d->appInfo,
-                                      d->domainEvents.onMgrDeleteParam);
-        if (((guid->aid & 0x03)==MANAGEDAPPLICATION) && 
-            (d->domainEvents.onAppRemoteNew) && live) 
-          result=d->domainEvents.onAppRemoteNew(&d->appInfo,
-                                          d->domainEvents.onAppRemoteNewParam);
-        if (((guid->aid & 0x03)==MANAGEDAPPLICATION) && 
-            (d->domainEvents.onAppDelete) && !live) 
-          d->domainEvents.onAppDelete(&d->appInfo,
-                                      d->domainEvents.onAppDeleteParam);
+      updateORTEAppInfo((AppParams *)params, &d->appInfo);
+      if (((guid->aid & 0x03) == MANAGER) &&
+         (d->domainEvents.onMgrNew) && live)
+       result = d->domainEvents.onMgrNew(&d->appInfo,
+                                         d->domainEvents.onMgrNewParam);
+      if (((guid->aid & 0x03) == MANAGER) &&
+         (d->domainEvents.onMgrDelete) && (!live))
+       d->domainEvents.onMgrDelete(&d->appInfo,
+                                   d->domainEvents.onMgrDeleteParam);
+      if (((guid->aid & 0x03) == MANAGEDAPPLICATION) &&
+         (d->domainEvents.onAppRemoteNew) && live)
+       result = d->domainEvents.onAppRemoteNew(&d->appInfo,
+                                               d->domainEvents.onAppRemoteNewParam);
+      if (((guid->aid & 0x03) == MANAGEDAPPLICATION) &&
+         (d->domainEvents.onAppDelete) && !live)
+       d->domainEvents.onAppDelete(&d->appInfo,
+                                   d->domainEvents.onAppDeleteParam);
       break;
     case OID_PUBLICATION:
-      guidapp.hid=guid->hid;
-      guidapp.aid=guid->aid;
-      guidapp.oid=OID_APP;
-      objectEntryOID=objectEntryFind(d,&guidapp);
-      if (!objectEntryOID) return ORTE_FALSE;
-      updateORTEAppInfo((AppParams*)objectEntryOID->attributes,&d->appInfo);   
-      d->pubInfo.topic=(char*)((ORTEPublProp*)params)->topic;
-      d->pubInfo.type=(char*)((ORTEPublProp*)params)->typeName;
-      d->pubInfo.objectId=guid->oid;
-      if ((d->domainEvents.onPubRemoteNew) && live) 
-        result=d->domainEvents.onPubRemoteNew(&d->appInfo,&d->pubInfo,
-                                        d->domainEvents.onPubRemoteNewParam);
-      if ((d->domainEvents.onPubDelete) && !live) 
-        d->domainEvents.onPubDelete(&d->appInfo,&d->pubInfo,
-                                    d->domainEvents.onPubDeleteParam);
-      
+      guidapp.hid = guid->hid;
+      guidapp.aid = guid->aid;
+      guidapp.oid = OID_APP;
+      objectEntryOID = objectEntryFind(d, &guidapp);
+      if (!objectEntryOID)
+       return ORTE_FALSE;
+      updateORTEAppInfo((AppParams *)objectEntryOID->attributes, &d->appInfo);
+      d->pubInfo.topic = (char *)((ORTEPublProp *)params)->topic;
+      d->pubInfo.type = (char *)((ORTEPublProp *)params)->typeName;
+      d->pubInfo.objectId = guid->oid;
+      if ((d->domainEvents.onPubRemoteNew) && live)
+       result = d->domainEvents.onPubRemoteNew(&d->appInfo, &d->pubInfo,
+                                               d->domainEvents.onPubRemoteNewParam);
+      if ((d->domainEvents.onPubDelete) && !live)
+       d->domainEvents.onPubDelete(&d->appInfo, &d->pubInfo,
+                                   d->domainEvents.onPubDeleteParam);
+
       break;
     case OID_SUBSCRIPTION:
-      guidapp.hid=guid->hid;
-      guidapp.aid=guid->aid;
-      guidapp.oid=OID_APP;
-      objectEntryOID=objectEntryFind(d,&guidapp);
-      if (!objectEntryOID) return ORTE_FALSE;
-      updateORTEAppInfo((AppParams*)objectEntryOID->attributes,&d->appInfo);   
-      d->subInfo.topic=(char*)((ORTESubsProp*)params)->topic;
-      d->subInfo.type=(char*)((ORTESubsProp*)params)->typeName;
-      d->subInfo.objectId=guid->oid;
+      guidapp.hid = guid->hid;
+      guidapp.aid = guid->aid;
+      guidapp.oid = OID_APP;
+      objectEntryOID = objectEntryFind(d, &guidapp);
+      if (!objectEntryOID)
+       return ORTE_FALSE;
+      updateORTEAppInfo((AppParams *)objectEntryOID->attributes, &d->appInfo);
+      d->subInfo.topic = (char *)((ORTESubsProp *)params)->topic;
+      d->subInfo.type = (char *)((ORTESubsProp *)params)->typeName;
+      d->subInfo.objectId = guid->oid;
       if ((d->domainEvents.onSubRemoteNew) && (live))
-        result=d->domainEvents.onSubRemoteNew(&d->appInfo,&d->subInfo,
-                                        d->domainEvents.onSubRemoteNewParam);
+       result = d->domainEvents.onSubRemoteNew(&d->appInfo, &d->subInfo,
+                                               d->domainEvents.onSubRemoteNewParam);
       if ((d->domainEvents.onSubDelete) && (!live))
-        d->domainEvents.onSubDelete(&d->appInfo,&d->subInfo,
-                                    d->domainEvents.onSubDeleteParam);
-      
+       d->domainEvents.onSubDelete(&d->appInfo, &d->subInfo,
+                                   d->domainEvents.onSubDeleteParam);
+
       break;
   }
   return result;
@@ -196,29 +203,30 @@ generateEvent(ORTEDomain *d,GUID_RTPS *guid,void *params,Boolean live) {
 /*
  * GetTypeApp - Test if application is MOM or OAM
  * @d: pointer to a domain
- * @ap 
+ * @ap
  * @senderIPAddress:
  *
  * Return: return ORTE_TRUE if application MOM
  */
 Boolean
-getTypeApp(ORTEDomain *d,AppParams *ap,IPAddress senderIPAddress) {
-  Boolean       result=ORTE_FALSE;
-  uint16_t      i,j,k;
-  
+getTypeApp(ORTEDomain *d, AppParams *ap, IPAddress senderIPAddress)
+{
+  Boolean       result = ORTE_FALSE;
+  uint16_t      i, j, k;
+
   //test if the app is MOM
-  for (i=0;i<d->appParams->managerKeyCount;i++) {
-    for (j=0;j<ap->managerKeyCount;j++) {
-      if (ap->managerKeyList[j]!=StringToIPAddress("127.0.0.1")) {
-        if (ap->managerKeyList[j]==d->appParams->managerKeyList[i])
-          result=ORTE_TRUE;
+  for (i = 0; i < d->appParams->managerKeyCount; i++) {
+    for (j = 0; j < ap->managerKeyCount; j++) {
+      if (ap->managerKeyList[j] != StringToIPAddress("127.0.0.1")) {
+       if (ap->managerKeyList[j] == d->appParams->managerKeyList[i])
+         result = ORTE_TRUE;
       } else {
-        if (senderIPAddress==StringToIPAddress("127.0.0.1"))
-          result=ORTE_TRUE;
-        for (k=0;k<d->domainProp.IFCount;k++) {
-          if (d->domainProp.IFProp[k].ipAddress==senderIPAddress)
-            result=ORTE_TRUE;
-        }
+       if (senderIPAddress == StringToIPAddress("127.0.0.1"))
+         result = ORTE_TRUE;
+       for (k = 0; k < d->domainProp.IFCount; k++) {
+         if (d->domainProp.IFProp[k].ipAddress == senderIPAddress)
+           result = ORTE_TRUE;
+       }
       }
     }
   }
@@ -233,21 +241,21 @@ getTypeApp(ORTEDomain *d,AppParams *ap,IPAddress senderIPAddress) {
  * Return: return ORTE_TRUE if a multicast ip address was match
  */
 Boolean
-matchMulticastAddresses(ObjectEntryOID *o1,ObjectEntryOID *o2) 
+matchMulticastAddresses(ObjectEntryOID *o1, ObjectEntryOID *o2)
 {
-  AppParams    *ap1,*ap2;
-  uint16_t      i,j;
-  
-  if (o1->guid.oid!=OID_APP)
+  AppParams     *ap1, *ap2;
+  uint16_t      i, j;
+
+  if (o1->guid.oid != OID_APP)
     return ORTE_FALSE;
 
-  ap1=o1->attributes;
-  ap2=o2->attributes;
-  for (i=0;i<ap1->metatrafficMulticastIPAddressCount;i++) {
-    for (j=0;j<ap2->metatrafficMulticastIPAddressCount;j++) {
-      if (ap1->metatrafficMulticastIPAddressList[i]==
-          ap2->metatrafficMulticastIPAddressList[j])
-         return ORTE_TRUE;
+  ap1 = o1->attributes;
+  ap2 = o2->attributes;
+  for (i = 0; i < ap1->metatrafficMulticastIPAddressCount; i++) {
+    for (j = 0; j < ap2->metatrafficMulticastIPAddressCount; j++) {
+      if (ap1->metatrafficMulticastIPAddressList[i] ==
+         ap2->metatrafficMulticastIPAddressList[j])
+       return ORTE_TRUE;
     }
   }
   return ORTE_FALSE;
@@ -261,29 +269,30 @@ matchMulticastAddresses(ObjectEntryOID *o1,ObjectEntryOID *o2)
  * @alive:
  *
  */
-void 
+void
 appSelfParamChanged(ORTEDomain *d,
-    Boolean lock,Boolean unlock,Boolean forWM,Boolean alive) {
+                   Boolean lock, Boolean unlock, Boolean forWM, Boolean alive)
+{
   CSChange     *csChange;
-     
+
   if (lock) {
     pthread_rwlock_wrlock(&d->writerApplicationSelf.lock);
     if (forWM)
       pthread_rwlock_wrlock(&d->writerManagers.lock);
   }
-  csChange=(CSChange*)MALLOC(sizeof(CSChange));
-  parameterUpdateCSChange(csChange,d->appParams,ORTE_TRUE);
-  csChange->guid=d->guid;
-  csChange->alive=alive;
-  csChange->cdrCodec.buffer=NULL;
-  CSTWriterAddCSChange(d,&d->writerApplicationSelf,csChange);
+  csChange = (CSChange *)MALLOC(sizeof(CSChange));
+  parameterUpdateCSChange(csChange, d->appParams, ORTE_TRUE);
+  csChange->guid = d->guid;
+  csChange->alive = alive;
+  csChange->cdrCodec.buffer = NULL;
+  CSTWriterAddCSChange(d, &d->writerApplicationSelf, csChange);
   if (forWM) {
-    csChange=(CSChange*)MALLOC(sizeof(CSChange));
-    parameterUpdateCSChange(csChange,d->appParams,ORTE_TRUE);
-    csChange->guid=d->guid;
-    csChange->alive=alive;
-    csChange->cdrCodec.buffer=NULL;
-    CSTWriterAddCSChange(d,&d->writerManagers,csChange);
+    csChange = (CSChange *)MALLOC(sizeof(CSChange));
+    parameterUpdateCSChange(csChange, d->appParams, ORTE_TRUE);
+    csChange->guid = d->guid;
+    csChange->alive = alive;
+    csChange->cdrCodec.buffer = NULL;
+    CSTWriterAddCSChange(d, &d->writerManagers, csChange);
   }
   if (unlock) {
     pthread_rwlock_unlock(&d->writerApplicationSelf.lock);
@@ -296,31 +305,32 @@ appSelfParamChanged(ORTEDomain *d,
  * getAppO2SRemoteReader - returns pointer to virtual multicat object in case multicast application
  * @d: pointer to an domain
  * @objectEntryOID:
- * @ap: pointer to an application 
+ * @ap: pointer to an application
  *
  */
 ObjectEntryOID *
-getAppO2SRemoteReader(ORTEDomain *d,ObjectEntryOID *objectEntryOID,
-    AppParams *ap) {
+getAppO2SRemoteReader(ORTEDomain *d, ObjectEntryOID *objectEntryOID,
+                     AppParams *ap)
+{
   GUID_RTPS         guid;
-  AppParams        *map;
+  AppParams         *map;
   IPAddress         maddr;
 
-  maddr=ap->metatrafficMulticastIPAddressList[0];
+  maddr = ap->metatrafficMulticastIPAddressList[0];
   if (ap->metatrafficMulticastIPAddressCount &&
       IN_MULTICAST(maddr)) {
-    map=(AppParams*)MALLOC(sizeof(AppParams));
-    guid.hid=maddr;
-    guid.aid=AID_UNKNOWN;
-    guid.oid=OID_APP;
-    objectEntryOID=objectEntryFind(d,&guid);
+    map = (AppParams *)MALLOC(sizeof(AppParams));
+    guid.hid = maddr;
+    guid.aid = AID_UNKNOWN;
+    guid.oid = OID_APP;
+    objectEntryOID = objectEntryFind(d, &guid);
     if (!objectEntryOID) {
-      memcpy(map,ap,sizeof(AppParams));
-      objectEntryOID=objectEntryAdd(d,&guid,(void*)map);
+      memcpy(map, ap, sizeof(AppParams));
+      objectEntryOID = objectEntryAdd(d, &guid, (void *)map);
       Domain2PortMulticastMetatraffic(d->domain,
-                                     objectEntryOID->multicastPort);
-      debug(9,2) ("new multicast application 0x%x-0x%x-0x%x temporary created\n",
-                   GUID_PRINTF(guid));
+                                     objectEntryOID->multicastPort);
+      debug(9, 2) ("new multicast application 0x%x-0x%x-0x%x temporary created\n",
+                  GUID_PRINTF(guid));
     }
   }
   return objectEntryOID;
@@ -334,26 +344,27 @@ getAppO2SRemoteReader(ORTEDomain *d,ObjectEntryOID *objectEntryOID,
  *
  */
 ObjectEntryOID *
-getSubsO2SRemoteReader(ORTEDomain *d,ObjectEntryOID *objectEntryOID,
-    ORTESubsProp *sp) {
-  AppParams        *map;
+getSubsO2SRemoteReader(ORTEDomain *d, ObjectEntryOID *objectEntryOID,
+                      ORTESubsProp *sp)
+{
+  AppParams         *map;
   GUID_RTPS         guid;
 
   if (IN_MULTICAST(sp->multicast)) {
-    map=(AppParams*)MALLOC(sizeof(AppParams));
-    guid.hid=sp->multicast;
-    guid.aid=AID_UNKNOWN;
-    guid.oid=OID_APP;
-    objectEntryOID=objectEntryFind(d,&guid);
+    map = (AppParams *)MALLOC(sizeof(AppParams));
+    guid.hid = sp->multicast;
+    guid.aid = AID_UNKNOWN;
+    guid.oid = OID_APP;
+    objectEntryOID = objectEntryFind(d, &guid);
     if (!objectEntryOID) {
       AppParamsInit(map);
-      map->metatrafficMulticastIPAddressList[0]=sp->multicast;
-      map->metatrafficMulticastIPAddressCount=1;
-      objectEntryOID=objectEntryAdd(d,&guid,(void*)map);
+      map->metatrafficMulticastIPAddressList[0] = sp->multicast;
+      map->metatrafficMulticastIPAddressCount = 1;
+      objectEntryOID = objectEntryAdd(d, &guid, (void *)map);
       Domain2PortMulticastUserdata(d->domain,
-                                  objectEntryOID->multicastPort);
-      debug(9,2) ("new subs. multicast application 0x%x-0x%x-0x%x temporary created\n",
-                   GUID_PRINTF(guid));
+                                  objectEntryOID->multicastPort);
+      debug(9, 2) ("new subs. multicast application 0x%x-0x%x-0x%x temporary created\n",
+                  GUID_PRINTF(guid));
     }
   }
   return objectEntryOID;
index f8889cdc7d676b1fb427d9e1572f6486ed5e4cee..72537276f49eb47d1923de5763772f6eadddd43e 100644 (file)
  *
  *  DEBUG:  section 11                  parameter
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
 /*****************************************************************************/
 void
-parameterPutString(ParameterSequence *ps,int8_t id,int8_t *sstr) 
+parameterPutString(ParameterSequence *ps, int8_t id, int8_t *sstr)
 {
   int               len;
 
-  len=strlen((char*)sstr)+1;
-  ps->parameterID=id;
-  ps->parameterLength=len;
-  ps->parameter=NULL;
+  len = strlen((char *)sstr)+1;
+  ps->parameterID = id;
+  ps->parameterLength = len;
+  ps->parameter = NULL;
 
-  if (MAX_PARAMETER_LOCAL_LENGTH<len) {
-     ps->parameter=(u_char*)MALLOC(len);
-     strncpy((char *)ps->parameter, (const char*)sstr,len);
+  if (MAX_PARAMETER_LOCAL_LENGTH < len) {
+    ps->parameter = (u_char *)MALLOC(len);
+    strncpy((char *)ps->parameter, (const char *)sstr, len);
   } else {
-     strncpy((char *)ps->parameterLocal.asStr, (const char*)sstr,len);
-  } 
+    strncpy((char *)ps->parameterLocal.asStr, (const char *)sstr, len);
+  }
 }
 
 /*****************************************************************************/
 int
-parameterDelete(CSChange *csChange) {
+parameterDelete(CSChange *csChange)
+{
   ParameterSequence *ps;
 
   ul_list_for_each(CSChangeAttributes,
-                   csChange,
-                   ps) {
+                  csChange,
+                  ps) {
     if ((ps->parameterLength) > MAX_PARAMETER_LOCAL_LENGTH)
       FREE(ps->parameter);
   }
   //ps is like one piece of memory
   if (CSChangeAttributes_first(csChange))
     FREE(CSChangeAttributes_first(csChange));
-  CSChangeAttributes_init_head(csChange);  
+  CSChangeAttributes_init_head(csChange);
   return ORTE_TRUE;
-} 
+}
 
 
 /*****************************************************************************/
 int
-parameterCodeCodecFromCSChange(CSChange *csChange,CDR_Codec *cdrCodec)
+parameterCodeCodecFromCSChange(CSChange *csChange, CDR_Codec *cdrCodec)
 {
   ParameterSequence *ps;
 
   ul_list_for_each(CSChangeAttributes,
-                   csChange,
-                   ps) {
+                  csChange,
+                  ps) {
 
-    if (CDR_put_ushort(cdrCodec,ps->parameterID)==CORBA_FALSE) return -1;
-    if (CDR_put_ushort(cdrCodec,ps->parameterLength)==CORBA_FALSE) return -1;
+    if (CDR_put_ushort(cdrCodec, ps->parameterID) == CORBA_FALSE)
+      return -1;
+    if (CDR_put_ushort(cdrCodec, ps->parameterLength) == CORBA_FALSE)
+      return -1;
 
-    debug(11,10) ("parameterCodeCodecToCSChange: parameterID-0x%x, len-%d\n",
-                  ps->parameterID,ps->parameterLength);
+    debug(11, 10) ("parameterCodeCodecToCSChange: parameterID-0x%x, len-%d\n",
+                  ps->parameterID, ps->parameterLength);
 
     switch (ps->parameterID) {
       case PID_SENTINEL:
-        break;
+       break;
       //NtpTime
       case PID_EXPIRATION_TIME:
       case PID_PERSISTENCE:
       case PID_MINIMUM_SEPARATION:
-        /* time in seconds */
-        if (CDR_put_long(cdrCodec, ps->parameterLocal.asNtpTime.seconds)==
-           CORBA_FALSE) return -1;
-        /* time in seconds / 2^32 */
-        if (CDR_put_ulong(cdrCodec, ps->parameterLocal.asNtpTime.fraction)==
-           CORBA_FALSE) return -1;     
-        break;
+       /* time in seconds */
+       if (CDR_put_long(cdrCodec, ps->parameterLocal.asNtpTime.seconds) ==
+           CORBA_FALSE)
+         return -1;
+       /* time in seconds / 2^32 */
+       if (CDR_put_ulong(cdrCodec, ps->parameterLocal.asNtpTime.fraction) ==
+           CORBA_FALSE)
+         return -1;
+       break;
       //CORBA_unsigned_long
       case PID_TYPE_CHECKSUM:
       case PID_STRENGTH:
@@ -112,67 +117,78 @@ parameterCodeCodecFromCSChange(CSChange *csChange,CDR_Codec *cdrCodec)
       case PID_USERDATA_MULTICAST_IPADDRESS:
       case PID_METATRAFFIC_UNICAST_PORT:
       case PID_USERDATA_UNICAST_PORT:
-        if (CDR_put_ulong(cdrCodec, ps->parameterLocal.asLong)==
-           CORBA_FALSE) return -1;     
-        break;
+       if (CDR_put_ulong(cdrCodec, ps->parameterLocal.asLong) ==
+           CORBA_FALSE)
+         return -1;
+       break;
       //VendorId
       case PID_VENDOR_ID:
-        if (CDR_put_octet(cdrCodec, ps->parameterLocal.asVendorId.major)==
-           CORBA_FALSE) return -1;     
-        if (CDR_put_octet(cdrCodec, ps->parameterLocal.asVendorId.minor)==
-           CORBA_FALSE) return -1;     
-        break;
+       if (CDR_put_octet(cdrCodec, ps->parameterLocal.asVendorId.major) ==
+           CORBA_FALSE)
+         return -1;
+       if (CDR_put_octet(cdrCodec, ps->parameterLocal.asVendorId.minor) ==
+           CORBA_FALSE)
+         return -1;
+       break;
       //ProtocolVersion
       case PID_PROTOCOL_VERSION:
-        if (CDR_put_octet(cdrCodec, ps->parameterLocal.asProtocolVersion.major)==
-           CORBA_FALSE) return -1;     
-        if (CDR_put_octet(cdrCodec, ps->parameterLocal.asProtocolVersion.minor)==
-           CORBA_FALSE) return -1;     
-        break;
+       if (CDR_put_octet(cdrCodec, ps->parameterLocal.asProtocolVersion.major) ==
+           CORBA_FALSE)
+         return -1;
+       if (CDR_put_octet(cdrCodec, ps->parameterLocal.asProtocolVersion.minor) ==
+           CORBA_FALSE)
+         return -1;
+       break;
       //SequenceNumber
       case PID_VARGAPPS_SEQUENCE_NUMBER_LAST:
-        if (CDR_put_ulong(cdrCodec, ps->parameterLocal.asSequenceNumber.high)==
-           CORBA_FALSE) return -1;     
-        if (CDR_put_ulong(cdrCodec, ps->parameterLocal.asSequenceNumber.low)==
-           CORBA_FALSE) return -1;     
-        break;
+       if (CDR_put_ulong(cdrCodec, ps->parameterLocal.asSequenceNumber.high) ==
+           CORBA_FALSE)
+         return -1;
+       if (CDR_put_ulong(cdrCodec, ps->parameterLocal.asSequenceNumber.low) ==
+           CORBA_FALSE)
+         return -1;
+       break;
       //Boolean
       case PID_EXPECTS_ACK:
-        if (CDR_put_octet(cdrCodec,ps->parameterLocal.asOctet)==
-           CORBA_FALSE) return -1;     
-        break;
+       if (CDR_put_octet(cdrCodec, ps->parameterLocal.asOctet) ==
+           CORBA_FALSE)
+         return -1;
+       break;
       //PathName,TypeName
       case PID_TOPIC:
-      case PID_TYPE_NAME:{
-        int wptr,len;
-       
-       wptr=cdrCodec->wptr;
-       
-        len=ps->parameterLength;
-        if (len % 4) {                   //length alignment to 4
-          len&=~3;
-          len+=4;
-        }
-       len+=4;                           //data size
-       cdrCodec->wptr-=2;                //new alignments value 
-        if (CDR_put_ushort(cdrCodec,(CORBA_unsigned_short)len)==CORBA_FALSE) return -1;        
-
-        if (ps->parameterLength>MAX_PARAMETER_LOCAL_LENGTH) {
-          if (CDR_put_string(cdrCodec,(char*)ps->parameter)==
-           CORBA_FALSE) return -1;     
-        } else {
-          if (CDR_put_string(cdrCodec,(char*)ps->parameterLocal.asStr)==
-           CORBA_FALSE) return -1;     
-        }
-
-        cdrCodec->wptr=wptr+len;
-        } break;
+      case PID_TYPE_NAME: {
+       int wptr, len;
+
+       wptr = cdrCodec->wptr;
+
+       len = ps->parameterLength;
+       if (len % 4) {                    //length alignment to 4
+         len &= ~3;
+         len += 4;
+       }
+       len += 4;                           //data size
+       cdrCodec->wptr -= 2;                //new alignments value
+       if (CDR_put_ushort(cdrCodec, (CORBA_unsigned_short)len) == CORBA_FALSE)
+         return -1;
+
+       if (ps->parameterLength > MAX_PARAMETER_LOCAL_LENGTH) {
+         if (CDR_put_string(cdrCodec, (char *)ps->parameter) ==
+             CORBA_FALSE)
+           return -1;
+       } else {
+         if (CDR_put_string(cdrCodec, (char *)ps->parameterLocal.asStr) ==
+             CORBA_FALSE)
+           return -1;
+       }
+
+       cdrCodec->wptr = wptr+len;
+      } break;
       case PID_PAD:
-        break;
+       break;
       default:
-        debug(11,1) ("parameterCodeCodecFromCSChange: undefined parameterID: %d\n",
-                      ps->parameterID);
-        break;
+       debug(11, 1) ("parameterCodeCodecFromCSChange: undefined parameterID: %d\n",
+                     ps->parameterID);
+       break;
     }
   }
   return 0;
@@ -180,58 +196,58 @@ parameterCodeCodecFromCSChange(CSChange *csChange,CDR_Codec *cdrCodec)
 
 /*****************************************************************************/
 int
-parameterDecodeCodecToCSChange(CSChange *csChange,CDR_Codec *cdrCodec)
+parameterDecodeCodecToCSChange(CSChange *csChange, CDR_Codec *cdrCodec)
 {
   ParameterId       parameterId;
   ParameterLength   parameterLength;
   ParameterSequence *ps;
-  uint16_t          counter=0;
-  unsigned int             rptr;
+  uint16_t          counter = 0;
+  unsigned int      rptr;
 
   CSChangeAttributes_init_head(csChange);
-  rptr=cdrCodec->rptr;
+  rptr = cdrCodec->rptr;
 
   //count number of parameters -> we need one memory allocation for ps
-  while (cdrCodec->rptr<cdrCodec->buf_len) {
-    if (CDR_get_ushort(cdrCodec,&parameterId)==CORBA_FALSE) 
+  while (cdrCodec->rptr < cdrCodec->buf_len) {
+    if (CDR_get_ushort(cdrCodec, &parameterId) == CORBA_FALSE)
       break;
-    if (CDR_get_ushort(cdrCodec,&parameterLength)==CORBA_FALSE) 
+    if (CDR_get_ushort(cdrCodec, &parameterLength) == CORBA_FALSE)
       break;
-    if (parameterId==PID_SENTINEL) 
+    if (parameterId == PID_SENTINEL)
       break;
     counter++;
-    cdrCodec->rptr+=parameterLength;
+    cdrCodec->rptr += parameterLength;
   }
 
-  ps=(ParameterSequence*)MALLOC(sizeof(ParameterSequence)*(counter+1));
-  cdrCodec->rptr=rptr;
+  ps = (ParameterSequence *)MALLOC(sizeof(ParameterSequence)*(counter+1));
+  cdrCodec->rptr = rptr;
 
   while (counter) {
-    CDR_get_ushort(cdrCodec,&parameterId);
-    CDR_get_ushort(cdrCodec,&parameterLength);
+    CDR_get_ushort(cdrCodec, &parameterId);
+    CDR_get_ushort(cdrCodec, &parameterLength);
 
-    ps->parameterID=parameterId;
-    ps->parameterLength=parameterLength;
-    ps->parameter=NULL;
+    ps->parameterID = parameterId;
+    ps->parameterLength = parameterLength;
+    ps->parameter = NULL;
 
     /* save start position of parameter */
-    rptr=cdrCodec->rptr;  
+    rptr = cdrCodec->rptr;
 
-    debug(11,10) ("parameterDecodeCodecToCSChange: parameterID-0x%x, len-%d\n",
-                  parameterId,parameterLength);
+    debug(11, 10) ("parameterDecodeCodecToCSChange: parameterID-0x%x, len-%d\n",
+                  parameterId, parameterLength);
     switch (parameterId) {
       case PID_SENTINEL:
-        counter=1;
-        break;
+       counter = 1;
+       break;
       //NtpTime
       case PID_EXPIRATION_TIME:
       case PID_PERSISTENCE:
       case PID_MINIMUM_SEPARATION:
-        /* time in seconds */
-        CDR_get_long(cdrCodec, &ps->parameterLocal.asNtpTime.seconds);
-        /* time in seconds / 2^32 */
-        CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&ps->parameterLocal.asNtpTime.fraction);
-        break;
+       /* time in seconds */
+       CDR_get_long(cdrCodec, &ps->parameterLocal.asNtpTime.seconds);
+       /* time in seconds / 2^32 */
+       CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&ps->parameterLocal.asNtpTime.fraction);
+       break;
       //CORBA_unsigned_long
       case PID_TYPE_CHECKSUM:
       case PID_STRENGTH:
@@ -245,317 +261,323 @@ parameterDecodeCodecToCSChange(CSChange *csChange,CDR_Codec *cdrCodec)
       case PID_USERDATA_MULTICAST_IPADDRESS:
       case PID_METATRAFFIC_UNICAST_PORT:
       case PID_USERDATA_UNICAST_PORT:
-        CDR_get_ulong(cdrCodec, &ps->parameterLocal.asLong);
-        break;
+       CDR_get_ulong(cdrCodec, &ps->parameterLocal.asLong);
+       break;
       //VendorId
       case PID_VENDOR_ID:
-        CDR_get_octet(cdrCodec, (CORBA_octet *)&ps->parameterLocal.asVendorId.major);
-        CDR_get_octet(cdrCodec, (CORBA_octet *)&ps->parameterLocal.asVendorId.minor);
-        break;
+       CDR_get_octet(cdrCodec, (CORBA_octet *)&ps->parameterLocal.asVendorId.major);
+       CDR_get_octet(cdrCodec, (CORBA_octet *)&ps->parameterLocal.asVendorId.minor);
+       break;
       //ProtocolVersion
       case PID_PROTOCOL_VERSION:
-        CDR_get_octet(cdrCodec, (CORBA_octet *)&ps->parameterLocal.asProtocolVersion.major);
-        CDR_get_octet(cdrCodec, (CORBA_octet *)&ps->parameterLocal.asProtocolVersion.minor);
-        break;
+       CDR_get_octet(cdrCodec, (CORBA_octet *)&ps->parameterLocal.asProtocolVersion.major);
+       CDR_get_octet(cdrCodec, (CORBA_octet *)&ps->parameterLocal.asProtocolVersion.minor);
+       break;
       //SequenceNumber
       case PID_VARGAPPS_SEQUENCE_NUMBER_LAST:
-        CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&ps->parameterLocal.asSequenceNumber.high);
-        CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&ps->parameterLocal.asSequenceNumber.low);
-        break;
+       CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&ps->parameterLocal.asSequenceNumber.high);
+       CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&ps->parameterLocal.asSequenceNumber.low);
+       break;
       //Boolean
       case PID_EXPECTS_ACK:
-        CDR_get_octet(cdrCodec, ps->parameterLocal.asStr);
-        break;
+       CDR_get_octet(cdrCodec, ps->parameterLocal.asStr);
+       break;
       //PathName,TypeName
       case PID_TOPIC:
-      case PID_TYPE_NAME:{
-        CORBA_unsigned_long len;
-
-       CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&len);  
-        cdrCodec->rptr-=4;
-       ps->parameterLength=(uint16_t)len;
-        if (ps->parameterLength>MAX_PARAMETER_LOCAL_LENGTH) {      
-          CDR_get_string(cdrCodec,(CORBA_char**)&ps->parameter);
-        } else {
-          CDR_get_string_buff(cdrCodec,(CORBA_char*)ps->parameterLocal.asStr);
-        }
-        } break;
+      case PID_TYPE_NAME: {
+       CORBA_unsigned_long len;
+
+       CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&len);
+       cdrCodec->rptr -= 4;
+       ps->parameterLength = (uint16_t)len;
+       if (ps->parameterLength > MAX_PARAMETER_LOCAL_LENGTH) {
+         CDR_get_string(cdrCodec, (CORBA_char **)&ps->parameter);
+       } else {
+         CDR_get_string_buff(cdrCodec, (CORBA_char *)ps->parameterLocal.asStr);
+       }
+      } break;
       case PID_PAD:
-        break;
+       break;
       default:
-        debug(11,1) ("parameterDecodeCodecToCSChange: undefined parameterID: %d\n",
-                      parameterId);
-        break;
+       debug(11, 1) ("parameterDecodeCodecToCSChange: undefined parameterID: %d\n",
+                     parameterId);
+       break;
     }
-    CSChangeAttributes_insert(csChange,ps);
+    CSChangeAttributes_insert(csChange, ps);
     ps++; //next ps
     counter--;
 
-    cdrCodec->rptr=rptr+parameterLength;  
+    cdrCodec->rptr = rptr+parameterLength;
   }
   //SENTINEL
-  ps->parameterID=PID_SENTINEL;
-  ps->parameterLength=0;
-  ps->parameter=NULL;
-  CSChangeAttributes_insert(csChange,ps);
+  ps->parameterID = PID_SENTINEL;
+  ps->parameterLength = 0;
+  ps->parameter = NULL;
+  CSChangeAttributes_insert(csChange, ps);
   return ORTE_TRUE;
 }
 
 /*****************************************************************************/
 int
 parameterUpdateCSChange(
-     CSChange *csChange,AppParams *ap,Boolean Manager) {
+  CSChange *csChange, AppParams *ap, Boolean Manager)
+{
   ParameterSequence *ps;
   int               i;
 
-  i=ap->managerKeyCount+
-    ap->metatrafficMulticastIPAddressCount+
-    ap->unicastIPAddressCount+7;
-  if (!Manager) i--;
+  i = ap->managerKeyCount+
+      ap->metatrafficMulticastIPAddressCount+
+      ap->unicastIPAddressCount+7;
+  if (!Manager)
+    i--;
   CSChangeAttributes_init_head(csChange);
-  ps=(ParameterSequence*)MALLOC(sizeof(ParameterSequence)*i);
+  ps = (ParameterSequence *)MALLOC(sizeof(ParameterSequence)*i);
   //EXPIRATION_TIME
-  ps->parameterID=PID_EXPIRATION_TIME;
-  ps->parameterLength=8;
-  memcpy(ps->parameterLocal.asStr,&ap->expirationTime,ps->parameterLength);
-  ps->parameter=NULL;
-  CSChangeAttributes_insert(csChange,ps);
-  ps++;  
+  ps->parameterID = PID_EXPIRATION_TIME;
+  ps->parameterLength = 8;
+  memcpy(ps->parameterLocal.asStr, &ap->expirationTime, ps->parameterLength);
+  ps->parameter = NULL;
+  CSChangeAttributes_insert(csChange, ps);
+  ps++;
   //MATATRAFFIC_MULTICAST_IPADDRESS
-  for (i=0;i<ap->metatrafficMulticastIPAddressCount;i++) {
-    ps->parameterID=PID_MATATRAFFIC_MULTICAST_IPADDRESS;
-    ps->parameterLength=4;
-    ps->parameterLocal.asIPAddress=ap->metatrafficMulticastIPAddressList[i];
-    ps->parameter=NULL;
-    CSChangeAttributes_insert(csChange,ps);
+  for (i = 0; i < ap->metatrafficMulticastIPAddressCount; i++) {
+    ps->parameterID = PID_MATATRAFFIC_MULTICAST_IPADDRESS;
+    ps->parameterLength = 4;
+    ps->parameterLocal.asIPAddress = ap->metatrafficMulticastIPAddressList[i];
+    ps->parameter = NULL;
+    CSChangeAttributes_insert(csChange, ps);
     ps++;
   }
   //METATRAFFIC_UNICAST_PORT
-  ps->parameterID=PID_METATRAFFIC_UNICAST_PORT;
-  ps->parameterLength=4;
-  ps->parameterLocal.asPort=ap->metatrafficUnicastPort;
-  ps->parameter=NULL;
-  CSChangeAttributes_insert(csChange,ps);
-  ps++;  
+  ps->parameterID = PID_METATRAFFIC_UNICAST_PORT;
+  ps->parameterLength = 4;
+  ps->parameterLocal.asPort = ap->metatrafficUnicastPort;
+  ps->parameter = NULL;
+  CSChangeAttributes_insert(csChange, ps);
+  ps++;
   //USERDATA_UNICAST_PORT
-  ps->parameterID=PID_USERDATA_UNICAST_PORT;
-  ps->parameterLength=4;
-  ps->parameterLocal.asPort=ap->userdataUnicastPort;
-  ps->parameter=NULL;
-  CSChangeAttributes_insert(csChange,ps);
-  ps++;  
+  ps->parameterID = PID_USERDATA_UNICAST_PORT;
+  ps->parameterLength = 4;
+  ps->parameterLocal.asPort = ap->userdataUnicastPort;
+  ps->parameter = NULL;
+  CSChangeAttributes_insert(csChange, ps);
+  ps++;
   //APP_IPADDRESS
-  for (i=0;i<ap->unicastIPAddressCount;i++) {
-    ps->parameterID=PID_APP_IPADDRESS;;
-    ps->parameterLength=4;
-    ps->parameterLocal.asIPAddress=ap->unicastIPAddressList[i];
-    ps->parameter=NULL;
-    CSChangeAttributes_insert(csChange,ps);
+  for (i = 0; i < ap->unicastIPAddressCount; i++) {
+    ps->parameterID = PID_APP_IPADDRESS;
+    ;
+    ps->parameterLength = 4;
+    ps->parameterLocal.asIPAddress = ap->unicastIPAddressList[i];
+    ps->parameter = NULL;
+    CSChangeAttributes_insert(csChange, ps);
     ps++;
   }
   //PROTOCOL_VERSION
-  ps->parameterID=PID_PROTOCOL_VERSION;
-  ps->parameterLength=2;
-  ps->parameterLocal.asProtocolVersion=ap->protocolVersion;
-  ps->parameter=NULL;
-  CSChangeAttributes_insert(csChange,ps);
-  ps++;  
+  ps->parameterID = PID_PROTOCOL_VERSION;
+  ps->parameterLength = 2;
+  ps->parameterLocal.asProtocolVersion = ap->protocolVersion;
+  ps->parameter = NULL;
+  CSChangeAttributes_insert(csChange, ps);
+  ps++;
   //VENDOR_ID
-  ps->parameterID=PID_VENDOR_ID;
-  ps->parameterLength=2;
-  ps->parameterLocal.asVendorId=ap->vendorId;
-  ps->parameter=NULL;
-  CSChangeAttributes_insert(csChange,ps);
-  ps++;  
+  ps->parameterID = PID_VENDOR_ID;
+  ps->parameterLength = 2;
+  ps->parameterLocal.asVendorId = ap->vendorId;
+  ps->parameter = NULL;
+  CSChangeAttributes_insert(csChange, ps);
+  ps++;
   if (Manager) {    //Manager
     //VARGAPPS_SEQUENCE_NUMBER_LAST
-    ps->parameterID=PID_VARGAPPS_SEQUENCE_NUMBER_LAST;
-    ps->parameterLength=8;
-    ps->parameterLocal.asSequenceNumber=ap->vargAppsSequenceNumber;
-    ps->parameter=NULL;
-    CSChangeAttributes_insert(csChange,ps);
-    ps++;  
+    ps->parameterID = PID_VARGAPPS_SEQUENCE_NUMBER_LAST;
+    ps->parameterLength = 8;
+    ps->parameterLocal.asSequenceNumber = ap->vargAppsSequenceNumber;
+    ps->parameter = NULL;
+    CSChangeAttributes_insert(csChange, ps);
+    ps++;
   }
   //MANAGER_KEY
-  for (i=0;i<ap->managerKeyCount;i++) {
-    ps->parameterID=PID_MANAGER_KEY;
-    ps->parameterLength=4;
-    ps->parameterLocal.asUInt32=ap->managerKeyList[i];
-    ps->parameter=NULL;
-    CSChangeAttributes_insert(csChange,ps);
+  for (i = 0; i < ap->managerKeyCount; i++) {
+    ps->parameterID = PID_MANAGER_KEY;
+    ps->parameterLength = 4;
+    ps->parameterLocal.asUInt32 = ap->managerKeyList[i];
+    ps->parameter = NULL;
+    CSChangeAttributes_insert(csChange, ps);
     ps++;
   }
   //SENTINEL
-  ps->parameterID=PID_SENTINEL;
-  ps->parameterLength=0;
-  ps->parameter=NULL;
-  CSChangeAttributes_insert(csChange,ps);
+  ps->parameterID = PID_SENTINEL;
+  ps->parameterLength = 0;
+  ps->parameter = NULL;
+  CSChangeAttributes_insert(csChange, ps);
   return 0;
-} 
+}
 
 /*****************************************************************************/
 int
-parameterUpdateCSChangeFromPublication(CSChange *csChange,ORTEPublProp *pp) {
+parameterUpdateCSChangeFromPublication(CSChange *csChange, ORTEPublProp *pp)
+{
   ParameterSequence *ps;
-  
+
   CSChangeAttributes_init_head(csChange);
-  ps=(ParameterSequence*)MALLOC(sizeof(ParameterSequence)*8);
+  ps = (ParameterSequence *)MALLOC(sizeof(ParameterSequence)*8);
   //persistence
-  ps->parameterID=PID_PERSISTENCE;
-  ps->parameterLength=8;
-  memcpy(ps->parameterLocal.asStr,&pp->persistence,ps->parameterLength);
-  ps->parameter=NULL;
-  CSChangeAttributes_insert(csChange,ps);
-  ps++;  
+  ps->parameterID = PID_PERSISTENCE;
+  ps->parameterLength = 8;
+  memcpy(ps->parameterLocal.asStr, &pp->persistence, ps->parameterLength);
+  ps->parameter = NULL;
+  CSChangeAttributes_insert(csChange, ps);
+  ps++;
   /* reliabitityOffered */
-  ps->parameterID=PID_RELIABILITY_OFFERED;
-  ps->parameterLength=4;
-  ps->parameterLocal.asUInt32=pp->reliabilityOffered;
-  ps->parameter=NULL;
-  CSChangeAttributes_insert(csChange,ps);
+  ps->parameterID = PID_RELIABILITY_OFFERED;
+  ps->parameterLength = 4;
+  ps->parameterLocal.asUInt32 = pp->reliabilityOffered;
+  ps->parameter = NULL;
+  CSChangeAttributes_insert(csChange, ps);
   ps++;
   /* sendQueueSize */
-  ps->parameterID=PID_SEND_QUEUE_SIZE;
-  ps->parameterLength=4;
-  ps->parameterLocal.asUInt32=pp->sendQueueSize;
-  ps->parameter=NULL;
-  CSChangeAttributes_insert(csChange,ps);
+  ps->parameterID = PID_SEND_QUEUE_SIZE;
+  ps->parameterLength = 4;
+  ps->parameterLocal.asUInt32 = pp->sendQueueSize;
+  ps->parameter = NULL;
+  CSChangeAttributes_insert(csChange, ps);
   ps++;
   /* strength */
-  ps->parameterID=PID_STRENGTH;
-  ps->parameterLength=4;
-  ps->parameterLocal.asUInt32=pp->strength;
-  ps->parameter=NULL;
-  CSChangeAttributes_insert(csChange,ps);
+  ps->parameterID = PID_STRENGTH;
+  ps->parameterLength = 4;
+  ps->parameterLocal.asUInt32 = pp->strength;
+  ps->parameter = NULL;
+  CSChangeAttributes_insert(csChange, ps);
   ps++;
   /* topic */
-  parameterPutString(ps,PID_TOPIC,pp->topic);
-  CSChangeAttributes_insert(csChange,ps);
-  ps++;  
+  parameterPutString(ps, PID_TOPIC, pp->topic);
+  CSChangeAttributes_insert(csChange, ps);
+  ps++;
   /* typeCheckSum */
-  ps->parameterID=PID_TYPE_CHECKSUM;
-  ps->parameterLength=4;
-  ps->parameterLocal.asUInt32=pp->typeChecksum;
-  ps->parameter=NULL;
-  CSChangeAttributes_insert(csChange,ps);
+  ps->parameterID = PID_TYPE_CHECKSUM;
+  ps->parameterLength = 4;
+  ps->parameterLocal.asUInt32 = pp->typeChecksum;
+  ps->parameter = NULL;
+  CSChangeAttributes_insert(csChange, ps);
   ps++;
   /* typeName */
-  parameterPutString(ps,PID_TYPE_NAME,pp->typeName);
-  CSChangeAttributes_insert(csChange,ps);
-  ps++;  
-  /* sentinel -> end */  
-  ps->parameterID=PID_SENTINEL;
-  ps->parameterLength=0;
-  ps->parameter=NULL;
-  CSChangeAttributes_insert(csChange,ps);
+  parameterPutString(ps, PID_TYPE_NAME, pp->typeName);
+  CSChangeAttributes_insert(csChange, ps);
+  ps++;
+  /* sentinel -> end */
+  ps->parameterID = PID_SENTINEL;
+  ps->parameterLength = 0;
+  ps->parameter = NULL;
+  CSChangeAttributes_insert(csChange, ps);
   return 0;
-} 
+}
 
 /*****************************************************************************/
 int
-parameterUpdateCSChangeFromSubscription(CSChange *csChange,ORTESubsProp *sp) {
+parameterUpdateCSChangeFromSubscription(CSChange *csChange, ORTESubsProp *sp)
+{
   ParameterSequence *ps;
-  
+
   CSChangeAttributes_init_head(csChange);
-  ps=(ParameterSequence*)MALLOC(sizeof(ParameterSequence)*8);
+  ps = (ParameterSequence *)MALLOC(sizeof(ParameterSequence)*8);
   //minimum separation
-  ps->parameterID=PID_MINIMUM_SEPARATION;
-  ps->parameterLength=8;
-  memcpy(ps->parameterLocal.asStr,&sp->minimumSeparation,ps->parameterLength);
-  ps->parameter=NULL;
-  CSChangeAttributes_insert(csChange,ps);
-  ps++;  
+  ps->parameterID = PID_MINIMUM_SEPARATION;
+  ps->parameterLength = 8;
+  memcpy(ps->parameterLocal.asStr, &sp->minimumSeparation, ps->parameterLength);
+  ps->parameter = NULL;
+  CSChangeAttributes_insert(csChange, ps);
+  ps++;
   /* receive queue size*/
-  ps->parameterID=PID_RECV_QUEUE_SIZE;
-  ps->parameterLength=4;
-  ps->parameterLocal.asUInt32=sp->recvQueueSize;
-  ps->parameter=NULL;
-  CSChangeAttributes_insert(csChange,ps);
+  ps->parameterID = PID_RECV_QUEUE_SIZE;
+  ps->parameterLength = 4;
+  ps->parameterLocal.asUInt32 = sp->recvQueueSize;
+  ps->parameter = NULL;
+  CSChangeAttributes_insert(csChange, ps);
   ps++;
   /* reliabitityRequested */
-  ps->parameterID=PID_RELIABILITY_REQUESTED;
-  ps->parameterLength=4;
-  ps->parameterLocal.asUInt32=sp->reliabilityRequested;
-  ps->parameter=NULL;
-  CSChangeAttributes_insert(csChange,ps);
+  ps->parameterID = PID_RELIABILITY_REQUESTED;
+  ps->parameterLength = 4;
+  ps->parameterLocal.asUInt32 = sp->reliabilityRequested;
+  ps->parameter = NULL;
+  CSChangeAttributes_insert(csChange, ps);
   ps++;
   /* topic */
-  parameterPutString(ps,PID_TOPIC,sp->topic);
-  CSChangeAttributes_insert(csChange,ps);
-  ps++;  
+  parameterPutString(ps, PID_TOPIC, sp->topic);
+  CSChangeAttributes_insert(csChange, ps);
+  ps++;
   /* typeCheckSum */
-  ps->parameterID=PID_TYPE_CHECKSUM;
-  ps->parameterLength=4;
-  ps->parameterLocal.asUInt32=sp->typeChecksum;
-  ps->parameter=NULL;
-  CSChangeAttributes_insert(csChange,ps);
+  ps->parameterID = PID_TYPE_CHECKSUM;
+  ps->parameterLength = 4;
+  ps->parameterLocal.asUInt32 = sp->typeChecksum;
+  ps->parameter = NULL;
+  CSChangeAttributes_insert(csChange, ps);
   ps++;
   /* typeName */
-  parameterPutString(ps,PID_TYPE_NAME,sp->typeName);
-  CSChangeAttributes_insert(csChange,ps);
-  ps++;  
+  parameterPutString(ps, PID_TYPE_NAME, sp->typeName);
+  CSChangeAttributes_insert(csChange, ps);
+  ps++;
   /* userdata multicast ipaddress */
-  ps->parameterID=PID_USERDATA_MULTICAST_IPADDRESS;
-  ps->parameterLength=4;
-  ps->parameterLocal.asIPAddress=sp->multicast;
-  ps->parameter=NULL;
-  CSChangeAttributes_insert(csChange,ps);
+  ps->parameterID = PID_USERDATA_MULTICAST_IPADDRESS;
+  ps->parameterLength = 4;
+  ps->parameterLocal.asIPAddress = sp->multicast;
+  ps->parameter = NULL;
+  CSChangeAttributes_insert(csChange, ps);
   ps++;
-  /* sentinel -> end */  
-  ps->parameterID=PID_SENTINEL;
-  ps->parameterLength=0;
-  ps->parameter=NULL;
-  CSChangeAttributes_insert(csChange,ps);
+  /* sentinel -> end */
+  ps->parameterID = PID_SENTINEL;
+  ps->parameterLength = 0;
+  ps->parameter = NULL;
+  CSChangeAttributes_insert(csChange, ps);
   return 0;
-} 
+}
 
 /*****************************************************************************/
 int
-parameterUpdateApplication(CSChange *csChange,AppParams *ap) {
+parameterUpdateApplication(CSChange *csChange, AppParams *ap)
+{
   ParameterSequence   *ps;
 
-  ap->managerKeyCount=0;
-  ap->metatrafficMulticastIPAddressCount=0;
-  ap->unicastIPAddressCount=0;
-  ap->appId=csChange->guid.aid;
-  ap->hostId=csChange->guid.hid;
-  ul_list_for_each(CSChangeAttributes,csChange,ps) {
+  ap->managerKeyCount = 0;
+  ap->metatrafficMulticastIPAddressCount = 0;
+  ap->unicastIPAddressCount = 0;
+  ap->appId = csChange->guid.aid;
+  ap->hostId = csChange->guid.hid;
+  ul_list_for_each(CSChangeAttributes, csChange, ps) {
     switch (ps->parameterID) {
       case PID_EXPIRATION_TIME:
-        ap->expirationTime=ps->parameterLocal.asNtpTime;
-        break;
+       ap->expirationTime = ps->parameterLocal.asNtpTime;
+       break;
       case PID_MANAGER_KEY:
-        ap->managerKeyList[ap->managerKeyCount]=
-            ps->parameterLocal.asUInt32;
-        ap->managerKeyCount++;
-        break;
+       ap->managerKeyList[ap->managerKeyCount] =
+         ps->parameterLocal.asUInt32;
+       ap->managerKeyCount++;
+       break;
       case PID_MATATRAFFIC_MULTICAST_IPADDRESS:
-        ap->metatrafficMulticastIPAddressList[ap->metatrafficMulticastIPAddressCount]=
-            ps->parameterLocal.asIPAddress;
-        ap->metatrafficMulticastIPAddressCount++;
-        break;
+       ap->metatrafficMulticastIPAddressList[ap->metatrafficMulticastIPAddressCount] =
+         ps->parameterLocal.asIPAddress;
+       ap->metatrafficMulticastIPAddressCount++;
+       break;
       case PID_APP_IPADDRESS:
-        ap->unicastIPAddressList[ap->unicastIPAddressCount]=
-            ps->parameterLocal.asIPAddress;
-        ap->unicastIPAddressCount++;
-        break;
+       ap->unicastIPAddressList[ap->unicastIPAddressCount] =
+         ps->parameterLocal.asIPAddress;
+       ap->unicastIPAddressCount++;
+       break;
       case PID_USERDATA_MULTICAST_IPADDRESS:
-        break;
+       break;
       case PID_METATRAFFIC_UNICAST_PORT:
-        ap->metatrafficUnicastPort=ps->parameterLocal.asPort;
-        break;
+       ap->metatrafficUnicastPort = ps->parameterLocal.asPort;
+       break;
       case PID_USERDATA_UNICAST_PORT:
-        ap->userdataUnicastPort=ps->parameterLocal.asPort;
-        break;
+       ap->userdataUnicastPort = ps->parameterLocal.asPort;
+       break;
       case PID_VENDOR_ID:
-        ap->vendorId=ps->parameterLocal.asVendorId;
-        break;
+       ap->vendorId = ps->parameterLocal.asVendorId;
+       break;
       case PID_PROTOCOL_VERSION:
-        ap->protocolVersion=ps->parameterLocal.asProtocolVersion;
-        break;
+       ap->protocolVersion = ps->parameterLocal.asProtocolVersion;
+       break;
       case PID_VARGAPPS_SEQUENCE_NUMBER_LAST:
-        ap->vargAppsSequenceNumber=ps->parameterLocal.asSequenceNumber;
-        break;
+       ap->vargAppsSequenceNumber = ps->parameterLocal.asSequenceNumber;
+       break;
     }
   }
   return 0;
@@ -563,41 +585,42 @@ parameterUpdateApplication(CSChange *csChange,AppParams *ap) {
 
 /*****************************************************************************/
 int
-parameterUpdatePublication(CSChange *csChange,ORTEPublProp *pp) {
+parameterUpdatePublication(CSChange *csChange, ORTEPublProp *pp)
+{
   ParameterSequence   *ps;
 
-  ul_list_for_each(CSChangeAttributes,csChange,ps) {
+  ul_list_for_each(CSChangeAttributes, csChange, ps) {
     switch (ps->parameterID) {
       case PID_EXPECTS_ACK:
-        pp->expectsAck=*(Boolean*)&ps->parameterLocal;
-      break;
+       pp->expectsAck = *(Boolean *)&ps->parameterLocal;
+       break;
       case PID_PERSISTENCE:
-        pp->persistence=ps->parameterLocal.asNtpTime;
-      break;
+       pp->persistence = ps->parameterLocal.asNtpTime;
+       break;
       case PID_RELIABILITY_OFFERED:
-        pp->reliabilityOffered=ps->parameterLocal.asUInt32;
-      break;
+       pp->reliabilityOffered = ps->parameterLocal.asUInt32;
+       break;
       case PID_SEND_QUEUE_SIZE:
-        pp->sendQueueSize=ps->parameterLocal.asUInt32;
-      break;
+       pp->sendQueueSize = ps->parameterLocal.asUInt32;
+       break;
       case PID_STRENGTH:
-        pp->strength=ps->parameterLocal.asUInt32;
-      break;
+       pp->strength = ps->parameterLocal.asUInt32;
+       break;
       case PID_TOPIC:
-        if (ps->parameterLength>MAX_PARAMETER_LOCAL_LENGTH)
-          strncpy((char *)pp->topic, (const char*)ps->parameter,ps->parameterLength);
-        else
-          strncpy((char *)pp->topic, (const char*)ps->parameterLocal.asStr,ps->parameterLength);
-      break;
+       if (ps->parameterLength > MAX_PARAMETER_LOCAL_LENGTH)
+         strncpy((char *)pp->topic, (const char *)ps->parameter, ps->parameterLength);
+       else
+         strncpy((char *)pp->topic, (const char *)ps->parameterLocal.asStr, ps->parameterLength);
+       break;
       case PID_TYPE_CHECKSUM:
-        pp->typeChecksum=ps->parameterLocal.asTypeChecksum;
-      break;
+       pp->typeChecksum = ps->parameterLocal.asTypeChecksum;
+       break;
       case PID_TYPE_NAME:
-        if (ps->parameterLength>MAX_PARAMETER_LOCAL_LENGTH)
-          strncpy((char *)pp->typeName, (const char*)ps->parameter,ps->parameterLength);
-        else
-          strncpy((char *)pp->typeName, (const char*)ps->parameterLocal.asStr,ps->parameterLength);
-      break;      
+       if (ps->parameterLength > MAX_PARAMETER_LOCAL_LENGTH)
+         strncpy((char *)pp->typeName, (const char *)ps->parameter, ps->parameterLength);
+       else
+         strncpy((char *)pp->typeName, (const char *)ps->parameterLocal.asStr, ps->parameterLength);
+       break;
     }
   }
   return 0;
@@ -605,40 +628,40 @@ parameterUpdatePublication(CSChange *csChange,ORTEPublProp *pp) {
 
 /*****************************************************************************/
 int
-parameterUpdateSubscription(CSChange *csChange,ORTESubsProp *sp) {
+parameterUpdateSubscription(CSChange *csChange, ORTESubsProp *sp)
+{
   ParameterSequence   *ps;
 
-  ul_list_for_each(CSChangeAttributes,csChange,ps) {
+  ul_list_for_each(CSChangeAttributes, csChange, ps) {
     switch (ps->parameterID) {
       case PID_MINIMUM_SEPARATION:
-        sp->minimumSeparation=ps->parameterLocal.asNtpTime;
-      break;
+       sp->minimumSeparation = ps->parameterLocal.asNtpTime;
+       break;
       case PID_RECV_QUEUE_SIZE:
-        sp->recvQueueSize=ps->parameterLocal.asUInt32;
-      break;
+       sp->recvQueueSize = ps->parameterLocal.asUInt32;
+       break;
       case PID_RELIABILITY_REQUESTED:
-        sp->reliabilityRequested=ps->parameterLocal.asUInt32;
-      break;
+       sp->reliabilityRequested = ps->parameterLocal.asUInt32;
+       break;
       case PID_TOPIC:
-        if (ps->parameterLength>MAX_PARAMETER_LOCAL_LENGTH)
-          strncpy((char *)sp->topic, (const char*)ps->parameter,ps->parameterLength);
-        else
-          strncpy((char *)sp->topic, (const char*)ps->parameterLocal.asStr,ps->parameterLength);
-      break;
+       if (ps->parameterLength > MAX_PARAMETER_LOCAL_LENGTH)
+         strncpy((char *)sp->topic, (const char *)ps->parameter, ps->parameterLength);
+       else
+         strncpy((char *)sp->topic, (const char *)ps->parameterLocal.asStr, ps->parameterLength);
+       break;
       case PID_TYPE_CHECKSUM:
-        sp->typeChecksum=ps->parameterLocal.asTypeChecksum;
-      break;
+       sp->typeChecksum = ps->parameterLocal.asTypeChecksum;
+       break;
       case PID_TYPE_NAME:
-        if (ps->parameterLength>MAX_PARAMETER_LOCAL_LENGTH)
-          strncpy((char *)sp->typeName, (const char*)ps->parameter,ps->parameterLength);
-        else
-          strncpy((char *)sp->typeName, (const char*)ps->parameterLocal.asStr,ps->parameterLength);
-      break;
+       if (ps->parameterLength > MAX_PARAMETER_LOCAL_LENGTH)
+         strncpy((char *)sp->typeName, (const char *)ps->parameter, ps->parameterLength);
+       else
+         strncpy((char *)sp->typeName, (const char *)ps->parameterLocal.asStr, ps->parameterLength);
+       break;
       case PID_USERDATA_MULTICAST_IPADDRESS:
-        sp->multicast=ps->parameterLocal.asIPAddress;
-      break;
+       sp->multicast = ps->parameterLocal.asIPAddress;
+       break;
     }
   }
   return 0;
 }
-
index 5b3a1dcb4b276d209d6aff94b2c3b87de25b4231..2ada83bee0067b010b5b311855a4dbaac151e838 100644 (file)
@@ -1,48 +1,49 @@
 /*
- *  $Id: sock.c,v 0.0.0.1               2003/08/21 
+ *  $Id: sock.c,v 0.0.0.1               2003/08/21
  *
- *  DEBUG:  section 6                   Socket 
+ *  DEBUG:  section 6                   Socket
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #include "orte_all.h"
 
 /*********************************************************************/
 int
-sock_start(void) {
+sock_start(void)
+{
 #if defined(SOCK_BSD) || defined (SOCK_RTLWIP)
   return 0;
 #elif defined (SOCK_WIN)
   WORD wVersionRequested;
   WSADATA wsaData;
   #ifdef SOCK_WIN_PHARLAP
-    wVersionRequested = MAKEWORD(1, 1);
+  wVersionRequested = MAKEWORD(1, 1);
   #else
-    wVersionRequested = MAKEWORD(2, 0);
+  wVersionRequested = MAKEWORD(2, 0);
   #endif
   return WSAStartup(wVersionRequested, &wsaData);
 #endif
@@ -50,7 +51,8 @@ sock_start(void) {
 
 /*********************************************************************/
 inline void
-sock_finish(void) {
+sock_finish(void)
+{
 #if defined(SOCK_WIN)
   WSACleanup();
 #endif
@@ -58,15 +60,18 @@ sock_finish(void) {
 
 /*********************************************************************/
 int
-sock_init_udp(sock_t *sock) {
+sock_init_udp(sock_t *sock)
+{
   sock->fd = socket(AF_INET, SOCK_DGRAM, 0);
-  if (sock->fd < 0) return -1;
+  if (sock->fd < 0)
+    return -1;
   return 0;
 }
 
 /*********************************************************************/
 inline void
-sock_cleanup(sock_t *sock) {
+sock_cleanup(sock_t *sock)
+{
 #if defined(SOCK_BSD)
   close(sock->fd);
 #elif defined(SOCK_RTLWIP)
@@ -78,8 +83,9 @@ sock_cleanup(sock_t *sock) {
 
 /*********************************************************************/
 inline int
-sock_setsockopt(sock_t *sock,int level,int optname,const char *optval, int optlen) {
-  if (setsockopt(sock->fd, level, optname,(void *)optval, optlen)) {
+sock_setsockopt(sock_t *sock, int level, int optname, const char *optval, int optlen)
+{
+  if (setsockopt(sock->fd, level, optname, (void *)optval, optlen)) {
     sock_cleanup(sock);
     return -1;
   }
@@ -88,8 +94,9 @@ sock_setsockopt(sock_t *sock,int level,int optname,const char *optval, int optle
 
 /*********************************************************************/
 inline int
-sock_getsockopt(sock_t *sock,int level,int optname,char *optval, int *optlen) {
-  if (getsockopt(sock->fd, level, optname,(void *)optval, (socklen_t *)optlen)) {
+sock_getsockopt(sock_t *sock, int level, int optname, char *optval, int *optlen)
+{
+  if (getsockopt(sock->fd, level, optname, (void *)optval, (socklen_t *)optlen)) {
     sock_cleanup(sock);
     return -1;
   }
@@ -98,72 +105,76 @@ sock_getsockopt(sock_t *sock,int level,int optname,char *optval, int *optlen) {
 
 /*********************************************************************/
 int
-sock_bind(sock_t *sock,uint16_t port, IPAddress listen) {
+sock_bind(sock_t *sock, uint16_t port, IPAddress listen)
+{
   struct sockaddr_in name;
   int size;
 
   name.sin_family = AF_INET;
   name.sin_port = htons(port);
   name.sin_addr.s_addr = htonl(listen);
-  if (bind(sock->fd, 
-          #ifndef CONFIG_ORTE_RTL_ONETD 
-            (struct sockaddr *)
-          #endif
-          &name, sizeof(name)) < 0) {
+  if (bind(sock->fd,
+         #ifndef CONFIG_ORTE_RTL_ONETD
+          (struct sockaddr *)
+         #endif
+          &name, sizeof(name)) < 0) {
     sock_cleanup(sock);
     return -1;
   }
   size = sizeof(name);
   if (getsockname(sock->fd,
-         #ifndef CONFIG_ORTE_RTL_ONETD 
-          (struct sockaddr *)
-         #endif
-        &name, 
-         #ifndef CONFIG_ORTE_RTL_ONETD 
-           (socklen_t *)&size
-         #else
-          size 
-         #endif
-        ) < 0) {
+        #ifndef CONFIG_ORTE_RTL_ONETD
+                 (struct sockaddr *)
+        #endif
+                 &name,
+        #ifndef CONFIG_ORTE_RTL_ONETD
+                 (socklen_t *)&size
+        #else
+                 size
+        #endif
+                 ) < 0) {
     sock_cleanup(sock);
     return -1;
   }
-  sock->port=ntohs(name.sin_port);
+  sock->port = ntohs(name.sin_port);
   return 0;
 }
 
 /*********************************************************************/
 inline int
-sock_recvfrom(sock_t *sock, void *buf, int max_len,struct sockaddr_in *des,int des_len) {
+sock_recvfrom(sock_t *sock, void *buf, int max_len, struct sockaddr_in *des, int des_len)
+{
   return recvfrom(sock->fd, buf, max_len, 0,
-    #ifndef CONFIG_ORTE_RTL_ONETD 
-      (struct sockaddr*)
+    #ifndef CONFIG_ORTE_RTL_ONETD
+                 (struct sockaddr *)
     #endif
-    des,(socklen_t *)&des_len);
+                 des, (socklen_t *)&des_len);
 }
 
 /*********************************************************************/
 inline int
-sock_sendto(sock_t *sock, void *buf, int len,struct sockaddr_in *des,int des_len) {
+sock_sendto(sock_t *sock, void *buf, int len, struct sockaddr_in *des, int des_len)
+{
   return sendto(sock->fd, buf, len, 0,
-    #ifndef CONFIG_ORTE_RTL_ONETD 
-      (struct sockaddr*)
+    #ifndef CONFIG_ORTE_RTL_ONETD
+               (struct sockaddr *)
     #endif
-    des,des_len);
+               des, des_len);
 }
 
 /*********************************************************************/
 inline int
-sock_ioctl(sock_t *sock, long cmd, unsigned long *arg) {
+sock_ioctl(sock_t *sock, long cmd, unsigned long *arg)
+{
   return ioctl(sock->fd, cmd, arg);
 }
 
 /*********************************************************************/
 
 #if 0
-  #define SOCK_INTF_DEBUG(...) printf( __VA_ARGS__ )
+  #define SOCK_INTF_DEBUG(...) printf(__VA_ARGS__)
 #else
-  #define SOCK_INTF_DEBUG(...) do {;} while(0)
+  #define SOCK_INTF_DEBUG(...) do {; } while (0)
 #endif
 
 #ifdef HAVE_IFADDRS_H
@@ -171,7 +182,8 @@ sock_ioctl(sock_t *sock, long cmd, unsigned long *arg) {
 #endif /*HAVE_IFADDRS_H*/
 
 int
-sock_get_local_interfaces(sock_t *sock,ORTEIFProp *IFProp,char *IFCount) {
+sock_get_local_interfaces(sock_t *sock, ORTEIFProp *IFProp, char *IFCount)
+{
 #if defined(HAVE_IFADDRS_H)
   struct ifaddrs *ifa = NULL;
   struct ifaddrs *ifa_it;
@@ -187,25 +199,25 @@ sock_get_local_interfaces(sock_t *sock,ORTEIFProp *IFProp,char *IFCount) {
       continue;
     }
     SOCK_INTF_DEBUG("interace %s SA_%d addr 0x%08lx flags 0x%08lx %s %s ... ",
-           ifa_it->ifa_name,
-           ifa_it->ifa_addr->sa_family,
-           (unsigned long)ntohl(((struct sockaddr_in*)(ifa_it->ifa_addr))->sin_addr.s_addr),
-           (unsigned long)ifa_it->ifa_flags,
-           ifa_it->ifa_flags & IFF_UP? "up":"down",
-           ifa_it->ifa_flags & IFF_LOOPBACK? "loopback":"");
+                   ifa_it->ifa_name,
+                   ifa_it->ifa_addr->sa_family,
+                   (unsigned long)ntohl(((struct sockaddr_in *)(ifa_it->ifa_addr))->sin_addr.s_addr),
+                   (unsigned long)ifa_it->ifa_flags,
+                   ifa_it->ifa_flags & IFF_UP ? "up" : "down",
+                   ifa_it->ifa_flags & IFF_LOOPBACK ? "loopback" : "");
 
     if (!(ifa_it->ifa_flags & IFF_UP) || (ifa_it->ifa_flags & IFF_LOOPBACK) ||
-        (ifa_it->ifa_addr->sa_family != AF_INET)) {
+       (ifa_it->ifa_addr->sa_family != AF_INET)) {
       SOCK_INTF_DEBUG("skipped\n");
       continue;
     }
     SOCK_INTF_DEBUG("used\n");
 
     (*IFCount)++;
-    IFProp->ifFlags=ifa_it->ifa_flags;
-    IFProp->ipAddress=ntohl(((struct sockaddr_in*)(ifa_it->ifa_addr))->sin_addr.s_addr);
+    IFProp->ifFlags = ifa_it->ifa_flags;
+    IFProp->ipAddress = ntohl(((struct sockaddr_in *)(ifa_it->ifa_addr))->sin_addr.s_addr);
     IFProp++;
-    if(*IFCount >= MAX_INTERFACES)
+    if (*IFCount >= MAX_INTERFACES)
       break;
   }
 
@@ -225,29 +237,29 @@ sock_get_local_interfaces(sock_t *sock,ORTEIFProp *IFProp,char *IFCount) {
     ifc.ifc_len = 2 * 1024;
   ifc.ifc_buf = buf = malloc(ifc.ifc_len);
 
-  *IFCount=0;
+  *IFCount = 0;
   res = ioctl(sock->fd, SIOCGIFCONF, &ifc);
   if (res < 0) {
-     SOCK_INTF_DEBUG("ioctl(sock->fd, SIOCGIFCONF) failed\n");
-     free(buf);
-     return -1;
+    SOCK_INTF_DEBUG("ioctl(sock->fd, SIOCGIFCONF) failed\n");
+    free(buf);
+    return -1;
   }
   SOCK_INTF_DEBUG("ioctl(sock->fd, SIOCGIFCONF) returned %d\n", res);
-  for(i=0; i < ifc.ifc_len; i++)
-     SOCK_INTF_DEBUG(" %02x", buf[i]);
+  for (i = 0; i < ifc.ifc_len; i++)
+    SOCK_INTF_DEBUG(" %02x", buf[i]);
   SOCK_INTF_DEBUG("\n");
 
   SOCK_INTF_DEBUG("sizeof(struct sockaddr) %d, sizeof(struct ifreq) %d ifc.ifc_len %d\n",
-         (int)sizeof(struct sockaddr),
-         (int)sizeof(struct ifreq),
-         ifc.ifc_len);
+                 (int)sizeof(struct sockaddr),
+                 (int)sizeof(struct ifreq),
+                 ifc.ifc_len);
 
-  for (ptr = buf; ptr < (buf + ifc.ifc_len);) {
-    struct ifreq*     ifr = (struct ifreq*) ptr;
+  for (ptr = buf; ptr < (buf + ifc.ifc_len); ) {
+    struct ifreq *ifr = (struct ifreq *)ptr;
     struct sockaddr   addr;
     size_t            addr_len = sizeof(addr);
 
-    if(buf + ifc.ifc_len - ptr < sizeof(struct ifreq)) {
+    if (buf + ifc.ifc_len - ptr < sizeof(struct ifreq)) {
       SOCK_INTF_DEBUG("truncated ifreq entry\n");
       break;
     }
@@ -257,50 +269,51 @@ sock_get_local_interfaces(sock_t *sock,ORTEIFProp *IFProp,char *IFCount) {
    #ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
     addr_len = addr.sa_len;
     if ((addr_len > sizeof(addr)) || SOCK_SIOCGIFCONF_SA_LEN_UNCONDITIONAL)
-      ptr = addr_len + (char*)&ifr->ifr_addr;
+      ptr = addr_len + (char *)&ifr->ifr_addr;
     else
    #endif /*HAVE_STRUCT_SOCKADDR_SA_LEN*/
-      ptr += sizeof(struct ifreq);
+    ptr += sizeof(struct ifreq);
 
     res = ioctl(sock->fd, SIOCGIFFLAGS, ifr);
 
     SOCK_INTF_DEBUG("interace %s SA_%d addr 0x%08lx len %d flags 0x%08lx %s %s SIOCGIFFLAGS res %d\n",
-           ifr->ifr_name,
-           addr.sa_family,
-           (unsigned long)ntohl(((struct sockaddr_in*)&addr)->sin_addr.s_addr),
-           (int)addr_len,
-           (unsigned long)ifr->ifr_flags,
-           ifr->ifr_flags & IFF_UP? "up":"down",
-           ifr->ifr_flags & IFF_LOOPBACK? "loopback":"",
-           res);
+                   ifr->ifr_name,
+                   addr.sa_family,
+                   (unsigned long)ntohl(((struct sockaddr_in *)&addr)->sin_addr.s_addr),
+                   (int)addr_len,
+                   (unsigned long)ifr->ifr_flags,
+                   ifr->ifr_flags & IFF_UP ? "up" : "down",
+                   ifr->ifr_flags & IFF_LOOPBACK ? "loopback" : "",
+                   res);
 
     if ((ifr->ifr_flags & IFF_UP) && !(ifr->ifr_flags & IFF_LOOPBACK) &&
-        (addr.sa_family == AF_INET)) {
+       (addr.sa_family == AF_INET)) {
       (*IFCount)++;
-      IFProp->ifFlags=ifr->ifr_flags;
-      IFProp->ipAddress=ntohl(((struct sockaddr_in*)&addr)->sin_addr.s_addr);
+      IFProp->ifFlags = ifr->ifr_flags;
+      IFProp->ipAddress = ntohl(((struct sockaddr_in *)&addr)->sin_addr.s_addr);
       IFProp++;
-      if(*IFCount >= MAX_INTERFACES)
-        break;
+      if (*IFCount >= MAX_INTERFACES)
+       break;
     }
   }
   free(buf);
   return 0;
 #elif defined(SOCK_RTLWIP)
   /* loopback iface is recognized if it has this address */
-  char ip_address [] = "127.0.0.1";
+  char ip_address[] = "127.0.0.1";
   struct in_addr loopaddr;
   int i;
 
-  *IFCount=0;
-  if (inet_aton(ip_address, &loopaddr) != 0) return -1;
-  
+  *IFCount = 0;
+  if (inet_aton(ip_address, &loopaddr) != 0)
+    return -1;
+
   for (i = 0; i < NIC_TABLE_SIZE; i++) {
-    if (nic_table [i].nic_struct != NULL) {
+    if (nic_table[i].nic_struct != NULL) {
       if (nic_table[i].ipad.s_addr != loopaddr.s_addr) {
        (*IFCount)++;
-       IFProp->ifFlags=0; //RT-Linux doesn't flags
-       IFProp->ipAddress=ntohl(nic_table[i].ipad.s_addr);
+       IFProp->ifFlags = 0; //RT-Linux doesn't flags
+       IFProp->ipAddress = ntohl(nic_table[i].ipad.s_addr);
        IFProp++;
       }
     }
@@ -334,27 +347,26 @@ sock_get_local_interfaces(sock_t *sock,ORTEIFProp *IFProp,char *IFCount) {
   return 0;
 #elif defined(SOCK_WIN)
   INTERFACE_INFO      InterfaceList[MAX_INTERFACES];
-  struct sockaddr_in* pAddress;
-  unsigned long       len,i;
-
-  *IFCount=0;
-  if (WSAIoctl(sock->fd,SIO_GET_INTERFACE_LIST,NULL,0,
-               InterfaceList, sizeof(InterfaceList),
-               &len, NULL, NULL)==SOCKET_ERROR) return -1;
-  len=len/sizeof(INTERFACE_INFO);
-  for(i=0;i<len;i++) {
+  struct sockaddr_in *pAddress;
+  unsigned long       len, i;
+
+  *IFCount = 0;
+  if (WSAIoctl(sock->fd, SIO_GET_INTERFACE_LIST, NULL, 0,
+              InterfaceList, sizeof(InterfaceList),
+              &len, NULL, NULL) == SOCKET_ERROR)
+    return -1;
+  len = len/sizeof(INTERFACE_INFO);
+  for (i = 0; i < len; i++) {
     long  nFlags;
-    pAddress = (struct sockaddr_in*)&(InterfaceList[i].iiAddress);
+    pAddress = (struct sockaddr_in *)&(InterfaceList[i].iiAddress);
     nFlags = InterfaceList[i].iiFlags;
     if ((nFlags & IFF_UP) && !(nFlags & IFF_LOOPBACK)) {
-      IFProp->ifFlags=nFlags;
-      IFProp->ipAddress=ntohl(pAddress->sin_addr.s_addr);
+      IFProp->ifFlags = nFlags;
+      IFProp->ipAddress = ntohl(pAddress->sin_addr.s_addr);
       IFProp++;
       (*IFCount)++;
     }
   }
   return 0;
-#endif
+#endif /* if defined(HAVE_IFADDRS_H) */
 }
-
-
index c6c29a34a79ec27d7c505867ae91472749dca533..9e86a69c33a03adc8b00b65c5f02c08e4f67220c 100644 (file)
@@ -3,18 +3,18 @@
  *
  *  DEBUG:  section                     Manager
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
@@ -28,7 +28,7 @@
  *  GNU General Public License for more details.
  *
  */
+
 #include "orte_all.h"
 
 #ifdef HAVE_INTTYPES_H
 //global variables
 static ORTEDomain          *d;
 static ORTEDomainProp      dp;
-static int32_t             opt,domain=ORTE_DEFAULT_DOMAIN;
-static Boolean             orteDaemon=ORTE_FALSE;
-static Boolean             orteWinService=ORTE_FALSE;
-static ORTEDomainAppEvents *events=NULL;
+static int32_t             opt, domain = ORTE_DEFAULT_DOMAIN;
+static Boolean             orteDaemon = ORTE_FALSE;
+static Boolean             orteWinService = ORTE_FALSE;
+static ORTEDomainAppEvents *events = NULL;
 
 //event system
 Boolean
-onMgrAppRemoteNew(const struct ORTEAppInfo *appInfo, void *param) {
-  printf("%s 0x%"ORTE_PRI_HostId"-0x%"ORTE_PRI_AppId" was accepted\n",
-         (appInfo->appId & 0x3)==MANAGER ? "manager" : "application",
-         appInfo->hostId,appInfo->appId);
+onMgrAppRemoteNew(const struct ORTEAppInfo *appInfo, void *param)
+{
+  printf("%s 0x%"ORTE_PRI_HostId "-0x%"ORTE_PRI_AppId " was accepted\n",
+        (appInfo->appId & 0x3) == MANAGER ? "manager" : "application",
+        appInfo->hostId, appInfo->appId);
   return ORTE_TRUE;
 }
 
 void
-onMgrAppDelete(const struct ORTEAppInfo *appInfo, void *param) {
-  printf("%s 0x%"ORTE_PRI_HostId"-0x%"ORTE_PRI_AppId" was deleted\n",
-         (appInfo->appId & 0x3)==MANAGER ? "manager" : "application",
-         appInfo->hostId,appInfo->appId);
+onMgrAppDelete(const struct ORTEAppInfo *appInfo, void *param)
+{
+  printf("%s 0x%"ORTE_PRI_HostId "-0x%"ORTE_PRI_AppId " was deleted\n",
+        (appInfo->appId & 0x3) == MANAGER ? "manager" : "application",
+        appInfo->hostId, appInfo->appId);
 }
 
 #if defined(_WIN32) || defined(__CYGWIN__)
 //Windows service support
-void serviceDispatchTable(void);  //forward declaration
-void removeService(void);         //forward declaration
-void installService(void);        //forward declaration
-int managerInit(void) {
-  d=ORTEDomainMgrCreate(domain,&dp,events,ORTE_TRUE);
-  if (d==NULL) return -1;
+void
+serviceDispatchTable(void);       //forward declaration
+void
+removeService(void);              //forward declaration
+void
+installService(void);             //forward declaration
+int
+managerInit(void)
+{
+  d = ORTEDomainMgrCreate(domain, &dp, events, ORTE_TRUE);
+  if (d == NULL)
+    return -1;
   return 0;
 }
-int managerStart(void) {
-  ORTEDomainStart(d,ORTE_TRUE,ORTE_FALSE,ORTE_FALSE,ORTE_FALSE,ORTE_TRUE);
+int
+managerStart(void)
+{
+  ORTEDomainStart(d, ORTE_TRUE, ORTE_FALSE, ORTE_FALSE, ORTE_FALSE, ORTE_TRUE);
   return 0;
 }
-int managerStop(void) {
+int
+managerStop(void)
+{
   ORTEDomainMgrDestroy(d);
   return 0;
 }
@@ -96,32 +108,37 @@ int managerStop(void) {
 
 #ifdef CONFIG_ORTE_UNIX
 #ifdef HAVE_SYS_STAT_H
-  #include <sys/stat.h>                /* For umask() */
+  #include <sys/stat.h>         /* For umask() */
 #endif
 //Unix daemon support
-void waitForEndingCommand(void) {
-       sigset_t sigset;
-       sigemptyset(&sigset);
-       sigaddset(&sigset, SIGINT);
-       sigaddset(&sigset, SIGTERM);
-       {
+void
+waitForEndingCommand(void)
+{
+  sigset_t sigset;
+
+  sigemptyset(&sigset);
+  sigaddset(&sigset, SIGINT);
+  sigaddset(&sigset, SIGTERM);
+  {
        #ifdef HAVE_SIGWAITINFO
-               sigwaitinfo(&sigset, NULL);
+    sigwaitinfo(&sigset, NULL);
        #else /*HAVE_SIGWAITINFO*/
-               int sig;
-               sigwait(&sigset, &sig);
+    int sig;
+    sigwait(&sigset, &sig);
        #endif /*HAVE_SIGWAITINFO*/
-       }
+  }
 }
-static int daemonInit(void) {
+static int
+daemonInit(void)
+{
   pid_t pid;
 
   if ((pid = fork()) < 0) {
     return -1;
   } else
-    if (pid != 0) {
-      exit(0); /* parent vanishes */
-    }
+  if (pid != 0) {
+    exit(0);    /* parent vanishes */
+  }
   /* child process */
   setsid();
   umask(0);
@@ -130,9 +147,11 @@ static int daemonInit(void) {
   close(2);
   return 0;
 }
-#endif
+#endif /* ifdef CONFIG_ORTE_UNIX */
 
-static void usage(void) {
+static void
+usage(void)
+{
   printf("usage: ortemanager <parameters> \n");
   printf("  -p, --peer <IPAdd:IPAdd:...>  possible locations of fellow managers\n");
   printf("  -k, --key  <IPAdd:IPAdd:...>  manualy assigned manager's keys\n");
@@ -159,27 +178,29 @@ static void usage(void) {
   printf("  -h, --help                    this usage screen\n");
 }
 
-int main(int argc,char *argv[]) {
+int
+main(int argc, char *argv[])
+{
 #if defined HAVE_GETOPT_LONG || defined HAVE_GETOPT_LONG_ORTE
   static struct option long_opts[] = {
-    { "peer",1,0, 'p' },
-    { "key",1,0, 'k' },
-    { "domain",1,0, 'd' },
-    { "verbosity",1,0, 'v' },
-    { "refresh",1,0, 'R' },
-    { "purge",1,0, 'P' },
-    { "metaMulticast",1,0, 'I' },
-    { "timetolive",1,0, 't' },
-    { "listen",1,0, 'L' },
+    { "peer", 1, 0, 'p' },
+    { "key", 1, 0, 'k' },
+    { "domain", 1, 0, 'd' },
+    { "verbosity", 1, 0, 'v' },
+    { "refresh", 1, 0, 'R' },
+    { "purge", 1, 0, 'P' },
+    { "metaMulticast", 1, 0, 'I' },
+    { "timetolive", 1, 0, 't' },
+    { "listen", 1, 0, 'L' },
 #ifdef CONFIG_ORTE_UNIX
-    { "daemon",1,0, 'D' },
+    { "daemon", 1, 0, 'D' },
 #endif
-    { "expiration",1,0, 'E' },
-    { "events",0,0, 'e' },
-    { "logfile",1,0, 'l' },
-    { "version",0,0, 'V' },
-    { "install_service",0,0, 'i' },
-    { "remove_service",0,0, 'r' },
+    { "expiration", 1, 0, 'E' },
+    { "events", 0, 0, 'e' },
+    { "logfile", 1, 0, 'l' },
+    { "version", 0, 0, 'V' },
+    { "install_service", 0, 0, 'i' },
+    { "remove_service", 0, 0, 'r' },
     { "help",  0, 0, 'h' },
     { 0, 0, 0, 0}
   };
@@ -189,86 +210,86 @@ int main(int argc,char *argv[]) {
   ORTEDomainPropDefaultGet(&dp);
 
 #if defined HAVE_GETOPT_LONG || defined HAVE_GETOPT_LONG_ORTE
-  while ((opt = getopt_long(argc, argv, "k:p:d:v:R:E:P:I:t:L:l:VhDesir",&long_opts[0], NULL)) != EOF) {
+  while ((opt = getopt_long(argc, argv, "k:p:d:v:R:E:P:I:t:L:l:VhDesir", &long_opts[0], NULL)) != EOF) {
 #else
   while ((opt = getopt(argc, argv, "k:p:d:v:R:E:P:I:t:L:l:VhDesir")) != EOF) {
 #endif
     switch (opt) {
       case 'p':
-        dp.mgrs=optarg;
-        break;
+       dp.mgrs = optarg;
+       break;
       case 'k':
-        dp.keys=optarg;
-        break;
+       dp.keys = optarg;
+       break;
       case 'd':
-        domain=strtol(optarg,NULL,0);
-        break;
+       domain = strtol(optarg, NULL, 0);
+       break;
       case 'v':
-        ORTEVerbositySetOptions(optarg);
-        break;
+       ORTEVerbositySetOptions(optarg);
+       break;
       case 'R':
-        NtpTimeAssembFromMs(dp.baseProp.refreshPeriod,strtol(optarg,NULL,0),0);
-        break;
+       NtpTimeAssembFromMs(dp.baseProp.refreshPeriod, strtol(optarg, NULL, 0), 0);
+       break;
       case 'P':
-        NtpTimeAssembFromMs(dp.baseProp.purgeTime,strtol(optarg,NULL,0),0);
-        break;
+       NtpTimeAssembFromMs(dp.baseProp.purgeTime, strtol(optarg, NULL, 0), 0);
+       break;
       case 'I':
-        dp.multicast.enabled=ORTE_TRUE;
-        dp.multicast.ipAddress=StringToIPAddress(optarg);
-        break;
+       dp.multicast.enabled = ORTE_TRUE;
+       dp.multicast.ipAddress = StringToIPAddress(optarg);
+       break;
       case 'L':
-        dp.listen=StringToIPAddress(optarg);
-        break;
+       dp.listen = StringToIPAddress(optarg);
+       break;
       case 't':
-        dp.multicast.ttl=strtol(optarg,NULL,0);
-        break;
+       dp.multicast.ttl = strtol(optarg, NULL, 0);
+       break;
       case 'E':
-        NtpTimeAssembFromMs(dp.baseProp.expirationTime,strtol(optarg,NULL,0),0);
-        break;
+       NtpTimeAssembFromMs(dp.baseProp.expirationTime, strtol(optarg, NULL, 0), 0);
+       break;
       case 'e':
-        events=(ORTEDomainAppEvents*)malloc(sizeof(ORTEDomainAppEvents));
-        ORTEDomainInitEvents(events);
-        events->onMgrNew=onMgrAppRemoteNew;
-        events->onAppRemoteNew=onMgrAppRemoteNew;
-        events->onMgrDelete=onMgrAppDelete;
-        events->onAppDelete=onMgrAppDelete;
-        break;
+       events = (ORTEDomainAppEvents *)malloc(sizeof(ORTEDomainAppEvents));
+       ORTEDomainInitEvents(events);
+       events->onMgrNew = onMgrAppRemoteNew;
+       events->onAppRemoteNew = onMgrAppRemoteNew;
+       events->onMgrDelete = onMgrAppDelete;
+       events->onAppDelete = onMgrAppDelete;
+       break;
       case 'l':
-        ORTEVerbositySetLogFile(optarg);
-        break;
+       ORTEVerbositySetLogFile(optarg);
+       break;
       case 'V':
-        printf("Open Real-Time Ethernet (%s).\n",dp.version);
-        exit(0);
-        break;
+       printf("Open Real-Time Ethernet (%s).\n", dp.version);
+       exit(0);
+       break;
       case 'D':
-        orteDaemon=ORTE_TRUE;
-        break;
+       orteDaemon = ORTE_TRUE;
+       break;
       #if defined(_WIN32) || defined(__CYGWIN__)
       case 's':
-        serviceDispatchTable();
-        exit(0);
-        break;
+       serviceDispatchTable();
+       exit(0);
+       break;
       case 'i':
-        installService();
-        orteWinService=ORTE_TRUE;
-        break;
+       installService();
+       orteWinService = ORTE_TRUE;
+       break;
       case 'r':
-        removeService();
-        exit(0);
-        break;
+       removeService();
+       exit(0);
+       break;
       #endif
       case 'h':
       default:
-        usage();
-        exit(opt == 'h' ? 0 : 1);
+       usage();
+       exit(opt == 'h' ? 0 : 1);
     }
   }
-  
-  if (orteWinService) { 
+
+  if (orteWinService) {
     exit(0);
   }
-  
-  d=ORTEDomainMgrCreate(domain,&dp,events,ORTE_TRUE);
+
+  d = ORTEDomainMgrCreate(domain, &dp, events, ORTE_TRUE);
   if (!d) {
     perror("ORTEDomainMgrCreate");
     exit(1);
@@ -279,62 +300,69 @@ int main(int argc,char *argv[]) {
     daemonInit();
   #endif
 
-  ORTEDomainStart(d,ORTE_TRUE,ORTE_FALSE,ORTE_FALSE,ORTE_FALSE,ORTE_TRUE);
+  ORTEDomainStart(d, ORTE_TRUE, ORTE_FALSE, ORTE_FALSE, ORTE_FALSE, ORTE_TRUE);
   #ifndef CONFIG_ORTE_UNIX
-     while(1) ORTESleepMs(1000);
+  while (1)
+    ORTESleepMs(1000);
   #endif
 
   #ifdef CONFIG_ORTE_UNIX
   waitForEndingCommand();
   ORTEDomainMgrDestroy(d);
-  if (events) 
+  if (events)
     free(events);
   #endif
 
   exit(0);
 }
-#else
-char *verbosity="";
-MODULE_PARM(verbosity,"1s");
-MODULE_PARM_DESC(verbosity,"set verbosity level SECTION, up to LEVEL:...");
-char *peer="";
-MODULE_PARM(peer,"1s");
-MODULE_PARM_DESC(peer,"possible locations of fellow managers");
+#else /* ifndef CONFIG_ORTE_RT */
+char *verbosity = "";
+MODULE_PARM(verbosity, "1s");
+MODULE_PARM_DESC(verbosity, "set verbosity level SECTION, up to LEVEL:...");
+char *peer = "";
+MODULE_PARM(peer, "1s");
+MODULE_PARM_DESC(peer, "possible locations of fellow managers");
 MODULE_LICENSE("GPL");
-ORTEDomain *d=NULL;
+ORTEDomain *d = NULL;
 pthread_t  thread;
 
 void *
-domainInit(void *arg) {
+domainInit(void *arg)
+{
   ORTEDomainProp dp;
 
   ORTEDomainPropDefaultGet(&dp);
   ORTEVerbositySetOptions(verbosity);
-  dp.mgrs=peer;
-  d=ORTEDomainMgrCreate(ORTE_DEFAULT_DOMAIN,&dp,NULL,ORTE_TRUE);
+  dp.mgrs = peer;
+  d = ORTEDomainMgrCreate(ORTE_DEFAULT_DOMAIN, &dp, NULL, ORTE_TRUE);
   return arg;
 }
 
 void *
-domainDestroy(void *arg) {
-  if (!d) return NULL;
+domainDestroy(void *arg)
+{
+  if (!d)
+    return NULL;
   ORTEDomainMgrDestroy(d);
   return arg;
 }
 
 int
-init_module(void) {
+init_module(void)
+{
   ORTEInit();
-  pthread_create(&thread,NULL,&domainInit,NULL);  //allocate resources in RT 
-  pthread_join(thread,NULL);
+  pthread_create(&thread, NULL, &domainInit, NULL);  //allocate resources in RT
+  pthread_join(thread, NULL);
   if (d)
-    ORTEDomainStart(d,ORTE_TRUE,ORTE_FALSE,ORTE_FALSE,ORTE_FALSE,ORTE_TRUE); //manager start
+    ORTEDomainStart(d, ORTE_TRUE, ORTE_FALSE, ORTE_FALSE, ORTE_FALSE, ORTE_TRUE);  //manager start
   return 0;
 }
 void
-cleanup_module(void) {
-  if (!d) return;
-  pthread_create(&thread,NULL,&domainDestroy,NULL);
-  pthread_join(thread,NULL);
+cleanup_module(void)
+{
+  if (!d)
+    return;
+  pthread_create(&thread, NULL, &domainDestroy, NULL);
+  pthread_join(thread, NULL);
 }
-#endif
+#endif /* ifndef CONFIG_ORTE_RT */
index 6c8406cf7dac5bf08db8ea597ae4a49dce239387..bad7d73a6ec2892137ba2b0071027a98cceda8e5 100644 (file)
@@ -6,57 +6,70 @@ static SERVICE_STATUS_HANDLE   sshStatusHandle;
 static DWORD                   dwErr = 0;
 static char                    szErr[1024] = "";
 
-char                           *name_service="ortemanager";
-char                           *name_service_disp="ortemanager";
-
-int managerInit(void);         //forward declaration
-int managerStart(void);        //forward declaration
-int managerStop(void);         //forward declaration
-
-static void AddToMessageLog(char *lpszMsg) {
+char                           *name_service = "ortemanager";
+char                           *name_service_disp = "ortemanager";
+
+int
+managerInit(void);             //forward declaration
+int
+managerStart(void);            //forward declaration
+int
+managerStop(void);             //forward declaration
+
+static void
+AddToMessageLog(char *lpszMsg)
+{
   char    szMsg[2048];
   HANDLE  hEventSource;
-  char *  lpszStrings[2];
+  char *lpszStrings[2];
 
   dwErr = GetLastError();
   hEventSource = RegisterEventSource(NULL, name_service);
   sprintf(szMsg, "%s error: %li", name_service, dwErr);
   lpszStrings[0] = szMsg;
   lpszStrings[1] = lpszMsg;
-  if(hEventSource != NULL) {
+  if (hEventSource != NULL) {
     ReportEvent(hEventSource, // handle of event source
-                EVENTLOG_ERROR_TYPE,  // event type
-                0,                    // event category
-                0,                    // event ID
-                NULL,                 // current user's SID
-                2,                    // strings in lpszStrings
-                0,                    // no bytes of raw data
-                (LPCSTR*)lpszStrings, // array of error strings
-                NULL);                // no raw data
+               EVENTLOG_ERROR_TYPE,  // event type
+               0,                    // event category
+               0,                    // event ID
+               NULL,                 // current user's SID
+               2,                    // strings in lpszStrings
+               0,                    // no bytes of raw data
+               (LPCSTR *)lpszStrings, // array of error strings
+               NULL);                // no raw data
     DeregisterEventSource(hEventSource);
   }
 }
 
-BOOL ReportStatusToSCMgr(DWORD dwCurrentState,DWORD dwWin32ExitCode,
-                         DWORD dwWaitHint) {
+BOOL
+ReportStatusToSCMgr(DWORD dwCurrentState, DWORD dwWin32ExitCode,
+                   DWORD dwWaitHint)
+{
   static DWORD dwCheckPoint = 1;
   BOOL fResult = TRUE;
 
-  if(dwCurrentState == SERVICE_START_PENDING) ssStatus.dwControlsAccepted = 0;
-  else ssStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP;
+  if (dwCurrentState == SERVICE_START_PENDING)
+    ssStatus.dwControlsAccepted = 0;
+  else
+    ssStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP;
   ssStatus.dwCurrentState = dwCurrentState;
   ssStatus.dwWin32ExitCode = dwWin32ExitCode;
   ssStatus.dwWaitHint = dwWaitHint;
-  if((dwCurrentState == SERVICE_RUNNING) || (dwCurrentState == SERVICE_STOPPED)) ssStatus.dwCheckPoint = 0;
-  else ssStatus.dwCheckPoint = dwCheckPoint++;
-  if(!(fResult = SetServiceStatus(sshStatusHandle, &ssStatus))) {
+  if ((dwCurrentState == SERVICE_RUNNING) || (dwCurrentState == SERVICE_STOPPED))
+    ssStatus.dwCheckPoint = 0;
+  else
+    ssStatus.dwCheckPoint = dwCheckPoint++;
+  if (!(fResult = SetServiceStatus(sshStatusHandle, &ssStatus))) {
     AddToMessageLog("SetServiceStatus");
   }
   return fResult;
 }
 
-void WINAPI service_ctrl(DWORD dwCtrlCode) {
-  switch(dwCtrlCode) {
+void WINAPI
+service_ctrl(DWORD dwCtrlCode)
+{
+  switch (dwCtrlCode) {
     case SERVICE_CONTROL_STOP:
       ssStatus.dwCurrentState = SERVICE_STOP_PENDING;
       managerStop();
@@ -70,136 +83,152 @@ void WINAPI service_ctrl(DWORD dwCtrlCode) {
   ReportStatusToSCMgr(ssStatus.dwCurrentState, NO_ERROR, 0);
 }
 
-void WINAPI service_main(DWORD dwArgc, char **lpszArgv) {
+void WINAPI
+service_main(DWORD dwArgc, char **lpszArgv)
+{
   int       err;
+
   sshStatusHandle = RegisterServiceCtrlHandler(name_service, service_ctrl);
-  if(sshStatusHandle) {
+  if (sshStatusHandle) {
     ssStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
     ssStatus.dwServiceSpecificExitCode = 0;
-    killServiceEvent = CreateEvent( NULL, TRUE, FALSE, NULL );
-    if (!killServiceEvent) goto cleanup;
-    if(!ReportStatusToSCMgr(SERVICE_START_PENDING,NO_ERROR,3000)) goto cleanup;
-    err=managerInit();
-    if (err<0) {
+    killServiceEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+    if (!killServiceEvent)
+      goto cleanup;
+    if (!ReportStatusToSCMgr(SERVICE_START_PENDING, NO_ERROR, 3000))
+      goto cleanup;
+    err = managerInit();
+    if (err < 0) {
       AddToMessageLog("Starting communication");
-      dwErr=NO_ERROR;
+      dwErr = NO_ERROR;
       goto cleanup;
     }
     managerStart();
-    if(!ReportStatusToSCMgr(SERVICE_RUNNING,NO_ERROR, 0 )) goto cleanup;
-    WaitForSingleObject(killServiceEvent,INFINITE);
+    if (!ReportStatusToSCMgr(SERVICE_RUNNING, NO_ERROR, 0))
+      goto cleanup;
+    WaitForSingleObject(killServiceEvent, INFINITE);
     CloseHandle(killServiceEvent);
   }
 cleanup:
-  if(sshStatusHandle) {
-    ReportStatusToSCMgr(SERVICE_STOP_PENDING,dwErr,0);
-    ReportStatusToSCMgr(SERVICE_STOPPED,dwErr,0);
+  if (sshStatusHandle) {
+    ReportStatusToSCMgr(SERVICE_STOP_PENDING, dwErr, 0);
+    ReportStatusToSCMgr(SERVICE_STOPPED, dwErr, 0);
   }
 }
 
-void serviceDispatchTable(void) {
+void
+serviceDispatchTable(void)
+{
   SERVICE_TABLE_ENTRY dispatchTable[] = {
-      { name_service, (LPSERVICE_MAIN_FUNCTION)service_main },
-      { NULL, NULL }
+    { name_service, (LPSERVICE_MAIN_FUNCTION)service_main },
+    { NULL, NULL }
   };
-  if(!StartServiceCtrlDispatcher(dispatchTable)) {
+
+  if (!StartServiceCtrlDispatcher(dispatchTable)) {
     AddToMessageLog("StartServiceCtrlDispatcher failed.");
   }
 }
 
-char *GetLastErrorText( char *lpszBuf, DWORD dwSize ) {
+char *
+GetLastErrorText(char *lpszBuf, DWORD dwSize)
+{
   DWORD dwRet;
   char *lpszTemp = NULL;
 
   dwRet = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |FORMAT_MESSAGE_ARGUMENT_ARRAY,
-                        NULL,
-                        GetLastError(),
-                        LANG_NEUTRAL,
-                        (char *)&lpszTemp,
-                        0,
-                        NULL);
+                       NULL,
+                       GetLastError(),
+                       LANG_NEUTRAL,
+                       (char *)&lpszTemp,
+                       0,
+                       NULL);
   // supplied buffer is not long enough
-  if(!dwRet || ((long)dwSize < (long)dwRet+14)) {
+  if (!dwRet || ((long)dwSize < (long)dwRet+14)) {
     lpszBuf[0] = '\0';
   } else {
     lpszTemp[lstrlen(lpszTemp)-2] = '\0';  //remove cr and newline character
     sprintf(lpszBuf, "%s (%li)", lpszTemp, GetLastError());
   }
-  if(lpszTemp) LocalFree((HLOCAL) lpszTemp );
+  if (lpszTemp)
+    LocalFree((HLOCAL)lpszTemp);
   return lpszBuf;
 }
 
-void installService(void) {
+void
+installService(void)
+{
   SC_HANDLE   schService;
   SC_HANDLE   schSCManager;
   TCHAR       szPath[512];
 
-  if(GetModuleFileName( NULL, szPath, sizeof(szPath) - 1) == 0) {
-     printf("Unable to install %s - %s\n",
-             name_service,
-             GetLastErrorText(szErr, sizeof(szErr)));
-     return;
+  if (GetModuleFileName(NULL, szPath, sizeof(szPath) - 1) == 0) {
+    printf("Unable to install %s - %s\n",
+          name_service,
+          GetLastErrorText(szErr, sizeof(szErr)));
+    return;
   }
-  strcat(szPath," -s");
+  strcat(szPath, " -s");
   schSCManager = OpenSCManager(NULL,  // machine (NULL == local)
-                               NULL,  // database (NULL == default)
-                               SC_MANAGER_ALL_ACCESS);   // access required
-  if(schSCManager) {
+                              NULL,  // database (NULL == default)
+                              SC_MANAGER_ALL_ACCESS);   // access required
+  if (schSCManager) {
     schService = CreateService(schSCManager,               // SCManager database
-                               name_service,               // name of service
-                               name_service_disp,          // name to display
-                               SERVICE_ALL_ACCESS,         // desired access
-                               SERVICE_WIN32_OWN_PROCESS,  // service type
-                               SERVICE_AUTO_START,         // start type
-                               SERVICE_ERROR_NORMAL,       // error control type
-                               szPath,                     // service's binary
-                               NULL,                       // no load ordering group
-                               NULL,                       // no tag identifier
-                               NULL,                       // dependencies
-                               NULL,                       // LocalSystem account
-                               NULL);                      // no password
-    if(schService) {
+                              name_service,               // name of service
+                              name_service_disp,          // name to display
+                              SERVICE_ALL_ACCESS,         // desired access
+                              SERVICE_WIN32_OWN_PROCESS,  // service type
+                              SERVICE_AUTO_START,         // start type
+                              SERVICE_ERROR_NORMAL,       // error control type
+                              szPath,                     // service's binary
+                              NULL,                       // no load ordering group
+                              NULL,                       // no tag identifier
+                              NULL,                       // dependencies
+                              NULL,                       // LocalSystem account
+                              NULL);                      // no password
+    if (schService) {
       CloseServiceHandle(schSCManager);
-      printf("Service name (%s) instaled!\n",name_service);
+      printf("Service name (%s) instaled!\n", name_service);
     } else {
-       printf("OpenSCManager failed - %s\n", GetLastErrorText(szErr, sizeof(szErr)));
+      printf("OpenSCManager failed - %s\n", GetLastErrorText(szErr, sizeof(szErr)));
     }
   }
 }
 
-void removeService(void) {
+void
+removeService(void)
+{
   SC_HANDLE   schService;
   SC_HANDLE   schSCManager;
 
   schSCManager = OpenSCManager(NULL,          // machine (NULL == local)
-                               NULL,          // database (NULL == default)
-                               SC_MANAGER_ALL_ACCESS );  // access required
-  if(schSCManager) {
+                              NULL,          // database (NULL == default)
+                              SC_MANAGER_ALL_ACCESS);   // access required
+  if (schSCManager) {
     schService = OpenService(schSCManager, name_service, SERVICE_ALL_ACCESS);
-    if(schService) {
+    if (schService) {
       // try to stop the service
-      if(ControlService( schService, SERVICE_CONTROL_STOP, &ssStatus )) {
-        printf("Stopping %s.", name_service);
-        Sleep(100);
-        while(QueryServiceStatus(schService, &ssStatus )) {
-          if(ssStatus.dwCurrentState == SERVICE_STOP_PENDING) {
-            printf(".");
-            Sleep(100);
-          } else {
-             break;
-          }
-        }
-        if(ssStatus.dwCurrentState == SERVICE_STOPPED) {
-          printf("\n%s stopped.\n", name_service);
-        } else {
-          printf("\n%s failed to stop.\n", name_service);
-        }
+      if (ControlService(schService, SERVICE_CONTROL_STOP, &ssStatus)) {
+       printf("Stopping %s.", name_service);
+       Sleep(100);
+       while (QueryServiceStatus(schService, &ssStatus)) {
+         if (ssStatus.dwCurrentState == SERVICE_STOP_PENDING) {
+           printf(".");
+           Sleep(100);
+         } else {
+           break;
+         }
+       }
+       if (ssStatus.dwCurrentState == SERVICE_STOPPED) {
+         printf("\n%s stopped.\n", name_service);
+       } else {
+         printf("\n%s failed to stop.\n", name_service);
+       }
       }
       // now remove the service
-      if(DeleteService(schService)) {
-        printf("%s removed.\n", name_service);
+      if (DeleteService(schService)) {
+       printf("%s removed.\n", name_service);
       } else {
-        printf("DeleteService failed - %s\n", GetLastErrorText(szErr, sizeof(szErr)));
+       printf("DeleteService failed - %s\n", GetLastErrorText(szErr, sizeof(szErr)));
       }
       CloseServiceHandle(schService);
     } else {
@@ -210,4 +239,3 @@ void removeService(void) {
     printf("OpenSCManager failed - %s\n", GetLastErrorText(szErr, sizeof(szErr)));
   }
 }
-
index 987d13331cdb9d6759301f018c10398f7086552b..9e1f66a409a1eb0f60e9a9c859582e76ff6c1e99 100644 (file)
@@ -1,30 +1,30 @@
 /*
- *  $Id: filename.c,v 0.0.0.1           2003/MM/DD 
+ *  $Id: filename.c,v 0.0.0.1           2003/MM/DD
  *
  *  DEBUG:  section XX                  Description
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
\ No newline at end of file
+ *
+ */
index e04a0ca34b9cb891055d523f336f0d659193422f..e2a351609dfacb449b79ec60f4166dbe6fed6205 100644 (file)
@@ -1,31 +1,31 @@
 /*
- *  $Id: filename.h,v 0.0.0.1           2003/MM/DD 
+ *  $Id: filename.h,v 0.0.0.1           2003/MM/DD
  *
- *  -------------------------------------------------------------------  
- *                                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                              
+ *  -------------------------------------------------------------------
+ *                                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
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
- */ 
+ *
+ */
 
 #ifndef _X_H
 #define _X_H