text
stringlengths 2
99k
| meta
dict |
---|---|
### Solution for "Download of Code Without Integrity Check" challenge
This challenge showcases a situation common to software deployments where an update server is being used but integrity checks are no in place in order to validate the software has not been tampered with.
Only thing required to do in order to pass is changing the update server to `evil.bad`. | {
"pile_set_name": "Github"
} |
/*
Copyright (C) 2014-2016 Leosac
This file is part of Leosac.
Leosac is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Leosac is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "modules/smtp/SMTPServerInfoSerializer.hpp"
#include "modules/smtp/SMTPConfig.hpp"
#include "tools/JSONUtils.hpp"
using namespace Leosac;
using namespace Leosac::Module;
using namespace Leosac::Module::SMTP;
json SMTPServerInfoJSONSerializer::serialize(const SMTPServerInfo &in,
const SecurityContext &)
{
json server_desc;
server_desc["url"] = in.url;
server_desc["from"] = in.from;
server_desc["username"] = in.username;
server_desc["password"] = in.password;
server_desc["timeout"] = in.ms_timeout;
server_desc["verify_host"] = in.verify_host;
server_desc["verify_peer"] = in.verify_peer;
server_desc["enabled"] = in.enabled;
return server_desc;
}
void SMTPServerInfoJSONSerializer::unserialize(SMTPServerInfo &out, const json &in,
const SecurityContext &)
{
using namespace JSONUtil;
out.url = extract_with_default(in, "url", out.url);
out.from = extract_with_default(in, "from", out.from);
out.username = extract_with_default(in, "username", out.username);
out.password = extract_with_default(in, "password", out.password);
out.ms_timeout = extract_with_default(in, "timeout", out.ms_timeout);
out.verify_peer = extract_with_default(in, "verify_peer", out.verify_peer);
out.verify_host = extract_with_default(in, "verify_host", out.verify_host);
out.enabled = extract_with_default(in, "enabled", out.enabled);
}
std::string SMTPServerInfoJSONStringSerializer::serialize(const SMTPServerInfo &in,
const SecurityContext &sc)
{
return SMTPServerInfoJSONSerializer::serialize(in, sc).dump(4);
}
void SMTPServerInfoJSONStringSerializer::unserialize(SMTPServerInfo &out,
const std::string &in,
const SecurityContext &sc)
{
return SMTPServerInfoJSONSerializer::unserialize(out, json::parse(in), sc);
}
| {
"pile_set_name": "Github"
} |
<at-dialog title="vm.title" on-close="vm.onClose">
<at-form state="vm.form" autocomplete="off" id="external_test_form">
<at-input-group col="12" tab="20" state="vm.form.inputs" form-id="external_test"></at-input-group>
<at-action-group col="12" pos="right">
<at-action-button
variant="tertiary"
ng-click="vm.onClose()"
>
{{::vm.strings.get('CLOSE')}}
</at-action-button>
<at-action-button
variant="primary"
ng-click="vm.onSubmit()"
ng-disabled="!vm.form.isValid || vm.form.disabled"
>
{{::vm.strings.get('RUN')}}
</at-action-button>
</at-action-group>
</at-form>
</at-dialog>
| {
"pile_set_name": "Github"
} |
<bx_include_base:../modules/base/profile/template/cover.html />
| {
"pile_set_name": "Github"
} |
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: github.com/golang/protobuf/ptypes/any/any.proto
package any
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
anypb "google.golang.org/protobuf/types/known/anypb"
reflect "reflect"
)
// Symbols defined in public import of google/protobuf/any.proto.
type Any = anypb.Any
var File_github_com_golang_protobuf_ptypes_any_any_proto protoreflect.FileDescriptor
var file_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc = []byte{
0x0a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c,
0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79,
0x70, 0x65, 0x73, 0x2f, 0x61, 0x6e, 0x79, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x2b, 0x5a, 0x29,
0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e,
0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65,
0x73, 0x2f, 0x61, 0x6e, 0x79, 0x3b, 0x61, 0x6e, 0x79, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
}
var file_github_com_golang_protobuf_ptypes_any_any_proto_goTypes = []interface{}{}
var file_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_github_com_golang_protobuf_ptypes_any_any_proto_init() }
func file_github_com_golang_protobuf_ptypes_any_any_proto_init() {
if File_github_com_golang_protobuf_ptypes_any_any_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc,
NumEnums: 0,
NumMessages: 0,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_github_com_golang_protobuf_ptypes_any_any_proto_goTypes,
DependencyIndexes: file_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs,
}.Build()
File_github_com_golang_protobuf_ptypes_any_any_proto = out.File
file_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc = nil
file_github_com_golang_protobuf_ptypes_any_any_proto_goTypes = nil
file_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs = nil
}
| {
"pile_set_name": "Github"
} |
<html><head>
<title>struct::skiplist - Tcl Data Structures</title>
<style type="text/css"><!--
HTML {
background: #FFFFFF;
color: black;
}
BODY {
background: #FFFFFF;
color: black;
}
DIV.doctools {
margin-left: 10%;
margin-right: 10%;
}
DIV.doctools H1,DIV.doctools H2 {
margin-left: -5%;
}
H1, H2, H3, H4 {
margin-top: 1em;
font-family: sans-serif;
font-size: large;
color: #005A9C;
background: transparent;
text-align: left;
}
H1.doctools_title {
text-align: center;
}
UL,OL {
margin-right: 0em;
margin-top: 3pt;
margin-bottom: 3pt;
}
UL LI {
list-style: disc;
}
OL LI {
list-style: decimal;
}
DT {
padding-top: 1ex;
}
UL.doctools_toc,UL.doctools_toc UL, UL.doctools_toc UL UL {
font: normal 12pt/14pt sans-serif;
list-style: none;
}
LI.doctools_section, LI.doctools_subsection {
list-style: none;
margin-left: 0em;
text-indent: 0em;
padding: 0em;
}
PRE {
display: block;
font-family: monospace;
white-space: pre;
margin: 0%;
padding-top: 0.5ex;
padding-bottom: 0.5ex;
padding-left: 1ex;
padding-right: 1ex;
width: 100%;
}
PRE.doctools_example {
color: black;
background: #f5dcb3;
border: 1px solid black;
}
UL.doctools_requirements LI, UL.doctools_syntax LI {
list-style: none;
margin-left: 0em;
text-indent: 0em;
padding: 0em;
}
DIV.doctools_synopsis {
color: black;
background: #80ffff;
border: 1px solid black;
font-family: serif;
margin-top: 1em;
margin-bottom: 1em;
}
UL.doctools_syntax {
margin-top: 1em;
border-top: 1px solid black;
}
UL.doctools_requirements {
margin-bottom: 1em;
border-bottom: 1px solid black;
}
--></style>
</head>
<! -- Generated from file 'skiplist.man' by tcllib/doctools with format 'html'
-->
<! -- Copyright © 2000 Keith Vetter
-->
<! -- struct::skiplist.n
-->
<body><hr> [
<a href="../../../../../../../../home">Tcllib Home</a>
| <a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="../../../../toc0.html">Categories</a>
| <a href="../../../../toc1.html">Modules</a>
| <a href="../../../../toc2.html">Applications</a>
] <hr>
<div class="doctools">
<h1 class="doctools_title">struct::skiplist(n) 1.3 tcllib "Tcl Data Structures"</h1>
<div id="name" class="doctools_section"><h2><a name="name">Name</a></h2>
<p>struct::skiplist - Create and manipulate skiplists</p>
</div>
<div id="toc" class="doctools_section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="doctools_toc">
<li class="doctools_section"><a href="#toc">Table Of Contents</a></li>
<li class="doctools_section"><a href="#synopsis">Synopsis</a></li>
<li class="doctools_section"><a href="#section1">Description</a></li>
<li class="doctools_section"><a href="#section2">Bugs, Ideas, Feedback</a></li>
<li class="doctools_section"><a href="#keywords">Keywords</a></li>
<li class="doctools_section"><a href="#category">Category</a></li>
<li class="doctools_section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="doctools_section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="doctools_synopsis">
<ul class="doctools_requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">struct::skiplist <span class="opt">?1.3?</span></b></li>
</ul>
<ul class="doctools_syntax">
<li><a href="#1"><b class="cmd">skiplistName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#2"><i class="arg">skiplistName</i> <b class="method">delete</b> <i class="arg">node</i> <span class="opt">?<i class="arg">node</i>...?</span></a></li>
<li><a href="#3"><i class="arg">skiplistName</i> <b class="method">destroy</b></a></li>
<li><a href="#4"><i class="arg">skiplistName</i> <b class="method">insert</b> <i class="arg">key value</i></a></li>
<li><a href="#5"><i class="arg">skiplistName</i> <b class="method">search</b> <i class="arg">node</i> <span class="opt">?<b class="const">-key</b> <i class="arg">key</i>?</span></a></li>
<li><a href="#6"><i class="arg">skiplistName</i> <b class="method">size</b></a></li>
<li><a href="#7"><i class="arg">skiplistName</i> <b class="method">walk</b> <i class="arg">cmd</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="doctools_section"><h2><a name="section1">Description</a></h2>
<p>The <b class="cmd">::struct::skiplist</b> command creates a new skiplist object
with an associated global Tcl command whose name is
<i class="arg">skiplistName</i>. This command may be used to invoke various
operations on the skiplist. It has the following general form:</p>
<dl class="doctools_definitions">
<dt><a name="1"><b class="cmd">skiplistName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p><i class="arg">Option</i> and the <i class="arg">arg</i>s determine the exact behavior of the
command.</p></dd>
</dl>
<p>Skip lists are an alternative data structure to binary trees. They can
be used to maintain ordered lists over any sequence of insertions and
deletions. Skip lists use randomness to achieve probabilistic
balancing, and as a result the algorithms for insertion and deletion
in skip lists are much simpler and faster than those for binary trees.</p>
<p>To read more about skip lists see Pugh, William.
<em>Skip lists: a probabilistic alternative to balanced trees</em>
In: Communications of the ACM, June 1990, 33(6) 668-676.</p>
<p>Currently, the key can be either a number or a string, and comparisons
are performed with the built in greater than operator.
The following commands are possible for skiplist objects:</p>
<dl class="doctools_definitions">
<dt><a name="2"><i class="arg">skiplistName</i> <b class="method">delete</b> <i class="arg">node</i> <span class="opt">?<i class="arg">node</i>...?</span></a></dt>
<dd><p>Remove the specified nodes from the skiplist.</p></dd>
<dt><a name="3"><i class="arg">skiplistName</i> <b class="method">destroy</b></a></dt>
<dd><p>Destroy the skiplist, including its storage space and associated command.</p></dd>
<dt><a name="4"><i class="arg">skiplistName</i> <b class="method">insert</b> <i class="arg">key value</i></a></dt>
<dd><p>Insert a node with the given <i class="arg">key</i> and <i class="arg">value</i> into the
skiplist. If a node with that key already exists, then the that node's
value is updated and its node level is returned. Otherwise a new node
is created and 0 is returned.</p></dd>
<dt><a name="5"><i class="arg">skiplistName</i> <b class="method">search</b> <i class="arg">node</i> <span class="opt">?<b class="const">-key</b> <i class="arg">key</i>?</span></a></dt>
<dd><p>Search for a given key in a skiplist. If not found then 0 is returned.
If found, then a two element list of 1 followed by the node's value is retuned.</p></dd>
<dt><a name="6"><i class="arg">skiplistName</i> <b class="method">size</b></a></dt>
<dd><p>Return a count of the number of nodes in the skiplist.</p></dd>
<dt><a name="7"><i class="arg">skiplistName</i> <b class="method">walk</b> <i class="arg">cmd</i></a></dt>
<dd><p>Walk the skiplist from the first node to the last. At each node, the
command <i class="arg">cmd</i> will be evaluated with the key and value of the
current node appended.</p></dd>
</dl>
</div>
<div id="section2" class="doctools_section"><h2><a name="section2">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>struct :: skiplist</em> of the
<a href="http://core.tcl.tk/tcllib/reportlist">Tcllib Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="doctools_section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key306">skiplist</a></p>
</div>
<div id="category" class="doctools_section"><h2><a name="category">Category</a></h2>
<p>Data structures</p>
</div>
<div id="copyright" class="doctools_section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright © 2000 Keith Vetter</p>
</div>
</div></body></html>
| {
"pile_set_name": "Github"
} |
THE_URL:file://localhost/Users/hubery/Public/ucar/Document/Functions/Contributed/zonalAve.shtml
THE_TITLE:zonalAve
NCL Home > Documentation > Functions > General applied math
zonalAve
Computes a zonal average of the input array.
Prototype
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
function zonalAve (
x : numeric
)
return_val : typeof(x)
Arguments
x
An array of any size and type.
Return value
The results are returned in an array of the same type and one dimension smaller than x. Metadata are preserved.
Description
This function computes a zonal average of the input array x. If the input array has a "long_name" or "short_name"
attribute, it will be updated.
©2015 UCAR | Privacy Policy | Terms of Use | Contact the Webmaster | Sponsored by NSF
| {
"pile_set_name": "Github"
} |
{{/*
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- $serviceName := print .Release.Name "-controller" -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ $serviceName }}
labels:
app.kubernetes.io/component: controller
{{ include "labels" . | indent 4 }}
spec:
replicas: {{ .Values.controller.replicas }}
selector:
matchLabels:
app.kubernetes.io/component: controller
{{ include "selector-labels" . | indent 6 }}
template:
metadata:
labels:
app.kubernetes.io/component: controller
{{ include "selector-labels" . | indent 8 }}
annotations:
{{- with .Values.controller.podAnnotations }}
{{ toYaml . | indent 8 }}
{{- end }}
spec:
{{- with .Values.controller.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.controller.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.controller.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{ toYaml . | trimSuffix "\n" | indent 8 }}
{{- end }}
volumes:
- name: certs
secret:
secretName: {{ required "secret.certs must be provided" .Values.secret.certs }}
- name: envdir
secret:
secretName: {{ required "secret.envdir must be provided" .Values.secret.envdir }}
{{- if .Values.secret.configs }}
{{- range $module, $secretName := .Values.secret.configs }}
- name: {{ $secretName }}-{{ $module }}
secret:
secretName: {{ $secretName }}
{{- end }}
{{- else }}
- name: "empty-configs"
emptyDir: {}
{{- end }}
containers:
- name: {{ $serviceName }}
image: {{ required "controller.image.repository must be provided" .Values.controller.image.repository }}:{{ .Values.controller.image.tag }}
imagePullPolicy: {{ .Values.controller.image.pullPolicy }}
volumeMounts:
{{- range tuple "certs" "envdir" }}
- name: {{ . }}
mountPath: /var/opt/magma/{{ . }}
readOnly: true
{{- end }}
{{- if .Values.secret.configs }}
{{- range $module, $secretName := .Values.secret.configs }}
- name: {{ $secretName }}-{{ $module }}
mountPath: {{ print "/var/opt/magma/configs/" $module }}
readOnly: true
{{- end }}
{{- else }}
- name: "empty-configs"
mountPath: /var/opt/magma/configs
readOnly: true
{{- end }}
ports:
{{- with .Values.controller.service }}
- containerPort: {{ .targetPort }}
{{- range $_, $port := untilStep (.portStart | int) (.portEnd | add1 | int) 1 }}
- containerPort: {{ $port }}
{{- end }}
{{- end }}
env:
- name: DATABASE_SOURCE
valueFrom:
secretKeyRef:
name: {{ $serviceName }}
key: {{ .Values.controller.spec.database.driver }}.connstr
- name: SQL_DRIVER
value: {{ .Values.controller.spec.database.driver }}
- name: SQL_DIALECT
value: {{ .Values.controller.spec.database.sql_dialect }}
# Hostname override for dispatcher
- name: SERVICE_HOST_NAME
valueFrom:
fieldRef:
fieldPath: status.podIP
# Hostname override for metricsd
- name: HOST_NAME
valueFrom:
fieldRef:
fieldPath: status.podIP
livenessProbe:
tcpSocket:
port: 9081
initialDelaySeconds: 10
periodSeconds: 30
readinessProbe:
tcpSocket:
port: 9081
initialDelaySeconds: 5
periodSeconds: 10
resources:
{{ toYaml .Values.controller.resources | indent 12 }}
| {
"pile_set_name": "Github"
} |
liTest run started
liTest scala.scalanative.junit.MethodNameDecodeTest.abcd$u0020$u2206ƒ$u0020$uD83D$uDE00$u0020$times$u0020$hash$amp$ started
ldTest scala.scalanative.junit.MethodNameDecodeTest.abcd$u0020$u2206ƒ$u0020$uD83D$uDE00$u0020$times$u0020$hash$amp$ finished, took <TIME>
e01abcd$u0020$u2206ƒ$u0020$uD83D$uDE00$u0020$times$u0020$hash$amp$
liTest run finished: 0 failed, 0 ignored, 1 total, <TIME>
d
| {
"pile_set_name": "Github"
} |
// Copyright 2013 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 spdy
// headerDictionary is the dictionary sent to the zlib compressor/decompressor.
var headerDictionary = []byte{
0x00, 0x00, 0x00, 0x07, 0x6f, 0x70, 0x74, 0x69,
0x6f, 0x6e, 0x73, 0x00, 0x00, 0x00, 0x04, 0x68,
0x65, 0x61, 0x64, 0x00, 0x00, 0x00, 0x04, 0x70,
0x6f, 0x73, 0x74, 0x00, 0x00, 0x00, 0x03, 0x70,
0x75, 0x74, 0x00, 0x00, 0x00, 0x06, 0x64, 0x65,
0x6c, 0x65, 0x74, 0x65, 0x00, 0x00, 0x00, 0x05,
0x74, 0x72, 0x61, 0x63, 0x65, 0x00, 0x00, 0x00,
0x06, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x00,
0x00, 0x00, 0x0e, 0x61, 0x63, 0x63, 0x65, 0x70,
0x74, 0x2d, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65,
0x74, 0x00, 0x00, 0x00, 0x0f, 0x61, 0x63, 0x63,
0x65, 0x70, 0x74, 0x2d, 0x65, 0x6e, 0x63, 0x6f,
0x64, 0x69, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x0f,
0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x2d, 0x6c,
0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x00,
0x00, 0x00, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x70,
0x74, 0x2d, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73,
0x00, 0x00, 0x00, 0x03, 0x61, 0x67, 0x65, 0x00,
0x00, 0x00, 0x05, 0x61, 0x6c, 0x6c, 0x6f, 0x77,
0x00, 0x00, 0x00, 0x0d, 0x61, 0x75, 0x74, 0x68,
0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x00, 0x00, 0x00, 0x0d, 0x63, 0x61, 0x63,
0x68, 0x65, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72,
0x6f, 0x6c, 0x00, 0x00, 0x00, 0x0a, 0x63, 0x6f,
0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x00, 0x00, 0x00, 0x0c, 0x63, 0x6f, 0x6e, 0x74,
0x65, 0x6e, 0x74, 0x2d, 0x62, 0x61, 0x73, 0x65,
0x00, 0x00, 0x00, 0x10, 0x63, 0x6f, 0x6e, 0x74,
0x65, 0x6e, 0x74, 0x2d, 0x65, 0x6e, 0x63, 0x6f,
0x64, 0x69, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x10,
0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d,
0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65,
0x00, 0x00, 0x00, 0x0e, 0x63, 0x6f, 0x6e, 0x74,
0x65, 0x6e, 0x74, 0x2d, 0x6c, 0x65, 0x6e, 0x67,
0x74, 0x68, 0x00, 0x00, 0x00, 0x10, 0x63, 0x6f,
0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x6c, 0x6f,
0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00,
0x00, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e,
0x74, 0x2d, 0x6d, 0x64, 0x35, 0x00, 0x00, 0x00,
0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74,
0x2d, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x00, 0x00,
0x00, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e,
0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x00, 0x00,
0x00, 0x04, 0x64, 0x61, 0x74, 0x65, 0x00, 0x00,
0x00, 0x04, 0x65, 0x74, 0x61, 0x67, 0x00, 0x00,
0x00, 0x06, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74,
0x00, 0x00, 0x00, 0x07, 0x65, 0x78, 0x70, 0x69,
0x72, 0x65, 0x73, 0x00, 0x00, 0x00, 0x04, 0x66,
0x72, 0x6f, 0x6d, 0x00, 0x00, 0x00, 0x04, 0x68,
0x6f, 0x73, 0x74, 0x00, 0x00, 0x00, 0x08, 0x69,
0x66, 0x2d, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x00,
0x00, 0x00, 0x11, 0x69, 0x66, 0x2d, 0x6d, 0x6f,
0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x2d, 0x73,
0x69, 0x6e, 0x63, 0x65, 0x00, 0x00, 0x00, 0x0d,
0x69, 0x66, 0x2d, 0x6e, 0x6f, 0x6e, 0x65, 0x2d,
0x6d, 0x61, 0x74, 0x63, 0x68, 0x00, 0x00, 0x00,
0x08, 0x69, 0x66, 0x2d, 0x72, 0x61, 0x6e, 0x67,
0x65, 0x00, 0x00, 0x00, 0x13, 0x69, 0x66, 0x2d,
0x75, 0x6e, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69,
0x65, 0x64, 0x2d, 0x73, 0x69, 0x6e, 0x63, 0x65,
0x00, 0x00, 0x00, 0x0d, 0x6c, 0x61, 0x73, 0x74,
0x2d, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65,
0x64, 0x00, 0x00, 0x00, 0x08, 0x6c, 0x6f, 0x63,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00,
0x0c, 0x6d, 0x61, 0x78, 0x2d, 0x66, 0x6f, 0x72,
0x77, 0x61, 0x72, 0x64, 0x73, 0x00, 0x00, 0x00,
0x06, 0x70, 0x72, 0x61, 0x67, 0x6d, 0x61, 0x00,
0x00, 0x00, 0x12, 0x70, 0x72, 0x6f, 0x78, 0x79,
0x2d, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74,
0x69, 0x63, 0x61, 0x74, 0x65, 0x00, 0x00, 0x00,
0x13, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2d, 0x61,
0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05,
0x72, 0x61, 0x6e, 0x67, 0x65, 0x00, 0x00, 0x00,
0x07, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x72,
0x00, 0x00, 0x00, 0x0b, 0x72, 0x65, 0x74, 0x72,
0x79, 0x2d, 0x61, 0x66, 0x74, 0x65, 0x72, 0x00,
0x00, 0x00, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65,
0x72, 0x00, 0x00, 0x00, 0x02, 0x74, 0x65, 0x00,
0x00, 0x00, 0x07, 0x74, 0x72, 0x61, 0x69, 0x6c,
0x65, 0x72, 0x00, 0x00, 0x00, 0x11, 0x74, 0x72,
0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x2d, 0x65,
0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x00,
0x00, 0x00, 0x07, 0x75, 0x70, 0x67, 0x72, 0x61,
0x64, 0x65, 0x00, 0x00, 0x00, 0x0a, 0x75, 0x73,
0x65, 0x72, 0x2d, 0x61, 0x67, 0x65, 0x6e, 0x74,
0x00, 0x00, 0x00, 0x04, 0x76, 0x61, 0x72, 0x79,
0x00, 0x00, 0x00, 0x03, 0x76, 0x69, 0x61, 0x00,
0x00, 0x00, 0x07, 0x77, 0x61, 0x72, 0x6e, 0x69,
0x6e, 0x67, 0x00, 0x00, 0x00, 0x10, 0x77, 0x77,
0x77, 0x2d, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e,
0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x00, 0x00,
0x00, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64,
0x00, 0x00, 0x00, 0x03, 0x67, 0x65, 0x74, 0x00,
0x00, 0x00, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75,
0x73, 0x00, 0x00, 0x00, 0x06, 0x32, 0x30, 0x30,
0x20, 0x4f, 0x4b, 0x00, 0x00, 0x00, 0x07, 0x76,
0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x00, 0x00,
0x00, 0x08, 0x48, 0x54, 0x54, 0x50, 0x2f, 0x31,
0x2e, 0x31, 0x00, 0x00, 0x00, 0x03, 0x75, 0x72,
0x6c, 0x00, 0x00, 0x00, 0x06, 0x70, 0x75, 0x62,
0x6c, 0x69, 0x63, 0x00, 0x00, 0x00, 0x0a, 0x73,
0x65, 0x74, 0x2d, 0x63, 0x6f, 0x6f, 0x6b, 0x69,
0x65, 0x00, 0x00, 0x00, 0x0a, 0x6b, 0x65, 0x65,
0x70, 0x2d, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x00,
0x00, 0x00, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69,
0x6e, 0x31, 0x30, 0x30, 0x31, 0x30, 0x31, 0x32,
0x30, 0x31, 0x32, 0x30, 0x32, 0x32, 0x30, 0x35,
0x32, 0x30, 0x36, 0x33, 0x30, 0x30, 0x33, 0x30,
0x32, 0x33, 0x30, 0x33, 0x33, 0x30, 0x34, 0x33,
0x30, 0x35, 0x33, 0x30, 0x36, 0x33, 0x30, 0x37,
0x34, 0x30, 0x32, 0x34, 0x30, 0x35, 0x34, 0x30,
0x36, 0x34, 0x30, 0x37, 0x34, 0x30, 0x38, 0x34,
0x30, 0x39, 0x34, 0x31, 0x30, 0x34, 0x31, 0x31,
0x34, 0x31, 0x32, 0x34, 0x31, 0x33, 0x34, 0x31,
0x34, 0x34, 0x31, 0x35, 0x34, 0x31, 0x36, 0x34,
0x31, 0x37, 0x35, 0x30, 0x32, 0x35, 0x30, 0x34,
0x35, 0x30, 0x35, 0x32, 0x30, 0x33, 0x20, 0x4e,
0x6f, 0x6e, 0x2d, 0x41, 0x75, 0x74, 0x68, 0x6f,
0x72, 0x69, 0x74, 0x61, 0x74, 0x69, 0x76, 0x65,
0x20, 0x49, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x32, 0x30, 0x34, 0x20,
0x4e, 0x6f, 0x20, 0x43, 0x6f, 0x6e, 0x74, 0x65,
0x6e, 0x74, 0x33, 0x30, 0x31, 0x20, 0x4d, 0x6f,
0x76, 0x65, 0x64, 0x20, 0x50, 0x65, 0x72, 0x6d,
0x61, 0x6e, 0x65, 0x6e, 0x74, 0x6c, 0x79, 0x34,
0x30, 0x30, 0x20, 0x42, 0x61, 0x64, 0x20, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x34, 0x30,
0x31, 0x20, 0x55, 0x6e, 0x61, 0x75, 0x74, 0x68,
0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x34, 0x30,
0x33, 0x20, 0x46, 0x6f, 0x72, 0x62, 0x69, 0x64,
0x64, 0x65, 0x6e, 0x34, 0x30, 0x34, 0x20, 0x4e,
0x6f, 0x74, 0x20, 0x46, 0x6f, 0x75, 0x6e, 0x64,
0x35, 0x30, 0x30, 0x20, 0x49, 0x6e, 0x74, 0x65,
0x72, 0x6e, 0x61, 0x6c, 0x20, 0x53, 0x65, 0x72,
0x76, 0x65, 0x72, 0x20, 0x45, 0x72, 0x72, 0x6f,
0x72, 0x35, 0x30, 0x31, 0x20, 0x4e, 0x6f, 0x74,
0x20, 0x49, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65,
0x6e, 0x74, 0x65, 0x64, 0x35, 0x30, 0x33, 0x20,
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20,
0x55, 0x6e, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61,
0x62, 0x6c, 0x65, 0x4a, 0x61, 0x6e, 0x20, 0x46,
0x65, 0x62, 0x20, 0x4d, 0x61, 0x72, 0x20, 0x41,
0x70, 0x72, 0x20, 0x4d, 0x61, 0x79, 0x20, 0x4a,
0x75, 0x6e, 0x20, 0x4a, 0x75, 0x6c, 0x20, 0x41,
0x75, 0x67, 0x20, 0x53, 0x65, 0x70, 0x74, 0x20,
0x4f, 0x63, 0x74, 0x20, 0x4e, 0x6f, 0x76, 0x20,
0x44, 0x65, 0x63, 0x20, 0x30, 0x30, 0x3a, 0x30,
0x30, 0x3a, 0x30, 0x30, 0x20, 0x4d, 0x6f, 0x6e,
0x2c, 0x20, 0x54, 0x75, 0x65, 0x2c, 0x20, 0x57,
0x65, 0x64, 0x2c, 0x20, 0x54, 0x68, 0x75, 0x2c,
0x20, 0x46, 0x72, 0x69, 0x2c, 0x20, 0x53, 0x61,
0x74, 0x2c, 0x20, 0x53, 0x75, 0x6e, 0x2c, 0x20,
0x47, 0x4d, 0x54, 0x63, 0x68, 0x75, 0x6e, 0x6b,
0x65, 0x64, 0x2c, 0x74, 0x65, 0x78, 0x74, 0x2f,
0x68, 0x74, 0x6d, 0x6c, 0x2c, 0x69, 0x6d, 0x61,
0x67, 0x65, 0x2f, 0x70, 0x6e, 0x67, 0x2c, 0x69,
0x6d, 0x61, 0x67, 0x65, 0x2f, 0x6a, 0x70, 0x67,
0x2c, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x67,
0x69, 0x66, 0x2c, 0x61, 0x70, 0x70, 0x6c, 0x69,
0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x78,
0x6d, 0x6c, 0x2c, 0x61, 0x70, 0x70, 0x6c, 0x69,
0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x78,
0x68, 0x74, 0x6d, 0x6c, 0x2b, 0x78, 0x6d, 0x6c,
0x2c, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x70, 0x6c,
0x61, 0x69, 0x6e, 0x2c, 0x74, 0x65, 0x78, 0x74,
0x2f, 0x6a, 0x61, 0x76, 0x61, 0x73, 0x63, 0x72,
0x69, 0x70, 0x74, 0x2c, 0x70, 0x75, 0x62, 0x6c,
0x69, 0x63, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74,
0x65, 0x6d, 0x61, 0x78, 0x2d, 0x61, 0x67, 0x65,
0x3d, 0x67, 0x7a, 0x69, 0x70, 0x2c, 0x64, 0x65,
0x66, 0x6c, 0x61, 0x74, 0x65, 0x2c, 0x73, 0x64,
0x63, 0x68, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65,
0x74, 0x3d, 0x75, 0x74, 0x66, 0x2d, 0x38, 0x63,
0x68, 0x61, 0x72, 0x73, 0x65, 0x74, 0x3d, 0x69,
0x73, 0x6f, 0x2d, 0x38, 0x38, 0x35, 0x39, 0x2d,
0x31, 0x2c, 0x75, 0x74, 0x66, 0x2d, 0x2c, 0x2a,
0x2c, 0x65, 0x6e, 0x71, 0x3d, 0x30, 0x2e,
}
| {
"pile_set_name": "Github"
} |
{
"_from": "isstream@~0.1.2",
"_id": "isstream@0.1.2",
"_inBundle": false,
"_integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=",
"_location": "/isstream",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "isstream@~0.1.2",
"name": "isstream",
"escapedName": "isstream",
"rawSpec": "~0.1.2",
"saveSpec": null,
"fetchSpec": "~0.1.2"
},
"_requiredBy": [
"/request"
],
"_resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
"_shasum": "47e63f7af55afa6f92e1500e690eb8b8529c099a",
"_spec": "isstream@~0.1.2",
"_where": "/Users/rhwood/Developer/JMRI/JMRI/rhwood/JMRI/web/app/node_modules/request",
"author": {
"name": "Rod Vagg",
"email": "rod@vagg.org"
},
"bugs": {
"url": "https://github.com/rvagg/isstream/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Determine if an object is a Stream",
"devDependencies": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.1",
"isarray": "0.0.1",
"string_decoder": "~0.10.x",
"tape": "~2.12.3"
},
"homepage": "https://github.com/rvagg/isstream",
"keywords": [
"stream",
"type",
"streams",
"readable-stream",
"hippo"
],
"license": "MIT",
"main": "isstream.js",
"name": "isstream",
"repository": {
"type": "git",
"url": "git+https://github.com/rvagg/isstream.git"
},
"scripts": {
"test": "tar --xform 's/^package/readable-stream-1.0/' -zxf readable-stream-1.0.*.tgz && tar --xform 's/^package/readable-stream-1.1/' -zxf readable-stream-1.1.*.tgz && node test.js; rm -rf readable-stream-1.?/"
},
"version": "0.1.2"
}
| {
"pile_set_name": "Github"
} |
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
*/
#include "../../headers/tomcrypt.h"
/**
@file der_decode_integer.c
ASN.1 DER, decode an integer, Tom St Denis
*/
#ifdef LTC_DER
/**
Read a mp_int integer
@param in The DER encoded data
@param inlen Size of DER encoded data
@param num The first mp_int to decode
@return CRYPT_OK if successful
*/
int der_decode_integer(const unsigned char *in, unsigned long inlen, void *num)
{
unsigned long x, y, z;
int err;
LTC_ARGCHK(num != NULL);
LTC_ARGCHK(in != NULL);
/* min DER INTEGER is 0x02 01 00 == 0 */
if (inlen < (1 + 1 + 1)) {
return CRYPT_INVALID_PACKET;
}
/* ok expect 0x02 when we AND with 0001 1111 [1F] */
x = 0;
if ((in[x++] & 0x1F) != 0x02) {
return CRYPT_INVALID_PACKET;
}
/* now decode the len stuff */
z = in[x++];
if ((z & 0x80) == 0x00) {
/* short form */
/* will it overflow? */
if (x + z > inlen) {
return CRYPT_INVALID_PACKET;
}
/* no so read it */
if ((err = mp_read_unsigned_bin(num, (unsigned char *)in + x, z)) != CRYPT_OK) {
return err;
}
} else {
/* long form */
z &= 0x7F;
/* will number of length bytes overflow? (or > 4) */
if (((x + z) > inlen) || (z > 4) || (z == 0)) {
return CRYPT_INVALID_PACKET;
}
/* now read it in */
y = 0;
while (z--) {
y = ((unsigned long)(in[x++])) | (y << 8);
}
/* now will reading y bytes overrun? */
if ((x + y) > inlen) {
return CRYPT_INVALID_PACKET;
}
/* no so read it */
if ((err = mp_read_unsigned_bin(num, (unsigned char *)in + x, y)) != CRYPT_OK) {
return err;
}
}
/* see if it's negative */
if (in[x] & 0x80) {
void *tmp;
if (mp_init(&tmp) != CRYPT_OK) {
return CRYPT_MEM;
}
if (mp_2expt(tmp, mp_count_bits(num)) != CRYPT_OK || mp_sub(num, tmp, num) != CRYPT_OK) {
mp_clear(tmp);
return CRYPT_MEM;
}
mp_clear(tmp);
}
return CRYPT_OK;
}
#endif
/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/integer/der_decode_integer.c,v $ */
/* $Revision: 1.5 $ */
/* $Date: 2006/12/28 01:27:24 $ */ | {
"pile_set_name": "Github"
} |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/request'
| {
"pile_set_name": "Github"
} |
/**
* Created by martin on 19.02.2017.
*/
import * as path from 'path';
let pkg = null;
try {
pkg = require(path.resolve(__dirname, '..', 'package.json'));
} catch (e) {
try {
pkg = require(path.resolve(__dirname, '..', '..', 'package.json'));
} catch (e) {
pkg = null;
}
}
export const VERSION = (pkg ? pkg.version : 'unknown');
| {
"pile_set_name": "Github"
} |
'use strict';
var Promise = require('sporks/scripts/promise'),
sporks = require('sporks');
var Config = function (slouch) {
this._slouch = slouch;
};
Config.prototype._couchDB2Request = function (node, path, opts, parseBody) {
opts.uri = this._slouch._url + '/_node/' + node + '/_config/' + path;
opts.parseBody = parseBody;
return this._slouch._req(opts);
};
// Warning: as per https://github.com/klaemo/docker-couchdb/issues/42#issuecomment-169610897, this
// isn't really the best approach as a more complete solution would implement some rollback
// mechanism when a node fails after several attempts. (Retries are already attempted by the
// request).
Config.prototype._couchDB2Requests = function (path, opts, parseBody, maxNumNodes) {
var self = this,
promises = [],
i = 0;
return self._slouch.membership.get().then(function (members) {
members.cluster_nodes.forEach(function (node) {
if (typeof maxNumNodes === 'undefined' || i++ < maxNumNodes) {
// Clone the opts as we need a separate copy per node
var clonedOpts = sporks.clone(opts);
promises.push(self._couchDB2Request(node, path, clonedOpts, parseBody));
}
});
// Only return a single promise when there is a single promise so that the return value
// is consistent for a single node.
return promises.length > 1 ? Promise.all(promises) : promises[0];
});
};
Config.prototype._couchDB1Request = function (path, opts, parseBody) {
opts.uri = this._slouch._url + '/_config/' + path;
opts.parseBody = parseBody;
return this._slouch._req(opts);
};
Config.prototype._request = function (path, opts, parseBody, maxNumNodes) {
var self = this;
return self._slouch.system.isCouchDB1().then(function (isCouchDB1) {
if (isCouchDB1) {
return self._couchDB1Request(path, opts, parseBody);
} else {
return self._couchDB2Requests(path, opts, parseBody, maxNumNodes);
}
});
};
Config.prototype.get = function (path) {
return this._request(path, {
method: 'GET'
}, true);
};
Config.prototype.set = function (path, value) {
return this._request(path, {
method: 'PUT',
body: JSON.stringify(this._toString(value))
});
};
Config.prototype.unset = function (path) {
return this._request(path, {
method: 'DELETE'
});
};
Config.prototype.unsetIgnoreMissing = function (path) {
var self = this;
return self._slouch.doc.ignoreMissing(function () {
return self.unset(path);
});
};
Config.prototype.setCouchHttpdAuthTimeout = function (timeoutSecs) {
// Convert timeout value to a string
return this.set('couch_httpd_auth/timeout', timeoutSecs + '');
};
Config.prototype._toString = function (value) {
if (typeof value === 'boolean') {
return value ? 'true' : 'false';
} else if (typeof value === 'string') {
return value;
} else {
return value + ''; // convert to string
}
};
Config.prototype.setCouchHttpdAuthAllowPersistentCookies = function (allow) {
return this.set('couch_httpd_auth/allow_persistent_cookies', allow);
};
Config.prototype.setLogLevel = function (level) {
return this.set('log/level', level);
};
Config.prototype.setCompactionRule = function (dbName, rule) {
return this.set('compactions/' + encodeURIComponent(dbName), rule);
};
Config.prototype.setCouchDBMaxDBsOpen = function (maxDBsOpen) {
return this.set('couchdb/max_dbs_open', maxDBsOpen);
};
Config.prototype.setHttpdMaxConnections = function (maxConnections) {
return this.set('httpd/max_connections', maxConnections);
};
module.exports = Config;
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xyoye.player.danmaku.danmaku.model.objectpool;
public interface PoolableManager<T extends Poolable<T>> {
T newInstance();
void onAcquired(T element);
void onReleased(T element);
}
| {
"pile_set_name": "Github"
} |
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Framework\DB\Sql;
/**
* Class LimitExpression
*/
class LimitExpression extends Expression
{
/**
* @var string
*/
protected $sql;
/**
* @var int
*/
protected $count;
/**
* @var int
*/
protected $offset;
/**
* @param string $sql
* @param int $count
* @param int $offset
*/
public function __construct(
$sql,
$count,
$offset = 0
) {
$this->sql = $sql;
$this->count = $count;
$this->offset = $offset;
}
/**
* @inheritdoc
*/
public function __toString()
{
$sql = $this->sql;
$count = (int)$this->count;
if ($count <= 0) {
/** @see Zend_Db_Adapter_Exception */
#require_once 'Zend/Db/Adapter/Exception.php';
throw new \Zend_Db_Adapter_Exception("LIMIT argument count=$count is not valid");
}
$offset = (int)$this->offset;
if ($offset < 0) {
/** @see Zend_Db_Adapter_Exception */
#require_once 'Zend/Db/Adapter/Exception.php';
throw new \Zend_Db_Adapter_Exception("LIMIT argument offset=$offset is not valid");
}
$sql .= " LIMIT $count";
if ($offset > 0) {
$sql .= " OFFSET $offset";
}
return trim($sql);
}
}
| {
"pile_set_name": "Github"
} |
Ethereum入門
=============
[Ethereum入門](http://book.ethereum-jp.net)は、分散アプリケーションプラットフォーム「Ethereum(イーサリアム)」の技術入門書です。
Ethereumがどのように動作するのか、Ethereumを用いてどのように分散アプリケーションを開発していくか、について解説していきます。
Ethereumプロジェクトは最初の安定版(Homestead)リリースがされましたが、今後仕様が変更になる場合があります。仕様変更に伴い本書も逐次内容を変更していきます。
また本ドキュメントは**2018/3/10 現在、制作中です。**
本ドキュメントはオープンなプロジェクトであり、そのため協力者を広く求めています。本書のソースコードは[GitHub上](https://github.com/a-mitani/mastering-ethereum)で公開されています。
本書への追記や修正などありましたら、上記[GitHub](https://github.com/a-mitani/mastering-ethereum)にてIssueの発行、またはPull requestをお願いいたします。
本ドキュメントは <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a> のもとで公開されています。
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a><br />
| {
"pile_set_name": "Github"
} |
### 更新时间Updated
Updated可以让您在记录插入或每次记录更新时自动更新数据库中的标记字段为当前时间,需要在xorm标记中使用updated标记,如下所示进行标记,对应的字段可以为time.Time或者自定义的time.Time或者int,int64等int类型。
```Go
type User struct {
Id int64
Name string
UpdatedAt time.Time `xorm:"updated"`
}
```
在Insert(), InsertOne(), Update()方法被调用时,updated标记的字段将会被自动更新为当前时间,如下所示:
```Go
var user User
engine.Id(1).Get(&user)
// SELECT * FROM user WHERE id = ?
engine.Id(1).Update(&user)
// UPDATE user SET ..., updaetd_at = ? WHERE id = ?
```
如果你希望临时不自动插入时间,则可以组合NoAutoTime()方法:
```Go
engine.NoAutoTime().Insert(&user)
```
这个在从一张表拷贝字段到另一张表时比较有用。
| {
"pile_set_name": "Github"
} |
#ifndef __PMU_H
#define __PMU_H
#include <linux/bitops.h>
#include "../../../include/linux/perf_event.h"
enum {
PERF_PMU_FORMAT_VALUE_CONFIG,
PERF_PMU_FORMAT_VALUE_CONFIG1,
PERF_PMU_FORMAT_VALUE_CONFIG2,
};
#define PERF_PMU_FORMAT_BITS 64
struct perf_pmu__format {
char *name;
int value;
DECLARE_BITMAP(bits, PERF_PMU_FORMAT_BITS);
struct list_head list;
};
struct perf_pmu {
char *name;
__u32 type;
struct list_head format;
struct list_head list;
};
struct perf_pmu *perf_pmu__find(char *name);
int perf_pmu__config(struct perf_pmu *pmu, struct perf_event_attr *attr,
struct list_head *head_terms);
int perf_pmu_wrap(void);
void perf_pmu_error(struct list_head *list, char *name, char const *msg);
int perf_pmu__new_format(struct list_head *list, char *name,
int config, unsigned long *bits);
void perf_pmu__set_format(unsigned long *bits, long from, long to);
int perf_pmu__test(void);
#endif /* __PMU_H */
| {
"pile_set_name": "Github"
} |
#!/usr/bin/python
#
# Copyright 2018-2020 Polyaxon, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# coding: utf-8
"""
Polyaxon SDKs and REST API specification.
Polyaxon SDKs and REST API specification. # noqa: E501
The version of the OpenAPI document: 1.1.9-rc4
Contact: contact@polyaxon.com
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from polyaxon_sdk.configuration import Configuration
class V1Queue(object):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
"uuid": "str",
"agent": "str",
"name": "str",
"description": "str",
"tags": "list[str]",
"priority": "int",
"concurrency": "int",
"created_at": "datetime",
"updated_at": "datetime",
}
attribute_map = {
"uuid": "uuid",
"agent": "agent",
"name": "name",
"description": "description",
"tags": "tags",
"priority": "priority",
"concurrency": "concurrency",
"created_at": "created_at",
"updated_at": "updated_at",
}
def __init__(
self,
uuid=None,
agent=None,
name=None,
description=None,
tags=None,
priority=None,
concurrency=None,
created_at=None,
updated_at=None,
local_vars_configuration=None,
): # noqa: E501
"""V1Queue - a model defined in OpenAPI""" # noqa: E501
if local_vars_configuration is None:
local_vars_configuration = Configuration()
self.local_vars_configuration = local_vars_configuration
self._uuid = None
self._agent = None
self._name = None
self._description = None
self._tags = None
self._priority = None
self._concurrency = None
self._created_at = None
self._updated_at = None
self.discriminator = None
if uuid is not None:
self.uuid = uuid
if agent is not None:
self.agent = agent
if name is not None:
self.name = name
if description is not None:
self.description = description
if tags is not None:
self.tags = tags
if priority is not None:
self.priority = priority
if concurrency is not None:
self.concurrency = concurrency
if created_at is not None:
self.created_at = created_at
if updated_at is not None:
self.updated_at = updated_at
@property
def uuid(self):
"""Gets the uuid of this V1Queue. # noqa: E501
:return: The uuid of this V1Queue. # noqa: E501
:rtype: str
"""
return self._uuid
@uuid.setter
def uuid(self, uuid):
"""Sets the uuid of this V1Queue.
:param uuid: The uuid of this V1Queue. # noqa: E501
:type: str
"""
self._uuid = uuid
@property
def agent(self):
"""Gets the agent of this V1Queue. # noqa: E501
:return: The agent of this V1Queue. # noqa: E501
:rtype: str
"""
return self._agent
@agent.setter
def agent(self, agent):
"""Sets the agent of this V1Queue.
:param agent: The agent of this V1Queue. # noqa: E501
:type: str
"""
self._agent = agent
@property
def name(self):
"""Gets the name of this V1Queue. # noqa: E501
:return: The name of this V1Queue. # noqa: E501
:rtype: str
"""
return self._name
@name.setter
def name(self, name):
"""Sets the name of this V1Queue.
:param name: The name of this V1Queue. # noqa: E501
:type: str
"""
self._name = name
@property
def description(self):
"""Gets the description of this V1Queue. # noqa: E501
:return: The description of this V1Queue. # noqa: E501
:rtype: str
"""
return self._description
@description.setter
def description(self, description):
"""Sets the description of this V1Queue.
:param description: The description of this V1Queue. # noqa: E501
:type: str
"""
self._description = description
@property
def tags(self):
"""Gets the tags of this V1Queue. # noqa: E501
:return: The tags of this V1Queue. # noqa: E501
:rtype: list[str]
"""
return self._tags
@tags.setter
def tags(self, tags):
"""Sets the tags of this V1Queue.
:param tags: The tags of this V1Queue. # noqa: E501
:type: list[str]
"""
self._tags = tags
@property
def priority(self):
"""Gets the priority of this V1Queue. # noqa: E501
:return: The priority of this V1Queue. # noqa: E501
:rtype: int
"""
return self._priority
@priority.setter
def priority(self, priority):
"""Sets the priority of this V1Queue.
:param priority: The priority of this V1Queue. # noqa: E501
:type: int
"""
self._priority = priority
@property
def concurrency(self):
"""Gets the concurrency of this V1Queue. # noqa: E501
:return: The concurrency of this V1Queue. # noqa: E501
:rtype: int
"""
return self._concurrency
@concurrency.setter
def concurrency(self, concurrency):
"""Sets the concurrency of this V1Queue.
:param concurrency: The concurrency of this V1Queue. # noqa: E501
:type: int
"""
self._concurrency = concurrency
@property
def created_at(self):
"""Gets the created_at of this V1Queue. # noqa: E501
:return: The created_at of this V1Queue. # noqa: E501
:rtype: datetime
"""
return self._created_at
@created_at.setter
def created_at(self, created_at):
"""Sets the created_at of this V1Queue.
:param created_at: The created_at of this V1Queue. # noqa: E501
:type: datetime
"""
self._created_at = created_at
@property
def updated_at(self):
"""Gets the updated_at of this V1Queue. # noqa: E501
:return: The updated_at of this V1Queue. # noqa: E501
:rtype: datetime
"""
return self._updated_at
@updated_at.setter
def updated_at(self, updated_at):
"""Sets the updated_at of this V1Queue.
:param updated_at: The updated_at of this V1Queue. # noqa: E501
:type: datetime
"""
self._updated_at = updated_at
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(
map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value)
)
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(
map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict")
else item,
value.items(),
)
)
else:
result[attr] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, V1Queue):
return False
return self.to_dict() == other.to_dict()
def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, V1Queue):
return True
return self.to_dict() != other.to_dict()
| {
"pile_set_name": "Github"
} |
package webrtc
const (
// Unknown defines default public constant to use for "enum" like struct
// comparisons when no value was defined.
Unknown = iota
unknownStr = "unknown"
ssrcStr = "ssrc"
receiveMTU = 8192
)
| {
"pile_set_name": "Github"
} |
<!-- YAML
added: v0.1.97
changes:
- version: v10.0.0
pr-url: https://github.com/nodejs/node/pull/12562
description: 参数 `callback` 不再是可选的。
如果不传入,则在运行时会抛出 `TypeError`。
- version: v7.6.0
pr-url: https://github.com/nodejs/node/pull/10739
description: 参数 `path` 可以是 WHATWG `URL` 对象(使用 `file:` 协议)。
该支持目前仍是实验的。
- version: v7.0.0
pr-url: https://github.com/nodejs/node/pull/7897
description: 参数 `callback` 不再是可选的。
如果不传入,则会触发弃用警告(id 为 DEP0013)。
-->
* `path` {string|Buffer|URL}
* `uid` {integer}
* `gid` {integer}
* `callback` {Function}
* `err` {Error}
异步地更改文件的所有者和群组。
除了可能的异常,完成回调没有其他参数。
也可参见 chown(2)。
| {
"pile_set_name": "Github"
} |
box: yosssi/golang-latest@1.0.9
# Build definition
build:
# The steps that will be executed on build
steps:
# Sets the go workspace and places you package
# at the right place in the workspace tree
- setup-go-workspace
# Gets the dependencies
- script:
name: go get
code: |
cd $WERCKER_SOURCE_DIR
go version
go get -t ./...
# Build the project
- script:
name: go build
code: |
go build ./...
# Test the project
- script:
name: go test
code: |
packages=(cmd/gmq-cli mqtt mqtt/client mqtt/packet)
for package in ${packages[@]}; do go test -v -cover -race ./$package; done
# Invoke goveralls
- script:
name: goveralls
code: |
go get github.com/axw/gocov/gocov
go get github.com/mattn/goveralls
echo "mode: count" > all.cov
for package in ${packages[@]}; do go test --covermode=count -coverprofile=$package.cov ./$package; sed -e "1d" $package.cov >> all.cov; done
GIT_BRANCH=$WERCKER_GIT_BRANCH goveralls -coverprofile=all.cov -service=wercker.com -repotoken $COVERALLS_REPO_TOKEN
| {
"pile_set_name": "Github"
} |
/*
* Driver for audio on multifunction CS5535/6 companion device
* Copyright (C) Jaya Kumar
*
* Based on Jaroslav Kysela and Takashi Iwai's examples.
* This work was sponsored by CIS(M) Sdn Bhd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/io.h>
#include <sound/core.h>
#include <sound/control.h>
#include <sound/pcm.h>
#include <sound/rawmidi.h>
#include <sound/ac97_codec.h>
#include <sound/initval.h>
#include <sound/asoundef.h>
#include "cs5535audio.h"
#define DRIVER_NAME "cs5535audio"
static char *ac97_quirk;
module_param(ac97_quirk, charp, 0444);
MODULE_PARM_DESC(ac97_quirk, "AC'97 board specific workarounds.");
static const struct ac97_quirk ac97_quirks[] = {
#if 0 /* Not yet confirmed if all 5536 boards are HP only */
{
.subvendor = PCI_VENDOR_ID_AMD,
.subdevice = PCI_DEVICE_ID_AMD_CS5536_AUDIO,
.name = "AMD RDK",
.type = AC97_TUNE_HP_ONLY
},
#endif
{}
};
static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
module_param_array(index, int, NULL, 0444);
MODULE_PARM_DESC(index, "Index value for " DRIVER_NAME);
module_param_array(id, charp, NULL, 0444);
MODULE_PARM_DESC(id, "ID string for " DRIVER_NAME);
module_param_array(enable, bool, NULL, 0444);
MODULE_PARM_DESC(enable, "Enable " DRIVER_NAME);
static const struct pci_device_id snd_cs5535audio_ids[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_CS5535_AUDIO) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_AUDIO) },
{}
};
MODULE_DEVICE_TABLE(pci, snd_cs5535audio_ids);
static void wait_till_cmd_acked(struct cs5535audio *cs5535au, unsigned long timeout)
{
unsigned int tmp;
do {
tmp = cs_readl(cs5535au, ACC_CODEC_CNTL);
if (!(tmp & CMD_NEW))
break;
udelay(1);
} while (--timeout);
if (!timeout)
dev_err(cs5535au->card->dev,
"Failure writing to cs5535 codec\n");
}
static unsigned short snd_cs5535audio_codec_read(struct cs5535audio *cs5535au,
unsigned short reg)
{
unsigned int regdata;
unsigned int timeout;
unsigned int val;
regdata = ((unsigned int) reg) << 24;
regdata |= ACC_CODEC_CNTL_RD_CMD;
regdata |= CMD_NEW;
cs_writel(cs5535au, ACC_CODEC_CNTL, regdata);
wait_till_cmd_acked(cs5535au, 50);
timeout = 50;
do {
val = cs_readl(cs5535au, ACC_CODEC_STATUS);
if ((val & STS_NEW) && reg == (val >> 24))
break;
udelay(1);
} while (--timeout);
if (!timeout)
dev_err(cs5535au->card->dev,
"Failure reading codec reg 0x%x, Last value=0x%x\n",
reg, val);
return (unsigned short) val;
}
static void snd_cs5535audio_codec_write(struct cs5535audio *cs5535au,
unsigned short reg, unsigned short val)
{
unsigned int regdata;
regdata = ((unsigned int) reg) << 24;
regdata |= val;
regdata &= CMD_MASK;
regdata |= CMD_NEW;
regdata &= ACC_CODEC_CNTL_WR_CMD;
cs_writel(cs5535au, ACC_CODEC_CNTL, regdata);
wait_till_cmd_acked(cs5535au, 50);
}
static void snd_cs5535audio_ac97_codec_write(struct snd_ac97 *ac97,
unsigned short reg, unsigned short val)
{
struct cs5535audio *cs5535au = ac97->private_data;
snd_cs5535audio_codec_write(cs5535au, reg, val);
}
static unsigned short snd_cs5535audio_ac97_codec_read(struct snd_ac97 *ac97,
unsigned short reg)
{
struct cs5535audio *cs5535au = ac97->private_data;
return snd_cs5535audio_codec_read(cs5535au, reg);
}
static int snd_cs5535audio_mixer(struct cs5535audio *cs5535au)
{
struct snd_card *card = cs5535au->card;
struct snd_ac97_bus *pbus;
struct snd_ac97_template ac97;
int err;
static struct snd_ac97_bus_ops ops = {
.write = snd_cs5535audio_ac97_codec_write,
.read = snd_cs5535audio_ac97_codec_read,
};
if ((err = snd_ac97_bus(card, 0, &ops, NULL, &pbus)) < 0)
return err;
memset(&ac97, 0, sizeof(ac97));
ac97.scaps = AC97_SCAP_AUDIO | AC97_SCAP_SKIP_MODEM
| AC97_SCAP_POWER_SAVE;
ac97.private_data = cs5535au;
ac97.pci = cs5535au->pci;
/* set any OLPC-specific scaps */
olpc_prequirks(card, &ac97);
if ((err = snd_ac97_mixer(pbus, &ac97, &cs5535au->ac97)) < 0) {
dev_err(card->dev, "mixer failed\n");
return err;
}
snd_ac97_tune_hardware(cs5535au->ac97, ac97_quirks, ac97_quirk);
err = olpc_quirks(card, cs5535au->ac97);
if (err < 0) {
dev_err(card->dev, "olpc quirks failed\n");
return err;
}
return 0;
}
static void process_bm0_irq(struct cs5535audio *cs5535au)
{
u8 bm_stat;
spin_lock(&cs5535au->reg_lock);
bm_stat = cs_readb(cs5535au, ACC_BM0_STATUS);
spin_unlock(&cs5535au->reg_lock);
if (bm_stat & EOP) {
struct cs5535audio_dma *dma;
dma = cs5535au->playback_substream->runtime->private_data;
snd_pcm_period_elapsed(cs5535au->playback_substream);
} else {
dev_err(cs5535au->card->dev,
"unexpected bm0 irq src, bm_stat=%x\n",
bm_stat);
}
}
static void process_bm1_irq(struct cs5535audio *cs5535au)
{
u8 bm_stat;
spin_lock(&cs5535au->reg_lock);
bm_stat = cs_readb(cs5535au, ACC_BM1_STATUS);
spin_unlock(&cs5535au->reg_lock);
if (bm_stat & EOP) {
struct cs5535audio_dma *dma;
dma = cs5535au->capture_substream->runtime->private_data;
snd_pcm_period_elapsed(cs5535au->capture_substream);
}
}
static irqreturn_t snd_cs5535audio_interrupt(int irq, void *dev_id)
{
u16 acc_irq_stat;
unsigned char count;
struct cs5535audio *cs5535au = dev_id;
if (cs5535au == NULL)
return IRQ_NONE;
acc_irq_stat = cs_readw(cs5535au, ACC_IRQ_STATUS);
if (!acc_irq_stat)
return IRQ_NONE;
for (count = 0; count < 4; count++) {
if (acc_irq_stat & (1 << count)) {
switch (count) {
case IRQ_STS:
cs_readl(cs5535au, ACC_GPIO_STATUS);
break;
case WU_IRQ_STS:
cs_readl(cs5535au, ACC_GPIO_STATUS);
break;
case BM0_IRQ_STS:
process_bm0_irq(cs5535au);
break;
case BM1_IRQ_STS:
process_bm1_irq(cs5535au);
break;
default:
dev_err(cs5535au->card->dev,
"Unexpected irq src: 0x%x\n",
acc_irq_stat);
break;
}
}
}
return IRQ_HANDLED;
}
static int snd_cs5535audio_free(struct cs5535audio *cs5535au)
{
synchronize_irq(cs5535au->irq);
pci_set_power_state(cs5535au->pci, PCI_D3hot);
if (cs5535au->irq >= 0)
free_irq(cs5535au->irq, cs5535au);
pci_release_regions(cs5535au->pci);
pci_disable_device(cs5535au->pci);
kfree(cs5535au);
return 0;
}
static int snd_cs5535audio_dev_free(struct snd_device *device)
{
struct cs5535audio *cs5535au = device->device_data;
return snd_cs5535audio_free(cs5535au);
}
static int snd_cs5535audio_create(struct snd_card *card,
struct pci_dev *pci,
struct cs5535audio **rcs5535au)
{
struct cs5535audio *cs5535au;
int err;
static struct snd_device_ops ops = {
.dev_free = snd_cs5535audio_dev_free,
};
*rcs5535au = NULL;
if ((err = pci_enable_device(pci)) < 0)
return err;
if (dma_set_mask(&pci->dev, DMA_BIT_MASK(32)) < 0 ||
dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(32)) < 0) {
dev_warn(card->dev, "unable to get 32bit dma\n");
err = -ENXIO;
goto pcifail;
}
cs5535au = kzalloc(sizeof(*cs5535au), GFP_KERNEL);
if (cs5535au == NULL) {
err = -ENOMEM;
goto pcifail;
}
spin_lock_init(&cs5535au->reg_lock);
cs5535au->card = card;
cs5535au->pci = pci;
cs5535au->irq = -1;
if ((err = pci_request_regions(pci, "CS5535 Audio")) < 0) {
kfree(cs5535au);
goto pcifail;
}
cs5535au->port = pci_resource_start(pci, 0);
if (request_irq(pci->irq, snd_cs5535audio_interrupt,
IRQF_SHARED, KBUILD_MODNAME, cs5535au)) {
dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
err = -EBUSY;
goto sndfail;
}
cs5535au->irq = pci->irq;
pci_set_master(pci);
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL,
cs5535au, &ops)) < 0)
goto sndfail;
*rcs5535au = cs5535au;
return 0;
sndfail: /* leave the device alive, just kill the snd */
snd_cs5535audio_free(cs5535au);
return err;
pcifail:
pci_disable_device(pci);
return err;
}
static int snd_cs5535audio_probe(struct pci_dev *pci,
const struct pci_device_id *pci_id)
{
static int dev;
struct snd_card *card;
struct cs5535audio *cs5535au;
int err;
if (dev >= SNDRV_CARDS)
return -ENODEV;
if (!enable[dev]) {
dev++;
return -ENOENT;
}
err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
0, &card);
if (err < 0)
return err;
if ((err = snd_cs5535audio_create(card, pci, &cs5535au)) < 0)
goto probefail_out;
card->private_data = cs5535au;
if ((err = snd_cs5535audio_mixer(cs5535au)) < 0)
goto probefail_out;
if ((err = snd_cs5535audio_pcm(cs5535au)) < 0)
goto probefail_out;
strcpy(card->driver, DRIVER_NAME);
strcpy(card->shortname, "CS5535 Audio");
sprintf(card->longname, "%s %s at 0x%lx, irq %i",
card->shortname, card->driver,
cs5535au->port, cs5535au->irq);
if ((err = snd_card_register(card)) < 0)
goto probefail_out;
pci_set_drvdata(pci, card);
dev++;
return 0;
probefail_out:
snd_card_free(card);
return err;
}
static void snd_cs5535audio_remove(struct pci_dev *pci)
{
olpc_quirks_cleanup();
snd_card_free(pci_get_drvdata(pci));
}
static struct pci_driver cs5535audio_driver = {
.name = KBUILD_MODNAME,
.id_table = snd_cs5535audio_ids,
.probe = snd_cs5535audio_probe,
.remove = snd_cs5535audio_remove,
#ifdef CONFIG_PM_SLEEP
.driver = {
.pm = &snd_cs5535audio_pm,
},
#endif
};
module_pci_driver(cs5535audio_driver);
MODULE_AUTHOR("Jaya Kumar");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("CS5535 Audio");
MODULE_SUPPORTED_DEVICE("CS5535 Audio");
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project> | {
"pile_set_name": "Github"
} |
#!/bin/bash -e
export URL="http://localhost:3000"
echo "Bulk loading"
./populate.py -d 8 --destination=$URL --domain="mydomain" --bulk
echo "The home page"
wrk -c 10 -d5 -t5 $URL | grep Requests
echo "Single word search 'p'"
wrk -c 10 -d5 -t5 "$URL/v1?q=p&d=mydomain" | grep Requests
echo "Single word search 'python'"
wrk -c 10 -d5 -t5 "$URL/v1?q=python&d=mydomain" | grep Requests
echo "Single word search 'xxxxxx'"
wrk -c 10 -d5 -t5 "$URL/v1?q=xxxxx&d=mydomain" | grep Requests
echo "Double word search 'python', 'te'"
wrk -c 10 -d5 -t5 "$URL/v1?q=python%20te&d=mydomain" | grep Requests
echo "Double word search 'xxxxxxxx', 'yyyyyyy'"
wrk -c 10 -d5 -t5 "$URL/v1?q=xxxxxxxx%20yyyyyy&d=mydomain" | grep Requests
| {
"pile_set_name": "Github"
} |
/*
* /MathJax/jax/output/HTML-CSS/fonts/TeX/AMS/Regular/MiscSymbols.js
*
* Copyright (c) 2012 Design Science, Inc.
*
* Part of the MathJax library.
* See http://www.mathjax.org for details.
*
* Licensed under the Apache License, Version 2.0;
* you may not use this file except in compliance with the License.
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
MathJax.Hub.Insert(MathJax.OutputJax["HTML-CSS"].FONTDATA.FONTS.MathJax_AMS,{9733:[694,111,944,49,895]});MathJax.Ajax.loadComplete(MathJax.OutputJax["HTML-CSS"].fontDir+"/AMS/Regular/MiscSymbols.js");
| {
"pile_set_name": "Github"
} |
<http://example/s> <http://example/p> <http://example/o> .
| {
"pile_set_name": "Github"
} |
""" Two1 command to send bitcoin to another address """
# standart python imports
import logging
# 3rd party imports
import click
# two1 imports
from two1.blockchain.exceptions import DataProviderError
from two1.wallet.exceptions import WalletBalanceError
from two1.commands.util import decorators
from two1.commands.util import uxstring
from two1.commands.util import exceptions
from two1.commands.util import currency
from two1.commands.util.bitcoin_computer import has_mining_chip
# Creates a ClickLogger
logger = logging.getLogger(__name__)
@click.command("send")
@click.argument('address', type=click.STRING)
@click.argument('amount', type=click.FLOAT)
@click.argument('denomination', default='', type=click.STRING)
@click.option('--use-unconfirmed', '-u',
is_flag=True,
default=False,
show_default=True,
help="Use unconfirmed transactions/UTXOs")
@click.option('--verbose', '-v', is_flag=True, default=False,
help="Show all transaction inputs and outputs.")
@click.pass_context
@decorators.catch_all
def send(ctx, address, amount, denomination, use_unconfirmed, verbose):
"""Send a specified address some satoshis.
\b
Usage
-----
Send 5000 satoshi from your on-chain balance to the Apache Foundation.
$ 21 send 1BtjAzWGLyAavUkbw3QsyzzNDKdtPXk95D 5000 satoshis
You can use the following denominations: satoshis, bitcoins, and USD.
By default, this command uses only confirmed transactions and
UTXOs to send coins. To use unconfirmed transactions, use the
--use-unconfirmed flag.
"""
if denomination == '':
confirmed = click.confirm(uxstring.UxString.default_price_denomination, default=True)
if not confirmed:
raise exceptions.Two1Error(uxstring.UxString.cancel_command)
denomination = currency.Price.SAT
price = currency.Price(amount, denomination)
return _send(ctx.obj['wallet'], address, price.satoshis, verbose, use_unconfirmed)
def _send(wallet, address, satoshis, verbose, use_unconfirmed=False):
"""Send bitcoin to the specified address"""
txids = []
try:
txids = wallet.send_to(address=address, amount=satoshis, use_unconfirmed=use_unconfirmed)
# For now there is only a single txn created, so assume it's 0
txid, txn = txids[0]["txid"], txids[0]["txn"]
if verbose:
logger.info(uxstring.UxString.send_success_verbose.format(satoshis, address, txid, txn))
else:
logger.info(uxstring.UxString.send_success.format(satoshis, address, txid))
except ValueError as e:
# This will trigger if there's a below dust-limit output.
raise exceptions.Two1Error(str(e))
except WalletBalanceError as e:
if wallet.unconfirmed_balance() > satoshis:
raise exceptions.Two1Error(uxstring.UxString.send_insufficient_confirmed + str(e))
else:
balance = min(wallet.confirmed_balance(), wallet.unconfirmed_balance())
if has_mining_chip():
raise exceptions.Two1Error(uxstring.UxString.send_insufficient_blockchain_21bc.format(
balance, satoshis, address, str(e)))
else:
raise exceptions.Two1Error(uxstring.UxString.send_insufficient_blockchain_free.format(
balance, satoshis, address, str(e)))
except DataProviderError as e:
if "rejected" in str(e):
raise exceptions.Two1Error(uxstring.UxString.send_rejected)
else:
raise exceptions.Two1Error(str(e))
return txids
| {
"pile_set_name": "Github"
} |
/***************************************************************************/
/* */
/* ftcsbits.c */
/* */
/* FreeType sbits manager (body). */
/* */
/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#include <ft2build.h>
#include FT_CACHE_H
#include "ftcsbits.h"
#include FT_INTERNAL_OBJECTS_H
#include FT_INTERNAL_DEBUG_H
#include FT_ERRORS_H
#include "ftccback.h"
#include "ftcerror.h"
#undef FT_COMPONENT
#define FT_COMPONENT trace_cache
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** SBIT CACHE NODES *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
static FT_Error
ftc_sbit_copy_bitmap( FTC_SBit sbit,
FT_Bitmap* bitmap,
FT_Memory memory )
{
FT_Error error;
FT_Int pitch = bitmap->pitch;
FT_ULong size;
if ( pitch < 0 )
pitch = -pitch;
size = (FT_ULong)( pitch * bitmap->rows );
if ( !FT_ALLOC( sbit->buffer, size ) )
FT_MEM_COPY( sbit->buffer, bitmap->buffer, size );
return error;
}
FT_LOCAL_DEF( void )
ftc_snode_free( FTC_Node ftcsnode,
FTC_Cache cache )
{
FTC_SNode snode = (FTC_SNode)ftcsnode;
FTC_SBit sbit = snode->sbits;
FT_UInt count = snode->count;
FT_Memory memory = cache->memory;
for ( ; count > 0; sbit++, count-- )
FT_FREE( sbit->buffer );
FTC_GNode_Done( FTC_GNODE( snode ), cache );
FT_FREE( snode );
}
FT_LOCAL_DEF( void )
FTC_SNode_Free( FTC_SNode snode,
FTC_Cache cache )
{
ftc_snode_free( FTC_NODE( snode ), cache );
}
/*
* This function tries to load a small bitmap within a given FTC_SNode.
* Note that it returns a non-zero error code _only_ in the case of
* out-of-memory condition. For all other errors (e.g., corresponding
* to a bad font file), this function will mark the sbit as `unavailable'
* and return a value of 0.
*
* You should also read the comment within the @ftc_snode_compare
* function below to see how out-of-memory is handled during a lookup.
*/
static FT_Error
ftc_snode_load( FTC_SNode snode,
FTC_Manager manager,
FT_UInt gindex,
FT_ULong *asize )
{
FT_Error error;
FTC_GNode gnode = FTC_GNODE( snode );
FTC_Family family = gnode->family;
FT_Memory memory = manager->memory;
FT_Face face;
FTC_SBit sbit;
FTC_SFamilyClass clazz;
if ( (FT_UInt)(gindex - gnode->gindex) >= snode->count )
{
FT_ERROR(( "ftc_snode_load: invalid glyph index" ));
return FTC_Err_Invalid_Argument;
}
sbit = snode->sbits + ( gindex - gnode->gindex );
clazz = (FTC_SFamilyClass)family->clazz;
sbit->buffer = 0;
error = clazz->family_load_glyph( family, gindex, manager, &face );
if ( error )
goto BadGlyph;
{
FT_Int temp;
FT_GlyphSlot slot = face->glyph;
FT_Bitmap* bitmap = &slot->bitmap;
FT_Pos xadvance, yadvance; /* FT_GlyphSlot->advance.{x|y} */
if ( slot->format != FT_GLYPH_FORMAT_BITMAP )
{
FT_TRACE0(( "ftc_snode_load:"
" glyph loaded didn't return a bitmap\n" ));
goto BadGlyph;
}
/* Check that our values fit into 8-bit containers! */
/* If this is not the case, our bitmap is too large */
/* and we will leave it as `missing' with sbit.buffer = 0 */
#define CHECK_CHAR( d ) ( temp = (FT_Char)d, temp == d )
#define CHECK_BYTE( d ) ( temp = (FT_Byte)d, temp == d )
/* horizontal advance in pixels */
xadvance = ( slot->advance.x + 32 ) >> 6;
yadvance = ( slot->advance.y + 32 ) >> 6;
if ( !CHECK_BYTE( bitmap->rows ) ||
!CHECK_BYTE( bitmap->width ) ||
!CHECK_CHAR( bitmap->pitch ) ||
!CHECK_CHAR( slot->bitmap_left ) ||
!CHECK_CHAR( slot->bitmap_top ) ||
!CHECK_CHAR( xadvance ) ||
!CHECK_CHAR( yadvance ) )
goto BadGlyph;
sbit->width = (FT_Byte)bitmap->width;
sbit->height = (FT_Byte)bitmap->rows;
sbit->pitch = (FT_Char)bitmap->pitch;
sbit->left = (FT_Char)slot->bitmap_left;
sbit->top = (FT_Char)slot->bitmap_top;
sbit->xadvance = (FT_Char)xadvance;
sbit->yadvance = (FT_Char)yadvance;
sbit->format = (FT_Byte)bitmap->pixel_mode;
sbit->max_grays = (FT_Byte)(bitmap->num_grays - 1);
/* copy the bitmap into a new buffer -- ignore error */
error = ftc_sbit_copy_bitmap( sbit, bitmap, memory );
/* now, compute size */
if ( asize )
*asize = FT_ABS( sbit->pitch ) * sbit->height;
} /* glyph loading successful */
/* ignore the errors that might have occurred -- */
/* we mark unloaded glyphs with `sbit.buffer == 0' */
/* and `width == 255', `height == 0' */
/* */
if ( error && error != FTC_Err_Out_Of_Memory )
{
BadGlyph:
sbit->width = 255;
sbit->height = 0;
sbit->buffer = NULL;
error = 0;
if ( asize )
*asize = 0;
}
return error;
}
FT_LOCAL_DEF( FT_Error )
FTC_SNode_New( FTC_SNode *psnode,
FTC_GQuery gquery,
FTC_Cache cache )
{
FT_Memory memory = cache->memory;
FT_Error error;
FTC_SNode snode = NULL;
FT_UInt gindex = gquery->gindex;
FTC_Family family = gquery->family;
FTC_SFamilyClass clazz = FTC_CACHE__SFAMILY_CLASS( cache );
FT_UInt total;
total = clazz->family_get_count( family, cache->manager );
if ( total == 0 || gindex >= total )
{
error = FT_Err_Invalid_Argument;
goto Exit;
}
if ( !FT_NEW( snode ) )
{
FT_UInt count, start;
start = gindex - ( gindex % FTC_SBIT_ITEMS_PER_NODE );
count = total - start;
if ( count > FTC_SBIT_ITEMS_PER_NODE )
count = FTC_SBIT_ITEMS_PER_NODE;
FTC_GNode_Init( FTC_GNODE( snode ), start, family );
snode->count = count;
error = ftc_snode_load( snode,
cache->manager,
gindex,
NULL );
if ( error )
{
FTC_SNode_Free( snode, cache );
snode = NULL;
}
}
Exit:
*psnode = snode;
return error;
}
FT_LOCAL_DEF( FT_Error )
ftc_snode_new( FTC_Node *ftcpsnode,
FT_Pointer ftcgquery,
FTC_Cache cache )
{
FTC_SNode *psnode = (FTC_SNode*)ftcpsnode;
FTC_GQuery gquery = (FTC_GQuery)ftcgquery;
return FTC_SNode_New( psnode, gquery, cache );
}
FT_LOCAL_DEF( FT_Offset )
ftc_snode_weight( FTC_Node ftcsnode,
FTC_Cache cache )
{
FTC_SNode snode = (FTC_SNode)ftcsnode;
FT_UInt count = snode->count;
FTC_SBit sbit = snode->sbits;
FT_Int pitch;
FT_Offset size;
FT_UNUSED( cache );
FT_ASSERT( snode->count <= FTC_SBIT_ITEMS_PER_NODE );
/* the node itself */
size = sizeof ( *snode );
for ( ; count > 0; count--, sbit++ )
{
if ( sbit->buffer )
{
pitch = sbit->pitch;
if ( pitch < 0 )
pitch = -pitch;
/* add the size of a given glyph image */
size += pitch * sbit->height;
}
}
return size;
}
#if 0
FT_LOCAL_DEF( FT_Offset )
FTC_SNode_Weight( FTC_SNode snode )
{
return ftc_snode_weight( FTC_NODE( snode ), NULL );
}
#endif /* 0 */
FT_LOCAL_DEF( FT_Bool )
ftc_snode_compare( FTC_Node ftcsnode,
FT_Pointer ftcgquery,
FTC_Cache cache )
{
FTC_SNode snode = (FTC_SNode)ftcsnode;
FTC_GQuery gquery = (FTC_GQuery)ftcgquery;
FTC_GNode gnode = FTC_GNODE( snode );
FT_UInt gindex = gquery->gindex;
FT_Bool result;
result = FT_BOOL( gnode->family == gquery->family &&
(FT_UInt)( gindex - gnode->gindex ) < snode->count );
if ( result )
{
/* check if we need to load the glyph bitmap now */
FTC_SBit sbit = snode->sbits + ( gindex - gnode->gindex );
/*
* The following code illustrates what to do when you want to
* perform operations that may fail within a lookup function.
*
* Here, we want to load a small bitmap on-demand; we thus
* need to call the `ftc_snode_load' function which may return
* a non-zero error code only when we are out of memory (OOM).
*
* The correct thing to do is to use @FTC_CACHE_TRYLOOP and
* @FTC_CACHE_TRYLOOP_END in order to implement a retry loop
* that is capable of flushing the cache incrementally when
* an OOM errors occur.
*
* However, we need to `lock' the node before this operation to
* prevent it from being flushed within the loop.
*
* When we exit the loop, we unlock the node, then check the `error'
* variable. If it is non-zero, this means that the cache was
* completely flushed and that no usable memory was found to load
* the bitmap.
*
* We then prefer to return a value of 0 (i.e., NO MATCH). This
* ensures that the caller will try to allocate a new node.
* This operation consequently _fail_ and the lookup function
* returns the appropriate OOM error code.
*
* Note that `buffer == NULL && width == 255' is a hack used to
* tag `unavailable' bitmaps in the array. We should never try
* to load these.
*
*/
if ( sbit->buffer == NULL && sbit->width != 255 )
{
FT_ULong size;
FT_Error error;
ftcsnode->ref_count++; /* lock node to prevent flushing */
/* in retry loop */
FTC_CACHE_TRYLOOP( cache )
{
error = ftc_snode_load( snode, cache->manager, gindex, &size );
}
FTC_CACHE_TRYLOOP_END();
ftcsnode->ref_count--; /* unlock the node */
if ( error )
result = 0;
else
cache->manager->cur_weight += size;
}
}
return result;
}
FT_LOCAL_DEF( FT_Bool )
FTC_SNode_Compare( FTC_SNode snode,
FTC_GQuery gquery,
FTC_Cache cache )
{
return ftc_snode_compare( FTC_NODE( snode ), gquery, cache );
}
/* END */
| {
"pile_set_name": "Github"
} |
debian/tmp/usr/bin/ansible-test usr/bin
debian/tmp/usr/lib/python3/dist-packages/ansible_test usr/lib/python3/dist-packages
| {
"pile_set_name": "Github"
} |
files
{
0 1 1 test_job test_namespace strings1.xml 0
1 2 6 test_job test_namespace strings2.xml 0
2 3 13 test_job test_namespace strings3.xml 0
3 4 20 test_job test_namespace strings4.xml 0
4 5 28 test_job test_namespace strings5.xml 0
}
| {
"pile_set_name": "Github"
} |
# Firejail profile for meld
# Description: Graphical tool to diff and merge files
# This file is overwritten after every install/update
# Persistent local customizations
include meld.local
# Persistent global definitions
include globals.local
# If you want to use meld as git-mergetool (and maybe some other VCS integrations) you need
# to bypass firejail, you can do this by removing the symlink or calling it by its absolute path
# Removing the symlink:
# sudo rm /usr/local/bin/meld
# Calling by its absolute path (example for git-mergetool):
# git config --global mergetool.meld.cmd /usr/bin/meld
noblacklist ${HOME}/.config/meld
noblacklist ${HOME}/.config/git
noblacklist ${HOME}/.gitconfig
noblacklist ${HOME}/.git-credentials
noblacklist ${HOME}/.local/share/meld
noblacklist ${HOME}/.ssh
noblacklist ${HOME}/.subversion
# Allow python (blacklisted by disable-interpreters.inc)
include allow-python3.inc
# Python 2 is EOL (see #3164). Uncomment the next line (or put it into your meld.local) if you understand the risks but want python 2 support for older meld versions.
#include allow-python2.inc
# Uncomment the next line (or put it into your meld.local) if you don't need to compare files in disable-common.inc.
#include disable-common.inc
include disable-devel.inc
include disable-exec.inc
include disable-interpreters.inc
include disable-passwdmgr.inc
# Uncomment the next line (or put it into your meld.local) if you don't need to compare files in disable-programs.inc.
#include disable-programs.inc
include disable-shell.inc
include whitelist-runuser-common.inc
# Uncomment the next lines (or put it into your meld.local) if you don't need to compare files in /usr/share.
#whitelist /usr/share/meld
#include whitelist-usr-share-common.inc
# Uncomment the next line (or put it into your meld.local) if you don't need to compare files in /var.
#include whitelist-var-common.inc
apparmor
caps.drop all
ipc-namespace
machine-id
netfilter
no3d
nodvd
nogroups
nonewprivs
noroot
nosound
notv
nou2f
novideo
protocol unix,inet,inet6
seccomp
shell none
tracelog
private-bin bzr,cvs,git,hg,meld,python*,svn
private-cache
private-dev
# Uncomment the next line (or put it into your meld.local) if you don't need to compare in /etc.
#private-etc alternatives,ca-certificates,crypto-policies,fonts,hostname,hosts,pki,resolv.conf,ssl,subversion
# Comment the next line (or add 'ignore private-tmp to your meld.local') if you want to use it as a difftool (#3551)
private-tmp
read-only ${HOME}/.ssh
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" version="1.0" default-locale="en-US">
<!-- Generated with https://github.com/citation-style-language/utilities/tree/master/generate_dependent_styles/data/mdpi -->
<info>
<title>Processes</title>
<id>http://www.zotero.org/styles/processes</id>
<link href="http://www.zotero.org/styles/processes" rel="self"/>
<link href="http://www.zotero.org/styles/multidisciplinary-digital-publishing-institute" rel="independent-parent"/>
<link href="http://www.mdpi.com/authors/references" rel="documentation"/>
<category citation-format="numeric"/>
<category field="science"/>
<eissn>2227-9717</eissn>
<updated>2014-05-15T12:00:00+00:00</updated>
<rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
</info>
</style>
| {
"pile_set_name": "Github"
} |
/*************************************************************
*
* MathJax/jax/output/HTML-CSS/fonts/STIX/General/Bold/BBBold.js
*
* Copyright (c) 2009-2018 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
MathJax.Hub.Insert(
MathJax.OutputJax['HTML-CSS'].FONTDATA.FONTS['STIXGeneral-bold'],
{
0x1D538: [676,0,787,50,737], // MATHEMATICAL DOUBLE-STRUCK CAPITAL A
0x1D539: [676,0,729,75,669], // MATHEMATICAL DOUBLE-STRUCK CAPITAL B
0x1D53B: [676,0,748,75,703], // MATHEMATICAL DOUBLE-STRUCK CAPITAL D
0x1D53C: [676,0,650,75,595], // MATHEMATICAL DOUBLE-STRUCK CAPITAL E
0x1D53D: [676,0,474,75,595], // MATHEMATICAL DOUBLE-STRUCK CAPITAL F
0x1D53E: [691,19,751,45,686], // MATHEMATICAL DOUBLE-STRUCK CAPITAL G
0x1D540: [676,0,380,80,300], // MATHEMATICAL DOUBLE-STRUCK CAPITAL I
0x1D541: [676,19,618,50,548], // MATHEMATICAL DOUBLE-STRUCK CAPITAL J
0x1D542: [676,0,792,75,767], // MATHEMATICAL DOUBLE-STRUCK CAPITAL K
0x1D543: [676,0,662,70,607], // MATHEMATICAL DOUBLE-STRUCK CAPITAL L
0x1D544: [676,0,914,75,839], // MATHEMATICAL DOUBLE-STRUCK CAPITAL M
0x1D546: [691,19,787,45,742], // MATHEMATICAL DOUBLE-STRUCK CAPITAL O
0x1D54A: [692,19,702,45,657], // MATHEMATICAL DOUBLE-STRUCK CAPITAL S
0x1D54B: [676,0,556,25,645], // MATHEMATICAL DOUBLE-STRUCK CAPITAL T
0x1D54C: [676,19,738,70,668], // MATHEMATICAL DOUBLE-STRUCK CAPITAL U
0x1D54D: [676,0,627,17,704], // MATHEMATICAL DOUBLE-STRUCK CAPITAL V
0x1D54E: [676,0,996,17,1015], // MATHEMATICAL DOUBLE-STRUCK CAPITAL W
0x1D54F: [676,0,794,20,769], // MATHEMATICAL DOUBLE-STRUCK CAPITAL X
0x1D550: [676,0,652,23,739], // MATHEMATICAL DOUBLE-STRUCK CAPITAL Y
0x1D552: [473,14,623,50,563], // MATHEMATICAL DOUBLE-STRUCK SMALL A
0x1D553: [676,14,643,60,593], // MATHEMATICAL DOUBLE-STRUCK SMALL B
0x1D554: [473,14,574,50,524], // MATHEMATICAL DOUBLE-STRUCK SMALL C
0x1D555: [676,14,643,50,583], // MATHEMATICAL DOUBLE-STRUCK SMALL D
0x1D556: [473,14,573,50,523], // MATHEMATICAL DOUBLE-STRUCK SMALL E
0x1D557: [676,0,474,25,536], // MATHEMATICAL DOUBLE-STRUCK SMALL F
0x1D558: [473,205,643,50,583], // MATHEMATICAL DOUBLE-STRUCK SMALL G
0x1D559: [676,0,624,60,564], // MATHEMATICAL DOUBLE-STRUCK SMALL H
0x1D55A: [691,0,330,65,265], // MATHEMATICAL DOUBLE-STRUCK SMALL I
0x1D55B: [691,205,371,-20,311], // MATHEMATICAL DOUBLE-STRUCK SMALL J
0x1D55C: [676,0,646,60,621], // MATHEMATICAL DOUBLE-STRUCK SMALL K
0x1D55D: [676,0,325,60,265], // MATHEMATICAL DOUBLE-STRUCK SMALL L
0x1D55E: [473,0,908,60,848], // MATHEMATICAL DOUBLE-STRUCK SMALL M
0x1D55F: [473,0,624,60,564], // MATHEMATICAL DOUBLE-STRUCK SMALL N
0x1D560: [473,14,598,45,553], // MATHEMATICAL DOUBLE-STRUCK SMALL O
0x1D561: [473,205,643,60,593], // MATHEMATICAL DOUBLE-STRUCK SMALL P
0x1D562: [473,205,643,50,583], // MATHEMATICAL DOUBLE-STRUCK SMALL Q
0x1D563: [473,0,339,60,445], // MATHEMATICAL DOUBLE-STRUCK SMALL R
0x1D564: [473,14,549,52,497], // MATHEMATICAL DOUBLE-STRUCK SMALL S
0x1D565: [676,14,446,25,411], // MATHEMATICAL DOUBLE-STRUCK SMALL T
0x1D566: [461,16,619,55,559], // MATHEMATICAL DOUBLE-STRUCK SMALL U
0x1D567: [461,0,494,6,544], // MATHEMATICAL DOUBLE-STRUCK SMALL V
0x1D568: [461,0,786,22,789], // MATHEMATICAL DOUBLE-STRUCK SMALL W
0x1D569: [461,0,660,25,635], // MATHEMATICAL DOUBLE-STRUCK SMALL X
0x1D56A: [461,205,471,-9,537], // MATHEMATICAL DOUBLE-STRUCK SMALL Y
0x1D56B: [461,0,513,40,473] // MATHEMATICAL DOUBLE-STRUCK SMALL Z
}
);
MathJax.Ajax.loadComplete(MathJax.OutputJax["HTML-CSS"].fontDir + "/General/Bold/BBBold.js");
| {
"pile_set_name": "Github"
} |
import { FocusZoneDirection } from '@fluentui/accessibility';
import { FocusTrapZone, FocusZone, FocusTrapZoneProps } from '@fluentui/react-bindings';
import * as React from 'react';
import * as ReactTestUtils from 'react-dom/test-utils';
import { keyboardKey } from '@fluentui/keyboard-key';
// rAF does not exist in node - let's mock it
window.requestAnimationFrame = (callback: FrameRequestCallback) => {
const r = window.setTimeout(callback, 0);
jest.runAllTimers();
return r;
};
jest.useFakeTimers();
class FocusTrapZoneTestComponent extends React.Component<{}, { isShowingFirst: boolean; isShowingSecond: boolean }> {
constructor(props: {}) {
super(props);
this.state = { isShowingFirst: true, isShowingSecond: false };
}
render() {
return (
<div>
<FocusTrapZone forceFocusInsideTrapOnOutsideFocus isClickableOutsideFocusTrap={false}>
<button className={'a'} onClick={this._toggleFirst}>
a
</button>
<button className={'b'} onClick={this._toggleSecond}>
b
</button>
</FocusTrapZone>
{this.state.isShowingFirst && (
<FocusTrapZone forceFocusInsideTrapOnOutsideFocus={false} isClickableOutsideFocusTrap={false}>
<FocusZone data-is-visible={true}>First</FocusZone>
</FocusTrapZone>
)}
{this.state.isShowingSecond && (
<FocusTrapZone forceFocusInsideTrapOnOutsideFocus={false} isClickableOutsideFocusTrap={true}>
<FocusZone data-is-visible={true}>First</FocusZone>
</FocusTrapZone>
)}
</div>
);
}
_toggleFirst = () => this.setState({ isShowingFirst: !this.state.isShowingFirst });
_toggleSecond = () => this.setState({ isShowingSecond: !this.state.isShowingSecond });
}
describe('FocusTrapZone', () => {
// document.activeElement can be used to detect activeElement after component mount, but it does not
// update based on focus events due to limitations of ReactDOM. Use lastFocusedElement to detect focus
// change events.
let lastFocusedElement: HTMLElement | undefined;
const ftzClassname = 'ftzTestClassname';
const _onFocus = (ev: any): void => (lastFocusedElement = ev.target);
const setupElement = (
element: HTMLElement,
{
clientRect,
isVisible = true,
}: {
clientRect: {
top: number;
left: number;
bottom: number;
right: number;
};
isVisible?: boolean;
},
): void => {
// @ts-ignore
element.getBoundingClientRect = () => ({
top: clientRect.top,
left: clientRect.left,
bottom: clientRect.bottom,
right: clientRect.right,
width: clientRect.right - clientRect.left,
height: clientRect.bottom - clientRect.top,
});
element.setAttribute('data-is-visible', String(isVisible));
element.focus = () => ReactTestUtils.Simulate.focus(element);
};
/**
* Helper to get FocusTrapZone bumpers. Requires classname attribute of
* 'ftzClassname' on FTZ.
*/
function getFtzBumpers(
element: HTMLElement,
): {
firstBumper: Element;
lastBumper: Element;
} {
const ftz = element.querySelector(`.${ftzClassname}`) as HTMLElement;
const ftzNodes = ftz.children;
const firstBumper = ftzNodes[0];
const lastBumper = ftzNodes[ftzNodes.length - 1];
return { firstBumper, lastBumper };
}
beforeEach(() => {
lastFocusedElement = undefined;
});
describe('Tab and shift-tab wrap at extreme ends of the FTZ', () => {
it('can tab across FocusZones with different button structures', async () => {
expect.assertions(3);
const topLevelDiv = ReactTestUtils.renderIntoDocument<{}>(
<div onFocusCapture={_onFocus}>
<FocusTrapZone forceFocusInsideTrapOnOutsideFocus={false} className={ftzClassname}>
<FocusZone direction={FocusZoneDirection.horizontal} data-is-visible={true}>
<div data-is-visible={true}>
<button className="a">a</button>
</div>
<div data-is-visible={true}>
<button className="b">b</button>
</div>
<div data-is-visible={true}>
<button className="c">c</button>
</div>
</FocusZone>
<FocusZone direction={FocusZoneDirection.horizontal} data-is-visible={true}>
<div data-is-visible={true}>
<div data-is-visible={true}>
<button className="d">d</button>
<button className="e">e</button>
<button className="f">f</button>
</div>
</div>
</FocusZone>
</FocusTrapZone>
</div>,
) as HTMLElement;
const buttonA = topLevelDiv.querySelector('.a') as HTMLElement;
const buttonB = topLevelDiv.querySelector('.b') as HTMLElement;
const buttonC = topLevelDiv.querySelector('.c') as HTMLElement;
const buttonD = topLevelDiv.querySelector('.d') as HTMLElement;
const buttonE = topLevelDiv.querySelector('.e') as HTMLElement;
const buttonF = topLevelDiv.querySelector('.f') as HTMLElement;
// Assign bounding locations to buttons.
setupElement(buttonA, { clientRect: { top: 0, bottom: 30, left: 0, right: 30 } });
setupElement(buttonB, { clientRect: { top: 0, bottom: 30, left: 30, right: 60 } });
setupElement(buttonC, { clientRect: { top: 0, bottom: 30, left: 60, right: 90 } });
setupElement(buttonD, { clientRect: { top: 30, bottom: 60, left: 0, right: 30 } });
setupElement(buttonE, { clientRect: { top: 30, bottom: 60, left: 30, right: 60 } });
setupElement(buttonF, { clientRect: { top: 30, bottom: 60, left: 60, right: 90 } });
const { firstBumper, lastBumper } = getFtzBumpers(topLevelDiv);
ReactTestUtils.Simulate.focus(buttonA);
expect(lastFocusedElement).toBe(buttonA);
// Simulate shift+tab event which would focus first bumper
ReactTestUtils.Simulate.focus(firstBumper);
expect(lastFocusedElement).toBe(buttonD);
// Simulate tab event which would focus last bumper
ReactTestUtils.Simulate.focus(lastBumper);
expect(lastFocusedElement).toBe(buttonA);
});
it('can tab across a FocusZone with different button structures', async () => {
expect.assertions(3);
const topLevelDiv = ReactTestUtils.renderIntoDocument<{}>(
<div onFocusCapture={_onFocus}>
<FocusTrapZone forceFocusInsideTrapOnOutsideFocus={false} className={ftzClassname}>
<div data-is-visible={true}>
<button className="x">x</button>
</div>
<FocusZone direction={FocusZoneDirection.horizontal} data-is-visible={true}>
<div data-is-visible={true}>
<button className="a">a</button>
</div>
<div data-is-visible={true}>
<div data-is-visible={true}>
<button className="b">b</button>
<button className="c">c</button>
<button className="d">d</button>
</div>
</div>
</FocusZone>
</FocusTrapZone>
</div>,
) as HTMLElement;
const buttonX = topLevelDiv.querySelector('.x') as HTMLElement;
const buttonA = topLevelDiv.querySelector('.a') as HTMLElement;
const buttonB = topLevelDiv.querySelector('.b') as HTMLElement;
const buttonC = topLevelDiv.querySelector('.c') as HTMLElement;
const buttonD = topLevelDiv.querySelector('.d') as HTMLElement;
const { firstBumper, lastBumper } = getFtzBumpers(topLevelDiv);
// Assign bounding locations to buttons.
setupElement(buttonX, { clientRect: { top: 0, bottom: 30, left: 0, right: 30 } });
setupElement(buttonA, { clientRect: { top: 0, bottom: 30, left: 0, right: 30 } });
setupElement(buttonB, { clientRect: { top: 0, bottom: 30, left: 30, right: 60 } });
setupElement(buttonC, { clientRect: { top: 0, bottom: 30, left: 60, right: 90 } });
setupElement(buttonD, { clientRect: { top: 30, bottom: 60, left: 0, right: 30 } });
ReactTestUtils.Simulate.focus(buttonX);
expect(lastFocusedElement).toBe(buttonX);
// Simulate shift+tab event which would focus first bumper
ReactTestUtils.Simulate.focus(firstBumper);
expect(lastFocusedElement).toBe(buttonA);
// Simulate tab event which would focus last bumper
ReactTestUtils.Simulate.focus(lastBumper);
expect(lastFocusedElement).toBe(buttonX);
});
it('can trap focus when FTZ bookmark elements are FocusZones, and those elements have inner elements focused that are not the first inner element', async () => {
expect.assertions(4);
const topLevelDiv = ReactTestUtils.renderIntoDocument<{}>(
<div onFocusCapture={_onFocus}>
<button className={'z1'}>z1</button>
<FocusTrapZone forceFocusInsideTrapOnOutsideFocus={false} className={ftzClassname}>
<FocusZone direction={FocusZoneDirection.horizontal} data-is-visible={true}>
<button className={'a'}>a</button>
<button className={'b'}>b</button>
<button className={'c'}>c</button>
</FocusZone>
<button className={'d'}>d</button>
<FocusZone direction={FocusZoneDirection.horizontal} data-is-visible={true}>
<button className={'e'}>e</button>
<button className={'f'}>f</button>
<button className={'g'}>g</button>
</FocusZone>
</FocusTrapZone>
<button className={'z2'}>z2</button>
</div>,
) as HTMLElement;
const buttonZ1 = topLevelDiv.querySelector('.z1') as HTMLElement;
const buttonA = topLevelDiv.querySelector('.a') as HTMLElement;
const buttonB = topLevelDiv.querySelector('.b') as HTMLElement;
const buttonC = topLevelDiv.querySelector('.c') as HTMLElement;
const buttonD = topLevelDiv.querySelector('.d') as HTMLElement;
const buttonE = topLevelDiv.querySelector('.e') as HTMLElement;
const buttonF = topLevelDiv.querySelector('.f') as HTMLElement;
const buttonG = topLevelDiv.querySelector('.g') as HTMLElement;
const buttonZ2 = topLevelDiv.querySelector('.z2') as HTMLElement;
const { firstBumper, lastBumper } = getFtzBumpers(topLevelDiv);
// Assign bounding locations to buttons.
setupElement(buttonZ1, { clientRect: { top: 0, bottom: 10, left: 0, right: 10 } });
setupElement(buttonA, { clientRect: { top: 10, bottom: 30, left: 0, right: 10 } });
setupElement(buttonB, { clientRect: { top: 10, bottom: 30, left: 10, right: 20 } });
setupElement(buttonC, { clientRect: { top: 10, bottom: 30, left: 20, right: 30 } });
setupElement(buttonD, { clientRect: { top: 30, bottom: 40, left: 0, right: 10 } });
setupElement(buttonE, { clientRect: { top: 40, bottom: 60, left: 0, right: 10 } });
setupElement(buttonF, { clientRect: { top: 40, bottom: 60, left: 10, right: 20 } });
setupElement(buttonG, { clientRect: { top: 40, bottom: 60, left: 20, right: 30 } });
setupElement(buttonZ2, { clientRect: { top: 60, bottom: 70, left: 0, right: 10 } });
// Focus the middle button in the first FZ.
ReactTestUtils.Simulate.focus(buttonA);
ReactTestUtils.Simulate.keyDown(buttonA, { which: keyboardKey.ArrowRight });
expect(lastFocusedElement).toBe(buttonB);
// Focus the middle button in the second FZ.
ReactTestUtils.Simulate.focus(buttonE);
ReactTestUtils.Simulate.keyDown(buttonE, { which: keyboardKey.ArrowRight });
expect(lastFocusedElement).toBe(buttonF);
// Simulate tab event which would focus last bumper
ReactTestUtils.Simulate.focus(lastBumper);
expect(lastFocusedElement).toBe(buttonB);
// Simulate shift+tab event which would focus first bumper
ReactTestUtils.Simulate.focus(firstBumper);
expect(lastFocusedElement).toBe(buttonF);
});
});
describe('Tab and shift-tab do nothing (keep focus where it is) when the FTZ contains 0 tabbable items', () => {
function setupTest(props: FocusTrapZoneProps) {
const topLevelDiv = ReactTestUtils.renderIntoDocument<{}>(
<div onFocusCapture={_onFocus}>
<button className={'z1'}>z1</button>
<FocusTrapZone className={ftzClassname} forceFocusInsideTrapOnOutsideFocus={true} {...props}>
<button className={'a'} tabIndex={-1}>
a
</button>
<button className={'b'} tabIndex={-1}>
b
</button>
<button className={'c'} tabIndex={-1}>
c
</button>
</FocusTrapZone>
<button className={'z2'}>z2</button>
</div>,
) as HTMLElement;
const buttonZ1 = topLevelDiv.querySelector('.z1') as HTMLElement;
const buttonA = topLevelDiv.querySelector('.a') as HTMLElement;
const buttonB = topLevelDiv.querySelector('.b') as HTMLElement;
const buttonC = topLevelDiv.querySelector('.c') as HTMLElement;
const buttonZ2 = topLevelDiv.querySelector('.z2') as HTMLElement;
const { firstBumper, lastBumper } = getFtzBumpers(topLevelDiv);
// Have to set bumpers as "visible" for focus utilities to find them.
// This is needed for 0 tabbable element tests to make sure that next tabbable element
// from one bumper is the other bumper.
firstBumper.setAttribute('data-is-visible', String(true));
lastBumper.setAttribute('data-is-visible', String(true));
// Assign bounding locations to buttons.
setupElement(buttonZ1, { clientRect: { top: 0, bottom: 10, left: 0, right: 10 } });
setupElement(buttonA, { clientRect: { top: 10, bottom: 20, left: 0, right: 10 } });
setupElement(buttonB, { clientRect: { top: 20, bottom: 30, left: 0, right: 10 } });
setupElement(buttonC, { clientRect: { top: 30, bottom: 40, left: 0, right: 10 } });
setupElement(buttonZ2, { clientRect: { top: 40, bottom: 50, left: 0, right: 10 } });
return { buttonZ1, buttonA, buttonB, buttonC, buttonZ2, firstBumper, lastBumper };
}
it('focuses first focusable element when focusing first bumper', async () => {
expect.assertions(2);
const { buttonB, buttonA, firstBumper } = setupTest({});
ReactTestUtils.Simulate.focus(buttonB);
expect(lastFocusedElement).toBe(buttonB);
// Simulate shift+tab event which would focus first bumper
ReactTestUtils.Simulate.focus(firstBumper);
expect(lastFocusedElement).toBe(buttonA);
});
it('focuses first focusable element when focusing last bumper', async () => {
expect.assertions(2);
const { buttonA, buttonB, lastBumper } = setupTest({});
ReactTestUtils.Simulate.focus(buttonB);
expect(lastFocusedElement).toBe(buttonB);
// Simulate tab event which would focus last bumper
ReactTestUtils.Simulate.focus(lastBumper);
expect(lastFocusedElement).toBe(buttonA);
});
});
describe('Focus behavior based on default and explicit prop values', () => {
function setupTest(props: FocusTrapZoneProps) {
// data-is-visible is embedded in buttons here for testing focus behavior on initial render.
// Components have to be marked visible before setupElement has a chance to apply the data-is-visible attribute.
const topLevelDiv = (ReactTestUtils.renderIntoDocument(
<div>
<div onFocusCapture={_onFocus}>
<button className={'z1'}>z1</button>
<FocusTrapZone data-is-visible={true} {...props} className={ftzClassname}>
<button className={'a'} data-is-visible={true}>
a
</button>
<button className={'b'} data-is-visible={true}>
b
</button>
<button className={'c'} data-is-visible={true}>
c
</button>
</FocusTrapZone>
<button className={'z2'}>z2</button>
</div>
</div>,
) as unknown) as HTMLElement;
const buttonZ1 = topLevelDiv.querySelector('.z1') as HTMLElement;
const buttonA = topLevelDiv.querySelector('.a') as HTMLElement;
const buttonB = topLevelDiv.querySelector('.b') as HTMLElement;
const buttonC = topLevelDiv.querySelector('.c') as HTMLElement;
const buttonZ2 = topLevelDiv.querySelector('.z2') as HTMLElement;
const { firstBumper, lastBumper } = getFtzBumpers(topLevelDiv);
// Assign bounding locations to buttons.
setupElement(buttonZ1, { clientRect: { top: 0, bottom: 10, left: 0, right: 10 } });
setupElement(buttonA, { clientRect: { top: 10, bottom: 20, left: 0, right: 10 } });
setupElement(buttonB, { clientRect: { top: 20, bottom: 30, left: 0, right: 10 } });
setupElement(buttonC, { clientRect: { top: 30, bottom: 40, left: 0, right: 10 } });
setupElement(buttonZ2, { clientRect: { top: 40, bottom: 50, left: 0, right: 10 } });
return { buttonZ1, buttonA, buttonB, buttonC, buttonZ2, firstBumper, lastBumper };
}
it('Focuses first element when FTZ does not have focus and first bumper receives focus', async () => {
expect.assertions(2);
const { buttonA, buttonZ1, firstBumper } = setupTest({ isClickableOutsideFocusTrap: true });
ReactTestUtils.Simulate.focus(buttonZ1);
expect(lastFocusedElement).toBe(buttonZ1);
ReactTestUtils.Simulate.focus(firstBumper);
expect(lastFocusedElement).toBe(buttonA);
});
it('Focuses last element when FTZ does not have focus and last bumper receives focus', async () => {
expect.assertions(2);
const { buttonC, buttonZ2, lastBumper } = setupTest({ isClickableOutsideFocusTrap: true });
ReactTestUtils.Simulate.focus(buttonZ2);
expect(lastFocusedElement).toBe(buttonZ2);
ReactTestUtils.Simulate.focus(lastBumper);
expect(lastFocusedElement).toBe(buttonC);
});
it('Focuses first on mount', async () => {
expect.assertions(1);
const { buttonA } = setupTest({});
expect(document.activeElement).toBe(buttonA);
});
it('Does not focus first on mount with disableFirstFocus', async () => {
expect.assertions(1);
const activeElement = document.activeElement;
setupTest({ disableFirstFocus: true });
// document.activeElement can be used to detect activeElement after component mount, but it does not
// update based on focus events due to limitations of ReactDOM.
// Make sure activeElement didn't change.
expect(document.activeElement).toBe(activeElement);
});
it('Does not focus first on mount while disabled', async () => {
expect.assertions(1);
const activeElement = document.activeElement;
setupTest({ disabled: true });
// document.activeElement can be used to detect activeElement after component mount, but it does not
// update based on focus events due to limitations of ReactDOM.
// Make sure activeElement didn't change.
expect(document.activeElement).toBe(activeElement);
});
it('Focuses on firstFocusableSelector on mount', async () => {
expect.assertions(1);
const { buttonC } = setupTest({ firstFocusableSelector: '.c' });
expect(document.activeElement).toBe(buttonC);
});
it('Does not focus on firstFocusableSelector on mount while disabled', async () => {
expect.assertions(1);
const activeElement = document.activeElement;
setupTest({ firstFocusableSelector: '.c', disabled: true });
expect(document.activeElement).toBe(activeElement);
});
it('Falls back to first focusable element with invalid firstFocusableSelector', async () => {
const { buttonA } = setupTest({ firstFocusableSelector: '.invalidSelector' });
expect(document.activeElement).toBe(buttonA);
});
});
describe('Focusing the FTZ', () => {
function setupTest(focusPreviouslyFocusedInnerElement: boolean) {
let focusTrapZoneRef: FocusTrapZone | null = null;
const topLevelDiv = ReactTestUtils.renderIntoDocument<{}>(
<div onFocusCapture={_onFocus}>
<FocusTrapZone
forceFocusInsideTrapOnOutsideFocus={false}
focusPreviouslyFocusedInnerElement={focusPreviouslyFocusedInnerElement}
data-is-focusable={true}
ref={ftz => {
focusTrapZoneRef = ftz;
}}
>
<button className={'f'}>f</button>
<FocusZone>
<button className={'a'}>a</button>
<button className={'b'}>b</button>
</FocusZone>
</FocusTrapZone>
<button className={'z'}>z</button>
</div>,
) as HTMLElement;
const buttonF = topLevelDiv.querySelector('.f') as HTMLElement;
const buttonA = topLevelDiv.querySelector('.a') as HTMLElement;
const buttonB = topLevelDiv.querySelector('.b') as HTMLElement;
const buttonZ = topLevelDiv.querySelector('.z') as HTMLElement;
// Assign bounding locations to buttons.
setupElement(buttonF, { clientRect: { top: 0, bottom: 10, left: 0, right: 10 } });
setupElement(buttonA, { clientRect: { top: 10, bottom: 20, left: 0, right: 10 } });
setupElement(buttonB, { clientRect: { top: 20, bottom: 30, left: 0, right: 10 } });
setupElement(buttonZ, { clientRect: { top: 30, bottom: 40, left: 0, right: 10 } });
return { focusTrapZone: focusTrapZoneRef, buttonF, buttonA, buttonB, buttonZ };
}
it('goes to previously focused element when focusing the FTZ', async () => {
expect.assertions(4);
const { focusTrapZone, buttonF, buttonB, buttonZ } = setupTest(true /* focusPreviouslyFocusedInnerElement */);
// By calling `componentDidMount`, FTZ will behave as just initialized and focus needed element
// @ts-ignore
focusTrapZone.componentDidMount();
expect(lastFocusedElement).toBe(buttonF);
// Focus inside the trap zone, not the first element.
ReactTestUtils.Simulate.focus(buttonB);
expect(lastFocusedElement).toBe(buttonB);
// Focus outside the trap zone
ReactTestUtils.Simulate.focus(buttonZ);
expect(lastFocusedElement).toBe(buttonZ);
// By calling `componentDidMount`, FTZ will behave as just initialized and focus needed element
// FTZ should return to originally focused inner element.
// @ts-ignore
focusTrapZone.componentDidMount();
expect(lastFocusedElement).toBe(buttonB);
});
it('goes to first focusable element when focusing the FTZ', async () => {
expect.assertions(4);
const { focusTrapZone, buttonF, buttonB, buttonZ } = setupTest(false /* focusPreviouslyFocusedInnerElement */);
// By calling `componentDidMount`, FTZ will behave as just initialized and focus needed element
// Focus within should go to 1st focusable inner element.
// @ts-ignore
focusTrapZone.componentDidMount();
expect(lastFocusedElement).toBe(buttonF);
// Focus inside the trap zone, not the first element.
ReactTestUtils.Simulate.focus(buttonB);
expect(lastFocusedElement).toBe(buttonB);
// Focus outside the trap zone
ReactTestUtils.Simulate.focus(buttonZ);
expect(lastFocusedElement).toBe(buttonZ);
// By calling `componentDidMount`, FTZ will behave as just initialized and focus needed element
// Focus should go to the first focusable element
// @ts-ignore
focusTrapZone.componentDidMount();
expect(lastFocusedElement).toBe(buttonF);
});
});
describe('Nested FocusTrapZones Stack Behavior', () => {
const getFocusStack = (): FocusTrapZone[] => (FocusTrapZone as any)._focusStack;
beforeAll(() => (getFocusStack().length = 0));
it('FocusTrapZone maintains a proper stack of FocusTrapZones as more are mounted/unmounted.', async () => {
let focusTrapZoneFocusStack: FocusTrapZone[] = getFocusStack();
const topLevelDiv = ReactTestUtils.renderIntoDocument<{}>(
<div>
<FocusTrapZoneTestComponent />
</div>,
) as HTMLElement;
const buttonA = topLevelDiv.querySelector('.a') as HTMLElement;
const buttonB = topLevelDiv.querySelector('.b') as HTMLElement;
expect(focusTrapZoneFocusStack.length).toBe(2);
const baseFocusTrapZone = focusTrapZoneFocusStack[0];
expect(baseFocusTrapZone.props.forceFocusInsideTrapOnOutsideFocus).toBe(true);
expect(baseFocusTrapZone.props.isClickableOutsideFocusTrap).toBe(false);
const firstFocusTrapZone = focusTrapZoneFocusStack[1];
expect(firstFocusTrapZone.props.forceFocusInsideTrapOnOutsideFocus).toBe(false);
expect(firstFocusTrapZone.props.isClickableOutsideFocusTrap).toBe(false);
// There should be now 3 focus trap zones (base/first/second)
ReactTestUtils.Simulate.click(buttonB);
expect(focusTrapZoneFocusStack.length).toBe(3);
expect(focusTrapZoneFocusStack[0]).toBe(baseFocusTrapZone);
expect(focusTrapZoneFocusStack[1]).toBe(firstFocusTrapZone);
const secondFocusTrapZone = focusTrapZoneFocusStack[2];
expect(secondFocusTrapZone.props.forceFocusInsideTrapOnOutsideFocus).toBe(false);
expect(secondFocusTrapZone.props.isClickableOutsideFocusTrap).toBe(true);
// we remove the middle one
// unmounting a focus trap zone should remove it from the focus stack.
// but we also check that it removes the right focustrapzone (the middle one)
ReactTestUtils.Simulate.click(buttonA);
focusTrapZoneFocusStack = getFocusStack();
expect(focusTrapZoneFocusStack.length).toBe(2);
expect(focusTrapZoneFocusStack[0]).toBe(baseFocusTrapZone);
expect(focusTrapZoneFocusStack[1]).toBe(secondFocusTrapZone);
// finally remove the last focus trap zone.
ReactTestUtils.Simulate.click(buttonB);
focusTrapZoneFocusStack = getFocusStack();
expect(focusTrapZoneFocusStack.length).toBe(1);
expect(focusTrapZoneFocusStack[0]).toBe(baseFocusTrapZone);
});
});
});
| {
"pile_set_name": "Github"
} |
# Created by: Sean Farley <sean-freebsd@farley.org>
# $FreeBSD$
PORTNAME= Mknod
PORTVERSION= 0.02
PORTREVISION= 1
CATEGORIES= devel perl5
MASTER_SITES= CPAN
MASTER_SITE_SUBDIR= CPAN:RLZWART
PKGNAMEPREFIX= p5-
MAINTAINER= sean-freebsd@farley.org
COMMENT= Perl module interface to the mknod(2) system call
USES= perl5
USE_PERL5= configure
MANPREFIX= ${PREFIX}/${SITE_PERL_REL}
.include <bsd.port.mk>
| {
"pile_set_name": "Github"
} |
<?php
/*
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
All rights reserved.
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
http://www.opensolutions.ie/
This file is part of the OSS_SNMP package.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Open Source Solutions Limited nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace OSS_SNMP\MIBS;
/**
* A class for performing SNMP V2 queries on generic devices
*
* @copyright Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
* @author Barry O'Donovan <barry@opensolutions.ie>
*/
class Iface extends \OSS_SNMP\MIB
{
const OID_IF_NUMBER = '.1.3.6.1.2.1.2.1.0';
const OID_IF_INDEX = '.1.3.6.1.2.1.2.2.1.1';
const OID_IF_DESCRIPTION = '.1.3.6.1.2.1.2.2.1.2';
const OID_IF_TYPE = '.1.3.6.1.2.1.2.2.1.3';
const OID_IF_MTU = '.1.3.6.1.2.1.2.2.1.4';
const OID_IF_SPEED = '.1.3.6.1.2.1.2.2.1.5';
const OID_IF_PHYS_ADDRESS = '.1.3.6.1.2.1.2.2.1.6';
const OID_IF_ADMIN_STATUS = '.1.3.6.1.2.1.2.2.1.7';
const OID_IF_OPER_STATUS = '.1.3.6.1.2.1.2.2.1.8';
const OID_IF_LAST_CHANGE = '.1.3.6.1.2.1.2.2.1.9';
const OID_IF_IN_OCTETS = '.1.3.6.1.2.1.2.2.1.10';
const OID_IF_IN_UNICAST_PACKETS = '.1.3.6.1.2.1.2.2.1.11';
const OID_IF_IN_NON_UNICAST_PACKETS = '.1.3.6.1.2.1.2.2.1.12';
const OID_IF_IN_DISCARDS = '.1.3.6.1.2.1.2.2.1.13';
const OID_IF_IN_ERRORS = '.1.3.6.1.2.1.2.2.1.14';
const OID_IF_IN_UNKNOWN_PROTOCOLS = '.1.3.6.1.2.1.2.2.1.15';
const OID_IF_OUT_OCTETS = '.1.3.6.1.2.1.2.2.1.16';
const OID_IF_OUT_UNICAST_PACKETS = '.1.3.6.1.2.1.2.2.1.17';
const OID_IF_OUT_NON_UNICAST_PACKETS = '.1.3.6.1.2.1.2.2.1.18';
const OID_IF_OUT_DISCARDS = '.1.3.6.1.2.1.2.2.1.19';
const OID_IF_OUT_ERRORS = '.1.3.6.1.2.1.2.2.1.20';
const OID_IF_OUT_QUEUE_LENGTH = '.1.3.6.1.2.1.2.2.1.21';
const OID_IF_NAME = '.1.3.6.1.2.1.31.1.1.1.1';
const OID_IF_HIGH_SPEED = '.1.3.6.1.2.1.31.1.1.1.15';
const OID_IF_ALIAS = '.1.3.6.1.2.1.31.1.1.1.18';
/**
* Get the number of network interfaces (regardless of
* their current state) present on this system.
*
* @return int The number of network interfaces on the system
*/
public function numberOfInterfaces()
{
return $this->getSNMP()->get( self::OID_IF_NUMBER );
}
/**
* Get an array of device MTUs
*
* @return array An array of device MTUs
*/
public function mtus()
{
return $this->getSNMP()->walk1d( self::OID_IF_MTU );
}
/**
* Get an array of the interfaces' physical addresses
*
* "The interface's address at the protocol layer
* immediately `below' the network layer in the
* protocol stack. For interfaces which do not have
* such an address (e.g., a serial line), this object
* should contain an octet string of zero length."
*
* @return array An array of device physical addresses
*/
public function physAddresses()
{
$pa = $this->getSNMP()->walk1d( self::OID_IF_PHYS_ADDRESS );
// some switches return leading '00:' as '0:' - we correct this here:
foreach( $pa as $i => $a )
if( strpos( $a, ':' ) == 1 )
$pa[ $i ] = '0' . $a;
return $pa;
}
/**
* Constant for possible value of interface admin status.
* @see adminStates()
*/
const IF_ADMIN_STATUS_UP = 1;
/**
* Constant for possible value of interface admin status.
* @see adminStates()
*/
const IF_ADMIN_STATUS_DOWN = 2;
/**
* Constant for possible value of interface admin status.
* @see adminStates()
*/
const IF_ADMIN_STATUS_TESTING = 3;
/**
* Text representation of interface admin status.
*
* @see adminStates()
* @var array Text representations of interface admin status.
*/
public static $IF_ADMIN_STATES = array(
self::IF_ADMIN_STATUS_UP => 'up',
self::IF_ADMIN_STATUS_DOWN => 'down',
self::IF_ADMIN_STATUS_TESTING => 'testing'
);
/**
* Get an array of device interface admin status (up / down)
*
* E.g. the follow SNMP output yields the shown array:
*
* .1.3.6.1.2.1.2.2.1.7.10128 = INTEGER: up(1)
* .1.3.6.1.2.1.2.2.1.7.10129 = INTEGER: down(2)
* ...
*
* [10128] => 1
* [10129] => 2
*
* @see IF_ADMIN_STATES
* @param boolean $translate If true, return the string representation
* @return array An array of interface admin states
*/
public function adminStates( $translate = false )
{
$states = $this->getSNMP()->walk1d( self::OID_IF_ADMIN_STATUS );
if( !$translate )
return $states;
return $this->getSNMP()->translate( $states, self::$IF_ADMIN_STATES );
}
/**
* Get an array of device interface last change times
*
* Value returned is timeticks (one hundreds of a second)
*
* "The value of sysUpTime at the time the interface
* entered its current operational state. If the
* current state was entered prior to the last re-
* initialization of the local network management
* subsystem, then this object contains a zero
* value."
*
* @see \OSS_SNMP\MIBS\System::uptime()
* @param bool $asUnixTimestamp Poll sysUpTime and use this to return a timestamp of the last change
* @return array Timeticks (or zero) since last change of the interfaces
*/
public function lastChanges( $asUnixTimestamp = false )
{
$lc = $this->getSNMP()->walk1d( self::OID_IF_LAST_CHANGE );
if( $asUnixTimestamp )
{
$sysUptime = $this->getSNMP()->useSystem()->uptime() / 100;
foreach( $lc as $i => $t )
if( $t )
$lc[$i] = intval( floor( time() - $sysUptime + ( $t / 100 ) ) );
}
return $lc;
}
/**
* Get an array of device interface in octets
*
* "The total number of octets received on the
* interface, including framing characters."
*
* @return array The total number of octets received on interfaces
*/
public function inOctets()
{
return $this->getSNMP()->walk1d( self::OID_IF_IN_OCTETS );
}
/**
* Get an array of device interface unicast packets in
*
* "The number of subnetwork-unicast packets
* delivered to a higher-layer protocol."
*
* @return array The total number of unicast packets received on interfaces
*/
public function inUnicastPackets()
{
return $this->getSNMP()->walk1d( self::OID_IF_IN_UNICAST_PACKETS );
}
/**
* Get an array of device interface non-unicast packets in
*
* "The number of non-unicast (i.e., subnetwork-
* broadcast or subnetwork-multicast) packets
* delivered to a higher-layer protocol."
*
* @return array The total number of non-unicast packets received on interfaces
*/
public function inNonUnicastPackets()
{
return $this->getSNMP()->walk1d( self::OID_IF_IN_NON_UNICAST_PACKETS );
}
/**
* Get an array of device interface inbound discarded packets
*
* "The number of inbound packets which were chosen
* to be discarded even though no errors had been
* detected to prevent their being deliverable to a
* higher-layer protocol. One possible reason for
* discarding such a packet could be to free up
* buffer space."
*
* @return arrary The total number of discarded inbound packets received on interfaces
*/
public function inDiscards()
{
return $this->getSNMP()->walk1d( self::OID_IF_IN_DISCARDS );
}
/**
* Get an array of device interface inbound error packets
*
* "The number of inbound packets that contained
* errors preventing them from being deliverable to a
* higher-layer protocol."
*
* @return array The total number of error inbound packets received on interfaces
*/
public function inErrors()
{
return $this->getSNMP()->walk1d( self::OID_IF_IN_ERRORS );
}
/**
* Get an array of device interface out octets
*
* "The total number of octets transmitted out of the
* interface, including framing characters."
*
* @return array The total number of octets transmitted on interfaces
*/
public function outOctets()
{
return $this->getSNMP()->walk1d( self::OID_IF_OUT_OCTETS );
}
/**
* Get an array of device interface unicast packets out
*
* "The total number of packets that higher-level
* protocols requested be transmitted to a
* subnetwork-unicast address, including those that
* were discarded or not sent."
*
* @return array The total number of unicast packets transmitted on interfaces
*/
public function outUnicastPackets()
{
return $this->getSNMP()->walk1d( self::OID_IF_OUT_UNICAST_PACKETS );
}
/**
* Get an array of device interface non-unicast packets out
*
* "The total number of packets that higher-level
* protocols requested be transmitted to a non-
* unicast (i.e., a subnetwork-broadcast or
* subnetwork-multicast) address, including those
* that were discarded or not sent."
*
* @return array The total number of non-unicast packets requested sent interfaces
*/
public function outNonUnicastPackets()
{
return $this->getSNMP()->walk1d( self::OID_IF_OUT_NON_UNICAST_PACKETS );
}
/**
* Get an array of device interface outbound discarded packets
*
* "The number of outbound packets which were chosen
* to be discarded even though no errors had been
* detected to prevent their being transmitted. One
* possible reason for discarding such a packet could
* be to free up buffer space."
*
* @return arrary The total number of discarded outbound packets
*/
public function outDiscards()
{
return $this->getSNMP()->walk1d( self::OID_IF_OUT_DISCARDS );
}
/**
* Get an array of device interface outbound error packets
*
* "The number of outbound packets that could not be
* transmitted because of errors."
*
* @return array The total number of error outbound packets received on interfaces
*/
public function outErrors()
{
return $this->getSNMP()->walk1d( self::OID_IF_OUT_ERRORS );
}
/**
* Get an array of interface outbound queue lengths
*
* "The length of the output packet queue (in packets)"
*
* @return array The total number of packets in the outbound queues
*/
public function outQueueLength()
{
return $this->getSNMP()->walk1d( self::OID_IF_OUT_QUEUE_LENGTH );
}
/**
* Get an array of packets received on an interface of unknown protocol
*
* "The number of packets received via the interface
* which were discarded because of an unknown or
* unsupported protocol."
*
* @return array The number of packets received on an interface of unknown protocol
*/
public function inUnknownProtocols()
{
return $this->getSNMP()->walk1d( self::OID_IF_IN_UNKNOWN_PROTOCOLS );
}
/**
* Get an array of device interface indexes
*
* E.g. the following SNMP output yields the shown array:
*
* .1.3.6.1.2.1.2.2.1.1 = INTEGER: 1
* .1.3.6.1.2.1.2.2.1.2 = INTEGER: 2
* ...
*
* [1] => 1
* [2] => 2
*
* @return array An array of interface indexes
*/
public function indexes()
{
return $this->getSNMP()->walk1d( self::OID_IF_INDEX );
}
/**
* Get an array of device interface names
*
* E.g. the following SNMP output yields the shown array:
*
* .1.3.6.1.2.1.31.1.1.1.1.10128 = STRING: Gi1/0/28
* .1.3.6.1.2.1.31.1.1.1.1.10129 = STRING: Gi1/0/29
* ...
*
* [10128] => "Gi1/0/28"
* [10129] => "Gi1/0/29"
*
* @return array An array of interface names
*/
public function names()
{
return $this->getSNMP()->walk1d( self::OID_IF_NAME );
}
/**
* Get an array of device interface aliases (e.g. as set by the interface description / port-name parameter)
*
* E.g. the followig SNMP output yields the shown array:
*
* .1.3.6.1.2.1.2.2.1.2.18.10128 = STRING: Connection to switch2
* .1.3.6.1.2.1.2.2.1.2.18.10129 = STRING: Connection to switch3
* ...
*
* [10128] => "Connection to switch2"
* [10129] => "Connection to switch3"
*
* @return array An array of interface aliases
*/
public function aliases()
{
return $this->getSNMP()->walk1d( self::OID_IF_ALIAS );
}
/**
* Get an array of device interface descriptions
*
* E.g. the following SNMP output yields the shown array:
*
* .1.3.6.1.2.1.31.1.1.1.1.10128 = STRING: GigabitEthernet1/0/28
* .1.3.6.1.2.1.31.1.1.1.1.10129 = STRING: GigabitEthernet1/0/29
* ...
*
* [10128] => "GigabitEthernet1/0/28"
* [10129] => "GigabitEthernet1/0/29"
*
* @return array An array of interface descriptions
*/
public function descriptions()
{
return $this->getSNMP()->walk1d( self::OID_IF_DESCRIPTION );
}
/**
* Get an array of device interface (operating) speeds
*
* E.g. the following SNMP output yields the shown array:
*
* .1.3.6.1.2.1.2.2.1.5.10128 = Gauge32: 1000000000
* .1.3.6.1.2.1.2.2.1.5.10129 = Gauge32: 100000000
* ...
*
* [10128] => 1000000000
* [10129] => 100000000
*
* NB: operating speed as opposed to maximum speed
*
* **WARNING:** This is a 32 bit int so it cannot represent 10Gb
* links. These would show up as:
*
* [10127] => 4294967295
*
* Instead, use highSpeeds() which will represent the speed as Mbps
*
* @see highSpeeds()
* @return array An array of interface operating speeds
*/
public function speeds()
{
return $this->getSNMP()->walk1d( self::OID_IF_SPEED );
}
/**
* Get an array of device interface (operating) speeds
*
* From Cisco:
*
* > "An estimate of the interface's current bandwidth in units
* > of 1,000,000 bits per second. If this object reports a
* > value of `n' then the speed of the interface is somewhere in
* > the range of `n-500,000' to `n+499,999'. For interfaces
* > which do not vary in bandwidth or for those where no
* > accurate estimation can be made, this object should contain
* > the nominal bandwidth. For a sub-layer which has no concept
* > of bandwidth, this object should be zero."
*
* E.g. the following SNMP output yields the shown array:
*
* .1.3.6.1.2.1.2.2.1.5.10127 = Gauge32: 10000
* .1.3.6.1.2.1.2.2.1.5.10128 = Gauge32: 1000
* .1.3.6.1.2.1.2.2.1.5.10129 = Gauge32: 100
* ...
*
* [10127] => 10000000000
* [10128] => 1000000000
* [10129] => 100000000
*
* @return array An array of interface operating speeds
*/
public function highSpeeds()
{
return $this->getSNMP()->walk1d( self::OID_IF_HIGH_SPEED );
}
/**
* Constant for possible value of interface operation status.
* @see operationStates()
*/
const IF_OPER_STATUS_UP = 1;
/**
* Constant for possible value of interface operation status.
* @see operationStates()
*/
const IF_OPER_STATUS_DOWN = 2;
/**
* Constant for possible value of interface operation status.
* @see operationStates()
*/
const IF_OPER_STATUS_TESTING = 3;
/**
* Constant for possible value of interface operation status.
* @see operationStates()
*/
const IF_OPER_STATUS_UNKNOWN = 4;
/**
* Constant for possible value of interface operation status.
* @see operationStates()
*/
const IF_OPER_STATUS_DORMANT = 5;
/**
* Constant for possible value of interface operation status.
* @see operationStates()
*/
const IF_OPER_STATUS_NOT_PRESENT = 6;
/**
* Constant for possible value of interface operation status.
* @see operationStates()
*/
const IF_OPER_STATUS_LOWER_LAYER_DOWN = 7;
/**
* Text representation of interface operating status.
*
* @see operationStates()
* @var array Text representations of interface operating status.
*/
public static $IF_OPER_STATES = array(
self::IF_OPER_STATUS_UP => 'up',
self::IF_OPER_STATUS_DOWN => 'down',
self::IF_OPER_STATUS_TESTING => 'testing',
self::IF_OPER_STATUS_UNKNOWN => 'unknown',
self::IF_OPER_STATUS_DORMANT => 'dormant',
self::IF_OPER_STATUS_NOT_PRESENT => 'notPresent',
self::IF_OPER_STATUS_LOWER_LAYER_DOWN => 'lowerLayerDown'
);
/**
* Get an array of device interface operating status (up / down)
*
* E.g. the follow SNMP output yields the shown array:
*
* .1.3.6.1.2.1.2.2.1.8.10128 = INTEGER: up(1)
* .1.3.6.1.2.1.2.2.1.8.10129 = INTEGER: down(2)
* ...
*
* [10128] => 1
* [10129] => 2
*
* @see IF_OPER_STATES
* @param boolean $translate If true, return the string representation
* @return array An array of interface states
*/
public function operationStates( $translate = false )
{
$states = $this->getSNMP()->walk1d( self::OID_IF_OPER_STATUS );
if( !$translate )
return $states;
return $this->getSNMP()->translate( $states, self::$IF_OPER_STATES );
}
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_OTHER = 1;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_REGULAR1822 = 2;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_HDH1822 = 3;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_DDNX25 = 4;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_RFC877X25 = 5;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ETHERNETCSMACD = 6;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ISO88023CSMACD = 7;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ISO88024TOKENBUS = 8;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ISO88025TOKENRING = 9;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ISO88026MAN = 10;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_STARLAN = 11;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_PROTEON10MBIT = 12;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_PROTEON80MBIT = 13;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_HYPERCHANNEL = 14;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_FDDI = 15;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_LAPB = 16;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_SDLC = 17;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_DS1 = 18;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_E1 = 19;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_BASICISDN = 20;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_PRIMARYISDN = 21;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_PROPPOINTTOPOINTSERIAL = 22;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_PPP = 23;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_SOFTWARELOOPBACK = 24;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_EON = 25;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ETHERNET3MBIT = 26;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_NSIP = 27;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_SLIP = 28;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ULTRA = 29;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_DS3 = 30;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_SIP = 31;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_FRAMERELAY = 32;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_RS232 = 33;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_PARA = 34;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ARCNET = 35;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ARCNETPLUS = 36;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ATM = 37;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_MIOX25 = 38;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_SONET = 39;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_X25PLE = 40;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ISO88022LLC = 41;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_LOCALTALK = 42;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_SMDSDXI = 43;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_FRAMERELAYSERVICE = 44;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_V35 = 45;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_HSSI = 46;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_HIPPI = 47;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_MODEM = 48;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_AAL5 = 49;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_SONETPATH = 50;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_SONETVT = 51;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_SMDSICIP = 52;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_PROPVIRTUAL = 53;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_PROPMULTIPLEXOR = 54;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_IEEE80212 = 55;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_FIBRECHANNEL = 56;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_HIPPIINTERFACE = 57;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_FRAMERELAYINTERCONNECT = 58;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_AFLANE8023 = 59;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_AFLANE8025 = 60;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_CCTEMUL = 61;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_FASTETHER = 62;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ISDN = 63;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_V11 = 64;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_V36 = 65;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_G703AT64K = 66;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_G703AT2MB = 67;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_QLLC = 68;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_FASTETHERFX = 69;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_CHANNEL = 70;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_IEEE80211 = 71;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_IBM370PARCHAN = 72;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ESCON = 73;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_DLSW = 74;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ISDNS = 75;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ISDNU = 76;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_LAPD = 77;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_IPSWITCH = 78;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_RSRB = 79;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ATMLOGICAL = 80;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_DS0 = 81;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_DS0BUNDLE = 82;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_BSC = 83;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ASYNC = 84;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_CNR = 85;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ISO88025DTR = 86;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_EPLRS = 87;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ARAP = 88;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_PROPCNLS = 89;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_HOSTPAD = 90;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_TERMPAD = 91;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_FRAMERELAYMPI = 92;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_X213 = 93;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ADSL = 94;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_RADSL = 95;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_SDSL = 96;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_VDSL = 97;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ISO88025CRFPINT = 98;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_MYRINET = 99;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_VOICEEM = 100;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_VOICEFXO = 101;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_VOICEFXS = 102;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_VOICEENCAP = 103;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_VOICEOVERIP = 104;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ATMDXI = 105;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ATMFUNI = 106;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ATMIMA = 107;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_PPPMULTILINKBUNDLE = 108;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_IPOVERCDLC = 109;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_IPOVERCLAW = 110;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_STACKTOSTACK = 111;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_VIRTUALIPADDRESS = 112;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_MPC = 113;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_IPOVERATM = 114;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ISO88025FIBER = 115;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_TDLC = 116;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_GIGABITETHERNET = 117;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_HDLC = 118;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_LAPF = 119;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_V37 = 120;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_X25MLP = 121;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_X25HUNTGROUP = 122;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_TRASNPHDLC = 123;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_INTERLEAVE = 124;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_FAST = 125;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_IP = 126;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_DOCSCABLEMACLAYER = 127;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_DOCSCABLEDOWNSTREAM = 128;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_DOCSCABLEUPSTREAM = 129;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_A12MPPSWITCH = 130;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_TUNNEL = 131;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_COFFEE = 132;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_CES = 133;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ATMSUBINTERFACE = 134;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_L2VLAN = 135;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_L3IPVLAN = 136;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_L3IPXVLAN = 137;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_DIGITALPOWERLINE = 138;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_MEDIAMAILOVERIP = 139;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_DTM = 140;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_DCN = 141;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_IPFORWARD = 142;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_MSDSL = 143;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_IEEE1394 = 144;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_IF_GSN = 145;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_DVBRCCMACLAYER = 146;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_DVBRCCDOWNSTREAM = 147;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_DVBRCCUPSTREAM = 148;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ATMVIRTUAL = 149;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_MPLSTUNNEL = 150;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_SRP = 151;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_VOICEOVERATM = 152;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_VOICEOVERFRAMERELAY = 153;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_IDSL = 154;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_COMPOSITELINK = 155;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_SS7SIGLINK = 156;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_PROPWIRELESSP2P = 157;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_FRFORWARD = 158;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_RFC1483 = 159;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_USB = 160;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_IEEE8023ADLAG = 161;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_BGPPOLICYACCOUNTING = 162;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_FRF16MFRBUNDLE = 163;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_H323GATEKEEPER = 164;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_H323PROXY = 165;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_MPLS = 166;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_MFSIGLINK = 167;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_HDSL2 = 168;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_SHDSL = 169;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_DS1FDL = 170;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_POS = 171;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_DVBASIIN = 172;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_DVBASIOUT = 173;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_PLC = 174;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_NFAS = 175;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_TR008 = 176;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_GR303RDT = 177;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_GR303IDT = 178;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ISUP = 179;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_PROPDOCSWIRELESSMACLAYER = 180;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_PROPDOCSWIRELESSDOWNSTREAM = 181;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_PROPDOCSWIRELESSUPSTREAM = 182;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_HIPERLAN2 = 183;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_PROPBWAP2MP = 184;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_SONETOVERHEADCHANNEL = 185;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_DIGITALWRAPPEROVERHEADCHANNEL = 186;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_AAL2 = 187;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_RADIOMAC = 188;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ATMRADIO = 189;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_IMT = 190;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_MVL = 191;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_REACHDSL = 192;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_FRDLCIENDPT = 193;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ATMVCIENDPT = 194;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_OPTICALCHANNEL = 195;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_OPTICALTRANSPORT = 196;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_PROPATM = 197;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_VOICEOVERCABLE = 198;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_INFINIBAND = 199;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_TELINK = 200;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_Q2931 = 201;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_VIRTUALTG = 202;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_SIPTG = 203;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_SIPSIG = 204;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_DOCSCABLEUPSTREAMCHANNEL = 205;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ECONET = 206;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_PON155 = 207;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_PON622 = 208;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_BRIDGE = 209;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_LINEGROUP = 210;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_VOICEEMFGD = 211;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_VOICEFGDEANA = 212;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_VOICEDID = 213;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_MPEGTRANSPORT = 214;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_SIXTOFOUR = 215;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_GTP = 216;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_PDNETHERLOOP1 = 217;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_PDNETHERLOOP2 = 218;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_OPTICALCHANNELGROUP = 219;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_HOMEPNA = 220;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_GFP = 221;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_CISCOISLVLAN = 222;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ACTELISMETALOOP = 223;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_FCIPLINK = 224;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_RPR = 225;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_QAM = 226;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_LMP = 227;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_CBLVECTASTAR = 228;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_DOCSCABLEMCMTSDOWNSTREAM = 229;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ADSL2 = 230;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_MACSECCONTROLLEDIF = 231;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_MACSECUNCONTROLLEDIF = 232;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_AVICIOPTICALETHER = 233;
/**
* Constant for possible type of an interface
* @see types()
*/
const IF_TYPE_ATMBOND = 234;
/**
* Text representation of interface types.
*
* @see types()
* @var array Text representations of interface types.
*/
public static $IF_TYPES = array(
self::IF_TYPE_OTHER => 'other',
self::IF_TYPE_REGULAR1822 => 'regular1822',
self::IF_TYPE_HDH1822 => 'hdh1822',
self::IF_TYPE_DDNX25 => 'ddnX25',
self::IF_TYPE_RFC877X25 => 'rfc877x25',
self::IF_TYPE_ETHERNETCSMACD => 'ethernetCsmacd',
self::IF_TYPE_ISO88023CSMACD => 'iso88023Csmacd',
self::IF_TYPE_ISO88024TOKENBUS => 'iso88024TokenBus',
self::IF_TYPE_ISO88025TOKENRING => 'iso88025TokenRing',
self::IF_TYPE_ISO88026MAN => 'iso88026Man',
self::IF_TYPE_STARLAN => 'starLan',
self::IF_TYPE_PROTEON10MBIT => 'proteon10Mbit',
self::IF_TYPE_PROTEON80MBIT => 'proteon80Mbit',
self::IF_TYPE_HYPERCHANNEL => 'hyperchannel',
self::IF_TYPE_FDDI => 'fddi',
self::IF_TYPE_LAPB => 'lapb',
self::IF_TYPE_SDLC => 'sdlc',
self::IF_TYPE_DS1 => 'ds1',
self::IF_TYPE_E1 => 'e1',
self::IF_TYPE_BASICISDN => 'basicISDN',
self::IF_TYPE_PRIMARYISDN => 'primaryISDN',
self::IF_TYPE_PROPPOINTTOPOINTSERIAL => 'propPointToPointSerial',
self::IF_TYPE_PPP => 'ppp',
self::IF_TYPE_SOFTWARELOOPBACK => 'softwareLoopback',
self::IF_TYPE_EON => 'eon',
self::IF_TYPE_ETHERNET3MBIT => 'ethernet3Mbit',
self::IF_TYPE_NSIP => 'nsip',
self::IF_TYPE_SLIP => 'slip',
self::IF_TYPE_ULTRA => 'ultra',
self::IF_TYPE_DS3 => 'ds3',
self::IF_TYPE_SIP => 'sip',
self::IF_TYPE_FRAMERELAY => 'frameRelay',
self::IF_TYPE_RS232 => 'rs232',
self::IF_TYPE_PARA => 'para',
self::IF_TYPE_ARCNET => 'arcnet',
self::IF_TYPE_ARCNETPLUS => 'arcnetPlus',
self::IF_TYPE_ATM => 'atm',
self::IF_TYPE_MIOX25 => 'miox25',
self::IF_TYPE_SONET => 'sonet',
self::IF_TYPE_X25PLE => 'x25ple',
self::IF_TYPE_ISO88022LLC => 'iso88022llc',
self::IF_TYPE_LOCALTALK => 'localTalk',
self::IF_TYPE_SMDSDXI => 'smdsDxi',
self::IF_TYPE_FRAMERELAYSERVICE => 'frameRelayService',
self::IF_TYPE_V35 => 'v35',
self::IF_TYPE_HSSI => 'hssi',
self::IF_TYPE_HIPPI => 'hippi',
self::IF_TYPE_MODEM => 'modem',
self::IF_TYPE_AAL5 => 'aal5',
self::IF_TYPE_SONETPATH => 'sonetPath',
self::IF_TYPE_SONETVT => 'sonetVT',
self::IF_TYPE_SMDSICIP => 'smdsIcip',
self::IF_TYPE_PROPVIRTUAL => 'propVirtual',
self::IF_TYPE_PROPMULTIPLEXOR => 'propMultiplexor',
self::IF_TYPE_IEEE80212 => 'ieee80212',
self::IF_TYPE_FIBRECHANNEL => 'fibreChannel',
self::IF_TYPE_HIPPIINTERFACE => 'hippiInterface',
self::IF_TYPE_FRAMERELAYINTERCONNECT => 'frameRelayInterconnect',
self::IF_TYPE_AFLANE8023 => 'aflane8023',
self::IF_TYPE_AFLANE8025 => 'aflane8025',
self::IF_TYPE_CCTEMUL => 'cctEmul',
self::IF_TYPE_FASTETHER => 'fastEther',
self::IF_TYPE_ISDN => 'isdn',
self::IF_TYPE_V11 => 'v11',
self::IF_TYPE_V36 => 'v36',
self::IF_TYPE_G703AT64K => 'g703at64k',
self::IF_TYPE_G703AT2MB => 'g703at2mb',
self::IF_TYPE_QLLC => 'qllc',
self::IF_TYPE_FASTETHERFX => 'fastEtherFX',
self::IF_TYPE_CHANNEL => 'channel',
self::IF_TYPE_IEEE80211 => 'ieee80211',
self::IF_TYPE_IBM370PARCHAN => 'ibm370parChan',
self::IF_TYPE_ESCON => 'escon',
self::IF_TYPE_DLSW => 'dlsw',
self::IF_TYPE_ISDNS => 'isdns',
self::IF_TYPE_ISDNU => 'isdnu',
self::IF_TYPE_LAPD => 'lapd',
self::IF_TYPE_IPSWITCH => 'ipSwitch',
self::IF_TYPE_RSRB => 'rsrb',
self::IF_TYPE_ATMLOGICAL => 'atmLogical',
self::IF_TYPE_DS0 => 'ds0',
self::IF_TYPE_DS0BUNDLE => 'ds0Bundle',
self::IF_TYPE_BSC => 'bsc',
self::IF_TYPE_ASYNC => 'async',
self::IF_TYPE_CNR => 'cnr',
self::IF_TYPE_ISO88025DTR => 'iso88025Dtr',
self::IF_TYPE_EPLRS => 'eplrs',
self::IF_TYPE_ARAP => 'arap',
self::IF_TYPE_PROPCNLS => 'propCnls',
self::IF_TYPE_HOSTPAD => 'hostPad',
self::IF_TYPE_TERMPAD => 'termPad',
self::IF_TYPE_FRAMERELAYMPI => 'frameRelayMPI',
self::IF_TYPE_X213 => 'x213',
self::IF_TYPE_ADSL => 'adsl',
self::IF_TYPE_RADSL => 'radsl',
self::IF_TYPE_SDSL => 'sdsl',
self::IF_TYPE_VDSL => 'vdsl',
self::IF_TYPE_ISO88025CRFPINT => 'iso88025CRFPInt',
self::IF_TYPE_MYRINET => 'myrinet',
self::IF_TYPE_VOICEEM => 'voiceEM',
self::IF_TYPE_VOICEFXO => 'voiceFXO',
self::IF_TYPE_VOICEFXS => 'voiceFXS',
self::IF_TYPE_VOICEENCAP => 'voiceEncap',
self::IF_TYPE_VOICEOVERIP => 'voiceOverIp',
self::IF_TYPE_ATMDXI => 'atmDxi',
self::IF_TYPE_ATMFUNI => 'atmFuni',
self::IF_TYPE_ATMIMA => 'atmIma',
self::IF_TYPE_PPPMULTILINKBUNDLE => 'pppMultilinkBundle',
self::IF_TYPE_IPOVERCDLC => 'ipOverCdlc',
self::IF_TYPE_IPOVERCLAW => 'ipOverClaw',
self::IF_TYPE_STACKTOSTACK => 'stackToStack',
self::IF_TYPE_VIRTUALIPADDRESS => 'virtualIpAddress',
self::IF_TYPE_MPC => 'mpc',
self::IF_TYPE_IPOVERATM => 'ipOverAtm',
self::IF_TYPE_ISO88025FIBER => 'iso88025Fiber',
self::IF_TYPE_TDLC => 'tdlc',
self::IF_TYPE_GIGABITETHERNET => 'gigabitEthernet',
self::IF_TYPE_HDLC => 'hdlc',
self::IF_TYPE_LAPF => 'lapf',
self::IF_TYPE_V37 => 'v37',
self::IF_TYPE_X25MLP => 'x25mlp',
self::IF_TYPE_X25HUNTGROUP => 'x25huntGroup',
self::IF_TYPE_TRASNPHDLC => 'trasnpHdlc',
self::IF_TYPE_INTERLEAVE => 'interleave',
self::IF_TYPE_FAST => 'fast',
self::IF_TYPE_IP => 'ip',
self::IF_TYPE_DOCSCABLEMACLAYER => 'docsCableMaclayer',
self::IF_TYPE_DOCSCABLEDOWNSTREAM => 'docsCableDownstream',
self::IF_TYPE_DOCSCABLEUPSTREAM => 'docsCableUpstream',
self::IF_TYPE_A12MPPSWITCH => 'a12MppSwitch',
self::IF_TYPE_TUNNEL => 'tunnel',
self::IF_TYPE_COFFEE => 'coffee',
self::IF_TYPE_CES => 'ces',
self::IF_TYPE_ATMSUBINTERFACE => 'atmSubInterface',
self::IF_TYPE_L2VLAN => 'l2vlan',
self::IF_TYPE_L3IPVLAN => 'l3ipvlan',
self::IF_TYPE_L3IPXVLAN => 'l3ipxvlan',
self::IF_TYPE_DIGITALPOWERLINE => 'digitalPowerline',
self::IF_TYPE_MEDIAMAILOVERIP => 'mediaMailOverIp',
self::IF_TYPE_DTM => 'dtm',
self::IF_TYPE_DCN => 'dcn',
self::IF_TYPE_IPFORWARD => 'ipForward',
self::IF_TYPE_MSDSL => 'msdsl',
self::IF_TYPE_IEEE1394 => 'ieee1394',
self::IF_TYPE_IF_GSN => 'if-gsn',
self::IF_TYPE_DVBRCCMACLAYER => 'dvbRccMacLayer',
self::IF_TYPE_DVBRCCDOWNSTREAM => 'dvbRccDownstream',
self::IF_TYPE_DVBRCCUPSTREAM => 'dvbRccUpstream',
self::IF_TYPE_ATMVIRTUAL => 'atmVirtual',
self::IF_TYPE_MPLSTUNNEL => 'mplsTunnel',
self::IF_TYPE_SRP => 'srp',
self::IF_TYPE_VOICEOVERATM => 'voiceOverAtm',
self::IF_TYPE_VOICEOVERFRAMERELAY => 'voiceOverFrameRelay',
self::IF_TYPE_IDSL => 'idsl',
self::IF_TYPE_COMPOSITELINK => 'compositeLink',
self::IF_TYPE_SS7SIGLINK => 'ss7SigLink',
self::IF_TYPE_PROPWIRELESSP2P => 'propWirelessP2P',
self::IF_TYPE_FRFORWARD => 'frForward',
self::IF_TYPE_RFC1483 => 'rfc1483',
self::IF_TYPE_USB => 'usb',
self::IF_TYPE_IEEE8023ADLAG => 'ieee8023adLag',
self::IF_TYPE_BGPPOLICYACCOUNTING => 'bgppolicyaccounting',
self::IF_TYPE_FRF16MFRBUNDLE => 'frf16MfrBundle',
self::IF_TYPE_H323GATEKEEPER => 'h323Gatekeeper',
self::IF_TYPE_H323PROXY => 'h323Proxy',
self::IF_TYPE_MPLS => 'mpls',
self::IF_TYPE_MFSIGLINK => 'mfSigLink',
self::IF_TYPE_HDSL2 => 'hdsl2',
self::IF_TYPE_SHDSL => 'shdsl',
self::IF_TYPE_DS1FDL => 'ds1FDL',
self::IF_TYPE_POS => 'pos',
self::IF_TYPE_DVBASIIN => 'dvbAsiIn',
self::IF_TYPE_DVBASIOUT => 'dvbAsiOut',
self::IF_TYPE_PLC => 'plc',
self::IF_TYPE_NFAS => 'nfas',
self::IF_TYPE_TR008 => 'tr008',
self::IF_TYPE_GR303RDT => 'gr303RDT',
self::IF_TYPE_GR303IDT => 'gr303IDT',
self::IF_TYPE_ISUP => 'isup',
self::IF_TYPE_PROPDOCSWIRELESSMACLAYER => 'propDocsWirelessMaclayer',
self::IF_TYPE_PROPDOCSWIRELESSDOWNSTREAM => 'propDocsWirelessDownstream',
self::IF_TYPE_PROPDOCSWIRELESSUPSTREAM => 'propDocsWirelessUpstream',
self::IF_TYPE_HIPERLAN2 => 'hiperlan2',
self::IF_TYPE_PROPBWAP2MP => 'propBWAp2Mp',
self::IF_TYPE_SONETOVERHEADCHANNEL => 'sonetOverheadChannel',
self::IF_TYPE_DIGITALWRAPPEROVERHEADCHANNEL => 'digitalWrapperOverheadChannel',
self::IF_TYPE_AAL2 => 'aal2',
self::IF_TYPE_RADIOMAC => 'radioMAC',
self::IF_TYPE_ATMRADIO => 'atmRadio',
self::IF_TYPE_IMT => 'imt',
self::IF_TYPE_MVL => 'mvl',
self::IF_TYPE_REACHDSL => 'reachDSL',
self::IF_TYPE_FRDLCIENDPT => 'frDlciEndPt',
self::IF_TYPE_ATMVCIENDPT => 'atmVciEndPt',
self::IF_TYPE_OPTICALCHANNEL => 'opticalChannel',
self::IF_TYPE_OPTICALTRANSPORT => 'opticalTransport',
self::IF_TYPE_PROPATM => 'propAtm',
self::IF_TYPE_VOICEOVERCABLE => 'voiceOverCable',
self::IF_TYPE_INFINIBAND => 'infiniband',
self::IF_TYPE_TELINK => 'teLink',
self::IF_TYPE_Q2931 => 'q2931',
self::IF_TYPE_VIRTUALTG => 'virtualTg',
self::IF_TYPE_SIPTG => 'sipTg',
self::IF_TYPE_SIPSIG => 'sipSig',
self::IF_TYPE_DOCSCABLEUPSTREAMCHANNEL => 'docsCableUpstreamChannel',
self::IF_TYPE_ECONET => 'econet',
self::IF_TYPE_PON155 => 'pon155',
self::IF_TYPE_PON622 => 'pon622',
self::IF_TYPE_BRIDGE => 'bridge',
self::IF_TYPE_LINEGROUP => 'linegroup',
self::IF_TYPE_VOICEEMFGD => 'voiceEMFGD',
self::IF_TYPE_VOICEFGDEANA => 'voiceFGDEANA',
self::IF_TYPE_VOICEDID => 'voiceDID',
self::IF_TYPE_MPEGTRANSPORT => 'mpegTransport',
self::IF_TYPE_SIXTOFOUR => 'sixToFour',
self::IF_TYPE_GTP => 'gtp',
self::IF_TYPE_PDNETHERLOOP1 => 'pdnEtherLoop1',
self::IF_TYPE_PDNETHERLOOP2 => 'pdnEtherLoop2',
self::IF_TYPE_OPTICALCHANNELGROUP => 'opticalChannelGroup',
self::IF_TYPE_HOMEPNA => 'homepna',
self::IF_TYPE_GFP => 'gfp',
self::IF_TYPE_CISCOISLVLAN => 'ciscoISLvlan',
self::IF_TYPE_ACTELISMETALOOP => 'actelisMetaLOOP',
self::IF_TYPE_FCIPLINK => 'fcipLink',
self::IF_TYPE_RPR => 'rpr',
self::IF_TYPE_QAM => 'qam',
self::IF_TYPE_LMP => 'lmp',
self::IF_TYPE_CBLVECTASTAR => 'cblVectaStar',
self::IF_TYPE_DOCSCABLEMCMTSDOWNSTREAM => 'docsCableMCmtsDownstream',
self::IF_TYPE_ADSL2 => 'adsl2',
self::IF_TYPE_MACSECCONTROLLEDIF => 'macSecControlledIF',
self::IF_TYPE_MACSECUNCONTROLLEDIF => 'macSecUncontrolledIF',
self::IF_TYPE_AVICIOPTICALETHER => 'aviciOpticalEther',
self::IF_TYPE_ATMBOND => 'atmbond'
);
/**
* Get an array of device interface types
*
* @see $IF_TYPES
* @param boolean $translate If true, return the string representation
* @return array An array of interface types
*/
public function types( $translate = false )
{
$types = $this->getSNMP()->walk1d( self::OID_IF_TYPE );
if( !$translate )
return $types;
return $this->getSNMP()->translate( $types, self::$IF_TYPES );
}
/**
* Returns an associate array of STP port IDs (key) to interface IDs (value)
*
* e.g. [22] => 10122
*
*
* @return array Associate array of STP port IDs (key) to interface IDs (value)
*/
public function bridgeBasePortIfIndexes()
{
return $this->getSNMP()->walk1d( self::OID_BRIDGE_BASE_PORT_IF_INDEX );
}
}
| {
"pile_set_name": "Github"
} |
angular.module('uiRouterSample.contacts.service', [
])
// A RESTful factory for retrieving contacts from 'contacts.json'
.factory('contacts', ['$http', 'utils', function ($http, utils) {
var path = 'assets/contacts.json';
var contacts = $http.get(path).then(function (resp) {
return resp.data.contacts;
});
var factory = {};
factory.all = function () {
return contacts;
};
factory.get = function (id) {
return contacts.then(function(){
return utils.findById(contacts, id);
})
};
return factory;
}]);
| {
"pile_set_name": "Github"
} |
End of preview. Expand
in Dataset Viewer.
README.md exists but content is empty.
Use the Edit dataset card button to edit it.
- Downloads last month
- 35