add functions to send AUTH REQ and REJECT

This commit is contained in:
Harald Welte 2009-08-12 22:56:50 +02:00
parent f0b4cef137
commit 7984d5c260
2 changed files with 30 additions and 0 deletions

View File

@ -698,6 +698,8 @@ enum gsm_chan_t get_ctype_by_chreq(struct gsm_bts *bts, u_int8_t ra);
enum gsm_chreq_reason_t get_reason_by_chreq(struct gsm_bts *bts, u_int8_t ra);
int gsm48_tx_mm_info(struct gsm_lchan *lchan);
int gsm48_tx_mm_auth_req(struct gsm_lchan *lchan, u_int8_t *rand);
int gsm48_tx_mm_auth_rej(struct gsm_lchan *lchan);
struct msgb *gsm48_msgb_alloc(void);
int gsm48_sendmsg(struct msgb *msg, struct gsm_trans *trans);
int generate_mid_from_tmsi(u_int8_t *buf, u_int32_t tmsi);

View File

@ -1408,6 +1408,34 @@ int gsm48_tx_mm_info(struct gsm_lchan *lchan)
return gsm48_sendmsg(msg, NULL);
}
/* Section 9.2.2 */
int gsm48_tx_mm_auth_req(struct gsm_lchan *lchan, u_int8_t *rand)
{
struct msgb *msg = gsm48_msgb_alloc();
struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh));
u_int8_t *r;
DEBUGP(DMM, "-> AUTH REQ\n");
msg->lchan = lchan;
gh->proto_discr = GSM48_PDISC_MM;
gh->msg_type = GSM48_MT_MM_AUTH_REQ;
/* 16 bytes RAND parameters */
r = msgb_put(msg, 16);
if (rand)
memcpy(r, rand, 16);
return gsm48_sendmsg(msg, NULL);
}
/* Section 9.2.1 */
int gsm48_tx_mm_auth_rej(struct gsm_lchan *lchan)
{
DEBUGP(DMM, "-> AUTH REJECT\n");
return gsm48_tx_simple(lchan, GSM48_PDISC_MM, GSM48_MT_MM_AUTH_REJ);
}
static int gsm48_tx_mm_serv_ack(struct gsm_lchan *lchan)
{
DEBUGP(DMM, "-> CM SERVICE ACK\n");