sys_linux.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Copyright 2014 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package ipv4
  5. import "syscall"
  6. const (
  7. // See /usr/include/linux/in.h.
  8. sysSockoptHeaderPrepend = syscall.IP_HDRINCL
  9. sysSockoptTOS = syscall.IP_TOS
  10. sysSockoptTTL = syscall.IP_TTL
  11. sysSockoptMulticastTTL = syscall.IP_MULTICAST_TTL
  12. sysSockoptMulticastInterface = syscall.IP_MULTICAST_IF
  13. sysSockoptMulticastLoopback = syscall.IP_MULTICAST_LOOP
  14. sysSockoptJoinGroup = syscall.IP_ADD_MEMBERSHIP
  15. sysSockoptLeaveGroup = syscall.IP_DROP_MEMBERSHIP
  16. )
  17. const (
  18. // See /usr/include/linux/in.h.
  19. sysSockoptReceiveTOS = syscall.IP_RECVTOS
  20. sysSockoptReceiveTTL = syscall.IP_RECVTTL
  21. sysSockoptPacketInfo = syscall.IP_PKTINFO
  22. )
  23. const (
  24. sysSizeofNewMulticastReq = 0xc
  25. sysSizeofPacketInfo = 0xc
  26. )
  27. type sysNewMulticastReq struct {
  28. IP [4]byte
  29. Interface [4]byte
  30. IfIndex int32
  31. }
  32. type sysPacketInfo struct {
  33. IfIndex int32
  34. RoutedIP [4]byte
  35. IP [4]byte
  36. }
  37. func init() {
  38. supportsPacketInfo = true
  39. }