Browse Source

Add ICMP

Signed-off-by: Imhotheb <Info@Imhotheb.de>
master
Imhotheb 5 years ago
parent
commit
90af16ed03
  1. 77
      PB.Ex_ICMP/PB.Ex_ICMP.pb
  2. 57
      PB.Ex_ICMP/PB.Ex_ICMP.pbi
  3. BIN
      PB.Ex_ICMP/PB.Ex_ICMP_x64.dll
  4. BIN
      PB.Ex_ICMP/PB.Ex_ICMP_x86.dll
  5. 9
      README.md

77
PB.Ex_ICMP/PB.Ex_ICMP.pb

@ -0,0 +1,77 @@
EnableExplicit
Global PBEx_ICMP
#PBEx_ICMP_Status_BadDestination = 11018
#PBEx_ICMP_Status_BadHeader = 11042
#PBEx_ICMP_Status_BadOption = 11007
#PBEx_ICMP_Status_BadRoute = 11012
#PBEx_ICMP_Status_DestinationHostUnreachable = 11003
#PBEx_ICMP_Status_DestinationNetworkUnreachable = 11002
#PBEx_ICMP_Status_DestinationPortUnreachable = 11005
#PBEx_ICMP_Status_DestinationProhibited = 11004
#PBEx_ICMP_Status_DestinationProtocolUnreachable = 11004
#PBEx_ICMP_Status_DestinationScopeMismatch = 11045
#PBEx_ICMP_Status_DestinationUnreachable = 11040
#PBEx_ICMP_Status_HardwareError = 11008
#PBEx_ICMP_Status_IcmpError = 11044
#PBEx_ICMP_Status_NoResources = 11006
#PBEx_ICMP_Status_PacketTooBig = 11009
#PBEx_ICMP_Status_ParameterProblem = 11015
#PBEx_ICMP_Status_SourceQuench = 11016
#PBEx_ICMP_Status_Success = 0
#PBEx_ICMP_Status_TimedOut = 11010
#PBEx_ICMP_Status_TimeExceeded = 11041
#PBEx_ICMP_Status_TtlExpired = 11013
#PBEx_ICMP_Status_TtlReassemblyTimeExceeded = 11014
#PBEx_ICMP_Status_Unknown = -1
#PBEx_ICMP_Status_UnrecognizedNextHeader = 11043
CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
PBEx_ICMP = OpenLibrary(#PB_Any, "PB.Ex_ICMP_x86.dll")
CompilerElseIf #PB_Compiler_Processor = #PB_Processor_x64
PBEx_ICMP = OpenLibrary(#PB_Any, "PB.Ex_ICMP_x64.dll")
CompilerEndIf
If PBEx_ICMP
Prototype SendICMPPing(Address.p-Unicode, Timeout, TTL, DontFragment, ErrorOutput)
Global SendICMPPing.SendICMPPing = GetFunction(PBEx_ICMP, "SendICMPPing")
Prototype GetICMPStatus(ErrorOutput)
Global GetICMPStatus.GetICMPStatus = GetFunction(PBEx_ICMP, "GetICMPStatus")
Prototype GetICMPIPAddress(Output, ErrorOutput)
Global GetICMPIPAddress.GetICMPIPAddress = GetFunction(PBEx_ICMP, "GetICMPIPAddress")
Prototype GetICMPRoundTripTime(ErrorOutput)
Global GetICMPRoundTripTime.GetICMPRoundTripTime = GetFunction(PBEx_ICMP, "GetICMPRoundTripTime")
Prototype GetICMPTTL(ErrorOutput)
Global GetICMPTTL.GetICMPTTL = GetFunction(PBEx_ICMP, "GetICMPTTL")
EndIf
Global Output$ = Space(1024)
Global ErrorOutput$ = Space(128)
Define ICMPStatus
SendICMPPing("www.google.de", 1000, 128, 1, @ErrorOutput$)
ICMPStatus = GetICMPStatus(@ErrorOutput$)
If ICMPStatus = #PBEx_ICMP_Status_Success
GetICMPIPAddress(@Output$, @ErrorOutput$)
Debug "IP address: " + Output$
Debug "Time needed: " + GetICMPRoundTripTime(@ErrorOutput$)
Debug "TTL: " + GetICMPTTL(@ErrorOutput$)
Else
Debug "ICMP-Error: " + ICMPStatus
EndIf
CloseLibrary(PBEx_ICMP)
; IDE Options = PureBasic 5.60 (Windows - x64)
; CursorPosition = 53
; FirstLine = 7
; EnableXP
; EnableUser
; Executable = PB.Ex_MSSQL.exe
; CompileSourceDirectory
; EnableCompileCount = 790
; EnableBuildCount = 7
; EnableUnicode

57
PB.Ex_ICMP/PB.Ex_ICMP.pbi

@ -0,0 +1,57 @@
EnableExplicit
Global PBEx_ICMP
#PBEx_ICMP_Status_BadDestination = 11018
#PBEx_ICMP_Status_BadHeader = 11042
#PBEx_ICMP_Status_BadOption = 11007
#PBEx_ICMP_Status_BadRoute = 11012
#PBEx_ICMP_Status_DestinationHostUnreachable = 11003
#PBEx_ICMP_Status_DestinationNetworkUnreachable = 11002
#PBEx_ICMP_Status_DestinationPortUnreachable = 11005
#PBEx_ICMP_Status_DestinationProhibited = 11004
#PBEx_ICMP_Status_DestinationProtocolUnreachable = 11004
#PBEx_ICMP_Status_DestinationScopeMismatch = 11045
#PBEx_ICMP_Status_DestinationUnreachable = 11040
#PBEx_ICMP_Status_HardwareError = 11008
#PBEx_ICMP_Status_IcmpError = 11044
#PBEx_ICMP_Status_NoResources = 11006
#PBEx_ICMP_Status_PacketTooBig = 11009
#PBEx_ICMP_Status_ParameterProblem = 11015
#PBEx_ICMP_Status_SourceQuench = 11016
#PBEx_ICMP_Status_Success = 0
#PBEx_ICMP_Status_TimedOut = 11010
#PBEx_ICMP_Status_TimeExceeded = 11041
#PBEx_ICMP_Status_TtlExpired = 11013
#PBEx_ICMP_Status_TtlReassemblyTimeExceeded = 11014
#PBEx_ICMP_Status_Unknown = -1
#PBEx_ICMP_Status_UnrecognizedNextHeader = 11043
CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
PBEx_ICMP = OpenLibrary(#PB_Any, "PB.Ex_ICMP_x86.dll")
CompilerElseIf #PB_Compiler_Processor = #PB_Processor_x64
PBEx_ICMP = OpenLibrary(#PB_Any, "PB.Ex_ICMP_x64.dll")
CompilerEndIf
If PBEx_ICMP
Prototype SendICMPPing(Address.p-Unicode, Timeout, TTL, DontFragment, ErrorOutput)
Global SendICMPPing.SendICMPPing = GetFunction(PBEx_ICMP, "SendICMPPing")
Prototype GetICMPStatus(ErrorOutput)
Global GetICMPStatus.GetICMPStatus = GetFunction(PBEx_ICMP, "GetICMPStatus")
Prototype GetICMPIPAddress(Output, ErrorOutput)
Global GetICMPIPAddress.GetICMPIPAddress = GetFunction(PBEx_ICMP, "GetICMPIPAddress")
Prototype GetICMPRoundTripTime(ErrorOutput)
Global GetICMPRoundTripTime.GetICMPRoundTripTime = GetFunction(PBEx_ICMP, "GetICMPRoundTripTime")
Prototype GetICMPTTL(ErrorOutput)
Global GetICMPTTL.GetICMPTTL = GetFunction(PBEx_ICMP, "GetICMPTTL")
EndIf
; IDE Options = PureBasic 5.60 (Windows - x64)
; CursorPosition = 47
; EnableXP
; EnableUser
; Executable = PB.Ex_MSSQL.exe
; CompileSourceDirectory
; EnableCompileCount = 450
; EnableBuildCount = 7
; EnableUnicode

BIN
PB.Ex_ICMP/PB.Ex_ICMP_x64.dll

Binary file not shown.

BIN
PB.Ex_ICMP/PB.Ex_ICMP_x86.dll

Binary file not shown.

9
README.md

@ -2,10 +2,11 @@
PureBasic Extensions (PB.Ex) by [RSBasic](https://www.rsbasic.de/)
Spenden / Donations bitte direkt an RSBasic
---
#### Forum-Links:
## Forum-Links:
######German:
### German:
|Extension|Link|
|--------|--------|
@ -18,10 +19,11 @@ Spenden / Donations bitte direkt an RSBasic
|WebGadget|https://www.purebasic.fr/german/viewtopic.php?t=31422|
|FTP|https://www.purebasic.fr/german/viewtopic.php?t=30712|
|Math|https://www.purebasic.fr/german/viewtopic.php?t=31452|
|ICMP|https://www.purebasic.fr/german/viewtopic.php?t=31459|
[Wunschliste](https://www.purebasic.fr/german/viewtopic.php?t=30740)
######English:
### English:
|Extension|Link|
|--------|--------|
@ -34,5 +36,6 @@ Spenden / Donations bitte direkt an RSBasic
|WebGadget|https://www.purebasic.fr/english/viewtopic.php?t=72703|
|FTP|https://www.purebasic.fr/english/viewtopic.php?t=70380|
|Math|https://www.purebasic.fr/english/viewtopic.php?t=72761|
|ICMP|https://www.purebasic.fr/english/viewtopic.php?t=72783|
[Wishlist](https://www.purebasic.fr/english/viewtopic.php?t=70476)

Loading…
Cancel
Save

Impressum | Datenschutz