Shared skeleton for the three Role C gateway service binaries - see gateway_c_common.h. Lifted verbatim from the old single gateway_c.c: only the "call all three handlers" sites became "call this service's one handler" (via gateway_c_service_def_t), and the version-banner / arg-parse from the old main_c.c folded into gateway_c_main().
More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "rte/app/appmanager/rte_appmanager.h"
#include "rte/core/rte_core_version.h"
#include "rte/oal/log/rte_log.h"
#include "rte/oal/memory/rte_mem_util.h"
#include "rte/posix_osadapter/rte_posix_osadapter_channel_service.h"
#include "rte/utils/safestate/rte_safestate.h"
#include "common/app_main_common.h"
#include "common/common_config.h"
#include "common/rbc_util_frame.h"
#include "gateway_c_common.h"
#include "gateway_c_selfstatus.h"
#include "gateway_c_config.h"
#include "gateway_c_types.h"
#include "gateway_c_util.h"
#include "rte_rbc2oo2_version.h"
Go to the source code of this file.
|
| static rte_status_t | gateway_c_shutdown (void *context) |
| static rte_status_t | resolve_channel_c (const char *name, rte_netlink_config_t *config, void *context) |
| static void | cycle_tick_callback (rte_timer_handle_t handle, void *user_ctx) |
| static rte_status_t | gateway_c_init (void *context) |
| static void | gateway_c_check_channel_down_reboot (gateway_c_context_t *ctx, rte_timestamp_ms_t now_ms) |
| static rte_status_t | gateway_c_execute (void *context) |
| static const char * | gateway_c_get_name (void) |
| static const char * | gateway_c_get_version (void) |
| static rte_appmanager_config_t | gateway_c_common_make_config (rte_example_site_t site, const gateway_c_service_def_t *svc) |
| int | gateway_c_main (int argc, char **argv, const gateway_c_service_def_t *svc) |
| | Full process entry for a Role C gateway service: prints the version banner, parses argv[1] as {WEST|EAST}, runs app_main_common_init(), then rte_appmanager_run() with a config built from svc. Call once from main().
|
| static uint64_t | gateway_c_hash_bytes (const uint8_t *bytes, size_t size) |
| void | gateway_c_dedup_init (gateway_c_dedup_t *dedup) |
| | Initialize a first-arrival deduplication tracker.
|
| bool | gateway_c_dedup_check_and_record (gateway_c_dedup_t *dedup, const uint8_t *bytes, size_t size) |
| | Check if bytes was already forwarded within the expiry window. If not seen, records bytes with current monotonic timestamp.
|
Shared skeleton for the three Role C gateway service binaries - see gateway_c_common.h. Lifted verbatim from the old single gateway_c.c: only the "call all three handlers" sites became "call this service's one handler" (via gateway_c_service_def_t), and the version-banner / arg-parse from the old main_c.c folded into gateway_c_main().
Definition in file gateway_c_common.c.
◆ gateway_c_shutdown()
| rte_status_t gateway_c_shutdown |
( |
void * | context | ) |
|
|
static |
◆ resolve_channel_c()
| rte_status_t resolve_channel_c |
( |
const char * | name, |
|
|
rte_netlink_config_t * | config, |
|
|
void * | context ) |
|
static |
◆ cycle_tick_callback()
| void cycle_tick_callback |
( |
rte_timer_handle_t | handle, |
|
|
void * | user_ctx ) |
|
static |
◆ gateway_c_init()
| rte_status_t gateway_c_init |
( |
void * | context | ) |
|
|
static |
◆ gateway_c_check_channel_down_reboot()
| void gateway_c_check_channel_down_reboot |
( |
gateway_c_context_t * | ctx, |
|
|
rte_timestamp_ms_t | now_ms ) |
|
static |
◆ gateway_c_execute()
| rte_status_t gateway_c_execute |
( |
void * | context | ) |
|
|
static |
◆ gateway_c_get_name()
| const char * gateway_c_get_name |
( |
void | | ) |
|
|
static |
◆ gateway_c_get_version()
| const char * gateway_c_get_version |
( |
void | | ) |
|
|
static |
◆ gateway_c_common_make_config()
◆ gateway_c_main()
Full process entry for a Role C gateway service: prints the version banner, parses argv[1] as {WEST|EAST}, runs app_main_common_init(), then rte_appmanager_run() with a config built from svc. Call once from main().
- Parameters
-
| argc | From main(). |
| argv | From main(); argv[1] must be "WEST" or "EAST". |
| svc | This service's definition. Must not be NULL; all its mandatory function-pointer fields must be set. |
- Returns
- Process exit code (0 on clean shutdown, 1 on any setup failure).
Definition at line 376 of file gateway_c_common.c.
◆ gateway_c_hash_bytes()
| uint64_t gateway_c_hash_bytes |
( |
const uint8_t * | bytes, |
|
|
size_t | size ) |
|
static |
◆ gateway_c_dedup_init()
◆ gateway_c_dedup_check_and_record()
| bool gateway_c_dedup_check_and_record |
( |
gateway_c_dedup_t * | dedup, |
|
|
const uint8_t * | bytes, |
|
|
size_t | size ) |
Check if bytes was already forwarded within the expiry window. If not seen, records bytes with current monotonic timestamp.
- Returns
- true if duplicate (drop it); false if first arrival (forward it).
Definition at line 438 of file gateway_c_common.c.
◆ g_c_ctx
◆ g_svc