Bladeren bron

Fix pubsub includes

Mark Giraud 5 jaren geleden
bovenliggende
commit
578dc5fd37

+ 1 - 0
examples/pubsub/tutorial_pubsub_publish.c

@@ -28,6 +28,7 @@
 #include <ua_config_default.h>
 #include <ua_log_stdout.h>
 #include <ua_network_pubsub_udp.h>
+#include <ua_network_pubsub_ethernet.h>
 
 #include <signal.h>
 

+ 16 - 0
include/ua_util.h

@@ -55,6 +55,22 @@ UA_StatusCode UA_EXPORT
 UA_parseEndpointUrlEthernet(const UA_String *endpointUrl, UA_String *target,
                             UA_UInt16 *vid, UA_Byte *pcp);
 
+/* Convert given byte string to a positive number. Returns the number of valid
+ * digits. Stops if a non-digit char is found and returns the number of digits
+ * up to that point. */
+size_t UA_readNumber(UA_Byte *buf, size_t buflen, UA_UInt32 *number);
+
+/* Same as UA_ReadNumber but with a base parameter */
+size_t UA_readNumberWithBase(UA_Byte *buf, size_t buflen, UA_UInt32 *number, UA_Byte base);
+
+#ifndef UA_MIN
+#define UA_MIN(A,B) (A > B ? B : A)
+#endif
+
+#ifndef UA_MAX
+#define UA_MAX(A,B) (A > B ? A : B)
+#endif
+
 /**
  * Convenience macros for complex types
  * ------------------------------------ */

+ 0 - 1
plugins/networking/ua_network_pubsub_ethernet.c

@@ -13,7 +13,6 @@
 #include <linux/if_packet.h>
 
 #include "ua_network_pubsub_ethernet.h"
-#include "ua_util_internal.h"
 
 #ifndef ETHERTYPE_UADP
 #define ETHERTYPE_UADP  0xb62c

+ 3 - 3
src/ua_util.c

@@ -7,13 +7,13 @@
  *    Copyright 2017 (c) Stefan Profanter, fortiss GmbH
  */
 
+#include "ua_types_generated_handling.h"
 #include "ua_util.h"
 #include "ua_util_internal.h"
-#include "ua_plugin_network.h"
 #include "base64.h"
 
 size_t
-UA_readNumberWithBase(u8 *buf, size_t buflen, u32 *number, u8 base) {
+UA_readNumberWithBase(UA_Byte *buf, size_t buflen, UA_UInt32 *number, UA_Byte base) {
     UA_assert(buf);
     UA_assert(number);
     u32 n = 0;
@@ -36,7 +36,7 @@ UA_readNumberWithBase(u8 *buf, size_t buflen, u32 *number, u8 base) {
 }
 
 size_t
-UA_readNumber(u8 *buf, size_t buflen, u32 *number)
+UA_readNumber(UA_Byte *buf, size_t buflen, UA_UInt32 *number)
 {
     return UA_readNumberWithBase(buf, buflen, number, 10);
 }

+ 1 - 16
src/ua_util_internal.h

@@ -15,6 +15,7 @@
 #define UA_UTIL_H_
 
 #define UA_INTERNAL
+#include "ua_util.h"
 #include "ua_types.h"
 
 _UA_BEGIN_DECLS
@@ -40,22 +41,6 @@ typedef UA_StatusCode status;
 /* Utility Functions
  * ----------------- */
 
-/* Convert given byte string to a positive number. Returns the number of valid
- * digits. Stops if a non-digit char is found and returns the number of digits
- * up to that point. */
-size_t UA_readNumber(u8 *buf, size_t buflen, u32 *number);
-
-/* Same as UA_ReadNumber but with a base parameter */
-size_t UA_readNumberWithBase(u8 *buf, size_t buflen, u32 *number, u8 base);
-
-#ifndef UA_MIN
-#define UA_MIN(A,B) (A > B ? B : A)
-#endif
-
-#ifndef UA_MAX
-#define UA_MAX(A,B) (A > B ? A : B)
-#endif
-
 #ifdef UA_DEBUG_DUMP_PKGS
 void UA_EXPORT UA_dump_hex_pkg(UA_Byte* buffer, size_t bufferLen);
 #endif