From b2b96a76d9b48b9fef34de4f835e97cc6ff9230a Mon Sep 17 00:00:00 2001
From: Ruud Overeem <overeem@astron.nl>
Date: Fri, 25 Jan 2008 10:40:25 +0000
Subject: [PATCH] Bug 1000: Made a directory for protocols used by daemons so
 that the clients are not dependant from the deamons.

---
 .gitattributes                              |   3 +
 MAC/APL/APLProtocol/APLProtocol.spec.in     | 160 ++++++++++++++++++++
 MAC/APL/APLProtocol/Makefile.am             |  11 ++
 MAC/APL/APLProtocol/bootstrap               |   3 +
 MAC/APL/APLProtocol/configure.in            |  68 +++++++++
 MAC/APL/APLProtocol/include/APL/Makefile.am |   4 +
 MAC/APL/APLProtocol/include/Makefile.am     |   4 +
 MAC/APL/APLProtocol/src/KVT_Protocol.prot   | 110 ++++++++++++++
 MAC/APL/APLProtocol/src/LOG_Protocol.prot   | 110 ++++++++++++++
 MAC/APL/APLProtocol/src/Makefile.am         |  37 +++++
 MAC/MACCommon/ProtID_numbers.txt            |  19 +--
 11 files changed, 520 insertions(+), 9 deletions(-)
 create mode 100644 MAC/APL/APLProtocol/APLProtocol.spec.in
 create mode 100644 MAC/APL/APLProtocol/Makefile.am
 create mode 100755 MAC/APL/APLProtocol/bootstrap
 create mode 100644 MAC/APL/APLProtocol/configure.in
 create mode 100644 MAC/APL/APLProtocol/include/APL/Makefile.am
 create mode 100644 MAC/APL/APLProtocol/include/Makefile.am
 create mode 100644 MAC/APL/APLProtocol/src/KVT_Protocol.prot
 create mode 100644 MAC/APL/APLProtocol/src/LOG_Protocol.prot
 create mode 100644 MAC/APL/APLProtocol/src/Makefile.am

diff --git a/.gitattributes b/.gitattributes
index 5e1366e910b..d5b3d190ecf 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -231,6 +231,9 @@ MAC/APL/APLCommon/bootstrap -text svneol=native#application/octet-stream
 MAC/APL/APLCommon/configure.in -text svneol=native#application/octet-stream
 MAC/APL/APLCommon/src/Makefile.am -text svneol=native#application/octet-stream
 MAC/APL/APLCommon/src/StartDaemon_Protocol.prot -text svneol=native#application/octet-stream
+MAC/APL/APLProtocol/bootstrap -text
+MAC/APL/APLProtocol/src/KVT_Protocol.prot -text
+MAC/APL/APLProtocol/src/LOG_Protocol.prot -text
 MAC/APL/CUDaemons/src/LoggingClient/LoggingClient.log_prop -text
 MAC/APL/CURTDBDaemons/src/LoggingProcessor/LoggingProcessor.conf -text
 MAC/APL/CURTDBDaemons/src/LoggingProcessor/LoggingProcessor.log_prop -text
diff --git a/MAC/APL/APLProtocol/APLProtocol.spec.in b/MAC/APL/APLProtocol/APLProtocol.spec.in
new file mode 100644
index 00000000000..aad7382d231
--- /dev/null
+++ b/MAC/APL/APLProtocol/APLProtocol.spec.in
@@ -0,0 +1,160 @@
+# -*- Mode:rpm-spec -*-
+# APLProtocol.spec.in
+#
+
+##############################################################################
+#
+# Preamble
+#
+##############################################################################
+
+Summary: This package contains all daemons that should run on a ControlUnit.
+
+%define release @RPM_RELEASE@
+%define version @VERSION@
+%define pkgname @PACKAGE@
+%define pkgdir %{pkgname}-%{version}-%{release}
+%define prefix /opt/lofar
+%define configure_args @RPM_CONFIGURE_ARGS@
+##define build_kernel_version @BUILD_KERNEL_VERSION@
+
+Name: %{pkgname}
+Version: %{version}
+Release: %{release}
+Copyright: LGPL
+Group: Application/System
+Source: %{pkgname}-%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{pkgdir}-root
+URL: http://www.astron.nl
+Prefix: %{prefix}
+BuildArchitectures: i386 # Target platforms, i.e., i586
+Requires: RTCCommon = 1.0
+Packager: %{packager}
+Distribution: The LOFAR project
+Vendor: ASTRON
+
+AutoReqProv: no
+
+%description
+
+Collection of protocols used within and outside MAC.
+
+##############################################################################
+#
+# prep
+#
+##############################################################################
+%prep
+echo $prefix
+
+# create the build directory, untar the source
+%setup
+
+##############################################################################
+#
+# build
+#
+##############################################################################
+%build
+./configure %{configure_args} --prefix=%{prefix} && make
+
+##############################################################################
+#
+# install
+#
+##############################################################################
+%install
+# To make things work with BUILDROOT
+if [ "$RPM_BUILD_ROOT" != "%{_tmppath}/%{pkgdir}-root" ]
+then
+  echo
+  echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+  echo @                                                                    @
+  echo @  RPM_BUILD_ROOT is not what I expected.  Please clean it yourself. @
+  echo @                                                                    @
+  echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+  echo
+else
+  echo Cleaning RPM_BUILD_ROOT: "$RPM_BUILD_ROOT"
+  rm -rf "$RPM_BUILD_ROOT"
+fi
+mkdir -p $RPM_BUILD_ROOT%{prefix}
+make DESTDIR="$RPM_BUILD_ROOT" install
+
+#uninstall
+
+##############################################################################
+#
+# verify
+#
+##############################################################################
+#verify
+
+##############################################################################
+#
+# clean
+#
+##############################################################################
+%clean
+# Call me paranoid, but I do not want to be responsible for nuking
+# someone's harddrive!
+if [ "$RPM_BUILD_ROOT" != "%{_tmppath}/%{pkgdir}-root" ]
+then
+  echo
+  echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+  echo @                                                                    @
+  echo @  RPM_BUILD_ROOT is not what I expected.  Please clean it yourself. @
+  echo @                                                                    @
+  echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+  echo
+else
+  echo Cleaning RPM_BUILD_ROOT: "$RPM_BUILD_ROOT"
+  rm -rf "$RPM_BUILD_ROOT"
+fi
+
+##############################################################################
+#
+# files
+#
+##############################################################################
+
+# empty 'files' means all distributed files
+%files
+%defattr(-, root, root)
+%{prefix}
+
+# Your application file list goes here
+# %{prefix}/lib/lib*.so*
+
+# Documentation
+# doc COPYING ChangeLog README AUTHORS NEWS
+# doc doc/*
+
+# link the module to the correct path
+%post 
+
+# before uninstall
+%preun
+
+# after uninstall
+%postun
+
+##############################################################################
+#
+# package devel
+#
+##############################################################################
+
+#package devel
+#Summary: Development files for %{pkgname}
+#Group: Applications/System
+#description devel
+#Development files for %{pkgname}.
+
+#files devel
+
+# Your development files go here
+# Programmers documentation goes here
+#doc doc
+
+# end of file
diff --git a/MAC/APL/APLProtocol/Makefile.am b/MAC/APL/APLProtocol/Makefile.am
new file mode 100644
index 00000000000..78a8f278dc8
--- /dev/null
+++ b/MAC/APL/APLProtocol/Makefile.am
@@ -0,0 +1,11 @@
+SUBDIRS=src
+
+pkgextdir     = $(prefix)/config/$(PACKAGE)
+pkgext_DATA   = pkgext pkgextcppflags pkgextcxxflags pkgextldflags
+
+EXTRA_DIST = \
+      Makefile.common \
+      APLProtocol.spec \
+      autoconf_share/compiletool
+
+include $(top_srcdir)/Makefile.common
diff --git a/MAC/APL/APLProtocol/bootstrap b/MAC/APL/APLProtocol/bootstrap
new file mode 100755
index 00000000000..06f18cde1db
--- /dev/null
+++ b/MAC/APL/APLProtocol/bootstrap
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+../../../autoconf_share/bootstrap ../../../autoconf_share
diff --git a/MAC/APL/APLProtocol/configure.in b/MAC/APL/APLProtocol/configure.in
new file mode 100644
index 00000000000..47e1517d5c3
--- /dev/null
+++ b/MAC/APL/APLProtocol/configure.in
@@ -0,0 +1,68 @@
+dnl
+dnl Process this file with autoconf to produce a configure script.
+dnl
+AC_INIT
+dnl AC_CONFIG_AUX_DIR(config)
+dnl AM_CONFIG_HEADER(config/config.h)
+AM_CONFIG_HEADER(config.h)
+AM_INIT_AUTOMAKE(APLProtocol, 1.0, no-define)
+
+dnl
+dnl Initialize for LOFAR (may set compilers)
+dnl
+lofar_INIT
+
+dnl Checks for programs.
+AC_PROG_AWK
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_DISABLE_SHARED
+AC_PROG_LIBTOOL
+AC_PROG_YACC
+AM_PROG_LEX
+
+dnl Checks for libraries.
+
+dnl dnl Replace `main' with a function in -lfl:
+dnl AC_CHECK_LIB(fl, main)
+dnl dnl Replace `main' with a function in -lcosev_r:
+dnl AC_CHECK_LIB(cosev_r, main)
+dnl dnl Replace `main' with a function in -lcosnm_r:
+dnl AC_CHECK_LIB(cosnm_r, main)
+dnl dnl Replace `main' with a function in -lorb_r:
+dnl AC_CHECK_LIB(orb_r, main)
+dnl dnl Replace `main' with a function in -lpthread:
+dnl AC_CHECK_LIB(pthread, main)
+dnl dnl Replace `main' with a function in -lvport_r:
+dnl AC_CHECK_LIB(vport_r, main)
+
+dnl Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS(unistd.h)
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_TYPE_SIZE_T
+
+dnl Checks for library functions.
+AC_FUNC_VPRINTF
+
+dnl
+dnl Check for LOFAR specific things
+dnl
+lofar_GENERAL
+lofar_COMPILETOOLS
+lofar_INTERNAL(MAC/APL/RTCCommon, rtccommon, , 1, APL/RTCCommon/Marshalling.h,,)
+
+dnl
+dnl Output Makefiles
+dnl
+AC_OUTPUT(
+src/Makefile
+include/Makefile
+include/APL/Makefile
+Makefile
+APLProtocol.spec
+)
diff --git a/MAC/APL/APLProtocol/include/APL/Makefile.am b/MAC/APL/APLProtocol/include/APL/Makefile.am
new file mode 100644
index 00000000000..3f093a312be
--- /dev/null
+++ b/MAC/APL/APLProtocol/include/APL/Makefile.am
@@ -0,0 +1,4 @@
+
+SUBDIRS = APLProtocol
+
+include $(top_srcdir)/Makefile.common
diff --git a/MAC/APL/APLProtocol/include/Makefile.am b/MAC/APL/APLProtocol/include/Makefile.am
new file mode 100644
index 00000000000..96c8fa3cc73
--- /dev/null
+++ b/MAC/APL/APLProtocol/include/Makefile.am
@@ -0,0 +1,4 @@
+
+SUBDIRS = APL
+
+include $(top_srcdir)/Makefile.common
diff --git a/MAC/APL/APLProtocol/src/KVT_Protocol.prot b/MAC/APL/APLProtocol/src/KVT_Protocol.prot
new file mode 100644
index 00000000000..72f3442bb3a
--- /dev/null
+++ b/MAC/APL/APLProtocol/src/KVT_Protocol.prot
@@ -0,0 +1,110 @@
+//#  KVT_Protocol.prot: Protocol for sending LogMessages to a LoggingProcessor
+//#
+//#  Copyright (C) 2007
+//#  ASTRON (Netherlands Foundation for Research in Astronomy)
+//#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//#
+//#  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.
+//#
+//#  You should have received a copy of the GNU General Public License
+//#  along with this program; if not, write to the Free Software
+//#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//#
+//#  $Id: Log_Protocol.prot 10814 2008-01-11 19:45:48Z overeem $
+
+autogen definitions protocol;
+
+description = "Protocol definition for sending LogMessages to a LoggingProcessor";
+prefix = "KVT"; // for the signal names
+id = "(LOFAR::GCF::TM::F_GCF_PROTOCOL + 1)";
+// specify extra include files
+// e.g.
+//include = '<sys/time.h>';
+//include = '<GCF/GCF_PValue.h>';
+//include = '<GCF/GCF_Defines.h>';
+include = '<APL/RTCCommon/StringVector.h>';
+
+prelude = << PRELUDE_END
+
+PRELUDE_END;
+
+// An "event" has a "signal" and a "dir" (direction)
+// and zero or more "param"s.
+// "dir" can be one of "IN" or "OUT".
+// A "param" has a "name" and a "type".
+//
+
+event = {
+	signal = SEND_MSG;
+	dir = IN;
+	param = {
+		name = "seqnr";
+		type = "unsigned short";
+	};
+	param = {
+		name = "key";
+		type = "string";
+	};
+	param = {
+		name = "value";
+		type = "string";
+	};
+};
+
+event = {
+	signal = SEND_MSG_ACK;
+	dir = OUT;
+	param = {
+		name = "seqnr";
+		type = "unsigned short";
+	};
+	param = {
+		name = "result";
+		type = "unsigned short";
+	};
+};
+
+event = {
+	signal = SEND_MSG_POOL;
+	dir = IN;
+	param = {
+		name = "seqnr";
+		type = "unsigned short";
+	};
+	param = {
+		name = "msgCount";
+		type = "unsigned short";
+	};
+	param = {
+		name = "keys";
+		type = "RTC::StringVector";
+		userdefined;
+	};
+	param = {
+		name = "values";
+		type = "RTC::StringVector";
+		userdefined;
+	};
+};
+
+event = {
+	signal = SEND_MSG_POOL_ACK;
+	dir = OUT;
+	param = {
+		name = "seqnr";
+		type = "unsigned short";
+	};
+	param = {
+		name = "result";
+		type = "unsigned short";
+	};
+};
+
diff --git a/MAC/APL/APLProtocol/src/LOG_Protocol.prot b/MAC/APL/APLProtocol/src/LOG_Protocol.prot
new file mode 100644
index 00000000000..528bdd53466
--- /dev/null
+++ b/MAC/APL/APLProtocol/src/LOG_Protocol.prot
@@ -0,0 +1,110 @@
+//#  LOG_Protocol.prot: Protocol for sending LogMessages to a LoggingProcessor
+//#
+//#  Copyright (C) 2007
+//#  ASTRON (Netherlands Foundation for Research in Astronomy)
+//#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//#
+//#  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.
+//#
+//#  You should have received a copy of the GNU General Public License
+//#  along with this program; if not, write to the Free Software
+//#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//#
+//#  $Id: Log_Protocol.prot 10814 2008-01-11 19:45:48Z overeem $
+
+autogen definitions protocol;
+
+description = "Protocol definition for sending LogMessages to a LoggingProcessor";
+prefix = "LOG"; // for the signal names
+id = "(LOFAR::GCF::TM::F_GCF_PROTOCOL + 0)";
+// specify extra include files
+// e.g.
+//include = '<sys/time.h>';
+include = '<GCF/GCF_PValue.h>';
+include = '<GCF/GCF_Defines.h>';
+include = '<APL/RTCCommon/StringVector.h>';
+
+prelude = << PRELUDE_END
+
+PRELUDE_END;
+
+// An "event" has a "signal" and a "dir" (direction)
+// and zero or more "param"s.
+// "dir" can be one of "IN" or "OUT".
+// A "param" has a "name" and a "type".
+//
+
+event = {
+	signal = SEND_MSG;
+	dir = IN;
+	param = {
+		name = "seqnr";
+		type = "unsigned short";
+	};
+	param = {
+		name = "DPname";
+		type = "string";
+	};
+	param = {
+		name = "message";
+		type = "string";
+	};
+};
+
+event = {
+	signal = SEND_MSG_ACK;
+	dir = OUT;
+	param = {
+		name = "seqnr";
+		type = "unsigned short";
+	};
+	param = {
+		name = "result";
+		type = "unsigned short";
+	};
+};
+
+event = {
+	signal = SEND_MSG_POOL;
+	dir = IN;
+	param = {
+		name = "seqnr";
+		type = "unsigned short";
+	};
+	param = {
+		name = "msgCount";
+		type = "unsigned short";
+	};
+	param = {
+		name = "DPnames";
+		type = "RTC::StringVector";
+		userdefined;
+	};
+	param = {
+		name = "messages";
+		type = "RTC::StringVector";
+		userdefined;
+	};
+};
+
+event = {
+	signal = SEND_MSG_POOL_ACK;
+	dir = OUT;
+	param = {
+		name = "seqnr";
+		type = "unsigned short";
+	};
+	param = {
+		name = "result";
+		type = "unsigned short";
+	};
+};
+
diff --git a/MAC/APL/APLProtocol/src/Makefile.am b/MAC/APL/APLProtocol/src/Makefile.am
new file mode 100644
index 00000000000..d24e1caa3c4
--- /dev/null
+++ b/MAC/APL/APLProtocol/src/Makefile.am
@@ -0,0 +1,37 @@
+AUTOGEN = autogen
+SUFFIXES = .ph
+%.ph: %.prot
+	$(AUTOGEN) --writable -L $(datadir)/GCF/TM $<
+	cp $*.ph $(top_builddir)/include/APL/APLProtocol/
+
+%.cc: %.prot
+	$(AUTOGEN) --writable -L $(datadir)/GCF/TM $<
+
+clean-local:
+	rm -f *.ph
+
+bin_PROGRAMS 				= 
+bin_SCRIPTS					= 
+INSTHDRS 					= LOG_Protocol.ph KVT_Protocol.ph
+NOINSTHDRS 					= 
+BUILT_SOURCES				= LOG_Protocol.cc \
+							  LOG_Protocol.ph \
+							  KVT_Protocol.cc \
+							  KVT_Protocol.ph
+
+pkgincludedir				= $(includedir)/APL/APLProtocol
+pkginclude_HEADERS 			= $(NOINSTHDRS) $(INSTHDRS)
+DOCHDRS						= $(pkginclude_HEADERS) $(BUILT_SOURCES)
+EXTRA_DIST 					= $(configfiles_DATA) $(sysconf_DATA)
+
+# Libraries
+lib_LTLIBRARIES         	= liblog_protocol.la libkvt_protocol.la
+liblog_protocol_la_SOURCES 	= LOG_Protocol.cc
+libkvt_protocol_la_SOURCES 	= KVT_Protocol.cc
+
+#in case of make install these files will be copied to the bindir beside the test apps
+configfilesdir				= $(bindir)
+configfiles_DATA 			= 
+sysconf_DATA				= 
+
+include $(top_srcdir)/Makefile.common
diff --git a/MAC/MACCommon/ProtID_numbers.txt b/MAC/MACCommon/ProtID_numbers.txt
index 3e64bdd6302..d6992865f0a 100644
--- a/MAC/MACCommon/ProtID_numbers.txt
+++ b/MAC/MACCommon/ProtID_numbers.txt
@@ -21,24 +21,25 @@ ServerName     | id                   | value
 ---------------+----------------------+-------
 FSM             F_FSM_PROTOCOL          1
 PORT            F_PORT_PROTOCOL         2
-PML             F_GCF_PROTOCOL + 0      3    // Obsolete
-PI              F_GCF_PROTOCOL + 1      4    // Obsolete
-PA              F_GCF_PROTOCOL + 2      5    // Obsolete
+LOG             F_GCF_PROTOCOL + 0      3    // used to be PML
+KVT             F_GCF_PROTOCOL + 1      4    // used to be PI
+DP              F_GCF_PROTOCOL + 2      5    // used to be PA
 SB              F_GCF_PROTOCOL + 3      6
-KVL             F_GCF_PROTOCOL + 4      7
+...             F_GCF_PROTOCOL + 4      7	 // used to be KVL
 
-RTDB            F_APL_PROTOCOL + 1      11   // was LogicalDevice
+TST             F_APL_PROTOCOL + 0      10   // used for testing
+...             F_APL_PROTOCOL + 1      11   // was LogicalDevice
 StartDaemon     F_APL_PROTOCOL + 2      12
 Control         F_APL_PROTOCOL + 3      13   // used to be SAS
-THPVSSBridge    F_APL_PROTOCOL + 4      14
+THPVSSBridge    F_APL_PROTOCOL + 4      14	 // Obsolete?
 MIS             F_APL_PROTOCOL + 5      15
-ABS             F_APL_PROTOCOL + 10     20
+BS              F_APL_PROTOCOL + 10     20
 EPA             F_APL_PROTOCOL + 11     21
 RSP             F_APL_PROTOCOL + 12     22
 CAL             F_APL_PROTOCOL + 13     23
 TBB             F_APL_PROTOCOL + 14     24
 TP              F_APL_PROTOCOL + 15     25
-CC              F_APL_PROTOCOL + 16     26
+TC              F_APL_PROTOCOL + 16     26
 ADAM            F_APL_PROTOCOL + 17     27
 
-NM              F_APL_PROTOCOL + 20     30
+NM              F_APL_PROTOCOL + 20     30	 // Obsolete?
-- 
GitLab