summaryrefslogtreecommitdiff
path: root/include/hybbx/bandwidth_policy.h
blob: 6c12296b2ddd3b1ad5a1005dc8882b47ef33ecb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef HYBBX_BANDWIDTH_POLICY_H
#define HYBBX_BANDWIDTH_POLICY_H

/**
 * Per-user bandwidth limits when a low-bandwidth circuit link is under pressure.
 * Circuit (secondary) sessions are never targeted. Among users, AX.25 sessions
 * are sacrificed before full-duplex TCP/telnet; within each class, newest first.
 */

#include "hybbx/circuit_balance.h"
#include "hybbx/types.h"

#ifdef __cplusplus
extern "C" {
#endif

#define HYBBX_BANDWIDTH_DISCONNECT_MSG "You are disconnected by bandwidth limits."

struct hybbx_service;

/** Logged-in telnet and packet_radio users subject to limits (not circuit links). */
unsigned hybbx_bandwidth_policy_user_count(struct hybbx_service *service);

/**
 * Apply pause / break / cancel / resume to online users (AX.25 before TCP, then LIFO).
 * Circuit (secondary) sessions are never targeted. Returns users affected.
 */
unsigned hybbx_bandwidth_policy_apply(struct hybbx_service *service,
                                      hybbx_circuit_balance_action_t action);

#ifdef __cplusplus
}
#endif

#endif /* HYBBX_BANDWIDTH_POLICY_H */
git clone -b <branch> https://cgit.mode42.com/<repo>.git
git clone -b <branch> git://cgit.mode42.com/<repo>.git

info@mode42.com