📄 ip.lis
字号:
.module ip.c
.area lit(rom, con, rel)
0000 _ip_str1::
0000 0A5400 .byte 10,'T,0
0003 .dbfile C:\AVR\AT-Modem__PPP__UDP__IC\ip.c
0003 .dbsym e ip_str1 _ip_str1 A[3:3]kc
0003 _ip_str2::
0003 0A5200 .byte 10,'R,0
0006 .dbsym e ip_str2 _ip_str2 A[3:3]kc
0006 _ip_str2a::
0006 583A2050726F743A205050505F495020 .byte 'X,58,32,'P,'r,'o,'t,58,32,'P,'P,'P,95,'I,'P,32
0016 00 .byte 0
0017 .dbsym e ip_str2a _ip_str2a A[17:17]kc
0017 _ip_str3::
0017 2020202049504864723A205665723A00 .byte 32,32,32,32,'I,'P,'H,'d,'r,58,32,'V,'e,'r,58,0
0027 .dbsym e ip_str3 _ip_str3 A[16:16]kc
0027 _ip_str4::
0027 204864724C656E3A00 .byte 32,'H,'d,'r,'L,'e,'n,58,0
0030 .dbsym e ip_str4 _ip_str4 A[9:9]kc
0030 _ip_str5::
0030 20546F733A00 .byte 32,'T,'o,'s,58,0
0036 .dbsym e ip_str5 _ip_str5 A[6:6]kc
0036 _ip_str6::
0036 20546F744C656E3A00 .byte 32,'T,'o,'t,'L,'e,'n,58,0
003F .dbsym e ip_str6 _ip_str6 A[9:9]kc
003F _ip_str7::
003F 2049443A00 .byte 32,'I,'D,58,0
0044 .dbsym e ip_str7 _ip_str7 A[5:5]kc
0044 _ip_str8::
0044 20467261673A00 .byte 32,'F,'r,'a,'g,58,0
004B .dbsym e ip_str8 _ip_str8 A[7:7]kc
004B _ip_str9::
004B 2054544C3A00 .byte 32,'T,'T,'L,58,0
0051 .dbsym e ip_str9 _ip_str9 A[6:6]kc
0051 _ip_str10::
0051 2049434D5000 .byte 32,'I,'C,'M,'P,0
0057 .dbsym e ip_str10 _ip_str10 A[6:6]kc
0057 _ip_str11::
0057 2055445000 .byte 32,'U,'D,'P,0
005C .dbsym e ip_str11 _ip_str11 A[5:5]kc
005C _ip_str12::
005C 2054435000 .byte 32,'T,'C,'P,0
0061 .dbsym e ip_str12 _ip_str12 A[5:5]kc
0061 _ip_str13::
0061 2043686B73756D3A00 .byte 32,'C,'h,'k,'s,'u,'m,58,0
006A .dbsym e ip_str13 _ip_str13 A[9:9]kc
006A _ip_str14::
006A 202020206F7074696F6E3A00 .byte 32,32,32,32,'o,'p,'t,'i,'o,'n,58,0
0076 .dbsym e ip_str14 _ip_str14 A[12:12]kc
0076 _ip_str15::
0076 202020204461746142797465733A00 .byte 32,32,32,32,'D,'a,'t,'a,'B,'y,'t,'e,'s,58,0
0085 .dbsym e ip_str15 _ip_str15 A[15:15]kc
0085 _ip_str16::
0085 2A2A2A2049502063686B73756D206572 .byte 42,42,42,32,'I,'P,32,'c,'h,'k,'s,'u,'m,32,'e,'r
0095 720A00 .byte 'r,10,0
0098 .dbsym e ip_str16 _ip_str16 A[19:19]kc
0098 _ip_str17::
0098 2A2A2A20467261676D656E746564202D .byte 42,42,42,32,'F,'r,'a,'g,'m,'e,'n,'t,'e,'d,32,45
00A8 2069676E6F72696E670A00 .byte 32,'i,'g,'n,'o,'r,'i,'n,'g,10,0
00B3 .dbsym e ip_str17 _ip_str17 A[27:27]kc
00B3 _SubnetMask::
00B3 FFFF .byte 255,255
00B5 FF00 .byte 255,0
00B7 .dbsym e SubnetMask _SubnetMask A[4:4]kc
00B7 _AllowedIP::
00B7 C0A8 .byte 192,168
00B9 FE02 .byte 254,2
00BB C0A8 .byte 192,168
00BD FE05 .byte 254,5
00BF C0A8 .byte 192,168
00C1 FE07 .byte 254,7
00C3 0000 .byte 0,0
00C5 0000 .byte 0,0
00C7 0000 .byte 0,0
00C9 0000 .byte 0,0
00CB 0000 .byte 0,0
00CD 0000 .byte 0,0
00CF 0000 .byte 0,0
00D1 0000 .byte 0,0
00D3 0000 .byte 0,0
00D5 0000 .byte 0,0
00D7 0000 .byte 0,0
00D9 0000 .byte 0,0
00DB 0000 .byte 0,0
00DD 0000 .byte 0,0
00DF .dbsym e AllowedIP _AllowedIP A[40:10:4]kc
.area text(rom, con, rel)
0000 .dbfile C:\AVR\AT-Modem__PPP__UDP__IC\ip.c
0000 .dbfunc e IP_DisplayProtocol _IP_DisplayProtocol fV
0000 ; TotalBytes -> R20,R21
0000 ; Tx -> R22
.even
0000 _IP_DisplayProtocol::
0000 0E940000 xcall push_gset2
0004 A901 movw R20,R18
0006 602F mov R22,R16
0008 2497 sbiw R28,4
000A .dbline -1
000A .dbline 109
000A ;
000A ; /*
000A ; * Copyright (C) 2003-2004 by Clive Moss All rights reserved.
000A ; *
000A ; * Help & Contributions from D.J.Armstrong
000A ;
000A ; * Redistribution and use in source and binary forms, with or without
000A ; * modification, are permitted provided that the following conditions
000A ; * are met:
000A ; *
000A ; * 1. Redistributions of source code must retain the above copyright
000A ; * notice, this list of conditions and the following disclaimer.
000A ; * 2. Redistributions in binary form must reproduce the above copyright
000A ; * notice, this list of conditions and the following disclaimer in the
000A ; * documentation and/or other materials provided with the distribution.
000A ; * 3. Neither the name of the copyright holders nor the names of
000A ; * contributors may be used to endorse or promote products derived
000A ; * from this software without specific prior written permission.
000A ; *
000A ; * THIS SOFTWARE IS PROVIDED BY CLIVE MOSS 'AS IS' AND ANY EXPRESS OR
000A ; * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
000A ; * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
000A ; * ARE DISCLAIMED.
000A ; * IN NO EVENT SHALL CLIVE MOSS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
000A ; * INDIRECT, INCIDENTAL,SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
000A ; * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
000A ; * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
000A ; * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
000A ; * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
000A ; * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
000A ; * SUCH DAMAGE.
000A ; */
000A ;
000A ; //#ifdef CPU_eZ8
000A ; // #pragma stkck // enable stack checking
000A ; //#endif
000A ;
000A ; #include <stdio.h>
000A ; #include <stdlib.h>
000A ; #include <string.h>
000A ;
000A ; #include "common.h"
000A ; #include "ppp.h"
000A ; #include "ip.h"
000A ;
000A ; #ifdef IncludeTCP
000A ; #include "tcp.h"
000A ; #endif
000A ;
000A ; #ifdef IncludeICMP
000A ; #include "icmp.h"
000A ; #endif
000A ;
000A ; #ifdef IncludeUDP
000A ; #include "udp.h"
000A ; #endif
000A ;
000A ; #ifdef Debug
000A ; flash char ip_str1[] = "\nT";
000A ; flash char ip_str2[] = "\nR";
000A ; flash char ip_str2a[] = "X: Prot: PPP_IP ";
000A ; flash char ip_str3[] = " IPHdr: Ver:";
000A ; flash char ip_str4[] = " HdrLen:";
000A ; flash char ip_str5[] = " Tos:";
000A ; flash char ip_str6[] = " TotLen:";
000A ; flash char ip_str7[] = " ID:";
000A ; flash char ip_str8[] = " Frag:";
000A ; flash char ip_str9[] = " TTL:";
000A ; flash char ip_str10[] = " ICMP";
000A ; flash char ip_str11[] = " UDP";
000A ; flash char ip_str12[] = " TCP";
000A ; flash char ip_str13[] = " Chksum:";
000A ; flash char ip_str14[] = " option:";
000A ; flash char ip_str15[] = " DataBytes:";
000A ; flash char ip_str16[] = "*** IP chksum err\n";
000A ; flash char ip_str17[] = "*** Fragmented - ignoring\n";
000A ; #endif
000A ;
000A ; flash char SubnetMask[4] = {255, 255, 255, 0};
000A ;
000A ; flash char AllowedIP[10][4] = { // these are the ip's that are allowed to ping us and are allowed to ping & tcp in
000A ; // FIREWALL stuff
000A ; {192, 168, 254, 2}, // local lan ip
000A ; {192, 168, 254, 5}, // local lan ip
000A ; {192, 168, 254, 7}, // local lan ip
000A ; {0, 0, 0, 0}, // spare
000A ; {0, 0, 0, 0}, // spare
000A ; {0, 0, 0, 0}, // spare
000A ; {0, 0, 0, 0}, // spare
000A ; {0, 0, 0, 0}, // spare
000A ; {0, 0, 0, 0}, // spare
000A ; {0, 0, 0, 0} // leave as '0'
000A ; };
000A ;
000A ; #ifdef CPU_eZ8
000A ; near u16 IP_ID;
000A ; #endif
000A ; #ifdef CPU_ATmega128
000A ; u16 IP_ID;
000A ; #endif
000A ;
000A ; T_IP_Header *IP_Header;
000A ;
000A ; // **************************************************************************
000A ;
000A ; #ifdef Debug
000A ;
000A ; void IP_DisplayProtocol(bool Tx, int TotalBytes)
000A ; {
000A .dbline 110
000A ; if (Tx)
000A 6623 tst R22
000C 39F0 breq L2
000E .dbline 111
000E ; {
000E .dbline 112
000E ; if (!SendDebugRStr(ip_str1)) return;
000E 00E0 ldi R16,<_ip_str1
0010 10E0 ldi R17,>_ip_str1
0012 0E940000 xcall _SendDebugRStr
0016 0023 tst R16
0018 41F4 brne L3
001A .dbline 112
001A 20C0 xjmp L1
001C X0:
001C .dbline 113
001C ; }
001C L2:
001C .dbline 115
001C ; else
001C ; {
001C .dbline 116
001C ; if (!SendDebugRStr(ip_str2)) return;
001C 00E0 ldi R16,<_ip_str2
001E 10E0 ldi R17,>_ip_str2
0020 0E940000 xcall _SendDebugRStr
0024 0023 tst R16
0026 09F4 brne L6
0028 .dbline 116
0028 19C0 xjmp L1
002A L6:
002A .dbline 117
002A ; }
002A L3:
002A .dbline 118
002A ; if (!SendDebugRStr(ip_str2a)) return;
002A 00E0 ldi R16,<_ip_str2a
002C 10E0 ldi R17,>_ip_str2a
002E 0E940000 xcall _SendDebugRStr
0032 0023 tst R16
0034 09F4 brne L8
0036 .dbline 118
0036 12C0 xjmp L1
0038 L8:
0038 .dbline 119
0038 5B83 std y+3,R21
003A 4A83 std y+2,R20
003C 81E2 ldi R24,33
003E 90E0 ldi R25,0
0040 9983 std y+1,R25
0042 8883 std y+0,R24
0044 20E0 ldi R18,<L10
0046 30E0 ldi R19,>L10
0048 00E0 ldi R16,<_ScratchPad
004A 10E0 ldi R17,>_ScratchPad
004C 0E940000 xcall _sprintf
0050 .dbline 120
0050 00E0 ldi R16,<_ScratchPad
0052 10E0 ldi R17,>_ScratchPad
0054 0E940000 xcall _SendDebugStr
0058 0023 tst R16
005A 01F4 brne L11
005C .dbline 120
005C L11:
005C .dbline -2
005C L1:
005C 2496 adiw R28,4
005E 0E940000 xcall pop_gset2
0062 .dbline 0 ; func end
0062 0895 ret
0064 .dbsym r TotalBytes 20 I
0064 .dbsym r Tx 22 c
0064 .dbend
0064 .dbfunc e IP_DisplayHeader _IP_DisplayHeader fV
0064 ; j -> R10,R11
0064 ; i -> R20,R21
0064 ; len -> R12
0064 ; type -> R14
0064 ; TotalBytes -> R22,R23
0064 ; HeaderIdx -> R10,R11
.even
0064 _IP_DisplayHeader::
0064 0E940000 xcall push_gset5
0068 B901 movw R22,R18
006A 5801 movw R10,R16
006C 2497 sbiw R28,4
006E .dbline -1
006E .dbline 124
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -