ID the MBED processor on the network if you have more than one. View MBED name on DHCP of your Router - Example \"MBED PE\" Change your ID in Core / host.h

Committer:
JeffM
Date:
Sat Nov 06 14:11:02 2010 +0000
Revision:
0:fd3b85615428
MBED ID 1A

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JeffM 0:fd3b85615428 1 /*
JeffM 0:fd3b85615428 2 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
JeffM 0:fd3b85615428 3 * All rights reserved.
JeffM 0:fd3b85615428 4 *
JeffM 0:fd3b85615428 5 * Redistribution and use in source and binary forms, with or without modification,
JeffM 0:fd3b85615428 6 * are permitted provided that the following conditions are met:
JeffM 0:fd3b85615428 7 *
JeffM 0:fd3b85615428 8 * 1. Redistributions of source code must retain the above copyright notice,
JeffM 0:fd3b85615428 9 * this list of conditions and the following disclaimer.
JeffM 0:fd3b85615428 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
JeffM 0:fd3b85615428 11 * this list of conditions and the following disclaimer in the documentation
JeffM 0:fd3b85615428 12 * and/or other materials provided with the distribution.
JeffM 0:fd3b85615428 13 * 3. The name of the author may not be used to endorse or promote products
JeffM 0:fd3b85615428 14 * derived from this software without specific prior written permission.
JeffM 0:fd3b85615428 15 *
JeffM 0:fd3b85615428 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
JeffM 0:fd3b85615428 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
JeffM 0:fd3b85615428 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
JeffM 0:fd3b85615428 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
JeffM 0:fd3b85615428 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
JeffM 0:fd3b85615428 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
JeffM 0:fd3b85615428 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
JeffM 0:fd3b85615428 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
JeffM 0:fd3b85615428 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
JeffM 0:fd3b85615428 25 * OF SUCH DAMAGE.
JeffM 0:fd3b85615428 26 *
JeffM 0:fd3b85615428 27 * This file is part of the lwIP TCP/IP stack.
JeffM 0:fd3b85615428 28 *
JeffM 0:fd3b85615428 29 * Author: Adam Dunkels <adam@sics.se>
JeffM 0:fd3b85615428 30 *
JeffM 0:fd3b85615428 31 */
JeffM 0:fd3b85615428 32
JeffM 0:fd3b85615428 33 #ifndef __LWIP_PBUF_H__
JeffM 0:fd3b85615428 34 #define __LWIP_PBUF_H__
JeffM 0:fd3b85615428 35
JeffM 0:fd3b85615428 36 #include "lwip/opt.h"
JeffM 0:fd3b85615428 37 #include "lwip/err.h"
JeffM 0:fd3b85615428 38
JeffM 0:fd3b85615428 39 #ifdef __cplusplus
JeffM 0:fd3b85615428 40 extern "C" {
JeffM 0:fd3b85615428 41 #endif
JeffM 0:fd3b85615428 42
JeffM 0:fd3b85615428 43 /* Currently, the pbuf_custom code is only needed for one specific configuration
JeffM 0:fd3b85615428 44 * of IP_FRAG */
JeffM 0:fd3b85615428 45 #define LWIP_SUPPORT_CUSTOM_PBUF (IP_FRAG && !IP_FRAG_USES_STATIC_BUF && !LWIP_NETIF_TX_SINGLE_PBUF)
JeffM 0:fd3b85615428 46
JeffM 0:fd3b85615428 47 #define PBUF_TRANSPORT_HLEN 20
JeffM 0:fd3b85615428 48 #define PBUF_IP_HLEN 20
JeffM 0:fd3b85615428 49
JeffM 0:fd3b85615428 50 typedef enum {
JeffM 0:fd3b85615428 51 PBUF_TRANSPORT,
JeffM 0:fd3b85615428 52 PBUF_IP,
JeffM 0:fd3b85615428 53 PBUF_LINK,
JeffM 0:fd3b85615428 54 PBUF_RAW
JeffM 0:fd3b85615428 55 } pbuf_layer;
JeffM 0:fd3b85615428 56
JeffM 0:fd3b85615428 57 typedef enum {
JeffM 0:fd3b85615428 58 PBUF_RAM, /* pbuf data is stored in RAM */
JeffM 0:fd3b85615428 59 PBUF_ROM, /* pbuf data is stored in ROM */
JeffM 0:fd3b85615428 60 PBUF_REF, /* pbuf comes from the pbuf pool */
JeffM 0:fd3b85615428 61 PBUF_POOL /* pbuf payload refers to RAM */
JeffM 0:fd3b85615428 62 } pbuf_type;
JeffM 0:fd3b85615428 63
JeffM 0:fd3b85615428 64
JeffM 0:fd3b85615428 65 /* indicates this packet's data should be immediately passed to the application */
JeffM 0:fd3b85615428 66 #define PBUF_FLAG_PUSH 0x01U
JeffM 0:fd3b85615428 67 /* indicates this is a custom pbuf: pbuf_free and pbuf_header handle such a
JeffM 0:fd3b85615428 68 a pbuf differently */
JeffM 0:fd3b85615428 69 #define PBUF_FLAG_IS_CUSTOM 0x02U
JeffM 0:fd3b85615428 70 /* indicates this pbuf is UDP multicast to be looped back */
JeffM 0:fd3b85615428 71 #define PBUF_FLAG_MCASTLOOP 0x04U
JeffM 0:fd3b85615428 72
JeffM 0:fd3b85615428 73 struct pbuf {
JeffM 0:fd3b85615428 74 /* next pbuf in singly linked pbuf chain */
JeffM 0:fd3b85615428 75 struct pbuf *next;
JeffM 0:fd3b85615428 76
JeffM 0:fd3b85615428 77 /* pointer to the actual data in the buffer */
JeffM 0:fd3b85615428 78 void *payload;
JeffM 0:fd3b85615428 79
JeffM 0:fd3b85615428 80 /**
JeffM 0:fd3b85615428 81 * total length of this buffer and all next buffers in chain
JeffM 0:fd3b85615428 82 * belonging to the same packet.
JeffM 0:fd3b85615428 83 *
JeffM 0:fd3b85615428 84 * For non-queue packet chains this is the invariant:
JeffM 0:fd3b85615428 85 * p->tot_len == p->len + (p->next? p->next->tot_len: 0)
JeffM 0:fd3b85615428 86 */
JeffM 0:fd3b85615428 87 u16_t tot_len;
JeffM 0:fd3b85615428 88
JeffM 0:fd3b85615428 89 /* length of this buffer */
JeffM 0:fd3b85615428 90 u16_t len;
JeffM 0:fd3b85615428 91
JeffM 0:fd3b85615428 92 /* pbuf_type as u8_t instead of enum to save space */
JeffM 0:fd3b85615428 93 u8_t /*pbuf_type*/ type;
JeffM 0:fd3b85615428 94
JeffM 0:fd3b85615428 95 /* misc flags */
JeffM 0:fd3b85615428 96 u8_t flags;
JeffM 0:fd3b85615428 97
JeffM 0:fd3b85615428 98 /**
JeffM 0:fd3b85615428 99 * the reference count always equals the number of pointers
JeffM 0:fd3b85615428 100 * that refer to this pbuf. This can be pointers from an application,
JeffM 0:fd3b85615428 101 * the stack itself, or pbuf->next pointers from a chain.
JeffM 0:fd3b85615428 102 */
JeffM 0:fd3b85615428 103 u16_t ref;
JeffM 0:fd3b85615428 104 };
JeffM 0:fd3b85615428 105
JeffM 0:fd3b85615428 106 #if LWIP_SUPPORT_CUSTOM_PBUF
JeffM 0:fd3b85615428 107 /* Prototype for a function to free a custom pbuf */
JeffM 0:fd3b85615428 108 typedef void (*pbuf_free_custom_fn)(struct pbuf *p);
JeffM 0:fd3b85615428 109
JeffM 0:fd3b85615428 110 /* A custom pbuf: like a pbuf, but following a function pointer to free it. */
JeffM 0:fd3b85615428 111 struct pbuf_custom {
JeffM 0:fd3b85615428 112 /* The actual pbuf */
JeffM 0:fd3b85615428 113 struct pbuf pbuf;
JeffM 0:fd3b85615428 114 /* This function is called when pbuf_free deallocates this pbuf(_custom) */
JeffM 0:fd3b85615428 115 pbuf_free_custom_fn custom_free_function;
JeffM 0:fd3b85615428 116 };
JeffM 0:fd3b85615428 117 #endif /* LWIP_SUPPORT_CUSTOM_PBUF */
JeffM 0:fd3b85615428 118
JeffM 0:fd3b85615428 119 /* Initializes the pbuf module. This call is empty for now, but may not be in future. */
JeffM 0:fd3b85615428 120 #define pbuf_init()
JeffM 0:fd3b85615428 121
JeffM 0:fd3b85615428 122 struct pbuf *pbuf_alloc(pbuf_layer l, u16_t length, pbuf_type type);
JeffM 0:fd3b85615428 123 #if LWIP_SUPPORT_CUSTOM_PBUF
JeffM 0:fd3b85615428 124 struct pbuf *pbuf_alloced_custom(pbuf_layer l, u16_t length, pbuf_type type,
JeffM 0:fd3b85615428 125 struct pbuf_custom *p, void *payload_mem,
JeffM 0:fd3b85615428 126 u16_t payload_mem_len);
JeffM 0:fd3b85615428 127 #endif /* LWIP_SUPPORT_CUSTOM_PBUF */
JeffM 0:fd3b85615428 128 void pbuf_realloc(struct pbuf *p, u16_t size);
JeffM 0:fd3b85615428 129 u8_t pbuf_header(struct pbuf *p, s16_t header_size);
JeffM 0:fd3b85615428 130 void pbuf_ref(struct pbuf *p);
JeffM 0:fd3b85615428 131 u8_t pbuf_free(struct pbuf *p);
JeffM 0:fd3b85615428 132 u8_t pbuf_clen(struct pbuf *p);
JeffM 0:fd3b85615428 133 void pbuf_cat(struct pbuf *head, struct pbuf *tail);
JeffM 0:fd3b85615428 134 void pbuf_chain(struct pbuf *head, struct pbuf *tail);
JeffM 0:fd3b85615428 135 struct pbuf *pbuf_dechain(struct pbuf *p);
JeffM 0:fd3b85615428 136 err_t pbuf_copy(struct pbuf *p_to, struct pbuf *p_from);
JeffM 0:fd3b85615428 137 u16_t pbuf_copy_partial(struct pbuf *p, void *dataptr, u16_t len, u16_t offset);
JeffM 0:fd3b85615428 138 err_t pbuf_take(struct pbuf *buf, const void *dataptr, u16_t len);
JeffM 0:fd3b85615428 139 struct pbuf *pbuf_coalesce(struct pbuf *p, pbuf_layer layer);
JeffM 0:fd3b85615428 140 #if LWIP_CHECKSUM_ON_COPY
JeffM 0:fd3b85615428 141 err_t pbuf_fill_chksum(struct pbuf *p, u16_t start_offset, const void *dataptr,
JeffM 0:fd3b85615428 142 u16_t len, u16_t *chksum);
JeffM 0:fd3b85615428 143 #endif /* LWIP_CHECKSUM_ON_COPY */
JeffM 0:fd3b85615428 144
JeffM 0:fd3b85615428 145 u8_t pbuf_get_at(struct pbuf* p, u16_t offset);
JeffM 0:fd3b85615428 146 u16_t pbuf_memcmp(struct pbuf* p, u16_t offset, const void* s2, u16_t n);
JeffM 0:fd3b85615428 147 u16_t pbuf_memfind(struct pbuf* p, const void* mem, u16_t mem_len, u16_t start_offset);
JeffM 0:fd3b85615428 148 u16_t pbuf_strstr(struct pbuf* p, const char* substr);
JeffM 0:fd3b85615428 149
JeffM 0:fd3b85615428 150 #ifdef __cplusplus
JeffM 0:fd3b85615428 151 }
JeffM 0:fd3b85615428 152 #endif
JeffM 0:fd3b85615428 153
JeffM 0:fd3b85615428 154 #endif /* __LWIP_PBUF_H__ */