LibJuno 1.0.4
LibJuno is a lightweight C11 library designed specifically for embedded systems.
Loading...
Searching...
No Matches
main.cpp File Reference

Composition root for the udp-threads example. More...

#include "juno/sch/juno_sch_api.h"
#include "juno/sb/broker_api.h"
#include "juno/thread_linux.h"
#include "udp_linux.h"
#include "udp_msg_api.h"
#include "sender_app.h"
#include "monitor_app.h"
#include "udp_bridge_app.h"
#include "processor_app.h"
#include "juno/status.h"
#include <unistd.h>
Include dependency graph for main.cpp:

Functions

static JUNO_STATUS_T SchExecute (JUNO_SCH_ROOT_T *ptSch)
 
static void * Thread1Entry (void *pvArg)
 
static void * Thread2Entry (void *pvArg)
 
int main (void)
 

Variables

static const JUNO_SCH_API_T s_tSchApi = { SchExecute, NULL, NULL }
 
static JUNO_THREAD_T s_tThread1
 
static JUNO_THREAD_T s_tThread2
 
static JUNO_SCH_ROOT_T s_tSch1
 
static JUNO_SCH_ROOT_T s_tSch2
 
static JUNO_SB_BROKER_ROOT_T s_tBroker1
 
static JUNO_SB_BROKER_ROOT_T s_tBroker2
 
static JUNO_SB_PIPE_Ts_aptBroker1Registry [2u]
 
static JUNO_SB_PIPE_Ts_aptBroker2Registry [2u]
 
static JUNO_UDP_T s_tUdpSender
 
static JUNO_UDP_T s_tUdpReceiver
 
static UDPTH_MSG_ARRAY_T s_tMsgArray1
 
static UDPTH_MSG_ARRAY_T s_tMsgArray2
 
static SENDER_APP_T s_tSenderApp
 
static MONITOR_APP_T s_tMonitorApp
 
static UDP_BRIDGE_APP_T s_tBridgeApp
 
static PROCESSOR_APP_T s_tProcessorApp
 
static JUNO_APP_ROOT_Ts_arrSchTable1 [2u]
 
static JUNO_APP_ROOT_Ts_arrSchTable2 [2u]
 
static const JUNO_UDP_CFG_T s_tSenderCfg = { "127.0.0.1", 9000u, false }
 
static const JUNO_UDP_CFG_T s_tReceiverCfg = { "0.0.0.0", 9000u, true }
 

Detailed Description

Composition root for the udp-threads example.

Owns all static module instances. Wires dependencies bottom-up, spawns two POSIX threads (each with its own scheduler, broker, and applications), runs for 10 seconds, then performs cooperative shutdown.

Thread 1: SenderApp + MonitorApp via s_tSch1 and s_tBroker1. Thread 2: UdpBridgeApp + ProcessorApp via s_tSch2 and s_tBroker2.

No dynamic allocation. No global mutable state beyond the static instances declared here (which are owned exclusively by this translation unit).

Function Documentation

◆ main()

int main ( void  )

◆ SchExecute()

static JUNO_STATUS_T SchExecute ( JUNO_SCH_ROOT_T ptSch)
static

◆ Thread1Entry()

static void * Thread1Entry ( void *  pvArg)
static

◆ Thread2Entry()

static void * Thread2Entry ( void *  pvArg)
static

Variable Documentation

◆ s_aptBroker1Registry

JUNO_SB_PIPE_T* s_aptBroker1Registry[2u]
static

◆ s_aptBroker2Registry

JUNO_SB_PIPE_T* s_aptBroker2Registry[2u]
static

◆ s_arrSchTable1

JUNO_APP_ROOT_T* s_arrSchTable1[2u]
static

◆ s_arrSchTable2

JUNO_APP_ROOT_T* s_arrSchTable2[2u]
static

◆ s_tBridgeApp

UDP_BRIDGE_APP_T s_tBridgeApp
static

◆ s_tBroker1

JUNO_SB_BROKER_ROOT_T s_tBroker1
static

◆ s_tBroker2

JUNO_SB_BROKER_ROOT_T s_tBroker2
static

◆ s_tMonitorApp

MONITOR_APP_T s_tMonitorApp
static

◆ s_tMsgArray1

UDPTH_MSG_ARRAY_T s_tMsgArray1
static

◆ s_tMsgArray2

UDPTH_MSG_ARRAY_T s_tMsgArray2
static

◆ s_tProcessorApp

PROCESSOR_APP_T s_tProcessorApp
static

◆ s_tReceiverCfg

const JUNO_UDP_CFG_T s_tReceiverCfg = { "0.0.0.0", 9000u, true }
static

◆ s_tSch1

JUNO_SCH_ROOT_T s_tSch1
static

◆ s_tSch2

JUNO_SCH_ROOT_T s_tSch2
static

◆ s_tSchApi

const JUNO_SCH_API_T s_tSchApi = { SchExecute, NULL, NULL }
static

◆ s_tSenderApp

SENDER_APP_T s_tSenderApp
static

◆ s_tSenderCfg

const JUNO_UDP_CFG_T s_tSenderCfg = { "127.0.0.1", 9000u, false }
static

◆ s_tThread1

JUNO_THREAD_T s_tThread1
static

◆ s_tThread2

JUNO_THREAD_T s_tThread2
static

◆ s_tUdpReceiver

JUNO_UDP_T s_tUdpReceiver
static

◆ s_tUdpSender

JUNO_UDP_T s_tUdpSender
static