Back to home page

Quest Cross Reference

 
 

    


Warning, cross-references for /kernel/include/lwip/raw.h need to be fixed.

0001 /*
0002  * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
0003  * All rights reserved.
0004  *
0005  * Redistribution and use in source and binary forms, with or without modification,
0006  * are permitted provided that the following conditions are met:
0007  *
0008  * 1. Redistributions of source code must retain the above copyright notice,
0009  *    this list of conditions and the following disclaimer.
0010  * 2. Redistributions in binary form must reproduce the above copyright notice,
0011  *    this list of conditions and the following disclaimer in the documentation
0012  *    and/or other materials provided with the distribution.
0013  * 3. The name of the author may not be used to endorse or promote products
0014  *    derived from this software without specific prior written permission.
0015  *
0016  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
0017  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
0018  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
0019  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
0020  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
0021  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0022  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0023  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
0024  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
0025  * OF SUCH DAMAGE.
0026  *
0027  * This file is part of the lwIP TCP/IP stack.
0028  *
0029  * Author: Adam Dunkels <adam@sics.se>
0030  *
0031  */
0032 #ifndef __LWIP_RAW_H__
0033 #define __LWIP_RAW_H__
0034 
0035 #include "lwip/opt.h"
0036 
0037 #if LWIP_RAW /* don't build if not configured for use in lwipopts.h */
0038 
0039 #include "lwip/pbuf.h"
0040 #include "lwip/inet.h"
0041 #include "lwip/ip.h"
0042 #include "lwip/ip_addr.h"
0043 
0044 #ifdef __cplusplus
0045 extern "C" {
0046 #endif
0047 
0048 struct raw_pcb {
0049 /* Common members of all PCB types */
0050   IP_PCB;
0051 
0052   struct raw_pcb *next;
0053 
0054   u8_t protocol;
0055 
0056   /* receive callback function
0057    * @param arg user supplied argument (raw_pcb.recv_arg)
0058    * @param pcb the raw_pcb which received data
0059    * @param p the packet buffer that was received
0060    * @param addr the remote IP address from which the packet was received
0061    * @return 1 if the packet was 'eaten' (aka. deleted),
0062    *         0 if the packet lives on
0063    * If returning 1, the callback is responsible for freeing the pbuf
0064    * if it's not used any more.
0065    */
0066   u8_t (* recv)(void *arg, struct raw_pcb *pcb, struct pbuf *p,
0067     struct ip_addr *addr);
0068   /* user-supplied argument for the recv callback */
0069   void *recv_arg;
0070 };
0071 
0072 /* The following functions is the application layer interface to the
0073    RAW code. */
0074 struct raw_pcb * raw_new        (u8_t proto);
0075 void             raw_remove     (struct raw_pcb *pcb);
0076 err_t            raw_bind       (struct raw_pcb *pcb, struct ip_addr *ipaddr);
0077 err_t            raw_connect    (struct raw_pcb *pcb, struct ip_addr *ipaddr);
0078 
0079 void             raw_recv       (struct raw_pcb *pcb,
0080                                  u8_t (* recv)(void *arg, struct raw_pcb *pcb,
0081                                               struct pbuf *p,
0082                                               struct ip_addr *addr),
0083                                  void *recv_arg);
0084 err_t            raw_sendto     (struct raw_pcb *pcb, struct pbuf *p, struct ip_addr *ipaddr);
0085 err_t            raw_send       (struct raw_pcb *pcb, struct pbuf *p);
0086 
0087 /* The following functions are the lower layer interface to RAW. */
0088 u8_t             raw_input      (struct pbuf *p, struct netif *inp);
0089 #define raw_init() /* Compatibility define, not init needed. */
0090 
0091 #ifdef __cplusplus
0092 }
0093 #endif
0094 
0095 #endif /* LWIP_RAW */
0096 
0097 #endif /* __LWIP_RAW_H__ */