2013-11-27 17:54:30 +01:00
|
|
|
/*
|
2013-08-16 10:20:23 +02:00
|
|
|
* Copyright 2009, Freie Universitaet Berlin (FUB). All rights reserved.
|
|
|
|
*
|
2014-08-23 15:43:13 +02:00
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
* directory for more details.
|
2014-08-27 18:47:31 +02:00
|
|
|
*/
|
2010-09-22 15:10:42 +02:00
|
|
|
|
|
|
|
/**
|
2013-11-27 17:54:30 +01:00
|
|
|
* @defgroup net_mmstack Protocol multiplex
|
|
|
|
* @ingroup net
|
|
|
|
* @brief Protocol handler multiplexing
|
2010-09-22 15:10:42 +02:00
|
|
|
* @{
|
2013-11-27 17:54:30 +01:00
|
|
|
*
|
2010-09-22 15:10:42 +02:00
|
|
|
* @file
|
2013-11-27 17:54:30 +01:00
|
|
|
* @brief Protocol handler multiplexing
|
2010-09-22 15:10:42 +02:00
|
|
|
*
|
2013-11-27 17:54:30 +01: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>
|
2010-09-22 15:10:42 +02:00
|
|
|
*/
|
|
|
|
|
2013-11-27 17:54:30 +01:00
|
|
|
#ifndef PROTOCOLMULTIPLEX_H_
|
|
|
|
#define PROTOCOLMULTIPLEX_H_
|
|
|
|
|
|
|
|
|
2010-09-22 15:10:42 +02:00
|
|
|
#include "radio/types.h"
|
|
|
|
|
2014-10-10 11:51:11 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2010-09-22 15:10:42 +02:00
|
|
|
typedef struct {
|
2013-11-27 17:54:30 +01:00
|
|
|
packet_handler_t handler;
|
|
|
|
protocol_t protocol;
|
2010-09-22 15:10:42 +02:00
|
|
|
} handler_entry_t;
|
|
|
|
|
|
|
|
typedef struct {
|
2013-11-27 17:54:30 +01: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
|
|
|
|
2014-10-10 11:51:11 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2010-09-22 15:10:42 +02:00
|
|
|
/** @} */
|
|
|
|
#endif /* PROTOCOLMULTIPLEX_H_ */
|