STM32F769IDiscovery
1.00
uDANTE Audio Networking with STM32F7 DISCO board
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
Eclipse_WS2
STM32F769IDiscovery
Middlewares
Third_Party
LwIP
src
include
lwip
netbuf.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
3
* All rights reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without modification,
6
* are permitted provided that the following conditions are met:
7
*
8
* 1. Redistributions of source code must retain the above copyright notice,
9
* this list of conditions and the following disclaimer.
10
* 2. Redistributions in binary form must reproduce the above copyright notice,
11
* this list of conditions and the following disclaimer in the documentation
12
* and/or other materials provided with the distribution.
13
* 3. The name of the author may not be used to endorse or promote products
14
* derived from this software without specific prior written permission.
15
*
16
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
19
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
21
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
24
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
25
* OF SUCH DAMAGE.
26
*
27
* This file is part of the lwIP TCP/IP stack.
28
*
29
* Author: Adam Dunkels <adam@sics.se>
30
*
31
*/
32
#ifndef LWIP_HDR_NETBUF_H
33
#define LWIP_HDR_NETBUF_H
34
35
#include "
lwip/opt.h
"
36
37
#if LWIP_NETCONN || LWIP_SOCKET
/* don't build if not configured for use in lwipopts.h */
38
/* Note: Netconn API is always available when sockets are enabled -
39
* sockets are implemented on top of them */
40
41
#include "
lwip/pbuf.h
"
42
#include "
lwip/ip_addr.h
"
43
#include "
lwip/ip6_addr.h
"
44
45
#ifdef __cplusplus
46
extern
"C"
{
47
#endif
48
50
#define NETBUF_FLAG_DESTADDR 0x01
51
52
#define NETBUF_FLAG_CHKSUM 0x02
53
54
struct
netbuf {
55
struct
pbuf
*p, *ptr;
56
ip_addr_t
addr;
57
u16_t
port;
58
#if LWIP_NETBUF_RECVINFO || LWIP_CHECKSUM_ON_COPY
59
#if LWIP_CHECKSUM_ON_COPY
60
u8_t
flags
;
61
#endif
/* LWIP_CHECKSUM_ON_COPY */
62
u16_t
toport_chksum;
63
#if LWIP_NETBUF_RECVINFO
64
ip_addr_t
toaddr;
65
#endif
/* LWIP_NETBUF_RECVINFO */
66
#endif
/* LWIP_NETBUF_RECVINFO || LWIP_CHECKSUM_ON_COPY */
67
};
68
69
/* Network buffer functions: */
70
struct
netbuf * netbuf_new (
void
);
71
void
netbuf_delete (
struct
netbuf *buf);
72
void
* netbuf_alloc (
struct
netbuf *buf,
u16_t
size);
73
void
netbuf_free (
struct
netbuf *buf);
74
err_t
netbuf_ref (
struct
netbuf *buf,
75
const
void
*dataptr,
u16_t
size);
76
void
netbuf_chain (
struct
netbuf *head,
struct
netbuf *tail);
77
78
err_t
netbuf_data (
struct
netbuf *buf,
79
void
**dataptr,
u16_t
*len);
80
s8_t
netbuf_next (
struct
netbuf *buf);
81
void
netbuf_first (
struct
netbuf *buf);
82
83
84
#define netbuf_copy_partial(buf, dataptr, len, offset) \
85
pbuf_copy_partial((buf)->p, (dataptr), (len), (offset))
86
#define netbuf_copy(buf,dataptr,len) netbuf_copy_partial(buf, dataptr, len, 0)
87
#define netbuf_take(buf, dataptr, len) pbuf_take((buf)->p, dataptr, len)
88
#define netbuf_len(buf) ((buf)->p->tot_len)
89
#define netbuf_fromaddr(buf) (&((buf)->addr))
90
#define netbuf_set_fromaddr(buf, fromaddr) ip_addr_set(&((buf)->addr), fromaddr)
91
#define netbuf_fromport(buf) ((buf)->port)
92
#if LWIP_NETBUF_RECVINFO
93
#define netbuf_destaddr(buf) (&((buf)->toaddr))
94
#define netbuf_set_destaddr(buf, destaddr) ip_addr_set(&((buf)->toaddr), destaddr)
95
#if LWIP_CHECKSUM_ON_COPY
96
#define netbuf_destport(buf) (((buf)->flags & NETBUF_FLAG_DESTADDR) ? (buf)->toport_chksum : 0)
97
#else
/* LWIP_CHECKSUM_ON_COPY */
98
#define netbuf_destport(buf) ((buf)->toport_chksum)
99
#endif
/* LWIP_CHECKSUM_ON_COPY */
100
#endif
/* LWIP_NETBUF_RECVINFO */
101
#if LWIP_CHECKSUM_ON_COPY
102
#define netbuf_set_chksum(buf, chksum) do { (buf)->flags = NETBUF_FLAG_CHKSUM; \
103
(buf)->toport_chksum = chksum; } while(0)
104
#endif
/* LWIP_CHECKSUM_ON_COPY */
105
106
#ifdef __cplusplus
107
}
108
#endif
109
110
#endif
/* LWIP_NETCONN || LWIP_SOCKET */
111
112
#endif
/* LWIP_HDR_NETBUF_H */
113
s8_t
signed char s8_t
Definition:
cc.h:39
opt.h
ip6_addr.h
pbuf::flags
u8_t flags
Definition:
pbuf.h:131
pbuf
Definition:
pbuf.h:108
err_t
s8_t err_t
Definition:
err.h:47
pbuf.h
u8_t
unsigned char u8_t
Definition:
cc.h:38
ip_addr_t
ip6_addr_t ip_addr_t
Definition:
ip_addr.h:194
ip_addr.h
u16_t
unsigned short u16_t
Definition:
cc.h:40
Generated by
1.8.11