ping.xml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <CLISH_MODULE xmlns="http://clish.sourceforge.net/XMLSchema"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://clish.sourceforge.net/XMLSchema
  5. http://clish.sourceforge.net/XMLSchema/clish.xsd">
  6. <!--=======================================================-->
  7. <VIEW name="ping-view"
  8. prompt="${SYSTEM_NAME}# ">
  9. <COMMAND name="ping"
  10. help="Send echo messages">
  11. <PARAM name="ip"
  12. help="IP echo"
  13. ptype="SUBCOMMAND"
  14. mode="subcommand"
  15. optional="true"/>
  16. <PARAM name="dst"
  17. help="Ping destination address or hostname"
  18. ptype="STRING"/>
  19. <PARAM name="resolve"
  20. help="Resolve names"
  21. ptype="SUBCOMMAND"
  22. mode="subcommand"
  23. optional="true"/>
  24. <PARAM name="broadcast"
  25. help="Ping broadcast address"
  26. ptype="SUBCOMMAND"
  27. mode="subcommand"
  28. optional="true"/>
  29. <PARAM name="repeat"
  30. help="Specify repeat count"
  31. optional="true"
  32. mode="subcommand"
  33. ptype="SUBCOMMAND">
  34. <PARAM name="count"
  35. help="Repeat count"
  36. default="5"
  37. ptype="UINT"/>
  38. </PARAM>
  39. <PARAM name="size"
  40. help="Specify datagram size"
  41. optional="true"
  42. mode="subcommand"
  43. ptype="SUBCOMMAND">
  44. <PARAM name="psize"
  45. help="Datagram size"
  46. ptype="UINT"/>
  47. </PARAM>
  48. <PARAM name="source"
  49. help="Specify source address or name"
  50. optional="true"
  51. mode="subcommand"
  52. ptype="SUBCOMMAND">
  53. <PARAM name="src"
  54. help="Interface name or IP-address"
  55. ptype="STRING"/>
  56. </PARAM>
  57. <PARAM name="packet_interval"
  58. value="interval"
  59. help="Specify interval between packets"
  60. optional="true"
  61. ptype="SUBCOMMAND">
  62. <PARAM name="interval"
  63. help="Interval beetween packets"
  64. default="2"
  65. ptype="UINT"/>
  66. </PARAM>
  67. <PARAM name="flood"
  68. help="Flood ping"
  69. ptype="SUBCOMMAND"
  70. mode="subcommand"
  71. optional="true"/>
  72. <ACTION>
  73. cmd="ping ${dst}"
  74. # Resolve names
  75. if [[ ! -n "${resolve}" ]]; then
  76. cmd=$cmd" -n"
  77. fi
  78. # Ping broadcast
  79. if [[ -n "${broadcast}" ]]; then
  80. cmd=$cmd" -b"
  81. fi
  82. # Ping from interface or address
  83. cmd=$cmd"${ -I :src}"
  84. # Packets count
  85. if [[ ! -n "${count}" ]]; then
  86. cmd=$cmd" -c 5"
  87. else
  88. cmd=$cmd"${ -c :count}"
  89. fi
  90. # Packet size
  91. cmd=$cmd"${ -s :psize}"
  92. # Interval between packets
  93. if [[ ! -n "${interval}" ]]; then
  94. cmd=$cmd" -i 2"
  95. else
  96. cmd=$cmd"${ -i :interval}"
  97. fi
  98. # Flood ping
  99. if [[ -n "${flood}" ]]; then
  100. cmd=$cmd" -f"
  101. fi
  102. # Change it to exec or...
  103. $cmd
  104. </ACTION>
  105. </COMMAND>
  106. <COMMAND name="traceroute"
  107. help="Trace route to destination"
  108. lock="false">
  109. <PARAM name="ip"
  110. help="IP trace"
  111. ptype="STRING"
  112. mode="subcommand"
  113. optional="true"/>
  114. <PARAM name="addr"
  115. help="Trace route to destination address or hostname"
  116. ptype="STRING"/>
  117. <ACTION>
  118. traceroute ${addr}
  119. </ACTION>
  120. </COMMAND>
  121. </VIEW>
  122. </CLISH_MODULE>