You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

39 lines
1.7 KiB

// etcp_loadbalancer.h - Load Balancer for ETCP Channels
#ifndef ETCP_LOADBALANCER_H
#define ETCP_LOADBALANCER_H
#include "etcp.h"
#ifdef __cplusplus
extern "C" {
#endif
// Constants (moved here for visibility)
#define TIMEBASE_NS 100000ULL // 0.1ms base
#define SUB_MODULO 1000000ULL // Sub-nanotime modulo
#define DELTA_TIME_NS 10000ULL // Delta for inactivity
#define SHAPER_BURST_DELAY_TB 10ULL // 10 = 1ms burst allowance
// при формировании пакета - выбрать линк для передачи
// должен либо возвращать линк который готов забрать пакет, либо возвратить NULL если все линки заняты.
struct ETCP_LINK* etcp_loadbalancer_select_link(struct ETCP_CONN* etcp);
// Когда линк снова ready (timer или link_ready) - loadbalancer должен вызвать ETCP_CONN->packet_request_fn(etcp)
//void etcp_loadbalancer_update_after_send(struct ETCP_LINK* link, size_t pkt_size); - это надо заменить на:
void etcp_loadbalancer_send(struct ETCP_DGRAM* dgram);
// сообщаем в loadbalancer о готовности линка (вызывается из таймера, ACK, изменения лимита)
void loadbalancer_link_ready(struct ETCP_LINK* link);
// проверяет все условия блокировки отправки (включая inflight_bytes)
int loadbalancer_link_can_send(struct ETCP_LINK* link);
// Получить состояние связи ETCP: 1 - есть живой линк, 0 - все недоступны
int etcp_loadbalancer_get_link_status(struct ETCP_CONN* etcp);
#ifdef __cplusplus
}
#endif
#endif // ETCP_LOADBALANCER_H