Pārlūkot izejas kodu

added some in .gitignorex

FlorianPalm 11 gadi atpakaļ
vecāks
revīzija
76ccf0faea

+ 6 - 2
OPCUAServer/.gitignore

@@ -4,7 +4,11 @@ bin/
 
 
 # ignore all target directories
 # ignore all target directories
 target/
 target/
-
+autom4te.cache
+# ignore Makefiles
+Makefile
+src/Makefile
+tests/Makefile
 # ignore all files ending with ~
 # ignore all files ending with ~
 *.po
 *.po
-*.o 
+*.o 

+ 3 - 3
OPCUAServer/config.log

@@ -4,7 +4,7 @@ running configure, to aid debugging if configure makes a mistake.
 It was created by OPCUAServer configure 1.0, which was
 It was created by OPCUAServer configure 1.0, which was
 generated by GNU Autoconf 2.68.  Invocation command line was
 generated by GNU Autoconf 2.68.  Invocation command line was
 
 
-  $ /home/opcua/git/opcUaStack/OPCUAServer/configure 
+  $ ./configure 
 
 
 ## --------- ##
 ## --------- ##
 ## Platform. ##
 ## Platform. ##
@@ -12,9 +12,9 @@ generated by GNU Autoconf 2.68.  Invocation command line was
 
 
 hostname = opcua-VirtualBox
 hostname = opcua-VirtualBox
 uname -m = i686
 uname -m = i686
-uname -r = 3.8.0-34-generic
+uname -r = 3.8.0-35-generic
 uname -s = Linux
 uname -s = Linux
-uname -v = #49~precise1-Ubuntu SMP Wed Nov 13 18:08:04 UTC 2013
+uname -v = #50~precise1-Ubuntu SMP Wed Dec 4 17:28:45 UTC 2013
 
 
 /usr/bin/uname -p = unknown
 /usr/bin/uname -p = unknown
 /bin/uname -X     = unknown
 /bin/uname -X     = unknown

+ 2 - 2
OPCUAServer/config.status

@@ -436,7 +436,7 @@ Report bugs to the package provider."
 ac_cs_config=""
 ac_cs_config=""
 ac_cs_version="\
 ac_cs_version="\
 OPCUAServer config.status 1.0
 OPCUAServer config.status 1.0
-configured by /home/opcua/git/opcUaStack/OPCUAServer/configure, generated by GNU Autoconf 2.68,
+configured by ./configure, generated by GNU Autoconf 2.68,
   with options \"$ac_cs_config\"
   with options \"$ac_cs_config\"
 
 
 Copyright (C) 2010 Free Software Foundation, Inc.
 Copyright (C) 2010 Free Software Foundation, Inc.
@@ -514,7 +514,7 @@ if $ac_cs_silent; then
 fi
 fi
 
 
 if $ac_cs_recheck; then
 if $ac_cs_recheck; then
-  set X '/bin/bash' '/home/opcua/git/opcUaStack/OPCUAServer/configure'  $ac_configure_extra_args --no-create --no-recursion
+  set X '/bin/bash' './configure'  $ac_configure_extra_args --no-create --no-recursion
   shift
   shift
   $as_echo "running CONFIG_SHELL=/bin/bash $*" >&6
   $as_echo "running CONFIG_SHELL=/bin/bash $*" >&6
   CONFIG_SHELL='/bin/bash'
   CONFIG_SHELL='/bin/bash'

+ 1 - 1
OPCUAServer/src/.deps/opcuaServer.Po

@@ -1 +1 @@
-opcuaServer.o: opcuaServer.c
+# dummy

+ 18 - 24
OPCUAServer/src/opcuaServer.c

@@ -8,38 +8,32 @@
  ============================================================================
  ============================================================================
  */
  */
 
 
-//#include <stdio.h>
-//#include <stdlib.h>
-//#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
 
 
 
 
-//#include "opcua_binaryEncDec.h"
-//#include "opcua_builtInDatatypes.h"
-//#include "opcua_transportLayer.h"
-//#include "opcua_types.h"
 
 
-//#include <sys/socket.h>
-//#include <netinet/in.h>
+#include "opcua_binaryEncDec.h"
+#include "opcua_builtInDatatypes.h"
+#include "opcua_transportLayer.h"
+#include "opcua_types.h"
 
 
-//void server_init();
-//void server_run();
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+void server_init();
+void server_run();
 
 
 int main(void)
 int main(void)
 {
 {
-//	puts("OPC ua Stack");
-	//struct BED_ApplicationDescription nStruct;
-	//UA_String s;
-//	puts("running tests...");
-//	TL_getMessageHeader_test();
-	//TL_getHELMessage_test();
-//	puts("...done");
-//	server_init();
-//	server_run();
-
-	return 0;//EXIT_SUCCESS;
+
+	server_init();
+	server_run();
+
+	return EXIT_SUCCESS;
 
 
 }
 }
-/*
+
 void server_init()
 void server_init()
 {
 {
 	puts("starting demo Server");
 	puts("starting demo Server");
@@ -147,4 +141,4 @@ void server_run()
 	}
 	}
 
 
 }
 }
-*/
+

+ 1 - 6
OPCUAServer/src/opcua_binaryEncDec.c

@@ -8,7 +8,7 @@
 #include "opcua_binaryEncDec.h"
 #include "opcua_binaryEncDec.h"
 #include "opcua_types.h"
 #include "opcua_types.h"
 
 
-const char *TEST_PASSED = "PASSED";
+
 
 
 /*
 /*
  * convert byte array to Byte
  * convert byte array to Byte
@@ -80,11 +80,6 @@ Int64 convertToInt64(char* buf, int pos)
 }
 }
 
 
 
 
-Int64 convertToInt64_test(char* buf, int pos)
-{
-
-	printf("");
-}
 
 
 
 
 convertToUAString(char* buf, int pos,UA_String *dstUAString)
 convertToUAString(char* buf, int pos,UA_String *dstUAString)

+ 2 - 1
OPCUAServer/src/opcua_connectionHelper.h

@@ -54,7 +54,8 @@ struct SL_connection
 	UA_String secureChannelId;
 	UA_String secureChannelId;
 	UInt32 securityMode;
 	UInt32 securityMode;
 	UA_String clientNonce;
 	UA_String clientNonce;
-	UA_Duration requestedLifetime;
+	UA_Duration requestedLifetime; /// life time of the secure channel
+	UA_DateTime requestedAt; /// Point in time in which the secure channel was requested
 	UInt32 connectionState;
 	UInt32 connectionState;
 
 
 };
 };

+ 112 - 97
OPCUAServer/src/opcua_secureChannelLayer.c

@@ -10,149 +10,164 @@ SL_getRequestHeader()
 {
 {
 
 
 }
 }
+
 /*
 /*
  * opens a secureChannel (server side)
  * opens a secureChannel (server side)
  */
  */
-void SL_secureChannel_open(const UA_connection     *connection,
-		const AD_RawMessage                        *secureChannelMessage,
-		SL_SecureConversationMessageHeader   *SCM_Header,
-		SL_AsymmetricAlgorithmSecurityHeader *AAS_Header)
+void SL_secureChannel_open(const UA_connection *connection,
+		const AD_RawMessage *secureChannelMessage,
+		const SL_SecureConversationMessageHeader *SCM_Header,
+		const SL_AsymmetricAlgorithmSecurityHeader *AAS_Header)
 {
 {
 
 
 	TL_send();
 	TL_send();
-	//connection->secureLayer.
+	//client protocol Version
+
+connection->secureLayer.
+//connection->secureLayer.
 }
 }
 /*
 /*
-void SL_secureChannel_Request_get(AD_RawMessage        *secureChannelMessage,
-		                          secureChannelRequest *SC_request)
-{
+ void SL_secureChannel_Request_get(AD_RawMessage        *secureChannelMessage,
+ secureChannelRequest *SC_request)
+ {
 
 
-}
-*/
+ }
+ */
 /*
 /*
  * closes a secureChannel (server side)
  * closes a secureChannel (server side)
  */
  */
+void SL_secureChannel_formResponse()
+{
+
+}
 void SL_secureChannel_close(UA_connection *connection)
 void SL_secureChannel_close(UA_connection *connection)
 {
 {
 
 
 }
 }
+
 /*
 /*
  * receive and process data from underlying layer
  * receive and process data from underlying layer
  */
  */
-void SL_receive(UA_connection *connection,
-		        AD_RawMessage *serviceMessage)
+void SL_receive(UA_connection *connection, AD_RawMessage *serviceMessage)
 {
 {
-	AD_RawMessage* secureChannelMessage;
-	SL_SecureConversationMessageHeader SCM_Header;
-	SL_AsymmetricAlgorithmSecurityHeader AAS_Header;
+AD_RawMessage* secureChannelMessage;
+SL_SecureConversationMessageHeader SCM_Header;
+SL_AsymmetricAlgorithmSecurityHeader AAS_Header;
 
 
-	//get data from transport layer
-	TL_receive(UA_connection, secureChannelMessage);
+//get data from transport layer
+TL_receive(UA_connection, secureChannelMessage);
 
 
-	//get the Secure Channel Message Header
-	UInt32 readPosition = SL_secureChannel_SCMHeader_get(connection,secureChannelMessage,&SCM_Header);
+//get the Secure Channel Message Header
+UInt32 readPosition = SL_secureChannel_SCMHeader_get(connection,
+		secureChannelMessage, &SCM_Header);
 
 
-	//get the Secure Channel Asymmetric Algorithm Security Header
-	readPosition = SL_secureChannel_AASHeader_get(connection,secureChannelMessage,readPosition,&AAS_Header);
+//get the Secure Channel Asymmetric Algorithm Security Header
+readPosition = SL_secureChannel_AASHeader_get(connection, secureChannelMessage,
+		readPosition, &AAS_Header);
 
 
-	//get Secure Channel Message
-	SL_secureChannel_Message_get(connection,secureChannelMessage,readPosition,serviceMessage);
+//get Secure Channel Message
+SL_secureChannel_Message_get(connection, secureChannelMessage, readPosition,
+		serviceMessage);
 
 
-
-	if (secureChannelMessage.length > 0)
+if (secureChannelMessage.length > 0)
+{
+	switch (SCM_Header.MessageType)
 	{
 	{
-		switch (SCM_Header.MessageType)
+	case packetType_MSG:
+		if (connection->secureLayer.connectionState
+				== connectionState_ESTABLISHED)
+		{
+
+		}
+		else //receiving message, without secure channel
+		{
+			//TODO send back Error Message
+		}
+		break;
+	case packetType_OPN:
+		//Server Handling
+		if (openSecureChannelHeader_check(connection, secureChannelMessage))
 		{
 		{
-		case packetType_MSG:
-			if (connection->secureLayer.connectionState
-					== connectionState_ESTABLISHED)
-			{
-
-			}
-			else //receiving message, without secure channel
-			{
-				//TODO send back Error Message
-			}
-			break;
-		case packetType_OPN:
-			//Server Handling
-			if (openSecureChannelHeader_check(connection, secureChannelMessage))
-			{
-				SL_secureChannel_open(connection, serviceMessage);
-			}
-			else
-			{
-				//TODO send back Error Message
-			}
-
-			//Client Handling
-
-			//TODO free memory for secureChannelMessage
-
-			break;
-		case packetType_CLO:
-			SL_secureChannel_close(connection, secureChannelMessage);
-
-			//TODO free memory for secureChannelMessage
-			break;
+
+		}
+		SL_secureChannel_open(connection, serviceMessage);
+	}
+	else
+	{
+		//TODO send back Error Message
 	}
 	}
 
 
+	//Client Handling
+
+	//TODO free memory for secureChannelMessage
+
+	break;
+	case packetType_CLO:
+	SL_secureChannel_close(connection, secureChannelMessage);
+
+	//TODO free memory for secureChannelMessage
+	break;
 }
 }
-UInt32 SL_secureChannel_SCMHeader_get(UA_connection *connection, AD_RawMessage *rawMessage, SL_SecureConversationMessageHeader* SC_Header)
+
+}
+UInt32 SL_secureChannel_SCMHeader_get(UA_connection *connection,
+	AD_RawMessage *rawMessage, SL_SecureConversationMessageHeader* SC_Header)
 {
 {
-	Int32 pos = 0;
-	SC_Header->MessageType = TL_getPacketType(rawMessage);
-	pos += TL_MESSAGE_TYPE_LEN;
-	SC_Header->IsFinal = rawMessage[pos];
-	pos += sizeof(Byte);
-	SC_Header->MessageSize = convertToUInt32(rawMessage,pos);
-	pos += sizeof(UInt32);
-	SC_Header->SecureChannelId = convertToUInt32(rawMessage,pos);
-	pos += sizeof(UInt32);
-	return pos;
+Int32 pos = 0;
+SC_Header->MessageType = TL_getPacketType(rawMessage);
+pos += TL_MESSAGE_TYPE_LEN;
+SC_Header->IsFinal = rawMessage[pos];
+pos += sizeof(Byte);
+SC_Header->MessageSize = convertToUInt32(rawMessage, pos);
+pos += sizeof(UInt32);
+SC_Header->SecureChannelId = convertToUInt32(rawMessage, pos);
+pos += sizeof(UInt32);
+return pos;
 
 
 }
 }
-UInt32 SL_secureChannel_AASHeader_get(UA_connection *connection, AD_RawMessage *rawMessage,UInt32 pos, SL_AsymmetricAlgorithmSecurityHeader* AAS_Header)
+UInt32 SL_secureChannel_AASHeader_get(UA_connection *connection,
+	AD_RawMessage *rawMessage, UInt32 pos,
+	SL_AsymmetricAlgorithmSecurityHeader* AAS_Header)
 {
 {
-	AAS_Header->SecurityPolicyUri.Length = convertToInt32(rawMessage,pos);
+AAS_Header->SecurityPolicyUri.Length = convertToInt32(rawMessage, pos);
 
 
-	pos += sizeof(Int32);
-	AAS_Header->SecurityPolicyUri.Data = rawMessage[pos];
+pos += sizeof(Int32);
+AAS_Header->SecurityPolicyUri.Data = rawMessage[pos];
 
 
-	if(AAS_Header->SecurityPolicyUri.Length < 0)
-	{
-		AAS_Header->SecurityPolicyUri.Length = 0;
-	}
-	pos +=  AAS_Header->SecurityPolicyUri.Length;
+if (AAS_Header->SecurityPolicyUri.Length < 0)
+{
+	AAS_Header->SecurityPolicyUri.Length = 0;
+}
+pos += AAS_Header->SecurityPolicyUri.Length;
 
 
-	AAS_Header->SenderCertificate.Length = convertToInt32(rawMessage,pos);
-	pos += sizeof(Int32);
-	if(AAS_Header->SenderCertificate.Length < 0)
-	{
-		AAS_Header->SenderCertificate.Length = 0;
-	}
-	AAS_Header->SenderCertificate.Data = rawMessage[pos];
+AAS_Header->SenderCertificate.Length = convertToInt32(rawMessage, pos);
+pos += sizeof(Int32);
+if (AAS_Header->SenderCertificate.Length < 0)
+{
+	AAS_Header->SenderCertificate.Length = 0;
+}
+AAS_Header->SenderCertificate.Data = rawMessage[pos];
 
 
-	pos += AAS_Header->SenderCertificate.Length;
+pos += AAS_Header->SenderCertificate.Length;
 
 
-	AAS_Header->ReceiverThumbprint.Length = convertToInt32(rawMessage,pos);
-	pos += sizeof(Int32);
+AAS_Header->ReceiverThumbprint.Length = convertToInt32(rawMessage, pos);
+pos += sizeof(Int32);
 
 
-	if(AAS_Header->ReceiverThumbprint.Length < 0)
-	{
-		AAS_Header->ReceiverThumbprint.Length = 0;
-	}
-	AAS_Header->ReceiverThumbprint.Data = rawMessage[pos];
+if (AAS_Header->ReceiverThumbprint.Length < 0)
+{
+	AAS_Header->ReceiverThumbprint.Length = 0;
+}
+AAS_Header->ReceiverThumbprint.Data = rawMessage[pos];
 
 
-	pos += AAS_Header->ReceiverThumbprint.Length;
-	return pos;
+pos += AAS_Header->ReceiverThumbprint.Length;
+return pos;
 }
 }
 void SL_secureChannel_Footer_get()
 void SL_secureChannel_Footer_get()
 {
 {
 
 
-
 }
 }
-void SL_secureChannel_Message_get(UA_connection *connection, AD_RawMessage *rawMessage,UInt32 pos, AD_RawMessage *message)
+void SL_secureChannel_Message_get(UA_connection *connection,
+	AD_RawMessage *rawMessage, UInt32 pos, AD_RawMessage *message)
 {
 {
 
 
 }
 }