Dependents:   SNMPAgent HTTPServer think_speak_a cyassl-client ... more

Committer:
mamezu
Date:
Thu Dec 09 01:33:56 2010 +0000
Revision:
0:0f6c82fcde82

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mamezu 0:0f6c82fcde82 1 /*
mamezu 0:0f6c82fcde82 2 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
mamezu 0:0f6c82fcde82 3 * All rights reserved.
mamezu 0:0f6c82fcde82 4 *
mamezu 0:0f6c82fcde82 5 * Redistribution and use in source and binary forms, with or without modification,
mamezu 0:0f6c82fcde82 6 * are permitted provided that the following conditions are met:
mamezu 0:0f6c82fcde82 7 *
mamezu 0:0f6c82fcde82 8 * 1. Redistributions of source code must retain the above copyright notice,
mamezu 0:0f6c82fcde82 9 * this list of conditions and the following disclaimer.
mamezu 0:0f6c82fcde82 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
mamezu 0:0f6c82fcde82 11 * this list of conditions and the following disclaimer in the documentation
mamezu 0:0f6c82fcde82 12 * and/or other materials provided with the distribution.
mamezu 0:0f6c82fcde82 13 * 3. The name of the author may not be used to endorse or promote products
mamezu 0:0f6c82fcde82 14 * derived from this software without specific prior written permission.
mamezu 0:0f6c82fcde82 15 *
mamezu 0:0f6c82fcde82 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
mamezu 0:0f6c82fcde82 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
mamezu 0:0f6c82fcde82 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
mamezu 0:0f6c82fcde82 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
mamezu 0:0f6c82fcde82 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
mamezu 0:0f6c82fcde82 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
mamezu 0:0f6c82fcde82 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
mamezu 0:0f6c82fcde82 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
mamezu 0:0f6c82fcde82 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
mamezu 0:0f6c82fcde82 25 * OF SUCH DAMAGE.
mamezu 0:0f6c82fcde82 26 *
mamezu 0:0f6c82fcde82 27 * This file is part of the lwIP TCP/IP stack.
mamezu 0:0f6c82fcde82 28 *
mamezu 0:0f6c82fcde82 29 * Author: Adam Dunkels <adam@sics.se>
mamezu 0:0f6c82fcde82 30 *
mamezu 0:0f6c82fcde82 31 */
mamezu 0:0f6c82fcde82 32 #ifndef __LWIP_RAW_H__
mamezu 0:0f6c82fcde82 33 #define __LWIP_RAW_H__
mamezu 0:0f6c82fcde82 34
mamezu 0:0f6c82fcde82 35 #include "lwip/opt.h"
mamezu 0:0f6c82fcde82 36
mamezu 0:0f6c82fcde82 37 #if LWIP_RAW /* don't build if not configured for use in lwipopts.h */
mamezu 0:0f6c82fcde82 38
mamezu 0:0f6c82fcde82 39 #include "lwip/pbuf.h"
mamezu 0:0f6c82fcde82 40 #include "lwip/def.h"
mamezu 0:0f6c82fcde82 41 #include "lwip/ip.h"
mamezu 0:0f6c82fcde82 42 #include "lwip/ip_addr.h"
mamezu 0:0f6c82fcde82 43
mamezu 0:0f6c82fcde82 44 #ifdef __cplusplus
mamezu 0:0f6c82fcde82 45 extern "C" {
mamezu 0:0f6c82fcde82 46 #endif
mamezu 0:0f6c82fcde82 47
mamezu 0:0f6c82fcde82 48 struct raw_pcb;
mamezu 0:0f6c82fcde82 49
mamezu 0:0f6c82fcde82 50 /** Function prototype for raw pcb receive callback functions.
mamezu 0:0f6c82fcde82 51 * @param arg user supplied argument (raw_pcb.recv_arg)
mamezu 0:0f6c82fcde82 52 * @param pcb the raw_pcb which received data
mamezu 0:0f6c82fcde82 53 * @param p the packet buffer that was received
mamezu 0:0f6c82fcde82 54 * @param addr the remote IP address from which the packet was received
mamezu 0:0f6c82fcde82 55 * @return 1 if the packet was 'eaten' (aka. deleted),
mamezu 0:0f6c82fcde82 56 * 0 if the packet lives on
mamezu 0:0f6c82fcde82 57 * If returning 1, the callback is responsible for freeing the pbuf
mamezu 0:0f6c82fcde82 58 * if it's not used any more.
mamezu 0:0f6c82fcde82 59 */
mamezu 0:0f6c82fcde82 60 typedef u8_t (*raw_recv_fn)(void *arg, struct raw_pcb *pcb, struct pbuf *p,
mamezu 0:0f6c82fcde82 61 ip_addr_t *addr);
mamezu 0:0f6c82fcde82 62
mamezu 0:0f6c82fcde82 63 struct raw_pcb {
mamezu 0:0f6c82fcde82 64 /* Common members of all PCB types */
mamezu 0:0f6c82fcde82 65 IP_PCB;
mamezu 0:0f6c82fcde82 66
mamezu 0:0f6c82fcde82 67 struct raw_pcb *next;
mamezu 0:0f6c82fcde82 68
mamezu 0:0f6c82fcde82 69 u8_t protocol;
mamezu 0:0f6c82fcde82 70
mamezu 0:0f6c82fcde82 71 /** receive callback function */
mamezu 0:0f6c82fcde82 72 raw_recv_fn recv;
mamezu 0:0f6c82fcde82 73 /* user-supplied argument for the recv callback */
mamezu 0:0f6c82fcde82 74 void *recv_arg;
mamezu 0:0f6c82fcde82 75 };
mamezu 0:0f6c82fcde82 76
mamezu 0:0f6c82fcde82 77 /* The following functions is the application layer interface to the
mamezu 0:0f6c82fcde82 78 RAW code. */
mamezu 0:0f6c82fcde82 79 struct raw_pcb * raw_new (u8_t proto);
mamezu 0:0f6c82fcde82 80 void raw_remove (struct raw_pcb *pcb);
mamezu 0:0f6c82fcde82 81 err_t raw_bind (struct raw_pcb *pcb, ip_addr_t *ipaddr);
mamezu 0:0f6c82fcde82 82 err_t raw_connect (struct raw_pcb *pcb, ip_addr_t *ipaddr);
mamezu 0:0f6c82fcde82 83
mamezu 0:0f6c82fcde82 84 void raw_recv (struct raw_pcb *pcb, raw_recv_fn recv, void *recv_arg);
mamezu 0:0f6c82fcde82 85 err_t raw_sendto (struct raw_pcb *pcb, struct pbuf *p, ip_addr_t *ipaddr);
mamezu 0:0f6c82fcde82 86 err_t raw_send (struct raw_pcb *pcb, struct pbuf *p);
mamezu 0:0f6c82fcde82 87
mamezu 0:0f6c82fcde82 88 /* The following functions are the lower layer interface to RAW. */
mamezu 0:0f6c82fcde82 89 u8_t raw_input (struct pbuf *p, struct netif *inp);
mamezu 0:0f6c82fcde82 90 #define raw_init() /* Compatibility define, not init needed. */
mamezu 0:0f6c82fcde82 91
mamezu 0:0f6c82fcde82 92 #ifdef __cplusplus
mamezu 0:0f6c82fcde82 93 }
mamezu 0:0f6c82fcde82 94 #endif
mamezu 0:0f6c82fcde82 95
mamezu 0:0f6c82fcde82 96 #endif /* LWIP_RAW */
mamezu 0:0f6c82fcde82 97
mamezu 0:0f6c82fcde82 98 #endif /* __LWIP_RAW_H__ */