Implement sending SMS and send one on network registration
This commit is contained in:
parent
3b2ec4261f
commit
6fe997e9dd
|
@ -46,8 +46,28 @@ struct sms_submit {
|
||||||
u_int8_t *user_data;
|
u_int8_t *user_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* SMS deliver PDU */
|
||||||
|
struct sms_deliver {
|
||||||
|
u_int8_t *smsc;
|
||||||
|
u_int8_t mti:2;
|
||||||
|
u_int8_t rd:1;
|
||||||
|
u_int8_t vpf:2;
|
||||||
|
u_int8_t srr:1;
|
||||||
|
u_int8_t udhi:1;
|
||||||
|
u_int8_t rp:1;
|
||||||
|
u_int8_t msg_ref;
|
||||||
|
u_int8_t *orig_addr;
|
||||||
|
u_int8_t pid;
|
||||||
|
u_int8_t dcs;
|
||||||
|
u_int8_t vp;
|
||||||
|
u_int8_t ud_len;
|
||||||
|
u_int8_t *user_data;
|
||||||
|
};
|
||||||
|
|
||||||
struct msgb;
|
struct msgb;
|
||||||
|
|
||||||
int gsm0411_rcv_sms(struct msgb *msg);
|
int gsm0411_rcv_sms(struct msgb *msg);
|
||||||
|
|
||||||
|
int gsm0411_send_sms(struct gsm_lchan *lchan, struct sms_deliver *sms);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -193,6 +193,8 @@ int gsm0408_loc_upd_acc(struct gsm_lchan *lchan, u_int32_t tmsi)
|
||||||
|
|
||||||
gsm48_sendmsg(msg);
|
gsm48_sendmsg(msg);
|
||||||
|
|
||||||
|
gsm0411_send_sms(lchan, 0);
|
||||||
|
|
||||||
return gsm48_cc_tx_setup(lchan);
|
return gsm48_cc_tx_setup(lchan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,12 @@ static char *gsm411_7bit_decode(u_int8_t *user_data, u_int8_t length)
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static u_int8_t gsm0411_tpdu_from_sms(u_int8_t *tpdu, struct sms_deliver *sms)
|
||||||
|
{
|
||||||
|
u_int8_t len = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
static int gsm411_sms_submit_from_msgb(struct msgb *msg)
|
static int gsm411_sms_submit_from_msgb(struct msgb *msg)
|
||||||
{
|
{
|
||||||
u_int8_t *smsp = msgb_sms(msg);
|
u_int8_t *smsp = msgb_sms(msg);
|
||||||
|
@ -216,3 +222,45 @@ int gsm0411_rcv_sms(struct msgb *msg)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Test TPDU */
|
||||||
|
static u_int8_t tpdu_test[] = {
|
||||||
|
0x00, 0x01, 0x00, 0x04, 0x81, 0x32, 0x24, 0x00, 0x00, 0x24, 0xD7, 0x32, 0x7B, 0xFC, 0x6E, 0x97, 0x41, 0xF4, 0x37, 0x88, 0x8E, 0x2E, 0x83, 0x64, 0xB5, 0xE1, 0x0C, 0x74, 0x9C, 0x36, 0x41, 0xF4, 0xF2, 0x9C, 0x0E, 0x72, 0x97, 0xE9, 0xF7, 0xB7, 0x7C, 0x0D
|
||||||
|
};
|
||||||
|
|
||||||
|
int gsm0411_send_sms(struct gsm_lchan *lchan, struct sms_deliver *sms)
|
||||||
|
{
|
||||||
|
struct msgb *msg = gsm411_msgb_alloc();
|
||||||
|
struct gsm48_hdr *gh;
|
||||||
|
struct gsm411_rp_hdr *rp;
|
||||||
|
u_int8_t *data, *tpdu, smslen;
|
||||||
|
|
||||||
|
msg->lchan = lchan;
|
||||||
|
|
||||||
|
gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh));
|
||||||
|
gh->proto_discr = GSM48_PDISC_SMS;
|
||||||
|
gh->msg_type = GSM411_MT_CP_DATA;
|
||||||
|
|
||||||
|
rp = (struct gsm411_rp_hdr *)msgb_put(msg, sizeof(*rp));
|
||||||
|
rp->msg_type = GSM411_MT_RP_DATA_MT;
|
||||||
|
rp->msg_ref = 42; /* FIXME: Choose randomly */
|
||||||
|
/* No OA or DA for now */
|
||||||
|
data = (u_int8_t *)msgb_put(msg, 1);
|
||||||
|
data[0] = 0;
|
||||||
|
data = (u_int8_t *)msgb_put(msg, 1);
|
||||||
|
data[0] = 0;
|
||||||
|
|
||||||
|
/* FIXME: Hardcoded for now */
|
||||||
|
smslen = gsm0411_tpdu_from_sms(tpdu, sms);
|
||||||
|
|
||||||
|
data = (u_int8_t *)msgb_put(msg, sizeof(tpdu_test));
|
||||||
|
|
||||||
|
//memcpy(data, tpdu, smslen);
|
||||||
|
memcpy(data, tpdu_test, sizeof(tpdu_test));
|
||||||
|
|
||||||
|
free(tpdu);
|
||||||
|
|
||||||
|
DEBUGP(DSMS, "TX: SMS SUBMIT\n");
|
||||||
|
|
||||||
|
return gsm0411_sendmsg(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,3 +78,4 @@ void db_subscriber_alloc_tmsi(void) {}
|
||||||
void db_create_subscriber(void) {}
|
void db_create_subscriber(void) {}
|
||||||
void rsl_chan_release(void) {}
|
void rsl_chan_release(void) {}
|
||||||
void msgb_alloc(void) {}
|
void msgb_alloc(void) {}
|
||||||
|
void gsm0411_send_sms(void) {}
|
||||||
|
|
|
@ -85,4 +85,6 @@ int main(int argc, char** argv)
|
||||||
gsm0411_rcv_sms(msg);
|
gsm0411_rcv_sms(msg);
|
||||||
msgb_free(msg);
|
msgb_free(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gsm0411_send_sms(0, 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue