Subversion Repositories HomeAutomation

Rev

Details | Last modification | View Log | SVN | RSS feed

Rev Author Line No. Line
363 johboh 1
/*********************************************************************
2
 *
3
 *                  ICMP Module Defs for Microchip TCP/IP Stack
4
 *
5
 *********************************************************************
6
 * FileName:        ICMP.h
7
 * Dependencies:    StackTsk.h
8
 *                  IP.h
9
 *                  MAC.h
10
 * Processor:       PIC18, PIC24F, PIC24H, dsPIC30F, dsPIC33F
11
 * Complier:        Microchip C18 v3.02 or higher
12
 *                  Microchip C30 v2.01 or higher
13
 * Company:         Microchip Technology, Inc.
14
 *
15
 * Software License Agreement
16
 *
17
 * This software is owned by Microchip Technology Inc. ("Microchip")
18
 * and is supplied to you for use exclusively as described in the
19
 * associated software agreement.  This software is protected by
20
 * software and other intellectual property laws.  Any use in
21
 * violation of the software license may subject the user to criminal
22
 * sanctions as well as civil liability.  Copyright 2006 Microchip
23
 * Technology Inc.  All rights reserved.
24
 *
25
 * This software is provided "AS IS."  MICROCHIP DISCLAIMS ALL
26
 * WARRANTIES, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, NOT LIMITED
27
 * TO MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
28
 * INFRINGEMENT.  Microchip shall in no event be liable for special,
29
 * incidental, or consequential damages.
30
 *
31
 *
32
 * Author               Date    Comment
33
 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
34
 * Nilesh Rajbharti     4/27/01 Original        (Rev 1.0)
35
 * Nilesh Rajbharti     5/22/02 Rev 2.0 (See version.log for detail)
36
 ********************************************************************/
37
 
38
#ifndef ICMP_H
39
#define ICMP_H
40
 
41
#include "..\Include\StackTsk.h"
42
#include "..\Include\IP.h"
43
#include "..\Include\MAC.h"
44
 
45
// Windows ping uses 32 bytes, while MAC uses 56 bytes.
46
#define MAX_ICMP_DATA       (32)
47
 
48
#define MAX_ICMP_DATA_LEN   (MAX_ICMP_DATA)
49
 
50
 
51
typedef enum _ICMP_CODE
52
{
53
    ICMP_ECHO_REPLY = 0,
54
    ICMP_ECHO_REQUEST = 8
55
} ICMP_CODE, ICMP_REQUESTS;
56
 
57
 
58
/*********************************************************************
59
 * Function:        BOOL ICMPIsTxReady()
60
 *
61
 * PreCondition:    None
62
 *
63
 * Input:           None
64
 *
65
 * Output:          TRUE if transmit buffer is ready
66
 *                  FALSE if transmit buffer is not ready
67
 *
68
 * Side Effects:    None
69
 *
70
 * Note:            None
71
 *
72
 ********************************************************************/
73
#define ICMPIsTxReady()     MACIsTxReady(TRUE)
74
 
75
 
76
/*********************************************************************
77
 * Function:        void ICMPPut(NODE_INFO *remote,
78
 *                               ICMP_CODE code,
79
 *                               BYTE *data,
80
 *                               BYTE len,
81
 *                               WORD id,
82
 *                               WORD seq)
83
 *
84
 * PreCondition:    ICMPIsTxReady() == TRUE
85
 *
86
 * Input:           remote      - Remote node info
87
 *                  code        - ICMP_ECHO_REPLY or ICMP_ECHO_REQUEST
88
 *                  data        - Data bytes
89
 *                  len         - Number of bytes to send
90
 *                  id          - ICMP identifier
91
 *                  seq         - ICMP sequence number
92
 *
93
 * Output:          None
94
 *
95
 * Side Effects:    None
96
 *
97
 * Note:            A ICMP packet is created and put on MAC.
98
 *
99
 ********************************************************************/
100
void ICMPPut(NODE_INFO *remote,
101
             ICMP_CODE code,
102
             BYTE *data,
103
             BYTE len,
104
             WORD id,
105
             WORD seq);
106
 
107
 
108
/*********************************************************************
109
 * Function:        BOOL ICMPGet(ICMP_CODE *code,
110
 *                              BYTE *data,
111
 *                              BYTE *len,
112
 *                              WORD *id,
113
 *                              WORD *seq)
114
 *
115
 * PreCondition:    MAC buffer contains ICMP type packet.
116
 *
117
 * Input:           code    - Buffer to hold ICMP code value
118
 *                  data    - Buffer to hold ICMP data
119
 *                  len     - Buffer to hold ICMP data length
120
 *                  id      - Buffer to hold ICMP id
121
 *                  seq     - Buffer to hold ICMP seq
122
 *
123
 * Output:          TRUE if valid ICMP packet was received
124
 *                  FALSE otherwise.
125
 *
126
 * Side Effects:    None
127
 *
128
 * Overview:        None
129
 *
130
 * Note:            None
131
 ********************************************************************/
132
BOOL ICMPGet(ICMP_CODE *code,
133
             BYTE *data,
134
             BYTE *len,
135
             WORD *id,
136
             WORD *seq);
137
 
138
 
139
 
140
#endif
141
 
142