Sylvain Munaut | 12ba778 | 2014-06-16 10:13:40 +0200 | [diff] [blame] | 1 | #pragma once |
Harald Welte | 1e90866 | 2010-03-07 23:39:54 +0100 | [diff] [blame] | 2 | |
| 3 | #include <stdint.h> |
| 4 | #include <string.h> |
| 5 | #include <errno.h> |
| 6 | |
Pablo Neira Ayuso | 8341934 | 2011-03-22 16:36:13 +0100 | [diff] [blame] | 7 | #include <osmocom/core/msgb.h> |
| 8 | #include <osmocom/gsm/tlv.h> |
| 9 | #include <osmocom/gsm/mncc.h> |
| 10 | #include <osmocom/gsm/protocol/gsm_04_08.h> |
Harald Welte | 1e90866 | 2010-03-07 23:39:54 +0100 | [diff] [blame] | 11 | |
| 12 | /* decode a 'called/calling/connect party BCD number' as in 10.5.4.7 */ |
| 13 | int gsm48_decode_bcd_number(char *output, int output_len, |
| 14 | const uint8_t *bcd_lv, int h_len); |
| 15 | |
| 16 | /* convert a ASCII phone number to 'called/calling/connect party BCD number' */ |
| 17 | int gsm48_encode_bcd_number(uint8_t *bcd_lv, uint8_t max_len, |
| 18 | int h_len, const char *input); |
| 19 | /* decode 'bearer capability' */ |
| 20 | int gsm48_decode_bearer_cap(struct gsm_mncc_bearer_cap *bcap, |
| 21 | const uint8_t *lv); |
| 22 | /* encode 'bearer capability' */ |
| 23 | int gsm48_encode_bearer_cap(struct msgb *msg, int lv_only, |
| 24 | const struct gsm_mncc_bearer_cap *bcap); |
| 25 | /* decode 'call control cap' */ |
| 26 | int gsm48_decode_cccap(struct gsm_mncc_cccap *ccap, const uint8_t *lv); |
| 27 | /* encode 'call control cap' */ |
| 28 | int gsm48_encode_cccap(struct msgb *msg, |
| 29 | const struct gsm_mncc_cccap *ccap); |
| 30 | /* decode 'called party BCD number' */ |
| 31 | int gsm48_decode_called(struct gsm_mncc_number *called, |
| 32 | const uint8_t *lv); |
| 33 | /* encode 'called party BCD number' */ |
| 34 | int gsm48_encode_called(struct msgb *msg, |
| 35 | const struct gsm_mncc_number *called); |
| 36 | /* decode callerid of various IEs */ |
| 37 | int gsm48_decode_callerid(struct gsm_mncc_number *callerid, |
| 38 | const uint8_t *lv); |
| 39 | /* encode callerid of various IEs */ |
| 40 | int gsm48_encode_callerid(struct msgb *msg, int ie, int max_len, |
| 41 | const struct gsm_mncc_number *callerid); |
| 42 | /* decode 'cause' */ |
| 43 | int gsm48_decode_cause(struct gsm_mncc_cause *cause, |
| 44 | const uint8_t *lv); |
| 45 | /* encode 'cause' */ |
| 46 | int gsm48_encode_cause(struct msgb *msg, int lv_only, |
| 47 | const struct gsm_mncc_cause *cause); |
| 48 | /* decode 'calling number' */ |
| 49 | int gsm48_decode_calling(struct gsm_mncc_number *calling, |
| 50 | const uint8_t *lv); |
| 51 | /* encode 'calling number' */ |
| 52 | int gsm48_encode_calling(struct msgb *msg, |
| 53 | const struct gsm_mncc_number *calling); |
| 54 | /* decode 'connected number' */ |
| 55 | int gsm48_decode_connected(struct gsm_mncc_number *connected, |
| 56 | const uint8_t *lv); |
| 57 | /* encode 'connected number' */ |
| 58 | int gsm48_encode_connected(struct msgb *msg, |
| 59 | const struct gsm_mncc_number *connected); |
| 60 | /* decode 'redirecting number' */ |
| 61 | int gsm48_decode_redirecting(struct gsm_mncc_number *redirecting, |
| 62 | const uint8_t *lv); |
| 63 | /* encode 'redirecting number' */ |
| 64 | int gsm48_encode_redirecting(struct msgb *msg, |
| 65 | const struct gsm_mncc_number *redirecting); |
| 66 | /* decode 'facility' */ |
| 67 | int gsm48_decode_facility(struct gsm_mncc_facility *facility, |
| 68 | const uint8_t *lv); |
| 69 | /* encode 'facility' */ |
| 70 | int gsm48_encode_facility(struct msgb *msg, int lv_only, |
| 71 | const struct gsm_mncc_facility *facility); |
| 72 | /* decode 'notify' */ |
| 73 | int gsm48_decode_notify(int *notify, const uint8_t *v); |
| 74 | /* encode 'notify' */ |
| 75 | int gsm48_encode_notify(struct msgb *msg, int notify); |
| 76 | /* decode 'signal' */ |
| 77 | int gsm48_decode_signal(int *signal, const uint8_t *v); |
| 78 | /* encode 'signal' */ |
| 79 | int gsm48_encode_signal(struct msgb *msg, int signal); |
| 80 | /* decode 'keypad' */ |
| 81 | int gsm48_decode_keypad(int *keypad, const uint8_t *lv); |
| 82 | /* encode 'keypad' */ |
| 83 | int gsm48_encode_keypad(struct msgb *msg, int keypad); |
| 84 | /* decode 'progress' */ |
| 85 | int gsm48_decode_progress(struct gsm_mncc_progress *progress, |
| 86 | const uint8_t *lv); |
| 87 | /* encode 'progress' */ |
| 88 | int gsm48_encode_progress(struct msgb *msg, int lv_only, |
| 89 | const struct gsm_mncc_progress *p); |
| 90 | /* decode 'user-user' */ |
| 91 | int gsm48_decode_useruser(struct gsm_mncc_useruser *uu, |
| 92 | const uint8_t *lv); |
| 93 | /* encode 'useruser' */ |
| 94 | int gsm48_encode_useruser(struct msgb *msg, int lv_only, |
| 95 | const struct gsm_mncc_useruser *uu); |
| 96 | /* decode 'ss version' */ |
| 97 | int gsm48_decode_ssversion(struct gsm_mncc_ssversion *ssv, |
| 98 | const uint8_t *lv); |
| 99 | /* encode 'ss version' */ |
| 100 | int gsm48_encode_ssversion(struct msgb *msg, |
| 101 | const struct gsm_mncc_ssversion *ssv); |
| 102 | /* decode 'more data' does not require a function, because it has no value */ |
| 103 | /* encode 'more data' */ |
| 104 | int gsm48_encode_more(struct msgb *msg); |
| 105 | |
Harald Welte | 1523d70 | 2010-08-04 11:46:44 +0200 | [diff] [blame] | 106 | /* structure of one frequency */ |
| 107 | struct gsm_sysinfo_freq { |
| 108 | /* if the frequency included in the sysinfo */ |
| 109 | uint8_t mask; |
| 110 | }; |
| 111 | |
| 112 | /* decode "Cell Channel Description" (10.5.2.1b) and other frequency lists */ |
| 113 | int gsm48_decode_freq_list(struct gsm_sysinfo_freq *f, uint8_t *cd, |
| 114 | uint8_t len, uint8_t mask, uint8_t frqt); |