summaryrefslogtreecommitdiff
path: root/cp/msg/src/msg_cm.c
diff options
context:
space:
mode:
authorGuillaume2007-11-29 16:42:23 +0000
committerGuillaume2007-11-29 16:42:23 +0000
commitc7ad0c479cc8cff6fcc1f7d849f638102551ab14 (patch)
treef3ad8039d2c0249a480afec539189aa49030703e /cp/msg/src/msg_cm.c
parentd3143d582541dd2db2a1a661766f9cc599d3ba57 (diff)
change secu module for multi station prn
working on cm_encrypted_payload.ind message git-svn-id: svn+ssh://pessac/svn/cesar/trunk@1072 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cp/msg/src/msg_cm.c')
-rw-r--r--cp/msg/src/msg_cm.c67
1 files changed, 65 insertions, 2 deletions
diff --git a/cp/msg/src/msg_cm.c b/cp/msg/src/msg_cm.c
index e03268084c..1ac2008c50 100644
--- a/cp/msg/src/msg_cm.c
+++ b/cp/msg/src/msg_cm.c
@@ -23,19 +23,82 @@ msg_cm_unassociated_sta_ind_send(const mac_address_t oda)
cm_unassociated_sta_t *unassociated_sta;
msg_param_t msg_param;
- msg = msg_sending_common_part(oda);
+ msg = msg_sending_common_part(oda, &msg_param);
msg->mm_type = CM_UNASSOCIATED_STA_IND;
// set the message values
unassociated_sta = (cm_unassociated_sta_t *) & msg->mm_entry;
// TODO set the values...
// set the mnbf flag
msg_param.mnbf = 1;
- msg_param.encrypted = true;
+ msg_param.encryption = NOT_ENCRYPTED;
// and finaly, send the message
//printf(" send cm_unassociated_sta\n");
msg_send(msg, sizeof(cm_unassociated_sta_t) + MSG_MME_HEADER_SIZE, msg_param);
}
+void
+msg_cm_encrypted_payload_ind_send(
+ const msg_mme_t *encapsulated_msg,
+ const msg_param_t encapsulated_msg_param,
+ const tei_t tei,
+ const bool last_msg_of_p_run,
+ const pid_t pid
+ )
+{
+ // 11.5.2
+ msg_mme_t *msg;
+ cm_encrypted_payload_t *cm_encrypted_payload;
+ msg_param_t msg_param;
+ station_status_t station_status;
+ protocol_run_t pr_run;
+
+ dbg_assert ( !msg_check_wrong_mme_const_values (msg));
+ dbg_assert(tei != 0 && tei != 0xFF);
+
+ msg = msg_sending_common_part(encapsulated_msg->oda, &msg_param);
+ msg->mm_type = CM_ENCRYPTED_PAYLOAD_IND;
+ // set the message values
+ cm_encrypted_payload = (cm_encrypted_payload_t *) & msg->mm_entry;
+ // set the message values...
+ cm_encrypted_payload->peks = encapsulated_msg_param.peks;
+ // set the avln status of the station
+ station_status = station_get_status();
+ if(station_status == STATION_UNASSOCIATED)
+ {
+ cm_encrypted_payload->avln_status = station_get_cco_capa();
+ }
+ else
+ {
+ if(station_get_is_cco())
+ {
+ cm_encrypted_payload->avln_status = 0x08;
+ }
+ else
+ {
+ // the station is assosciated
+ cm_encrypted_payload->avln_status = 0x04;
+ if(station_get_pcco_capa()) cm_encrypted_payload->avln_status = 0x05;
+ }
+ }
+ // set the protocol run parameters
+ if(secu_gen_protocol_run_param(tei, last_msg_of_p_run, &pr_run) == PRN_NotInitialised)
+ {
+ secu_start_new_protocol_run(tei, pid, &pr_run);
+ secu_gen_protocol_run_param(tei, last_msg_of_p_run, &pr_run);
+ }
+ cm_encrypted_payload->pid = pr_run.pid;
+ cm_encrypted_payload->prn = pr_run.prn;
+ cm_encrypted_payload->pmn = pr_run.pmn;
+ // TODO continuer ici
+
+ // set the mnbf flag
+ msg_param.encryption = NOT_ENCRYPTED;
+ // and finaly, send the message
+ //printf(" send cm_unassociated_sta\n");
+// msg_send(msg, , msg_param);
+}
+
+
/*
void
msg_cm_conn_new_req_send(msg_cm_conn_new_req_t msg)