1/** 2 * \file 3 * \brief Bfdmux twek options 4 */ 5/* 6 * Copyright (c) 2009, 2010, ETH Zurich. 7 * All rights reserved. 8 * 9 * This file is distributed under the terms in the attached LICENSE file. 10 * If you do not find this file, copies can be found by writing to: 11 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group. 12 */ 13 14#ifndef __BFDMUX_H__ 15#define __BFDMUX_H__ 16 17#ifndef DOXYGEN 18// exclude system headers from documentation 19 20#include <stdio.h> 21#include <stdint.h> 22#include <stdbool.h> 23#include <netif/etharp.h> 24 25#endif // DOXYGEN 26 27#include "debug.h" 28 29/* 30 * Configs 31 */ 32#define PROC_QUEUE_LEN 5 /**< \brief Number of NIC buffers to queue for processing */ 33 34// Socket 35#define BFDMUX_SOCK_PATH "/tmp/.bfdmux.sock" /**< \brief Location of the UNIX socket file */ 36 37 38#define FLUSH_AND_SYNC 1 /**< \brief Always call fflush and sync on file descriptor and communication channels. */ 39 40// Error constants 41#define ERR_OK 0 /**< \brief No error */ 42#define ERR_NONFATAL -1 /**< \brief Error, but nonfatal */ 43#define ERR_FATAL -2 /**< \brief Fatal error, shut down */ 44#define ERR_DISCONNECT -3 /**< \brief Disconnect error. Client-server connection is lost. */ 45#define ERR_DROPPED -4 /**< \brief Application was not able to receive a new packet. So the packet was dropped. */ 46 47/* 48 * IP TCP/UDP Definitions 49 */ 50#define PROTO_TCP 0x06 /**< \brief TCP protocol number in IPv4 header */ 51#define PROTO_UDP 0x11a /**< \brief UDP protocol number in IPv4 header */ 52#define PORT_ANY 0x00 /**< \brief Any UDP/TCP port */ 53#define BFDMUX_IP_ADDR_ANY 0x00 /**< \brief Any IPv4-Address */ 54#define IP_ADDR_LOCAL 0x7f000001 /**< \brief This is the localhost 127.0.0.1 IP-Address */ 55#define MAC_ANY(mac) #mac={.addr = {0,0,0,0,0,0}} // Any MAC 56 57/* 58 * Type defs 59 */ 60typedef uint8_t prot_t; /**< \brief Protocol type */ 61typedef uint32_t addr_t; /**< \brief IP-Address type */ 62typedef uint16_t port_t; /**< \brief Port type */ 63 64//typedef int8_t err_t; /**< \brief Error type */ 65typedef int32_t sock_t; /**< \brief Socket type */ 66typedef int32_t mq_t; /**< \brief Message queue type */ 67typedef uint8_t cmd_t; /**< \brief Command type */ 68typedef uint32_t mqkey_t; /**< \brief Message queue key type */ 69typedef uint32_t smkey_t; /**< \brief Shared memory key type */ 70typedef int32_t filterid_t; /**< \brief Filter id type. Negative values for errors. */ 71 72/* FIXME: Understand this hack 73// k: 74// this is a dirty hack like the whole 75// stupid definitions like IP_ADDR_ANY 76// in the bfdmux which prevents me to 77// include the correct headers from lwip 78#define MAC_ADDR_SIZE 6 79struct eth_addr { uint8_t addr[MAC_ADDR_SIZE]; }; 80// had to fix all of them at the end 81*/ 82 83 84bool demux(void *data, int len); 85 86#endif 87