Harald Welte | 6eafe91 | 2009-10-16 08:32:58 +0200 | [diff] [blame] | 1 | #ifndef _GSM_04_80_H |
| 2 | #define _GSM_04_80_H |
| 3 | |
| 4 | /* GSM TS 04.80 definitions (Supplementary Services Specification, Formats and Coding) */ |
| 5 | |
| 6 | /* Section 3.4 */ |
| 7 | #define GSM0480_MTYPE_RELEASE_COMPLETE 0x2A |
| 8 | #define GSM0480_MTYPE_FACILITY 0x3A |
| 9 | #define GSM0480_MTYPE_REGISTER 0x3B |
| 10 | |
| 11 | /* Section 3.5 */ |
| 12 | #define GSM0480_IE_FACILITY 0x1C |
| 13 | #define GSM0480_IE_SS_VERSION 0x7F |
| 14 | |
| 15 | /* Section 3.6.2 */ |
| 16 | #define GSM0480_CTYPE_INVOKE 0xA1 |
| 17 | #define GSM0480_CTYPE_RETURN_RESULT 0xA2 |
| 18 | #define GSM0480_CTYPE_RETURN_ERROR 0xA3 |
| 19 | #define GSM0480_CTYPE_REJECT 0xA4 |
| 20 | |
| 21 | /* Section 3.6.3 */ |
| 22 | #define GSM0480_COMPIDTAG_INVOKE_ID 0x02 |
| 23 | #define GSM0480_COMPIDTAG_LINKED_ID 0x80 |
| 24 | |
| 25 | /* Section 3.6.4 */ |
| 26 | #define GSM0480_OPERATION_CODE 0x02 |
| 27 | |
| 28 | /* Section 3.6.5 */ |
| 29 | #define GSM_0480_SEQUENCE_TAG 0x30 |
| 30 | #define GSM_0480_SET_TAG 0x31 |
| 31 | |
| 32 | /* Section 3.6.6 */ |
| 33 | #define GSM_0480_ERROR_CODE_TAG 0x02 |
| 34 | |
| 35 | /* Section 3.6.7 */ |
| 36 | /* Table 3.13 */ |
| 37 | #define GSM_0480_PROBLEM_CODE_TAG_GENERAL 0x80 |
| 38 | #define GSM_0480_PROBLEM_CODE_TAG_INVOKE 0x81 |
| 39 | #define GSM_0480_PROBLEM_CODE_TAG_RETURN_RESULT 0x82 |
| 40 | #define GSM_0480_PROBLEM_CODE_TAG_RETURN_ERROR 0x83 |
| 41 | |
| 42 | /* Table 3.14 */ |
| 43 | #define GSM_0480_GEN_PROB_CODE_UNRECOGNISED 0x00 |
| 44 | #define GSM_0480_GEN_PROB_CODE_MISTYPED 0x01 |
| 45 | #define GSM_0480_GEN_PROB_CODE_BAD_STRUCTURE 0x02 |
| 46 | |
| 47 | /* Table 3.15 */ |
| 48 | #define GSM_0480_INVOKE_PROB_CODE_DUPLICATE_INVOKE_ID 0x00 |
| 49 | #define GSM_0480_INVOKE_PROB_CODE_UNRECOGNISED_OPERATION 0x01 |
| 50 | #define GSM_0480_INVOKE_PROB_CODE_MISTYPED_PARAMETER 0x02 |
| 51 | #define GSM_0480_INVOKE_PROB_CODE_RESOURCE_LIMITATION 0x03 |
| 52 | #define GSM_0480_INVOKE_PROB_CODE_INITIATING_RELEASE 0x04 |
| 53 | #define GSM_0480_INVOKE_PROB_CODE_UNRECOGNISED_LINKED_ID 0x05 |
| 54 | #define GSM_0480_INVOKE_PROB_CODE_UNEXPECTED_LINKED_RESPONSE 0x06 |
| 55 | #define GSM_0480_INVOKE_PROB_CODE_UNEXPECTED_LINKED_OPERATION 0x07 |
| 56 | |
| 57 | /* Table 3.16 */ |
| 58 | #define GSM_0480_RESULT_PROB_CODE_UNRECOGNISED_INVOKE_ID 0x00 |
| 59 | #define GSM_0480_RESULT_PROB_CODE_RETURN_RESULT_UNEXPECTED 0x01 |
| 60 | #define GSM_0480_RESULT_PROB_CODE_MISTYPED_PARAMETER 0x02 |
| 61 | |
| 62 | /* Table 3.17 */ |
| 63 | #define GSM_0480_ERROR_PROB_CODE_UNRECOGNISED_INVOKE_ID 0x00 |
| 64 | #define GSM_0480_ERROR_PROB_CODE_RETURN_ERROR_UNEXPECTED 0x01 |
| 65 | #define GSM_0480_ERROR_PROB_CODE_UNRECOGNISED_ERROR 0x02 |
| 66 | #define GSM_0480_ERROR_PROB_CODE_UNEXPECTED_ERROR 0x03 |
| 67 | #define GSM_0480_ERROR_PROB_CODE_MISTYPED_PARAMETER 0x04 |
| 68 | |
| 69 | /* Section 4.5 */ |
| 70 | #define GSM0480_OP_CODE_REGISTER_SS 0x0A |
| 71 | #define GSM0480_OP_CODE_ERASE_SS 0x0B |
| 72 | #define GSM0480_OP_CODE_ACTIVATE_SS 0x0C |
| 73 | #define GSM0480_OP_CODE_DEACTIVATE_SS 0x0D |
| 74 | #define GSM0480_OP_CODE_INTERROGATE_SS 0x0E |
| 75 | #define GSM0480_OP_CODE_NOTIFY_SS 0x10 |
| 76 | #define GSM0480_OP_CODE_REGISTER_PASSWORD 0x11 |
| 77 | #define GSM0480_OP_CODE_GET_PASSWORD 0x12 |
| 78 | #define GSM0480_OP_CODE_PROCESS_USS_DATA 0x13 |
| 79 | #define GSM0480_OP_CODE_FORWARD_CHECK_SS_IND 0x26 |
| 80 | #define GSM0480_OP_CODE_PROCESS_USS_REQ 0x3B |
| 81 | #define GSM0480_OP_CODE_USS_REQUEST 0x3C |
| 82 | #define GSM0480_OP_CODE_USS_NOTIFY 0x3D |
| 83 | #define GSM0480_OP_CODE_FORWARD_CUG_INFO 0x78 |
| 84 | #define GSM0480_OP_CODE_SPLIT_MPTY 0x79 |
| 85 | #define GSM0480_OP_CODE_RETRIEVE_MPTY 0x7A |
| 86 | #define GSM0480_OP_CODE_HOLD_MPTY 0x7B |
| 87 | #define GSM0480_OP_CODE_BUILD_MPTY 0x7C |
| 88 | #define GSM0480_OP_CODE_FORWARD_CHARGE_ADVICE 0x7D |
| 89 | |
| 90 | #define GSM0480_ERR_CODE_UNKNOWN_SUBSCRIBER 0x01 |
| 91 | #define GSM0480_ERR_CODE_ILLEGAL_SUBSCRIBER 0x09 |
| 92 | #define GSM0480_ERR_CODE_BEARER_SERVICE_NOT_PROVISIONED 0x0A |
| 93 | #define GSM0480_ERR_CODE_TELESERVICE_NOT_PROVISIONED 0x0B |
| 94 | #define GSM0480_ERR_CODE_ILLEGAL_EQUIPMENT 0x0C |
| 95 | #define GSM0480_ERR_CODE_CALL_BARRED 0x0D |
| 96 | #define GSM0480_ERR_CODE_ILLEGAL_SS_OPERATION 0x10 |
| 97 | #define GSM0480_ERR_CODE_SS_ERROR_STATUS 0x11 |
| 98 | #define GSM0480_ERR_CODE_SS_NOT_AVAILABLE 0x12 |
| 99 | #define GSM0480_ERR_CODE_SS_SUBSCRIPTION_VIOLATION 0x13 |
| 100 | #define GSM0480_ERR_CODE_SS_INCOMPATIBILITY 0x14 |
| 101 | #define GSM0480_ERR_CODE_FACILITY_NOT_SUPPORTED 0x15 |
| 102 | #define GSM0480_ERR_CODE_ABSENT_SUBSCRIBER 0x1B |
| 103 | #define GSM0480_ERR_CODE_SYSTEM_FAILURE 0x22 |
| 104 | #define GSM0480_ERR_CODE_DATA_MISSING 0x23 |
| 105 | #define GSM0480_ERR_CODE_UNEXPECTED_DATA_VALUE 0x24 |
| 106 | #define GSM0480_ERR_CODE_PW_REGISTRATION_FAILURE 0x25 |
| 107 | #define GSM0480_ERR_CODE_NEGATIVE_PW_CHECK 0x26 |
| 108 | #define GSM0480_ERR_CODE_NUM_PW_ATTEMPTS_VIOLATION 0x2B |
| 109 | #define GSM0480_ERR_CODE_UNKNOWN_ALPHABET 0x47 |
| 110 | #define GSM0480_ERR_CODE_USSD_BUSY 0x48 |
| 111 | #define GSM0480_ERR_CODE_MAX_MPTY_PARTICIPANTS 0x7E |
| 112 | #define GSM0480_ERR_CODE_RESOURCES_NOT_AVAILABLE 0x7F |
| 113 | |
| 114 | /* ASN.1 type-tags */ |
| 115 | #define ASN1_BOOLEAN_TAG 0x01 |
| 116 | #define ASN1_INTEGER_TAG 0x02 |
| 117 | #define ASN1_BIT_STRING_TAG 0x03 |
| 118 | #define ASN1_OCTET_STRING_TAG 0x04 |
| 119 | #define ASN1_NULL_TYPE_TAG 0x05 |
| 120 | #define ASN1_OBJECT_ID_TAG 0x06 |
| 121 | #define ASN1_UTF8_STRING_TAG 0x0C |
| 122 | #define ASN1_PRINTABLE_STRING_TAG 0x13 |
| 123 | #define ASN1_IA5_STRING_TAG 0x16 |
| 124 | #define ASN1_UNICODE_STRING_TAG 0x1E |
| 125 | |
Harald Welte | dfe6c7d | 2010-02-20 16:24:02 +0100 | [diff] [blame^] | 126 | #include <osmocore/msgb.h> |
Harald Welte | 6eafe91 | 2009-10-16 08:32:58 +0200 | [diff] [blame] | 127 | |
Mike Haben | 2449b37 | 2009-10-26 20:36:34 +0100 | [diff] [blame] | 128 | #define MAX_LEN_USSD_STRING 31 |
| 129 | |
Mike Haben | dc329a6 | 2009-10-22 09:56:44 +0200 | [diff] [blame] | 130 | struct ussd_request { |
Mike Haben | 2449b37 | 2009-10-26 20:36:34 +0100 | [diff] [blame] | 131 | char text[MAX_LEN_USSD_STRING + 1]; |
Mike Haben | dc329a6 | 2009-10-22 09:56:44 +0200 | [diff] [blame] | 132 | u_int8_t transaction_id; |
| 133 | u_int8_t invoke_id; |
| 134 | }; |
| 135 | |
Mike Haben | 2449b37 | 2009-10-26 20:36:34 +0100 | [diff] [blame] | 136 | int gsm0480_decode_ussd_request(const struct msgb *msg, |
Mike Haben | dc329a6 | 2009-10-22 09:56:44 +0200 | [diff] [blame] | 137 | struct ussd_request *request); |
Mike Haben | 2449b37 | 2009-10-26 20:36:34 +0100 | [diff] [blame] | 138 | int gsm0480_send_ussd_response(const struct msgb *in_msg, const char* response_text, |
Mike Haben | dc329a6 | 2009-10-22 09:56:44 +0200 | [diff] [blame] | 139 | const struct ussd_request *req); |
Mike Haben | 2449b37 | 2009-10-26 20:36:34 +0100 | [diff] [blame] | 140 | int gsm0480_send_ussd_reject(const struct msgb *msg, |
Mike Haben | dc329a6 | 2009-10-22 09:56:44 +0200 | [diff] [blame] | 141 | const struct ussd_request *request); |
Harald Welte | 6eafe91 | 2009-10-16 08:32:58 +0200 | [diff] [blame] | 142 | |
| 143 | #endif |