The reconcile package is used for DOM reconcilation in Isomorphic Go web applications.

control_bsd.go 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright 2012 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 darwin dragonfly freebsd netbsd openbsd
  5. package ipv4
  6. import (
  7. "net"
  8. "syscall"
  9. "unsafe"
  10. "golang.org/x/net/internal/iana"
  11. "golang.org/x/net/internal/socket"
  12. )
  13. func marshalDst(b []byte, cm *ControlMessage) []byte {
  14. m := socket.ControlMessage(b)
  15. m.MarshalHeader(iana.ProtocolIP, sysIP_RECVDSTADDR, net.IPv4len)
  16. return m.Next(net.IPv4len)
  17. }
  18. func parseDst(cm *ControlMessage, b []byte) {
  19. if len(cm.Dst) < net.IPv4len {
  20. cm.Dst = make(net.IP, net.IPv4len)
  21. }
  22. copy(cm.Dst, b[:net.IPv4len])
  23. }
  24. func marshalInterface(b []byte, cm *ControlMessage) []byte {
  25. m := socket.ControlMessage(b)
  26. m.MarshalHeader(iana.ProtocolIP, sysIP_RECVIF, syscall.SizeofSockaddrDatalink)
  27. return m.Next(syscall.SizeofSockaddrDatalink)
  28. }
  29. func parseInterface(cm *ControlMessage, b []byte) {
  30. sadl := (*syscall.SockaddrDatalink)(unsafe.Pointer(&b[0]))
  31. cm.IfIndex = int(sadl.Index)
  32. }