aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/include/openbsc/gsm_sup.h
diff options
context:
space:
mode:
authorIvan Klyuchnikov <kluchnikovi@gmail.com>2018-05-21 19:25:30 +0300
committerIvan Kluchnikov <kluchnikovi@gmail.com>2018-05-21 19:39:33 +0300
commitfd87ede9e9164de79c04e2fdb3a7e4a2c41cc4a4 (patch)
tree637245e9f2b5a2422cffdd058e553ae8a4f20e58 /openbsc/include/openbsc/gsm_sup.h
parentc2891e441cfdbbc23e302f42a986014d052b7975 (diff)
sms charging: Implement SMS online ECUR charging based on 3GPP TS 32.274
Event Charging with Unit Reservation (ECUR) principle is used for SMS online charging in osmo-nitb. Osmo-nitb generates Reserve Units information which is transferred to OCS. For this purpose, osmo-nitb utilizes the Reserve Units procedure that is specified in TS 32.274 and TS 32.299. The Reserve Units procedure employs the Reserve Units Request and Reserve Units Response messages. Change-Id: I12b681f65cdcdb281da04b49a63ceb140be7e643
Diffstat (limited to 'openbsc/include/openbsc/gsm_sup.h')
-rw-r--r--openbsc/include/openbsc/gsm_sup.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/gsm_sup.h b/openbsc/include/openbsc/gsm_sup.h
index 26017365d..2b2315a4d 100644
--- a/openbsc/include/openbsc/gsm_sup.h
+++ b/openbsc/include/openbsc/gsm_sup.h
@@ -11,6 +11,44 @@
(subscr) ? (subscr)->imsi : "---", \
## args)
+#define LOGGSESSIONP(level, session_id, fmt, args...) \
+ LOGP(DSUP, level, "SESSION(%d:%d) " fmt, \
+ session_id.h, session_id.l, \
+ ## args)
+
+/* TODO move libosmocore */
+enum osmo_gsup_charging_message_type {
+ OSMO_GSUP_MSGT_RESERVE_UNITS_REQUEST = 0b00100000,
+ OSMO_GSUP_MSGT_RESERVE_UNITS_RESPONSE = 0b00100010,
+};
+enum osmo_gsup_charging_request_type {
+ OSMO_GSUP_MSGT_REQUEST_TYPE_INITIAL = 0b00000001,
+ OSMO_GSUP_MSGT_REQUEST_TYPE_UPDATE = 0b00000010,
+ OSMO_GSUP_MSGT_REQUEST_TYPE_TERMINATION = 0b00000011,
+ OSMO_GSUP_MSGT_REQUEST_TYPE_EVENT = 0b00000100,
+};
+enum osmo_charging_service_type {
+ OSMO_CHARGING_SERVICE_TYPE_SMS = 0b00000001,
+};
+
+enum osmo_charging_result_code {
+ OSMO_CHARGING_RESULT_CODE_SUCCESS = 2001,
+ OSMO_CHARGING_RESULT_CODE_CREDIT_LIMIT_REACHED = 4012,
+};
+
+struct osmo_gsup_reserve_units_response {
+ /* Message type: [Pres: M] [Format: V] [Length: 1] */
+ uint8_t message_type;
+ /* Session id: [Pres: M] [Format: V] [Length: 8] */
+ struct charging_session_id session_id;
+ /* Request type: [Pres: M] [Format: V] [Length: 1] */
+ uint8_t request_type;
+ /* Result code: [Pres: M] [Format: V] [Length: 4] */
+ uint32_t result_code;
+ /* Service units: [Pres: O] [Format: V] [Length: 4] */
+ uint32_t service_units;
+};
+
/* Callback for both HLR/auth and USSD SUP sockets */
int sup_read_cb(struct gsup_client *sup_client, struct msgb *msg);
@@ -26,4 +64,9 @@ int subscr_tx_sms_message(struct gsm_subscriber *subscr,
void init_charging_session_id(struct gsm_network *network);
struct charging_session_id get_charging_session_id(struct gsm_network *network);
+int tx_reserve_units_request(enum osmo_gsup_charging_message_type msg_type,
+ enum osmo_gsup_charging_request_type request_type,
+ enum osmo_charging_service_type service_type,
+ struct gsm_trans *trans, uint32_t service_units);
+
#endif /* _GSM_SUP_H */