?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 * Helper Function Defs for Microchip TCP/IP Stack
4 *
5 *********************************************************************
6 * FileName: Helpers.h
7 * Dependencies: stacktsk.h
8 * Processor: PIC18, PIC24F, PIC24H, dsPIC30F, dsPIC33F, PIC32
9 * Compiler: Microchip C32 v1.05 or higher
10 * Microchip C30 v3.12 or higher
11 * Microchip C18 v3.30 or higher
12 * HI-TECH PICC-18 PRO 9.63PL2 or higher
13 * Company: Microchip Technology, Inc.
14 *
15 * Software License Agreement
16 *
17 * Copyright (C) 2002-2009 Microchip Technology Inc. All rights
18 * reserved.
19 *
20 * Microchip licenses to you the right to use, modify, copy, and
21 * distribute:
22 * (i) the Software when embedded on a Microchip microcontroller or
23 * digital signal controller product ("Device") which is
24 * integrated into Licensee's product; or
25 * (ii) ONLY the Software driver source files ENC28J60.c, ENC28J60.h,
26 * ENCX24J600.c and ENCX24J600.h ported to a non-Microchip device
27 * used in conjunction with a Microchip ethernet controller for
28 * the sole purpose of interfacing with the ethernet controller.
29 *
30 * You should refer to the license agreement accompanying this
31 * Software for additional information regarding your rights and
32 * obligations.
33 *
34 * THE SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT
35 * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT
36 * LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A
37 * PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
38 * MICROCHIP BE LIABLE FOR ANY INCIDENTAL, SPECIAL, INDIRECT OR
39 * CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF
40 * PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR SERVICES, ANY CLAIMS
41 * BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE
42 * THEREOF), ANY CLAIMS FOR INDEMNITY OR CONTRIBUTION, OR OTHER
43 * SIMILAR COSTS, WHETHER ASSERTED ON THE BASIS OF CONTRACT, TORT
44 * (INCLUDING NEGLIGENCE), BREACH OF WARRANTY, OR OTHERWISE.
45 *
46 *
47 * Author Date Comment
48 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
49 * Nilesh Rajbharti 5/17/01 Original (Rev 1.0)
50 * Nilesh Rajbharti 2/9/02 Cleanup
51 ********************************************************************/
52 #ifndef __HELPERS_H
53 #define __HELPERS_H
54  
55  
56 #if !defined(__18CXX) || defined(HI_TECH_C)
57 char *strupr(char* s);
58  
59 #if defined(HI_TECH_C)
60 // HI-TECH PICC-18 PRO 9.63 seems to already have a ultoa() library
61 // function, but the parameter list is different!
62 #define ultoa(val,buf) ultoa((buf),(val),10)
63 #else
64 void ultoa(DWORD Value, BYTE* Buffer);
65 #endif
66 #endif
67  
68 #if defined(DEBUG)
69 #define DebugPrint(a) {putrsUART(a);}
70 #else
71 #define DebugPrint(a)
72 #endif
73  
74 DWORD GenerateRandomDWORD(void);
75 void uitoa(WORD Value, BYTE* Buffer);
76 void UnencodeURL(BYTE* URL);
77 WORD Base64Decode(BYTE* cSourceData, WORD wSourceLen, BYTE* cDestData, WORD wDestLen);
78 WORD Base64Encode(BYTE* cSourceData, WORD wSourceLen, BYTE* cDestData, WORD wDestLen);
79 BOOL StringToIPAddress(BYTE* str, IP_ADDR* IPAddress);
80 BYTE ReadStringUART(BYTE* Dest, BYTE BufferLen);
81 BYTE hexatob(WORD_VAL AsciiChars);
82 BYTE btohexa_high(BYTE b);
83 BYTE btohexa_low(BYTE b);
84 signed char stricmppgm2ram(BYTE* a, ROM BYTE* b);
85 char * strnchr(const char *searchString, size_t count, char c);
86  
87 #if defined(__18CXX)
88 BOOL ROMStringToIPAddress(ROM BYTE* str, IP_ADDR* IPAddress);
89 #else
90 // Non-ROM variant for C30 and C32
91 #define ROMStringToIPAddress(a,b) StringToIPAddress((BYTE*)a,b)
92 #endif
93  
94  
95 WORD swaps(WORD v);
96 DWORD swapl(DWORD v);
97  
98 WORD CalcIPChecksum(BYTE* buffer, WORD len);
99 WORD CalcIPBufferChecksum(WORD len);
100  
101 #if defined(__18CXX)
102 DWORD leftRotateDWORD(DWORD val, BYTE bits);
103 #else
104 // Rotations are more efficient in C30 and C32
105 #define leftRotateDWORD(x, n) (((x) << (n)) | ((x) >> (32-(n))))
106 #endif
107  
108 void FormatNetBIOSName(BYTE Name[16]);
109  
110  
111 // Protocols understood by the ExtractURLFields() function. IMPORTANT: If you
112 // need to reorder these (change their constant values), you must also reorder
113 // the constant arrays in ExtractURLFields().
114 typedef enum
115 {
116 PROTOCOL_HTTP = 0u,
117 PROTOCOL_HTTPS,
118 PROTOCOL_MMS,
119 PROTOCOL_RTSP
120 } PROTOCOLS;
121  
122 BYTE ExtractURLFields(BYTE *vURL, PROTOCOLS *protocol, BYTE *vUsername, WORD *wUsernameLen, BYTE *vPassword, WORD *wPasswordLen, BYTE *vHostname, WORD *wHostnameLen, WORD *wPort, BYTE *vFilePath, WORD *wFilePathLen);
123 SHORT Replace(BYTE *vExpression, ROM BYTE *vFind, ROM BYTE *vReplacement, WORD wMaxLen, BOOL bSearchCaseInsensitive);
124  
125 #endif
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3