Procházet zdrojové kódy

added stack functionality (message parsing)

FlorianPalm před 11 roky
rodič
revize
3e1d5a47d7

+ 110 - 0
OPCUAServer/src/opcuaServer.c.orig

@@ -0,0 +1,110 @@
+/*
+ ============================================================================
+ Name        : opcuaServer.c
+ Author      :
+ Version     :
+ Copyright   : Your copyright notice
+ Description :
+ ============================================================================
+ */
+
+#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>
+*/
+
+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 EXIT_SUCCESS;
+
+}
+
+void server_init()
+{
+	puts("starting demo Server");
+	//call listen
+
+}
+void server_run()
+{
+	int server_state = 0;
+	int recv_data = 0;
+	int send_data = 1;
+	int new_client = 2;
+	int new_request = 3;
+
+	while(1)
+	{
+		//call recv (nonblocking)
+
+		//call TL_getPacketType
+
+		//if newData
+		//
+		UA_connection connection;
+		AD_RawMessage *rawMessage;
+		switch(server_state)
+		{
+
+			recv_data :
+			{
+				//call receive function
+
+				break;
+			}
+			send_data :
+			{
+				//call send function
+				break;
+			}
+			new_client :
+			{
+				if(connection->transportLayer.connectionState != connectionState_ESTABLISHED)
+				{
+					TL_open(connection,rawMessage);
+				}
+/*				else
+				{
+					SL_open(connection,rawMessage);
+
+				}
+*/
+			}
+			new_request :
+			{
+
+
+				break;
+			}
+
+		}
+		//if newClient
+
+
+		//TL_processHELMessage(&connection,);
+
+		//--------
+		//call listen
+	}
+
+}
+

+ 20 - 0
OPCUAServer/src/opcua_binaryEncDec.h.orig

@@ -0,0 +1,20 @@
+/*
+ * opcua_BinaryEncDec.h
+ *
+ *  Created on: Dec 18, 2013
+ *      Author: opcua
+ */
+
+#ifndef OPCUA_BINARYENCDEC_NEU_H_
+#define OPCUA_BINARYENCDEC_NEU_H_
+
+#include "opcua_builtInDatatypes.h"
+
+
+
+//functions
+Byte convertToByte(char* buf, int pos);
+Int32 convertToInt32(char* buf,int pos);
+UInt32 convertToUInt32(char* buf, int pos);
+
+#endif /* OPCUA_BINARYENCDEC_NEU_H_ */

+ 28 - 0
OPCUAServer/src/opcua_serverAPI.h

@@ -0,0 +1,28 @@
+/*
+ * opcua_serverAPI.h
+ *
+ *  Created on: Jan 10, 2014
+ *      Author: opcua
+ */
+
+#ifndef OPCUA_SERVERAPI_H_
+#define OPCUA_SERVERAPI_H_
+
+// startServer(parameters)
+
+// stopServer(parameters)
+
+
+
+
+
+// sessionId = AcceptSecureChannel()
+
+// serviceRequest = receiveServiceRequest(sessionId)
+
+// sendServiceResponse(sessionId, serviceResponse)
+
+// closeSecureChannel(sessionId)
+
+
+#endif /* OPCUA_SERVERAPI_H_ */