API Reference
This section catalogs the primary interfaces exposed by the server.micro.bss platform.
gRPC Services (CRMServer)
The CRM Server (src/crm/crm_server.cpp) provides endpoints defined in the .proto schemas for backend-to-backend communication. The CRM frontend sends serialized requests, which are handled by the C++ CRMServiceImpl.
Core Management APIs
| Endpoint | Request Message | Response Message | Description |
|---|---|---|---|
AddSubscriber |
billing::Subscriber |
billing::CRMResponse |
Provisions a new MSISDN with a default price plan and optional initial balance. |
UpdateSubscriber |
billing::Subscriber |
billing::CRMResponse |
Modifies an existing subscriber's status (e.g., active, suspended) or price plan assignment. |
GetSubscriber |
billing::QueryRequest |
billing::Subscriber |
Retrieves the full demographic, balance, and lifecycle state of a target MSISDN. |
GenerateBill |
billing::QueryRequest |
billing::CRMResponse |
Triggers an on-demand bill run for a specific MSISDN, forcing the rating of all pending CDRs up to the current timestamp. |
TopUpVoucher |
billing::VoucherRequest |
billing::CRMResponse |
Validates a 16-digit voucher PIN against the DB, credits the subscriber's balance, and marks the voucher as used. |
Authentication Requirement
Every gRPC invocation must include a valid JSON Web Token (JWT) in the request metadata. The auth_interceptor.hpp middleware enforces this prior to routing to the implementation methods.
Internal C++ APIs
The following details the core C++ signatures responsible for business execution, adapted from their source Doxygen definitions.
Database Layer (db.hpp)
DB_layer implements the raw CRUD logic utilizing MySQL X DevAPI.
| Method | Parameters | Returns | Description |
|---|---|---|---|
insert(billing::CDR &cdr) |
cdr: The deserialized CDR object |
int: 0 on success, -1 on error |
Inserts a new pending Call Detail Record into the ledger. |
reserve_balance(billing::Subscriber &sub, float amount) |
sub: Mutable subscriber passed by referenceamount: Euro value to lock |
int: 0 on success, -1 on DB lock/error |
Locks funds during an active DIAMETER session to prevent double-spending. |
debit_balance(billing::Subscriber &sub, float amount) |
sub: Mutable subscriber passed by referenceamount: Final Euro value to deduct |
int: 0 on success, -1 on DB error |
Finalizes a charge, permanently deducting the amount from the subscriber's main balance. |
Credit Control (diameter_client.hpp)
The MockDiameterClient and DiameterClientConfig are utilities used for generating and handling test traffic simulating GGSN/PGW nodes.
| Object | Type | Description |
|---|---|---|
MockDiameterClient |
Service Class | Sends dummy CCR-INITIAL, CCR-UPDATE, and CCR-TERMINATE requests to validate rating rules without needing a live telco switch. |
Data Models (cdr.hpp, subscriber.hpp)
The domain entities support custom protocol buffer serialization interfaces.
| Model | Method | Returns | Description |
|---|---|---|---|
CDR / Subscriber |
deserialize(const string &) |
int: 1 on success, 0 on failure |
Parses the target entity from a binary string. Fails gracefully by returning 0 allowing callers to handle bad input without crashing. |
CDR / Subscriber |
serialize(string &) |
int: 1 on success, 0 on failure |
Serializes the entity. Certain critical callers may perform a graceful shutdown (std::raise(SIGTERM)) on failure to avoid data consistency issues. |