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