#ifndef cp2_msg_inc_msg_cc_h #define cp2_msg_inc_msg_cc_h /* Cesar project {{{ * * Copyright (C) 2008 Spidcom * * <<>> * * }}} */ /** * \file cp2/msg/inc/msg_cc.h * \brief CC family MME. * \ingroup cp2_msg */ #include "cc_who_ru.h" #include "cc_assoc.h" #include "cc_leave.h" #include "cc_set_tei_map.h" #include "cp2/mme.h" BEGIN_DECLS /** * Send a CC_WHO_RU.REQ. * \param ctx control plane context * \param peer peer information * \param nid NID of the requested AVLN */ void cp_msg_cc_who_ru_req_send (cp_t *ctx, cp_mme_peer_t *peer, cp_nid_t nid); /** * Receive a CC_WHO_RU.REQ. * \param ctx control plane context * \param mme MME handle * \param nid received NID of the requested AVLN * \return true on success */ bool cp_msg_cc_who_ru_req_receive (cp_t *ctx, cp_mme_rx_t *mme, cp_nid_t *nid); /** * Send a CC_WHO_RU.CNF. * \param ctx control plane context * \param peer peer information * \param data MME data to send */ void cp_msg_cc_who_ru_cnf_send (cp_t *ctx, cp_mme_peer_t *peer, const cp_msg_cc_who_ru_cnf_t *data); /** * Receive a CC_WHO_RU.CNF. * \param ctx control plane context * \param mme MME handle * \param data received MME data * \return true on success */ bool cp_msg_cc_who_ru_cnf_receive (cp_t *ctx, cp_mme_rx_t *mme, cp_msg_cc_who_ru_cnf_t *data); /** * Send a CC_ASSOC.REQ. * \param ctx control plane context * \param peer peer information * \param data MME data to send */ void cp_msg_cc_assoc_req_send (cp_t *ctx, cp_mme_peer_t *peer, const cp_msg_cc_assoc_req_t *data); /** * 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); /** * 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); /** * Receive a CC_ASSOC.CNF. * \param ctx control plane context * \param mme MME handle * \param data received MME data * \return true on success */ bool cp_msg_cc_assoc_cnf_receive (cp_t *ctx, cp_mme_rx_t *mme, cp_msg_cc_assoc_cnf_t *data); /** * Send a CC_LEAVE.REQ. * \param ctx control plane context * \param peer peer information * \param reason reason for the disassociation */ void cp_msg_cc_leave_req_send (cp_t *ctx, cp_mme_peer_t *peer, enum cp_msg_cc_leave_req_reason_t reason); /** * Receive a CC_LEAVE.REQ. * \param ctx control plane context * \param mme MME handle * \param reason received reason for the disassociation * \return true on success */ bool cp_msg_cc_leave_req_receive (cp_t *ctx, cp_mme_rx_t *mme, enum cp_msg_cc_leave_req_reason_t *reason); /** * 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); /** * Receive a CC_LEAVE.CNF. * \param ctx control plane context * \param mme MME handle * \return true on success */ bool cp_msg_cc_leave_cnf_receive (cp_t *ctx, cp_mme_rx_t *mme); /** * 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); /** * Receive a CC_LEAVE.IND. * \param ctx control plane context * \param mme MME handle * \param reason received reason for the disassociation * \param nid received NID * \return true on success */ bool cp_msg_cc_leave_ind_receive (cp_t *ctx, cp_mme_rx_t *mme, enum cp_msg_cc_leave_ind_reason_t *reason, cp_nid_t *nid); /** * Send a CC_LEAVE.RSP. * \param ctx control plane context * \param peer peer information */ void cp_msg_cc_leave_rsp_send (cp_t *ctx, cp_mme_peer_t *peer); /** * Receive a CC_LEAVE.RSP. * \param ctx control plane context * \param mme MME handle * \return true on success */ bool cp_msg_cc_leave_rsp_receive (cp_t *ctx, cp_mme_rx_t *mme); /** * Send a CC_SET_TEI_MAP.REQ. * \param ctx control plane context * \param peer peer information */ void cp_msg_cc_set_tei_map_req_send (cp_t *ctx, cp_mme_peer_t *peer); /** * Receive a CC_SET_TEI_MAP.REQ. * \param ctx control plane context * \param mme MME handle * \return true on success */ bool cp_msg_cc_set_tei_map_req_receive (cp_t *ctx, cp_mme_rx_t *mme); /** * 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); /** * 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); /** * Begin a CC_SET_TEI_MAP.IND reception. * \param ctx control plane context * \param mme MME handle * \param mode received mode: update, add or delete * \param sta_nb received number of STA * \return true on success */ bool cp_msg_cc_set_tei_map_ind_receive_begin ( cp_t *ctx, cp_mme_rx_t *mme, enum cp_msg_cc_set_tei_map_ind_mode_t *mode, uint *sta_nb); /** * Read a station from a received CC_SET_TEI_MAP.IND. * \param ctx control plane context * \param mme MME being received * \param tei received STA TEI * \param mac received STA mac address * \param status received STA status * \return true on success */ bool cp_msg_cc_set_tei_map_ind_receive_sta ( cp_t *ctx, cp_mme_rx_t *mme, cp_tei_t *tei, mac_t *mac, enum cp_msg_cc_set_tei_map_ind_status_t *status); /** * Finalise a CC_SET_TEI_MAP.IND reception. * \param ctx control plane context * \param mme MME being received * \return true on success */ bool cp_msg_cc_set_tei_map_ind_receive_end (cp_t *ctx, cp_mme_rx_t *mme); /** * Write the header of a CC_RELAY MME. * \param ctx the module context. * \param peer the peer information. * \param mmtype the MMType of the MME CC_RELAY_REQ or CC_RELAY_IND. * \param prun if the MME shall be encrypted. * \param peks the Payload encryption key select. * \param fda the final destination mac address. * \param ftei the final TEI. */ cp_mme_tx_t * cp_msg_cc_relay_send_begin (cp_t *ctx, cp_mme_peer_t *peer, cp_mmtype_t mmtype, const cp_secu_protocol_run_t *prun, cp_mme_peks_t peks, mac_t fda, cp_tei_t ftei); /** * Finalise the MME CC_RELAY.*. * \param ctx the module context. * \param msg the MME to send. * \param length the MME length corresponding (header included). * * Patch the Length of the MME payload in the MSG CC_RELAY.REQ MME. */ void cp_msg_cc_relay_send_finalise (cp_t *ctx, cp_mme_tx_t *msg, uint length); /** * Write the header of a CC_RELAY MME. * \param ctx the module context. * \param peer the peer information. * \param mmtype the MMType of the MME CC_RELAY_REQ or CC_RELAY_IND. * \param prun if the MME shall be encrypted. * \param peks the Payload encryption key select. * \param fda the final destination mac address. * \param ftei the final TEI. */ extern inline cp_mme_tx_t * cp_msg_cc_relay_req_send_begin (cp_t *ctx, cp_mme_peer_t *peer, const cp_secu_protocol_run_t *prun, cp_mme_peks_t peks, mac_t fda, cp_tei_t ftei) { dbg_assert (ctx); dbg_assert (peer); dbg_assert (fda); dbg_assert (ftei); return cp_msg_cc_relay_send_begin (ctx, peer, CC_RELAY_REQ, prun, peks, fda, ftei); } /** * Write the header of a CC_RELAY MME. * \param ctx the module context. * \param peer the peer information. * \param prun if the MME shall be encrypted. * \param peks the Payload encryption key select. * \param fda the final destination mac address. * \param ftei the final TEI. */ extern inline cp_mme_tx_t * cp_msg_cc_relay_ind_send_begin (cp_t *ctx, cp_mme_peer_t *peer, const cp_secu_protocol_run_t *prun, cp_mme_peks_t peks, mac_t fda, cp_tei_t ftei) { dbg_assert (ctx); dbg_assert (peer); dbg_assert (fda); dbg_assert (ftei); return cp_msg_cc_relay_send_begin (ctx, peer, CC_RELAY_IND, prun, peks, fda, ftei); } /** * Receive a CC_RELAY.* * \param ctx the control plane context. * \param msg the MME context. * \param length the MME payload length contained. * * Initialise the Relay MME. */ void cp_msg_cc_relay_receive (cp_t *ctx, cp_mme_rx_t *msg, uint *length); END_DECLS #endif /* cp2_msg_inc_msg_cc_h */