hattori&ide

Dependencies:   mbed

Committer:
hattori_atsushi
Date:
Sun Dec 18 08:16:01 2022 +0000
Revision:
0:f77369cabd75
hattori

Who changed what in which revision?

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