libosmogsm
0.11.0-dirty
Osmocom GSM library
|
00001 00003 #pragma once 00004 00005 #include <stdint.h> 00006 #include <string.h> 00007 #include <errno.h> 00008 00009 #include <osmocom/core/msgb.h> 00010 #include <osmocom/gsm/tlv.h> 00011 #include <osmocom/gsm/mncc.h> 00012 #include <osmocom/gsm/protocol/gsm_04_08.h> 00013 00014 /* decode a 'called/calling/connect party BCD number' as in 10.5.4.7 */ 00015 int gsm48_decode_bcd_number(char *output, int output_len, 00016 const uint8_t *bcd_lv, int h_len); 00017 00018 /* convert a ASCII phone number to 'called/calling/connect party BCD number' */ 00019 int gsm48_encode_bcd_number(uint8_t *bcd_lv, uint8_t max_len, 00020 int h_len, const char *input); 00021 /* decode 'bearer capability' */ 00022 int gsm48_decode_bearer_cap(struct gsm_mncc_bearer_cap *bcap, 00023 const uint8_t *lv); 00024 /* encode 'bearer capability' */ 00025 int gsm48_encode_bearer_cap(struct msgb *msg, int lv_only, 00026 const struct gsm_mncc_bearer_cap *bcap); 00027 /* decode 'call control cap' */ 00028 int gsm48_decode_cccap(struct gsm_mncc_cccap *ccap, const uint8_t *lv); 00029 /* encode 'call control cap' */ 00030 int gsm48_encode_cccap(struct msgb *msg, 00031 const struct gsm_mncc_cccap *ccap); 00032 /* decode 'called party BCD number' */ 00033 int gsm48_decode_called(struct gsm_mncc_number *called, 00034 const uint8_t *lv); 00035 /* encode 'called party BCD number' */ 00036 int gsm48_encode_called(struct msgb *msg, 00037 const struct gsm_mncc_number *called); 00038 /* decode callerid of various IEs */ 00039 int gsm48_decode_callerid(struct gsm_mncc_number *callerid, 00040 const uint8_t *lv); 00041 /* encode callerid of various IEs */ 00042 int gsm48_encode_callerid(struct msgb *msg, int ie, int max_len, 00043 const struct gsm_mncc_number *callerid); 00044 /* decode 'cause' */ 00045 int gsm48_decode_cause(struct gsm_mncc_cause *cause, 00046 const uint8_t *lv); 00047 /* encode 'cause' */ 00048 int gsm48_encode_cause(struct msgb *msg, int lv_only, 00049 const struct gsm_mncc_cause *cause); 00050 /* decode 'calling number' */ 00051 int gsm48_decode_calling(struct gsm_mncc_number *calling, 00052 const uint8_t *lv); 00053 /* encode 'calling number' */ 00054 int gsm48_encode_calling(struct msgb *msg, 00055 const struct gsm_mncc_number *calling); 00056 /* decode 'connected number' */ 00057 int gsm48_decode_connected(struct gsm_mncc_number *connected, 00058 const uint8_t *lv); 00059 /* encode 'connected number' */ 00060 int gsm48_encode_connected(struct msgb *msg, 00061 const struct gsm_mncc_number *connected); 00062 /* decode 'redirecting number' */ 00063 int gsm48_decode_redirecting(struct gsm_mncc_number *redirecting, 00064 const uint8_t *lv); 00065 /* encode 'redirecting number' */ 00066 int gsm48_encode_redirecting(struct msgb *msg, 00067 const struct gsm_mncc_number *redirecting); 00068 /* decode 'facility' */ 00069 int gsm48_decode_facility(struct gsm_mncc_facility *facility, 00070 const uint8_t *lv); 00071 /* encode 'facility' */ 00072 int gsm48_encode_facility(struct msgb *msg, int lv_only, 00073 const struct gsm_mncc_facility *facility); 00074 /* decode 'notify' */ 00075 int gsm48_decode_notify(int *notify, const uint8_t *v); 00076 /* encode 'notify' */ 00077 int gsm48_encode_notify(struct msgb *msg, int notify); 00078 /* decode 'signal' */ 00079 int gsm48_decode_signal(int *signal, const uint8_t *v); 00080 /* encode 'signal' */ 00081 int gsm48_encode_signal(struct msgb *msg, int signal); 00082 /* decode 'keypad' */ 00083 int gsm48_decode_keypad(int *keypad, const uint8_t *lv); 00084 /* encode 'keypad' */ 00085 int gsm48_encode_keypad(struct msgb *msg, int keypad); 00086 /* decode 'progress' */ 00087 int gsm48_decode_progress(struct gsm_mncc_progress *progress, 00088 const uint8_t *lv); 00089 /* encode 'progress' */ 00090 int gsm48_encode_progress(struct msgb *msg, int lv_only, 00091 const struct gsm_mncc_progress *p); 00092 /* decode 'user-user' */ 00093 int gsm48_decode_useruser(struct gsm_mncc_useruser *uu, 00094 const uint8_t *lv); 00095 /* encode 'useruser' */ 00096 int gsm48_encode_useruser(struct msgb *msg, int lv_only, 00097 const struct gsm_mncc_useruser *uu); 00098 /* decode 'ss version' */ 00099 int gsm48_decode_ssversion(struct gsm_mncc_ssversion *ssv, 00100 const uint8_t *lv); 00101 /* encode 'ss version' */ 00102 int gsm48_encode_ssversion(struct msgb *msg, 00103 const struct gsm_mncc_ssversion *ssv); 00104 /* decode 'more data' does not require a function, because it has no value */ 00105 /* encode 'more data' */ 00106 int gsm48_encode_more(struct msgb *msg); 00107 00108 /* structure of one frequency */ 00109 struct gsm_sysinfo_freq { 00110 /* if the frequency included in the sysinfo */ 00111 uint8_t mask; 00112 }; 00113 00114 /* decode "Cell Channel Description" (10.5.2.1b) and other frequency lists */ 00115 int gsm48_decode_freq_list(struct gsm_sysinfo_freq *f, uint8_t *cd, 00116 uint8_t len, uint8_t mask, uint8_t frqt);