diff options
Diffstat (limited to 'openbsc/include/openbsc/gsm_sup.h')
-rw-r--r-- | openbsc/include/openbsc/gsm_sup.h | 43 |
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 */ |