OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgo/] [go/] [net/] [sockoptip_bsd.go] - Blame information for rev 848

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 747 jeremybenn
// Copyright 2011 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
// +build darwin freebsd netbsd openbsd
6
 
7
// IP-level socket options for BSD variants
8
 
9
package net
10
 
11
import (
12
        "os"
13
        "syscall"
14
)
15
 
16
func ipv4MulticastTTL(fd *netFD) (int, error) {
17
        fd.incref()
18
        defer fd.decref()
19
        v, err := syscall.GetsockoptByte(fd.sysfd, syscall.IPPROTO_IP, syscall.IP_MULTICAST_TTL)
20
        if err != nil {
21
                return -1, os.NewSyscallError("getsockopt", err)
22
        }
23
        return int(v), nil
24
}
25
 
26
func setIPv4MulticastTTL(fd *netFD, v int) error {
27
        fd.incref()
28
        defer fd.decref()
29
        err := syscall.SetsockoptByte(fd.sysfd, syscall.IPPROTO_IP, syscall.IP_MULTICAST_TTL, byte(v))
30
        if err != nil {
31
                return os.NewSyscallError("setsockopt", err)
32
        }
33
        return nil
34
}
35
 
36
func ipv6TrafficClass(fd *netFD) (int, error) {
37
        fd.incref()
38
        defer fd.decref()
39
        v, err := syscall.GetsockoptInt(fd.sysfd, syscall.IPPROTO_IPV6, syscall.IPV6_TCLASS)
40
        if err != nil {
41
                return -1, os.NewSyscallError("getsockopt", err)
42
        }
43
        return v, nil
44
}
45
 
46
func setIPv6TrafficClass(fd *netFD, v int) error {
47
        fd.incref()
48
        defer fd.decref()
49
        err := syscall.SetsockoptInt(fd.sysfd, syscall.IPPROTO_IPV6, syscall.IPV6_TCLASS, v)
50
        if err != nil {
51
                return os.NewSyscallError("setsockopt", err)
52
        }
53
        return nil
54
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.