platformcommand: Link commands for interacting with the MS simulator into libtpm2tctisock.

The platformcommand code is now common but consumed through the
libtpm2tctisock library. It should not be linked into binaries directly.
The accompanying command codes have been moved into the tpmsockets.h
file to expose them to clients.

This resolves #111.

Signed-off-by: Philip Tricca <flihp@twobit.us>
diff --git a/Makefile.am b/Makefile.am
index f11ec72..4579633 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -46,7 +46,7 @@
 resourcemgr_resourcemgr_CXXFLAGS = $(RESOURCEMGR_INC) $(PTHREAD_CFLAGS)
 resourcemgr_resourcemgr_LDADD    = $(libtpm2sapi) 
 resourcemgr_resourcemgr_LDFLAGS  = $(PTHREAD_LDFLAGS)
-resourcemgr_resourcemgr_SOURCES  = $(RESOURCEMGR_C) $(TPMSOCKETS_CXX) \
+resourcemgr_resourcemgr_SOURCES  = $(RESOURCEMGR_C) $(TPMSOCKETS_C) $(TPMSOCKETS_CXX) \
     $(COMMON_C) $(COMMONTCTI_C) $(LOCALTPM_C)
 
 sysapi_libtpm2sapi_la_CFLAGS  = -I$(srcdir)/include/tpm2sapi
@@ -57,7 +57,7 @@
 
 tcti_libtpm2tctisock_la_CFLAGS   = -DSAPI_CLIENT $(TCTISOCK_INC)
 tcti_libtpm2tctisock_la_CXXFLAGS = -DSAPI_CLIENT $(TCTISOCK_INC)
-tcti_libtpm2tctisock_la_SOURCES  = common/debug.c $(TPMSOCKETS_CXX) $(COMMONTCTI_C)
+tcti_libtpm2tctisock_la_SOURCES  = common/debug.c $(TPMSOCKETS_C) $(TPMSOCKETS_CXX) $(COMMONTCTI_C)
 
 test_tpmclient_tpmclient_CFLAGS   = -DSAPI_CLIENT $(TPMCLIENT_INC)
 test_tpmclient_tpmclient_CXXFLAGS = -DSAPI_CLIENT $(TPMCLIENT_INC) $(COMMONTCTI_INC) $(TCTIDEV_INC)
diff --git a/bootstrap b/bootstrap
index 7627c98..754c5d9 100755
--- a/bootstrap
+++ b/bootstrap
@@ -36,7 +36,8 @@
   printf "SAMPLE_SRC = \$(SAMPLE_C) \$(SAMPLE_H)\n"
 
   src_listvar "tcti/tpmsockets" "*.cpp" "TPMSOCKETS_CXX"
-  printf "TPMSOCKETS_SRC = \$(TPMSOCKETS_CXX) \$(TPMSOCKETS_H)\n"
+  src_listvar "tcti/tpmsockets" "*.c" "TPMSOCKETS_C"
+  printf "TPMSOCKETS_SRC = \$(TPMSOCKETS_C) \$(TPMSOCKETS_CXX) \$(TPMSOCKETS_H)\n"
 ) > ${VARS_FILE}
 
 printf "Running libtoolize ...\n"
diff --git a/common/platform.h b/common/platform.h
deleted file mode 100644
index 17ec698..0000000
--- a/common/platform.h
+++ /dev/null
@@ -1,40 +0,0 @@
-//**********************************************************************;
-// Copyright (c) 2015, Intel Corporation
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice,
-// this list of conditions and the following disclaimer.
-//
-// 2. 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.
-//
-// 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 HOLDER 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 PLATFORM_H
-#define PLATFORM_H
-
-// Commands to send to OTHER port.
-#define MS_SIM_POWER_ON         1
-#define MS_SIM_POWER_OFF        2
-#define MS_SIM_TPM_SEND_COMMAND 8
-#define MS_SIM_CANCEL_ON        9
-#define MS_SIM_CANCEL_OFF       10
-#define MS_SIM_NV_ON            11
-#define TPM_SESSION_END         20
-
-#endif
diff --git a/include/tpm2tcti/tpmsockets.h b/include/tpm2tcti/tpmsockets.h
index dd43e2c..1636744 100644
--- a/include/tpm2tcti/tpmsockets.h
+++ b/include/tpm2tcti/tpmsockets.h
@@ -67,6 +67,15 @@
 
 #define HOSTNAME_LENGTH 200
 
+/* Commands for Microsoft TPM2 simulator OTHER port. */
+#define MS_SIM_POWER_ON         1
+#define MS_SIM_POWER_OFF        2
+#define MS_SIM_TPM_SEND_COMMAND 8
+#define MS_SIM_CANCEL_ON        9
+#define MS_SIM_CANCEL_OFF       10
+#define MS_SIM_NV_ON            11
+#define TPM_SESSION_END         20
+
 extern TSS2_TCTI_DRIVER_INFO tpmSocketsTctiInfo;
 
 TSS2_RC PlatformCommand(
diff --git a/common/platformcommand.c b/tcti/tpmsockets/platformcommand.c
similarity index 100%
rename from common/platformcommand.c
rename to tcti/tpmsockets/platformcommand.c