Update deps

This commit is contained in:
Frank Denis 2021-06-07 15:54:56 +02:00
parent a2ebe0c4a4
commit 98ab4aee23
73 changed files with 1073 additions and 109 deletions

6
go.mod
View File

@ -20,9 +20,9 @@ require (
github.com/kardianos/service v1.2.0
github.com/miekg/dns v1.1.42
github.com/powerman/check v1.3.1
golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf
golang.org/x/net v0.0.0-20210505214959-0714010a04ed
golang.org/x/sys v0.0.0-20210507161434-a76c4d0a0096
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a
golang.org/x/net v0.0.0-20210525063256-abc453219eb5
golang.org/x/sys v0.0.0-20210603125802-9665404d3644
gopkg.in/natefinch/lumberjack.v2 v2.0.0
gopkg.in/yaml.v2 v2.4.0 // indirect
)

12
go.sum
View File

@ -79,8 +79,8 @@ github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf h1:B2n+Zi5QeYRDAEodEu72OS36gmTWjgpXr2+cWcBW90o=
golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a h1:kr2P4QFmQr29mSLA43kwrOcgcReGTfbE9N577tCTuBc=
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
@ -91,8 +91,8 @@ golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73r
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210505214959-0714010a04ed h1:V9kAVxLvz1lkufatrpHuUVyJ/5tR3Ms7rk951P4mI98=
golang.org/x/net v0.0.0-20210505214959-0714010a04ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210525063256-abc453219eb5 h1:wjuX4b5yYQnEQHzd+CBcrcC6OVR2J1CN6mUy0oSxIPo=
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@ -109,8 +109,8 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20201231184435-2d18734c6014/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210507161434-a76c4d0a0096 h1:5PbJGn5Sp3GEUjJ61aYbUP6RIo3Z3r2E4Tv9y2z8UHo=
golang.org/x/sys v0.0.0-20210507161434-a76c4d0a0096/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210603125802-9665404d3644 h1:CA1DEQ4NdKphKeL70tvsWNdT5oFh1lOjihRcEDROi0I=
golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build go1.7 && amd64 && gc && !purego
// +build go1.7,amd64,gc,!purego
#include "textflag.h"

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build amd64 && gc && !purego
// +build amd64,gc,!purego
#include "textflag.h"

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build go1.11 && gc && !purego
// +build go1.11,gc,!purego
#include "textflag.h"

View File

@ -19,6 +19,7 @@
// The differences in this and the original implementation are
// due to the calling conventions and initialization of constants.
//go:build gc && !purego
// +build gc,!purego
#include "textflag.h"

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build gc && !purego
// +build gc,!purego
#include "go_asm.h"

View File

@ -4,6 +4,7 @@
// This file was originally from https://golang.org/cl/24717 by Vlad Krasnov of CloudFlare.
//go:build gc && !purego
// +build gc,!purego
#include "textflag.h"

View File

@ -1,5 +1,6 @@
// Code generated by command: go run fe_amd64_asm.go -out ../fe_amd64.s -stubs ../fe_amd64.go -pkg field. DO NOT EDIT.
//go:build amd64 && gc && !purego
// +build amd64,gc,!purego
#include "textflag.h"

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build arm64 && gc && !purego
// +build arm64,gc,!purego
#include "textflag.h"

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build gc && !purego
// +build gc,!purego
#include "textflag.h"

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build gc && !purego
// +build gc,!purego
#include "textflag.h"

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build gc && !purego
// +build gc,!purego
#include "textflag.h"

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build amd64 && !purego && gc
// +build amd64,!purego,gc
// This code was translated into a form compatible with 6a from the public

49
vendor/golang.org/x/net/http2/ascii.go generated vendored Normal file
View File

@ -0,0 +1,49 @@
// Copyright 2021 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.
package http2
import "strings"
// asciiEqualFold is strings.EqualFold, ASCII only. It reports whether s and t
// are equal, ASCII-case-insensitively.
func asciiEqualFold(s, t string) bool {
if len(s) != len(t) {
return false
}
for i := 0; i < len(s); i++ {
if lower(s[i]) != lower(t[i]) {
return false
}
}
return true
}
// lower returns the ASCII lowercase version of b.
func lower(b byte) byte {
if 'A' <= b && b <= 'Z' {
return b + ('a' - 'A')
}
return b
}
// isASCIIPrint returns whether s is ASCII and printable according to
// https://tools.ietf.org/html/rfc20#section-4.2.
func isASCIIPrint(s string) bool {
for i := 0; i < len(s); i++ {
if s[i] < ' ' || s[i] > '~' {
return false
}
}
return true
}
// asciiToLower returns the lowercase version of s if s is ASCII and printable,
// and whether or not it was.
func asciiToLower(s string) (lower string, ok bool) {
if !isASCIIPrint(s) {
return "", false
}
return strings.ToLower(s), true
}

View File

@ -6,7 +6,6 @@ package http2
import (
"net/http"
"strings"
"sync"
)
@ -79,10 +78,10 @@ func buildCommonHeaderMaps() {
}
}
func lowerHeader(v string) string {
func lowerHeader(v string) (lower string, ascii bool) {
buildCommonHeaderMapsOnce()
if s, ok := commonLowerHeader[v]; ok {
return s
return s, true
}
return strings.ToLower(v)
return asciiToLower(v)
}

View File

@ -231,13 +231,12 @@ func ConfigureServer(s *http.Server, conf *Server) error {
if s.TLSConfig == nil {
s.TLSConfig = new(tls.Config)
} else if s.TLSConfig.CipherSuites != nil {
// If they already provided a CipherSuite list, return
// an error if it has a bad order or is missing
// ECDHE_RSA_WITH_AES_128_GCM_SHA256 or ECDHE_ECDSA_WITH_AES_128_GCM_SHA256.
} else if s.TLSConfig.CipherSuites != nil && s.TLSConfig.MinVersion < tls.VersionTLS13 {
// If they already provided a TLS 1.01.2 CipherSuite list, return an
// error if it is missing ECDHE_RSA_WITH_AES_128_GCM_SHA256 or
// ECDHE_ECDSA_WITH_AES_128_GCM_SHA256.
haveRequired := false
sawBad := false
for i, cs := range s.TLSConfig.CipherSuites {
for _, cs := range s.TLSConfig.CipherSuites {
switch cs {
case tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
// Alternative MTI cipher to not discourage ECDSA-only servers.
@ -245,14 +244,9 @@ func ConfigureServer(s *http.Server, conf *Server) error {
tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256:
haveRequired = true
}
if isBadCipher(cs) {
sawBad = true
} else if sawBad {
return fmt.Errorf("http2: TLSConfig.CipherSuites index %d contains an HTTP/2-approved cipher suite (%#04x), but it comes after unapproved cipher suites. With this configuration, clients that don't support previous, approved cipher suites may be given an unapproved one and reject the connection.", i, cs)
}
}
if !haveRequired {
return fmt.Errorf("http2: TLSConfig.CipherSuites is missing an HTTP/2-required AES_128_GCM_SHA256 cipher (need at least one of TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 or TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256).")
return fmt.Errorf("http2: TLSConfig.CipherSuites is missing an HTTP/2-required AES_128_GCM_SHA256 cipher (need at least one of TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 or TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256)")
}
}
@ -2789,8 +2783,12 @@ func (w *responseWriter) Push(target string, opts *http.PushOptions) error {
// but PUSH_PROMISE requests cannot have a body.
// http://tools.ietf.org/html/rfc7540#section-8.2
// Also disallow Host, since the promised URL must be absolute.
switch strings.ToLower(k) {
case "content-length", "content-encoding", "trailer", "te", "expect", "host":
if asciiEqualFold(k, "content-length") ||
asciiEqualFold(k, "content-encoding") ||
asciiEqualFold(k, "trailer") ||
asciiEqualFold(k, "te") ||
asciiEqualFold(k, "expect") ||
asciiEqualFold(k, "host") {
return fmt.Errorf("promised request headers cannot include %q", k)
}
}

View File

@ -995,7 +995,7 @@ func checkConnHeaders(req *http.Request) error {
if vv := req.Header["Transfer-Encoding"]; len(vv) > 0 && (len(vv) > 1 || vv[0] != "" && vv[0] != "chunked") {
return fmt.Errorf("http2: invalid Transfer-Encoding request header: %q", vv)
}
if vv := req.Header["Connection"]; len(vv) > 0 && (len(vv) > 1 || vv[0] != "" && !strings.EqualFold(vv[0], "close") && !strings.EqualFold(vv[0], "keep-alive")) {
if vv := req.Header["Connection"]; len(vv) > 0 && (len(vv) > 1 || vv[0] != "" && !asciiEqualFold(vv[0], "close") && !asciiEqualFold(vv[0], "keep-alive")) {
return fmt.Errorf("http2: invalid Connection request header: %q", vv)
}
return nil
@ -1521,19 +1521,21 @@ func (cc *ClientConn) encodeHeaders(req *http.Request, addGzipHeader bool, trail
var didUA bool
for k, vv := range req.Header {
if strings.EqualFold(k, "host") || strings.EqualFold(k, "content-length") {
if asciiEqualFold(k, "host") || asciiEqualFold(k, "content-length") {
// Host is :authority, already sent.
// Content-Length is automatic, set below.
continue
} else if strings.EqualFold(k, "connection") || strings.EqualFold(k, "proxy-connection") ||
strings.EqualFold(k, "transfer-encoding") || strings.EqualFold(k, "upgrade") ||
strings.EqualFold(k, "keep-alive") {
} else if asciiEqualFold(k, "connection") ||
asciiEqualFold(k, "proxy-connection") ||
asciiEqualFold(k, "transfer-encoding") ||
asciiEqualFold(k, "upgrade") ||
asciiEqualFold(k, "keep-alive") {
// Per 8.1.2.2 Connection-Specific Header
// Fields, don't send connection-specific
// fields. We have already checked if any
// are error-worthy so just ignore the rest.
continue
} else if strings.EqualFold(k, "user-agent") {
} else if asciiEqualFold(k, "user-agent") {
// Match Go's http1 behavior: at most one
// User-Agent. If set to nil or empty string,
// then omit it. Otherwise if not mentioned,
@ -1546,7 +1548,7 @@ func (cc *ClientConn) encodeHeaders(req *http.Request, addGzipHeader bool, trail
if vv[0] == "" {
continue
}
} else if strings.EqualFold(k, "cookie") {
} else if asciiEqualFold(k, "cookie") {
// Per 8.1.2.5 To allow for better compression efficiency, the
// Cookie header field MAY be split into separate header fields,
// each with one or more cookie-pairs.
@ -1605,7 +1607,12 @@ func (cc *ClientConn) encodeHeaders(req *http.Request, addGzipHeader bool, trail
// Header list size is ok. Write the headers.
enumerateHeaders(func(name, value string) {
name = strings.ToLower(name)
name, ascii := asciiToLower(name)
if !ascii {
// Skip writing invalid headers. Per RFC 7540, Section 8.1.2, header
// field names have to be ASCII characters (just as in HTTP/1.x).
return
}
cc.writeHeader(name, value)
if traceHeaders {
traceWroteHeaderField(trace, name, value)
@ -1653,9 +1660,14 @@ func (cc *ClientConn) encodeTrailers(req *http.Request) ([]byte, error) {
}
for k, vv := range req.Trailer {
lowKey, ascii := asciiToLower(k)
if !ascii {
// Skip writing invalid headers. Per RFC 7540, Section 8.1.2, header
// field names have to be ASCII characters (just as in HTTP/1.x).
continue
}
// Transfer-Encoding, etc.. have already been filtered at the
// start of RoundTrip
lowKey := strings.ToLower(k)
for _, v := range vv {
cc.writeHeader(lowKey, v)
}

View File

@ -341,7 +341,12 @@ func encodeHeaders(enc *hpack.Encoder, h http.Header, keys []string) {
}
for _, k := range keys {
vv := h[k]
k = lowerHeader(k)
k, ascii := lowerHeader(k)
if !ascii {
// Skip writing invalid headers. Per RFC 7540, Section 8.1.2, header
// field names have to be ASCII characters (just as in HTTP/1.x).
continue
}
if !validWireHeaderFieldName(k) {
// Skip it as backup paranoia. Per
// golang.org/issue/14048, these should

5
vendor/golang.org/x/sys/cpu/cpu.go generated vendored
View File

@ -154,14 +154,13 @@ var MIPS64X struct {
// For ppc64/ppc64le, it is safe to check only for ISA level starting on ISA v3.00,
// since there are no optional categories. There are some exceptions that also
// require kernel support to work (DARN, SCV), so there are feature bits for
// those as well. The minimum processor requirement is POWER8 (ISA 2.07).
// The struct is padded to avoid false sharing.
// those as well. The struct is padded to avoid false sharing.
var PPC64 struct {
_ CacheLinePad
HasDARN bool // Hardware random number generator (requires kernel enablement)
HasSCV bool // Syscall vectored (requires kernel enablement)
IsPOWER8 bool // ISA v2.07 (POWER8)
IsPOWER9 bool // ISA v3.00 (POWER9)
IsPOWER9 bool // ISA v3.00 (POWER9), implies IsPOWER8
_ CacheLinePad
}

View File

@ -20,6 +20,7 @@ func archInit() {
PPC64.IsPOWER8 = true
}
if impl&_IMPL_POWER9 != 0 {
PPC64.IsPOWER8 = true
PPC64.IsPOWER9 = true
}

View File

@ -76,7 +76,7 @@ arguments can be passed to the kernel. The third is for low-level use by the
ForkExec wrapper. Unlike the first two, it does not call into the scheduler to
let it know that a system call is running.
When porting Go to an new architecture/OS, this file must be implemented for
When porting Go to a new architecture/OS, this file must be implemented for
each GOOS/GOARCH pair.
### mksysnum
@ -107,7 +107,7 @@ prototype can be exported (capitalized) or not.
Adding a new syscall often just requires adding a new `//sys` function prototype
with the desired arguments and a capitalized name so it is exported. However, if
you want the interface to the syscall to be different, often one will make an
unexported `//sys` prototype, an then write a custom wrapper in
unexported `//sys` prototype, and then write a custom wrapper in
`syscall_${GOOS}.go`.
### types files
@ -137,7 +137,7 @@ some `#if/#elif` macros in your include statements.
This script is used to generate the system's various constants. This doesn't
just include the error numbers and error strings, but also the signal numbers
an a wide variety of miscellaneous constants. The constants come from the list
and a wide variety of miscellaneous constants. The constants come from the list
of include files in the `includes_${uname}` variable. A regex then picks out
the desired `#define` statements, and generates the corresponding Go constants.
The error numbers and strings are generated from `#include <errno.h>`, and the

View File

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build (darwin || freebsd || netbsd || openbsd) && gc
// +build darwin freebsd netbsd openbsd
//go:build (freebsd || netbsd || openbsd) && gc
// +build freebsd netbsd openbsd
// +build gc
#include "textflag.h"

View File

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build (darwin || freebsd || netbsd || openbsd) && gc
// +build darwin freebsd netbsd openbsd
//go:build (freebsd || netbsd || openbsd) && gc
// +build freebsd netbsd openbsd
// +build gc
#include "textflag.h"

View File

@ -239,6 +239,7 @@ struct ltchars {
#include <linux/netfilter/nfnetlink.h>
#include <linux/netlink.h>
#include <linux/net_namespace.h>
#include <linux/nfc.h>
#include <linux/nsfs.h>
#include <linux/perf_event.h>
#include <linux/pps.h>
@ -258,6 +259,7 @@ struct ltchars {
#include <linux/watchdog.h>
#include <mtd/ubi-user.h>
#include <mtd/mtd-user.h>
#include <net/route.h>
#if defined(__sparc__)
@ -501,6 +503,9 @@ ccflags="$@"
$2 ~ /^LO_(KEY|NAME)_SIZE$/ ||
$2 ~ /^LOOP_(CLR|CTL|GET|SET)_/ ||
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL)_/ ||
$2 ~ /^NFC_(GENL|PROTO|COMM|RF|SE|DIRECTION|LLCP|SOCKPROTO)_/ ||
$2 ~ /^NFC_.*_(MAX)?SIZE$/ ||
$2 ~ /^RAW_PAYLOAD_/ ||
$2 ~ /^TP_STATUS_/ ||
$2 ~ /^FALLOC_/ ||
$2 ~ /^ICMPV?6?_(FILTER|SEC)/ ||
@ -593,6 +598,9 @@ ccflags="$@"
$2 == "HID_MAX_DESCRIPTOR_SIZE" ||
$2 ~ /^_?HIDIOC/ ||
$2 ~ /^BUS_(USB|HIL|BLUETOOTH|VIRTUAL)$/ ||
$2 ~ /^MTD/ ||
$2 ~ /^OTP/ ||
$2 ~ /^MEM/ ||
$2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE)/ {printf("\t%s = C.%s\n", $2, $2)}
$2 ~ /^__WCOREFLAG$/ {next}
$2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)}

View File

@ -904,6 +904,46 @@ func (sa *SockaddrIUCV) sockaddr() (unsafe.Pointer, _Socklen, error) {
return unsafe.Pointer(&sa.raw), SizeofSockaddrIUCV, nil
}
type SockaddrNFC struct {
DeviceIdx uint32
TargetIdx uint32
NFCProtocol uint32
raw RawSockaddrNFC
}
func (sa *SockaddrNFC) sockaddr() (unsafe.Pointer, _Socklen, error) {
sa.raw.Sa_family = AF_NFC
sa.raw.Dev_idx = sa.DeviceIdx
sa.raw.Target_idx = sa.TargetIdx
sa.raw.Nfc_protocol = sa.NFCProtocol
return unsafe.Pointer(&sa.raw), SizeofSockaddrNFC, nil
}
type SockaddrNFCLLCP struct {
DeviceIdx uint32
TargetIdx uint32
NFCProtocol uint32
DestinationSAP uint8
SourceSAP uint8
ServiceName string
raw RawSockaddrNFCLLCP
}
func (sa *SockaddrNFCLLCP) sockaddr() (unsafe.Pointer, _Socklen, error) {
sa.raw.Sa_family = AF_NFC
sa.raw.Dev_idx = sa.DeviceIdx
sa.raw.Target_idx = sa.TargetIdx
sa.raw.Nfc_protocol = sa.NFCProtocol
sa.raw.Dsap = sa.DestinationSAP
sa.raw.Ssap = sa.SourceSAP
if len(sa.ServiceName) > len(sa.raw.Service_name) {
return nil, 0, EINVAL
}
copy(sa.raw.Service_name[:], sa.ServiceName)
sa.raw.SetServiceNameLen(len(sa.ServiceName))
return unsafe.Pointer(&sa.raw), SizeofSockaddrNFCLLCP, nil
}
var socketProtocol = func(fd int) (int, error) {
return GetsockoptInt(fd, SOL_SOCKET, SO_PROTOCOL)
}
@ -1144,6 +1184,37 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
}
return sa, nil
}
case AF_NFC:
proto, err := socketProtocol(fd)
if err != nil {
return nil, err
}
switch proto {
case NFC_SOCKPROTO_RAW:
pp := (*RawSockaddrNFC)(unsafe.Pointer(rsa))
sa := &SockaddrNFC{
DeviceIdx: pp.Dev_idx,
TargetIdx: pp.Target_idx,
NFCProtocol: pp.Nfc_protocol,
}
return sa, nil
case NFC_SOCKPROTO_LLCP:
pp := (*RawSockaddrNFCLLCP)(unsafe.Pointer(rsa))
if uint64(pp.Service_name_len) > uint64(len(pp.Service_name)) {
return nil, EINVAL
}
sa := &SockaddrNFCLLCP{
DeviceIdx: pp.Dev_idx,
TargetIdx: pp.Target_idx,
NFCProtocol: pp.Nfc_protocol,
DestinationSAP: pp.Dsap,
SourceSAP: pp.Ssap,
ServiceName: string(pp.Service_name[:pp.Service_name_len]),
}
return sa, nil
default:
return nil, EINVAL
}
}
return nil, EAFNOSUPPORT
}

View File

@ -378,6 +378,10 @@ func (cmsg *Cmsghdr) SetLen(length int) {
cmsg.Len = uint32(length)
}
func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) {
rsa.Service_name_len = uint32(length)
}
//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
func Poll(fds []PollFd, timeout int) (n int, err error) {

View File

@ -172,6 +172,10 @@ func (cmsg *Cmsghdr) SetLen(length int) {
cmsg.Len = uint64(length)
}
func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) {
rsa.Service_name_len = uint64(length)
}
//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
func Poll(fds []PollFd, timeout int) (n int, err error) {

View File

@ -256,6 +256,10 @@ func (cmsg *Cmsghdr) SetLen(length int) {
cmsg.Len = uint32(length)
}
func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) {
rsa.Service_name_len = uint32(length)
}
//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
func Poll(fds []PollFd, timeout int) (n int, err error) {

View File

@ -207,6 +207,10 @@ func (cmsg *Cmsghdr) SetLen(length int) {
cmsg.Len = uint64(length)
}
func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) {
rsa.Service_name_len = uint64(length)
}
func InotifyInit() (fd int, err error) {
return InotifyInit1(0)
}

View File

@ -217,6 +217,10 @@ func (cmsg *Cmsghdr) SetLen(length int) {
cmsg.Len = uint64(length)
}
func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) {
rsa.Service_name_len = uint64(length)
}
func InotifyInit() (fd int, err error) {
return InotifyInit1(0)
}

View File

@ -229,6 +229,10 @@ func (cmsg *Cmsghdr) SetLen(length int) {
cmsg.Len = uint32(length)
}
func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) {
rsa.Service_name_len = uint32(length)
}
//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
func Poll(fds []PollFd, timeout int) (n int, err error) {

View File

@ -215,6 +215,10 @@ func (cmsg *Cmsghdr) SetLen(length int) {
cmsg.Len = uint32(length)
}
func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) {
rsa.Service_name_len = uint32(length)
}
//sysnb pipe(p *[2]_C_int) (err error)
func Pipe(p []int) (err error) {

View File

@ -100,6 +100,10 @@ func (cmsg *Cmsghdr) SetLen(length int) {
cmsg.Len = uint64(length)
}
func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) {
rsa.Service_name_len = uint64(length)
}
//sysnb pipe(p *[2]_C_int) (err error)
func Pipe(p []int) (err error) {

View File

@ -188,6 +188,10 @@ func (cmsg *Cmsghdr) SetLen(length int) {
cmsg.Len = uint64(length)
}
func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) {
rsa.Service_name_len = uint64(length)
}
func InotifyInit() (fd int, err error) {
return InotifyInit1(0)
}

View File

@ -129,6 +129,10 @@ func (cmsg *Cmsghdr) SetLen(length int) {
cmsg.Len = uint64(length)
}
func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) {
rsa.Service_name_len = uint64(length)
}
// Linux on s390x uses the old mmap interface, which requires arguments to be passed in a struct.
// mmap2 also requires arguments to be passed in a struct; it is currently not exposed in <asm/unistd.h>.
func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {

View File

@ -116,6 +116,10 @@ func (cmsg *Cmsghdr) SetLen(length int) {
cmsg.Len = uint64(length)
}
func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) {
rsa.Service_name_len = uint64(length)
}
//sysnb pipe(p *[2]_C_int) (err error)
func Pipe(p []int) (err error) {

View File

@ -1406,6 +1406,10 @@ const (
MCAST_LEAVE_SOURCE_GROUP = 0x2f
MCAST_MSFILTER = 0x30
MCAST_UNBLOCK_SOURCE = 0x2c
MEMGETREGIONINFO = 0xc0104d08
MEMREADOOB64 = 0xc0184d16
MEMWRITE = 0xc0304d18
MEMWRITEOOB64 = 0xc0184d15
MFD_ALLOW_SEALING = 0x2
MFD_CLOEXEC = 0x1
MFD_HUGETLB = 0x4
@ -1494,7 +1498,35 @@ const (
MS_SYNCHRONOUS = 0x10
MS_UNBINDABLE = 0x20000
MS_VERBOSE = 0x8000
MTD_ABSENT = 0x0
MTD_BIT_WRITEABLE = 0x800
MTD_CAP_NANDFLASH = 0x400
MTD_CAP_NORFLASH = 0xc00
MTD_CAP_NVRAM = 0x1c00
MTD_CAP_RAM = 0x1c00
MTD_CAP_ROM = 0x0
MTD_DATAFLASH = 0x6
MTD_INODE_FS_MAGIC = 0x11307854
MTD_MAX_ECCPOS_ENTRIES = 0x40
MTD_MAX_OOBFREE_ENTRIES = 0x8
MTD_MLCNANDFLASH = 0x8
MTD_NANDECC_AUTOPLACE = 0x2
MTD_NANDECC_AUTOPL_USR = 0x4
MTD_NANDECC_OFF = 0x0
MTD_NANDECC_PLACE = 0x1
MTD_NANDECC_PLACEONLY = 0x3
MTD_NANDFLASH = 0x4
MTD_NORFLASH = 0x3
MTD_NO_ERASE = 0x1000
MTD_OTP_FACTORY = 0x1
MTD_OTP_OFF = 0x0
MTD_OTP_USER = 0x2
MTD_POWERUP_LOCK = 0x2000
MTD_RAM = 0x1
MTD_ROM = 0x2
MTD_SLC_ON_MLC_EMULATION = 0x4000
MTD_UBIVOLUME = 0x7
MTD_WRITEABLE = 0x400
NAME_MAX = 0xff
NCP_SUPER_MAGIC = 0x564c
NETLINK_ADD_MEMBERSHIP = 0x1
@ -1534,6 +1566,59 @@ const (
NETLINK_XFRM = 0x6
NETNSA_MAX = 0x5
NETNSA_NSID_NOT_ASSIGNED = -0x1
NFC_ATR_REQ_GB_MAXSIZE = 0x30
NFC_ATR_REQ_MAXSIZE = 0x40
NFC_ATR_RES_GB_MAXSIZE = 0x2f
NFC_ATR_RES_MAXSIZE = 0x40
NFC_COMM_ACTIVE = 0x0
NFC_COMM_PASSIVE = 0x1
NFC_DEVICE_NAME_MAXSIZE = 0x8
NFC_DIRECTION_RX = 0x0
NFC_DIRECTION_TX = 0x1
NFC_FIRMWARE_NAME_MAXSIZE = 0x20
NFC_GB_MAXSIZE = 0x30
NFC_GENL_MCAST_EVENT_NAME = "events"
NFC_GENL_NAME = "nfc"
NFC_GENL_VERSION = 0x1
NFC_HEADER_SIZE = 0x1
NFC_ISO15693_UID_MAXSIZE = 0x8
NFC_LLCP_MAX_SERVICE_NAME = 0x3f
NFC_LLCP_MIUX = 0x1
NFC_LLCP_REMOTE_LTO = 0x3
NFC_LLCP_REMOTE_MIU = 0x2
NFC_LLCP_REMOTE_RW = 0x4
NFC_LLCP_RW = 0x0
NFC_NFCID1_MAXSIZE = 0xa
NFC_NFCID2_MAXSIZE = 0x8
NFC_NFCID3_MAXSIZE = 0xa
NFC_PROTO_FELICA = 0x3
NFC_PROTO_FELICA_MASK = 0x8
NFC_PROTO_ISO14443 = 0x4
NFC_PROTO_ISO14443_B = 0x6
NFC_PROTO_ISO14443_B_MASK = 0x40
NFC_PROTO_ISO14443_MASK = 0x10
NFC_PROTO_ISO15693 = 0x7
NFC_PROTO_ISO15693_MASK = 0x80
NFC_PROTO_JEWEL = 0x1
NFC_PROTO_JEWEL_MASK = 0x2
NFC_PROTO_MAX = 0x8
NFC_PROTO_MIFARE = 0x2
NFC_PROTO_MIFARE_MASK = 0x4
NFC_PROTO_NFC_DEP = 0x5
NFC_PROTO_NFC_DEP_MASK = 0x20
NFC_RAW_HEADER_SIZE = 0x2
NFC_RF_INITIATOR = 0x0
NFC_RF_NONE = 0x2
NFC_RF_TARGET = 0x1
NFC_SENSB_RES_MAXSIZE = 0xc
NFC_SENSF_RES_MAXSIZE = 0x12
NFC_SE_DISABLED = 0x0
NFC_SE_EMBEDDED = 0x2
NFC_SE_ENABLED = 0x1
NFC_SE_UICC = 0x1
NFC_SOCKPROTO_LLCP = 0x1
NFC_SOCKPROTO_MAX = 0x2
NFC_SOCKPROTO_RAW = 0x0
NFNETLINK_V0 = 0x0
NFNLGRP_ACCT_QUOTA = 0x8
NFNLGRP_CONNTRACK_DESTROY = 0x3
@ -1959,6 +2044,11 @@ const (
QNX4_SUPER_MAGIC = 0x2f
QNX6_SUPER_MAGIC = 0x68191122
RAMFS_MAGIC = 0x858458f6
RAW_PAYLOAD_DIGITAL = 0x3
RAW_PAYLOAD_HCI = 0x2
RAW_PAYLOAD_LLCP = 0x0
RAW_PAYLOAD_NCI = 0x1
RAW_PAYLOAD_PROPRIETARY = 0x4
RDTGROUP_SUPER_MAGIC = 0x7655821
REISERFS_SUPER_MAGIC = 0x52654973
RENAME_EXCHANGE = 0x2

View File

@ -60,6 +60,8 @@ const (
CS8 = 0x30
CSIZE = 0x30
CSTOPB = 0x40
ECCGETLAYOUT = 0x81484d11
ECCGETSTATS = 0x80104d12
ECHOCTL = 0x200
ECHOE = 0x10
ECHOK = 0x20
@ -123,6 +125,19 @@ const (
MCL_CURRENT = 0x1
MCL_FUTURE = 0x2
MCL_ONFAULT = 0x4
MEMERASE = 0x40084d02
MEMERASE64 = 0x40104d14
MEMGETBADBLOCK = 0x40084d0b
MEMGETINFO = 0x80204d01
MEMGETOOBSEL = 0x80c84d0a
MEMGETREGIONCOUNT = 0x80044d07
MEMISLOCKED = 0x80084d17
MEMLOCK = 0x40084d05
MEMREADOOB = 0xc00c4d04
MEMSETBADBLOCK = 0x40084d0c
MEMUNLOCK = 0x40084d06
MEMWRITEOOB = 0xc00c4d03
MTDFILEMODE = 0x4d13
NFDBITS = 0x20
NLDLY = 0x100
NOFLSH = 0x80
@ -132,6 +147,10 @@ const (
NS_GET_USERNS = 0xb701
OLCUC = 0x2
ONLCR = 0x4
OTPGETREGIONCOUNT = 0x40044d0e
OTPGETREGIONINFO = 0x400c4d0f
OTPLOCK = 0x800c4d10
OTPSELECT = 0x80044d0d
O_APPEND = 0x400
O_ASYNC = 0x2000
O_CLOEXEC = 0x80000

View File

@ -60,6 +60,8 @@ const (
CS8 = 0x30
CSIZE = 0x30
CSTOPB = 0x40
ECCGETLAYOUT = 0x81484d11
ECCGETSTATS = 0x80104d12
ECHOCTL = 0x200
ECHOE = 0x10
ECHOK = 0x20
@ -123,6 +125,19 @@ const (
MCL_CURRENT = 0x1
MCL_FUTURE = 0x2
MCL_ONFAULT = 0x4
MEMERASE = 0x40084d02
MEMERASE64 = 0x40104d14
MEMGETBADBLOCK = 0x40084d0b
MEMGETINFO = 0x80204d01
MEMGETOOBSEL = 0x80c84d0a
MEMGETREGIONCOUNT = 0x80044d07
MEMISLOCKED = 0x80084d17
MEMLOCK = 0x40084d05
MEMREADOOB = 0xc0104d04
MEMSETBADBLOCK = 0x40084d0c
MEMUNLOCK = 0x40084d06
MEMWRITEOOB = 0xc0104d03
MTDFILEMODE = 0x4d13
NFDBITS = 0x40
NLDLY = 0x100
NOFLSH = 0x80
@ -132,6 +147,10 @@ const (
NS_GET_USERNS = 0xb701
OLCUC = 0x2
ONLCR = 0x4
OTPGETREGIONCOUNT = 0x40044d0e
OTPGETREGIONINFO = 0x400c4d0f
OTPLOCK = 0x800c4d10
OTPSELECT = 0x80044d0d
O_APPEND = 0x400
O_ASYNC = 0x2000
O_CLOEXEC = 0x80000

View File

@ -60,6 +60,8 @@ const (
CS8 = 0x30
CSIZE = 0x30
CSTOPB = 0x40
ECCGETLAYOUT = 0x81484d11
ECCGETSTATS = 0x80104d12
ECHOCTL = 0x200
ECHOE = 0x10
ECHOK = 0x20
@ -121,6 +123,19 @@ const (
MCL_CURRENT = 0x1
MCL_FUTURE = 0x2
MCL_ONFAULT = 0x4
MEMERASE = 0x40084d02
MEMERASE64 = 0x40104d14
MEMGETBADBLOCK = 0x40084d0b
MEMGETINFO = 0x80204d01
MEMGETOOBSEL = 0x80c84d0a
MEMGETREGIONCOUNT = 0x80044d07
MEMISLOCKED = 0x80084d17
MEMLOCK = 0x40084d05
MEMREADOOB = 0xc00c4d04
MEMSETBADBLOCK = 0x40084d0c
MEMUNLOCK = 0x40084d06
MEMWRITEOOB = 0xc00c4d03
MTDFILEMODE = 0x4d13
NFDBITS = 0x20
NLDLY = 0x100
NOFLSH = 0x80
@ -130,6 +145,10 @@ const (
NS_GET_USERNS = 0xb701
OLCUC = 0x2
ONLCR = 0x4
OTPGETREGIONCOUNT = 0x40044d0e
OTPGETREGIONINFO = 0x400c4d0f
OTPLOCK = 0x800c4d10
OTPSELECT = 0x80044d0d
O_APPEND = 0x400
O_ASYNC = 0x2000
O_CLOEXEC = 0x80000

View File

@ -60,6 +60,8 @@ const (
CS8 = 0x30
CSIZE = 0x30
CSTOPB = 0x40
ECCGETLAYOUT = 0x81484d11
ECCGETSTATS = 0x80104d12
ECHOCTL = 0x200
ECHOE = 0x10
ECHOK = 0x20
@ -124,6 +126,19 @@ const (
MCL_CURRENT = 0x1
MCL_FUTURE = 0x2
MCL_ONFAULT = 0x4
MEMERASE = 0x40084d02
MEMERASE64 = 0x40104d14
MEMGETBADBLOCK = 0x40084d0b
MEMGETINFO = 0x80204d01
MEMGETOOBSEL = 0x80c84d0a
MEMGETREGIONCOUNT = 0x80044d07
MEMISLOCKED = 0x80084d17
MEMLOCK = 0x40084d05
MEMREADOOB = 0xc0104d04
MEMSETBADBLOCK = 0x40084d0c
MEMUNLOCK = 0x40084d06
MEMWRITEOOB = 0xc0104d03
MTDFILEMODE = 0x4d13
NFDBITS = 0x40
NLDLY = 0x100
NOFLSH = 0x80
@ -133,6 +148,10 @@ const (
NS_GET_USERNS = 0xb701
OLCUC = 0x2
ONLCR = 0x4
OTPGETREGIONCOUNT = 0x40044d0e
OTPGETREGIONINFO = 0x400c4d0f
OTPLOCK = 0x800c4d10
OTPSELECT = 0x80044d0d
O_APPEND = 0x400
O_ASYNC = 0x2000
O_CLOEXEC = 0x80000

View File

@ -60,6 +60,8 @@ const (
CS8 = 0x30
CSIZE = 0x30
CSTOPB = 0x40
ECCGETLAYOUT = 0x41484d11
ECCGETSTATS = 0x40104d12
ECHOCTL = 0x200
ECHOE = 0x10
ECHOK = 0x20
@ -121,6 +123,19 @@ const (
MCL_CURRENT = 0x1
MCL_FUTURE = 0x2
MCL_ONFAULT = 0x4
MEMERASE = 0x80084d02
MEMERASE64 = 0x80104d14
MEMGETBADBLOCK = 0x80084d0b
MEMGETINFO = 0x40204d01
MEMGETOOBSEL = 0x40c84d0a
MEMGETREGIONCOUNT = 0x40044d07
MEMISLOCKED = 0x40084d17
MEMLOCK = 0x80084d05
MEMREADOOB = 0xc00c4d04
MEMSETBADBLOCK = 0x80084d0c
MEMUNLOCK = 0x80084d06
MEMWRITEOOB = 0xc00c4d03
MTDFILEMODE = 0x20004d13
NFDBITS = 0x20
NLDLY = 0x100
NOFLSH = 0x80
@ -130,6 +145,10 @@ const (
NS_GET_USERNS = 0x2000b701
OLCUC = 0x2
ONLCR = 0x4
OTPGETREGIONCOUNT = 0x80044d0e
OTPGETREGIONINFO = 0x800c4d0f
OTPLOCK = 0x400c4d10
OTPSELECT = 0x40044d0d
O_APPEND = 0x8
O_ASYNC = 0x1000
O_CLOEXEC = 0x80000

View File

@ -60,6 +60,8 @@ const (
CS8 = 0x30
CSIZE = 0x30
CSTOPB = 0x40
ECCGETLAYOUT = 0x41484d11
ECCGETSTATS = 0x40104d12
ECHOCTL = 0x200
ECHOE = 0x10
ECHOK = 0x20
@ -121,6 +123,19 @@ const (
MCL_CURRENT = 0x1
MCL_FUTURE = 0x2
MCL_ONFAULT = 0x4
MEMERASE = 0x80084d02
MEMERASE64 = 0x80104d14
MEMGETBADBLOCK = 0x80084d0b
MEMGETINFO = 0x40204d01
MEMGETOOBSEL = 0x40c84d0a
MEMGETREGIONCOUNT = 0x40044d07
MEMISLOCKED = 0x40084d17
MEMLOCK = 0x80084d05
MEMREADOOB = 0xc0104d04
MEMSETBADBLOCK = 0x80084d0c
MEMUNLOCK = 0x80084d06
MEMWRITEOOB = 0xc0104d03
MTDFILEMODE = 0x20004d13
NFDBITS = 0x40
NLDLY = 0x100
NOFLSH = 0x80
@ -130,6 +145,10 @@ const (
NS_GET_USERNS = 0x2000b701
OLCUC = 0x2
ONLCR = 0x4
OTPGETREGIONCOUNT = 0x80044d0e
OTPGETREGIONINFO = 0x800c4d0f
OTPLOCK = 0x400c4d10
OTPSELECT = 0x40044d0d
O_APPEND = 0x8
O_ASYNC = 0x1000
O_CLOEXEC = 0x80000

View File

@ -60,6 +60,8 @@ const (
CS8 = 0x30
CSIZE = 0x30
CSTOPB = 0x40
ECCGETLAYOUT = 0x41484d11
ECCGETSTATS = 0x40104d12
ECHOCTL = 0x200
ECHOE = 0x10
ECHOK = 0x20
@ -121,6 +123,19 @@ const (
MCL_CURRENT = 0x1
MCL_FUTURE = 0x2
MCL_ONFAULT = 0x4
MEMERASE = 0x80084d02
MEMERASE64 = 0x80104d14
MEMGETBADBLOCK = 0x80084d0b
MEMGETINFO = 0x40204d01
MEMGETOOBSEL = 0x40c84d0a
MEMGETREGIONCOUNT = 0x40044d07
MEMISLOCKED = 0x40084d17
MEMLOCK = 0x80084d05
MEMREADOOB = 0xc0104d04
MEMSETBADBLOCK = 0x80084d0c
MEMUNLOCK = 0x80084d06
MEMWRITEOOB = 0xc0104d03
MTDFILEMODE = 0x20004d13
NFDBITS = 0x40
NLDLY = 0x100
NOFLSH = 0x80
@ -130,6 +145,10 @@ const (
NS_GET_USERNS = 0x2000b701
OLCUC = 0x2
ONLCR = 0x4
OTPGETREGIONCOUNT = 0x80044d0e
OTPGETREGIONINFO = 0x800c4d0f
OTPLOCK = 0x400c4d10
OTPSELECT = 0x40044d0d
O_APPEND = 0x8
O_ASYNC = 0x1000
O_CLOEXEC = 0x80000

View File

@ -60,6 +60,8 @@ const (
CS8 = 0x30
CSIZE = 0x30
CSTOPB = 0x40
ECCGETLAYOUT = 0x41484d11
ECCGETSTATS = 0x40104d12
ECHOCTL = 0x200
ECHOE = 0x10
ECHOK = 0x20
@ -121,6 +123,19 @@ const (
MCL_CURRENT = 0x1
MCL_FUTURE = 0x2
MCL_ONFAULT = 0x4
MEMERASE = 0x80084d02
MEMERASE64 = 0x80104d14
MEMGETBADBLOCK = 0x80084d0b
MEMGETINFO = 0x40204d01
MEMGETOOBSEL = 0x40c84d0a
MEMGETREGIONCOUNT = 0x40044d07
MEMISLOCKED = 0x40084d17
MEMLOCK = 0x80084d05
MEMREADOOB = 0xc00c4d04
MEMSETBADBLOCK = 0x80084d0c
MEMUNLOCK = 0x80084d06
MEMWRITEOOB = 0xc00c4d03
MTDFILEMODE = 0x20004d13
NFDBITS = 0x20
NLDLY = 0x100
NOFLSH = 0x80
@ -130,6 +145,10 @@ const (
NS_GET_USERNS = 0x2000b701
OLCUC = 0x2
ONLCR = 0x4
OTPGETREGIONCOUNT = 0x80044d0e
OTPGETREGIONINFO = 0x800c4d0f
OTPLOCK = 0x400c4d10
OTPSELECT = 0x40044d0d
O_APPEND = 0x8
O_ASYNC = 0x1000
O_CLOEXEC = 0x80000

View File

@ -60,6 +60,8 @@ const (
CS8 = 0x300
CSIZE = 0x300
CSTOPB = 0x400
ECCGETLAYOUT = 0x41484d11
ECCGETSTATS = 0x40104d12
ECHOCTL = 0x40
ECHOE = 0x2
ECHOK = 0x4
@ -121,6 +123,19 @@ const (
MCL_CURRENT = 0x2000
MCL_FUTURE = 0x4000
MCL_ONFAULT = 0x8000
MEMERASE = 0x80084d02
MEMERASE64 = 0x80104d14
MEMGETBADBLOCK = 0x80084d0b
MEMGETINFO = 0x40204d01
MEMGETOOBSEL = 0x40c84d0a
MEMGETREGIONCOUNT = 0x40044d07
MEMISLOCKED = 0x40084d17
MEMLOCK = 0x80084d05
MEMREADOOB = 0xc00c4d04
MEMSETBADBLOCK = 0x80084d0c
MEMUNLOCK = 0x80084d06
MEMWRITEOOB = 0xc00c4d03
MTDFILEMODE = 0x20004d13
NFDBITS = 0x20
NL2 = 0x200
NL3 = 0x300
@ -132,6 +147,10 @@ const (
NS_GET_USERNS = 0x2000b701
OLCUC = 0x4
ONLCR = 0x2
OTPGETREGIONCOUNT = 0x80044d0e
OTPGETREGIONINFO = 0x800c4d0f
OTPLOCK = 0x400c4d10
OTPSELECT = 0x40044d0d
O_APPEND = 0x400
O_ASYNC = 0x2000
O_CLOEXEC = 0x80000

View File

@ -60,6 +60,8 @@ const (
CS8 = 0x300
CSIZE = 0x300
CSTOPB = 0x400
ECCGETLAYOUT = 0x41484d11
ECCGETSTATS = 0x40104d12
ECHOCTL = 0x40
ECHOE = 0x2
ECHOK = 0x4
@ -121,6 +123,19 @@ const (
MCL_CURRENT = 0x2000
MCL_FUTURE = 0x4000
MCL_ONFAULT = 0x8000
MEMERASE = 0x80084d02
MEMERASE64 = 0x80104d14
MEMGETBADBLOCK = 0x80084d0b
MEMGETINFO = 0x40204d01
MEMGETOOBSEL = 0x40c84d0a
MEMGETREGIONCOUNT = 0x40044d07
MEMISLOCKED = 0x40084d17
MEMLOCK = 0x80084d05
MEMREADOOB = 0xc0104d04
MEMSETBADBLOCK = 0x80084d0c
MEMUNLOCK = 0x80084d06
MEMWRITEOOB = 0xc0104d03
MTDFILEMODE = 0x20004d13
NFDBITS = 0x40
NL2 = 0x200
NL3 = 0x300
@ -132,6 +147,10 @@ const (
NS_GET_USERNS = 0x2000b701
OLCUC = 0x4
ONLCR = 0x2
OTPGETREGIONCOUNT = 0x80044d0e
OTPGETREGIONINFO = 0x800c4d0f
OTPLOCK = 0x400c4d10
OTPSELECT = 0x40044d0d
O_APPEND = 0x400
O_ASYNC = 0x2000
O_CLOEXEC = 0x80000

View File

@ -60,6 +60,8 @@ const (
CS8 = 0x300
CSIZE = 0x300
CSTOPB = 0x400
ECCGETLAYOUT = 0x41484d11
ECCGETSTATS = 0x40104d12
ECHOCTL = 0x40
ECHOE = 0x2
ECHOK = 0x4
@ -121,6 +123,19 @@ const (
MCL_CURRENT = 0x2000
MCL_FUTURE = 0x4000
MCL_ONFAULT = 0x8000
MEMERASE = 0x80084d02
MEMERASE64 = 0x80104d14
MEMGETBADBLOCK = 0x80084d0b
MEMGETINFO = 0x40204d01
MEMGETOOBSEL = 0x40c84d0a
MEMGETREGIONCOUNT = 0x40044d07
MEMISLOCKED = 0x40084d17
MEMLOCK = 0x80084d05
MEMREADOOB = 0xc0104d04
MEMSETBADBLOCK = 0x80084d0c
MEMUNLOCK = 0x80084d06
MEMWRITEOOB = 0xc0104d03
MTDFILEMODE = 0x20004d13
NFDBITS = 0x40
NL2 = 0x200
NL3 = 0x300
@ -132,6 +147,10 @@ const (
NS_GET_USERNS = 0x2000b701
OLCUC = 0x4
ONLCR = 0x2
OTPGETREGIONCOUNT = 0x80044d0e
OTPGETREGIONINFO = 0x800c4d0f
OTPLOCK = 0x400c4d10
OTPSELECT = 0x40044d0d
O_APPEND = 0x400
O_ASYNC = 0x2000
O_CLOEXEC = 0x80000

View File

@ -60,6 +60,8 @@ const (
CS8 = 0x30
CSIZE = 0x30
CSTOPB = 0x40
ECCGETLAYOUT = 0x81484d11
ECCGETSTATS = 0x80104d12
ECHOCTL = 0x200
ECHOE = 0x10
ECHOK = 0x20
@ -121,6 +123,19 @@ const (
MCL_CURRENT = 0x1
MCL_FUTURE = 0x2
MCL_ONFAULT = 0x4
MEMERASE = 0x40084d02
MEMERASE64 = 0x40104d14
MEMGETBADBLOCK = 0x40084d0b
MEMGETINFO = 0x80204d01
MEMGETOOBSEL = 0x80c84d0a
MEMGETREGIONCOUNT = 0x80044d07
MEMISLOCKED = 0x80084d17
MEMLOCK = 0x40084d05
MEMREADOOB = 0xc0104d04
MEMSETBADBLOCK = 0x40084d0c
MEMUNLOCK = 0x40084d06
MEMWRITEOOB = 0xc0104d03
MTDFILEMODE = 0x4d13
NFDBITS = 0x40
NLDLY = 0x100
NOFLSH = 0x80
@ -130,6 +145,10 @@ const (
NS_GET_USERNS = 0xb701
OLCUC = 0x2
ONLCR = 0x4
OTPGETREGIONCOUNT = 0x40044d0e
OTPGETREGIONINFO = 0x400c4d0f
OTPLOCK = 0x800c4d10
OTPSELECT = 0x80044d0d
O_APPEND = 0x400
O_ASYNC = 0x2000
O_CLOEXEC = 0x80000

View File

@ -60,6 +60,8 @@ const (
CS8 = 0x30
CSIZE = 0x30
CSTOPB = 0x40
ECCGETLAYOUT = 0x81484d11
ECCGETSTATS = 0x80104d12
ECHOCTL = 0x200
ECHOE = 0x10
ECHOK = 0x20
@ -121,6 +123,19 @@ const (
MCL_CURRENT = 0x1
MCL_FUTURE = 0x2
MCL_ONFAULT = 0x4
MEMERASE = 0x40084d02
MEMERASE64 = 0x40104d14
MEMGETBADBLOCK = 0x40084d0b
MEMGETINFO = 0x80204d01
MEMGETOOBSEL = 0x80c84d0a
MEMGETREGIONCOUNT = 0x80044d07
MEMISLOCKED = 0x80084d17
MEMLOCK = 0x40084d05
MEMREADOOB = 0xc0104d04
MEMSETBADBLOCK = 0x40084d0c
MEMUNLOCK = 0x40084d06
MEMWRITEOOB = 0xc0104d03
MTDFILEMODE = 0x4d13
NFDBITS = 0x40
NLDLY = 0x100
NOFLSH = 0x80
@ -130,6 +145,10 @@ const (
NS_GET_USERNS = 0xb701
OLCUC = 0x2
ONLCR = 0x4
OTPGETREGIONCOUNT = 0x40044d0e
OTPGETREGIONINFO = 0x400c4d0f
OTPLOCK = 0x800c4d10
OTPSELECT = 0x80044d0d
O_APPEND = 0x400
O_ASYNC = 0x2000
O_CLOEXEC = 0x80000

View File

@ -63,6 +63,8 @@ const (
CS8 = 0x30
CSIZE = 0x30
CSTOPB = 0x40
ECCGETLAYOUT = 0x41484d11
ECCGETSTATS = 0x40104d12
ECHOCTL = 0x200
ECHOE = 0x10
ECHOK = 0x20
@ -126,6 +128,19 @@ const (
MCL_CURRENT = 0x2000
MCL_FUTURE = 0x4000
MCL_ONFAULT = 0x8000
MEMERASE = 0x80084d02
MEMERASE64 = 0x80104d14
MEMGETBADBLOCK = 0x80084d0b
MEMGETINFO = 0x40204d01
MEMGETOOBSEL = 0x40c84d0a
MEMGETREGIONCOUNT = 0x40044d07
MEMISLOCKED = 0x40084d17
MEMLOCK = 0x80084d05
MEMREADOOB = 0xc0104d04
MEMSETBADBLOCK = 0x80084d0c
MEMUNLOCK = 0x80084d06
MEMWRITEOOB = 0xc0104d03
MTDFILEMODE = 0x20004d13
NFDBITS = 0x40
NLDLY = 0x100
NOFLSH = 0x80
@ -135,6 +150,10 @@ const (
NS_GET_USERNS = 0x2000b701
OLCUC = 0x2
ONLCR = 0x4
OTPGETREGIONCOUNT = 0x80044d0e
OTPGETREGIONINFO = 0x800c4d0f
OTPLOCK = 0x400c4d10
OTPSELECT = 0x40044d0d
O_APPEND = 0x8
O_ASYNC = 0x40
O_CLOEXEC = 0x400000

View File

@ -351,6 +351,13 @@ type RawSockaddrIUCV struct {
Name [8]int8
}
type RawSockaddrNFC struct {
Sa_family uint16
Dev_idx uint32
Target_idx uint32
Nfc_protocol uint32
}
type _Socklen uint32
type Linger struct {
@ -464,6 +471,7 @@ const (
SizeofSockaddrL2TPIP = 0x10
SizeofSockaddrL2TPIP6 = 0x20
SizeofSockaddrIUCV = 0x20
SizeofSockaddrNFC = 0x10
SizeofLinger = 0x8
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
@ -3742,3 +3750,158 @@ const (
NLMSGERR_ATTR_OFFS = 0x2
NLMSGERR_ATTR_COOKIE = 0x3
)
type (
EraseInfo struct {
Start uint32
Length uint32
}
EraseInfo64 struct {
Start uint64
Length uint64
}
MtdOobBuf struct {
Start uint32
Length uint32
Ptr *uint8
}
MtdOobBuf64 struct {
Start uint64
Pad uint32
Length uint32
Ptr uint64
}
MtdWriteReq struct {
Start uint64
Len uint64
Ooblen uint64
Data uint64
Oob uint64
Mode uint8
_ [7]uint8
}
MtdInfo struct {
Type uint8
Flags uint32
Size uint32
Erasesize uint32
Writesize uint32
Oobsize uint32
_ uint64
}
RegionInfo struct {
Offset uint32
Erasesize uint32
Numblocks uint32
Regionindex uint32
}
OtpInfo struct {
Start uint32
Length uint32
Locked uint32
}
NandOobinfo struct {
Useecc uint32
Eccbytes uint32
Oobfree [8][2]uint32
Eccpos [32]uint32
}
NandOobfree struct {
Offset uint32
Length uint32
}
NandEcclayout struct {
Eccbytes uint32
Eccpos [64]uint32
Oobavail uint32
Oobfree [8]NandOobfree
}
MtdEccStats struct {
Corrected uint32
Failed uint32
Badblocks uint32
Bbtblocks uint32
}
)
const (
MTD_OPS_PLACE_OOB = 0x0
MTD_OPS_AUTO_OOB = 0x1
MTD_OPS_RAW = 0x2
)
const (
MTD_FILE_MODE_NORMAL = 0x0
MTD_FILE_MODE_OTP_FACTORY = 0x1
MTD_FILE_MODE_OTP_USER = 0x2
MTD_FILE_MODE_RAW = 0x3
)
const (
NFC_CMD_UNSPEC = 0x0
NFC_CMD_GET_DEVICE = 0x1
NFC_CMD_DEV_UP = 0x2
NFC_CMD_DEV_DOWN = 0x3
NFC_CMD_DEP_LINK_UP = 0x4
NFC_CMD_DEP_LINK_DOWN = 0x5
NFC_CMD_START_POLL = 0x6
NFC_CMD_STOP_POLL = 0x7
NFC_CMD_GET_TARGET = 0x8
NFC_EVENT_TARGETS_FOUND = 0x9
NFC_EVENT_DEVICE_ADDED = 0xa
NFC_EVENT_DEVICE_REMOVED = 0xb
NFC_EVENT_TARGET_LOST = 0xc
NFC_EVENT_TM_ACTIVATED = 0xd
NFC_EVENT_TM_DEACTIVATED = 0xe
NFC_CMD_LLC_GET_PARAMS = 0xf
NFC_CMD_LLC_SET_PARAMS = 0x10
NFC_CMD_ENABLE_SE = 0x11
NFC_CMD_DISABLE_SE = 0x12
NFC_CMD_LLC_SDREQ = 0x13
NFC_EVENT_LLC_SDRES = 0x14
NFC_CMD_FW_DOWNLOAD = 0x15
NFC_EVENT_SE_ADDED = 0x16
NFC_EVENT_SE_REMOVED = 0x17
NFC_EVENT_SE_CONNECTIVITY = 0x18
NFC_EVENT_SE_TRANSACTION = 0x19
NFC_CMD_GET_SE = 0x1a
NFC_CMD_SE_IO = 0x1b
NFC_CMD_ACTIVATE_TARGET = 0x1c
NFC_CMD_VENDOR = 0x1d
NFC_CMD_DEACTIVATE_TARGET = 0x1e
NFC_ATTR_UNSPEC = 0x0
NFC_ATTR_DEVICE_INDEX = 0x1
NFC_ATTR_DEVICE_NAME = 0x2
NFC_ATTR_PROTOCOLS = 0x3
NFC_ATTR_TARGET_INDEX = 0x4
NFC_ATTR_TARGET_SENS_RES = 0x5
NFC_ATTR_TARGET_SEL_RES = 0x6
NFC_ATTR_TARGET_NFCID1 = 0x7
NFC_ATTR_TARGET_SENSB_RES = 0x8
NFC_ATTR_TARGET_SENSF_RES = 0x9
NFC_ATTR_COMM_MODE = 0xa
NFC_ATTR_RF_MODE = 0xb
NFC_ATTR_DEVICE_POWERED = 0xc
NFC_ATTR_IM_PROTOCOLS = 0xd
NFC_ATTR_TM_PROTOCOLS = 0xe
NFC_ATTR_LLC_PARAM_LTO = 0xf
NFC_ATTR_LLC_PARAM_RW = 0x10
NFC_ATTR_LLC_PARAM_MIUX = 0x11
NFC_ATTR_SE = 0x12
NFC_ATTR_LLC_SDP = 0x13
NFC_ATTR_FIRMWARE_NAME = 0x14
NFC_ATTR_SE_INDEX = 0x15
NFC_ATTR_SE_TYPE = 0x16
NFC_ATTR_SE_AID = 0x17
NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS = 0x18
NFC_ATTR_SE_APDU = 0x19
NFC_ATTR_TARGET_ISO15693_DSFID = 0x1a
NFC_ATTR_TARGET_ISO15693_UID = 0x1b
NFC_ATTR_SE_PARAMS = 0x1c
NFC_ATTR_VENDOR_ID = 0x1d
NFC_ATTR_VENDOR_SUBCMD = 0x1e
NFC_ATTR_VENDOR_DATA = 0x1f
NFC_SDP_ATTR_UNSPEC = 0x0
NFC_SDP_ATTR_URI = 0x1
NFC_SDP_ATTR_SAP = 0x2
)

View File

@ -128,6 +128,17 @@ const (
FADV_NOREUSE = 0x5
)
type RawSockaddrNFCLLCP struct {
Sa_family uint16
Dev_idx uint32
Target_idx uint32
Nfc_protocol uint32
Dsap uint8
Ssap uint8
Service_name [63]uint8
Service_name_len uint32
}
type RawSockaddr struct {
Family uint16
Data [14]int8
@ -160,9 +171,10 @@ type Cmsghdr struct {
}
const (
SizeofIovec = 0x8
SizeofMsghdr = 0x1c
SizeofCmsghdr = 0xc
SizeofSockaddrNFCLLCP = 0x58
SizeofIovec = 0x8
SizeofMsghdr = 0x1c
SizeofCmsghdr = 0xc
)
const (

View File

@ -130,6 +130,17 @@ const (
FADV_NOREUSE = 0x5
)
type RawSockaddrNFCLLCP struct {
Sa_family uint16
Dev_idx uint32
Target_idx uint32
Nfc_protocol uint32
Dsap uint8
Ssap uint8
Service_name [63]uint8
Service_name_len uint64
}
type RawSockaddr struct {
Family uint16
Data [14]int8
@ -163,9 +174,10 @@ type Cmsghdr struct {
}
const (
SizeofIovec = 0x10
SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10
SizeofSockaddrNFCLLCP = 0x60
SizeofIovec = 0x10
SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10
)
const (

View File

@ -134,6 +134,17 @@ const (
FADV_NOREUSE = 0x5
)
type RawSockaddrNFCLLCP struct {
Sa_family uint16
Dev_idx uint32
Target_idx uint32
Nfc_protocol uint32
Dsap uint8
Ssap uint8
Service_name [63]uint8
Service_name_len uint32
}
type RawSockaddr struct {
Family uint16
Data [14]uint8
@ -166,9 +177,10 @@ type Cmsghdr struct {
}
const (
SizeofIovec = 0x8
SizeofMsghdr = 0x1c
SizeofCmsghdr = 0xc
SizeofSockaddrNFCLLCP = 0x58
SizeofIovec = 0x8
SizeofMsghdr = 0x1c
SizeofCmsghdr = 0xc
)
const (

View File

@ -131,6 +131,17 @@ const (
FADV_NOREUSE = 0x5
)
type RawSockaddrNFCLLCP struct {
Sa_family uint16
Dev_idx uint32
Target_idx uint32
Nfc_protocol uint32
Dsap uint8
Ssap uint8
Service_name [63]uint8
Service_name_len uint64
}
type RawSockaddr struct {
Family uint16
Data [14]int8
@ -164,9 +175,10 @@ type Cmsghdr struct {
}
const (
SizeofIovec = 0x10
SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10
SizeofSockaddrNFCLLCP = 0x60
SizeofIovec = 0x10
SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10
)
const (

View File

@ -133,6 +133,17 @@ const (
FADV_NOREUSE = 0x5
)
type RawSockaddrNFCLLCP struct {
Sa_family uint16
Dev_idx uint32
Target_idx uint32
Nfc_protocol uint32
Dsap uint8
Ssap uint8
Service_name [63]uint8
Service_name_len uint32
}
type RawSockaddr struct {
Family uint16
Data [14]int8
@ -165,9 +176,10 @@ type Cmsghdr struct {
}
const (
SizeofIovec = 0x8
SizeofMsghdr = 0x1c
SizeofCmsghdr = 0xc
SizeofSockaddrNFCLLCP = 0x58
SizeofIovec = 0x8
SizeofMsghdr = 0x1c
SizeofCmsghdr = 0xc
)
const (

View File

@ -131,6 +131,17 @@ const (
FADV_NOREUSE = 0x5
)
type RawSockaddrNFCLLCP struct {
Sa_family uint16
Dev_idx uint32
Target_idx uint32
Nfc_protocol uint32
Dsap uint8
Ssap uint8
Service_name [63]uint8
Service_name_len uint64
}
type RawSockaddr struct {
Family uint16
Data [14]int8
@ -164,9 +175,10 @@ type Cmsghdr struct {
}
const (
SizeofIovec = 0x10
SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10
SizeofSockaddrNFCLLCP = 0x60
SizeofIovec = 0x10
SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10
)
const (

View File

@ -131,6 +131,17 @@ const (
FADV_NOREUSE = 0x5
)
type RawSockaddrNFCLLCP struct {
Sa_family uint16
Dev_idx uint32
Target_idx uint32
Nfc_protocol uint32
Dsap uint8
Ssap uint8
Service_name [63]uint8
Service_name_len uint64
}
type RawSockaddr struct {
Family uint16
Data [14]int8
@ -164,9 +175,10 @@ type Cmsghdr struct {
}
const (
SizeofIovec = 0x10
SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10
SizeofSockaddrNFCLLCP = 0x60
SizeofIovec = 0x10
SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10
)
const (

View File

@ -133,6 +133,17 @@ const (
FADV_NOREUSE = 0x5
)
type RawSockaddrNFCLLCP struct {
Sa_family uint16
Dev_idx uint32
Target_idx uint32
Nfc_protocol uint32
Dsap uint8
Ssap uint8
Service_name [63]uint8
Service_name_len uint32
}
type RawSockaddr struct {
Family uint16
Data [14]int8
@ -165,9 +176,10 @@ type Cmsghdr struct {
}
const (
SizeofIovec = 0x8
SizeofMsghdr = 0x1c
SizeofCmsghdr = 0xc
SizeofSockaddrNFCLLCP = 0x58
SizeofIovec = 0x8
SizeofMsghdr = 0x1c
SizeofCmsghdr = 0xc
)
const (

View File

@ -134,6 +134,17 @@ const (
FADV_NOREUSE = 0x5
)
type RawSockaddrNFCLLCP struct {
Sa_family uint16
Dev_idx uint32
Target_idx uint32
Nfc_protocol uint32
Dsap uint8
Ssap uint8
Service_name [63]uint8
Service_name_len uint32
}
type RawSockaddr struct {
Family uint16
Data [14]uint8
@ -166,9 +177,10 @@ type Cmsghdr struct {
}
const (
SizeofIovec = 0x8
SizeofMsghdr = 0x1c
SizeofCmsghdr = 0xc
SizeofSockaddrNFCLLCP = 0x58
SizeofIovec = 0x8
SizeofMsghdr = 0x1c
SizeofCmsghdr = 0xc
)
const (

View File

@ -132,6 +132,17 @@ const (
FADV_NOREUSE = 0x5
)
type RawSockaddrNFCLLCP struct {
Sa_family uint16
Dev_idx uint32
Target_idx uint32
Nfc_protocol uint32
Dsap uint8
Ssap uint8
Service_name [63]uint8
Service_name_len uint64
}
type RawSockaddr struct {
Family uint16
Data [14]uint8
@ -165,9 +176,10 @@ type Cmsghdr struct {
}
const (
SizeofIovec = 0x10
SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10
SizeofSockaddrNFCLLCP = 0x60
SizeofIovec = 0x10
SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10
)
const (

View File

@ -132,6 +132,17 @@ const (
FADV_NOREUSE = 0x5
)
type RawSockaddrNFCLLCP struct {
Sa_family uint16
Dev_idx uint32
Target_idx uint32
Nfc_protocol uint32
Dsap uint8
Ssap uint8
Service_name [63]uint8
Service_name_len uint64
}
type RawSockaddr struct {
Family uint16
Data [14]uint8
@ -165,9 +176,10 @@ type Cmsghdr struct {
}
const (
SizeofIovec = 0x10
SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10
SizeofSockaddrNFCLLCP = 0x60
SizeofIovec = 0x10
SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10
)
const (

View File

@ -131,6 +131,17 @@ const (
FADV_NOREUSE = 0x5
)
type RawSockaddrNFCLLCP struct {
Sa_family uint16
Dev_idx uint32
Target_idx uint32
Nfc_protocol uint32
Dsap uint8
Ssap uint8
Service_name [63]uint8
Service_name_len uint64
}
type RawSockaddr struct {
Family uint16
Data [14]uint8
@ -164,9 +175,10 @@ type Cmsghdr struct {
}
const (
SizeofIovec = 0x10
SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10
SizeofSockaddrNFCLLCP = 0x60
SizeofIovec = 0x10
SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10
)
const (

View File

@ -130,6 +130,17 @@ const (
FADV_NOREUSE = 0x7
)
type RawSockaddrNFCLLCP struct {
Sa_family uint16
Dev_idx uint32
Target_idx uint32
Nfc_protocol uint32
Dsap uint8
Ssap uint8
Service_name [63]uint8
Service_name_len uint64
}
type RawSockaddr struct {
Family uint16
Data [14]int8
@ -163,9 +174,10 @@ type Cmsghdr struct {
}
const (
SizeofIovec = 0x10
SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10
SizeofSockaddrNFCLLCP = 0x60
SizeofIovec = 0x10
SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10
)
const (

View File

@ -134,6 +134,17 @@ const (
FADV_NOREUSE = 0x5
)
type RawSockaddrNFCLLCP struct {
Sa_family uint16
Dev_idx uint32
Target_idx uint32
Nfc_protocol uint32
Dsap uint8
Ssap uint8
Service_name [63]uint8
Service_name_len uint64
}
type RawSockaddr struct {
Family uint16
Data [14]int8
@ -167,9 +178,10 @@ type Cmsghdr struct {
}
const (
SizeofIovec = 0x10
SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10
SizeofSockaddrNFCLLCP = 0x60
SizeofIovec = 0x10
SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10
)
const (

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !go1.12
// +build !go1.12
// This file is here to allow bodyless functions with go:linkname for Go 1.11

View File

@ -9,6 +9,8 @@ package windows
import (
errorspkg "errors"
"unsafe"
"golang.org/x/sys/internal/unsafeheader"
)
// EscapeArg rewrites command line argument s as prescribed
@ -78,6 +80,40 @@ func EscapeArg(s string) string {
return string(qs[:j])
}
// ComposeCommandLine escapes and joins the given arguments suitable for use as a Windows command line,
// in CreateProcess's CommandLine argument, CreateService/ChangeServiceConfig's BinaryPathName argument,
// or any program that uses CommandLineToArgv.
func ComposeCommandLine(args []string) string {
var commandLine string
for i := range args {
if i > 0 {
commandLine += " "
}
commandLine += EscapeArg(args[i])
}
return commandLine
}
// DecomposeCommandLine breaks apart its argument command line into unescaped parts using CommandLineToArgv,
// as gathered from GetCommandLine, QUERY_SERVICE_CONFIG's BinaryPathName argument, or elsewhere that
// command lines are passed around.
func DecomposeCommandLine(commandLine string) ([]string, error) {
if len(commandLine) == 0 {
return []string{}, nil
}
var argc int32
argv, err := CommandLineToArgv(StringToUTF16Ptr(commandLine), &argc)
if err != nil {
return nil, err
}
defer LocalFree(Handle(unsafe.Pointer(argv)))
var args []string
for _, v := range (*argv)[:argc] {
args = append(args, UTF16ToString((*v)[:]))
}
return args, nil
}
func CloseOnExec(fd Handle) {
SetHandleInformation(Handle(fd), HANDLE_FLAG_INHERIT, 0)
}
@ -101,8 +137,8 @@ func FullPath(name string) (path string, err error) {
}
}
// NewProcThreadAttributeList allocates a new ProcThreadAttributeList, with the requested maximum number of attributes.
func NewProcThreadAttributeList(maxAttrCount uint32) (*ProcThreadAttributeList, error) {
// NewProcThreadAttributeList allocates a new ProcThreadAttributeListContainer, with the requested maximum number of attributes.
func NewProcThreadAttributeList(maxAttrCount uint32) (*ProcThreadAttributeListContainer, error) {
var size uintptr
err := initializeProcThreadAttributeList(nil, maxAttrCount, 0, &size)
if err != ERROR_INSUFFICIENT_BUFFER {
@ -111,10 +147,9 @@ func NewProcThreadAttributeList(maxAttrCount uint32) (*ProcThreadAttributeList,
}
return nil, err
}
const psize = unsafe.Sizeof(uintptr(0))
// size is guaranteed to be ≥1 by InitializeProcThreadAttributeList.
al := (*ProcThreadAttributeList)(unsafe.Pointer(&make([]unsafe.Pointer, (size+psize-1)/psize)[0]))
err = initializeProcThreadAttributeList(al, maxAttrCount, 0, &size)
al := &ProcThreadAttributeListContainer{data: (*ProcThreadAttributeList)(unsafe.Pointer(&make([]byte, size)[0]))}
err = initializeProcThreadAttributeList(al.data, maxAttrCount, 0, &size)
if err != nil {
return nil, err
}
@ -122,11 +157,39 @@ func NewProcThreadAttributeList(maxAttrCount uint32) (*ProcThreadAttributeList,
}
// Update modifies the ProcThreadAttributeList using UpdateProcThreadAttribute.
func (al *ProcThreadAttributeList) Update(attribute uintptr, flags uint32, value unsafe.Pointer, size uintptr, prevValue unsafe.Pointer, returnedSize *uintptr) error {
return updateProcThreadAttribute(al, flags, attribute, value, size, prevValue, returnedSize)
// Note that the value passed to this function will be copied into memory
// allocated by LocalAlloc, the contents of which should not contain any
// Go-managed pointers, even if the passed value itself is a Go-managed
// pointer.
func (al *ProcThreadAttributeListContainer) Update(attribute uintptr, value unsafe.Pointer, size uintptr) error {
alloc, err := LocalAlloc(LMEM_FIXED, uint32(size))
if err != nil {
return err
}
var src, dst []byte
hdr := (*unsafeheader.Slice)(unsafe.Pointer(&src))
hdr.Data = value
hdr.Cap = int(size)
hdr.Len = int(size)
hdr = (*unsafeheader.Slice)(unsafe.Pointer(&dst))
hdr.Data = unsafe.Pointer(alloc)
hdr.Cap = int(size)
hdr.Len = int(size)
copy(dst, src)
al.heapAllocations = append(al.heapAllocations, alloc)
return updateProcThreadAttribute(al.data, 0, attribute, unsafe.Pointer(alloc), size, nil, nil)
}
// Delete frees ProcThreadAttributeList's resources.
func (al *ProcThreadAttributeList) Delete() {
deleteProcThreadAttributeList(al)
func (al *ProcThreadAttributeListContainer) Delete() {
deleteProcThreadAttributeList(al.data)
for i := range al.heapAllocations {
LocalFree(Handle(al.heapAllocations[i]))
}
al.heapAllocations = nil
}
// List returns the actual ProcThreadAttributeList to be passed to StartupInfoEx.
func (al *ProcThreadAttributeListContainer) List() *ProcThreadAttributeList {
return al.data
}

View File

@ -220,6 +220,7 @@ func NewCallbackCDecl(fn interface{}) uintptr {
//sys CancelIo(s Handle) (err error)
//sys CancelIoEx(s Handle, o *Overlapped) (err error)
//sys CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) = CreateProcessW
//sys CreateProcessAsUser(token Token, appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) = advapi32.CreateProcessAsUserW
//sys initializeProcThreadAttributeList(attrlist *ProcThreadAttributeList, attrcount uint32, flags uint32, size *uintptr) (err error) = InitializeProcThreadAttributeList
//sys deleteProcThreadAttributeList(attrlist *ProcThreadAttributeList) = DeleteProcThreadAttributeList
//sys updateProcThreadAttribute(attrlist *ProcThreadAttributeList, flags uint32, attr uintptr, value unsafe.Pointer, size uintptr, prevvalue unsafe.Pointer, returnedsize *uintptr) (err error) = UpdateProcThreadAttribute

View File

@ -909,14 +909,15 @@ type StartupInfoEx struct {
// ProcThreadAttributeList is a placeholder type to represent a PROC_THREAD_ATTRIBUTE_LIST.
//
// To create a *ProcThreadAttributeList, use NewProcThreadAttributeList, and
// free its memory using ProcThreadAttributeList.Delete.
type ProcThreadAttributeList struct {
// This is of type unsafe.Pointer, not of type byte or uintptr, because
// the contents of it is mostly a list of pointers, and in most cases,
// that's a list of pointers to Go-allocated objects. In order to keep
// the GC from collecting these objects, we declare this as unsafe.Pointer.
_ [1]unsafe.Pointer
// To create a *ProcThreadAttributeList, use NewProcThreadAttributeList, update
// it with ProcThreadAttributeListContainer.Update, free its memory using
// ProcThreadAttributeListContainer.Delete, and access the list itself using
// ProcThreadAttributeListContainer.List.
type ProcThreadAttributeList struct{}
type ProcThreadAttributeListContainer struct {
data *ProcThreadAttributeList
heapAllocations []uintptr
}
type ProcessInformation struct {

View File

@ -69,6 +69,7 @@ var (
procConvertStringSecurityDescriptorToSecurityDescriptorW = modadvapi32.NewProc("ConvertStringSecurityDescriptorToSecurityDescriptorW")
procConvertStringSidToSidW = modadvapi32.NewProc("ConvertStringSidToSidW")
procCopySid = modadvapi32.NewProc("CopySid")
procCreateProcessAsUserW = modadvapi32.NewProc("CreateProcessAsUserW")
procCreateServiceW = modadvapi32.NewProc("CreateServiceW")
procCreateWellKnownSid = modadvapi32.NewProc("CreateWellKnownSid")
procCryptAcquireContextW = modadvapi32.NewProc("CryptAcquireContextW")
@ -553,6 +554,18 @@ func CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) {
return
}
func CreateProcessAsUser(token Token, appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) {
var _p0 uint32
if inheritHandles {
_p0 = 1
}
r1, _, e1 := syscall.Syscall12(procCreateProcessAsUserW.Addr(), 11, uintptr(token), uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo)), 0)
if r1 == 0 {
err = errnoErr(e1)
}
return
}
func CreateService(mgr Handle, serviceName *uint16, displayName *uint16, access uint32, srvType uint32, startType uint32, errCtl uint32, pathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16) (handle Handle, err error) {
r0, _, e1 := syscall.Syscall15(procCreateServiceW.Addr(), 13, uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(unsafe.Pointer(displayName)), uintptr(access), uintptr(srvType), uintptr(startType), uintptr(errCtl), uintptr(unsafe.Pointer(pathName)), uintptr(unsafe.Pointer(loadOrderGroup)), uintptr(unsafe.Pointer(tagId)), uintptr(unsafe.Pointer(dependencies)), uintptr(unsafe.Pointer(serviceStartName)), uintptr(unsafe.Pointer(password)), 0, 0)
handle = Handle(r0)

6
vendor/modules.txt vendored
View File

@ -69,7 +69,7 @@ github.com/powerman/check
# github.com/smartystreets/goconvey v1.6.4
github.com/smartystreets/goconvey/convey/gotest
github.com/smartystreets/goconvey/convey/reporting
# golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf
# golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a
## explicit
golang.org/x/crypto/blake2b
golang.org/x/crypto/chacha20
@ -84,7 +84,7 @@ golang.org/x/crypto/nacl/box
golang.org/x/crypto/nacl/secretbox
golang.org/x/crypto/poly1305
golang.org/x/crypto/salsa20/salsa
# golang.org/x/net v0.0.0-20210505214959-0714010a04ed
# golang.org/x/net v0.0.0-20210525063256-abc453219eb5
## explicit
golang.org/x/net/bpf
golang.org/x/net/http/httpguts
@ -97,7 +97,7 @@ golang.org/x/net/internal/socks
golang.org/x/net/ipv4
golang.org/x/net/ipv6
golang.org/x/net/proxy
# golang.org/x/sys v0.0.0-20210507161434-a76c4d0a0096
# golang.org/x/sys v0.0.0-20210603125802-9665404d3644
## explicit
golang.org/x/sys/cpu
golang.org/x/sys/internal/unsafeheader