1
0
mirror of https://github.com/restic/restic.git synced 2025-08-15 21:27:32 +00:00
Files
.github
cmd
doc
docker
internal
scripts
vendor
bazil.org
cloud.google.com
github.com
golang.org
x
crypto
net
bpf
context
dict
dns
html
http2
icmp
idna
internal
ipv4
batch.go
bpf_test.go
control.go
control_bsd.go
control_pktinfo.go
control_stub.go
control_test.go
control_unix.go
control_windows.go
defs_darwin.go
defs_dragonfly.go
defs_freebsd.go
defs_linux.go
defs_netbsd.go
defs_openbsd.go
defs_solaris.go
dgramopt.go
doc.go
endpoint.go
example_test.go
gen.go
genericopt.go
header.go
header_test.go
helper.go
iana.go
icmp.go
icmp_linux.go
icmp_stub.go
icmp_test.go
multicast_test.go
multicastlistener_test.go
multicastsockopt_test.go
packet.go
packet_go1_8.go
packet_go1_9.go
payload.go
payload_cmsg.go
payload_cmsg_go1_8.go
payload_cmsg_go1_9.go
payload_nocmsg.go
readwrite_go1_8_test.go
readwrite_go1_9_test.go
readwrite_test.go
sockopt.go
sockopt_posix.go
sockopt_stub.go
sys_asmreq.go
sys_asmreq_stub.go
sys_asmreqn.go
sys_asmreqn_stub.go
sys_bpf.go
sys_bpf_stub.go
sys_bsd.go
sys_darwin.go
sys_dragonfly.go
sys_freebsd.go
sys_linux.go
sys_solaris.go
sys_ssmreq.go
sys_ssmreq_stub.go
sys_stub.go
sys_windows.go
unicast_test.go
unicastsockopt_test.go
zsys_darwin.go
zsys_dragonfly.go
zsys_freebsd_386.go
zsys_freebsd_amd64.go
zsys_freebsd_arm.go
zsys_linux_386.go
zsys_linux_amd64.go
zsys_linux_arm.go
zsys_linux_arm64.go
zsys_linux_mips.go
zsys_linux_mips64.go
zsys_linux_mips64le.go
zsys_linux_mipsle.go
zsys_linux_ppc.go
zsys_linux_ppc64.go
zsys_linux_ppc64le.go
zsys_linux_s390x.go
zsys_netbsd.go
zsys_openbsd.go
zsys_solaris.go
ipv6
lex
lif
nettest
netutil
proxy
publicsuffix
route
trace
webdav
websocket
xsrftoken
.gitattributes
.gitignore
AUTHORS
CONTRIBUTING.md
CONTRIBUTORS
LICENSE
PATENTS
README.md
codereview.cfg
oauth2
sys
google.golang.org
gopkg.in
.gitignore
.hound.yml
.travis.yml
CHANGELOG.md
CONTRIBUTING.md
Gopkg.lock
Gopkg.toml
LICENSE
Makefile
README.rst
VERSION
appveyor.yml
build.go
run_integration_tests.go
restic/vendor/golang.org/x/net/ipv4/payload_cmsg.go
2017-07-23 14:25:38 +02:00

37 lines
1.2 KiB
Go

// 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 !nacl,!plan9,!windows
package ipv4
import (
"net"
"syscall"
)
// ReadFrom reads a payload of the received IPv4 datagram, from the
// endpoint c, copying the payload into b. It returns the number of
// bytes copied into b, the control message cm and the source address
// src of the received datagram.
func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) {
if !c.ok() {
return 0, nil, nil, syscall.EINVAL
}
return c.readFrom(b)
}
// WriteTo writes a payload of the IPv4 datagram, to the destination
// address dst through the endpoint c, copying the payload from b. It
// returns the number of bytes written. The control message cm allows
// the datagram path and the outgoing interface to be specified.
// Currently only Darwin and Linux support this. The cm may be nil if
// control of the outgoing datagram is not required.
func (c *payloadHandler) WriteTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) {
if !c.ok() {
return 0, syscall.EINVAL
}
return c.writeTo(b, cm, dst)
}