2010-09-22 15:10:42 +02:00
|
|
|
/******************************************************************************
|
|
|
|
Copyright 2009, Freie Universitaet Berlin (FUB). All rights reserved.
|
|
|
|
|
|
|
|
These sources were developed at the Freie Universitaet Berlin, Computer Systems
|
|
|
|
and Telematics group (http://cst.mi.fu-berlin.de).
|
|
|
|
-------------------------------------------------------------------------------
|
2013-03-07 20:51:26 +01:00
|
|
|
This file is part of RIOT.
|
2010-09-22 15:10:42 +02:00
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU General Public License as published by the Free Software
|
|
|
|
Foundation, either version 3 of the License, or (at your option) any later
|
|
|
|
version.
|
|
|
|
|
2013-03-07 20:51:26 +01:00
|
|
|
RIOT is distributed in the hope that it will be useful, but WITHOUT
|
2010-09-22 15:10:42 +02:00
|
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along with
|
|
|
|
this program. If not, see http://www.gnu.org/licenses/ .
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
For further information and questions please use the web site
|
|
|
|
http://scatterweb.mi.fu-berlin.de
|
|
|
|
and the mailinglist (subscription via web site)
|
|
|
|
scatterweb@lists.spline.inf.fu-berlin.de
|
|
|
|
*******************************************************************************/
|
|
|
|
|
|
|
|
#ifndef PROTOCOLMULTIPLEX_H_
|
|
|
|
#define PROTOCOLMULTIPLEX_H_
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @addtogroup net
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @internal
|
|
|
|
* @brief Protocol handler multiplexing
|
|
|
|
*
|
2013-03-08 11:30:23 +01:00
|
|
|
* @author Freie Universität Berlin, Computer Systems & Telematics
|
2010-09-22 15:10:42 +02:00
|
|
|
* @author Thomas Hillebrandt <hillebra@inf.fu-berlin.de>
|
|
|
|
* @author Heiko Will <hwill@inf.fu-berlin.de>
|
|
|
|
* @author Michael Baar <baar@inf.fu-berlin.de>
|
|
|
|
* @version $Revision: 1526 $
|
|
|
|
*
|
|
|
|
* @note $Id: protocol-multiplex.h 1526 2009-10-30 13:40:20Z hillebra $
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "radio/types.h"
|
|
|
|
|
|
|
|
typedef struct {
|
2013-06-22 17:58:19 +02:00
|
|
|
packet_handler_t handler;
|
|
|
|
protocol_t protocol;
|
2010-09-22 15:10:42 +02:00
|
|
|
} handler_entry_t;
|
|
|
|
|
|
|
|
typedef struct {
|
2013-06-22 17:58:19 +02:00
|
|
|
uint8_t size;
|
|
|
|
handler_entry_t *handler;
|
2010-09-22 15:10:42 +02:00
|
|
|
} pm_table_t;
|
|
|
|
|
2013-06-22 17:58:19 +02:00
|
|
|
void pm_init_table(pm_table_t *table, uint8_t size, handler_entry_t *handler);
|
|
|
|
int pm_find_handler_index(const pm_table_t *table, protocol_t protocol, unsigned int start);
|
|
|
|
int pm_set_handler(const pm_table_t *table, protocol_t protocol, packet_handler_t handler);
|
|
|
|
void pm_remove_handler(const pm_table_t *table, protocol_t protocol, packet_handler_t handler);
|
|
|
|
int pm_invoke(const pm_table_t *table, protocol_t protocol, void *payload, int payload_size, packet_info_t *packet_info);
|
2010-09-22 15:10:42 +02:00
|
|
|
|
|
|
|
/** @} */
|
|
|
|
|
|
|
|
#endif /* PROTOCOLMULTIPLEX_H_ */
|