mirror of git://git.sysmocom.de/ofono
Add address from string utility for SMS
This commit is contained in:
parent
a8dc75392c
commit
61a4b0fee9
|
@ -1681,6 +1681,18 @@ time_t sms_scts_to_time(const struct sms_scts *scts, struct tm *remote)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sms_address_from_string(struct sms_address *addr, const char *str)
|
||||||
|
{
|
||||||
|
addr->numbering_plan = SMS_NUMBERING_PLAN_ISDN;
|
||||||
|
if (str[0] == '+') {
|
||||||
|
addr->number_type = SMS_NUMBER_TYPE_INTERNATIONAL;
|
||||||
|
strcpy(addr->address, str+1);
|
||||||
|
} else {
|
||||||
|
addr->number_type = SMS_NUMBER_TYPE_UNKNOWN;
|
||||||
|
strcpy(addr->address, str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const char *sms_address_to_string(const struct sms_address *addr)
|
const char *sms_address_to_string(const struct sms_address *addr)
|
||||||
{
|
{
|
||||||
static char buffer[64];
|
static char buffer[64];
|
||||||
|
|
|
@ -356,7 +356,9 @@ gboolean sms_encode(const struct sms *in, int *len, int *tpdu_len,
|
||||||
int sms_udl_in_bytes(guint8 ud_len, guint8 dcs);
|
int sms_udl_in_bytes(guint8 ud_len, guint8 dcs);
|
||||||
|
|
||||||
time_t sms_scts_to_time(const struct sms_scts *scts, struct tm *remote);
|
time_t sms_scts_to_time(const struct sms_scts *scts, struct tm *remote);
|
||||||
|
|
||||||
const char *sms_address_to_string(const struct sms_address *addr);
|
const char *sms_address_to_string(const struct sms_address *addr);
|
||||||
|
void sms_address_from_string(struct sms_address *addr, const char *str);
|
||||||
|
|
||||||
const guint8 *sms_extract_common(const struct sms *sms, gboolean *out_udhi,
|
const guint8 *sms_extract_common(const struct sms *sms, gboolean *out_udhi,
|
||||||
guint8 *out_dcs, guint8 *out_udl,
|
guint8 *out_dcs, guint8 *out_udl,
|
||||||
|
|
Loading…
Reference in New Issue