/* * cleopatre/application/managerd/inc/bridge.h * * (C) Copyright 2009 SPiDCOM Technologies * * 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 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA */ #ifndef BRIDGE_H #define BRIDGE_H #include "libmme.h" #include "mme_nl.h" #include "managerd.h" /** Interfaces name */ #define BR_IFNAME "br0" #define LO_IFNAME "lo" #define ETH_IFNAME "eth0" /** Reception timeout in seconds */ #define WAIT_TOUT 1 /** return status for bridge_processing */ enum bridge_status { TO_SEND=0, TO_DROP=1, }; /** * Processing a received frame before sending it. * Analyse received frame on buffer pointer, processing it * and give it on buffer pointer. * * \param ctx managerd context. * \param buffer received frame. * \param len received frame length that will be updated. * \param max_len size max of buffer. * \return bridge status. */ enum bridge_status bridge_processing(struct managerd_ctx *ctx, uint8_t *buffer, int *len, int max_len); /** * Receive a frame from BR interface. * * \param ctx managerd context. * \param buffer frame pointer. * \param len length allowed. * \param is_local boolean; TRUE: get packet from loopback, else: get packet from bridge * \return received length or error code. */ int bridge_receive(struct managerd_ctx *ctx, uint8_t *buffer, int len, int is_local); /** * Send a frame to BR interface. * * \param ctx managerd context. * \param buffer frame pointer. * \param len length to send. * \return error code. */ int bridge_send(struct managerd_ctx *ctx, uint8_t *buffer, int len); /** * Initialize and prepare connections. * * \param ctx managerd context. * \return error code. */ int bridge_init(struct managerd_ctx *ctx); /** * Close connections. * * \param ctx managerd context. */ void bridge_uninit(struct managerd_ctx *ctx); #endif /* BRIDGE_H */