defs_linux.go 1004 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright 2017 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. // +build ignore
  5. // +godefs map struct_in_addr [4]byte /* in_addr */
  6. // +godefs map struct_in6_addr [16]byte /* in6_addr */
  7. package socket
  8. /*
  9. #include <linux/in.h>
  10. #include <linux/in6.h>
  11. #define _GNU_SOURCE
  12. #include <sys/socket.h>
  13. */
  14. import "C"
  15. const (
  16. sysAF_UNSPEC = C.AF_UNSPEC
  17. sysAF_INET = C.AF_INET
  18. sysAF_INET6 = C.AF_INET6
  19. sysSOCK_RAW = C.SOCK_RAW
  20. )
  21. type iovec C.struct_iovec
  22. type msghdr C.struct_msghdr
  23. type mmsghdr C.struct_mmsghdr
  24. type cmsghdr C.struct_cmsghdr
  25. type sockaddrInet C.struct_sockaddr_in
  26. type sockaddrInet6 C.struct_sockaddr_in6
  27. const (
  28. sizeofIovec = C.sizeof_struct_iovec
  29. sizeofMsghdr = C.sizeof_struct_msghdr
  30. sizeofMmsghdr = C.sizeof_struct_mmsghdr
  31. sizeofCmsghdr = C.sizeof_struct_cmsghdr
  32. sizeofSockaddrInet = C.sizeof_struct_sockaddr_in
  33. sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6
  34. )