?lang_form? ?lang_select? ?lang_submit? ?lang_endform?
{HEADER END}
{BLAME START}

library

?curdirlinks? -

Blame information for rev 32

Line No. Rev Author Line
1 32 kaklik /*********************************************************************
2 *
3 * IP Defs for Microchip TCP/IP Stack
4 *
5 *********************************************************************
6 * FileName: IP.h
7 * Dependencies: StackTsk.h
8 * MAC.h
9 * Processor: PIC18, PIC24F, PIC24H, dsPIC30F, dsPIC33F, PIC32
10 * Compiler: Microchip C32 v1.05 or higher
11 * Microchip C30 v3.12 or higher
12 * Microchip C18 v3.30 or higher
13 * HI-TECH PICC-18 PRO 9.63PL2 or higher
14 * Company: Microchip Technology, Inc.
15 *
16 * Software License Agreement
17 *
18 * Copyright (C) 2002-2009 Microchip Technology Inc. All rights
19 * reserved.
20 *
21 * Microchip licenses to you the right to use, modify, copy, and
22 * distribute:
23 * (i) the Software when embedded on a Microchip microcontroller or
24 * digital signal controller product ("Device") which is
25 * integrated into Licensee's product; or
26 * (ii) ONLY the Software driver source files ENC28J60.c, ENC28J60.h,
27 * ENCX24J600.c and ENCX24J600.h ported to a non-Microchip device
28 * used in conjunction with a Microchip ethernet controller for
29 * the sole purpose of interfacing with the ethernet controller.
30 *
31 * You should refer to the license agreement accompanying this
32 * Software for additional information regarding your rights and
33 * obligations.
34 *
35 * THE SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT
36 * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT
37 * LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A
38 * PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
39 * MICROCHIP BE LIABLE FOR ANY INCIDENTAL, SPECIAL, INDIRECT OR
40 * CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF
41 * PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR SERVICES, ANY CLAIMS
42 * BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE
43 * THEREOF), ANY CLAIMS FOR INDEMNITY OR CONTRIBUTION, OR OTHER
44 * SIMILAR COSTS, WHETHER ASSERTED ON THE BASIS OF CONTRACT, TORT
45 * (INCLUDING NEGLIGENCE), BREACH OF WARRANTY, OR OTHERWISE.
46 *
47 *
48 * Author Date Comment
49 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
50 * Nilesh Rajbharti 4/27/01 Original (Rev 1.0)
51 * Nilesh Rajbharti 2/9/02 Cleanup
52 * Nilesh Rajbharti 5/22/02 Rev 2.0 (See version.log for detail)
53 ********************************************************************/
54 #ifndef __IP_H
55 #define __IP_H
56  
57  
58 #define IP_PROT_ICMP (1u)
59 #define IP_PROT_TCP (6u)
60 #define IP_PROT_UDP (17u)
61  
62  
63 // IP packet header definition
64 typedef struct _IP_HEADER
65 {
66 BYTE VersionIHL;
67 BYTE TypeOfService;
68 WORD TotalLength;
69 WORD Identification;
70 WORD FragmentInfo;
71 BYTE TimeToLive;
72 BYTE Protocol;
73 WORD HeaderChecksum;
74 IP_ADDR SourceAddress;
75 IP_ADDR DestAddress;
76 } IP_HEADER;
77  
78 // IP Pseudo header as defined by RFC 793 (needed for TCP and UDP
79 // checksum calculations/verification)
80 typedef struct _PSEUDO_HEADER
81 {
82 IP_ADDR SourceAddress;
83 IP_ADDR DestAddress;
84 BYTE Zero;
85 BYTE Protocol;
86 WORD Length;
87 } PSEUDO_HEADER;
88  
89 #define SwapPseudoHeader(h) (h.Length = swaps(h.Length))
90  
91  
92 /*********************************************************************
93 * Function: BOOL IPIsTxReady(BOOL HighPriority)
94 *
95 * PreCondition: None
96 *
97 * Input: None
98 *
99 * Output: TRUE if transmit buffer is empty
100 * FALSE if transmit buffer is not empty
101 *
102 * Side Effects: None
103 *
104 * Note: None
105 *
106 ********************************************************************/
107 #define IPIsTxReady() MACIsTxReady()
108  
109  
110 /*********************************************************************
111 * Macro: IPSetTxBuffer(a, b)
112 *
113 * PreCondition: None
114 *
115 * Input: a - Buffer identifier
116 * b - Offset
117 *
118 * Output: Next Read/Write access to transmit buffer 'a'
119 * set to offset 'b'
120 *
121 * Side Effects: None
122 *
123 * Note: None
124 *
125 ********************************************************************/
126 #define IPSetTxBuffer(b) MACSetWritePtr(b + BASE_TX_ADDR + sizeof(ETHER_HEADER) + sizeof(IP_HEADER))
127  
128  
129  
130 /*********************************************************************
131 * Function: WORD IPPutHeader( IP_ADDR *Dest,
132 * BYTE Protocol,
133 * WORD Identifier,
134 * WORD DataLen)
135 *
136 * PreCondition: IPIsTxReady() == TRUE
137 *
138 * Input: Src - Destination node address
139 * Protocol - Current packet protocol
140 * Identifier - Current packet identifier
141 * DataLen - Current packet data length
142 *
143 * Output: Handle to current packet - For use by
144 * IPSendByte() function.
145 *
146 * Side Effects: None
147 *
148 * Note: Only one IP message can be transmitted at any
149 * time.
150 * Caller may not transmit and receive a message
151 * at the same time.
152 *
153 ********************************************************************/
154 WORD IPPutHeader(NODE_INFO *remote,
155 BYTE protocol,
156 WORD len);
157  
158  
159 /*********************************************************************
160 * Function: BOOL IPGetHeader( IP_ADDR *localIP,
161 * NODE_INFO *remote,
162 * BYTE *Protocol,
163 * WORD *len)
164 *
165 * PreCondition: MACGetHeader() == TRUE
166 *
167 * Input: localIP - Local node IP Address as received
168 * in current IP header.
169 * If this information is not required
170 * caller may pass NULL value.
171 * remote - Remote node info
172 * Protocol - Current packet protocol
173 * len - Current packet data length
174 *
175 * Output: TRUE, if valid packet was received
176 * FALSE otherwise
177 *
178 * Side Effects: None
179 *
180 * Note: Only one IP message can be received.
181 * Caller may not transmit and receive a message
182 * at the same time.
183 *
184 ********************************************************************/
185 BOOL IPGetHeader(IP_ADDR *localIP,
186 NODE_INFO *remote,
187 BYTE *protocol,
188 WORD *len);
189  
190  
191 /*********************************************************************
192 * Macro: IPDiscard()
193 *
194 * PreCondition: MACGetHeader() == TRUE
195 *
196 * Input: None
197 *
198 * Output: Current packet is discarded and buffer is
199 * freed-up
200 *
201 * Side Effects: None
202 *
203 * Note: None
204 *
205 ********************************************************************/
206 #define IPDiscard() MACDiscard()
207  
208  
209  
210 /*********************************************************************
211 * Macro: IPGetArray(a, b)
212 *
213 * PreCondition: MACGetHeader() == TRUE
214 *
215 * Input: a - Data buffer
216 * b - Buffer length
217 *
218 * Output: None
219 *
220 * Side Effects: None
221 *
222 * Note: Data is copied from IP data to given buffer
223 *
224 ********************************************************************/
225 #define IPGetArray(a, b) MACGetArray(a, b)
226  
227  
228  
229  
230 /*********************************************************************
231 * Function: IPSetRxBuffer(WORD Offset)
232 *
233 * PreCondition: IPHeaderLen must have been intialized by
234 * IPGetHeader() or IPPutHeader()
235 *
236 * Input: Offset from beginning of IP data field
237 *
238 * Output: Next Read/Write access to receive buffer is
239 * set to Offset
240 *
241 * Side Effects: None
242 *
243 * Note: None
244 *
245 ********************************************************************/
246 void IPSetRxBuffer(WORD Offset);
247  
248  
249  
250  
251  
252 #endif
253  
254  
255  
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3