Sfoglia il codice sorgente

enhancement 1020
Adds AMF B.01.01 support - still needs alot of work


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@879 fd59a12c-fef9-0310-b244-a6a79926bd2f

Steven Dake 20 anni fa
parent
commit
7b2ddfa428
39 ha cambiato i file con 7217 aggiunte e 3651 eliminazioni
  1. 228 0
      README.amf
  2. 122 35
      conf/groups.conf
  3. 4 0
      conf/openais.conf
  4. 23 20
      exec/Makefile
  5. 3539 1663
      exec/amf.c
  6. 7 3
      exec/amf.h
  7. 532 0
      exec/amfconfig.c
  8. 204 0
      exec/amfconfig.h
  9. 207 0
      exec/cfg.c
  10. 44 0
      exec/cfg.h
  11. 7 4
      exec/main.c
  12. 30 29
      exec/main.h
  13. 260 0
      exec/mainconfig.c
  14. 71 0
      exec/mainconfig.h
  15. 0 556
      exec/mainparse.c
  16. 0 180
      exec/mainparse.h
  17. 99 0
      exec/openais-instantiate.c
  18. 3 1
      exec/sync.c
  19. 2 3
      exec/totemconfig.c
  20. 2 0
      exec/totemip.c
  21. 134 93
      include/ipc_amf.h
  22. 109 0
      include/ipc_cfg.h
  23. 2 1
      include/ipc_gen.h
  24. 157 0
      include/openaisCfg.h
  25. 2 158
      include/saAis.h
  26. 338 0
      include/saAmf.h
  27. 10 1
      lib/Makefile
  28. 470 348
      lib/amf.c
  29. 30 0
      lib/libOpenaisCfg.versions
  30. 14 5
      test/Makefile
  31. 74 0
      test/clc_cli_script
  32. 1 1
      test/testamf.c
  33. 116 133
      test/testamf1.c
  34. 99 150
      test/testamf2.c
  35. 95 86
      test/testamf3.c
  36. 95 86
      test/testamf4.c
  37. 41 45
      test/testamf5.c
  38. 45 49
      test/testamf6.c
  39. 1 1
      test/testamfth.c

+ 228 - 0
README.amf

@@ -0,0 +1,228 @@
+AMF B.01.01 Implementation
+--------------------------
+This patch contains the basis of the AMF B.01.01 service targeted for release
+in Wilson (1.0).  It is a work in progress and incomplete at this time.
+
+What does AMF do?
+-----------------
+The AMF has many major duties:
+ * issue instantiate, terminate, and cleanup operations for components
+ * assignment of component service instances to components
+ * detection of component faults and executing recovery actions
+
+The AMF starts and stops processes that are part of the component.  A SU
+contains multiple components.  A service group contains multiple SUs.
+A SU is the unit of redundancy used to implement high availability.
+
+The process of starting and stopping components takes place using the CLC
+operations.  The AMF specification is exceedingly clear about which CLC
+operations occur for which component types and openais implements the full
+CLC operations for all of the various component types.
+
+If a component is not sa-aware, the only level of high availability that
+can be applied to the application is through execution of the CLC interfaces.
+
+A special component, called a proxy component, can be used to present an
+sa-aware component to AMF to manage a non-sa-aware component.  This would be 
+useful, for example, to implement a healthcheck operation which runs some
+operation of the unmodified application service.
+
+Components that are sa-aware have been written specifically to the AMF
+interfaces.  These components provide the most support for high availability
+for application developers.
+
+When an sa-aware component is registered, service instances are assigned
+to the component once the service unit is available to take service.  This
+service instance specifies whether the component is ACTIVE or STANDBY.  The
+component is directed by the AMF to enter either ACTIVE or STANDBY states
+and then executes its assigned operational mode.  The number of CSIs assigned
+to a component is determined by a reduction process with 6 levels of
+reduction.  The AMF provides a very clear definition of what is required
+with several examples for each reduction level.
+
+The AMF detects faults through the use of a healthcheck operation.  The user
+specifies in a configuration file healthcheck keys and timing parameters.
+This configuration is then used by the application developer to register
+a healthcheck operation in the AMF.  The healthcheck operation can be started
+or stopped.  Once started, the AMF will periodically send a request to the
+component to determine its level of health.  The AMF reacts to negative
+healthchecks or failed healthchecks by executing a recovery policy.
+
+The recovery policy attempts to restart components first.  When components
+are restarted and fail a certain number of times within a timeout period, the
+entire service unit is failed over.  When SUs on one node are restarted and fail
+a certain number of times within a timeout period, the service unit is failed
+over to a standby service unit.
+
+Currently openais implements most of what is described above.
+
+How to configure AMF
+--------------------
+The AMF doesn't specify a configuration file format.  It does specify many
+configuration options, which are mostly implemented in openais.  The
+configuration file specifies the service groups, service units, service
+instances, recovery configuration options, and information describing where
+components and CLI (command line interface) tools are located.
+
+There are several configuration options which are used to control the component
+life cycle (CLC) of the component.  These configuration options are:
+
+in the group section:
+clccli_path=/home/sdake/amfb-dec/test
+  The path to the CLC CLI applications.
+
+binary_path=/home/sdake/amfb-dec/test
+  The path to the components.
+
+in the unit section:
+bn=testamf1
+  The bn parameter specifies the binary name of the application that should be
+  run by the instantion script.  Note instantiate may already know this
+  information and hence, this is optional.
+
+instantiate=clc_cli_script
+  The instantiate parameter specifies the CLC-CLI binary program to be run to
+  instantiate a component.  An instantiation starts the processes representing
+  the component.
+
+terminate=clc_cli_script
+  The terminate parameter specifies the CLC-CLI binary program to be run to
+  terminate a component.  A terminate CLC terminates the processes representing
+  the component nicely by properly shutting down.
+
+cleanup=clc_cli_script
+  The cleanup parameter specifies the CLC-CLI binary program to be run to
+  cleanup a component.  A cleanup CLC terminates the processes representing
+  the component abruptly.
+
+There are several options to describe the component recovery escalation
+policies.  These are:
+
+component_restart_probation=100000
+  This specifies the number of milliseconds that a component can be restarted
+  in escalation level 0 (only restart components) before escalating to level 1.
+
+component_restart_max=4
+  This specifies the number of times within component_restart_probation period
+  before escalating from level 0 to level 1.
+
+unit_restart_probation=200000
+  This specifies the number of milliseconds that a unit can be restarted
+  in escalation level 1 (restart entire SU) before escalating to level 2.
+
+unit_restart_max=6
+  This specifies the number of times within unit_restart_probation period
+  before escalating from level 1 to level 2.
+
+The AMF will execute a N+M reduction process based upon the number of service
+instances specified in the configuration file and 4 configuration options
+at the groups level:
+
+preferred-active-units=3
+  This is the preferred number of active units that should be active.
+
+maximum-active-instances=3
+  This is the naximum number of active CSIs that can be assigned to a component.
+
+preferred-standby-units=2
+  This is the preferred number of standby units that should be active.
+
+maximum-standby-instances=4
+  This is the naximum number of standby CSIs that can be assigned to a component.
+
+A service instance is specified only as a name.  If there are 4 SIs, the
+reduction process will execute as per the AMF specification to assign the proper
+number of active and standby CSIs to components currently registered.  This
+is a little buggy at the moment.
+
+serviceinstance {
+	name = siaa
+}
+
+Failure detection occurs through the healthcheck option.  The healthcheck
+options are
+key
+  The name of the healthcheck parameter
+
+period
+  The number of milliseconds to wait before issueing a new healthcheck.
+
+maximum_duration
+  The maximum amount of time to wait for a healthcheck to complete before
+  declaring a failure.
+
+
+The example programs
+--------------------
+First the openais test programs should be installed.  When compiling openais
+in the exec directory a file called openais-instantiate is created.  Copy this
+to the test directory
+
+exec# cp openais-instantiate ../test
+
+Set execute permissions for the clc_cli_script
+
+exec# cd ../test
+test# chmod +x ../clc_cli_script
+
+IMPORTANT NOTE:
+Within the amf stanza, the mode variable should be set to enabled.  This option
+defaults to off and the default configuration file turns this off as well.
+This is configured off by default to keep from confusing openais users
+interested in using AIS without the alpha-AMF.
+
+example openais.conf:
+amf {
+	mode: enabled
+}
+
+The following two paths must be set in the groups.conf file:
+       clccli_path=/home/sdake/amfb-l/test
+       binary_path=/home/sdake/amfb-l/test
+
+If these are not set, the path to the clc_cli_script and component binaries
+cannot be determined and AMF will not institate the testamf1 binary.
+
+Once aisexec is run using the default configuration file, 5 service units
+will be instantiated.  The testamf1 C code will be used for all 5 SUs
+and both comp_a and comp_b.  The testamf1 program determines its component
+name at start time from the saAmfComponentNameGet api call.  The result is
+that 10 processes will be started by AMF.
+
+The testamf1 will be assigned CSIs after they execute a saAmfComponentRegister
+operation.  Note this operation causes the presence state of the testamf1
+component to be set to INSTANTIATED as required by the AMF specification.  The
+service instances and their names are defined within the configuration file.
+
+The testamf1 program reports an error via saAmfErrorReport after 10
+healthchecks.  This results in openais calling the cleanup handler, which for
+an sa-aware component, is the CLC_CLI_CLEANUP command.  This causes the cleanup
+operation of the clc_cli_script to be run.  This cleanup command then reads the
+pid of the process that was stored to /var/run at startup of the testamf1
+program.  It then executes a kill -9 on the PID.  Custom cleanup operations can
+be executed by modifying the clc_cli_script script program.
+
+After this is done 4 times (configurable) the entire service
+unit is terminated and restarted. Once this happens 6 times, the code
+escalates to level 2, which is currently unimplemented.
+
+Currently working:
+component register, healthcheck start and stop, csi assignment, n+m with
+all 6 reduction levels, error report, amf response, terminate, cleanup and
+restart escalation levels 0-1, single node (multinode not tested),
+setting presence and operational state of components internally, initial
+assignment of n+m csis based upon configuration options and fully
+following AIS AMF B spec.
+
+Not working or tested:
+escalation levels 2-3 (switchover/failover), protection group tracking,
+protection groups in general, any other model besides n+m, amf B
+specified reassignment of csis to terminated and restarted components,
+support for proxied or non-sa aware components, state machine for n+m
+needs alot of work after initial start.  Timeout periods to reduce
+escalation level for escalation policies are unimplemented.
+
+Any feedback appreciated.
+
+Keep in mind this is very early code and may have many bugs which I'd
+be happy to have reported :).

+ 122 - 35
conf/groups.conf

@@ -1,58 +1,145 @@
 # Test configuration file
 # Test configuration file
-  
+
 group {
 group {
 	name=raid
 	name=raid
 	model=nplusm
 	model=nplusm
-	active-units=1
-	backup-units=2
-		
+	preferred-active-units=3
+	maximum-active-instances=3
+	preferred-standby-units=2
+	maximum-standby-instances=4
+	clccli_path=/home/sdake/amfb-dec/test
+	binary_path=/home/sdake/amfb-dec/test
+	component_restart_probation=100000
+	component_restart_max=4
+	unit_restart_probation=200000
+	unit_restart_max=6
+
 	unit {  
 	unit {  
-		name=raidA
+		name=SU_1
 		component {
 		component {
-			name=comp_a_in_su_x
-			model=x_active
+			name=comp_a_in_su_1
+			comptype=sa_aware
+			bn=testamf1
+			instantiate=clc_cli_script
+			terminate=clc_cli_script
+			cleanup=clc_cli_script
 		}
 		}
 		component {
 		component {
-			name=comp_b_in_su_x
-			model = x_active	
+			name=comp_b_in_su_1
+			comptype=sa_aware
+			bn=testamf1
+			instantiate=clc_cli_script
+			terminate=clc_cli_script
+			cleanup=clc_cli_script
 		}
 		}
 	}
 	}
-	unit {
-		name=raidB
+	unit {  
+		name=SU_2
+		component {
+			name=comp_a_in_su_2
+			comptype=sa_aware
+			bn=testamf1
+			instantiate=clc_cli_script
+			terminate=clc_cli_script
+			cleanup=clc_cli_script
+		}
+		component {
+			name=comp_b_in_su_2
+			comptype=sa_aware
+			bn=testamf1
+			instantiate=clc_cli_script
+			terminate=clc_cli_script
+			cleanup=clc_cli_script
+		}
+	}
+	unit {  
+		name=SU_3
+		component {
+			name=comp_a_in_su_3
+			comptype=sa_aware
+			bn=testamf1
+			instantiate=clc_cli_script
+			terminate=clc_cli_script
+			cleanup=clc_cli_script
+		}
 		component {
 		component {
-			name=comp_a_in_su_y
-			model=x_active
+			name=comp_b_in_su_3
+			comptype=sa_aware
+			bn=testamf1
+			instantiate=clc_cli_script
+			terminate=clc_cli_script
+			cleanup=clc_cli_script
 		}
 		}
+	}
+	unit {  
+		name=SU_4
 		component {
 		component {
-			name=comp_b_in_su_y
-			model = x_active	
+			name=comp_a_in_su_4
+			comptype=sa_aware
+			bn=testamf1
+			instantiate=clc_cli_script
+			terminate=clc_cli_script
+			cleanup=clc_cli_script
+		}
+		component {
+			name=comp_b_in_su_4
+			comptype=sa_aware
+			bn=testamf1
+			instantiate=clc_cli_script
+			terminate=clc_cli_script
+			cleanup=clc_cli_script
 		}
 		}
 	}
 	}
-	unit {
-		name=raidC
+	unit {  
+		name=SU_5
 		component {
 		component {
-			name=comp_a_in_su_z
-			model=x_active
+			name=comp_a_in_su_5
+			comptype=sa_aware
+			bn=testamf1
+			instantiate=clc_cli_script
+			terminate=clc_cli_script
+			cleanup=clc_cli_script
 		}
 		}
 		component {
 		component {
-			name=comp_b_in_su_z
-			model = x_active	
+			name=comp_b_in_su_5
+			comptype=sa_aware
+			bn=testamf1
+			instantiate=clc_cli_script
+			terminate=clc_cli_script
+			cleanup=clc_cli_script
 		}
 		}
 	}
 	}
-# protection group has the same name as a component service instance
-# if one entity of a component service instance fails, the entire
-# service unit fails over to another service unit in the service 
-# instance
-	protection {
-		name = pgA
-		member = comp_a_in_su_x
-		member = comp_a_in_su_y
-		member = comp_a_in_su_z
+	serviceinstance {
+		name = siaa
 	}
 	}
-	protection {
-		name = pgB
-		member = comp_b_in_su_x
-		member = comp_b_in_su_y
-		member = comp_b_in_su_z
+	serviceinstance {
+		name = sibb
 	}
 	}
+	serviceinstance {
+		name = sicc
+	}
+#	serviceinstance {
+#		name = sidd
+#	}
+#	serviceinstance {
+#		name = side
+#	}
+#	serviceinstance {
+#		name = sidf
+#	}
+}
+healthcheck {
+	key = key1
+	period = 500
+	maximum_duration = 550
+}
+healthcheck {
+	key = key2
+	period = 2000
+	maximum_duration = 250
+}
+healthcheck {
+	key = key3
+	period = 3000
+	maximum_duration = 350
 }
 }

+ 4 - 0
conf/openais.conf

@@ -16,3 +16,7 @@ logging {
 	debug: off
 	debug: off
 	timestamp: on
 	timestamp: on
 }
 }
+
+amf {
+	mode: enabled
+}

+ 23 - 20
exec/Makefile

@@ -29,13 +29,13 @@
 # THE POSSIBILITY OF SUCH DAMAGE.
 # THE POSSIBILITY OF SUCH DAMAGE.
 
 
 # Production mode flags
 # Production mode flags
-CFLAGS = -O3 -Wall -fomit-frame-pointer
-LDFLAGS = -lpthread
+#CFLAGS = -O3 -Wall -fomit-frame-pointer
+#LDFLAGS = -lpthread
 
 
 # Debug mode flags
 # Debug mode flags
-#CFLAGS = -g -Wall
-##-DDEBUG
-#LDFLAGS = -g -lpthread
+CFLAGS = -g -Wall 
+#-DDEBUG
+LDFLAGS = -g -lpthread
 
 
 # Profile mode flags
 # Profile mode flags
 #CFLAGS = -O3 -pg
 #CFLAGS = -O3 -pg
@@ -48,15 +48,15 @@ LDFLAGS = -lpthread
 TOTEM_SRC = aispoll.c totemip.c totemnet.c totemrrp.c totemsrp.c totemmrp.c totempg.c totemconfig.c tlist.c hdb.c crypto.c wthread.c
 TOTEM_SRC = aispoll.c totemip.c totemnet.c totemrrp.c totemsrp.c totemmrp.c totempg.c totemconfig.c tlist.c hdb.c crypto.c wthread.c
 TOTEM_OBJS = aispoll.o totemip.o totemnet.o totemrrp.o totemsrp.o totemmrp.o totempg.o totemconfig.o tlist.o hdb.o crypto.o wthread.o
 TOTEM_OBJS = aispoll.o totemip.o totemnet.o totemrrp.o totemsrp.o totemmrp.o totempg.o totemconfig.o tlist.o hdb.o crypto.o wthread.o
 
 
-EXEC_SRC = main.c clm.c amf.c ckpt.c evt.c lck.c evs.c mainparse.c print.c mempool.c \
-		util.c sync.c ykd.c
-EXEC_OBJS = main.o clm.o amf.o ckpt.o evt.o lck.o evs.o mainparse.o print.o mempool.o \
-		util.o sync.o ykd.o
+EXEC_SRC = main.c clm.c amf.c ckpt.c evt.c lck.c evs.c print.c mempool.c \
+		util.c sync.c ykd.c cfg.c mainconfig.c amfconfig.o
+EXEC_OBJS = main.o clm.o amf.o ckpt.o evt.o lck.o evs.o print.o mempool.o \
+		util.o sync.o ykd.o cfg.o mainconfig.o amfconfig.o
 EXEC_LIBS = libtotem_pg.a
 EXEC_LIBS = libtotem_pg.a
 
 
 OBJS = $(TOTEM_OBJS) $(EXEC_OBJS)
 OBJS = $(TOTEM_OBJS) $(EXEC_OBJS)
 
 
-all:libtotem_pg.a libtotem_pg.so.1.0 aisexec keygen
+all:libtotem_pg.a libtotem_pg.so.1.0 aisexec keygen openais-instantiate
 
 
 aisexec: $(EXEC_OBJS) libtotem_pg.a
 aisexec: $(EXEC_OBJS) libtotem_pg.a
 	$(CC) $(LDFLAGS) $(EXEC_OBJS) $(EXEC_LIBS) -o aisexec
 	$(CC) $(LDFLAGS) $(EXEC_OBJS) $(EXEC_LIBS) -o aisexec
@@ -73,6 +73,9 @@ libtotem_pg.so.1.0: $(TOTEM_OBJS)
 keygen: keygen.o
 keygen: keygen.o
 	$(CC) $(LDFLAGS) keygen.o -o keygen
 	$(CC) $(LDFLAGS) keygen.o -o keygen
 
 
+openais-instantiate: openais-instantiate.o
+	$(CC) $(LDFLAGS) openais-instantiate.o -o openais-instantiate
+
 clean:
 clean:
 	rm -f aisexec $(OBJS) libtotem_pg.so.1.0 libtotem_pg.so.1 libtotem_pg.so libtotem_pg.a gmon.out keygen keygen.o *.da *.bb *.bbg
 	rm -f aisexec $(OBJS) libtotem_pg.so.1.0 libtotem_pg.so.1 libtotem_pg.so libtotem_pg.a gmon.out keygen keygen.o *.da *.bb *.bbg
 
 
@@ -120,40 +123,40 @@ totemconfig.o: totemconfig.c
 
 
 main.o: ../include/saAis.h ../include/ipc_evs.h ../include/saAis.h
 main.o: ../include/saAis.h ../include/ipc_evs.h ../include/saAis.h
 main.o: evs.h ../include/saClm.h ../include/ipc_gen.h ../include/list.h
 main.o: evs.h ../include/saClm.h ../include/ipc_gen.h ../include/list.h
-main.o: ../include/queue.h totempg.h aispoll.h totemsrp.h mempool.h mainparse.h
+main.o: ../include/queue.h totempg.h aispoll.h totemsrp.h mempool.h amfconfig.h
 main.o: main.h clm.h ../include/saClm.h amf.h handlers.h ckpt.h evt.h hdb.h
 main.o: main.h clm.h ../include/saClm.h amf.h handlers.h ckpt.h evt.h hdb.h
 main.o: ../include/saEvt.h swab.h print.h
 main.o: ../include/saEvt.h swab.h print.h
 clm.o: ../include/saAis.h ../include/saClm.h ../include/saAis.h
 clm.o: ../include/saAis.h ../include/saClm.h ../include/saAis.h
 clm.o: ../include/ipc_evs.h evs.h ../include/saClm.h ../include/ipc_gen.h
 clm.o: ../include/ipc_evs.h evs.h ../include/saClm.h ../include/ipc_gen.h
 clm.o: ../include/ipc_clm.h ../include/list.h ../include/queue.h aispoll.h
 clm.o: ../include/ipc_clm.h ../include/list.h ../include/queue.h aispoll.h
-clm.o: totempg.h totemsrp.h mainparse.h main.h clm.h amf.h handlers.h ckpt.h
+clm.o: totempg.h totemsrp.h amfconfig.h main.h clm.h amf.h handlers.h ckpt.h
 clm.o: evt.h hdb.h ../include/saEvt.h mempool.h print.h
 clm.o: evt.h hdb.h ../include/saEvt.h mempool.h print.h
 amf.o: ../include/saAis.h ../include/ipc_evs.h ../include/saAis.h
 amf.o: ../include/saAis.h ../include/ipc_evs.h ../include/saAis.h
 amf.o: evs.h ../include/saClm.h ../include/ipc_gen.h ../include/list.h
 amf.o: evs.h ../include/saClm.h ../include/ipc_gen.h ../include/list.h
 amf.o: ../include/queue.h totempg.h aispoll.h totemsrp.h mempool.h util.h
 amf.o: ../include/queue.h totempg.h aispoll.h totemsrp.h mempool.h util.h
-amf.o: mainparse.h main.h clm.h ../include/saClm.h amf.h handlers.h ckpt.h evt.h
+amf.o: amfconfig.h main.h clm.h ../include/saClm.h amf.h handlers.h ckpt.h evt.h
 amf.o: hdb.h ../include/saEvt.h print.h
 amf.o: hdb.h ../include/saEvt.h print.h
 ckpt.o: ../include/saAis.h ../include/ipc_evs.h ../include/saAis.h
 ckpt.o: ../include/saAis.h ../include/ipc_evs.h ../include/saAis.h
 ckpt.o: evs.h ../include/saClm.h ../include/ipc_gen.h ../include/list.h
 ckpt.o: evs.h ../include/saClm.h ../include/ipc_gen.h ../include/list.h
-ckpt.o: ../include/queue.h aispoll.h mempool.h util.h mainparse.h totempg.h
+ckpt.o: ../include/queue.h aispoll.h mempool.h util.h amfconfig.h totempg.h
 ckpt.o: totemsrp.h main.h clm.h ../include/saClm.h amf.h handlers.h ckpt.h
 ckpt.o: totemsrp.h main.h clm.h ../include/saClm.h amf.h handlers.h ckpt.h
 ckpt.o: evt.h hdb.h ../include/saEvt.h print.h
 ckpt.o: evt.h hdb.h ../include/saEvt.h print.h
 evt.o: ../include/ipc_evt.h ../include/saAis.h ../include/saEvt.h
 evt.o: ../include/ipc_evt.h ../include/saAis.h ../include/saEvt.h
 evt.o: ../include/saClm.h ../include/ipc_gen.h ../include/list.h
 evt.o: ../include/saClm.h ../include/ipc_gen.h ../include/list.h
 evt.o: ../include/queue.h util.h ../include/saAis.h aispoll.h mempool.h
 evt.o: ../include/queue.h util.h ../include/saAis.h aispoll.h mempool.h
-evt.o: mainparse.h totempg.h totemsrp.h main.h evs.h clm.h ../include/saClm.h
+evt.o: amfconfig.h totempg.h totemsrp.h main.h evs.h clm.h ../include/saClm.h
 evt.o: amf.h ../include/ipc_evs.h handlers.h ckpt.h evt.h hdb.h
 evt.o: amf.h ../include/ipc_evs.h handlers.h ckpt.h evt.h hdb.h
 evt.o: ../include/saEvt.h swab.h print.h
 evt.o: ../include/saEvt.h swab.h print.h
 evs.o: ../include/saAis.h ../include/ipc_evs.h ../include/saAis.h
 evs.o: ../include/saAis.h ../include/ipc_evs.h ../include/saAis.h
 evs.o: evs.h ../include/saClm.h ../include/ipc_gen.h ../include/list.h
 evs.o: evs.h ../include/saClm.h ../include/ipc_gen.h ../include/list.h
-evs.o: ../include/queue.h aispoll.h totempg.h totemsrp.h mainparse.h main.h clm.h
+evs.o: ../include/queue.h aispoll.h totempg.h totemsrp.h amfconfig.h main.h clm.h
 evs.o: ../include/saClm.h amf.h handlers.h ckpt.h evt.h hdb.h
 evs.o: ../include/saClm.h amf.h handlers.h ckpt.h evt.h hdb.h
 evs.o: ../include/saEvt.h mempool.h print.h
 evs.o: ../include/saEvt.h mempool.h print.h
-mainparse.o: ../include/saAis.h ../include/list.h util.h mainparse.h aispoll.h
-mainparse.o: totempg.h totemsrp.h mempool.h print.h ../include/saClm.h
-mainparse.o: ../include/saAis.h
+amfconfig.o: ../include/saAis.h ../include/list.h util.h amfconfig.h aispoll.h
+amfconfig.o: totempg.h totemsrp.h mempool.h print.h ../include/saClm.h
+amfconfig.o: ../include/saAis.h
 print.o: print.h ../include/saAis.h ../include/saClm.h
 print.o: print.h ../include/saAis.h ../include/saClm.h
-print.o: ../include/saAis.h mainparse.h ../include/list.h aispoll.h totempg.h
+print.o: ../include/saAis.h amfconfig.h ../include/list.h aispoll.h totempg.h
 print.o: totemsrp.h
 print.o: totemsrp.h
 mempool.o: ../include/list.h mempool.h
 mempool.o: ../include/list.h mempool.h
 util.o: ../include/saAis.h ../include/list.h util.h
 util.o: ../include/saAis.h ../include/list.h util.h

File diff suppressed because it is too large
+ 3539 - 1663
exec/amf.c


+ 7 - 3
exec/amf.h

@@ -31,10 +31,10 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * THE POSSIBILITY OF SUCH DAMAGE.
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
  */
-#include "../include/ipc_gen.h"
-#include "../include/ipc_amf.h"
+#include "../include/saAis.h"
+#include "../include/saAmf.h"
 #include "aispoll.h"
 #include "aispoll.h"
-#include "mainparse.h"
+#include "amfconfig.h"
 #include "handlers.h"
 #include "handlers.h"
 
 
 #ifndef AMF_H_DEFINED
 #ifndef AMF_H_DEFINED
@@ -47,10 +47,14 @@ struct libamf_ci_trackentry {
 	SaNameT csiName;
 	SaNameT csiName;
 };
 };
 
 
+struct amf_comp;
 struct libamf_ci {
 struct libamf_ci {
+	struct amf_comp *comp;
+/*
 	struct libamf_ci_trackentry *tracks;
 	struct libamf_ci_trackentry *tracks;
 	int trackEntries;
 	int trackEntries;
 	int trackActive;
 	int trackActive;
+*/
 };
 };
 
 
 void amf_dump ();
 void amf_dump ();

+ 532 - 0
exec/amfconfig.c

@@ -0,0 +1,532 @@
+/*
+ * Copyright (c) 2002-2005 MontaVista Software, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Steven Dake (sdake@mvista.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ *   contributors may be used to endorse or promote products derived from this
+ *   software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <assert.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#include "../include/saAis.h"
+#include "../include/saAmf.h"
+#include "../include/ipc_amf.h"
+#include "../include/list.h"
+#include "util.h"
+#include "amfconfig.h"
+#include "mainconfig.h"
+#include "mempool.h"
+#include "print.h"
+#include "totem.h"
+
+DECLARE_LIST_INIT (amf_groupHead);
+DECLARE_LIST_INIT (amf_healthcheck_head);
+
+static char error_string_response[512];
+
+typedef enum {
+	AMF_HEAD,
+	AMF_GROUP,
+	AMF_UNIT,
+	AMF_COMPONENT,
+	AMF_SERVICEINSTANCE,
+	AMF_HEALTHCHECK
+} amf_parse_t;
+
+typedef enum {
+	MAIN_HEAD,
+	MAIN_NETWORK,
+	MAIN_LOGGING,
+	MAIN_KEY,
+	MAIN_TIMEOUT,
+	MAIN_EVENT
+} main_parse_t;
+
+void setSaNameT (SaNameT *name, char *str) {
+	strncpy ((char *)name->value, str, SA_MAX_NAME_LENGTH);
+	if (strlen ((char *)name->value) > SA_MAX_NAME_LENGTH) {
+		name->length = SA_MAX_NAME_LENGTH;
+	} else {
+		name->length = strlen (str);
+	}
+}
+
+int SaNameTisEqual (SaNameT *str1, char *str2) {
+	if (str1->length == strlen (str2)) {
+		return ((strncmp ((char *)str1->value, (char *)str2,
+			str1->length)) == 0);
+	} else {
+		return 0;
+	}
+}
+
+struct amf_healthcheck *find_healthcheck (SaAmfHealthcheckKeyT *key)
+{
+	struct amf_healthcheck *healthcheck;
+	struct amf_healthcheck *ret_healthcheck = 0;
+	struct list_head *list;
+
+	for (list = amf_healthcheck_head.next;
+		list != &amf_healthcheck_head;
+		list = list->next) {
+
+		healthcheck = list_entry (list,
+			struct amf_healthcheck, list);
+
+		if (memcmp (key, &healthcheck->key, sizeof (SaAmfHealthcheckKeyT)) == 0) {
+			ret_healthcheck = healthcheck;
+			break;
+		}
+	}
+	return (ret_healthcheck);
+}
+
+struct amf_comp *find_comp (SaNameT *name)
+{
+	struct list_head *list_group = 0;
+	struct list_head *list_unit = 0;
+	struct list_head *AmfComponentList = 0;
+
+	struct amf_group *amf_group = 0;
+	struct amf_unit *amf_unit = 0;
+	struct amf_comp *AmfComponent = 0;
+	int found = 0;
+
+	/*
+	 * Search all groups
+	 */
+	for (list_group = amf_groupHead.next;
+		list_group != &amf_groupHead && found == 0;
+		list_group = list_group->next) {
+
+		amf_group = list_entry (list_group,
+			struct amf_group, group_list);
+
+		/*
+		 * Search all units
+		 */
+		for (list_unit = amf_group->unit_head.next;
+			list_unit != &amf_group->unit_head && found == 0;
+			list_unit = list_unit->next) {
+
+			amf_unit = list_entry (list_unit,
+				struct amf_unit, unit_list);
+
+			/*
+			 * Search all components
+			 */
+			for (AmfComponentList = amf_unit->comp_head.next;
+				AmfComponentList != &amf_unit->comp_head && found == 0;
+				AmfComponentList = AmfComponentList->next) {
+
+				AmfComponent = list_entry (AmfComponentList,
+					struct amf_comp, comp_list);
+
+				if (name_match (name, &AmfComponent->name)) {
+					found = 1;
+				}
+			}
+		}
+	}
+
+	if (found) {
+		return (AmfComponent);
+	} else {
+		return (0);
+	}
+}
+
+struct amf_unit *find_unit (SaNameT *name)
+{
+	struct list_head *list_group = 0;
+	struct list_head *list_unit = 0;
+
+	struct amf_group *amf_group = 0;
+	struct amf_unit *amf_unit = 0;
+	int found = 0;
+
+	/*
+	 * Search all groups
+	 */
+	for (list_group = amf_groupHead.next;
+		list_group != &amf_groupHead && found == 0;
+		list_group = list_group->next) {
+
+		amf_group = list_entry (list_group,
+			struct amf_group, group_list);
+
+		/*
+		 * Search all units
+		 */
+		for (list_unit = amf_group->unit_head.next;
+			list_unit != &amf_group->unit_head && found == 0;
+			list_unit = list_unit->next) {
+
+			amf_unit = list_entry (list_unit,
+				struct amf_unit, unit_list);
+
+			if (name_match (name, &amf_unit->name)) {
+				found = 1;
+			}
+		}
+	}
+
+	if (found) {
+		return (amf_unit);
+	} else {
+		return (0);
+	}
+}
+
+extern int openais_amf_config_read (char **error_string)
+{
+	char line[255];
+	FILE *fp;
+	amf_parse_t current_parse = AMF_HEAD;
+	int line_number = 0;
+	char *loc;
+	int i;
+
+	struct amf_group *amf_group = 0;
+	struct amf_unit *amf_unit = 0;
+	struct amf_comp *amf_comp = 0;
+	struct amf_si *amf_si = 0;
+	struct amf_healthcheck *amf_healthcheck = 0;
+
+	fp = fopen ("/etc/ais/groups.conf", "r");
+	if (fp == 0) {
+		sprintf (error_string_response,
+			"Can't read /etc/ais/groups.conf file reason = (%s).\n", strerror (errno));
+		*error_string = error_string_response;
+		return (-1);
+	}
+
+	while (fgets (line, 255, fp)) {
+		line_number += 1;
+		line[strlen(line) - 1] = '\0';
+		/*
+		 * Clear out comments and empty lines
+		 */
+		if (line[0] == '#' || line[0] == '\0' || line[0] == '\n') {
+			continue;
+		}
+
+		/*
+		 * Clear out white space and tabs
+		 */
+		for (i = strlen (line) - 1; i > -1; i--) {
+			if (line[i] == '\t' || line[i] == ' ') {
+				line[i] = '\0';
+			} else {
+				break;
+			}
+		}
+
+		switch (current_parse) {
+		case AMF_HEAD:
+			if (strstr_rs (line, "group{")) {
+				amf_group = (struct amf_group *)mempool_malloc (sizeof (struct amf_group));
+				memset (amf_group, 0, sizeof (struct amf_group));
+				list_init (&amf_group->group_list);
+				list_init (&amf_group->unit_head);
+				list_init (&amf_group->si_head);
+				list_add (&amf_group->group_list, &amf_groupHead);
+				memset (amf_group->clccli_path, 0, sizeof (&amf_unit->clccli_path));
+				memset (amf_group->binary_path, 0, sizeof (&amf_unit->binary_path));
+				current_parse = AMF_GROUP;
+			} else
+			if (strstr_rs (line, "healthcheck{")) {
+				amf_healthcheck = (struct amf_healthcheck *)mempool_malloc (sizeof (struct amf_healthcheck));
+				memset (amf_healthcheck, 0, sizeof (struct amf_healthcheck));
+				list_init (&amf_healthcheck->list);
+				list_add_tail (&amf_healthcheck->list,
+					&amf_healthcheck_head);
+				current_parse = AMF_HEALTHCHECK;
+			} else {
+				goto parse_error;
+			}
+			break;
+
+		case AMF_GROUP:
+			if ((loc = strstr_rs (line, "name=")) != 0) {
+				setSaNameT (&amf_group->name, loc);
+			} else
+			if ((loc = strstr_rs (line, "model=")) != 0) {
+				if (strcmp (loc, "2n") == 0) {
+					amf_group->model = GROUPCAPABILITYMODEL_2N;
+				} else
+				if (strcmp (loc, "nplusm") == 0) {
+					amf_group->model = GROUPCAPABILITYMODEL_NPLUSM;
+				} else
+				if (strcmp (loc, "nway") == 0) {
+					printf ("nway redundancy model not supported.\n");
+					goto parse_error;
+				} else
+				if (strcmp (loc, "nwayactive") == 0) {
+					printf ("nway active redundancy model not supported.\n");
+					goto parse_error;
+				} else
+				if (strcmp (loc, "noredundancy") == 0) {
+					amf_group->model = GROUPCAPABILITYMODEL_NOREDUNDANCY;
+				} else {
+					goto parse_error;
+				}
+			} else
+			if ((loc = strstr_rs (line, "preferred-active-units=")) != 0) {
+				amf_group->preferred_active_units = atoi (loc);
+			} else 
+			if ((loc = strstr_rs (line, "preferred-standby-units=")) != 0) {
+				amf_group->preferred_standby_units = atoi (loc);
+			} else 
+			if ((loc = strstr_rs (line, "maximum-active-instances=")) != 0) {
+				amf_group->maximum_active_instances = atoi (loc);
+			} else 
+			if ((loc = strstr_rs (line, "maximum-standby-instances=")) != 0) {
+				amf_group->maximum_standby_instances = atoi (loc);
+			} else 
+			if ((loc = strstr_rs (line, "clccli_path=")) != 0) {
+				strcpy (amf_group->clccli_path, loc);
+			} else
+			if ((loc = strstr_rs (line, "binary_path=")) != 0) {
+				strcpy (amf_group->binary_path, loc);
+			} else
+			if ((loc = strstr_rs (line, "component_restart_probation=")) != 0) {
+				amf_group->component_restart_probation = atoi (loc);
+				printf ("restart probation %d\n", amf_group->component_restart_probation);
+			} else
+			if ((loc = strstr_rs (line, "component_restart_max=")) != 0) {
+				amf_group->component_restart_max = atoi (loc);
+				printf ("restart max %d\n", amf_group->component_restart_max);
+			} else
+			if ((loc = strstr_rs (line, "unit_restart_probation=")) != 0) {
+				amf_group->unit_restart_probation = atoi (loc);
+				printf ("unit restart probation %d\n", amf_group->unit_restart_probation);
+			} else
+			if ((loc = strstr_rs (line, "unit_restart_max=")) != 0) {
+				amf_group->unit_restart_max = atoi (loc);
+				printf ("unit restart max %d\n", amf_group->unit_restart_max);
+			} else
+
+			if (strstr_rs (line, "unit{")) {
+				amf_unit = (struct amf_unit *)mempool_malloc (sizeof (struct amf_unit));
+				memset (amf_unit, 0, sizeof (struct amf_unit));
+				amf_unit->amf_group = amf_group;
+
+				amf_unit->operational_state = OPENAIS_CFG_OPERATIONALSTATE_DISABLED;
+				amf_unit->presence_state = OPENAIS_CFG_PRESENCESTATE_UNINSTANTIATED;
+				list_init (&amf_unit->comp_head);
+				list_init (&amf_unit->si_head);
+				amf_unit->escalation_level = ESCALATION_LEVEL_NO_ESCALATION;
+				amf_unit->restart_count = 0;
+				list_add_tail (&amf_unit->unit_list, &amf_group->unit_head);
+				memset (amf_unit->clccli_path, 0, sizeof (&amf_unit->clccli_path));
+				memset (amf_unit->binary_path, 0, sizeof (&amf_unit->binary_path));
+				current_parse = AMF_UNIT;
+			} else
+			if (strstr_rs (line, "serviceinstance{")) {
+				amf_si = (struct amf_si *)mempool_malloc (sizeof (struct amf_si));
+				memset (amf_si, 0, sizeof (struct amf_si));
+				list_init (&amf_si->csi_head);
+				list_init (&amf_si->unit_list);
+				list_init (&amf_si->pg_head);
+				list_add_tail (&amf_si->list, &amf_group->si_head);
+				amf_si->group = amf_group;
+				current_parse = AMF_SERVICEINSTANCE;
+			} else
+			if (strstr_rs (line, "}")) {
+				current_parse = AMF_HEAD;
+			} else {
+				goto parse_error;
+			}
+			break;
+
+		case AMF_UNIT:
+			if ((loc = strstr_rs (line, "name=")) != 0) {
+				setSaNameT (&amf_unit->name, loc);
+			} else
+			if ((loc = strstr_rs (line, "component{")) != 0) {
+				amf_comp = (struct amf_comp *)mempool_malloc (sizeof (struct amf_comp));
+				memset (amf_comp, 0, sizeof (struct amf_comp));
+				amf_comp->unit = amf_unit;
+				amf_comp->operational_state = OPENAIS_CFG_OPERATIONALSTATE_DISABLED;
+				amf_comp->presence_state = OPENAIS_CFG_PRESENCESTATE_UNINSTANTIATED;
+
+				list_init (&amf_comp->comp_list);
+				list_init (&amf_comp->healthcheck_list);
+				list_add_tail (&amf_comp->comp_list, &amf_unit->comp_head);
+
+				memset (amf_comp->clccli_path, 0, sizeof (&amf_comp->clccli_path));
+				memset (amf_comp->binary_path, 0, sizeof (&amf_unit->binary_path));
+				memset (amf_comp->binary_name, 0, sizeof (&amf_comp->binary_name));
+
+				current_parse = AMF_COMPONENT;
+			} else
+			if ((loc = strstr_rs (line, "clccli_path=")) != 0) {
+				strcpy (amf_unit->clccli_path, loc);
+			} else
+			if ((loc = strstr_rs (line, "binary_path=")) != 0) {
+				strcpy (amf_unit->binary_path, loc);
+			} else
+			if (strstr_rs (line, "}")) {
+				current_parse = AMF_GROUP;
+			} else {
+				goto parse_error;
+			}
+			break;
+
+		case AMF_COMPONENT:
+			if ((loc = strstr_rs (line, "name=")) != 0) {
+				setSaNameT (&amf_comp->name, loc);
+			} else
+#ifdef COMPILE_OUT
+			if ((loc = strstr_rs (line, "model=")) != 0) {
+				if (strcmp (loc, "x_active_and_y_standby") == 0) {
+					amf_comp->componentCapabilityModel = SA_AMF_COMPONENT_CAPABILITY_X_ACTIVE_AND_Y_STANDBY;
+				} else
+				if (strcmp (loc, "x_active_or_y_standby") == 0) {
+					amf_comp->componentCapabilityModel = SA_AMF_COMPONENT_CAPABILITY_X_ACTIVE_OR_Y_STANDBY;
+				} else
+				if (strcmp (loc, "1_active_or_y_standby") == 0) {
+					amf_comp->componentCapabilityModel = SA_AMF_COMPONENT_CAPABILITY_1_ACTIVE_OR_Y_STANDBY;
+				} else
+				if (strcmp (loc, "1_active_or_1_standby") == 0) {
+					amf_comp->componentCapabilityModel = SA_AMF_COMPONENT_CAPABILITY_1_ACTIVE_OR_1_STANDBY;
+				} else
+				if (strcmp (loc, "x_active") == 0) {
+					amf_comp->componentCapabilityModel = SA_AMF_COMPONENT_CAPABILITY_X_ACTIVE;
+				} else
+				if (strcmp (loc, "1_active") == 0) {
+					amf_comp->componentCapabilityModel = SA_AMF_COMPONENT_CAPABILITY_1_ACTIVE;
+				} else
+				if (strcmp (loc, "no_active") == 0) {
+					amf_comp->componentCapabilityModel = SA_AMF_COMPONENT_CAPABILITY_NO_ACTIVE;
+				} else {
+					goto parse_error;
+				}
+			} else
+#endif
+			if ((loc = strstr_rs(line, "comptype=")) != 0) {
+				if (strstr (line, "sa_aware")) {
+					amf_comp->comptype = clc_component_sa_aware;
+				} else
+				if (strstr (line, "proxied_pre")) {
+					amf_comp->comptype = clc_component_proxied_pre;
+				} else
+				if (strstr (line, "proxied_non_pre")) {
+					amf_comp->comptype = clc_component_proxied_non_pre;
+				} else
+				if (strstr (line, "non_proxied_non_sa_aware")) {
+					amf_comp->comptype = clc_component_proxied_non_pre;
+				} else {
+					goto parse_error;
+				}
+			} else
+			if ((loc = strstr_rs(line, "instantiate=")) != 0) {
+				strcpy (amf_comp->instantiate_cmd, loc);
+			} else
+			if ((loc = strstr_rs(line, "terminate=")) != 0) {
+				strcpy (amf_comp->terminate_cmd, loc);
+			} else
+			if ((loc = strstr_rs(line, "cleanup=")) != 0) {
+				strcpy (amf_comp->cleanup_cmd, loc);
+			} else
+			if ((loc = strstr_rs(line, "am_start=")) != 0) {
+				strcpy (amf_comp->am_start_cmd, loc);
+			} else
+			if ((loc = strstr_rs(line, "am_stop=")) != 0) {
+				strcpy (amf_comp->am_stop_cmd, loc);
+			} else
+			if ((loc = strstr_rs (line, "clccli_path=")) != 0) {
+				strcpy (amf_comp->clccli_path, loc);
+			} else
+			if ((loc = strstr_rs (line, "binary_path=")) != 0) {
+				strcpy (amf_comp->binary_path, loc);
+			} else
+			if ((loc = strstr_rs (line, "bn=")) != 0) {
+				strcpy (amf_comp->binary_name, loc);
+			} else
+			if (strstr_rs (line, "}")) {
+				current_parse = AMF_UNIT;
+			} else {
+				goto parse_error;
+			}
+			break;
+
+		case AMF_SERVICEINSTANCE:
+			if ((loc = strstr_rs (line, "name=")) != 0) {
+				setSaNameT (&amf_si->name, loc);
+			} else
+			if (strstr_rs (line, "}")) {
+				current_parse = AMF_GROUP;
+			} else {
+				goto parse_error;
+			}
+			break;
+
+		case AMF_HEALTHCHECK:
+			if ((loc = strstr_rs (line, "key=")) != 0) {
+				strcpy (amf_healthcheck->key.key, loc);
+				amf_healthcheck->key.keyLen = strlen (loc);
+			} else 
+			if ((loc = strstr_rs (line, "period=")) != 0) {
+				amf_healthcheck->period = atoi (loc);
+			} else
+			if ((loc = strstr_rs (line, "maximum_duration=")) != 0) {
+				amf_healthcheck->maximum_duration = atoi (loc);
+			} else
+			if (strstr_rs (line, "}")) {
+				current_parse = AMF_HEAD;
+			} else {
+				goto parse_error;
+			}
+			break;
+			
+		default:
+			printf ("Invalid state\n");
+			goto parse_error;
+			break;
+		}
+	}
+
+	fclose (fp);
+	return (0);
+
+parse_error:
+	sprintf (error_string_response,
+		"parse error at /etc/groups.conf:%d.\n", line_number);
+	*error_string = error_string_response;
+	fclose (fp);
+	return (-1);
+}

+ 204 - 0
exec/amfconfig.h

@@ -0,0 +1,204 @@
+/*
+ * Copyright (c) 2002-2005 MontaVista Software, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Steven Dake (sdake@mvista.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ *   contributors may be used to endorse or promote products derived from this
+ *   software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <netinet/in.h>
+#include "../include/saAis.h"
+#include "../include/saAmf.h"
+#include "../include/list.h"
+#include "aispoll.h"
+#include "../include/openaisCfg.h"
+
+#ifndef AMFCONFIG_H_DEFINED
+#define AMFCONFIG_H_DEFINED
+
+typedef enum {
+	GROUPCAPABILITYMODEL_2N,
+	GROUPCAPABILITYMODEL_NPLUSM,
+	GROUPCAPABILITYMODEL_NWAY,
+	GROUPCAPABILITYMODEL_NWAYACTIVE,
+	GROUPCAPABILITYMODEL_NOREDUNDANCY
+} SaAmfGroupCapabilityModelT;
+
+#ifdef COMPILE_OUT
+enum amfOperationalAdministrativeState {
+	AMF_DISABLED_UNLOCKED = 0,
+	AMF_DISABLED_LOCKED = 1,
+	AMF_ENABLED_UNLOCKED = 2,
+	AMF_ENABLED_STOPPING = 3
+};
+#endif
+
+struct amf_healthcheck {
+	SaAmfHealthcheckKeyT key;
+	SaTimeT period;
+	SaTimeT maximum_duration;
+	struct amf_comp *comp;
+	struct list_head list;
+};
+
+enum escalation_levels {
+	ESCALATION_LEVEL_NO_ESCALATION = 1,	/* execute component restart */
+        ESCALATION_LEVEL_ONE = 2,		/* escalate to service unit restart */
+        ESCALATION_LEVEL_TWO = 3,		/* escalate to service unit failover */
+        ESCALATION_LEVEL_THREE = 4		/* escalate to node failover */
+};
+
+struct amf_unit {
+	SaNameT name;
+	struct list_head comp_head;
+	struct list_head unit_list;
+	struct amf_group *amf_group;
+	struct list_head si_head;
+	struct list_head si_list;
+	int si_count;
+	OpenaisCfgPresenceStateT presence_state;
+	OpenaisCfgOperationalStateT operational_state;
+	OpenaisCfgReadinessStateT readiness_state;
+	SaAmfHAStateT assigned_ha_state;
+	SaAmfHAStateT requested_ha_state;
+
+	unsigned char clccli_path[1024];
+	unsigned char binary_path[1024];
+
+	poll_timer_handle restart_timer;
+	int restart_count;
+	enum escalation_levels escalation_level;
+};
+
+struct amf_si;
+struct amf_csi {
+	SaNameT name;
+	struct list_head list;
+	struct amf_unit *unit;
+	struct list_head csi_list;
+	struct list_head unit_head;
+	struct amf_si *si;
+	int pg_set;
+};
+
+struct amf_si {
+	SaNameT name;
+	int csi_count;
+	struct list_head list;
+	struct amf_group *group;
+	struct list_head csi_head;
+	struct list_head pg_head;
+	struct list_head unit_list;
+	OpenaisCfgAdministrativeStateT administrative_state;
+	OpenaisCfgOperationalStateT operational_state;
+};
+
+struct amf_pg {
+	SaNameT name;
+	struct amf_comp *comp;
+	struct list_head pg_list;
+	struct list_head pg_comp_head;
+};
+
+struct amf_pg_comp {
+	struct amf_comp *comp;
+	struct amf_csi *csi;
+	struct list_head list;
+};
+
+struct amf_group {
+	SaNameT name;
+	SaAmfGroupCapabilityModelT model;
+	SaUint32T preferred_active_units;;
+	SaUint32T preferred_standby_units;
+	SaUint32T maximum_active_instances;
+	SaUint32T maximum_standby_instances;
+	OpenaisCfgAdministrativeStateT administrativeState;
+	struct list_head group_list;
+	struct list_head unit_head;
+	struct list_head si_head;
+
+	unsigned char clccli_path[1024];
+	unsigned char binary_path[1024];
+
+	unsigned int component_restart_probation;
+	unsigned int component_restart_max;
+
+	unsigned int unit_restart_probation;
+	unsigned int unit_restart_max;
+};
+
+enum clc_component_types {
+	clc_component_sa_aware = 0,			/* sa aware */
+	clc_component_proxied_pre = 1,			/* proxied, pre-instantiable */
+	clc_component_proxied_non_pre = 2,		/* proxied, non pre-instantiable */
+	clc_component_non_proxied_non_sa_aware = 3	/* non-proxied, non sa aware */
+};
+
+struct amf_comp {
+	int registered;
+	int local;
+	struct conn_info *conn_info;
+	SaNameT name;
+	struct in_addr source_addr;
+	struct amf_comp *proxy_comp;
+	struct amf_unit *unit;
+	struct amf_pg *pg;
+	struct amf_csi *csi;
+
+	struct list_head comp_list;
+	struct list_head healthcheck_list;
+
+	enum clc_component_types comptype;
+
+	unsigned char clccli_path[1024];
+	unsigned char binary_path[1024];
+	unsigned char binary_name[1024];
+
+	unsigned char instantiate_cmd[1024];
+	unsigned char terminate_cmd[1024];
+	unsigned char cleanup_cmd[1024];
+	unsigned char am_start_cmd[1024];
+	unsigned char am_stop_cmd[1024];
+	
+	OpenaisCfgAdministrativeStateT administrative_state;
+	OpenaisCfgOperationalStateT operational_state;
+	OpenaisCfgReadinessStateT readiness_state;
+	SaAmfHAStateT ha_state;
+	OpenaisCfgPresenceStateT presence_state;
+};
+
+extern struct list_head amf_group_head;
+
+extern struct amf_comp *find_comp (SaNameT *name);
+
+extern struct amf_unit *find_unit (SaNameT *name);
+
+extern struct amf_healthcheck *find_healthcheck (SaAmfHealthcheckKeyT *key);
+
+#endif /* AMFCONFIG_H_DEFINED */

+ 207 - 0
exec/cfg.c

@@ -0,0 +1,207 @@
+/*
+ * Copyright (c) 2005 MontaVista Software, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Steven Dake (sdake@mvista.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ *   contributors may be used to endorse or promote products derived from this
+ *   software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <sys/types.h>
+#include <sys/uio.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <signal.h>
+#include <string.h>
+
+#include "../include/saAis.h"
+#include "../include/openaisCfg.h"
+#include "../include/ipc_gen.h"
+#include "../include/ipc_cfg.h"
+#include "../include/list.h"
+#include "../include/queue.h"
+#include "totempg.h"
+#include "aispoll.h"
+#include "mempool.h"
+#include "util.h"
+#include "handlers.h"
+
+#define LOG_SERVICE LOG_SERVICE_AMF
+#include "print.h"
+#define LOG_LEVEL_FROM_LIB LOG_LEVEL_DEBUG
+#define LOG_LEVEL_FROM_GMI LOG_LEVEL_DEBUG
+#define LOG_LEVEL_ENTER_FUNC LOG_LEVEL_DEBUG
+
+static int cfg_confchg_fn (
+	enum totem_configuration_type configuration_type,
+    struct in_addr *member_list, int member_list_entries,
+    struct in_addr *left_list, int left_list_entries,
+    struct in_addr *joined_list, int joined_list_entries,
+	struct memb_ring_id *ring_id);
+
+static int cfg_exit_fn (struct conn_info *conn_info);
+
+static int cfg_exec_init_fn (struct openais_config *);
+
+static int cfg_init_two_fn (struct conn_info *conn_info);
+
+static int message_handler_req_lib_cfg_statetrackstart (struct conn_info *conn_info, void *message);
+
+static int message_handler_req_lib_cfg_statetrackstop (struct conn_info *conn_info, void *message);
+
+static int message_handler_req_lib_cfg_administrativestateset (struct conn_info *conn_info, void *message);
+
+static int message_handler_req_lib_cfg_administrativestateget (struct conn_info *conn_info, void *message);
+
+/*
+ * Service Handler Definition
+ */
+struct libais_handler cfg_libais_handlers[] =
+{
+	{ /* 0 */
+		.libais_handler_fn	= message_handler_req_lib_cfg_statetrackstart,
+		.response_size		= sizeof (struct res_lib_cfg_statetrackstart),
+		.response_id		= MESSAGE_RES_CFG_STATETRACKSTART,
+		.flow_control		= FLOW_CONTROL_REQUIRED
+	},
+	{ /* 1 */
+		.libais_handler_fn	= message_handler_req_lib_cfg_statetrackstop,
+		.response_size		= sizeof (struct res_lib_cfg_statetrackstop),
+		.response_id		= MESSAGE_RES_CFG_STATETRACKSTOP,
+		.flow_control		= FLOW_CONTROL_REQUIRED
+	},
+	{ /* 2 */
+		.libais_handler_fn	= message_handler_req_lib_cfg_administrativestateset,
+		.response_size		= sizeof (struct res_lib_cfg_administrativestateset),
+		.response_id		= MESSAGE_RES_CFG_ADMINISTRATIVESTATESET,
+		.flow_control		= FLOW_CONTROL_NOT_REQUIRED
+	},
+	{ /* 3 */
+		.libais_handler_fn	= message_handler_req_lib_cfg_administrativestateget,
+		.response_size		= sizeof (struct res_lib_cfg_administrativestateget),
+		.response_id		= MESSAGE_RES_CFG_ADMINISTRATIVESTATEGET,
+		.flow_control		= FLOW_CONTROL_NOT_REQUIRED
+	}
+};
+
+int (*cfg_aisexec_handler_fns[]) (void *, struct in_addr source_addr, int endian_conversion_required) = {
+/*
+	message_handler_req_exec_cfg_componentregister,
+	message_handler_req_exec_cfg_componentunregister,
+	message_handler_req_exec_cfg_componenterrorreport,
+	message_handler_req_exec_cfg_componenterrorclear,
+*/
+};
+
+/*
+ * Exports the interface for the service
+ */
+struct service_handler cfg_service_handler = {
+	.libais_handlers			= cfg_libais_handlers,
+	.libais_handlers_count		= sizeof (cfg_libais_handlers) / sizeof (struct libais_handler),
+	.aisexec_handler_fns		= cfg_aisexec_handler_fns,
+	.aisexec_handler_fns_count	= sizeof (cfg_aisexec_handler_fns) / sizeof (int (*)),
+	.confchg_fn					= cfg_confchg_fn,
+	.libais_init_two_fn			= cfg_init_two_fn,
+	.libais_exit_fn				= cfg_exit_fn,
+	.exec_init_fn				= cfg_exec_init_fn,
+};
+
+/* IMPL */
+
+static int cfg_exec_init_fn (struct openais_config *openais_config)
+{
+	return (0);
+}
+static int cfg_confchg_fn (
+	enum totem_configuration_type configuration_type,
+    struct in_addr *member_list, int member_list_entries,
+    struct in_addr *left_list, int left_list_entries,
+    struct in_addr *joined_list, int joined_list_entries,
+	struct memb_ring_id *ring_id)
+{
+	return (0);
+}
+
+int cfg_exit_fn (struct conn_info *conn_info)
+{
+	return (0);
+}
+
+static int cfg_init_two_fn (struct conn_info *conn_info)
+{
+        log_printf (LOG_LEVEL_DEBUG, "Got request to initalize configuration service.\n");
+
+        list_init (&conn_info->conn_list);
+
+        return (0);
+}
+
+/*
+ * Library Interface Implementation
+ */
+static int message_handler_req_lib_cfg_statetrackstart (struct conn_info *conn_info, void *message)
+{
+	struct req_lib_cfg_statetrackstart *req_lib_cfg_statetrackstart = (struct req_lib_cfg_statetrackstart *)message;
+
+	log_printf (LOG_LEVEL_FROM_LIB,
+		"Handle : message_handler_req_lib_cfg_statetrackstart()\n");
+
+	return (0);
+}
+
+static int message_handler_req_lib_cfg_statetrackstop (struct conn_info *conn_info, void *message)
+{
+	struct req_lib_cfg_statetrackstop *req_lib_cfg_statetrackstop = (struct req_lib_cfg_statetrackstop *)message;
+
+	log_printf (LOG_LEVEL_FROM_LIB,
+		"Handle : message_handler_req_lib_cfg_administrativestateget()\n");
+	return (0);
+}
+
+static int message_handler_req_lib_cfg_administrativestateset (struct conn_info *conn_info, void *message)
+{
+	struct req_lib_cfg_administrativestateset *req_lib_cfg_administrativestateset = (struct req_lib_cfg_administrativestateset *)message;
+	log_printf (LOG_LEVEL_FROM_LIB,
+		"Handle : message_handler_req_lib_cfg_administrativestateset()\n");
+	return (0);
+}
+static int message_handler_req_lib_cfg_administrativestateget (struct conn_info *conn_info, void *message)
+{
+	struct req_lib_cfg_administrativestateget *req_lib_cfg_administrativestateget = (struct req_lib_cfg_administrativestateget *)message;
+	log_printf (LOG_LEVEL_FROM_LIB,
+		"Handle : message_handler_req_lib_cfg_administrativestateget()\n");
+	return (0);
+}
+

+ 44 - 0
exec/cfg.h

@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2005 MontaVista Software, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Steven Dake (sdake@mvista.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ *   contributors may be used to endorse or promote products derived from this
+ *   software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "../include/ipc_gen.h"
+#include "../include/ipc_cfg.h"
+#include "aispoll.h"
+#include "handlers.h"
+
+#ifndef CFG_H_DEFINED
+#define CFG_H_DEFINED
+
+extern struct service_handler cfg_service_handler;
+
+#endif /* CFG_H_DEFINED */

+ 7 - 4
exec/main.c

@@ -63,7 +63,8 @@
 #include "totempg.h"
 #include "totempg.h"
 #include "totemsrp.h"
 #include "totemsrp.h"
 #include "mempool.h"
 #include "mempool.h"
-#include "mainparse.h"
+#include "mainconfig.h"
+#include "amfconfig.h"
 #include "totemconfig.h"
 #include "totemconfig.h"
 #include "main.h"
 #include "main.h"
 #include "handlers.h"
 #include "handlers.h"
@@ -74,7 +75,7 @@
 #include "ckpt.h"
 #include "ckpt.h"
 #include "evt.h"
 #include "evt.h"
 #include "lck.h"
 #include "lck.h"
-#include "ykd.h"
+#include "cfg.h"
 #include "swab.h"
 #include "swab.h"
 
 
 #define LOG_SERVICE LOG_SERVICE_MAIN
 #define LOG_SERVICE LOG_SERVICE_MAIN
@@ -94,14 +95,15 @@ struct service_handler *ais_service_handlers[] = {
     &amf_service_handler,
     &amf_service_handler,
     &ckpt_service_handler,
     &ckpt_service_handler,
     &evt_service_handler,
     &evt_service_handler,
-    &lck_service_handler
+    &lck_service_handler,
+	&cfg_service_handler
 };
 };
 
 
 struct sync_callbacks sync_callbacks[5];
 struct sync_callbacks sync_callbacks[5];
 
 
 int sync_callback_count;
 int sync_callback_count;
 
 
-#define AIS_SERVICE_HANDLERS_COUNT 6
+#define AIS_SERVICE_HANDLERS_COUNT 7
 #define AIS_SERVICE_HANDLER_AISEXEC_FUNCTIONS_MAX 50
 #define AIS_SERVICE_HANDLER_AISEXEC_FUNCTIONS_MAX 50
 
 
  /*
  /*
@@ -816,6 +818,7 @@ static void aisexec_handler_fns_build (void)
 		for (j = 0; j < ais_service_handlers[i]->aisexec_handler_fns_count; j++) {
 		for (j = 0; j < ais_service_handlers[i]->aisexec_handler_fns_count; j++) {
 			aisexec_handler_fns[aisexec_handler_fns_count++] = 
 			aisexec_handler_fns[aisexec_handler_fns_count++] = 
 				ais_service_handlers[i]->aisexec_handler_fns[j];
 				ais_service_handlers[i]->aisexec_handler_fns[j];
+				printf ("pos %d %x\n", aisexec_handler_fns_count - 1, ais_service_handlers[i]->aisexec_handler_fns[j]);
 		}
 		}
 	}
 	}
 	log_printf (LOG_LEVEL_DEBUG, "built %d handler functions\n", aisexec_handler_fns_count);
 	log_printf (LOG_LEVEL_DEBUG, "built %d handler functions\n", aisexec_handler_fns_count);

+ 30 - 29
exec/main.h

@@ -37,6 +37,8 @@
 #include <sys/un.h>
 #include <sys/un.h>
 #include "../include/saAis.h"
 #include "../include/saAis.h"
 #include "../include/queue.h"
 #include "../include/queue.h"
+#include "../include/ipc_gen.h"
+#include "mainconfig.h"
 #include "poll.h"
 #include "poll.h"
 #include "evs.h"
 #include "evs.h"
 #include "clm.h"
 #include "clm.h"
@@ -103,7 +105,7 @@ struct conn_info {
 	struct queue outq;		/* Circular queue for outgoing requests */
 	struct queue outq;		/* Circular queue for outgoing requests */
 	int byte_start;			/* Byte to start sending from in head of queue */
 	int byte_start;			/* Byte to start sending from in head of queue */
 	enum service_types service;/* Type of service so dispatch knows how to route message */
 	enum service_types service;/* Type of service so dispatch knows how to route message */
-	struct saAmfComponent *component;	/* Component for which this connection relates to  TODO shouldn't this be in the ci structure */
+//	struct saAmfComponent *component;	/* Component for which this connection relates to  TODO shouldn't this be in the ci structure */
 	int authenticated;		/* Is this connection authenticated? */
 	int authenticated;		/* Is this connection authenticated? */
 	struct list_head conn_list;
 	struct list_head conn_list;
 	struct ais_ci ais_ci;	/* libais connection information */
 	struct ais_ci ais_ci;	/* libais connection information */
@@ -115,34 +117,33 @@ struct conn_info {
 enum nodeexec_message_types {
 enum nodeexec_message_types {
 	MESSAGE_REQ_EXEC_EVS_MCAST = 0,
 	MESSAGE_REQ_EXEC_EVS_MCAST = 0,
 	MESSAGE_REQ_EXEC_CLM_NODEJOIN = 1,
 	MESSAGE_REQ_EXEC_CLM_NODEJOIN = 1,
-	MESSAGE_REQ_EXEC_AMF_COMPONENTREGISTER = 2,
-	MESSAGE_REQ_EXEC_AMF_COMPONENTUNREGISTER = 3,
-	MESSAGE_REQ_EXEC_AMF_ERRORREPORT = 4,
-	MESSAGE_REQ_EXEC_AMF_ERRORCANCELALL = 5,
-	MESSAGE_REQ_EXEC_AMF_READINESSSTATESET = 6,
-	MESSAGE_REQ_EXEC_AMF_HASTATESET = 7,
-	MESSAGE_REQ_EXEC_CKPT_CHECKPOINTOPEN = 8,
-	MESSAGE_REQ_EXEC_CKPT_CHECKPOINTCLOSE = 9,
-	MESSAGE_REQ_EXEC_CKPT_CHECKPOINTUNLINK = 10,
-	MESSAGE_REQ_EXEC_CKPT_CHECKPOINTRETENTIONDURATIONSET = 11,
-	MESSAGE_REQ_EXEC_CKPT_CHECKPOINTRETENTIONDURATIONEXPIRE = 12,
-	MESSAGE_REQ_EXEC_CKPT_SECTIONCREATE = 13,
-	MESSAGE_REQ_EXEC_CKPT_SECTIONDELETE = 14,
-	MESSAGE_REQ_EXEC_CKPT_SECTIONEXPIRATIONTIMESET = 15,
-	MESSAGE_REQ_EXEC_CKPT_SECTIONWRITE = 16,
-	MESSAGE_REQ_EXEC_CKPT_SECTIONOVERWRITE = 17,
-	MESSAGE_REQ_EXEC_CKPT_SECTIONREAD = 18,
-	MESSAGE_REQ_EXEC_CKPT_SYNCHRONIZESTATE = 19,
-	MESSAGE_REQ_EXEC_CKPT_SYNCHRONIZESECTION = 20,
-	MESSAGE_REQ_EXEC_EVT_EVENTDATA = 21,
-	MESSAGE_REQ_EXEC_EVT_CHANCMD = 22,
-	MESSAGE_REQ_EXEC_EVT_RECOVERY_EVENTDATA = 23,
-	MESSAGE_REQ_EXEC_LCK_RESOURCEOPEN = 24,
-	MESSAGE_REQ_EXEC_LCK_RESOURCECLOSE = 25,
-	MESSAGE_REQ_EXEC_LCK_RESOURCELOCK = 26,
-	MESSAGE_REQ_EXEC_LCK_RESOURCEUNLOCK = 27,
-	MESSAGE_REQ_EXEC_LCK_RESOURCELOCKORPHAN = 28,
-	MESSAGE_REQ_EXEC_LCK_LOCKPURGE = 29
+	MESSAGE_REQ_EXEC_AMF_OPERATIONAL_STATE_COMP_SET = 2,
+	MESSAGE_REQ_EXEC_AMF_PRESENCE_STATE_COMP_SET = 3,
+	MESSAGE_REQ_EXEC_AMF_ADMINISTRATIVE_STATE_CSI_SET = 4,
+	MESSAGE_REQ_EXEC_AMF_ADMINISTRATIVE_STATE_UNIT_SET = 5,
+	MESSAGE_REQ_EXEC_AMF_ADMINISTRATIVE_STATE_GROUP_SET = 6,
+	MESSAGE_REQ_EXEC_CKPT_CHECKPOINTOPEN = 7,
+	MESSAGE_REQ_EXEC_CKPT_CHECKPOINTCLOSE = 8,
+	MESSAGE_REQ_EXEC_CKPT_CHECKPOINTUNLINK = 9,
+	MESSAGE_REQ_EXEC_CKPT_CHECKPOINTRETENTIONDURATIONSET = 10,
+	MESSAGE_REQ_EXEC_CKPT_CHECKPOINTRETENTIONDURATIONEXPIRE = 11,
+	MESSAGE_REQ_EXEC_CKPT_SECTIONCREATE = 12,
+	MESSAGE_REQ_EXEC_CKPT_SECTIONDELETE = 13,
+	MESSAGE_REQ_EXEC_CKPT_SECTIONEXPIRATIONTIMESET = 14,
+	MESSAGE_REQ_EXEC_CKPT_SECTIONWRITE = 15,
+	MESSAGE_REQ_EXEC_CKPT_SECTIONOVERWRITE = 16,
+	MESSAGE_REQ_EXEC_CKPT_SECTIONREAD = 17,
+	MESSAGE_REQ_EXEC_CKPT_SYNCHRONIZESTATE = 18,
+	MESSAGE_REQ_EXEC_CKPT_SYNCHRONIZESECTION = 19,
+	MESSAGE_REQ_EXEC_EVT_EVENTDATA = 20,
+	MESSAGE_REQ_EXEC_EVT_CHANCMD = 21,
+	MESSAGE_REQ_EXEC_EVT_RECOVERY_EVENTDATA = 22,
+	MESSAGE_REQ_EXEC_LCK_RESOURCEOPEN = 23,
+	MESSAGE_REQ_EXEC_LCK_RESOURCECLOSE = 24,
+	MESSAGE_REQ_EXEC_LCK_RESOURCELOCK = 25,
+	MESSAGE_REQ_EXEC_LCK_RESOURCEUNLOCK = 26,
+	MESSAGE_REQ_EXEC_LCK_RESOURCELOCKORPHAN = 27,
+	MESSAGE_REQ_EXEC_LCK_LOCKPURGE = 28
 };
 };
 
 
 extern struct totem_ip_address *this_ip;
 extern struct totem_ip_address *this_ip;

+ 260 - 0
exec/mainconfig.c

@@ -0,0 +1,260 @@
+/*
+ * Copyright (c) 2002-2005 MontaVista Software, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Steven Dake (sdake@mvista.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ *   contributors may be used to endorse or promote products derived from this
+ *   software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <assert.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#include "../include/saAis.h"
+#include "../include/list.h"
+#include "util.h"
+#include "mainconfig.h"
+#include "mempool.h"
+#include "print.h"
+#include "totem.h"
+
+DECLARE_LIST_INIT (saAmfGroupHead);
+
+static char error_string_response[512];
+
+typedef enum {
+	MAIN_HEAD,
+	MAIN_LOGGING,
+	MAIN_EVENT,
+	MAIN_AMF
+} main_parse_t;
+
+char *strstr_rs (const char *haystack, const char *needle)
+{
+	char *end_address;
+	char *new_needle;
+
+	new_needle = (char *)mempool_strdup (needle);
+	new_needle[strlen(new_needle) - 1] = '\0';
+
+	end_address = strstr (haystack, new_needle);
+	if (end_address) {
+		end_address += strlen (new_needle);
+		end_address = strstr (end_address, needle + strlen (new_needle));
+	}
+	if (end_address) {
+		end_address += 1; /* skip past { or = */
+		do {
+			if (*end_address == '\t' || *end_address == ' ') {
+				end_address++;
+			} else {
+				break;
+			}
+		} while (*end_address != '\0');
+	}
+
+	mempool_free (new_needle);
+	return (end_address);
+}
+
+extern int openais_main_config_read (char **error_string,
+    struct openais_config *openais_config,
+	int interface_max)
+{
+	FILE *fp;
+	int line_number = 0;
+	main_parse_t parse = MAIN_HEAD;
+	int logging_parsed = 0;
+	int event_parsed = 0;
+	int amf_parsed = 0;
+	char *loc;
+	int i;
+	int parse_done = 0;
+	char line[512];
+	char *error_reason = error_string_response;
+
+	memset (openais_config, 0, sizeof (struct openais_config));
+	fp = fopen ("/etc/ais/openais.conf", "r");
+	if (fp == 0) {
+		parse_done = 1;
+		sprintf (error_reason, "Can't read file reason = (%s)\n", strerror (errno));
+		*error_string = error_reason;
+		return -1;
+	}
+
+	while (fgets (line, 255, fp)) {
+		line_number += 1;
+		line[strlen(line) - 1] = '\0';
+		/*
+		 * Clear out white space and tabs
+		 */
+		for (i = strlen (line) - 1; i > -1; i--) {
+			if (line[i] == '\t' || line[i] == ' ') {
+				line[i] = '\0';
+			} else {
+				break;
+			}
+		}
+		/*
+		 * Clear out comments and empty lines
+		 */
+		if (line[0] == '#' || line[0] == '\0') {
+			continue;
+		}
+			
+		line_number += 1;
+
+		switch (parse) {
+		case MAIN_HEAD:
+			if (logging_parsed == 0 && strstr_rs (line, "logging{")) {
+				logging_parsed = 1;
+				parse = MAIN_LOGGING;
+			} else
+			if (event_parsed == 0 && strstr_rs (line, "event{")) {
+				event_parsed = 1;
+				parse = MAIN_EVENT;
+			} else
+			if (amf_parsed == 0 && strstr_rs (line, "amf{")) {
+				amf_parsed = 1;
+				parse = MAIN_AMF;
+			} else {
+				continue;
+			}
+			break;
+
+		case MAIN_LOGGING:
+			if ((loc = strstr_rs (line, "logoutput:"))) {
+				if (strcmp (loc, "file") == 0) {
+					openais_config->logmode |= LOG_MODE_FILE;
+				} else
+				if (strcmp (loc, "syslog") == 0) {
+					openais_config->logmode |= LOG_MODE_SYSLOG;
+				} else
+				if (strcmp (loc, "stderr") == 0) {
+					openais_config->logmode |= LOG_MODE_STDERR;
+				} else {
+					goto parse_error;
+				}
+			} else
+			if ((loc = strstr_rs (line, "debug:"))) {
+				if (strcmp (loc, "on") == 0) {
+					openais_config->logmode |= LOG_MODE_DEBUG;
+				} else
+				if (strcmp (loc, "off") == 0) {
+					openais_config->logmode &= ~LOG_MODE_DEBUG;
+				} else {
+					goto parse_error;
+				}
+			} else
+			if ((loc = strstr_rs (line, "timestamp:"))) {
+				if (strcmp (loc, "on") == 0) {
+					openais_config->logmode |= LOG_MODE_TIMESTAMP;
+				} else
+				if (strcmp (loc, "off") == 0) {
+					openais_config->logmode &= ~LOG_MODE_TIMESTAMP;
+				} else {
+					goto parse_error;
+				}
+			} else 
+			if ((loc = strstr_rs (line, "logfile:"))) {
+				openais_config->logfile = strdup (loc);
+			} else
+			if ((loc = strstr_rs (line, "}"))) {
+				parse = MAIN_HEAD;
+			} else {
+				goto parse_error;
+			}
+			break;
+
+		case MAIN_EVENT:
+			if ((loc = strstr_rs (line, "delivery_queue_size:"))) {
+					openais_config->evt_delivery_queue_size = atoi(loc);
+			} else if ((loc = strstr_rs (line, "delivery_queue_resume:"))) {
+					openais_config->evt_delivery_queue_resume = atoi(loc);
+			} else if ((loc = strstr_rs (line, "}"))) {
+				parse = MAIN_HEAD;
+			} else {
+				goto parse_error;
+			}
+			break;
+
+		case MAIN_AMF:
+			if ((loc = strstr_rs (line, "mode:"))) {
+				if (strcmp (loc, "enabled") == 0) {
+					openais_config->amf_enabled = 1;
+				} else
+				if (strcmp (loc, "disabled") == 0) {
+					openais_config->amf_enabled = 0;
+				} else {
+					goto parse_error;
+				}
+			} else
+			if ((loc = strstr_rs (line, "}"))) {
+				parse = MAIN_HEAD;
+			} else {
+				goto parse_error;
+			}
+			break;
+
+		default:
+			assert (0 == 1); /* SHOULDN'T HAPPEN */
+			break;	
+		}
+	}
+
+	if ((openais_config->logmode & LOG_MODE_FILE) && openais_config->logfile == 0) {
+		error_reason = "logmode set to 'file' but no logfile specified";
+		goto parse_error;
+	}
+
+	if (parse == MAIN_HEAD) {
+		fclose (fp);
+		return (0);
+	} else {
+		error_reason = "Missing closing brace";
+		goto parse_error;
+	}
+
+parse_error:
+	if (parse_done) {
+		sprintf (error_string_response,
+			"parse error in /etc/ais/openais.conf: %s.\n", error_reason);
+	} else {
+		sprintf (error_string_response,
+			"parse error in /etc/ais/openais.conf: %s (line %d).\n",
+			error_reason, line_number);
+	}
+	*error_string = error_string_response;
+	fclose (fp);
+	return (-1);
+}

+ 71 - 0
exec/mainconfig.h

@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2002-2005 MontaVista Software, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Steven Dake (sdake@mvista.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ *   contributors may be used to endorse or promote products derived from this
+ *   software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <netinet/in.h>
+#include "../include/saAis.h"
+#include "../include/list.h"
+#include "aispoll.h"
+#include "totemsrp.h"
+#include "totempg.h"
+
+#ifndef MAINCONFIG_H_DEFINED
+#define MAINCONFIG_H_DEFINED
+
+struct openais_config {
+	/*
+	 * logging
+	 */
+	int logmode;
+	char *logfile;
+
+	/*
+	 * Event service
+	 */
+	unsigned int evt_delivery_queue_size;
+	unsigned int evt_delivery_queue_resume;
+
+	/*
+	 * AMF service
+	 */
+	unsigned int amf_enabled;
+
+	struct totem_config totem_config;
+};
+
+extern char *strstr_rs (const char *haystack, const char *needle);
+
+extern int openais_main_config_read (char **error_string,
+	struct openais_config *openais_config,
+	int interface_max);
+	
+#endif /* MAINCONFIG_H_DEFINED */

+ 0 - 556
exec/mainparse.c

@@ -1,556 +0,0 @@
-/*
- * Copyright (c) 2002-2004 MontaVista Software, Inc.
- *
- * All rights reserved.
- *
- * Author: Steven Dake (sdake@mvista.com)
- *
- * This software licensed under BSD license, the text of which follows:
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * - Redistributions of source code must retain the above copyright notice,
- *   this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * - Neither the name of the MontaVista Software, Inc. nor the names of its
- *   contributors may be used to endorse or promote products derived from this
- *   software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <assert.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include "../include/saAis.h"
-#include "../include/list.h"
-#include "util.h"
-#include "mainparse.h"
-#include "mempool.h"
-#include "print.h"
-#include "totem.h"
-
-DECLARE_LIST_INIT (saAmfGroupHead);
-
-static char error_string_response[512];
-
-typedef enum {
-	AMF_HEAD,
-	AMF_GROUP,
-	AMF_UNIT,
-	AMF_PROTECTION,
-	AMF_COMPONENT
-} amf_parse_t;
-
-typedef enum {
-	MAIN_HEAD,
-	MAIN_LOGGING,
-	MAIN_EVENT
-} main_parse_t;
-
-void setSaNameT (SaNameT *name, char *str) {
-	strncpy ((char *)name->value, str, SA_MAX_NAME_LENGTH);
-	if (strlen ((char *)name->value) > SA_MAX_NAME_LENGTH) {
-		name->length = SA_MAX_NAME_LENGTH;
-	} else {
-		name->length = strlen (str);
-	}
-}
-
-int SaNameTisEqual (SaNameT *str1, char *str2) {
-	if (str1->length == strlen (str2)) {
-		return ((strncmp ((char *)str1->value, (char *)str2,
-			str1->length)) == 0);
-	} else {
-		return 0;
-	}
-}
-
-struct saAmfComponent *findComponent (SaNameT *name)
-{
-	struct list_head *AmfGroupList = 0;
-	struct list_head *AmfUnitList = 0;
-	struct list_head *AmfComponentList = 0;
-
-	struct saAmfGroup *saAmfGroup = 0;
-	struct saAmfUnit *AmfUnit = 0;
-	struct saAmfComponent *AmfComponent = 0;
-	int found = 0;
-
-	/*
-	 * Search all groups
-	 */
-	for (AmfGroupList = saAmfGroupHead.next;
-		AmfGroupList != &saAmfGroupHead && found == 0;
-		AmfGroupList = AmfGroupList->next) {
-
-		saAmfGroup = list_entry (AmfGroupList,
-			struct saAmfGroup, saAmfGroupList);
-
-		/*
-		 * Search all units
-		 */
-		for (AmfUnitList = saAmfGroup->saAmfUnitHead.next;
-			AmfUnitList != &saAmfGroup->saAmfUnitHead && found == 0;
-			AmfUnitList = AmfUnitList->next) {
-
-			AmfUnit = list_entry (AmfUnitList,
-				struct saAmfUnit, saAmfUnitList);
-
-			/*
-			 * Search all components
-			 */
-			for (AmfComponentList = AmfUnit->saAmfComponentHead.next;
-				AmfComponentList != &AmfUnit->saAmfComponentHead && found == 0;
-				AmfComponentList = AmfComponentList->next) {
-
-				AmfComponent = list_entry (AmfComponentList,
-					struct saAmfComponent, saAmfComponentList);
-
-				if (name_match (name, &AmfComponent->name)) {
-					found = 1;
-				}
-			}
-		}
-	}
-
-	if (found) {
-		return (AmfComponent);
-	} else {
-		return (0);
-	}
-}
-
-static inline char *
-strstr_rs (const char *haystack, const char *needle)
-{
-	char *end_address;
-	char *new_needle;
-
-	new_needle = (char *)mempool_strdup (needle);
-	new_needle[strlen(new_needle) - 1] = '\0';
-
-	end_address = strstr (haystack, new_needle);
-	if (end_address) {
-		end_address += strlen (new_needle);
-		end_address = strstr (end_address, needle + strlen (new_needle));
-	}
-	if (end_address) {
-		end_address += 1; /* skip past { or = */
-		do {
-			if (*end_address == '\t' || *end_address == ' ') {
-				end_address++;
-			} else {
-				break;
-			}
-		} while (*end_address != '\0');
-	}
-
-	mempool_free (new_needle);
-	return (end_address);
-}
-
-extern int openais_amf_config_read (char **error_string)
-{
-	char line[255];
-	FILE *fp;
-	amf_parse_t current_parse = AMF_HEAD;
-	int line_number = 0;
-	char *loc;
-	int i;
-
-	struct saAmfGroup *saAmfGroup = 0;
-	struct saAmfUnit *saAmfUnit = 0;
-	struct saAmfProtectionGroup *saAmfProtectionGroup = 0;
-	struct saAmfComponent *saAmfComponent = 0;
-	struct list_head *findAmfUnitList = 0;
-	struct list_head *findAmfComponentList = 0;
-	struct saAmfUnit *findAmfUnit = 0;
-	struct saAmfComponent *findAmfComponent = 0;
-	SaNameT componentName;
-
-	fp = fopen ("/etc/ais/groups.conf", "r");
-	if (fp == 0) {
-		sprintf (error_string_response,
-			"Can't read /etc/ais/groups.conf file reason = (%s).\n", strerror (errno));
-		*error_string = error_string_response;
-		return (-1);
-	}
-
-	while (fgets (line, 255, fp)) {
-		line_number += 1;
-		line[strlen(line) - 1] = '\0';
-		/*
-		 * Clear out white space and tabs
-		 */
-		for (i = strlen (line) - 1; i > -1; i--) {
-			if (line[i] == '\t' || line[i] == ' ') {
-				line[i] = '\0';
-			} else {
-				break;
-			}
-		}
-		/*
-		 * Clear out comments and empty lines
-		 */
-		if (line[0] == '#' || line[0] == '\0') {
-			continue;
-		}
-			
-		switch (current_parse) {
-		case AMF_HEAD:
-			if (strstr_rs (line, "group{")) {
-				saAmfGroup = (struct saAmfGroup *)mempool_malloc (sizeof (struct saAmfGroup));
-				memset (saAmfGroup, 0, sizeof (struct saAmfGroup));
-				list_init (&saAmfGroup->saAmfGroupList);
-				list_init (&saAmfGroup->saAmfUnitHead);
-				list_init (&saAmfGroup->saAmfProtectionGroupHead);
-				list_add (&saAmfGroup->saAmfGroupList, &saAmfGroupHead);
-				current_parse = AMF_GROUP;
-			} else
-			if (strcmp (line, "") == 0) {
-			} else {
-				goto parse_error;
-			}
-			break;
-
-		case AMF_GROUP:
-			if ((loc = strstr_rs (line, "name=")) != 0) {
-				setSaNameT (&saAmfGroup->name, loc);
-			} else
-			if ((loc = strstr_rs (line, "model=")) != 0) {
-				if (strcmp (loc, "2n") == 0) {
-					saAmfGroup->model = GROUPCAPABILITYMODEL_2N;
-				} else
-				if (strcmp (loc, "nplusm") == 0) {
-					saAmfGroup->model = GROUPCAPABILITYMODEL_NPLUSM;
-				} else
-				if (strcmp (loc, "nway") == 0) {
-					printf ("nway redundancy model not supported.\n");
-					goto parse_error;
-				} else
-				if (strcmp (loc, "nwayactive") == 0) {
-					printf ("nway active redundancy model not supported.\n");
-					goto parse_error;
-				} else
-				if (strcmp (loc, "noredundancy") == 0) {
-					saAmfGroup->model = GROUPCAPABILITYMODEL_NOREDUNDANCY;
-				} else {
-					goto parse_error;
-				}
-			} else
-			if ((loc = strstr_rs (line, "active-units=")) != 0) {
-				saAmfGroup->saAmfActiveUnitsDesired = atoi (loc);
-			} else 
-			if ((loc = strstr_rs (line, "backup-units=")) != 0) {
-				saAmfGroup->saAmfStandbyUnitsDesired = atoi (loc);
-			} else 
-			if (strstr_rs (line, "unit{")) {
-				saAmfUnit = (struct saAmfUnit *)mempool_malloc (sizeof (struct saAmfUnit));
-				memset (saAmfUnit, 0, sizeof (struct saAmfUnit));
-				saAmfUnit->saAmfGroup = saAmfGroup;
-
-				list_init (&saAmfUnit->saAmfComponentHead);
-				list_add (&saAmfUnit->saAmfUnitList, &saAmfGroup->saAmfUnitHead);
-				current_parse = AMF_UNIT;
-			} else
-			if (strstr_rs (line, "protection{")) {
-				saAmfProtectionGroup = (struct saAmfProtectionGroup *)mempool_malloc (sizeof (struct saAmfProtectionGroup));
-				memset (saAmfProtectionGroup, 0, sizeof (struct saAmfProtectionGroup));
-				list_init (&saAmfProtectionGroup->saAmfMembersHead);
-				list_init (&saAmfProtectionGroup->saAmfProtectionGroupList);
-				list_add (&saAmfProtectionGroup->saAmfProtectionGroupList, &saAmfGroup->saAmfProtectionGroupHead);
-
-				current_parse = AMF_PROTECTION;
-			} else
-			if (strstr_rs (line, "}")) {
-				current_parse = AMF_HEAD;
-			} else {
-				goto parse_error;
-			}
-			break;
-
-		case AMF_UNIT:
-			if ((loc = strstr_rs (line, "name=")) != 0) {
-				setSaNameT (&saAmfUnit->name, loc);
-			} else
-			if ((loc = strstr_rs (line, "component{")) != 0) {
-				saAmfComponent = (struct saAmfComponent *)mempool_malloc (sizeof (struct saAmfComponent));
-				memset (saAmfComponent, 0, sizeof (struct saAmfComponent));
-				saAmfComponent->saAmfUnit = saAmfUnit;
-				saAmfComponent->currentReadinessState = SA_AMF_OUT_OF_SERVICE;
-				saAmfComponent->newReadinessState = SA_AMF_OUT_OF_SERVICE;
-				saAmfComponent->currentHAState = SA_AMF_QUIESCED;
-				saAmfComponent->newHAState = SA_AMF_QUIESCED;
-				saAmfComponent->healthcheckInterval = 100;
-				list_init (&saAmfComponent->saAmfComponentList);
-				list_init (&saAmfComponent->saAmfProtectionGroupList);
-				list_add (&saAmfComponent->saAmfComponentList, &saAmfUnit->saAmfComponentHead);
-
-				current_parse = AMF_COMPONENT;
-			} else
-			if (strstr_rs (line, "}")) {
-				current_parse = AMF_GROUP;
-			} else {
-				goto parse_error;
-			}
-			break;
-
-		case AMF_COMPONENT:
-			if ((loc = strstr_rs (line, "name=")) != 0) {
-				setSaNameT (&saAmfComponent->name, loc);
-			} else
-			if ((loc = strstr_rs (line, "model=")) != 0) {
-				if (strcmp (loc, "x_active_and_y_standby") == 0) {
-					saAmfComponent->componentCapabilityModel = SA_AMF_COMPONENT_CAPABILITY_X_ACTIVE_AND_Y_STANDBY;
-				} else
-				if (strcmp (loc, "x_active_or_y_standby") == 0) {
-					saAmfComponent->componentCapabilityModel = SA_AMF_COMPONENT_CAPABILITY_X_ACTIVE_OR_Y_STANDBY;
-				} else
-				if (strcmp (loc, "1_active_or_y_standby") == 0) {
-					saAmfComponent->componentCapabilityModel = SA_AMF_COMPONENT_CAPABILITY_1_ACTIVE_OR_Y_STANDBY;
-				} else
-				if (strcmp (loc, "1_active_or_1_standby") == 0) {
-					saAmfComponent->componentCapabilityModel = SA_AMF_COMPONENT_CAPABILITY_1_ACTIVE_OR_1_STANDBY;
-				} else
-				if (strcmp (loc, "x_active") == 0) {
-					saAmfComponent->componentCapabilityModel = SA_AMF_COMPONENT_CAPABILITY_X_ACTIVE;
-				} else
-				if (strcmp (loc, "1_active") == 0) {
-					saAmfComponent->componentCapabilityModel = SA_AMF_COMPONENT_CAPABILITY_1_ACTIVE;
-				} else
-				if (strcmp (loc, "no_active") == 0) {
-					saAmfComponent->componentCapabilityModel = SA_AMF_COMPONENT_CAPABILITY_NO_ACTIVE;
-				} else {
-					goto parse_error;
-				}
-			} else
-			if (strstr_rs (line, "}")) {
-				current_parse = AMF_UNIT;
-			} else {
-				goto parse_error;
-			}
-			break;
-
-		case AMF_PROTECTION:
-			if ((loc = strstr_rs (line, "name=")) != 0) {
-				setSaNameT (&saAmfProtectionGroup->name, loc);
-			} else
-			if ((loc = strstr_rs (line, "member=")) != 0) {
-				for (findAmfUnitList = saAmfGroup->saAmfUnitHead.next;
-					findAmfUnitList != &saAmfGroup->saAmfUnitHead;
-					findAmfUnitList = findAmfUnitList->next) {
-
-					findAmfUnit = list_entry (findAmfUnitList, 
-						struct saAmfUnit, saAmfUnitList);
-					for (findAmfComponentList = findAmfUnit->saAmfComponentHead.next;
-						findAmfComponentList != &findAmfUnit->saAmfComponentHead;
-						findAmfComponentList = findAmfComponentList->next) {
-
-						findAmfComponent = list_entry (findAmfComponentList, 
-							struct saAmfComponent, saAmfComponentList);
-
-						if (SaNameTisEqual (&findAmfComponent->name, loc)) {
-							list_add (&findAmfComponent->saAmfProtectionGroupList,
-								&saAmfProtectionGroup->saAmfMembersHead);
-						}
-					}
-					/*
-					 * Connect component to protection group
-					 */
-					setSaNameT (&componentName, loc);
-					saAmfComponent = findComponent (&componentName);
-					saAmfComponent->saAmfProtectionGroup = saAmfProtectionGroup;
-				}
-			} else
-			if (strstr_rs (line, "}")) {
-				current_parse = AMF_GROUP;
-			} else {
-				goto parse_error;
-			}
-			break;
-
-		default:
-			printf ("Invalid state\n");
-			goto parse_error;
-			break;
-		}
-	}
-
-	fclose (fp);
-	return (0);
-
-parse_error:
-	sprintf (error_string_response,
-		"parse error at /etc/groups.conf:%d.\n", line_number);
-	*error_string = error_string_response;
-	fclose (fp);
-	return (-1);
-}
-
-extern int openais_main_config_read (char **error_string,
-    struct openais_config *openais_config,
-	int interface_max)
-{
-	FILE *fp;
-	int line_number = 0;
-	main_parse_t parse = MAIN_HEAD;
-	int logging_parsed = 0;
-	int event_parsed = 0;
-	char *loc;
-	int i;
-	int parse_done = 0;
-	char line[512];
-	char *error_reason = error_string_response;
-
-	memset (openais_config, 0, sizeof (struct openais_config));
-	fp = fopen ("/etc/ais/openais.conf", "r");
-	if (fp == 0) {
-		parse_done = 1;
-		sprintf (error_reason, "Can't read file reason = (%s)\n", strerror (errno));
-		*error_string = error_reason;
-		return -1;
-	}
-
-	while (fgets (line, 255, fp)) {
-		line_number += 1;
-		line[strlen(line) - 1] = '\0';
-		/*
-		 * Clear out white space and tabs
-		 */
-		for (i = strlen (line) - 1; i > -1; i--) {
-			if (line[i] == '\t' || line[i] == ' ') {
-				line[i] = '\0';
-			} else {
-				break;
-			}
-		}
-		/*
-		 * Clear out comments and empty lines
-		 */
-		if (line[0] == '#' || line[0] == '\0') {
-			continue;
-		}
-			
-		line_number += 1;
-
-		switch (parse) {
-		case MAIN_HEAD:
-			if (logging_parsed == 0 && strstr_rs (line, "logging{")) {
-				logging_parsed = 1;
-				parse = MAIN_LOGGING;
-			} else
-			if (event_parsed == 0 && strstr_rs (line, "event{")) {
-				event_parsed = 1;
-				parse = MAIN_EVENT;
-			} else {
-				continue;
-			}
-			break;
-
-		case MAIN_LOGGING:
-			if ((loc = strstr_rs (line, "logoutput:"))) {
-				if (strcmp (loc, "file") == 0) {
-					openais_config->logmode |= LOG_MODE_FILE;
-				} else
-				if (strcmp (loc, "syslog") == 0) {
-					openais_config->logmode |= LOG_MODE_SYSLOG;
-				} else
-				if (strcmp (loc, "stderr") == 0) {
-					openais_config->logmode |= LOG_MODE_STDERR;
-				} else {
-					goto parse_error;
-				}
-			} else
-			if ((loc = strstr_rs (line, "debug:"))) {
-				if (strcmp (loc, "on") == 0) {
-					openais_config->logmode |= LOG_MODE_DEBUG;
-				} else
-				if (strcmp (loc, "off") == 0) {
-					openais_config->logmode &= ~LOG_MODE_DEBUG;
-				} else {
-					goto parse_error;
-				}
-			} else
-			if ((loc = strstr_rs (line, "timestamp:"))) {
-				if (strcmp (loc, "on") == 0) {
-					openais_config->logmode |= LOG_MODE_TIMESTAMP;
-				} else
-				if (strcmp (loc, "off") == 0) {
-					openais_config->logmode &= ~LOG_MODE_TIMESTAMP;
-				} else {
-					goto parse_error;
-				}
-			} else 
-			if ((loc = strstr_rs (line, "logfile:"))) {
-				openais_config->logfile = strdup (loc);
-			} else
-			if ((loc = strstr_rs (line, "}"))) {
-				parse = MAIN_HEAD;
-			} else {
-				goto parse_error;
-			}
-			break;
-
-		case MAIN_EVENT:
-			if ((loc = strstr_rs (line, "delivery_queue_size:"))) {
-					openais_config->evt_delivery_queue_size = atoi(loc);
-			} else if ((loc = strstr_rs (line, "delivery_queue_resume:"))) {
-					openais_config->evt_delivery_queue_resume = atoi(loc);
-			} else if ((loc = strstr_rs (line, "}"))) {
-				parse = MAIN_HEAD;
-			} else {
-				goto parse_error;
-			}
-			break;
-
-		default:
-			assert (0 == 1); /* SHOULDN'T HAPPEN */
-			break;	
-		}
-	}
-
-	if ((openais_config->logmode & LOG_MODE_FILE) && openais_config->logfile == 0) {
-		error_reason = "logmode set to 'file' but no logfile specified";
-		goto parse_error;
-	}
-
-	if (parse == MAIN_HEAD) {
-		fclose (fp);
-		return (0);
-	} else {
-		error_reason = "Missing closing brace";
-		goto parse_error;
-	}
-
-parse_error:
-	if (parse_done) {
-		sprintf (error_string_response,
-			"parse error in /etc/ais/openais.conf: %s.\n", error_reason);
-	} else {
-		sprintf (error_string_response,
-			"parse error in /etc/ais/openais.conf: %s (line %d).\n",
-			error_reason, line_number);
-	}
-	*error_string = error_string_response;
-	fclose (fp);
-	return (-1);
-}

+ 0 - 180
exec/mainparse.h

@@ -1,180 +0,0 @@
-/*
- * Copyright (c) 2002-2004 MontaVista Software, Inc.
- *
- * All rights reserved.
- *
- * Author: Steven Dake (sdake@mvista.com)
- *
- * This software licensed under BSD license, the text of which follows:
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * - Redistributions of source code must retain the above copyright notice,
- *   this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * - Neither the name of the MontaVista Software, Inc. nor the names of its
- *   contributors may be used to endorse or promote products derived from this
- *   software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include <netinet/in.h>
-#include "../include/saAis.h"
-#include "../include/list.h"
-#include "aispoll.h"
-#include "totemsrp.h"
-#include "totempg.h"
-
-#ifndef PARSE_H_DEFINED
-#define PARSE_H_DEFINED
-
-typedef enum {
-	GROUPCAPABILITYMODEL_2N,
-	GROUPCAPABILITYMODEL_NPLUSM,
-	GROUPCAPABILITYMODEL_NWAY,
-	GROUPCAPABILITYMODEL_NWAYACTIVE,
-	GROUPCAPABILITYMODEL_NOREDUNDANCY
-} SaAmfGroupCapabilityModelT;
-
-enum amfOperationalAdministrativeState {
-	AMF_DISABLED_UNLOCKED = 0,
-	AMF_DISABLED_LOCKED = 1,
-	AMF_ENABLED_UNLOCKED = 2,
-	AMF_ENABLED_STOPPING = 3
-};
-
-struct openais_config {
-	/*
-	 * logging
-	 */
-	int logmode;
-	char *logfile;
-
-	/*
-	 * Event service
-	 */
-	unsigned int evt_delivery_queue_size;
-	unsigned int evt_delivery_queue_resume;
-
-	struct totem_config totem_config;
-};
-
-struct saAmfUnit {
-	SaNameT name;
-	struct list_head saAmfComponentHead;
-	struct list_head saAmfUnitList;
-	enum amfOperationalAdministrativeState operationalAdministrativeState;
-	struct saAmfGroup *saAmfGroup;
-};
-
-struct saAmfProtectionGroup {
-	SaNameT name;
-	struct list_head saAmfMembersHead;
-	struct list_head saAmfProtectionGroupList;
-};
-
-struct saAmfGroup {
-	SaNameT name;
-	SaAmfGroupCapabilityModelT model;
-	SaUint32T saAmfActiveUnitsDesired;
-	SaUint32T saAmfStandbyUnitsDesired;
-	struct list_head saAmfGroupList;
-	struct list_head saAmfProtectionGroupHead;
-	struct list_head saAmfUnitHead;
-};
-
-/*
- * State machines for states in AMF
- */
-enum amfOperationalState {
-	AMF_OPER_DISABLED,
-	AMF_OPER_ENABLED
-};
-
-enum amfAdministrativeState {
-	AMF_ADMIN_UNLOCKED,
-	AMF_ADMIN_LOCKED,
-	AMF_ADMIN_STOPPING
-};
-
-enum amfEnabledUnlockedState {
-	AMF_ENABLED_UNLOCKED_INITIAL = 0,
-	AMF_ENABLED_UNLOCKED_IN_SERVICE_REQUESTED,
-	AMF_ENABLED_UNLOCKED_IN_SERVICE_COMPLETED,
-	AMF_ENABLED_UNLOCKED_ACTIVE_REQUESTED,
-	AMF_ENABLED_UNLOCKED_ACTIVE_COMPLETED,
-	AMF_ENABLED_UNLOCKED_STANDBY_REQUESTED,
-	AMF_ENABLED_UNLOCKED_STANDBY_COMPLETED
-};
-
-enum amfDisabledUnlockedState {
-	AMF_DISABLED_UNLOCKED_REGISTEREDORERRORCANCEL = 0,
-	AMF_DISABLED_UNLOCKED_FAILED,
-	AMF_DISABLED_UNLOCKED_QUIESCED_REQUESTED,
-	AMF_DISABLED_UNLOCKED_QUIESCED_COMPLETED,
-	AMF_DISABLED_UNLOCKED_OUT_OF_SERVICE_REQUESTED,
-	AMF_DISABLED_UNLOCKED_OUT_OF_SERVICE_COMPLETED
-};
-	
-enum amfDisabledLockedState {
-	AMF_DISABLED_LOCKED_INITIAL = 0,
-	AMF_DISABLED_LOCKED_QUIESCED_REQUESTED,
-	AMF_DISABLED_LOCKED_QUIESCED_COMPLETED,
-	AMF_DISABLED_LOCKED_OUT_OF_SERVICE_REQUESTED,
-	AMF_DISABLED_LOCKED_OUT_OF_SERVICE_COMPLETED
-};
-
-enum amfEnabledStoppingState {
-	AMF_ENABLED_STOPPING_INITIAL = 0,
-	AMF_ENABLED_STOPPING_STOPPING_REQUESTED,
-	AMF_ENABLED_STOPPING_STOPPING_COMPLETED
-};
-
-struct saAmfComponent {
-	int registered;
-	int local;
-	struct conn_info *conn_info;
-	struct totem_ip_address source_addr;
-	SaNameT name;
-	SaAmfReadinessStateT currentReadinessState;
-	SaAmfReadinessStateT newReadinessState;
-	SaAmfHAStateT currentHAState;
-	SaAmfHAStateT newHAState;
-	enum amfEnabledUnlockedState enabledUnlockedState;
-	enum amfDisabledUnlockedState disabledUnlockedState;
-	SaAmfComponentCapabilityModelT componentCapabilityModel;
-	SaAmfProbableCauseT probableCause;
-	int healthcheckInterval;
-	poll_timer_handle timer_healthcheck;
-	int healthcheck_outstanding;
-	struct saAmfComponent *saAmfProxyComponent;
-	struct list_head saAmfComponentList;
-	struct list_head saAmfProtectionGroupList;
-	struct saAmfUnit *saAmfUnit;
-	struct saAmfProtectionGroup *saAmfProtectionGroup;
-};
-
-extern struct list_head saAmfGroupHead;
-
-extern struct saAmfComponent *findComponent (SaNameT *name);
-
-extern int openais_amf_config_read (char **error_string);
-
-extern int openais_main_config_read (char **error_string,
-	struct openais_config *openais_config,
-	int interface_max);
-	
-#endif /* PARSE_H_DEFINED */

+ 99 - 0
exec/openais-instantiate.c

@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2005 MontaVista Software, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Steven Dake (sdake@mvista.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ *   contributors may be used to endorse or promote products derived from this
+ *   software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <time.h>
+#include <unistd.h>
+#include <semaphore.h>
+#include <errno.h>
+#include <string.h>
+
+struct timespec sleeptime = {
+	.tv_sec = 0,
+	.tv_nsec = 10000 /* 10 msec */
+};
+
+/*
+ * The method by which the status is returned from execve
+ * needs some performance enhancement
+ */
+int main (int argc, char **argv, char **envp)
+{
+	pid_t pid;
+	pid_t res;
+	int status;
+	int i;
+
+	pid = fork();
+	if (pid == -1) {
+		printf ("openais-instantiate: could not fork process %s\n", strerror (errno));
+		return (errno);
+	}
+	if (pid) {
+		/*
+		 * Wait for a status code for at most 100 msec (10 * sleeptime)
+		 * if child never returns a code, it is assumed to have been instantiated
+		 */
+		for (i = 0; i < 10; i++) {
+			res = waitpid (pid, &status, WNOHANG);
+			if (res) {
+				if (WEXITSTATUS(status) == 0) {
+					printf ("openais-instantiate: component instantiated\n");
+					return (0);
+				} else {
+					printf ("openais-instantiate: could not instantiate component (return code %d = %s)\n",
+						WEXITSTATUS(status),
+						strerror (WEXITSTATUS(status)));
+					return (errno);
+				}
+			}
+			nanosleep (&sleeptime, 0);
+			
+		}
+		printf ("openais-instantiate: component instantiated\n");
+		return (0);
+	} else {
+
+printf ("childs pid %d\n", getpid());
+		/*
+		 * child process
+		 */
+		res = execve (argv[1], &argv[2], envp);
+		if (res == -1) {
+			return (errno);
+		}
+	}
+	return (0);
+}

+ 3 - 1
exec/sync.c

@@ -58,6 +58,8 @@
 
 
 #define LOG_SERVICE LOG_SERVICE_SYNC
 #define LOG_SERVICE LOG_SERVICE_SYNC
 
 
+#define MESSAGE_REQ_SYNC_BARRIER 0
+
 struct barrier_data {
 struct barrier_data {
 	struct totem_ip_address addr;
 	struct totem_ip_address addr;
 	int completed;
 	int completed;
@@ -125,7 +127,7 @@ static int sync_barrier_send (struct memb_ring_id *ring_id)
 	int res;
 	int res;
 
 
 	req_exec_sync_barrier_start.header.size = sizeof (struct req_exec_sync_barrier_start);
 	req_exec_sync_barrier_start.header.size = sizeof (struct req_exec_sync_barrier_start);
-	req_exec_sync_barrier_start.header.id = MESSAGE_REQ_EXEC_SYNC_BARRIER;
+	req_exec_sync_barrier_start.header.id = MESSAGE_REQ_SYNC_BARRIER;
 
 
 	memcpy (&req_exec_sync_barrier_start.ring_id, ring_id,
 	memcpy (&req_exec_sync_barrier_start.ring_id, ring_id,
 		sizeof (struct memb_ring_id));
 		sizeof (struct memb_ring_id));

+ 2 - 3
exec/totemconfig.c

@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2002-2004 MontaVista Software, Inc.
+ * Copyright (c) 2002-2005 MontaVista Software, Inc.
  *
  *
  * All rights reserved.
  * All rights reserved.
  *
  *
@@ -70,7 +70,7 @@ static char error_string_response[512];
 
 
 typedef enum {
 typedef enum {
 	MAIN_HEAD,
 	MAIN_HEAD,
-	MAIN_TOTEM
+	MAIN_TOTEM,
 } main_parse_t;
 } main_parse_t;
 
 
 static inline char *
 static inline char *
@@ -266,7 +266,6 @@ extern int totem_config_read (
 				goto parse_error;
 				goto parse_error;
 			}
 			}
 			break;
 			break;
-
 		default:
 		default:
 			assert (0 == 1); /* SHOULDN'T HAPPEN */
 			assert (0 == 1); /* SHOULDN'T HAPPEN */
 			break;	
 			break;	

+ 2 - 0
exec/totemip.c

@@ -132,6 +132,8 @@ int totemip_localhost(int family, struct totem_ip_address *localhost)
 {
 {
 	char *addr_text;
 	char *addr_text;
 
 
+	memset (localhost, 0, sizeof (struct totem_ip_address));
+
 	if (family == AF_INET)
 	if (family == AF_INET)
 		addr_text = LOCALHOST_IPV4;
 		addr_text = LOCALHOST_IPV4;
 	else
 	else

+ 134 - 93
include/ipc_amf.h

@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2002-2004 MontaVista Software, Inc.
+ * Copyright (c) 2002-2005 MontaVista Software, Inc.
  *
  *
  * All rights reserved.
  * All rights reserved.
  *
  *
@@ -39,49 +39,42 @@
 #include "saAis.h"
 #include "saAis.h"
 #include "ais_amf.h"
 #include "ais_amf.h"
 
 
-enum req_amf_response_interfaces {
-	MESSAGE_REQ_AMF_RESPONSE_SAAMFHEALTHCHECKCALLBACK = 1,
-	MESSAGE_REQ_AMF_RESPONSE_SAAMFREADINESSSTATESETCALLBACK,
-	MESSAGE_REQ_AMF_RESPONSE_SAAMFCOMPONENTTERMINATECALLBACK,
-	MESSAGE_REQ_AMF_RESPONSE_SAAMFCSISETCALLBACK,
-	MESSAGE_REQ_AMF_RESPONSE_SAAMFCSIREMOVECALLBACK,
-	MESSAGE_REQ_AMF_RESPONSE_SAAMFEXTERNALCOMPONENTRESTARTCALLBACK,
-	MESSAGE_REQ_AMF_RESPONSE_SAAMFEXTERNALCOMPONENTCONTROLCALLBACK,
-	MESSAGE_REQ_AMF_RESPONSE_SAAMFPENDINGOPERATIONCONFIRMCALLBACK
-};
-
-enum req_amf_types {
+enum req_lib_amf_types {
 	MESSAGE_REQ_AMF_COMPONENTREGISTER = 0,
 	MESSAGE_REQ_AMF_COMPONENTREGISTER = 0,
-	MESSAGE_REQ_AMF_COMPONENTUNREGISTER,
-	MESSAGE_REQ_AMF_READINESSSTATEGET,
-	MESSAGE_REQ_AMF_HASTATEGET,
-	MESSAGE_REQ_AMF_PROTECTIONGROUPTRACKSTART,
-	MESSAGE_REQ_AMF_PROTECTIONGROUPTRACKSTOP,
-	MESSAGE_REQ_AMF_ERRORREPORT,
-	MESSAGE_REQ_AMF_ERRORCANCELALL,
-	MESSAGE_REQ_AMF_STOPPINGCOMPLETE,
-	MESSAGE_REQ_AMF_RESPONSE,
-	MESSAGE_REQ_AMF_COMPONENTCAPABILITYMODELGET
+	MESSAGE_REQ_AMF_COMPONENTUNREGISTER = 1,
+	MESSAGE_REQ_AMF_PMSTART = 2,
+	MESSAGE_REQ_AMF_PMSTOP = 3,
+	MESSAGE_REQ_AMF_HEALTHCHECKSTART = 4,
+	MESSAGE_REQ_AMF_HEALTHCHECKCONFIRM = 5,
+	MESSAGE_REQ_AMF_HEALTHCHECKSTOP = 6,
+	MESSAGE_REQ_AMF_HASTATEGET = 7,
+	MESSAGE_REQ_AMF_CSIQUIESCINGCOMPLETE = 8,
+	MESSAGE_REQ_AMF_PROTECTIONGROUPTRACKSTART = 9,
+	MESSAGE_REQ_AMF_PROTECTIONGROUPTRACKSTOP = 10,
+	MESSAGE_REQ_AMF_COMPONENTERRORREPORT = 11,
+	MESSAGE_REQ_AMF_COMPONENTERRORCLEAR = 12,
+	MESSAGE_REQ_AMF_RESPONSE = 13
 };
 };
 
 
 enum res_lib_amf_types {
 enum res_lib_amf_types {
 	MESSAGE_RES_AMF_COMPONENTREGISTER = 0,
 	MESSAGE_RES_AMF_COMPONENTREGISTER = 0,
-	MESSAGE_RES_AMF_COMPONENTUNREGISTER,
-	MESSAGE_RES_AMF_READINESSSTATEGET,
-	MESSAGE_RES_AMF_HASTATEGET,
-	MESSAGE_RES_AMF_HEALTHCHECKCALLBACK,
-	MESSAGE_RES_AMF_READINESSSTATESETCALLBACK,
-	MESSAGE_RES_AMF_COMPONENTTERMINATECALLBACK,
-	MESSAGE_RES_AMF_CSISETCALLBACK,
-	MESSAGE_RES_AMF_CSIREMOVECALLBACK,
-	MESSAGE_RES_AMF_PROTECTIONGROUPTRACKSTART,
-	MESSAGE_RES_AMF_PROTECTIONGROUPTRACKCALLBACK,
-	MESSAGE_RES_AMF_PROTECTIONGROUPTRACKSTOP,
-	MESSAGE_RES_AMF_COMPONENTCAPABILITYMODELGET,
-	MESSAGE_RES_AMF_ERRORREPORT,
-	MESSAGE_RES_AMF_ERRORCANCELALL,
-	MESSAGE_RES_AMF_STOPPINGCOMPLETE,
-	MESSAGE_RES_AMF_RESPONSE
+	MESSAGE_RES_AMF_COMPONENTUNREGISTER = 1,
+	MESSAGE_RES_AMF_PMSTART = 2,
+	MESSAGE_RES_AMF_PMSTOP = 3,
+	MESSAGE_RES_AMF_HEALTHCHECKSTART = 4,
+	MESSAGE_RES_AMF_HEALTHCHECKCONFIRM = 5,
+	MESSAGE_RES_AMF_HEALTHCHECKSTOP = 6,
+	MESSAGE_RES_AMF_HASTATEGET = 7,
+	MESSAGE_RES_AMF_CSIQUIESCINGCOMPLETE = 8,
+	MESSAGE_RES_AMF_PROTECTIONGROUPTRACKSTART = 9,
+	MESSAGE_RES_AMF_PROTECTIONGROUPTRACKSTOP = 10,
+	MESSAGE_RES_AMF_COMPONENTERRORREPORT = 11,
+	MESSAGE_RES_AMF_COMPONENTERRORCLEAR = 12,
+	MESSAGE_RES_AMF_RESPONSE = 13,
+	MESSAGE_RES_AMF_CSISETCALLBACK = 14,
+	MESSAGE_RES_AMF_HEALTHCHECKCALLBACK = 15,
+	MESSAGE_RES_AMF_CSIREMOVECALLBACK = 16,
+	MESSAGE_RES_AMF_COMPONENTTERMINATECALLBACK = 17,
 };
 };
 
 
 struct req_lib_amf_componentregister {
 struct req_lib_amf_componentregister {
@@ -104,38 +97,65 @@ struct res_lib_amf_componentunregister {
 	struct res_header header;
 	struct res_header header;
 };
 };
 
 
-struct req_amf_readinessstateget {
+struct req_lib_amf_pmstart {
 	struct req_header header;
 	struct req_header header;
 	SaNameT compName;
 	SaNameT compName;
+	SaUint64T processId;
+	SaInt32T descendentsTreeDepth;
+	SaAmfPmErrorsT pmErrors;
+	SaAmfRecommendedRecoveryT recommendedRecovery;
 };
 };
 
 
-struct res_lib_amf_readinessstateget {
+struct res_lib_amf_pmstart {
 	struct res_header header;
 	struct res_header header;
-	SaAmfReadinessStateT readinessState;
 };
 };
 
 
-struct res_lib_amf_healthcheckcallback {
+struct req_lib_amf_pmstop {
+	struct req_header header;
+	SaNameT compName;
+	SaAmfPmStopQualifierT stopQualifier;
+	SaUint64T processId;
+	SaAmfPmErrorsT pmErrors;
+};
+
+struct res_lib_amf_pmstop {
 	struct res_header header;
 	struct res_header header;
-	int instance;
-	SaInvocationT invocation;
+};
+
+struct req_lib_amf_healthcheckstart {
+	struct req_header header;
 	SaNameT compName;
 	SaNameT compName;
-	SaAmfHealthcheckT checkType;
+	SaAmfHealthcheckKeyT healthcheckKey;
+	SaAmfHealthcheckInvocationT invocationType;
+	SaAmfRecommendedRecoveryT recommendedRecovery;
 };
 };
 
 
-struct res_lib_amf_readinessstatesetcallback {
+struct res_lib_amf_healthcheckstart {
 	struct res_header header;
 	struct res_header header;
-	SaInvocationT invocation;
+};
+
+struct req_lib_amf_healthcheckconfirm {
+	struct req_header header;
 	SaNameT compName;
 	SaNameT compName;
-	SaAmfReadinessStateT readinessState;
+	SaAmfHealthcheckKeyT healthcheckKey;
+	SaAisErrorT healthcheckResult;
 };
 };
 
 
-struct res_lib_amf_componentterminatecallback {
+struct res_lib_amf_healthcheckconfirm {
 	struct res_header header;
 	struct res_header header;
-	SaInvocationT invocation;
+};
+
+struct req_lib_amf_healthcheckstop {
+	struct req_header header;
 	SaNameT compName;
 	SaNameT compName;
+	SaAmfHealthcheckKeyT healthcheckKey;
+};
+
+struct res_lib_amf_healthcheckstop {
+	struct res_header header;
 };
 };
 
 
-struct req_amf_hastateget {
+struct req_lib_amf_hastateget {
 	struct req_header header;
 	struct req_header header;
 	SaNameT compName;
 	SaNameT compName;
 	SaNameT csiName;
 	SaNameT csiName;
@@ -146,31 +166,21 @@ struct res_lib_amf_hastateget {
 	SaAmfHAStateT haState;
 	SaAmfHAStateT haState;
 };
 };
 
 
-struct res_lib_amf_csisetcallback {
-	struct res_header header;
+struct req_lib_amf_csiquiescingcomplete {
+	struct req_header header;
 	SaInvocationT invocation;
 	SaInvocationT invocation;
-	SaNameT compName;
-	SaNameT csiName;
-	SaAmfCSIFlagsT csiFlags;
-	SaAmfHAStateT haState;
-	SaNameT activeCompName;
-	SaAmfCSITransitionDescriptorT transitionDescriptor;
+	SaAisErrorT error;
 };
 };
 
 
-struct res_lib_amf_csiremovecallback {
+struct res_lib_amf_csiquiescingcomplete {
 	struct res_header header;
 	struct res_header header;
-	SaInvocationT invocation;
-	SaNameT compName;
-	SaNameT csiName;
-	SaAmfCSIFlagsT csiFlags;
 };
 };
 
 
-struct req_amf_protectiongrouptrackstart {
+struct req_lib_amf_protectiongrouptrackstart {
 	struct req_header header;
 	struct req_header header;
 	SaNameT csiName;
 	SaNameT csiName;
 	SaUint8T trackFlags;
 	SaUint8T trackFlags;
 	SaAmfProtectionGroupNotificationT *notificationBufferAddress;
 	SaAmfProtectionGroupNotificationT *notificationBufferAddress;
-	SaUint32T numberOfItems;
 };
 };
 
 
 struct res_lib_amf_protectiongrouptrackstart {
 struct res_lib_amf_protectiongrouptrackstart {
@@ -178,7 +188,7 @@ struct res_lib_amf_protectiongrouptrackstart {
 };
 };
 	
 	
 
 
-struct req_amf_protectiongrouptrackstop {
+struct req_lib_amf_protectiongrouptrackstop {
 	struct req_header header;
 	struct req_header header;
 	SaNameT csiName;
 	SaNameT csiName;
 };
 };
@@ -187,39 +197,27 @@ struct res_lib_amf_protectiongrouptrackstop {
 	struct res_header header;
 	struct res_header header;
 };
 };
 
 
-struct res_lib_amf_protectiongrouptrackcallback {
-	struct res_header header;
-	SaNameT csiName;
-	SaAmfProtectionGroupNotificationT *notificationBufferAddress;
-	SaUint32T numberOfItems;
-	SaUint32T numberOfMembers;
-	SaUint32T error;
-	SaAmfProtectionGroupNotificationT notificationBuffer[0];
-};
-
-struct req_lib_amf_errorreport {
+struct req_lib_amf_componenterrorreport {
 	struct req_header header;
 	struct req_header header;
 	SaNameT reportingComponent;
 	SaNameT reportingComponent;
 	SaNameT erroneousComponent;
 	SaNameT erroneousComponent;
 	SaTimeT errorDetectionTime;
 	SaTimeT errorDetectionTime;
-	SaAmfErrorDescriptorT errorDescriptor;
-	SaAmfAdditionalDataT additionalData;
 };
 };
 
 
-struct res_lib_amf_errorreport {
+struct res_lib_amf_componenterrorreport {
 	struct res_header header;
 	struct res_header header;
 };
 };
 
 
-struct req_lib_amf_errorcancelall {
+struct req_lib_amf_componenterrorclear {
 	struct req_header header;
 	struct req_header header;
 	SaNameT compName;
 	SaNameT compName;
 };
 };
 
 
-struct res_lib_amf_errorcancelall {
+struct res_lib_amf_componenterrorclear {
 	struct res_header header;
 	struct res_header header;
 };
 };
 
 
-struct req_amf_response {
+struct req_lib_amf_response {
 	struct req_header header;
 	struct req_header header;
 	SaInvocationT invocation;
 	SaInvocationT invocation;
 	SaErrorT error;
 	SaErrorT error;
@@ -228,25 +226,68 @@ struct req_amf_response {
 struct res_lib_amf_response {
 struct res_lib_amf_response {
 	struct res_header header;
 	struct res_header header;
 };
 };
+struct res_lib_amf_healthcheckcallback {
+	struct res_header header;
+	SaInvocationT invocation;
+	SaNameT compName;
+	SaAmfHealthcheckKeyT key;
+};
 
 
-struct req_amf_stoppingcomplete {
-	struct req_header header;
+#ifdef COMPILE_OUT
+
+struct res_lib_amf_componentterminatecallback {
+	struct res_header header;
 	SaInvocationT invocation;
 	SaInvocationT invocation;
-	SaErrorT error;
+	SaNameT compName;
+};
+
+
+#endif
+
+struct res_lib_amf_csisetcallback {
+	struct res_header header;
+	SaInvocationT invocation;
+	SaNameT compName;
+	SaAmfHAStateT haState;
+	SaAmfCSIDescriptorT csiDescriptor;
 };
 };
 
 
-struct res_lib_amf_stoppingcomplete {
+struct res_lib_amf_csiremovecallback {
 	struct res_header header;
 	struct res_header header;
+	SaInvocationT invocation;
+	SaNameT compName;
+	SaNameT csiName;
+	SaAmfCSIFlagsT csiFlags;
 };
 };
 
 
-struct req_amf_componentcapabilitymodelget {
-	struct req_header header;
+struct res_lib_amf_componentterminatecallback {
+	struct res_header header;
+	SaInvocationT invocation;
 	SaNameT compName;
 	SaNameT compName;
 };
 };
 
 
-struct res_lib_amf_componentcapabilitymodelget {
+
+#ifdef COMPILE_OUT
+struct res_lib_amf_protectiongrouptrackcallback {
 	struct res_header header;
 	struct res_header header;
-	SaAmfComponentCapabilityModelT componentCapabilityModel;
+	SaNameT csiName;
+	SaAmfProtectionGroupNotificationT *notificationBufferAddress;
+	SaUint32T numberOfItems;
+	SaUint32T numberOfMembers;
+	SaUint32T error;
+	SaAmfProtectionGroupNotificationT notificationBuffer[0];
 };
 };
 
 
+typedef enum {
+        SA_AMF_COMPONENT_CAPABILITY_X_ACTIVE_AND_Y_STANDBY = 1,
+        SA_AMF_COMPONENT_CAPABILITY_X_ACTIVE_OR_Y_STANDBY = 2,
+        SA_AMF_COMPONENT_CAPABILITY_1_ACTIVE_OR_Y_STANDBY = 3,
+        SA_AMF_COMPONENT_CAPABILITY_1_ACTIVE_OR_1_STANDBY = 4,
+        SA_AMF_COMPONENT_CAPABILITY_X_ACTIVE = 5,
+        SA_AMF_COMPONENT_CAPABILITY_1_ACTIVE = 6,
+        SA_AMF_COMPONENT_CAPABILITY_NO_ACTIVE = 7
+} SaAmfComponentCapabilityModelT;
+
+#endif
+
 #endif /* AIS_IPC_AMF_H_DEFINED */
 #endif /* AIS_IPC_AMF_H_DEFINED */

+ 109 - 0
include/ipc_cfg.h

@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2005 MontaVista Software, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Steven Dake (sdake@mvista.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ *   contributors may be used to endorse or promote products derived from this
+ *   software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef AIS_IPC_CFG_H_DEFINED
+#define AIS_IPC_CFG_H_DEFINED
+
+#include <netinet/in.h>
+#include "ipc_gen.h"
+#include "saAis.h"
+#include "openaisCfg.h"
+
+enum req_lib_cfg_types {
+        MESSAGE_REQ_CFG_STATETRACKSTART = 0,
+        MESSAGE_REQ_CFG_STATETRACKSTOP = 1,
+        MESSAGE_REQ_CFG_ADMINISTRATIVESTATESET = 2,
+        MESSAGE_REQ_CFG_ADMINISTRATIVESTATEGET = 3,
+};
+
+enum res_lib_cfg_types {
+        MESSAGE_RES_CFG_STATETRACKSTART = 0,
+        MESSAGE_RES_CFG_STATETRACKSTOP = 1,
+        MESSAGE_RES_CFG_ADMINISTRATIVESTATESET = 2,
+        MESSAGE_RES_CFG_ADMINISTRATIVESTATEGET = 3,
+};
+
+struct req_lib_cfg_statetrackstart {
+	struct req_header header;
+	SaUint8T trackFlags;
+	OpenaisCfgStateNotificationT *notificationBufferAddress;
+};
+
+struct res_lib_cfg_statetrackstart {
+	struct res_header header;
+};
+
+struct req_lib_cfg_statetrackstop {
+	struct req_header header;
+};
+
+struct res_lib_cfg_statetrackstop {
+	struct res_header header;
+};
+
+struct req_lib_cfg_administrativestateset {
+	struct req_header header;
+	SaNameT compName;
+	OpenaisCfgAdministrativeTargetT administrativeTarget;
+	OpenaisCfgAdministrativeStateT administrativeState;
+};
+
+struct res_lib_cfg_administrativestateset {
+	struct res_header header;
+};
+
+struct req_lib_cfg_administrativestateget {
+	struct req_header header;
+	SaNameT compName;
+	OpenaisCfgAdministrativeTargetT administrativeTarget;
+	OpenaisCfgAdministrativeStateT administrativeState;
+};
+
+struct res_lib_cfg_administrativestateget {
+	struct res_header header;
+};
+
+typedef enum {
+	AIS_AMF_ADMINISTRATIVETARGET_SERVICEUNIT = 0,
+	AIS_AMF_ADMINISTRATIVETARGET_SERVICEGROUP = 1,
+	AIS_AMF_ADMINISTRATIVETARGET_COMPONENTSERVICEINSTANCE = 2,
+	AIS_AMF_ADMINISTRATIVETARGET_NODE = 3
+} openaisAdministrativeTarget;
+
+typedef enum {
+	AIS_AMF_ADMINISTRATIVESTATE_UNLOCKED = 0,
+	AIS_AMF_ADMINISTRATIVESTATE_LOCKED = 1,
+	AIS_AMF_ADMINISTRATIVESTATE_STOPPING = 2
+} openaisAdministrativeState;
+
+#endif /* AIS_IPC_CFG_H_DEFINED */

+ 2 - 1
include/ipc_gen.h

@@ -43,7 +43,8 @@ enum service_types {
 	AMF_SERVICE = 2,
 	AMF_SERVICE = 2,
 	CKPT_SERVICE = 3,
 	CKPT_SERVICE = 3,
 	EVT_SERVICE = 4,
 	EVT_SERVICE = 4,
-	LCK_SERVICE = 5
+	LCK_SERVICE = 5,
+	CFG_SERVICE = 6
 };
 };
 
 
 enum req_init_types {
 enum req_init_types {

+ 157 - 0
include/openaisCfg.h

@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2005 MontaVista Software, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Steven Dake (sdake@mvista.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ *   contributors may be used to endorse or promote products derived from this
+ *   software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef AIS_OPENAISCFG_H_DEFINED
+#define AIS_OPENAISCFG_H_DEFINED
+
+#include <netinet/in.h>
+#include "saAis.h"
+
+typedef SaUint64T OpenaisCfgHandleT;
+
+typedef enum {
+	OPENAIS_CFG_ADMINISTRATIVETARGET_SERVICEUNIT = 0,
+	OPENAIS_CFG_ADMINISTRATIVETARGET_SERVICEGROUP = 1,
+	OPENAIS_CFG_ADMINISTRATIVETARGET_COMPONENTSERVICEINSTANCE = 2,
+	OPENAIS_CFG_ADMINISTRATIVETARGET_NODE = 3
+} OpenaisCfgAdministrativeTargetT;
+
+typedef enum {
+	OPENAIS_CFG_ADMINISTRATIVESTATE_UNLOCKED = 0,
+	OPENAIS_CFG_ADMINISTRATIVESTATE_LOCKED = 1,
+	OPENAIS_CFG_ADMINISTRATIVESTATE_STOPPING = 2
+} OpenaisCfgAdministrativeStateT;
+
+typedef enum {
+	OPENAIS_CFG_OPERATIONALSTATE_ENABLED = 1,
+	OPENAIS_CFG_OPERATIONALSTATE_DISABLED = 2
+} OpenaisCfgOperationalStateT;
+
+typedef enum {
+	OPENAIS_CFG_READINESSSTATE_OUTOFSERVICE = 1,
+	OPENAIS_CFG_READINESSSTATE_INSERVICE = 2,
+	OPENAIS_CFG_READINESSSTATE_STOPPING = 3
+} OpenaisCfgReadinessStateT;
+
+typedef enum {
+	OPENAIS_CFG_PRESENCESTATE_UNINSTANTIATED = 1,
+	OPENAIS_CFG_PRESENCESTATE_INSTANTIATING = 2,
+	OPENAIS_CFG_PRESENCESTATE_INSTANTIATED = 3,
+	OPENAIS_CFG_PRESENCESTATE_TERMINATING = 4,
+	OPENAIS_CFG_PRESENCESTATE_RESTARTING = 5,
+	OPENAIS_CFG_PRESENCESTATE_INSTANTIATION_FAILED = 6,
+	OPENAIS_CFG_PRESENCESTATE_TERMINATION_FAILED = 7
+} OpenaisCfgPresenceStateT;
+
+typedef enum {
+	OPENAIS_CFG_STATETYPE_OPERATIONAL = 0,
+	OPENAIS_CFG_STATETYPE_ADMINISTRATIVE = 1,
+	OPENAIS_CFG_STATETYPE_READINESS = 2,
+	OPENAIS_CFG_STATETYPE_HA = 3,
+	OPENAIS_CFG_STATETYPE_PRESENCE = 4
+} OpenaisCfgStateTypeT;
+
+typedef struct {
+	SaNameT name;
+	OpenaisCfgStateTypeT stateType;
+	OpenaisCfgAdministrativeStateT administrativeState;
+} OpenaisCfgStateNotificationT;
+
+typedef struct {
+        SaUint32T numberOfItems;
+        OpenaisCfgStateNotificationT *notification;
+} OpenaisCfgStateNotificationBufferT;
+
+typedef void (*OpenaisCfgStateTrackCallbackT) (
+	OpenaisCfgStateNotificationBufferT *notificationBuffer,
+	SaAisErrorT error);
+
+typedef struct {
+	OpenaisCfgStateTrackCallbackT
+		openaisCfgStateTrackCallback;
+} OpenaisCfgCallbacksT;
+
+/*
+ * Interfaces
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+SaAisErrorT
+openaisCfgInitialize (
+	OpenaisCfgHandleT *cfgHandle,
+	const OpenaisCfgCallbacksT *cfgCallbacks,
+	SaVersionT *version);
+
+SaAisErrorT
+openaisCfgSelectionObjectGet (
+	OpenaisCfgHandleT cfgHandle,
+	SaSelectionObjectT *selectionObject);
+
+SaAisErrorT
+openaisCfgDispatch (
+	OpenaisCfgHandleT cfgHandle,
+	SaDispatchFlagsT dispatchFlags);
+
+SaAisErrorT
+openaisCfgFinalize (
+	OpenaisCfgHandleT cfgHandle);
+
+SaAisErrorT
+openaisCfgAdministrativeStateGet (
+	OpenaisCfgHandleT cfgHandle,
+	OpenaisCfgAdministrativeTargetT administrativeTarget,
+	OpenaisCfgAdministrativeStateT *administrativeState);
+
+SaAisErrorT
+openaisCfgAdministrativeStateSet (
+	OpenaisCfgHandleT cfgHandle,
+	OpenaisCfgAdministrativeTargetT administrativeTarget,
+	OpenaisCfgAdministrativeStateT administrativeState);
+
+SaAisErrorT
+openaisCfgStateTrackStart (
+        OpenaisCfgHandleT cfgHandle,
+        SaUint8T trackFlags,
+        const OpenaisCfgStateNotificationT *notificationBuffer);
+
+SaAisErrorT
+openaisCfgStateTrackStop (
+        OpenaisCfgHandleT cfgHandle);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* AIS_OPENAISCFG_H_DEFINED */

+ 2 - 158
include/saAis.h

@@ -78,6 +78,8 @@ typedef struct {
 	unsigned char minorVersion;
 	unsigned char minorVersion;
 } SaVersionT;
 } SaVersionT;
 
 
+typedef SaUint64T SaNtfIdentifierT;
+
 #define SA_TRACK_CURRENT 0x01
 #define SA_TRACK_CURRENT 0x01
 #define SA_TRACK_CHANGES 0x02
 #define SA_TRACK_CHANGES 0x02
 #define SA_TRACK_CHANGES_ONLY 0x04
 #define SA_TRACK_CHANGES_ONLY 0x04
@@ -153,164 +155,6 @@ typedef SaUint64T SaSelectionObjectT;
 
 
 typedef SaUint64T SaInvocationT;
 typedef SaUint64T SaInvocationT;
 
 
-/*
- * AMF Definitions
- */
-typedef SaUint64T SaAmfHandleT;
-
-typedef enum {
-	SA_AMF_HEARTBEAT = 1,
-	SA_AMF_HEALTHCHECK_LEVEL1 = 2,
-	SA_AMF_HEALTHCHECK_LEVEL2 = 3,
-	SA_AMF_HEALTHCHECK_LEVEL3 = 4
-} SaAmfHealthcheckT;
-
-typedef enum {
-	SA_AMF_OUT_OF_SERVICE = 1,
-	SA_AMF_IN_SERVICE = 2,
-	SA_AMF_STOPPING = 3
-} SaAmfReadinessStateT;
-
-typedef enum {
-	SA_AMF_ACTIVE = 1,
-	SA_AMF_STANDBY = 2,
-	SA_AMF_QUIESCED = 3
-} SaAmfHAStateT;
-
-typedef enum {
-	SA_AMF_COMPONENT_CAPABILITY_X_ACTIVE_AND_Y_STANDBY = 1,
-	SA_AMF_COMPONENT_CAPABILITY_X_ACTIVE_OR_Y_STANDBY = 2,
-	SA_AMF_COMPONENT_CAPABILITY_1_ACTIVE_OR_Y_STANDBY = 3,
-	SA_AMF_COMPONENT_CAPABILITY_1_ACTIVE_OR_1_STANDBY = 4,
-	SA_AMF_COMPONENT_CAPABILITY_X_ACTIVE = 5,
-	SA_AMF_COMPONENT_CAPABILITY_1_ACTIVE = 6,
-	SA_AMF_COMPONENT_CAPABILITY_NO_ACTIVE = 7
-} SaAmfComponentCapabilityModelT;
-
-#define SA_AMF_CSI_ADD_NEW_ISTANCE 0x01
-#define SA_AMF_CSI_ALL_INSTANCES 0x02
-
-typedef SaUint32T SaAmfCSIFlagsT;
-
-typedef enum {
-	SA_AMF_CSI_NEW_ASSIGN = 1,
-	SA_AMF_CSI_QUIESCED = 2,
-	SA_AMF_CSI_NOT_QUIESCED = 3,
-	SA_AMF_CSI_STILL_ACTIVE = 4
-} SaAmfCSITransitionDescriptorT;
-
-typedef enum {
-	SA_AMF_RESET = 1,
-	SA_AMF_REBOOT = 2,
-	SA_AMF_POWER_ON = 3,
-	SA_AMF_POWER_OFF = 4
-} SaAmfExternalComponentActionT;
-
-#define SA_AMF_SWITCHOVER_OPERATION 0x01
-#define SA_AMF_SHUTDOWN_OPERATION 0x02
-typedef SaUint32T SaAmfPendingOperationFlagsT;
-
-typedef struct {
-	SaNameT compName;
-	SaAmfReadinessStateT readinessState;
-	SaAmfHAStateT haState;
-} SaAmfProtectionGroupMemberT;
-
-typedef enum {
-	SA_AMF_PROTECTION_GROUP_NO_CHANGE = 1,
-	SA_AMF_PROTECTION_GROUP_ADDED = 2,
-	SA_AMF_PROTECTION_GROUP_REMOVED = 3,
-	SA_AMF_PROTECTION_GROUP_STATE_CHANGE = 4
-} SaAmfProtectionGroupChangesT;
-
-typedef struct {
-	SaAmfProtectionGroupMemberT member;
-	SaAmfProtectionGroupChangesT change;
-} SaAmfProtectionGroupNotificationT;
-
-typedef enum {
-	SA_AMF_COMMUNICATION_ALARM_TYPE = 1,
-	SA_AMF_QUALITY_OF_SERVICE_ALARM_TYPE = 2,
-	SA_AMF_PROCESSING_ERROR_ALARM_TYPE = 3,
-	SA_AMF_EQUIPMENT_ALARM_TYPE = 4,
-	SA_AMF_ENVIRONMENTAL_ALARM_TYPE = 5
-} SaAmfErrorReportTypeT;
-
-typedef enum {
-	SA_AMF_APPLICATION_SUBSYSTEM_FAILURE = 1,
-	SA_AMF_BANDWIDTH_REDUCED = 2,
-	SA_AMF_CALL_ESTABLISHMENT_ERROR = 3,
-	SA_AMF_COMMUNICATION_PROTOCOL_ERROR = 4,
-	SA_AMF_COMMUNICATION_SUBSYSTEM_FAILURE = 5,
-	SA_AMF_CONFIGURATION_ERROR = 6,
-	SA_AMF_CONGESTION = 7,
-	SA_AMF_CORRUPT_DATA = 8,
-	SA_AMF_CPU_CYCLES_LIMIT_EXCEEDED = 9,
-	SA_AMF_EQUIPMENT_MALFUNCTION = 10,
-	SA_AMF_FILE_ERROR = 11,
-	SA_AMF_IO_DEVICE_ERROR = 12,
-	SA_AMF_LAN_ERROR, SA_AMF_OUT_OF_MEMORY = 13,
-	SA_AMF_PERFORMANCE_DEGRADED = 14,
-	SA_AMF_PROCESSOR_PROBLEM = 15,
-	SA_AMF_RECEIVE_FAILURE = 16,
-	SA_AMF_REMOTE_NODE_TRNASMISSION_ERROR = 17,
-	SA_AMF_RESOURCE_AT_OR_NEARING_CAPACITY = 18,
-	SA_AMF_RESPONSE_TIME_EXCESSIVE = 19,
-	SA_AMF_RETRANSMISSION_RATE_EXCESSIVE = 20,
-	SA_AMF_SOFTWARE_ERROR = 21,
-	SA_AMF_SOFTWARE_PROGRAM_ABNORMALLY_TERMINATED = 22,
-	SA_AMF_SOFTWARE_PROGRAM_ERROR = 23,
-	SA_AMF_STORAGE_CAPACITY_PROBLEM = 24,
-	SA_AMF_TIMING_PROBLEM = 25,
-	SA_AMF_UNDERLYING_REOUSRCE_UNAVAILABLE = 26,
-	SA_AMF_INTERNAL_ERROR = 27,
-	SA_AMF_NO_SERVICE_ERROR = 28,
-	SA_AMF_SOFTWARE_LIBRARY_ERROR = 29,
-	SA_AMF_NOT_RESPONDING = 30
-} SaAmfProbableCauseT;
-
-typedef enum {
-	SA_AMF_CLEARED = 1,
-	SA_AMF_NO_IMPACT = 2,
-	SA_AMF_INDETERMINATE = 3,
-	SA_AMF_CRITICAL = 4,
-	SA_AMF_MAJOR = 5,
-	SA_AMF_WEDGED_COMPONENT_FAILURE = 6,
-	SA_AMF_COMPONENT_TERMINATED_FAILURE = 7,
-	SA_AMF_NODE_FAILURE = 8,
-	SA_AMF_MINOR = 9,
-	SA_AMF_WARNING = 10
-} SaAmfErrorImpactAndSeverityT;
-
-typedef enum {
-	SA_AMF_NO_RECOMMENDATION = 1,
-	SA_AMF_INTERNALLY_RECOVERED = 2,
-	SA_AMF_COMPONENT_RESTART = 3,
-	SA_AMF_COMPONENT_FAILOVER = 4,
-	SA_AMF_NODE_SWITCHOVER = 5,
-	SA_AMF_NODE_FAILOVER = 6,
-	SA_AMF_NODE_FAILFAST = 7,
-	SA_AMF_CLUSTER_RESET = 8
-} SaAmfRecommendedRecoveryT;
-
-typedef struct {
-	SaAmfErrorReportTypeT errorReportType;
-	SaAmfProbableCauseT probableCause;
-	SaAmfErrorImpactAndSeverityT errorImpactAndSeverity;
-	SaAmfRecommendedRecoveryT recommendedRecovery;
-} SaAmfErrorDescriptorT;
-
 typedef SaUint64T SaSizeT;
 typedef SaUint64T SaSizeT;
-#define SA_AMF_OPAQUE_BUFFER_SIZE_MAX 512
-typedef struct {
-	char *buffer;
-	SaSizeT size;
-} SaAmfErrorBufferT;
-
-typedef struct {
-	SaAmfErrorBufferT *specificProblem;
-	SaAmfErrorBufferT *additionalText;
-	SaAmfErrorBufferT *additionalInformation;
-} SaAmfAdditionalDataT;
 
 
 #endif /* AIS_TYPES_H_DEFINED */
 #endif /* AIS_TYPES_H_DEFINED */

+ 338 - 0
include/saAmf.h

@@ -0,0 +1,338 @@
+/*
+ * Copyright (c) 2002-2003 MontaVista Software, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Steven Dake (sdake@mvista.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ *   contributors may be used to endorse or promote products derived from this
+ *   software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AIS_AMF_H_DEFINED
+#define AIS_AMF_H_DEFINED
+
+#include "saAis.h"
+
+typedef SaUint64T SaAmfHandleT;
+
+#define SA_AMF_PM_ZERO_EXIT 0x1
+#define SA_AMF_PM_NON_ZERO_EXIT 0x2
+#define SA_AMF_PM_ABNORMAL_END 0x4
+
+typedef SaUint32T SaAmfPmErrorsT;
+
+typedef enum {
+	SA_AMF_PM_PROC = 1,
+	SA_AMF_PM_PROC_AND_DESCENDENTS = 2,
+	SA_AMF_PM_ALL_PROCESSES =3
+} SaAmfPmStopQualifierT;
+
+typedef enum {
+	SA_AMF_HEALTHCHECK_AMF_INVOKED = 1,
+	SA_AMF_HELATHCHECK_COMPONENT_INVOKED =2
+} SaAmfHealthcheckInvocationT;
+
+#define SA_AMF_HEALTHCHECK_KEY_MAX 32
+typedef struct {
+	SaUint8T key[SA_AMF_HEALTHCHECK_KEY_MAX];
+	SaUint16T keyLen;
+} SaAmfHealthcheckKeyT;
+
+typedef enum {
+	SA_AMF_HA_ACTIVE = 1,
+	SA_AMF_HA_STANDBY = 2,
+	SA_AMF_HA_QUIESCED = 3,
+	SA_AMF_HA_QUIESCING = 4
+} SaAmfHAStateT;
+
+#define SA_AMF_CSI_ADD_ONE 0x1
+#define SA_AMF_CSI_TARGET_ONE 0x2
+#define SA_AMF_CSI_TARGET_ALL 0x4
+
+typedef SaUint32T SaAmfCSIFlagsT;
+
+
+typedef enum {
+	SA_AMF_CSI_NEW_ASSIGN = 1,
+	SA_AMF_CSI_QUIESCED = 2,
+	SA_AMF_CSI_NOT_QUIESCED = 3,
+	SA_AMF_CSI_STILL_ACTIVE = 4,
+} SaAmfCSITransitionDescriptorT;
+
+typedef struct {
+	SaAmfCSITransitionDescriptorT transitionDescriptor;
+	SaNameT activeCompName;
+} SaAmfCSIActiveDescriptorT;
+
+typedef struct {
+	SaNameT activeCompName;
+	SaUint32T standbyRank;
+} SaAmfCSIStandbyDescriptorT;
+
+typedef union {
+	SaAmfCSIActiveDescriptorT activeDescriptor;
+	SaAmfCSIStandbyDescriptorT standbyDescriptor;
+} SaAmfCSIStateDescriptorT;
+
+typedef struct {
+	SaUint8T *attrName;
+	SaUint8T *attrValue;
+} SaAmfCSIAttributeT;
+
+typedef struct {
+	SaAmfCSIAttributeT *attr;
+	SaUint32T number;
+} SaAmfCSIAttributeListT;
+
+typedef struct {
+	SaAmfCSIFlagsT csiFlags;
+	SaNameT csiName;
+	SaAmfCSIStateDescriptorT csiStateDescriptor;
+	SaAmfCSIAttributeListT csiAttr;
+} SaAmfCSIDescriptorT;
+
+typedef struct {
+	SaNameT compName;
+	SaAmfHAStateT haState;
+	SaUint32T rank;
+} SaAmfProtectionGroupMemberT;
+
+
+typedef enum {
+	SA_AMF_PROTECTION_GROUP_NO_CHANGE = 1,
+	SA_AMF_PROTECTION_GROUP_ADDED = 2,
+	SA_AMF_PROTECTION_GROUP_REMOVED = 3,
+	SA_AMF_PROTECTION_GROUP_STATE_CHANGE = 4
+} SaAmfProtectionGroupChangesT;
+
+
+typedef struct {
+	SaAmfProtectionGroupMemberT member;
+	SaAmfProtectionGroupChangesT change;
+} SaAmfProtectionGroupNotificationT;
+
+typedef struct {
+	SaUint32T numberOfItems;
+	SaAmfProtectionGroupNotificationT *notificaton;
+} SaAmfProtectionGruopNotificationBufferT;
+
+typedef enum {
+	SA_AMF_NO_RECOMMENDATION = 1,
+	SA_AMF_COMPONENT_RESTART = 2,
+	SA_AMF_COMPONENT_FAILOVER = 3,
+	SA_AMF_NODE_SWITCHOVER = 4,
+	SA_AMF_NODE_FAILOVER = 5,
+	SA_AMF_NODE_FAILFAST = 6,
+	SA_AMF_CLUSTER_RESET = 7
+} SaAmfRecommendedRecoveryT;
+
+typedef void (*SaAmfHealthcheckCallbackT) (
+	SaInvocationT invocation,
+	const SaNameT *compName,
+	SaAmfHealthcheckKeyT *healthcheckKey);
+
+typedef void (*SaAmfComponentTerminateCallbackT) (
+	SaInvocationT invocation,
+	const SaNameT *compName);
+
+typedef void (*SaAmfCSISetCallbackT) (
+	SaInvocationT invocation,
+	const SaNameT *compName,
+	SaAmfHAStateT haState,
+	SaAmfCSIDescriptorT *csiDescriptor);
+			
+typedef void (*SaAmfCSIRemoveCallbackT) (
+	SaInvocationT invocation,
+	const SaNameT *compName,
+	const SaNameT *csiName,
+	SaAmfCSIFlagsT csiFlags);
+
+typedef void (*SaAmfExternalComponentInstantiateCallbackT) (
+	SaInvocationT invocation,
+	const SaNameT *proxiedCompName);
+
+typedef void (*SaAmfExternalComponentCleanupCallbackT) (
+	SaInvocationT invocation,
+	const SaNameT *proxiedCompName);
+
+typedef void (*SaAmfProtectionGroupTrackCallbackT) (
+	const SaNameT *csiName,
+	SaAmfProtectionGroupNotificationT *notificationBuffer,
+	SaUint32T numberOfMembers,
+	SaAisErrorT error);
+
+typedef struct {
+	SaAmfHealthcheckCallbackT
+		saAmfHealthcheckCallback;
+	SaAmfComponentTerminateCallbackT
+		saAmfComponentTerminateCallback;
+	SaAmfCSISetCallbackT
+		saAmfCSISetCallback;
+	SaAmfCSIRemoveCallbackT
+		saAmfCSIRemoveCallback;
+	SaAmfProtectionGroupTrackCallbackT
+		saAmfProtectionGroupTrackCallback;
+	SaAmfExternalComponentInstantiateCallbackT
+		saAmfExternalComponentInstantiateCallback;
+	SaAmfExternalComponentCleanupCallbackT
+		saAmfExternalComponentCleanupCallback;
+} SaAmfCallbacksT;
+
+/*
+ * Interfaces
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+SaAisErrorT
+saAmfInitialize (
+	SaAmfHandleT *amfHandle,
+	const SaAmfCallbacksT *amfCallbacks,
+	SaVersionT *version);
+
+SaAisErrorT
+saAmfSelectionObjectGet (
+	SaAmfHandleT amfHandle,
+	SaSelectionObjectT *selectionObject);
+
+SaAisErrorT
+saAmfDispatch (
+	SaAmfHandleT amfHandle,
+	SaDispatchFlagsT dispatchFlags);
+
+SaAisErrorT
+saAmfFinalize (
+	SaAmfHandleT amfHandle);
+
+SaAisErrorT
+saAmfComponentRegister (
+	SaAmfHandleT amfHandle,
+	const SaNameT *compName,
+	const SaNameT *proxyCompName);
+
+SaAisErrorT
+saAmfComponentUnregister (
+	SaAmfHandleT amfHandle,
+	const SaNameT *compName,
+	const SaNameT *proxyCompName);
+
+SaAisErrorT
+saAmfComponentNameGet (
+	SaAmfHandleT amfHandle,
+	SaNameT *compName);
+
+SaAisErrorT
+saAmfPmStart (
+	SaAmfHandleT amfHandle,
+	const SaNameT *compName,
+	SaUint64T processId,
+	SaInt32T descendentsTreeDepth,
+	SaAmfPmErrorsT pmErrors,
+	SaAmfRecommendedRecoveryT recommendedRecovery);
+
+SaAisErrorT
+saAmfPmStop (
+	SaAmfHandleT amfHandle,
+	const SaNameT *compName,
+	SaAmfPmStopQualifierT stopQualifier,
+	SaInt64T processId,
+	SaAmfPmErrorsT pmErrors);
+
+SaAisErrorT
+saAmfHealthcheckStart (
+	SaAmfHandleT amfHandle,
+	const SaNameT *compName,
+	const SaAmfHealthcheckKeyT *healthcheckKey,
+	SaAmfHealthcheckInvocationT invocationType,
+	SaAmfRecommendedRecoveryT recommendedRecovery);
+
+SaAisErrorT
+saAmfHealthcheckConfirm (
+	SaAmfHandleT amfHandle,
+	const SaNameT *compName,
+	const SaAmfHealthcheckKeyT *healthcheckKey,
+	SaAisErrorT healthcheckResult);
+
+SaAisErrorT
+saAmfHealthcheckStop (
+	SaAmfHandleT amfHandle,
+	const SaNameT *compName,
+	const SaAmfHealthcheckKeyT *healthcheckKey);
+
+SaAisErrorT
+saAmfHAStateGet (
+	SaAmfHandleT amfHandle,
+	const SaNameT *compName,
+	const SaNameT *csiName,
+	SaAmfHAStateT *haState);
+
+
+SaAisErrorT
+saAmfCSIQuiescingComplete(
+	SaAmfHandleT amfHandle,
+	SaInvocationT invocation,
+	SaAisErrorT error);
+
+SaAisErrorT
+saAmfProtectionGroupTrackStart (
+	SaAmfHandleT amfHandle,
+	const SaNameT *csiName,
+	SaUint8T trackFlags,
+	const SaAmfProtectionGroupNotificationT *notificationBuffer);
+
+SaAisErrorT
+saAmfProtectionGroupTrackStop (
+	SaAmfHandleT amfHandle,
+	const SaNameT *csiName);
+
+SaAisErrorT
+saAmfComponentErrorReport (
+	SaAmfHandleT amfHandle,
+	const SaNameT *erroneousComponent,
+	SaTimeT errorDetectionTime,
+	SaAmfRecommendedRecoveryT recommendedRecovery,
+	SaNtfIdentifierT ntfIdentifier);
+
+SaAisErrorT
+saAmfComponentErrorClear (
+	SaAmfHandleT amfHandle,
+	const SaNameT *compName,
+	SaNtfIdentifierT ntfIdentifier);
+
+
+SaAisErrorT
+saAmfResponse (
+	SaAmfHandleT amfHandle,
+	SaInvocationT invocation,
+	SaAisErrorT error);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* AIS_AMF_H_DEFINED */

+ 10 - 1
lib/Makefile

@@ -45,7 +45,7 @@ LDFLAGS = -g
 
 
 all:libSaClm.a libSaClm.so.1.0 libSaAmf.a libSaAmf.so.1.0 libSaCkpt.a \
 all:libSaClm.a libSaClm.so.1.0 libSaAmf.a libSaAmf.so.1.0 libSaCkpt.a \
 	libSaCkpt.so.1.0 libSaEvt.a libSaEvt.so.1.0 libSaLck.a libSaLck.so.1.0 \
 	libSaCkpt.so.1.0 libSaEvt.a libSaEvt.so.1.0 libSaLck.a libSaLck.so.1.0 \
-	libais.a libais.so.1.0 libevs.a libevs.so.1.0
+	libais.a libais.so.1.0 libevs.a libevs.so.1.0 libOpenaisCfg.a libOpenaisCfg.so.1.0
 
 
 LIBAIS_SRC = util.c amf.c clm.c ckpt.c evt.c
 LIBAIS_SRC = util.c amf.c clm.c ckpt.c evt.c
 
 
@@ -115,6 +115,15 @@ libevs.so.1.0: util.o evs.o
 	ln -s libevs.so.1.0 libevs.so.1
 	ln -s libevs.so.1.0 libevs.so.1
 	ln -s libevs.so.1.0 libevs.so
 	ln -s libevs.so.1.0 libevs.so
 
 
+libOpenaisCfg.a: util.o cfg.o
+	$(AR) -rc libOpenaisCfg.a util.o cfg.o
+
+libOpenaisCfg.so.1.0: util.o cfg.o
+	$(CC) -shared -Wl,-soname,libOpenaisCfg.so.1,-version-script=libOpenaisCfg.versions util.o cfg.o -o $@
+	rm -f libOpenaisCfg.so.1 libOpenaisCfg.so
+	ln -s libOpenaisCfg.so.1.0 libOpenaisCfg.so.1
+	ln -s libOpenaisCfg.so.1.0 libOpenaisCfg.so
+
 clean:
 clean:
 	rm -f *.o libais.so* libais.a libSaClm.so* libSaClm.a* libSaAmf.so* libSaAmf.a \
 	rm -f *.o libais.so* libais.a libSaClm.so* libSaClm.a* libSaAmf.so* libSaAmf.a \
 		libSaCkpt.so* libSaCkpt.a* libSaEvt.so* libSaEvt.a libSaLck.so libSaLck.a \
 		libSaCkpt.so* libSaCkpt.a* libSaEvt.so* libSaEvt.a libSaLck.so libSaLck.a \

+ 470 - 348
lib/amf.c

@@ -1,6 +1,6 @@
 
 
 /*
 /*
- * Copyright (c) 2002-2003 MontaVista Software, Inc.
+ * Copyright (c) 2002-2005 MontaVista Software, Inc.
  *
  *
  * All rights reserved.
  * All rights reserved.
  *
  *
@@ -46,7 +46,7 @@
 #include <sys/un.h>
 #include <sys/un.h>
 
 
 #include "../include/saAis.h"
 #include "../include/saAis.h"
-#include "../include/ais_amf.h"
+#include "../include/saAmf.h"
 #include "../include/ipc_gen.h"
 #include "../include/ipc_gen.h"
 #include "../include/ipc_amf.h"
 #include "../include/ipc_amf.h"
 #include "util.h"
 #include "util.h"
@@ -86,7 +86,7 @@ static struct saHandleDatabase amfHandleDatabase = {
  * Versions supported
  * Versions supported
  */
  */
 static SaVersionT amfVersionsSupported[] = {
 static SaVersionT amfVersionsSupported[] = {
-	{ 'A', 1, 1 }
+	{ 'B', 1, 1 }
 };
 };
 
 
 static struct saVersionDatabase amfVersionDatabase = {
 static struct saVersionDatabase amfVersionDatabase = {
@@ -102,14 +102,14 @@ void amfHandleInstanceDestructor (void *instance)
 {
 {
 }
 }
 
 
-SaErrorT
+SaAisErrorT
 saAmfInitialize (
 saAmfInitialize (
 	SaAmfHandleT *amfHandle,
 	SaAmfHandleT *amfHandle,
 	const SaAmfCallbacksT *amfCallbacks,
 	const SaAmfCallbacksT *amfCallbacks,
-	const SaVersionT *version)
+	SaVersionT *version)
 {
 {
 	struct amfInstance *amfInstance;
 	struct amfInstance *amfInstance;
-	SaErrorT error = SA_OK;
+	SaAisErrorT error = SA_OK;
 
 
 	error = saVersionVerify (&amfVersionDatabase, (SaVersionT *)version);
 	error = saVersionVerify (&amfVersionDatabase, (SaVersionT *)version);
 	if (error != SA_OK) {
 	if (error != SA_OK) {
@@ -154,45 +154,49 @@ error_no_destroy:
 	return (error);
 	return (error);
 }
 }
 
 
-SaErrorT
+SaAisErrorT
 saAmfSelectionObjectGet (
 saAmfSelectionObjectGet (
-	const SaAmfHandleT *amfHandle,
+	SaAmfHandleT amfHandle,
 	SaSelectionObjectT *selectionObject)
 	SaSelectionObjectT *selectionObject)
 {
 {
 	struct amfInstance *amfInstance;
 	struct amfInstance *amfInstance;
-	SaErrorT error;
+	SaAisErrorT error;
 
 
-	error = saHandleInstanceGet (&amfHandleDatabase, *amfHandle, (void *)&amfInstance);
+	error = saHandleInstanceGet (&amfHandleDatabase, amfHandle, (void *)&amfInstance);
 	if (error != SA_OK) {
 	if (error != SA_OK) {
 		return (error);
 		return (error);
 	}
 	}
 
 
 	*selectionObject = amfInstance->dispatch_fd;
 	*selectionObject = amfInstance->dispatch_fd;
 
 
-	saHandleInstancePut (&amfHandleDatabase, *amfHandle);
+	saHandleInstancePut (&amfHandleDatabase, amfHandle);
 	return (SA_OK);
 	return (SA_OK);
 }
 }
 
 
-SaErrorT
+SaAisErrorT
 saAmfDispatch (
 saAmfDispatch (
-	const SaAmfHandleT *amfHandle,
+	SaAmfHandleT amfHandle,
 	SaDispatchFlagsT dispatchFlags)
 	SaDispatchFlagsT dispatchFlags)
 {
 {
 	struct pollfd ufds;
 	struct pollfd ufds;
 	int timeout = -1;
 	int timeout = -1;
-	SaErrorT error;
+	SaAisErrorT error;
 	int cont = 1; /* always continue do loop except when set to 0 */
 	int cont = 1; /* always continue do loop except when set to 0 */
 	int dispatch_avail;
 	int dispatch_avail;
 	struct amfInstance *amfInstance;
 	struct amfInstance *amfInstance;
-	struct res_lib_amf_healthcheckcallback *res_lib_amf_healthcheckcallback;
-	struct res_lib_amf_readinessstatesetcallback *res_lib_amf_readinessstatesetcallback;
 	struct res_lib_amf_csisetcallback *res_lib_amf_csisetcallback;
 	struct res_lib_amf_csisetcallback *res_lib_amf_csisetcallback;
+
+	struct res_lib_amf_healthcheckcallback *res_lib_amf_healthcheckcallback;
 	struct res_lib_amf_csiremovecallback *res_lib_amf_csiremovecallback;
 	struct res_lib_amf_csiremovecallback *res_lib_amf_csiremovecallback;
+	struct res_lib_amf_componentterminatecallback *res_lib_amf_componentterminatecallback;
+
+	/*
 	struct res_lib_amf_protectiongrouptrackcallback *res_lib_amf_protectiongrouptrackcallback;
 	struct res_lib_amf_protectiongrouptrackcallback *res_lib_amf_protectiongrouptrackcallback;
+	*/
 	SaAmfCallbacksT callbacks;
 	SaAmfCallbacksT callbacks;
 	struct res_overlay dispatch_data;
 	struct res_overlay dispatch_data;
 
 
-	error = saHandleInstanceGet (&amfHandleDatabase, *amfHandle,
+	error = saHandleInstanceGet (&amfHandleDatabase, amfHandle,
 		(void *)&amfInstance);
 		(void *)&amfInstance);
 	if (error != SA_OK) {
 	if (error != SA_OK) {
 		return (error);
 		return (error);
@@ -285,15 +289,7 @@ saAmfDispatch (
 			callbacks.saAmfHealthcheckCallback (
 			callbacks.saAmfHealthcheckCallback (
 				res_lib_amf_healthcheckcallback->invocation,
 				res_lib_amf_healthcheckcallback->invocation,
 				&res_lib_amf_healthcheckcallback->compName,
 				&res_lib_amf_healthcheckcallback->compName,
-				res_lib_amf_healthcheckcallback->checkType);
-			break;
-
-		case MESSAGE_RES_AMF_READINESSSTATESETCALLBACK:
-			res_lib_amf_readinessstatesetcallback = (struct res_lib_amf_readinessstatesetcallback *)&dispatch_data;
-			callbacks.saAmfReadinessStateSetCallback (
-				res_lib_amf_readinessstatesetcallback->invocation,
-				&res_lib_amf_readinessstatesetcallback->compName,
-				res_lib_amf_readinessstatesetcallback->readinessState);
+				&res_lib_amf_healthcheckcallback->key);
 			break;
 			break;
 
 
 		case MESSAGE_RES_AMF_CSISETCALLBACK:
 		case MESSAGE_RES_AMF_CSISETCALLBACK:
@@ -301,11 +297,8 @@ saAmfDispatch (
 			callbacks.saAmfCSISetCallback (
 			callbacks.saAmfCSISetCallback (
 				res_lib_amf_csisetcallback->invocation,
 				res_lib_amf_csisetcallback->invocation,
 				&res_lib_amf_csisetcallback->compName,
 				&res_lib_amf_csisetcallback->compName,
-				&res_lib_amf_csisetcallback->csiName,
-				res_lib_amf_csisetcallback->csiFlags,
-				&res_lib_amf_csisetcallback->haState,
-				&res_lib_amf_csisetcallback->activeCompName,
-				res_lib_amf_csisetcallback->transitionDescriptor);
+				res_lib_amf_csisetcallback->haState,
+				&res_lib_amf_csisetcallback->csiDescriptor);
 			break;
 			break;
 
 
 		case MESSAGE_RES_AMF_CSIREMOVECALLBACK:
 		case MESSAGE_RES_AMF_CSIREMOVECALLBACK:
@@ -314,9 +307,17 @@ saAmfDispatch (
 				res_lib_amf_csiremovecallback->invocation,
 				res_lib_amf_csiremovecallback->invocation,
 				&res_lib_amf_csiremovecallback->compName,
 				&res_lib_amf_csiremovecallback->compName,
 				&res_lib_amf_csiremovecallback->csiName,
 				&res_lib_amf_csiremovecallback->csiName,
-				&res_lib_amf_csiremovecallback->csiFlags);
+				res_lib_amf_csiremovecallback->csiFlags);
+			break;
+
+		case MESSAGE_RES_AMF_COMPONENTTERMINATECALLBACK:
+			res_lib_amf_componentterminatecallback = (struct res_lib_amf_componentterminatecallback *)&dispatch_data;
+			callbacks.saAmfComponentTerminateCallback (
+				res_lib_amf_componentterminatecallback->invocation,
+				&res_lib_amf_componentterminatecallback->compName);
 			break;
 			break;
 
 
+#ifdef COMPILE_OUT
 		case MESSAGE_RES_AMF_PROTECTIONGROUPTRACKCALLBACK:
 		case MESSAGE_RES_AMF_PROTECTIONGROUPTRACKCALLBACK:
 			res_lib_amf_protectiongrouptrackcallback = (struct res_lib_amf_protectiongrouptrackcallback *)&dispatch_data;
 			res_lib_amf_protectiongrouptrackcallback = (struct res_lib_amf_protectiongrouptrackcallback *)&dispatch_data;
 			memcpy (res_lib_amf_protectiongrouptrackcallback->notificationBufferAddress,
 			memcpy (res_lib_amf_protectiongrouptrackcallback->notificationBufferAddress,
@@ -328,8 +329,8 @@ saAmfDispatch (
 				res_lib_amf_protectiongrouptrackcallback->numberOfItems,
 				res_lib_amf_protectiongrouptrackcallback->numberOfItems,
 				res_lib_amf_protectiongrouptrackcallback->numberOfMembers,
 				res_lib_amf_protectiongrouptrackcallback->numberOfMembers,
 				res_lib_amf_protectiongrouptrackcallback->error);
 				res_lib_amf_protectiongrouptrackcallback->error);
+#endif
 			break;
 			break;
-
 		default:
 		default:
 			error = SA_ERR_LIBRARY;	
 			error = SA_ERR_LIBRARY;	
 			goto error_nounlock;
 			goto error_nounlock;
@@ -351,19 +352,19 @@ saAmfDispatch (
 	} while (cont);
 	} while (cont);
 
 
 error_unlock:
 error_unlock:
-	saHandleInstancePut (&amfHandleDatabase, *amfHandle);
+	saHandleInstancePut (&amfHandleDatabase, amfHandle);
 error_nounlock:
 error_nounlock:
 	return (error);
 	return (error);
 }
 }
 
 
-SaErrorT
+SaAisErrorT
 saAmfFinalize (
 saAmfFinalize (
-	const SaAmfHandleT *amfHandle)
+	SaAmfHandleT amfHandle)
 {
 {
 	struct amfInstance *amfInstance;
 	struct amfInstance *amfInstance;
-	SaErrorT error;
+	SaAisErrorT error;
 
 
-	error = saHandleInstanceGet (&amfHandleDatabase, *amfHandle, (void *)&amfInstance);
+	error = saHandleInstanceGet (&amfHandleDatabase, amfHandle, (void *)&amfInstance);
 	if (error != SA_OK) {
 	if (error != SA_OK) {
 		return (error);
 		return (error);
 	}
 	}
@@ -378,7 +379,7 @@ saAmfFinalize (
 	if (amfInstance->finalize) {
 	if (amfInstance->finalize) {
 		pthread_mutex_unlock (&amfInstance->response_mutex);
 		pthread_mutex_unlock (&amfInstance->response_mutex);
 		pthread_mutex_unlock (&amfInstance->dispatch_mutex);
 		pthread_mutex_unlock (&amfInstance->dispatch_mutex);
-		saHandleInstancePut (&amfHandleDatabase, *amfHandle);
+		saHandleInstancePut (&amfHandleDatabase, amfHandle);
 		return (SA_ERR_BAD_HANDLE);
 		return (SA_ERR_BAD_HANDLE);
 	}
 	}
 
 
@@ -388,7 +389,7 @@ saAmfFinalize (
 
 
 	pthread_mutex_unlock (&amfInstance->dispatch_mutex);
 	pthread_mutex_unlock (&amfInstance->dispatch_mutex);
 
 
-	saHandleDestroy (&amfHandleDatabase, *amfHandle);
+	saHandleDestroy (&amfHandleDatabase, amfHandle);
 
 
 	if (amfInstance->response_fd != -1) {
 	if (amfInstance->response_fd != -1) {
 		shutdown (amfInstance->response_fd, 0);
 		shutdown (amfInstance->response_fd, 0);
@@ -399,266 +400,446 @@ saAmfFinalize (
 		close (amfInstance->dispatch_fd);
 		close (amfInstance->dispatch_fd);
 	}
 	}
 
 
-	saHandleInstancePut (&amfHandleDatabase, *amfHandle);
+	saHandleInstancePut (&amfHandleDatabase, amfHandle);
 
 
 	return (error);
 	return (error);
 }
 }
 
 
-SaErrorT
+SaAisErrorT
 saAmfComponentRegister (
 saAmfComponentRegister (
-	const SaAmfHandleT *amfHandle,
+	SaAmfHandleT amfHandle,
 	const SaNameT *compName,
 	const SaNameT *compName,
 	const SaNameT *proxyCompName)
 	const SaNameT *proxyCompName)
 {
 {
 	struct amfInstance *amfInstance;
 	struct amfInstance *amfInstance;
-	SaErrorT error;
+	SaAisErrorT error;
 	struct req_lib_amf_componentregister req_lib_amf_componentregister;
 	struct req_lib_amf_componentregister req_lib_amf_componentregister;
 	struct res_lib_amf_componentregister res_lib_amf_componentregister;
 	struct res_lib_amf_componentregister res_lib_amf_componentregister;
 
 
+	error = saHandleInstanceGet (&amfHandleDatabase, amfHandle,
+		(void *)&amfInstance);
+	if (error != SA_OK) {
+		return (error);
+	}
+
 	req_lib_amf_componentregister.header.size = sizeof (struct req_lib_amf_componentregister);
 	req_lib_amf_componentregister.header.size = sizeof (struct req_lib_amf_componentregister);
 	req_lib_amf_componentregister.header.id = MESSAGE_REQ_AMF_COMPONENTREGISTER;
 	req_lib_amf_componentregister.header.id = MESSAGE_REQ_AMF_COMPONENTREGISTER;
-	memcpy (&req_lib_amf_componentregister.compName, compName, sizeof (SaNameT));
+	memcpy (&req_lib_amf_componentregister.compName, compName,
+		sizeof (SaNameT));
 	if (proxyCompName) {
 	if (proxyCompName) {
-		memcpy (&req_lib_amf_componentregister.proxyCompName, proxyCompName, sizeof (SaNameT));
+		memcpy (&req_lib_amf_componentregister.proxyCompName,
+			proxyCompName, sizeof (SaNameT));
 	} else {
 	} else {
-		memset (&req_lib_amf_componentregister.proxyCompName, 0, sizeof (SaNameT));
-	}
-
-	error = saHandleInstanceGet (&amfHandleDatabase, *amfHandle, (void *)&amfInstance);
-	if (error != SA_OK) {
-		return (error);
+		memset (&req_lib_amf_componentregister.proxyCompName, 0,
+			sizeof (SaNameT));
 	}
 	}
 
 
 	pthread_mutex_lock (&amfInstance->response_mutex);
 	pthread_mutex_lock (&amfInstance->response_mutex);
 
 
-	error = saSendReceiveReply (amfInstance->response_fd, &req_lib_amf_componentregister,
+	error = saSendReceiveReply (amfInstance->response_fd,
+		&req_lib_amf_componentregister,
 		sizeof (struct req_lib_amf_componentregister),
 		sizeof (struct req_lib_amf_componentregister),
 		&res_lib_amf_componentregister,
 		&res_lib_amf_componentregister,
 		sizeof (struct res_lib_amf_componentregister));
 		sizeof (struct res_lib_amf_componentregister));
-	if (error != SA_OK) {
-		goto error_unlock;
-	}
 
 
-	if (res_lib_amf_componentregister.header.error == SA_OK) {
+	pthread_mutex_unlock (&amfInstance->response_mutex);
+
+	saHandleInstancePut (&amfHandleDatabase, amfHandle);
+
+	if (res_lib_amf_componentregister.header.error == SA_AIS_OK) {
 		amfInstance->compRegistered = 1;
 		amfInstance->compRegistered = 1;
 		memcpy (&amfInstance->compName, compName, sizeof (SaNameT));
 		memcpy (&amfInstance->compName, compName, sizeof (SaNameT));
 	}
 	}
-
-	error = res_lib_amf_componentregister.header.error;
-
-error_unlock:
-	pthread_mutex_unlock (&amfInstance->response_mutex);
-	saHandleInstancePut (&amfHandleDatabase, *amfHandle);
-	return (error);
+        return (error == SA_AIS_OK ? res_lib_amf_componentregister.header.error : error);
 }
 }
 
 
-SaErrorT
+SaAisErrorT
 saAmfComponentUnregister (
 saAmfComponentUnregister (
-	const SaAmfHandleT *amfHandle,
+	SaAmfHandleT amfHandle,
 	const SaNameT *compName,
 	const SaNameT *compName,
 	const SaNameT *proxyCompName)
 	const SaNameT *proxyCompName)
 {
 {
 	struct req_lib_amf_componentunregister req_lib_amf_componentunregister;
 	struct req_lib_amf_componentunregister req_lib_amf_componentunregister;
 	struct res_lib_amf_componentunregister res_lib_amf_componentunregister;
 	struct res_lib_amf_componentunregister res_lib_amf_componentunregister;
 	struct amfInstance *amfInstance;
 	struct amfInstance *amfInstance;
-	SaErrorT error;
+	SaAisErrorT error;
+
+	error = saHandleInstanceGet (&amfHandleDatabase, amfHandle,
+		(void *)&amfInstance);
+	if (error != SA_OK) {
+		return (error);
+	}
 
 
 	req_lib_amf_componentunregister.header.size = sizeof (struct req_lib_amf_componentunregister);
 	req_lib_amf_componentunregister.header.size = sizeof (struct req_lib_amf_componentunregister);
 	req_lib_amf_componentunregister.header.id = MESSAGE_REQ_AMF_COMPONENTUNREGISTER;
 	req_lib_amf_componentunregister.header.id = MESSAGE_REQ_AMF_COMPONENTUNREGISTER;
-	memcpy (&req_lib_amf_componentunregister.compName, compName, sizeof (SaNameT));
+	memcpy (&req_lib_amf_componentunregister.compName, compName,
+		sizeof (SaNameT));
 	if (proxyCompName) {
 	if (proxyCompName) {
-		memcpy (&req_lib_amf_componentunregister.proxyCompName, proxyCompName, sizeof (SaNameT));
+		memcpy (&req_lib_amf_componentunregister.proxyCompName,
+			proxyCompName, sizeof (SaNameT));
 	} else {
 	} else {
-		memset (&req_lib_amf_componentunregister.proxyCompName, 0, sizeof (SaNameT));
+		memset (&req_lib_amf_componentunregister.proxyCompName, 0,
+			sizeof (SaNameT));
 	}	
 	}	
 
 
-	error = saHandleInstanceGet (&amfHandleDatabase, *amfHandle, (void *)&amfInstance);
-	if (error != SA_OK) {
-		return (error);
-	}
-
 	pthread_mutex_lock (&amfInstance->response_mutex);
 	pthread_mutex_lock (&amfInstance->response_mutex);
 
 
-	error - saSendReceiveReply (amfInstance->response_fd,
+	error = saSendReceiveReply (amfInstance->response_fd,
 		&req_lib_amf_componentunregister,
 		&req_lib_amf_componentunregister,
 		sizeof (struct req_lib_amf_componentunregister),
 		sizeof (struct req_lib_amf_componentunregister),
 		&res_lib_amf_componentunregister,
 		&res_lib_amf_componentunregister,
 		sizeof (struct res_lib_amf_componentunregister));
 		sizeof (struct res_lib_amf_componentunregister));
+
+	pthread_mutex_unlock (&amfInstance->response_mutex);
+
+	saHandleInstancePut (&amfHandleDatabase, amfHandle);
+
+        return (error == SA_AIS_OK ? res_lib_amf_componentunregister.header.error : error);
+}
+
+SaAisErrorT
+saAmfComponentNameGet (
+	SaAmfHandleT amfHandle,
+	SaNameT *compName)
+{
+	struct amfInstance *amfInstance;
+	SaAisErrorT error;
+	char *env_value;
+
+	error = saHandleInstanceGet (&amfHandleDatabase, amfHandle,
+		(void *)&amfInstance);
 	if (error != SA_OK) {
 	if (error != SA_OK) {
-		goto error_unlock;
+		return (error);
 	}
 	}
 
 
-	error = res_lib_amf_componentunregister.header.error;
-	if (error == SA_OK) {
-		amfInstance->compRegistered = 0;
+	pthread_mutex_lock (&amfInstance->response_mutex);
+
+	error = SA_AIS_OK;
+
+	env_value = getenv ("SA_AMF_COMPONENT_NAME");
+	if (env_value == 0) {
+		error = SA_AIS_ERR_NOT_EXIST;
+		goto error_exit;
 	}
 	}
 
 
-error_unlock:
+	strcpy (compName->value, env_value);
+	compName->length = strlen (env_value);
+
+error_exit:
 	pthread_mutex_unlock (&amfInstance->response_mutex);
 	pthread_mutex_unlock (&amfInstance->response_mutex);
-	saHandleInstancePut (&amfHandleDatabase, *amfHandle);
+
+	saHandleInstancePut (&amfHandleDatabase, amfHandle);
+
 	return (error);
 	return (error);
 }
 }
 
 
-SaErrorT
-saAmfCompNameGet (
-	const SaAmfHandleT *amfHandle,
-	SaNameT *compName)
+SaAisErrorT
+saAmfPmStart (
+	SaAmfHandleT amfHandle,
+	const SaNameT *compName,
+	SaUint64T processId,
+	SaInt32T descendentsTreeDepth,
+	SaAmfPmErrorsT pmErrors,
+	SaAmfRecommendedRecoveryT recommendedRecovery)
 {
 {
+	struct req_lib_amf_pmstart req_lib_amf_pmstart;
+	struct res_lib_amf_pmstart res_lib_amf_pmstart;
 	struct amfInstance *amfInstance;
 	struct amfInstance *amfInstance;
-	SaErrorT error;
+	SaAisErrorT error;
 
 
-	error = saHandleInstanceGet (&amfHandleDatabase, *amfHandle, (void *)&amfInstance);
+	error = saHandleInstanceGet (&amfHandleDatabase, amfHandle,
+		(void *)&amfInstance);
 	if (error != SA_OK) {
 	if (error != SA_OK) {
 		return (error);
 		return (error);
 	}
 	}
 
 
+	req_lib_amf_pmstart.header.size = sizeof (struct req_lib_amf_componentunregister);
+	req_lib_amf_pmstart.header.id = MESSAGE_REQ_AMF_PMSTART;
+	memcpy (&req_lib_amf_pmstart.compName, compName,
+		sizeof (SaNameT));
+	req_lib_amf_pmstart.processId = processId;
+	req_lib_amf_pmstart.descendentsTreeDepth = descendentsTreeDepth;
+	req_lib_amf_pmstart.pmErrors = pmErrors;
+
 	pthread_mutex_lock (&amfInstance->response_mutex);
 	pthread_mutex_lock (&amfInstance->response_mutex);
 
 
-	if (amfInstance->compRegistered == 0) {
-		pthread_mutex_unlock (&amfInstance->response_mutex);
-		return (SA_ERR_NOT_EXIST);
+	error = saSendReceiveReply (amfInstance->response_fd,
+		&req_lib_amf_pmstart,
+		sizeof (struct req_lib_amf_pmstart),
+		&res_lib_amf_pmstart,
+		sizeof (struct res_lib_amf_pmstart));
+
+	pthread_mutex_unlock (&amfInstance->response_mutex);
+
+	saHandleInstancePut (&amfHandleDatabase, amfHandle);
+
+        return (error == SA_AIS_OK ? res_lib_amf_pmstart.header.error : error);
+}
+
+SaAisErrorT
+saAmfPmStop (
+	SaAmfHandleT amfHandle,
+	const SaNameT *compName,
+	SaAmfPmStopQualifierT stopQualifier,
+	SaInt64T processId,
+	SaAmfPmErrorsT pmErrors)
+{
+	struct req_lib_amf_pmstop req_lib_amf_pmstop;
+	struct res_lib_amf_pmstop res_lib_amf_pmstop;
+	struct amfInstance *amfInstance;
+	SaAisErrorT error;
+
+	error = saHandleInstanceGet (&amfHandleDatabase, amfHandle,
+		(void *)&amfInstance);
+	if (error != SA_OK) {
+		return (error);
 	}
 	}
 
 
-	memcpy (compName, &amfInstance->compName, sizeof (SaNameT));
+	req_lib_amf_pmstop.header.size = sizeof (struct req_lib_amf_pmstop);
+	req_lib_amf_pmstop.header.id = MESSAGE_REQ_AMF_PMSTOP;
+	memcpy (&req_lib_amf_pmstop.compName, compName, sizeof (SaNameT));
+	req_lib_amf_pmstop.stopQualifier = stopQualifier;
+	req_lib_amf_pmstop.processId = processId;
+	req_lib_amf_pmstop.pmErrors = pmErrors;
+
+	pthread_mutex_lock (&amfInstance->response_mutex);
+
+	error = saSendReceiveReply (amfInstance->response_fd,
+		&req_lib_amf_pmstop,
+		sizeof (struct req_lib_amf_pmstop),
+		&res_lib_amf_pmstop,
+		sizeof (struct res_lib_amf_pmstop));
 
 
 	pthread_mutex_unlock (&amfInstance->response_mutex);
 	pthread_mutex_unlock (&amfInstance->response_mutex);
 
 
-	saHandleInstancePut (&amfHandleDatabase, *amfHandle);
+	saHandleInstancePut (&amfHandleDatabase, amfHandle);
 
 
-	return (SA_OK);
+        return (error == SA_AIS_OK ? res_lib_amf_pmstop.header.error : error);
+	return (SA_AIS_OK);
 }
 }
 
 
-SaErrorT
-saAmfReadinessStateGet (
+SaAisErrorT
+saAmfHealthcheckStart (
+	SaAmfHandleT amfHandle,
 	const SaNameT *compName,
 	const SaNameT *compName,
-	SaAmfReadinessStateT *readinessState)
+	const SaAmfHealthcheckKeyT *healthcheckKey,
+	SaAmfHealthcheckInvocationT invocationType,
+	SaAmfRecommendedRecoveryT recommendedRecovery)
 {
 {
-	int fd_response;
-	int fd_dispatch;
-	SaErrorT error;
-	struct req_amf_readinessstateget req_amf_readinessstateget;
-	struct res_lib_amf_readinessstateget res_lib_amf_readinessstateget;
+	struct req_lib_amf_healthcheckstart req_lib_amf_healthcheckstart;
+	struct res_lib_amf_healthcheckstart res_lib_amf_healthcheckstart;
+	struct amfInstance *amfInstance;
+	SaAisErrorT error;
 
 
-	error = saServiceConnectTwo (&fd_response, &fd_dispatch, AMF_SERVICE);
+	error = saHandleInstanceGet (&amfHandleDatabase, amfHandle,
+		(void *)&amfInstance);
 	if (error != SA_OK) {
 	if (error != SA_OK) {
-		goto exit_noclose;
+		return (error);
 	}
 	}
-	req_amf_readinessstateget.header.id = MESSAGE_RES_AMF_READINESSSTATEGET;
-	req_amf_readinessstateget.header.size = sizeof (struct req_amf_readinessstateget);
-	memcpy (&req_amf_readinessstateget.compName, compName, sizeof (SaNameT));
 
 
-	error - saSendReceiveReply (fd_response,
-		&req_amf_readinessstateget, sizeof (struct req_amf_readinessstateget),
-		&res_lib_amf_readinessstateget, sizeof (struct res_lib_amf_readinessstateget));
+	req_lib_amf_healthcheckstart.header.size = sizeof (struct req_lib_amf_healthcheckstart);
+	req_lib_amf_healthcheckstart.header.id = MESSAGE_REQ_AMF_HEALTHCHECKSTART;
+	memcpy (&req_lib_amf_healthcheckstart.compName, compName,
+		sizeof (SaNameT));
+	memcpy (&req_lib_amf_healthcheckstart.healthcheckKey,
+		healthcheckKey, sizeof (SaAmfHealthcheckKeyT));
+	req_lib_amf_healthcheckstart.invocationType = invocationType;
+	req_lib_amf_healthcheckstart.recommendedRecovery = recommendedRecovery;
+
+	pthread_mutex_lock (&amfInstance->response_mutex);
+
+	error = saSendReceiveReply (amfInstance->response_fd,
+		&req_lib_amf_healthcheckstart,
+		sizeof (struct req_lib_amf_healthcheckstart),
+		&res_lib_amf_healthcheckstart,
+		sizeof (struct res_lib_amf_healthcheckstart));
+
+	pthread_mutex_unlock (&amfInstance->response_mutex);
+
+	saHandleInstancePut (&amfHandleDatabase, amfHandle);
+
+        return (error == SA_AIS_OK ? res_lib_amf_healthcheckstart.header.error : error);
+}
+
+SaAisErrorT
+saAmfHealthcheckConfirm (
+	SaAmfHandleT amfHandle,
+	const SaNameT *compName,
+	const SaAmfHealthcheckKeyT *healthcheckKey,
+	SaAisErrorT healthcheckResult)
+{
+	struct req_lib_amf_healthcheckconfirm req_lib_amf_healthcheckconfirm;
+	struct res_lib_amf_healthcheckconfirm res_lib_amf_healthcheckconfirm;
+	struct amfInstance *amfInstance;
+	SaAisErrorT error;
+
+	error = saHandleInstanceGet (&amfHandleDatabase, amfHandle,
+		(void *)&amfInstance);
 	if (error != SA_OK) {
 	if (error != SA_OK) {
-		goto exit_close;
+		return (error);
 	}
 	}
 
 
-	error = res_lib_amf_readinessstateget.header.error;
-	if (error == SA_OK) {
-		memcpy (readinessState, &res_lib_amf_readinessstateget.readinessState, 
-			sizeof (SaAmfReadinessStateT));
-	}
-		
-exit_close:
-	close (fd_response);
-	close (fd_dispatch);
-exit_noclose:
-	return (error);
+	req_lib_amf_healthcheckconfirm.header.size = sizeof (struct req_lib_amf_componentunregister);
+	req_lib_amf_healthcheckconfirm.header.id = MESSAGE_REQ_AMF_HEALTHCHECKCONFIRM;
+	memcpy (&req_lib_amf_healthcheckconfirm.compName, compName,
+		sizeof (SaNameT));
+	memcpy (&req_lib_amf_healthcheckconfirm.healthcheckKey,
+		healthcheckKey, sizeof (SaAmfHealthcheckKeyT));
+	req_lib_amf_healthcheckconfirm.healthcheckResult = healthcheckResult;
+
+	pthread_mutex_lock (&amfInstance->response_mutex);
+
+	error = saSendReceiveReply (amfInstance->response_fd,
+		&req_lib_amf_healthcheckconfirm,
+		sizeof (struct req_lib_amf_healthcheckconfirm),
+		&res_lib_amf_healthcheckconfirm,
+		sizeof (struct res_lib_amf_healthcheckconfirm));
+
+	pthread_mutex_unlock (&amfInstance->response_mutex);
+
+	saHandleInstancePut (&amfHandleDatabase, amfHandle);
+
+        return (error == SA_AIS_OK ? res_lib_amf_healthcheckconfirm.header.error : error);
 }
 }
 
 
-SaErrorT
-saAmfStoppingComplete (
-	SaInvocationT invocation,
-	SaErrorT error)
+SaAisErrorT
+saAmfHealthcheckStop (
+	SaAmfHandleT amfHandle,
+	const SaNameT *compName,
+	const SaAmfHealthcheckKeyT *healthcheckKey)
 {
 {
-	struct req_amf_stoppingcomplete req_amf_stoppingcomplete;
-	struct res_lib_amf_stoppingcomplete res_lib_amf_stoppingcomplete;
-	int fd;
-	SaErrorT errorResult;
+	struct req_lib_amf_healthcheckstop req_lib_amf_healthcheckstop;
+	struct res_lib_amf_healthcheckstop res_lib_amf_healthcheckstop;
+	struct amfInstance *amfInstance;
+	SaAisErrorT error;
 
 
-	errorResult = saServiceConnect (&fd, AMF_SERVICE);
-	if (errorResult != SA_OK) {
-		goto exit_noclose;
-	}
-	req_amf_stoppingcomplete.header.id = MESSAGE_REQ_AMF_STOPPINGCOMPLETE;
-	req_amf_stoppingcomplete.header.size = sizeof (struct req_amf_stoppingcomplete);
-	req_amf_stoppingcomplete.invocation = invocation;
-	req_amf_stoppingcomplete.error = error;
-	error = saSendReceiveReply (fd,
-		&req_amf_stoppingcomplete, sizeof (struct req_amf_stoppingcomplete),
-		&res_lib_amf_stoppingcomplete, sizeof (struct res_lib_amf_stoppingcomplete));
+	error = saHandleInstanceGet (&amfHandleDatabase, amfHandle,
+		(void *)&amfInstance);
 	if (error != SA_OK) {
 	if (error != SA_OK) {
-		goto exit_close;
+		return (error);
 	}
 	}
-	error = res_lib_amf_stoppingcomplete.header.error;
-// TODO executive needs to send reply of stopping complete
 
 
-exit_close:
-	close (fd);
-exit_noclose:
-	return (errorResult);
+	req_lib_amf_healthcheckstop.header.size = sizeof (struct req_lib_amf_healthcheckstop);
+	req_lib_amf_healthcheckstop.header.id = MESSAGE_REQ_AMF_HEALTHCHECKSTOP;
+	memcpy (&req_lib_amf_healthcheckstop.compName, compName,
+		sizeof (SaNameT));
+	memcpy (&req_lib_amf_healthcheckstop.healthcheckKey,
+		healthcheckKey, sizeof (SaAmfHealthcheckKeyT));
+
+	pthread_mutex_lock (&amfInstance->response_mutex);
+
+	error = saSendReceiveReply (amfInstance->response_fd,
+		&req_lib_amf_healthcheckstop,
+		sizeof (struct req_lib_amf_healthcheckstop),
+		&res_lib_amf_healthcheckstop,
+		sizeof (struct res_lib_amf_healthcheckstop));
+
+	pthread_mutex_unlock (&amfInstance->response_mutex);
+
+	saHandleInstancePut (&amfHandleDatabase, amfHandle);
+
+        return (error == SA_AIS_OK ? res_lib_amf_healthcheckstop.header.error : error);
 }
 }
 
 
-SaErrorT
+
+SaAisErrorT
 saAmfHAStateGet (
 saAmfHAStateGet (
+	SaAmfHandleT amfHandle,
 	const SaNameT *compName,
 	const SaNameT *compName,
 	const SaNameT *csiName,
 	const SaNameT *csiName,
-	SaAmfHAStateT *haState) {
-
-	struct req_amf_hastateget req_amf_hastateget;
+	SaAmfHAStateT *haState)
+{
+	struct amfInstance *amfInstance;
+	struct req_lib_amf_hastateget req_lib_amf_hastateget;
 	struct res_lib_amf_hastateget res_lib_amf_hastateget;
 	struct res_lib_amf_hastateget res_lib_amf_hastateget;
-	int fd;
-	SaErrorT error;
+	SaAisErrorT error;
 
 
-	error = saServiceConnect (&fd, AMF_SERVICE);
-	if (error != SA_OK) {
-		goto exit_noclose;
+	error = saHandleInstanceGet (&amfHandleDatabase, amfHandle,
+		(void *)&amfInstance);
+	if (error != SA_AIS_OK) {
+		return (error);
 	}
 	}
-	req_amf_hastateget.header.id = MESSAGE_REQ_AMF_HASTATEGET;
-	req_amf_hastateget.header.size = sizeof (struct req_amf_hastateget);
-	memcpy (&req_amf_hastateget.compName, compName, sizeof (SaNameT));
-	memcpy (&req_amf_hastateget.csiName, csiName, sizeof (SaNameT));
 
 
-	error = saSendReceiveReply (fd,
-		&req_amf_hastateget, sizeof (struct req_amf_hastateget),
+	pthread_mutex_lock (&amfInstance->response_mutex);
+
+	req_lib_amf_hastateget.header.id = MESSAGE_REQ_AMF_HASTATEGET;
+	req_lib_amf_hastateget.header.size = sizeof (struct req_lib_amf_hastateget);
+	memcpy (&req_lib_amf_hastateget.compName, compName, sizeof (SaNameT));
+	memcpy (&req_lib_amf_hastateget.csiName, csiName, sizeof (SaNameT));
+
+	error = saSendReceiveReply (amfInstance->response_fd,
+		&req_lib_amf_hastateget, sizeof (struct req_lib_amf_hastateget),
 		&res_lib_amf_hastateget, sizeof (struct res_lib_amf_hastateget));
 		&res_lib_amf_hastateget, sizeof (struct res_lib_amf_hastateget));
-	if (error != SA_OK) {
-		goto exit_close;
+
+	pthread_mutex_unlock (&amfInstance->response_mutex);
+
+	saHandleInstancePut (&amfHandleDatabase, amfHandle);
+
+	if (res_lib_amf_hastateget.header.error == SA_AIS_OK) {
+		memcpy (haState, &res_lib_amf_hastateget.haState,
+			sizeof (SaAmfHAStateT));
 	}
 	}
+        return (error == SA_AIS_OK ? res_lib_amf_hastateget.header.error : error);
+}
+
+SaAisErrorT
+saAmfCSIQuiescingComplete (
+	SaAmfHandleT amfHandle,
+	SaInvocationT invocation,
+	SaAisErrorT error)
+{
+	struct req_lib_amf_csiquiescingcomplete req_lib_amf_csiquiescingcomplete;
+	struct res_lib_amf_csiquiescingcomplete res_lib_amf_csiquiescingcomplete;
+	struct amfInstance *amfInstance;
+	SaAisErrorT errorResult;
 
 
-	error = res_lib_amf_hastateget.header.error;
-	if (error == SA_OK) {
-		memcpy (haState, &res_lib_amf_hastateget.haState, sizeof (SaAmfHAStateT));
+	error = saHandleInstanceGet (&amfHandleDatabase, amfHandle,
+		(void *)&amfInstance);
+	if (error != SA_OK) {
+		return (error);
 	}
 	}
-	
-exit_close:
-	close (fd);
-exit_noclose:
-	return (error);
+
+	req_lib_amf_csiquiescingcomplete.header.size = sizeof (struct req_lib_amf_componentunregister);
+	req_lib_amf_csiquiescingcomplete.header.id = MESSAGE_REQ_AMF_CSIQUIESCINGCOMPLETE;
+	req_lib_amf_csiquiescingcomplete.invocation = invocation;
+	req_lib_amf_csiquiescingcomplete.error = error;
+
+	pthread_mutex_lock (&amfInstance->response_mutex);
+
+	errorResult = saSendReceiveReply (amfInstance->response_fd,
+		&req_lib_amf_csiquiescingcomplete,
+		sizeof (struct req_lib_amf_csiquiescingcomplete),
+		&res_lib_amf_csiquiescingcomplete,
+		sizeof (struct res_lib_amf_csiquiescingcomplete));
+
+	pthread_mutex_unlock (&amfInstance->response_mutex);
+
+	saHandleInstancePut (&amfHandleDatabase, amfHandle);
+
+        return (errorResult == SA_AIS_OK ? res_lib_amf_csiquiescingcomplete.header.error : errorResult);
 }
 }
 
 
-SaErrorT
+SaAisErrorT
 saAmfProtectionGroupTrackStart (
 saAmfProtectionGroupTrackStart (
-	const SaAmfHandleT *amfHandle,
+	SaAmfHandleT amfHandle,
 	const SaNameT *csiName,
 	const SaNameT *csiName,
 	SaUint8T trackFlags,
 	SaUint8T trackFlags,
-	const SaAmfProtectionGroupNotificationT *notificationBuffer,
-	SaUint32T numberOfItems) {
-
+	const SaAmfProtectionGroupNotificationT *notificationBuffer)
+{
 	struct amfInstance *amfInstance;
 	struct amfInstance *amfInstance;
-	struct req_amf_protectiongrouptrackstart req_amf_protectiongrouptrackstart;
+	struct req_lib_amf_protectiongrouptrackstart req_lib_amf_protectiongrouptrackstart;
 	struct res_lib_amf_protectiongrouptrackstart res_lib_amf_protectiongrouptrackstart;
 	struct res_lib_amf_protectiongrouptrackstart res_lib_amf_protectiongrouptrackstart;
-	SaErrorT error;
+	SaAisErrorT error;
 
 
-	req_amf_protectiongrouptrackstart.header.size = sizeof (struct req_amf_protectiongrouptrackstart);
-	req_amf_protectiongrouptrackstart.header.id = MESSAGE_REQ_AMF_PROTECTIONGROUPTRACKSTART;
-	memcpy (&req_amf_protectiongrouptrackstart.csiName, csiName, sizeof (SaNameT));
-	req_amf_protectiongrouptrackstart.trackFlags = trackFlags;
-	req_amf_protectiongrouptrackstart.notificationBufferAddress = (SaAmfProtectionGroupNotificationT *)notificationBuffer;
-	req_amf_protectiongrouptrackstart.numberOfItems = numberOfItems;
+	req_lib_amf_protectiongrouptrackstart.header.size = sizeof (struct req_lib_amf_protectiongrouptrackstart);
+	req_lib_amf_protectiongrouptrackstart.header.id = MESSAGE_REQ_AMF_PROTECTIONGROUPTRACKSTART;
+	memcpy (&req_lib_amf_protectiongrouptrackstart.csiName, csiName,
+		sizeof (SaNameT));
+	req_lib_amf_protectiongrouptrackstart.trackFlags = trackFlags;
+	req_lib_amf_protectiongrouptrackstart.notificationBufferAddress = (SaAmfProtectionGroupNotificationT *)notificationBuffer;
 
 
-	error = saHandleInstanceGet (&amfHandleDatabase, *amfHandle, (void *)&amfInstance);
+	error = saHandleInstanceGet (&amfHandleDatabase, amfHandle,
+		(void *)&amfInstance);
 	if (error != SA_OK) {
 	if (error != SA_OK) {
 		return (error);
 		return (error);
 	}
 	}
@@ -666,219 +847,160 @@ saAmfProtectionGroupTrackStart (
 	pthread_mutex_lock (&amfInstance->response_mutex);
 	pthread_mutex_lock (&amfInstance->response_mutex);
 
 
 	error = saSendReceiveReply (amfInstance->response_fd,
 	error = saSendReceiveReply (amfInstance->response_fd,
-		&req_amf_protectiongrouptrackstart,
-		sizeof (struct req_amf_protectiongrouptrackstart),
+		&req_lib_amf_protectiongrouptrackstart,
+		sizeof (struct req_lib_amf_protectiongrouptrackstart),
 		&res_lib_amf_protectiongrouptrackstart,
 		&res_lib_amf_protectiongrouptrackstart,
 		sizeof (struct res_lib_amf_protectiongrouptrackstart));
 		sizeof (struct res_lib_amf_protectiongrouptrackstart));
-	if (error != SA_OK) {
-		goto error_unlock;
-	}
 
 
-	error = res_lib_amf_protectiongrouptrackstart.header.error;
-
-error_unlock:
 	pthread_mutex_unlock (&amfInstance->response_mutex);
 	pthread_mutex_unlock (&amfInstance->response_mutex);
-	saHandleInstancePut (&amfHandleDatabase, *amfHandle);
-	return (error);
+
+	saHandleInstancePut (&amfHandleDatabase, amfHandle);
+
+        return (error == SA_AIS_OK ? res_lib_amf_protectiongrouptrackstart.header.error : error);
 }
 }
 
 
-SaErrorT
+SaAisErrorT
 saAmfProtectionGroupTrackStop (
 saAmfProtectionGroupTrackStop (
-	const SaAmfHandleT *amfHandle,
-	const SaNameT *csiName) {
-
+	SaAmfHandleT amfHandle,
+	const SaNameT *csiName)
+{
 	struct amfInstance *amfInstance;
 	struct amfInstance *amfInstance;
-	struct req_amf_protectiongrouptrackstop req_amf_protectiongrouptrackstop;
+	struct req_lib_amf_protectiongrouptrackstop req_lib_amf_protectiongrouptrackstop;
 	struct res_lib_amf_protectiongrouptrackstop res_lib_amf_protectiongrouptrackstop;
 	struct res_lib_amf_protectiongrouptrackstop res_lib_amf_protectiongrouptrackstop;
-	SaErrorT error;
-
-	req_amf_protectiongrouptrackstop.header.size = sizeof (struct req_amf_protectiongrouptrackstop);
-	req_amf_protectiongrouptrackstop.header.id = MESSAGE_REQ_AMF_PROTECTIONGROUPTRACKSTOP;
-	memcpy (&req_amf_protectiongrouptrackstop.csiName, csiName, sizeof (SaNameT));
+	SaAisErrorT error;
 
 
-	error = saHandleInstanceGet (&amfHandleDatabase, *amfHandle, (void *)&amfInstance);
+	error = saHandleInstanceGet (&amfHandleDatabase, amfHandle,
+		(void *)&amfInstance);
 	if (error != SA_OK) {
 	if (error != SA_OK) {
 		return (error);
 		return (error);
 	}
 	}
 
 
+	req_lib_amf_protectiongrouptrackstop.header.size = sizeof (struct req_lib_amf_protectiongrouptrackstop);
+	req_lib_amf_protectiongrouptrackstop.header.id = MESSAGE_REQ_AMF_PROTECTIONGROUPTRACKSTOP;
+	memcpy (&req_lib_amf_protectiongrouptrackstop.csiName, csiName, sizeof (SaNameT));
+
 	pthread_mutex_lock (&amfInstance->response_mutex);
 	pthread_mutex_lock (&amfInstance->response_mutex);
 
 
 	error = saSendReceiveReply (amfInstance->response_fd,
 	error = saSendReceiveReply (amfInstance->response_fd,
-		&req_amf_protectiongrouptrackstop,
-		sizeof (struct req_amf_protectiongrouptrackstop),
+		&req_lib_amf_protectiongrouptrackstop,
+		sizeof (struct req_lib_amf_protectiongrouptrackstop),
 		&res_lib_amf_protectiongrouptrackstop,
 		&res_lib_amf_protectiongrouptrackstop,
 		sizeof (struct res_lib_amf_protectiongrouptrackstop));
 		sizeof (struct res_lib_amf_protectiongrouptrackstop));
-	if (error != SA_OK) {
-		goto error_unlock;
-	}
-
-	error = res_lib_amf_protectiongrouptrackstop.header.error;
 
 
-error_unlock:
 	pthread_mutex_unlock (&amfInstance->response_mutex);
 	pthread_mutex_unlock (&amfInstance->response_mutex);
-	saHandleInstancePut (&amfHandleDatabase, *amfHandle);
-	return (error);
+
+	saHandleInstancePut (&amfHandleDatabase, amfHandle);
+
+        return (error == SA_AIS_OK ? res_lib_amf_protectiongrouptrackstop.header.error : error);
 }
 }
 
 
-SaErrorT
-saAmfErrorReport (
-	const SaNameT *reportingComponent,
+SaAisErrorT
+saAmfComponentErrorReport (
+	SaAmfHandleT amfHandle,
 	const SaNameT *erroneousComponent,
 	const SaNameT *erroneousComponent,
 	SaTimeT errorDetectionTime,
 	SaTimeT errorDetectionTime,
-	const SaAmfErrorDescriptorT *errorDescriptor,
-	const SaAmfAdditionalDataT *additionalData) {
-
-	struct req_lib_amf_errorreport req_lib_amf_errorreport;
-	struct res_lib_amf_errorreport res_lib_amf_errorreport;
-	int fd;
-	SaErrorT error;
-
-	error = saServiceConnect (&fd, AMF_SERVICE);
-	if (error != SA_OK) {
-		goto exit_noclose;
-	}
-	req_lib_amf_errorreport.header.id = MESSAGE_REQ_AMF_ERRORREPORT;
-	req_lib_amf_errorreport.header.size = sizeof (struct req_lib_amf_errorreport);
-	memcpy (&req_lib_amf_errorreport.reportingComponent, reportingComponent, sizeof (SaNameT));
-	memcpy (&req_lib_amf_errorreport.erroneousComponent, erroneousComponent, sizeof (SaNameT));
-	req_lib_amf_errorreport.errorDetectionTime = errorDetectionTime;
-	memcpy (&req_lib_amf_errorreport.errorDescriptor,
-		errorDescriptor, sizeof (SaAmfErrorDescriptorT));
-	/* TODO this is wrong, and needs some thinking
-	memcpy (&req_lib_amf_errorreport.additionalData,
-		additionalData, sizeof (SaAmfAdditionalDataT));
-	*/
+	SaAmfRecommendedRecoveryT recommendedRecovery,
+	SaNtfIdentifierT ntfIdentifier)
+{
+	struct amfInstance *amfInstance;
+	struct req_lib_amf_componenterrorreport req_lib_amf_componenterrorreport;
+	struct res_lib_amf_componenterrorreport res_lib_amf_componenterrorreport;
+	SaAisErrorT error;
 
 
-	error = saSendReceiveReply (fd,
-		&req_lib_amf_errorreport, sizeof (struct req_lib_amf_errorreport),
-		&res_lib_amf_errorreport, sizeof (struct res_lib_amf_errorreport));
+	error = saHandleInstanceGet (&amfHandleDatabase, amfHandle,
+		(void *)&amfInstance);
 	if (error != SA_OK) {
 	if (error != SA_OK) {
-		goto exit_close;
+		return (error);
 	}
 	}
 
 
-	error = res_lib_amf_errorreport.header.error;
+	req_lib_amf_componenterrorreport.header.id = MESSAGE_REQ_AMF_COMPONENTERRORREPORT;
+	req_lib_amf_componenterrorreport.header.size = sizeof (struct req_lib_amf_componenterrorreport);
+	memcpy (&req_lib_amf_componenterrorreport.erroneousComponent, erroneousComponent,
+		sizeof (SaNameT));
+	req_lib_amf_componenterrorreport.errorDetectionTime = errorDetectionTime;
 
 
-exit_close:
-	close (fd);
-exit_noclose:
-	return (error);
-}
-
-SaErrorT
-saAmfErrorCancelAll (
-	const SaNameT *compName) {
-
-	struct req_lib_amf_errorcancelall req_lib_amf_errorcancelall;
-	struct res_lib_amf_errorcancelall res_lib_amf_errorcancelall;
-	int fd;
-	SaErrorT error;
+printf ("start error report\n");
+	error = saSendReceiveReply (amfInstance->response_fd,
+		&req_lib_amf_componenterrorreport,
+		sizeof (struct req_lib_amf_componenterrorreport),
+		&res_lib_amf_componenterrorreport,
+		sizeof (struct res_lib_amf_componenterrorreport));
+printf ("end error report\n");
 
 
-	error = saServiceConnect (&fd, AMF_SERVICE);
-	if (error != SA_OK) {
-		goto exit_noclose;
-	}
-	req_lib_amf_errorcancelall.header.id = MESSAGE_REQ_AMF_ERRORCANCELALL;
-	req_lib_amf_errorcancelall.header.size = sizeof (struct req_lib_amf_errorcancelall);
-	memcpy (&req_lib_amf_errorcancelall.compName, compName, sizeof (SaNameT));
+	error = res_lib_amf_componenterrorreport.header.error;
 
 
-	error = saSendReceiveReply (fd,
-		&req_lib_amf_errorcancelall, sizeof (struct req_lib_amf_errorcancelall),
-		&res_lib_amf_errorcancelall, sizeof (struct res_lib_amf_errorcancelall));
-	if (error != SA_OK) {
-		goto exit_close;
-	}
+	pthread_mutex_unlock (&amfInstance->response_mutex);
 
 
-	error = res_lib_amf_errorcancelall.header.error;
+	saHandleInstancePut (&amfHandleDatabase, amfHandle);
 
 
-exit_close:
-	close (fd);
-exit_noclose:
-	return (error);
+        return (error == SA_AIS_OK ? res_lib_amf_componenterrorreport.header.error : error);
 }
 }
 
 
-SaErrorT
-saAmfComponentCapabilityModelGet (
+SaAisErrorT
+saAmfComponentErrorClear (
+	SaAmfHandleT amfHandle,
 	const SaNameT *compName,
 	const SaNameT *compName,
-	SaAmfComponentCapabilityModelT *componentCapabilityModel)
+	SaNtfIdentifierT ntfIdentifier)
 {
 {
+	struct amfInstance *amfInstance;
+	struct req_lib_amf_componenterrorclear req_lib_amf_componenterrorclear;
+	struct res_lib_amf_componenterrorclear res_lib_amf_componenterrorclear;
+	SaAisErrorT error;
 
 
-	int fd;
-	SaErrorT error;
-	struct req_amf_componentcapabilitymodelget req_amf_componentcapabilitymodelget;
-	struct res_lib_amf_componentcapabilitymodelget res_lib_amf_componentcapabilitymodelget;
-
-	error = saServiceConnect (&fd, AMF_SERVICE);
-	if (error != SA_OK) {
-		goto exit_noclose;
-	}
-	req_amf_componentcapabilitymodelget.header.id = MESSAGE_REQ_AMF_COMPONENTCAPABILITYMODELGET;
-	req_amf_componentcapabilitymodelget.header.size = sizeof (struct req_amf_componentcapabilitymodelget);
-	memcpy (&req_amf_componentcapabilitymodelget.compName, compName, sizeof (SaNameT));
-
-	error = saSendReceiveReply (fd,
-		&req_amf_componentcapabilitymodelget,
-		sizeof (struct req_amf_componentcapabilitymodelget),
-		&res_lib_amf_componentcapabilitymodelget,
-		sizeof (struct res_lib_amf_componentcapabilitymodelget));
+	error = saHandleInstanceGet (&amfHandleDatabase, amfHandle,
+		(void *)&amfInstance);
 	if (error != SA_OK) {
 	if (error != SA_OK) {
-		goto exit_close;
+		return (error);
 	}
 	}
-	error = res_lib_amf_componentcapabilitymodelget.header.error;
 
 
-	if (error == SA_OK) {
-		memcpy (componentCapabilityModel,
-			&res_lib_amf_componentcapabilitymodelget.componentCapabilityModel, 
-			sizeof (SaAmfComponentCapabilityModelT));
-	}
-		
-exit_close:
-	close (fd);
-exit_noclose:
-	return (error);
-}
+	req_lib_amf_componenterrorclear.header.id = MESSAGE_REQ_AMF_COMPONENTERRORCLEAR;
+	req_lib_amf_componenterrorclear.header.size = sizeof (struct req_lib_amf_componenterrorclear);
+	memcpy (&req_lib_amf_componenterrorclear.compName, compName, sizeof (SaNameT));
 
 
-SaErrorT
-saAmfPendingOperationGet (
-	const SaNameT *compName,
-	SaAmfPendingOperationFlagsT *pendingOperationFlags) {
+	error = saSendReceiveReply (amfInstance->response_fd,
+		&req_lib_amf_componenterrorclear,
+		sizeof (struct req_lib_amf_componenterrorclear),
+		&res_lib_amf_componenterrorclear,
+		sizeof (struct res_lib_amf_componenterrorclear));
 
 
-	*pendingOperationFlags = 0;	
-	return (SA_OK);
+	pthread_mutex_unlock (&amfInstance->response_mutex);
+
+	saHandleInstancePut (&amfHandleDatabase, amfHandle);
+
+        return (error == SA_AIS_OK ? res_lib_amf_componenterrorclear.header.error : error);
 }
 }
 
 
-SaErrorT
+SaAisErrorT
 saAmfResponse (
 saAmfResponse (
+	SaAmfHandleT amfHandle,
 	SaInvocationT invocation,
 	SaInvocationT invocation,
-	SaErrorT error)
+	SaAisErrorT error)
 {
 {
-	struct req_amf_response req_amf_response;
+	struct amfInstance *amfInstance;
+	struct req_lib_amf_response req_lib_amf_response;
 	struct res_lib_amf_response res_lib_amf_response;
 	struct res_lib_amf_response res_lib_amf_response;
-	int fd_response;
-	int fd_dispatch;
-	SaErrorT errorResult;
+	SaAisErrorT errorResult;
 
 
-	errorResult = saServiceConnectTwo (&fd_response, &fd_dispatch, AMF_SERVICE);
+	errorResult = saHandleInstanceGet (&amfHandleDatabase, amfHandle,
+		(void *)&amfInstance);
 	if (errorResult != SA_OK) {
 	if (errorResult != SA_OK) {
-		goto exit_noclose;
-	}
-	req_amf_response.header.id = MESSAGE_REQ_AMF_RESPONSE;
-	req_amf_response.header.size = sizeof (struct req_amf_response);
-	req_amf_response.invocation = invocation;
-	req_amf_response.error = error;
-
-	errorResult = saSendReceiveReply (fd_response,
-		&req_amf_response,
-		sizeof (struct req_amf_response),
-		&res_lib_amf_response,
-		sizeof (struct res_lib_amf_response));
-
-	close (fd_response);
-	close (fd_dispatch);
-
-	if (errorResult == SA_OK) {
-		errorResult = res_lib_amf_response.header.error;
+		return (error);
 	}
 	}
 
 
-exit_noclose:
-	return (errorResult);
+	req_lib_amf_response.header.id = MESSAGE_REQ_AMF_RESPONSE;
+	req_lib_amf_response.header.size = sizeof (struct req_lib_amf_response);
+	req_lib_amf_response.invocation = invocation;
+	req_lib_amf_response.error = error;
+
+	pthread_mutex_lock (&amfInstance->response_mutex);
+
+	errorResult = saSendReceiveReply (amfInstance->response_fd,
+		&req_lib_amf_response, sizeof (struct req_lib_amf_response),
+		&res_lib_amf_response, sizeof (struct res_lib_amf_response));
+
+	pthread_mutex_unlock (&amfInstance->response_mutex);
+
+	saHandleInstancePut (&amfHandleDatabase, amfHandle);
+
+        return (errorResult == SA_AIS_OK ? res_lib_amf_response.header.error : errorResult);
 }
 }

+ 30 - 0
lib/libOpenaisCfg.versions

@@ -0,0 +1,30 @@
+# Version and symbol export for libSaCkpt.so
+
+OPENAIS_CKPT_B.01.01 {
+	global:
+		openaisCfgInitialize;
+		openaisCfgSelectionObjectGet;
+		openaisCfgDispatch;
+		openaisCfgFinalize;
+		openaisCfgAdministrativeStateGet;
+		openaisCfgAdministrativeStateSet;
+		openaisCfgTrackStart;
+		openaisCfgTrackStop;
+		
+		
+	local:
+		saHandleCreate;
+		saHandleDestroy;
+		saHandleInstanceGet;
+		saHandleInstancePut;
+		saPollRetry;
+		saRecvRetry;
+		saSendMsgReceiveReply;
+		saSendMsgRetry;
+		saSendReceiveReply;
+		saSendRetry;
+		saServiceConnect;
+		saServiceConnectTwo;
+		saVersionVerify;
+		clustTimeNow;
+};

+ 14 - 5
test/Makefile

@@ -48,15 +48,12 @@ LDFLAGS = -g -L../lib
 #LDFLAGS = -pg -L../lib
 #LDFLAGS = -pg -L../lib
 
 
 EXTRA_CFLAGS = -I../include
 EXTRA_CFLAGS = -I../include
-TEST_SRC =  testclm.c testamf.c testamf1.c testamf2.c testamf3.c \
-		testamf4.c testamf5.c testamf6.c testamfth.c  \
-		testckpt.c ckptstress.c ckptbench.c  \
+TEST_SRC =  testclm.c testamf1.c testckpt.c ckptstress.c ckptbench.c  \
 		ckptbenchth.c testevt.c testevs.c evsbench.c \
 		ckptbenchth.c testevt.c testevs.c evsbench.c \
 		subscription.c publish.c evtbench.c \
 		subscription.c publish.c evtbench.c \
 		sa_error.c unlink.c testclm2.c testlck.c
 		sa_error.c unlink.c testclm2.c testlck.c
 
 
-all: testclm testamf testamf1 testamf2 testamf3 testamf4 testamf5 \
-	testamf6 testamfth testckpt ckptstress ckptbench \
+all: testclm testamf1 testckpt ckptstress ckptbench \
 	ckptbenchth ckpt-rd ckpt-wr testevt testevs \
 	ckptbenchth ckpt-rd ckpt-wr testevt testevs \
 	evsbench subscription publish evtbench unlink testclm2 testlck
 	evsbench subscription publish evtbench unlink testclm2 testlck
 
 
@@ -84,6 +81,18 @@ testamf5: testamf5.o $(LIBRARIES)
 testamf6: testamf6.o $(LIBRARIES)
 testamf6: testamf6.o $(LIBRARIES)
 	$(CC) $(LDFLAGS) -o testamf6 testamf6.o $(LIBS)
 	$(CC) $(LDFLAGS) -o testamf6 testamf6.o $(LIBS)
 
 
+testamf7: testamf7.o $(LIBRARIES)
+	$(CC) $(LDFLAGS) -o testamf7 testamf7.o $(LIBS)
+
+testamf8: testamf8.o $(LIBRARIES)
+	$(CC) $(LDFLAGS) -o testamf8 testamf8.o $(LIBS)
+
+testamf9: testamf9.o $(LIBRARIES)
+	$(CC) $(LDFLAGS) -o testamf9 testamf9.o $(LIBS)
+
+testamf10: testamf10.o $(LIBRARIES)
+	$(CC) $(LDFLAGS) -o testamf10 testamf10.o $(LIBS)
+
 testamfth: testamfth.o $(LIBRARIES)
 testamfth: testamfth.o $(LIBRARIES)
 	$(CC) $(LDFLAGS) -o testamfth testamfth.o $(LIBS)
 	$(CC) $(LDFLAGS) -o testamfth testamfth.o $(LIBS)
 
 

+ 74 - 0
test/clc_cli_script

@@ -0,0 +1,74 @@
+#!/bin/sh
+# Copyright (c) 2005 MontaVista Software, Inc.
+# 
+# All rights reserved.
+# 
+# This software licensed under BSD license, the text of which follows:
+# 
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# 
+# - Redistributions of source code must retain the above copyright notice,
+#   this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright notice,
+#   this list of conditions and the following disclaimer in the documentation
+#   and/or other materials provided with the distribution.
+# - Neither the name of the MontaVista Software, Inc. nor the names of its
+#   contributors may be used to endorse or promote products derived from this
+#   software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+# This script will instantiate, terminate, or cleanup using default actions
+# It may be modified to do any action desired.
+
+instantiate() {
+	./openais-instantiate $COMP_BINARY_PATH/$COMP_BINARY_NAME
+	RETVAL=$?
+	return $RETVQAL
+}
+
+terminate() {
+	echo clc_cli_script terminating up component $SA_AMF_COMPONENT_NAME on PID `cat /var/run/openais_cleanup_$SA_AMF_COMPONENT_NAME`
+	kill -15 `cat /var/run/openais_cleanup_$SA_AMF_COMPONENT_NAME`
+	RETVAL=$?
+	return $RETVAL
+}
+
+cleanup() {
+	echo clc_cli_script cleaning up component $SA_AMF_COMPONENT_NAME on PID `cat /var/run/openais_cleanup_$SA_AMF_COMPONENT_NAME`
+	kill -9 `cat /var/run/openais_cleanup_$SA_AMF_COMPONENT_NAME`
+	RETVAL=$?
+	return $RETVAL
+}
+
+case "$CLC_CLI_INTERFACE" in
+	instantiate)
+		instantiate
+		;;
+
+	terminate)
+		terminiate
+		;;
+
+	cleanup)
+		cleanup
+		;;
+
+	*)
+		echo $"Usage: $0 {instantiate|terminate}"
+		exit 1
+
+esac
+
+exit 0

+ 1 - 1
test/testamf.c

@@ -41,7 +41,7 @@
 #include <unistd.h>
 #include <unistd.h>
 #include <signal.h>
 #include <signal.h>
 
 
-#include "saAis.h"
+#include "ais_types.h"
 #include "ais_amf.h"
 #include "ais_amf.h"
 #include "saClm.h"
 #include "saClm.h"
 
 

+ 116 - 133
test/testamf1.c

@@ -41,9 +41,19 @@
 #include <sys/socket.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <sys/un.h>
 #include <sched.h>
 #include <sched.h>
+#include <sys/stat.h>
+#include <fcntl.h>
 
 
 #include "saAis.h"
 #include "saAis.h"
-#include "ais_amf.h"
+#include "saAmf.h"
+
+SaAmfHandleT handle;
+
+SaAmfHealthcheckKeyT key0 = {
+	.key = "key1",
+	.keyLen = 4
+};
+SaNameT compNameGlobal;
 
 
 void printSaNameT (SaNameT *name)
 void printSaNameT (SaNameT *name)
 {
 {
@@ -62,48 +72,43 @@ void setSanameT (SaNameT *name, char *str) {
 static int health_flag = -1;
 static int health_flag = -1;
 static unsigned int healthcheck_count = 0;
 static unsigned int healthcheck_count = 0;
 static unsigned int healthcheck_no = 0;
 static unsigned int healthcheck_no = 0;
+
+int stop = 0;
+
 void HealthcheckCallback (SaInvocationT invocation,
 void HealthcheckCallback (SaInvocationT invocation,
 	const SaNameT *compName,
 	const SaNameT *compName,
-	SaAmfHealthcheckT checkType)
+	SaAmfHealthcheckKeyT *healthcheckKey)
 {
 {
 	SaErrorT res;
 	SaErrorT res;
 
 
-	healthcheck_no ++;
-	if (health_flag == -1 || healthcheck_no%healthcheck_count == 0) {
-		printf ("%u HealthcheckCallback have occured for component: ",healthcheck_no);
-		printSaNameT ((SaNameT *)compName);
-		printf ("\n");
-	}
-	res = saAmfResponse (invocation, SA_OK);
-	if (res != SA_OK) {
-		printf ("response res is %d\n", res);
+	healthcheck_no++;
+/*
+	printf ("Healthcheck %u for key '%s' for component ",
+		healthcheck_no, healthcheckKey->key);
+
+	printSaNameT ((SaNameT *)compName);
+	printf ("\n");
+*/
+	if (healthcheck_no == 10) {
+printf ("COMPONENT REPORTING ERROR %s\n", compNameGlobal.value);
+		saAmfComponentErrorReport (handle, compName, 0, SA_AMF_COMPONENT_RESTART, 0);
+		res = saAmfResponse (handle, invocation, SA_AIS_OK);
+printf ("COMPONENT DONE REPORTING ERROR\n");
+	} else {
+		res = saAmfResponse (handle, invocation, SA_AIS_OK);
 	}
 	}
-}
 
 
-void ReadinessStateSetCallback (SaInvocationT invocation,
-	const SaNameT *compName,
-	SaAmfReadinessStateT readinessState)
-{
-	switch (readinessState) {
-	case SA_AMF_IN_SERVICE:
-		printf ("ReadinessStateSetCallback: '");
-		printSaNameT ((SaNameT *)compName);
-		printf ("' requested to enter operational state SA_AMF_IN_SERVICE.\n");
-		saAmfResponse (invocation, SA_OK);
-		break;
-	case SA_AMF_OUT_OF_SERVICE:
-		printf ("ReadinessStateSetCallback: '");
-		printSaNameT ((SaNameT *)compName);
-		printf ("' requested to enter operational state SA_AMF_OUT_OF_SERVICE.\n");
-		saAmfResponse (invocation, SA_OK);
-		break;
-	case SA_AMF_STOPPING:
-		printf ("ReadinessStateSetCallback: '");
-		printSaNameT ((SaNameT *)compName);
-		printf ("' requested to enter operational state SA_AMF_STOPPING.\n");
-		saAmfStoppingComplete (invocation, SA_OK);
-		break;
+/*
+	if (healthcheck_no < 10) {
+		res = saAmfResponse (handle, invocation, SA_AIS_OK);
 	}
 	}
+*/
+/*
+	if (healthcheck_no == 3) {
+		res = saAmfHealthcheckStop (handle, &compNameGlobal, &key0);
+		stop = 1;
+	}
+*/
 }
 }
 
 
 void ComponentTerminateCallback (
 void ComponentTerminateCallback (
@@ -111,44 +116,38 @@ void ComponentTerminateCallback (
 	const SaNameT *compName)
 	const SaNameT *compName)
 {
 {
 	printf ("ComponentTerminateCallback\n");
 	printf ("ComponentTerminateCallback\n");
+	saAmfResponse (handle, invocation, SA_AIS_OK);
+	exit (0);
 }
 }
 
 
 void CSISetCallback (
 void CSISetCallback (
 	SaInvocationT invocation,
 	SaInvocationT invocation,
 	const SaNameT *compName,
 	const SaNameT *compName,
-	const SaNameT *csiName,
-	SaAmfCSIFlagsT csiFlags,
-	SaAmfHAStateT *haState,
-	SaNameT *activeCompName,
-	SaAmfCSITransitionDescriptorT transitionDescriptor)
+	SaAmfHAStateT haState,
+	SaAmfCSIDescriptorT *csiDescriptor)
 {
 {
-	switch (*haState) {
-	case SA_AMF_ACTIVE:
-		printf ("CSISetCallback: '"); 
-		printSaNameT ((SaNameT *)compName);
-		printf ("' for CSI '");
+	int res;
+	switch (haState) {
+	case SA_AMF_HA_ACTIVE:
+		printf ("CSISetCallback:"); 
+		printf ("for CSI '");
+		printSaNameT ((SaNameT *)&csiDescriptor->csiName);
+		printf ("' for component ");
 		printSaNameT ((SaNameT *)compName);
 		printSaNameT ((SaNameT *)compName);
 		printf ("'");
 		printf ("'");
  		printf (" requested to enter hastate SA_AMF_ACTIVE.\n");
  		printf (" requested to enter hastate SA_AMF_ACTIVE.\n");
-		saAmfResponse (invocation, SA_OK);
+		res = saAmfResponse (handle, invocation, SA_AIS_OK);
 		break;
 		break;
-	case SA_AMF_STANDBY:
-		printf ("CSISetCallback: '"); 
+
+	case SA_AMF_HA_STANDBY:
+		printf ("CSISetCallback:"); 
+		printf ("for CSI '");
 		printSaNameT ((SaNameT *)compName);
 		printSaNameT ((SaNameT *)compName);
-		printf ("' for CSI '");
+		printf ("' for component ");
 		printSaNameT ((SaNameT *)compName);
 		printSaNameT ((SaNameT *)compName);
 		printf ("'");
 		printf ("'");
 		printf (" requested to enter hastate SA_AMF_STANDBY.\n");
 		printf (" requested to enter hastate SA_AMF_STANDBY.\n");
-		saAmfResponse (invocation, SA_OK);
-		break;
-	case SA_AMF_QUIESCED:
-		printf ("CSISetCallback: '"); 
-		printSaNameT ((SaNameT *)compName);
-		printf ("' for CSI '");
-		printSaNameT ((SaNameT *)compName);
-		printf ("'");
-		printf (" requested to enter hastate SA_AMF_QUIESCED.\n");
-		saAmfResponse (invocation, SA_OK);
+		saAmfResponse (handle, invocation, SA_AIS_OK);
 		break;
 		break;
 	}
 	}
 }
 }
@@ -159,14 +158,17 @@ void CSIRemoveCallback (
 	const SaNameT *csiName,
 	const SaNameT *csiName,
 	const SaAmfCSIFlagsT *csiFlags)
 	const SaAmfCSIFlagsT *csiFlags)
 {
 {
+	int res;
+
 	printf ("CSIRemoveCallback for component '");
 	printf ("CSIRemoveCallback for component '");
 	printSaNameT ((SaNameT *)compName);
 	printSaNameT ((SaNameT *)compName);
 	printf ("' in CSI '");
 	printf ("' in CSI '");
 	printSaNameT ((SaNameT *)csiName);
 	printSaNameT ((SaNameT *)csiName);
 	printf ("'\n");
 	printf ("'\n");
-	saAmfResponse (invocation, SA_OK);
+	res = saAmfResponse (handle, invocation, SA_AIS_OK);
 }
 }
 
 
+#ifdef COMPILE_OUT
 void ProtectionGroupTrackCallback (
 void ProtectionGroupTrackCallback (
 	const SaNameT *csiName,
 	const SaNameT *csiName,
 	SaAmfProtectionGroupNotificationT *notificationBuffer,
 	SaAmfProtectionGroupNotificationT *notificationBuffer,
@@ -189,50 +191,18 @@ void ProtectionGroupTrackCallback (
 	}
 	}
 }
 }
 
 
-void ExternalComponentRestartCallback (
-	const SaInvocationT invocation,
-	const SaNameT *externalCompName)
-{
-	printf ("ExternalComponentRestartCallback\n");
-}
-
-void ExternalComponentControlCallback (
-	const SaInvocationT invocation,
-	const SaNameT *externalCompName,
-	SaAmfExternalComponentActionT controlAction)
-{
-	printf ("ExternalComponentControlCallback\n");
-}
-
-void PendingOperationConfirmCallback (
-	const SaInvocationT invocation,
-	const SaNameT *compName,
-	SaAmfPendingOperationFlagsT pendingOperationFlags)
-{
-	printf ("PendingOperationConfirmCallback\n");
-}
-
-void PendingOperationExpiredCallback (
-	const SaNameT *compName,
-	SaAmfPendingOperationFlagsT pendingOperationFlags)
-{
-	printf ("PendingOperationExpiredCallback\n");
-}
+#endif
 
 
 SaAmfCallbacksT amfCallbacks = {
 SaAmfCallbacksT amfCallbacks = {
-	HealthcheckCallback,
-	ReadinessStateSetCallback,
-	ComponentTerminateCallback,
-	CSISetCallback,
-	CSIRemoveCallback,
-	ProtectionGroupTrackCallback,
-	ExternalComponentRestartCallback,
-	ExternalComponentControlCallback,
-	PendingOperationConfirmCallback,
-	PendingOperationExpiredCallback
+	.saAmfHealthcheckCallback = HealthcheckCallback,
+	.saAmfComponentTerminateCallback = ComponentTerminateCallback,
+	.saAmfCSISetCallback = CSISetCallback,
+	.saAmfCSIRemoveCallback = CSIRemoveCallback,
 };
 };
 
 
-SaVersionT version = { 'A', 1, 1 };
+SaAmfCallbacksT amfCallbacks;
+
+SaVersionT version = { 'B', 1, 1 };
 
 
 static struct sched_param sched_param = {
 static struct sched_param sched_param = {
     sched_priority: 99
     sched_priority: 99
@@ -242,66 +212,79 @@ void sigintr_handler (int signum) {
 	exit (0);
 	exit (0);
 }
 }
 
 
+void write_pid (void) {
+	char pid[256];
+	char filename[256];
+	int fd;
+	int res;
+	
+	sprintf (filename,  "/var/run/openais_cleanup_%s", compNameGlobal.value);
+	fd = open (filename, O_CREAT | O_TRUNC | O_RDWR, S_IRWXU);
+	sprintf (pid, "%d", getpid());
+	res = write (fd, pid, strlen (pid));
+	close (fd);
+}
 
 
 int main (int argc, char **argv) {
 int main (int argc, char **argv) {
-	SaAmfHandleT handle;
 	int result;
 	int result;
 	SaSelectionObjectT select_fd;
 	SaSelectionObjectT select_fd;
 	fd_set read_fds;
 	fd_set read_fds;
-	SaNameT compName;
 	extern char *optarg;
 	extern char *optarg;
 	extern int optind;
 	extern int optind;
-	int c;
 
 
-	memset (&compName, 0, sizeof (SaNameT));
 	signal (SIGINT, sigintr_handler);
 	signal (SIGINT, sigintr_handler);
 	result = sched_setscheduler (0, SCHED_RR, &sched_param);
 	result = sched_setscheduler (0, SCHED_RR, &sched_param);
 	if (result == -1) {
 	if (result == -1) {
 		printf ("couldn't set sched priority\n");
 		printf ("couldn't set sched priority\n");
  	}
  	}
 
 
-	for (;;){
-		c = getopt(argc,argv,"h:n:");
-		if (c==-1) {
-			break;
-		}
-		switch (c) {
-		case 0 :
-			break;
-		case 'h':
-			health_flag = 0;
-			sscanf (optarg,"%ud" ,&healthcheck_count);
-			break;
-		case 'n':
-	  		setSanameT (&compName, optarg);
-			break;
-                default :
-			break;
-                }
-	}
-
 	result = saAmfInitialize (&handle, &amfCallbacks, &version);
 	result = saAmfInitialize (&handle, &amfCallbacks, &version);
-	if (result != SA_OK) {
+	if (result != SA_AIS_OK) {
 		printf ("initialize result is %d\n", result);
 		printf ("initialize result is %d\n", result);
 		exit (1);
 		exit (1);
 	}
 	}
 
 
 	FD_ZERO (&read_fds);
 	FD_ZERO (&read_fds);
-	saAmfSelectionObjectGet (&handle, &select_fd);
+	saAmfSelectionObjectGet (handle, &select_fd);
 	FD_SET (select_fd, &read_fds);
 	FD_SET (select_fd, &read_fds);
-	if (compName.length <= 0) {
-		setSanameT (&compName, "comp_a_in_su_x");
-	}
-
-	result = saAmfComponentRegister (&handle, &compName, NULL);
+	saAmfComponentNameGet (handle, &compNameGlobal);
+	write_pid ();
+	
+
+	result = saAmfHealthcheckStart (handle,
+		&compNameGlobal,
+		&key0,
+		SA_AMF_HEALTHCHECK_AMF_INVOKED,
+		SA_AMF_COMPONENT_FAILOVER);
+
+	result = saAmfHealthcheckStart (handle,
+		&compNameGlobal,
+		&key0,
+		SA_AMF_HEALTHCHECK_AMF_INVOKED,
+		SA_AMF_COMPONENT_FAILOVER);
+
+	result = saAmfComponentRegister (handle, &compNameGlobal, NULL);
 	printf ("register result is %d (should be 1)\n", result);
 	printf ("register result is %d (should be 1)\n", result);
 
 
 	do {
 	do {
 		select (select_fd + 1, &read_fds, 0, 0, 0);
 		select (select_fd + 1, &read_fds, 0, 0, 0);
-		saAmfDispatch (&handle, SA_DISPATCH_ALL);
+		saAmfDispatch (handle, SA_DISPATCH_ALL);
+	} while (result && stop == 0);
+
+	printf ("healthchecks stopped for 5 seconds\n");
+	sleep (5);
+	result = saAmfHealthcheckStart (handle,
+		&compNameGlobal,
+		&key0,
+		SA_AMF_HEALTHCHECK_AMF_INVOKED,
+		SA_AMF_COMPONENT_FAILOVER);
+
+	do {
+		select (select_fd + 1, &read_fds, 0, 0, 0);
+		saAmfDispatch (handle, SA_DISPATCH_ALL);
 	} while (result);
 	} while (result);
 
 
-	saAmfFinalize (&handle);
+	saAmfFinalize (handle);
 
 
 	exit (0);
 	exit (0);
 }
 }

+ 99 - 150
test/testamf2.c

@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2002-2004 MontaVista Software, Inc.
+ * Copyright (c) 2002-2003 MontaVista Software, Inc.
  *
  *
  * All rights reserved.
  * All rights reserved.
  *
  *
@@ -35,15 +35,23 @@
 #include <stdio.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <errno.h>
-#include <unistd.h>
 #include <signal.h>
 #include <signal.h>
+#include <unistd.h>
 #include <sys/types.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <sys/un.h>
 #include <sched.h>
 #include <sched.h>
 
 
 #include "saAis.h"
 #include "saAis.h"
-#include "ais_amf.h"
+#include "saAmf.h"
+
+SaAmfHandleT handle;
+
+SaAmfHealthcheckKeyT key0 = {
+	.key = "key1",
+	.keyLen = 4
+};
+SaNameT compNameGlobal;
 
 
 void printSaNameT (SaNameT *name)
 void printSaNameT (SaNameT *name)
 {
 {
@@ -62,47 +70,27 @@ void setSanameT (SaNameT *name, char *str) {
 static int health_flag = -1;
 static int health_flag = -1;
 static unsigned int healthcheck_count = 0;
 static unsigned int healthcheck_count = 0;
 static unsigned int healthcheck_no = 0;
 static unsigned int healthcheck_no = 0;
+
+int stop = 0;
+
 void HealthcheckCallback (SaInvocationT invocation,
 void HealthcheckCallback (SaInvocationT invocation,
 	const SaNameT *compName,
 	const SaNameT *compName,
-	SaAmfHealthcheckT checkType)
+	SaAmfHealthcheckKeyT *healthcheckKey)
 {
 {
 	SaErrorT res;
 	SaErrorT res;
 
 
 	healthcheck_no++;
 	healthcheck_no++;
+/*
+	printf ("Healthcheck %u for key '%s' for component ",
+		healthcheck_no, healthcheckKey->key);
 
 
-	if (health_flag == -1 || healthcheck_no%healthcheck_count == 0) {
-		printf ("%u HealthcheckCallback have occured for component: ",healthcheck_no);
-		printSaNameT ((SaNameT *)compName);
-		printf ("\n");
-	}
-	res = saAmfResponse (invocation, SA_OK);
-	if (res != SA_OK) {
-		printf ("response res is %d\n", res);
-	}
-}
-
-void ReadinessStateSetCallback (SaInvocationT invocation,
-	const SaNameT *compName,
-	SaAmfReadinessStateT readinessState)
-{
-	switch (readinessState) {
-	case SA_AMF_IN_SERVICE:
-		printf ("ReadinessStateSetCallback: '");
-		printSaNameT ((SaNameT *)compName);
-		printf ("' requested to enter operational state SA_AMF_IN_SERVICE.\n");
-		saAmfResponse (invocation, SA_OK);
-		break;
-	case SA_AMF_OUT_OF_SERVICE:
-		printf ("ReadinessStateSetCallback: '");
-		printSaNameT ((SaNameT *)compName);
-		printf ("' requested to enter operational state SA_AMF_OUT_OF_SERVICE.\n");
-		saAmfResponse (invocation, SA_OK);
-		break;
-	case SA_AMF_STOPPING:
-		printf ("ReadinessStateSetCallback: '");
-		printSaNameT ((SaNameT *)compName);
-                printf ("' requested to enter operational state SA_AMF_STOPPING.\n");                saAmfStoppingComplete (invocation, SA_OK);
-		break;
+	printSaNameT ((SaNameT *)compName);
+	printf ("\n");
+*/
+	res = saAmfResponse (handle, invocation, SA_AIS_OK);
+	if (healthcheck_no == 3) {
+		res = saAmfHealthcheckStop (handle, &compNameGlobal, &key0);
+		stop = 1;
 	}
 	}
 }
 }
 
 
@@ -111,44 +99,38 @@ void ComponentTerminateCallback (
 	const SaNameT *compName)
 	const SaNameT *compName)
 {
 {
 	printf ("ComponentTerminateCallback\n");
 	printf ("ComponentTerminateCallback\n");
+	saAmfResponse (handle, invocation, SA_AIS_OK);
+	exit (0);
 }
 }
 
 
 void CSISetCallback (
 void CSISetCallback (
 	SaInvocationT invocation,
 	SaInvocationT invocation,
 	const SaNameT *compName,
 	const SaNameT *compName,
-	const SaNameT *csiName,
-	SaAmfCSIFlagsT csiFlags,
-	SaAmfHAStateT *haState,
-	SaNameT *activeCompName,
-	SaAmfCSITransitionDescriptorT transitionDescriptor)
+	SaAmfHAStateT haState,
+	SaAmfCSIDescriptorT *csiDescriptor)
 {
 {
-	switch (*haState) {
-	case SA_AMF_ACTIVE:
-		printf ("CSISetCallback: '"); 
-		printSaNameT ((SaNameT *)compName);
-		printf ("' for CSI '");
+	int res;
+	switch (haState) {
+	case SA_AMF_HA_ACTIVE:
+		printf ("CSISetCallback:"); 
+		printf ("for CSI '");
+		printSaNameT ((SaNameT *)&csiDescriptor->csiName);
+		printf ("' for component ");
 		printSaNameT ((SaNameT *)compName);
 		printSaNameT ((SaNameT *)compName);
 		printf ("'");
 		printf ("'");
  		printf (" requested to enter hastate SA_AMF_ACTIVE.\n");
  		printf (" requested to enter hastate SA_AMF_ACTIVE.\n");
-		saAmfResponse (invocation, SA_OK);
+		res = saAmfResponse (handle, invocation, SA_AIS_OK);
 		break;
 		break;
-	case SA_AMF_STANDBY:
-		printf ("CSISetCallback: '"); 
+
+	case SA_AMF_HA_STANDBY:
+		printf ("CSISetCallback:"); 
+		printf ("for CSI '");
 		printSaNameT ((SaNameT *)compName);
 		printSaNameT ((SaNameT *)compName);
-		printf ("' for CSI '");
+		printf ("' for component ");
 		printSaNameT ((SaNameT *)compName);
 		printSaNameT ((SaNameT *)compName);
 		printf ("'");
 		printf ("'");
 		printf (" requested to enter hastate SA_AMF_STANDBY.\n");
 		printf (" requested to enter hastate SA_AMF_STANDBY.\n");
-		saAmfResponse (invocation, SA_OK);
-		break;
-	case SA_AMF_QUIESCED:
-		printf ("CSISetCallback: '"); 
-		printSaNameT ((SaNameT *)compName);
-		printf ("' for CSI '");
-		printSaNameT ((SaNameT *)compName);
-		printf ("'");
-		printf (" requested to enter hastate SA_AMF_QUIESCED.\n");
-		saAmfResponse (invocation, SA_OK);
+		saAmfResponse (handle, invocation, SA_AIS_OK);
 		break;
 		break;
 	}
 	}
 }
 }
@@ -159,14 +141,17 @@ void CSIRemoveCallback (
 	const SaNameT *csiName,
 	const SaNameT *csiName,
 	const SaAmfCSIFlagsT *csiFlags)
 	const SaAmfCSIFlagsT *csiFlags)
 {
 {
+	int res;
+
 	printf ("CSIRemoveCallback for component '");
 	printf ("CSIRemoveCallback for component '");
 	printSaNameT ((SaNameT *)compName);
 	printSaNameT ((SaNameT *)compName);
 	printf ("' in CSI '");
 	printf ("' in CSI '");
 	printSaNameT ((SaNameT *)csiName);
 	printSaNameT ((SaNameT *)csiName);
 	printf ("'\n");
 	printf ("'\n");
-	saAmfResponse (invocation, SA_OK);
+	res = saAmfResponse (handle, invocation, SA_AIS_OK);
 }
 }
 
 
+#ifdef COMPILE_OUT
 void ProtectionGroupTrackCallback (
 void ProtectionGroupTrackCallback (
 	const SaNameT *csiName,
 	const SaNameT *csiName,
 	SaAmfProtectionGroupNotificationT *notificationBuffer,
 	SaAmfProtectionGroupNotificationT *notificationBuffer,
@@ -189,70 +174,44 @@ void ProtectionGroupTrackCallback (
 	}
 	}
 }
 }
 
 
-void ExternalComponentRestartCallback (
-	const SaInvocationT invocation,
-	const SaNameT *externalCompName)
-{
-	printf ("ExternalComponentRestartCallback\n");
-}
+#endif
 
 
-void ExternalComponentControlCallback (
-	const SaInvocationT invocation,
-	const SaNameT *externalCompName,
-	SaAmfExternalComponentActionT controlAction)
-{
-	printf ("ExternalComponentControlCallback\n");
-}
+SaAmfCallbacksT amfCallbacks = {
+	.saAmfHealthcheckCallback = HealthcheckCallback,
+	.saAmfComponentTerminateCallback = ComponentTerminateCallback,
+	.saAmfCSISetCallback = CSISetCallback,
+	.saAmfCSIRemoveCallback = CSIRemoveCallback,
+};
 
 
-void PendingOperationConfirmCallback (
-	const SaInvocationT invocation,
-	const SaNameT *compName,
-	SaAmfPendingOperationFlagsT pendingOperationFlags)
-{
-	printf ("PendingOperationConfirmCallback\n");
-}
+SaAmfCallbacksT amfCallbacks;
 
 
-void PendingOperationExpiredCallback (
-	const SaNameT *compName,
-	SaAmfPendingOperationFlagsT pendingOperationFlags)
-{
-	printf ("PendingOperationExpiredCallback\n");
-}
+SaVersionT version = { 'B', 1, 1 };
 
 
-SaAmfCallbacksT amfCallbacks = {
-	HealthcheckCallback,
-	ReadinessStateSetCallback,
-	ComponentTerminateCallback,
-	CSISetCallback,
-	CSIRemoveCallback,
-	ProtectionGroupTrackCallback,
-	ExternalComponentRestartCallback,
-	ExternalComponentControlCallback,
-	PendingOperationConfirmCallback,
-	PendingOperationExpiredCallback
+static struct sched_param sched_param = {
+    sched_priority: 99
 };
 };
 
 
-SaVersionT version = { 'A', 1, 1 };
-
 void sigintr_handler (int signum) {
 void sigintr_handler (int signum) {
 	exit (0);
 	exit (0);
 }
 }
 
 
 int main (int argc, char **argv) {
 int main (int argc, char **argv) {
-	SaAmfHandleT handle;
 	int result;
 	int result;
 	SaSelectionObjectT select_fd;
 	SaSelectionObjectT select_fd;
 	fd_set read_fds;
 	fd_set read_fds;
-	SaNameT compName;
-	int c,i;
-	SaAmfErrorDescriptorT errorDescriptor;
 	extern char *optarg;
 	extern char *optarg;
 	extern int optind;
 	extern int optind;
+	int c;
 
 
-	memset (&compName, 0, sizeof (SaNameT));
+printf ("testamf2 pid %d\n", getpid());
+	memset (&compNameGlobal, 0, sizeof (SaNameT));
 	signal (SIGINT, sigintr_handler);
 	signal (SIGINT, sigintr_handler);
+	result = sched_setscheduler (0, SCHED_RR, &sched_param);
+	if (result == -1) {
+		printf ("couldn't set sched priority\n");
+ 	}
 
 
-	for (;;) {
+	for (;;){
 		c = getopt(argc,argv,"h:n:");
 		c = getopt(argc,argv,"h:n:");
 		if (c==-1) {
 		if (c==-1) {
 			break;
 			break;
@@ -265,71 +224,61 @@ int main (int argc, char **argv) {
 			sscanf (optarg,"%ud" ,&healthcheck_count);
 			sscanf (optarg,"%ud" ,&healthcheck_count);
 			break;
 			break;
 		case 'n':
 		case 'n':
-			setSanameT (&compName, optarg);
+	  		setSanameT (&compNameGlobal, optarg);
 			break;
 			break;
-		default :
+                default :
 			break;
 			break;
-		}
+                }
 	}
 	}
 
 
 	result = saAmfInitialize (&handle, &amfCallbacks, &version);
 	result = saAmfInitialize (&handle, &amfCallbacks, &version);
-	if (result != SA_OK) {
+	if (result != SA_AIS_OK) {
 		printf ("initialize result is %d\n", result);
 		printf ("initialize result is %d\n", result);
 		exit (1);
 		exit (1);
 	}
 	}
 
 
 	FD_ZERO (&read_fds);
 	FD_ZERO (&read_fds);
-	saAmfSelectionObjectGet (&handle, &select_fd);
+	saAmfSelectionObjectGet (handle, &select_fd);
 	FD_SET (select_fd, &read_fds);
 	FD_SET (select_fd, &read_fds);
-
-	if (compName.length <= 0){
-		setSanameT (&compName, "comp_b_in_su_x");
+	if (compNameGlobal.length <= 0) {
+		setSanameT (&compNameGlobal, "comp_b_in_su_1");
 	}
 	}
 
 
-	result = saAmfComponentRegister (&handle, &compName, NULL);
-
+	result = saAmfHealthcheckStart (handle,
+		&compNameGlobal,
+		&key0,
+		SA_AMF_HEALTHCHECK_AMF_INVOKED,
+		SA_AMF_COMPONENT_FAILOVER);
+	printf ("start %d\n", result);
+
+	result = saAmfHealthcheckStart (handle,
+		&compNameGlobal,
+		&key0,
+		SA_AMF_HEALTHCHECK_AMF_INVOKED,
+		SA_AMF_COMPONENT_FAILOVER);
+	printf ("start %d\n", result);
+	result = saAmfComponentRegister (handle, &compNameGlobal, NULL);
 	printf ("register result is %d (should be 1)\n", result);
 	printf ("register result is %d (should be 1)\n", result);
 
 
-	i = 0;
 	do {
 	do {
 		select (select_fd + 1, &read_fds, 0, 0, 0);
 		select (select_fd + 1, &read_fds, 0, 0, 0);
-		saAmfDispatch (&handle, SA_DISPATCH_ALL);
-//	} while (1);
-	} while (i++ < 4);
+		saAmfDispatch (handle, SA_DISPATCH_ALL);
+	} while (result && stop == 0);
 
 
-	printf ("Unregistering component\n");
-	result = saAmfComponentUnregister (&handle, &compName, NULL);
+	printf ("healthchecks stopped for 5 seconds\n");
+	sleep (5);
+	result = saAmfHealthcheckStart (handle,
+		&compNameGlobal,
+		&key0,
+		SA_AMF_HEALTHCHECK_AMF_INVOKED,
+		SA_AMF_COMPONENT_FAILOVER);
 
 
-//	select (select_fd + 1, &read_fds, 0, 0, 0);
-	saAmfDispatch (&handle, SA_DISPATCH_ALL);
-
-	sleep (1);
-	printf ("Registering component\n");
-	result = saAmfComponentRegister (&handle, &compName, NULL);
-
-	sleep (1);
-	select (select_fd + 1, &read_fds, 0, 0, 0);
-	saAmfDispatch (&handle, SA_DISPATCH_ALL);
-
-	printf ("REPORTING ERROR.\n");
-	errorDescriptor.probableCause = 5;
-	result = saAmfErrorReport (&compName, &compName,
-		0,
-       	&errorDescriptor,
-		NULL);
-
-	select (select_fd + 1, &read_fds, 0, 0, 0);
-	saAmfDispatch (&handle, SA_DISPATCH_ALL);
-
-	sleep (1);
-	printf ("CANCELING ERROR.\n");
-	result = saAmfErrorCancelAll (&compName);
 	do {
 	do {
 		select (select_fd + 1, &read_fds, 0, 0, 0);
 		select (select_fd + 1, &read_fds, 0, 0, 0);
-		saAmfDispatch (&handle, SA_DISPATCH_ALL);
+		saAmfDispatch (handle, SA_DISPATCH_ALL);
 	} while (result);
 	} while (result);
 
 
-	saAmfFinalize (&handle);
+	saAmfFinalize (handle);
 
 
-	return (0);
+	exit (0);
 }
 }

+ 95 - 86
test/testamf3.c

@@ -40,9 +40,18 @@
 #include <sys/types.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <sys/un.h>
+#include <sched.h>
 
 
-#include "saAis.h"
-#include "ais_amf.h"
+#include "ais_types.h"
+#include "saAmf.h"
+
+SaAmfHandleT handle;
+
+SaAmfHealthcheckKeyT key0 = {
+	.key = "key1",
+	.keyLen = 4
+};
+SaNameT compNameGlobal;
 
 
 void printSaNameT (SaNameT *name)
 void printSaNameT (SaNameT *name)
 {
 {
@@ -61,51 +70,33 @@ void setSanameT (SaNameT *name, char *str) {
 static int health_flag = -1;
 static int health_flag = -1;
 static unsigned int healthcheck_count = 0;
 static unsigned int healthcheck_count = 0;
 static unsigned int healthcheck_no = 0;
 static unsigned int healthcheck_no = 0;
+
+int stop = 0;
 void HealthcheckCallback (SaInvocationT invocation,
 void HealthcheckCallback (SaInvocationT invocation,
 	const SaNameT *compName,
 	const SaNameT *compName,
-	SaAmfHealthcheckT checkType)
+	SaAmfHealthcheckKeyT *healthcheckKey)
 {
 {
 	SaErrorT res;
 	SaErrorT res;
-	healthcheck_no ++;
 
 
-	if (health_flag == -1 || healthcheck_no%healthcheck_count == 0) {
-		printf ("%u HealthcheckCallback have occured for component: ",healthcheck_no);
-		printSaNameT ((SaNameT *)compName);
-		printf ("\n");
-	}
+	healthcheck_no++;
+	printf ("Healthcheck %u for key '%s' for component ",
+		healthcheck_no, healthcheckKey->key);
 
 
-	res = saAmfResponse (invocation, SA_OK);
+	printSaNameT ((SaNameT *)compName);
+	printf ("\n");
+	res = saAmfResponse (handle, invocation, SA_AIS_OK);
 	if (res != SA_OK) {
 	if (res != SA_OK) {
 		printf ("response res is %d\n", res);
 		printf ("response res is %d\n", res);
 	}
 	}
-}
-
-void ReadinessStateSetCallback (SaInvocationT invocation,
-	const SaNameT *compName,
-	SaAmfReadinessStateT readinessState)
-{
-	switch (readinessState) {
-	case SA_AMF_IN_SERVICE:
-		printf ("ReadinessStateSetCallback: '");
-		printSaNameT ((SaNameT *)compName);
-		printf ("' requested to enter operational state SA_AMF_IN_SERVICE.\n");
-		saAmfResponse (invocation, SA_OK);
-		break;
-	case SA_AMF_OUT_OF_SERVICE:
-		printf ("ReadinessStateSetCallback: '");
-		printSaNameT ((SaNameT *)compName);
-		printf ("' requested to enter operational state SA_AMF_OUT_OF_SERVICE.\n");
-		saAmfResponse (invocation, SA_OK);
-		break;
-	case SA_AMF_STOPPING:
-		printf ("ReadinessStateSetCallback: '");
-		printSaNameT ((SaNameT *)compName);
-		printf ("' requested to enter operational state SA_AMF_STOPPING.\n");
-		saAmfStoppingComplete (invocation, SA_OK);
-		break;
+	if (healthcheck_no == 20) {
+		res = saAmfHealthcheckStop (handle, &compNameGlobal, &key0);
+		stop = 1;
 	}
 	}
+	printf ("done res = %d\n", res);
 }
 }
 
 
+#ifdef COMPILE_OUT
+
 void ComponentTerminateCallback (
 void ComponentTerminateCallback (
 	SaInvocationT invocation,
 	SaInvocationT invocation,
 	const SaNameT *compName)
 	const SaNameT *compName)
@@ -113,46 +104,40 @@ void ComponentTerminateCallback (
 	printf ("ComponentTerminateCallback\n");
 	printf ("ComponentTerminateCallback\n");
 }
 }
 
 
+#endif
 void CSISetCallback (
 void CSISetCallback (
 	SaInvocationT invocation,
 	SaInvocationT invocation,
 	const SaNameT *compName,
 	const SaNameT *compName,
-	const SaNameT *csiName,
-	SaAmfCSIFlagsT csiFlags,
-	SaAmfHAStateT *haState,
-	SaNameT *activeCompName,
-	SaAmfCSITransitionDescriptorT transitionDescriptor)
+	SaAmfHAStateT haState,
+	SaAmfCSIDescriptorT *csiDescriptor)
 {
 {
-	switch (*haState) {
-	case SA_AMF_ACTIVE:
-		printf ("CSISetCallback: '"); 
-		printSaNameT ((SaNameT *)compName);
-		printf ("' for CSI '");
+	int res;
+	switch (haState) {
+	case SA_AMF_HA_ACTIVE:
+		printf ("CSISetCallback:"); 
+		printf ("for CSI '");
+		printSaNameT ((SaNameT *)&csiDescriptor->csiName);
+		printf ("' for component ");
 		printSaNameT ((SaNameT *)compName);
 		printSaNameT ((SaNameT *)compName);
 		printf ("'");
 		printf ("'");
  		printf (" requested to enter hastate SA_AMF_ACTIVE.\n");
  		printf (" requested to enter hastate SA_AMF_ACTIVE.\n");
-		saAmfResponse (invocation, SA_OK);
+		res = saAmfResponse (handle, invocation, SA_AIS_OK);
 		break;
 		break;
-	case SA_AMF_STANDBY:
-		printf ("CSISetCallback: '"); 
+
+	case SA_AMF_HA_STANDBY:
+		printf ("CSISetCallback:"); 
+		printf ("for CSI '");
 		printSaNameT ((SaNameT *)compName);
 		printSaNameT ((SaNameT *)compName);
-		printf ("' for CSI '");
+		printf ("' for component ");
 		printSaNameT ((SaNameT *)compName);
 		printSaNameT ((SaNameT *)compName);
 		printf ("'");
 		printf ("'");
 		printf (" requested to enter hastate SA_AMF_STANDBY.\n");
 		printf (" requested to enter hastate SA_AMF_STANDBY.\n");
-		saAmfResponse (invocation, SA_OK);
-		break;
-	case SA_AMF_QUIESCED:
-		printf ("CSISetCallback: '"); 
-		printSaNameT ((SaNameT *)compName);
-		printf ("' for CSI '");
-		printSaNameT ((SaNameT *)compName);
-		printf ("'");
-		printf (" requested to enter hastate SA_AMF_QUIESCED.\n");
-		saAmfResponse (invocation, SA_OK);
+		saAmfResponse (handle, invocation, SA_AIS_OK);
 		break;
 		break;
 	}
 	}
 }
 }
 
 
+#ifdef COMPILE_OUT
 void CSIRemoveCallback (
 void CSIRemoveCallback (
 	SaInvocationT invocation,
 	SaInvocationT invocation,
 	const SaNameT *compName,
 	const SaNameT *compName,
@@ -218,40 +203,41 @@ void PendingOperationExpiredCallback (
 {
 {
 	printf ("PendingOperationExpiredCallback\n");
 	printf ("PendingOperationExpiredCallback\n");
 }
 }
+#endif
 
 
 SaAmfCallbacksT amfCallbacks = {
 SaAmfCallbacksT amfCallbacks = {
-	HealthcheckCallback,
-	ReadinessStateSetCallback,
-	ComponentTerminateCallback,
-	CSISetCallback,
-	CSIRemoveCallback,
-	ProtectionGroupTrackCallback,
-	ExternalComponentRestartCallback,
-	ExternalComponentControlCallback,
-	PendingOperationConfirmCallback,
-	PendingOperationExpiredCallback
+	.saAmfHealthcheckCallback = HealthcheckCallback,
+	.saAmfCSISetCallback = CSISetCallback,
 };
 };
 
 
-SaVersionT version = { 'A', 1, 1 };
+SaAmfCallbacksT amfCallbacks;
+
+SaVersionT version = { 'B', 1, 1 };
+
+static struct sched_param sched_param = {
+    sched_priority: 99
+};
 
 
 void sigintr_handler (int signum) {
 void sigintr_handler (int signum) {
 	exit (0);
 	exit (0);
 }
 }
 
 
-
 int main (int argc, char **argv) {
 int main (int argc, char **argv) {
-	SaAmfHandleT handle;
 	int result;
 	int result;
 	SaSelectionObjectT select_fd;
 	SaSelectionObjectT select_fd;
 	fd_set read_fds;
 	fd_set read_fds;
-	SaNameT compName;
 	extern char *optarg;
 	extern char *optarg;
 	extern int optind;
 	extern int optind;
 	int c;
 	int c;
 
 
+	memset (&compNameGlobal, 0, sizeof (SaNameT));
 	signal (SIGINT, sigintr_handler);
 	signal (SIGINT, sigintr_handler);
-	memset (&compName, 0, sizeof (SaNameT));
-	for (;;) {
+	result = sched_setscheduler (0, SCHED_RR, &sched_param);
+	if (result == -1) {
+		printf ("couldn't set sched priority\n");
+ 	}
+
+	for (;;){
 		c = getopt(argc,argv,"h:n:");
 		c = getopt(argc,argv,"h:n:");
 		if (c==-1) {
 		if (c==-1) {
 			break;
 			break;
@@ -264,11 +250,11 @@ int main (int argc, char **argv) {
 			sscanf (optarg,"%ud" ,&healthcheck_count);
 			sscanf (optarg,"%ud" ,&healthcheck_count);
 			break;
 			break;
 		case 'n':
 		case 'n':
-			setSanameT (&compName, optarg);
+	  		setSanameT (&compNameGlobal, optarg);
 			break;
 			break;
-		default :
+                default :
 			break;
 			break;
-		}
+                }
 	}
 	}
 
 
 	result = saAmfInitialize (&handle, &amfCallbacks, &version);
 	result = saAmfInitialize (&handle, &amfCallbacks, &version);
@@ -278,23 +264,46 @@ int main (int argc, char **argv) {
 	}
 	}
 
 
 	FD_ZERO (&read_fds);
 	FD_ZERO (&read_fds);
-	saAmfSelectionObjectGet (&handle, &select_fd);
+	saAmfSelectionObjectGet (handle, &select_fd);
 	FD_SET (select_fd, &read_fds);
 	FD_SET (select_fd, &read_fds);
-
-	if (compName.length <= 0){
-		setSanameT (&compName, "comp_a_in_su_y");
+	if (compNameGlobal.length <= 0) {
+		setSanameT (&compNameGlobal, "comp_a_in_su_2");
 	}
 	}
 
 
-	result = saAmfComponentRegister (&handle, &compName, NULL);
+	result = saAmfHealthcheckStart (handle,
+		&compNameGlobal,
+		&key0,
+		SA_AMF_HEALTHCHECK_AMF_INVOKED,
+		SA_AMF_COMPONENT_FAILOVER);
+	printf ("start %d\n", result);
+
+	result = saAmfHealthcheckStart (handle,
+		&compNameGlobal,
+		&key0,
+		SA_AMF_HEALTHCHECK_AMF_INVOKED,
+		SA_AMF_COMPONENT_FAILOVER);
+	printf ("start %d\n", result);
+	result = saAmfComponentRegister (handle, &compNameGlobal, NULL);
 	printf ("register result is %d (should be 1)\n", result);
 	printf ("register result is %d (should be 1)\n", result);
 
 
 	do {
 	do {
 		select (select_fd + 1, &read_fds, 0, 0, 0);
 		select (select_fd + 1, &read_fds, 0, 0, 0);
-		saAmfDispatch (&handle, SA_DISPATCH_ALL);
+		saAmfDispatch (handle, SA_DISPATCH_ALL);
+	} while (result && stop == 0);
+
+	sleep (5);
+	result = saAmfHealthcheckStart (handle,
+		&compNameGlobal,
+		&key0,
+		SA_AMF_HEALTHCHECK_AMF_INVOKED,
+		SA_AMF_COMPONENT_FAILOVER);
+
+	do {
+		select (select_fd + 1, &read_fds, 0, 0, 0);
+		saAmfDispatch (handle, SA_DISPATCH_ALL);
 	} while (result);
 	} while (result);
 
 
-	saAmfFinalize (&handle);
+	saAmfFinalize (handle);
 
 
-	printf ("Done \n");
 	exit (0);
 	exit (0);
 }
 }

+ 95 - 86
test/testamf4.c

@@ -40,9 +40,18 @@
 #include <sys/types.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <sys/un.h>
+#include <sched.h>
 
 
-#include "saAis.h"
-#include "ais_amf.h"
+#include "ais_types.h"
+#include "saAmf.h"
+
+SaAmfHandleT handle;
+
+SaAmfHealthcheckKeyT key0 = {
+	.key = "key1",
+	.keyLen = 4
+};
+SaNameT compNameGlobal;
 
 
 void printSaNameT (SaNameT *name)
 void printSaNameT (SaNameT *name)
 {
 {
@@ -61,52 +70,33 @@ void setSanameT (SaNameT *name, char *str) {
 static int health_flag = -1;
 static int health_flag = -1;
 static unsigned int healthcheck_count = 0;
 static unsigned int healthcheck_count = 0;
 static unsigned int healthcheck_no = 0;
 static unsigned int healthcheck_no = 0;
+
+int stop = 0;
 void HealthcheckCallback (SaInvocationT invocation,
 void HealthcheckCallback (SaInvocationT invocation,
 	const SaNameT *compName,
 	const SaNameT *compName,
-	SaAmfHealthcheckT checkType)
+	SaAmfHealthcheckKeyT *healthcheckKey)
 {
 {
 	SaErrorT res;
 	SaErrorT res;
 
 
-	healthcheck_no ++;
-	if (health_flag == -1 || healthcheck_no%healthcheck_count == 0) {
-		printf ("%u HealthcheckCallback have occured for component: ",healthcheck_no);
-		printSaNameT ((SaNameT *)compName);
-		printf ("\n");
-	}
-	res = saAmfResponse (invocation, SA_OK);
+	healthcheck_no++;
+	printf ("Healthcheck %u for key '%s' for component ",
+		healthcheck_no, healthcheckKey->key);
+
+	printSaNameT ((SaNameT *)compName);
+	printf ("\n");
+	res = saAmfResponse (handle, invocation, SA_AIS_OK);
 	if (res != SA_OK) {
 	if (res != SA_OK) {
 		printf ("response res is %d\n", res);
 		printf ("response res is %d\n", res);
 	}
 	}
-}
-
-void ReadinessStateSetCallback (SaInvocationT invocation,
-	const SaNameT *compName,
-	SaAmfReadinessStateT readinessState)
-{
-	SaErrorT res;
-
-	switch (readinessState) {
-	case SA_AMF_IN_SERVICE:
-		printf ("ReadinessStateSetCallback: '");
-		printSaNameT ((SaNameT *)compName);
-		printf ("' requested to enter operational state SA_AMF_IN_SERVICE.\n");
-		res = saAmfResponse (invocation, SA_OK);
-printf ("res is %d\n", res);
-		break;
-	case SA_AMF_OUT_OF_SERVICE:
-		printf ("ReadinessStateSetCallback: '");
-		printSaNameT ((SaNameT *)compName);
-		printf ("' requested to enter operational state SA_AMF_OUT_OF_SERVICE.\n");
-		saAmfResponse (invocation, SA_OK);
-		break;
-	case SA_AMF_STOPPING:
-		printf ("ReadinessStateSetCallback: '");
-		printSaNameT ((SaNameT *)compName);
-                printf ("' requested to enter operational state SA_AMF_STOPPING.\n");                saAmfStoppingComplete (invocation, SA_OK);
-		break;
+	if (healthcheck_no == 20) {
+		res = saAmfHealthcheckStop (handle, &compNameGlobal, &key0);
+		stop = 1;
 	}
 	}
+	printf ("done res = %d\n", res);
 }
 }
 
 
+#ifdef COMPILE_OUT
+
 void ComponentTerminateCallback (
 void ComponentTerminateCallback (
 	SaInvocationT invocation,
 	SaInvocationT invocation,
 	const SaNameT *compName)
 	const SaNameT *compName)
@@ -114,46 +104,40 @@ void ComponentTerminateCallback (
 	printf ("ComponentTerminateCallback\n");
 	printf ("ComponentTerminateCallback\n");
 }
 }
 
 
+#endif
 void CSISetCallback (
 void CSISetCallback (
 	SaInvocationT invocation,
 	SaInvocationT invocation,
 	const SaNameT *compName,
 	const SaNameT *compName,
-	const SaNameT *csiName,
-	SaAmfCSIFlagsT csiFlags,
-	SaAmfHAStateT *haState,
-	SaNameT *activeCompName,
-	SaAmfCSITransitionDescriptorT transitionDescriptor)
+	SaAmfHAStateT haState,
+	SaAmfCSIDescriptorT *csiDescriptor)
 {
 {
-	switch (*haState) {
-	case SA_AMF_ACTIVE:
-		printf ("CSISetCallback: '"); 
-		printSaNameT ((SaNameT *)compName);
-		printf ("' for CSI '");
+	int res;
+	switch (haState) {
+	case SA_AMF_HA_ACTIVE:
+		printf ("CSISetCallback:"); 
+		printf ("for CSI '");
+		printSaNameT ((SaNameT *)&csiDescriptor->csiName);
+		printf ("' for component ");
 		printSaNameT ((SaNameT *)compName);
 		printSaNameT ((SaNameT *)compName);
 		printf ("'");
 		printf ("'");
  		printf (" requested to enter hastate SA_AMF_ACTIVE.\n");
  		printf (" requested to enter hastate SA_AMF_ACTIVE.\n");
-		saAmfResponse (invocation, SA_OK);
+		res = saAmfResponse (handle, invocation, SA_AIS_OK);
 		break;
 		break;
-	case SA_AMF_STANDBY:
-		printf ("CSISetCallback: '"); 
+
+	case SA_AMF_HA_STANDBY:
+		printf ("CSISetCallback:"); 
+		printf ("for CSI '");
 		printSaNameT ((SaNameT *)compName);
 		printSaNameT ((SaNameT *)compName);
-		printf ("' for CSI '");
+		printf ("' for component ");
 		printSaNameT ((SaNameT *)compName);
 		printSaNameT ((SaNameT *)compName);
 		printf ("'");
 		printf ("'");
 		printf (" requested to enter hastate SA_AMF_STANDBY.\n");
 		printf (" requested to enter hastate SA_AMF_STANDBY.\n");
-		saAmfResponse (invocation, SA_OK);
-		break;
-	case SA_AMF_QUIESCED:
-		printf ("CSISetCallback: '"); 
-		printSaNameT ((SaNameT *)compName);
-		printf ("' for CSI '");
-		printSaNameT ((SaNameT *)compName);
-		printf ("'");
-		printf (" requested to enter hastate SA_AMF_QUIESCED.\n");
-		saAmfResponse (invocation, SA_OK);
+		saAmfResponse (handle, invocation, SA_AIS_OK);
 		break;
 		break;
 	}
 	}
 }
 }
 
 
+#ifdef COMPILE_OUT
 void CSIRemoveCallback (
 void CSIRemoveCallback (
 	SaInvocationT invocation,
 	SaInvocationT invocation,
 	const SaNameT *compName,
 	const SaNameT *compName,
@@ -219,40 +203,41 @@ void PendingOperationExpiredCallback (
 {
 {
 	printf ("PendingOperationExpiredCallback\n");
 	printf ("PendingOperationExpiredCallback\n");
 }
 }
+#endif
 
 
 SaAmfCallbacksT amfCallbacks = {
 SaAmfCallbacksT amfCallbacks = {
-	HealthcheckCallback,
-	ReadinessStateSetCallback,
-	ComponentTerminateCallback,
-	CSISetCallback,
-	CSIRemoveCallback,
-	ProtectionGroupTrackCallback,
-	ExternalComponentRestartCallback,
-	ExternalComponentControlCallback,
-	PendingOperationConfirmCallback,
-	PendingOperationExpiredCallback
+	.saAmfHealthcheckCallback = HealthcheckCallback,
+	.saAmfCSISetCallback = CSISetCallback,
 };
 };
 
 
-SaVersionT version = { 'A', 1, 1 };
+SaAmfCallbacksT amfCallbacks;
+
+SaVersionT version = { 'B', 1, 1 };
+
+static struct sched_param sched_param = {
+    sched_priority: 99
+};
 
 
 void sigintr_handler (int signum) {
 void sigintr_handler (int signum) {
 	exit (0);
 	exit (0);
 }
 }
 
 
 int main (int argc, char **argv) {
 int main (int argc, char **argv) {
-	SaAmfHandleT handle;
 	int result;
 	int result;
 	SaSelectionObjectT select_fd;
 	SaSelectionObjectT select_fd;
 	fd_set read_fds;
 	fd_set read_fds;
-	SaNameT compName;
 	extern char *optarg;
 	extern char *optarg;
 	extern int optind;
 	extern int optind;
 	int c;
 	int c;
 
 
-	memset (&compName, 0, sizeof (SaNameT));
+	memset (&compNameGlobal, 0, sizeof (SaNameT));
 	signal (SIGINT, sigintr_handler);
 	signal (SIGINT, sigintr_handler);
+	result = sched_setscheduler (0, SCHED_RR, &sched_param);
+	if (result == -1) {
+		printf ("couldn't set sched priority\n");
+ 	}
 
 
-	for (;;) {
+	for (;;){
 		c = getopt(argc,argv,"h:n:");
 		c = getopt(argc,argv,"h:n:");
 		if (c==-1) {
 		if (c==-1) {
 			break;
 			break;
@@ -265,11 +250,11 @@ int main (int argc, char **argv) {
 			sscanf (optarg,"%ud" ,&healthcheck_count);
 			sscanf (optarg,"%ud" ,&healthcheck_count);
 			break;
 			break;
 		case 'n':
 		case 'n':
-			setSanameT (&compName, optarg);
+	  		setSanameT (&compNameGlobal, optarg);
 			break;
 			break;
-		default :
+                default :
 			break;
 			break;
-		}
+                }
 	}
 	}
 
 
 	result = saAmfInitialize (&handle, &amfCallbacks, &version);
 	result = saAmfInitialize (&handle, &amfCallbacks, &version);
@@ -279,22 +264,46 @@ int main (int argc, char **argv) {
 	}
 	}
 
 
 	FD_ZERO (&read_fds);
 	FD_ZERO (&read_fds);
-	saAmfSelectionObjectGet (&handle, &select_fd);
+	saAmfSelectionObjectGet (handle, &select_fd);
 	FD_SET (select_fd, &read_fds);
 	FD_SET (select_fd, &read_fds);
-
-	if (compName.length <= 0){
-		setSanameT (&compName, "comp_b_in_su_y");
+	if (compNameGlobal.length <= 0) {
+		setSanameT (&compNameGlobal, "comp_b_in_su_2");
 	}
 	}
 
 
-	result = saAmfComponentRegister (&handle, &compName, NULL);
+	result = saAmfHealthcheckStart (handle,
+		&compNameGlobal,
+		&key0,
+		SA_AMF_HEALTHCHECK_AMF_INVOKED,
+		SA_AMF_COMPONENT_FAILOVER);
+	printf ("start %d\n", result);
+
+	result = saAmfHealthcheckStart (handle,
+		&compNameGlobal,
+		&key0,
+		SA_AMF_HEALTHCHECK_AMF_INVOKED,
+		SA_AMF_COMPONENT_FAILOVER);
+	printf ("start %d\n", result);
+	result = saAmfComponentRegister (handle, &compNameGlobal, NULL);
 	printf ("register result is %d (should be 1)\n", result);
 	printf ("register result is %d (should be 1)\n", result);
 
 
 	do {
 	do {
 		select (select_fd + 1, &read_fds, 0, 0, 0);
 		select (select_fd + 1, &read_fds, 0, 0, 0);
-		saAmfDispatch (&handle, SA_DISPATCH_ALL);
+		saAmfDispatch (handle, SA_DISPATCH_ALL);
+	} while (result && stop == 0);
+
+	sleep (5);
+	result = saAmfHealthcheckStart (handle,
+		&compNameGlobal,
+		&key0,
+		SA_AMF_HEALTHCHECK_AMF_INVOKED,
+		SA_AMF_COMPONENT_FAILOVER);
+
+	do {
+		select (select_fd + 1, &read_fds, 0, 0, 0);
+		saAmfDispatch (handle, SA_DISPATCH_ALL);
 	} while (result);
 	} while (result);
 
 
-	saAmfFinalize (&handle);
+	saAmfFinalize (handle);
 
 
 	exit (0);
 	exit (0);
 }
 }

+ 41 - 45
test/testamf5.c

@@ -40,9 +40,10 @@
 #include <sys/types.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <sys/un.h>
+#include <sched.h>
 
 
-#include "saAis.h"
-#include "ais_amf.h"
+#include "ais_types.h"
+#include "saAmf.h"
 
 
 void printSaNameT (SaNameT *name)
 void printSaNameT (SaNameT *name)
 {
 {
@@ -61,6 +62,8 @@ void setSanameT (SaNameT *name, char *str) {
 static int health_flag = -1;
 static int health_flag = -1;
 static unsigned int healthcheck_count = 0;
 static unsigned int healthcheck_count = 0;
 static unsigned int healthcheck_no = 0;
 static unsigned int healthcheck_no = 0;
+
+#ifdef COMPILE_OUT
 void HealthcheckCallback (SaInvocationT invocation,
 void HealthcheckCallback (SaInvocationT invocation,
 	const SaNameT *compName,
 	const SaNameT *compName,
 	SaAmfHealthcheckT checkType)
 	SaAmfHealthcheckT checkType)
@@ -112,46 +115,37 @@ void ComponentTerminateCallback (
 	printf ("ComponentTerminateCallback\n");
 	printf ("ComponentTerminateCallback\n");
 }
 }
 
 
+#endif
 void CSISetCallback (
 void CSISetCallback (
 	SaInvocationT invocation,
 	SaInvocationT invocation,
 	const SaNameT *compName,
 	const SaNameT *compName,
-	const SaNameT *csiName,
-	SaAmfCSIFlagsT csiFlags,
-	SaAmfHAStateT *haState,
-	SaNameT *activeCompName,
-	SaAmfCSITransitionDescriptorT transitionDescriptor)
+	SaAmfHAStateT haState,
+	SaAmfCSIDescriptorT *csiDescriptor)
 {
 {
-	switch (*haState) {
-	case SA_AMF_ACTIVE:
+	switch (haState) {
+	case SA_AMF_HA_ACTIVE:
 		printf ("CSISetCallback: '"); 
 		printf ("CSISetCallback: '"); 
-		printSaNameT ((SaNameT *)compName);
+		printSaNameT ((SaNameT *)&csiDescriptor->csiName);
 		printf ("' for CSI '");
 		printf ("' for CSI '");
 		printSaNameT ((SaNameT *)compName);
 		printSaNameT ((SaNameT *)compName);
 		printf ("'");
 		printf ("'");
  		printf (" requested to enter hastate SA_AMF_ACTIVE.\n");
  		printf (" requested to enter hastate SA_AMF_ACTIVE.\n");
-		saAmfResponse (invocation, SA_OK);
+//		saAmfResponse (invocation, SA_OK);
 		break;
 		break;
-	case SA_AMF_STANDBY:
+
+	case SA_AMF_HA_STANDBY:
 		printf ("CSISetCallback: '"); 
 		printf ("CSISetCallback: '"); 
 		printSaNameT ((SaNameT *)compName);
 		printSaNameT ((SaNameT *)compName);
 		printf ("' for CSI '");
 		printf ("' for CSI '");
 		printSaNameT ((SaNameT *)compName);
 		printSaNameT ((SaNameT *)compName);
 		printf ("'");
 		printf ("'");
 		printf (" requested to enter hastate SA_AMF_STANDBY.\n");
 		printf (" requested to enter hastate SA_AMF_STANDBY.\n");
-		saAmfResponse (invocation, SA_OK);
-		break;
-	case SA_AMF_QUIESCED:
-		printf ("CSISetCallback: '"); 
-		printSaNameT ((SaNameT *)compName);
-		printf ("' for CSI '");
-		printSaNameT ((SaNameT *)compName);
-		printf ("'");
-		printf (" requested to enter hastate SA_AMF_QUIESCED.\n");
-		saAmfResponse (invocation, SA_OK);
+//		saAmfResponse (invocation, SA_OK);
 		break;
 		break;
 	}
 	}
 }
 }
 
 
+#ifdef COMPILE_OUT
 void CSIRemoveCallback (
 void CSIRemoveCallback (
 	SaInvocationT invocation,
 	SaInvocationT invocation,
 	const SaNameT *compName,
 	const SaNameT *compName,
@@ -217,26 +211,25 @@ void PendingOperationExpiredCallback (
 {
 {
 	printf ("PendingOperationExpiredCallback\n");
 	printf ("PendingOperationExpiredCallback\n");
 }
 }
+#endif
 
 
 SaAmfCallbacksT amfCallbacks = {
 SaAmfCallbacksT amfCallbacks = {
-	HealthcheckCallback,
-	ReadinessStateSetCallback,
-	ComponentTerminateCallback,
-	CSISetCallback,
-	CSIRemoveCallback,
-	ProtectionGroupTrackCallback,
-	ExternalComponentRestartCallback,
-	ExternalComponentControlCallback,
-	PendingOperationConfirmCallback,
-	PendingOperationExpiredCallback
+	.saAmfCSISetCallback = CSISetCallback,
 };
 };
 
 
-SaVersionT version = { 'A', 1, 1 };
+SaAmfCallbacksT amfCallbacks;
+
+SaVersionT version = { 'B', 1, 1 };
+
+static struct sched_param sched_param = {
+    sched_priority: 99
+};
 
 
 void sigintr_handler (int signum) {
 void sigintr_handler (int signum) {
 	exit (0);
 	exit (0);
 }
 }
 
 
+
 int main (int argc, char **argv) {
 int main (int argc, char **argv) {
 	SaAmfHandleT handle;
 	SaAmfHandleT handle;
 	int result;
 	int result;
@@ -249,8 +242,12 @@ int main (int argc, char **argv) {
 
 
 	memset (&compName, 0, sizeof (SaNameT));
 	memset (&compName, 0, sizeof (SaNameT));
 	signal (SIGINT, sigintr_handler);
 	signal (SIGINT, sigintr_handler);
+	result = sched_setscheduler (0, SCHED_RR, &sched_param);
+	if (result == -1) {
+		printf ("couldn't set sched priority\n");
+ 	}
 
 
-	for (;;) {
+	for (;;){
 		c = getopt(argc,argv,"h:n:");
 		c = getopt(argc,argv,"h:n:");
 		if (c==-1) {
 		if (c==-1) {
 			break;
 			break;
@@ -263,11 +260,11 @@ int main (int argc, char **argv) {
 			sscanf (optarg,"%ud" ,&healthcheck_count);
 			sscanf (optarg,"%ud" ,&healthcheck_count);
 			break;
 			break;
 		case 'n':
 		case 'n':
-			setSanameT (&compName, optarg);
+	  		setSanameT (&compName, optarg);
 			break;
 			break;
-		default :
+                default :
 			break;
 			break;
-		}
+                }
 	}
 	}
 
 
 	result = saAmfInitialize (&handle, &amfCallbacks, &version);
 	result = saAmfInitialize (&handle, &amfCallbacks, &version);
@@ -277,22 +274,21 @@ int main (int argc, char **argv) {
 	}
 	}
 
 
 	FD_ZERO (&read_fds);
 	FD_ZERO (&read_fds);
-	saAmfSelectionObjectGet (&handle, &select_fd);
+	saAmfSelectionObjectGet (handle, &select_fd);
 	FD_SET (select_fd, &read_fds);
 	FD_SET (select_fd, &read_fds);
-
-	if (compName.length <= 0){
-		setSanameT (&compName, "comp_a_in_su_z");
+	if (compName.length <= 0) {
+		setSanameT (&compName, "comp_a_in_su_3");
 	}
 	}
 
 
-	result = saAmfComponentRegister (&handle, &compName, NULL);
+	result = saAmfComponentRegister (handle, &compName, NULL);
 	printf ("register result is %d (should be 1)\n", result);
 	printf ("register result is %d (should be 1)\n", result);
 
 
 	do {
 	do {
 		select (select_fd + 1, &read_fds, 0, 0, 0);
 		select (select_fd + 1, &read_fds, 0, 0, 0);
-		saAmfDispatch (&handle, SA_DISPATCH_ALL);
+		saAmfDispatch (handle, SA_DISPATCH_ALL);
 	} while (result);
 	} while (result);
 
 
-	saAmfFinalize (&handle);
+	saAmfFinalize (handle);
 
 
-	return (0);
+	exit (0);
 }
 }

+ 45 - 49
test/testamf6.c

@@ -40,9 +40,10 @@
 #include <sys/types.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <sys/un.h>
+#include <sched.h>
 
 
-#include "saAis.h"
-#include "ais_amf.h"
+#include "ais_types.h"
+#include "saAmf.h"
 
 
 void printSaNameT (SaNameT *name)
 void printSaNameT (SaNameT *name)
 {
 {
@@ -58,10 +59,11 @@ void setSanameT (SaNameT *name, char *str) {
 	memcpy (name->value, str, name->length);
 	memcpy (name->value, str, name->length);
 }
 }
 
 
-
 static int health_flag = -1;
 static int health_flag = -1;
 static unsigned int healthcheck_count = 0;
 static unsigned int healthcheck_count = 0;
 static unsigned int healthcheck_no = 0;
 static unsigned int healthcheck_no = 0;
+
+#ifdef COMPILE_OUT
 void HealthcheckCallback (SaInvocationT invocation,
 void HealthcheckCallback (SaInvocationT invocation,
 	const SaNameT *compName,
 	const SaNameT *compName,
 	SaAmfHealthcheckT checkType)
 	SaAmfHealthcheckT checkType)
@@ -100,7 +102,8 @@ void ReadinessStateSetCallback (SaInvocationT invocation,
 	case SA_AMF_STOPPING:
 	case SA_AMF_STOPPING:
 		printf ("ReadinessStateSetCallback: '");
 		printf ("ReadinessStateSetCallback: '");
 		printSaNameT ((SaNameT *)compName);
 		printSaNameT ((SaNameT *)compName);
-                printf ("' requested to enter operational state SA_AMF_STOPPING.\n");                saAmfStoppingComplete (invocation, SA_OK);
+		printf ("' requested to enter operational state SA_AMF_STOPPING.\n");
+		saAmfStoppingComplete (invocation, SA_OK);
 		break;
 		break;
 	}
 	}
 }
 }
@@ -112,46 +115,37 @@ void ComponentTerminateCallback (
 	printf ("ComponentTerminateCallback\n");
 	printf ("ComponentTerminateCallback\n");
 }
 }
 
 
+#endif
 void CSISetCallback (
 void CSISetCallback (
 	SaInvocationT invocation,
 	SaInvocationT invocation,
 	const SaNameT *compName,
 	const SaNameT *compName,
-	const SaNameT *csiName,
-	SaAmfCSIFlagsT csiFlags,
-	SaAmfHAStateT *haState,
-	SaNameT *activeCompName,
-	SaAmfCSITransitionDescriptorT transitionDescriptor)
+	SaAmfHAStateT haState,
+	SaAmfCSIDescriptorT *csiDescriptor)
 {
 {
-	switch (*haState) {
-	case SA_AMF_ACTIVE:
+	switch (haState) {
+	case SA_AMF_HA_ACTIVE:
 		printf ("CSISetCallback: '"); 
 		printf ("CSISetCallback: '"); 
-		printSaNameT ((SaNameT *)compName);
+		printSaNameT ((SaNameT *)&csiDescriptor->csiName);
 		printf ("' for CSI '");
 		printf ("' for CSI '");
 		printSaNameT ((SaNameT *)compName);
 		printSaNameT ((SaNameT *)compName);
 		printf ("'");
 		printf ("'");
  		printf (" requested to enter hastate SA_AMF_ACTIVE.\n");
  		printf (" requested to enter hastate SA_AMF_ACTIVE.\n");
-		saAmfResponse (invocation, SA_OK);
+//		saAmfResponse (invocation, SA_OK);
 		break;
 		break;
-	case SA_AMF_STANDBY:
+
+	case SA_AMF_HA_STANDBY:
 		printf ("CSISetCallback: '"); 
 		printf ("CSISetCallback: '"); 
 		printSaNameT ((SaNameT *)compName);
 		printSaNameT ((SaNameT *)compName);
 		printf ("' for CSI '");
 		printf ("' for CSI '");
 		printSaNameT ((SaNameT *)compName);
 		printSaNameT ((SaNameT *)compName);
 		printf ("'");
 		printf ("'");
 		printf (" requested to enter hastate SA_AMF_STANDBY.\n");
 		printf (" requested to enter hastate SA_AMF_STANDBY.\n");
-		saAmfResponse (invocation, SA_OK);
-		break;
-	case SA_AMF_QUIESCED:
-		printf ("CSISetCallback: '"); 
-		printSaNameT ((SaNameT *)compName);
-		printf ("' for CSI '");
-		printSaNameT ((SaNameT *)compName);
-		printf ("'");
-		printf (" requested to enter hastate SA_AMF_QUIESCED.\n");
-		saAmfResponse (invocation, SA_OK);
+//		saAmfResponse (invocation, SA_OK);
 		break;
 		break;
 	}
 	}
 }
 }
 
 
+#ifdef COMPILE_OUT
 void CSIRemoveCallback (
 void CSIRemoveCallback (
 	SaInvocationT invocation,
 	SaInvocationT invocation,
 	const SaNameT *compName,
 	const SaNameT *compName,
@@ -217,26 +211,25 @@ void PendingOperationExpiredCallback (
 {
 {
 	printf ("PendingOperationExpiredCallback\n");
 	printf ("PendingOperationExpiredCallback\n");
 }
 }
+#endif
 
 
 SaAmfCallbacksT amfCallbacks = {
 SaAmfCallbacksT amfCallbacks = {
-	HealthcheckCallback,
-	ReadinessStateSetCallback,
-	ComponentTerminateCallback,
-	CSISetCallback,
-	CSIRemoveCallback,
-	ProtectionGroupTrackCallback,
-	ExternalComponentRestartCallback,
-	ExternalComponentControlCallback,
-	PendingOperationConfirmCallback,
-	PendingOperationExpiredCallback
+	.saAmfCSISetCallback = CSISetCallback,
 };
 };
 
 
-SaVersionT version = { 'A', 1, 1 };
+SaAmfCallbacksT amfCallbacks;
+
+SaVersionT version = { 'B', 1, 1 };
+
+static struct sched_param sched_param = {
+    sched_priority: 99
+};
 
 
 void sigintr_handler (int signum) {
 void sigintr_handler (int signum) {
-        exit (0);
+	exit (0);
 }
 }
 
 
+
 int main (int argc, char **argv) {
 int main (int argc, char **argv) {
 	SaAmfHandleT handle;
 	SaAmfHandleT handle;
 	int result;
 	int result;
@@ -249,8 +242,12 @@ int main (int argc, char **argv) {
 
 
 	memset (&compName, 0, sizeof (SaNameT));
 	memset (&compName, 0, sizeof (SaNameT));
 	signal (SIGINT, sigintr_handler);
 	signal (SIGINT, sigintr_handler);
+	result = sched_setscheduler (0, SCHED_RR, &sched_param);
+	if (result == -1) {
+		printf ("couldn't set sched priority\n");
+ 	}
 
 
-	for (;;) {
+	for (;;){
 		c = getopt(argc,argv,"h:n:");
 		c = getopt(argc,argv,"h:n:");
 		if (c==-1) {
 		if (c==-1) {
 			break;
 			break;
@@ -263,11 +260,11 @@ int main (int argc, char **argv) {
 			sscanf (optarg,"%ud" ,&healthcheck_count);
 			sscanf (optarg,"%ud" ,&healthcheck_count);
 			break;
 			break;
 		case 'n':
 		case 'n':
-			setSanameT (&compName, optarg);
+	  		setSanameT (&compName, optarg);
 			break;
 			break;
-		default :
+                default :
 			break;
 			break;
-		}
+                }
 	}
 	}
 
 
 	result = saAmfInitialize (&handle, &amfCallbacks, &version);
 	result = saAmfInitialize (&handle, &amfCallbacks, &version);
@@ -275,24 +272,23 @@ int main (int argc, char **argv) {
 		printf ("initialize result is %d\n", result);
 		printf ("initialize result is %d\n", result);
 		exit (1);
 		exit (1);
 	}
 	}
-	printf ("initialize result is %d\n", result);
 
 
 	FD_ZERO (&read_fds);
 	FD_ZERO (&read_fds);
-	saAmfSelectionObjectGet (&handle, &select_fd);
+	saAmfSelectionObjectGet (handle, &select_fd);
 	FD_SET (select_fd, &read_fds);
 	FD_SET (select_fd, &read_fds);
-
-	if (compName.length <= 0){
-		setSanameT (&compName, "comp_b_in_su_z");		
+	if (compName.length <= 0) {
+		setSanameT (&compName, "comp_b_in_su_3");
 	}
 	}
 
 
-	result = saAmfComponentRegister (&handle, &compName, NULL);
+	result = saAmfComponentRegister (handle, &compName, NULL);
 	printf ("register result is %d (should be 1)\n", result);
 	printf ("register result is %d (should be 1)\n", result);
 
 
 	do {
 	do {
 		select (select_fd + 1, &read_fds, 0, 0, 0);
 		select (select_fd + 1, &read_fds, 0, 0, 0);
-		saAmfDispatch (&handle, SA_DISPATCH_ALL);
+		saAmfDispatch (handle, SA_DISPATCH_ALL);
 	} while (result);
 	} while (result);
 
 
-	saAmfFinalize (&handle);
-	return (0);
+	saAmfFinalize (handle);
+
+	exit (0);
 }
 }

+ 1 - 1
test/testamfth.c

@@ -41,7 +41,7 @@
 #include <sys/socket.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <sys/un.h>
 
 
-#include "saAis.h"
+#include "ais_types.h"
 #include "ais_amf.h"
 #include "ais_amf.h"
 #include "saClm.h"
 #include "saClm.h"
 
 

Some files were not shown because too many files changed in this diff