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