/* Cesar project {{{ * * Copyright (C) 2008 Spidcom * * <<>> * * }}} */ /** * \file src/action-test.c * \brief « brief description » * \ingroup « module » * * « long description » */ #include "common/std.h" #include "string.h" #include "lib/test.h" #include "lib/utils.h" #include "lib/swap.h" #include "lib/read_word.h" #include "cl/cl_mactotei.h" #include "common/defs/homeplugAV.h" #include "common/defs/ethernet.h" #include "mac/common/ntb.h" #include "cp2/cp.h" #include "cp2/fsm/fsm.h" #include "cp2/msg/msg.h" #include "cp2/sta/mgr/sta.h" #include "cp2/cco/action/cco_action.h" #include "cp2/cco/action/inc/cco_action.h" #include "cp2/inc/context.h" test_t test; // The value provided to the module beacon. u16 snid_compute; // A Simple counter. uint tei_map_cnt; static cp_fsm_event_t fsm_event; static bool fsm_event_posted = false; /** * Verify TEI lease computing function. * \param test the test object. * * Test 1: * Initialise the TEI flags to the value 0x0124 in the first word. * The TEI return shall be 2. * * Test 2: * Initialise the TEI flags first word to 0xFFFFFFFE. * The second one with 0xFFFFEFFF * The TEI returned shall be 45. * * Test 3: * Initialise the TEI flags first word to 0xFFFFFFFE. * Initialise the TEI flags second word to 0xFFFFFFFF. * Initialise the TEI flags ... word to 0xFFFFFFFF. * Initialise the TEI flags eights word to 0x7FFFFFFF. * The TEI returned shall be 0. */ void test_case_tei_lease_create (test_t test) { cp_cco_action_t action; uint tei; test_case_begin (test, "TEI Lease create"); action.tei_flags[0] = 0x0124; tei = cp_cco_action_tei_compute (&action); test_begin (test, "Test 1") { test_fail_if (tei != 2, "TEI shall be 2"); test_fail_if ((action.tei_flags[0] & 0x2) != 2, "TEI bit flag shall be setted"); } test_end; action.tei_flags[0] = 0xFFFFFFFE; action.tei_flags[1] = 0xFFFFEFFF; tei = cp_cco_action_tei_compute (&action); test_begin (test, "Test 2") { test_fail_if (tei != 45, "TEI shall be 57"); test_fail_if ((action.tei_flags[1] & 0xC) != 12, "TEI bit flag shall be setted"); } test_end; action.tei_flags[0] = 0xFFFFFFFE; action.tei_flags[1] = 0xFFFFFFFF; action.tei_flags[2] = 0xFFFFFFFF; action.tei_flags[3] = 0xFFFFFFFF; action.tei_flags[4] = 0xFFFFFFFF; action.tei_flags[5] = 0xFFFFFFFF; action.tei_flags[6] = 0xFFFFFFFF; action.tei_flags[7] = 0x7FFFFFFF; tei = cp_cco_action_tei_compute (&action); test_begin (test, "Test 3") { test_fail_if (tei != 0, "TEI shall be 0"); test_fail_if (action.tei_flags[7] != 0x7FFFFFFF, "TEI bit flag shall be setted"); } test_end; } /** * Verify TEI release function. * \param test the test object. * * Test 1: * Initialise the TEI flags to the value 0x0126 in the first word. * The TEI return shall be 2 * * Test 2: * Initialise the TEI flags first word to 0xFFFFFFFE. * The second one with 0xFFFFFFFF * The TEI returned shall be 45. */ void test_case_tei_release (test_t test) { cp_cco_action_t action; uint tei; test_case_begin (test, "TEI Lease release"); action.tei_flags[0] = 0x0126; //Release TEI 2. cp_cco_action_tei_release (&action, 2); // Get TEI. tei = cp_cco_action_tei_compute (&action); test_begin (test, "Test 1") { test_fail_if (tei != 2, "TEI shall be 2"); test_fail_if ((action.tei_flags[0] & 0x2) != 2, "TEI bit flag shall be setted"); } test_end; action.tei_flags[0] = 0xFFFFFFFE; action.tei_flags[1] = 0xFFFFFFFF; cp_cco_action_tei_release (&action, 45); tei = cp_cco_action_tei_compute (&action); test_begin (test, "Test 2") { test_fail_if (tei != 45, "TEI shall be 57"); test_fail_if ((action.tei_flags[1] & 0xC) != 12, "TEI bit flag shall be setted"); } test_end; } /** Test the initialisation of the cco_action module. * \param test the test object. * * The initialise procedure shall only initialise the set for the expiration * process. * At the end of this test the set shall be empty. */ void test_case_cco_action_init (test_t test) { cp_t cp; uint i; test_case_begin (test, "Initialise the module."); cp_cco_action_init (&cp); test_begin (test, "Verify") { for (i = 0; i < 8; i++) { test_fail_if (cp.cco_action.tei_flags[i] != 0, "TEI flags shall be null"); } } test_end; } /** Change SNID. * \param test the test object. * * Test the procedure to modify the SNID at the beginning of the AVLN, and * simulating an AVLN SNID collision. * * Test 1: Choosing SNID at the beginning. * This shall choose randomly a value of SNID. The random generator is * initialised with the mac_ntb date. * * Environment: * The phy_date override in the test shall always return the same value * in order to verify the SNID chosen. * * The all range of SNID values shall be available. The flags returned * by the override of the get_snids function from the sta manager shall * return 0x0. * * Test 2: Choosing SNID after collision. * * This shall choose randomly a value of SNID between the following ones, * 2, 3, 4, 7, 9, 11, 13, 14. So the flag returned by the * get_snids function from the sta manager shall be not(0x9563) so 0x6A9C. * * Once this is done the value of the new SNID shall be provide to the beacon * module using change_snid function. */ void test_case_change_snid (test_t test) { cp_t cp; test_case_begin (test, "change SNID test 1"); cp_cco_action_init (&cp); cp_sta_mgr_init (&cp); cp_cco_action_snid_change (&cp); test_begin (test, "Verify SNID chosen") { test_fail_if (snid_compute != 13, "Wrong snid"); } test_end; test_case_begin (test, "change SNID test 2"); cp_cco_action_init (&cp); /* Adding the AVLN. */ cp_sta_mgr_add_avln (&cp, 1, 1); cp_sta_mgr_add_avln (&cp, 5, 2); cp_sta_mgr_add_avln (&cp, 6, 3); cp_sta_mgr_add_avln (&cp, 8, 4); cp_sta_mgr_add_avln (&cp, 10, 5); cp_sta_mgr_add_avln (&cp, 12, 6); cp_sta_mgr_add_avln (&cp, 15, 7); cp_cco_action_snid_change (&cp); test_begin (test, "Verify SNID chosen") { test_fail_if (snid_compute != 13, "Wrong snid"); } test_end; cp_sta_mgr_uninit (&cp); } /** Sta association procedure. * \param test the test object. * * Test 1: Receiving a CC_ASSOC.REQ join * * First station to associate * The CCo shall try to associate the station to its AVLN. * 1. Get an available TEI different from the one of the own Station's TEI. * 2. Add the station to the station list (use the station manager). * 3. Answer the request. * * At the end of this test, the station shall be present in the station * manager list. The station shall be in the associate state. * * Second station to associate * The CCo tries to associate another station to the AVLN. * * 1. Get an available TEI different from the previous registered station * and the own station. * 2. Add the station to the station manager list. * 3. Answer the request. * * At the end of the test two station shall be present with different TEIs. * * No more station can be associate * The CCo tries to associate another station to the AVLN, but there are * no more TEIs available. * * 1. The CCo tries to get a TEI for the station, the function shall * return 0. * 2. Add the station to the sta manager as unassociated sta. * 3. Answer the request with a failed code. * * Test 2: Receiving a CC_ASSOC.REQ renew * * This shall only verify if the TEI lease is correctly update in the * station. * * At the end of this test, the station requiring the renew shall have 45 * minutes more before the expiration of the TEI lease. * * Test 3: Receiving a CC_ASSOC_REQ join from a associated station. * * At the end the station shall still exists with a different TEI. * 1. The station is removed from the AVLN. (a SET_TEI_MAP is send) * 2. The station is added in the AVLN (a SET_TEI_MAP is send). */ void test_case_sta_assoc_procedure (test_t test) { cp_t cp; bitstream_t bitstream; u8 buffer[256] __attribute__((aligned(256))); uint req_type; u64 nid = 12; uint cco_cap = 2; uint pco_cap = true; cp_mme_rx_t mme_rx; cp_net_t *net; cp_sta_t *sta; cl_mactotei_blk_t *table; cp.cl = blk_alloc (); memset (cp.cl, 0, BLK_SIZE); cp_cco_action_init (&cp); cp_sta_mgr_init (&cp); cp_sta_mgr_update_our_avln_nid (&cp, nid); test_case_begin (test, "Test 1: Receiving a CC_ASSOC.REQ join"); // Construct the MME to associate the first station. mme_rx.peer.mac = 2; mme_rx.peer.vlan_tag = 0; mme_rx.peer.tei = 0; // Write the request. bitstream_init (&bitstream, buffer + 19, 10, BITSTREAM_WRITE); bitstream_access (&bitstream, &req_type, 8); bitstream_access (&bitstream, &nid, 56); bitstream_access (&bitstream, &cco_cap, 8); bitstream_access (&bitstream, &pco_cap, 8); bitstream_finalise (&bitstream); // Initialise the MME Rx object. mme_rx.p_mme = buffer; mme_rx.length = 60; bitstream_init (&mme_rx.bitstream, buffer + 19, 60, BITSTREAM_READ); cp_cco_action_manage_sta_assoc (&cp, &mme_rx); // Second station to add. // Construct the MME to associate the second station. mme_rx.peer.mac = 3; mme_rx.peer.vlan_tag = 0; mme_rx.peer.tei = 0; // Write the request. bitstream_init (&bitstream, buffer + 19, 10, BITSTREAM_WRITE); bitstream_access (&bitstream, &req_type, 8); bitstream_access (&bitstream, &nid, 56); bitstream_access (&bitstream, &cco_cap, 8); bitstream_access (&bitstream, &pco_cap, 8); bitstream_finalise (&bitstream); // Initialise the MME Rx object. mme_rx.p_mme = buffer; mme_rx.length = 60; bitstream_init (&mme_rx.bitstream, buffer + 19, 60, BITSTREAM_READ); cp_cco_action_manage_sta_assoc (&cp, &mme_rx); // The next station can not be associated because the TEIs are already in // use. cp.cco_action.tei_flags[0] = 0xFFFFFFFF; cp.cco_action.tei_flags[1] = 0xFFFFFFFF; cp.cco_action.tei_flags[2] = 0xFFFFFFFF; cp.cco_action.tei_flags[3] = 0xFFFFFFFF; cp.cco_action.tei_flags[4] = 0xFFFFFFFF; cp.cco_action.tei_flags[5] = 0xFFFFFFFF; cp.cco_action.tei_flags[6] = 0xFFFFFFFF; cp.cco_action.tei_flags[7] = 0xFFFFFFFF; // third station to add. // Construct the MME to associate the third station. mme_rx.peer.mac = 4; mme_rx.peer.vlan_tag = 0; mme_rx.peer.tei = 0; // Write the request. bitstream_init (&bitstream, buffer + 19, 10, BITSTREAM_WRITE); bitstream_access (&bitstream, &req_type, 8); bitstream_access (&bitstream, &nid, 56); bitstream_access (&bitstream, &cco_cap, 8); bitstream_access (&bitstream, &pco_cap, 8); bitstream_finalise (&bitstream); // Initialise the MME Rx object. mme_rx.p_mme = buffer; mme_rx.length = 60; bitstream_init (&mme_rx.bitstream, buffer + 19, 60, BITSTREAM_READ); cp_cco_action_manage_sta_assoc (&cp, &mme_rx); test_case_begin (test, "Test 2: Receiving a CC_ASSOC.REQ renew"); // Renew the lease. mme_rx.peer.mac = 2; mme_rx.peer.vlan_tag = 0; mme_rx.peer.tei = 2; // Write the request. req_type = CP_MSG_CC_ASSOC_REQ_TYPE_RENEW; bitstream_init (&bitstream, buffer + 19, 10, BITSTREAM_WRITE); bitstream_access (&bitstream, &req_type, 8); bitstream_access (&bitstream, &nid, 56); bitstream_access (&bitstream, &cco_cap, 8); bitstream_access (&bitstream, &pco_cap, 8); bitstream_finalise (&bitstream); // Initialise the MME Rx object. mme_rx.p_mme = buffer; mme_rx.length = 60; bitstream_init (&mme_rx.bitstream, buffer + 19, 60, BITSTREAM_READ); net = cp_sta_mgr_get_our_avln (&cp); sta = cp_net_get_sta (&cp, net, 2); cp_sta_set_state (sta, CP_STA_STATE_AUTHENTICATED); slab_release (sta); cp_cco_action_manage_sta_assoc (&cp, &mme_rx); test_case_begin (test, "Test 3: Receiving a CC_ASSOC_REQ join from a associated station"); cp.cco_action.tei_flags[0] = 0xF0FFFFFF; cp.cco_action.tei_flags[1] = 0xFFFFFFFF; cp.cco_action.tei_flags[2] = 0xFFFFFFFF; cp.cco_action.tei_flags[3] = 0xFFFFFFFF; cp.cco_action.tei_flags[4] = 0xFFFFFFFF; cp.cco_action.tei_flags[5] = 0xFFFFFFFF; cp.cco_action.tei_flags[6] = 0xFFFFFFFF; cp.cco_action.tei_flags[7] = 0xFFFFFFFF; table = cl_mactotei_new (); cl_mactotei_addr_add (table, 0x2, 0x2, 1); cl_mactotei_use_table (cp.cl, table); // Construct the MME to associate the first station. mme_rx.peer.mac = 2; mme_rx.peer.vlan_tag = 0; mme_rx.peer.tei = 0; req_type = CP_MSG_CC_ASSOC_REQ_TYPE_NEW; // Write the request. bitstream_init (&bitstream, buffer + 19, 10, BITSTREAM_WRITE); bitstream_access (&bitstream, &req_type, 8); bitstream_access (&bitstream, &nid, 56); bitstream_access (&bitstream, &cco_cap, 8); bitstream_access (&bitstream, &pco_cap, 8); bitstream_finalise (&bitstream); // Initialise the MME Rx object. mme_rx.p_mme = buffer; mme_rx.length = 60; bitstream_init (&mme_rx.bitstream, buffer + 19, 60, BITSTREAM_READ); cp_cco_action_manage_sta_assoc (&cp, &mme_rx); cp_cco_action_uninit (&cp); cp_sta_mgr_uninit (&cp); blk_release_desc ((blk_t *) table); blk_release (cp.cl); } /** Sta authentication procedure * \param test the test object. * * this shall only answer with a CM_GET_KEY.CNF message if the station is known * * Test 1: Station is not known. * Environment * A MME is received with a authentication request and the Station is not * known. * Result * A MME with the CM_GET_KEY.CNF containing the result "request refused" * shall be sent. * * Test 2: Station is known. * * Environment * Some station have been added and are associated. A CM_GET_KEY.REQ MME * is received from a station. * Result * The CCo shall send a answer CM_GET_KEY.CNF with the following data. * * - Result = 0 (guaranteed) * - key = 2 (NEK) * - NID = 0 */ void test_case_sta_authentication (test_t test) { cp_t cp; cp_net_t *net; cp_sta_t *sta; mfs_rx_t mfs; bitstream_t bitstream; cp_mme_rx_t mme; u64 data; u8 buffer[1024]__attribute__((aligned(1024))); cp_cco_action_init (&cp); cp_sta_mgr_init (&cp); // Update the net NID and SNID. cp_sta_mgr_update_our_avln_nid (&cp, 0x1); cp_sta_mgr_update_our_avln_snid (&cp, 0x2); net = cp_sta_mgr_get_our_avln (&cp); test_case_begin (test, "Sta authentication procedure"); // Build the MME. bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE); // ODA. data = 0x2; bitstream_access (&bitstream, &data, 48); // OSA. data = 0x1; bitstream_access (&bitstream, &data, 48); // Mtype data = swap16 (HPAV_MTYPE_MME); bitstream_access (&bitstream, &data, 16); // MMV. data = HPAV_MMV1; bitstream_access (&bitstream, &data, 8); // MMtype. data = CM_GET_KEY_REQ; bitstream_access (&bitstream, &data, 16); // FMI data = 0; bitstream_access (&bitstream, &data, 16); // Request type. data = 0; bitstream_access (&bitstream, &data, 8); // Request key type. data = CP_MSG_KEY_NEK; bitstream_access (&bitstream, &data, 8); // NID. data = cp_net_get_nid (&cp, net); bitstream_access (&bitstream, &data, 56); // Nonce. data = 0xc; bitstream_access (&bitstream, &data, 32); // PID. data = 0; bitstream_access (&bitstream, &data, 32); // Key. data = 0xA; bitstream_access (&bitstream, &data, 8); bitstream_finalise (&bitstream); mme.length = 37; mme.p_mme = buffer; mme.peer.tei = 0xFF; cp_cco_action_manage_sta_auth (&cp, &mme); mfs.common.tei = 0x1; sta = cp_net_sta_add (&cp, net, mfs.common.tei, 0x1); cp_sta_set_state (sta, CP_STA_STATE_AUTHENTICATED); slab_release (sta); cp_cco_action_manage_sta_auth (&cp, &mme); cp_sta_mgr_uninit (&cp); cp_cco_action_uninit (&cp); } /** Test the station leaving procedure. * \param test the test object. * * This shall only verify that a message is post in the FSM when the station * leave the AVLN. */ void test_case_sta_leave (test_t test) { cp_t cp; cp_net_t *net; cp_sta_t *sta; cp_sta_mgr_init (&cp); cp_cco_action_init (&cp); test_case_begin (test, "CCO action : Station leave"); net = cp_sta_mgr_get_our_avln (&cp); sta = cp_net_sta_add (&cp, net, 0x1, 0x1); cp_cco_action_manage_sta_leave (&cp, NULL, sta); slab_release (sta); test_begin (test, "Verify the post event") { test_fail_if (fsm_event_posted != true, "FSM Event not posted"); } test_end; cp_cco_action_uninit (&cp); cp_sta_mgr_uninit (&cp); } int main (void) { uint phy; mac_config_t mac_config; test_init (test, 0, NULL); mac_ntb_init ((phy_t *) &phy, &mac_config); test_case_tei_lease_create (test); test_case_tei_release (test); test_case_cco_action_init (test); test_case_change_snid (test); test_case_sta_assoc_procedure (test); test_case_sta_authentication (test); test_case_sta_leave (test); test_case_begin (test, "Memory leaks"); test_begin (test, "Memory leaks verification") { test_fail_if (blk_check_memory() == false, "Memory not freed"); } test_end; test_result (test); HAL_PLATFORM_EXIT (test_nb_failed (test) == 0 ? 0 : 1); return test_nb_failed (test) == 0 ? 0 : 1; } void cp_beacon_change_snid (cp_t *ctx, u8 snid) { snid_compute = snid; } u32 phy_date (phy_t *phy) { return 42; } /** * Begin a CC_SET_TEI_MAP.IND construction. * \param ctx control plane context * \param peer peer information * \param mode update, add or delete * \param sta_nb number of stations sent * \return the MME being constructed */ cp_mme_tx_t * cp_msg_cc_set_tei_map_ind_send_begin ( cp_t *ctx, cp_mme_peer_t *peer, enum cp_msg_cc_set_tei_map_ind_mode_t mode, uint sta_nb) { return NULL; } /** * * Write a station to a CC_SET_TEI_MAP.IND being constructed. * \param ctx control plane context * \param mme MME being constructed * \param tei STA TEI * \param mac STA mac address * \param status STA status */ void cp_msg_cc_set_tei_map_ind_send_sta ( cp_t *ctx, cp_mme_tx_t *mme, cp_tei_t tei, mac_t mac, enum cp_msg_cc_set_tei_map_ind_status_t status) { } /** * Finalise and send a CC_SET_TEI_MAP.IND message. * \param ctx control plane context * \param mme MME being constructed */ void cp_msg_cc_set_tei_map_ind_send_end (cp_t *ctx, cp_mme_tx_t *mme) { } /** * Receive a CC_ASSOC.REQ. * \param ctx control plane context * \param mme MME handle * \param data received MME data * \return true on success */ bool cp_msg_cc_assoc_req_receive (cp_t *ctx, cp_mme_rx_t *mme, cp_msg_cc_assoc_req_t *data) { dbg_assert (ctx); dbg_assert (mme); dbg_assert (data); bitstream_access (&mme->bitstream, &data->request_type, 8); bitstream_access (&mme->bitstream, &data->nid, 56); bitstream_access (&mme->bitstream, &data->cco_cap, 8); bitstream_access (&mme->bitstream, &data->proxy_cap, 8); bitstream_finalise (&mme->bitstream); return true; } /** * Send a CC_ASSOC.CNF. * \param ctx control plane context * \param peer peer information * \param data MME data to send */ void cp_msg_cc_assoc_cnf_send (cp_t *ctx, cp_mme_peer_t *peer, const cp_msg_cc_assoc_cnf_t *data) { cp_sta_t *sta; cp_net_t *net; dbg_assert (ctx); dbg_assert (data); net = cp_sta_mgr_get_our_avln (ctx); if (data->sta_tei) sta = cp_net_get_sta (ctx, net, data->sta_tei); else sta = cp_net_get_sta_unassoc (ctx, net, peer->mac); test_begin (test, "Verifying CNF Data") { test_fail_if (sta == NULL, "Station shall exists"); switch (cp_sta_get_state (sta)) { case CP_STA_STATE_ASSOCIATED: test_fail_if (data->result != CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS, "Wrong result value"); test_fail_if (data->lease_time_min != CP_CCO_ACTION_LEASE_ASSOC_MIN, "Wrong TEI lease time"); break; case CP_STA_STATE_AUTHENTICATED: test_fail_if (data->result != CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS, "Wrong result value"); test_fail_if (data->lease_time_min != CP_CCO_ACTION_LEASE_AUTH_MIN, "Wrong TEI lease time"); break; default: test_fail_if (data->result != CP_MSG_CC_ASSOC_CNF_RESULT_FAILURE_TEMPORARY_RESSOURCE_EXHAUSTION, "Wrong result value"); } test_fail_if (data->sta_tei != cp_sta_get_tei (sta), "Wrong TEI"); test_fail_if (data->nid != cp_net_get_nid (ctx, net), "Wrong NID"); test_fail_if (data->snid != cp_net_get_snid (ctx, net), "Wrong SNID"); } test_end; slab_release(sta); } /** * Receive a CM_GET_KEY.REQ. * \param ctx control plane context * \param mme MME handle * \param data received MME data * \return true on success * * Encryption and protocol run information is available in the MME handle. */ bool cp_msg_cm_get_key_req_receive (cp_t *ctx, cp_mme_rx_t *mme, cp_msg_cm_get_key_req_t *data) { uint offset; bool vlantag_present; u64 unused; dbg_assert (ctx); dbg_assert (mme); dbg_assert (mme->p_mme); dbg_assert (mme->length < ETH_PACKET_MAX_SIZE); dbg_assert (data); if (read_u16_from_word (mme->p_mme + 12) == swap16(HPAV_MTYPE_MME)) vlantag_present = false; else vlantag_present = true; // Read the MME. bitstream_init (&mme->bitstream, mme->p_mme, mme->length, BITSTREAM_READ); bitstream_access (&mme->bitstream, &mme->peer.mac, 48); bitstream_access (&mme->bitstream, &unused, 48); if (vlantag_present) bitstream_access (&mme->bitstream, &mme->peer.vlan_tag, 32); bitstream_access (&mme->bitstream, &unused, 16); bitstream_access (&mme->bitstream, &unused, 8); bitstream_access (&mme->bitstream, &unused, 16); bitstream_access (&mme->bitstream, &unused, 16); // Read the data in the MME. bitstream_access (&mme->bitstream, &data->relayed, 8); bitstream_access (&mme->bitstream, &data->key_type, 8); bitstream_access (&mme->bitstream, &data->nid, 56); if (vlantag_present) offset = 41; else offset = 37; memcpy (mme->p_mme + offset, &data->hash_key, mme->length - offset); return true; } /** * Send a CM_GET_KEY.CNF. * \param ctx control plane context * \param peer peer information * \param peks payload encryption key select * \param prun protocol run information * \param data MME data to send */ void cp_msg_cm_get_key_cnf_send (cp_t *ctx, cp_mme_peer_t *peer, cp_mme_peks_t peks, const cp_secu_protocol_run_t *prun, const cp_msg_cm_get_key_cnf_t *data) { dbg_assert (ctx); dbg_assert (data); test_begin (test, "Verify data") { test_fail_if (data->result != (peer->tei == 0xFF ? CP_MSG_CM_GET_KEY_CNF_RESULT_REQUEST_REFUSED : CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED), "Wrong result type"); } test_end; } /** * Send a CC_LEAVE.CNF. * \param ctx control plane context * \param peer peer information */ void cp_msg_cc_leave_cnf_send (cp_t *ctx, cp_mme_peer_t *peer) { } /** * Send a CC_LEAVE.IND. * \param ctx control plane context * \param peer peer information * \param reason reason for the disassociation * \param nid NID */ void cp_msg_cc_leave_ind_send (cp_t *ctx, cp_mme_peer_t *peer, enum cp_msg_cc_leave_ind_reason_t reason, cp_nid_t nid) { } cp_fsm_event_t * cp_fsm_event_bare_new (cp_t *ctx, cp_fsm_event_type_t type) { return &fsm_event; } void cp_fsm_post (cp_t *ctx, cp_fsm_event_t *event) { fsm_event_posted = true; }