tnativesockets.nim 770 B

123456789101112131415161718192021222324252627282930
  1. discard """
  2. cmd: "nim c -r --styleCheck:hint --panics:on $options $file"
  3. targets: "c"
  4. nimout: ""
  5. action: "run"
  6. exitcode: 0
  7. timeout: 60.0
  8. """
  9. import nativesockets
  10. when defined(windows):
  11. doAssert toInt(IPPROTO_IP) == 0.cint
  12. doAssert toInt(IPPROTO_ICMP) == 1.cint
  13. doAssert toInt(IPPROTO_TCP) == 6.cint
  14. doAssert toInt(IPPROTO_UDP) == 17.cint
  15. doAssert toInt(IPPROTO_IPV6) == 41.cint
  16. doAssert toInt(IPPROTO_ICMPV6) == 58.cint
  17. doAssert toInt(IPPROTO_RAW) == 20.cint
  18. # no changes to enum value
  19. doAssert ord(IPPROTO_TCP) == 6
  20. doAssert ord(IPPROTO_UDP) == 17
  21. doAssert ord(IPPROTO_IP) == 18
  22. doAssert ord(IPPROTO_IPV6) == 19
  23. doAssert ord(IPPROTO_RAW) == 20
  24. doAssert ord(IPPROTO_ICMP) == 21
  25. doAssert ord(IPPROTO_ICMPV6) == 22