From 375c37350ecb7ce600fddc6245842476da461054 Mon Sep 17 00:00:00 2001 From: "julien.delange" Date: Thu, 29 Apr 2010 11:24:17 +0000 Subject: [PATCH] * begin to separate sockets stuff with the other services git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/po-hi-c@512 129961e7-ef38-4bb5-a8f7-c9a525a55882 --- include/Makefile.am | 1 + include/po_hi_protocols.h | 6 +++--- include/po_hi_transport.h | 2 ++ share/make/Makefile.common | 12 +++++++++++- src/po_hi_main.c | 15 +++++++++------ src/po_hi_transport_sockets.c | 13 +------------ 6 files changed, 27 insertions(+), 22 deletions(-) diff --git a/include/Makefile.am b/include/Makefile.am index ec03618..c4ab94e 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -14,6 +14,7 @@ EXTRA_DIST = $(srcdir)/po_hi_common.h \ $(srcdir)/po_hi_types.h \ $(srcdir)/po_hi_main.h \ $(srcdir)/po_hi_simulink.h \ + $(srcdir)/po_hi_transport_sockets.h \ $(srcdir)/po_hi_transport.h CLEANFILES = *~ diff --git a/include/po_hi_protocols.h b/include/po_hi_protocols.h index 8306bb8..9b02b7c 100644 --- a/include/po_hi_protocols.h +++ b/include/po_hi_protocols.h @@ -17,12 +17,12 @@ #include #include -#define __PO_HI_NOPORT 1 -#define __PO_HI_NOADDR "" - typedef __po_hi_uint16_t __po_hi_inetport_t; typedef char* __po_hi_inetaddr_t; +#define __PO_HI_NOPORT 1 +#define __PO_HI_NOADDR "" + int __po_hi_protocols_send (__po_hi_entity_t from, __po_hi_entity_t to, __po_hi_msg_t* msg); diff --git a/include/po_hi_transport.h b/include/po_hi_transport.h index a7d6815..d1ea305 100644 --- a/include/po_hi_transport.h +++ b/include/po_hi_transport.h @@ -12,6 +12,7 @@ #define __PO_HI_TRANSPORT__ #include +#include #include #include @@ -65,4 +66,5 @@ int __po_hi_transport_low_level_send (__po_hi_entity_t from, * which is sent. */ + #endif /* __PO_HI_TRANSPORT__ */ diff --git a/share/make/Makefile.common b/share/make/Makefile.common index dfaa74d..1dba88d 100644 --- a/share/make/Makefile.common +++ b/share/make/Makefile.common @@ -31,13 +31,23 @@ CPPFLAGS=$(CFLAGS) $(USER_CPPFLAGS) LDFLAGS=$(TARGET_LDFLAGS) $(USER_LDFLAGS) ifdef TARGET_INCLUDE -INCLUDE=-I. -I$(USER_SOURCES_DIRS) -I$(RUNTIME_PATH)/include/ $(TARGET_INCLUDE) +INCLUDE=-I. -I$(RUNTIME_PATH)/include/ $(TARGET_INCLUDE) else INCLUDE=-I. -I$(RUNTIME_PATH)/include/ endif +ifdef USER_SOURCES_DIRS +INCLUDE+=-I$(USER_SOURCES_DIRS) +endif + INCLUDE+=$(USER_INCLUDE) +ifndef $(TARGET_NAME) +TARGET_NAME=$(TARGET) +endif + +INCLUDE+=-DTARGET=$(TARGET_NAME) + ################################################################################ # Files to be compiled diff --git a/src/po_hi_main.c b/src/po_hi_main.c index 2f52f6c..2d77a27 100644 --- a/src/po_hi_main.c +++ b/src/po_hi_main.c @@ -9,19 +9,22 @@ */ #include +/* POSIX files */ -/* system-dependent included files */ +#include +/* included files from the generated code */ #include #include #include #include -/* included files from PolyORB-HI-C */ -#include -/* included files from the generated code */ +#if __PO_HI_NB_NODES > 1 +#include +#include +#endif -int __po_hi_transport_need_receiver_task(); +/* included files from PolyORB-HI-C */ void __po_hi_initialize_transport (); pthread_cond_t cond_init; @@ -43,7 +46,7 @@ int __po_hi_initialize () nb_tasks_to_init = __PO_HI_NB_TASKS + 1; #if __PO_HI_NB_NODES > 1 - if (__po_hi_transport_need_receiver_task()) + if (__PO_HI_TRANSPORT_SOCKET_NEED_RECEIVER_TASK ()) { nb_tasks_to_init++; } diff --git a/src/po_hi_transport_sockets.c b/src/po_hi_transport_sockets.c index 1a3b44a..cc9aff1 100644 --- a/src/po_hi_transport_sockets.c +++ b/src/po_hi_transport_sockets.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -60,9 +61,6 @@ * See the files deployment.h and deployment.c. */ -extern __po_hi_inetport_t node_port[__PO_HI_NB_NODES]; -extern __po_hi_inetaddr_t node_addr[__PO_HI_NB_NODES]; -extern __po_hi_node_t mynode; extern __po_hi_node_t entity_table[__PO_HI_NB_ENTITIES]; /* @@ -473,12 +471,3 @@ void* __po_hi_receiver_task (void) return NULL; } -int __po_hi_transport_need_receiver_task () -{ - if ((__PO_HI_NB_NODES > 1) && (node_port[mynode] != __PO_HI_NOPORT)) - { - return 1; - } - - return 0; -} -- GitLab