/[H8]/trunk/docs/Microchip TCP_IP stack/Include/TCPIP Stack/UDP.h
ViewVC logotype

Annotation of /trunk/docs/Microchip TCP_IP stack/Include/TCPIP Stack/UDP.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 15 - (hide annotations) (download)
Thu Apr 19 09:01:15 2007 UTC (17 years, 3 months ago) by hedin
File MIME type: text/plain
File size: 4853 byte(s)
added the TCP/IP stack, source code.
1 hedin 15 /*********************************************************************
2     *
3     * UDP Module Defs for Microchip TCP/IP Stack
4     *
5     *********************************************************************
6     * FileName: UDP.h
7     * Dependencies: StackTsk.h
8     * MAC.h
9     * Processor: PIC18, PIC24F, PIC24H, dsPIC30F, dsPIC33F
10     * Complier: Microchip C18 v3.02 or higher
11     * Microchip C30 v2.01 or higher
12     * Company: Microchip Technology, Inc.
13     *
14     * Software License Agreement
15     *
16     * Copyright © 2002-2007 Microchip Technology Inc. All rights
17     * reserved.
18     *
19     * Microchip licenses to you the right to use, modify, copy, and
20     * distribute:
21     * (i) the Software when embedded on a Microchip microcontroller or
22     * digital signal controller product (“Device”) which is
23     * integrated into Licensee’s product; or
24     * (ii) ONLY the Software driver source files ENC28J60.c and
25     * ENC28J60.h ported to a non-Microchip device used in
26     * conjunction with a Microchip ethernet controller for the
27     * sole purpose of interfacing with the ethernet controller.
28     *
29     * You should refer to the license agreement accompanying this
30     * Software for additional information regarding your rights and
31     * obligations.
32     *
33     * THE SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS” WITHOUT
34     * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT
35     * LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A
36     * PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
37     * MICROCHIP BE LIABLE FOR ANY INCIDENTAL, SPECIAL, INDIRECT OR
38     * CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF
39     * PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR SERVICES, ANY CLAIMS
40     * BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE
41     * THEREOF), ANY CLAIMS FOR INDEMNITY OR CONTRIBUTION, OR OTHER
42     * SIMILAR COSTS, WHETHER ASSERTED ON THE BASIS OF CONTRACT, TORT
43     * (INCLUDING NEGLIGENCE), BREACH OF WARRANTY, OR OTHERWISE.
44     *
45     *
46     * Author Date Comment
47     *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
48     * Nilesh Rajbharti 3/19/01 Original (Rev 1.0)
49     ********************************************************************/
50     #ifndef __UDP_H
51     #define __UDP_H
52    
53    
54     typedef WORD UDP_PORT;
55     typedef BYTE UDP_SOCKET;
56    
57     typedef struct _UDP_SOCKET_INFO
58     {
59     NODE_INFO remoteNode;
60     UDP_PORT remotePort;
61     UDP_PORT localPort;
62     WORD TxCount;
63     WORD RxCount;
64    
65     struct
66     {
67     unsigned char bFirstRead : 1;
68     } Flags;
69    
70     } UDP_SOCKET_INFO;
71    
72    
73     #define INVALID_UDP_SOCKET (0xffu)
74     #define INVALID_UDP_PORT (0ul)
75    
76     /*
77     * All module utilizing UDP module will get extern definition of
78     * activeUDPSocket. While UDP module itself will define activeUDPSocket.
79     */
80     #if !defined(__UDP_C)
81     extern UDP_SOCKET activeUDPSocket;
82     extern UDP_SOCKET_INFO UDPSocketInfo[MAX_UDP_SOCKETS];
83     #endif
84    
85    
86     typedef struct _UDP_HEADER
87     {
88     UDP_PORT SourcePort;
89     UDP_PORT DestinationPort;
90     WORD Length;
91     WORD Checksum;
92     } UDP_HEADER;
93    
94    
95     void UDPInit(void);
96    
97     UDP_SOCKET UDPOpen(UDP_PORT localPort, NODE_INFO *remoteNode, UDP_PORT remotePort);
98     void UDPClose(UDP_SOCKET s);
99     BOOL UDPProcess(NODE_INFO *remoteNode, IP_ADDR *localIP, WORD len);
100    
101     WORD UDPIsPutReady(UDP_SOCKET s);
102     BOOL UDPPut(BYTE v);
103     WORD UDPPutArray(BYTE *cData, WORD wDataLen);
104     WORD UDPPutROMArray(ROM BYTE *cData, WORD wDataLen);
105     BYTE* UDPPutString(BYTE *strData);
106     ROM BYTE* UDPPutROMString(ROM BYTE *strData);
107     void UDPFlush(void);
108    
109     WORD UDPIsGetReady(UDP_SOCKET s);
110     BOOL UDPGet(BYTE *v);
111     WORD UDPGetArray(BYTE *cData, WORD wDataLen);
112     void UDPDiscard(void);
113    
114    
115     /*********************************************************************
116     * Macro: UDPSetTxBuffer(a, b)
117     *
118     * PreCondition: None
119     *
120     * Input: a - Buffer identifier
121     * b - Offset
122     *
123     * Output: Next Read/Write access to transmit buffer 'a'
124     * set to offset 'b'
125     *
126     * Side Effects: None
127     *
128     * Note: None
129     *
130     ********************************************************************/
131     #define UDPSetTxBuffer(b) IPSetTxBuffer(b+sizeof(UDP_HEADER))
132    
133    
134     /*********************************************************************
135     * Macro: UDPSetRxBuffer(a)
136     *
137     * PreCondition: None
138     *
139     * Input: a - Offset
140     *
141     * Output: Next Read/Write access to receive buffer is
142     * set to offset 'b'
143     *
144     * Side Effects: None
145     *
146     * Note: None
147     *
148     ********************************************************************/
149     #define UDPSetRxBuffer(a) IPSetRxBuffer(a+sizeof(UDP_HEADER))
150    
151    
152     #endif

  ViewVC Help
Powered by ViewVC 1.1.20