sys_aix.go (2073B)
1 // Copyright 2019 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 5 // Added for go1.11 compatibility 6 //go:build aix 7 // +build aix 8 9 package ipv4 10 11 import ( 12 "net" 13 "syscall" 14 15 "golang.org/x/net/internal/iana" 16 "golang.org/x/net/internal/socket" 17 18 "golang.org/x/sys/unix" 19 ) 20 21 // IP_RECVIF is defined on AIX but doesn't work. IP_RECVINTERFACE must be used instead. 22 const sockoptReceiveInterface = unix.IP_RECVINTERFACE 23 24 var ( 25 ctlOpts = [ctlMax]ctlOpt{ 26 ctlTTL: {unix.IP_RECVTTL, 1, marshalTTL, parseTTL}, 27 ctlDst: {unix.IP_RECVDSTADDR, net.IPv4len, marshalDst, parseDst}, 28 ctlInterface: {unix.IP_RECVINTERFACE, syscall.SizeofSockaddrDatalink, marshalInterface, parseInterface}, 29 } 30 31 sockOpts = map[int]*sockOpt{ 32 ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_TOS, Len: 4}}, 33 ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_TTL, Len: 4}}, 34 ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_TTL, Len: 1}}, 35 ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_IF, Len: 4}}, 36 ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_LOOP, Len: 1}}, 37 ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_RECVTTL, Len: 4}}, 38 ssoReceiveDst: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_RECVDSTADDR, Len: 4}}, 39 ssoReceiveInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_RECVINTERFACE, Len: 4}}, 40 ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_HDRINCL, Len: 4}}, 41 ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_ADD_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, 42 ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_DROP_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, 43 } 44 )