| // Copyright 2012 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| // +build darwin dragonfly freebsd linux netbsd openbsd |
| func newControlMessage(opt *rawOpt) (oob []byte) { |
| return opt.marshalControlMessage() |
| func parseControlMessage(b []byte) (*ControlMessage, error) { |
| cmsgs, err := syscall.ParseSocketControlMessage(b) |
| return nil, os.NewSyscallError("parse socket control message", err) |
| for _, m := range cmsgs { |
| if m.Header.Level != ianaProtocolIP { |
| cm.parseControlMessage(&m) |
| func marshalControlMessage(cm *ControlMessage) (oob []byte) { |
| return cm.marshalPacketInfo() |