answer
stringlengths 15
1.25M
|
|---|
;(function() {
var DeferredAPI = {
deferred: deferred,
all: all,
Deferred: Deferred,
DeferredList: DeferredList,
wrapResult: wrapResult,
wrapFailure: wrapFailure,
Failure: Failure
}
// CommonJS module support
if (typeof module !== 'undefined') {
var DeferredURLRequest = require('./DeferredURLRequest')
for (var k in DeferredURLRequest) {
DeferredAPI[k] = DeferredURLRequest[k]
}
module.exports = DeferredAPI
}
// Browser API
else if (typeof window !== 'undefined') {
window.deferred = DeferredAPI
}
// Fake out console if necessary
if (typeof console === 'undefined') {
var global = function() { return this || (1,eval)('this') }
;(function() {
var noop = function(){}
global().console = { log: noop, warn: noop, error: noop, dir: noop }
}())
}
function wrapResult(result) {
return new Deferred().resolve(result)
}
function wrapFailure(error) {
return new Deferred().reject(error)
}
function Failure(v) { this.value = v }
// Crockford style constructor
function deferred(t) { return new Deferred(t) }
function Deferred(canceller) {
this.called = false
this.running = false
this.result = null
this.pauseCount = 0
this.callbacks = []
this.verbose = false
this._canceller = canceller
// If this Deferred is cancelled and the creator of this Deferred
// didn't cancel it, then they may not know about the cancellation and
// try to resolve or reject it as well. This flag causes the
// "already called" error that resolve() or reject() normally throws
// to be suppressed once.
this.<API key> = false
}
if (typeof Object.defineProperty === 'function') {
var <API key> = true
Object.defineProperty(Deferred, '<API key>', {
enumerable: false,
set: function(v) { <API key> = v },
get: function() { return <API key> }
})
} else {
Deferred.<API key> = true
}
Deferred.prototype.cancel = function() {
if (!this.called) {
if (typeof this._canceller === 'function') {
this._canceller(this)
} else {
this.<API key> = true
}
if (!this.called) {
this.reject('cancelled')
}
} else if (this.result instanceof Deferred) {
this.result.cancel()
}
}
Deferred.prototype.then = function(callback, errback) {
this.callbacks.push({callback: callback, errback: errback})
if (this.called) _run(this)
return this
}
Deferred.prototype.fail = function(errback) {
this.callbacks.push({callback: null, errback: errback})
if (this.called) _run(this)
return this
}
Deferred.prototype.both = function(callback) {
return this.then(callback, callback)
}
Deferred.prototype.resolve = function(result) {
_startRun(this, result)
return this
}
Deferred.prototype.reject = function(err) {
if (!(err instanceof Failure)) {
err = new Failure(err)
}
_startRun(this, err)
return this
}
Deferred.prototype.pause = function() {
this.pauseCount += 1
if (this.extra) {
console.log('Deferred.pause ' + this.pauseCount + ': ' + this.extra)
}
return this
}
Deferred.prototype.unpause = function() {
this.pauseCount -= 1
if (this.extra) {
console.log('Deferred.unpause ' + this.pauseCount + ': ' + this.extra)
}
if (this.pauseCount <= 0 && this.called) {
_run(this)
}
return this
}
// For debugging
Deferred.prototype.inspect = function(extra, cb) {
this.extra = extra
var self = this
return this.then(function(r) {
console.log('Deferred.inspect resolved: ' + self.extra)
console.dir(r)
return r
}, function(e) {
console.log('Deferred.inspect rejected: ' + self.extra)
console.dir(e)
return e
})
}
A couple of sugary methods
Deferred.prototype.thenReturn = function(result) {
return this.then(function(_) { return result })
}
Deferred.prototype.thenCall = function(f) {
return this.then(function(result) {
f(result)
return result
})
}
Deferred.prototype.failReturn = function(result) {
return this.fail(function(_) { return result })
}
Deferred.prototype.failCall = function(f) {
return this.fail(function(result) {
f(result)
return result
})
}
function _continue(d, newResult) {
d.result = newResult
d.unpause()
return d.result
}
function _nest(outer) {
outer.result.both(function(newResult) {
return _continue(outer, newResult)
})
}
function _startRun(d, result) {
if (d.called) {
if (d.<API key>) {
d.<API key> = false
return
}
throw new Error("Already resolved Deferred: " + d)
}
d.called = true
d.result = result
if (d.result instanceof Deferred) {
d.pause()
_nest(d)
return
}
_run(d)
}
function _run(d) {
if (d.running) return
var link, status, fn
if (d.pauseCount > 0) return
while (d.callbacks.length > 0) {
link = d.callbacks.shift()
status = (d.result instanceof Failure) ? 'errback' : 'callback'
fn = link[status]
if (typeof fn !== 'function') continue
try {
d.running = true
d.result = fn(d.result)
d.running = false
if (d.result instanceof Deferred) {
d.pause()
_nest(d)
return
}
} catch (e) {
if (Deferred.<API key>) {
d.running = false
var f = new Failure(e)
f.source = f.source || status
d.result = f
if (d.verbose) {
console.warn('uncaught error in deferred ' + status + ': ' + e.message)
console.warn('Stack: ' + e.stack)
}
} else {
throw e
}
}
}
}
DeferredList / all
function all(ds, opts) { return new DeferredList(ds, opts) }
function DeferredList(ds, opts) {
opts = opts || {}
Deferred.call(this)
this._deferreds = ds
this._finished = 0
this._length = ds.length
this._results = []
this._fireOnFirstResult = opts.fireOnFirstResult
this._fireOnFirstError = opts.fireOnFirstError
this._consumeErrors = opts.consumeErrors
this.<API key> = opts.<API key>
if (this._length === 0 && !this._fireOnFirstResult) {
this.resolve(this._results)
}
for (var i = 0, n = this._length; i < n; ++i) {
ds[i].both(<API key>(this, i))
}
}
if (typeof Object.create === 'function') {
DeferredList.prototype = Object.create(Deferred.prototype, {
constructor: { value: DeferredList, enumerable: false }
})
} else {
DeferredList.prototype = new Deferred()
DeferredList.prototype.constructor = DeferredList
}
DeferredList.prototype.<API key> = function() {
this.<API key> = true
}
var _deferredCancel = Deferred.prototype.cancel
DeferredList.prototype.cancel = function() {
_deferredCancel.call(this)
if (this.<API key>) {
for (var i = 0; i < this._length; ++i) {
this._deferreds[i].cancel()
}
}
}
function <API key>(d, i) {
return function(result) {
var isErr = result instanceof Failure
, myResult = (isErr && d._consumeErrors) ? null : result
// Support nesting
if (result instanceof Deferred) {
result.both(<API key>(d, i))
return
}
d._results[i] = myResult
d._finished += 1
if (!d.called) {
if (d._fireOnFirstResult && !isErr) {
d.resolve(result)
} else if (d._fireOnFirstError && isErr) {
d.reject(result)
} else if (d._finished === d._length) {
d.resolve(d._results)
}
}
return myResult
}
}
}())
|
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects;
namespace osu.Game.Tests.Visual
{
public abstract class ModPerfectTestScene : ModTestScene
{
private readonly Ruleset ruleset;
private readonly ModPerfect mod;
protected ModPerfectTestScene(Ruleset ruleset, ModPerfect mod)
: base(ruleset)
{
this.ruleset = ruleset;
this.mod = mod;
}
protected void CreateHitObjectTest(HitObjectTestData testData, bool shouldMiss) => CreateModTest(new ModTestData
{
Mod = mod,
Beatmap = new Beatmap
{
BeatmapInfo = { Ruleset = ruleset.RulesetInfo },
HitObjects = { testData.HitObject }
},
Autoplay = !shouldMiss,
PassCondition = () => ((<API key>)Player).CheckFailed(shouldMiss && testData.FailOnMiss)
});
protected override TestPlayer CreateModPlayer(Ruleset ruleset) => new <API key>();
private class <API key> : TestPlayer
{
public <API key>()
: base(showResults: false)
{
}
protected override bool AllowFail => true;
public bool CheckFailed(bool failed)
{
if (!failed)
return ScoreProcessor.HasCompleted && !HealthProcessor.HasFailed;
return HealthProcessor.HasFailed;
}
}
protected class HitObjectTestData
{
public readonly HitObject HitObject;
public readonly bool FailOnMiss;
public HitObjectTestData(HitObject hitObject, bool failOnMiss = true)
{
HitObject = hitObject;
FailOnMiss = failOnMiss;
}
}
}
}
|
'use strict';
var request = require('request');
var querystring = require('querystring');
var FirebaseError = require('./error');
var RSVP = require('rsvp');
var _ = require('lodash');
var logger = require('./logger');
var utils = require('./utils');
var responseToError = require('./responseToError');
var refreshToken;
var commandScopes;
var scopes = require('./scopes');
var CLI_VERSION = require('../package.json').version;
var _request = function(options) {
logger.debug('>>> HTTP REQUEST',
options.method,
options.url,
options.body || options.form || ''
);
return new RSVP.Promise(function(resolve, reject) {
var req = request(options, function(err, response, body) {
if (err) {
return reject(new FirebaseError('Server Error. ' + err.message, {
original: err,
exit: 2
}));
}
logger.debug('<<< HTTP RESPONSE', response.statusCode, response.headers);
if (response.statusCode >= 400) {
logger.debug('<<< HTTP RESPONSE BODY', response.body);
if (!options.resolveOnHTTPError) {
return reject(responseToError(response, body, options));
}
}
return resolve({
status: response.statusCode,
response: response,
body: body
});
});
if (_.size(options.files) > 0) {
var form = req.form();
_.forEach(options.files, function(details, param) {
form.append(param, details.stream, {
knownLength: details.knownLength,
filename: details.filename,
contentType: details.contentType
});
});
}
});
};
var _appendQueryData = function(path, data) {
if (data && _.size(data) > 0) {
path += _.includes(path, '?') ? '&' : '?';
path += querystring.stringify(data);
}
return path;
};
var api = {
// "In this context, the client secret is obviously not treated as a secret"
billingOrigin: utils.envOverride('<API key>', 'https://cloudbilling.googleapis.com'),
clientId: utils.envOverride('FIREBASE_CLIENT_ID', '<API key>.apps.googleusercontent.com'),
clientSecret: utils.envOverride('<API key>', '<API key>'),
cloudloggingOrigin: utils.envOverride('<API key>', 'https://logging.googleapis.com'),
adminOrigin: utils.envOverride('FIREBASE_ADMIN_URL', 'https://admin.firebase.com'),
apikeysOrigin: utils.envOverride('<API key>', 'https://apikeys.googleapis.com'),
appengineOrigin: utils.envOverride('<API key>', 'https://appengine.googleapis.com'),
authOrigin: utils.envOverride('FIREBASE_AUTH_URL', 'https://accounts.google.com'),
consoleOrigin: utils.envOverride('<API key>', 'https://console.firebase.google.com'),
deployOrigin: utils.envOverride('FIREBASE_DEPLOY_URL', utils.envOverride('FIREBASE_UPLOAD_URL', 'https://deploy.firebase.com')),
functionsOrigin: utils.envOverride('<API key>', 'https://cloudfunctions.googleapis.com'),
googleOrigin: utils.envOverride('FIREBASE_TOKEN_URL', utils.envOverride('FIREBASE_GOOGLE_URL', 'https:
hostingOrigin: utils.envOverride('<API key>', 'https://firebaseapp.com'),
realtimeOrigin: utils.envOverride('<API key>', 'https://firebaseio.com'),
rulesOrigin: utils.envOverride('FIREBASE_RULES_URL', 'https://firebaserules.googleapis.com'),
runtimeconfigOrigin: utils.envOverride('<API key>', 'https://runtimeconfig.googleapis.com'),
setToken: function(token) {
refreshToken = token;
},
setScopes: function(s) {
commandScopes = _.uniq(_.flatten([
scopes.EMAIL,
scopes.OPENID,
scopes.<API key>,
scopes.FIREBASE_PLATFORM
].concat(s || [])));
logger.debug('> command requires scopes:', JSON.stringify(commandScopes));
},
getAccessToken: function() {
return require('./auth').getAccessToken(refreshToken, commandScopes);
},
addRequestHeaders: function(reqOptions) {
// Runtime fetch of Auth singleton to prevent circular module dependencies
_.set(reqOptions, ['headers', 'User-Agent'], 'FirebaseCLI/' + CLI_VERSION);
var auth = require('../lib/auth');
return auth.getAccessToken(refreshToken, commandScopes).then(function(result) {
_.set(reqOptions, 'headers.authorization', 'Bearer ' + result.access_token);
return reqOptions;
});
},
request: function(method, resource, options) {
options = _.extend({
data: {},
origin: api.adminOrigin, // default to hitting the admin backend
resolveOnHTTPError: false, // by default, status codes >= 400 leads to reject
json: true
}, options);
var validMethods = ['GET', 'PUT', 'POST', 'DELETE', 'PATCH'];
if (validMethods.indexOf(method) < 0) {
method = 'GET';
}
var reqOptions = {
method: method
};
if (options.query) {
resource = _appendQueryData(resource, options.query);
}
if (method === 'GET') {
resource = _appendQueryData(resource, options.data);
} else {
if (_.size(options.data) > 0) {
reqOptions.body = options.data;
} else if (_.size(options.form) > 0) {
reqOptions.form = options.form;
}
}
reqOptions.url = options.origin + resource;
reqOptions.files = options.files;
reqOptions.resolveOnHTTPError = options.resolveOnHTTPError;
reqOptions.json = options.json;
if (options.auth === true) {
return api.addRequestHeaders(reqOptions).then(function(reqOptionsWithToken) {
return _request(reqOptionsWithToken);
});
}
return _request(reqOptions);
},
getProject: function(projectId) {
return api.request('GET', '/v1/projects/' + encodeURIComponent(projectId), {
auth: true
}).then(function(res) {
if (res.body && !res.body.error) {
return res.body;
}
return RSVP.reject(new FirebaseError('Server Error: Unexpected Response. Please try again', {
context: res,
exit: 2
}));
});
},
getProjects: function() {
return api.request('GET', '/v1/projects', {
auth: true
}).then(function(res) {
if (res.body && res.body.projects) {
return res.body.projects;
}
return RSVP.reject(new FirebaseError('Server Error: Unexpected Response. Please try again', {
context: res,
exit: 2
}));
});
}
};
module.exports = api;
|
"use strict";
/**
* Module dependencies.
*/
var should = require('should');
var http = require('http');
var querystring = require('querystring');
var fs = require('fs');
var zlib = require('zlib');
var iconv = require('iconv-lite');
var server = http.createServer(function (req, res) {
// req.headers['user-agent'].should.match(/^node\-urllib\/\d+\.\d+\.\d+ node\//);
var chunks = [];
var size = 0;
req.on('data', function (buf) {
chunks.push(buf);
size += buf.length;
});
req.on('end', function () {
if (req.url === '/timeout') {
return setTimeout(function () {
res.end('timeout 500ms');
}, 500);
} else if (req.url === '/response_timeout') {
res.write('foo');
return setTimeout(function () {
res.end('timeout 700ms');
}, 700);
} else if (req.url === '/error') {
return res.destroy();
} else if (req.url === '/socket.destroy') {
res.write('foo haha\n');
setTimeout(function () {
res.write('foo haha 2');
setTimeout(function () {
res.destroy();
}, 300);
}, 200);
return;
} else if (req.url === '/socket.end') {
res.write('foo haha\n');
setTimeout(function () {
res.write('foo haha 2');
setTimeout(function () {
// res.end();
res.socket.end();
// res.socket.end('foosdfsdf');
}, 300);
}, 200);
return;
} else if (req.url === '/socket.end.error') {
res.write('foo haha\n');
setTimeout(function () {
res.write('foo haha 2');
setTimeout(function () {
res.socket.end('balabala');
}, 300);
}, 200);
return;
} else if (req.url === '/302') {
res.statusCode = 302;
res.setHeader('Location', '/204');
return res.end('Redirect to /204');
} else if (req.url === '/301') {
res.statusCode = 301;
res.setHeader('Location', '/204');
return res.end('I am 301 body');
} else if (req.url === '/303') {
res.statusCode = 303;
res.setHeader('Location', '/204');
return res.end('Redirect to /204');
} else if (req.url === '/307') {
res.statusCode = 307;
res.setHeader('Location', '/204');
return res.end('I am 307 body');
} else if (req.url === '/<API key>') {
res.statusCode = 302;
return res.end('I am 302 body');
} else if (req.url === '/204') {
res.statusCode = 204;
return res.end();
} else if (req.url === '/loop_redirect') {
res.statusCode = 302;
res.setHeader('Location', '/loop_redirect');
return res.end('Redirect to /loop_redirect');
} else if (req.url === '/post') {
res.setHeader('<API key>', req.headers['content-type'] || '');
res.writeHeader(200);
return res.end(Buffer.concat(chunks));
} else if (req.url.indexOf('/get') === 0) {
res.writeHeader(200);
return res.end(req.url);
} else if (req.url === '/wrongjson') {
res.writeHeader(200);
return res.end(new Buffer('{"foo":""'));
} else if (req.url === '/wrongjson-gbk') {
res.setHeader('content-type', 'application/json; charset=gbk');
res.writeHeader(200);
return res.end(fs.readFileSync(__filename));
} else if (req.url === '/writestream') {
var s = fs.createReadStream(__filename);
return s.pipe(res);
} else if (req.url === '/auth') {
var auth = new Buffer(req.headers.authorization.split(' ')[1], 'base64').toString().split(':');
res.writeHeader(200);
return res.end(JSON.stringify({user: auth[0], password: auth[1]}));
} else if (req.url === '/stream') {
res.writeHeader(200, {
'Content-Length': String(size)
});
for (var i = 0; i < chunks.length; i++) {
res.write(chunks[i]);
}
res.end();
return;
} else if (req.url.indexOf('/json_mirror') === 0) {
res.setHeader('Content-Type', req.headers['content-type'] || 'application/json');
if (req.method === 'GET') {
res.end(JSON.stringify({
url: req.url,
data: Buffer.concat(chunks).toString(),
}));
} else {
res.end(JSON.stringify(JSON.parse(Buffer.concat(chunks))));
}
return;
} else if (req.url.indexOf('/no-gzip') === 0) {
fs.createReadStream(__filename).pipe(res);
return;
} else if (req.url.indexOf('/gzip') === 0) {
res.setHeader('Content-Encoding', 'gzip');
fs.createReadStream(__filename).pipe(zlib.createGzip()).pipe(res);
return;
} else if (req.url === '/ua') {
res.end(JSON.stringify(req.headers));
return;
} else if (req.url === '/gbk/json') {
res.setHeader('Content-Type', 'application/json;charset=gbk');
var content = iconv.encode(JSON.stringify({hello: ''}), 'gbk');
return res.end(content);
} else if (req.url === '/gbk/text') {
res.setHeader('Content-Type', 'text/plain;charset=gbk');
var content = iconv.encode('', 'gbk');
return res.end(content);
} else if (req.url === '/errorcharset') {
res.setHeader('Content-Type', 'text/plain;charset=notfound');
return res.end('');
}
var url = req.url.split('?');
var get = querystring.parse(url[1]);
var ret;
if (chunks.length > 0) {
ret = Buffer.concat(chunks).toString();
} else {
ret = '<html><head><meta http-equiv="Content-Type" content="text/html;charset=##{charset}##">...</html>';
}
chunks = [];
res.writeHead(get.code ? get.code : 200, {
'Content-Type': 'text/html',
});
res.end(ret.replace('##{charset}##', get.charset ? get.charset : ''));
});
});
module.exports = server;
|
/*
A small frog wants to get to the other side of the road. The frog is currently located at position X and wants to get to a position greater than or equal to Y. The small frog always jumps a fixed distance, D.
Count the minimal number of jumps that the small frog must perform to reach its target.
Write a function:
int solution(int X, int Y, int D);
that, given three integers X, Y and D, returns the minimal number of jumps from position X to a position equal to or greater than Y.
*/
// you can write to stdout for debugging purposes, e.g.
// printf("this is a debug message\n");
int solution(int X, int Y, int D) {
// write your code in C99
int diff=Y-X;
if(diff%D==0)
return diff/D;
else
return diff/D+1;
}
|
// Type definitions for @ag-grid-community/core v25.0.1
export declare function convertToSet<T>(list: T[]): Set<T>;
|
package maritech.nei;
import mariculture.core.lib.Modules;
import mariculture.factory.Factory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import codechicken.nei.api.API;
import codechicken.nei.api.IConfigureNEI;
public class MTNEIConfig implements IConfigureNEI {
@Override
public void loadConfig() {
if (Modules.isActive(Modules.factory)) {
API.hideItem(new ItemStack(Factory.customRFBlock, 1, OreDictionary.WILDCARD_VALUE));
}
}
@Override
public String getName() {
return "MariTech NEI";
}
@Override
public String getVersion() {
return "1.0";
}
}
|
package tpe.exceptions.trycatchfinally;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Point;
import de.smits_net.games.framework.board.Board;
/**
* Spielfeld.
*/
public class GameBoard extends Board {
private Professor sprite;
/**
* Erzeugt ein neues Board.
*/
public GameBoard() {
// neues Spielfeld anlegen
super(10, new Dimension(400, 400), Color.BLACK);
// Sprite initialisieren
sprite = new Professor(this, new Point(300, 200));
}
/**
* Spielfeld neu zeichnen. Wird vom Framework aufgerufen.
*/
@Override
public void drawGame(Graphics g) {
sprite.draw(g, this);
}
/**
* Spielsituation updaten. Wird vom Framework aufgerufen.
*/
@Override
public boolean updateGame() {
sprite.move();
return sprite.isVisible();
}
}
|
'use strict';
import '../../Series/Funnel3DSeries.js';
|
#!/bin/bash
# Postfix (SMTP)
# Postfix handles the transmission of email between servers
# using the SMTP protocol. It is a Mail Transfer Agent (MTA).
# Postfix listens on port 25 (SMTP) for incoming mail from
# other servers on the Internet. It is responsible for very
# basic email filtering such as by IP address and greylisting,
# it checks that the destination address is valid, rewrites
# destinations according to aliases, and passses email on to
# another service for local mail delivery.
# The first hop in local mail delivery is to Spamassassin via
# LMTP. Spamassassin then passes mail over to Dovecot for
# storage in the user's mailbox.
# Postfix also listens on port 587 (SMTP+STARTLS) for
# connections from users who can authenticate and then sends
# their email out to the outside world. Postfix queries Dovecot
# to authenticate users.
# Address validation, alias rewriting, and user authentication
# is configured in a separate setup script mail-users.sh
# because of the overlap of this part with the Dovecot
# configuration.
source setup/functions.sh # load our functions
source /etc/mailinabox.conf # load global vars
# Install postfix's packages.
# * `postfix`: The SMTP server.
# * `postfix-pcre`: Enables header filtering.
# * `postgrey`: A mail policy service that soft-rejects mail the first time
# it is received. Spammers don't usually try agian. Legitimate mail
# always will.
# * `ca-certificates`: A trust store used to squelch postfix warnings about
# untrusted <API key> connections.
# postgrey is going to come in via the Mail-in-a-Box PPA, which publishes
# a modified version of postgrey that lets senders whitelisted by dnswl.org
# > infrastructure and every commercial vendor of dnswl.org data (eg through
# > anti-spam solutions) must register with dnswl.org and purchase a subscription.
echo "Installing Postfix (SMTP server)..."
apt_install postfix postfix-pcre postgrey ca-certificates
# Set some basic settings...
# * Have postfix listen on all network interfaces.
# * Make outgoing connections on a particular interface (if multihomed) so that SPF passes on the receiving side.
# * Set our name (the Debian default seems to be "localhost" but make it our hostname).
# * Set the name of the local machine to localhost, which means xxx@localhost is delivered locally, although we don't use it.
# * Set the SMTP banner (which must have the hostname first, then anything).
tools/editconf.py /etc/postfix/main.cf \
inet_interfaces=all \
smtp_bind_address=$PRIVATE_IP \
smtp_bind_address6=$PRIVATE_IPV6 \
myhostname=$PRIMARY_HOSTNAME\
smtpd_banner="\$myhostname ESMTP Hi, I'm a Mail-in-a-Box (Ubuntu/Postfix; see https://mailinabox.email/)" \
mydestination=localhost
# Tweak some queue settings:
# * Inform users when their e-mail delivery is delayed more than 3 hours (default is not to warn).
# * Stop trying to send an undeliverable e-mail after 2 days (instead of 5), and for bounce messages just try for 1 day.
tools/editconf.py /etc/postfix/main.cf \
delay_warning_time=3h \
<API key>=2d \
<API key>=1d
# Enable the 'submission' port 587 smtpd server and tweak its settings.
# * Do not add the OpenDMAC <API key> header. That should only be added
# on incoming mail. Omit the OpenDMARC milter by re-setting smtpd_milters to the
# OpenDKIM milter only. See dkim.sh.
# * Even though we dont allow auth over non-TLS connections (smtpd_tls_auth_only below, and without auth the client cant
# send outbound mail), don't allow non-TLS mail submission on this port anyway to prevent accidental misconfiguration.
# By putting this setting here we leave opportunistic TLS on incoming mail at default cipher settings (any cipher is better than none).
# * Give it a different name in syslog to distinguish it from the port 25 smtpd server.
# * Add a new cleanup service specific to the submission service ('authclean')
# that filters out privacy-sensitive headers on mail being sent out by
# authenticated users.
tools/editconf.py /etc/postfix/master.cf -s -w \
"submission=inet n - - - - smtpd
-o syslog_name=postfix/submission
-o smtpd_milters=inet:127.0.0.1:8891
-o <API key>=encrypt
-o smtpd_tls_ciphers=high -o <API key>=aNULL,DES,3DES,MD5,DES+MD5,RC4 -o <API key>=!SSLv2,!SSLv3
-o <API key>=authclean" \
"authclean=unix n - - - 0 cleanup
-o header_checks=pcre:/etc/postfix/<API key>"
# Install the `<API key>` file required by the new 'authclean' service.
cp conf/<API key> /etc/postfix/<API key>
# Modify the `<API key>` file to use the local machine name and ip
# on the first received header line. This may help reduce the spam score of email by
# removing the 127.0.0.1 reference.
sed -i "s/PRIMARY_HOSTNAME/$PRIMARY_HOSTNAME/" /etc/postfix/<API key>
sed -i "s/PUBLIC_IP/$PUBLIC_IP/" /etc/postfix/<API key>
# Enable TLS on these and all other connections (i.e. ports 25 *and* 587) and
# require TLS before a user is allowed to authenticate. This also makes
# opportunistic TLS available on *incoming* mail.
# Set stronger DH parameters, which via openssl tend to default to 1024 bits
# (see ssl.sh).
tools/editconf.py /etc/postfix/main.cf \
<API key>=may\
smtpd_tls_auth_only=yes \
smtpd_tls_cert_file=$STORAGE_ROOT/ssl/ssl_certificate.pem \
smtpd_tls_key_file=$STORAGE_ROOT/ssl/ssl_private_key.pem \
<API key>=$STORAGE_ROOT/ssl/dh2048.pem \
smtpd_tls_protocols=\!SSLv2,\!SSLv3 \
smtpd_tls_ciphers=medium \
<API key>=aNULL,RC4 \
<API key>=yes
# Prevent non-authenticated users from sending mail that requires being
# relayed elsewhere. We don't want to be an "open relay". On outbound
# mail, require one of:
# * `<API key>`: Authenticated users (i.e. on port 587).
# * `permit_mynetworks`: Mail that originates locally.
# * `<API key>`: No one else. (Permits mail whose destination is local and rejects other mail.)
tools/editconf.py /etc/postfix/main.cf \
<API key>=<API key>,permit_mynetworks,<API key>
# When connecting to remote SMTP servers, prefer TLS and use DANE if available.
# Prefering ("opportunistic") TLS means Postfix will use TLS if the remote end
# offers it, otherwise it will transmit the message in the clear. Postfix will
# accept whatever SSL certificate the remote end provides. Opportunistic TLS
# protects against passive easvesdropping (but not man-in-the-middle attacks).
# DANE takes this a step further:
# Postfix queries DNS for the TLSA record on the destination MX host. If no TLSA records are found,
# then opportunistic TLS is used. Otherwise the server certificate must match the TLSA records
# or else the mail bounces. TLSA also requires DNSSEC on the MX host. Postfix doesn't do DNSSEC
# itself but assumes the system's nameserver does and reports DNSSEC status. Thus this also
# relies on our local bind9 server being present and `<API key>=dnssec`.
# The `smtp_tls_CAfile` is superflous, but it eliminates warnings in the logs about untrusted certs,
# which we don't care about seeing because Postfix is doing opportunistic TLS anyway. Better to encrypt,
# even if we don't know if it's to the right party, than to not encrypt at all. Instead we'll
# now see notices about trusted certs. The CA file is provided by the package `ca-certificates`.
tools/editconf.py /etc/postfix/main.cf \
smtp_tls_protocols=\!SSLv2,\!SSLv3 \
<API key>=\!SSLv2,\!SSLv3 \
smtp_tls_ciphers=medium \
<API key>=aNULL,RC4 \
<API key>=dane \
<API key>=dnssec \
smtp_tls_CAfile=/etc/ssl/certs/ca-certificates.crt \
smtp_tls_loglevel=2
# Pass any incoming mail over to a local delivery agent. Spamassassin
# will act as the LDA agent at first. It is listening on port 10025
# with LMTP. Spamassassin will pass the mail over to Dovecot after.
# In a basic setup we would pass mail directly to Dovecot by setting
# virtual_transport to `lmtp:unix:private/dovecot-lmtp`.
tools/editconf.py /etc/postfix/main.cf virtual_transport=lmtp:[127.0.0.1]:10025
# Who can send mail to us? Some basic filters.
# * `<API key>`: Reject not-nice-looking return paths.
# * `<API key>`: Reject return paths with invalid domains.
# * `reject_<API key>`: Reject if mail FROM address does not match the client SASL login
# * `reject_rhsbl_sender`: Reject return paths that use blacklisted domains.
# * `<API key>`: Authenticated users (i.e. on port 587) can skip further checks.
# * `permit_mynetworks`: Mail that originates locally can skip further checks.
# * `reject_rbl_client`: Reject connections from IP addresses blacklisted in zen.spamhaus.org
# * `<API key>`: Although Postfix will reject mail to unknown recipients, it's nicer to reject such mail ahead of greylisting rather than after.
# * `<API key>`: Apply greylisting using postgrey.
# Notes: #NODOC
# permit_dnswl_client can pass through mail from whitelisted IP addresses, which would be good to put before greylisting #NODOC
# so these IPs get mail delivered quickly. But when an IP is not listed in the permit_dnswl_client list (i.e. it is not #NODOC
# whitelisted) then postfix does a DEFER_IF_REJECT, which results in all "unknown user" sorts of messages turning into #NODOC
# "450 4.7.1 Client host rejected: Service unavailable". This is a retry code, so the mail doesn't properly bounce. #NODOC
tools/editconf.py /etc/postfix/main.cf \
<API key>="<API key>,<API key>,reject_<API key>,reject_rhsbl_sender dbl.spamhaus.org" \
<API key>=<API key>,permit_mynetworks,"reject_rbl_client zen.spamhaus.org",<API key>,"<API key> inet:127.0.0.1:10023"
# Postfix connects to Postgrey on the 127.0.0.1 interface specifically. Ensure that
# Postgrey listens on the same interface (and not IPv6, for instance).
# A lot of legit mail servers try to resend before 300 seconds.
# As a matter of fact RFC is not strict about retry timer so postfix and
# other MTA have their own intervals. To fix the problem of receiving
# e-mails really latter, delay of greylisting has been set to
# 180 seconds (default is 300 seconds).
tools/editconf.py /etc/default/postgrey \
POSTGREY_OPTS=\"'--inet=127.0.0.1:10023 --delay=180'\"
# Increase the message size limit from 10MB to 128MB.
# The same limit is specified in nginx.conf for mail submitted via webmail and Z-Push.
tools/editconf.py /etc/postfix/main.cf \
message_size_limit=134217728
# Allow the two SMTP ports in the firewall.
ufw_allow smtp
ufw_allow submission
# Restart services
restart_service postfix
restart_service postgrey
|
<!DOCTYPE html>
<html>
<head>
<title>onChange / onSelectionChange</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<link rel="stylesheet" type="text/css" href="../../../codebase/fonts/font_roboto/roboto.css"/>
<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlxgrid.css"/>
<script src="../../../codebase/dhtmlxgrid.js"></script>
<style>
#log_here {
font-size: 8pt;
font-family: Tahoma;
width: 500px;
height: 120px;
border: 1px solid #cecece;
padding: 2px 5px;
overflow: auto;
}
</style>
<script>
var myCombo;
var eventIndex = 1;
function doOnLoad() {
myCombo = new dhtmlXCombo("combo_zone", null, null, "image");
myCombo.setImagePath("../common/flags/");
myCombo.load("../common/data_countries.json");
myCombo.allowFreeText(true);
myCombo.attachEvent("onChange", function(value, text){
log("onChange event, value: "+value+", text: "+text);
});
myCombo.attachEvent("onSelectionChange", function(){
log("onSelectionChange event");
});
}
function log(text) {
var t = document.getElementById("log_here");
t.innerHTML += (eventIndex++)+") "+text+"<br>";
t.scrollTop = t.scrollHeight;
}
</script>
</head>
<body onload="doOnLoad();">
<h3>onChange / onSelectionChange</h3>
<div id="combo_zone" style="width:230px;"></div>
<br><br><br><br><br><br><br><br><br><br>
<div id="log_here"></div>
</body>
</html>
|
#pragma once
#include "AudioData.h"
#include <string>
//2D indexing: column-major order, 0-based:
#define IDX2D(row, column) (((column) * rows) + (row))
class <API key>
{
private:
double freq_lowest;
double freq_highest;
int sample_freq_Hz;
double total_time_s;
bool use_exponential;
bool use_stereo;
bool use_delay;
bool use_fade;
bool use_diffraction;
bool use_bspline;
float speed_of_sound_m_s;
float <API key>;
int rows;
int columns;
const uint32_t sampleCount;
const uint32_t samplesPerColumn;
const float timePerSample_s;
const float scale;
std::vector<float> omega;
std::vector<float> phi0;
std::vector<float> <API key>;
std::vector<float> <API key>;
AudioData audioData;
float rnd(void);
void <API key>();
void processMono(const std::vector<float> &image);
void processStereo(const std::vector<float> &image);
public:
<API key>(int rows, int columns, double freq_lowest = 500, double freq_highest = 5000,
int sample_freq_Hz = 44100, double total_time_s = 1.05, bool use_exponential = true,
bool use_stereo = true, bool use_delay = true, bool use_fade = true,
bool use_diffraction = true, bool use_bspline = true, float speed_of_sound_m_s = 340,
float <API key> = 0.20);
void Process(const std::vector<float> &image);
AudioData& GetAudioData() { return audioData; }
};
|
package test.org.jboss.forge.furnace.lifecycle;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.forge.arquillian.archive.AddonArchive;
import org.jboss.forge.arquillian.services.LocalServices;
import org.jboss.forge.furnace.Furnace;
import org.jboss.forge.furnace.addons.Addon;
import org.jboss.forge.furnace.addons.AddonId;
import org.jboss.forge.furnace.addons.AddonRegistry;
import org.jboss.forge.furnace.repositories.<API key>;
import org.jboss.forge.furnace.repositories.<API key>;
import org.jboss.forge.furnace.util.Addons;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import test.org.jboss.forge.furnace.mocks.MockImpl1;
import test.org.jboss.forge.furnace.mocks.MockInterface;
@RunWith(Arquillian.class)
public class <API key>
{
@Deployment(order = 2)
public static AddonArchive getDeployment()
{
AddonArchive archive = ShrinkWrap.create(AddonArchive.class)
.<API key>(
<API key>.create("dep1")
);
archive.addAsLocalServices(<API key>.class);
return archive;
}
@Deployment(name = "dep2,2", testable = false, order = 1)
public static AddonArchive getDeployment2()
{
AddonArchive archive = ShrinkWrap.create(AddonArchive.class)
.addAsLocalServices(MockImpl1.class)
.addClasses(MockImpl1.class, MockInterface.class)
.addBeansXML();
return archive;
}
@Deployment(name = "dep1,1", testable = false, order = 0)
public static AddonArchive getDeployment1()
{
AddonArchive archive = ShrinkWrap.create(AddonArchive.class)
.addClass(<API key>.class)
.addAsLocalServices(<API key>.class);
return archive;
}
@Test(timeout = 5000)
public void <API key>() throws Exception
{
Furnace furnace = LocalServices.getFurnace(getClass().getClassLoader());
AddonRegistry registry = furnace.getAddonRegistry();
Addon dep2 = registry.getAddon(AddonId.from("dep2", "2"));
<API key> manager = registry.getServices(<API key>.class).get();
Assert.assertEquals(3, manager.getPostStartupCount());
<API key> repository = (<API key>) furnace.getRepositories().get(0);
repository.disable(dep2.getId());
Addons.waitUntilStopped(dep2);
Assert.assertEquals(1, manager.getPreShutdownCount());
}
}
|
package org.eclipse.smarthome.io.rest.core.link;
import java.util.ArrayList;
import java.util.Collection;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.UriInfo;
import org.eclipse.smarthome.core.thing.ChannelUID;
import org.eclipse.smarthome.core.thing.link.AbstractLink;
import org.eclipse.smarthome.core.thing.link.ItemChannelLink;
import org.eclipse.smarthome.core.thing.link.<API key>;
import org.eclipse.smarthome.core.thing.link.ThingLinkManager;
import org.eclipse.smarthome.core.thing.link.dto.AbstractLinkDTO;
import org.eclipse.smarthome.core.thing.link.dto.ItemChannelLinkDTO;
import org.eclipse.smarthome.io.rest.JSONResponse;
import org.eclipse.smarthome.io.rest.RESTResource;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
/**
* This class acts as a REST resource for links.
*
* @author Dennis Nobel - Initial contribution
* @author Yordan Zhelev - Added Swagger annotations
* @author Kai Kreuzer - Removed Thing links and added auto link url
*/
@Path(<API key>.PATH_LINKS)
@Api(value = <API key>.PATH_LINKS)
public class <API key> implements RESTResource {
/** The URI path to this resource */
public static final String PATH_LINKS = "links";
private <API key> <API key>;
private ThingLinkManager thingLinkManager;
@Context
UriInfo uriInfo;
@GET
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Gets all available links.", response = ItemChannelLinkDTO.class, responseContainer = "Collection")
@ApiResponses(value = { @ApiResponse(code = 200, message = "OK") })
public Response getAll() {
Collection<ItemChannelLink> channelLinks = <API key>.getAll();
return Response.ok(toBeans(channelLinks)).build();
}
@GET
@Path("/auto")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Tells whether automatic link mode is active or not", response = Boolean.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "OK") })
public Response isAutomatic() {
return Response.ok(thingLinkManager.isAutoLinksEnabled()).build();
}
@PUT
@Path("/{itemName}/{channelUID}")
@ApiOperation(value = "Links item to a channel.")
@ApiResponses(value = { @ApiResponse(code = 200, message = "OK"),
@ApiResponse(code = 400, message = "Item already linked to the channel.") })
public Response link(@PathParam("itemName") @ApiParam(value = "itemName") String itemName,
@PathParam("channelUID") @ApiParam(value = "channelUID") String channelUid) {
<API key>.add(new ItemChannelLink(itemName, new ChannelUID(channelUid)));
return Response.ok().build();
}
@DELETE
@Path("/{itemName}/{channelUID}")
@ApiOperation(value = "Unlinks item from a channel.")
@ApiResponses(value = { @ApiResponse(code = 200, message = "OK"),
@ApiResponse(code = 404, message = "Link not found."),
@ApiResponse(code = 405, message = "Link not editable.") })
public Response unlink(@PathParam("itemName") @ApiParam(value = "itemName") String itemName,
@PathParam("channelUID") @ApiParam(value = "channelUID") String channelUid) {
String linkId = AbstractLink.getIDFor(itemName, new ChannelUID(channelUid));
if (<API key>.get(linkId) == null) {
String message = "Link " + linkId + " does not exist!";
return JSONResponse.createResponse(Status.NOT_FOUND, null, message);
}
ItemChannelLink result = <API key>
.remove(AbstractLink.getIDFor(itemName, new ChannelUID(channelUid)));
if (result != null) {
return Response.ok().build();
} else {
return JSONResponse.createErrorResponse(Status.METHOD_NOT_ALLOWED, "Channel is read-only.");
}
}
protected void setThingLinkManager(ThingLinkManager thingLinkManager) {
this.thingLinkManager = thingLinkManager;
}
protected void <API key>(ThingLinkManager thingLinkManager) {
this.thingLinkManager = null;
}
protected void <API key>(<API key> <API key>) {
this.<API key> = <API key>;
}
protected void <API key>(<API key> <API key>) {
this.<API key> = null;
}
private Collection<AbstractLinkDTO> toBeans(Iterable<ItemChannelLink> links) {
Collection<AbstractLinkDTO> beans = new ArrayList<>();
for (AbstractLink link : links) {
ItemChannelLinkDTO bean = new ItemChannelLinkDTO(link.getItemName(), link.getUID().toString());
beans.add(bean);
}
return beans;
}
}
|
package com.ibm.ws.security.social.fat.LibertyOP;
import java.util.ArrayList;
import java.util.List;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.runner.RunWith;
import com.ibm.websphere.simplicity.log.Log;
import com.ibm.ws.security.oauth_oidc.fat.commonTest.RSCommonTestTools;
import com.ibm.ws.security.social.fat.LibertyOP.CommonTests.<API key>;
import com.ibm.ws.security.social.fat.commonTests.Social_BasicTests;
import com.ibm.ws.security.social.fat.utils.SocialConstants;
import com.ibm.ws.security.social.fat.utils.SocialTestSettings;
import componenttest.custom.junit.runner.FATRunner;
import componenttest.custom.junit.runner.Mode;
import componenttest.custom.junit.runner.Mode.TestMode;
import componenttest.rules.repeater.RepeatTests;
import componenttest.topology.impl.<API key>;
@RunWith(FATRunner.class)
@<API key>
@Mode(TestMode.FULL)
public class <API key><API key> extends Social_BasicTests {
public static Class<?> thisClass = <API key><API key>.class;
public static RSCommonTestTools rsTools = new RSCommonTestTools();
@ClassRule
public static RepeatTests r = RepeatTests.with(<API key>.usingUserInfo()).andWith(<API key>.usingIntrospect());
@BeforeClass
public static void setUp() throws Exception {
<API key> = FATSuite.UserApiEndpoint;
List<String> startMsgs = new ArrayList<String>();
startMsgs.add("CWWKT0016I.*" + SocialConstants.<API key>);
List<String> extraApps = new ArrayList<String>();
extraApps.add(SocialConstants.HELLOWORLD_SERVLET);
// TODO fix
List<String> opStartMsgs = new ArrayList<String>();
// opStartMsgs.add("CWWKS1600I.*" + SocialConstants.<API key>);
opStartMsgs.add("CWWKS1631I.*");
// TODO fix
List<String> opExtraApps = new ArrayList<String>();
opExtraApps.add(SocialConstants.OP_SAMPLE_APP);
String[] <API key> = rsTools.chooseTokenSettings(SocialConstants.OIDC_OP);
String tokenType = <API key>[0];
String certType = <API key>[1];
Log.info(thisClass, "setupBeforeTest", "inited tokenType to: " + tokenType);
socialSettings = new SocialTestSettings();
testSettings = socialSettings;
testOPServer = commonSetUp(SocialConstants.SERVER_NAME + ".LibertyOP.op", "op_server_orig.xml", SocialConstants.OIDC_OP, null, SocialConstants.DO_NOT_USE_DERBY, opStartMsgs, null, SocialConstants.OIDC_OP, true, true, tokenType, certType);
genericTestServer = commonSetUp(SocialConstants.SERVER_NAME + ".LibertyOP.social", "<API key><API key>.xml", SocialConstants.GENERIC_SERVER, extraApps, SocialConstants.DO_NOT_USE_DERBY, startMsgs);
<API key>(SocialConstants.LIBERTYOP_PROVIDER, SocialConstants.OAUTH_OP);
<API key>(GenericConfig, "<API key><API key>);
socialSettings = <API key>(socialSettings);
}
}
|
package org.eclipse.che.multiuser.machine.authentication.server;
import static com.google.common.base.Strings.nullToEmpty;
import java.io.IOException;
import java.security.Principal;
import javax.inject.Inject;
import javax.inject.Singleton;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.<API key>;
import org.eclipse.che.api.core.NotFoundException;
import org.eclipse.che.api.core.ServerException;
import org.eclipse.che.api.core.model.user.User;
import org.eclipse.che.api.user.server.UserManager;
import org.eclipse.che.commons.auth.token.<API key>;
import org.eclipse.che.commons.env.EnvironmentContext;
import org.eclipse.che.commons.subject.Subject;
import org.eclipse.che.commons.subject.SubjectImpl;
import org.eclipse.che.multiuser.api.permission.server.AuthorizedSubject;
import org.eclipse.che.multiuser.api.permission.server.PermissionChecker;
/** @author Max Shaposhnik (mshaposhnik@codenvy.com) */
@Singleton
public class MachineLoginFilter implements Filter {
@Inject private <API key> tokenExtractor;
@Inject private <API key> <API key>;
@Inject private UserManager userManager;
@Inject private PermissionChecker permissionChecker;
@Override
public void init(FilterConfig filterConfig) throws ServletException {}
@Override
public void doFilter(
ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
throws IOException, ServletException {
final HttpServletRequest httpRequest = (HttpServletRequest) servletRequest;
if (httpRequest.getScheme().startsWith("ws")
|| !nullToEmpty(tokenExtractor.getToken(httpRequest)).startsWith("machine")) {
filterChain.doFilter(servletRequest, servletResponse);
return;
} else {
String tokenString;
User user;
try {
tokenString = tokenExtractor.getToken(httpRequest);
String userId = <API key>.getUserId(tokenString);
user = userManager.getById(userId);
} catch (NotFoundException | ServerException e) {
throw new ServletException("Cannot find user by machine token.");
}
final Subject subject =
new AuthorizedSubject(
new SubjectImpl(user.getName(), user.getId(), tokenString, false), permissionChecker);
try {
EnvironmentContext.getCurrent().setSubject(subject);
filterChain.doFilter(addUserInRequest(httpRequest, subject), servletResponse);
} finally {
EnvironmentContext.reset();
}
}
}
private HttpServletRequest addUserInRequest(
final HttpServletRequest httpRequest, final Subject subject) {
return new <API key>(httpRequest) {
@Override
public String getRemoteUser() {
return subject.getUserName();
}
@Override
public Principal getUserPrincipal() {
return subject::getUserName;
}
};
}
@Override
public void destroy() {}
}
|
package com.ibm.ws.cdi.services.impl;
import javax.enterprise.context.Dependent;
/**
* This class only needs to be here to make sure this is a BDA with a BeanManager
*/
@Dependent
public class MyPojoUser {
public String getUser() {
String s = "DefaultPojoUser";
return s;
}
}
|
package org.openhab.binding.http.internal.config;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.http.internal.converter.ColorItemConverter;
import org.openhab.core.library.types.<API key>;
import org.openhab.core.library.types.NextPreviousType;
import org.openhab.core.library.types.OnOffType;
import org.openhab.core.library.types.OpenClosedType;
import org.openhab.core.library.types.PlayPauseType;
import org.openhab.core.library.types.<API key>;
import org.openhab.core.library.types.StopMoveType;
import org.openhab.core.library.types.UpDownType;
import org.openhab.core.types.Command;
import org.openhab.core.types.State;
/**
* The {@link HttpChannelConfig} class contains fields mapping channel configuration parameters.
*
* @author Jan N. Klug - Initial contribution
*/
@NonNullByDefault
public class HttpChannelConfig {
private final Map<String, State> stringStateMap = new HashMap<>();
private final Map<Command, @Nullable String> commandStringMap = new HashMap<>();
private boolean initialized = false;
public @Nullable String stateExtension;
public @Nullable String commandExtension;
public @Nullable String stateTransformation;
public @Nullable String <API key>;
public HttpChannelMode mode = HttpChannelMode.READWRITE;
// switch, dimmer, color
public @Nullable String onValue;
public @Nullable String offValue;
// dimmer, color
public BigDecimal step = BigDecimal.ONE;
public @Nullable String increaseValue;
public @Nullable String decreaseValue;
// color
public ColorItemConverter.ColorMode colorMode = ColorItemConverter.ColorMode.RGB;
// contact
public @Nullable String openValue;
public @Nullable String closedValue;
// rollershutter
public @Nullable String upValue;
public @Nullable String downValue;
public @Nullable String stopValue;
public @Nullable String moveValue;
// player
public @Nullable String playValue;
public @Nullable String pauseValue;
public @Nullable String nextValue;
public @Nullable String previousValue;
public @Nullable String rewindValue;
public @Nullable String fastforwardValue;
/**
* maps a command to a user-defined string
*
* @param command the command to map
* @return a string or null if no mapping found
*/
public @Nullable String commandToFixedValue(Command command) {
if (!initialized) {
createMaps();
}
return commandStringMap.get(command);
}
/**
* maps a user-defined string to a state
*
* @param string the string to map
* @return the state or null if no mapping found
*/
public @Nullable State fixedValueToState(String string) {
if (!initialized) {
createMaps();
}
return stringStateMap.get(string);
}
private void createMaps() {
addToMaps(this.onValue, OnOffType.ON);
addToMaps(this.offValue, OnOffType.OFF);
addToMaps(this.openValue, OpenClosedType.OPEN);
addToMaps(this.closedValue, OpenClosedType.CLOSED);
addToMaps(this.upValue, UpDownType.UP);
addToMaps(this.downValue, UpDownType.DOWN);
commandStringMap.put(<API key>.INCREASE, increaseValue);
commandStringMap.put(<API key>.DECREASE, decreaseValue);
commandStringMap.put(StopMoveType.STOP, stopValue);
commandStringMap.put(StopMoveType.MOVE, moveValue);
commandStringMap.put(PlayPauseType.PLAY, playValue);
commandStringMap.put(PlayPauseType.PAUSE, pauseValue);
commandStringMap.put(NextPreviousType.NEXT, nextValue);
commandStringMap.put(NextPreviousType.PREVIOUS, previousValue);
commandStringMap.put(<API key>.REWIND, rewindValue);
commandStringMap.put(<API key>.FASTFORWARD, fastforwardValue);
initialized = true;
}
private void addToMaps(@Nullable String value, State state) {
if (value != null) {
commandStringMap.put((Command) state, value);
stringStateMap.put(value, state);
}
}
}
|
package eu.hohenegger.c0ffee_tips.tests;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
import eu.hohenegger.c0ffee_tips.TestBasic;
@RunWith(Suite.class)
@SuiteClasses({TestBasic.class})
public class AllTests {
}
|
package org.hibernate.hql.ast.util;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.ListIterator;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.Collection;
import org.hibernate.AssertionFailure;
import org.hibernate.dialect.Dialect;
import org.hibernate.impl.FilterImpl;
import org.hibernate.type.Type;
import org.hibernate.param.<API key>;
import org.hibernate.param.<API key>;
import org.hibernate.engine.JoinSequence;
import org.hibernate.engine.<API key>;
import org.hibernate.engine.<API key>;
import org.hibernate.hql.antlr.SqlTokenTypes;
import org.hibernate.hql.ast.HqlSqlWalker;
import org.hibernate.hql.ast.tree.FromClause;
import org.hibernate.hql.ast.tree.FromElement;
import org.hibernate.hql.ast.tree.QueryNode;
import org.hibernate.hql.ast.tree.DotNode;
import org.hibernate.hql.ast.tree.ParameterContainer;
import org.hibernate.hql.classic.ParserHelper;
import org.hibernate.sql.JoinFragment;
import org.hibernate.util.StringHelper;
import org.hibernate.util.ArrayHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Performs the post-processing of the join information gathered during semantic analysis.
* The join generating classes are complex, this encapsulates some of the <API key>
* code.
*
* @author Joshua Davis
*/
public class JoinProcessor implements SqlTokenTypes {
private static final Logger log = LoggerFactory.getLogger( JoinProcessor.class );
private final HqlSqlWalker walker;
private final SyntheticAndFactory syntheticAndFactory;
/**
* Constructs a new JoinProcessor.
*
* @param walker The walker to which we are bound, giving us access to needed resources.
*/
public JoinProcessor(HqlSqlWalker walker) {
this.walker = walker;
this.syntheticAndFactory = new SyntheticAndFactory( walker );
}
/**
* Translates an AST join type (i.e., the token type) into a JoinFragment.XXX join type.
*
* @param astJoinType The AST join type (from HqlSqlTokenTypes or SqlTokenTypes)
* @return a JoinFragment.XXX join type.
* @see JoinFragment
* @see SqlTokenTypes
*/
public static int toHibernateJoinType(int astJoinType) {
switch ( astJoinType ) {
case LEFT_OUTER:
return JoinFragment.LEFT_OUTER_JOIN;
case INNER:
return JoinFragment.INNER_JOIN;
case RIGHT_OUTER:
return JoinFragment.RIGHT_OUTER_JOIN;
default:
throw new AssertionFailure( "undefined join type " + astJoinType );
}
}
public void processJoins(QueryNode query) {
final FromClause fromClause = query.getFromClause();
final List fromElements;
if ( DotNode.<API key> ) {
// for regression testing against output from the old parser...
// found it easiest to simply reorder the FromElements here into ascending order
// in terms of injecting them into the resulting sql ast in orders relative to those
// expected by the old parser; this is definitely another of those "only needed
// for regression purposes". The SyntheticAndFactory, then, simply injects them as it
// encounters them.
fromElements = new ArrayList();
ListIterator liter = fromClause.getFromElements().listIterator( fromClause.getFromElements().size() );
while ( liter.hasPrevious() ) {
fromElements.add( liter.previous() );
}
}
else {
fromElements = fromClause.getFromElements();
}
// Iterate through the alias,JoinSequence pairs and generate SQL token nodes.
Iterator iter = fromElements.iterator();
while ( iter.hasNext() ) {
final FromElement fromElement = ( FromElement ) iter.next();
JoinSequence join = fromElement.getJoinSequence();
join.setSelector(
new JoinSequence.Selector() {
public boolean includeSubclasses(String alias) {
// The uber-rule here is that we need to include subclass joins if
// the FromElement is in any way dereferenced by a property from
// the subclass table; otherwise we end up with column references
// qualified by a non-existent table reference in the resulting SQL...
boolean containsTableAlias = fromClause.containsTableAlias( alias );
if ( fromElement.<API key>() ) {
// TODO : or should we return 'containsTableAlias'??
log.trace( "forcing inclusion of extra joins [alias=" + alias + ", containsTableAlias=" + containsTableAlias + "]" );
return true;
}
boolean shallowQuery = walker.isShallowQuery();
boolean includeSubclasses = fromElement.isIncludeSubclasses();
boolean subQuery = fromClause.isSubQuery();
return includeSubclasses && containsTableAlias && !subQuery && !shallowQuery;
}
}
);
addJoinNodes( query, join, fromElement );
}
}
private void addJoinNodes(QueryNode query, JoinSequence join, FromElement fromElement) {
JoinFragment joinFragment = join.toJoinFragment(
walker.getEnabledFilters(),
fromElement.useFromFragment() || fromElement.<API key>(),
fromElement.<API key>(),
fromElement.<API key>()
);
String frag = joinFragment.<API key>();
String whereFrag = joinFragment.<API key>();
// If the from element represents a JOIN_FRAGMENT and it is
// a theta-style join, convert its type from JOIN_FRAGMENT
// to FROM_FRAGMENT
if ( fromElement.getType() == JOIN_FRAGMENT &&
( join.isThetaStyle() || StringHelper.isNotEmpty( whereFrag ) ) ) {
fromElement.setType( FROM_FRAGMENT );
fromElement.getJoinSequence().setUseThetaStyle( true ); // this is used during SqlGenerator processing
}
// If there is a FROM fragment and the FROM element is an explicit, then add the from part.
if ( fromElement.useFromFragment() /*&& StringHelper.isNotEmpty( frag )*/ ) {
String fromFragment = processFromFragment( frag, join ).trim();
if ( log.isDebugEnabled() ) {
log.debug( "Using FROM fragment [" + fromFragment + "]" );
}
<API key>(
fromFragment,
fromElement,
walker
);
}
syntheticAndFactory.addWhereFragment(
joinFragment,
whereFrag,
query,
fromElement,
walker
);
}
private String processFromFragment(String frag, JoinSequence join) {
String fromFragment = frag.trim();
// The FROM fragment will probably begin with ', '. Remove this if it is present.
if ( fromFragment.startsWith( ", " ) ) {
fromFragment = fromFragment.substring( 2 );
}
return fromFragment;
}
public static void <API key>(
final String sqlFragment,
final ParameterContainer container,
final HqlSqlWalker walker) {
if ( walker.getEnabledFilters().isEmpty()
&& ( ! <API key>( sqlFragment ) )
&& ( ! ( <API key>( sqlFragment ) ) ) ) {
return;
}
Dialect dialect = walker.<API key>().getFactory().getDialect();
String symbols = new StringBuffer().append( ParserHelper.HQL_SEPARATORS )
.append( dialect.openQuote() )
.append( dialect.closeQuote() )
.toString();
StringTokenizer tokens = new StringTokenizer( sqlFragment, symbols, true );
StringBuffer result = new StringBuffer();
while ( tokens.hasMoreTokens() ) {
final String token = tokens.nextToken();
if ( token.startsWith( ParserHelper.HQL_VARIABLE_PREFIX ) ) {
final String filterParameterName = token.substring( 1 );
final String[] parts = <API key>.<API key>( filterParameterName );
final FilterImpl filter = ( FilterImpl ) walker.getEnabledFilters().get( parts[0] );
final Object value = filter.getParameter( parts[1] );
final Type type = filter.getFilterDefinition().getParameterType( parts[1] );
final String typeBindFragment = StringHelper.join(
",",
ArrayHelper.fillArray( "?", type.getColumnSpan( walker.<API key>().getFactory() ) )
);
final String bindFragment = ( value != null && Collection.class.isInstance( value ) )
? StringHelper.join( ",", ArrayHelper.fillArray( typeBindFragment, ( ( Collection ) value ).size() ) )
: typeBindFragment;
result.append( bindFragment );
container.<API key>( new <API key>( parts[0], parts[1], type ) );
}
else {
result.append( token );
}
}
container.setText( result.toString() );
}
private static boolean <API key>(String sqlFragment) {
return sqlFragment.indexOf( ParserHelper.HQL_VARIABLE_PREFIX ) < 0;
}
private static boolean <API key>(String sqlFragment) {
return sqlFragment.indexOf( "?" ) < 0;
}
}
|
package org.openhab.binding.tinkerforge.internal.model.impl;
import java.lang.reflect.<API key>;
import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.openhab.binding.tinkerforge.internal.LoggerConstants;
import org.openhab.binding.tinkerforge.internal.<API key>;
import org.openhab.binding.tinkerforge.internal.model.MBaseDevice;
import org.openhab.binding.tinkerforge.internal.model.<API key>;
import org.openhab.binding.tinkerforge.internal.model.<API key>;
import org.openhab.binding.tinkerforge.internal.model.MSubDevice;
import org.openhab.binding.tinkerforge.internal.model.MSubDeviceHolder;
import org.openhab.binding.tinkerforge.internal.model.ModelPackage;
import org.openhab.binding.tinkerforge.internal.types.OnOffValue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.tinkerforge.<API key>;
import com.tinkerforge.TimeoutException;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>MIndustrial Quad Relay</b></em>'.
*
* @author Theo Weiss
* @since 1.4.0
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.openhab.binding.tinkerforge.internal.model.impl.<API key>#getSwitchState
* <em>Switch State</em>}</li>
* <li>{@link org.openhab.binding.tinkerforge.internal.model.impl.<API key>#getLogger
* <em>Logger</em>}</li>
* <li>{@link org.openhab.binding.tinkerforge.internal.model.impl.<API key>#getUid <em>Uid</em>}
* </li>
* <li>{@link org.openhab.binding.tinkerforge.internal.model.impl.<API key>#isPoll <em>Poll</em>}
* </li>
* <li>{@link org.openhab.binding.tinkerforge.internal.model.impl.<API key>#getEnabledA
* <em>Enabled A</em>}</li>
* <li>{@link org.openhab.binding.tinkerforge.internal.model.impl.<API key>#getSubId
* <em>Sub Id</em>}</li>
* <li>{@link org.openhab.binding.tinkerforge.internal.model.impl.<API key>#getMbrick
* <em>Mbrick</em>}</li>
* <li>{@link org.openhab.binding.tinkerforge.internal.model.impl.<API key>#getDeviceType
* <em>Device Type</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class <API key> extends MinimalEObjectImpl.Container implements <API key> {
/**
* The default value of the '{@link #getSwitchState() <em>Switch State</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getSwitchState()
* @generated
* @ordered
*/
protected static final OnOffValue <API key> = null;
/**
* The cached value of the '{@link #getSwitchState() <em>Switch State</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getSwitchState()
* @generated
* @ordered
*/
protected OnOffValue switchState = <API key>;
/**
* The default value of the '{@link #getLogger() <em>Logger</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getLogger()
* @generated
* @ordered
*/
protected static final Logger LOGGER_EDEFAULT = null;
/**
* The cached value of the '{@link #getLogger() <em>Logger</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getLogger()
* @generated
* @ordered
*/
protected Logger logger = LOGGER_EDEFAULT;
/**
* The default value of the '{@link #getUid() <em>Uid</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getUid()
* @generated
* @ordered
*/
protected static final String UID_EDEFAULT = null;
/**
* The cached value of the '{@link #getUid() <em>Uid</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getUid()
* @generated
* @ordered
*/
protected String uid = UID_EDEFAULT;
/**
* The default value of the '{@link #isPoll() <em>Poll</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #isPoll()
* @generated
* @ordered
*/
protected static final boolean POLL_EDEFAULT = true;
/**
* The cached value of the '{@link #isPoll() <em>Poll</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #isPoll()
* @generated
* @ordered
*/
protected boolean poll = POLL_EDEFAULT;
/**
* The default value of the '{@link #getEnabledA() <em>Enabled A</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getEnabledA()
* @generated
* @ordered
*/
protected static final AtomicBoolean ENABLED_A_EDEFAULT = null;
/**
* The cached value of the '{@link #getEnabledA() <em>Enabled A</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getEnabledA()
* @generated
* @ordered
*/
protected AtomicBoolean enabledA = ENABLED_A_EDEFAULT;
/**
* The default value of the '{@link #getSubId() <em>Sub Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getSubId()
* @generated
* @ordered
*/
protected static final String SUB_ID_EDEFAULT = null;
/**
* The cached value of the '{@link #getSubId() <em>Sub Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getSubId()
* @generated
* @ordered
*/
protected String subId = SUB_ID_EDEFAULT;
/**
* The default value of the '{@link #getDeviceType() <em>Device Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getDeviceType()
* @generated
* @ordered
*/
protected static final String <API key> = "quad_relay";
/**
* The cached value of the '{@link #getDeviceType() <em>Device Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getDeviceType()
* @generated
* @ordered
*/
protected String deviceType = <API key>;
private short relayNum;
private int mask;
private static final byte <API key> = 0000000000000001;
private static final byte OFF_BYTE = 0000000000000000;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
protected <API key>() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return ModelPackage.Literals.<API key>;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public OnOffValue getSwitchState() {
return switchState;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setSwitchState(OnOffValue newSwitchState) {
OnOffValue oldSwitchState = switchState;
switchState = newSwitchState;
if (<API key>()) {
eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.<API key>,
oldSwitchState, switchState));
}
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public void turnSwitch(OnOffValue state) {
logger.debug("turnSwitchState called on: {}", <API key>.class);
try {
if (state == OnOffValue.OFF) {
logger.debug("setSwitchValue off");
getMbrick().<API key>().setSelectedValues(mask, OFF_BYTE);
} else if (state == OnOffValue.ON) {
logger.debug("setSwitchState on");
getMbrick().<API key>().setSelectedValues(mask, mask);
} else {
logger.error("{} unkown switchstate {}", LoggerConstants.TFMODELUPDATE, state);
}
setSwitchState(state);
} catch (TimeoutException e) {
<API key>.handleError(this, <API key>.<API key>, e);
} catch (<API key> e) {
<API key>.handleError(this, <API key>.<API key>, e);
}
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public void fetchSwitchState() {
OnOffValue value = OnOffValue.UNDEF;
try {
int deviceValue = getMbrick().<API key>().getValue();
if ((deviceValue & mask) == mask) {
value = OnOffValue.ON;
} else {
value = OnOffValue.OFF;
}
setSwitchState(value);
} catch (TimeoutException e) {
<API key>.handleError(this, <API key>.<API key>, e);
} catch (<API key> e) {
<API key>.handleError(this, <API key>.<API key>, e);
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public Logger getLogger() {
return logger;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setLogger(Logger newLogger) {
Logger oldLogger = logger;
logger = newLogger;
if (<API key>()) {
eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.<API key>,
oldLogger, logger));
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public String getUid() {
return uid;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setUid(String newUid) {
String oldUid = uid;
uid = newUid;
if (<API key>()) {
eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.<API key>, oldUid,
uid));
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean isPoll() {
return poll;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setPoll(boolean newPoll) {
boolean oldPoll = poll;
poll = newPoll;
if (<API key>()) {
eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.<API key>, oldPoll,
poll));
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public AtomicBoolean getEnabledA() {
return enabledA;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setEnabledA(AtomicBoolean newEnabledA) {
AtomicBoolean oldEnabledA = enabledA;
enabledA = newEnabledA;
if (<API key>()) {
eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.<API key>,
oldEnabledA, enabledA));
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public String getSubId() {
return subId;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setSubId(String newSubId) {
String oldSubId = subId;
subId = newSubId;
if (<API key>()) {
eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.<API key>, oldSubId,
subId));
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public <API key> getMbrick() {
if (eContainerFeatureID() != ModelPackage.<API key>) {
return null;
}
return (<API key>) eContainer();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public NotificationChain basicSetMbrick(<API key> newMbrick, NotificationChain msgs) {
msgs = eBasicSetContainer((InternalEObject) newMbrick, ModelPackage.<API key>, msgs);
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setMbrick(<API key> newMbrick) {
if (newMbrick != eInternalContainer()
|| (eContainerFeatureID() != ModelPackage.<API key> && newMbrick != null)) {
if (EcoreUtil.isAncestor(this, newMbrick)) {
throw new <API key>("Recursive containment not allowed for " + toString());
}
NotificationChain msgs = null;
if (eInternalContainer() != null) {
msgs = <API key>(msgs);
}
if (newMbrick != null) {
msgs = ((InternalEObject) newMbrick).eInverseAdd(this, ModelPackage.<API key>,
MSubDeviceHolder.class, msgs);
}
msgs = basicSetMbrick(newMbrick, msgs);
if (msgs != null) {
msgs.dispatch();
}
} else if (<API key>()) {
eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.<API key>,
newMbrick, newMbrick));
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public String getDeviceType() {
return deviceType;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public void init() {
setEnabledA(new AtomicBoolean());
poll = true; // don't use the setter to prevent notification
logger = LoggerFactory.getLogger(<API key>.class);
relayNum = Short.parseShort(String.valueOf(subId.charAt(subId.length() - 1)));
mask = <API key> << relayNum;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public void enable() {
logger.debug("enable called on <API key>");
fetchSwitchState();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public void disable() {
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ModelPackage.<API key>:
if (eInternalContainer() != null) {
msgs = <API key>(msgs);
}
return basicSetMbrick((<API key>) otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ModelPackage.<API key>:
return basicSetMbrick(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public NotificationChain <API key>(NotificationChain msgs) {
switch (eContainerFeatureID()) {
case ModelPackage.<API key>:
return eInternalContainer().eInverseRemove(this, ModelPackage.<API key>,
MSubDeviceHolder.class, msgs);
}
return super.<API key>(msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ModelPackage.<API key>:
return getSwitchState();
case ModelPackage.<API key>:
return getLogger();
case ModelPackage.<API key>:
return getUid();
case ModelPackage.<API key>:
return isPoll();
case ModelPackage.<API key>:
return getEnabledA();
case ModelPackage.<API key>:
return getSubId();
case ModelPackage.<API key>:
return getMbrick();
case ModelPackage.<API key>:
return getDeviceType();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ModelPackage.<API key>:
setSwitchState((OnOffValue) newValue);
return;
case ModelPackage.<API key>:
setLogger((Logger) newValue);
return;
case ModelPackage.<API key>:
setUid((String) newValue);
return;
case ModelPackage.<API key>:
setPoll((Boolean) newValue);
return;
case ModelPackage.<API key>:
setEnabledA((AtomicBoolean) newValue);
return;
case ModelPackage.<API key>:
setSubId((String) newValue);
return;
case ModelPackage.<API key>:
setMbrick((<API key>) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ModelPackage.<API key>:
setSwitchState(<API key>);
return;
case ModelPackage.<API key>:
setLogger(LOGGER_EDEFAULT);
return;
case ModelPackage.<API key>:
setUid(UID_EDEFAULT);
return;
case ModelPackage.<API key>:
setPoll(POLL_EDEFAULT);
return;
case ModelPackage.<API key>:
setEnabledA(ENABLED_A_EDEFAULT);
return;
case ModelPackage.<API key>:
setSubId(SUB_ID_EDEFAULT);
return;
case ModelPackage.<API key>:
setMbrick((<API key>) null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ModelPackage.<API key>:
return <API key> == null ? switchState != null : !<API key>.equals(switchState);
case ModelPackage.<API key>:
return LOGGER_EDEFAULT == null ? logger != null : !LOGGER_EDEFAULT.equals(logger);
case ModelPackage.<API key>:
return UID_EDEFAULT == null ? uid != null : !UID_EDEFAULT.equals(uid);
case ModelPackage.<API key>:
return poll != POLL_EDEFAULT;
case ModelPackage.<API key>:
return ENABLED_A_EDEFAULT == null ? enabledA != null : !ENABLED_A_EDEFAULT.equals(enabledA);
case ModelPackage.<API key>:
return SUB_ID_EDEFAULT == null ? subId != null : !SUB_ID_EDEFAULT.equals(subId);
case ModelPackage.<API key>:
return getMbrick() != null;
case ModelPackage.<API key>:
return <API key> == null ? deviceType != null : !<API key>.equals(deviceType);
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public int <API key>(int derivedFeatureID, Class<?> baseClass) {
if (baseClass == MBaseDevice.class) {
switch (derivedFeatureID) {
case ModelPackage.<API key>:
return ModelPackage.<API key>;
case ModelPackage.<API key>:
return ModelPackage.MBASE_DEVICE__UID;
case ModelPackage.<API key>:
return ModelPackage.MBASE_DEVICE__POLL;
case ModelPackage.<API key>:
return ModelPackage.<API key>;
default:
return -1;
}
}
if (baseClass == MSubDevice.class) {
switch (derivedFeatureID) {
case ModelPackage.<API key>:
return ModelPackage.MSUB_DEVICE__SUB_ID;
case ModelPackage.<API key>:
return ModelPackage.MSUB_DEVICE__MBRICK;
default:
return -1;
}
}
return super.<API key>(derivedFeatureID, baseClass);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public int <API key>(int baseFeatureID, Class<?> baseClass) {
if (baseClass == MBaseDevice.class) {
switch (baseFeatureID) {
case ModelPackage.<API key>:
return ModelPackage.<API key>;
case ModelPackage.MBASE_DEVICE__UID:
return ModelPackage.<API key>;
case ModelPackage.MBASE_DEVICE__POLL:
return ModelPackage.<API key>;
case ModelPackage.<API key>:
return ModelPackage.<API key>;
default:
return -1;
}
}
if (baseClass == MSubDevice.class) {
switch (baseFeatureID) {
case ModelPackage.MSUB_DEVICE__SUB_ID:
return ModelPackage.<API key>;
case ModelPackage.MSUB_DEVICE__MBRICK:
return ModelPackage.<API key>;
default:
return -1;
}
}
return super.<API key>(baseFeatureID, baseClass);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public int eDerivedOperationID(int baseOperationID, Class<?> baseClass) {
if (baseClass == MBaseDevice.class) {
switch (baseOperationID) {
case ModelPackage.MBASE_DEVICE___INIT:
return ModelPackage.<API key>;
case ModelPackage.<API key>:
return ModelPackage.<API key>;
case ModelPackage.<API key>:
return ModelPackage.<API key>;
default:
return -1;
}
}
if (baseClass == MSubDevice.class) {
switch (baseOperationID) {
default:
return -1;
}
}
return super.eDerivedOperationID(baseOperationID, baseClass);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public Object eInvoke(int operationID, EList<?> arguments) throws <API key> {
switch (operationID) {
case ModelPackage.<API key>:
init();
return null;
case ModelPackage.<API key>:
enable();
return null;
case ModelPackage.<API key>:
disable();
return null;
case ModelPackage.<API key>:
turnSwitch((OnOffValue) arguments.get(0));
return null;
case ModelPackage.<API key>:
fetchSwitchState();
return null;
}
return super.eInvoke(operationID, arguments);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) {
return super.toString();
}
StringBuffer result = new StringBuffer(super.toString());
result.append(" (switchState: ");
result.append(switchState);
result.append(", logger: ");
result.append(logger);
result.append(", uid: ");
result.append(uid);
result.append(", poll: ");
result.append(poll);
result.append(", enabledA: ");
result.append(enabledA);
result.append(", subId: ");
result.append(subId);
result.append(", deviceType: ");
result.append(deviceType);
result.append(')');
return result.toString();
}
} // <API key>
|
#!/bin/bash
EXIT_CODE=0
kill_ffmpeg(){
echo "Killing ffmpeg with PID=$ffmpeg_pid"
kill -2 "$ffmpeg_pid"
wait "$ffmpeg_pid"
mkdir -p /tmp/e2e/report/
|
package org.hibernate.envers.tools;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.OneToMany;
import org.hibernate.mapping.ToOne;
import org.hibernate.mapping.Value;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class MappingTools {
/**
* @param componentName Name of the component, that is, name of the property in the entity that references the
* component.
* @return A prefix for properties in the given component.
*/
public static String <API key>(String componentName) {
return componentName + "_";
}
/**
* @param <API key> The name of the property that holds the relation to the entity.
* @return A prefix which should be used to prefix an id mapper for the related entity.
*/
public static String <API key>(String <API key>) {
return <API key> + "_";
}
public static String <API key>(Value value) {
if (value instanceof ToOne) {
return ((ToOne) value).<API key>();
} else if (value instanceof OneToMany) {
return ((OneToMany) value).<API key>();
} else if (value instanceof Collection) {
return <API key>(((Collection) value).getElement());
}
return null;
}
}
|
package com.ibm.ws.security.oauth20.web;
import java.io.IOException;
import java.io.<API key>;
import java.nio.charset.StandardCharsets;
import java.security.Principal;
import java.util.Collection;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.StringTokenizer;
import javax.security.auth.Subject;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.osgi.framework.ServiceReference;
import org.osgi.service.component.ComponentContext;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.ConfigurationPolicy;
import org.osgi.service.component.annotations.Deactivate;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.component.annotations.<API key>;
import org.osgi.service.component.annotations.ReferencePolicy;
import org.osgi.service.component.annotations.<API key>;
import com.ibm.ejs.ras.TraceNLS;
import com.ibm.oauth.core.api.OAuthResult;
import com.ibm.oauth.core.api.attributes.AttributeList;
import com.ibm.oauth.core.api.error.OidcServerException;
import com.ibm.oauth.core.api.error.oauth20.O<API key>;
import com.ibm.oauth.core.api.error.oauth20.O<API key>;
import com.ibm.oauth.core.api.error.oauth20.OAuth20Exception;
import com.ibm.oauth.core.api.oauth20.token.OAuth20Token;
import com.ibm.oauth.core.internal.oauth20.OAuth20Constants;
import com.ibm.oauth.core.internal.oauth20.OAuth20Util;
import com.ibm.oauth.core.internal.oauth20.OAuthResultImpl;
import com.ibm.websphere.ras.Tr;
import com.ibm.websphere.ras.TraceComponent;
import com.ibm.websphere.security.WSSecurityException;
import com.ibm.websphere.security.auth.WSSubject;
import com.ibm.ws.ffdc.FFDCFilter;
import com.ibm.ws.ffdc.annotation.FFDCIgnore;
import com.ibm.ws.security.SecurityService;
import com.ibm.ws.security.common.claims.UserClaims;
import com.ibm.ws.security.oauth20.ProvidersService;
import com.ibm.ws.security.oauth20.api.Constants;
import com.ibm.ws.security.oauth20.api.O<API key>;
import com.ibm.ws.security.oauth20.api.OAuth20Provider;
import com.ibm.ws.security.oauth20.error.impl.O<API key>;
import com.ibm.ws.security.oauth20.exception.O<API key>;
import com.ibm.ws.security.oauth20.plugins.OAuth20TokenImpl;
import com.ibm.ws.security.oauth20.plugins.OidcBaseClient;
import com.ibm.ws.security.oauth20.util.ConfigUtils;
import com.ibm.ws.security.oauth20.util.Nonce;
import com.ibm.ws.security.oauth20.util.<API key>;
import com.ibm.ws.security.oauth20.util.OIDCConstants;
import com.ibm.ws.security.oauth20.util.OidcOAuth20Util;
import com.ibm.ws.security.oauth20.web.OAuth20Request.EndpointType;
import com.ibm.ws.webcontainer.security.CookieHelper;
import com.ibm.ws.webcontainer.security.<API key>;
import com.ibm.ws.webcontainer.security.<API key>;
import com.ibm.wsspi.kernel.service.utils.<API key>;
import com.ibm.wsspi.kernel.service.utils.<API key>;
import com.ibm.wsspi.security.oauth20.<API key>;
import com.ibm.wsspi.security.oauth20.<API key>;
@Component(service = O<API key>.class, name = "com.ibm.ws.security.oauth20.web.O<API key>, immediate = true, configurationPolicy = ConfigurationPolicy.IGNORE, property = "service.vendor=IBM")
public class O<API key> {
private static TraceComponent tc = Tr.register(O<API key>.class);
private static TraceComponent tc2 = Tr.register(O<API key>.class, // use this one when bundle is the usual bundle.
TraceConstants.TRACE_GROUP,
TraceConstants.MESSAGE_BUNDLE);
protected static final String MESSAGE_BUNDLE = "com.ibm.ws.security.oauth20.internal.resources.OAuthMessages";
protected static final String MSG_RESOURCE_BUNDLE = "com.ibm.ws.security.oauth20.resources.ProviderMsgs";
public static final String KEY_SERVICE_PID = "service.pid";
public static final String <API key> = "securityService";
protected final <API key><SecurityService> securityServiceRef = new <API key><SecurityService>(<API key>);
public static final String KEY_<API key> = "<API key>;
private final <API key><String, <API key>> <API key> = new <API key><String, <API key>>(KEY_<API key>);
public static final String KEY_JWT_MEDIATOR = "<API key>";
private final <API key><String, <API key>> <API key> = new <API key><String, <API key>>(KEY_JWT_MEDIATOR);
public static final String KEY_O<API key> = "o<API key>;
private static final <API key><O<API key>> o<API key> = new <API key><O<API key>>(KEY_O<API key>);
private static final String ATTR_NONCE = "consentNonce";
public static final String AUTHENTICATED = "authenticated";
protected volatile <API key> <API key> = new <API key>();
protected volatile ClientAuthorization clientAuthorization = new ClientAuthorization();
protected volatile UserAuthentication userAuthentication = new UserAuthentication();
protected volatile <API key> coverageMapServices = new <API key>();
protected volatile <API key> <API key> = new <API key>();
protected volatile Consent consent = new Consent();
protected volatile TokenExchange tokenExchange = new TokenExchange();
@Reference(service = SecurityService.class, name = <API key>, policy = ReferencePolicy.DYNAMIC, policyOption = <API key>.GREEDY)
protected void setSecurityService(ServiceReference<SecurityService> reference) {
securityServiceRef.setReference(reference);
}
protected void <API key>(ServiceReference<SecurityService> reference) {
securityServiceRef.unsetReference(reference);
}
@Reference(service = <API key>.class, name = KEY_<API key>, policy = ReferencePolicy.DYNAMIC, cardinality = <API key>.MULTIPLE, policyOption = <API key>.GREEDY)
protected void set<API key>(ServiceReference<<API key>> ref) {
synchronized (<API key>) {
<API key>.putReference((String) ref.getProperty(KEY_SERVICE_PID), ref);
}
}
protected void unset<API key>(ServiceReference<<API key>> ref) {
synchronized (<API key>) {
<API key>.removeReference((String) ref.getProperty(KEY_SERVICE_PID), ref);
}
}
@Reference(service = <API key>.class, name = KEY_JWT_MEDIATOR, policy = ReferencePolicy.DYNAMIC, cardinality = <API key>.OPTIONAL, policyOption = <API key>.GREEDY)
protected void <API key>(ServiceReference<<API key>> ref) {
synchronized (<API key>) {
<API key>.putReference((String) ref.getProperty(KEY_SERVICE_PID), ref);
}
}
protected void <API key>(ServiceReference<<API key>> ref) {
synchronized (<API key>) {
<API key>.removeReference((String) ref.getProperty(KEY_SERVICE_PID), ref);
}
}
@Reference(service = O<API key>.class, name = KEY_O<API key>, policy = ReferencePolicy.DYNAMIC)
protected void setO<API key>(ServiceReference<O<API key>> ref) {
o<API key>.setReference(ref);
}
protected void unsetO<API key>(ServiceReference<O<API key>> ref) {
o<API key>.unsetReference(ref);
}
@Activate
protected void activate(ComponentContext cc) {
securityServiceRef.activate(cc);
<API key>.activate(cc);
<API key>.activate(cc);
o<API key>.activate(cc);
ConfigUtils.<API key>(<API key>);
TokenIntrospect.setTokenIntrospect(<API key>);
// The TraceComponent object was not initialized with the message bundle containing this message, so we cannot use
// Tr.info(tc, "O<API key>). Eventually these messages will be merged into one file, making this infoMsg variable unnecessary
String infoMsg = TraceNLS.getFormattedMessage(this.getClass(),
MESSAGE_BUNDLE,
"O<API key>,
null,
"CWWKS1410I: The OAuth endpoint service is activated.");
Tr.info(tc, infoMsg);
}
@Deactivate
protected void deactivate(ComponentContext cc) {
securityServiceRef.deactivate(cc);
<API key>.deactivate(cc);
<API key>.deactivate(cc);
o<API key>.deactivate(cc);
}
protected void handleOAuthRequest(HttpServletRequest request,
HttpServletResponse response,
ServletContext servletContext) throws ServletException, IOException {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Checking if OAuth20 Provider should process the request.");
Tr.debug(tc, "Inbound request " + com.ibm.ws.security.common.web.WebUtils.<API key>(request, "client_secret"));
}
OAuth20Request oauth20Request = getAuth20Request(request, response);
OAuth20Provider oauth20Provider = null;
if (oauth20Request != null) {
EndpointType endpointType = oauth20Request.getType();
oauth20Provider = getProvider(response, oauth20Request);
if (oauth20Provider != null) {
AttributeList optionalParams = new AttributeList();
if (tc.isDebugEnabled()) {
Tr.debug(tc, "OAUTH20 _SSO OP PROCESS IS STARTING.");
Tr.debug(tc, "OAUTH20 _SSO OP inbound URL " + com.ibm.ws.security.common.web.WebUtils.<API key>(request, "client_secret"));
}
<API key>(request, response, servletContext, oauth20Provider, endpointType, optionalParams);
}
}
if (tc.isDebugEnabled()) {
if (oauth20Provider != null) {
Tr.debug(tc, "OAUTH20 _SSO OP PROCESS HAS ENDED.");
} else {
Tr.debug(tc, "OAUTH20 _SSO OP WILL NOT PROCESS THE REQUEST");
}
}
}
@FFDCIgnore({ OidcServerException.class })
protected void <API key>(HttpServletRequest request,
HttpServletResponse response,
ServletContext servletContext,
OAuth20Provider oauth20Provider,
EndpointType endpointType,
AttributeList oidcOptionalParams) throws ServletException, IOException {
<API key>(request, response, oauth20Provider);
if (response.isCommitted()) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Response has already been committed, so likely did not pass HTTPS requirement");
}
return;
}
boolean <API key> = false;
<API key> uitb = null;
if (tc.isDebugEnabled()) {
Tr.debug(tc, "endpointType[" + endpointType + "]");
}
try {
switch (endpointType) {
case authorize:
OAuthResult result = process<API key>(oauth20Provider, request, response, servletContext, oidcOptionalParams);
if (result != null) {
if (result.getStatus() == OAuthResult.TAI_CHALLENGE) { // SPNEGO negotiate
break;
} else if (result.getStatus() != OAuthResult.STATUS_OK) {
userAuthentication.renderErrorPage(oauth20Provider, request, response, result);
}
}
break;
case token:
if (<API key>.verify(oauth20Provider, request, response, endpointType)) {
processTokenRequest(oauth20Provider, request, response);
}
break;
case introspect:
if (<API key>.verify(oauth20Provider, request, response, endpointType)) {
introspect(oauth20Provider, request, response);
}
break;
case revoke:
if (<API key>.verify(oauth20Provider, request, response, endpointType)) {
revoke(oauth20Provider, request, response);
}
break;
case coverage_map: // non-spec extension
coverageMapServices.<API key>(oauth20Provider, request, response);
break;
case registration:
<API key>(oauth20Provider, request, response, servletContext, <API key>.ROLE_REQUIRED, true);
<API key>.<API key>(oauth20Provider, request, response);
break;
case logout:
// no need to authenticate
logout(oauth20Provider, request, response);
break;
case app_password:
tokenExchange.processAppPassword(oauth20Provider, request, response);
break;
case app_token:
tokenExchange.processAppToken(oauth20Provider, request, response);
break;
// these next 3 are for UI pages
case clientManagement:
if (!authenticateUI(request, response, servletContext, oauth20Provider, oidcOptionalParams, <API key>.ROLE_REQUIRED)) {
break;
}
// new MockUiPage(request, response).render(); // TODO: replace with hook to real ui.
RequestDispatcher rd = servletContext.<API key>("WEB-CONTENT/clientAdmin/index.jsp");
rd.forward(request, response);
break;
case <API key>:
if (!authenticateUI(request, response, servletContext, oauth20Provider, oidcOptionalParams, null)) {
break;
}
checkUIConfig(oauth20Provider, request);
// put auth header and access token and feature enablement state into request attributes for ui to use
uitb = new <API key>(oauth20Provider, request);
uitb.<API key>();
// new MockUiPage(request, response).render(); // TODO: replace with hook to real ui.
RequestDispatcher rd2 = servletContext.<API key>("WEB-CONTENT/accountManager/index.jsp");
rd2.forward(request, response);
break;
case <API key>:
if (!authenticateUI(request, response, servletContext, oauth20Provider, oidcOptionalParams, OAuth20Constants.TOKEN_MANAGER_ROLE)) {
break;
}
checkUIConfig(oauth20Provider, request);
// put auth header and access token and feature enablement state into request attributes for ui to use
uitb = new <API key>(oauth20Provider, request);
uitb.<API key>();
// new MockUiPage(request, response).render(); // TODO: replace with hook to real ui.
RequestDispatcher rd3 = servletContext.<API key>("WEB-CONTENT/tokenManager/index.jsp");
rd3.forward(request, response);
break;
case clientMetatype:
<API key>(request, response);
break;
default:
break;
}
} catch (OidcServerException e) {
if (!<API key>) {
// we don't want routine browser auth challenges producing ffdc's.
// (but if a login is invalid in that case, we will still get a CWIML4537E from base sec.)
// however for non-browsers we want ffdc's like we had before, so generate manually
if (!e.getErrorDescription().contains("CWWKS1424E")) { // no ffdc for nonexistent clients
com.ibm.ws.ffdc.FFDCFilter.processException(e,
"com.ibm.ws.security.oauth20.web.O<API key>, "324", this);
}
}
boolean <API key> = <API key>; // ui must NOT log in using basic auth, so logout function will work.
WebUtils.sendErrorJSON(response, e.getHttpStatus(), e.getErrorCode(), e.getErrorDescription(request.getLocales()), <API key>);
}
}
// return true if clear to go, false otherwise. Log message and/or throw exception if unsuccessful
private boolean authenticateUI(HttpServletRequest request, HttpServletResponse response,
ServletContext servletContext, OAuth20Provider provider, AttributeList options, String requiredRole)
throws ServletException, IOException, OidcServerException {
OAuthResult result = <API key>(request, response, servletContext, provider, options);
if (!isUI<API key>(request, response, provider, result, requiredRole)) {
return false;
}
return true;
}
private boolean isUI<API key>(HttpServletRequest request, HttpServletResponse response, OAuth20Provider provider, OAuthResult result, String requiredRole) throws OidcServerException {
if (result == null) { // sent to login page
return false;
}
if (result.getStatus() == OAuthResult.TAI_CHALLENGE) { // SPNEGO negotiate
return false;
}
if (result.getStatus() != OAuthResult.STATUS_OK) {
try {
userAuthentication.renderErrorPage(provider, request, response, result);
} catch (Exception e) {
// ffdc
}
return false;
}
if (requiredRole != null && !request.isUserInRole(requiredRole)) {
throw new OidcServerException("403", OIDCConstants.ERROR_ACCESS_DENIED, HttpServletResponse.SC_FORBIDDEN);
}
return true;
}
void <API key>(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
O<API key> metatypeService = o<API key>.getService();
if (metatypeService == null) {
response.sendError(HttpServletResponse.<API key>);
return;
}
metatypeService.<API key>(request, response);
}
private boolean checkUIConfig(OAuth20Provider provider, HttpServletRequest request) {
String uri = request.getRequestURI();
String id = provider.getInternalClientId();
String secret = provider.<API key>();
OidcBaseClient client = null;
boolean result = false;
try {
client = provider.getClientProvider().get(id);
} catch (OidcServerException e) {
// ffdc
}
if (client != null) {
result = secret != null && client.isEnabled() && (client.<API key>() || client.isAppTokenAllowed());
}
if (!result) {
Tr.warning(tc2, "O<API key>, uri);
}
return result;
}
public void logout(OAuth20Provider provider,
HttpServletRequest request,
HttpServletResponse response) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Processing logout");
}
try {
request.logout(); // ltpa cookie removed if present. No exception if not.
} catch (ServletException e) {
FFDCFilter.processException(e,
this.getClass().getName(), "logout",
new Object[] {});
new LogoutPages().<API key>(request, response);
return;
}
// not part of spec: logout url defined in config, not client-specific
String logoutRedirectURL = provider.<API key>();
try {
if (logoutRedirectURL != null) {
String encodedURL = URLEncodeParams(logoutRedirectURL);
if (tc.isDebugEnabled()) {
Tr.debug(tc, "OAUTH20 _SSO OP redirecting to [" + logoutRedirectURL + "], url encoded to [" + encodedURL + "]");
}
response.sendRedirect(encodedURL);
return;
} else {
// send default logout page
new LogoutPages().<API key>(request, response);
}
} catch (IOException e) {
FFDCFilter.processException(e,
this.getClass().getName(), "logout",
new Object[] {});
new LogoutPages().<API key>(request, response);
}
}
String URLEncodeParams(String UrlStr) {
String sep = "?";
String encodedURL = UrlStr;
int index = UrlStr.indexOf(sep);
// if encoded url in server.xml, don't encode it again.
boolean alreadyEncoded = UrlStr.contains("%");
if (index > -1 && !alreadyEncoded) {
index++; // don't encode ?
String prefix = UrlStr.substring(0, index);
String suffix = UrlStr.substring(index);
try {
encodedURL = prefix + java.net.URLEncoder.encode(suffix, StandardCharsets.UTF_8.toString());
// shouldn't encode = in queries, so flip those back
encodedURL = encodedURL.replace("%3D", "=");
} catch (<API key> e) {
// ffdc
}
}
return encodedURL;
}
public OAuthResult process<API key>(OAuth20Provider provider, HttpServletRequest request, HttpServletResponse response,
ServletContext servletContext, AttributeList options)
throws ServletException, IOException, OidcServerException {
OAuthResult oauthResult = checkForError(request);
if (oauthResult != null) {
return oauthResult;
}
boolean autoAuthz = clientAuthorization.<API key>(provider, request);
String reqConsentNonce = getReqConsentNonce(request);
boolean afterLogin = isAfterLogin(request); // we've been to login.jsp or it's replacement.
if (reqConsentNonce == null) { // validate request for initial authorization request only
oauthResult = clientAuthorization.<API key>(provider, request, response);
if (oauthResult.getStatus() != OAuthResult.STATUS_OK) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Status is OK, returning result");
}
return oauthResult;
}
}
oauthResult = <API key>(oauthResult, request, response, servletContext,
provider, reqConsentNonce, options, autoAuthz, afterLogin);
return oauthResult;
}
/**
* Adds the <API key>, <API key>, and <API key> attributes from the options list
* into attrList, if those attributes exist.
*
* @param options
* @param attrList
*/
private void <API key>(AttributeList options, AttributeList attrList) {
String value = options.<API key>(OIDCConstants.OIDC_<API key>);
if (value != null) {
attrList.setAttribute(OIDCConstants.OIDC_<API key>, OAuth20Constants.ATTRTYPE_REQUEST, new String[] { value });
}
value = options.<API key>(OIDCConstants.OIDC_<API key>);
if (value != null) {
attrList.setAttribute(OIDCConstants.OIDC_<API key>, OAuth20Constants.ATTRTYPE_REQUEST, new String[] { value });
}
value = options.<API key>(OIDCConstants.OIDC_<API key>);
if (value != null) {
attrList.setAttribute(OIDCConstants.OIDC_<API key>, OAuth20Constants.ATTRTYPE_REQUEST, new String[] { value });
}
}
/**
* @param attrs
* @param request
* @return OAuthResultImpl if validation failed, null otherwise.
*/
private OAuthResultImpl <API key>(AttributeList attrs, HttpServletRequest request) {
if (attrs != null) {
Principal user = request.getUserPrincipal();
String username = null;
if (user != null) {
username = user.getName();
}
try {
userAuthentication.validateIdTokenHint(username, attrs);
} catch (OAuth20Exception oe) {
return new OAuthResultImpl(OAuthResult.STATUS_FAILED, attrs, oe);
}
}
return null;
}
/**
* Creates a 401 STATUS_FAILED result due to the token limit being reached.
*
* @param attrs
* @param request
* @param clientId
* @return
*/
private OAuthResult <API key>(AttributeList attrs, HttpServletRequest request, String clientId) {
if (attrs == null) {
attrs = new AttributeList();
String responseType = request.getParameter(OAuth20Constants.RESPONSE_TYPE);
attrs.setAttribute(OAuth20Constants.RESPONSE_TYPE, OAuth20Constants.RESPONSE_TYPE, new String[] { responseType });
attrs.setAttribute(OAuth20Constants.CLIENT_ID, OAuth20Constants.CLIENT_ID, new String[] { clientId });
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Attribute responseType:" + responseType + " client_id:" + clientId);
}
}
O<API key> e = new O<API key>("security.oauth20.token.limit.external.error");
e.setHttpStatusCode(HttpServletResponse.SC_BAD_REQUEST);
OAuthResult <API key> = new OAuthResultImpl(OAuthResult.STATUS_FAILED, attrs, e);
return <API key>;
}
private OAuthResult <API key>(HttpServletRequest request, HttpServletResponse response,
ServletContext servletContext, OAuth20Provider provider, AttributeList options) throws IOException, ServletException, OidcServerException {
OAuthResult oauthResult = null;
Prompt prompt = new Prompt();
if (request.getUserPrincipal() == null) {
// authenticate user if not done yet. Send to login page.
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Authenticate user if not done yet");
}
oauthResult = userAuthentication.handle<API key>(provider, request, response, prompt, securityServiceRef, servletContext, O<API key>.AUTHENTICATED, oauthResult);
}
if (request.getUserPrincipal() == null) { // must be redirect
return oauthResult;
} else if (CookieHelper.getCookieValue(request.getCookies(), <API key>.<API key>) != null) {
<API key> handler = <API key>.<API key>().<API key>(); // GM 2017.05.31
// <API key> handler = new <API key>(<API key>.<API key>());
handler.<API key>(request, response, <API key>.<API key>);
}
if (!request.isUserInRole(AUTHENTICATED)) { // must be authorized, we'll check userInRole later.
Tr.audit(tc, "security.oauth20.error.authorization", request.getUserPrincipal().getName());
response.sendError(HttpServletResponse.SC_FORBIDDEN);
return oauthResult;
}
return new OAuthResultImpl(OAuthResult.STATUS_OK, new AttributeList());
}
@FFDCIgnore({ O<API key>.class })
private OAuthResult <API key>(OAuthResult oauthResult, HttpServletRequest request, HttpServletResponse response,
ServletContext servletContext, OAuth20Provider provider,
String reqConsentNonce, AttributeList options, boolean autoauthz, boolean afterLogin) throws IOException, ServletException, OidcServerException {
Prompt prompt = null;
String[] scopesAttr = null;
AttributeList attrs = null;
if (oauthResult != null) {
attrs = oauthResult.getAttributeList();
scopesAttr = attrs.<API key>(OAuth20Constants.SCOPE);
if (options != null) {
<API key>(options, attrs);
}
String[] validResources = attrs.<API key>(OAuth20Constants.RESOURCE);
if (validResources != null) {
options.setAttribute(OAuth20Constants.RESOURCE, OAuth20Constants.<API key>, validResources);
}
}
// Per section 4.1.2.1 of the OAuth 2.0 spec (RFC6749), the state parameter must be included in any error response if it was
// originally provided in the request. Adding it to the attribute list here will ensure it is propagated to any failure response.
String[] stateParams = request.getParameterValues(OAuth20Constants.STATE);
if (stateParams != null) {
if (attrs == null) {
attrs = new AttributeList();
}
attrs.setAttribute(OAuth20Constants.STATE, OAuth20Constants.<API key>, stateParams);
}
boolean isOpenId = false;
if (scopesAttr != null) {
for (String scope : scopesAttr) {
if (OIDCConstants.SCOPE_OPENID.equals(scope)) {
isOpenId = true;
break;
}
}
}
if (isOpenId) {
// if id_token_hint exists and user is already logged in, compare...
OAuthResultImpl result = <API key>(attrs, request);
if (result != null) {
return result;
}
}
prompt = new Prompt(request);
if (request.getUserPrincipal() == null || (prompt.hasLogin() && !afterLogin)) {
// authenticate user if not done yet
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Authenticate user if not done yet");
}
oauthResult = userAuthentication.handle<API key>(provider, request, response, prompt, securityServiceRef, servletContext, O<API key>.AUTHENTICATED, oauthResult);
}
if (request.getUserPrincipal() == null) { // must be redirect
return oauthResult;
} else if (CookieHelper.getCookieValue(request.getCookies(), <API key>.<API key>) != null) {
<API key> handler = <API key>.<API key>().<API key>(); // GM 2017.05.31
// <API key> handler = new <API key>(<API key>.<API key>());
handler.<API key>(request, response, <API key>.<API key>);
}
if (!request.isUserInRole(AUTHENTICATED) && !request.isUserInRole(OAuth20Constants.TOKEN_MANAGER_ROLE)) { // must be authorized
Tr.audit(tc, "security.oauth20.error.authorization", request.getUserPrincipal().getName());
response.sendError(HttpServletResponse.SC_FORBIDDEN);
return oauthResult;
}
if (reqConsentNonce != null && !consent.isNonceValid(request, reqConsentNonce)) { // nonce must be valid if has one
consent.handleNonceError(request, response);
return oauthResult;
}
String clientId = getClientId(request);
String[] reducedScopes = null;
try {
reducedScopes = clientAuthorization.getReducedScopes(provider, request, clientId, true);
} catch (Exception e1) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Caught exception, so setting reduced scopes to null. Exception was: " + e1);
}
reducedScopes = null;
}
boolean preAuthzed = false;
if (reqConsentNonce == null) {
try {
preAuthzed = clientAuthorization.<API key>(provider, clientId, reducedScopes);
} catch (Exception e) {
preAuthzed = false;
}
}
// Handle consent
if (!autoauthz && !preAuthzed && reqConsentNonce == null && !consent.isCachedAndValid(oauthResult, provider, request, response)) {
if (prompt.hasNone()) {
// Prompt includes "none," however authorization has not been obtained or cached; return error
oauthResult = prompt.<API key>(attrs);
} else {
// ask user for approval if not auto authorized, or not approved
Nonce nonce = consent.setNonce(request);
if (tc.isDebugEnabled()) {
Tr.debug(tc, "_SSO OP redirecting for consent");
}
consent.renderConsentForm(request, response, provider, clientId, nonce, oauthResult.getAttributeList(), servletContext);
}
return oauthResult;
}
if (reachedTokenLimit(provider, request)) {
return <API key>(attrs, request, clientId);
}
if (request.getAttribute(OAuth20Constants.<API key>) != null) {
// Ensure that the reduced scopes list is not empty
oauthResult = clientAuthorization.<API key>(reducedScopes, oauthResult, request, provider, clientId);
if (oauthResult != null && oauthResult.getStatus() != OAuthResult.STATUS_OK) {
response.setStatus(HttpServletResponse.SC_FOUND);
return oauthResult;
}
}
// getBack the resource. better double check it
OidcBaseClient client;
try {
client = <API key>.<API key>(provider, clientId);
<API key>.validateResource(request, options, client);
} catch (O<API key> e) { // some exceptions need to handled separately
WebUtils.<API key>(request, e);
} catch (OAuth20Exception e) {
WebUtils.<API key>(request, e);
}
if (options != null) {
options.setAttribute(OAuth20Constants.SCOPE, OAuth20Constants.<API key>, reducedScopes);
}
if (provider.isTrackOAuthClients()) {
OAuthClientTracker clientTracker = new OAuthClientTracker(request, response, provider);
clientTracker.trackOAuthClient(clientId);
}
consent.handleConsent(provider, request, prompt, clientId);
<API key>(request, options);
oauthResult = provider.<API key>(request, response, options);
return oauthResult;
}
/**
* Secure registration services with BASIC Auth and validating against the required role.
*
* @param provider
* @param request
* @param response
* @param servletContext
* @param requiredRole - user must be in this role.
* @param fallbacktoBasicAuth - if false, if there is no cookie on the request, then no basic auth challenge will be sent back to browser.
* @throws OidcServerException
*/
@FFDCIgnore({ OidcServerException.class })
private void <API key>(OAuth20Provider provider, HttpServletRequest request, HttpServletResponse response, ServletContext servletContext, String requiredRole, boolean fallbackToBasicAuth) throws OidcServerException {
try {
userAuthentication.handleBasic<API key>(provider, request, response, securityServiceRef, servletContext, requiredRole, fallbackToBasicAuth);
} catch (OidcServerException e) {
if (fallbackToBasicAuth) {
if (e.getHttpStatus() == HttpServletResponse.SC_UNAUTHORIZED) {
response.setHeader(<API key>.<API key>, <API key>.UN<API key>);
}
}
throw e;
}
}
@FFDCIgnore({ O<API key>.class })
public void processTokenRequest(OAuth20Provider provider, HttpServletRequest request, HttpServletResponse response) throws ServletException, OidcServerException {
String clientId = (String) request.getAttribute("authenticatedClient");
try {
// checking resource
OidcBaseClient client = <API key>.<API key>(provider, clientId);
if (client == null || !client.isEnabled()) {
throw new OidcServerException("security.oauth20.error.invalid.client", OIDCConstants.<API key>, HttpServletResponse.SC_BAD_REQUEST);
}
<API key>.validateResource(request, null, client);
} catch (O<API key> e) { // some exceptions need to handled separately
WebUtils.<API key>(request, e);
} catch (OAuth20Exception e) {
WebUtils.<API key>(request, e);
}
OAuthResult result = clientAuthorization.<API key>(provider, request, response, clientId);
if (result.getStatus() == OAuthResult.STATUS_OK) {
result = provider.processTokenRequest(clientId, request, response);
}
if (result.getStatus() != OAuthResult.STATUS_OK) {
O<API key> handler = new O<API key>();
handler.<API key>(request, response, result);
}
}
/**
* Get the access token from the request's token parameter and look it up in
* the token cache.
*
* If the access token is found in the cache return status 200 and a JSON object.
*
* If the token is not found or the request had errors return status 400.
*
* @param provider
* @param request
* @param response
* @throws OidcServerException
* @throws IOException
*/
public void introspect(OAuth20Provider provider,
HttpServletRequest request,
HttpServletResponse response) throws OidcServerException, IOException {
TokenIntrospect tokenIntrospect = new TokenIntrospect();
tokenIntrospect.introspect(provider, request, response);
}
/**
* Revoke the provided token by removing it from the cache
*
* If the access token is found in the cache remove it from the cache
* and return status 200.
*
* @param provider
* @param request
* @param response
*/
public void revoke(OAuth20Provider provider,
HttpServletRequest request,
HttpServletResponse response) {
try {
String tokenString = request.getParameter(com.ibm.ws.security.oauth20.util.UtilConstants.TOKEN);
if (tokenString == null) {
// send 400 per OAuth Token revocation spec
WebUtils.sendErrorJSON(response, HttpServletResponse.SC_BAD_REQUEST,
Constants.<API key>, null); // invalid_request
return;
}
String tokenLookupStr = tokenString;
OAuth20Token token = null;
boolean <API key> = false;
if (OidcOAuth20Util.isJwtToken(tokenString)) {
tokenLookupStr = com.ibm.ws.security.oauth20.util.HashUtils.digest(tokenString);
} else if (tokenString.length() == (provider.<API key>() + 2)) {
// app-token
String encode = provider.<API key>();
if (OAuth20Constants.PLAIN_ENCODING.equals(encode)) { // must be app-password or app-token
tokenLookupStr = EndpointUtils.computeTokenHash(tokenString);
} else {
tokenLookupStr = EndpointUtils.computeTokenHash(tokenString, encode);
}
<API key> = true;
}
if (<API key>) {
token = provider.getTokenCache().getByHash(tokenLookupStr);
} else {
token = provider.getTokenCache().get(tokenLookupStr);
}
boolean isAppPassword = false;
if (token != null && OAuth20Constants.APP_PASSWORD.equals(token.getGrantType())) {
isAppPassword = true;
Tr.error(tc, "security.oauth20.apppwtok.revoke.disallowed", new Object[] {});
}
if (token == null) {
// send 200 per OAuth Token revocation spec
response.setStatus(HttpServletResponse.SC_OK);
if (tc.isDebugEnabled()) {
Tr.debug(tc, "token " + tokenString + " not in cache or wrong token type, return");
}
return;
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, "token type: " + token.getType());
}
ClientAuthnData clientAuthData = new ClientAuthnData(request, response);
if (clientAuthData.hasAuthnData() &&
clientAuthData.getUserName().equals(token.getClientId()) == true) {
if (!isAppPassword && ((token.getType().equals(OAuth20Constants.<API key>) &&
token.getSubType().equals(OAuth20Constants.<API key>)) ||
token.getType().equals(OAuth20Constants.<API key>))) {
// Revoke the token by removing it from the cache
if (tc.isDebugEnabled()) {
OAuth20Token theToken = provider.getTokenCache().get(tokenLookupStr);
String buf = (theToken != null) ? "is in the cache" : "is not in the cache";
Tr.debug(tc, "token " + tokenLookupStr + " " + buf + ", calling remove");
}
if (<API key>) {
provider.getTokenCache().removeByHash(tokenLookupStr);
} else {
provider.getTokenCache().remove(tokenLookupStr);
}
if (token.getSubType().equals(OAuth20Constants.<API key>)) {
<API key>(request, provider, token);
}
response.setStatus(HttpServletResponse.SC_OK);
} else {
// Unsupported token type, send 400 per RFC7009 OAuth Token revocation spec
WebUtils.sendErrorJSON(response, HttpServletResponse.SC_BAD_REQUEST,
Constants.<API key>, null);
}
} else {
// client is not authorized. send 400 per RFC6749 5.2 OAuth Token revocation spec
String defaultMsg = "CWWKS1406E: The revoke request had an invalid client credential. The request URI was {" + request.getRequestURI() + "}.";
String errorMsg = TraceNLS.getFormattedMessage(this.getClass(),
MESSAGE_BUNDLE,
"<API key>",
new Object[] { "revoke", request.getRequestURI() },
defaultMsg);
WebUtils.sendErrorJSON(response, HttpServletResponse.SC_BAD_REQUEST,
Constants.<API key>, errorMsg);
}
} catch (O<API key> e) {
// Duplicate parameter found in request
WebUtils.sendErrorJSON(response, HttpServletResponse.SC_BAD_REQUEST, Constants.<API key>, e.getMessage());
} catch (Exception e) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Internal error processing token revoke request", e);
}
try {
response.sendError(HttpServletResponse.<API key>);
} catch (IOException ioe) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Internal error process token introspect revoke error", ioe);
}
}
}
}
/**
* For OpenidConnect, when a refresh token is revoked, also delete all access tokens that have become associated with it.
* (Each time a refresh token is submitted for a new one, the prior access tokens become associated with the new refresh token)
* @param request
* @param provider
* @param refreshToken
* @throws Exception
*/
private void <API key>(HttpServletRequest request, OAuth20Provider provider, OAuth20Token refreshToken) throws Exception {
String contextPath = request.getContextPath();
if (contextPath != null && !contextPath.equals("/oidc")) {
// if this is for oauth, return. Oauth's persistence code doesn't support this token association.
// and we only wanted revocation for oidc, we wanted to leave oauth alone.
if (tc.isDebugEnabled()) {
Tr.debug(tc, "not oidc, returning");
}
return;
}
if (!provider.getRevokeAccess<API key>()) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "provider prop revokeAccess<API key> is false, returning");
}
return;
}
String username = refreshToken.getUsername();
String clientId = refreshToken.getClientId();
String refreshTokenId = refreshToken.getId();
O<API key> cache = provider.getTokenCache();
Collection<OAuth20Token> ctokens = cache.getAllUserTokens(username);
for (OAuth20Token ctoken : ctokens) {
boolean nullGuard = (cache != null && ctoken.getType() != null && clientId != null && ctoken.getClientId() != null && ctoken.getId() != null);
if (nullGuard && OAuth20Constants.<API key>.equals(ctoken.getType()) && clientId.equals(ctoken.getClientId())
&& refreshTokenId.equals(((OAuth20TokenImpl) ctoken).getRefreshTokenKey())) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "removing token: " + ctoken.getId());
}
cache.remove(ctoken.getId());
}
}
}
protected void <API key>(HttpServletRequest request, HttpServletResponse response, OAuth20Provider provider) throws IOException {
String url = request.getRequestURL().toString();
if (provider.isHttpsRequired()) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Checking if URL starts with https: " + url);
}
if (url != null && !url.startsWith("https")) {
Tr.error(tc, "security.oauth20.error.wrong.http.scheme", new Object[] { url });
response.sendError(HttpServletResponse.SC_NOT_FOUND,
Tr.formatMessage(tc, "security.oauth20.error.wrong.http.scheme",
new Object[] { url }));
}
}
}
/**
* Determines if this user hit the token limit for the user / client combination
*
* @param provider
* @param request
* @return
*/
protected boolean reachedTokenLimit(OAuth20Provider provider, HttpServletRequest request) {
String userName = getUserName(request);
String clientId = getClientId(request);
long limit = provider.<API key>();
if (limit > 0) {
long numtokens = provider.getTokenCache().getNumTokens(userName, clientId);
if (numtokens >= limit) {
Tr.error(tc, "security.oauth20.token.limit.error", new Object[] { userName, clientId, limit });
return true;
}
}
return false;
}
private OAuth20Request getAuth20Request(HttpServletRequest request, HttpServletResponse response) throws IOException {
OAuth20Request oauth20Request = (OAuth20Request) request.getAttribute(OAuth20Constants.O<API key>);
if (oauth20Request == null) {
String errorMsg = TraceNLS.getFormattedMessage(this.getClass(),
MESSAGE_BUNDLE,
"O<API key>,
new Object[] { request.getRequestURI(), OAuth20Constants.O<API key> },
"CWWKS1412E: The request endpoint {0} does not have attribute {1}.");
Tr.error(tc, errorMsg);
response.sendError(HttpServletResponse.SC_NOT_FOUND);
}
return oauth20Request;
}
private OAuth20Provider getProvider(HttpServletResponse response, OAuth20Request oauth20Request) throws IOException {
OAuth20Provider provider = ProvidersService.getOAuth20Provider(oauth20Request.getProviderName());
if (provider == null) {
String errorMsg = TraceNLS.getFormattedMessage(this.getClass(),
MESSAGE_BUNDLE,
"O<API key>,
new Object[] { oauth20Request.getProviderName(), OAuth20Constants.O<API key> },
"CWWKS1413E: The OAuth20Provider object is null for OAuth provider {0}.");
Tr.error(tc, errorMsg);
response.sendError(HttpServletResponse.SC_NOT_FOUND);
}
return provider;
}
private String getReqConsentNonce(HttpServletRequest request) {
return request.getParameter(ATTR_NONCE);
}
private String getUserName(HttpServletRequest request) {
return request.getUserPrincipal().getName();
}
private String getClientId(HttpServletRequest request) {
return request.getParameter(OAuth20Constants.CLIENT_ID);
}
/* returns whether login form had been presented */
protected boolean isAfterLogin(HttpServletRequest request) {
boolean output = false;
HttpSession session = request.getSession(false);
if (session != null) {
if (session.getAttribute(Constants.ATTR_AFTERLOGIN) != null) {
session.removeAttribute(Constants.ATTR_AFTERLOGIN);
output = true;
}
}
return output;
}
/**
* @return
*/
@SuppressWarnings("unchecked")
public Map<String, String[]> <API key>(HttpServletRequest request, AttributeList options) {
final String methodName = "<API key>";
try {
String externalClaimNames = options.<API key>(OAuth20Constants.<API key>);
if (tc.isDebugEnabled())
Tr.debug(tc, methodName + " externalClamiNames:" + externalClaimNames);
if (externalClaimNames != null) {
Map<String, String[]> map2 = (Map<String, String[]>) getFromWSSubject(OAuth20Constants.EXTERNAL_MEDIATION);
if (map2 != null && map2.size() > 0) {
Set<Entry<String, String[]>> entries = map2.entrySet();
for (Entry<String, String[]> entry : entries) {
options.setAttribute(entry.getKey(), OAuth20Constants.EXTERNAL_MEDIATION, entry.getValue());
}
}
// get the external claims
Map<String, String[]> map = (Map<String, String[]>) getFromWSSubject(OAuth20Constants.EXTERNAL_CLAIMS);
if (tc.isDebugEnabled())
Tr.debug(tc, methodName + " externalClaims:" + map);
if (map == null)
return null;
// filter properties by externalClaimNames
StringTokenizer strTokenizer = new StringTokenizer(externalClaimNames, ", ");
while (strTokenizer.hasMoreTokens()) {
String key = strTokenizer.nextToken();
String[] values = map.get(key);
if (tc.isDebugEnabled())
Tr.debug(tc, methodName + " key:" + key + " values:'" + OAuth20Util.arrayToSpaceString(values) + "'");
if (values != null && values.length > 0) {
options.setAttribute(OAuth20Constants.<API key> + key, OAuth20Constants.EXTERNAL_CLAIMS, values);
}
}
return map;
}
} catch (WSSecurityException e) {
if (tc.isDebugEnabled())
Tr.debug(tc, methodName + " failed. Nothing changed. WSSecurityException:" + e);
}
return null;
}
/**
* @param externalClaims
* @return
*/
private Object getFromWSSubject(String externalClaims) throws WSSecurityException {
Subject runAsSubject = WSSubject.getRunAsSubject();
Object obj = null;
try {
Set<Object> publicCreds = runAsSubject.<API key>();
if (publicCreds != null && publicCreds.size() > 0) {
Iterator<Object> publicCredIterator = publicCreds.iterator();
while (publicCredIterator.hasNext()) {
Object cred = publicCredIterator.next();
if (cred != null && cred instanceof Hashtable) {
@SuppressWarnings("rawtypes")
Hashtable userCred = (Hashtable) cred;
obj = userCred.get(externalClaims);
if (obj != null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "getFromWSSubject found:" + obj);
}
break;
}
}
}
}
} catch (Exception e) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Unable to match predefined cache key." + e);
}
}
return obj;
}
/**
* Check if the request contains an "error" parameter. If one is present and equals the OAuth 2.0 error type "access_denied", a message indicating the user likely canceled the request will be
* logged and a failure result will be returned.
*
* @param request
* @return A {@code OAuthResult} object initialized with AuthResult.FAILURE and 403 status code if an "error" parameter is present and equals "access_denied." Returns null otherwise.
*/
private OAuthResult checkForError(HttpServletRequest request) {
OAuthResult result = null;
String error = request.getParameter("error");
if (error != null && error.length() > 0 && OAuth20Exception.ACCESS_DENIED.equals(error)) {
// User likely canceled the request
String errorMsg = TraceNLS.getFormattedMessage(this.getClass(),
MESSAGE_BUNDLE,
"security.oauth20.request.denied",
new Object[] {},
"CWOAU0067E: The request has been denied by the user, or another error occurred that resulted in denial of the request.");
Tr.error(tc, errorMsg);
O<API key> e = new O<API key>("security.oauth20.request.denied");
e.setHttpStatusCode(HttpServletResponse.SC_FORBIDDEN);
AttributeList attrs = new AttributeList();
String value = request.getParameter(OAuth20Constants.RESPONSE_TYPE);
if (value != null && value.length() > 0) {
attrs.setAttribute(OAuth20Constants.RESPONSE_TYPE, OAuth20Constants.RESPONSE_TYPE, new String[] { value });
}
value = getClientId(request);
if (value != null && value.length() > 0) {
attrs.setAttribute(OAuth20Constants.CLIENT_ID, OAuth20Constants.CLIENT_ID, new String[] { value });
}
result = new OAuthResultImpl(OAuthResult.STATUS_FAILED, attrs, e);
}
return result;
}
/**
* @param provider
* @param responseJSON
* @param accessToken
* @param groupsOnly
* @throws IOException
*/
protected Map<String, Object> getUserClaimsMap(UserClaims userClaims, boolean groupsOnly) throws IOException {
// keep this method for <API key>
return TokenIntrospect.getUserClaimsMap(userClaims, groupsOnly);
}
protected UserClaims getUserClaimsObj(OAuth20Provider provider, OAuth20Token accessToken) throws IOException {
// keep this method for <API key>
return TokenIntrospect.getUserClaimsObj(provider, accessToken);
}
}
|
package ch.elexis.core.ui.wizards;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.widgets.Form;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.TableWrapData;
import org.eclipse.ui.forms.widgets.TableWrapLayout;
import ch.elexis.core.ui.UiDesk;
import ch.elexis.core.ui.icons.ImageSize;
import ch.elexis.core.ui.icons.Images;
import ch.rgw.tools.JdbcLink;
import ch.rgw.tools.StringTool;
public class DBImportFirstPage extends WizardPage {
List dbTypes;
Text server, dbName;
String defaultUser, defaultPassword;
JdbcLink j = null;
static final String[] supportedDB = new String[] {
"mySQl", "PostgreSQL", "H2", "ODBC" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
};
static final int MYSQL = 0;
static final int POSTGRESQL = 1;
static final int ODBC = 3;
static final int H2 = 2;
public DBImportFirstPage(String pageName){
super(Messages.<API key>, Messages.<API key>,
Images.IMG_LOGO.getImageDescriptor(ImageSize.<API key>)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
setMessage(Messages.<API key> + Messages.<API key>); //$NON-NLS-1$
setDescription(Messages.<API key>); //$NON-NLS-1$
}
public DBImportFirstPage(String pageName, String title, ImageDescriptor titleImage){
super(pageName, title, titleImage);
// TODO Automatisch erstellter Konstruktoren-Stub
}
public void createControl(Composite parent){
DBImportWizard wiz = (DBImportWizard) getWizard();
FormToolkit tk = UiDesk.getToolkit();
Form form = tk.createForm(parent);
form.setText(Messages.<API key>); //$NON-NLS-1$
Composite body = form.getBody();
body.setLayout(new TableWrapLayout());
tk.createLabel(body, Messages.<API key>); //$NON-NLS-1$
dbTypes = new List(body, SWT.BORDER);
dbTypes.setItems(supportedDB);
dbTypes.<API key>(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e){
int it = dbTypes.getSelectionIndex();
switch (it) {
case MYSQL:
case POSTGRESQL:
server.setEnabled(true);
dbName.setEnabled(true);
defaultUser = ""; //$NON-NLS-1$
defaultPassword = ""; //$NON-NLS-1$
break;
case H2:
server.setEnabled(false);
dbName.setEnabled(true);
defaultUser = "sa";
defaultPassword = "";
break;
case ODBC:
server.setEnabled(false);
dbName.setEnabled(true);
defaultUser = "sa"; //$NON-NLS-1$
defaultPassword = ""; //$NON-NLS-1$
break;
default:
break;
}
DBImportSecondPage sec = (DBImportSecondPage) getNextPage();
sec.name.setText(defaultUser);
sec.pwd.setText(defaultPassword);
}
});
tk.adapt(dbTypes, true, true);
tk.createLabel(body, Messages.<API key>); //$NON-NLS-1$
server = tk.createText(body, "", SWT.BORDER); //$NON-NLS-1$
TableWrapData twr = new TableWrapData(TableWrapData.FILL_GRAB);
server.setLayoutData(twr);
tk.createLabel(body, Messages.<API key>); //$NON-NLS-1$
dbName = tk.createText(body, "", SWT.BORDER); //$NON-NLS-1$
TableWrapData twr2 = new TableWrapData(TableWrapData.FILL_GRAB);
dbName.setLayoutData(twr2);
if (wiz.preset != null && wiz.preset.length > 1) {
int idx = StringTool.getIndex(supportedDB, wiz.preset[0]);
if (idx < dbTypes.getItemCount()) {
dbTypes.select(idx);
}
server.setText(wiz.preset[1]);
dbName.setText(wiz.preset[2]);
}
setControl(form);
}
}
|
package com.ibm.ws.install.internal;
public class MavenRepository {
private String name;
private String repositoryUrl;
private String userId;
private String password;
public MavenRepository(String name, String repositoryUrl, String userId, String password) {
this.name = name;
this.repositoryUrl = repositoryUrl;
this.userId = userId;
this.password = password;
}
public String getName(){
return name;
}
public String getRepositoryUrl() {
return repositoryUrl;
}
public String getUserId() {
return userId;
}
public String getPassword() {
return password;
}
public String toString(){
return this.repositoryUrl;
}
}
|
package org.eclipse.kapua.service.datastore.internal.model.query;
import java.util.ArrayList;
import org.eclipse.kapua.service.datastore.model.Storable;
import org.eclipse.kapua.service.datastore.model.StorableListResult;
@SuppressWarnings("serial")
public class <API key><E extends Storable> extends ArrayList<E> implements StorableListResult<E>
{
private Object nextKey;
private Integer totalCount;
public <API key>()
{
nextKey = null;
totalCount = null;
}
public <API key>(Object nextKey)
{
this.nextKey = nextKey;
this.totalCount = null;
}
public <API key>(Object nextKeyOffset, Integer totalCount)
{
this(nextKeyOffset);
this.totalCount = totalCount;
}
public Object getNextKey()
{
return nextKey;
}
public Integer getTotalCount()
{
return totalCount;
}
}
|
package com.ibm.ws.transaction.test;
import org.junit.ClassRule;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
import com.ibm.ws.transaction.test.tests.EJBNewTxDBRoSTest;
import com.ibm.ws.transaction.test.tests.EJBNewTxDBTest;
import com.ibm.ws.transaction.test.tests.EJBNewTxRoSTest;
import com.ibm.ws.transaction.test.tests.EJBNewTxTest;
import componenttest.rules.repeater.<API key>;
import componenttest.rules.repeater.JakartaEE9Action;
import componenttest.rules.repeater.RepeatTests;
@RunWith(Suite.class)
@SuiteClasses({
EJBNewTxTest.class,
EJBNewTxDBTest.class,
EJBNewTxRoSTest.class,
EJBNewTxDBRoSTest.class
})
public class FATSuite {
// Using the RepeatTests @ClassRule will cause all tests to be run twice.
// First without any modifications, then again with all features upgraded to their EE8 equivalents.
@ClassRule
public static RepeatTests r = RepeatTests.withoutModification()
.andWith(<API key>.EE8_FEATURES())
.andWith(new JakartaEE9Action());
}
|
package org.openhab.binding.loxone.internal.controls;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.openhab.core.library.types.StringType;
/**
* Test class for (@link LxControlTracker}
*
* @author Pawel Pieczul - initial contribution
*
*/
public class <API key> extends LxControlTest {
@BeforeEach
public void setup() {
setupControl("<API key>", "<API key>",
"<API key>", "Tracker Control");
}
@Test
public void testControlCreation() {
testControlCreation(LxControlTracker.class, 1, 0, 1, 1, 1);
}
@Test
public void testChannels() {
testChannel("String", null, null, null, null, null, true, null);
}
@Test
public void <API key>() {
for (int i = 0; i < 20; i++) {
String s = new String();
for (int j = 0; j < i; j++) {
for (char c = 'a'; c <= 'a' + j; c++) {
s = s + c;
}
if (j != i - 1) {
s = s + '|';
}
}
changeLoxoneState("entries", s);
testChannelState(new StringType(s));
}
}
}
|
package moCreatures.items;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.World;
import moCreatures.entities.EntitySharkEgg;
// Decompiler options: packimports(3) braces deadcode
public class ItemSharkEgg extends Item
{
public ItemSharkEgg(int i)
{
super(i);
maxStackSize = 16;
}
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
{
itemstack.stackSize
if(!world.singleplayerWorld)
{
EntitySharkEgg entitysharkegg = new EntitySharkEgg(world);
entitysharkegg.setPosition(entityplayer.posX, entityplayer.posY, entityplayer.posZ);
world.entityJoinedWorld(entitysharkegg);
entitysharkegg.motionY += world.rand.nextFloat() * 0.05F;
entitysharkegg.motionX += (world.rand.nextFloat() - world.rand.nextFloat()) * 0.3F;
entitysharkegg.motionZ += (world.rand.nextFloat() - world.rand.nextFloat()) * 0.3F;
}
return itemstack;
}
}
|
package org.eclipse.egit.ui.internal.decorators;
import java.io.IOException;
import java.util.Map;
import java.util.WeakHashMap;
import org.eclipse.core.resources.IResource;
import org.eclipse.egit.core.GitProvider;
import org.eclipse.egit.core.project.RepositoryMapping;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.UIText;
import org.eclipse.egit.ui.internal.CompareUtils;
import org.eclipse.egit.ui.internal.trace.GitTraceLocation;
import org.eclipse.jface.text.Document;
import org.eclipse.jgit.events.ListenerHandle;
import org.eclipse.jgit.events.RefsChangedEvent;
import org.eclipse.jgit.events.RefsChangedListener;
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectLoader;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevTree;
import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.jgit.treewalk.TreeWalk;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.RepositoryProvider;
class GitDocument extends Document implements RefsChangedListener {
private final IResource resource;
private ObjectId lastCommit;
private ObjectId lastTree;
private ObjectId lastBlob;
private ListenerHandle myRefsChangedHandle;
static Map<GitDocument, Repository> doc2repo = new WeakHashMap<GitDocument, Repository>();
static GitDocument create(final IResource resource) throws IOException {
if (GitTraceLocation.QUICKDIFF.isActive())
GitTraceLocation.getTrace().trace(
GitTraceLocation.QUICKDIFF.getLocation(),
"(GitDocument) create: " + resource); //$NON-NLS-1$
GitDocument ret = null;
if (RepositoryProvider.getProvider(resource.getProject()) instanceof GitProvider) {
ret = new GitDocument(resource);
ret.populate();
final Repository repository = ret.getRepository();
if (repository != null)
ret.myRefsChangedHandle = repository.getListenerList()
.<API key>(ret);
}
return ret;
}
private GitDocument(IResource resource) {
this.resource = resource;
GitDocument.doc2repo.put(this, getRepository());
}
private void setResolved(final AnyObjectId commit, final AnyObjectId tree,
final AnyObjectId blob, final String value) {
lastCommit = commit != null ? commit.copy() : null;
lastTree = tree != null ? tree.copy() : null;
lastBlob = blob != null ? blob.copy() : null;
set(value);
if (blob != null)
if (GitTraceLocation.QUICKDIFF.isActive())
GitTraceLocation
.getTrace()
.trace(
GitTraceLocation.QUICKDIFF.getLocation(),
"(GitDocument) resolved " + resource + " to " + lastBlob + " in " + lastCommit + "/" + lastTree); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
else if (GitTraceLocation.QUICKDIFF.isActive())
GitTraceLocation.getTrace().trace(
GitTraceLocation.QUICKDIFF.getLocation(),
"(GitDocument) unresolved " + resource); //$NON-NLS-1$
}
void populate() throws IOException {
if (GitTraceLocation.QUICKDIFF.isActive())
GitTraceLocation.getTrace().traceEntry(
GitTraceLocation.QUICKDIFF.getLocation(), resource);
TreeWalk tw = null;
RevWalk rw = null;
try {
RepositoryMapping mapping = RepositoryMapping.getMapping(resource);
if (mapping == null) {
setResolved(null, null, null, ""); //$NON-NLS-1$
return;
}
final String gitPath = mapping.getRepoRelativePath(resource);
final Repository repository = mapping.getRepository();
String baseline = <API key>.baseline.get(repository);
if (baseline == null)
baseline = Constants.HEAD;
ObjectId commitId = repository.resolve(baseline);
if (commitId != null) {
if (commitId.equals(lastCommit)) {
if (GitTraceLocation.QUICKDIFF.isActive())
GitTraceLocation.getTrace().trace(
GitTraceLocation.QUICKDIFF.getLocation(),
"(GitDocument) already resolved"); //$NON-NLS-1$
return;
}
} else {
String msg = NLS.bind(UIText.<API key>,
new Object[] { baseline, resource, repository });
Activator.logError(msg, new Throwable());
setResolved(null, null, null, ""); //$NON-NLS-1$
return;
}
rw = new RevWalk(repository);
RevCommit baselineCommit;
try {
baselineCommit = rw.parseCommit(commitId);
} catch (IOException err) {
String msg = NLS
.bind(UIText.<API key>, new Object[] {
commitId, baseline, resource, repository });
Activator.logError(msg, err);
setResolved(null, null, null, ""); //$NON-NLS-1$
return;
}
RevTree treeId = baselineCommit.getTree();
if (treeId.equals(lastTree)) {
if (GitTraceLocation.QUICKDIFF.isActive())
GitTraceLocation.getTrace().trace(
GitTraceLocation.QUICKDIFF.getLocation(),
"(GitDocument) already resolved"); //$NON-NLS-1$
return;
}
tw = TreeWalk.forPath(repository, gitPath, treeId);
if (tw == null) {
if (GitTraceLocation.QUICKDIFF.isActive())
GitTraceLocation
.getTrace()
.trace(
GitTraceLocation.QUICKDIFF.getLocation(),
"(GitDocument) resource " + resource + " not found in " + treeId + " in " + repository + ", baseline=" + baseline); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
setResolved(null, null, null, ""); //$NON-NLS-1$
return;
}
ObjectId id = tw.getObjectId(0);
if (id.equals(ObjectId.zeroId())) {
setResolved(null, null, null, ""); //$NON-NLS-1$
String msg = NLS
.bind(UIText.<API key>, new Object[] {
treeId.getName(), baseline, resource, repository });
Activator.logError(msg, new Throwable());
setResolved(null, null, null, ""); //$NON-NLS-1$
return;
}
if (!id.equals(lastBlob)) {
if (GitTraceLocation.QUICKDIFF.isActive())
GitTraceLocation.getTrace().trace(
GitTraceLocation.QUICKDIFF.getLocation(),
"(GitDocument) compareTo: " + baseline); //$NON-NLS-1$
ObjectLoader loader = repository.open(id, Constants.OBJ_BLOB);
byte[] bytes = loader.getBytes();
String charset;
charset = CompareUtils.getResourceEncoding(resource);
// Finally we could consider validating the content with respect
// to the content. We don't do that here.
String s = new String(bytes, charset);
setResolved(commitId, treeId, id, s);
if (GitTraceLocation.QUICKDIFF.isActive())
GitTraceLocation
.getTrace()
.trace(GitTraceLocation.QUICKDIFF.getLocation(),
"(GitDocument) has reference doc, size=" + s.length() + " bytes"); //$NON-NLS-1$ //$NON-NLS-2$
} else {
if (GitTraceLocation.QUICKDIFF.isActive())
GitTraceLocation.getTrace().trace(
GitTraceLocation.QUICKDIFF.getLocation(),
"(GitDocument) already resolved"); //$NON-NLS-1$
}
} finally {
if (tw != null)
tw.release();
if (rw != null)
rw.release();
if (GitTraceLocation.QUICKDIFF.isActive())
GitTraceLocation.getTrace().traceExit(
GitTraceLocation.QUICKDIFF.getLocation());
}
}
void dispose() {
if (GitTraceLocation.QUICKDIFF.isActive())
GitTraceLocation.getTrace().trace(
GitTraceLocation.QUICKDIFF.getLocation(),
"(GitDocument) dispose: " + resource); //$NON-NLS-1$
doc2repo.remove(this);
if (myRefsChangedHandle != null) {
myRefsChangedHandle.remove();
myRefsChangedHandle = null;
}
}
public void onRefsChanged(final RefsChangedEvent e) {
try {
populate();
} catch (IOException e1) {
Activator.logError(UIText.<API key>, e1);
}
}
private Repository getRepository() {
RepositoryMapping mapping = RepositoryMapping.getMapping(resource);
return (mapping != null) ? mapping.getRepository() : null;
}
/**
* A change occurred to a repository. Update any GitDocument instances
* referring to such repositories.
*
* @param repository
* Repository which changed
* @throws IOException
*/
static void refreshRelevant(final Repository repository) throws IOException {
for (Map.Entry<GitDocument, Repository> i : doc2repo.entrySet()) {
if (i.getValue() == repository) {
i.getKey().populate();
}
}
}
}
|
// Generated from C:\SIB\Code\WASX.SIB\dd\SIB\ws\code\sib.mfp.impl\src\com\ibm\ws\sib\mfp\schema\JsHdrSchema.schema: do not edit directly
package com.ibm.ws.sib.mfp.schema;
import com.ibm.ws.sib.mfp.jmf.impl.JSchema;
public final class JsHdrAccess {
public final static JSchema schema = new JsHdrSchema();
public final static int DISCRIMINATOR = 0;
public final static int ARRIVALTIMESTAMP = 1;
public final static int <API key> = 2;
public final static int SYSTEMMESSAGEVALUE = 3;
public final static int SECURITYUSERID = 4;
public final static int <API key> = 5;
public final static int MESSAGETYPE = 6;
public final static int SUBTYPE = 7;
public final static int HDR2 = 8;
public final static int API = 10;
public final static int IS_API_EMPTY = 0;
public final static int IS_API_DATA = 1;
public final static int API_DATA = 9;
}
|
*******************************************************************************
// * accompanies this distribution, and is available at
//package org.lttng.scope.lami.ui.viewers;
//import org.eclipse.jface.viewers.TableViewer;
//import org.eclipse.swt.SWT;
//import org.eclipse.swt.widgets.Composite;
//import org.lttng.scope.lami.core.module.LamiChartModel;
//import org.lttng.scope.lami.ui.views.<API key>;
**
// * Common interface for all Lami viewers.
// * @author Alexandre Montplaisir
//public interface ILamiViewer {
// /**
// * Dispose the viewer widget.
// */
// void dispose();
// /**
// * Factory method to create a new Table viewer.
// *
// * @param parent
// * The parent composite
// * @param page
// * The {@link <API key>} parent page
// * @return The new viewer
// */
// static ILamiViewer createLamiTable(Composite parent, <API key> page) {
// TableViewer tableViewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.MULTI | SWT.VIRTUAL);
// return new LamiTableViewer(tableViewer, page);
// /**
// * Factory method to create a new chart viewer. The chart type is specified
// * by the 'chartModel' parameter.
// *
// * @param parent
// * The parent composite
// * @param page
// * The {@link <API key>} parent page
// * @param chartModel
// * The information about the chart to display
// * @return The new viewer
// */
// static ILamiViewer createLamiChart(Composite parent, <API key> page, LamiChartModel chartModel) {
// switch (chartModel.getChartType()) {
// case BAR_CHART:
// return new LamiBarChartViewer(parent, page, chartModel);
// case XY_SCATTER:
// return new LamiScatterViewer(parent, page, chartModel);
// case PIE_CHART:
// default:
// throw new <API key>("Unsupported chart type: " + chartModel.toString()); //$NON-NLS-1$
|
package org.eclipse.kapua.kura.simulator.app.deploy;
import org.eclipse.kapua.kura.simulator.payload.Metric;
import org.eclipse.kapua.kura.simulator.payload.Optional;
public class <API key> {
@Metric("dp.name")
private String name;
@Metric("dp.version")
private String version;
@Metric("job.id")
private long jobId;
@Optional
@Metric("dp.reboot")
private Boolean reboot;
@Optional
@Metric("dp.reboot.delay")
private Integer rebootDelay;
public String getName() {
return name;
}
public void setName(final String name) {
this.name = name;
}
public String getVersion() {
return version;
}
public void setVersion(final String version) {
this.version = version;
}
public long getJobId() {
return jobId;
}
public void setJobId(final long jobId) {
this.jobId = jobId;
}
public Boolean getReboot() {
return reboot;
}
public void setReboot(final Boolean reboot) {
this.reboot = reboot;
}
public Integer getRebootDelay() {
return rebootDelay;
}
public void setRebootDelay(final Integer rebootDelay) {
this.rebootDelay = rebootDelay;
}
}
|
package org.eclipse.hawkbit.ui.common.tagdetails;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTag;
import org.eclipse.hawkbit.ui.common.tagdetails.TagPanelLayout.<API key>;
import org.eclipse.hawkbit.ui.utils.<API key>;
import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import com.google.common.collect.Sets;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.themes.ValoTheme;
/**
* Combobox that lists all available Tags that can be assigned to a
* {@link Target} or {@link DistributionSet}.
*/
public class <API key> extends HorizontalLayout {
private static final long serialVersionUID = 1L;
private final Collection<ProxyTag> allAssignableTags;
private final transient Set<<API key>> listeners = Sets.<API key>();
private final ComboBox<ProxyTag> <API key>;
private final boolean readOnlyMode;
/**
* Constructor.
*
* @param i18n
* the i18n
* @param readOnlyMode
* if true the combobox will be disabled so no assignment can be
* done.
*/
<API key>(final VaadinMessageSource i18n, final boolean readOnlyMode) {
this.readOnlyMode = readOnlyMode;
setWidth("100%");
this.<API key> = <API key>(
i18n.getMessage(UIMessageIdProvider.TOOLTIP_SELECT_TAG));
this.allAssignableTags = new HashSet<>();
this.<API key>.setItems(allAssignableTags);
addComponent(<API key>);
}
private ComboBox<ProxyTag> <API key>(final String description) {
final ComboBox<ProxyTag> tagsComboBox = new ComboBox<>();
tagsComboBox.setId(<API key>.TAG_SELECTION_ID);
tagsComboBox.setDescription(description);
tagsComboBox.addStyleName(ValoTheme.COMBOBOX_TINY);
tagsComboBox.setEnabled(!readOnlyMode);
tagsComboBox.setWidth("100%");
tagsComboBox.<API key>(true);
tagsComboBox.<API key>(ProxyTag::getName);
tagsComboBox.<API key>(event -> assignTag(event.getValue()));
return tagsComboBox;
}
private void assignTag(final ProxyTag tagData) {
if (tagData == null || readOnlyMode) {
return;
}
allAssignableTags.remove(tagData);
<API key>.clear();
<API key>.getDataProvider().refreshAll();
<API key>(tagData);
}
/**
* Initializes the Combobox with all assignable tags.
*
* @param assignableTags
* assignable tags
*/
void <API key>(final List<ProxyTag> assignableTags) {
allAssignableTags.addAll(assignableTags);
<API key>.getDataProvider().refreshAll();
}
/**
* Removes all Tags from Combobox.
*/
void removeAllTags() {
allAssignableTags.clear();
<API key>.clear();
<API key>.getDataProvider().refreshAll();
}
/**
* Adds an assignable Tag to the combobox.
*
* @param tagData
* the data of the Tag
*/
void addAssignableTag(final ProxyTag tagData) {
if (tagData == null) {
return;
}
allAssignableTags.add(tagData);
<API key>.getDataProvider().refreshAll();
}
/**
* Updates an assignable Tag in the combobox.
*
* @param tagData
* the data of the Tag
*/
void updateAssignableTag(final ProxyTag tagData) {
if (tagData == null) {
return;
}
<API key>(tagData.getId()).ifPresent(tagToUpdate -> updateAssignableTag(tagToUpdate, tagData));
}
private Optional<ProxyTag> <API key>(final Long id) {
return allAssignableTags.stream().filter(tag -> tag.getId().equals(id)).findAny();
}
private void updateAssignableTag(final ProxyTag oldTag, final ProxyTag newTag) {
allAssignableTags.remove(oldTag);
allAssignableTags.add(newTag);
<API key>.getDataProvider().refreshAll();
}
/**
* Removes an assignable tag from the combobox.
*
* @param tagId
* the tag Id of the Tag that should be removed.
*/
void removeAssignableTag(final Long tagId) {
<API key>(tagId).ifPresent(this::removeAssignableTag);
}
/**
* Removes an assignable tag from the combobox.
*
* @param tagData
* the {@link ProxyTag} of the Tag that should be removed.
*/
void removeAssignableTag(final ProxyTag tagData) {
allAssignableTags.remove(tagData);
<API key>.getDataProvider().refreshAll();
}
/**
* Registers an {@link <API key>} on the combobox.
*
* @param listener
* the listener to register
*/
void <API key>(final <API key> listener) {
listeners.add(listener);
}
/**
* Removes a {@link <API key>} from the combobox,
*
* @param listener
* the listener that should be removed.
*/
void <API key>(final <API key> listener) {
listeners.remove(listener);
}
private void <API key>(final ProxyTag tagData) {
listeners.forEach(listener -> listener.assignTag(tagData));
}
}
|
package org.openhab.binding.fronius.internal.api;
import com.google.gson.annotations.SerializedName;
/**
* The {@link <API key>} is responsible for storing
* the "RequestArguments" node from the {@link Head}
*
* @author Thomas Rokohl - Initial contribution
*/
public class <API key> {
@SerializedName("DataCollection")
private String dataCollection;
@SerializedName("DeviceClass")
private String deviceClass;
@SerializedName("DeviceId")
private String deviceId;
@SerializedName("Scope")
private String scope;
public String getDataCollection() {
if (null == dataCollection) {
dataCollection = "";
}
return dataCollection;
}
public void setDataCollection(String dataCollection) {
this.dataCollection = dataCollection;
}
public String getDeviceClass() {
if (null == deviceClass) {
deviceClass = "";
}
return deviceClass;
}
public void setDeviceClass(String deviceClass) {
this.deviceClass = deviceClass;
}
public String getDeviceId() {
if (null == deviceId) {
deviceId = "";
}
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getScope() {
if (null == scope) {
scope = "";
}
return scope;
}
public void setScope(String scope) {
this.scope = scope;
}
}
|
package org.openhab.binding.vigicrues.internal.dto.vigicrues;
import java.util.List;
import com.google.gson.annotations.SerializedName;
public class TerEntVigiCru {
public class VicTerEntVigiCru {
@SerializedName("vic:aNMoinsUn")
public List<VicANMoinsUn> vicANMoinsUn;
/*
* Currently unused, maybe interesting in the future
*
* @SerializedName("@id")
* public String id;
*
* @SerializedName("vic:CdEntVigiCru")
* public String vicCdEntVigiCru;
*
* @SerializedName("vic:TypEntVigiCru")
* public String vicTypEntVigiCru;
*
* @SerializedName("vic:LbEntVigiCru")
* public String vicLbEntVigiCru;
*
* @SerializedName("vic:DtHrCreatEntVigiCru")
* public String <API key>;
*
* @SerializedName("vic:DtHrMajEntVigiCru")
* public String <API key>;
*
* @SerializedName("vic:StEntVigiCru")
* public String vicStEntVigiCru;
* public int count_aNMoinsUn;
*
* @SerializedName("LinkInfoCru")
* public String linkInfoCru;
*/
}
@SerializedName("vic:TerEntVigiCru")
public VicTerEntVigiCru vicTerEntVigiCru;
}
|
#ifndef PARSER_COMMON_H_
#define PARSER_COMMON_H_
#include <btree/btree.h>
#include "btree_bison.h"
struct SParserContext
{
StringBuffer m_Parsed;
StringBuffer m_Original;
<API key> m_Funcs;
Allocator m_Allocator;
unsigned int m_LineNo;
BehaviorTreeContext m_Tree;
void* m_Extra;
const char* m_Current;
};
#define YY_EXTRA_TYPE ParserContext
int yylex( YYSTYPE*, void* );
int yylex_init( void** );
int yylex_init_extra( YY_EXTRA_TYPE, void** );
int yylex_destroy( void* );
void yyset_extra( YY_EXTRA_TYPE, void* );
int yyparse( YY_EXTRA_TYPE, void* );
void yyerror( ParserContext ctx, const char* msg );
void yywarning( ParserContext ctx, const char* msg );
void yyerror( ParserContext ctx, void*, const char* msg );
void yywarning( ParserContext ctx, void*, const char* msg );
#endif /* PARSER_COMMON_H_ */
|
package com.ibm.ws.security.openidconnect.server.fat.jaxrs.config.OAuth;
import java.util.ArrayList;
import java.util.List;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import com.ibm.websphere.simplicity.log.Log;
import com.ibm.ws.security.oauth_oidc.fat.commonTest.Constants;
import com.ibm.ws.security.oauth_oidc.fat.commonTest.TestServer;
import com.ibm.ws.security.oauth_oidc.fat.commonTest.TestSettings;
import com.ibm.ws.security.openidconnect.server.fat.jaxrs.config.CommonTests.<API key>;
import componenttest.custom.junit.runner.FATRunner;
import componenttest.custom.junit.runner.Mode;
import componenttest.custom.junit.runner.Mode.TestMode;
import componenttest.topology.impl.<API key>;
import componenttest.topology.utils.LDAPUtils;
// See test description in
// com.ibm.ws.security.openidconnect.server-1.0_fat.jaxrs.config/fat/src/com/ibm/ws/security/openidconnect/server/fat/jaxrs/config/CommonTests/<API key>.java
@<API key>
@Mode(TestMode.FULL)
@RunWith(FATRunner.class)
public class O<API key> extends <API key> {
private static final Class<?> thisClass = O<API key>.class;
@BeforeClass
public static void setupBeforeTest() throws Exception {
/*
* These tests have not been configured to run with the local LDAP server.
*/
Assume.assumeTrue(!LDAPUtils.<API key>);
msgUtils.printClassName(thisClass.toString());
Log.info(thisClass, "setupBeforeTest", "Prep for test");
// add any additional messages that you want the "start" to wait for
// we should wait for any providers that this test requires
List<String> extraMsgs = new ArrayList<String>();
extraMsgs.add("CWWKS1631I.*");
List<String> extraApps = new ArrayList<String>();
TestServer.addTestApp(null, extraMsgs, Constants.OP_SAMPLE_APP, Constants.OAUTH_OP);
TestServer.addTestApp(extraApps, null, Constants.OP_CLIENT_APP, Constants.OAUTH_OP);
TestServer.addTestApp(extraApps, extraMsgs, Constants.OP_TAI_APP, Constants.OAUTH_OP);
List<String> extraMsgs2 = new ArrayList<String>();
List<String> extraApps2 = new ArrayList<String>();
extraApps2.add(Constants.HELLOWORLD_SERVLET);
testSettings = new TestSettings();
testOPServer = commonSetUp(OPServerName, "<API key>.xml", Constants.OAUTH_OP, extraApps, Constants.DO_NOT_USE_DERBY, extraApps);
genericTestServer = commonSetUp(RSServerName, "<API key>.xml", Constants.GENERIC_SERVER, extraApps2, Constants.DO_NOT_USE_DERBY, extraMsgs2, null, Constants.OAUTH_OP);
targetProvider = Constants.O<API key>;
flowType = Constants.WEB_CLIENT_FLOW;
goodActions = Constants.<API key>;
// set RS protected resource to point to second server.
testSettings.<API key>(genericTestServer.getHttpsString() + "/helloworld/rest/helloworld");
// Initial user settings for default user. Individual tests override as needed.
testSettings.setAdminUser("oidcu1");
testSettings.setAdminPswd("security");
testSettings.setGroupIds("RSGroup");
}
}
|
package org.eclipse.kapua;
/**
* <API key> is thrown when <tt>null</tt> is passed to a method for an argument
* or as a value for field in an object where <tt>null</tt> is not allowed.<br>
* This should always be used instead of <tt><API key></tt> as the latter is too easily confused with programming bugs.
*
* @since 1.0
*
*/
public class <API key> extends <API key> {
private static final long serialVersionUID = -<API key>;
/**
* Constructor
*
* @param argumentName
*/
public <API key>(String argumentName) {
super(KapuaErrorCodes.<API key>, argumentName, null);
}
}
|
<!
This file is part of YunWebUI.
YunWebUI 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 St, Fifth Floor, Boston, MA 02110-1301 USA
As a special exception, you may use this file as part of a free software
library without restriction. Specifically, if other files instantiate
templates or use macros or inline functions from this file, or you compile
this file and link it with other files to produce an executable, this
file does not by itself cause the resulting executable to be covered by
the GNU General Public License. This exception does not however
invalidate any other reasons why the executable file might be covered by
the GNU General Public License.
Copyright 2013 Arduino LLC (http:
<html>
<head>
<title>Bridge Key/Value Storage Manager Example</title>
<style>
body {
background-color: #00979c;
color: #222;
font: 1em "Lucida Grande", Lucida, Verdana, sans-serif;
}
</style>
</head>
<body>
<div style="visibility: hidden; display: none;">
<table id="template">
<tr>
<td>"KEY"</td>
<td><input name="KEY" type="hidden" value="VALUE"> <input name="KEY" value="VALUE" type="text"></td>
<td><input type="button" name="KEY" value="delete"></td>
</tr>
</table>
</div>
<div style="background: none repeat scroll 0 0 #F5F5F5">
<div style="padding: 2em;">
<div id="warning" style="display: none;">
<span style="color: #c37676;">You are using HTTP. We suggest to use HTTPS to protect your Yún<br><br></span>
</div>
Password: <input id="password" type="password" value="">
<br/>
<br/>
<div id="storage">
Retrieving storage values...
</div>
<br/>
<input id="refresh" type="button" value="Reload storage!">
<br/>
<br/>
<div>
Add a new entry into the storage:<br>
<table>
<tr>
<td>Key:</td>
<td><input id="new_storage_key" type="text"></td>
</tr>
<tr>
<td>Value:</td>
<td><input id="new_storage_value" type="text"></td>
</tr>
</table>
</div>
<input id="update" type="button" value="Update or insert new key/value pair">
</div>
</div>
<script type="text/javascript" src="zepto.min.js"></script>
<script>
"use strict";
var please_wait_message = "Retrieving storage values...";
function <API key>(user, password) {
var tok = user + ':' + (password || "arduino");
var hash = btoa(tok);
return "Basic " + hash;
}
function add_basic_<API key>(ajax_call_options, password) {
if (password && password !== "") {
ajax_call_options.headers = {
Authorization: <API key>("root", password)
}
}
}
function error_handler(error) {
if (error && error.status && error.status === 403) {
alert("Password is wrong!");
return
}
if (error && error.status && error.status === 500) {
alert("Error accessing the key/value store. Is the Bridge example sketch running?");
} else {
alert("Uknown error: check browser console");
}
console.log(arguments);
}
function <API key>(callback) {
var ajax_call_options = {
url: "/data/get",
timeout: 10000,
success: callback,
error: error_handler
};
add_basic_<API key>(ajax_call_options, $("#password").val());
$.ajax(ajax_call_options)
}
function <API key>(key, callback) {
var ajax_call_options = {
url: "/data/delete/" + encodeURIComponent(key),
timeout: 10000,
success: callback,
error: error_handler
};
add_basic_<API key>(ajax_call_options, $("#password").val());
$.ajax(ajax_call_options)
}
function <API key>(key, value, callback) {
var ajax_call_options = {
url: "/data/put/" + encodeURIComponent(key) + "/" + encodeURIComponent(value),
timeout: 10000,
success: callback,
error: error_handler
};
add_basic_<API key>(ajax_call_options, $("#password").val());
$.ajax(ajax_call_options)
}
function repaint_storage(storage) {
$("#storage").empty();
if (storage.value.length === 0) {
$("#storage").html("Storage is empty!");
return;
}
var template = $("#template tbody").html();
var html = "";
for (var key in storage.value) {
html = html + template.replace(/KEY/g, key).replace(/VALUE/g, storage.value[key]);
}
$("#storage").html("<table><tr><td>Key</td><td>Value</td><td></td></tr>" + html + "</table>");
}
function <API key>(event) {
var key = $(event.target).attr("name");
if (confirm("Are you sure you want to delete key \"" + key + "\" ?")) {
<API key>(key, function() {
$("#storage").html(please_wait_message);
<API key>(repaint_storage);
});
}
}
function update_storage(callback) {
var keys_to_update = [];
$("#storage input[type=text]").each(function(idx, item) {
var $key_value = $(item);
if ($key_value.val() !== $("#storage input[type=hidden][name=" + $key_value.attr("name") + "]").val()) {
keys_to_update.push({
key: $key_value.attr("name"),
value: $key_value.val()
});
}
});
var new_storage_key = $("#new_storage_key").val();
var new_storage_value = $("#new_storage_value").val();
if (new_storage_key && new_storage_value) {
keys_to_update.push({
key: new_storage_key,
value: new_storage_value
});
}
var done = 0;
for (var idx = 0; idx < keys_to_update.length; idx++) {
<API key>(keys_to_update[idx].key, keys_to_update[idx].value, function() {
done++;
if (done === keys_to_update.length) {
callback();
}
});
}
}
$(function() {
$("#storage").html(please_wait_message);
<API key>(repaint_storage);
$("#storage").on("click", "input[type=button]", <API key>);
$("#update").on("click", function() {
update_storage(function() {
$("#storage").html(please_wait_message);
<API key>(repaint_storage);
})
});
$("#refresh").on("click", function() {
$("#storage").html(please_wait_message);
<API key>(repaint_storage);
});
if (window.location.protocol === "http:") {
$("#warning").attr("style", "");
}
});
</script>
</body>
</html>
|
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "config.h"
#include "common.h"
#include "mem.h"
#include "avassert.h"
#include "avstring.h"
#include "bprint.h"
int av_strstart(const char *str, const char *pfx, const char **ptr)
{
while (*pfx && *pfx == *str) {
pfx++;
str++;
}
if (!*pfx && ptr)
*ptr = str;
return !*pfx;
}
int av_stristart(const char *str, const char *pfx, const char **ptr)
{
while (*pfx && av_toupper((unsigned)*pfx) == av_toupper((unsigned)*str)) {
pfx++;
str++;
}
if (!*pfx && ptr)
*ptr = str;
return !*pfx;
}
char *av_stristr(const char *s1, const char *s2)
{
if (!*s2)
return (char*)(intptr_t)s1;
do
if (av_stristart(s1, s2, NULL))
return (char*)(intptr_t)s1;
while (*s1++);
return NULL;
}
char *av_strnstr(const char *haystack, const char *needle, size_t hay_length)
{
size_t needle_len = strlen(needle);
if (!needle_len)
return (char*)haystack;
while (hay_length >= needle_len) {
hay_length
if (!memcmp(haystack, needle, needle_len))
return (char*)haystack;
haystack++;
}
return NULL;
}
size_t av_strlcpy(char *dst, const char *src, size_t size)
{
size_t len = 0;
while (++len < size && *src)
*dst++ = *src++;
if (len <= size)
*dst = 0;
return len + strlen(src) - 1;
}
size_t av_strlcat(char *dst, const char *src, size_t size)
{
size_t len = strlen(dst);
if (size <= len + 1)
return len + strlen(src);
return len + av_strlcpy(dst + len, src, size - len);
}
size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...)
{
size_t len = strlen(dst);
va_list vl;
va_start(vl, fmt);
len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl);
va_end(vl);
return len;
}
char *av_asprintf(const char *fmt, ...)
{
char *p = NULL;
va_list va;
int len;
va_start(va, fmt);
len = vsnprintf(NULL, 0, fmt, va);
va_end(va);
if (len < 0)
goto end;
p = av_malloc(len + 1);
if (!p)
goto end;
va_start(va, fmt);
len = vsnprintf(p, len + 1, fmt, va);
va_end(va);
if (len < 0)
av_freep(&p);
end:
return p;
}
char *av_d2str(double d)
{
char *str = av_malloc(16);
if (str)
snprintf(str, 16, "%f", d);
return str;
}
#define WHITESPACES " \n\t"
char *av_get_token(const char **buf, const char *term)
{
char *out = av_malloc(strlen(*buf) + 1);
char *ret = out, *end = out;
const char *p = *buf;
if (!out)
return NULL;
p += strspn(p, WHITESPACES);
while (*p && !strspn(p, term)) {
char c = *p++;
if (c == '\\' && *p) {
*out++ = *p++;
end = out;
} else if (c == '\'') {
while (*p && *p != '\'')
*out++ = *p++;
if (*p) {
p++;
end = out;
}
} else {
*out++ = c;
}
}
do
*out
while (out >= end && strspn(out, WHITESPACES));
*buf = p;
return ret;
}
char *av_strtok(char *s, const char *delim, char **saveptr)
{
char *tok;
if (!s && !(s = *saveptr))
return NULL;
/* skip leading delimiters */
s += strspn(s, delim);
/* s now points to the first non delimiter char, or to the end of the string */
if (!*s) {
*saveptr = NULL;
return NULL;
}
tok = s++;
/* skip non delimiters */
s += strcspn(s, delim);
if (*s) {
*s = 0;
*saveptr = s+1;
} else {
*saveptr = NULL;
}
return tok;
}
int av_strcasecmp(const char *a, const char *b)
{
uint8_t c1, c2;
do {
c1 = av_tolower(*a++);
c2 = av_tolower(*b++);
} while (c1 && c1 == c2);
return c1 - c2;
}
int av_strncasecmp(const char *a, const char *b, size_t n)
{
const char *end = a + n;
uint8_t c1, c2;
do {
c1 = av_tolower(*a++);
c2 = av_tolower(*b++);
} while (a < end && c1 && c1 == c2);
return c1 - c2;
}
const char *av_basename(const char *path)
{
char *p = strrchr(path, '/');
#if HAVE_DOS_PATHS
char *q = strrchr(path, '\\');
char *d = strchr(path, ':');
p = FFMAX3(p, q, d);
#endif
if (!p)
return path;
return p + 1;
}
const char *av_dirname(char *path)
{
char *p = strrchr(path, '/');
#if HAVE_DOS_PATHS
char *q = strrchr(path, '\\');
char *d = strchr(path, ':');
d = d ? d + 1 : d;
p = FFMAX3(p, q, d);
#endif
if (!p)
return ".";
*p = '\0';
return path;
}
int av_escape(char **dst, const char *src, const char *special_chars,
enum AVEscapeMode mode, int flags)
{
AVBPrint dstbuf;
av_bprint_init(&dstbuf, 1, <API key>);
av_bprint_escape(&dstbuf, src, special_chars, mode, flags);
if (!<API key>(&dstbuf)) {
av_bprint_finalize(&dstbuf, NULL);
return AVERROR(ENOMEM);
} else {
av_bprint_finalize(&dstbuf, dst);
return dstbuf.len;
}
}
int av_isdigit(int c)
{
return c >= '0' && c <= '9';
}
int av_isgraph(int c)
{
return c > 32 && c < 127;
}
int av_isspace(int c)
{
return c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' ||
c == '\v';
}
int av_isxdigit(int c)
{
c = av_tolower(c);
return av_isdigit(c) || (c >= 'a' && c <= 'f');
}
int av_match_name(const char *name, const char *names)
{
const char *p;
int len, namelen;
if (!name || !names)
return 0;
namelen = strlen(name);
while ((p = strchr(names, ','))) {
len = FFMAX(p - names, namelen);
if (!av_strncasecmp(name, names, len))
return 1;
names = p + 1;
}
return !av_strcasecmp(name, names);
}
int av_utf8_decode(int32_t *codep, const uint8_t **bufp, const uint8_t *buf_end,
unsigned int flags)
{
const uint8_t *p = *bufp;
uint32_t top;
uint64_t code;
int ret = 0, tail_len;
uint32_t <API key>[6] = {
0x00000000, 0x00000080, 0x00000800, 0x00010000, 0x00200000, 0x04000000,
};
if (p >= buf_end)
return 0;
code = *p++;
/* first sequence byte starts with 10, or is 1111-1110 or 1111-1111,
which is not admitted */
if ((code & 0xc0) == 0x80 || code >= 0xFE) {
ret = AVERROR(EILSEQ);
goto end;
}
top = (code & 128) >> 1;
tail_len = 0;
while (code & top) {
int tmp;
tail_len++;
if (p >= buf_end) {
(*bufp) ++;
return AVERROR(EILSEQ); /* incomplete sequence */
}
/* we assume the byte to be in the form 10xx-xxxx */
tmp = *p++ - 128; /* strip leading 1 */
if (tmp>>6) {
(*bufp) ++;
return AVERROR(EILSEQ);
}
code = (code<<6) + tmp;
top <<= 5;
}
code &= (top << 1) - 1;
/* check for overlong encodings */
av_assert0(tail_len <= 5);
if (code < <API key>[tail_len]) {
ret = AVERROR(EILSEQ);
goto end;
}
if (code >= 1<<31) {
ret = AVERROR(EILSEQ); /* out-of-range value */
goto end;
}
*codep = code;
if (code > 0x10FFFF &&
!(flags & <API key>))
ret = AVERROR(EILSEQ);
if (code < 0x20 && code != 0x9 && code != 0xA && code != 0xD &&
flags & <API key>)
ret = AVERROR(EILSEQ);
if (code >= 0xD800 && code <= 0xDFFF &&
!(flags & <API key>))
ret = AVERROR(EILSEQ);
if ((code == 0xFFFE || code == 0xFFFF) &&
!(flags & <API key>))
ret = AVERROR(EILSEQ);
end:
*bufp = p;
return ret;
}
int av_match_list(const char *name, const char *list, char separator)
{
const char *p, *q;
for (p = name; p && *p; ) {
for (q = list; q && *q; ) {
int k;
for (k = 0; p[k] == q[k] || (p[k]*q[k] == 0 && p[k]+q[k] == separator); k++)
if (k && (!p[k] || p[k] == separator))
return 1;
q = strchr(q, separator);
q += !!q;
}
p = strchr(p, separator);
p += !!p;
}
return 0;
}
#ifdef TEST
int main(void)
{
int i;
static const char * const strings[] = {
"''",
"",
":",
"\\",
"'",
" '' :",
" '' '' :",
"foo '' :",
"'foo'",
"foo ",
" ' foo ' ",
"foo\\",
"foo': blah:blah",
"foo\\: blah:blah",
"foo\'",
"'foo : ' :blahblah",
"\\ :blah",
" foo",
" foo ",
" foo \\ ",
"foo ':blah",
" foo bar : blahblah",
"\\f\\o\\o",
"'foo : \\ \\ ' : blahblah",
"'\\fo\\o:': blahblah",
"\\'fo\\o\\:': foo ' :blahblah"
};
printf("Testing av_get_token()\n");
for (i = 0; i < FF_ARRAY_ELEMS(strings); i++) {
const char *p = strings[i];
char *q;
printf("|%s|", p);
q = av_get_token(&p, ":");
printf(" -> |%s|", q);
printf(" + |%s|\n", p);
av_free(q);
}
return 0;
}
#endif /* TEST */
|
<?php
/**
* WARNING:
* Do not make changes to this file as it will be over-written when you upgrade CB.
* To localize you need to create your own CB language plugin and make changes there.
*/
defined('CBLIB') or die();
return array(
// 66 language strings from file plug_cbconditional/cbconditional.xml
'<API key>' => 'Tab condition preferences',
'<API key>' => 'Select conditional display for this tab.',
'<API key>' => 'Normal CB settings',
'<API key>' => 'Tab conditional',
'IF_bfa9de' => 'If...',
'<API key>' => 'Select field to match value against in determining this tabs display.',
'FIELD_6f16a5' => 'Field',
'VALUE_689202' => 'Value',
'<API key>' => 'View Access Levels',
'USERGROUPS_6ad0aa' => 'Usergroups',
'FIELDS_a4ca5e' => 'Fields',
'VALUE_f14e9e' => 'Value...',
'<API key>' => 'Input substitution supported value to match against. In addition to user substitutions you can access $_REQUEST, $_GET, and $_POST substitutions as [request_VARIABLE],[post_VARIABLE], and [get_VARIABLE] (e.g. [get_task]).',
'<API key>' => 'Enable or disable translation of language strings in value.',
'<API key>' => 'Translate Value',
'HAS_7bac0f' => 'Has...',
'<API key>' => 'Select the view access levels to match against the user. The user only needs to have one of the selected view access levels to match.',
'<API key>' => 'Select the usergroups to match against the user. The user only needs to have one of the selected usergroups to match.',
'IS_9149c7' => 'Is...',
'<API key>' => 'Select operator to compare field value against input value.',
'OPERATOR_e1b3ec' => 'Operator',
'EQUAL_TO_c1d440' => 'Equal To',
'NOT_EQUAL_TO_9ac8c0' => 'Not Equal To',
'GREATER_THAN_728845' => 'Greater Than',
'LESS_THAN_45ed1c' => 'Less Than',
'<API key>' => 'Greater Than or Equal To',
'<API key>' => 'Less Than or Equal To',
'EMPTY_ce2c8a' => 'Empty',
'NOT_EMPTY_f49248' => 'Not Empty',
'DOES_CONTAIN_396955' => 'Does Contain',
'<API key>' => 'Does Not Contain',
'IS_REGEX_44846d' => 'Is REGEX',
'IS_NOT_REGEX_4bddfd' => 'Is Not REGEX',
'TO_4a384a' => 'To...',
'<API key>' => 'Input substitution supported value to match against field value. In addition to user substitutions you can access $_REQUEST, $_GET, and $_POST substitutions as [request_VARIABLE],[post_VARIABLE], and [get_VARIABLE] (e.g. [get_task]).',
'THEN_c1325f' => 'Then...',
'<API key>' => 'Select how to handle this tabs display based on field value match.',
'FOR_0ba2b3' => 'For...',
'<API key>' => 'Enable or disable conditional usage on registration.',
'REGISTRATION_0f98b7' => 'Registration',
'<API key>' => 'Enable or disable conditional usage on profile edit.',
'PROFILE_EDIT_24f0eb' => 'Profile Edit',
'<API key>' => 'Enable or disable conditional usage on profile view.',
'PROFILE_VIEW_307f0e' => 'Profile View',
'<API key>' => 'Field condition preferences',
'<API key>' => 'Select conditional display for this field.',
'<API key>' => 'Field conditional others',
'<API key>' => 'Field conditional self',
'<API key>' => 'Select field to match value against in determining this fields display.',
'SELECT_FIELD_24af14' => '
'<API key>' => 'Select fields to show if value is matched.',
'<API key>' => '
'<API key>' => 'Select fields to hide if value is matched.',
'<API key>' => 'Field Options',
'<API key>' => 'Select field options to show if value is matched.',
'<API key>' => '
'<API key>' => 'Select field options to hide if value is matched.',
'<API key>' => 'Select how to handle this fields display based on field value match.',
'<API key>' => 'Enable or disable conditional usage on userlists searching.',
'<API key>' => 'Userlists Search',
'<API key>' => 'Enable or disable conditional usage on userlists view.',
'<API key>' => 'Userlists View',
'<API key>' => 'Enable or disable usage of conditions in Backend.',
'BACKEND_2e427c' => 'Backend',
'<API key>' => 'Enable or disable reset of field values to blank if condition is not met.',
'RESET_526d68' => 'Reset',
);
|
package ca.nines.ise.util;
import java.util.ArrayDeque;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.UserDataHandler;
import org.w3c.dom.events.Event;
import org.w3c.dom.events.EventListener;
import org.w3c.dom.events.EventTarget;
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.XMLFilterImpl;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.LocatorImpl;
public class LocationAnnotator extends XMLFilterImpl {
/**
* Locator returned by the construction process.
*/
private Locator locator;
/**
* The systemID of the XML.
*/
private final String source;
/**
* Stack to hold the locators which haven't been completed yet.
*/
private final ArrayDeque<Locator> locatorStack = new ArrayDeque<>();
/**
* Stack holding incomplete elements.
*/
private final ArrayDeque<Element> elementStack = new ArrayDeque<>();
/**
* A data handler to add the location data.
*/
private final UserDataHandler dataHandler = new LocationDataHandler();
/**
* Construct a location annotator for an XMLReader and Document. The systemID
* is determined automatically.
*
* @param xmlReader the reader to use the annotator
* @param dom the DOM to annotate
*/
LocationAnnotator(XMLReader xmlReader, Document dom) {
super(xmlReader);
source = "";
EventListener modListener = new EventListener() {
@Override
public void handleEvent(Event e) {
EventTarget target = e.getTarget();
elementStack.push((Element) target);
}
};
((EventTarget) dom).addEventListener("DOMNodeInserted", modListener, true);
}
/**
* Construct a location annotator for an XMLReader and Document. The systemID
* is NOT determined automatically.
*
* @param source the systemID of the XML
* @param xmlReader the reader to use the annotator
* @param dom the DOM to annotate
*/
LocationAnnotator(String source, XMLReader xmlReader, Document dom) {
super(xmlReader);
this.source = source;
EventListener modListener = new EventListener() {
@Override
public void handleEvent(Event e) {
EventTarget target = e.getTarget();
elementStack.push((Element) target);
}
};
((EventTarget) dom).addEventListener("DOMNodeInserted", modListener, true);
}
/**
* Add the locator to the document during the parse.
*
* @param locator the locator to add
*/
@Override
public void setDocumentLocator(Locator locator) {
super.setDocumentLocator(locator);
this.locator = locator;
}
/**
* Handle the start tag of an element by adding locator data.
*
* @param uri The systemID of the XML.
* @param localName the name of the tag. unused.
* @param qName the FQDN of the tag. unused.
* @param atts the attributes of the tag. unused.
* @throws SAXException
*/
@Override
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
super.startElement(uri, localName, qName, atts);
locatorStack.push(new LocatorImpl(locator));
}
/**
* Handle the end tag of an element by adding locator data.
*
* @param uri The systemID of the XML.
* @param localName the name of the tag. unused.
* @param qName the FQDN of the tag. unused.
* @throws SAXException
*/
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
super.endElement(uri, localName, qName);
if (locatorStack.size() > 0) {
Locator startLocator = locatorStack.pop();
LocationData location = new LocationData(
(startLocator.getSystemId() == null ? source : startLocator.getSystemId()),
startLocator.getLineNumber(),
startLocator.getColumnNumber(),
locator.getLineNumber(),
locator.getColumnNumber()
);
Element e = elementStack.pop();
e.setUserData(
LocationData.LOCATION_DATA_KEY, location,
dataHandler);
}
}
/**
* UserDataHandler to insert location data into the XML DOM.
*/
private class LocationDataHandler implements UserDataHandler {
/**
* Handle an even during a parse. An even is a start/end/empty tag or some
* data.
*
* @param operation unused.
* @param key unused
* @param data unused
* @param src the source of the data
* @param dst the destination of the data
*/
@Override
public void handle(short operation, String key, Object data, Node src, Node dst) {
if (src != null && dst != null) {
LocationData locatonData = (LocationData) src.getUserData(LocationData.LOCATION_DATA_KEY);
if (locatonData != null) {
dst.setUserData(LocationData.LOCATION_DATA_KEY, locatonData, dataHandler);
}
}
}
}
}
|
package net.indrix.arara.servlets.pagination;
import java.sql.SQLException;
import java.util.List;
import net.indrix.arara.dao.<API key>;
public class <API key> extends
<API key> {
/**
* Creates a new <API key> object, with the given number of elements per page, and
* with the flag identification
*
* @param soundsPerPage The amount of sounds per page
* @param identification The flag for identification
*/
public <API key>(int soundsPerPage, boolean identification) {
super(soundsPerPage, identification);
}
@Override
protected List retrieveAllData() throws <API key>, SQLException {
logger.debug("<API key>.retrieveAllData : retrieving all sounds...");
List listOfSounds = null;
if (id != -1){
listOfSounds = model.<API key>(getId());
} else {
listOfSounds = model.<API key>(getText());
}
logger.debug("<API key>.retrieveAllData : " + listOfSounds.size() + " sounds retrieved...");
return listOfSounds;
}
}
|
/* This file was generated by PyBindGen 0.15.0.809 */
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <stddef.h>
#if PY_VERSION_HEX < 0x020400F0
#define <API key>() 1
#define Py_CLEAR(op) \
do { \
if (op) { \
PyObject *tmp = (PyObject *)(op); \
(op) = NULL; \
Py_DECREF(tmp); \
} \
} while (0)
#define Py_VISIT(op) \
do { \
if (op) { \
int vret = visit((PyObject *)(op), arg); \
if (vret) \
return vret; \
} \
} while (0)
#endif
#if PY_VERSION_HEX < 0x020500F0
typedef int Py_ssize_t;
# define PY_SSIZE_T_MAX INT_MAX
# define PY_SSIZE_T_MIN INT_MIN
typedef inquiry lenfunc;
typedef intargfunc ssizeargfunc;
typedef intobjargproc ssizeobjargproc;
#endif
#if __GNUC__ > 2
# define PYBINDGEN_UNUSED(param) param __attribute__((__unused__))
#elif __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
# define PYBINDGEN_UNUSED(param) __attribute__((__unused__)) param
#else
# define PYBINDGEN_UNUSED(param) param
#endif /* !__GNUC__ */
typedef enum <API key> {
<API key> = 0,
<API key> = (1<<0),
} <API key>;
#include "ns3/uan-module.h"
#include <ostream>
#include <sstream>
#include <typeinfo>
#include <map>
#include <iostream>
typedef struct {
PyObject_HEAD
ns3::Address *obj;
<API key> flags:8;
} PyNs3Address;
extern PyTypeObject *_PyNs3Address_Type;
#define PyNs3Address_Type (*_PyNs3Address_Type)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::<API key> *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::<API key>::Item *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::Buffer *obj;
<API key> flags:8;
} PyNs3Buffer;
extern PyTypeObject *_PyNs3Buffer_Type;
#define PyNs3Buffer_Type (*_PyNs3Buffer_Type)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::Buffer::Iterator *obj;
<API key> flags:8;
} PyNs3BufferIterator;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::ByteTagIterator *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::ByteTagIterator::Item *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::ByteTagList *obj;
<API key> flags:8;
} PyNs3ByteTagList;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::ByteTagList::Iterator *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::ByteTagList::Iterator::Item *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::CallbackBase *obj;
<API key> flags:8;
} PyNs3CallbackBase;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::<API key> *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::<API key> *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
class <API key> : public ns3::<API key>
{
public:
PyObject *m_pyself;
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
};
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::EnergySourceHelper *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
class <API key> : public ns3::EnergySourceHelper
{
public:
PyObject *m_pyself;
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
};
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::EventId *obj;
<API key> flags:8;
} PyNs3EventId;
extern PyTypeObject *_PyNs3EventId_Type;
#define PyNs3EventId_Type (*_PyNs3EventId_Type)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::Ipv4Address *obj;
<API key> flags:8;
} PyNs3Ipv4Address;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::Ipv4Mask *obj;
<API key> flags:8;
} PyNs3Ipv4Mask;
extern PyTypeObject *_PyNs3Ipv4Mask_Type;
#define PyNs3Ipv4Mask_Type (*_PyNs3Ipv4Mask_Type)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::Ipv6Address *obj;
<API key> flags:8;
} PyNs3Ipv6Address;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::Ipv6Prefix *obj;
<API key> flags:8;
} PyNs3Ipv6Prefix;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::NetDeviceContainer *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::NodeContainer *obj;
<API key> flags:8;
} PyNs3NodeContainer;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::ObjectBase *obj;
PyObject *inst_dict;
<API key> flags:8;
} PyNs3ObjectBase;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
class <API key> : public ns3::ObjectBase
{
public:
PyObject *m_pyself;
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
};
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::ObjectDeleter *obj;
<API key> flags:8;
} PyNs3ObjectDeleter;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::ObjectFactory *obj;
<API key> flags:8;
} PyNs3ObjectFactory;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::PacketMetadata *obj;
<API key> flags:8;
} PyNs3PacketMetadata;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::PacketMetadata::Item *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::PacketMetadata::ItemIterator *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::PacketTagIterator *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::PacketTagIterator::Item *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::PacketTagList *obj;
<API key> flags:8;
} PyNs3PacketTagList;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::PacketTagList::TagData *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter > *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
#include <map>
#include <string>
#include <typeinfo>
#if defined(__GNUC__) && __GNUC__ >= 3
# include <cxxabi.h>
#endif
#define PBG_TYPEMAP_DEBUG 0
namespace pybindgen {
class TypeMap
{
std::map<std::string, PyTypeObject *> m_map;
public:
TypeMap() {}
void register_wrapper(const std::type_info &cpp_type_info, PyTypeObject *python_wrapper)
{
#if PBG_TYPEMAP_DEBUG
std::cerr << "register_wrapper(this=" << this << ", type_name=" << cpp_type_info.name()
<< ", python_wrapper=" << python_wrapper->tp_name << ")" << std::endl;
#endif
m_map[std::string(cpp_type_info.name())] = python_wrapper;
}
PyTypeObject * lookup_wrapper(const std::type_info &cpp_type_info, PyTypeObject *fallback_wrapper)
{
#if PBG_TYPEMAP_DEBUG
std::cerr << "lookup_wrapper(this=" << this << ", type_name=" << cpp_type_info.name() << ")" << std::endl;
#endif
PyTypeObject *python_wrapper = m_map[cpp_type_info.name()];
if (python_wrapper)
return python_wrapper;
else {
#if defined(__GNUC__) && __GNUC__ >= 3
// Get closest (in the single inheritance tree provided by cxxabi.h)
// registered python wrapper.
const abi::<API key> *_typeinfo =
dynamic_cast<const abi::<API key>*> (&cpp_type_info);
#if PBG_TYPEMAP_DEBUG
std::cerr << " -> looking at C++ type " << _typeinfo->name() << std::endl;
#endif
while (_typeinfo && (python_wrapper = m_map[std::string(_typeinfo->name())]) == 0) {
_typeinfo = dynamic_cast<const abi::<API key>*> (_typeinfo->__base_type);
#if PBG_TYPEMAP_DEBUG
std::cerr << " -> looking at C++ type " << _typeinfo->name() << std::endl;
#endif
}
#if PBG_TYPEMAP_DEBUG
if (python_wrapper) {
std::cerr << " -> found match " << std::endl;
} else {
std::cerr << " -> return fallback wrapper" << std::endl;
}
#endif
return python_wrapper? python_wrapper : fallback_wrapper;
#else // non gcc 3+ compilers can only match against explicitly registered classes, not hidden subclasses
return fallback_wrapper;
#endif
}
}
};
}
extern pybindgen::TypeMap *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::Simulator *obj;
<API key> flags:8;
} PyNs3Simulator;
extern PyTypeObject *<API key>;
#define PyNs3Simulator_Type (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::Tag *obj;
PyObject *inst_dict;
<API key> flags:8;
} PyNs3Tag;
extern PyTypeObject *_PyNs3Tag_Type;
#define PyNs3Tag_Type (*_PyNs3Tag_Type)
typedef struct {
PyObject_HEAD
ns3::TagBuffer *obj;
<API key> flags:8;
} PyNs3TagBuffer;
extern PyTypeObject *<API key>;
#define PyNs3TagBuffer_Type (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::TracedValue< double > *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::TypeId *obj;
<API key> flags:8;
} PyNs3TypeId;
extern PyTypeObject *_PyNs3TypeId_Type;
#define PyNs3TypeId_Type (*_PyNs3TypeId_Type)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::TypeId::<API key> *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::TypeId::<API key> *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::Vector2D *obj;
<API key> flags:8;
} PyNs3Vector2D;
extern PyTypeObject *_PyNs3Vector2D_Type;
#define PyNs3Vector2D_Type (*_PyNs3Vector2D_Type)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::Vector3D *obj;
<API key> flags:8;
} PyNs3Vector3D;
extern PyTypeObject *_PyNs3Vector3D_Type;
#define PyNs3Vector3D_Type (*_PyNs3Vector3D_Type)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::empty *obj;
<API key> flags:8;
} PyNs3Empty;
extern PyTypeObject *_PyNs3Empty_Type;
#define PyNs3Empty_Type (*_PyNs3Empty_Type)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::int64x64_t *obj;
<API key> flags:8;
} PyNs3Int64x64_t;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::Chunk *obj;
PyObject *inst_dict;
<API key> flags:8;
} PyNs3Chunk;
extern PyTypeObject *_PyNs3Chunk_Type;
#define PyNs3Chunk_Type (*_PyNs3Chunk_Type)
typedef struct {
PyObject_HEAD
ns3::Header *obj;
PyObject *inst_dict;
<API key> flags:8;
} PyNs3Header;
extern PyTypeObject *_PyNs3Header_Type;
#define PyNs3Header_Type (*_PyNs3Header_Type)
typedef struct {
PyObject_HEAD
ns3::Object *obj;
PyObject *inst_dict;
<API key> flags:8;
} PyNs3Object;
extern PyTypeObject *_PyNs3Object_Type;
#define PyNs3Object_Type (*_PyNs3Object_Type)
class <API key> : public ns3::Object
{
public:
PyObject *m_pyself;
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
};
typedef struct {
PyObject_HEAD
ns3::Object::AggregateIterator *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::<API key> *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
class <API key> : public ns3::<API key>
{
public:
PyObject *m_pyself;
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
};
typedef struct {
PyObject_HEAD
ns3::<API key> *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
class <API key> : public ns3::<API key>
{
public:
PyObject *m_pyself;
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
};
typedef struct {
PyObject_HEAD
ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > *obj;
<API key> flags:8;
} PyNs3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt__;
extern PyTypeObject *_PyNs3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___Type;
#define PyNs3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___Type (*_PyNs3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___Type)
extern pybindgen::TypeMap *_PyNs3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt____typeid_map;
#define PyNs3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt____typeid_map (*_PyNs3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt____typeid_map)
typedef struct {
PyObject_HEAD
ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > *obj;
<API key> flags:8;
} PyNs3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt__;
extern PyTypeObject *_PyNs3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___Type;
#define PyNs3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___Type (*_PyNs3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___Type)
extern pybindgen::TypeMap *_PyNs3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt____typeid_map;
#define PyNs3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt____typeid_map (*_PyNs3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt____typeid_map)
typedef struct {
PyObject_HEAD
ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> > *obj;
<API key> flags:8;
} PyNs3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt__;
extern PyTypeObject *_PyNs3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___Type;
#define PyNs3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___Type (*_PyNs3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___Type)
extern pybindgen::TypeMap *_PyNs3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt____typeid_map;
#define PyNs3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt____typeid_map (*_PyNs3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt____typeid_map)
typedef struct {
PyObject_HEAD
ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> > *obj;
<API key> flags:8;
} PyNs3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt__;
extern PyTypeObject *_PyNs3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___Type;
#define PyNs3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___Type (*_PyNs3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___Type)
extern pybindgen::TypeMap *_PyNs3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt____typeid_map;
#define PyNs3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt____typeid_map (*_PyNs3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt____typeid_map)
typedef struct {
PyObject_HEAD
ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> > *obj;
<API key> flags:8;
} PyNs3SimpleRefCount__Ns3EventImpl_Ns3Empty_Ns3DefaultDeleter__lt__ns3EventImpl__gt__;
extern PyTypeObject *_PyNs3SimpleRefCount__Ns3EventImpl_Ns3Empty_Ns3DefaultDeleter__lt__ns3EventImpl__gt___Type;
#define PyNs3SimpleRefCount__Ns3EventImpl_Ns3Empty_Ns3DefaultDeleter__lt__ns3EventImpl__gt___Type (*_PyNs3SimpleRefCount__Ns3EventImpl_Ns3Empty_Ns3DefaultDeleter__lt__ns3EventImpl__gt___Type)
extern pybindgen::TypeMap *_PyNs3SimpleRefCount__Ns3EventImpl_Ns3Empty_Ns3DefaultDeleter__lt__ns3EventImpl__gt____typeid_map;
#define PyNs3SimpleRefCount__Ns3EventImpl_Ns3Empty_Ns3DefaultDeleter__lt__ns3EventImpl__gt____typeid_map (*_PyNs3SimpleRefCount__Ns3EventImpl_Ns3Empty_Ns3DefaultDeleter__lt__ns3EventImpl__gt____typeid_map)
typedef struct {
PyObject_HEAD
ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> > *obj;
<API key> flags:8;
} PyNs3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt__;
extern PyTypeObject *_PyNs3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___Type;
#define PyNs3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___Type (*_PyNs3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___Type)
extern pybindgen::TypeMap *_PyNs3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt____typeid_map;
#define PyNs3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt____typeid_map (*_PyNs3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt____typeid_map)
typedef struct {
PyObject_HEAD
ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> > *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *_PyNs3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___Type;
#define PyNs3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___Type (*_PyNs3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___Type)
extern pybindgen::TypeMap *_PyNs3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt____typeid_map;
#define PyNs3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt____typeid_map (*_PyNs3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt____typeid_map)
typedef struct {
PyObject_HEAD
ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > *obj;
<API key> flags:8;
} PyNs3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt__;
extern PyTypeObject *_PyNs3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___Type;
#define PyNs3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___Type (*_PyNs3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___Type)
extern pybindgen::TypeMap *_PyNs3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt____typeid_map;
#define PyNs3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt____typeid_map (*_PyNs3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt____typeid_map)
typedef struct {
PyObject_HEAD
ns3::Time *obj;
<API key> flags:8;
} PyNs3Time;
extern PyTypeObject *_PyNs3Time_Type;
#define PyNs3Time_Type (*_PyNs3Time_Type)
extern std::map<void*, PyObject*> *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::TraceSourceAccessor *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::Trailer *obj;
PyObject *inst_dict;
<API key> flags:8;
} PyNs3Trailer;
extern PyTypeObject *_PyNs3Trailer_Type;
#define PyNs3Trailer_Type (*_PyNs3Trailer_Type)
typedef struct {
PyObject_HEAD
ns3::<API key> *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
class <API key> : public ns3::<API key>
{
public:
PyObject *m_pyself;
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
};
typedef struct {
PyObject_HEAD
ns3::<API key> *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
class <API key> : public ns3::<API key>
{
public:
PyObject *m_pyself;
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
};
typedef struct {
PyObject_HEAD
ns3::<API key> *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
class <API key> : public ns3::<API key>
{
public:
PyObject *m_pyself;
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
};
typedef struct {
PyObject_HEAD
ns3::ZetaRandomVariable *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
class <API key> : public ns3::ZetaRandomVariable
{
public:
PyObject *m_pyself;
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
};
typedef struct {
PyObject_HEAD
ns3::ZipfRandomVariable *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
class <API key> : public ns3::ZipfRandomVariable
{
public:
PyObject *m_pyself;
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
};
typedef struct {
PyObject_HEAD
ns3::AttributeAccessor *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::AttributeChecker *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::AttributeValue *obj;
<API key> flags:8;
} PyNs3AttributeValue;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::BooleanChecker *obj;
<API key> flags:8;
} PyNs3BooleanChecker;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::BooleanValue *obj;
<API key> flags:8;
} PyNs3BooleanValue;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::CallbackChecker *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::CallbackImplBase *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::CallbackValue *obj;
<API key> flags:8;
} PyNs3CallbackValue;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::Channel *obj;
PyObject *inst_dict;
<API key> flags:8;
} PyNs3Channel;
extern PyTypeObject *_PyNs3Channel_Type;
#define PyNs3Channel_Type (*_PyNs3Channel_Type)
class <API key> : public ns3::Channel
{
public:
PyObject *m_pyself;
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
};
typedef struct {
PyObject_HEAD
ns3::<API key> *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
class <API key> : public ns3::<API key>
{
public:
PyObject *m_pyself;
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
};
typedef struct {
PyObject_HEAD
ns3::<API key> *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
class <API key> : public ns3::<API key>
{
public:
PyObject *m_pyself;
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
};
typedef struct {
PyObject_HEAD
ns3::DeviceEnergyModel *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
class <API key> : public ns3::DeviceEnergyModel
{
public:
PyObject *m_pyself;
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
};
typedef struct {
PyObject_HEAD
ns3::DoubleValue *obj;
<API key> flags:8;
} PyNs3DoubleValue;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::<API key> *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
class <API key> : public ns3::<API key>
{
public:
PyObject *m_pyself;
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
};
typedef struct {
PyObject_HEAD
ns3::EmptyAttributeValue *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::EnergySource *obj;
PyObject *inst_dict;
<API key> flags:8;
} PyNs3EnergySource;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
class <API key> : public ns3::EnergySource
{
public:
PyObject *m_pyself;
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
};
typedef struct {
PyObject_HEAD
ns3::<API key> *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
class <API key> : public ns3::<API key>
{
public:
PyObject *m_pyself;
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
};
typedef struct {
PyObject_HEAD
ns3::EnumChecker *obj;
<API key> flags:8;
} PyNs3EnumChecker;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::EnumValue *obj;
<API key> flags:8;
} PyNs3EnumValue;
extern PyTypeObject *<API key>;
#define PyNs3EnumValue_Type (*<API key>)
typedef struct {
PyObject_HEAD
ns3::<API key> *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
class <API key> : public ns3::<API key>
{
public:
PyObject *m_pyself;
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
};
typedef struct {
PyObject_HEAD
ns3::EventImpl *obj;
<API key> flags:8;
} PyNs3EventImpl;
extern PyTypeObject *<API key>;
#define PyNs3EventImpl_Type (*<API key>)
typedef struct {
PyObject_HEAD
ns3::<API key> *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
class <API key> : public ns3::<API key>
{
public:
PyObject *m_pyself;
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
};
typedef struct {
PyObject_HEAD
ns3::GammaRandomVariable *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
class <API key> : public ns3::GammaRandomVariable
{
public:
PyObject *m_pyself;
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
};
typedef struct {
PyObject_HEAD
ns3::IntegerValue *obj;
<API key> flags:8;
} PyNs3IntegerValue;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::Ipv4AddressChecker *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::Ipv4AddressValue *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::Ipv4MaskChecker *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::Ipv4MaskValue *obj;
<API key> flags:8;
} PyNs3Ipv4MaskValue;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::Ipv6AddressChecker *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::Ipv6AddressValue *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::Ipv6PrefixChecker *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::Ipv6PrefixValue *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::<API key> *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
class <API key> : public ns3::<API key>
{
public:
PyObject *m_pyself;
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
};
typedef struct {
PyObject_HEAD
ns3::MobilityModel *obj;
PyObject *inst_dict;
<API key> flags:8;
} PyNs3MobilityModel;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
class <API key> : public ns3::MobilityModel
{
public:
PyObject *m_pyself;
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
};
typedef struct {
PyObject_HEAD
ns3::NetDevice *obj;
PyObject *inst_dict;
<API key> flags:8;
} PyNs3NetDevice;
extern PyTypeObject *<API key>;
#define PyNs3NetDevice_Type (*<API key>)
typedef struct {
PyObject_HEAD
ns3::NixVector *obj;
<API key> flags:8;
} PyNs3NixVector;
extern PyTypeObject *<API key>;
#define PyNs3NixVector_Type (*<API key>)
typedef struct {
PyObject_HEAD
ns3::Node *obj;
PyObject *inst_dict;
<API key> flags:8;
} PyNs3Node;
extern PyTypeObject *_PyNs3Node_Type;
#define PyNs3Node_Type (*_PyNs3Node_Type)
class <API key> : public ns3::Node
{
public:
PyObject *m_pyself;
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
};
typedef struct {
PyObject_HEAD
ns3::<API key> *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
class <API key> : public ns3::<API key>
{
public:
PyObject *m_pyself;
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
};
typedef struct {
PyObject_HEAD
ns3::<API key> *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::ObjectFactoryValue *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::Packet *obj;
<API key> flags:8;
} PyNs3Packet;
extern PyTypeObject *_PyNs3Packet_Type;
#define PyNs3Packet_Type (*_PyNs3Packet_Type)
typedef struct {
PyObject_HEAD
ns3::<API key> *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
class <API key> : public ns3::<API key>
{
public:
PyObject *m_pyself;
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
};
typedef struct {
PyObject_HEAD
ns3::PointerChecker *obj;
<API key> flags:8;
} PyNs3PointerChecker;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::PointerValue *obj;
<API key> flags:8;
} PyNs3PointerValue;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::TimeChecker *obj;
<API key> flags:8;
} PyNs3TimeChecker;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::TimeValue *obj;
<API key> flags:8;
} PyNs3TimeValue;
extern PyTypeObject *<API key>;
#define PyNs3TimeValue_Type (*<API key>)
typedef struct {
PyObject_HEAD
ns3::TypeIdChecker *obj;
<API key> flags:8;
} PyNs3TypeIdChecker;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::TypeIdValue *obj;
<API key> flags:8;
} PyNs3TypeIdValue;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::UintegerValue *obj;
<API key> flags:8;
} PyNs3UintegerValue;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::Vector2DChecker *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::Vector2DValue *obj;
<API key> flags:8;
} PyNs3Vector2DValue;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::Vector3DChecker *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::Vector3DValue *obj;
<API key> flags:8;
} PyNs3Vector3DValue;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::AddressChecker *obj;
<API key> flags:8;
} PyNs3AddressChecker;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::AddressValue *obj;
<API key> flags:8;
} PyNs3AddressValue;
extern PyTypeObject *<API key>;
#define <API key> (*<API key>)
typedef struct {
PyObject_HEAD
ns3::Reservation *obj;
<API key> flags:8;
} PyNs3Reservation;
extern PyTypeObject <API key>;
extern std::map<void*, PyObject*> <API key>;
typedef struct {
PyObject_HEAD
ns3::Tap *obj;
<API key> flags:8;
} PyNs3Tap;
extern PyTypeObject PyNs3Tap_Type;
extern std::map<void*, PyObject*> <API key>;
typedef struct {
PyObject_HEAD
ns3::UanAddress *obj;
<API key> flags:8;
} PyNs3UanAddress;
extern PyTypeObject <API key>;
extern std::map<void*, PyObject*> <API key>;
typedef struct {
PyObject_HEAD
ns3::UanHelper *obj;
<API key> flags:8;
} PyNs3UanHelper;
extern PyTypeObject PyNs3UanHelper_Type;
extern std::map<void*, PyObject*> <API key>;
typedef struct {
PyObject_HEAD
ns3::UanModesList *obj;
<API key> flags:8;
} PyNs3UanModesList;
extern PyTypeObject <API key>;
extern std::map<void*, PyObject*> <API key>;
typedef struct {
PyObject_HEAD
ns3::UanPacketArrival *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject <API key>;
extern std::map<void*, PyObject*> <API key>;
typedef struct {
PyObject_HEAD
ns3::UanPdp *obj;
<API key> flags:8;
} PyNs3UanPdp;
extern PyTypeObject PyNs3UanPdp_Type;
extern std::map<void*, PyObject*> <API key>;
typedef struct {
PyObject_HEAD
ns3::UanPhyListener *obj;
PyObject *inst_dict;
<API key> flags:8;
} PyNs3UanPhyListener;
extern PyTypeObject <API key>;
class <API key> : public ns3::UanPhyListener
{
public:
PyObject *m_pyself;
<API key>()
: ns3::UanPhyListener(), m_pyself(NULL)
{}
<API key>(ns3::UanPhyListener const & arg0)
: ns3::UanPhyListener(arg0), m_pyself(NULL)
{}
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
virtual void NotifyCcaEnd();
virtual void NotifyCcaStart();
virtual void NotifyRxEndError();
virtual void NotifyRxEndOk();
virtual void NotifyRxStart();
virtual void NotifyTxStart(ns3::Time duration);
};
extern std::map<void*, PyObject*> <API key>;
typedef struct {
PyObject_HEAD
ns3::UanTxMode *obj;
<API key> flags:8;
} PyNs3UanTxMode;
extern PyTypeObject PyNs3UanTxMode_Type;
extern std::map<void*, PyObject*> <API key>;
typedef struct {
PyObject_HEAD
ns3::UanTxModeFactory *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject <API key>;
extern std::map<void*, PyObject*> <API key>;
typedef struct {
PyObject_HEAD
ns3::<API key> *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject <API key>;
class <API key> : public ns3::<API key>
{
public:
PyObject *m_pyself;
<API key>(ns3::<API key> const & arg0)
: ns3::<API key>(arg0), m_pyself(NULL)
{}
<API key>()
: ns3::<API key>(), m_pyself(NULL)
{}
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
virtual ns3::Ptr< ns3::DeviceEnergyModel > DoInstall(ns3::Ptr< ns3::NetDevice > device, ns3::Ptr< ns3::EnergySource > source) const;
};
typedef struct {
PyObject_HEAD
ns3::UanHeaderCommon *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject <API key>;
typedef struct {
PyObject_HEAD
ns3::UanHeaderRcAck *obj;
PyObject *inst_dict;
<API key> flags:8;
} PyNs3UanHeaderRcAck;
extern PyTypeObject <API key>;
typedef struct {
PyObject_HEAD
ns3::UanHeaderRcCts *obj;
PyObject *inst_dict;
<API key> flags:8;
} PyNs3UanHeaderRcCts;
extern PyTypeObject <API key>;
typedef struct {
PyObject_HEAD
ns3::<API key> *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject <API key>;
typedef struct {
PyObject_HEAD
ns3::UanHeaderRcData *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject <API key>;
typedef struct {
PyObject_HEAD
ns3::UanHeaderRcRts *obj;
PyObject *inst_dict;
<API key> flags:8;
} PyNs3UanHeaderRcRts;
extern PyTypeObject <API key>;
typedef struct {
PyObject_HEAD
ns3::UanMac *obj;
PyObject *inst_dict;
<API key> flags:8;
} PyNs3UanMac;
extern PyTypeObject PyNs3UanMac_Type;
typedef struct {
PyObject_HEAD
ns3::UanMacAloha *obj;
PyObject *inst_dict;
<API key> flags:8;
} PyNs3UanMacAloha;
extern PyTypeObject <API key>;
class <API key> : public ns3::UanMacAloha
{
public:
PyObject *m_pyself;
<API key>(ns3::UanMacAloha const & arg0)
: ns3::UanMacAloha(arg0), m_pyself(NULL)
{}
<API key>()
: ns3::UanMacAloha(), m_pyself(NULL)
{}
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
static PyObject * <API key>(PyNs3UanMacAloha *self);
inline void <API key>()
{ ns3::ObjectBase::<API key>(); }
static PyObject * <API key>(PyNs3UanMacAloha *self);
inline void <API key>()
{ ns3::Object::NotifyNewAggregate(); }
static PyObject * _wrap_DoStart(PyNs3UanMacAloha *self);
inline void <API key>()
{ ns3::Object::DoStart(); }
static PyObject * _wrap_DoDispose(PyNs3UanMacAloha *self);
inline void <API key>()
{ ns3::UanMacAloha::DoDispose(); }
virtual int64_t AssignStreams(int64_t stream);
virtual void AttachPhy(ns3::Ptr< ns3::UanPhy > phy);
virtual void Clear();
virtual bool Enqueue(ns3::Ptr< ns3::Packet > pkt, ns3::Address const & dest, uint16_t protocolNumber);
virtual ns3::Address GetAddress();
virtual ns3::Address GetBroadcast() const;
virtual void SetAddress(ns3::UanAddress addr);
virtual void DoDispose();
virtual ns3::TypeId GetInstanceTypeId() const;
virtual void DoStart();
virtual void NotifyNewAggregate();
virtual void <API key>();
static ns3::TypeId GetTypeId (void)
{
static ns3::TypeId tid = ns3::TypeId ("<API key>")
.SetParent< ns3::UanMacAloha > ()
;
return tid;
}
};
<API key> (<API key>);
typedef struct {
PyObject_HEAD
ns3::UanMacCw *obj;
PyObject *inst_dict;
<API key> flags:8;
} PyNs3UanMacCw;
extern PyTypeObject PyNs3UanMacCw_Type;
class <API key> : public ns3::UanMacCw
{
public:
PyObject *m_pyself;
<API key>(ns3::UanMacCw const & arg0)
: ns3::UanMacCw(arg0), m_pyself(NULL)
{}
<API key>()
: ns3::UanMacCw(), m_pyself(NULL)
{}
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
static PyObject * <API key>(PyNs3UanMacCw *self);
inline void <API key>()
{ ns3::ObjectBase::<API key>(); }
static PyObject * <API key>(PyNs3UanMacCw *self);
inline void <API key>()
{ ns3::Object::NotifyNewAggregate(); }
static PyObject * _wrap_DoStart(PyNs3UanMacCw *self);
inline void <API key>()
{ ns3::Object::DoStart(); }
static PyObject * _wrap_DoDispose(PyNs3UanMacCw *self);
inline void <API key>()
{ ns3::UanMacCw::DoDispose(); }
virtual int64_t AssignStreams(int64_t stream);
virtual void AttachPhy(ns3::Ptr< ns3::UanPhy > phy);
virtual void Clear();
virtual bool Enqueue(ns3::Ptr< ns3::Packet > pkt, ns3::Address const & dest, uint16_t protocolNumber);
virtual ns3::Address GetAddress();
virtual ns3::Address GetBroadcast() const;
virtual uint32_t GetCw();
virtual ns3::Time GetSlotTime();
virtual void NotifyCcaEnd();
virtual void NotifyCcaStart();
virtual void NotifyRxEndError();
virtual void NotifyRxEndOk();
virtual void NotifyRxStart();
virtual void NotifyTxStart(ns3::Time duration);
virtual void SetAddress(ns3::UanAddress addr);
virtual void SetCw(uint32_t cw);
virtual void SetSlotTime(ns3::Time duration);
virtual void DoDispose();
virtual ns3::TypeId GetInstanceTypeId() const;
virtual void DoStart();
virtual void NotifyNewAggregate();
virtual void <API key>();
static ns3::TypeId GetTypeId (void)
{
static ns3::TypeId tid = ns3::TypeId ("<API key>")
.SetParent< ns3::UanMacCw > ()
;
return tid;
}
};
<API key> (<API key>);
typedef struct {
PyObject_HEAD
ns3::UanMacRc *obj;
PyObject *inst_dict;
<API key> flags:8;
} PyNs3UanMacRc;
extern PyTypeObject PyNs3UanMacRc_Type;
class <API key> : public ns3::UanMacRc
{
public:
PyObject *m_pyself;
<API key>(ns3::UanMacRc const & arg0)
: ns3::UanMacRc(arg0), m_pyself(NULL)
{}
<API key>()
: ns3::UanMacRc(), m_pyself(NULL)
{}
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
static PyObject * <API key>(PyNs3UanMacRc *self);
inline void <API key>()
{ ns3::ObjectBase::<API key>(); }
static PyObject * <API key>(PyNs3UanMacRc *self);
inline void <API key>()
{ ns3::Object::NotifyNewAggregate(); }
static PyObject * _wrap_DoStart(PyNs3UanMacRc *self);
inline void <API key>()
{ ns3::Object::DoStart(); }
static PyObject * _wrap_DoDispose(PyNs3UanMacRc *self);
inline void <API key>()
{ ns3::UanMacRc::DoDispose(); }
virtual int64_t AssignStreams(int64_t stream);
virtual void AttachPhy(ns3::Ptr< ns3::UanPhy > phy);
virtual void Clear();
virtual bool Enqueue(ns3::Ptr< ns3::Packet > pkt, ns3::Address const & dest, uint16_t protocolNumber);
virtual ns3::Address GetAddress();
virtual ns3::Address GetBroadcast() const;
virtual void SetAddress(ns3::UanAddress addr);
virtual void DoDispose();
virtual ns3::TypeId GetInstanceTypeId() const;
virtual void DoStart();
virtual void NotifyNewAggregate();
virtual void <API key>();
static ns3::TypeId GetTypeId (void)
{
static ns3::TypeId tid = ns3::TypeId ("<API key>")
.SetParent< ns3::UanMacRc > ()
;
return tid;
}
};
<API key> (<API key>);
typedef struct {
PyObject_HEAD
ns3::UanMacRcGw *obj;
PyObject *inst_dict;
<API key> flags:8;
} PyNs3UanMacRcGw;
extern PyTypeObject <API key>;
class <API key> : public ns3::UanMacRcGw
{
public:
PyObject *m_pyself;
<API key>(ns3::UanMacRcGw const & arg0)
: ns3::UanMacRcGw(arg0), m_pyself(NULL)
{}
<API key>()
: ns3::UanMacRcGw(), m_pyself(NULL)
{}
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
static PyObject * <API key>(PyNs3UanMacRcGw *self);
inline void <API key>()
{ ns3::ObjectBase::<API key>(); }
static PyObject * <API key>(PyNs3UanMacRcGw *self);
inline void <API key>()
{ ns3::Object::NotifyNewAggregate(); }
static PyObject * _wrap_DoStart(PyNs3UanMacRcGw *self);
inline void <API key>()
{ ns3::Object::DoStart(); }
static PyObject * _wrap_DoDispose(PyNs3UanMacRcGw *self);
inline void <API key>()
{ ns3::UanMacRcGw::DoDispose(); }
virtual int64_t AssignStreams(int64_t stream);
virtual void AttachPhy(ns3::Ptr< ns3::UanPhy > phy);
virtual void Clear();
virtual bool Enqueue(ns3::Ptr< ns3::Packet > pkt, ns3::Address const & dest, uint16_t protocolNumber);
virtual ns3::Address GetAddress();
virtual ns3::Address GetBroadcast() const;
virtual void SetAddress(ns3::UanAddress addr);
virtual void DoDispose();
virtual ns3::TypeId GetInstanceTypeId() const;
virtual void DoStart();
virtual void NotifyNewAggregate();
virtual void <API key>();
static ns3::TypeId GetTypeId (void)
{
static ns3::TypeId tid = ns3::TypeId ("<API key>")
.SetParent< ns3::UanMacRcGw > ()
;
return tid;
}
};
<API key> (<API key>);
typedef struct {
PyObject_HEAD
ns3::UanNoiseModel *obj;
PyObject *inst_dict;
<API key> flags:8;
} PyNs3UanNoiseModel;
extern PyTypeObject <API key>;
class <API key> : public ns3::UanNoiseModel
{
public:
PyObject *m_pyself;
<API key>()
: ns3::UanNoiseModel(), m_pyself(NULL)
{}
<API key>(ns3::UanNoiseModel const & arg0)
: ns3::UanNoiseModel(arg0), m_pyself(NULL)
{}
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
static PyObject * <API key>(PyNs3UanNoiseModel *self);
inline void <API key>()
{ ns3::ObjectBase::<API key>(); }
static PyObject * <API key>(PyNs3UanNoiseModel *self);
inline void <API key>()
{ ns3::Object::NotifyNewAggregate(); }
static PyObject * _wrap_DoStart(PyNs3UanNoiseModel *self);
inline void <API key>()
{ ns3::Object::DoStart(); }
virtual void Clear();
virtual void DoDispose();
virtual double GetNoiseDbHz(double fKhz) const;
virtual ns3::TypeId GetInstanceTypeId() const;
virtual void DoStart();
virtual void NotifyNewAggregate();
virtual void <API key>();
static ns3::TypeId GetTypeId (void)
{
static ns3::TypeId tid = ns3::TypeId ("<API key>")
.SetParent< ns3::UanNoiseModel > ()
;
return tid;
}
};
<API key> (<API key>);
typedef struct {
PyObject_HEAD
ns3::<API key> *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject <API key>;
class <API key> : public ns3::<API key>
{
public:
PyObject *m_pyself;
<API key>(ns3::<API key> const & arg0)
: ns3::<API key>(arg0), m_pyself(NULL)
{}
<API key>()
: ns3::<API key>(), m_pyself(NULL)
{}
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
static PyObject * <API key>(<API key> *self);
inline void <API key>()
{ ns3::ObjectBase::<API key>(); }
static PyObject * <API key>(<API key> *self);
inline void <API key>()
{ ns3::Object::NotifyNewAggregate(); }
static PyObject * _wrap_DoStart(<API key> *self);
inline void <API key>()
{ ns3::Object::DoStart(); }
virtual double GetNoiseDbHz(double fKhz) const;
virtual void Clear();
virtual void DoDispose();
virtual ns3::TypeId GetInstanceTypeId() const;
virtual void DoStart();
virtual void NotifyNewAggregate();
virtual void <API key>();
static ns3::TypeId GetTypeId (void)
{
static ns3::TypeId tid = ns3::TypeId ("<API key>")
.SetParent< ns3::<API key> > ()
;
return tid;
}
};
<API key> (<API key>);
typedef struct {
PyObject_HEAD
ns3::UanPhy *obj;
PyObject *inst_dict;
<API key> flags:8;
} PyNs3UanPhy;
extern PyTypeObject PyNs3UanPhy_Type;
typedef struct {
PyObject_HEAD
ns3::UanPhyCalcSinr *obj;
PyObject *inst_dict;
<API key> flags:8;
} PyNs3UanPhyCalcSinr;
extern PyTypeObject <API key>;
class <API key> : public ns3::UanPhyCalcSinr
{
public:
PyObject *m_pyself;
<API key>()
: ns3::UanPhyCalcSinr(), m_pyself(NULL)
{}
<API key>(ns3::UanPhyCalcSinr const & arg0)
: ns3::UanPhyCalcSinr(arg0), m_pyself(NULL)
{}
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
static PyObject * <API key>(PyNs3UanPhyCalcSinr *self);
inline void <API key>()
{ ns3::ObjectBase::<API key>(); }
static PyObject * <API key>(PyNs3UanPhyCalcSinr *self);
inline void <API key>()
{ ns3::Object::NotifyNewAggregate(); }
static PyObject * _wrap_DoStart(PyNs3UanPhyCalcSinr *self);
inline void <API key>()
{ ns3::Object::DoStart(); }
virtual double CalcSinrDb(ns3::Ptr< ns3::Packet > pkt, ns3::Time arrTime, double rxPowerDb, double ambNoiseDb, ns3::UanTxMode mode, ns3::UanPdp pdp, std::list< ns3::UanPacketArrival > const & arrivalList) const;
virtual void Clear();
virtual void DoDispose();
virtual ns3::TypeId GetInstanceTypeId() const;
virtual void DoStart();
virtual void NotifyNewAggregate();
virtual void <API key>();
static ns3::TypeId GetTypeId (void)
{
static ns3::TypeId tid = ns3::TypeId ("<API key>")
.SetParent< ns3::UanPhyCalcSinr > ()
;
return tid;
}
};
<API key> (<API key>);
typedef struct {
PyObject_HEAD
ns3::<API key> *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject <API key>;
class <API key> : public ns3::<API key>
{
public:
PyObject *m_pyself;
<API key>(ns3::<API key> const & arg0)
: ns3::<API key>(arg0), m_pyself(NULL)
{}
<API key>()
: ns3::<API key>(), m_pyself(NULL)
{}
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
static PyObject * <API key>(<API key> *self);
inline void <API key>()
{ ns3::ObjectBase::<API key>(); }
static PyObject * <API key>(<API key> *self);
inline void <API key>()
{ ns3::Object::NotifyNewAggregate(); }
static PyObject * _wrap_DoStart(<API key> *self);
inline void <API key>()
{ ns3::Object::DoStart(); }
virtual double CalcSinrDb(ns3::Ptr< ns3::Packet > pkt, ns3::Time arrTime, double rxPowerDb, double ambNoiseDb, ns3::UanTxMode mode, ns3::UanPdp pdp, std::list< ns3::UanPacketArrival > const & arrivalList) const;
virtual void DoDispose();
virtual void Clear();
virtual ns3::TypeId GetInstanceTypeId() const;
virtual void DoStart();
virtual void NotifyNewAggregate();
virtual void <API key>();
static ns3::TypeId GetTypeId (void)
{
static ns3::TypeId tid = ns3::TypeId ("<API key>")
.SetParent< ns3::<API key> > ()
;
return tid;
}
};
<API key> (<API key>);
typedef struct {
PyObject_HEAD
ns3::UanPhyCalcSinrDual *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject <API key>;
class <API key> : public ns3::UanPhyCalcSinrDual
{
public:
PyObject *m_pyself;
<API key>(ns3::UanPhyCalcSinrDual const & arg0)
: ns3::UanPhyCalcSinrDual(arg0), m_pyself(NULL)
{}
<API key>()
: ns3::UanPhyCalcSinrDual(), m_pyself(NULL)
{}
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
static PyObject * <API key>(<API key> *self);
inline void <API key>()
{ ns3::ObjectBase::<API key>(); }
static PyObject * <API key>(<API key> *self);
inline void <API key>()
{ ns3::Object::NotifyNewAggregate(); }
static PyObject * _wrap_DoStart(<API key> *self);
inline void <API key>()
{ ns3::Object::DoStart(); }
virtual double CalcSinrDb(ns3::Ptr< ns3::Packet > pkt, ns3::Time arrTime, double rxPowerDb, double ambNoiseDb, ns3::UanTxMode mode, ns3::UanPdp pdp, std::list< ns3::UanPacketArrival > const & arrivalList) const;
virtual void DoDispose();
virtual void Clear();
virtual ns3::TypeId GetInstanceTypeId() const;
virtual void DoStart();
virtual void NotifyNewAggregate();
virtual void <API key>();
static ns3::TypeId GetTypeId (void)
{
static ns3::TypeId tid = ns3::TypeId ("<API key>")
.SetParent< ns3::UanPhyCalcSinrDual > ()
;
return tid;
}
};
<API key> (<API key>);
typedef struct {
PyObject_HEAD
ns3::UanPhyCalcSinrFhFsk *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject <API key>;
class <API key> : public ns3::UanPhyCalcSinrFhFsk
{
public:
PyObject *m_pyself;
<API key>(ns3::UanPhyCalcSinrFhFsk const & arg0)
: ns3::UanPhyCalcSinrFhFsk(arg0), m_pyself(NULL)
{}
<API key>()
: ns3::UanPhyCalcSinrFhFsk(), m_pyself(NULL)
{}
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
static PyObject * <API key>(<API key> *self);
inline void <API key>()
{ ns3::ObjectBase::<API key>(); }
static PyObject * <API key>(<API key> *self);
inline void <API key>()
{ ns3::Object::NotifyNewAggregate(); }
static PyObject * _wrap_DoStart(<API key> *self);
inline void <API key>()
{ ns3::Object::DoStart(); }
virtual double CalcSinrDb(ns3::Ptr< ns3::Packet > pkt, ns3::Time arrTime, double rxPowerDb, double ambNoiseDb, ns3::UanTxMode mode, ns3::UanPdp pdp, std::list< ns3::UanPacketArrival > const & arrivalList) const;
virtual void DoDispose();
virtual void Clear();
virtual ns3::TypeId GetInstanceTypeId() const;
virtual void DoStart();
virtual void NotifyNewAggregate();
virtual void <API key>();
static ns3::TypeId GetTypeId (void)
{
static ns3::TypeId tid = ns3::TypeId ("<API key>")
.SetParent< ns3::UanPhyCalcSinrFhFsk > ()
;
return tid;
}
};
<API key> (<API key>);
typedef struct {
PyObject_HEAD
ns3::UanPhyDual *obj;
PyObject *inst_dict;
<API key> flags:8;
} PyNs3UanPhyDual;
extern PyTypeObject <API key>;
typedef struct {
PyObject_HEAD
ns3::UanPhyGen *obj;
PyObject *inst_dict;
<API key> flags:8;
} PyNs3UanPhyGen;
extern PyTypeObject PyNs3UanPhyGen_Type;
typedef struct {
PyObject_HEAD
ns3::UanPhyPer *obj;
PyObject *inst_dict;
<API key> flags:8;
} PyNs3UanPhyPer;
extern PyTypeObject PyNs3UanPhyPer_Type;
class <API key> : public ns3::UanPhyPer
{
public:
PyObject *m_pyself;
<API key>()
: ns3::UanPhyPer(), m_pyself(NULL)
{}
<API key>(ns3::UanPhyPer const & arg0)
: ns3::UanPhyPer(arg0), m_pyself(NULL)
{}
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
static PyObject * <API key>(PyNs3UanPhyPer *self);
inline void <API key>()
{ ns3::ObjectBase::<API key>(); }
static PyObject * <API key>(PyNs3UanPhyPer *self);
inline void <API key>()
{ ns3::Object::NotifyNewAggregate(); }
static PyObject * _wrap_DoStart(PyNs3UanPhyPer *self);
inline void <API key>()
{ ns3::Object::DoStart(); }
virtual double CalcPer(ns3::Ptr< ns3::Packet > pkt, double sinrDb, ns3::UanTxMode mode);
virtual void Clear();
virtual void DoDispose();
virtual ns3::TypeId GetInstanceTypeId() const;
virtual void DoStart();
virtual void NotifyNewAggregate();
virtual void <API key>();
static ns3::TypeId GetTypeId (void)
{
static ns3::TypeId tid = ns3::TypeId ("<API key>")
.SetParent< ns3::UanPhyPer > ()
;
return tid;
}
};
<API key> (<API key>);
typedef struct {
PyObject_HEAD
ns3::UanPhyPerGenDefault *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject <API key>;
class <API key> : public ns3::UanPhyPerGenDefault
{
public:
PyObject *m_pyself;
<API key>(ns3::UanPhyPerGenDefault const & arg0)
: ns3::UanPhyPerGenDefault(arg0), m_pyself(NULL)
{}
<API key>()
: ns3::UanPhyPerGenDefault(), m_pyself(NULL)
{}
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
static PyObject * <API key>(<API key> *self);
inline void <API key>()
{ ns3::ObjectBase::<API key>(); }
static PyObject * <API key>(<API key> *self);
inline void <API key>()
{ ns3::Object::NotifyNewAggregate(); }
static PyObject * _wrap_DoStart(<API key> *self);
inline void <API key>()
{ ns3::Object::DoStart(); }
virtual double CalcPer(ns3::Ptr< ns3::Packet > pkt, double sinrDb, ns3::UanTxMode mode);
virtual void Clear();
virtual void DoDispose();
virtual ns3::TypeId GetInstanceTypeId() const;
virtual void DoStart();
virtual void NotifyNewAggregate();
virtual void <API key>();
static ns3::TypeId GetTypeId (void)
{
static ns3::TypeId tid = ns3::TypeId ("<API key>")
.SetParent< ns3::UanPhyPerGenDefault > ()
;
return tid;
}
};
<API key> (<API key>);
typedef struct {
PyObject_HEAD
ns3::UanPhyPerUmodem *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject <API key>;
class <API key> : public ns3::UanPhyPerUmodem
{
public:
PyObject *m_pyself;
<API key>(ns3::UanPhyPerUmodem const & arg0)
: ns3::UanPhyPerUmodem(arg0), m_pyself(NULL)
{}
<API key>()
: ns3::UanPhyPerUmodem(), m_pyself(NULL)
{}
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
static PyObject * <API key>(<API key> *self);
inline void <API key>()
{ ns3::ObjectBase::<API key>(); }
static PyObject * <API key>(<API key> *self);
inline void <API key>()
{ ns3::Object::NotifyNewAggregate(); }
static PyObject * _wrap_DoStart(<API key> *self);
inline void <API key>()
{ ns3::Object::DoStart(); }
virtual double CalcPer(ns3::Ptr< ns3::Packet > pkt, double sinrDb, ns3::UanTxMode mode);
virtual void Clear();
virtual void DoDispose();
virtual ns3::TypeId GetInstanceTypeId() const;
virtual void DoStart();
virtual void NotifyNewAggregate();
virtual void <API key>();
static ns3::TypeId GetTypeId (void)
{
static ns3::TypeId tid = ns3::TypeId ("<API key>")
.SetParent< ns3::UanPhyPerUmodem > ()
;
return tid;
}
};
<API key> (<API key>);
typedef struct {
PyObject_HEAD
ns3::UanPropModel *obj;
PyObject *inst_dict;
<API key> flags:8;
} PyNs3UanPropModel;
extern PyTypeObject <API key>;
class <API key> : public ns3::UanPropModel
{
public:
PyObject *m_pyself;
<API key>()
: ns3::UanPropModel(), m_pyself(NULL)
{}
<API key>(ns3::UanPropModel const & arg0)
: ns3::UanPropModel(arg0), m_pyself(NULL)
{}
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
static PyObject * <API key>(PyNs3UanPropModel *self);
inline void <API key>()
{ ns3::ObjectBase::<API key>(); }
static PyObject * <API key>(PyNs3UanPropModel *self);
inline void <API key>()
{ ns3::Object::NotifyNewAggregate(); }
static PyObject * _wrap_DoStart(PyNs3UanPropModel *self);
inline void <API key>()
{ ns3::Object::DoStart(); }
virtual void Clear();
virtual void DoDispose();
virtual ns3::Time GetDelay(ns3::Ptr< ns3::MobilityModel > a, ns3::Ptr< ns3::MobilityModel > b, ns3::UanTxMode mode);
virtual double GetPathLossDb(ns3::Ptr< ns3::MobilityModel > a, ns3::Ptr< ns3::MobilityModel > b, ns3::UanTxMode txMode);
virtual ns3::UanPdp GetPdp(ns3::Ptr< ns3::MobilityModel > a, ns3::Ptr< ns3::MobilityModel > b, ns3::UanTxMode mode);
virtual ns3::TypeId GetInstanceTypeId() const;
virtual void DoStart();
virtual void NotifyNewAggregate();
virtual void <API key>();
static ns3::TypeId GetTypeId (void)
{
static ns3::TypeId tid = ns3::TypeId ("<API key>")
.SetParent< ns3::UanPropModel > ()
;
return tid;
}
};
<API key> (<API key>);
typedef struct {
PyObject_HEAD
ns3::UanPropModelIdeal *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject <API key>;
class <API key> : public ns3::UanPropModelIdeal
{
public:
PyObject *m_pyself;
<API key>(ns3::UanPropModelIdeal const & arg0)
: ns3::UanPropModelIdeal(arg0), m_pyself(NULL)
{}
<API key>()
: ns3::UanPropModelIdeal(), m_pyself(NULL)
{}
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
static PyObject * <API key>(<API key> *self);
inline void <API key>()
{ ns3::ObjectBase::<API key>(); }
static PyObject * <API key>(<API key> *self);
inline void <API key>()
{ ns3::Object::NotifyNewAggregate(); }
static PyObject * _wrap_DoStart(<API key> *self);
inline void <API key>()
{ ns3::Object::DoStart(); }
virtual ns3::Time GetDelay(ns3::Ptr< ns3::MobilityModel > a, ns3::Ptr< ns3::MobilityModel > b, ns3::UanTxMode mode);
virtual double GetPathLossDb(ns3::Ptr< ns3::MobilityModel > a, ns3::Ptr< ns3::MobilityModel > b, ns3::UanTxMode mode);
virtual ns3::UanPdp GetPdp(ns3::Ptr< ns3::MobilityModel > a, ns3::Ptr< ns3::MobilityModel > b, ns3::UanTxMode mode);
virtual void Clear();
virtual void DoDispose();
virtual ns3::TypeId GetInstanceTypeId() const;
virtual void DoStart();
virtual void NotifyNewAggregate();
virtual void <API key>();
static ns3::TypeId GetTypeId (void)
{
static ns3::TypeId tid = ns3::TypeId ("<API key>")
.SetParent< ns3::UanPropModelIdeal > ()
;
return tid;
}
};
<API key> (<API key>);
typedef struct {
PyObject_HEAD
ns3::UanPropModelThorp *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject <API key>;
class <API key> : public ns3::UanPropModelThorp
{
public:
PyObject *m_pyself;
<API key>(ns3::UanPropModelThorp const & arg0)
: ns3::UanPropModelThorp(arg0), m_pyself(NULL)
{}
<API key>()
: ns3::UanPropModelThorp(), m_pyself(NULL)
{}
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
static PyObject * <API key>(<API key> *self);
inline void <API key>()
{ ns3::ObjectBase::<API key>(); }
static PyObject * <API key>(<API key> *self);
inline void <API key>()
{ ns3::Object::NotifyNewAggregate(); }
static PyObject * _wrap_DoStart(<API key> *self);
inline void <API key>()
{ ns3::Object::DoStart(); }
virtual ns3::Time GetDelay(ns3::Ptr< ns3::MobilityModel > a, ns3::Ptr< ns3::MobilityModel > b, ns3::UanTxMode mode);
virtual double GetPathLossDb(ns3::Ptr< ns3::MobilityModel > a, ns3::Ptr< ns3::MobilityModel > b, ns3::UanTxMode mode);
virtual ns3::UanPdp GetPdp(ns3::Ptr< ns3::MobilityModel > a, ns3::Ptr< ns3::MobilityModel > b, ns3::UanTxMode mode);
virtual void Clear();
virtual void DoDispose();
virtual ns3::TypeId GetInstanceTypeId() const;
virtual void DoStart();
virtual void NotifyNewAggregate();
virtual void <API key>();
static ns3::TypeId GetTypeId (void)
{
static ns3::TypeId tid = ns3::TypeId ("<API key>")
.SetParent< ns3::UanPropModelThorp > ()
;
return tid;
}
};
<API key> (<API key>);
typedef struct {
PyObject_HEAD
ns3::UanTransducer *obj;
PyObject *inst_dict;
<API key> flags:8;
} PyNs3UanTransducer;
extern PyTypeObject <API key>;
typedef struct {
PyObject_HEAD
ns3::UanTransducerHd *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject <API key>;
typedef struct {
PyObject_HEAD
ns3::UanChannel *obj;
PyObject *inst_dict;
<API key> flags:8;
} PyNs3UanChannel;
extern PyTypeObject <API key>;
class <API key> : public ns3::UanChannel
{
public:
PyObject *m_pyself;
<API key>(ns3::UanChannel const & arg0)
: ns3::UanChannel(arg0), m_pyself(NULL)
{}
<API key>()
: ns3::UanChannel(), m_pyself(NULL)
{}
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
static PyObject * <API key>(PyNs3UanChannel *self);
inline void <API key>()
{ ns3::ObjectBase::<API key>(); }
static PyObject * <API key>(PyNs3UanChannel *self);
inline void <API key>()
{ ns3::Object::NotifyNewAggregate(); }
static PyObject * _wrap_DoStart(PyNs3UanChannel *self);
inline void <API key>()
{ ns3::Object::DoStart(); }
static PyObject * _wrap_DoDispose(PyNs3UanChannel *self);
inline void <API key>()
{ ns3::UanChannel::DoDispose(); }
virtual ns3::Ptr< ns3::NetDevice > GetDevice(uint32_t i) const;
virtual uint32_t GetNDevices() const;
virtual void DoDispose();
virtual ns3::TypeId GetInstanceTypeId() const;
virtual void DoStart();
virtual void NotifyNewAggregate();
virtual void <API key>();
static ns3::TypeId GetTypeId (void)
{
static ns3::TypeId tid = ns3::TypeId ("<API key>")
.SetParent< ns3::UanChannel > ()
;
return tid;
}
};
<API key> (<API key>);
typedef struct {
PyObject_HEAD
ns3::UanModesListChecker *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject <API key>;
typedef struct {
PyObject_HEAD
ns3::UanModesListValue *obj;
<API key> flags:8;
} <API key>;
extern PyTypeObject <API key>;
typedef struct {
PyObject_HEAD
ns3::UanNetDevice *obj;
PyObject *inst_dict;
<API key> flags:8;
} PyNs3UanNetDevice;
extern PyTypeObject <API key>;
typedef struct {
PyObject_HEAD
ns3::<API key> *obj;
PyObject *inst_dict;
<API key> flags:8;
} <API key>;
extern PyTypeObject <API key>;
class <API key> : public ns3::<API key>
{
public:
PyObject *m_pyself;
<API key>(ns3::<API key> const & arg0)
: ns3::<API key>(arg0), m_pyself(NULL)
{}
<API key>()
: ns3::<API key>(), m_pyself(NULL)
{}
void set_pyobj(PyObject *pyobj)
{
Py_XDECREF(m_pyself);
Py_INCREF(pyobj);
m_pyself = pyobj;
}
virtual ~<API key>()
{
Py_CLEAR(m_pyself);
}
static PyObject * <API key>(<API key> *self);
inline void <API key>()
{ ns3::ObjectBase::<API key>(); }
static PyObject * <API key>(<API key> *self);
inline void <API key>()
{ ns3::Object::NotifyNewAggregate(); }
static PyObject * _wrap_DoStart(<API key> *self);
inline void <API key>()
{ ns3::Object::DoStart(); }
virtual void ChangeState(int newState);
virtual ns3::Ptr< ns3::Node > GetNode() const;
virtual double <API key>() const;
virtual void <API key>();
virtual void SetEnergySource(ns3::Ptr< ns3::EnergySource > source);
virtual void SetNode(ns3::Ptr< ns3::Node > node);
virtual void DoDispose();
virtual double DoGetCurrentA() const;
virtual ns3::TypeId GetInstanceTypeId() const;
virtual void DoStart();
virtual void NotifyNewAggregate();
virtual void <API key>();
static ns3::TypeId GetTypeId (void)
{
static ns3::TypeId tid = ns3::TypeId ("<API key>")
.SetParent< ns3::<API key> > ()
;
return tid;
}
};
<API key> (<API key>);
typedef struct {
PyObject_HEAD
std::vector< ns3::Tap > *obj;
} <API key>;
typedef struct {
PyObject_HEAD
<API key> *container;
std::vector< ns3::Tap >::iterator *iterator;
} <API key>;
extern PyTypeObject <API key>;
extern PyTypeObject <API key>;
int <API key>(PyObject *arg, std::vector< ns3::Tap > *container);
typedef struct {
PyObject_HEAD
std::vector< double > *obj;
} <API key>;
typedef struct {
PyObject_HEAD
<API key> *container;
std::vector< double >::iterator *iterator;
} <API key>;
extern PyTypeObject <API key>;
extern PyTypeObject <API key>;
int <API key>(PyObject *arg, std::vector< double > *container);
typedef struct {
PyObject_HEAD
std::set< unsigned char > *obj;
} <API key>;
typedef struct {
PyObject_HEAD
<API key> *container;
std::set< unsigned char >::iterator *iterator;
} <API key>;
extern PyTypeObject <API key>;
extern PyTypeObject <API key>;
int <API key>(PyObject *arg, std::set< unsigned char > *container);
typedef struct {
PyObject_HEAD
std::list< ns3::UanPacketArrival > *obj;
} <API key>;
typedef struct {
PyObject_HEAD
<API key> *container;
std::list< ns3::UanPacketArrival >::iterator *iterator;
} <API key>;
extern PyTypeObject <API key>;
extern PyTypeObject <API key>;
int <API key>(PyObject *arg, std::list< ns3::UanPacketArrival > *container);
typedef struct {
PyObject_HEAD
std::list< ns3::Ptr< ns3::UanPhy > > *obj;
} <API key>;
typedef struct {
PyObject_HEAD
<API key> *container;
std::list< ns3::Ptr< ns3::UanPhy > >::iterator *iterator;
} <API key>;
extern PyTypeObject <API key>;
extern PyTypeObject <API key>;
int <API key>(PyObject *arg, std::list< ns3::Ptr< ns3::UanPhy > > *container);
typedef struct {
PyObject_HEAD
std::list< ns3::Ptr< ns3::UanTransducer > > *obj;
} <API key>;
typedef struct {
PyObject_HEAD
<API key> *container;
std::list< ns3::Ptr< ns3::UanTransducer > >::iterator *iterator;
} <API key>;
extern PyTypeObject <API key>;
extern PyTypeObject <API key>;
int _wrap_convert_py2c__std__list__lt___ns3__Ptr__lt___ns3__UanTransducer___gt_____gt__(PyObject *arg, std::list< ns3::Ptr< ns3::UanTransducer > > *container);
class PythonCallbackImpl0 : public ns3::CallbackImpl<void, int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>
{
public:
PyObject *m_callback;
PythonCallbackImpl0(PyObject *callback)
{
Py_INCREF(callback);
m_callback = callback;
}
virtual ~PythonCallbackImpl0()
{
Py_DECREF(m_callback);
m_callback = NULL;
}
virtual bool IsEqual(ns3::Ptr<const ns3::CallbackImplBase> other_base) const
{
const PythonCallbackImpl0 *other = dynamic_cast<const PythonCallbackImpl0*> (ns3::PeekPointer (other_base));
if (other != NULL)
return (other->m_callback == m_callback);
else
return false;
}
void
operator()(int arg1)
{
PyGILState_STATE __py_gil_state;
PyObject *py_retval;
PyObject *args;
__py_gil_state = (<API key>() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
args = Py_BuildValue((char *) "(i)", arg1);
py_retval = PyObject_CallObject(m_callback, args);
if (py_retval == NULL) {
Py_DECREF(args);
if (<API key>())
PyGILState_Release(__py_gil_state);
return;
}
if (py_retval != Py_None) {
PyErr_SetString(PyExc_TypeError, "function/method should return None");
Py_DECREF(py_retval);
Py_DECREF(args);
if (<API key>())
PyGILState_Release(__py_gil_state);
return;
}
Py_DECREF(py_retval);
Py_DECREF(args);
if (<API key>())
PyGILState_Release(__py_gil_state);
return;
}
};
class PythonCallbackImpl1 : public ns3::CallbackImpl<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>
{
public:
PyObject *m_callback;
PythonCallbackImpl1(PyObject *callback)
{
Py_INCREF(callback);
m_callback = callback;
}
virtual ~PythonCallbackImpl1()
{
Py_DECREF(m_callback);
m_callback = NULL;
}
virtual bool IsEqual(ns3::Ptr<const ns3::CallbackImplBase> other_base) const
{
const PythonCallbackImpl1 *other = dynamic_cast<const PythonCallbackImpl1*> (ns3::PeekPointer (other_base));
if (other != NULL)
return (other->m_callback == m_callback);
else
return false;
}
void
operator()()
{
PyGILState_STATE __py_gil_state;
PyObject *py_retval;
PyObject *args;
__py_gil_state = (<API key>() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
args = Py_BuildValue((char *) "()");
py_retval = PyObject_CallObject(m_callback, args);
if (py_retval == NULL) {
Py_DECREF(args);
if (<API key>())
PyGILState_Release(__py_gil_state);
return;
}
if (py_retval != Py_None) {
PyErr_SetString(PyExc_TypeError, "function/method should return None");
Py_DECREF(py_retval);
Py_DECREF(args);
if (<API key>())
PyGILState_Release(__py_gil_state);
return;
}
Py_DECREF(py_retval);
Py_DECREF(args);
if (<API key>())
PyGILState_Release(__py_gil_state);
return;
}
};
class PythonCallbackImpl2 : public ns3::CallbackImpl<void, ns3::Ptr<ns3::Packet>, double, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>
{
public:
PyObject *m_callback;
PythonCallbackImpl2(PyObject *callback)
{
Py_INCREF(callback);
m_callback = callback;
}
virtual ~PythonCallbackImpl2()
{
Py_DECREF(m_callback);
m_callback = NULL;
}
virtual bool IsEqual(ns3::Ptr<const ns3::CallbackImplBase> other_base) const
{
const PythonCallbackImpl2 *other = dynamic_cast<const PythonCallbackImpl2*> (ns3::PeekPointer (other_base));
if (other != NULL)
return (other->m_callback == m_callback);
else
return false;
}
void
operator()(ns3::Ptr< ns3::Packet > arg1, double arg2)
{
PyGILState_STATE __py_gil_state;
PyObject *py_retval;
PyNs3Packet *py_Packet;
std::map<void*, PyObject*>::const_iterator wrapper_lookup_iter;
PyTypeObject *wrapper_type = 0;
PyObject *args;
__py_gil_state = (<API key>() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
wrapper_lookup_iter = <API key>.find((void *) const_cast<ns3::Packet *> (ns3::PeekPointer (arg1)));
if (wrapper_lookup_iter == <API key>.end()) {
py_Packet = NULL;
} else {
py_Packet = (PyNs3Packet *) wrapper_lookup_iter->second;
Py_INCREF(py_Packet);
}
if (py_Packet == NULL)
{
wrapper_type = PyNs3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt____typeid_map.lookup_wrapper(typeid(*const_cast<ns3::Packet *> (ns3::PeekPointer (arg1))), &PyNs3Packet_Type);
py_Packet = PyObject_New(PyNs3Packet, wrapper_type);
py_Packet->flags = <API key>;
const_cast<ns3::Packet *> (ns3::PeekPointer (arg1))->Ref();
py_Packet->obj = const_cast<ns3::Packet *> (ns3::PeekPointer (arg1));
<API key>[(void *) py_Packet->obj] = (PyObject *) py_Packet;
}
args = Py_BuildValue((char *) "(Nd)", py_Packet, arg2);
py_retval = PyObject_CallObject(m_callback, args);
if (py_retval == NULL) {
Py_DECREF(args);
if (<API key>())
PyGILState_Release(__py_gil_state);
return;
}
if (py_retval != Py_None) {
PyErr_SetString(PyExc_TypeError, "function/method should return None");
Py_DECREF(py_retval);
Py_DECREF(args);
if (<API key>())
PyGILState_Release(__py_gil_state);
return;
}
Py_DECREF(py_retval);
Py_DECREF(args);
if (<API key>())
PyGILState_Release(__py_gil_state);
return;
}
};
class PythonCallbackImpl3 : public ns3::CallbackImpl<void, ns3::Ptr<ns3::Packet>, double, ns3::UanTxMode, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>
{
public:
PyObject *m_callback;
PythonCallbackImpl3(PyObject *callback)
{
Py_INCREF(callback);
m_callback = callback;
}
virtual ~PythonCallbackImpl3()
{
Py_DECREF(m_callback);
m_callback = NULL;
}
virtual bool IsEqual(ns3::Ptr<const ns3::CallbackImplBase> other_base) const
{
const PythonCallbackImpl3 *other = dynamic_cast<const PythonCallbackImpl3*> (ns3::PeekPointer (other_base));
if (other != NULL)
return (other->m_callback == m_callback);
else
return false;
}
void
operator()(ns3::Ptr< ns3::Packet > arg1, double arg2, ns3::UanTxMode arg3)
{
PyGILState_STATE __py_gil_state;
PyObject *py_retval;
PyNs3Packet *py_Packet;
std::map<void*, PyObject*>::const_iterator wrapper_lookup_iter;
PyTypeObject *wrapper_type = 0;
PyNs3UanTxMode *py_UanTxMode;
PyObject *args;
__py_gil_state = (<API key>() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
wrapper_lookup_iter = <API key>.find((void *) const_cast<ns3::Packet *> (ns3::PeekPointer (arg1)));
if (wrapper_lookup_iter == <API key>.end()) {
py_Packet = NULL;
} else {
py_Packet = (PyNs3Packet *) wrapper_lookup_iter->second;
Py_INCREF(py_Packet);
}
if (py_Packet == NULL)
{
wrapper_type = PyNs3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt____typeid_map.lookup_wrapper(typeid(*const_cast<ns3::Packet *> (ns3::PeekPointer (arg1))), &PyNs3Packet_Type);
py_Packet = PyObject_New(PyNs3Packet, wrapper_type);
py_Packet->flags = <API key>;
const_cast<ns3::Packet *> (ns3::PeekPointer (arg1))->Ref();
py_Packet->obj = const_cast<ns3::Packet *> (ns3::PeekPointer (arg1));
<API key>[(void *) py_Packet->obj] = (PyObject *) py_Packet;
}
py_UanTxMode = PyObject_New(PyNs3UanTxMode, &PyNs3UanTxMode_Type);
py_UanTxMode->flags = <API key>;
py_UanTxMode->obj = new ns3::UanTxMode(arg3);
<API key>[(void *) py_UanTxMode->obj] = (PyObject *) py_UanTxMode;
args = Py_BuildValue((char *) "(NdN)", py_Packet, arg2, py_UanTxMode);
py_retval = PyObject_CallObject(m_callback, args);
if (py_retval == NULL) {
Py_DECREF(args);
if (<API key>())
PyGILState_Release(__py_gil_state);
return;
}
if (py_retval != Py_None) {
PyErr_SetString(PyExc_TypeError, "function/method should return None");
Py_DECREF(py_retval);
Py_DECREF(args);
if (<API key>())
PyGILState_Release(__py_gil_state);
return;
}
Py_DECREF(py_retval);
Py_DECREF(args);
if (<API key>())
PyGILState_Release(__py_gil_state);
return;
}
};
class PythonCallbackImpl4 : public ns3::CallbackImpl<void, ns3::Ptr<ns3::Packet>, ns3::UanAddress const&, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>
{
public:
PyObject *m_callback;
PythonCallbackImpl4(PyObject *callback)
{
Py_INCREF(callback);
m_callback = callback;
}
virtual ~PythonCallbackImpl4()
{
Py_DECREF(m_callback);
m_callback = NULL;
}
virtual bool IsEqual(ns3::Ptr<const ns3::CallbackImplBase> other_base) const
{
const PythonCallbackImpl4 *other = dynamic_cast<const PythonCallbackImpl4*> (ns3::PeekPointer (other_base));
if (other != NULL)
return (other->m_callback == m_callback);
else
return false;
}
void
operator()(ns3::Ptr< ns3::Packet > arg1, ns3::UanAddress const & arg2)
{
PyGILState_STATE __py_gil_state;
PyObject *py_retval;
PyNs3Packet *py_Packet;
std::map<void*, PyObject*>::const_iterator wrapper_lookup_iter;
PyTypeObject *wrapper_type = 0;
PyNs3UanAddress *py_UanAddress;
PyObject *args;
__py_gil_state = (<API key>() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
wrapper_lookup_iter = <API key>.find((void *) const_cast<ns3::Packet *> (ns3::PeekPointer (arg1)));
if (wrapper_lookup_iter == <API key>.end()) {
py_Packet = NULL;
} else {
py_Packet = (PyNs3Packet *) wrapper_lookup_iter->second;
Py_INCREF(py_Packet);
}
if (py_Packet == NULL)
{
wrapper_type = PyNs3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt____typeid_map.lookup_wrapper(typeid(*const_cast<ns3::Packet *> (ns3::PeekPointer (arg1))), &PyNs3Packet_Type);
py_Packet = PyObject_New(PyNs3Packet, wrapper_type);
py_Packet->flags = <API key>;
const_cast<ns3::Packet *> (ns3::PeekPointer (arg1))->Ref();
py_Packet->obj = const_cast<ns3::Packet *> (ns3::PeekPointer (arg1));
<API key>[(void *) py_Packet->obj] = (PyObject *) py_Packet;
}
py_UanAddress = PyObject_New(PyNs3UanAddress, &<API key>);
py_UanAddress->flags = <API key>;
py_UanAddress->obj = new ns3::UanAddress(arg2);
<API key>[(void *) py_UanAddress->obj] = (PyObject *) py_UanAddress;
args = Py_BuildValue((char *) "(NN)", py_Packet, py_UanAddress);
py_retval = PyObject_CallObject(m_callback, args);
if (py_retval == NULL) {
Py_DECREF(args);
if (<API key>())
PyGILState_Release(__py_gil_state);
return;
}
if (py_retval != Py_None) {
PyErr_SetString(PyExc_TypeError, "function/method should return None");
Py_DECREF(py_retval);
Py_DECREF(args);
if (<API key>())
PyGILState_Release(__py_gil_state);
return;
}
Py_DECREF(py_retval);
Py_DECREF(args);
if (<API key>())
PyGILState_Release(__py_gil_state);
return;
}
};
class PythonCallbackImpl5 : public ns3::CallbackImpl<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>
{
public:
PyObject *m_callback;
PythonCallbackImpl5(PyObject *callback)
{
Py_INCREF(callback);
m_callback = callback;
}
virtual ~PythonCallbackImpl5()
{
Py_DECREF(m_callback);
m_callback = NULL;
}
virtual bool IsEqual(ns3::Ptr<const ns3::CallbackImplBase> other_base) const
{
const PythonCallbackImpl5 *other = dynamic_cast<const PythonCallbackImpl5*> (ns3::PeekPointer (other_base));
if (other != NULL)
return (other->m_callback == m_callback);
else
return false;
}
bool
operator()(ns3::Ptr< ns3::NetDevice > arg1, ns3::Ptr< ns3::Packet const > arg2, unsigned short arg3, ns3::Address const & arg4)
{
PyGILState_STATE __py_gil_state;
PyObject *py_retval;
bool retval;
PyNs3NetDevice *py_NetDevice;
std::map<void*, PyObject*>::const_iterator wrapper_lookup_iter;
PyTypeObject *wrapper_type = 0;
PyNs3Packet *py_Packet;
std::map<void*, PyObject*>::const_iterator <API key>;
PyTypeObject *wrapper_type2 = 0;
PyNs3Address *py_Address;
PyObject *args;
PyObject *py_boolretval;
__py_gil_state = (<API key>() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
wrapper_lookup_iter = <API key>.find((void *) const_cast<ns3::NetDevice *> (ns3::PeekPointer (arg1)));
if (wrapper_lookup_iter == <API key>.end()) {
py_NetDevice = NULL;
} else {
py_NetDevice = (PyNs3NetDevice *) wrapper_lookup_iter->second;
Py_INCREF(py_NetDevice);
}
if (py_NetDevice == NULL)
{
wrapper_type = <API key>.lookup_wrapper(typeid(*const_cast<ns3::NetDevice *> (ns3::PeekPointer (arg1))), &PyNs3NetDevice_Type);
py_NetDevice = PyObject_GC_New(PyNs3NetDevice, wrapper_type);
py_NetDevice->inst_dict = NULL;
py_NetDevice->flags = <API key>;
const_cast<ns3::NetDevice *> (ns3::PeekPointer (arg1))->Ref();
py_NetDevice->obj = const_cast<ns3::NetDevice *> (ns3::PeekPointer (arg1));
<API key>[(void *) py_NetDevice->obj] = (PyObject *) py_NetDevice;
}
<API key> = <API key>.find((void *) const_cast<ns3::Packet *> (ns3::PeekPointer (arg2)));
if (<API key> == <API key>.end()) {
py_Packet = NULL;
} else {
py_Packet = (PyNs3Packet *) <API key>->second;
Py_INCREF(py_Packet);
}
if (py_Packet == NULL)
{
wrapper_type2 = PyNs3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt____typeid_map.lookup_wrapper(typeid(*const_cast<ns3::Packet *> (ns3::PeekPointer (arg2))), &PyNs3Packet_Type);
py_Packet = PyObject_New(PyNs3Packet, wrapper_type2);
py_Packet->flags = <API key>;
const_cast<ns3::Packet *> (ns3::PeekPointer (arg2))->Ref();
py_Packet->obj = const_cast<ns3::Packet *> (ns3::PeekPointer (arg2));
<API key>[(void *) py_Packet->obj] = (PyObject *) py_Packet;
}
py_Address = PyObject_New(PyNs3Address, &PyNs3Address_Type);
py_Address->flags = <API key>;
py_Address->obj = new ns3::Address(arg4);
<API key>[(void *) py_Address->obj] = (PyObject *) py_Address;
args = Py_BuildValue((char *) "(NNiN)", py_NetDevice, py_Packet, (int) arg3, py_Address);
py_retval = PyObject_CallObject(m_callback, args);
if (py_retval == NULL) {
Py_DECREF(args);
if (<API key>())
PyGILState_Release(__py_gil_state);
return false;
}
py_retval = Py_BuildValue((char*) "(N)", py_retval);
if (!PyArg_ParseTuple(py_retval, (char *) "O", &py_boolretval)) {
PyErr_Print();
Py_DECREF(py_retval);
Py_DECREF(args);
if (<API key>())
PyGILState_Release(__py_gil_state);
return false;
}
retval = PyObject_IsTrue(py_boolretval);
Py_DECREF(py_retval);
Py_DECREF(args);
if (<API key>())
PyGILState_Release(__py_gil_state);
return retval;
}
};
class PythonCallbackImpl6 : public ns3::CallbackImpl<void, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty>
{
public:
PyObject *m_callback;
PythonCallbackImpl6(PyObject *callback)
{
Py_INCREF(callback);
m_callback = callback;
}
virtual ~PythonCallbackImpl6()
{
Py_DECREF(m_callback);
m_callback = NULL;
}
virtual bool IsEqual(ns3::Ptr<const ns3::CallbackImplBase> other_base) const
{
const PythonCallbackImpl6 *other = dynamic_cast<const PythonCallbackImpl6*> (ns3::PeekPointer (other_base));
if (other != NULL)
return (other->m_callback == m_callback);
else
return false;
}
void
operator()(ns3::Ptr< ns3::NetDevice > arg1, ns3::Ptr< ns3::Packet const > arg2, unsigned short arg3, ns3::Address const & arg4, ns3::Address const & arg5, ns3::NetDevice::PacketType arg6)
{
PyGILState_STATE __py_gil_state;
PyObject *py_retval;
PyNs3NetDevice *py_NetDevice;
std::map<void*, PyObject*>::const_iterator wrapper_lookup_iter;
PyTypeObject *wrapper_type = 0;
PyNs3Packet *py_Packet;
std::map<void*, PyObject*>::const_iterator <API key>;
PyTypeObject *wrapper_type2 = 0;
PyNs3Address *py_Address;
PyNs3Address *py_Address2;
PyObject *args;
__py_gil_state = (<API key>() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
wrapper_lookup_iter = <API key>.find((void *) const_cast<ns3::NetDevice *> (ns3::PeekPointer (arg1)));
if (wrapper_lookup_iter == <API key>.end()) {
py_NetDevice = NULL;
} else {
py_NetDevice = (PyNs3NetDevice *) wrapper_lookup_iter->second;
Py_INCREF(py_NetDevice);
}
if (py_NetDevice == NULL)
{
wrapper_type = <API key>.lookup_wrapper(typeid(*const_cast<ns3::NetDevice *> (ns3::PeekPointer (arg1))), &PyNs3NetDevice_Type);
py_NetDevice = PyObject_GC_New(PyNs3NetDevice, wrapper_type);
py_NetDevice->inst_dict = NULL;
py_NetDevice->flags = <API key>;
const_cast<ns3::NetDevice *> (ns3::PeekPointer (arg1))->Ref();
py_NetDevice->obj = const_cast<ns3::NetDevice *> (ns3::PeekPointer (arg1));
<API key>[(void *) py_NetDevice->obj] = (PyObject *) py_NetDevice;
}
<API key> = <API key>.find((void *) const_cast<ns3::Packet *> (ns3::PeekPointer (arg2)));
if (<API key> == <API key>.end()) {
py_Packet = NULL;
} else {
py_Packet = (PyNs3Packet *) <API key>->second;
Py_INCREF(py_Packet);
}
if (py_Packet == NULL)
{
wrapper_type2 = PyNs3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt____typeid_map.lookup_wrapper(typeid(*const_cast<ns3::Packet *> (ns3::PeekPointer (arg2))), &PyNs3Packet_Type);
py_Packet = PyObject_New(PyNs3Packet, wrapper_type2);
py_Packet->flags = <API key>;
const_cast<ns3::Packet *> (ns3::PeekPointer (arg2))->Ref();
py_Packet->obj = const_cast<ns3::Packet *> (ns3::PeekPointer (arg2));
<API key>[(void *) py_Packet->obj] = (PyObject *) py_Packet;
}
py_Address = PyObject_New(PyNs3Address, &PyNs3Address_Type);
py_Address->flags = <API key>;
py_Address->obj = new ns3::Address(arg4);
<API key>[(void *) py_Address->obj] = (PyObject *) py_Address;
py_Address2 = PyObject_New(PyNs3Address, &PyNs3Address_Type);
py_Address2->flags = <API key>;
py_Address2->obj = new ns3::Address(arg5);
<API key>[(void *) py_Address2->obj] = (PyObject *) py_Address2;
args = Py_BuildValue((char *) "(NNiNNi)", py_NetDevice, py_Packet, (int) arg3, py_Address, py_Address2, arg6);
py_retval = PyObject_CallObject(m_callback, args);
if (py_retval == NULL) {
Py_DECREF(args);
if (<API key>())
PyGILState_Release(__py_gil_state);
return;
}
if (py_retval != Py_None) {
PyErr_SetString(PyExc_TypeError, "function/method should return None");
Py_DECREF(py_retval);
Py_DECREF(args);
if (<API key>())
PyGILState_Release(__py_gil_state);
return;
}
Py_DECREF(py_retval);
Py_DECREF(args);
if (<API key>())
PyGILState_Release(__py_gil_state);
return;
}
};
int <API key>(PyObject *value, ns3::Tap *address);
int <API key>(PyObject *value, double *address);
int <API key>(PyObject *value, unsigned char *address);
int <API key>(PyObject *value, ns3::UanPacketArrival *address);
int <API key>(PyObject *value, ns3::Ptr< ns3::UanPhy > *address);
int <API key>(PyObject *value, ns3::Ptr< ns3::UanTransducer > *address);
|
package dataservice.businessdataservice;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.ArrayList;
import po.BusinessPO;
import po.DistributeReceiptPO;
import po.DriverPO;
import po.EnVehicleReceiptPO;
import po.GatheringReceiptPO;
import po.<API key>;
import po.OrganizationPO;
import po.VehiclePO;
/**
* BusinessData
*/
public interface BusinessDataService extends Remote {
// IDID,IDnull
public BusinessPO getBusinessInfo(String organizationID, String ID) throws RemoteException;
// IDIDPO
public VehiclePO getVehicleInfo(String organizationID, String vehicleID) throws RemoteException;
public boolean addReceipt(String organizationID, <API key> po) throws RemoteException;
public ArrayList<VehiclePO> getVehicleInfos(String organizationID) throws RemoteException;
public boolean addEnVehicleReceipt(String organizationID, ArrayList<EnVehicleReceiptPO> pos) throws RemoteException;
// VehiclePOVehiclePOList
public boolean addVehicle(String organizationID, VehiclePO po) throws RemoteException;
// VehiclePOListVehiclePO
public boolean deleteVehicle(String organizationID, VehiclePO po) throws RemoteException;
// VehiclePOListVehiclePO
public boolean modifyVehicle(String organizationID, VehiclePO po) throws RemoteException;
public ArrayList<DriverPO> getDriverInfos(String organizationID) throws RemoteException;
// GatheringReceipt
public boolean addGatheringReceipt(String organizationID, GatheringReceiptPO grp) throws RemoteException;
// OrderAcceptReceiptPO
public int <API key>(String organizationID) throws RemoteException;
// GatheringReceipt,time 2015-11-23
public ArrayList<GatheringReceiptPO> getGatheringReceipt(String time) throws RemoteException;
public ArrayList<GatheringReceiptPO> <API key>(String organization) throws RemoteException;
public ArrayList<GatheringReceiptPO> <API key>(String organization, String time)
throws RemoteException;
// DistributeOrder
public boolean <API key>(String organizationID, DistributeReceiptPO po) throws RemoteException;
public DriverPO getDriverInfo(String organizationID, String ID) throws RemoteException;
public boolean addDriver(String organizationID, DriverPO po) throws RemoteException;
public boolean deleteDriver(String organizationID, DriverPO po) throws RemoteException;
public boolean modifyDriver(String organizationID, DriverPO po) throws RemoteException;
/**
* Lizi
*/
public ArrayList<GatheringReceiptPO> <API key>() throws RemoteException;
/**
* Lizi
*/
public ArrayList<DistributeReceiptPO> <API key>() throws RemoteException;
/**
* Lizi
*/
public ArrayList<EnVehicleReceiptPO> <API key>() throws RemoteException;
/**
* Lizi
*/
public ArrayList<<API key>> <API key>() throws RemoteException;
public void <API key>(DistributeReceiptPO po) throws RemoteException;
public void <API key>(<API key> po) throws RemoteException;
public void <API key>(EnVehicleReceiptPO po) throws RemoteException;
public void <API key>(GatheringReceiptPO po) throws RemoteException;
public boolean addDriverTime(String organizationID, String driverID) throws RemoteException;
public ArrayList<OrganizationPO> <API key>() throws RemoteException;
public int getNumOfVehicles(String organizationID) throws RemoteException;
public int getNumOfDrivers(String organizationID) throws RemoteException;
public int <API key>(String organizationID) throws RemoteException;
public int <API key>(String organizationID) throws RemoteException;
public int <API key>(String organizationID) throws RemoteException;
// public ArrayList<OrderPO> getTransferOrders() throws RemoteException;
// public ArrayList<VehiclePO> getFreeVehicles() throws RemoteException;
// public boolean <API key>(EnVehicleReceiptPO po) throws
// RemoteException;
// public ArrayList<GatheringReceiptPO> <API key>() throws
// RemoteException;
// public boolean addReceipt(<API key> po) throws
// RemoteException;
// public boolean addGatheringReceipt(GatheringReceiptPO po);
}
|
# OpenStack ocata installation script on Ubuntu 16.04.2
# by kasidit chanchio
# vasabilab, dept of computer science,
# Thammasat University, Thailand
# run with sudo or as root.
#!/bin/bash -x
cd $HOME/OPSInstaller/controller
pwd
apt-get -y install keystone
cp files/keystone.conf /etc/keystone/keystone.conf
echo "su -s /bin/sh -c \"keystone-manage db_sync\" keystone"
su -s /bin/sh -c "keystone-manage db_sync" keystone
#echo keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone
keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone
keystone-manage credential_setup --keystone-user keystone --keystone-group keystone
keystone-manage bootstrap --bootstrap-password adminpassword \
--bootstrap-admin-url http://controller:35357/v3/ \
--<API key> http://controller:5000/v3/ \
--<API key> http://controller:5000/v3/ \
--bootstrap-region-id RegionOne
cp files/apache2.conf /etc/apache2/apache2.conf
service apache2 restart
rm -f /var/lib/keystone/keystone.db
|
FusionCharts.ready(function () {
var gradientCheckBox = document.getElementById('useGradient');
//Set event listener for radio button
if (gradientCheckBox.addEventListener) {
gradientCheckBox.addEventListener("click", changeGradient);
}
function changeGradient(evt, obj) {
//Set gradient fill for chart using <API key> attribute
(gradientCheckBox.checked) ?revenueChart.setChartAttribute('<API key>', 1) : revenueChart.setChartAttribute('<API key>', 0);
};
var revenueChart = new FusionCharts({
type: 'column2d',
renderAt: 'chart-container',
width: '400',
height: '300',
dataFormat: 'json',
dataSource: {
"chart": {
"caption": "Quarterly Revenue",
"subCaption": "Last year",
"xAxisName": "Quarter",
"yAxisName": "Amount (In USD)",
"theme": "fint",
"numberPrefix": "$",
//Removing default gradient fill from columns
"<API key>": "1"
},
"data": [{
"label": "Q1",
"value": "1950000",
"color": "#008ee4"
}, {
"label": "Q2",
"value": "1450000",
"color": "#9b59b6"
}, {
"label": "Q3",
"value": "1730000",
"color": "#6baa01"
}, {
"label": "Q4",
"value": "2120000",
"color": "#e44a00"
}]
}
}).render();
});
|
#ifndef <API key>
#define <API key>
#include "formula_function.hpp"
#include <set>
namespace ai {
class formula_ai;
}
namespace game_logic {
class <API key> : public <API key> {
public:
explicit <API key>(ai::formula_ai& ai) :
ai_(ai),
move_functions()
{}
expression_ptr create_function(const std::string& fn,
const std::vector<expression_ptr>& args) const;
private:
ai::formula_ai& ai_;
std::set<std::string> move_functions;
};
}
#endif /* <API key> */
|
/* -*- mode: c -*- */
#include "ejudge/cpu.h"
#include "ejudge/errlog.h"
#include <stdlib.h>
int
cpu_get_bogomips(void)
{
err("cpu_get_bogomips: not implemented");
return -1;
}
void
<API key>(unsigned char **p_model, unsigned char **p_mhz)
{
*p_model = NULL;
*p_mhz = NULL;
}
|
#include <u.h>
#include <libc.h>
#include <bio.h>
#include "pci.h"
#include "vga.h"
/*
* ATI Mach64 family.
*/
enum {
HTotalDisp,
HSyncStrtWid,
VTotalDisp,
VSyncStrtWid,
VlineCrntVline,
OffPitch,
IntCntl,
CrtcGenCntl,
OvrClr,
OvrWidLR,
OvrWidTB,
CurClr0,
CurClr1,
CurOffset,
CurHVposn,
CurHVoff,
ScratchReg0,
ScratchReg1, /* Scratch Register (BIOS info) */
ClockCntl,
BusCntl,
MemCntl,
ExtMemCntl,
MemVgaWpSel,
MemVgaRpSel,
DacRegs,
DacCntl,
GenTestCntl,
ConfigCntl, /* Configuration control */
ConfigChipId,
ConfigStat0, /* Configuration status 0 */
ConfigStat1, /* Configuration status 1 */
ConfigStat2,
DspConfig, /* Rage */
DspOnOff, /* Rage */
DpBkgdClr,
DpChainMsk,
DpFrgdClr,
DpMix,
DpPixWidth,
DpSrc,
DpWriteMsk,
LcdIndex,
LcdData,
Nreg,
TvIndex = 0x1D,
TvData = 0x27,
LCD_ConfigPanel = 0,
LCD_GenCtrl,
LCD_DstnCntl,
LCD_HfbPitchAddr,
LCD_HorzStretch,
LCD_VertStretch,
LCD_ExtVertStretch,
LCD_LtGio,
LCD_PowerMngmnt,
LCD_ZvgPio,
Nlcd,
};
static char* iorname[Nreg] = {
"HTotalDisp",
"HSyncStrtWid",
"VTotalDisp",
"VSyncStrtWid",
"VlineCrntVline",
"OffPitch",
"IntCntl",
"CrtcGenCntl",
"OvrClr",
"OvrWidLR",
"OvrWidTB",
"CurClr0",
"CurClr1",
"CurOffset",
"CurHVposn",
"CurHVoff",
"ScratchReg0",
"ScratchReg1",
"ClockCntl",
"BusCntl",
"MemCntl",
"ExtMemCntl",
"MemVgaWpSel",
"MemVgaRpSel",
"DacRegs",
"DacCntl",
"GenTestCntl",
"ConfigCntl",
"ConfigChipId",
"ConfigStat0",
"ConfigStat1",
"ConfigStat2",
"DspConfig",
"DspOnOff",
"DpBkgdClr",
"DpChainMsk",
"DpFrgdClr",
"DpMix",
"DpPixWidth",
"DpSrc",
"DpWriteMsk",
"LcdIndex",
"LcdData",
};
static char* lcdname[Nlcd] = {
"LCD ConfigPanel",
"LCD GenCntl",
"LCD DstnCntl",
"LCD HfbPitchAddr",
"LCD HorzStretch",
"LCD VertStretch",
"LCD ExtVertStretch",
"LCD LtGio",
"LCD PowerMngmnt",
"LCD ZvgPio"
};
/*
* Crummy hack: all io register offsets
* here get IOREG or'ed in, so that we can
* tell the difference between an uninitialized
* array entry and HTotalDisp.
*/
enum {
IOREG = 0x10000,
};
static ushort ioregs[Nreg] = {
[HTotalDisp] IOREG|0x0000,
[HSyncStrtWid] IOREG|0x0100,
[VTotalDisp] IOREG|0x0200,
[VSyncStrtWid] IOREG|0x0300,
[VlineCrntVline] IOREG|0x0400,
[OffPitch] IOREG|0x0500,
[IntCntl] IOREG|0x0600,
[CrtcGenCntl] IOREG|0x0700,
[OvrClr] IOREG|0x0800,
[OvrWidLR] IOREG|0x0900,
[OvrWidTB] IOREG|0x0A00,
[CurClr0] IOREG|0x0B00,
[CurClr1] IOREG|0x0C00,
[CurOffset] IOREG|0x0D00,
[CurHVposn] IOREG|0x0E00,
[CurHVoff] IOREG|0x0F00,
[ScratchReg0] IOREG|0x1000,
[ScratchReg1] IOREG|0x1100,
[ClockCntl] IOREG|0x1200,
[BusCntl] IOREG|0x1300,
[MemCntl] IOREG|0x1400,
[MemVgaWpSel] IOREG|0x1500,
[MemVgaRpSel] IOREG|0x1600,
[DacRegs] IOREG|0x1700,
[DacCntl] IOREG|0x1800,
[GenTestCntl] IOREG|0x1900,
[ConfigCntl] IOREG|0x1A00,
[ConfigChipId] IOREG|0x1B00,
[ConfigStat0] IOREG|0x1C00,
[ConfigStat1] IOREG|0x1D00,
/* [GpIo] IOREG|0x1E00, */
/* [HTotalDisp] IOREG|0x1F00, duplicate, says XFree86 */
};
static ushort pciregs[Nreg] = {
[HTotalDisp] 0x00,
[HSyncStrtWid] 0x01,
[VTotalDisp] 0x02,
[VSyncStrtWid] 0x03,
[VlineCrntVline] 0x04,
[OffPitch] 0x05,
[IntCntl] 0x06,
[CrtcGenCntl] 0x07,
[DspConfig] 0x08,
[DspOnOff] 0x09,
[OvrClr] 0x10,
[OvrWidLR] 0x11,
[OvrWidTB] 0x12,
[CurClr0] 0x18,
[CurClr1] 0x19,
[CurOffset] 0x1A,
[CurHVposn] 0x1B,
[CurHVoff] 0x1C,
[ScratchReg0] 0x20,
[ScratchReg1] 0x21,
[ClockCntl] 0x24,
[BusCntl] 0x28,
[LcdIndex] 0x29,
[LcdData] 0x2A,
[ExtMemCntl] 0x2B,
[MemCntl] 0x2C,
[MemVgaWpSel] 0x2D,
[MemVgaRpSel] 0x2E,
[DacRegs] 0x30,
[DacCntl] 0x31,
[GenTestCntl] 0x34,
[ConfigCntl] 0x37,
[ConfigChipId] 0x38,
[ConfigStat0] 0x39,
[ConfigStat1] 0x25, /* rsc: was 0x3A, but that's not what the LT manual says */
[ConfigStat2] 0x26,
[DpBkgdClr] 0xB0,
[DpChainMsk] 0xB3,
[DpFrgdClr] 0xB1,
[DpMix] 0xB5,
[DpPixWidth] 0xB4,
[DpSrc] 0xB6,
[DpWriteMsk] 0xB2,
};
enum {
PLLm = 0x02,
PLLp = 0x06,
PLLn0 = 0x07,
PLLn1 = 0x08,
PLLn2 = 0x09,
PLLn3 = 0x0A,
PLLx = 0x0B, /* external divisor (Rage) */
Npll = 32,
Ntv = 1, /* actually 256, but not used */
};
typedef struct Mach64xx Mach64xx;
struct Mach64xx {
ulong io;
Pcidev* pci;
int bigmem;
int lcdon;
int lcdpanelid;
ulong reg[Nreg];
ulong lcd[Nlcd];
ulong tv[Ntv];
uchar pll[Npll];
ulong (*ior32)(Mach64xx*, int);
void (*iow32)(Mach64xx*, int, ulong);
};
static ulong
portior32(Mach64xx* mp, int r)
{
if((ioregs[r] & IOREG) == 0)
return ~0;
return inportl(((ioregs[r] & ~IOREG)<<2)+mp->io);
}
static void
portiow32(Mach64xx* mp, int r, ulong l)
{
if((ioregs[r] & IOREG) == 0)
return;
outportl(((ioregs[r] & ~IOREG)<<2)+mp->io, l);
}
static ulong
pciior32(Mach64xx* mp, int r)
{
return inportl((pciregs[r]<<2)+mp->io);
}
static void
pciiow32(Mach64xx* mp, int r, ulong l)
{
outportl((pciregs[r]<<2)+mp->io, l);
}
static uchar
pllr(Mach64xx* mp, int r)
{
int io;
if(mp->ior32 == portior32)
io = ((ioregs[ClockCntl]&~IOREG)<<2)+mp->io;
else
io = (pciregs[ClockCntl]<<2)+mp->io;
outportb(io+1, r<<2);
return inportb(io+2);
}
static void
pllw(Mach64xx* mp, int r, uchar b)
{
int io;
if(mp->ior32 == portior32)
io = ((ioregs[ClockCntl]&~IOREG)<<2)+mp->io;
else
io = (pciregs[ClockCntl]<<2)+mp->io;
outportb(io+1, (r<<2)|0x02);
outportb(io+2, b);
}
static ulong
lcdr32(Mach64xx *mp, ulong r)
{
ulong or;
or = mp->ior32(mp, LcdIndex);
mp->iow32(mp, LcdIndex, (or&~0x0F) | (r&0x0F));
return mp->ior32(mp, LcdData);
}
static void
lcdw32(Mach64xx *mp, ulong r, ulong v)
{
ulong or;
or = mp->ior32(mp, LcdIndex);
mp->iow32(mp, LcdIndex, (or&~0x0F) | (r&0x0F));
mp->iow32(mp, LcdData, v);
}
static ulong
tvr32(Mach64xx *mp, ulong r)
{
outportb(mp->io+(TvIndex<<2), r&0x0F);
return inportl(mp->io+(TvData<<2));
}
static void
tvw32(Mach64xx *mp, ulong r, ulong v)
{
outportb(mp->io+(TvIndex<<2), r&0x0F);
outportl(mp->io+(TvData<<2), v);
}
static int smallmem[] = {
512*1024, 1024*1024, 2*1024*1024, 4*1024*1024,
6*1024*1024, 8*1024*1024, 12*1024*1024, 16*1024*1024,
};
static int bigmem[] = {
512*1024, 2*512*1024, 3*512*1024, 4*512*1024,
5*512*1024, 6*512*1024, 7*512*1024, 8*512*1024,
5*1024*1024, 6*1024*1024, 7*1024*1024, 8*1024*1024,
10*1024*1024, 12*1024*1024, 14*1024*1024, 16*1024*1024,
};
static void
snarf(Vga* vga, Ctlr* ctlr)
{
Mach64xx *mp;
int i;
ulong v;
if(vga->private == nil){
vga->private = alloc(sizeof(Mach64xx));
mp = vga->private;
mp->io = 0x2EC;
mp->ior32 = portior32;
mp->iow32 = portiow32;
mp->pci = pcimatch(0, 0x1002, 0);
if (mp->pci) {
if(v = mp->pci->mem[1].bar & ~0x3) {
mp->io = v;
mp->ior32 = pciior32;
mp->iow32 = pciiow32;
}
}
}
mp = vga->private;
for(i = 0; i < Nreg; i++)
mp->reg[i] = mp->ior32(mp, i);
for(i = 0; i < Npll; i++)
mp->pll[i] = pllr(mp, i);
switch(mp->reg[ConfigChipId] & 0xFFFF){
default:
mp->lcdpanelid = 0;
break;
case ('L'<<8)|'B': /* 4C42: Rage LTPro AGP */
case ('L'<<8)|'I': /* 4C49: Rage 3D LTPro */
case ('L'<<8)|'M': /* 4C4D: Rage Mobility */
case ('L'<<8)|'P': /* 4C50: Rage 3D LTPro */
for(i = 0; i < Nlcd; i++)
mp->lcd[i] = lcdr32(mp, i);
if(mp->lcd[LCD_GenCtrl] & 0x02)
mp->lcdon = 1;
mp->lcdpanelid = ((mp->reg[ConfigStat2]>>14) & 0x1F);
break;
}
/*
* Check which memory size map we are using.
*/
mp->bigmem = 0;
switch(mp->reg[ConfigChipId] & 0xFFFF){
case ('G'<<8)|'B': /* 4742: 264GT PRO */
case ('G'<<8)|'D': /* 4744: 264GT PRO */
case ('G'<<8)|'I': /* 4749: 264GT PRO */
case ('G'<<8)|'M': /* 474D: Rage XL */
case ('G'<<8)|'P': /* 4750: 264GT PRO */
case ('G'<<8)|'Q': /* 4751: 264GT PRO */
case ('G'<<8)|'R': /* 4752: */
case ('G'<<8)|'U': /* 4755: 264GT DVD */
case ('G'<<8)|'V': /* 4756: Rage2C */
case ('G'<<8)|'Z': /* 475A: Rage2C */
case ('V'<<8)|'U': /* 5655: 264VT3 */
case ('V'<<8)|'V': /* 5656: 264VT4 */
case ('L'<<8)|'B': /* 4C42: Rage LTPro AGP */
case ('L'<<8)|'I': /* 4C49: Rage 3D LTPro */
case ('L'<<8)|'M': /* 4C4D: Rage Mobility */
case ('L'<<8)|'P': /* 4C50: Rage 3D LTPro */
mp->bigmem = 1;
break;
case ('G'<<8)|'T': /* 4754: 264GT[B] */
case ('V'<<8)|'T': /* 5654: 264VT/GT/VTB */
/*
* Only the VTB and GTB use the new memory encoding,
* and they are identified by a nonzero ChipVersion,
* apparently.
*/
if((mp->reg[ConfigChipId] >> 24) & 0x7)
mp->bigmem = 1;
break;
}
/*
* Memory size and aperture. It's recommended
* to use an 8Mb aperture on a 16Mb boundary.
*/
if(mp->bigmem)
vga->vmz = bigmem[mp->reg[MemCntl] & 0x0F];
else
vga->vmz = smallmem[mp->reg[MemCntl] & 0x07];
vga->vma = 16*1024*1024;
switch(mp->reg[ConfigCntl]&0x3){
case 0:
vga->apz = 16*1024*1024; /* empirical -rsc */
break;
case 1:
vga->apz = 4*1024*1024;
break;
case 2:
vga->apz = 8*1024*1024;
break;
case 3:
vga->apz = 2*1024*1024; /* empirical: mach64GX -rsc */
break;
}
ctlr->flag |= Fsnarf;
}
static void
options(Vga*, Ctlr* ctlr)
{
ctlr->flag |= Hlinear|Foptions;
}
static void
clock(Vga* vga, Ctlr* ctlr)
{
int clk, m, n, p;
double f, q;
Mach64xx *mp;
mp = vga->private;
/*
* Don't compute clock timings for LCD panels.
* Just use what's already there. We can't just use
* the frequency in the vgadb for this because
* the frequency being programmed into the PLLs
* is not the frequency being used to compute the DSP
* settings. The DSP-relevant frequency is the one
* we keep in /lib/vgadb.
*/
if(mp->lcdon){
clk = mp->reg[ClockCntl] & 0x03;
n = mp->pll[7+clk];
p = (mp->pll[6]>>(clk*2)) & 0x03;
p |= (mp->pll[11]>>(2+clk)) & 0x04;
switch(p){
case 0:
case 1:
case 2:
case 3:
p = 1<<p;
break;
case 4+0:
p = 3;
break;
case 4+2:
p = 6;
break;
case 4+3:
p = 12;
break;
default:
case 4+1:
p = -1;
break;
}
m = mp->pll[PLLm];
f = (2.0*RefFreq*n)/(m*p) + 0.5;
vga->m[0] = m;
vga->p[0] = p;
vga->n[0] = n;
vga->f[0] = f;
return;
}
if(vga->f[0] == 0)
vga->f[0] = vga->mode->frequency;
f = vga->f[0];
m = mp->pll[PLLm];
vga->m[0] = m;
q = (f*m)/(2*RefFreq);
if(ctlr->flag&Uenhanced){
if(q > 255 || q < 10.6666666667)
error("%s: vclk %lud out of range\n", ctlr->name, vga->f[0]);
if(q > 127.5)
p = 1;
else if(q > 85)
p = 2;
else if(q > 63.75)
p = 3;
else if(q > 42.5)
p = 4;
else if(q > 31.875)
p = 6;
else if(q > 21.25)
p = 8;
else
p = 12;
}else{
if(q > 255 || q < 16)
error("%s: vclk %lud out of range\n", ctlr->name, vga->f[0]);
if(q >= 127.5)
p = 1;
else if(q >= 63.5)
p = 2;
else if(q >= 31.5)
p = 4;
else
p = 8;
}
vga->p[0] = p;
/*
* The feedback divider should be kept in the range 0x80 to 0xFF
* and is found from
* n = q*p
* rounded to the nearest whole number.
*/
vga->n[0] = (q*p)+0.5;
}
typedef struct Meminfo Meminfo;
struct Meminfo {
int latency;
int latch;
int trp; /* filled in from card */
int trcd; /* filled in from card */
int tcrd; /* filled in from card */
int tras; /* filled in from card */
};
enum {
Mdram,
Medo,
Msdram,
Mwram,
};
/*
* The manuals and documentation are silent on which settings
* to use for Mwdram, or how to tell which to use.
*/
static Meminfo meminfo[] = {
[Mdram] { 1, 0 },
[Medo] { 1, 2 },
[Msdram] { 3, 1 },
[Mwram] { 1, 3 }, /* non TYPE_A */
};
static ushort looplatencytab[2][2] = {
{ 8, 6 },
{ 9, 8 },
};
static ushort cyclesperqwordtab[2][2] = {
{ 3, 2 },
{ 2, 1 },
};
static int memtype[] = {
-1, /* disable memory access */
Mdram, /* basic DRAM */
Medo, /* EDO */
Medo, /* hyper page DRAM or EDO */
Msdram, /* SDRAM */
Msdram, /* SGRAM */
Mwram,
Mwram
};
/*
* Calculate various memory parameters so that the card
* fetches the right bytes at the right time. I don't claim to
* understand the actual calculations very well.
*
* This is remarkably useful on laptops, since knowledge of
* x lets us find the frequency that the screen is really running
* at, which is not necessarily in the VCLKs.
*/
static void
setdsp(Vga* vga, Ctlr*)
{
Mach64xx *mp;
Meminfo *mem;
ushort table, memclk, memtyp;
int i, prec, xprec, fprec;
ulong t;
double pw, x, fifosz, fifoon, fifooff;
ushort dspon, dspoff;
int afifosz, lat, ncycle, pfc, rcc;
mp = vga->private;
/*
* Get video ram configuration from BIOS and chip
*/
table = *(ushort*)readbios(sizeof table, 0xc0048);
trace("rom table offset %uX\n", table);
table = *(ushort*)readbios(sizeof table, 0xc0000+table+16);
trace("freq table offset %uX\n", table);
memclk = *(ushort*)readbios(sizeof memclk, 0xc0000+table+18);
trace("memclk %ud\n", memclk);
memtyp = memtype[mp->reg[ConfigStat0]&07];
mem = &meminfo[memtyp];
/*
* First we need to calculate x, the number of
* XCLKs that one QWORD occupies in the display FIFO.
*
* For some reason, x gets stretched out if LCD stretching
* is turned on.
*/
x = ((double)memclk*640000.0) /
((double)vga->mode->frequency * (double)vga->mode->z);
if(mp->lcd[LCD_HorzStretch] & (1<<31))
x *= 4096.0 / (double)(mp->lcd[LCD_HorzStretch] & 0xFFFF);
trace("memclk %d... x %f...", memclk, x);
/*
* We have 14 bits to specify x in. Decide where to
* put the decimal (err, binary) point by counting how
* many significant bits are in the integer portion of x.
*/
t = x;
for(i=31; i>=0; i
if(t & (1<<i))
break;
xprec = i+1;
trace("t %lud... xprec %d...", t, xprec);
/*
* The maximum FIFO size is the number of XCLKs per QWORD
* multiplied by 32, for some reason. We have 11 bits to
* specify fifosz.
*/
fifosz = x * 32.0;
trace("fifosz %f...", fifosz);
t = fifosz;
for(i=31; i>=0; i
if(t & (1<<i))
break;
fprec = i+1;
trace("fprec %d...", fprec);
/*
* Precision is specified as 3 less than the number of bits
* in the integer part of x, and 5 less than the number of bits
* in the integer part of fifosz.
*
* It is bounded by zero and seven.
*/
prec = (xprec-3 > fprec-5) ? xprec-3 : fprec-5;
if(prec < 0)
prec = 0;
if(prec > 7)
prec = 7;
xprec = prec+3;
fprec = prec+5;
trace("prec %d...", prec);
/*
* Actual fifo size
*/
afifosz = (1<<fprec) / x;
if(afifosz > 32)
afifosz = 32;
fifooff = ceil(x*(afifosz-1));
/*
* I am suspicious of this table, lifted from ATI docs,
* because it doesn't agree with the Windows drivers.
* We always get 0x0A for lat+2 while Windows uses 0x08.
*/
lat = looplatencytab[memtyp > 1][vga->vmz > 1*1024*1024];
trace("afifosz %d...fifooff %f...", afifosz, fifooff);
/*
* Page fault clock
*/
t = mp->reg[MemCntl];
mem->trp = (t>>8)&3; /* RAS precharge time */
mem->trcd = (t>>10)&3; /* RAS to CAS delay */
mem->tcrd = (t>>12)&1; /* CAS to RAS delay */
mem->tras = (t>>16)&7; /* RAS low minimum pulse width */
pfc = mem->trp + 1 + mem->trcd + 1 + mem->tcrd;
trace("pfc %d...", pfc);
/*
* Maximum random access cycle clock.
*/
ncycle = cyclesperqwordtab[memtyp > 1][vga->vmz > 1*1024*1024];
rcc = mem->trp + 1 + mem->tras + 1;
if(rcc < pfc+ncycle)
rcc = pfc+ncycle;
trace("rcc %d...", rcc);
fifoon = (rcc > floor(x)) ? rcc : floor(x);
fifoon += (3.0 * rcc) - 1 + pfc + ncycle;
trace("fifoon %f...\n", fifoon);
/*
* Now finally put the bits together.
* x is stored in a 14 bit field with xprec bits of integer.
*/
pw = x * (1<<(14-xprec));
mp->reg[DspConfig] = (ulong)pw | (((lat+2)&0xF)<<16) | ((prec&7)<<20);
/*
* These are stored in an 11 bit field with fprec bits of integer.
*/
dspon = (ushort)fifoon << (11-fprec);
dspoff = (ushort)fifooff << (11-fprec);
mp->reg[DspOnOff] = ((dspon&0x7ff) << 16) | (dspoff&0x7ff);
}
static void
init(Vga* vga, Ctlr* ctlr)
{
Mode *mode;
Mach64xx *mp;
int p, x, y;
mode = vga->mode;
if((mode->x > 640 || mode->y > 480) && mode->z == 1)
error("%s: no support for 1-bit mode other than 640x480x1\n",
ctlr->name);
mp = vga->private;
if(mode->z > 8 && mp->pci == nil)
error("%s: no support for >8-bit color without PCI\n",
ctlr->name);
/*
* Check for Rage chip
*/
switch (mp->reg[ConfigChipId]&0xffff) {
case ('G'<<8)|'B': /* 4742: 264GT PRO */
case ('G'<<8)|'D': /* 4744: 264GT PRO */
case ('G'<<8)|'I': /* 4749: 264GT PRO */
case ('G'<<8)|'M': /* 474D: Rage XL */
case ('G'<<8)|'P': /* 4750: 264GT PRO */
case ('G'<<8)|'Q': /* 4751: 264GT PRO */
case ('G'<<8)|'R': /* 4752: */
case ('G'<<8)|'U': /* 4755: 264GT DVD */
case ('G'<<8)|'V': /* 4756: Rage2C */
case ('G'<<8)|'Z': /* 475A: Rage2C */
case ('V'<<8)|'U': /* 5655: 264VT3 */
case ('V'<<8)|'V': /* 5656: 264VT4 */
case ('G'<<8)|'T': /* 4754: 264GT[B] */
case ('V'<<8)|'T': /* 5654: 264VT/GT/VTB */
case ('L'<<8)|'B': /* 4C42: Rage LTPro AGP */
case ('L'<<8)|'I': /* 4C49: 264LT PRO */
case ('L'<<8)|'M': /* 4C4D: Rage Mobility */
case ('L'<<8)|'P': /* 4C50: 264LT PRO */
ctlr->flag |= Uenhanced;
break;
}
/*
* Always use VCLK2.
*/
clock(vga, ctlr);
mp->pll[PLLn2] = vga->n[0];
mp->pll[PLLp] &= ~(0x03<<(2*2));
switch(vga->p[0]){
case 1:
case 3:
p = 0;
break;
case 2:
p = 1;
break;
case 4:
case 6:
p = 2;
break;
case 8:
case 12:
p = 3;
break;
default:
p = 3;
break;
}
mp->pll[PLLp] |= p<<(2*2);
if ((1<<p) != vga->p[0])
mp->pll[PLLx] |= 1<<(4+2);
else
mp->pll[PLLx] &= ~(1<<(4+2));
mp->reg[ClockCntl] = 2;
mp->reg[ConfigCntl] = 0;
mp->reg[CrtcGenCntl] = 0x02000000|(mp->reg[CrtcGenCntl] & ~0x01400700);
switch(mode->z){
default:
case 1:
mp->reg[CrtcGenCntl] |= 0x00000100;
mp->reg[DpPixWidth] = 0x00000000;
break;
case 8:
mp->reg[CrtcGenCntl] |= 0x01000200;
mp->reg[DpPixWidth] = 0x00020202;
break;
case 15:
mp->reg[CrtcGenCntl] |= 0x01000300;
mp->reg[DpPixWidth] = 0x00030303;
break;
case 16:
mp->reg[CrtcGenCntl] |= 0x01000400;
mp->reg[DpPixWidth] = 0x00040404;
break;
case 24:
mp->reg[CrtcGenCntl] |= 0x01000500;
mp->reg[DpPixWidth] = 0x00050505;
break;
case 32:
mp->reg[CrtcGenCntl] |= 0x01000600;
mp->reg[DpPixWidth] = 0x00060606;
break;
}
mp->reg[HTotalDisp] = (((mode->x>>3)-1)<<16)|((mode->ht>>3)-1);
mp->reg[HSyncStrtWid] = (((mode->ehs - mode->shs)>>3)<<16)
|((mode->shs>>3)-1);
if(mode->hsync == '-')
mp->reg[HSyncStrtWid] |= 0x00200000;
mp->reg[VTotalDisp] = ((mode->y-1)<<16)|(mode->vt-1);
mp->reg[VSyncStrtWid] = ((mode->vre - mode->vrs)<<16)|(mode->vrs-1);
if(mode->vsync == '-')
mp->reg[VSyncStrtWid] |= 0x00200000;
mp->reg[IntCntl] = 0;
/*
* This used to set it to (mode->x/(8*2))<<22 for depths < 8,
* but from the manual that seems wrong to me. -rsc
*/
mp->reg[OffPitch] = (vga->virtx/8)<<22;
mp->reg[OvrClr] = Pblack;
if(vga->linear && mode->z != 1)
ctlr->flag |= Ulinear;
/*
* Heuristic fiddling on LT PRO.
* Do this before setdsp so the stretching is right.
*/
if(mp->lcdon){
/* use non-shadowed registers */
mp->lcd[LCD_GenCtrl] &= ~0x00000404;
mp->lcd[LCD_ConfigPanel] |= 0x00004000;
mp->lcd[LCD_VertStretch] = 0;
y = ((mp->lcd[LCD_ExtVertStretch]>>11) & 0x7FF)+1;
if(mode->y < y){
x = (mode->y*1024)/y;
mp->lcd[LCD_VertStretch] = 0xC0000000|x;
}
mp->lcd[LCD_ExtVertStretch] &= ~0x00400400;
/*
* The x value doesn't seem to be available on all
* chips so intuit it from the y value which seems to
* be reliable.
*/
mp->lcd[LCD_HorzStretch] &= ~0xC00000FF;
x = (mp->lcd[LCD_HorzStretch]>>20) & 0xFF;
if(x == 0){
switch(y){
default:
break;
case 480:
x = 640;
break;
case 600:
x = 800;
break;
case 768:
x = 1024;
break;
case 1024:
x = 1280;
break;
}
}
else
x = (x+1)*8;
if(mode->x < x){
x = (mode->x*4096)/x;
mp->lcd[LCD_HorzStretch] |= 0xC0000000|x;
}
}
if(ctlr->flag&Uenhanced)
setdsp(vga, ctlr);
ctlr->flag |= Finit;
}
static void
load(Vga* vga, Ctlr* ctlr)
{
Mach64xx *mp;
int i;
mp = vga->private;
/*
* Unlock the CRTC and LCD registers.
*/
mp->iow32(mp, CrtcGenCntl, mp->ior32(mp, CrtcGenCntl)&~0x00400000);
if(mp->lcdon)
lcdw32(mp, LCD_GenCtrl, mp->lcd[LCD_GenCtrl]|0x80000000);
/*
* Always use an aperture on a 16Mb boundary.
*/
if(ctlr->flag & Ulinear)
mp->reg[ConfigCntl] = ((vga->vmb/(4*1024*1024))<<4)|0x02;
mp->iow32(mp, ConfigCntl, mp->reg[ConfigCntl]);
mp->iow32(mp, GenTestCntl, 0);
mp->iow32(mp, GenTestCntl, 0x100);
if((ctlr->flag&Uenhanced) == 0)
mp->iow32(mp, MemCntl, mp->reg[MemCntl] & ~0x70000);
mp->iow32(mp, BusCntl, mp->reg[BusCntl]);
mp->iow32(mp, HTotalDisp, mp->reg[HTotalDisp]);
mp->iow32(mp, HSyncStrtWid, mp->reg[HSyncStrtWid]);
mp->iow32(mp, VTotalDisp, mp->reg[VTotalDisp]);
mp->iow32(mp, VSyncStrtWid, mp->reg[VSyncStrtWid]);
mp->iow32(mp, IntCntl, mp->reg[IntCntl]);
mp->iow32(mp, OffPitch, mp->reg[OffPitch]);
if(mp->lcdon){
for(i=0; i<Nlcd; i++)
lcdw32(mp, i, mp->lcd[i]);
}
mp->iow32(mp, GenTestCntl, mp->reg[GenTestCntl]);
mp->iow32(mp, ConfigCntl, mp->reg[ConfigCntl]);
mp->iow32(mp, CrtcGenCntl, mp->reg[CrtcGenCntl]);
mp->iow32(mp, OvrClr, mp->reg[OvrClr]);
mp->iow32(mp, OvrWidLR, mp->reg[OvrWidLR]);
mp->iow32(mp, OvrWidTB, mp->reg[OvrWidTB]);
if(ctlr->flag&Uenhanced){
mp->iow32(mp, DacRegs, mp->reg[DacRegs]);
mp->iow32(mp, DacCntl, mp->reg[DacCntl]);
mp->iow32(mp, CrtcGenCntl, mp->reg[CrtcGenCntl]&~0x02000000);
mp->iow32(mp, DspOnOff, mp->reg[DspOnOff]);
mp->iow32(mp, DspConfig, mp->reg[DspConfig]);
mp->iow32(mp, CrtcGenCntl, mp->reg[CrtcGenCntl]);
pllw(mp, PLLx, mp->pll[PLLx]);
}
pllw(mp, PLLn2, mp->pll[PLLn2]);
pllw(mp, PLLp, mp->pll[PLLp]);
pllw(mp, PLLn3, mp->pll[PLLn3]);
mp->iow32(mp, ClockCntl, mp->reg[ClockCntl]);
mp->iow32(mp, ClockCntl, 0x40|mp->reg[ClockCntl]);
mp->iow32(mp, DpPixWidth, mp->reg[DpPixWidth]);
if(vga->mode->z > 8){
int sh, i;
/*
* We need to initialize the palette, since the DACs use it
* in true color modes. First see if the card supports an
* 8-bit DAC.
*/
mp->iow32(mp, DacCntl, mp->reg[DacCntl] | 0x100);
if(mp->ior32(mp, DacCntl)&0x100){
/* card appears to support it */
vgactlw("palettedepth", "8");
mp->reg[DacCntl] |= 0x100;
}
if(mp->reg[DacCntl] & 0x100)
sh = 0; /* 8-bit DAC */
else
sh = 2; /* 6-bit DAC */
for(i=0; i<256; i++)
setpalette(i, i>>sh, i>>sh, i>>sh);
}
ctlr->flag |= Fload;
}
static void
pixelclock(Vga* vga, Ctlr* ctlr)
{
Mach64xx *mp;
ushort table, s;
int memclk, ref_freq, ref_divider, min_freq, max_freq;
int feedback, nmult, pd, post, value;
int clock;
/*
* Find the pixel clock from the BIOS and current
* settings. Lifted from the ATI-supplied example code.
* The clocks stored in the BIOS table are in kHz/10.
*
* This is the clock LCDs use in vgadb to set the DSP
* values.
*/
mp = vga->private;
/*
* GetPLLInfo()
*/
table = *(ushort*)readbios(sizeof table, 0xc0048);
trace("rom table offset %uX\n", table);
table = *(ushort*)readbios(sizeof table, 0xc0000+table+16);
trace("freq table offset %uX\n", table);
s = *(ushort*)readbios(sizeof s, 0xc0000+table+18);
memclk = s*10000;
trace("memclk %ud\n", memclk);
s = *(ushort*)readbios(sizeof s, 0xc0000+table+8);
ref_freq = s*10000;
trace("ref_freq %ud\n", ref_freq);
s = *(ushort*)readbios(sizeof s, 0xc0000+table+10);
ref_divider = s;
trace("ref_divider %ud\n", ref_divider);
s = *(ushort*)readbios(sizeof s, 0xc0000+table+2);
min_freq = s*10000;
trace("min_freq %ud\n", min_freq);
s = *(ushort*)readbios(sizeof s, 0xc0000+table+4);
max_freq = s*10000;
trace("max_freq %ud\n", max_freq);
/*
* GetDivider()
*/
pd = mp->pll[PLLp] & 0x03;
value = (mp->pll[PLLx] & 0x10)>>2;
trace("pd %uX value %uX (|%d)\n", pd, value, value|pd);
value |= pd;
post = 0;
switch(value){
case 0:
post = 1;
break;
case 1:
post = 2;
break;
case 2:
post = 4;
break;
case 3:
post = 8;
break;
case 4:
post = 3;
break;
case 5:
post = 0;
break;
case 6:
post = 6;
break;
case 7:
post = 12;
break;
}
trace("post = %d\n", post);
feedback = mp->pll[PLLn0];
if(mp->pll[PLLx] & 0x08)
nmult = 4;
else
nmult = 2;
clock = (ref_freq/10000)*nmult*feedback;
clock /= ref_divider*post;
clock *= 10000;
Bprint(&stdout, "%s pixel clock = %ud\n", ctlr->name, clock);
}
static void dumpmach64bios(Mach64xx*);
static void
dump(Vga* vga, Ctlr* ctlr)
{
Mach64xx *mp;
int i, m, n, p;
double f;
static int first = 1;
if((mp = vga->private) == 0)
return;
Bprint(&stdout, "%s pci %p io %lux %s\n", ctlr->name,
mp->pci, mp->io, mp->ior32 == pciior32 ? "pciregs" : "ioregs");
if(mp->pci)
Bprint(&stdout, "%s ccru %ux\n", ctlr->name, mp->pci->ccru);
for(i = 0; i < Nreg; i++)
Bprint(&stdout, "%s %-*s%.8luX\n",
ctlr->name, 20, iorname[i], mp->reg[i]);
printitem(ctlr->name, "PLL");
for(i = 0; i < Npll; i++)
printreg(mp->pll[i]);
Bprint(&stdout, "\n");
switch(mp->reg[ConfigChipId] & 0xFFFF){
default:
break;
case ('L'<<8)|'B': /* 4C42: Rage LTPro AGP */
case ('L'<<8)|'I': /* 4C49: Rage 3D LTPro */
case ('L'<<8)|'M': /* 4C4D: Rage Mobility */
case ('L'<<8)|'P': /* 4C50: Rage 3D LTPro */
for(i = 0; i < Nlcd; i++)
Bprint(&stdout, "%s %-*s%.8luX\n",
ctlr->name, 20, lcdname[i], mp->lcd[i]);
break;
}
m = mp->pll[2];
for(i = 0; i < 4; i++){
n = mp->pll[7+i];
p = (mp->pll[6]>>(i*2)) & 0x03;
p |= (mp->pll[11]>>(2+i)) & 0x04;
switch(p){
case 0:
case 1:
case 2:
case 3:
p = 1<<p;
break;
case 4+0:
p = 3;
break;
case 4+2:
p = 6;
break;
case 4+3:
p = 12;
break;
default:
case 4+1:
p = -1;
break;
}
if(m*p == 0)
Bprint(&stdout, "unknown VCLK%d\n", i);
else {
f = (2.0*RefFreq*n)/(m*p) + 0.5;
Bprint(&stdout, "%s VCLK%d\t%ud\n", ctlr->name, i, (int)f);
}
}
pixelclock(vga, ctlr);
if(first) {
first = 0;
dumpmach64bios(mp);
}
}
enum {
ClockFixed=0,
ClockIcs2595,
ClockStg1703,
ClockCh8398,
ClockInternal,
ClockAtt20c408,
ClockIbmrgb514
};
/*
* mostly derived from the xfree86 probe routines.
*/
static void
dumpmach64bios(Mach64xx *mp)
{
int i, romtable, clocktable, freqtable, lcdtable, lcdpanel;
uchar bios[0x10000];
memmove(bios, readbios(sizeof bios, 0xC0000), sizeof bios);
/* find magic string */
for(i=0; i<1024; i++)
if(strncmp((char*)bios+i, " 761295520", 10) == 0)
break;
if(i==1024) {
Bprint(&stdout, "no ATI bios found\n");
return;
}
/* this is horribly endian dependent. sorry. */
romtable = *(ushort*)(bios+0x48);
if(romtable+0x12 > sizeof(bios)) {
Bprint(&stdout, "couldn't find ATI rom table\n");
return;
}
clocktable = *(ushort*)(bios+romtable+0x10);
if(clocktable+0x0C > sizeof(bios)) {
Bprint(&stdout, "couldn't find ATI clock table\n");
return;
}
freqtable = *(ushort*)(bios+clocktable-2);
if(freqtable+0x20 > sizeof(bios)) {
Bprint(&stdout, "couldn't find ATI frequency table\n");
return;
}
Bprint(&stdout, "ATI BIOS rom 0x%x freq 0x%x clock 0x%x\n", romtable, freqtable, clocktable);
Bprint(&stdout, "clocks:");
for(i=0; i<16; i++)
Bprint(&stdout, " %d", *(ushort*)(bios+freqtable+2*i));
Bprint(&stdout, "\n");
Bprint(&stdout, "programmable clock: %d\n", bios[clocktable]);
Bprint(&stdout, "clock to program: %d\n", bios[clocktable+6]);
if(*(ushort*)(bios+clocktable+8) != 1430) {
Bprint(&stdout, "reference numerator: %d\n", *(ushort*)(bios+clocktable+8)*10);
Bprint(&stdout, "reference denominator: 1\n");
} else {
Bprint(&stdout, "default reference numerator: 157500\n");
Bprint(&stdout, "default reference denominator: 11\n");
}
switch(bios[clocktable]) {
case ClockIcs2595:
Bprint(&stdout, "ics2595\n");
Bprint(&stdout, "reference divider: %d\n", *(ushort*)(bios+clocktable+0x0A));
break;
case ClockStg1703:
Bprint(&stdout, "stg1703\n");
break;
case ClockCh8398:
Bprint(&stdout, "ch8398\n");
break;
case ClockInternal:
Bprint(&stdout, "internal clock\n");
Bprint(&stdout, "reference divider in plls\n");
break;
case ClockAtt20c408:
Bprint(&stdout, "att 20c408\n");
break;
case ClockIbmrgb514:
Bprint(&stdout, "ibm rgb514\n");
Bprint(&stdout, "clock to program = 7\n");
break;
default:
Bprint(&stdout, "unknown clock\n");
break;
}
USED(mp);
if(1 || mp->lcdpanelid) {
lcdtable = *(ushort*)(bios+0x78);
if(lcdtable+5 > sizeof bios || lcdtable+bios[lcdtable+5] > sizeof bios) {
Bprint(&stdout, "can't find lcd bios table\n");
goto NoLcd;
}
lcdpanel = *(ushort*)(bios+lcdtable+0x0A);
if(lcdpanel+0x1D > sizeof bios /*|| bios[lcdpanel] != mp->lcdpanelid*/) {
Bprint(&stdout, "can't find lcd bios table0\n");
goto NoLcd;
}
Bprint(&stdout, "panelid %d x %d y %d\n", bios[lcdpanel], *(ushort*)(bios+lcdpanel+0x19), *(ushort*)(bios+lcdpanel+0x1B));
}
NoLcd:;
}
Ctlr mach64xx = {
"mach64xx", /* name */
snarf, /* snarf */
0, /* options */
init, /* init */
load, /* load */
dump, /* dump */
};
Ctlr mach64xxhwgc = {
"mach64xxhwgc", /* name */
0, /* snarf */
0, /* options */
0, /* init */
0, /* load */
0, /* dump */
};
|
(function($) {
jQuery.fn.upstate = function () {
if ( typeof regions === 'undefined' ) return;
$(this).change(function (e,init) {
var $this = $(this),
prefix = $this.attr('id').split('-')[0],
country = $this.val(),
state = $this.parents().find('#' + prefix + '-state'),
menu = $this.parents().find('#' + prefix + '-state-menu'),
options = '<option value=""></option>';
if (menu.length == 0) return true;
if (menu.hasClass('hidden')) menu.removeClass('hidden').hide();
if (regions[country] || (init && menu.find('option').length > 1)) {
state.setDisabled(true).addClass('_important').hide();
if (regions[country]) {
$.each(regions[country], function (value,label) {
options += '<option value="'+value+'">'+label+'</option>';
});
if (!init) menu.empty().append(options).setDisabled(false).show().focus();
if (menu.hasClass('auto-required')) menu.addClass('required');
} else {
if (menu.hasClass('auto-required')) menu.removeClass('required');
}
menu.setDisabled(false).show();
$('label[for='+state.attr('id')+']').attr('for',menu.attr('id'));
} else {
menu.empty().setDisabled(true).hide();
state.setDisabled(false).show().removeClass('_important');
$('label[for='+menu.attr('id')+']').attr('for',state.attr('id'));
if (!init) state.val('').focus();
}
}).trigger('change',[true]);
return $(this);
};
})(jQuery);
jQuery(document).ready(function($) {
var sameaddr = $('.sameaddress'),
shipFields = $('#<API key>'),
billFields = $('#<API key>'),
keepLastValue = function () { // Save the current value of the field
$(this).attr('data-last', $(this).val());
};
// Handle changes to the firstname and lastname fields
$('#firstname,#lastname').each(keepLastValue).change(function () {
var namefield = $(this); // Reference to the modified field
lastfirstname = $('#firstname').attr('data-last'),
lastlastname = $('#lastname').attr('data-last'),
firstlast = ( ( $('#firstname').val() ).trim() + " " + ( $('#lastname').val() ).trim() ).trim();
namefield.val( (namefield.val()).trim() );
// Update the billing name and shipping name
$('#billing-name,#shipping-name').each(function() {
var value = $(this).val();
if ( value.trim().length == 0 ) {
// Empty billing or shipping name
$('#billing-name,#shipping-name').val(firstlast);
} else if ( '' != value && ( $('#firstname').val() == value || $('#lastname').val() == value ) ) {
// Only one name entered (so far), add the other name
$(this).val(firstlast);
} else if ( 'firstname' == namefield.attr('id') && value.indexOf(lastlastname) != -1 ) {
// firstname changed & last lastname matched
$(this).val( value.replace(lastfirstname, namefield.val()).trim() );
} else if ( 'lastname' == namefield.attr('id') && value.indexOf(lastfirstname) != -1 ) {
// lastname changed & last firstname matched
$(this).val( value.replace(lastlastname, namefield.val()).trim() );
}
});
}).change(keepLastValue);
// Update state/province
$('#billing-country,#shipping-country').upstate();
// Toggle same shipping address
sameaddr.change(function (e,init) {
var refocus = false,
bc = $('#billing-country'),
sc = $('#shipping-country'),
prime = 'billing' == sameaddr.val() ? shipFields : billFields,
alt = 'shipping' == sameaddr.val() ? shipFields : billFields;
if (sameaddr.is(':checked')) {
prime.removeClass('half');
alt.hide().find('.required').setDisabled(true);
} else {
prime.addClass('half');
alt.show().find('.disabled:not(._important)').setDisabled(false);
if (!init) refocus = true;
}
if (bc.is(':visible')) bc.trigger('change.localemenu',[init]);
if (sc.is(':visible')) sc.trigger('change.localemenu',[init]);
if (refocus) alt.find('input:first').focus();
}).trigger('change',[true])
.click(function () { $(this).change(); }); // For IE compatibility
});
|
#include <stdlib.h>
#include <stdio.h>
#include <mikmod.h>
#if !defined _WIN32 && !defined _WIN64
#include <unistd.h> /* for usleep() */
#define MikMod_Sleep(ns) usleep(ns)
#else
#define MikMod_Sleep(ns) Sleep(ns / 1000)
#endif
SAMPLE *Load(const char *fn)
{
char *data_buf;
long data_len;
FILE *fptr;
/* open the file */
fptr = fopen(fn, "rb");
if (fptr == NULL) {
perror("fopen");
return 0;
}
/* calculate the file size */
fseek(fptr, 0, SEEK_END);
data_len = ftell(fptr);
fseek(fptr, 0, SEEK_SET);
/* allocate a buffer and load the file into it */
data_buf = (char *) malloc(data_len);
if (data_buf == NULL) {
perror("malloc");
fclose(fptr);
return 0;
}
if (fread(data_buf, data_len, 1, fptr) != 1) {
perror("fread");
fclose(fptr);
free(data_buf);
return 0;
}
fclose(fptr);
return Sample_LoadMem(data_buf, data_len);
}
int main(void)
{
/* sound effects */
SAMPLE *sfx1, *sfx2;
/* voices */
int v1, v2;
int i;
/* register all the drivers */
<API key>();
/* initialize the library */
md_mode |= DMODE_SOFT_SNDFX;
if (MikMod_Init("")) {
fprintf(stderr, "Could not initialize sound, reason: %s\n",
MikMod_strerror(MikMod_errno));
return 1;
}
/* load samples */
sfx1 = Load("first.wav");
if (!sfx1) {
MikMod_Exit();
fprintf(stderr, "Could not load the first sound, reason: %s\n",
MikMod_strerror(MikMod_errno));
return 1;
}
sfx2 = Load("second.wav");
if (!sfx2) {
Sample_Free(sfx1);
MikMod_Exit();
fprintf(stderr, "Could not load the second sound, reason: %s\n",
MikMod_strerror(MikMod_errno));
return 1;
}
/* reserve 2 voices for sound effects */
MikMod_SetNumVoices(-1, 2);
/* get ready to play */
MikMod_EnableOutput();
/* play first sample */
v1 = Sample_Play(sfx1, 0, 0);
do {
MikMod_Update();
MikMod_Sleep(100000);
} while (!Voice_Stopped(v1));
for (i = 0; i < 10; i++) {
MikMod_Update();
MikMod_Sleep(100000);
}
/* half a second later, play second sample */
v2 = Sample_Play(sfx2, 0, 0);
do {
MikMod_Update();
MikMod_Sleep(100000);
} while (!Voice_Stopped(v2));
for (i = 0; i < 10; i++) {
MikMod_Update();
MikMod_Sleep(100000);
}
<API key>();
Sample_Free(sfx2);
Sample_Free(sfx1);
MikMod_Exit();
return 0;
}
|
/* Include your headers here*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/i2c.h>
/*
#include <linux/i2c-id.h>
*/
#include <linux/init.h>
#include <linux/time.h>
#include <linux/sched.h>
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/interrupt.h>
#include <mach/hardware.h>
#include <asm/irq.h>
#include <mach/irqs.h>
#include <mach/wmt-i2c-bus.h>
#include <linux/slab.h>
#include <linux/pm.h>
#include <linux/syscore_ops.h>
#ifdef __KERNEL__
#ifdef DEBUG
#define DPRINTK printk
#else
#define DPRINTK(x...)
#endif
#else
#define DPRINTK printf
#endif
#define MAX_BUS_READY_CNT 50 /* jiffy*/
#define MAX_TX_TIMEOUT 500
#define MAX_RX_TIMEOUT 500
#define CTRL_GPIO <API key>
#define PU_EN_GPIO <API key>
#define PU_CTRL_GPIO <API key>
#define USE_UBOOT_PARA
struct wmt_i2c_s {
struct i2c_regs_s *regs;
int irq_no ;
enum i2c_mode_e i2c_mode ;
int volatile isr_nack ;
int volatile isr_byte_end ;
int volatile isr_timeout ;
int volatile isr_int_pending ;
};
static int <API key>(void);
extern int wmt_getsyspara(char *varname, unsigned char *varval, int *varlen);
static unsigned int speed_mode = 1;
static unsigned int is_master = 1;/*master:1, slave:0*/
unsigned int wmt_i2c3_is_master = 1;
unsigned int wmt_i2c3_speed_mode = 0;
static unsigned int <API key> = 0;/*0:power on, 1:suspend, 2:shutdown*/
EXPORT_SYMBOL(wmt_i2c3_is_master);
/* variable*/
static volatile struct wmt_i2c_s i2c ;
<API key>(i2c3_wait);
/*
spinlock_t i2c3_wmt_irqlock = SPIN_LOCK_UNLOCKED;
*/
static DEFINE_SPINLOCK(i2c3_wmt_irqlock);
static struct list_head wmt_i2c_fifohead;
/*
static spinlock_t i2c_fifolock = SPIN_LOCK_UNLOCKED;
*/
static DEFINE_SPINLOCK(i2c_fifolock);
static int i2c_wmt_read_buf(
unsigned int slave_addr,
char *buf,
unsigned int length,
int restart,
int last
);
static int i2c_wmt_write_buf(
unsigned int slave_addr,
char *buf,
unsigned int length,
int restart,
int last
);
static void i2c_wmt_set_mode(enum i2c_mode_e mode /*!<; //[IN] mode */)
{
if (is_master == 0)
return;
i2c.i2c_mode = mode ;
if (i2c.i2c_mode == I2C_STANDARD_MODE) {
DPRINTK("I2C: set standard mode \n");
i2c.regs->tr_reg = I2C_TR_STD_VALUE ; /* 0x8041*/
} else if (i2c.i2c_mode == I2C_FAST_MODE) {
DPRINTK("I2C: set fast mode \n");
i2c.regs->tr_reg = I2C_TR_FAST_VALUE ; /* 0x8011*/
}
}
static int i2c_send_request(
struct i2c_msg *msg,
int msg_num,
int non_block,
void (*callback)(void *data),
void *data
)
{
struct wmt_i2cbusfifo *i2c_fifo_head;
struct i2c_msg *pmsg = NULL;
int ret = 0;
int restart = 0;
int last = 0;
unsigned long flags;
int slave_addr = msg[0].addr;
if (slave_addr == <API key>)
return ret ;
if (<API key> == 2) {
printk("I2C3 has been shutdown\n");
return -EIO;
}
i2c.isr_nack = 0 ;
i2c.isr_byte_end = 0 ;
i2c.isr_timeout = 0 ;
i2c.isr_int_pending = 0;
i2c_fifo_head = kzalloc(sizeof(struct wmt_i2cbusfifo), GFP_ATOMIC);
INIT_LIST_HEAD(&i2c_fifo_head->busfifohead);
pmsg = &msg[0];
i2c_fifo_head->msg = pmsg;
i2c_fifo_head->msg_num = msg_num;
spin_lock_irqsave(&i2c_fifolock, flags);
if (list_empty(&wmt_i2c_fifohead)) {
<API key>();
pmsg = &msg[0];
i2c_fifo_head->xfer_length = 1;
i2c_fifo_head->xfer_msgnum = 0;
i2c_fifo_head->restart = 0;
i2c_fifo_head->non_block = non_block;
if (non_block == 1) {
i2c_fifo_head->callback = callback;
i2c_fifo_head->data = data;
} else {
i2c_fifo_head->callback = 0;
i2c_fifo_head->data = 0;
}
list_add_tail(&i2c_fifo_head->busfifohead, &wmt_i2c_fifohead);
if (pmsg->flags & I2C_M_RD) {
i2c_fifo_head->xfer_length = 1;
ret = i2c_wmt_read_buf(pmsg->addr, pmsg->buf, pmsg->len, restart, last);
} else {
i2c_fifo_head->xfer_length = 1;
if (pmsg->flags & I2C_M_NOSTART)
i2c_fifo_head->restart = 1;
else
i2c_fifo_head->restart = 0;
ret = i2c_wmt_write_buf(pmsg->addr, pmsg->buf, pmsg->len, restart, last);
}
} else {
i2c_fifo_head->xfer_length = 0;
i2c_fifo_head->xfer_msgnum = 0;
i2c_fifo_head->restart = 0;
i2c_fifo_head->non_block = non_block;
if (non_block == 1) {
i2c_fifo_head->callback = callback;
i2c_fifo_head->data = data;
} else {
i2c_fifo_head->callback = 0;
i2c_fifo_head->data = 0;
}
list_add_tail(&i2c_fifo_head->busfifohead, &wmt_i2c_fifohead);
}
<API key>(&i2c_fifolock, flags);
if (non_block == 0) {
wait_event(i2c3_wait, i2c.isr_int_pending);
ret = msg_num;
if (i2c.isr_nack == 1) {
DPRINTK("i2c_err : write NACK error (rx) \n\r") ;
ret = -EIO ;
}
if (i2c.isr_timeout == 1) {
DPRINTK("i2c_err : write SCL timeout error (rx)\n\r") ;
ret = -ETIMEDOUT ;
}
}
return ret;
}
static int i2c_wmt_read_buf(
unsigned int slave_addr,
char *buf,
unsigned int length,
int restart,
int last
)
{
unsigned short tcr_value;
int ret = 0;
DPRINTK("[%s]:length = %d , slave_addr = %x\n", __func__, length , slave_addr);
if (length <=0)
return -1;
i2c.isr_nack = 0 ;
i2c.isr_byte_end = 0 ;
i2c.isr_timeout = 0 ;
/*i2c.isr_int_pending = 0;*/
i2c.regs->cr_reg &= ~(I2C_CR_TX_END); /*clear Tx end*/
i2c.regs->cr_reg &= ~(<API key>); /*clear NEXT_NO_ACK*/
if (length <=0)
return -1;
i2c.isr_nack = 0 ;
i2c.isr_byte_end = 0 ;
i2c.isr_timeout = 0 ;
/*i2c.isr_int_pending = 0;*/
tcr_value = 0 ;
if (i2c.i2c_mode == I2C_STANDARD_MODE)
tcr_value = (unsigned short)(<API key>|I2C_TCR_MASTER_READ |\
(slave_addr & <API key>)) ;
else if (i2c.i2c_mode == I2C_FAST_MODE)
tcr_value = (unsigned short)(I2C_TCR_FAST_MODE|I2C_TCR_MASTER_READ |\
(slave_addr & <API key>)) ;
if (length == 1)
i2c.regs->cr_reg |= <API key>; /*only 8-bit to read*/
i2c.regs->tcr_reg = tcr_value ;
return ret;
}
static int i2c_wmt_write_buf(
unsigned int slave_addr,
char *buf,
unsigned int length,
int restart,
int last
)
{
unsigned short tcr_value ;
unsigned int xfer_length ;
int ret = 0 ;
DPRINTK("[%s]length = %d , slave_addr = %x\n", __func__, length , slave_addr);
if (slave_addr == <API key>)
return ret ;
if (is_master == 0)
return -ENXIO;
/* special case allow length:0, for i2c_smbus_xfer*/
if (length < 0)
return -1 ;
xfer_length = 0 ; /* for array index and also for checking counting*/
i2c.isr_nack = 0 ;
i2c.isr_byte_end = 0 ;
i2c.isr_timeout = 0 ;
/*i2c.isr_int_pending = 0;*/
i2c.regs->cr_reg &= ~(I2C_CR_TX_END); /*clear Tx end*/
i2c.regs->cr_reg &= ~(<API key>); /*clear NEXT_NO_ACK*/
if (length == 0)
i2c.regs->cdr_reg = 0 ;
else
i2c.regs->cdr_reg = (unsigned short)(buf[xfer_length] & <API key>) ;
tcr_value = 0 ;
if (i2c.i2c_mode == I2C_STANDARD_MODE)
tcr_value = (unsigned short)(<API key>|<API key> |\
(slave_addr & <API key>)) ;
else if (i2c.i2c_mode == I2C_FAST_MODE)
tcr_value = (unsigned short)(I2C_TCR_FAST_MODE|<API key> |\
(slave_addr & <API key>)) ;
i2c.regs->tcr_reg = tcr_value ;
ret = 0 ;
return ret;
}
static int i2c_wmt_read_msg(
unsigned int slave_addr, /*!<; //[IN] Salve address */
char *buf, /*!<; //[OUT] Pointer to data */
unsigned int length, /*!<; //Data length */
int restart, /*!<; //Need to restart after a complete read */
int last /*!<; //Last read */
)
{
unsigned short tcr_value ;
unsigned int xfer_length ;
int is_timeout ;
int ret = 0 ;
int wait_event_result = 0 ;
if (is_master == 0)
return -ENXIO;
if (length <= 0)
return -1 ;
xfer_length = 0 ;
if (restart == 0)
ret = <API key>() ;
if (ret < 0)
return ret ;
i2c.isr_nack = 0 ;
i2c.isr_byte_end = 0 ;
i2c.isr_timeout = 0 ;
i2c.isr_int_pending = 0;
i2c.regs->cr_reg &= ~(I2C_CR_TX_END); /*clear Tx end*/
i2c.regs->cr_reg &= ~(<API key>); /*clear NEXT_NO_ACK*/
if (restart == 0)
i2c.regs->cr_reg |= (I2C_CR_CPU_RDY); /*release SCL*/
tcr_value = 0 ;
if (i2c.i2c_mode == I2C_STANDARD_MODE) {
tcr_value = (unsigned short)(<API key>|I2C_TCR_MASTER_READ |\
(slave_addr & <API key>)) ;
} else if (i2c.i2c_mode == I2C_FAST_MODE) {
tcr_value = (unsigned short)(I2C_TCR_FAST_MODE|I2C_TCR_MASTER_READ |\
(slave_addr & <API key>)) ;
}
if (length == 1)
i2c.regs->cr_reg |= <API key>; /*only 8-bit to read*/
i2c.regs->tcr_reg = tcr_value ;
/*repeat start case*/
if (restart == 1)
i2c.regs->cr_reg |= (I2C_CR_CPU_RDY); /*release SCL*/
ret = 0 ;
for (; ;) {
is_timeout = 0 ;
wait_event_result = <API key>(i2c3_wait, i2c.isr_int_pending ,
(MAX_RX_TIMEOUT * HZ / 1000)) ;
if (likely(wait_event_result > 0)) {
DPRINTK("I2C: wait interrupted (rx) \n");
ret = 0 ;
} else if (likely(i2c.isr_int_pending == 0)) {
DPRINTK("I2C: wait timeout (rx) \n");
is_timeout = 1 ;
ret = -ETIMEDOUT ;
}
/* fail case*/
if (i2c.isr_nack == 1) {
DPRINTK("i2c_err : write NACK error (rx) \n\r") ;
ret = -EIO ;
break ;
}
if (i2c.isr_timeout == 1) {
DPRINTK("i2c_err : write SCL timeout error (rx)\n\r") ;
msleep(10);
ret = -ETIMEDOUT ;
break ;
}
if (is_timeout == 1) {
DPRINTK("i2c_err: write software timeout error (rx) \n\r") ;
ret = -ETIMEDOUT ;
break ;
}
/* pass case*/
if (i2c.isr_byte_end == 1) {
buf[xfer_length] = (i2c.regs->cdr_reg >> 8) ;
++xfer_length ;
DPRINTK("i2c_test: received BYTE_END\n\r");
}
i2c.isr_int_pending = 0;
i2c.isr_nack = 0 ;
i2c.isr_byte_end = 0 ;
i2c.isr_timeout = 0 ;
if (length > xfer_length) {
if ((length - 1) == xfer_length) { /* next read is the last one*/
i2c.regs->cr_reg |= (<API key> | I2C_CR_CPU_RDY);
DPRINTK("i2c_test: set CPU_RDY & TX_ACK. next data is last.\r\n");
} else {
i2c.regs->cr_reg |= I2C_CR_CPU_RDY ;
DPRINTK("i2c_test: more data to read. only set CPU_RDY. \r\n");
}
} else if (length == xfer_length) { /* end rx xfer*/
if (last == 1) { /* stop case*/
DPRINTK("i2c_test: read completed \r\n");
break ;
} else { /* restart case*/
/* ??? how to handle the restart after read ?*/
DPRINTK("i2c_test: RX ReStart Case \r\n") ;
break ;
}
} else {
DPRINTK("i2c_err : read known error\n\r") ;
ret = -EIO ;
break ;
}
}
DPRINTK("i2c_test: read sequence completed\n\r");
return ret ;
}
static int i2c_wmt_write_msg(
unsigned int slave_addr, /*!<; //[IN] Salve address */
char *buf, /*!<; //[OUT] Pointer to data */
unsigned int length, /*!<; //Data length */
int restart, /*!<; //Need to restart after a complete write */
int last /*!<; //Last read */
)
{
unsigned short tcr_value ;
unsigned int xfer_length ;
int is_timeout ;
int ret = 0 ;
int wait_event_result ;
DPRINTK("length = %d , slave_addr = %x\n", length , slave_addr);
if (slave_addr == <API key>)
return ret ;
if (is_master == 0)
return -ENXIO;
/* special case allow length:0, for i2c_smbus_xfer*/
if (length < 0)
return -1 ;
xfer_length = 0 ; /* for array index and also for checking counting*/
if (restart == 0)
ret = <API key>() ;
if (ret < 0)
return ret ;
i2c.isr_nack = 0 ;
i2c.isr_byte_end = 0 ;
i2c.isr_timeout = 0 ;
i2c.isr_int_pending = 0;
/* special case allow length:0, for i2c_smbus_xfer*/
if (length == 0)
i2c.regs->cdr_reg = 0 ;
else
i2c.regs->cdr_reg = (unsigned short)(buf[xfer_length] & <API key>) ;
if (restart == 0) {
i2c.regs->cr_reg &= ~(I2C_CR_TX_END); /*clear Tx end*/
i2c.regs->cr_reg |= (I2C_CR_CPU_RDY); /*release SCL*/
}
/* I2C: Set transfer mode [standard/fast]*/
tcr_value = 0 ;
if (i2c.i2c_mode == I2C_STANDARD_MODE)
tcr_value = (unsigned short)(<API key>|<API key> |\
(slave_addr & <API key>)) ;
else if (i2c.i2c_mode == I2C_FAST_MODE)
tcr_value = (unsigned short)(I2C_TCR_FAST_MODE|<API key> |\
(slave_addr & <API key>)) ;
i2c.regs->tcr_reg = tcr_value ;
if (restart == 1)
i2c.regs->cr_reg |= I2C_CR_CPU_RDY ;
ret = 0 ;
for (; ;) {
is_timeout = 0 ;
/* I2C: Wait for interrupt. if ( i2c.isr_int_pending == 1 ) ==> an interrupt exsits.*/
wait_event_result = <API key>(i2c3_wait, i2c.isr_int_pending , (MAX_TX_TIMEOUT * HZ / 1000)) ;
if (likely(wait_event_result > 0)) {
DPRINTK("I2C: wait interrupted (tx)\n");
ret = 0 ;
} else if (likely(i2c.isr_int_pending == 0)) {
DPRINTK("I2C: wait timeout (tx) \n");
is_timeout = 1 ;
ret = -ETIMEDOUT ;
}
/* fail case*/
if (i2c.isr_nack == 1) {
DPRINTK("i2c_err : write NACK error (tx) \n\r") ;
ret = -EIO ;
break ;
}
if (i2c.isr_timeout == 1) {
DPRINTK("i2c_err : write SCL timeout error (tx)\n\r") ;
msleep(10);
ret = -ETIMEDOUT ;
break ;
}
if (is_timeout == 1) {
DPRINTK("i2c_err : write software timeout error (tx)\n\r") ;
ret = -ETIMEDOUT ;
break ;
}
/* pass case*/
if (i2c.isr_byte_end == 1) {
DPRINTK("i2c: isr end byte (tx)\n\r") ;
++xfer_length ;
}
i2c.isr_int_pending = 0 ;
i2c.isr_nack = 0 ;
i2c.isr_byte_end = 0 ;
i2c.isr_timeout = 0 ;
if ((i2c.regs->csr_reg & <API key>) == I2C_CSR_RCV_NOT_ACK) {
DPRINTK("i2c_err : write RCV NACK error\n\r") ;
ret = -EIO ;
break ;
}
/* special case allow length:0, for i2c_smbus_xfer*/
if (length == 0) {
i2c.regs->cr_reg = (I2C_CR_TX_END|I2C_CR_CPU_RDY|I2C_CR_ENABLE) ;
break ;
}
if (length > xfer_length) {
i2c.regs->cdr_reg = (unsigned short) (buf[xfer_length] & <API key>) ;
i2c.regs->cr_reg = (I2C_CR_CPU_RDY | I2C_CR_ENABLE) ;
DPRINTK("i2c_test: write register data \n\r") ;
} else if (length == xfer_length) { /* end tx xfer*/
if (last == 1) { /* stop case*/
i2c.regs->cr_reg = (I2C_CR_TX_END|I2C_CR_CPU_RDY|I2C_CR_ENABLE) ;
DPRINTK("i2c_test: finish write \n\r") ;
break ;
} else { /* restart case*/
/* handle the restart for first write then the next is read*/
i2c.regs->cr_reg = (I2C_CR_ENABLE) ;
DPRINTK("i2c_test: tx restart Case \n\r") ;
break ;
}
} else {
DPRINTK("i2c_err : write unknown error\n\r") ;
ret = -EIO ;
break ;
}
} ;
DPRINTK("i2c_test: write sequence completed\n\r");
return ret ;
}
static int <API key>(void)
{
int ret ;
int cnt ;
ret = 0 ;
cnt = 0 ;
while (1) {
if ((REG16_VAL(I2C3_CSR_ADDR) & I2C_STATUS_MASK) == I2C_READY) {
ret = 0;
break ;
}
cnt++ ;
if (cnt > MAX_BUS_READY_CNT) {
ret = (-EBUSY) ;
printk("i2c_err 3: wait but not ready time-out\n\r") ;
cnt = 0;
break;
}
}
return ret ;
}
static void i2c_wmt_reset(void)
{
unsigned short tmp ;
if (is_master == 0)
return;
/* software initial*/
i2c.regs = (struct i2c_regs_s *)I2C3_BASE_ADDR ;
i2c.irq_no = IRQ_I2C3 ;
if (speed_mode == 0)
i2c.i2c_mode = I2C_STANDARD_MODE ;
else
i2c.i2c_mode = I2C_FAST_MODE ;
i2c.isr_nack = 0 ;
i2c.isr_byte_end = 0 ;
i2c.isr_timeout = 0 ;
i2c.isr_int_pending = 0;
/* hardware initial*/
i2c.regs->cr_reg = 0 ;
i2c.regs->div_reg = APB_96M_I2C_DIV ;
i2c.regs->isr_reg = <API key> ; /* 0x0007*/
i2c.regs->imr_reg = I2C_IMR_ALL_ENABLE ; /* 0x0007*/
i2c.regs->cr_reg = I2C_CR_ENABLE ;
tmp = i2c.regs->csr_reg ; /* read clear*/
i2c.regs->isr_reg = <API key> ; /* 0x0007*/
if (i2c.i2c_mode == I2C_STANDARD_MODE)
i2c.regs->tr_reg = I2C_TR_STD_VALUE ; /* 0x8041*/
else if (i2c.i2c_mode == I2C_FAST_MODE)
i2c.regs->tr_reg = I2C_TR_FAST_VALUE ; /* 0x8011*/
DPRINTK("Resetting I2C Controller Unit\n");
return ;
}
static int <API key>(struct wmt_i2cbusfifo *fifo_head)
{
int xfer_length = fifo_head->xfer_length;
int xfer_msgnum = fifo_head->xfer_msgnum;
struct i2c_msg *pmsg = &fifo_head->msg[xfer_msgnum];
int restart = fifo_head->restart;
unsigned short tcr_value;
unsigned short slave_addr = pmsg->addr;
int length = pmsg->len;
int ret = 0;
if (pmsg->flags & I2C_M_RD) {
if (restart == 0)
<API key>();
i2c.isr_nack = 0 ;
i2c.isr_byte_end = 0 ;
i2c.isr_timeout = 0 ;
/*i2c.isr_int_pending = 0;*/
i2c.regs->cr_reg &= ~(I2C_CR_TX_END); /*clear Tx end*/
i2c.regs->cr_reg &= ~(<API key>); /*clear NEXT_NO_ACK*/
if (restart == 0)
i2c.regs->cr_reg |= (I2C_CR_CPU_RDY); /*release SCL*/
tcr_value = 0 ;
if (i2c.i2c_mode == I2C_STANDARD_MODE) {
tcr_value = (unsigned short)(<API key>|I2C_TCR_MASTER_READ |\
(slave_addr & <API key>)) ;
} else if (i2c.i2c_mode == I2C_FAST_MODE) {
tcr_value = (unsigned short)(I2C_TCR_FAST_MODE|I2C_TCR_MASTER_READ |\
(slave_addr & <API key>)) ;
}
if (length == 1)
i2c.regs->cr_reg |= <API key>; /*only 8-bit to read*/
i2c.regs->tcr_reg = tcr_value ;
/*repeat start case*/
if (restart == 1)
i2c.regs->cr_reg |= (I2C_CR_CPU_RDY); /*release SCL*/
} else {
if (restart == 0)
<API key>();
i2c.isr_nack = 0 ;
i2c.isr_byte_end = 0 ;
i2c.isr_timeout = 0 ;
/*i2c.isr_int_pending = 0;*/
/* special case allow length:0, for i2c_smbus_xfer*/
if (length == 0)
i2c.regs->cdr_reg = 0 ;
else
i2c.regs->cdr_reg = (unsigned short)(pmsg->buf[xfer_length] & <API key>) ;
if (restart == 0) {
i2c.regs->cr_reg &= ~(I2C_CR_TX_END); /*clear Tx end*/
i2c.regs->cr_reg |= (I2C_CR_CPU_RDY); /*release SCL*/
}
/* I2C: Set transfer mode [standard/fast]*/
tcr_value = 0 ;
if (i2c.i2c_mode == I2C_STANDARD_MODE)
tcr_value = (unsigned short)(<API key>|<API key> |\
(slave_addr & <API key>)) ;
else if (i2c.i2c_mode == I2C_FAST_MODE)
tcr_value = (unsigned short)(I2C_TCR_FAST_MODE|<API key> |\
(slave_addr & <API key>)) ;
i2c.regs->tcr_reg = tcr_value ;
if (restart == 1)
i2c.regs->cr_reg |= I2C_CR_CPU_RDY ;
}
return ret;
}
static irqreturn_t i2c_wmt_handler(
int this_irq, /*!<; //[IN] IRQ number */
void *dev_id /*!<; //[IN] Pointer to device ID */
)
{
int wakeup ;
unsigned short isr_status ;
unsigned short tmp ;
unsigned long flags;
struct wmt_i2cbusfifo *fifo_head;
int xfer_length = 0;
int xfer_msgnum = 0;
struct i2c_msg *pmsg;
volatile unsigned short csr_reg;
spin_lock_irqsave(&i2c3_wmt_irqlock, flags);
isr_status = i2c.regs->isr_reg ;
csr_reg = i2c.regs->csr_reg;
wakeup = 0 ;
fifo_head = list_first_entry(&wmt_i2c_fifohead, struct wmt_i2cbusfifo, busfifohead);
if (isr_status & I2C_ISR_NACK_ADDR) {
DPRINTK("[%s]:i2c NACK\n", __func__);
/*spin_lock(&i2c_fifolock);*/
list_del(&fifo_head->busfifohead);/*del request*/
kfree(fifo_head);
/*spin_unlock(&i2c_fifolock);*/
xfer_length = 0;
i2c.regs->isr_reg = <API key> ;
tmp = i2c.regs->csr_reg ; /* read clear*/
i2c.isr_nack = 1 ;
wakeup = 1 ;
}
if ((isr_status & I2C_ISR_BYTE_END && ((csr_reg & <API key>) == I2C_CSR_RCV_NOT_ACK))) {
/*
printk("data rcv nack\n");
*/
list_del(&fifo_head->busfifohead);/*del request*/
kfree(fifo_head);
xfer_length = 0;
i2c.regs->isr_reg = <API key> ;
i2c.isr_nack = 1 ;
wakeup = 1 ;
} else if (isr_status & I2C_ISR_BYTE_END) {
i2c.regs->isr_reg = <API key> ;
i2c.isr_byte_end = 1 ;
xfer_length = fifo_head->xfer_length;
xfer_msgnum = fifo_head->xfer_msgnum;
pmsg = &fifo_head->msg[xfer_msgnum];
/*read case*/
if (pmsg->flags & I2C_M_RD) {
pmsg->buf[xfer_length - 1] = (i2c.regs->cdr_reg >> 8) ;
/*the last data in current msg?*/
if (xfer_length == pmsg->len - 1) {
/*last msg of the current request?*/
/*spin_lock(&i2c_fifolock);*/
if (pmsg->flags & I2C_M_NOSTART) {
++fifo_head->xfer_length;
fifo_head->restart = 1;
/*
++fifo_head->xfer_msgnum;
*/
i2c.regs->cr_reg |= I2C_CR_CPU_RDY;
} else {
++fifo_head->xfer_length;
fifo_head->restart = 0;
/*
++fifo_head->xfer_msgnum;
*/
i2c.regs->cr_reg |= (I2C_CR_CPU_RDY | <API key>);
}
/*spin_unlock(&i2c_fifolock);*/
} else if (xfer_length == pmsg->len) {/*next msg*/
if (xfer_msgnum < fifo_head->msg_num - 1) {
/*spin_lock(&i2c_fifolock);*/
fifo_head->xfer_length = 0;
++fifo_head->xfer_msgnum;
<API key>(fifo_head);
++fifo_head->xfer_length;
/*spin_unlock(&i2c_fifolock);*/
} else { /*data of this msg has been transfered*/
/*spin_lock(&i2c_fifolock);*/
list_del(&fifo_head->busfifohead);/*del request*/
/*next request exist?*/
if (list_empty(&wmt_i2c_fifohead)) {/*no more reqeust*/
/*kfree(fifo_head);*/
if (fifo_head->non_block == 0) {
wakeup = 1;
} else {
fifo_head->callback(fifo_head->data);
}
kfree(fifo_head);
} else { /*more request*/
if (fifo_head->non_block == 0) {
wakeup = 1;
} else {
fifo_head->callback(fifo_head->data);
}
kfree(fifo_head);
fifo_head = list_first_entry(&wmt_i2c_fifohead,
struct wmt_i2cbusfifo, busfifohead);
/*
if (fifo_head->non_block == 0)
wakeup = 1;
*/
fifo_head->xfer_length = 0;
<API key>(fifo_head);
++fifo_head->xfer_length;
/*
if (fifo_head->non_block == 0) {
printk("2 : non callback\n");
wakeup = 1;
} else {
printk("2 :callback\n");
fifo_head->callback(fifo_head->data);
}
*/
}
/*spin_unlock(&i2c_fifolock);*/
}
} else {/*next data*/
/*spin_lock(&i2c_fifolock);*/
++fifo_head->xfer_length;
/*spin_unlock(&i2c_fifolock);*/
i2c.regs->cr_reg |= I2C_CR_CPU_RDY;
}
} else { /*write case*/
/*the last data in current msg?*/
if (xfer_length == pmsg->len) {
/*last msg of the current request?*/
if (xfer_msgnum < fifo_head->msg_num - 1) {
/*spin_lock(&i2c_fifolock);*/
if (pmsg->flags & I2C_M_NOSTART) {
++fifo_head->xfer_length;
fifo_head->restart = 1;
} else {
++fifo_head->xfer_length;
fifo_head->restart = 0;
i2c.regs->cr_reg &= ~(I2C_CR_TX_END);
udelay(2);
i2c.regs->cr_reg |= (I2C_CR_TX_END);
}
/*access next msg*/
fifo_head->xfer_length = 0;
++fifo_head->xfer_msgnum;
<API key>(fifo_head);
++fifo_head->xfer_length;
/*spin_unlock(&i2c_fifolock);*/
} else {/*this request finish*/
/*spin_lock(&i2c_fifolock);*/
/*next request exist?*/
list_del(&fifo_head->busfifohead);/*del request*/
if (list_empty(&wmt_i2c_fifohead)) {
/*kfree(fifo_head);*/
/*
if (fifo_head->non_block == 0)
wakeup = 1;
*/
i2c.regs->cr_reg &= ~(I2C_CR_TX_END);
udelay(2);
i2c.regs->cr_reg |= (I2C_CR_TX_END);
if (fifo_head->non_block == 0) {
wakeup = 1;
} else {
fifo_head->callback(fifo_head->data);
}
kfree(fifo_head);
} else {
i2c.regs->cr_reg &= ~(I2C_CR_TX_END);
udelay(2);
i2c.regs->cr_reg |= (I2C_CR_TX_END);
if (fifo_head->non_block == 0) {
wakeup = 1;
} else {
fifo_head->callback(fifo_head->data);
}
kfree(fifo_head);
fifo_head = list_first_entry(&wmt_i2c_fifohead,
struct wmt_i2cbusfifo, busfifohead);
/*
if (fifo_head->non_block == 0)
wakeup = 1;
*/
/*next msg*/
fifo_head->xfer_length = 0;
++fifo_head->xfer_msgnum;
<API key>(fifo_head);
++fifo_head->xfer_length;
/*
if (fifo_head->non_block == 0) {
printk("4:non callback\n");
wakeup = 1;
} else {
printk("4:callback\n");
fifo_head->callback(fifo_head->data);
}
*/
}
/*spin_unlock(&i2c_fifolock);*/
}
} else {/*next data*/
i2c.regs->cdr_reg = (unsigned short) (pmsg->buf[fifo_head->xfer_length] & <API key>);
/*spin_lock(&i2c_fifolock);*/
++fifo_head->xfer_length;
/*spin_unlock(&i2c_fifolock);*/
i2c.regs->cr_reg |= (I2C_CR_CPU_RDY | I2C_CR_ENABLE);
}
}
}
if (isr_status & <API key>) {
DPRINTK("[%s]SCL timeout\n", __func__);
#if 0
i2c.regs->cr_reg |= BIT7;/*reset status*/
/*spin_lock(&i2c_fifolock);*/
list_del(&fifo_head->busfifohead);/*del request*/
/*spin_unlock(&i2c_fifolock);*/
xfer_length = 0;
i2c.regs->isr_reg = <API key> | <API key>;
i2c.isr_timeout = 1 ;
wakeup = 1;
#endif
i2c.regs->isr_reg = <API key> ;
}
if (wakeup) {
/*spin_lock_irqsave(&i2c_wmt_irqlock, flags);*/
i2c.isr_int_pending = 1;
/*<API key>(&i2c_wmt_irqlock, flags);*/
wake_up(&i2c3_wait);
} else
DPRINTK("i2c_err : unknown I2C ISR Handle 0x%4.4X" , isr_status) ;
<API key>(&i2c3_wmt_irqlock, flags);
return IRQ_HANDLED;
}
static int <API key>(void)
{
if (is_master == 0)
return 0;
if (request_irq(i2c.irq_no , &i2c_wmt_handler, IRQF_DISABLED, "i2c", 0) < 0) {
DPRINTK(KERN_INFO "I2C: Failed to register I2C irq %i\n", i2c.irq_no);
return -ENODEV;
}
return 0;
}
static void <API key>(void)
{
if (is_master == 0)
return;
free_irq(i2c.irq_no, 0);
}
static struct i2c_algo_wmt_data i2c_wmt_data = {
write_msg: i2c_wmt_write_msg,
read_msg: i2c_wmt_read_msg,
send_request: i2c_send_request,
wait_bus_not_busy: <API key>,
reset: i2c_wmt_reset,
set_mode: i2c_wmt_set_mode,
udelay: I2C_ALGO_UDELAY,
timeout: I2C_ALGO_TIMEOUT,
};
static struct i2c_adapter i2c_wmt_ops = {
.owner = THIS_MODULE,
/*
.id = I2C_ALGO_WMT,
*/
.algo_data = &i2c_wmt_data,
.name = "wmt_i2c3_adapter",
.retries = I2C_ADAPTER_RETRIES,
.nr = 3,
};
#ifdef CONFIG_PM
static struct i2c_regs_s wmt_i2c_reg ;
static void i2c_shutdown(void)
{
printk("i2c3 shutdown\n");
<API key> = 2;
while (!list_empty(&wmt_i2c_fifohead))
msleep(1);
while (1) {/*wait busy clear*/
if ((REG16_VAL(I2C3_CSR_ADDR) & I2C_STATUS_MASK) == I2C_READY)
break ;
msleep(1);
}
return;
}
static int i2c_suspend(void)
{
printk("i2c3 suspend\n");
wmt_i2c_reg.imr_reg = i2c.regs->imr_reg;
wmt_i2c_reg.tr_reg = i2c.regs->tr_reg;
wmt_i2c_reg.div_reg = i2c.regs->div_reg;
return 0;
}
static void i2c_resume(void)
{
printk("i2c3 resume\n");
<API key> &= ~(BIT0 | BIT1);
<API key> |= (BIT0 | BIT1);
<API key> |= (BIT0 | BIT1);
<API key> &= ~BIT28;
auto_pll_divisor(DEV_I2C3, CLK_ENABLE, 0, 0);
auto_pll_divisor(DEV_I2C3, SET_DIV, 2, 20);/*20M Hz*/
i2c.regs->cr_reg = 0 ;
i2c.regs->div_reg = wmt_i2c_reg.div_reg;
i2c.regs->imr_reg = wmt_i2c_reg.imr_reg;
i2c.regs->tr_reg = wmt_i2c_reg.tr_reg ;
i2c.regs->cr_reg = 0x001 ;
}
#else
#define i2c_suspend NULL
#define i2c_resume NULL
#define i2c_shutdown NULL
#endif
extern int wmt_i2c_add_bus(struct i2c_adapter *);
extern int wmt_i2c_del_bus(struct i2c_adapter *);
#ifdef CONFIG_PM
static struct syscore_ops wmt_i2c_syscore_ops = {
.suspend = i2c_suspend,
.resume = i2c_resume,
.shutdown = i2c_shutdown,
};
#endif
static int __init i2c_adap_wmt_init(void)
{
unsigned short tmp ;
char varname[] = "wmt.i2c.param";
#ifdef <API key>
char varname1[] = "wmt.bus.i2c.slave_port";
#endif
unsigned char buf[80];
int ret;
unsigned int port_num;
int idx = 0;
int varlen = 80;
unsigned int pllb_freq = 0;
unsigned int tr_val = 0;
#ifdef <API key>
#ifdef USE_UBOOT_PARA
ret = wmt_getsyspara(varname1, buf, &varlen);
#else
ret = 1;
#endif
is_master = 1;
if (ret == 0) {
ret = sscanf(buf, "%x", &port_num);
while (ret) {
if (port_num != 0)
is_master = 1;
else {
is_master = 0;
break;
}
idx += ret;
ret = sscanf(buf + idx, ",%x", &port_num);
}
} else
is_master = 1;
#endif
wmt_i2c3_is_master = is_master;
if (is_master == 1) {
#ifdef USE_UBOOT_PARA
ret = wmt_getsyspara(varname, buf, &varlen);
#else
ret = 1;
#endif
if (ret == 0) {
ret = sscanf(buf, "%x:%x", &port_num, &speed_mode);
idx += 3;
while (ret) {
if (ret < 2)
speed_mode = 0;
else {
if (port_num != 3)
speed_mode = 0;
else
break;
}
ret = sscanf(buf + idx, ",%x:%x", &port_num, &speed_mode);
idx += 4;
}
}
if (speed_mode > 1)
speed_mode = 0;
wmt_i2c3_speed_mode = speed_mode;
/* software initial*/
i2c.regs = (struct i2c_regs_s *)I2C3_BASE_ADDR ;
i2c.irq_no = IRQ_I2C3 ;
printk("PORT 3 speed_mode = %d\n", speed_mode);
if (speed_mode == 0)
i2c.i2c_mode = I2C_STANDARD_MODE ;
else if (speed_mode == 1)
i2c.i2c_mode = I2C_FAST_MODE ;
i2c.isr_nack = 0 ;
i2c.isr_byte_end = 0 ;
i2c.isr_timeout = 0 ;
i2c.isr_int_pending = 0;
/* hardware initial*/
auto_pll_divisor(DEV_I2C3, CLK_ENABLE, 0, 0);
pllb_freq = auto_pll_divisor(DEV_I2C3, SET_DIV, 2, 20);/*20M Hz*/
printk("pllb_freq = %d\n", pllb_freq);
if ((pllb_freq%(1000*2*100)) != 0)
tr_val = pllb_freq/(1000*2*100) + 1;
else
tr_val = pllb_freq/(1000*2*100);
*(volatile unsigned char *)CTRL_GPIO &= ~(BIT0 | BIT1);
*(volatile unsigned char *)PU_EN_GPIO |= (BIT0 | BIT1);
*(volatile unsigned char *)PU_CTRL_GPIO |= (BIT0 | BIT1);
<API key> &= ~BIT28;
i2c.regs->cr_reg = 0 ;
i2c.regs->div_reg = APB_96M_I2C_DIV ;
i2c.regs->isr_reg = <API key> ; /* 0x0007*/
i2c.regs->imr_reg = I2C_IMR_ALL_ENABLE ; /* 0x0007*/
i2c.regs->cr_reg = I2C_CR_ENABLE ;
tmp = i2c.regs->csr_reg ; /* read clear*/
i2c.regs->isr_reg = <API key> ; /* 0x0007*/
if (i2c.i2c_mode == I2C_STANDARD_MODE)
i2c.regs->tr_reg = 0xff00|tr_val;
else if (i2c.i2c_mode == I2C_FAST_MODE) {
tr_val /= 4;
i2c.regs->tr_reg = 0xff00|tr_val ;
}
}
if (<API key>() == 0) {
if (wmt_i2c_add_bus(&i2c_wmt_ops) < 0) {
<API key>();
printk(KERN_INFO "i2c: Failed to add bus\n");
return -ENODEV;
}
} else
return -ENODEV;
INIT_LIST_HEAD(&wmt_i2c_fifohead);
#ifdef CONFIG_PM
<API key>(&wmt_i2c_syscore_ops);
#endif
printk(KERN_INFO "i2c: successfully added bus\n");
#ifdef I2C_REG_TEST
printk("i2c.regs->cr_reg= 0x%08x\n\r", i2c.regs->cr_reg);
printk("i2c.regs->tcr_reg= 0x%08x\n\r", i2c.regs->tcr_reg);
printk("i2c.regs->csr_reg= 0x%08x\n\r", i2c.regs->csr_reg);
printk("i2c.regs->isr_reg= 0x%08x\n\r", i2c.regs->isr_reg);
printk("i2c.regs->imr_reg= 0x%08x\n\r", i2c.regs->imr_reg);
printk("i2c.regs->cdr_reg= 0x%08x\n\r", i2c.regs->cdr_reg);
printk("i2c.regs->tr_reg= 0x%08x\n\r", i2c.regs->tr_reg);
printk("i2c.regs->div_reg= 0x%08x\n\r", i2c.regs->div_reg);
#endif
return 0;
}
subsys_initcall(i2c_adap_wmt_init);
static void i2c_adap_wmt_exit(void)
{
wmt_i2c_del_bus(&i2c_wmt_ops);
<API key>();
printk(KERN_INFO "i2c: successfully removed bus\n");
}
MODULE_AUTHOR("WonderMedia Technologies, Inc.");
MODULE_DESCRIPTION("WMT I2C Adapter Driver");
MODULE_LICENSE("GPL");
module_exit(i2c_adap_wmt_exit);
|
/* Bluetooth HCI Management interface */
#include <linux/uaccess.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <asm/unaligned.h>
#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>
#include <net/bluetooth/l2cap.h>
#include <net/bluetooth/mgmt.h>
#include <net/bluetooth/smp.h>
#define MGMT_VERSION 0
#define MGMT_REVISION 1
#define SCAN_IDLE 0x00
#define SCAN_LE 0x01
#define SCAN_BR 0x02
struct pending_cmd {
struct list_head list;
__u16 opcode;
int index;
void *param;
struct sock *sk;
void *user_data;
};
struct <API key> {
struct work_struct work;
struct sock *sk;
};
LIST_HEAD(cmd_list);
static int cmd_status(struct sock *sk, u16 index, u16 cmd, u8 status)
{
struct sk_buff *skb;
struct mgmt_hdr *hdr;
struct mgmt_ev_cmd_status *ev;
BT_DBG("sock %p, index %u, cmd %u, status %u", sk, index, cmd, status);
skb = alloc_skb(sizeof(*hdr) + sizeof(*ev), GFP_ATOMIC);
if (!skb)
return -ENOMEM;
hdr = (void *) skb_put(skb, sizeof(*hdr));
hdr->opcode = cpu_to_le16(MGMT_EV_CMD_STATUS);
hdr->index = cpu_to_le16(index);
hdr->len = cpu_to_le16(sizeof(*ev));
ev = (void *) skb_put(skb, sizeof(*ev));
ev->status = status;
put_unaligned_le16(cmd, &ev->opcode);
if (sock_queue_rcv_skb(sk, skb) < 0)
kfree_skb(skb);
return 0;
}
static int cmd_complete(struct sock *sk, u16 index, u16 cmd, void *rp,
size_t rp_len)
{
struct sk_buff *skb;
struct mgmt_hdr *hdr;
struct <API key> *ev;
BT_DBG("sock %p", sk);
skb = alloc_skb(sizeof(*hdr) + sizeof(*ev) + rp_len, GFP_ATOMIC);
if (!skb)
return -ENOMEM;
hdr = (void *) skb_put(skb, sizeof(*hdr));
hdr->opcode = cpu_to_le16(<API key>);
hdr->index = cpu_to_le16(index);
hdr->len = cpu_to_le16(sizeof(*ev) + rp_len);
ev = (void *) skb_put(skb, sizeof(*ev) + rp_len);
put_unaligned_le16(cmd, &ev->opcode);
if (rp)
memcpy(ev->data, rp, rp_len);
if (sock_queue_rcv_skb(sk, skb) < 0)
kfree_skb(skb);
return 0;
}
static int read_version(struct sock *sk)
{
struct <API key> rp;
BT_DBG("sock %p", sk);
rp.version = MGMT_VERSION;
put_unaligned_le16(MGMT_REVISION, &rp.revision);
return cmd_complete(sk, MGMT_INDEX_NONE, <API key>, &rp,
sizeof(rp));
}
static int read_index_list(struct sock *sk)
{
struct <API key> *rp;
struct list_head *p;
size_t rp_len;
u16 count;
int i, err;
BT_DBG("sock %p", sk);
read_lock(&hci_dev_list_lock);
count = 0;
list_for_each(p, &hci_dev_list) {
struct hci_dev *d = list_entry(p, struct hci_dev, list);
if (d->dev_type != HCI_BREDR)
continue;
count++;
}
rp_len = sizeof(*rp) + (2 * count);
rp = kmalloc(rp_len, GFP_ATOMIC);
if (!rp) {
read_unlock(&hci_dev_list_lock);
return -ENOMEM;
}
put_unaligned_le16(0, &rp->num_controllers);
i = 0;
list_for_each(p, &hci_dev_list) {
struct hci_dev *d = list_entry(p, struct hci_dev, list);
hci_del_off_timer(d);
if (d->dev_type != HCI_BREDR)
continue;
set_bit(HCI_MGMT, &d->flags);
if (test_bit(HCI_SETUP, &d->flags))
continue;
put_unaligned_le16(d->id, &rp->index[i++]);
put_unaligned_le16((u16)i, &rp->num_controllers);
BT_DBG("Added hci%u", d->id);
}
read_unlock(&hci_dev_list_lock);
err = cmd_complete(sk, MGMT_INDEX_NONE, <API key>, rp,
rp_len);
kfree(rp);
return err;
}
static int <API key>(struct sock *sk, u16 index)
{
struct mgmt_rp_read_info rp;
struct hci_dev *hdev;
BT_DBG("sock %p hci%u", sk, index);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, MGMT_OP_READ_INFO, ENODEV);
hci_del_off_timer(hdev);
hci_dev_lock_bh(hdev);
set_bit(HCI_MGMT, &hdev->flags);
memset(&rp, 0, sizeof(rp));
rp.type = hdev->dev_type;
rp.powered = test_bit(HCI_UP, &hdev->flags);
rp.connectable = test_bit(HCI_PSCAN, &hdev->flags);
rp.discoverable = test_bit(HCI_ISCAN, &hdev->flags);
rp.pairable = test_bit(HCI_PSCAN, &hdev->flags);
if (test_bit(HCI_AUTH, &hdev->flags))
rp.sec_mode = 3;
else if (hdev->ssp_mode > 0)
rp.sec_mode = 4;
else
rp.sec_mode = 2;
bacpy(&rp.bdaddr, &hdev->bdaddr);
memcpy(rp.features, hdev->features, 8);
memcpy(rp.dev_class, hdev->dev_class, 3);
put_unaligned_le16(hdev->manufacturer, &rp.manufacturer);
rp.hci_ver = hdev->hci_ver;
put_unaligned_le16(hdev->hci_rev, &rp.hci_rev);
memcpy(rp.name, hdev->dev_name, sizeof(hdev->dev_name));
rp.le_white_list_size = hdev->le_white_list_size;
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return cmd_complete(sk, index, MGMT_OP_READ_INFO, &rp, sizeof(rp));
}
static void <API key>(struct work_struct *work)
{
struct <API key> *free_work =
container_of(work, struct <API key>, work);
BT_DBG("sk %p", free_work->sk);
sock_put(free_work->sk);
kfree(free_work);
}
static void mgmt_pending_free(struct pending_cmd *cmd)
{
struct <API key> *free_work;
struct sock *sk = cmd->sk;
BT_DBG("opcode %d, sk %p", cmd->opcode, sk);
kfree(cmd->param);
kfree(cmd);
free_work = kzalloc(sizeof(*free_work), GFP_ATOMIC);
if (free_work) {
INIT_WORK(&free_work->work, <API key>);
free_work->sk = sk;
if (!schedule_work(&free_work->work))
kfree(free_work);
}
}
static struct pending_cmd *mgmt_pending_add(struct sock *sk, u16 opcode,
u16 index, void *data, u16 len)
{
struct pending_cmd *cmd;
BT_DBG("%d", opcode);
cmd = kmalloc(sizeof(*cmd), GFP_ATOMIC);
if (!cmd)
return NULL;
cmd->opcode = opcode;
cmd->index = index;
cmd->param = kmalloc(len, GFP_ATOMIC);
if (!cmd->param) {
kfree(cmd);
return NULL;
}
if (data)
memcpy(cmd->param, data, len);
cmd->sk = sk;
sock_hold(sk);
list_add(&cmd->list, &cmd_list);
return cmd;
}
static void <API key>(u16 opcode, int index,
void (*cb)(struct pending_cmd *cmd, void *data),
void *data)
{
struct list_head *p, *n;
BT_DBG(" %d", opcode);
list_for_each_safe(p, n, &cmd_list) {
struct pending_cmd *cmd;
cmd = list_entry(p, struct pending_cmd, list);
if (opcode > 0 && cmd->opcode != opcode)
continue;
if (index >= 0 && cmd->index != index)
continue;
cb(cmd, data);
}
}
static struct pending_cmd *mgmt_pending_find(u16 opcode, int index)
{
struct list_head *p;
BT_DBG(" %d", opcode);
list_for_each(p, &cmd_list) {
struct pending_cmd *cmd;
cmd = list_entry(p, struct pending_cmd, list);
if (cmd->opcode != opcode)
continue;
if (index >= 0 && cmd->index != index)
continue;
return cmd;
}
return NULL;
}
static void mgmt_pending_remove(struct pending_cmd *cmd)
{
BT_DBG(" %d", cmd->opcode);
list_del(&cmd->list);
mgmt_pending_free(cmd);
}
static int set_powered(struct sock *sk, u16 index, unsigned char *data, u16 len)
{
struct mgmt_mode *cp;
struct hci_dev *hdev;
struct pending_cmd *cmd;
int err, up;
cp = (void *) data;
BT_DBG("request for hci%u", index);
if (len != sizeof(*cp))
return cmd_status(sk, index, MGMT_OP_SET_POWERED, EINVAL);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, MGMT_OP_SET_POWERED, ENODEV);
hci_dev_lock_bh(hdev);
up = test_bit(HCI_UP, &hdev->flags);
if ((cp->val && up) || (!cp->val && !up)) {
err = cmd_status(sk, index, MGMT_OP_SET_POWERED, EALREADY);
goto failed;
}
if (mgmt_pending_find(MGMT_OP_SET_POWERED, index)) {
err = cmd_status(sk, index, MGMT_OP_SET_POWERED, EBUSY);
goto failed;
}
cmd = mgmt_pending_add(sk, MGMT_OP_SET_POWERED, index, data, len);
if (!cmd) {
err = -ENOMEM;
goto failed;
}
hci_dev_unlock_bh(hdev);
if (cp->val)
queue_work(hdev->workqueue, &hdev->power_on);
else
queue_work(hdev->workqueue, &hdev->power_off);
err = 0;
hci_dev_put(hdev);
return err;
failed:
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static u8 get_service_classes(struct hci_dev *hdev)
{
struct list_head *p;
u8 val = 0;
list_for_each(p, &hdev->uuids) {
struct bt_uuid *uuid = list_entry(p, struct bt_uuid, list);
val |= uuid->svc_hint;
}
return val;
}
static int update_class(struct hci_dev *hdev)
{
u8 cod[3];
int err = 0;
BT_DBG("%s", hdev->name);
if (test_bit(HCI_SERVICE_CACHE, &hdev->flags))
return 0;
cod[0] = hdev->minor_class;
cod[1] = hdev->major_class;
cod[2] = get_service_classes(hdev);
if (memcmp(cod, hdev->dev_class, 3) == 0)
return 0;
err = hci_send_cmd(hdev, <API key>, sizeof(cod), cod);
if (err == 0)
memcpy(hdev->dev_class, cod, 3);
return err;
}
static int <API key>(struct sock *sk, u16 index,
unsigned char *data, u16 len)
{
struct mgmt_mode *cp;
struct hci_dev *hdev;
struct pending_cmd *cmd;
struct <API key> dcp;
int update_cod;
int err = 0;
/* General Inquiry LAP: 0x9E8B33, Limited Inquiry LAP: 0x9E8B00 */
u8 lap[] = { 0x33, 0x8b, 0x9e, 0x00, 0x8b, 0x9e };
cp = (void *) data;
BT_DBG("hci%u discoverable: %d", index, cp->val);
if (!cp || len != sizeof(*cp))
return cmd_status(sk, index, <API key>,
EINVAL);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, <API key>,
ENODEV);
hci_dev_lock_bh(hdev);
if (!test_bit(HCI_UP, &hdev->flags)) {
err = cmd_status(sk, index, <API key>,
ENETDOWN);
goto failed;
}
if (mgmt_pending_find(<API key>, index)) {
err = cmd_status(sk, index, <API key>,
EBUSY);
goto failed;
}
if (cp->val == test_bit(HCI_ISCAN, &hdev->flags) &&
test_bit(HCI_PSCAN, &hdev->flags)) {
err = cmd_status(sk, index, <API key>,
EALREADY);
goto failed;
}
cmd = mgmt_pending_add(sk, <API key>, index, data,
len);
if (!cmd) {
err = -ENOMEM;
goto failed;
}
memset(&dcp, 0, sizeof(dcp));
dcp.num_current_iac = cp->val ? 2 : 1;
memcpy(&dcp.lap, lap, dcp.num_current_iac * 3);
update_cod = 1;
if (cp->val) {
if (hdev->major_class & <API key>)
update_cod = 0;
hdev->major_class |= <API key>;
} else {
if (!(hdev->major_class & <API key>))
update_cod = 0;
hdev->major_class &= ~<API key>;
}
if (update_cod)
err = update_class(hdev);
if (err >= 0)
err = hci_send_cmd(hdev, <API key>,
sizeof(dcp), &dcp);
if (err < 0)
mgmt_pending_remove(cmd);
failed:
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static int set_discoverable(struct sock *sk, u16 index, unsigned char *data,
u16 len)
{
struct mgmt_mode *cp;
struct hci_dev *hdev;
struct pending_cmd *cmd;
u8 scan;
int err;
cp = (void *) data;
BT_DBG("request for hci%u", index);
if (len != sizeof(*cp))
return cmd_status(sk, index, <API key>, EINVAL);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, <API key>, ENODEV);
hci_dev_lock_bh(hdev);
if (!test_bit(HCI_UP, &hdev->flags)) {
err = cmd_status(sk, index, <API key>, ENETDOWN);
goto failed;
}
if (mgmt_pending_find(<API key>, index) ||
mgmt_pending_find(<API key>, index)) {
err = cmd_status(sk, index, <API key>, EBUSY);
goto failed;
}
if (cp->val == test_bit(HCI_ISCAN, &hdev->flags) &&
test_bit(HCI_PSCAN, &hdev->flags)) {
err = cmd_status(sk, index, <API key>, EALREADY);
goto failed;
}
cmd = mgmt_pending_add(sk, <API key>, index, data, len);
if (!cmd) {
err = -ENOMEM;
goto failed;
}
scan = SCAN_PAGE;
if (cp->val)
scan |= SCAN_INQUIRY;
err = hci_send_cmd(hdev, <API key>, 1, &scan);
if (err < 0)
mgmt_pending_remove(cmd);
failed:
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static int set_connectable(struct sock *sk, u16 index, unsigned char *data,
u16 len)
{
struct mgmt_mode *cp;
struct hci_dev *hdev;
struct pending_cmd *cmd;
u8 scan;
int err;
cp = (void *) data;
BT_DBG("request for hci%u", index);
if (len != sizeof(*cp))
return cmd_status(sk, index, <API key>, EINVAL);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, <API key>, ENODEV);
hci_dev_lock_bh(hdev);
if (!test_bit(HCI_UP, &hdev->flags)) {
err = cmd_status(sk, index, <API key>, ENETDOWN);
goto failed;
}
if (mgmt_pending_find(<API key>, index) ||
mgmt_pending_find(<API key>, index)) {
err = cmd_status(sk, index, <API key>, EBUSY);
goto failed;
}
if (cp->val == test_bit(HCI_PSCAN, &hdev->flags)) {
err = cmd_status(sk, index, <API key>, EALREADY);
goto failed;
}
cmd = mgmt_pending_add(sk, <API key>, index, data, len);
if (!cmd) {
err = -ENOMEM;
goto failed;
}
if (cp->val)
scan = SCAN_PAGE;
else
scan = 0;
err = hci_send_cmd(hdev, <API key>, 1, &scan);
if (err < 0)
mgmt_pending_remove(cmd);
failed:
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static int mgmt_event(u16 event, u16 index, void *data, u16 data_len,
struct sock *skip_sk)
{
struct sk_buff *skb;
struct mgmt_hdr *hdr;
BT_DBG("hci%d %d", index, event);
skb = alloc_skb(sizeof(*hdr) + data_len, GFP_ATOMIC);
if (!skb)
return -ENOMEM;
bt_cb(skb)->channel = HCI_CHANNEL_CONTROL;
hdr = (void *) skb_put(skb, sizeof(*hdr));
hdr->opcode = cpu_to_le16(event);
hdr->index = cpu_to_le16(index);
hdr->len = cpu_to_le16(data_len);
if (data)
memcpy(skb_put(skb, data_len), data, data_len);
hci_send_to_sock(NULL, skb, skip_sk);
kfree_skb(skb);
return 0;
}
static int send_mode_rsp(struct sock *sk, u16 opcode, u16 index, u8 val)
{
struct mgmt_mode rp;
rp.val = val;
return cmd_complete(sk, index, opcode, &rp, sizeof(rp));
}
static int set_pairable(struct sock *sk, u16 index, unsigned char *data,
u16 len)
{
struct mgmt_mode *cp, ev;
struct hci_dev *hdev;
int err;
cp = (void *) data;
BT_DBG("request for hci%u", index);
if (len != sizeof(*cp))
return cmd_status(sk, index, <API key>, EINVAL);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, <API key>, ENODEV);
hci_dev_lock_bh(hdev);
if (cp->val)
set_bit(HCI_PAIRABLE, &hdev->flags);
else
clear_bit(HCI_PAIRABLE, &hdev->flags);
err = send_mode_rsp(sk, <API key>, index, cp->val);
if (err < 0)
goto failed;
ev.val = cp->val;
err = mgmt_event(MGMT_EV_PAIRABLE, index, &ev, sizeof(ev), sk);
failed:
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
#define EIR_FLAGS 0x01 /* flags */
#define EIR_UUID16_SOME 0x02 /* 16-bit UUID, more available */
#define EIR_UUID16_ALL 0x03 /* 16-bit UUID, all listed */
#define EIR_UUID32_SOME 0x04 /* 32-bit UUID, more available */
#define EIR_UUID32_ALL 0x05 /* 32-bit UUID, all listed */
#define EIR_UUID128_SOME 0x06 /* 128-bit UUID, more available */
#define EIR_UUID128_ALL 0x07 /* 128-bit UUID, all listed */
#define EIR_NAME_SHORT 0x08 /* shortened local name */
#define EIR_NAME_COMPLETE 0x09 /* complete local name */
#define EIR_TX_POWER 0x0A /* transmit power level */
#define EIR_DEVICE_ID 0x10 /* device ID */
#define PNP_INFO_SVCLASS_ID 0x1200
static u8 bluetooth_base_uuid[] = {
0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80,
0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static u16 get_uuid16(u8 *uuid128)
{
u32 val;
int i;
for (i = 0; i < 12; i++) {
if (bluetooth_base_uuid[i] != uuid128[i])
return 0;
}
memcpy(&val, &uuid128[12], 4);
val = le32_to_cpu(val);
if (val > 0xffff)
return 0;
return (u16) val;
}
static void create_eir(struct hci_dev *hdev, u8 *data)
{
u8 *ptr = data;
u16 eir_len = 0;
u16 uuid16_list[HCI_MAX_EIR_LENGTH / sizeof(u16)];
int i, truncated = 0;
struct list_head *p;
size_t name_len;
name_len = strnlen(hdev->dev_name, HCI_MAX_EIR_LENGTH);
if (name_len > 0) {
/* EIR Data type */
if (name_len > 48) {
name_len = 48;
ptr[1] = EIR_NAME_SHORT;
} else
ptr[1] = EIR_NAME_COMPLETE;
/* EIR Data length */
ptr[0] = name_len + 1;
memcpy(ptr + 2, hdev->dev_name, name_len);
eir_len += (name_len + 2);
ptr += (name_len + 2);
}
memset(uuid16_list, 0, sizeof(uuid16_list));
/* Group all UUID16 types */
list_for_each(p, &hdev->uuids) {
struct bt_uuid *uuid = list_entry(p, struct bt_uuid, list);
u16 uuid16;
uuid16 = get_uuid16(uuid->uuid);
if (uuid16 == 0)
return;
if (uuid16 < 0x1100)
continue;
if (uuid16 == PNP_INFO_SVCLASS_ID)
continue;
/* Stop if not enough space to put next UUID */
if (eir_len + 2 + sizeof(u16) > HCI_MAX_EIR_LENGTH) {
truncated = 1;
break;
}
/* Check for duplicates */
for (i = 0; uuid16_list[i] != 0; i++)
if (uuid16_list[i] == uuid16)
break;
if (uuid16_list[i] == 0) {
uuid16_list[i] = uuid16;
eir_len += sizeof(u16);
}
}
if (uuid16_list[0] != 0) {
u8 *length = ptr;
/* EIR Data type */
ptr[1] = truncated ? EIR_UUID16_SOME : EIR_UUID16_ALL;
ptr += 2;
eir_len += 2;
for (i = 0; uuid16_list[i] != 0; i++) {
*ptr++ = (uuid16_list[i] & 0x00ff);
*ptr++ = (uuid16_list[i] & 0xff00) >> 8;
}
/* EIR Data length */
*length = (i * sizeof(u16)) + 1;
}
}
static int update_eir(struct hci_dev *hdev)
{
struct hci_cp_write_eir cp;
if (!(hdev->features[6] & LMP_EXT_INQ))
return 0;
if (hdev->ssp_mode == 0)
return 0;
if (test_bit(HCI_SERVICE_CACHE, &hdev->flags))
return 0;
memset(&cp, 0, sizeof(cp));
create_eir(hdev, cp.data);
if (memcmp(cp.data, hdev->eir, sizeof(cp.data)) == 0)
return 0;
memcpy(hdev->eir, cp.data, sizeof(cp.data));
return hci_send_cmd(hdev, HCI_OP_WRITE_EIR, sizeof(cp), &cp);
}
static int add_uuid(struct sock *sk, u16 index, unsigned char *data, u16 len)
{
struct mgmt_cp_add_uuid *cp;
struct hci_dev *hdev;
struct bt_uuid *uuid;
int err;
cp = (void *) data;
BT_DBG("request for hci%u", index);
if (len != sizeof(*cp))
return cmd_status(sk, index, MGMT_OP_ADD_UUID, EINVAL);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, MGMT_OP_ADD_UUID, ENODEV);
hci_dev_lock_bh(hdev);
uuid = kmalloc(sizeof(*uuid), GFP_ATOMIC);
if (!uuid) {
err = -ENOMEM;
goto failed;
}
memcpy(uuid->uuid, cp->uuid, 16);
uuid->svc_hint = cp->svc_hint;
list_add(&uuid->list, &hdev->uuids);
if (test_bit(HCI_UP, &hdev->flags)) {
err = update_class(hdev);
if (err < 0)
goto failed;
err = update_eir(hdev);
if (err < 0)
goto failed;
} else
err = 0;
err = cmd_complete(sk, index, MGMT_OP_ADD_UUID, NULL, 0);
failed:
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static int remove_uuid(struct sock *sk, u16 index, unsigned char *data, u16 len)
{
struct list_head *p, *n;
struct mgmt_cp_remove_uuid *cp;
struct hci_dev *hdev;
u8 bt_uuid_any[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
int err, found;
cp = (void *) data;
BT_DBG("request for hci%u", index);
if (len != sizeof(*cp))
return cmd_status(sk, index, MGMT_OP_REMOVE_UUID, EINVAL);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, MGMT_OP_REMOVE_UUID, ENODEV);
hci_dev_lock_bh(hdev);
if (memcmp(cp->uuid, bt_uuid_any, 16) == 0) {
err = hci_uuids_clear(hdev);
goto unlock;
}
found = 0;
list_for_each_safe(p, n, &hdev->uuids) {
struct bt_uuid *match = list_entry(p, struct bt_uuid, list);
if (memcmp(match->uuid, cp->uuid, 16) != 0)
continue;
list_del(&match->list);
kfree(match);
found++;
}
if (found == 0) {
err = cmd_status(sk, index, MGMT_OP_REMOVE_UUID, ENOENT);
goto unlock;
}
if (test_bit(HCI_UP, &hdev->flags)) {
err = update_class(hdev);
if (err < 0)
goto unlock;
err = update_eir(hdev);
if (err < 0)
goto unlock;
} else
err = 0;
err = cmd_complete(sk, index, MGMT_OP_REMOVE_UUID, NULL, 0);
unlock:
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static int set_dev_class(struct sock *sk, u16 index, unsigned char *data,
u16 len)
{
struct hci_dev *hdev;
struct <API key> *cp;
int err;
cp = (void *) data;
BT_DBG("request for hci%u", index);
if (len != sizeof(*cp))
return cmd_status(sk, index, <API key>, EINVAL);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, <API key>, ENODEV);
hci_dev_lock_bh(hdev);
hdev->major_class &= ~<API key>;
hdev->major_class |= cp->major & <API key>;
hdev->minor_class = cp->minor;
if (test_bit(HCI_UP, &hdev->flags)) {
err = update_class(hdev);
if (err == 0)
err = cmd_complete(sk, index,
<API key>, hdev->dev_class, sizeof(u8)*3);
} else
err = cmd_complete(sk, index, <API key>, NULL, 0);
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static int set_service_cache(struct sock *sk, u16 index, unsigned char *data,
u16 len)
{
struct hci_dev *hdev;
struct <API key> *cp;
int err;
cp = (void *) data;
if (len != sizeof(*cp))
return cmd_status(sk, index, <API key>, EINVAL);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, <API key>, ENODEV);
hci_dev_lock_bh(hdev);
BT_DBG("hci%u enable %d", index, cp->enable);
if (cp->enable) {
set_bit(HCI_SERVICE_CACHE, &hdev->flags);
err = 0;
} else {
clear_bit(HCI_SERVICE_CACHE, &hdev->flags);
if (test_bit(HCI_UP, &hdev->flags)) {
err = update_class(hdev);
if (err == 0)
err = update_eir(hdev);
} else
err = 0;
}
if (err == 0)
err = cmd_complete(sk, index, <API key>, NULL,
0);
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static int load_keys(struct sock *sk, u16 index, unsigned char *data, u16 len)
{
struct hci_dev *hdev;
struct mgmt_cp_load_keys *cp;
u16 key_count, expected_len;
int i, err;
cp = (void *) data;
if (len < sizeof(*cp))
return -EINVAL;
key_count = get_unaligned_le16(&cp->key_count);
expected_len = sizeof(*cp) + key_count * sizeof(struct mgmt_key_info);
if (expected_len > len) {
BT_ERR("load_keys: expected at least %u bytes, got %u bytes",
expected_len, len);
return -EINVAL;
}
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, MGMT_OP_LOAD_KEYS, ENODEV);
BT_DBG("hci%u debug_keys %u key_count %u", index, cp->debug_keys,
key_count);
hci_dev_lock_bh(hdev);
hci_link_keys_clear(hdev);
set_bit(HCI_LINK_KEYS, &hdev->flags);
if (cp->debug_keys)
set_bit(HCI_DEBUG_KEYS, &hdev->flags);
else
clear_bit(HCI_DEBUG_KEYS, &hdev->flags);
len -= sizeof(*cp);
i = 0;
while (i < len) {
struct mgmt_key_info *key = (void *) cp->keys + i;
i += sizeof(*key);
if (key->key_type == KEY_TYPE_LTK) {
struct key_master_id *id = (void *) key->data;
if (key->dlen != sizeof(struct key_master_id))
continue;
hci_add_ltk(hdev, 0, &key->bdaddr, key->addr_type,
key->pin_len, key->auth, id->ediv,
id->rand, key->val);
continue;
}
hci_add_link_key(hdev, 0, &key->bdaddr, key->val, key->key_type,
key->pin_len);
}
err = cmd_complete(sk, index, MGMT_OP_LOAD_KEYS, NULL, 0);
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static int remove_key(struct sock *sk, u16 index, unsigned char *data, u16 len)
{
struct hci_dev *hdev;
struct mgmt_cp_remove_key *cp;
struct hci_conn *conn;
int err;
cp = (void *) data;
if (len != sizeof(*cp))
return cmd_status(sk, index, MGMT_OP_REMOVE_KEY, EINVAL);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, MGMT_OP_REMOVE_KEY, ENODEV);
hci_dev_lock_bh(hdev);
err = hci_remove_link_key(hdev, &cp->bdaddr);
if (err < 0) {
err = cmd_status(sk, index, MGMT_OP_REMOVE_KEY, -err);
goto unlock;
}
err = 0;
if (!test_bit(HCI_UP, &hdev->flags) || !cp->disconnect)
goto unlock;
conn = <API key>(hdev, ACL_LINK, &cp->bdaddr);
if (conn) {
struct hci_cp_disconnect dc;
put_unaligned_le16(conn->handle, &dc.handle);
dc.reason = 0x13; /* Remote User Terminated Connection */
err = hci_send_cmd(hdev, HCI_OP_DISCONNECT, 0, NULL);
}
unlock:
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static int disconnect(struct sock *sk, u16 index, unsigned char *data, u16 len)
{
struct hci_dev *hdev;
struct mgmt_cp_disconnect *cp;
struct hci_cp_disconnect dc;
struct pending_cmd *cmd;
struct hci_conn *conn;
int err;
BT_DBG("");
cp = (void *) data;
if (len != sizeof(*cp))
return cmd_status(sk, index, MGMT_OP_DISCONNECT, EINVAL);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, MGMT_OP_DISCONNECT, ENODEV);
hci_dev_lock_bh(hdev);
if (!test_bit(HCI_UP, &hdev->flags)) {
err = cmd_status(sk, index, MGMT_OP_DISCONNECT, ENETDOWN);
goto failed;
}
if (mgmt_pending_find(MGMT_OP_DISCONNECT, index)) {
err = cmd_status(sk, index, MGMT_OP_DISCONNECT, EBUSY);
goto failed;
}
conn = <API key>(hdev, ACL_LINK, &cp->bdaddr);
if (!conn) {
conn = <API key>(hdev, LE_LINK, &cp->bdaddr);
if (!conn) {
err = cmd_status(sk, index, MGMT_OP_DISCONNECT,
ENOTCONN);
goto failed;
}
}
cmd = mgmt_pending_add(sk, MGMT_OP_DISCONNECT, index, data, len);
if (!cmd) {
err = -ENOMEM;
goto failed;
}
put_unaligned_le16(conn->handle, &dc.handle);
dc.reason = 0x13; /* Remote User Terminated Connection */
err = hci_send_cmd(hdev, HCI_OP_DISCONNECT, sizeof(dc), &dc);
if (err < 0)
mgmt_pending_remove(cmd);
failed:
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static u8 link_to_mgmt(u8 link_type, u8 addr_type)
{
switch (link_type) {
case LE_LINK:
switch (addr_type) {
case ADDR_LE_DEV_PUBLIC:
return MGMT_ADDR_LE_PUBLIC;
case ADDR_LE_DEV_RANDOM:
return MGMT_ADDR_LE_RANDOM;
default:
return MGMT_ADDR_INVALID;
}
case ACL_LINK:
return MGMT_ADDR_BREDR;
default:
return MGMT_ADDR_INVALID;
}
}
static int get_connections(struct sock *sk, u16 index)
{
struct <API key> *rp;
struct hci_dev *hdev;
struct list_head *p;
size_t rp_len;
u16 count;
int i, err;
BT_DBG("");
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, <API key>, ENODEV);
hci_dev_lock_bh(hdev);
count = 0;
list_for_each(p, &hdev->conn_hash.list) {
count++;
}
rp_len = sizeof(*rp) + (count * sizeof(bdaddr_t));
rp = kmalloc(rp_len, GFP_ATOMIC);
if (!rp) {
err = -ENOMEM;
goto unlock;
}
put_unaligned_le16(count, &rp->conn_count);
read_lock(&hci_dev_list_lock);
i = 0;
list_for_each(p, &hdev->conn_hash.list) {
struct hci_conn *c = list_entry(p, struct hci_conn, list);
bacpy(&rp->conn[i++], &c->dst);
}
read_unlock(&hci_dev_list_lock);
err = cmd_complete(sk, index, <API key>, rp, rp_len);
unlock:
kfree(rp);
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static int pin_code_reply(struct sock *sk, u16 index, unsigned char *data,
u16 len)
{
struct hci_dev *hdev;
struct <API key> *cp;
struct <API key> reply;
struct pending_cmd *cmd;
int err;
BT_DBG("");
cp = (void *) data;
if (len != sizeof(*cp))
return cmd_status(sk, index, <API key>, EINVAL);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, <API key>, ENODEV);
hci_dev_lock_bh(hdev);
if (!test_bit(HCI_UP, &hdev->flags)) {
err = cmd_status(sk, index, <API key>, ENETDOWN);
goto failed;
}
cmd = mgmt_pending_add(sk, <API key>, index, data, len);
if (!cmd) {
err = -ENOMEM;
goto failed;
}
bacpy(&reply.bdaddr, &cp->bdaddr);
reply.pin_len = cp->pin_len;
memcpy(reply.pin_code, cp->pin_code, 16);
err = hci_send_cmd(hdev, <API key>, sizeof(reply), &reply);
if (err < 0)
mgmt_pending_remove(cmd);
failed:
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static int encrypt_link(struct sock *sk, u16 index, unsigned char *data,
u16 len)
{
struct hci_dev *hdev;
struct <API key> *cp;
struct <API key> enc;
struct hci_conn *conn;
int err = 0;
BT_DBG("");
cp = (void *) data;
if (len != sizeof(*cp))
return cmd_status(sk, index, <API key>, EINVAL);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, <API key>, ENODEV);
hci_dev_lock_bh(hdev);
if (!test_bit(HCI_UP, &hdev->flags)) {
err = cmd_status(sk, index, <API key>, ENETDOWN);
goto done;
}
conn = <API key>(hdev, ACL_LINK, &cp->bdaddr);
if (!conn) {
err = cmd_status(sk, index, <API key>, ENOTCONN);
goto done;
}
if (test_and_set_bit(<API key>, &conn->pend)) {
err = cmd_status(sk, index, <API key>, EINPROGRESS);
goto done;
}
if (conn->link_mode & HCI_LM_AUTH) {
enc.handle = cpu_to_le16(conn->handle);
enc.encrypt = cp->enable;
err = hci_send_cmd(hdev,
<API key>, sizeof(enc), &enc);
} else {
conn->auth_initiator = 1;
if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->pend)) {
struct <API key> cp;
cp.handle = cpu_to_le16(conn->handle);
err = hci_send_cmd(conn->hdev,
<API key>, sizeof(cp), &cp);
}
}
done:
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static int pin_code_neg_reply(struct sock *sk, u16 index, unsigned char *data,
u16 len)
{
struct hci_dev *hdev;
struct <API key> *cp;
struct pending_cmd *cmd;
int err;
BT_DBG("");
cp = (void *) data;
if (len != sizeof(*cp))
return cmd_status(sk, index, <API key>,
EINVAL);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, <API key>,
ENODEV);
hci_dev_lock_bh(hdev);
if (!test_bit(HCI_UP, &hdev->flags)) {
err = cmd_status(sk, index, <API key>,
ENETDOWN);
goto failed;
}
cmd = mgmt_pending_add(sk, <API key>, index,
data, len);
if (!cmd) {
err = -ENOMEM;
goto failed;
}
err = hci_send_cmd(hdev, <API key>, sizeof(cp->bdaddr),
&cp->bdaddr);
if (err < 0)
mgmt_pending_remove(cmd);
failed:
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static int <API key>(struct sock *sk, u16 index,
unsigned char *data, u16 len)
{
struct hci_dev *hdev;
struct <API key> *cp;
int err = 0;
BT_DBG("");
cp = (void *) data;
if (len != sizeof(*cp))
return cmd_status(sk, index, <API key>,
EINVAL);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, <API key>,
ENODEV);
hci_dev_lock_bh(hdev);
if (!test_bit(HCI_UP, &hdev->flags)) {
err = cmd_status(sk, index, <API key>,
ENETDOWN);
goto failed;
}
<API key>(hdev, &cp->bdaddr);
failed:
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static int <API key>(struct sock *sk, u16 index,
unsigned char *data, u16 len)
{
struct hci_dev *hdev;
struct <API key> *cp;
int err = 0;
BT_DBG("");
cp = (void *) data;
if (len != sizeof(*cp))
return cmd_status(sk, index, <API key>,
EINVAL);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, <API key>,
ENODEV);
hci_dev_lock_bh(hdev);
if (!test_bit(HCI_UP, &hdev->flags)) {
err = cmd_status(sk, index, <API key>,
ENETDOWN);
goto failed;
}
<API key>(hdev, &cp->bdaddr);
failed:
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static int <API key>(struct sock *sk, u16 index)
{
struct hci_dev *hdev;
struct hci_conn *conn;
u8 sec_level, auth_type;
struct pending_cmd *cmd;
bdaddr_t bdaddr;
int err = 0;
BT_DBG("");
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, <API key>,
ENODEV);
hci_dev_lock_bh(hdev);
if (!test_bit(HCI_UP, &hdev->flags)) {
err = cmd_status(sk, index, <API key>,
ENETDOWN);
goto failed;
}
cmd = mgmt_pending_add(sk, <API key>, index,
NULL, 0);
if (!cmd) {
err = -ENOMEM;
goto failed;
}
sec_level = BT_SECURITY_MEDIUM;
auth_type = <API key>;
memset(&bdaddr, 0, sizeof(bdaddr));
conn = hci_le_connect(hdev, 0, BDADDR_ANY, sec_level, auth_type, NULL);
if (IS_ERR(conn)) {
err = PTR_ERR(conn);
mgmt_pending_remove(cmd);
}
failed:
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static int <API key>(struct sock *sk, u16 index)
{
struct hci_dev *hdev;
int err = 0;
BT_DBG("");
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index,
<API key>, ENODEV);
hci_dev_lock_bh(hdev);
if (!test_bit(HCI_UP, &hdev->flags)) {
err = cmd_status(sk, index,
<API key>, ENETDOWN);
goto failed;
}
<API key>(hdev, BDADDR_ANY);
failed:
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static int le_clear_white_list(struct sock *sk, u16 index)
{
struct hci_dev *hdev;
int err;
BT_DBG("");
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index,
<API key>, ENODEV);
hci_dev_lock_bh(hdev);
if (!test_bit(HCI_UP, &hdev->flags)) {
err = cmd_status(sk, index,
<API key>, ENETDOWN);
goto failed;
}
err = hci_send_cmd(hdev, <API key>, 0, NULL);
failed:
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static int set_io_capability(struct sock *sk, u16 index, unsigned char *data,
u16 len)
{
struct hci_dev *hdev;
struct <API key> *cp;
BT_DBG("");
cp = (void *) data;
if (len != sizeof(*cp))
return cmd_status(sk, index, <API key>, EINVAL);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, <API key>, ENODEV);
hci_dev_lock_bh(hdev);
hdev->io_capability = cp->io_capability;
BT_DBG("%s IO capability set to 0x%02x", hdev->name,
hdev->io_capability);
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return cmd_complete(sk, index, <API key>, NULL, 0);
}
static inline struct pending_cmd *find_pairing(struct hci_conn *conn)
{
struct hci_dev *hdev = conn->hdev;
struct list_head *p;
list_for_each(p, &cmd_list) {
struct pending_cmd *cmd;
cmd = list_entry(p, struct pending_cmd, list);
if (cmd->opcode != MGMT_OP_PAIR_DEVICE)
continue;
if (cmd->index != hdev->id)
continue;
if (cmd->user_data != conn)
continue;
return cmd;
}
return NULL;
}
static void pairing_complete(struct pending_cmd *cmd, u8 status)
{
struct mgmt_rp_pair_device rp;
struct hci_conn *conn = cmd->user_data;
BT_DBG(" %u", status);
bacpy(&rp.bdaddr, &conn->dst);
rp.status = status;
cmd_complete(cmd->sk, cmd->index, MGMT_OP_PAIR_DEVICE, &rp, sizeof(rp));
/* So we don't get further callbacks for this connection */
conn->connect_cfm_cb = NULL;
conn->security_cfm_cb = NULL;
conn->disconn_cfm_cb = NULL;
mgmt_pending_remove(cmd);
}
static void pairing_complete_cb(struct hci_conn *conn, u8 status)
{
struct pending_cmd *cmd;
BT_DBG(" %u", status);
cmd = find_pairing(conn);
if (!cmd) {
BT_DBG("Unable to find a pending command");
return;
}
pairing_complete(cmd, status);
hci_conn_put(conn);
}
static void <API key>(struct hci_conn *conn, u8 status)
{
struct pending_cmd *cmd;
BT_DBG(" %u", status);
cmd = find_pairing(conn);
if (!cmd) {
BT_DBG("Unable to find a pending command");
return;
}
if (conn->type == LE_LINK)
<API key>(conn->l2cap_data, status,
status ? 0 : 1);
else
pairing_complete(cmd, status);
}
static void <API key>(struct hci_conn *conn, u8 status)
{
struct pending_cmd *cmd;
BT_DBG("conn: %p %u", conn, status);
cmd = find_pairing(conn);
if (!cmd) {
BT_DBG("Unable to find a pending command");
return;
}
if (status || conn->pending_sec_level < BT_SECURITY_MEDIUM)
pairing_complete(cmd, status);
hci_conn_put(conn);
}
static void <API key>(struct pending_cmd *cmd, void *data)
{
struct hci_dev *hdev;
struct mgmt_mode ev = {0};
BT_DBG("");
hdev = hci_dev_get(cmd->index);
if (!hdev)
goto not_found;
del_timer(&hdev->disco_le_timer);
del_timer(&hdev->disco_timer);
hci_dev_put(hdev);
not_found:
mgmt_event(MGMT_EV_DISCOVERING, cmd->index, &ev, sizeof(ev), NULL);
list_del(&cmd->list);
mgmt_pending_free(cmd);
}
static int pair_device(struct sock *sk, u16 index, unsigned char *data, u16 len)
{
struct hci_dev *hdev;
struct mgmt_cp_pair_device *cp;
struct pending_cmd *cmd;
u8 sec_level, auth_type, io_cap;
struct hci_conn *conn;
struct adv_entry *entry;
int err;
BT_DBG("");
cp = (void *) data;
if (len != sizeof(*cp))
return cmd_status(sk, index, MGMT_OP_PAIR_DEVICE, EINVAL);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, MGMT_OP_PAIR_DEVICE, ENODEV);
hci_dev_lock_bh(hdev);
io_cap = cp->io_cap;
sec_level = BT_SECURITY_MEDIUM;
auth_type = <API key>;
entry = hci_find_adv_entry(hdev, &cp->bdaddr);
if (entry && entry->flags & 0x04) {
conn = hci_le_connect(hdev, 0, &cp->bdaddr, sec_level,
auth_type, NULL);
} else {
/* ACL-SSP does not support io_cap 0x04 (KeyboadDisplay) */
if (io_cap == 0x04)
io_cap = 0x01;
conn = hci_connect(hdev, ACL_LINK, 0, &cp->bdaddr, sec_level,
auth_type);
conn->auth_initiator = 1;
}
if (IS_ERR(conn)) {
err = PTR_ERR(conn);
goto unlock;
}
if (conn->connect_cfm_cb) {
hci_conn_put(conn);
err = cmd_status(sk, index, MGMT_OP_PAIR_DEVICE, EBUSY);
goto unlock;
}
cmd = mgmt_pending_add(sk, MGMT_OP_PAIR_DEVICE, index, data, len);
if (!cmd) {
err = -ENOMEM;
hci_conn_put(conn);
goto unlock;
}
conn->connect_cfm_cb = <API key>;
conn->security_cfm_cb = <API key>;
conn->disconn_cfm_cb = pairing_complete_cb;
conn->io_capability = io_cap;
cmd->user_data = conn;
if (conn->state == BT_CONNECTED &&
hci_conn_security(conn, sec_level, auth_type))
pairing_complete(cmd, 0);
err = 0;
unlock:
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static int user_confirm_reply(struct sock *sk, u16 index, unsigned char *data,
u16 len, u16 opcode)
{
struct <API key> *cp = (void *) data;
u16 mgmt_op = opcode, hci_op;
struct pending_cmd *cmd;
struct hci_dev *hdev;
struct hci_conn *le_conn;
int err;
BT_DBG("%d", mgmt_op);
if (mgmt_op == <API key>)
hci_op = <API key>;
else
hci_op = <API key>;
if (len < sizeof(*cp))
return cmd_status(sk, index, mgmt_op, EINVAL);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, mgmt_op, ENODEV);
hci_dev_lock_bh(hdev);
if (!test_bit(HCI_UP, &hdev->flags)) {
err = cmd_status(sk, index, mgmt_op, ENETDOWN);
goto done;
}
le_conn = <API key>(hdev, LE_LINK, &cp->bdaddr);
if (le_conn) {
err = <API key>(le_conn, mgmt_op, (void *) cp);
goto done;
}
BT_DBG("BR/EDR: %s", mgmt_op == <API key> ?
"Reject" : "Accept");
cmd = mgmt_pending_add(sk, mgmt_op, index, data, len);
if (!cmd) {
err = -ENOMEM;
goto done;
}
err = hci_send_cmd(hdev, hci_op, sizeof(cp->bdaddr), &cp->bdaddr);
if (err < 0)
mgmt_pending_remove(cmd);
done:
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static int resolve_name(struct sock *sk, u16 index, unsigned char *data,
u16 len)
{
struct <API key> *mgmt_cp = (void *) data;
struct <API key> hci_cp;
struct hci_dev *hdev;
struct pending_cmd *cmd;
int err;
BT_DBG("");
if (len != sizeof(*mgmt_cp))
return cmd_status(sk, index, <API key>, EINVAL);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, <API key>, ENODEV);
hci_dev_lock_bh(hdev);
cmd = mgmt_pending_add(sk, <API key>, index, data, len);
if (!cmd) {
err = -ENOMEM;
goto failed;
}
memset(&hci_cp, 0, sizeof(hci_cp));
bacpy(&hci_cp.bdaddr, &mgmt_cp->bdaddr);
err = hci_send_cmd(hdev, <API key>, sizeof(hci_cp),
&hci_cp);
if (err < 0)
mgmt_pending_remove(cmd);
failed:
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static int cancel_resolve_name(struct sock *sk, u16 index, unsigned char *data,
u16 len)
{
struct <API key> *mgmt_cp = (void *) data;
struct <API key> hci_cp;
struct hci_dev *hdev;
int err;
BT_DBG("");
if (len != sizeof(*mgmt_cp))
return cmd_status(sk, index, <API key>,
EINVAL);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, <API key>,
ENODEV);
hci_dev_lock_bh(hdev);
memset(&hci_cp, 0, sizeof(hci_cp));
bacpy(&hci_cp.bdaddr, &mgmt_cp->bdaddr);
err = hci_send_cmd(hdev, <API key>, sizeof(hci_cp),
&hci_cp);
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static int <API key>(struct sock *sk, u16 index,
unsigned char *data, u16 len)
{
struct <API key> *cp = (void *) data;
struct hci_dev *hdev;
struct hci_conn *conn;
int err;
BT_DBG("");
if (len != sizeof(*cp))
return cmd_status(sk, index, <API key>,
EINVAL);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, <API key>,
ENODEV);
hci_dev_lock_bh(hdev);
conn = <API key>(hdev, LE_LINK, &cp->bdaddr);
if (!conn) {
err = cmd_status(sk, index, <API key>,
ENOTCONN);
goto failed;
}
hci_le_conn_update(conn, le16_to_cpu(cp->interval_min),
le16_to_cpu(cp->interval_max),
le16_to_cpu(cp->slave_latency),
le16_to_cpu(cp->timeout_multiplier));
err = cmd_status(sk, index, <API key>, 0);
failed:
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static int read_tx_power_level(struct sock *sk, u16 index,
unsigned char *data, u16 len)
{
struct hci_dev *hdev;
struct <API key> *cp = (void *) data;
struct <API key> hci_cp;
struct pending_cmd *cmd;
struct hci_conn *conn;
int err;
BT_DBG("hci%u", index);
if (len != sizeof(*cp))
return cmd_status(sk, index,
<API key>, EINVAL);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index,
<API key>, ENODEV);
hci_dev_lock_bh(hdev);
if (!test_bit(HCI_UP, &hdev->flags)) {
err = cmd_status(sk, index,
<API key>, ENETDOWN);
goto unlock;
}
if (mgmt_pending_find(<API key>, index)) {
err = cmd_status(sk, index,
<API key>, EBUSY);
goto unlock;
}
cmd = mgmt_pending_add(sk, <API key>,
index, data, len);
if (!cmd) {
err = -ENOMEM;
goto unlock;
}
conn = <API key>(hdev, ACL_LINK, &cp->bdaddr);
if (!conn)
conn = <API key>(hdev, LE_LINK, &cp->bdaddr);
if (!conn) {
err = cmd_status(sk, index,
<API key>, ENOTCONN);
mgmt_pending_remove(cmd);
goto unlock;
}
put_unaligned_le16(conn->handle, &hci_cp.handle);
put_unaligned_le16(cp->type, &hci_cp.type);
err = hci_send_cmd(hdev, <API key>, sizeof(hci_cp), &hci_cp);
if (err < 0)
mgmt_pending_remove(cmd);
unlock:
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static int set_rssi_reporter(struct sock *sk, u16 index,
unsigned char *data, u16 len)
{
struct <API key> *cp = (void *) data;
struct hci_dev *hdev;
struct hci_conn *conn;
int err = 0;
if (len != sizeof(*cp))
return cmd_status(sk, index, <API key>,
EINVAL);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, <API key>,
ENODEV);
hci_dev_lock_bh(hdev);
conn = <API key>(hdev, LE_LINK, &cp->bdaddr);
if (!conn) {
err = cmd_status(sk, index, <API key>,
ENOTCONN);
goto failed;
}
BT_DBG("<API key> %d ", cp-><API key>);
<API key>(conn, cp->rssi_threshold,
__le16_to_cpu(cp->interval), cp-><API key>);
failed:
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static int unset_rssi_reporter(struct sock *sk, u16 index,
unsigned char *data, u16 len)
{
struct <API key> *cp = (void *) data;
struct hci_dev *hdev;
struct hci_conn *conn;
int err = 0;
if (len != sizeof(*cp))
return cmd_status(sk, index, <API key>,
EINVAL);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, <API key>,
ENODEV);
hci_dev_lock_bh(hdev);
conn = <API key>(hdev, LE_LINK, &cp->bdaddr);
if (!conn) {
err = cmd_status(sk, index, <API key>,
ENOTCONN);
goto failed;
}
<API key>(conn);
failed:
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static int <API key>(struct sock *sk, u16 index,
unsigned char *data, u16 len)
{
struct <API key> *cp = (void *) data;
struct hci_dev *hdev;
int err = 0;
if (len != sizeof(*cp))
return cmd_status(sk, index, <API key>,
EINVAL);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, <API key>,
ENODEV);
hci_dev_lock_bh(hdev);
if (!test_bit(HCI_UP, &hdev->flags)) {
err = cmd_status(sk, index, <API key>,
ENETDOWN);
goto failed;
}
<API key>(hdev, &cp->bdaddr);
failed:
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static int set_local_name(struct sock *sk, u16 index, unsigned char *data,
u16 len)
{
struct <API key> *mgmt_cp = (void *) data;
struct <API key> hci_cp;
struct hci_dev *hdev;
struct pending_cmd *cmd;
int err;
BT_DBG("");
if (len != sizeof(*mgmt_cp))
return cmd_status(sk, index, <API key>, EINVAL);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, <API key>, ENODEV);
hci_dev_lock_bh(hdev);
cmd = mgmt_pending_add(sk, <API key>, index, data, len);
if (!cmd) {
err = -ENOMEM;
goto failed;
}
memcpy(hci_cp.name, mgmt_cp->name, sizeof(hci_cp.name));
err = hci_send_cmd(hdev, <API key>, sizeof(hci_cp),
&hci_cp);
if (err < 0)
mgmt_pending_remove(cmd);
failed:
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static void discovery_rsp(struct pending_cmd *cmd, void *data)
{
struct mgmt_mode ev;
BT_DBG("");
if (cmd->opcode == <API key>) {
ev.val = 1;
cmd_status(cmd->sk, cmd->index, <API key>, 0);
} else {
ev.val = 0;
cmd_complete(cmd->sk, cmd->index, <API key>,
NULL, 0);
if (cmd->opcode == <API key>) {
struct hci_dev *hdev = hci_dev_get(cmd->index);
if (hdev) {
del_timer(&hdev->disco_le_timer);
del_timer(&hdev->disco_timer);
hci_dev_put(hdev);
}
}
}
mgmt_event(MGMT_EV_DISCOVERING, cmd->index, &ev, sizeof(ev), NULL);
list_del(&cmd->list);
mgmt_pending_free(cmd);
}
void <API key>(u16 index)
{
BT_DBG("");
<API key>(<API key>, index,
discovery_rsp, NULL);
}
void <API key>(u16 index, u8 status)
{
struct hci_dev *hdev;
struct <API key> le_cp = {1, 0};
struct mgmt_mode cp = {0};
int err = -1;
hdev = hci_dev_get(index);
if (hdev)
BT_DBG("disco_state: %d", hdev->disco_state);
if (!hdev || !lmp_le_capable(hdev)) {
<API key>(<API key>, index,
<API key>, NULL);
mgmt_event(MGMT_EV_DISCOVERING, index, &cp, sizeof(cp), NULL);
hdev->disco_state = SCAN_IDLE;
if (hdev)
goto done;
else
return;
}
if (hdev->disco_state != SCAN_IDLE) {
err = hci_send_cmd(hdev, <API key>,
sizeof(le_cp), &le_cp);
if (err >= 0) {
mod_timer(&hdev->disco_le_timer, jiffies +
msecs_to_jiffies(hdev->disco_int_phase * 1000));
hdev->disco_state = SCAN_LE;
} else
hdev->disco_state = SCAN_IDLE;
}
if (hdev->disco_state == SCAN_IDLE)
mgmt_event(MGMT_EV_DISCOVERING, index, &cp, sizeof(cp), NULL);
if (err < 0)
<API key>(<API key>, index,
<API key>, NULL);
done:
hci_dev_put(hdev);
}
void mgmt_disco_timeout(unsigned long data)
{
struct hci_dev *hdev = (void *) data;
struct pending_cmd *cmd;
struct mgmt_mode cp = {0};
BT_DBG("hci%d", hdev->id);
hdev = hci_dev_get(hdev->id);
if (!hdev)
return;
hci_dev_lock_bh(hdev);
del_timer(&hdev->disco_le_timer);
if (hdev->disco_state != SCAN_IDLE) {
struct <API key> le_cp = {0, 0};
if (test_bit(HCI_UP, &hdev->flags)) {
if (hdev->disco_state == SCAN_LE)
hci_send_cmd(hdev, <API key>,
sizeof(le_cp), &le_cp);
else
hci_send_cmd(hdev, <API key>, 0,
NULL);
}
hdev->disco_state = SCAN_IDLE;
}
mgmt_event(MGMT_EV_DISCOVERING, hdev->id, &cp, sizeof(cp), NULL);
cmd = mgmt_pending_find(<API key>, hdev->id);
if (cmd)
mgmt_pending_remove(cmd);
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
}
void <API key>(unsigned long data)
{
struct hci_dev *hdev = (void *)data;
struct <API key> le_cp = {0, 0};
BT_DBG("hci%d", hdev->id);
hdev = hci_dev_get(hdev->id);
if (!hdev)
return;
hci_dev_lock_bh(hdev);
if (test_bit(HCI_UP, &hdev->flags)) {
if (hdev->disco_state == SCAN_LE)
hci_send_cmd(hdev, <API key>,
sizeof(le_cp), &le_cp);
/* re-start BR scan */
if (hdev->disco_state != SCAN_IDLE) {
struct hci_cp_inquiry cp = {{0x33, 0x8b, 0x9e}, 4, 0};
hdev->disco_int_phase *= 2;
hdev->disco_int_count = 0;
cp.num_rsp = (u8) hdev->disco_int_phase;
hci_send_cmd(hdev, HCI_OP_INQUIRY, sizeof(cp), &cp);
hdev->disco_state = SCAN_BR;
}
}
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
}
static int start_discovery(struct sock *sk, u16 index)
{
struct hci_cp_inquiry cp = {{0x33, 0x8b, 0x9e}, 8, 0};
struct hci_dev *hdev;
struct pending_cmd *cmd;
int err;
BT_DBG("");
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, <API key>, ENODEV);
BT_DBG("disco_state: %d", hdev->disco_state);
hci_dev_lock_bh(hdev);
if (hdev->disco_state && timer_pending(&hdev->disco_timer)) {
err = -EBUSY;
goto failed;
}
cmd = mgmt_pending_add(sk, <API key>, index, NULL, 0);
if (!cmd) {
err = -ENOMEM;
goto failed;
}
/* If LE Capable, we will alternate between BR/EDR and LE */
if (lmp_le_capable(hdev)) {
struct <API key> le_cp;
/* Shorten BR scan params */
cp.num_rsp = 1;
cp.length /= 2;
/* Setup LE scan params */
memset(&le_cp, 0, sizeof(le_cp));
le_cp.type = 0x01; /* Active scanning */
/* The recommended value for scan interval and window is
* 11.25 msec. It is calculated by: time = n * 0.625 msec */
le_cp.interval = cpu_to_le16(0x0012);
le_cp.window = cpu_to_le16(0x0012);
le_cp.own_bdaddr_type = 0; /* Public address */
le_cp.filter = 0; /* Accept all adv packets */
hci_send_cmd(hdev, <API key>,
sizeof(le_cp), &le_cp);
}
err = hci_send_cmd(hdev, HCI_OP_INQUIRY, sizeof(cp), &cp);
if (err < 0) {
mgmt_pending_remove(cmd);
hdev->disco_state = SCAN_IDLE;
} else if (lmp_le_capable(hdev)) {
cmd = mgmt_pending_find(<API key>, index);
if (!cmd)
mgmt_pending_add(sk, <API key>, index,
NULL, 0);
hdev->disco_int_phase = 1;
hdev->disco_int_count = 0;
hdev->disco_state = SCAN_BR;
del_timer(&hdev->disco_le_timer);
del_timer(&hdev->disco_timer);
mod_timer(&hdev->disco_timer,
jiffies + msecs_to_jiffies(20000));
} else
hdev->disco_state = SCAN_BR;
failed:
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
if (err < 0)
return cmd_status(sk, index, <API key>, -err);
return err;
}
static int stop_discovery(struct sock *sk, u16 index)
{
struct <API key> le_cp = {0, 0};
struct mgmt_mode mode_cp = {0};
struct hci_dev *hdev;
struct pending_cmd *cmd = NULL;
int err = -EPERM;
u8 state;
BT_DBG("");
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, <API key>, ENODEV);
BT_DBG("disco_state: %d", hdev->disco_state);
hci_dev_lock_bh(hdev);
state = hdev->disco_state;
hdev->disco_state = SCAN_IDLE;
del_timer(&hdev->disco_le_timer);
del_timer(&hdev->disco_timer);
if (state == SCAN_LE) {
err = hci_send_cmd(hdev, <API key>,
sizeof(le_cp), &le_cp);
if (err >= 0) {
<API key>(<API key>, index,
<API key>, NULL);
err = cmd_complete(sk, index, <API key>,
NULL, 0);
}
} else if (state == SCAN_BR)
err = hci_send_cmd(hdev, <API key>, 0, NULL);
cmd = mgmt_pending_find(<API key>, index);
if (err < 0 && cmd)
mgmt_pending_remove(cmd);
mgmt_event(MGMT_EV_DISCOVERING, index, &mode_cp, sizeof(mode_cp), NULL);
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
if (err < 0)
return cmd_status(sk, index, <API key>, -err);
else
return err;
}
static int read_local_oob_data(struct sock *sk, u16 index)
{
struct hci_dev *hdev;
struct pending_cmd *cmd;
int err;
BT_DBG("hci%u", index);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, <API key>,
ENODEV);
hci_dev_lock_bh(hdev);
if (!test_bit(HCI_UP, &hdev->flags)) {
err = cmd_status(sk, index, <API key>,
ENETDOWN);
goto unlock;
}
if (!(hdev->features[6] & LMP_SIMPLE_PAIR)) {
err = cmd_status(sk, index, <API key>,
EOPNOTSUPP);
goto unlock;
}
if (mgmt_pending_find(<API key>, index)) {
err = cmd_status(sk, index, <API key>, EBUSY);
goto unlock;
}
cmd = mgmt_pending_add(sk, <API key>, index, NULL, 0);
if (!cmd) {
err = -ENOMEM;
goto unlock;
}
err = hci_send_cmd(hdev, <API key>, 0, NULL);
if (err < 0)
mgmt_pending_remove(cmd);
unlock:
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static int add_remote_oob_data(struct sock *sk, u16 index, unsigned char *data,
u16 len)
{
struct hci_dev *hdev;
struct <API key> *cp = (void *) data;
int err;
BT_DBG("hci%u ", index);
if (len != sizeof(*cp))
return cmd_status(sk, index, <API key>,
EINVAL);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, <API key>,
ENODEV);
hci_dev_lock_bh(hdev);
err = <API key>(hdev, &cp->bdaddr, cp->hash,
cp->randomizer);
if (err < 0)
err = cmd_status(sk, index, <API key>, -err);
else
err = cmd_complete(sk, index, <API key>, NULL,
0);
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
static int <API key>(struct sock *sk, u16 index,
unsigned char *data, u16 len)
{
struct hci_dev *hdev;
struct <API key> *cp = (void *) data;
int err;
BT_DBG("hci%u ", index);
if (len != sizeof(*cp))
return cmd_status(sk, index, <API key>,
EINVAL);
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, <API key>,
ENODEV);
hci_dev_lock_bh(hdev);
err = <API key>(hdev, &cp->bdaddr);
if (err < 0)
err = cmd_status(sk, index, <API key>,
-err);
else
err = cmd_complete(sk, index, <API key>,
NULL, 0);
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
int mgmt_control(struct sock *sk, struct msghdr *msg, size_t msglen)
{
unsigned char *buf;
struct mgmt_hdr *hdr;
u16 opcode, index, len;
int err;
BT_DBG("got %zu bytes", msglen);
if (msglen < sizeof(*hdr))
return -EINVAL;
buf = kmalloc(msglen, GFP_KERNEL);
if (!buf)
return -ENOMEM;
if (memcpy_fromiovec(buf, msg->msg_iov, msglen)) {
err = -EFAULT;
goto done;
}
hdr = (struct mgmt_hdr *) buf;
opcode = get_unaligned_le16(&hdr->opcode);
index = get_unaligned_le16(&hdr->index);
len = get_unaligned_le16(&hdr->len);
if (len != msglen - sizeof(*hdr)) {
err = -EINVAL;
goto done;
}
BT_DBG("got opcode %x", opcode);
switch (opcode) {
case <API key>:
err = read_version(sk);
break;
case <API key>:
err = read_index_list(sk);
break;
case MGMT_OP_READ_INFO:
err = <API key>(sk, index);
break;
case MGMT_OP_SET_POWERED:
err = set_powered(sk, index, buf + sizeof(*hdr), len);
break;
case <API key>:
err = set_discoverable(sk, index, buf + sizeof(*hdr), len);
break;
case <API key>:
err = <API key>(sk, index, buf + sizeof(*hdr),
len);
break;
case <API key>:
err = set_connectable(sk, index, buf + sizeof(*hdr), len);
break;
case <API key>:
err = set_pairable(sk, index, buf + sizeof(*hdr), len);
break;
case MGMT_OP_ADD_UUID:
err = add_uuid(sk, index, buf + sizeof(*hdr), len);
break;
case MGMT_OP_REMOVE_UUID:
err = remove_uuid(sk, index, buf + sizeof(*hdr), len);
break;
case <API key>:
err = set_dev_class(sk, index, buf + sizeof(*hdr), len);
break;
case <API key>:
err = set_service_cache(sk, index, buf + sizeof(*hdr), len);
break;
case MGMT_OP_LOAD_KEYS:
err = load_keys(sk, index, buf + sizeof(*hdr), len);
break;
case MGMT_OP_REMOVE_KEY:
err = remove_key(sk, index, buf + sizeof(*hdr), len);
break;
case MGMT_OP_DISCONNECT:
err = disconnect(sk, index, buf + sizeof(*hdr), len);
break;
case <API key>:
err = get_connections(sk, index);
break;
case <API key>:
err = pin_code_reply(sk, index, buf + sizeof(*hdr), len);
break;
case <API key>:
err = pin_code_neg_reply(sk, index, buf + sizeof(*hdr), len);
break;
case <API key>:
err = set_io_capability(sk, index, buf + sizeof(*hdr), len);
break;
case MGMT_OP_PAIR_DEVICE:
err = pair_device(sk, index, buf + sizeof(*hdr), len);
break;
case <API key>:
case <API key>:
case <API key>:
err = user_confirm_reply(sk, index, buf + sizeof(*hdr),
len, opcode);
break;
case <API key>:
err = set_local_name(sk, index, buf + sizeof(*hdr), len);
break;
case <API key>:
err = start_discovery(sk, index);
break;
case <API key>:
err = stop_discovery(sk, index);
break;
case <API key>:
err = resolve_name(sk, index, buf + sizeof(*hdr), len);
break;
case <API key>:
err = cancel_resolve_name(sk, index, buf + sizeof(*hdr), len);
break;
case <API key>:
err = <API key>(sk, index, buf + sizeof(*hdr), len);
break;
case <API key>:
err = set_rssi_reporter(sk, index, buf + sizeof(*hdr), len);
break;
case <API key>:
err = unset_rssi_reporter(sk, index, buf + sizeof(*hdr), len);
break;
case <API key>:
err = read_local_oob_data(sk, index);
break;
case <API key>:
err = add_remote_oob_data(sk, index, buf + sizeof(*hdr), len);
break;
case <API key>:
err = <API key>(sk, index, buf + sizeof(*hdr),
len);
break;
case <API key>:
err = encrypt_link(sk, index, buf + sizeof(*hdr), len);
break;
case <API key>:
err = <API key>(sk, index, buf + sizeof(*hdr),
len);
break;
case <API key>:
err = <API key>(sk, index, buf + sizeof(*hdr),
len);
break;
case <API key>:
err = le_clear_white_list(sk, index);
break;
case <API key>:
err = <API key>(sk, index);
break;
case <API key>:
err = <API key>(sk, index);
break;
case <API key>:
err = <API key>(sk, index, buf + sizeof(*hdr), len);
break;
case <API key>:
err = read_tx_power_level(sk, index, buf + sizeof(*hdr), len);
break;
default:
BT_DBG("Unknown op %u", opcode);
err = cmd_status(sk, index, opcode, 0x01);
break;
}
if (err < 0)
goto done;
err = msglen;
done:
kfree(buf);
return err;
}
static void cmd_status_rsp(struct pending_cmd *cmd, void *data)
{
u8 *status = data;
cmd_status(cmd->sk, cmd->index, cmd->opcode, *status);
mgmt_pending_remove(cmd);
}
int mgmt_index_added(u16 index)
{
BT_DBG("%d", index);
return mgmt_event(MGMT_EV_INDEX_ADDED, index, NULL, 0, NULL);
}
int mgmt_index_removed(u16 index)
{
u8 status = ENODEV;
BT_DBG("%d", index);
<API key>(0, index, cmd_status_rsp, &status);
return mgmt_event(<API key>, index, NULL, 0, NULL);
}
struct cmd_lookup {
u8 val;
struct sock *sk;
};
static void mode_rsp(struct pending_cmd *cmd, void *data)
{
struct mgmt_mode *cp = cmd->param;
struct cmd_lookup *match = data;
if (cp->val != match->val)
return;
send_mode_rsp(cmd->sk, cmd->opcode, cmd->index, cp->val);
list_del(&cmd->list);
if (match->sk == NULL) {
match->sk = cmd->sk;
sock_hold(match->sk);
}
mgmt_pending_free(cmd);
}
int mgmt_powered(u16 index, u8 powered)
{
struct mgmt_mode ev;
struct cmd_lookup match = { powered, NULL };
int ret;
BT_DBG("hci%u %d", index, powered);
<API key>(MGMT_OP_SET_POWERED, index, mode_rsp, &match);
if (!powered) {
u8 status = ENETDOWN;
<API key>(0, index, cmd_status_rsp, &status);
}
ev.val = powered;
ret = mgmt_event(MGMT_EV_POWERED, index, &ev, sizeof(ev), match.sk);
if (match.sk)
sock_put(match.sk);
return ret;
}
int <API key>(struct hci_dev *hdev, int err)
{
struct pending_cmd *cmd;
u8 status;
cmd = mgmt_pending_find(MGMT_OP_SET_POWERED, hdev->id);
if (!cmd)
return -ENOENT;
if (err == -ERFKILL)
status = <API key>;
else
status = MGMT_STATUS_FAILED;
err = cmd_status(cmd->sk, hdev->id, MGMT_OP_SET_POWERED, status);
mgmt_pending_remove(cmd);
return err;
}
int mgmt_discoverable(u16 index, u8 discoverable)
{
struct mgmt_mode ev;
struct cmd_lookup match = { discoverable, NULL };
int ret;
<API key>(<API key>, index, mode_rsp, &match);
ev.val = discoverable;
ret = mgmt_event(<API key>, index, &ev, sizeof(ev),
match.sk);
if (match.sk)
sock_put(match.sk);
return ret;
}
int mgmt_connectable(u16 index, u8 connectable)
{
struct mgmt_mode ev;
struct cmd_lookup match = { connectable, NULL };
int ret;
<API key>(<API key>, index, mode_rsp, &match);
ev.val = connectable;
ret = mgmt_event(MGMT_EV_CONNECTABLE, index, &ev, sizeof(ev), match.sk);
if (match.sk)
sock_put(match.sk);
return ret;
}
int mgmt_new_key(u16 index, struct link_key *key, u8 bonded)
{
struct mgmt_ev_new_key *ev;
int err, total;
total = sizeof(struct mgmt_ev_new_key) + key->dlen;
ev = kzalloc(total, GFP_ATOMIC);
if (!ev)
return -ENOMEM;
bacpy(&ev->key.bdaddr, &key->bdaddr);
ev->key.addr_type = key->addr_type;
ev->key.key_type = key->key_type;
memcpy(ev->key.val, key->val, 16);
ev->key.pin_len = key->pin_len;
ev->key.auth = key->auth;
ev->store_hint = bonded;
ev->key.dlen = key->dlen;
memcpy(ev->key.data, key->data, key->dlen);
err = mgmt_event(MGMT_EV_NEW_KEY, index, ev, total, NULL);
kfree(ev);
return err;
}
int mgmt_connected(u16 index, bdaddr_t *bdaddr, u8 le)
{
struct mgmt_ev_connected ev;
struct pending_cmd *cmd;
struct hci_dev *hdev;
BT_DBG("hci%u", index);
hdev = hci_dev_get(index);
if (!hdev)
return -ENODEV;
bacpy(&ev.bdaddr, bdaddr);
ev.le = le;
cmd = mgmt_pending_find(<API key>, index);
if (cmd) {
BT_ERR("mgmt_connected remove mgmt pending white_list");
mgmt_pending_remove(cmd);
}
return mgmt_event(MGMT_EV_CONNECTED, index, &ev, sizeof(ev), NULL);
}
int mgmt_le_conn_params(u16 index, bdaddr_t *bdaddr, u16 interval,
u16 latency, u16 timeout)
{
struct <API key> ev;
bacpy(&ev.bdaddr, bdaddr);
ev.interval = interval;
ev.latency = latency;
ev.timeout = timeout;
return mgmt_event(<API key>, index, &ev, sizeof(ev),
NULL);
}
static void disconnect_rsp(struct pending_cmd *cmd, void *data)
{
struct mgmt_cp_disconnect *cp = cmd->param;
struct sock **sk = data;
struct mgmt_rp_disconnect rp;
bacpy(&rp.bdaddr, &cp->bdaddr);
cmd_complete(cmd->sk, cmd->index, MGMT_OP_DISCONNECT, &rp, sizeof(rp));
*sk = cmd->sk;
sock_hold(*sk);
mgmt_pending_remove(cmd);
}
int mgmt_disconnected(u16 index, bdaddr_t *bdaddr, u8 reason)
{
struct <API key> ev;
struct sock *sk = NULL;
int err;
bacpy(&ev.bdaddr, bdaddr);
ev.reason = reason;
err = mgmt_event(<API key>, index, &ev, sizeof(ev), sk);
if (sk)
sock_put(sk);
<API key>(MGMT_OP_DISCONNECT, index, disconnect_rsp, &sk);
return err;
}
int <API key>(u16 index)
{
struct pending_cmd *cmd;
int err;
cmd = mgmt_pending_find(MGMT_OP_DISCONNECT, index);
if (!cmd)
return -ENOENT;
err = cmd_status(cmd->sk, index, MGMT_OP_DISCONNECT, EIO);
mgmt_pending_remove(cmd);
return err;
}
int mgmt_connect_failed(u16 index, bdaddr_t *bdaddr, u8 status)
{
struct <API key> ev;
bacpy(&ev.bdaddr, bdaddr);
ev.status = status;
return mgmt_event(<API key>, index, &ev, sizeof(ev), NULL);
}
int <API key>(u16 index, bdaddr_t *bdaddr)
{
struct <API key> ev;
BT_DBG("hci%u", index);
bacpy(&ev.bdaddr, bdaddr);
ev.secure = 0;
return mgmt_event(<API key>, index, &ev, sizeof(ev),
NULL);
}
int <API key>(u16 index, bdaddr_t *bdaddr, u8 status)
{
struct pending_cmd *cmd;
struct <API key> rp;
int err;
cmd = mgmt_pending_find(<API key>, index);
if (!cmd)
return -ENOENT;
bacpy(&rp.bdaddr, bdaddr);
rp.status = status;
err = cmd_complete(cmd->sk, index, <API key>, &rp,
sizeof(rp));
mgmt_pending_remove(cmd);
return err;
}
int <API key>(u16 index, bdaddr_t *bdaddr, u8 status)
{
struct pending_cmd *cmd;
struct <API key> rp;
int err;
cmd = mgmt_pending_find(<API key>, index);
if (!cmd)
return -ENOENT;
bacpy(&rp.bdaddr, bdaddr);
rp.status = status;
err = cmd_complete(cmd->sk, index, <API key>, &rp,
sizeof(rp));
mgmt_pending_remove(cmd);
return err;
}
int <API key>(u16 index, u8 event,
bdaddr_t *bdaddr, __le32 value)
{
struct <API key> ev;
struct hci_conn *conn = NULL;
struct hci_dev *hdev;
u8 loc_cap, rem_cap, loc_mitm, rem_mitm;
BT_DBG("hci%u", index);
hdev = hci_dev_get(index);
if (!hdev)
return -ENODEV;
conn = <API key>(hdev, ACL_LINK, bdaddr);
ev.auto_confirm = 0;
if (!conn || event != <API key>)
goto no_auto_confirm;
loc_cap = (conn->io_capability == 0x04) ? 0x01 : conn->io_capability;
rem_cap = conn->remote_cap;
loc_mitm = conn->auth_type & 0x01;
rem_mitm = conn->remote_auth & 0x01;
if ((conn->auth_type & <API key>) &&
conn->auth_initiator && rem_cap == 0x03)
ev.auto_confirm = 1;
else if (loc_cap == 0x01 && (rem_cap == 0x00 || rem_cap == 0x03)) {
if (!loc_mitm && !rem_mitm)
value = 0;
goto no_auto_confirm;
}
/* Show bonding dialog if neither side requires no bonding */
if ((conn->auth_type > 0x01) && (conn->remote_auth > 0x01)) {
if (!loc_mitm && !rem_mitm)
value = 0;
goto no_auto_confirm;
}
if ((!loc_mitm || rem_cap == 0x03) && (!rem_mitm || loc_cap == 0x03))
ev.auto_confirm = 1;
no_auto_confirm:
bacpy(&ev.bdaddr, bdaddr);
ev.event = event;
put_unaligned_le32(value, &ev.value);
hci_dev_put(hdev);
return mgmt_event(<API key>, index, &ev, sizeof(ev),
NULL);
}
int <API key>(u16 index, bdaddr_t *bdaddr)
{
struct <API key> ev;
BT_DBG("hci%u", index);
bacpy(&ev.bdaddr, bdaddr);
return mgmt_event(<API key>, index, &ev, sizeof(ev),
NULL);
}
static int <API key>(u16 index, bdaddr_t *bdaddr, u8 status,
u8 opcode)
{
struct pending_cmd *cmd;
struct <API key> rp;
int err;
cmd = mgmt_pending_find(opcode, index);
if (!cmd)
return -ENOENT;
bacpy(&rp.bdaddr, bdaddr);
rp.status = status;
err = cmd_complete(cmd->sk, index, opcode, &rp, sizeof(rp));
mgmt_pending_remove(cmd);
return err;
}
int <API key>(u16 index, bdaddr_t *bdaddr, u8 status)
{
return <API key>(index, bdaddr, status,
<API key>);
}
int <API key>(u16 index, bdaddr_t *bdaddr, u8 status)
{
return <API key>(index, bdaddr, status,
<API key>);
}
int mgmt_auth_failed(u16 index, bdaddr_t *bdaddr, u8 status)
{
struct mgmt_ev_auth_failed ev;
bacpy(&ev.bdaddr, bdaddr);
ev.status = status;
return mgmt_event(MGMT_EV_AUTH_FAILED, index, &ev, sizeof(ev), NULL);
}
int <API key>(u16 index, u8 *name, u8 status)
{
struct pending_cmd *cmd;
struct hci_dev *hdev;
struct <API key> ev;
int err;
memset(&ev, 0, sizeof(ev));
memcpy(ev.name, name, HCI_MAX_NAME_LENGTH);
cmd = mgmt_pending_find(<API key>, index);
if (!cmd)
goto send_event;
if (status) {
err = cmd_status(cmd->sk, index, <API key>, EIO);
goto failed;
}
hdev = hci_dev_get(index);
if (hdev) {
update_eir(hdev);
hci_dev_put(hdev);
}
err = cmd_complete(cmd->sk, index, <API key>, &ev,
sizeof(ev));
if (err < 0)
goto failed;
send_event:
err = mgmt_event(<API key>, index, &ev, sizeof(ev),
cmd ? cmd->sk : NULL);
failed:
if (cmd)
mgmt_pending_remove(cmd);
return err;
}
int <API key>(u16 index, u8 *hash, u8 *randomizer,
u8 status)
{
struct pending_cmd *cmd;
int err;
BT_DBG("hci%u status %u", index, status);
cmd = mgmt_pending_find(<API key>, index);
if (!cmd)
return -ENOENT;
if (status) {
err = cmd_status(cmd->sk, index, <API key>,
EIO);
} else {
struct <API key> rp;
memcpy(rp.hash, hash, sizeof(rp.hash));
memcpy(rp.randomizer, randomizer, sizeof(rp.randomizer));
err = cmd_complete(cmd->sk, index, <API key>,
&rp, sizeof(rp));
}
mgmt_pending_remove(cmd);
return err;
}
void <API key>(u16 index, s8 rssi, bdaddr_t *bdaddr,
u16 handle, u8 status)
{
struct mgmt_ev_rssi_update ev;
struct hci_conn *conn;
struct hci_dev *hdev;
if (status)
return;
hdev = hci_dev_get(index);
conn = <API key>(hdev, handle);
if (!conn)
return;
BT_DBG("<API key> : %d ",
conn-><API key>);
BT_DBG("RSSI Threshold : %d , recvd RSSI : %d ",
conn->rssi_threshold, rssi);
if (conn-><API key> == 1) {
BT_DBG("<API key> == 1");
if (rssi > conn->rssi_threshold) {
memset(&ev, 0, sizeof(ev));
bacpy(&ev.bdaddr, bdaddr);
ev.rssi = rssi;
mgmt_event(MGMT_EV_RSSI_UPDATE, index, &ev,
sizeof(ev), NULL);
} else {
<API key>(conn, conn->rssi_threshold,
conn-><API key>,
conn-><API key>);
}
} else {
BT_DBG("<API key> == 0");
if (rssi < conn->rssi_threshold) {
memset(&ev, 0, sizeof(ev));
bacpy(&ev.bdaddr, bdaddr);
ev.rssi = rssi;
mgmt_event(MGMT_EV_RSSI_UPDATE, index, &ev,
sizeof(ev), NULL);
} else {
<API key>(conn, conn->rssi_threshold,
conn-><API key>,
conn-><API key>);
}
}
}
int <API key>(u16 index)
{
struct pending_cmd *cmd;
int err;
cmd = mgmt_pending_find(<API key>, index);
if (!cmd)
return -ENOENT;
err = cmd_status(cmd->sk, index, <API key>, EIO);
mgmt_pending_remove(cmd);
return err;
}
int <API key>(u16 index, bdaddr_t *bdaddr, s8 level,
u8 status)
{
struct pending_cmd *cmd;
struct <API key> rp;
int err;
cmd = mgmt_pending_find(<API key>, index);
if (!cmd)
return -ENOENT;
bacpy(&rp.bdaddr, bdaddr);
rp.status = status;
rp.level = level;
err = cmd_complete(cmd->sk, index, <API key>, &rp,
sizeof(rp));
mgmt_pending_remove(cmd);
return err;
}
int mgmt_device_found(u16 index, bdaddr_t *bdaddr, u8 link_type, u8 addr_type,
u8 le, u8 *dev_class, s8 rssi, u8 eir_len, u8 *eir)
{
struct <API key> ev;
struct hci_dev *hdev;
int err;
BT_DBG("le: %d", le);
memset(&ev, 0, sizeof(ev));
bacpy(&ev.addr.bdaddr, bdaddr);
ev.addr.type = link_to_mgmt(link_type, addr_type);
ev.rssi = rssi;
ev.le = le;
if (dev_class)
memcpy(ev.dev_class, dev_class, sizeof(ev.dev_class));
if (eir && eir_len)
memcpy(ev.eir, eir, eir_len);
err = mgmt_event(<API key>, index, &ev, sizeof(ev), NULL);
if (err < 0)
return err;
hdev = hci_dev_get(index);
if (!hdev)
return 0;
if (hdev->disco_state == SCAN_IDLE)
goto done;
hdev->disco_int_count++;
if (hdev->disco_int_count >= hdev->disco_int_phase) {
/* Inquiry scan for General Discovery LAP */
struct hci_cp_inquiry cp = {{0x33, 0x8b, 0x9e}, 4, 0};
struct <API key> le_cp = {0, 0};
hdev->disco_int_phase *= 2;
hdev->disco_int_count = 0;
if (hdev->disco_state == SCAN_LE) {
/* cancel LE scan */
hci_send_cmd(hdev, <API key>,
sizeof(le_cp), &le_cp);
/* start BR scan */
cp.num_rsp = (u8) hdev->disco_int_phase;
hci_send_cmd(hdev, HCI_OP_INQUIRY,
sizeof(cp), &cp);
hdev->disco_state = SCAN_BR;
del_timer_sync(&hdev->disco_le_timer);
}
}
done:
hci_dev_put(hdev);
return 0;
}
int mgmt_remote_name(u16 index, bdaddr_t *bdaddr, u8 status, u8 *name)
{
struct mgmt_ev_remote_name ev;
memset(&ev, 0, sizeof(ev));
bacpy(&ev.bdaddr, bdaddr);
ev.status = status;
memcpy(ev.name, name, HCI_MAX_NAME_LENGTH);
return mgmt_event(MGMT_EV_REMOTE_NAME, index, &ev, sizeof(ev), NULL);
}
int mgmt_encrypt_change(u16 index, bdaddr_t *bdaddr, u8 status)
{
struct <API key> ev;
BT_DBG("hci%u", index);
bacpy(&ev.bdaddr, bdaddr);
ev.status = status;
return mgmt_event(<API key>, index, &ev, sizeof(ev),
NULL);
}
int mgmt_remote_class(u16 index, bdaddr_t *bdaddr, u8 dev_class[3])
{
struct <API key> ev;
memset(&ev, 0, sizeof(ev));
bacpy(&ev.bdaddr, bdaddr);
memcpy(ev.dev_class, dev_class, 3);
return mgmt_event(<API key>, index, &ev, sizeof(ev), NULL);
}
int mgmt_remote_version(u16 index, bdaddr_t *bdaddr, u8 ver, u16 mnf,
u16 sub_ver)
{
struct <API key> ev;
memset(&ev, 0, sizeof(ev));
bacpy(&ev.bdaddr, bdaddr);
ev.lmp_ver = ver;
ev.manufacturer = mnf;
ev.lmp_subver = sub_ver;
return mgmt_event(<API key>, index, &ev, sizeof(ev), NULL);
}
int <API key>(u16 index, bdaddr_t *bdaddr, u8 features[8])
{
struct <API key> ev;
memset(&ev, 0, sizeof(ev));
bacpy(&ev.bdaddr, bdaddr);
memcpy(ev.features, features, sizeof(ev.features));
return mgmt_event(<API key>, index, &ev, sizeof(ev),
NULL);
}
|
#ifndef <API key>
#define <API key>
#include <WebCore/LoaderStrategy.h>
#include <WebCore/PlatformStrategies.h>
namespace WebKit {
class <API key> : public WebCore::PlatformStrategies {
public:
static void initialize();
private:
// WebCore::PlatformStrategies
WebCore::CookiesStrategy* <API key>() override;
WebCore::LoaderStrategy* <API key>() override;
WebCore::PasteboardStrategy* <API key>() override;
WebCore::PluginStrategy* <API key>() override;
WebCore::BlobRegistry* createBlobRegistry() override;
};
} // namespace WebKit
#endif // <API key>
|
cmd_arch/arm/vfp/entry.o := /home/milind/toolchain/arm-eabi-4.6/bin/arm-eabi-gcc -Wp,-MD,arch/arm/vfp/.entry.o.d -nostdinc -isystem /home/milind/toolchain/arm-eabi-4.6/bin/../lib/gcc/arm-eabi/4.6.x-google/include -I/home/milind/work/kernel/<API key>/arch/arm/include -Iarch/arm/include/generated -Iinclude -include include/generated/autoconf.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-capri/include -Iarch/arm/plat-kona/include -D__ASSEMBLY__ -mabi=aapcs-linux -mno-thumb-interwork -funwind-tables -D__LINUX_ARM_ARCH__=7 -march=armv7-a -include asm/unified.h -mfpu=vfp3 -mfloat-abi=softfp -gdwarf-2 -c -o arch/arm/vfp/entry.o arch/arm/vfp/entry.S
source_arch/arm/vfp/entry.o := arch/arm/vfp/entry.S
deps_arch/arm/vfp/entry.o := \
$(wildcard include/config/preempt.h) \
/home/milind/work/kernel/<API key>/arch/arm/include/asm/unified.h \
$(wildcard include/config/arm/asm/unified.h) \
$(wildcard include/config/thumb2/kernel.h) \
/home/milind/work/kernel/<API key>/arch/arm/include/asm/thread_info.h \
$(wildcard include/config/arm/thumbee.h) \
include/linux/compiler.h \
$(wildcard include/config/sparse/rcu/pointer.h) \
$(wildcard include/config/trace/branch/profiling.h) \
$(wildcard include/config/profile/all/branches.h) \
$(wildcard include/config/enable/must/check.h) \
$(wildcard include/config/enable/warn/deprecated.h) \
/home/milind/work/kernel/<API key>/arch/arm/include/asm/fpstate.h \
$(wildcard include/config/vfpv3.h) \
$(wildcard include/config/smp.h) \
$(wildcard include/config/iwmmxt.h) \
/home/milind/work/kernel/<API key>/arch/arm/include/asm/vfpmacros.h \
/home/milind/work/kernel/<API key>/arch/arm/include/asm/hwcap.h \
/home/milind/work/kernel/<API key>/arch/arm/include/asm/vfp.h \
arch/arm/vfp/../kernel/entry-header.S \
$(wildcard include/config/frame/pointer.h) \
$(wildcard include/config/alignment/trap.h) \
$(wildcard include/config/cpu/v6.h) \
$(wildcard include/config/cpu/32v6k.h) \
$(wildcard include/config/have/hw/breakpoint.h) \
include/linux/init.h \
$(wildcard include/config/modules.h) \
$(wildcard include/config/hotplug.h) \
include/linux/linkage.h \
/home/milind/work/kernel/<API key>/arch/arm/include/asm/linkage.h \
/home/milind/work/kernel/<API key>/arch/arm/include/asm/assembler.h \
$(wildcard include/config/cpu/feroceon.h) \
$(wildcard include/config/trace/irqflags.h) \
/home/milind/work/kernel/<API key>/arch/arm/include/asm/ptrace.h \
$(wildcard include/config/cpu/endian/be8.h) \
$(wildcard include/config/arm/thumb.h) \
/home/milind/work/kernel/<API key>/arch/arm/include/asm/domain.h \
$(wildcard include/config/io/36.h) \
$(wildcard include/config/cpu/use/domains.h) \
/home/milind/work/kernel/<API key>/arch/arm/include/asm/asm-offsets.h \
include/generated/asm-offsets.h \
/home/milind/work/kernel/<API key>/arch/arm/include/asm/errno.h \
include/asm-generic/errno.h \
include/asm-generic/errno-base.h \
arch/arm/vfp/entry.o: $(deps_arch/arm/vfp/entry.o)
$(deps_arch/arm/vfp/entry.o):
|
package org.xmlvm.ios;
import java.util.*;
import org.xmlvm.XMLVMSkeletonOnly;
@XMLVMSkeletonOnly
public class CFGregorianDate {
/*
* Variables
*/
public int year;
public byte month;
public byte day;
public byte hour;
public byte minute;
public double second;
/*
* Constructors
*/
/** Default constructor */
CFGregorianDate() {}
/*
* Instance methods
*/
/**
* Boolean <API key>(CFGregorianDate gdate, CFOptionFlags unitFlags);
*/
public byte isValid(long unitFlags){
throw new RuntimeException("Stub");
}
/**
* CFAbsoluteTime <API key>(CFGregorianDate gdate, CFTimeZoneRef tz);
*/
public double getAbsoluteTime(NSTimeZone tz){
throw new RuntimeException("Stub");
}
}
|
#include "IpcClient.h"
#include <QTcpSocket>
#include <QHostAddress>
#include <iostream>
#include <QTimer>
#include "IpcReader.h"
#include "Ipc.h"
IpcClient::IpcClient() :
m_ReaderStarted(false),
m_Enabled(false)
{
m_Socket = new QTcpSocket(this);
connect(m_Socket, SIGNAL(connected()), this, SLOT(connected()));
connect(m_Socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(error(QAbstractSocket::SocketError)));
m_Reader = new IpcReader(m_Socket);
connect(m_Reader, SIGNAL(readLogLine(const QString&)), this, SLOT(handleReadLogLine(const QString&)));
}
IpcClient::~IpcClient()
{
}
void IpcClient::connected()
{
char typeBuf[1];
typeBuf[0] = kIpcClientGui;
sendHello();
infoMessage("connection established");
}
void IpcClient::connectToHost()
{
m_Enabled = true;
infoMessage("connecting to service...");
m_Socket->connectToHost(QHostAddress(QHostAddress::LocalHost), IPC_PORT);
if (!m_ReaderStarted) {
m_Reader->start();
m_ReaderStarted = true;
}
}
void IpcClient::disconnectFromHost()
{
infoMessage("service disconnect");
m_Reader->stop();
m_Socket->close();
}
void IpcClient::error(QAbstractSocket::SocketError error)
{
QString text;
switch (error) {
case 0: text = "connection refused"; break;
case 1: text = "remote host closed"; break;
default: text = QString("code=%1").arg(error); break;
}
errorMessage(QString("ipc connection error, %1").arg(text));
QTimer::singleShot(1000, this, SLOT(retryConnect()));
}
void IpcClient::retryConnect()
{
if (m_Enabled) {
connectToHost();
}
}
void IpcClient::sendHello()
{
QDataStream stream(m_Socket);
stream.writeRawData(kIpcMsgHello, 4);
char typeBuf[1];
typeBuf[0] = kIpcClientGui;
stream.writeRawData(typeBuf, 1);
}
void IpcClient::sendCommand(const QString& command, bool elevate)
{
QDataStream stream(m_Socket);
stream.writeRawData(kIpcMsgCommand, 4);
std::string stdStringCommand = command.toStdString();
const char* charCommand = stdStringCommand.c_str();
int length = strlen(charCommand);
char lenBuf[4];
intToBytes(length, lenBuf, 4);
stream.writeRawData(lenBuf, 4);
stream.writeRawData(charCommand, length);
char elevateBuf[1];
elevateBuf[0] = elevate ? 1 : 0;
stream.writeRawData(elevateBuf, 1);
}
void IpcClient::handleReadLogLine(const QString& text)
{
readLogLine(text);
}
// TODO: qt must have a built in way of converting int to bytes.
void IpcClient::intToBytes(int value, char *buffer, int size)
{
if (size == 1) {
buffer[0] = value & 0xff;
}
else if (size == 2) {
buffer[0] = (value >> 8) & 0xff;
buffer[1] = value & 0xff;
}
else if (size == 4) {
buffer[0] = (value >> 24) & 0xff;
buffer[1] = (value >> 16) & 0xff;
buffer[2] = (value >> 8) & 0xff;
buffer[3] = value & 0xff;
}
else {
// TODO: other sizes, if needed.
}
}
|
#if UNITY_4_3 || UNITY_4_3_0 || UNITY_4_3_1
#define UNITY_4_3
#elif UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2
#define UNITY_4
#elif UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5
#define UNITY_3
#endif
using UnityEngine;
using UnityEditor;
using System.Collections;
using ProBuilder2.Common;
using ProBuilder2.MeshOperations;
using ProBuilder2.EditorEnum;
namespace ProBuilder2.Actions
{
public class ExtrudeFace : Editor
{
const int EXTRUDE = 100;
[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Geometry/Extrude %#e", false, EXTRUDE + 1)]
public static void <API key>()
{
PerformExtrusion(0f);
}
[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Geometry/Extrude with Translation %e", false, EXTRUDE)]
public static void Extrude()
{
PerformExtrusion(.25f);
}
private static void PerformExtrusion(float dist)
{
SelectMode mode = pb_Editor.instance.GetSelectionMode();
pb_Object[] pbs = pbUtil.GetComponents<pb_Object>(Selection.transforms);
#if !UNITY_4_3
Undo.RegisterUndo(pbUtil.GetComponents<pb_Object>(Selection.transforms), "extrude selected.");
#else
Undo.RecordObjects(pbUtil.GetComponents<pb_Object>(Selection.transforms), "extrude selected.");
#endif
int extrudedFaceCount = 0;
foreach(pb_Object pb in pbs)
{
switch(mode)
{
case SelectMode.Face:
if(pb.selected_faces.Length < 1)
continue;
extrudedFaceCount += pb.selected_faces.Length;
pb.Extrude(pb.selected_faces, dist);
break;
case SelectMode.Edge:
if(pb.selected_edges.Length < 1)
continue;
pb_Edge[] newEdges = pb.Extrude(pb.selected_edges, dist, <API key>.GetBool(pb_Constant.<API key>));
if(newEdges != null)
{
extrudedFaceCount += pb.selected_edges.Length;
pb.selected_edges = newEdges;
pb.selected_triangles = pb.<API key>( pb.selected_edges.ToIntArray() );
}
break;
}
pb.GenerateUV2(true);
}
if(extrudedFaceCount > 0)
{
string val = "";
if(mode == SelectMode.Edge)
val = (extrudedFaceCount > 1 ? extrudedFaceCount + " Edges" : "Edge");
else
val = (extrudedFaceCount > 1 ? extrudedFaceCount + " Faces" : "Face");
pb_Editor_Utility.ShowNotification("Extrude " + val, "Extrudes the selected faces / edges.");
}
if(pb_Editor.instance)
pb_Editor.instance.UpdateSelection();
}
}
}
|
package com.openkm.frontend.client.bean;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* @author jllort
*
*/
public class GWTUserConfig implements IsSerializable {
private String user = "";
private String homePath = "";
private String homeType = "";
private String homeNode = "";
/**
* GWTUserConfig
*/
public GWTUserConfig() {
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public String getHomePath() {
return homePath;
}
public void setHomePath(String homePath) {
this.homePath = homePath;
}
public String getHomeType() {
return homeType;
}
public void setHomeType(String homeType) {
this.homeType = homeType;
}
public String getHomeNode() {
return homeNode;
}
public void setHomeNode(String homeNode) {
this.homeNode = homeNode;
}
}
|
#ifndef __STDDEF
#define __STDDEF
/* $Id: stddef.h,v 1.1 2002/08/28 23:59:20 drh Exp $ */
#ifndef NULL
#define NULL ((void*)0)
#endif
#define offsetof(ty,mem) ((size_t)((char*)&((ty*)0)->mem - (char*)0))
typedef long ptrdiff_t;
#if !defined(_SIZE_T) && !defined(_SIZE_T_) && !defined(_SIZE_T_DEFINED)
#define _SIZE_T
#define _SIZE_T_
#define _SIZE_T_DEFINED
typedef unsigned long size_t;
#endif
#if !defined(_WCHAR_T) && !defined(_WCHAR_T_) && !defined(_WCHAR_T_DEFINED)
#define _WCHAR_T
#define _WCHAR_T_
#define _WCHAR_T_DEFINED
#if (_WCHAR_T_SIZE + 0) == 1
typedef unsigned char wchar_t;
#elif (_WCHAR_T_SIZE + 0) == 2
typedef unsigned short wchar_t;
#elif (_WCHAR_T_SIZE + 0) == 4
typedef unsigned int wchar_t;
#else
typedef unsigned short wchar_t;
#endif
#endif
#endif /* __STDDEF */
|
/*!
@File
@Title System Description Header
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description This header provides system-specific declarations and macros
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
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.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) 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; AND (B) 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.
*/
#if !defined(__APOLLO_H__)
#define __APOLLO_H__
#define TC_SYSTEM_NAME "Rogue Test Chip"
/* Valid values for the TC_MEMORY_CONFIG configuration option */
#define TC_MEMORY_LOCAL (1)
#define TC_MEMORY_HOST (2)
#define TC_MEMORY_HYBRID (3)
#define <API key> (4)
#define <API key> (90000000)
#define <API key> (65000000)
#if defined(<API key>) || defined(<API key>)
/* Memory reserved for use by the PDP DC. */
#define <API key> (32 * 1024 * 1024)
#endif
#if defined(SUPPORT_ION)
/* Memory reserved for use by ion. */
#define <API key> (384 * 1024 * 1024)
#endif
/* Apollo reg on base register 0 */
#define <API key> (0)
#define <API key> (0x00010000)
#define <API key> (0x0000)
#define <API key> (0x0400)
#define <API key> (0x1000)
#define <API key> (0x0400)
#define <API key> (0x4050)
#define <API key> (0x0014)
#define <API key> (0xC000)
#define <API key> (0x0400)
/* Offsets for flashing Apollo PROMs from base 0 */
#define <API key> (0x4058)
#define <API key> (0x4050)
#define <API key> (0x4060)
#define <API key> (0xF)
#define <API key> (0)
#define <API key> (0xF)
#define <API key> (16)
#define <API key> (0x1)
#define <API key> (0x2)
#define <API key> (0x4)
#define <API key> (0x8)
#define <API key> (8)
/* RGX reg on base register 1 */
#define <API key> (1)
#define <API key> (0x00004000)
/* Device memory (including HP mapping) on base register 2 */
#define <API key> (2)
/* number of bytes that are broken */
#define <API key> (1024 * 1024)
#define <API key> (0x40000000 - <API key>)
#endif /* if !defined(__APOLLO_H__) */
|
/* $Id: PDMDevHlp.cpp $ */
/** @file
* PDM - Pluggable Device and Driver Manager, Device Helpers.
*/
#define LOG_GROUP <API key>
#include "PDMInternal.h"
#include <VBox/vmm/pdm.h>
#include <VBox/vmm/mm.h>
#include <VBox/vmm/hm.h>
#include <VBox/vmm/pgm.h>
#include <VBox/vmm/iom.h>
#ifdef VBOX_WITH_REM
# include <VBox/vmm/rem.h>
#endif
#include <VBox/vmm/dbgf.h>
#include <VBox/vmm/vmapi.h>
#include <VBox/vmm/vm.h>
#include <VBox/vmm/uvm.h>
#include <VBox/vmm/vmm.h>
#include <VBox/version.h>
#include <VBox/log.h>
#include <VBox/err.h>
#include <iprt/asm.h>
#include <iprt/assert.h>
#include <iprt/ctype.h>
#include <iprt/string.h>
#include <iprt/thread.h>
#include "dtrace/VBoxVMM.h"
#include "PDMInline.h"
/** @def <API key>
* Define this to enable the deadlock detection when accessing physical memory.
*/
#if /*defined(DEBUG_bird) ||*/ defined(DOXYGEN_RUNNING)
# define <API key> /**< @todo enable DevHlp deadlock detection! */
#endif
/**
* Wrapper around <API key>.
*/
DECLINLINE(int) <API key>(PPDMDEVINS pDevIns, const char *pszSymbol, PRTRCPTR ppvValue)
{
PVM pVM = pDevIns->Internal.s.pVMR3;
if (HMIsEnabled(pVM))
{
*ppvValue = NIL_RTRCPTR;
return VINF_SUCCESS;
}
return <API key>(pVM,
pDevIns->Internal.s.pDevR3->pReg->szRCMod,
pDevIns->Internal.s.pDevR3->pszRCSearchPath,
pszSymbol, ppvValue);
}
/**
* Wrapper around <API key>.
*/
DECLINLINE(int) <API key>(PPDMDEVINS pDevIns, const char *pszSymbol, PRTR0PTR ppvValue)
{
return <API key>(pDevIns->Internal.s.pVMR3,
pDevIns->Internal.s.pDevR3->pReg->szR0Mod,
pDevIns->Internal.s.pDevR3->pszR0SearchPath,
pszSymbol, ppvValue);
}
/** @name R3 DevHlp
* @{
*/
/** @<API key>{PDMDEVHLPR3,pfnIOPortRegister} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts, RTHCPTR pvUser, PFNIOMIOPORTOUT pfnOut, PFNIOMIOPORTIN pfnIn,
<API key> pfnOutStr, <API key> pfnInStr, const char *pszDesc)
{
<API key>(pDevIns);
LogFlow(("<API key>: caller='%s'/%d: Port=%#x cPorts=%#x pvUser=%p pfnOut=%p pfnIn=%p pfnOutStr=%p pfnInStr=%p p32_tszDesc=%p:{%s}\n", pDevIns->pReg->szName, pDevIns->iInstance,
Port, cPorts, pvUser, pfnOut, pfnIn, pfnOutStr, pfnInStr, pszDesc, pszDesc));
VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
#if 0 /** @todo needs a real string cache for this */
if (pDevIns->iInstance > 0)
{
char *pszDesc2 = MMR3HeapAPrintf(pVM, <API key>, "%s [%u]", pszDesc, pDevIns->iInstance);
if (pszDesc2)
pszDesc = pszDesc2;
}
#endif
int rc = <API key>(pDevIns->Internal.s.pVMR3, pDevIns, Port, cPorts, pvUser,
pfnOut, pfnIn, pfnOutStr, pfnInStr, pszDesc);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnIOPortRegisterRC} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts, RTRCPTR pvUser,
const char *pszOut, const char *pszIn,
const char *pszOutStr, const char *pszInStr, const char *pszDesc)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
LogFlow(("<API key>: caller='%s'/%d: Port=%#x cPorts=%#x pvUser=%p pszOut=%p:{%s} pszIn=%p:{%s} pszOutStr=%p:{%s} pszInStr=%p:{%s} pszDesc=%p:{%s}\n", pDevIns->pReg->szName, pDevIns->iInstance,
Port, cPorts, pvUser, pszOut, pszOut, pszIn, pszIn, pszOutStr, pszOutStr, pszInStr, pszInStr, pszDesc, pszDesc));
/*
* Resolve the functions (one of the can be NULL).
*/
int rc = VINF_SUCCESS;
if ( pDevIns->pReg->szRCMod[0]
&& (pDevIns->pReg->fFlags & PDM_DEVREG_FLAGS_RC)
&& !HMIsEnabled(pVM))
{
RTRCPTR RCPtrIn = NIL_RTRCPTR;
if (pszIn)
{
rc = <API key>(pDevIns, pszIn, &RCPtrIn);
AssertMsgRC(rc, ("Failed to resolve %s.%s (pszIn)\n", pDevIns->pReg->szRCMod, pszIn));
}
RTRCPTR RCPtrOut = NIL_RTRCPTR;
if (pszOut && RT_SUCCESS(rc))
{
rc = <API key>(pDevIns, pszOut, &RCPtrOut);
AssertMsgRC(rc, ("Failed to resolve %s.%s (pszOut)\n", pDevIns->pReg->szRCMod, pszOut));
}
RTRCPTR RCPtrInStr = NIL_RTRCPTR;
if (pszInStr && RT_SUCCESS(rc))
{
rc = <API key>(pDevIns, pszInStr, &RCPtrInStr);
AssertMsgRC(rc, ("Failed to resolve %s.%s (pszInStr)\n", pDevIns->pReg->szRCMod, pszInStr));
}
RTRCPTR RCPtrOutStr = NIL_RTRCPTR;
if (pszOutStr && RT_SUCCESS(rc))
{
rc = <API key>(pDevIns, pszOutStr, &RCPtrOutStr);
AssertMsgRC(rc, ("Failed to resolve %s.%s (pszOutStr)\n", pDevIns->pReg->szRCMod, pszOutStr));
}
if (RT_SUCCESS(rc))
{
#if 0 /** @todo needs a real string cache for this */
if (pDevIns->iInstance > 0)
{
char *pszDesc2 = MMR3HeapAPrintf(pVM, <API key>, "%s [%u]", pszDesc, pDevIns->iInstance);
if (pszDesc2)
pszDesc = pszDesc2;
}
#endif
rc = <API key>(pVM, pDevIns, Port, cPorts, pvUser, RCPtrOut, RCPtrIn, RCPtrOutStr, RCPtrInStr, pszDesc);
}
}
else if (!HMIsEnabled(pVM))
{
AssertMsgFailed(("No RC module for this driver!\n"));
rc = <API key>;
}
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnIOPortRegisterR0} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts, RTR0PTR pvUser,
const char *pszOut, const char *pszIn,
const char *pszOutStr, const char *pszInStr, const char *pszDesc)
{
<API key>(pDevIns);
VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
LogFlow(("<API key>: caller='%s'/%d: Port=%#x cPorts=%#x pvUser=%p pszOut=%p:{%s} pszIn=%p:{%s} pszOutStr=%p:{%s} pszInStr=%p:{%s} pszDesc=%p:{%s}\n", pDevIns->pReg->szName, pDevIns->iInstance,
Port, cPorts, pvUser, pszOut, pszOut, pszIn, pszIn, pszOutStr, pszOutStr, pszInStr, pszInStr, pszDesc, pszDesc));
/*
* Resolve the functions (one of the can be NULL).
*/
int rc = VINF_SUCCESS;
if ( pDevIns->pReg->szR0Mod[0]
&& (pDevIns->pReg->fFlags & PDM_DEVREG_FLAGS_R0))
{
R0PTRTYPE(PFNIOMIOPORTIN) pfnR0PtrIn = 0;
if (pszIn)
{
rc = <API key>(pDevIns, pszIn, &pfnR0PtrIn);
AssertMsgRC(rc, ("Failed to resolve %s.%s (pszIn)\n", pDevIns->pReg->szR0Mod, pszIn));
}
R0PTRTYPE(PFNIOMIOPORTOUT) pfnR0PtrOut = 0;
if (pszOut && RT_SUCCESS(rc))
{
rc = <API key>(pDevIns, pszOut, &pfnR0PtrOut);
AssertMsgRC(rc, ("Failed to resolve %s.%s (pszOut)\n", pDevIns->pReg->szR0Mod, pszOut));
}
R0PTRTYPE(<API key>) pfnR0PtrInStr = 0;
if (pszInStr && RT_SUCCESS(rc))
{
rc = <API key>(pDevIns, pszInStr, &pfnR0PtrInStr);
AssertMsgRC(rc, ("Failed to resolve %s.%s (pszInStr)\n", pDevIns->pReg->szR0Mod, pszInStr));
}
R0PTRTYPE(<API key>) pfnR0PtrOutStr = 0;
if (pszOutStr && RT_SUCCESS(rc))
{
rc = <API key>(pDevIns, pszOutStr, &pfnR0PtrOutStr);
AssertMsgRC(rc, ("Failed to resolve %s.%s (pszOutStr)\n", pDevIns->pReg->szR0Mod, pszOutStr));
}
if (RT_SUCCESS(rc))
{
#if 0 /** @todo needs a real string cache for this */
if (pDevIns->iInstance > 0)
{
char *pszDesc2 = MMR3HeapAPrintf(pVM, <API key>, "%s [%u]", pszDesc, pDevIns->iInstance);
if (pszDesc2)
pszDesc = pszDesc2;
}
#endif
rc = <API key>(pDevIns->Internal.s.pVMR3, pDevIns, Port, cPorts, pvUser, pfnR0PtrOut, pfnR0PtrIn, pfnR0PtrOutStr, pfnR0PtrInStr, pszDesc);
}
}
else
{
AssertMsgFailed(("No R0 module for this driver!\n"));
rc = <API key>;
}
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnIOPortDeregister} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts)
{
<API key>(pDevIns);
VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
LogFlow(("<API key>: caller='%s'/%d: Port=%#x cPorts=%#x\n", pDevIns->pReg->szName, pDevIns->iInstance,
Port, cPorts));
int rc = <API key>(pDevIns->Internal.s.pVMR3, pDevIns, Port, cPorts);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnMMIORegister} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, uint32_t cbRange, RTHCPTR pvUser,
PFNIOMMMIOWRITE pfnWrite, PFNIOMMMIOREAD pfnRead, PFNIOMMMIOFILL pfnFill,
uint32_t fFlags, const char *pszDesc)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
LogFlow(("<API key>: caller='%s'/%d: GCPhysStart=%RGp cbRange=%#x pvUser=%p pfnWrite=%p pfnRead=%p pfnFill=%p fFlags=%#x pszDesc=%p:{%s}\n",
pDevIns->pReg->szName, pDevIns->iInstance, GCPhysStart, cbRange, pvUser, pfnWrite, pfnRead, pfnFill, pszDesc, fFlags, pszDesc));
if (pDevIns->iInstance > 0)
{
char *pszDesc2 = MMR3HeapAPrintf(pVM, <API key>, "%s [%u]", pszDesc, pDevIns->iInstance);
if (pszDesc2)
pszDesc = pszDesc2;
}
int rc = IOMR3MmioRegisterR3(pVM, pDevIns, GCPhysStart, cbRange, pvUser,
pfnWrite, pfnRead, pfnFill, fFlags, pszDesc);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnMMIORegisterRC} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, uint32_t cbRange, RTRCPTR pvUser,
const char *pszWrite, const char *pszRead, const char *pszFill)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
LogFlow(("<API key>: caller='%s'/%d: GCPhysStart=%RGp cbRange=%#x pvUser=%p pszWrite=%p:{%s} pszRead=%p:{%s} pszFill=%p:{%s}\n",
pDevIns->pReg->szName, pDevIns->iInstance, GCPhysStart, cbRange, pvUser, pszWrite, pszWrite, pszRead, pszRead, pszFill, pszFill));
/*
* Resolve the functions.
* Not all function have to present, leave it to IOM to enforce this.
*/
int rc = VINF_SUCCESS;
if ( pDevIns->pReg->szRCMod[0]
&& (pDevIns->pReg->fFlags & PDM_DEVREG_FLAGS_RC)
&& !HMIsEnabled(pVM))
{
RTRCPTR RCPtrWrite = NIL_RTRCPTR;
if (pszWrite)
rc = <API key>(pDevIns, pszWrite, &RCPtrWrite);
RTRCPTR RCPtrRead = NIL_RTRCPTR;
int rc2 = VINF_SUCCESS;
if (pszRead)
rc2 = <API key>(pDevIns, pszRead, &RCPtrRead);
RTRCPTR RCPtrFill = NIL_RTRCPTR;
int rc3 = VINF_SUCCESS;
if (pszFill)
rc3 = <API key>(pDevIns, pszFill, &RCPtrFill);
if (RT_SUCCESS(rc) && RT_SUCCESS(rc2) && RT_SUCCESS(rc3))
rc = IOMR3MmioRegisterRC(pVM, pDevIns, GCPhysStart, cbRange, pvUser, RCPtrWrite, RCPtrRead, RCPtrFill);
else
{
AssertMsgRC(rc, ("Failed to resolve %s.%s (pszWrite)\n", pDevIns->pReg->szRCMod, pszWrite));
AssertMsgRC(rc2, ("Failed to resolve %s.%s (pszRead)\n", pDevIns->pReg->szRCMod, pszRead));
AssertMsgRC(rc3, ("Failed to resolve %s.%s (pszFill)\n", pDevIns->pReg->szRCMod, pszFill));
if (RT_FAILURE(rc2) && RT_SUCCESS(rc))
rc = rc2;
if (RT_FAILURE(rc3) && RT_SUCCESS(rc))
rc = rc3;
}
}
else if (!HMIsEnabled(pVM))
{
AssertMsgFailed(("No RC module for this driver!\n"));
rc = <API key>;
}
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnMMIORegisterR0} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, uint32_t cbRange, RTR0PTR pvUser,
const char *pszWrite, const char *pszRead, const char *pszFill)
{
<API key>(pDevIns);
VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
LogFlow(("<API key>: caller='%s'/%d: GCPhysStart=%RGp cbRange=%#x pvUser=%p pszWrite=%p:{%s} pszRead=%p:{%s} pszFill=%p:{%s}\n",
pDevIns->pReg->szName, pDevIns->iInstance, GCPhysStart, cbRange, pvUser, pszWrite, pszWrite, pszRead, pszRead, pszFill, pszFill));
/*
* Resolve the functions.
* Not all function have to present, leave it to IOM to enforce this.
*/
int rc = VINF_SUCCESS;
if ( pDevIns->pReg->szR0Mod[0]
&& (pDevIns->pReg->fFlags & PDM_DEVREG_FLAGS_R0))
{
R0PTRTYPE(PFNIOMMMIOWRITE) pfnR0PtrWrite = 0;
if (pszWrite)
rc = <API key>(pDevIns, pszWrite, &pfnR0PtrWrite);
R0PTRTYPE(PFNIOMMMIOREAD) pfnR0PtrRead = 0;
int rc2 = VINF_SUCCESS;
if (pszRead)
rc2 = <API key>(pDevIns, pszRead, &pfnR0PtrRead);
R0PTRTYPE(PFNIOMMMIOFILL) pfnR0PtrFill = 0;
int rc3 = VINF_SUCCESS;
if (pszFill)
rc3 = <API key>(pDevIns, pszFill, &pfnR0PtrFill);
if (RT_SUCCESS(rc) && RT_SUCCESS(rc2) && RT_SUCCESS(rc3))
rc = IOMR3MmioRegisterR0(pDevIns->Internal.s.pVMR3, pDevIns, GCPhysStart, cbRange, pvUser, pfnR0PtrWrite, pfnR0PtrRead, pfnR0PtrFill);
else
{
AssertMsgRC(rc, ("Failed to resolve %s.%s (pszWrite)\n", pDevIns->pReg->szR0Mod, pszWrite));
AssertMsgRC(rc2, ("Failed to resolve %s.%s (pszRead)\n", pDevIns->pReg->szR0Mod, pszRead));
AssertMsgRC(rc3, ("Failed to resolve %s.%s (pszFill)\n", pDevIns->pReg->szR0Mod, pszFill));
if (RT_FAILURE(rc2) && RT_SUCCESS(rc))
rc = rc2;
if (RT_FAILURE(rc3) && RT_SUCCESS(rc))
rc = rc3;
}
}
else
{
AssertMsgFailed(("No R0 module for this driver!\n"));
rc = <API key>;
}
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnMMIODeregister} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, uint32_t cbRange)
{
<API key>(pDevIns);
VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
LogFlow(("<API key>: caller='%s'/%d: GCPhysStart=%RGp cbRange=%
pDevIns->pReg->szName, pDevIns->iInstance, GCPhysStart, cbRange));
int rc = IOMR3MmioDeregister(pDevIns->Internal.s.pVMR3, pDevIns, GCPhysStart, cbRange);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/**
* @copydoc PDMDEVHLPR3::pfnMMIO2Register
*/
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS cb, uint32_t fFlags, void **ppv, const char *pszDesc)
{
<API key>(pDevIns);
VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
LogFlow(("<API key>: caller='%s'/%d: iRegion=%#x cb=%#RGp fFlags=%RX32 ppv=%p pszDescp=%p:{%s}\n",
pDevIns->pReg->szName, pDevIns->iInstance, iRegion, cb, fFlags, ppv, pszDesc, pszDesc));
/** @todo <API key> mangles the description, move it here and
* use a real string cache. */
int rc = <API key>(pDevIns->Internal.s.pVMR3, pDevIns, iRegion, cb, fFlags, ppv, pszDesc);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/**
* @copydoc PDMDEVHLPR3::pfnMMIO2Deregister
*/
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, uint32_t iRegion)
{
<API key>(pDevIns);
VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
LogFlow(("<API key>: caller='%s'/%d: iRegion=%
pDevIns->pReg->szName, pDevIns->iInstance, iRegion));
AssertReturn(iRegion <= UINT8_MAX || iRegion == UINT32_MAX, <API key>);
int rc = <API key>(pDevIns->Internal.s.pVMR3, pDevIns, iRegion);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/**
* @copydoc PDMDEVHLPR3::pfnMMIO2Map
*/
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS GCPhys)
{
<API key>(pDevIns);
VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
LogFlow(("<API key>: caller='%s'/%d: iRegion=%#x GCPhys=%#RGp\n",
pDevIns->pReg->szName, pDevIns->iInstance, iRegion, GCPhys));
int rc = PGMR3PhysMMIO2Map(pDevIns->Internal.s.pVMR3, pDevIns, iRegion, GCPhys);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/**
* @copydoc PDMDEVHLPR3::pfnMMIO2Unmap
*/
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS GCPhys)
{
<API key>(pDevIns);
VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
LogFlow(("<API key>: caller='%s'/%d: iRegion=%#x GCPhys=%#RGp\n",
pDevIns->pReg->szName, pDevIns->iInstance, iRegion, GCPhys));
int rc = PGMR3PhysMMIO2Unmap(pDevIns->Internal.s.pVMR3, pDevIns, iRegion, GCPhys);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/**
* @copydoc PDMDEVHLPR3::pfnMMHyperMapMMIO2
*/
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS off, RTGCPHYS cb,
const char *pszDesc, PRTRCPTR pRCPtr)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
LogFlow(("<API key>: caller='%s'/%d: iRegion=%#x off=%RGp cb=%RGp pszDesc=%p:{%s} pRCPtr=%p\n",
pDevIns->pReg->szName, pDevIns->iInstance, iRegion, off, cb, pszDesc, pszDesc, pRCPtr));
if (pDevIns->iInstance > 0)
{
char *pszDesc2 = MMR3HeapAPrintf(pVM, <API key>, "%s [%u]", pszDesc, pDevIns->iInstance);
if (pszDesc2)
pszDesc = pszDesc2;
}
int rc = MMR3HyperMapMMIO2(pVM, pDevIns, iRegion, off, cb, pszDesc, pRCPtr);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc *pRCPtr=%RRv\n", pDevIns->pReg->szName, pDevIns->iInstance, rc, *pRCPtr));
return rc;
}
/**
* @copydoc PDMDEVHLPR3::pfnMMIO2MapKernel
*/
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS off, RTGCPHYS cb,
const char *pszDesc, PRTR0PTR pR0Ptr)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
LogFlow(("<API key>: caller='%s'/%d: iRegion=%#x off=%RGp cb=%RGp pszDesc=%p:{%s} pR0Ptr=%p\n",
pDevIns->pReg->szName, pDevIns->iInstance, iRegion, off, cb, pszDesc, pszDesc, pR0Ptr));
if (pDevIns->iInstance > 0)
{
char *pszDesc2 = MMR3HeapAPrintf(pVM, <API key>, "%s [%u]", pszDesc, pDevIns->iInstance);
if (pszDesc2)
pszDesc = pszDesc2;
}
int rc = <API key>(pVM, pDevIns, iRegion, off, cb, pszDesc, pR0Ptr);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc *pR0Ptr=%RHv\n", pDevIns->pReg->szName, pDevIns->iInstance, rc, *pR0Ptr));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnROMRegister} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, uint32_t cbRange,
const void *pvBinary, uint32_t cbBinary, uint32_t fFlags, const char *pszDesc)
{
<API key>(pDevIns);
VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
LogFlow(("<API key>: caller='%s'/%d: GCPhysStart=%RGp cbRange=%#x pvBinary=%p cbBinary=%#x fFlags=%#RX32 pszDesc=%p:{%s}\n",
pDevIns->pReg->szName, pDevIns->iInstance, GCPhysStart, cbRange, pvBinary, cbBinary, fFlags, pszDesc, pszDesc));
/** @todo can we mangle pszDesc? */
int rc = <API key>(pDevIns->Internal.s.pVMR3, pDevIns, GCPhysStart, cbRange, pvBinary, cbBinary, fFlags, pszDesc);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnROMProtectShadow} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, uint32_t cbRange, PGMROMPROT enmProt)
{
<API key>(pDevIns);
LogFlow(("<API key>: caller='%s'/%d: GCPhysStart=%RGp cbRange=%#x enmProt=%d\n",
pDevIns->pReg->szName, pDevIns->iInstance, GCPhysStart, cbRange, enmProt));
int rc = PGMR3PhysRomProtect(pDevIns->Internal.s.pVMR3, GCPhysStart, cbRange, enmProt);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnSSMRegister} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, uint32_t uVersion, size_t cbGuess, const char *pszBefore,
PFNSSMDEVLIVEPREP pfnLivePrep, PFNSSMDEVLIVEEXEC pfnLiveExec, PFNSSMDEVLIVEVOTE pfnLiveVote,
PFNSSMDEVSAVEPREP pfnSavePrep, PFNSSMDEVSAVEEXEC pfnSaveExec, PFNSSMDEVSAVEDONE pfnSaveDone,
PFNSSMDEVLOADPREP pfnLoadPrep, PFNSSMDEVLOADEXEC pfnLoadExec, PFNSSMDEVLOADDONE pfnLoadDone)
{
<API key>(pDevIns);
VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
LogFlow(("<API key>: caller='%s'/%d: uVersion=#x cbGuess=%#x pszBefore=%p:{%s}\n"
" pfnLivePrep=%p pfnLiveExec=%p pfnLiveVote=%p pfnSavePrep=%p pfnSaveExec=%p pfnSaveDone=%p pszLoadPrep=%p pfnLoadExec=%p pfnLoadDone=%p\n",
pDevIns->pReg->szName, pDevIns->iInstance, uVersion, cbGuess, pszBefore, pszBefore,
pfnLivePrep, pfnLiveExec, pfnLiveVote,
pfnSavePrep, pfnSaveExec, pfnSaveDone,
pfnLoadPrep, pfnLoadExec, pfnLoadDone));
int rc = SSMR3RegisterDevice(pDevIns->Internal.s.pVMR3, pDevIns, pDevIns->pReg->szName, pDevIns->iInstance,
uVersion, cbGuess, pszBefore,
pfnLivePrep, pfnLiveExec, pfnLiveVote,
pfnSavePrep, pfnSaveExec, pfnSaveDone,
pfnLoadPrep, pfnLoadExec, pfnLoadDone);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnTMTimerCreate} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, TMCLOCK enmClock, PFNTMTIMERDEV pfnCallback, void *pvUser, uint32_t fFlags, const char *pszDesc, PPTMTIMERR3 ppTimer)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
LogFlow(("<API key>: caller='%s'/%d: enmClock=%d pfnCallback=%p pvUser=%p fFlags=%#x pszDesc=%p:{%s} ppTimer=%p\n",
pDevIns->pReg->szName, pDevIns->iInstance, enmClock, pfnCallback, pvUser, fFlags, pszDesc, pszDesc, ppTimer));
if (pDevIns->iInstance > 0) /** @todo use a string cache here later. */
{
char *pszDesc2 = MMR3HeapAPrintf(pVM, <API key>, "%s [%u]", pszDesc, pDevIns->iInstance);
if (pszDesc2)
pszDesc = pszDesc2;
}
int rc = <API key>(pVM, pDevIns, enmClock, pfnCallback, pvUser, fFlags, pszDesc, ppTimer);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnTMUtcNow} */
static DECLCALLBACK(PRTTIMESPEC) <API key>(PPDMDEVINS pDevIns, PRTTIMESPEC pTime)
{
<API key>(pDevIns);
LogFlow(("<API key>: caller='%s'/%d: pTime=%p\n",
pDevIns->pReg->szName, pDevIns->iInstance, pTime));
pTime = TMR3UtcNow(pDevIns->Internal.s.pVMR3, pTime);
LogFlow(("<API key>: caller='%s'/%d: returns %RU64\n", pDevIns->pReg->szName, pDevIns->iInstance, RTTimeSpecGetNano(pTime)));
return pTime;
}
/** @<API key>{PDMDEVHLPR3,pfnTMTimeVirtGet} */
static DECLCALLBACK(uint64_t) <API key>(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
LogFlow(("<API key>: caller='%s'\n",
pDevIns->pReg->szName, pDevIns->iInstance));
uint64_t u64Time = TMVirtualSyncGet(pDevIns->Internal.s.pVMR3);
LogFlow(("<API key>: caller='%s'/%d: returns %RU64\n", pDevIns->pReg->szName, pDevIns->iInstance, u64Time));
return u64Time;
}
/** @<API key>{PDMDEVHLPR3,<API key>} */
static DECLCALLBACK(uint64_t) <API key>(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
LogFlow(("<API key>: caller='%s'\n",
pDevIns->pReg->szName, pDevIns->iInstance));
uint64_t u64Freq = TMVirtualGetFreq(pDevIns->Internal.s.pVMR3);
LogFlow(("<API key>: caller='%s'/%d: returns %RU64\n", pDevIns->pReg->szName, pDevIns->iInstance, u64Freq));
return u64Freq;
}
/** @<API key>{PDMDEVHLPR3,<API key>} */
static DECLCALLBACK(uint64_t) <API key>(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
LogFlow(("<API key>: caller='%s'\n",
pDevIns->pReg->szName, pDevIns->iInstance));
uint64_t u64Time = TMVirtualGet(pDevIns->Internal.s.pVMR3);
uint64_t u64Nano = TMVirtualToNano(pDevIns->Internal.s.pVMR3, u64Time);
LogFlow(("<API key>: caller='%s'/%d: returns %RU64\n", pDevIns->pReg->szName, pDevIns->iInstance, u64Nano));
return u64Nano;
}
/** @<API key>{PDMDEVHLPR3,pfnGetSupDrvSession} */
static DECLCALLBACK(PSUPDRVSESSION) <API key>(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
LogFlow(("<API key>: caller='%s'\n",
pDevIns->pReg->szName, pDevIns->iInstance));
PSUPDRVSESSION pSession = pDevIns->Internal.s.pVMR3->pSession;
LogFlow(("<API key>: caller='%s'/%d: returns %#p\n", pDevIns->pReg->szName, pDevIns->iInstance, pSession));
return pSession;
}
/** @<API key>{PDMDEVHLPR3,pfnPhysRead} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
LogFlow(("<API key>: caller='%s'/%d: GCPhys=%RGp pvBuf=%p cbRead=%
pDevIns->pReg->szName, pDevIns->iInstance, GCPhys, pvBuf, cbRead));
#if defined(VBOX_STRICT) && defined(<API key>)
if (!VM_IS_EMT(pVM))
{
char szNames[128];
uint32_t cLocks = <API key>(pVM, szNames, sizeof(szNames));
AssertMsg(cLocks == 0, ("cLocks=%u %s\n", cLocks, szNames));
}
#endif
VBOXSTRICTRC rcStrict;
if (VM_IS_EMT(pVM))
rcStrict = PGMPhysRead(pVM, GCPhys, pvBuf, cbRead, <API key>);
else
rcStrict = <API key>(pVM, GCPhys, pvBuf, cbRead, <API key>);
AssertMsg(rcStrict == VINF_SUCCESS, ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict))); /** @todo track down the users for this bugger. */
Log(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, VBOXSTRICTRC_VAL(rcStrict) ));
return VBOXSTRICTRC_VAL(rcStrict);
}
/** @<API key>{PDMDEVHLPR3,pfnPhysWrite} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
LogFlow(("<API key>: caller='%s'/%d: GCPhys=%RGp pvBuf=%p cbWrite=%
pDevIns->pReg->szName, pDevIns->iInstance, GCPhys, pvBuf, cbWrite));
#if defined(VBOX_STRICT) && defined(<API key>)
if (!VM_IS_EMT(pVM))
{
char szNames[128];
uint32_t cLocks = <API key>(pVM, szNames, sizeof(szNames));
AssertMsg(cLocks == 0, ("cLocks=%u %s\n", cLocks, szNames));
}
#endif
VBOXSTRICTRC rcStrict;
if (VM_IS_EMT(pVM))
rcStrict = PGMPhysWrite(pVM, GCPhys, pvBuf, cbWrite, <API key>);
else
rcStrict = <API key>(pVM, GCPhys, pvBuf, cbWrite, <API key>);
AssertMsg(rcStrict == VINF_SUCCESS, ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict))); /** @todo track down the users for this bugger. */
Log(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, VBOXSTRICTRC_VAL(rcStrict) ));
return VBOXSTRICTRC_VAL(rcStrict);
}
/** @<API key>{PDMDEVHLPR3,pfnPhysGCPhys2CCPtr} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t fFlags, void **ppv, PPGMPAGEMAPLOCK pLock)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
LogFlow(("<API key>: caller='%s'/%d: GCPhys=%RGp fFlags=%#x ppv=%p pLock=%p\n",
pDevIns->pReg->szName, pDevIns->iInstance, GCPhys, fFlags, ppv, pLock));
AssertReturn(!fFlags, <API key>);
#if defined(VBOX_STRICT) && defined(<API key>)
if (!VM_IS_EMT(pVM))
{
char szNames[128];
uint32_t cLocks = <API key>(pVM, szNames, sizeof(szNames));
AssertMsg(cLocks == 0, ("cLocks=%u %s\n", cLocks, szNames));
}
#endif
int rc = <API key>(pVM, GCPhys, ppv, pLock);
Log(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,<API key>} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t fFlags, const void **ppv, PPGMPAGEMAPLOCK pLock)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
LogFlow(("<API key>: caller='%s'/%d: GCPhys=%RGp fFlags=%#x ppv=%p pLock=%p\n",
pDevIns->pReg->szName, pDevIns->iInstance, GCPhys, fFlags, ppv, pLock));
AssertReturn(!fFlags, <API key>);
#if defined(VBOX_STRICT) && defined(<API key>)
if (!VM_IS_EMT(pVM))
{
char szNames[128];
uint32_t cLocks = <API key>(pVM, szNames, sizeof(szNames));
AssertMsg(cLocks == 0, ("cLocks=%u %s\n", cLocks, szNames));
}
#endif
int rc = <API key>(pVM, GCPhys, ppv, pLock);
Log(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,<API key>} */
static DECLCALLBACK(void) <API key>(PPDMDEVINS pDevIns, PPGMPAGEMAPLOCK pLock)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
LogFlow(("<API key>: caller='%s'/%d: pLock=%p\n",
pDevIns->pReg->szName, pDevIns->iInstance, pLock));
<API key>(pVM, pLock);
Log(("<API key>: caller='%s'/%d: returns void\n", pDevIns->pReg->szName, pDevIns->iInstance));
}
/** @<API key>{PDMDEVHLPR3,pfnPhysReadGCVirt} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, void *pvDst, RTGCPTR GCVirtSrc, size_t cb)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
LogFlow(("<API key>: caller='%s'/%d: pvDst=%p GCVirt=%RGv cb=%
pDevIns->pReg->szName, pDevIns->iInstance, pvDst, GCVirtSrc, cb));
PVMCPU pVCpu = VMMGetCpu(pVM);
if (!pVCpu)
return VERR_ACCESS_DENIED;
#if defined(VBOX_STRICT) && defined(<API key>)
/** @todo SMP. */
#endif
int rc = <API key>(pVCpu, pvDst, GCVirtSrc, cb);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnPhysWriteGCVirt} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, RTGCPTR GCVirtDst, const void *pvSrc, size_t cb)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
LogFlow(("<API key>: caller='%s'/%d: GCVirtDst=%RGv pvSrc=%p cb=%
pDevIns->pReg->szName, pDevIns->iInstance, GCVirtDst, pvSrc, cb));
PVMCPU pVCpu = VMMGetCpu(pVM);
if (!pVCpu)
return VERR_ACCESS_DENIED;
#if defined(VBOX_STRICT) && defined(<API key>)
/** @todo SMP. */
#endif
int rc = <API key>(pVCpu, GCVirtDst, pvSrc, cb);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnPhysGCPtr2GCPhys} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, RTGCPTR GCPtr, PRTGCPHYS pGCPhys)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
LogFlow(("<API key>: caller='%s'/%d: GCPtr=%RGv pGCPhys=%p\n",
pDevIns->pReg->szName, pDevIns->iInstance, GCPtr, pGCPhys));
PVMCPU pVCpu = VMMGetCpu(pVM);
if (!pVCpu)
return VERR_ACCESS_DENIED;
#if defined(VBOX_STRICT) && defined(<API key>)
/** @todo SMP. */
#endif
int rc = PGMPhysGCPtr2GCPhys(pVCpu, GCPtr, pGCPhys);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc *pGCPhys=%RGp\n", pDevIns->pReg->szName, pDevIns->iInstance, rc, *pGCPhys));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnMMHeapAlloc} */
static DECLCALLBACK(void *) <API key>(PPDMDEVINS pDevIns, size_t cb)
{
<API key>(pDevIns);
LogFlow(("<API key>: caller='%s'/%d: cb=%#x\n", pDevIns->pReg->szName, pDevIns->iInstance, cb));
void *pv = MMR3HeapAlloc(pDevIns->Internal.s.pVMR3, <API key>, cb);
LogFlow(("<API key>: caller='%s'/%d: returns %p\n", pDevIns->pReg->szName, pDevIns->iInstance, pv));
return pv;
}
/** @<API key>{PDMDEVHLPR3,pfnMMHeapAllocZ} */
static DECLCALLBACK(void *) <API key>(PPDMDEVINS pDevIns, size_t cb)
{
<API key>(pDevIns);
LogFlow(("<API key>: caller='%s'/%d: cb=%#x\n", pDevIns->pReg->szName, pDevIns->iInstance, cb));
void *pv = MMR3HeapAllocZ(pDevIns->Internal.s.pVMR3, <API key>, cb);
LogFlow(("<API key>: caller='%s'/%d: returns %p\n", pDevIns->pReg->szName, pDevIns->iInstance, pv));
return pv;
}
/** @<API key>{PDMDEVHLPR3,pfnMMHeapFree} */
static DECLCALLBACK(void) <API key>(PPDMDEVINS pDevIns, void *pv)
{
<API key>(pDevIns);
LogFlow(("<API key>: caller='%s'/%d: pv=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, pv));
MMR3HeapFree(pv);
LogFlow(("<API key>: caller='%s'/%d: returns void\n", pDevIns->pReg->szName, pDevIns->iInstance));
}
/** @<API key>{PDMDEVHLPR3,pfnVMState} */
static DECLCALLBACK(VMSTATE) pdmR3DevHlp_VMState(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
VMSTATE enmVMState = VMR3GetState(pDevIns->Internal.s.pVMR3);
LogFlow(("pdmR3DevHlp_VMState: caller='%s'/%d: returns %d (%s)\n", pDevIns->pReg->szName, pDevIns->iInstance,
enmVMState, VMR3GetStateName(enmVMState)));
return enmVMState;
}
/** @<API key>{PDMDEVHLPR3,<API key>} */
static DECLCALLBACK(bool) <API key>(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
bool fRc = <API key>(pDevIns->Internal.s.pVMR3);
LogFlow(("pdmR3DevHlp_VMState: caller='%s'/%d: returns %RTbool\n", pDevIns->pReg->szName, pDevIns->iInstance,
fRc));
return fRc;
}
/** @<API key>{PDMDEVHLPR3,pfnVMSetError} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...)
{
<API key>(pDevIns);
va_list args;
va_start(args, pszFormat);
int rc2 = VMSetErrorV(pDevIns->Internal.s.pVMR3, rc, RT_SRC_POS_ARGS, pszFormat, args); Assert(rc2 == rc); NOREF(rc2);
va_end(args);
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnVMSetErrorV} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va)
{
<API key>(pDevIns);
int rc2 = VMSetErrorV(pDevIns->Internal.s.pVMR3, rc, RT_SRC_POS_ARGS, pszFormat, va); Assert(rc2 == rc); NOREF(rc2);
return rc;
}
/** @<API key>{PDMDEVHLPR3,<API key>} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, ...)
{
<API key>(pDevIns);
va_list args;
va_start(args, pszFormat);
int rc = VMSetRuntimeErrorV(pDevIns->Internal.s.pVMR3, fFlags, pszErrorId, pszFormat, args);
va_end(args);
return rc;
}
/** @<API key>{PDMDEVHLPR3,<API key>} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, va_list va)
{
<API key>(pDevIns);
int rc = VMSetRuntimeErrorV(pDevIns->Internal.s.pVMR3, fFlags, pszErrorId, pszFormat, va);
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnDBGFStopV} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, const char *pszFile, unsigned iLine, const char *pszFunction, const char *pszFormat, va_list args)
{
<API key>(pDevIns);
#ifdef LOG_ENABLED
va_list va2;
va_copy(va2, args);
LogFlow(("<API key>: caller='%s'/%d: pszFile=%p:{%s} iLine=%d pszFunction=%p:{%s} pszFormat=%p:{%s} (%N)\n",
pDevIns->pReg->szName, pDevIns->iInstance, pszFile, pszFile, iLine, pszFunction, pszFunction, pszFormat, pszFormat, pszFormat, &va2));
va_end(va2);
#endif
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
int rc = DBGFR3EventSrcV(pVM, DBGFEVENT_DEV_STOP, pszFile, iLine, pszFunction, pszFormat, args);
if (rc == <API key>)
rc = VINF_SUCCESS;
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnDBGFInfoRegister} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, const char *pszName, const char *pszDesc, PFNDBGFHANDLERDEV pfnHandler)
{
<API key>(pDevIns);
LogFlow(("<API key>: caller='%s'/%d: pszName=%p:{%s} pszDesc=%p:{%s} pfnHandler=%p\n",
pDevIns->pReg->szName, pDevIns->iInstance, pszName, pszName, pszDesc, pszDesc, pfnHandler));
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
int rc = <API key>(pVM, pszName, pszDesc, pfnHandler, pDevIns);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnDBGFRegRegister} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, PCDBGFREGDESC paRegisters)
{
<API key>(pDevIns);
LogFlow(("<API key>: caller='%s'/%d: paRegisters=%p\n",
pDevIns->pReg->szName, pDevIns->iInstance, paRegisters));
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
int rc = <API key>(pVM, paRegisters, pDevIns, pDevIns->pReg->szName, pDevIns->iInstance);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnDBGFTraceBuf} */
static DECLCALLBACK(RTTRACEBUF) <API key>(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
RTTRACEBUF hTraceBuf = pDevIns->Internal.s.pVMR3->hTraceBufR3;
LogFlow(("<API key>: caller='%s'/%d: returns %p\n", pDevIns->pReg->szName, pDevIns->iInstance, hTraceBuf));
return hTraceBuf;
}
/** @<API key>{PDMDEVHLPR3,pfnSTAMRegister} */
static DECLCALLBACK(void) <API key>(PPDMDEVINS pDevIns, void *pvSample, STAMTYPE enmType, const char *pszName, STAMUNIT enmUnit, const char *pszDesc)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
STAM_REG(pVM, pvSample, enmType, pszName, enmUnit, pszDesc);
NOREF(pVM);
}
/** @<API key>{PDMDEVHLPR3,pfnSTAMRegisterF} */
static DECLCALLBACK(void) <API key>(PPDMDEVINS pDevIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
STAMUNIT enmUnit, const char *pszDesc, const char *pszName, ...)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
va_list args;
va_start(args, pszName);
int rc = STAMR3RegisterV(pVM, pvSample, enmType, enmVisibility, enmUnit, pszDesc, pszName, args);
va_end(args);
AssertRC(rc);
NOREF(pVM);
}
/** @<API key>{PDMDEVHLPR3,pfnSTAMRegisterV} */
static DECLCALLBACK(void) <API key>(PPDMDEVINS pDevIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
STAMUNIT enmUnit, const char *pszDesc, const char *pszName, va_list args)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
int rc = STAMR3RegisterV(pVM, pvSample, enmType, enmVisibility, enmUnit, pszDesc, pszName, args);
AssertRC(rc);
NOREF(pVM);
}
/** @<API key>{PDMDEVHLPR3,pfnPCIRegister} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
LogFlow(("<API key>: caller='%s'/%d: pPciDev=%p:{.config={%#.256Rhxs}\n",
pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, pPciDev->config));
/*
* Validate input.
*/
if (!pPciDev)
{
Assert(pPciDev);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (pPciDev)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
if (!pPciDev->config[0] && !pPciDev->config[1])
{
Assert(pPciDev->config[0] || pPciDev->config[1]);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (vendor)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
if (pDevIns->Internal.s.pPciDeviceR3)
{
/** @todo the PCI device vs. PDM device designed is a bit flawed if we have to
* support a PDM device with multiple PCI devices. This might become a problem
* when upgrading the chipset for instance because of multiple functions in some
* devices...
*/
AssertMsgFailed(("Only one PCI device per device is currently implemented!\n"));
return <API key>;
}
/*
* Choose the PCI bus for the device.
*
* This is simple. If the device was configured for a particular bus, the PCIBusNo
* configuration value will be set. If not the default bus is 0.
*/
int rc;
PPDMPCIBUS pBus = pDevIns->Internal.s.pPciBusR3;
if (!pBus)
{
uint8_t u8Bus;
rc = CFGMR3QueryU8Def(pDevIns->Internal.s.pCfgHandle, "PCIBusNo", &u8Bus, 0);
<API key>(rc, ("Configuration error: PCIBusNo query failed with rc=%Rrc (%s/%d)\n",
rc, pDevIns->pReg->szName, pDevIns->iInstance), rc);
<API key>(u8Bus < RT_ELEMENTS(pVM->pdm.s.aPciBuses),
("Configuration error: PCIBusNo=%d, max is %d. (%s/%d)\n", u8Bus,
RT_ELEMENTS(pVM->pdm.s.aPciBuses), pDevIns->pReg->szName, pDevIns->iInstance),
VERR_PDM_NO_PCI_BUS);
pBus = pDevIns->Internal.s.pPciBusR3 = &pVM->pdm.s.aPciBuses[u8Bus];
}
if (pBus->pDevInsR3)
{
if (pDevIns->pReg->fFlags & PDM_DEVREG_FLAGS_R0)
pDevIns->Internal.s.pPciBusR0 = MMHyperR3ToR0(pVM, pDevIns->Internal.s.pPciBusR3);
else
pDevIns->Internal.s.pPciBusR0 = NIL_RTR0PTR;
if (pDevIns->pReg->fFlags & PDM_DEVREG_FLAGS_RC)
pDevIns->Internal.s.pPciBusRC = MMHyperR3ToRC(pVM, pDevIns->Internal.s.pPciBusR3);
else
pDevIns->Internal.s.pPciBusRC = NIL_RTRCPTR;
/*
* Check the configuration for PCI device and function assignment.
*/
int iDev = -1;
uint8_t u8Device;
rc = CFGMR3QueryU8(pDevIns->Internal.s.pCfgHandle, "PCIDeviceNo", &u8Device);
if (RT_SUCCESS(rc))
{
AssertMsgReturn(u8Device <= 31,
("Configuration error: PCIDeviceNo=%d, max is 31. (%s/%d)\n",
u8Device, pDevIns->pReg->szName, pDevIns->iInstance),
<API key>);
uint8_t u8Function;
rc = CFGMR3QueryU8(pDevIns->Internal.s.pCfgHandle, "PCIFunctionNo", &u8Function);
AssertMsgRCReturn(rc, ("Configuration error: PCIDeviceNo, but PCIFunctionNo query failed with rc=%Rrc (%s/%d)\n",
rc, pDevIns->pReg->szName, pDevIns->iInstance),
rc);
AssertMsgReturn(u8Function <= 7,
("Configuration error: PCIFunctionNo=%d, max is 7. (%s/%d)\n",
u8Function, pDevIns->pReg->szName, pDevIns->iInstance),
<API key>);
iDev = (u8Device << 3) | u8Function;
}
else if (rc != <API key>)
{
AssertMsgFailed(("Configuration error: PCIDeviceNo query failed with rc=%Rrc (%s/%d)\n",
rc, pDevIns->pReg->szName, pDevIns->iInstance));
return rc;
}
/*
* Call the pci bus device to do the actual registration.
*/
pdmLock(pVM);
rc = pBus->pfnRegisterR3(pBus->pDevInsR3, pPciDev, pDevIns->pReg->szName, iDev);
pdmUnlock(pVM);
if (RT_SUCCESS(rc))
{
pPciDev->pDevIns = pDevIns;
pDevIns->Internal.s.pPciDeviceR3 = pPciDev;
if (pDevIns->pReg->fFlags & PDM_DEVREG_FLAGS_R0)
pDevIns->Internal.s.pPciDeviceR0 = MMHyperR3ToR0(pVM, pPciDev);
else
pDevIns->Internal.s.pPciDeviceR0 = NIL_RTR0PTR;
if (pDevIns->pReg->fFlags & PDM_DEVREG_FLAGS_RC)
pDevIns->Internal.s.pPciDeviceRC = MMHyperR3ToRC(pVM, pPciDev);
else
pDevIns->Internal.s.pPciDeviceRC = NIL_RTRCPTR;
Log(("PDM: Registered device '%s'/%d as PCI device %d on bus %d\n",
pDevIns->pReg->szName, pDevIns->iInstance, pPciDev->devfn, pDevIns->Internal.s.pPciBusR3->iBus));
}
}
else
{
<API key>(("Configuration error: No PCI bus available. This could be related to init order too!\n"));
rc = VERR_PDM_NO_PCI_BUS;
}
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,<API key>} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, int iRegion, uint32_t cbRegion, PCIADDRESSSPACE enmType, PFNPCIIOREGIONMAP pfnCallback)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
LogFlow(("<API key>: caller='%s'/%d: iRegion=%d cbRegion=%#x enmType=%d pfnCallback=%p\n",
pDevIns->pReg->szName, pDevIns->iInstance, iRegion, cbRegion, enmType, pfnCallback));
/*
* Validate input.
*/
if (iRegion < 0 || iRegion >= PCI_NUM_REGIONS)
{
Assert(iRegion >= 0 && iRegion < PCI_NUM_REGIONS);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (iRegion)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
switch ((int)enmType)
{
case <API key>:
/*
* Sanity check: don't allow to register more than 32K of the PCI I/O space.
*/
AssertMsgReturn(cbRegion <= _32K,
("caller='%s'/%d: %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, cbRegion),
<API key>);
break;
case <API key>:
case <API key>:
case <API key> | <API key>:
case <API key> | <API key>:
/*
* Sanity check: don't allow to register more than 512MB of the PCI MMIO space for
* now. If this limit is increased beyond 2GB, adapt the aligned check below as well!
*/
AssertMsgReturn(cbRegion <= 512 * _1M,
("caller='%s'/%d: %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, cbRegion),
<API key>);
break;
default:
AssertMsgFailed(("enmType=%#x is unknown\n", enmType));
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (enmType)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
if (!pfnCallback)
{
Assert(pfnCallback);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (callback)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
AssertRelease(VMR3GetState(pVM) != VMSTATE_RUNNING);
/*
* Must have a PCI device registered!
*/
int rc;
PPCIDEVICE pPciDev = pDevIns->Internal.s.pPciDeviceR3;
if (pPciDev)
{
/*
* We're currently restricted to page aligned MMIO regions.
*/
if ( ((enmType & ~(<API key> | <API key>)) == <API key>)
&& cbRegion != RT_ALIGN_32(cbRegion, PAGE_SIZE))
{
Log(("<API key>: caller='%s'/%d: aligning cbRegion %#x -> %#x\n",
pDevIns->pReg->szName, pDevIns->iInstance, cbRegion, RT_ALIGN_32(cbRegion, PAGE_SIZE)));
cbRegion = RT_ALIGN_32(cbRegion, PAGE_SIZE);
}
/*
* For registering PCI MMIO memory or PCI I/O memory, the size of the region must be a power of 2!
*/
int iLastSet = ASMBitLastSetU32(cbRegion);
Assert(iLastSet > 0);
uint32_t cbRegionAligned = RT_BIT_32(iLastSet - 1);
if (cbRegion > cbRegionAligned)
cbRegion = cbRegionAligned * 2; /* round up */
PPDMPCIBUS pBus = pDevIns->Internal.s.pPciBusR3;
Assert(pBus);
pdmLock(pVM);
rc = pBus-><API key>(pBus->pDevInsR3, pPciDev, iRegion, cbRegion, enmType, pfnCallback);
pdmUnlock(pVM);
}
else
{
AssertMsgFailed(("No PCI device registered!\n"));
rc = <API key>;
}
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,<API key>} */
static DECLCALLBACK(void) <API key>(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PFNPCICONFIGREAD pfnRead, PPFNPCICONFIGREAD ppfnReadOld,
PFNPCICONFIGWRITE pfnWrite, PPFNPCICONFIGWRITE ppfnWriteOld)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
LogFlow(("<API key>: caller='%s'/%d: pPciDev=%p pfnRead=%p ppfnReadOld=%p pfnWrite=%p ppfnWriteOld=%p\n",
pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, pfnRead, ppfnReadOld, pfnWrite, ppfnWriteOld));
/*
* Validate input and resolve defaults.
*/
AssertPtr(pfnRead);
AssertPtr(pfnWrite);
AssertPtrNull(ppfnReadOld);
AssertPtrNull(ppfnWriteOld);
AssertPtrNull(pPciDev);
if (!pPciDev)
pPciDev = pDevIns->Internal.s.pPciDeviceR3;
AssertReleaseMsg(pPciDev, ("You must register your device first!\n"));
PPDMPCIBUS pBus = pDevIns->Internal.s.pPciBusR3;
AssertRelease(pBus);
AssertRelease(VMR3GetState(pVM) != VMSTATE_RUNNING);
/*
* Do the job.
*/
pdmLock(pVM);
pBus-><API key>(pBus->pDevInsR3, pPciDev, pfnRead, ppfnReadOld, pfnWrite, ppfnWriteOld);
pdmUnlock(pVM);
LogFlow(("<API key>: caller='%s'/%d: returns void\n", pDevIns->pReg->szName, pDevIns->iInstance));
}
/** @<API key>{PDMDEVHLPR3,pfnPCIPhysRead} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead)
{
<API key>(pDevIns);
#ifndef <API key>
/*
* Just check the busmaster setting here and forward the request to the generic read helper.
*/
PPCIDEVICE pPciDev = pDevIns->Internal.s.pPciDeviceR3;
AssertReleaseMsg(pPciDev, ("No PCI device registered!\n"));
if (!PCIDevIsBusmaster(pPciDev))
{
Log(("<API key>: caller='%s'/%d: returns %Rrc - Not bus master! GCPhys=%RGp cbRead=%#zx\n",
pDevIns->pReg->szName, pDevIns->iInstance, <API key>, GCPhys, cbRead));
return <API key>;
}
#endif
return pDevIns->pHlpR3->pfnPhysRead(pDevIns, GCPhys, pvBuf, cbRead);
}
/** @<API key>{PDMDEVHLPR3,pfnPCIPhysRead} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite)
{
<API key>(pDevIns);
#ifndef <API key>
/*
* Just check the busmaster setting here and forward the request to the generic read helper.
*/
PPCIDEVICE pPciDev = pDevIns->Internal.s.pPciDeviceR3;
AssertReleaseMsg(pPciDev, ("No PCI device registered!\n"));
if (!PCIDevIsBusmaster(pPciDev))
{
Log(("<API key>: caller='%s'/%d: returns %Rrc - Not bus master! GCPhys=%RGp cbWrite=%#zx\n",
pDevIns->pReg->szName, pDevIns->iInstance, <API key>, GCPhys, cbWrite));
return <API key>;
}
#endif
return pDevIns->pHlpR3->pfnPhysWrite(pDevIns, GCPhys, pvBuf, cbWrite);
}
/** @<API key>{PDMDEVHLPR3,pfnPCISetIrq} */
static DECLCALLBACK(void) <API key>(PPDMDEVINS pDevIns, int iIrq, int iLevel)
{
<API key>(pDevIns);
LogFlow(("<API key>: caller='%s'/%d: iIrq=%d iLevel=%d\n", pDevIns->pReg->szName, pDevIns->iInstance, iIrq, iLevel));
/*
* Validate input.
*/
Assert(iIrq == 0);
Assert((uint32_t)iLevel <= <API key>);
/*
* Must have a PCI device registered!
*/
PPCIDEVICE pPciDev = pDevIns->Internal.s.pPciDeviceR3;
if (pPciDev)
{
PPDMPCIBUS pBus = pDevIns->Internal.s.pPciBusR3; /** @todo the bus should be associated with the PCI device not the PDM device. */
Assert(pBus);
PVM pVM = pDevIns->Internal.s.pVMR3;
pdmLock(pVM);
uint32_t uTagSrc;
if (iLevel & PDM_IRQ_LEVEL_HIGH)
{
pDevIns->Internal.s.uLastIrqTag = uTagSrc = pdmCalcIrqTag(pVM, pDevIns->idTracing);
if (iLevel == PDM_IRQ_LEVEL_HIGH)
<API key>(VMMGetCpu(pVM), RT_LOWORD(uTagSrc), RT_HIWORD(uTagSrc));
else
<API key>(VMMGetCpu(pVM), RT_LOWORD(uTagSrc), RT_HIWORD(uTagSrc));
}
else
uTagSrc = pDevIns->Internal.s.uLastIrqTag;
pBus->pfnSetIrqR3(pBus->pDevInsR3, pPciDev, iIrq, iLevel, uTagSrc);
if (iLevel == PDM_IRQ_LEVEL_LOW)
VBOXVMM_PDM_IRQ_LOW(VMMGetCpu(pVM), RT_LOWORD(uTagSrc), RT_HIWORD(uTagSrc));
pdmUnlock(pVM);
}
else
<API key>(("No PCI device registered!\n"));
LogFlow(("<API key>: caller='%s'/%d: returns void\n", pDevIns->pReg->szName, pDevIns->iInstance));
}
/** @<API key>{PDMDEVHLPR3,pfnPCISetIrqNoWait} */
static DECLCALLBACK(void) <API key>(PPDMDEVINS pDevIns, int iIrq, int iLevel)
{
<API key>(pDevIns, iIrq, iLevel);
}
/** @<API key>{PDMDEVHLPR3,pfnPCIRegisterMsi} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, PPDMMSIREG pMsiReg)
{
<API key>(pDevIns);
LogFlow(("<API key>: caller='%s'/%d: %d MSI vectors %d MSI-X vectors\n", pDevIns->pReg->szName, pDevIns->iInstance, pMsiReg->cMsiVectors,pMsiReg->cMsixVectors ));
int rc = VINF_SUCCESS;
/*
* Must have a PCI device registered!
*/
PPCIDEVICE pPciDev = pDevIns->Internal.s.pPciDeviceR3;
if (pPciDev)
{
PPDMPCIBUS pBus = pDevIns->Internal.s.pPciBusR3; /** @todo the bus should be associated with the PCI device not the PDM device. */
Assert(pBus);
PVM pVM = pDevIns->Internal.s.pVMR3;
pdmLock(pVM);
if (pBus->pfnRegisterMsiR3)
rc = pBus->pfnRegisterMsiR3(pBus->pDevInsR3, pPciDev, pMsiReg);
else
rc = <API key>;
pdmUnlock(pVM);
}
else
<API key>(("No PCI device registered!\n"));
LogFlow(("<API key>: caller='%s'/%d: returns void\n", pDevIns->pReg->szName, pDevIns->iInstance));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnISASetIrq} */
static DECLCALLBACK(void) <API key>(PPDMDEVINS pDevIns, int iIrq, int iLevel)
{
<API key>(pDevIns);
LogFlow(("<API key>: caller='%s'/%d: iIrq=%d iLevel=%d\n", pDevIns->pReg->szName, pDevIns->iInstance, iIrq, iLevel));
/*
* Validate input.
*/
Assert(iIrq < 16);
Assert((uint32_t)iLevel <= <API key>);
PVM pVM = pDevIns->Internal.s.pVMR3;
/*
* Do the job.
*/
pdmLock(pVM);
uint32_t uTagSrc;
if (iLevel & PDM_IRQ_LEVEL_HIGH)
{
pDevIns->Internal.s.uLastIrqTag = uTagSrc = pdmCalcIrqTag(pVM, pDevIns->idTracing);
if (iLevel == PDM_IRQ_LEVEL_HIGH)
<API key>(VMMGetCpu(pVM), RT_LOWORD(uTagSrc), RT_HIWORD(uTagSrc));
else
<API key>(VMMGetCpu(pVM), RT_LOWORD(uTagSrc), RT_HIWORD(uTagSrc));
}
else
uTagSrc = pDevIns->Internal.s.uLastIrqTag;
PDMIsaSetIrq(pVM, iIrq, iLevel, uTagSrc); /* (The API takes the lock recursively.) */
if (iLevel == PDM_IRQ_LEVEL_LOW)
VBOXVMM_PDM_IRQ_LOW(VMMGetCpu(pVM), RT_LOWORD(uTagSrc), RT_HIWORD(uTagSrc));
pdmUnlock(pVM);
LogFlow(("<API key>: caller='%s'/%d: returns void\n", pDevIns->pReg->szName, pDevIns->iInstance));
}
/** @<API key>{PDMDEVHLPR3,pfnISASetIrqNoWait} */
static DECLCALLBACK(void) <API key>(PPDMDEVINS pDevIns, int iIrq, int iLevel)
{
<API key>(pDevIns, iIrq, iLevel);
}
/** @<API key>{PDMDEVHLPR3,pfnDriverAttach} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, uint32_t iLun, PPDMIBASE pBaseInterface, PPDMIBASE *ppBaseInterface, const char *pszDesc)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
LogFlow(("<API key>: caller='%s'/%d: iLun=%d pBaseInterface=%p ppBaseInterface=%p pszDesc=%p:{%s}\n",
pDevIns->pReg->szName, pDevIns->iInstance, iLun, pBaseInterface, ppBaseInterface, pszDesc, pszDesc));
/*
* Lookup the LUN, it might already be registered.
*/
PPDMLUN pLunPrev = NULL;
PPDMLUN pLun = pDevIns->Internal.s.pLunsR3;
for (; pLun; pLunPrev = pLun, pLun = pLun->pNext)
if (pLun->iLun == iLun)
break;
/*
* Create the LUN if if wasn't found, else check if driver is already attached to it.
*/
if (!pLun)
{
if ( !pBaseInterface
|| !pszDesc
|| !*pszDesc)
{
Assert(pBaseInterface);
Assert(pszDesc || *pszDesc);
return <API key>;
}
pLun = (PPDMLUN)MMR3HeapAlloc(pVM, MM_TAG_PDM_LUN, sizeof(*pLun));
if (!pLun)
return VERR_NO_MEMORY;
pLun->iLun = iLun;
pLun->pNext = pLunPrev ? pLunPrev->pNext : NULL;
pLun->pTop = NULL;
pLun->pBottom = NULL;
pLun->pDevIns = pDevIns;
pLun->pUsbIns = NULL;
pLun->pszDesc = pszDesc;
pLun->pBase = pBaseInterface;
if (!pLunPrev)
pDevIns->Internal.s.pLunsR3 = pLun;
else
pLunPrev->pNext = pLun;
Log(("<API key>: Registered LUN#%d '%s' with device '%s'/%d.\n",
iLun, pszDesc, pDevIns->pReg->szName, pDevIns->iInstance));
}
else if (pLun->pTop)
{
AssertMsgFailed(("Already attached! The device should keep track of such things!\n"));
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
Assert(pLun->pBase == pBaseInterface);
/*
* Get the attached driver configuration.
*/
int rc;
PCFGMNODE pNode = CFGMR3GetChildF(pDevIns->Internal.s.pCfgHandle, "LUN#%u", iLun);
if (pNode)
rc = pdmR3DrvInstantiate(pVM, pNode, pBaseInterface, NULL /*pDrvAbove*/, pLun, ppBaseInterface);
else
rc = <API key>;
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnQueueCreate} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, size_t cbItem, uint32_t cItems, uint32_t cMilliesInterval,
PFNPDMQUEUEDEV pfnCallback, bool fGCEnabled, const char *pszName, PPDMQUEUE *ppQueue)
{
<API key>(pDevIns);
LogFlow(("<API key>: caller='%s'/%d: cbItem=%#x cItems=%#x cMilliesInterval=%u pfnCallback=%p fGCEnabled=%RTbool pszName=%p:{%s} ppQueue=%p\n",
pDevIns->pReg->szName, pDevIns->iInstance, cbItem, cItems, cMilliesInterval, pfnCallback, fGCEnabled, pszName, pszName, ppQueue));
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
if (pDevIns->iInstance > 0)
{
pszName = MMR3HeapAPrintf(pVM, <API key>, "%s_%u", pszName, pDevIns->iInstance);
AssertLogRelReturn(pszName, VERR_NO_MEMORY);
}
int rc = <API key>(pVM, pDevIns, cbItem, cItems, cMilliesInterval, pfnCallback, fGCEnabled, pszName, ppQueue);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc *ppQueue=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, rc, *ppQueue));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnCritSectInit} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect, RT_SRC_POS_DECL,
const char *pszNameFmt, va_list va)
{
<API key>(pDevIns);
LogFlow(("<API key>: caller='%s'/%d: pCritSect=%p pszNameFmt=%p:{%s}\n",
pDevIns->pReg->szName, pDevIns->iInstance, pCritSect, pszNameFmt, pszNameFmt));
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
int rc = <API key>(pVM, pDevIns, pCritSect, RT_SRC_POS_ARGS, pszNameFmt, va);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnCritSectGetNop} */
static DECLCALLBACK(PPDMCRITSECT) <API key>(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
PPDMCRITSECT pCritSect = PDMR3CritSectGetNop(pVM);
LogFlow(("<API key>: caller='%s'/%d: return %p\n",
pDevIns->pReg->szName, pDevIns->iInstance, pCritSect));
return pCritSect;
}
/** @<API key>{PDMDEVHLPR3,pfnCritSectGetNopR0} */
static DECLCALLBACK(R0PTRTYPE(PPDMCRITSECT)) <API key>(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
R0PTRTYPE(PPDMCRITSECT) pCritSect = <API key>(pVM);
LogFlow(("<API key>: caller='%s'/%d: return %RHv\n",
pDevIns->pReg->szName, pDevIns->iInstance, pCritSect));
return pCritSect;
}
/** @<API key>{PDMDEVHLPR3,pfnCritSectGetNopRC} */
static DECLCALLBACK(RCPTRTYPE(PPDMCRITSECT)) <API key>(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
RCPTRTYPE(PPDMCRITSECT) pCritSect = <API key>(pVM);
LogFlow(("<API key>: caller='%s'/%d: return %RRv\n",
pDevIns->pReg->szName, pDevIns->iInstance, pCritSect));
return pCritSect;
}
/** @<API key>{PDMDEVHLPR3,<API key>} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect)
{
/*
* Validate input.
*
* Note! We only allow the automatically created default critical section
* to be replaced by this API.
*/
<API key>(pDevIns);
AssertPtrReturn(pCritSect, <API key>);
LogFlow(("<API key>: caller='%s'/%d: pCritSect=%p (%s)\n",
pDevIns->pReg->szName, pDevIns->iInstance, pCritSect, pCritSect->s.pszName));
AssertReturn(<API key>(pCritSect), <API key>);
PVM pVM = pDevIns->Internal.s.pVMR3;
AssertReturn(pCritSect->s.pVMR3 == pVM, <API key>);
VM_ASSERT_EMT(pVM);
<API key>(pVM, VMSTATE_CREATING, VERR_WRONG_ORDER);
AssertReturn(pDevIns->pCritSectRoR3, VERR_PDM_DEV_IPE_1);
AssertReturn(pDevIns->pCritSectRoR3->s.<API key>, VERR_WRONG_ORDER);
AssertReturn(!pDevIns->pCritSectRoR3->s.<API key>, VERR_WRONG_ORDER);
AssertReturn(pDevIns->pCritSectRoR3 != pCritSect, <API key>);
/*
* Replace the critical section and destroy the automatic default section.
*/
PPDMCRITSECT pOldCritSect = pDevIns->pCritSectRoR3;
pDevIns->pCritSectRoR3 = pCritSect;
if (pDevIns->pReg->fFlags & PDM_DEVREG_FLAGS_R0)
pDevIns->pCritSectRoR0 = MMHyperCCToR0(pVM, pDevIns->pCritSectRoR3);
else
Assert(pDevIns->pCritSectRoR0 == NIL_RTRCPTR);
if (pDevIns->pReg->fFlags & PDM_DEVREG_FLAGS_RC)
pDevIns->pCritSectRoRC = MMHyperCCToRC(pVM, pDevIns->pCritSectRoR3);
else
Assert(pDevIns->pCritSectRoRC == NIL_RTRCPTR);
PDMR3CritSectDelete(pOldCritSect);
if (pDevIns->pReg->fFlags & (PDM_DEVREG_FLAGS_RC | PDM_DEVREG_FLAGS_R0))
MMHyperFree(pVM, pOldCritSect);
else
MMR3HeapFree(pOldCritSect);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, VINF_SUCCESS));
return VINF_SUCCESS;
}
/** @<API key>{PDMDEVHLPR3,pfnThreadCreate} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDEV pfnThread,
<API key> pfnWakeup, size_t cbStack, RTTHREADTYPE enmType, const char *pszName)
{
<API key>(pDevIns);
VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
LogFlow(("<API key>: caller='%s'/%d: ppThread=%p pvUser=%p pfnThread=%p pfnWakeup=%p cbStack=%#zx enmType=%d pszName=%p:{%s}\n",
pDevIns->pReg->szName, pDevIns->iInstance, ppThread, pvUser, pfnThread, pfnWakeup, cbStack, enmType, pszName, pszName));
int rc = <API key>(pDevIns->Internal.s.pVMR3, pDevIns, ppThread, pvUser, pfnThread, pfnWakeup, cbStack, enmType, pszName);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc *ppThread=%RTthrd\n", pDevIns->pReg->szName, pDevIns->iInstance,
rc, *ppThread));
return rc;
}
/** @<API key>{PDMDEVHLPR3,<API key>} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, <API key> pfnAsyncNotify)
{
<API key>(pDevIns);
VM_ASSERT_EMT0(pDevIns->Internal.s.pVMR3);
LogFlow(("<API key>: caller='%s'/%d: pfnAsyncNotify=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, pfnAsyncNotify));
int rc = VINF_SUCCESS;
AssertStmt(pfnAsyncNotify, rc = <API key>);
AssertStmt(!pDevIns->Internal.s.pfnAsyncNotify, rc = VERR_WRONG_ORDER);
AssertStmt(pDevIns->Internal.s.fIntFlags & (<API key> | <API key>), rc = VERR_WRONG_ORDER);
VMSTATE enmVMState = VMR3GetState(pDevIns->Internal.s.pVMR3);
AssertStmt( enmVMState == VMSTATE_SUSPENDING
|| enmVMState == <API key>
|| enmVMState == <API key>
|| enmVMState == VMSTATE_RESETTING
|| enmVMState == <API key>
|| enmVMState == <API key>
|| enmVMState == <API key>,
rc = VERR_INVALID_STATE);
if (RT_SUCCESS(rc))
pDevIns->Internal.s.pfnAsyncNotify = pfnAsyncNotify;
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,<API key>} */
static DECLCALLBACK(void) <API key>(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VMSTATE enmVMState = VMR3GetState(pVM);
if ( enmVMState == VMSTATE_SUSPENDING
|| enmVMState == <API key>
|| enmVMState == <API key>
|| enmVMState == VMSTATE_RESETTING
|| enmVMState == <API key>
|| enmVMState == <API key>
|| enmVMState == <API key>)
{
LogFlow(("<API key>: caller='%s'/%d:\n", pDevIns->pReg->szName, pDevIns->iInstance));
<API key>(pVM->pUVM);
}
else
LogFlow(("<API key>: caller='%s'/%d: enmVMState=%d\n", pDevIns->pReg->szName, pDevIns->iInstance, enmVMState));
}
/** @<API key>{PDMDEVHLPR3,pfnRTCRegister} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, PCPDMRTCREG pRtcReg, PCPDMRTCHLP *ppRtcHlp)
{
<API key>(pDevIns);
VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
LogFlow(("<API key>: caller='%s'/%d: pRtcReg=%p:{.u32Version=%#x, .pfnWrite=%p, .pfnRead=%p} ppRtcHlp=%p\n",
pDevIns->pReg->szName, pDevIns->iInstance, pRtcReg, pRtcReg->u32Version, pRtcReg->pfnWrite,
pRtcReg->pfnWrite, ppRtcHlp));
/*
* Validate input.
*/
if (pRtcReg->u32Version != PDM_RTCREG_VERSION)
{
AssertMsgFailed(("u32Version=%#x expected %#x\n", pRtcReg->u32Version,
PDM_RTCREG_VERSION));
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (version)\n",
pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
if ( !pRtcReg->pfnWrite
|| !pRtcReg->pfnRead)
{
Assert(pRtcReg->pfnWrite);
Assert(pRtcReg->pfnRead);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (callbacks)\n",
pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
if (!ppRtcHlp)
{
Assert(ppRtcHlp);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (ppRtcHlp)\n",
pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
/*
* Only one DMA device.
*/
PVM pVM = pDevIns->Internal.s.pVMR3;
if (pVM->pdm.s.pRtc)
{
AssertMsgFailed(("Only one RTC device is supported!\n"));
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n",
pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
/*
* Allocate and initialize pci bus structure.
*/
int rc = VINF_SUCCESS;
PPDMRTC pRtc = (PPDMRTC)MMR3HeapAlloc(pDevIns->Internal.s.pVMR3, MM_TAG_PDM_DEVICE, sizeof(*pRtc));
if (pRtc)
{
pRtc->pDevIns = pDevIns;
pRtc->Reg = *pRtcReg;
pVM->pdm.s.pRtc = pRtc;
/* set the helper pointer. */
*ppRtcHlp = &g_pdmR3DevRtcHlp;
Log(("PDM: Registered RTC device '%s'/%d pDevIns=%p\n",
pDevIns->pReg->szName, pDevIns->iInstance, pDevIns));
}
else
rc = VERR_NO_MEMORY;
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n",
pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnDMARegister} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, unsigned uChannel, <API key> pfnTransferHandler, void *pvUser)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
LogFlow(("<API key>: caller='%s'/%d: uChannel=%d pfnTransferHandler=%p pvUser=%p\n",
pDevIns->pReg->szName, pDevIns->iInstance, uChannel, pfnTransferHandler, pvUser));
int rc = VINF_SUCCESS;
if (pVM->pdm.s.pDmac)
pVM->pdm.s.pDmac->Reg.pfnRegister(pVM->pdm.s.pDmac->pDevIns, uChannel, pfnTransferHandler, pvUser);
else
{
AssertMsgFailed(("Configuration error: No DMAC controller available. This could be related to init order too!\n"));
rc = <API key>;
}
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n",
pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnDMAReadMemory} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, unsigned uChannel, void *pvBuffer, uint32_t off, uint32_t cbBlock, uint32_t *pcbRead)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
LogFlow(("<API key>: caller='%s'/%d: uChannel=%d pvBuffer=%p off=%#x cbBlock=%#x pcbRead=%p\n",
pDevIns->pReg->szName, pDevIns->iInstance, uChannel, pvBuffer, off, cbBlock, pcbRead));
int rc = VINF_SUCCESS;
if (pVM->pdm.s.pDmac)
{
uint32_t cb = pVM->pdm.s.pDmac->Reg.pfnReadMemory(pVM->pdm.s.pDmac->pDevIns, uChannel, pvBuffer, off, cbBlock);
if (pcbRead)
*pcbRead = cb;
}
else
{
AssertMsgFailed(("Configuration error: No DMAC controller available. This could be related to init order too!\n"));
rc = <API key>;
}
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n",
pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnDMAWriteMemory} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, unsigned uChannel, const void *pvBuffer, uint32_t off, uint32_t cbBlock, uint32_t *pcbWritten)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
LogFlow(("<API key>: caller='%s'/%d: uChannel=%d pvBuffer=%p off=%#x cbBlock=%#x pcbWritten=%p\n",
pDevIns->pReg->szName, pDevIns->iInstance, uChannel, pvBuffer, off, cbBlock, pcbWritten));
int rc = VINF_SUCCESS;
if (pVM->pdm.s.pDmac)
{
uint32_t cb = pVM->pdm.s.pDmac->Reg.pfnWriteMemory(pVM->pdm.s.pDmac->pDevIns, uChannel, pvBuffer, off, cbBlock);
if (pcbWritten)
*pcbWritten = cb;
}
else
{
AssertMsgFailed(("Configuration error: No DMAC controller available. This could be related to init order too!\n"));
rc = <API key>;
}
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n",
pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnDMASetDREQ} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, unsigned uChannel, unsigned uLevel)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
LogFlow(("<API key>: caller='%s'/%d: uChannel=%d uLevel=%d\n",
pDevIns->pReg->szName, pDevIns->iInstance, uChannel, uLevel));
int rc = VINF_SUCCESS;
if (pVM->pdm.s.pDmac)
pVM->pdm.s.pDmac->Reg.pfnSetDREQ(pVM->pdm.s.pDmac->pDevIns, uChannel, uLevel);
else
{
AssertMsgFailed(("Configuration error: No DMAC controller available. This could be related to init order too!\n"));
rc = <API key>;
}
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n",
pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,<API key>} */
static DECLCALLBACK(uint8_t) <API key>(PPDMDEVINS pDevIns, unsigned uChannel)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
LogFlow(("<API key>: caller='%s'/%d: uChannel=%d\n",
pDevIns->pReg->szName, pDevIns->iInstance, uChannel));
uint8_t u8Mode;
if (pVM->pdm.s.pDmac)
u8Mode = pVM->pdm.s.pDmac->Reg.pfnGetChannelMode(pVM->pdm.s.pDmac->pDevIns, uChannel);
else
{
AssertMsgFailed(("Configuration error: No DMAC controller available. This could be related to init order too!\n"));
u8Mode = 3 << 2 ;
}
LogFlow(("<API key>: caller='%s'/%d: returns %#04x\n",
pDevIns->pReg->szName, pDevIns->iInstance, u8Mode));
return u8Mode;
}
/** @<API key>{PDMDEVHLPR3,pfnDMASchedule} */
static DECLCALLBACK(void) <API key>(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
LogFlow(("<API key>: caller='%s'/%d: VM_FF_PDM_DMA %d -> 1\n",
pDevIns->pReg->szName, pDevIns->iInstance, VM_FF_IS_SET(pVM, VM_FF_PDM_DMA)));
AssertMsg(pVM->pdm.s.pDmac, ("Configuration error: No DMAC controller available. This could be related to init order too!\n"));
VM_FF_SET(pVM, VM_FF_PDM_DMA);
#ifdef VBOX_WITH_REM
<API key>(pVM);
#endif
VMR3NotifyGlobalFFU(pVM->pUVM, <API key>);
}
/** @<API key>{PDMDEVHLPR3,pfnCMOSWrite} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, unsigned iReg, uint8_t u8Value)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
LogFlow(("<API key>: caller='%s'/%d: iReg=%#04x u8Value=%#04x\n",
pDevIns->pReg->szName, pDevIns->iInstance, iReg, u8Value));
int rc;
if (pVM->pdm.s.pRtc)
{
PPDMDEVINS pDevInsRtc = pVM->pdm.s.pRtc->pDevIns;
rc = PDMCritSectEnter(pDevInsRtc->pCritSectRoR3, VERR_IGNORED);
if (RT_SUCCESS(rc))
{
rc = pVM->pdm.s.pRtc->Reg.pfnWrite(pDevInsRtc, iReg, u8Value);
PDMCritSectLeave(pDevInsRtc->pCritSectRoR3);
}
}
else
rc = <API key>;
LogFlow(("<API key>: caller='%s'/%d: return %Rrc\n",
pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnCMOSRead} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, unsigned iReg, uint8_t *pu8Value)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
LogFlow(("<API key>: caller='%s'/%d: iReg=%#04x pu8Value=%p\n",
pDevIns->pReg->szName, pDevIns->iInstance, iReg, pu8Value));
int rc;
if (pVM->pdm.s.pRtc)
{
PPDMDEVINS pDevInsRtc = pVM->pdm.s.pRtc->pDevIns;
rc = PDMCritSectEnter(pDevInsRtc->pCritSectRoR3, VERR_IGNORED);
if (RT_SUCCESS(rc))
{
rc = pVM->pdm.s.pRtc->Reg.pfnRead(pDevInsRtc, iReg, pu8Value);
PDMCritSectLeave(pDevInsRtc->pCritSectRoR3);
}
}
else
rc = <API key>;
LogFlow(("<API key>: caller='%s'/%d: return %Rrc\n",
pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnAssertEMT} */
static DECLCALLBACK(bool) <API key>(PPDMDEVINS pDevIns, const char *pszFile, unsigned iLine, const char *pszFunction)
{
<API key>(pDevIns);
if (VM_IS_EMT(pDevIns->Internal.s.pVMR3))
return true;
char szMsg[100];
RTStrPrintf(szMsg, sizeof(szMsg), "AssertEMT '%s'/%d\n", pDevIns->pReg->szName, pDevIns->iInstance);
RTAssertMsg1Weak(szMsg, iLine, pszFile, pszFunction);
AssertBreakpoint();
return false;
}
/** @<API key>{PDMDEVHLPR3,pfnAssertOther} */
static DECLCALLBACK(bool) <API key>(PPDMDEVINS pDevIns, const char *pszFile, unsigned iLine, const char *pszFunction)
{
<API key>(pDevIns);
if (!VM_IS_EMT(pDevIns->Internal.s.pVMR3))
return true;
char szMsg[100];
RTStrPrintf(szMsg, sizeof(szMsg), "AssertOther '%s'/%d\n", pDevIns->pReg->szName, pDevIns->iInstance);
RTAssertMsg1Weak(szMsg, iLine, pszFile, pszFunction);
AssertBreakpoint();
return false;
}
/** @<API key>{PDMDEVHLP,<API key>} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, void *pvInterface, size_t cbInterface,
const char *pszSymPrefix, const char *pszSymList)
{
<API key>(pDevIns);
VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
LogFlow(("<API key>: caller='%s'/%d: pvInterface=%p cbInterface=%zu pszSymPrefix=%p:{%s} pszSymList=%p:{%s}\n",
pDevIns->pReg->szName, pDevIns->iInstance, pvInterface, cbInterface, pszSymPrefix, pszSymPrefix, pszSymList, pszSymList));
int rc;
if ( strncmp(pszSymPrefix, "dev", 3) == 0
&& RTStrIStr(pszSymPrefix + 3, pDevIns->pReg->szName) != NULL)
{
if (pDevIns->pReg->fFlags & PDM_DEVREG_FLAGS_RC)
rc = <API key>(pDevIns->Internal.s.pVMR3,
pvInterface, cbInterface,
pDevIns->pReg->szRCMod, pDevIns->Internal.s.pDevR3->pszRCSearchPath,
pszSymPrefix, pszSymList,
false /*fRing0OrRC*/);
else
{
AssertMsgFailed(("Not a raw-mode enabled driver\n"));
rc = <API key>;
}
}
else
{
AssertMsgFailed(("Invalid prefix '%s' for '%s'; must start with 'dev' and contain the driver name!\n",
pszSymPrefix, pDevIns->pReg->szName));
rc = VERR_INVALID_NAME;
}
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName,
pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLP,<API key>} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, void *pvInterface, size_t cbInterface,
const char *pszSymPrefix, const char *pszSymList)
{
<API key>(pDevIns);
VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
LogFlow(("<API key>: caller='%s'/%d: pvInterface=%p cbInterface=%zu pszSymPrefix=%p:{%s} pszSymList=%p:{%s}\n",
pDevIns->pReg->szName, pDevIns->iInstance, pvInterface, cbInterface, pszSymPrefix, pszSymPrefix, pszSymList, pszSymList));
int rc;
if ( strncmp(pszSymPrefix, "dev", 3) == 0
&& RTStrIStr(pszSymPrefix + 3, pDevIns->pReg->szName) != NULL)
{
if (pDevIns->pReg->fFlags & PDM_DEVREG_FLAGS_R0)
rc = <API key>(pDevIns->Internal.s.pVMR3,
pvInterface, cbInterface,
pDevIns->pReg->szR0Mod, pDevIns->Internal.s.pDevR3->pszR0SearchPath,
pszSymPrefix, pszSymList,
true /*fRing0OrRC*/);
else
{
AssertMsgFailed(("Not a ring-0 enabled driver\n"));
rc = <API key>;
}
}
else
{
AssertMsgFailed(("Invalid prefix '%s' for '%s'; must start with 'dev' and contain the driver name!\n",
pszSymPrefix, pDevIns->pReg->szName));
rc = VERR_INVALID_NAME;
}
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName,
pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLP,pfnCallR0} */
static DECLCALLBACK(int) pdmR3DevHlp_CallR0(PPDMDEVINS pDevIns, uint32_t uOperation, uint64_t u64Arg)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
LogFlow(("pdmR3DevHlp_CallR0: caller='%s'/%d: uOperation=%#x u64Arg=%#RX64\n",
pDevIns->pReg->szName, pDevIns->iInstance, uOperation, u64Arg));
/*
* Resolve the ring-0 entry point. There is not need to remember this like
* we do for drivers since this is mainly for construction time hacks and
* other things that aren't performance critical.
*/
int rc;
if (pDevIns->pReg->fFlags & PDM_DEVREG_FLAGS_R0)
{
char szSymbol[ sizeof("devR0") + sizeof(pDevIns->pReg->szName) + sizeof("ReqHandler")];
strcat(strcat(strcpy(szSymbol, "devR0"), pDevIns->pReg->szName), "ReqHandler");
szSymbol[sizeof("devR0") - 1] = RT_C_TO_UPPER(szSymbol[sizeof("devR0") - 1]);
<API key> pfnReqHandlerR0;
rc = <API key>(pDevIns, szSymbol, &pfnReqHandlerR0);
if (RT_SUCCESS(rc))
{
/*
* Make the ring-0 call.
*/
<API key> Req;
Req.Hdr.u32Magic = <API key>;
Req.Hdr.cbReq = sizeof(Req);
Req.pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);
Req.pfnReqHandlerR0 = pfnReqHandlerR0;
Req.uOperation = uOperation;
Req.u32Alignment = 0;
Req.u64Arg = u64Arg;
rc = SUPR3CallVMMR0Ex(pVM->pVMR0, NIL_VMCPUID, <API key>, 0, &Req.Hdr);
}
else
pfnReqHandlerR0 = NIL_RTR0PTR;
}
else
rc = VERR_ACCESS_DENIED;
LogFlow(("pdmR3DevHlp_CallR0: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName,
pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLP,<API key>} */
static DECLCALLBACK(VMSUSPENDREASON) <API key>(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
VMSUSPENDREASON enmReason = <API key>(pVM->pUVM);
LogFlow(("<API key>: caller='%s'/%d: returns %d\n",
pDevIns->pReg->szName, pDevIns->iInstance, enmReason));
return enmReason;
}
/** @<API key>{PDMDEVHLP,<API key>} */
static DECLCALLBACK(VMRESUMEREASON) <API key>(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
VMRESUMEREASON enmReason = VMR3GetResumeReason(pVM->pUVM);
LogFlow(("<API key>: caller='%s'/%d: returns %d\n",
pDevIns->pReg->szName, pDevIns->iInstance, enmReason));
return enmReason;
}
/** @<API key>{PDMDEVHLPR3,pfnGetUVM} */
static DECLCALLBACK(PUVM) pdmR3DevHlp_GetUVM(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
LogFlow(("pdmR3DevHlp_GetUVM: caller='%s'/%d: returns %p\n", pDevIns->pReg->szName, pDevIns->iInstance, pDevIns->Internal.s.pVMR3));
return pDevIns->Internal.s.pVMR3->pUVM;
}
/** @<API key>{PDMDEVHLPR3,pfnGetVM} */
static DECLCALLBACK(PVM) pdmR3DevHlp_GetVM(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
LogFlow(("pdmR3DevHlp_GetVM: caller='%s'/%d: returns %p\n", pDevIns->pReg->szName, pDevIns->iInstance, pDevIns->Internal.s.pVMR3));
return pDevIns->Internal.s.pVMR3;
}
/** @<API key>{PDMDEVHLPR3,pfnGetVMCPU} */
static DECLCALLBACK(PVMCPU) <API key>(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
LogFlow(("<API key>: caller='%s'/%d for CPU %u\n", pDevIns->pReg->szName, pDevIns->iInstance, VMMGetCpuId(pDevIns->Internal.s.pVMR3)));
return VMMGetCpu(pDevIns->Internal.s.pVMR3);
}
/** @<API key>{PDMDEVHLPR3,pfnGetCurrentCpuId} */
static DECLCALLBACK(VMCPUID) <API key>(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
VMCPUID idCpu = VMMGetCpuId(pDevIns->Internal.s.pVMR3);
LogFlow(("<API key>: caller='%s'/%d for CPU %u\n", pDevIns->pReg->szName, pDevIns->iInstance, idCpu));
return idCpu;
}
/** @<API key>{PDMDEVHLPR3,pfnPCIBusRegister} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, PPDMPCIBUSREG pPciBusReg, PCPDMPCIHLPR3 *ppPciHlpR3)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
LogFlow(("<API key>: caller='%s'/%d: pPciBusReg=%p:{.u32Version=%#x, .pfnRegisterR3=%p, .<API key>=%p, "
".pfnSetIrqR3=%p, .pfnFakePCIBIOSR3=%p, .pszSetIrqRC=%p:{%s}, .pszSetIrqR0=%p:{%s}} ppPciHlpR3=%p\n",
pDevIns->pReg->szName, pDevIns->iInstance, pPciBusReg, pPciBusReg->u32Version, pPciBusReg->pfnRegisterR3,
pPciBusReg-><API key>, pPciBusReg->pfnSetIrqR3, pPciBusReg->pfnFakePCIBIOSR3,
pPciBusReg->pszSetIrqRC, pPciBusReg->pszSetIrqRC, pPciBusReg->pszSetIrqR0, pPciBusReg->pszSetIrqR0, ppPciHlpR3));
/*
* Validate the structure.
*/
if (pPciBusReg->u32Version != <API key>)
{
AssertMsgFailed(("u32Version=%#x expected %#x\n", pPciBusReg->u32Version, <API key>));
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (version)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
if ( !pPciBusReg->pfnRegisterR3
|| !pPciBusReg-><API key>
|| !pPciBusReg->pfnSetIrqR3
|| (!pPciBusReg->pfnFakePCIBIOSR3 && !pVM->pdm.s.aPciBuses[0].pDevInsR3)) /* Only the first bus needs to do the BIOS work. */
{
Assert(pPciBusReg->pfnRegisterR3);
Assert(pPciBusReg-><API key>);
Assert(pPciBusReg->pfnSetIrqR3);
Assert(pPciBusReg->pfnFakePCIBIOSR3);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (R3 callbacks)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
if ( pPciBusReg->pszSetIrqRC
&& !VALID_PTR(pPciBusReg->pszSetIrqRC))
{
Assert(VALID_PTR(pPciBusReg->pszSetIrqRC));
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (GC callbacks)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
if ( pPciBusReg->pszSetIrqR0
&& !VALID_PTR(pPciBusReg->pszSetIrqR0))
{
Assert(VALID_PTR(pPciBusReg->pszSetIrqR0));
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (GC callbacks)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
if (!ppPciHlpR3)
{
Assert(ppPciHlpR3);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (ppPciHlpR3)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
/*
* Find free PCI bus entry.
*/
unsigned iBus = 0;
for (iBus = 0; iBus < RT_ELEMENTS(pVM->pdm.s.aPciBuses); iBus++)
if (!pVM->pdm.s.aPciBuses[iBus].pDevInsR3)
break;
if (iBus >= RT_ELEMENTS(pVM->pdm.s.aPciBuses))
{
AssertMsgFailed(("Too many PCI buses. Max=%u\n", RT_ELEMENTS(pVM->pdm.s.aPciBuses)));
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (pci bus)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
PPDMPCIBUS pPciBus = &pVM->pdm.s.aPciBuses[iBus];
/*
* Resolve and init the RC bits.
*/
if (pPciBusReg->pszSetIrqRC)
{
int rc = <API key>(pDevIns, pPciBusReg->pszSetIrqRC, &pPciBus->pfnSetIrqRC);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szRCMod, pPciBusReg->pszSetIrqRC, rc));
if (RT_FAILURE(rc))
{
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
pPciBus->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
}
else
{
pPciBus->pfnSetIrqRC = 0;
pPciBus->pDevInsRC = 0;
}
/*
* Resolve and init the R0 bits.
*/
if (pPciBusReg->pszSetIrqR0)
{
int rc = <API key>(pDevIns, pPciBusReg->pszSetIrqR0, &pPciBus->pfnSetIrqR0);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szR0Mod, pPciBusReg->pszSetIrqR0, rc));
if (RT_FAILURE(rc))
{
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
pPciBus->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);
}
else
{
pPciBus->pfnSetIrqR0 = 0;
pPciBus->pDevInsR0 = 0;
}
/*
* Init the R3 bits.
*/
pPciBus->iBus = iBus;
pPciBus->pDevInsR3 = pDevIns;
pPciBus->pfnRegisterR3 = pPciBusReg->pfnRegisterR3;
pPciBus->pfnRegisterMsiR3 = pPciBusReg->pfnRegisterMsiR3;
pPciBus-><API key> = pPciBusReg-><API key>;
pPciBus-><API key> = pPciBusReg-><API key>;
pPciBus->pfnSetIrqR3 = pPciBusReg->pfnSetIrqR3;
pPciBus->pfnFakePCIBIOSR3 = pPciBusReg->pfnFakePCIBIOSR3;
Log(("PDM: Registered PCI bus device '%s'/%d pDevIns=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, pDevIns));
/* set the helper pointer and return. */
*ppPciHlpR3 = &g_pdmR3DevPciHlp;
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, VINF_SUCCESS));
return VINF_SUCCESS;
}
/** @<API key>{PDMDEVHLPR3,pfnPICRegister} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, PPDMPICREG pPicReg, PCPDMPICHLPR3 *ppPicHlpR3)
{
<API key>(pDevIns);
VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
LogFlow(("<API key>: caller='%s'/%d: pPicReg=%p:{.u32Version=%#x, .pfnSetIrqR3=%p, .pfnGetInterruptR3=%p, .pszGetIrqRC=%p:{%s}, .pszGetInterruptRC=%p:{%s}, .pszGetIrqR0=%p:{%s}, .pszGetInterruptR0=%p:{%s} } ppPicHlpR3=%p\n",
pDevIns->pReg->szName, pDevIns->iInstance, pPicReg, pPicReg->u32Version, pPicReg->pfnSetIrqR3, pPicReg->pfnGetInterruptR3,
pPicReg->pszSetIrqRC, pPicReg->pszSetIrqRC, pPicReg->pszGetInterruptRC, pPicReg->pszGetInterruptRC,
pPicReg->pszSetIrqR0, pPicReg->pszSetIrqR0, pPicReg->pszGetInterruptR0, pPicReg->pszGetInterruptR0,
ppPicHlpR3));
/*
* Validate input.
*/
if (pPicReg->u32Version != PDM_PICREG_VERSION)
{
AssertMsgFailed(("u32Version=%#x expected %#x\n", pPicReg->u32Version, PDM_PICREG_VERSION));
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (version)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
if ( !pPicReg->pfnSetIrqR3
|| !pPicReg->pfnGetInterruptR3)
{
Assert(pPicReg->pfnSetIrqR3);
Assert(pPicReg->pfnGetInterruptR3);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (R3 callbacks)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
if ( ( pPicReg->pszSetIrqRC
|| pPicReg->pszGetInterruptRC)
&& ( !VALID_PTR(pPicReg->pszSetIrqRC)
|| !VALID_PTR(pPicReg->pszGetInterruptRC))
)
{
Assert(VALID_PTR(pPicReg->pszSetIrqRC));
Assert(VALID_PTR(pPicReg->pszGetInterruptRC));
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (RC callbacks)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
if ( pPicReg->pszSetIrqRC
&& !(pDevIns->pReg->fFlags & PDM_DEVREG_FLAGS_RC))
{
Assert(pDevIns->pReg->fFlags & PDM_DEVREG_FLAGS_RC);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (RC flag)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
if ( pPicReg->pszSetIrqR0
&& !(pDevIns->pReg->fFlags & PDM_DEVREG_FLAGS_R0))
{
Assert(pDevIns->pReg->fFlags & PDM_DEVREG_FLAGS_R0);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (R0 flag)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
if (!ppPicHlpR3)
{
Assert(ppPicHlpR3);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (ppPicHlpR3)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
/*
* Only one PIC device.
*/
PVM pVM = pDevIns->Internal.s.pVMR3;
if (pVM->pdm.s.Pic.pDevInsR3)
{
AssertMsgFailed(("Only one pic device is supported!\n"));
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
/*
* RC stuff.
*/
if (pPicReg->pszSetIrqRC)
{
int rc = <API key>(pDevIns, pPicReg->pszSetIrqRC, &pVM->pdm.s.Pic.pfnSetIrqRC);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szRCMod, pPicReg->pszSetIrqRC, rc));
if (RT_SUCCESS(rc))
{
rc = <API key>(pDevIns, pPicReg->pszGetInterruptRC, &pVM->pdm.s.Pic.pfnGetInterruptRC);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szRCMod, pPicReg->pszGetInterruptRC, rc));
}
if (RT_FAILURE(rc))
{
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
pVM->pdm.s.Pic.pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
}
else
{
pVM->pdm.s.Pic.pDevInsRC = 0;
pVM->pdm.s.Pic.pfnSetIrqRC = 0;
pVM->pdm.s.Pic.pfnGetInterruptRC = 0;
}
/*
* R0 stuff.
*/
if (pPicReg->pszSetIrqR0)
{
int rc = <API key>(pDevIns, pPicReg->pszSetIrqR0, &pVM->pdm.s.Pic.pfnSetIrqR0);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szR0Mod, pPicReg->pszSetIrqR0, rc));
if (RT_SUCCESS(rc))
{
rc = <API key>(pDevIns, pPicReg->pszGetInterruptR0, &pVM->pdm.s.Pic.pfnGetInterruptR0);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szR0Mod, pPicReg->pszGetInterruptR0, rc));
}
if (RT_FAILURE(rc))
{
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
pVM->pdm.s.Pic.pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);
Assert(pVM->pdm.s.Pic.pDevInsR0);
}
else
{
pVM->pdm.s.Pic.pfnSetIrqR0 = 0;
pVM->pdm.s.Pic.pfnGetInterruptR0 = 0;
pVM->pdm.s.Pic.pDevInsR0 = 0;
}
/*
* R3 stuff.
*/
pVM->pdm.s.Pic.pDevInsR3 = pDevIns;
pVM->pdm.s.Pic.pfnSetIrqR3 = pPicReg->pfnSetIrqR3;
pVM->pdm.s.Pic.pfnGetInterruptR3 = pPicReg->pfnGetInterruptR3;
Log(("PDM: Registered PIC device '%s'/%d pDevIns=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, pDevIns));
/* set the helper pointer and return. */
*ppPicHlpR3 = &g_pdmR3DevPicHlp;
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, VINF_SUCCESS));
return VINF_SUCCESS;
}
/** @<API key>{PDMDEVHLPR3,pfnAPICRegister} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, PPDMAPICREG pApicReg, PCPDMAPICHLPR3 *ppApicHlpR3)
{
<API key>(pDevIns);
VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
LogFlow(("<API key>: caller='%s'/%d: pApicReg=%p:{.u32Version=%#x, .pfnGetInterruptR3=%p, .pfnSetBaseR3=%p, .pfnGetBaseR3=%p, "
".pfnSetTPRR3=%p, .pfnGetTPRR3=%p, .pfnWriteMSR3=%p, .pfnReadMSR3=%p, .pfnBusDeliverR3=%p, .pfnLocalInterruptR3=%p .pfnGetTimerFreqR3=%p, pszGetInterruptRC=%p:{%s}, pszSetBaseRC=%p:{%s}, pszGetBaseRC=%p:{%s}, "
".pszSetTPRRC=%p:{%s}, .pszGetTPRRC=%p:{%s}, .pszWriteMSRRC=%p:{%s}, .pszReadMSRRC=%p:{%s}, .pszBusDeliverRC=%p:{%s}, .pszLocalInterruptRC=%p:{%s}, .pszGetTimerFreqRC=%p:{%s}} ppApicHlpR3=%p\n",
pDevIns->pReg->szName, pDevIns->iInstance, pApicReg, pApicReg->u32Version, pApicReg->pfnGetInterruptR3, pApicReg->pfnSetBaseR3,
pApicReg->pfnGetBaseR3, pApicReg->pfnSetTPRR3, pApicReg->pfnGetTPRR3, pApicReg->pfnWriteMSRR3, pApicReg->pfnReadMSRR3, pApicReg->pfnBusDeliverR3, pApicReg->pfnLocalInterruptR3, pApicReg->pfnGetTimerFreqR3, pApicReg->pszGetInterruptRC,
pApicReg->pszGetInterruptRC, pApicReg->pszSetBaseRC, pApicReg->pszSetBaseRC, pApicReg->pszGetBaseRC, pApicReg->pszGetBaseRC,
pApicReg->pszSetTPRRC, pApicReg->pszSetTPRRC, pApicReg->pszGetTPRRC, pApicReg->pszGetTPRRC, pApicReg->pszWriteMSRRC, pApicReg->pszWriteMSRRC, pApicReg->pszReadMSRRC, pApicReg->pszReadMSRRC, pApicReg->pszBusDeliverRC,
pApicReg->pszBusDeliverRC, pApicReg->pszLocalInterruptRC, pApicReg->pszLocalInterruptRC, pApicReg->pszGetTimerFreqRC, pApicReg->pszGetTimerFreqRC, ppApicHlpR3));
/*
* Validate input.
*/
if (pApicReg->u32Version != PDM_APICREG_VERSION)
{
AssertMsgFailed(("u32Version=%#x expected %#x\n", pApicReg->u32Version, PDM_APICREG_VERSION));
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (version)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
if ( !pApicReg->pfnGetInterruptR3
|| !pApicReg->pfnHasPendingIrqR3
|| !pApicReg->pfnSetBaseR3
|| !pApicReg->pfnGetBaseR3
|| !pApicReg->pfnSetTPRR3
|| !pApicReg->pfnGetTPRR3
|| !pApicReg->pfnWriteMSRR3
|| !pApicReg->pfnReadMSRR3
|| !pApicReg->pfnBusDeliverR3
|| !pApicReg->pfnLocalInterruptR3
|| !pApicReg->pfnGetTimerFreqR3)
{
Assert(pApicReg->pfnGetInterruptR3);
Assert(pApicReg->pfnHasPendingIrqR3);
Assert(pApicReg->pfnSetBaseR3);
Assert(pApicReg->pfnGetBaseR3);
Assert(pApicReg->pfnSetTPRR3);
Assert(pApicReg->pfnGetTPRR3);
Assert(pApicReg->pfnWriteMSRR3);
Assert(pApicReg->pfnReadMSRR3);
Assert(pApicReg->pfnBusDeliverR3);
Assert(pApicReg->pfnLocalInterruptR3);
Assert(pApicReg->pfnGetTimerFreqR3);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (R3 callbacks)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
if ( ( pApicReg->pszGetInterruptRC
|| pApicReg->pszHasPendingIrqRC
|| pApicReg->pszSetBaseRC
|| pApicReg->pszGetBaseRC
|| pApicReg->pszSetTPRRC
|| pApicReg->pszGetTPRRC
|| pApicReg->pszWriteMSRRC
|| pApicReg->pszReadMSRRC
|| pApicReg->pszBusDeliverRC
|| pApicReg->pszLocalInterruptRC
|| pApicReg->pszGetTimerFreqRC)
&& ( !VALID_PTR(pApicReg->pszGetInterruptRC)
|| !VALID_PTR(pApicReg->pszHasPendingIrqRC)
|| !VALID_PTR(pApicReg->pszSetBaseRC)
|| !VALID_PTR(pApicReg->pszGetBaseRC)
|| !VALID_PTR(pApicReg->pszSetTPRRC)
|| !VALID_PTR(pApicReg->pszGetTPRRC)
|| !VALID_PTR(pApicReg->pszWriteMSRRC)
|| !VALID_PTR(pApicReg->pszReadMSRRC)
|| !VALID_PTR(pApicReg->pszBusDeliverRC)
|| !VALID_PTR(pApicReg->pszLocalInterruptRC)
|| !VALID_PTR(pApicReg->pszGetTimerFreqRC))
)
{
Assert(VALID_PTR(pApicReg->pszGetInterruptRC));
Assert(VALID_PTR(pApicReg->pszHasPendingIrqRC));
Assert(VALID_PTR(pApicReg->pszSetBaseRC));
Assert(VALID_PTR(pApicReg->pszGetBaseRC));
Assert(VALID_PTR(pApicReg->pszSetTPRRC));
Assert(VALID_PTR(pApicReg->pszGetTPRRC));
Assert(VALID_PTR(pApicReg->pszReadMSRRC));
Assert(VALID_PTR(pApicReg->pszWriteMSRRC));
Assert(VALID_PTR(pApicReg->pszBusDeliverRC));
Assert(VALID_PTR(pApicReg->pszLocalInterruptRC));
Assert(VALID_PTR(pApicReg->pszGetTimerFreqRC));
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (RC callbacks)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
if ( ( pApicReg->pszGetInterruptR0
|| pApicReg->pszHasPendingIrqR0
|| pApicReg->pszSetBaseR0
|| pApicReg->pszGetBaseR0
|| pApicReg->pszSetTPRR0
|| pApicReg->pszGetTPRR0
|| pApicReg->pszWriteMSRR0
|| pApicReg->pszReadMSRR0
|| pApicReg->pszBusDeliverR0
|| pApicReg->pszLocalInterruptR0
|| pApicReg->pszGetTimerFreqR0)
&& ( !VALID_PTR(pApicReg->pszGetInterruptR0)
|| !VALID_PTR(pApicReg->pszHasPendingIrqR0)
|| !VALID_PTR(pApicReg->pszSetBaseR0)
|| !VALID_PTR(pApicReg->pszGetBaseR0)
|| !VALID_PTR(pApicReg->pszSetTPRR0)
|| !VALID_PTR(pApicReg->pszGetTPRR0)
|| !VALID_PTR(pApicReg->pszReadMSRR0)
|| !VALID_PTR(pApicReg->pszWriteMSRR0)
|| !VALID_PTR(pApicReg->pszBusDeliverR0)
|| !VALID_PTR(pApicReg->pszLocalInterruptR0)
|| !VALID_PTR(pApicReg->pszGetTimerFreqR0))
)
{
Assert(VALID_PTR(pApicReg->pszGetInterruptR0));
Assert(VALID_PTR(pApicReg->pszHasPendingIrqR0));
Assert(VALID_PTR(pApicReg->pszSetBaseR0));
Assert(VALID_PTR(pApicReg->pszGetBaseR0));
Assert(VALID_PTR(pApicReg->pszSetTPRR0));
Assert(VALID_PTR(pApicReg->pszGetTPRR0));
Assert(VALID_PTR(pApicReg->pszReadMSRR0));
Assert(VALID_PTR(pApicReg->pszWriteMSRR0));
Assert(VALID_PTR(pApicReg->pszBusDeliverR0));
Assert(VALID_PTR(pApicReg->pszLocalInterruptR0));
Assert(VALID_PTR(pApicReg->pszGetTimerFreqR0));
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (R0 callbacks)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
if (!ppApicHlpR3)
{
Assert(ppApicHlpR3);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (ppApicHlpR3)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
/*
* Only one APIC device. On SMP we have single logical device covering all LAPICs,
* as they need to communicate and share state easily.
*/
PVM pVM = pDevIns->Internal.s.pVMR3;
if (pVM->pdm.s.Apic.pDevInsR3)
{
AssertMsgFailed(("Only one apic device is supported!\n"));
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
/*
* Resolve & initialize the RC bits.
*/
if (pApicReg->pszGetInterruptRC)
{
int rc = <API key>(pDevIns, pApicReg->pszGetInterruptRC, &pVM->pdm.s.Apic.pfnGetInterruptRC);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szRCMod, pApicReg->pszGetInterruptRC, rc));
if (RT_SUCCESS(rc))
{
rc = <API key>(pDevIns, pApicReg->pszHasPendingIrqRC, &pVM->pdm.s.Apic.pfnHasPendingIrqRC);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szRCMod, pApicReg->pszHasPendingIrqRC, rc));
}
if (RT_SUCCESS(rc))
{
rc = <API key>(pDevIns, pApicReg->pszSetBaseRC, &pVM->pdm.s.Apic.pfnSetBaseRC);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szRCMod, pApicReg->pszSetBaseRC, rc));
}
if (RT_SUCCESS(rc))
{
rc = <API key>(pDevIns, pApicReg->pszGetBaseRC, &pVM->pdm.s.Apic.pfnGetBaseRC);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szRCMod, pApicReg->pszGetBaseRC, rc));
}
if (RT_SUCCESS(rc))
{
rc = <API key>(pDevIns, pApicReg->pszSetTPRRC, &pVM->pdm.s.Apic.pfnSetTPRRC);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szRCMod, pApicReg->pszSetTPRRC, rc));
}
if (RT_SUCCESS(rc))
{
rc = <API key>(pDevIns, pApicReg->pszGetTPRRC, &pVM->pdm.s.Apic.pfnGetTPRRC);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szRCMod, pApicReg->pszGetTPRRC, rc));
}
if (RT_SUCCESS(rc))
{
rc = <API key>(pDevIns, pApicReg->pszWriteMSRRC, &pVM->pdm.s.Apic.pfnWriteMSRRC);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szRCMod, pApicReg->pszWriteMSRRC, rc));
}
if (RT_SUCCESS(rc))
{
rc = <API key>(pDevIns, pApicReg->pszReadMSRRC, &pVM->pdm.s.Apic.pfnReadMSRRC);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szRCMod, pApicReg->pszReadMSRRC, rc));
}
if (RT_SUCCESS(rc))
{
rc = <API key>(pDevIns, pApicReg->pszBusDeliverRC, &pVM->pdm.s.Apic.pfnBusDeliverRC);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szRCMod, pApicReg->pszBusDeliverRC, rc));
}
if (RT_SUCCESS(rc))
{
rc = <API key>(pDevIns, pApicReg->pszLocalInterruptRC, &pVM->pdm.s.Apic.pfnLocalInterruptRC);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szRCMod, pApicReg->pszLocalInterruptRC, rc));
}
if (RT_SUCCESS(rc))
{
rc = <API key>(pDevIns, pApicReg->pszGetTimerFreqRC, &pVM->pdm.s.Apic.pfnGetTimerFreqRC);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szRCMod, pApicReg->pszGetTimerFreqRC, rc));
}
if (RT_FAILURE(rc))
{
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
pVM->pdm.s.Apic.pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
}
else
{
pVM->pdm.s.Apic.pDevInsRC = 0;
pVM->pdm.s.Apic.pfnGetInterruptRC = 0;
pVM->pdm.s.Apic.pfnHasPendingIrqRC = 0;
pVM->pdm.s.Apic.pfnSetBaseRC = 0;
pVM->pdm.s.Apic.pfnGetBaseRC = 0;
pVM->pdm.s.Apic.pfnSetTPRRC = 0;
pVM->pdm.s.Apic.pfnGetTPRRC = 0;
pVM->pdm.s.Apic.pfnWriteMSRRC = 0;
pVM->pdm.s.Apic.pfnReadMSRRC = 0;
pVM->pdm.s.Apic.pfnBusDeliverRC = 0;
pVM->pdm.s.Apic.pfnLocalInterruptRC = 0;
pVM->pdm.s.Apic.pfnGetTimerFreqRC = 0;
}
/*
* Resolve & initialize the R0 bits.
*/
if (pApicReg->pszGetInterruptR0)
{
int rc = <API key>(pDevIns, pApicReg->pszGetInterruptR0, &pVM->pdm.s.Apic.pfnGetInterruptR0);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szR0Mod, pApicReg->pszGetInterruptR0, rc));
if (RT_SUCCESS(rc))
{
rc = <API key>(pDevIns, pApicReg->pszHasPendingIrqR0, &pVM->pdm.s.Apic.pfnHasPendingIrqR0);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szR0Mod, pApicReg->pszHasPendingIrqR0, rc));
}
if (RT_SUCCESS(rc))
{
rc = <API key>(pDevIns, pApicReg->pszSetBaseR0, &pVM->pdm.s.Apic.pfnSetBaseR0);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szR0Mod, pApicReg->pszSetBaseR0, rc));
}
if (RT_SUCCESS(rc))
{
rc = <API key>(pDevIns, pApicReg->pszGetBaseR0, &pVM->pdm.s.Apic.pfnGetBaseR0);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szR0Mod, pApicReg->pszGetBaseR0, rc));
}
if (RT_SUCCESS(rc))
{
rc = <API key>(pDevIns, pApicReg->pszSetTPRR0, &pVM->pdm.s.Apic.pfnSetTPRR0);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szR0Mod, pApicReg->pszSetTPRR0, rc));
}
if (RT_SUCCESS(rc))
{
rc = <API key>(pDevIns, pApicReg->pszGetTPRR0, &pVM->pdm.s.Apic.pfnGetTPRR0);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szR0Mod, pApicReg->pszGetTPRR0, rc));
}
if (RT_SUCCESS(rc))
{
rc = <API key>(pDevIns, pApicReg->pszWriteMSRR0, &pVM->pdm.s.Apic.pfnWriteMSRR0);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szR0Mod, pApicReg->pszWriteMSRR0, rc));
}
if (RT_SUCCESS(rc))
{
rc = <API key>(pDevIns, pApicReg->pszReadMSRR0, &pVM->pdm.s.Apic.pfnReadMSRR0);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szR0Mod, pApicReg->pszReadMSRR0, rc));
}
if (RT_SUCCESS(rc))
{
rc = <API key>(pDevIns, pApicReg->pszBusDeliverR0, &pVM->pdm.s.Apic.pfnBusDeliverR0);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szR0Mod, pApicReg->pszBusDeliverR0, rc));
}
if (RT_SUCCESS(rc))
{
rc = <API key>(pDevIns, pApicReg->pszLocalInterruptR0, &pVM->pdm.s.Apic.pfnLocalInterruptR0);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szR0Mod, pApicReg->pszLocalInterruptR0, rc));
}
if (RT_SUCCESS(rc))
{
rc = <API key>(pDevIns, pApicReg->pszGetTimerFreqR0, &pVM->pdm.s.Apic.pfnGetTimerFreqR0);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szR0Mod, pApicReg->pszGetTimerFreqR0, rc));
}
if (RT_FAILURE(rc))
{
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
pVM->pdm.s.Apic.pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);
Assert(pVM->pdm.s.Apic.pDevInsR0);
}
else
{
pVM->pdm.s.Apic.pfnGetInterruptR0 = 0;
pVM->pdm.s.Apic.pfnHasPendingIrqR0 = 0;
pVM->pdm.s.Apic.pfnSetBaseR0 = 0;
pVM->pdm.s.Apic.pfnGetBaseR0 = 0;
pVM->pdm.s.Apic.pfnSetTPRR0 = 0;
pVM->pdm.s.Apic.pfnGetTPRR0 = 0;
pVM->pdm.s.Apic.pfnWriteMSRR0 = 0;
pVM->pdm.s.Apic.pfnReadMSRR0 = 0;
pVM->pdm.s.Apic.pfnBusDeliverR0 = 0;
pVM->pdm.s.Apic.pfnLocalInterruptR0 = 0;
pVM->pdm.s.Apic.pfnGetTimerFreqR0 = 0;
pVM->pdm.s.Apic.pDevInsR0 = 0;
}
/*
* Initialize the HC bits.
*/
pVM->pdm.s.Apic.pDevInsR3 = pDevIns;
pVM->pdm.s.Apic.pfnGetInterruptR3 = pApicReg->pfnGetInterruptR3;
pVM->pdm.s.Apic.pfnHasPendingIrqR3 = pApicReg->pfnHasPendingIrqR3;
pVM->pdm.s.Apic.pfnSetBaseR3 = pApicReg->pfnSetBaseR3;
pVM->pdm.s.Apic.pfnGetBaseR3 = pApicReg->pfnGetBaseR3;
pVM->pdm.s.Apic.pfnSetTPRR3 = pApicReg->pfnSetTPRR3;
pVM->pdm.s.Apic.pfnGetTPRR3 = pApicReg->pfnGetTPRR3;
pVM->pdm.s.Apic.pfnWriteMSRR3 = pApicReg->pfnWriteMSRR3;
pVM->pdm.s.Apic.pfnReadMSRR3 = pApicReg->pfnReadMSRR3;
pVM->pdm.s.Apic.pfnBusDeliverR3 = pApicReg->pfnBusDeliverR3;
pVM->pdm.s.Apic.pfnLocalInterruptR3 = pApicReg->pfnLocalInterruptR3;
pVM->pdm.s.Apic.pfnGetTimerFreqR3 = pApicReg->pfnGetTimerFreqR3;
Log(("PDM: Registered APIC device '%s'/%d pDevIns=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, pDevIns));
/* set the helper pointer and return. */
*ppApicHlpR3 = &g_pdmR3DevApicHlp;
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, VINF_SUCCESS));
return VINF_SUCCESS;
}
/** @<API key>{PDMDEVHLPR3,pfnIOAPICRegister} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, PPDMIOAPICREG pIoApicReg, PCPDMIOAPICHLPR3 *ppIoApicHlpR3)
{
<API key>(pDevIns);
VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
LogFlow(("<API key>: caller='%s'/%d: pIoApicReg=%p:{.u32Version=%#x, .pfnSetIrqR3=%p, .pszSetIrqRC=%p:{%s}, .pszSetIrqR0=%p:{%s}} ppIoApicHlpR3=%p\n",
pDevIns->pReg->szName, pDevIns->iInstance, pIoApicReg, pIoApicReg->u32Version, pIoApicReg->pfnSetIrqR3,
pIoApicReg->pszSetIrqRC, pIoApicReg->pszSetIrqRC, pIoApicReg->pszSetIrqR0, pIoApicReg->pszSetIrqR0, ppIoApicHlpR3));
/*
* Validate input.
*/
if (pIoApicReg->u32Version != <API key>)
{
AssertMsgFailed(("u32Version=%#x expected %#x\n", pIoApicReg->u32Version, <API key>));
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (version)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
if (!pIoApicReg->pfnSetIrqR3 || !pIoApicReg->pfnSendMsiR3)
{
Assert(pIoApicReg->pfnSetIrqR3);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (R3 callbacks)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
if ( pIoApicReg->pszSetIrqRC
&& !VALID_PTR(pIoApicReg->pszSetIrqRC))
{
Assert(VALID_PTR(pIoApicReg->pszSetIrqRC));
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (GC callbacks)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
if ( pIoApicReg->pszSendMsiRC
&& !VALID_PTR(pIoApicReg->pszSendMsiRC))
{
Assert(VALID_PTR(pIoApicReg->pszSendMsiRC));
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (GC callbacks)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
if ( pIoApicReg->pszSetIrqR0
&& !VALID_PTR(pIoApicReg->pszSetIrqR0))
{
Assert(VALID_PTR(pIoApicReg->pszSetIrqR0));
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (GC callbacks)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
if ( pIoApicReg->pszSendMsiR0
&& !VALID_PTR(pIoApicReg->pszSendMsiR0))
{
Assert(VALID_PTR(pIoApicReg->pszSendMsiR0));
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (GC callbacks)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
if (!ppIoApicHlpR3)
{
Assert(ppIoApicHlpR3);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (ppApicHlp)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
/*
* The I/O APIC requires the APIC to be present (hacks++).
* If the I/O APIC does GC stuff so must the APIC.
*/
PVM pVM = pDevIns->Internal.s.pVMR3;
if (!pVM->pdm.s.Apic.pDevInsR3)
{
AssertMsgFailed(("Configuration error / Init order error! No APIC!\n"));
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (no APIC)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
if ( pIoApicReg->pszSetIrqRC
&& !pVM->pdm.s.Apic.pDevInsRC)
{
AssertMsgFailed(("Configuration error! APIC doesn't do GC, I/O APIC does!\n"));
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (no GC APIC)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
/*
* Only one I/O APIC device.
*/
if (pVM->pdm.s.IoApic.pDevInsR3)
{
AssertMsgFailed(("Only one ioapic device is supported!\n"));
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (only one)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
/*
* Resolve & initialize the GC bits.
*/
if (pIoApicReg->pszSetIrqRC)
{
int rc = <API key>(pDevIns, pIoApicReg->pszSetIrqRC, &pVM->pdm.s.IoApic.pfnSetIrqRC);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szRCMod, pIoApicReg->pszSetIrqRC, rc));
if (RT_FAILURE(rc))
{
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
pVM->pdm.s.IoApic.pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
}
else
{
pVM->pdm.s.IoApic.pDevInsRC = 0;
pVM->pdm.s.IoApic.pfnSetIrqRC = 0;
}
if (pIoApicReg->pszSendMsiRC)
{
int rc = <API key>(pDevIns, pIoApicReg->pszSetIrqRC, &pVM->pdm.s.IoApic.pfnSendMsiRC);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szRCMod, pIoApicReg->pszSendMsiRC, rc));
if (RT_FAILURE(rc))
{
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
}
else
{
pVM->pdm.s.IoApic.pfnSendMsiRC = 0;
}
/*
* Resolve & initialize the R0 bits.
*/
if (pIoApicReg->pszSetIrqR0)
{
int rc = <API key>(pDevIns, pIoApicReg->pszSetIrqR0, &pVM->pdm.s.IoApic.pfnSetIrqR0);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szR0Mod, pIoApicReg->pszSetIrqR0, rc));
if (RT_FAILURE(rc))
{
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
pVM->pdm.s.IoApic.pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);
Assert(pVM->pdm.s.IoApic.pDevInsR0);
}
else
{
pVM->pdm.s.IoApic.pfnSetIrqR0 = 0;
pVM->pdm.s.IoApic.pDevInsR0 = 0;
}
if (pIoApicReg->pszSendMsiR0)
{
int rc = <API key>(pDevIns, pIoApicReg->pszSendMsiR0, &pVM->pdm.s.IoApic.pfnSendMsiR0);
AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szR0Mod, pIoApicReg->pszSendMsiR0, rc));
if (RT_FAILURE(rc))
{
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
}
else
{
pVM->pdm.s.IoApic.pfnSendMsiR0 = 0;
}
/*
* Initialize the R3 bits.
*/
pVM->pdm.s.IoApic.pDevInsR3 = pDevIns;
pVM->pdm.s.IoApic.pfnSetIrqR3 = pIoApicReg->pfnSetIrqR3;
pVM->pdm.s.IoApic.pfnSendMsiR3 = pIoApicReg->pfnSendMsiR3;
Log(("PDM: Registered I/O APIC device '%s'/%d pDevIns=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, pDevIns));
/* set the helper pointer and return. */
*ppIoApicHlpR3 = &g_pdmR3DevIoApicHlp;
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, VINF_SUCCESS));
return VINF_SUCCESS;
}
/** @<API key>{PDMDEVHLPR3,pfnHPETRegister} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, PPDMHPETREG pHpetReg, PCPDMHPETHLPR3 *ppHpetHlpR3)
{
<API key>(pDevIns);
VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
LogFlow(("<API key>: caller='%s'/%d:\n"));
/*
* Validate input.
*/
if (pHpetReg->u32Version != PDM_HPETREG_VERSION)
{
AssertMsgFailed(("u32Version=%#x expected %#x\n", pHpetReg->u32Version, PDM_HPETREG_VERSION));
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (version)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
if (!ppHpetHlpR3)
{
Assert(ppHpetHlpR3);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (ppApicHlpR3)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
/* set the helper pointer and return. */
*ppHpetHlpR3 = &g_pdmR3DevHpetHlp;
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, VINF_SUCCESS));
return VINF_SUCCESS;
}
/** @<API key>{PDMDEVHLPR3,pfnPciRawRegister} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, PPDMPCIRAWREG pPciRawReg, PCPDMPCIRAWHLPR3 *ppPciRawHlpR3)
{
<API key>(pDevIns);
VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
LogFlow(("<API key>: caller='%s'/%d:\n"));
/*
* Validate input.
*/
if (pPciRawReg->u32Version != <API key>)
{
AssertMsgFailed(("u32Version=%#x expected %#x\n", pPciRawReg->u32Version, <API key>));
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (version)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
if (!ppPciRawHlpR3)
{
Assert(ppPciRawHlpR3);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (ppApicHlpR3)\n", pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
/* set the helper pointer and return. */
*ppPciRawHlpR3 = &g_pdmR3DevPciRawHlp;
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, VINF_SUCCESS));
return VINF_SUCCESS;
}
/** @<API key>{PDMDEVHLPR3,pfnDMACRegister} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, PPDMDMACREG pDmacReg, PCPDMDMACHLP *ppDmacHlp)
{
<API key>(pDevIns);
VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
LogFlow(("<API key>: caller='%s'/%d: pDmacReg=%p:{.u32Version=%#x, .pfnRun=%p, .pfnRegister=%p, .pfnReadMemory=%p, .pfnWriteMemory=%p, .pfnSetDREQ=%p, .pfnGetChannelMode=%p} ppDmacHlp=%p\n",
pDevIns->pReg->szName, pDevIns->iInstance, pDmacReg, pDmacReg->u32Version, pDmacReg->pfnRun, pDmacReg->pfnRegister,
pDmacReg->pfnReadMemory, pDmacReg->pfnWriteMemory, pDmacReg->pfnSetDREQ, pDmacReg->pfnGetChannelMode, ppDmacHlp));
/*
* Validate input.
*/
if (pDmacReg->u32Version != PDM_DMACREG_VERSION)
{
AssertMsgFailed(("u32Version=%#x expected %#x\n", pDmacReg->u32Version,
PDM_DMACREG_VERSION));
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (version)\n",
pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
if ( !pDmacReg->pfnRun
|| !pDmacReg->pfnRegister
|| !pDmacReg->pfnReadMemory
|| !pDmacReg->pfnWriteMemory
|| !pDmacReg->pfnSetDREQ
|| !pDmacReg->pfnGetChannelMode)
{
Assert(pDmacReg->pfnRun);
Assert(pDmacReg->pfnRegister);
Assert(pDmacReg->pfnReadMemory);
Assert(pDmacReg->pfnWriteMemory);
Assert(pDmacReg->pfnSetDREQ);
Assert(pDmacReg->pfnGetChannelMode);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (callbacks)\n",
pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
if (!ppDmacHlp)
{
Assert(ppDmacHlp);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc (ppDmacHlp)\n",
pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
/*
* Only one DMA device.
*/
PVM pVM = pDevIns->Internal.s.pVMR3;
if (pVM->pdm.s.pDmac)
{
AssertMsgFailed(("Only one DMA device is supported!\n"));
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n",
pDevIns->pReg->szName, pDevIns->iInstance, <API key>));
return <API key>;
}
/*
* Allocate and initialize pci bus structure.
*/
int rc = VINF_SUCCESS;
PPDMDMAC pDmac = (PPDMDMAC)MMR3HeapAlloc(pDevIns->Internal.s.pVMR3, MM_TAG_PDM_DEVICE, sizeof(*pDmac));
if (pDmac)
{
pDmac->pDevIns = pDevIns;
pDmac->Reg = *pDmacReg;
pVM->pdm.s.pDmac = pDmac;
/* set the helper pointer. */
*ppDmacHlp = &g_pdmR3DevDmacHlp;
Log(("PDM: Registered DMAC device '%s'/%d pDevIns=%p\n",
pDevIns->pReg->szName, pDevIns->iInstance, pDevIns));
}
else
rc = VERR_NO_MEMORY;
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n",
pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/**
* @copydoc PDMDEVHLPR3::<API key>
*/
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTR3PTR pvHeap, unsigned cbSize)
{
<API key>(pDevIns);
VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
int rc = <API key>(pDevIns->Internal.s.pVMR3, GCPhys, pvHeap, cbSize);
return rc;
}
/**
* @copydoc PDMDEVHLPR3::<API key>
*/
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, RTGCPHYS GCPhys)
{
<API key>(pDevIns);
VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
int rc = <API key>(pDevIns->Internal.s.pVMR3, GCPhys);
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnVMReset} */
static DECLCALLBACK(int) pdmR3DevHlp_VMReset(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
LogFlow(("pdmR3DevHlp_VMReset: caller='%s'/%d: VM_FF_RESET %d -> 1\n",
pDevIns->pReg->szName, pDevIns->iInstance, VM_FF_IS_SET(pVM, VM_FF_RESET)));
/*
* We postpone this operation because we're likely to be inside a I/O instruction
* and the EIP will be updated when we return.
* We still return VINF_EM_RESET to break out of any execution loops and force FF evaluation.
*/
bool fHaltOnReset;
int rc = CFGMR3QueryBool(CFGMR3GetChild(CFGMR3GetRoot(pVM), "PDM"), "HaltOnReset", &fHaltOnReset);
if (RT_SUCCESS(rc) && fHaltOnReset)
{
Log(("pdmR3DevHlp_VMReset: Halt On Reset!\n"));
rc = VINF_EM_HALT;
}
else
{
VM_FF_SET(pVM, VM_FF_RESET);
rc = VINF_EM_RESET;
}
LogFlow(("pdmR3DevHlp_VMReset: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnVMSuspend} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns)
{
int rc;
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
LogFlow(("<API key>: caller='%s'/%d:\n",
pDevIns->pReg->szName, pDevIns->iInstance));
/** @todo Always take the SMP path - fewer code paths. */
if (pVM->cCpus > 1)
{
/* We own the IOM lock here and could cause a deadlock by waiting for a VCPU that is blocking on the IOM lock. */
rc = VMR3ReqCallNoWait(pVM, VMCPUID_ANY_QUEUE, (PFNRT)VMR3Suspend, 2, pVM->pUVM, VMSUSPENDREASON_VM);
AssertRC(rc);
rc = VINF_EM_SUSPEND;
}
else
rc = VMR3Suspend(pVM->pUVM, VMSUSPENDREASON_VM);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/**
* Worker for <API key> that is invoked via a queued
* EMT request to avoid deadlocks.
*
* @returns VBox status code fit for scheduling.
* @param pVM Pointer to the VM.
* @param pDevIns The device that triggered this action.
*/
static DECLCALLBACK(int) <API key>(PVM pVM, PPDMDEVINS pDevIns)
{
/*
* Suspend the VM first then do the saving.
*/
int rc = VMR3Suspend(pVM->pUVM, VMSUSPENDREASON_VM);
if (RT_SUCCESS(rc))
{
PUVM pUVM = pVM->pUVM;
rc = pUVM->pVmm2UserMethods->pfnSaveState(pVM->pUVM->pVmm2UserMethods, pUVM);
/*
* On success, power off the VM, on failure we'll leave it suspended.
*/
if (RT_SUCCESS(rc))
{
rc = VMR3PowerOff(pVM->pUVM);
if (RT_FAILURE(rc))
LogRel(("%s/SSP: VMR3PowerOff failed: %Rrc\n", pDevIns->pReg->szName, rc));
}
else
LogRel(("%s/SSP: pfnSaveState failed: %Rrc\n", pDevIns->pReg->szName, rc));
}
else
LogRel(("%s/SSP: Suspend failed: %Rrc\n", pDevIns->pReg->szName, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,<API key>} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
LogFlow(("<API key>: caller='%s'/%d:\n",
pDevIns->pReg->szName, pDevIns->iInstance));
int rc;
if ( pVM->pUVM->pVmm2UserMethods
&& pVM->pUVM->pVmm2UserMethods->pfnSaveState)
{
rc = VMR3ReqCallNoWait(pVM, VMCPUID_ANY_QUEUE, (PFNRT)<API key>, 2, pVM, pDevIns);
if (RT_SUCCESS(rc))
{
LogRel(("%s: Suspending, Saving and Powering Off the VM\n", pDevIns->pReg->szName));
rc = VINF_EM_SUSPEND;
}
}
else
rc = VERR_NOT_SUPPORTED;
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnVMPowerOff} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns)
{
int rc;
<API key>(pDevIns);
PVM pVM = pDevIns->Internal.s.pVMR3;
VM_ASSERT_EMT(pVM);
LogFlow(("<API key>: caller='%s'/%d:\n",
pDevIns->pReg->szName, pDevIns->iInstance));
/** @todo Always take the SMP path - fewer code paths. */
if (pVM->cCpus > 1)
{
/* We might be holding locks here and could cause a deadlock since
VMR3PowerOff rendezvous with the other CPUs. */
rc = VMR3ReqCallNoWait(pVM, VMCPUID_ANY_QUEUE, (PFNRT)VMR3PowerOff, 1, pVM->pUVM);
AssertRC(rc);
/* Set the VCPU state to stopped here as well to make sure no
inconsistency with the EM state occurs. */
VMCPU_SET_STATE(VMMGetCpu(pVM), VMCPUSTATE_STOPPED);
rc = VINF_EM_OFF;
}
else
rc = VMR3PowerOff(pVM->pUVM);
LogFlow(("<API key>: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
return rc;
}
/** @<API key>{PDMDEVHLPR3,pfnA20IsEnabled} */
static DECLCALLBACK(bool) <API key>(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
bool fRc = PGMPhysIsA20Enabled(VMMGetCpu(pDevIns->Internal.s.pVMR3));
LogFlow(("<API key>: caller='%s'/%d: returns %d\n", pDevIns->pReg->szName, pDevIns->iInstance, fRc));
return fRc;
}
/** @<API key>{PDMDEVHLPR3,pfnA20Set} */
static DECLCALLBACK(void) pdmR3DevHlp_A20Set(PPDMDEVINS pDevIns, bool fEnable)
{
<API key>(pDevIns);
VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
LogFlow(("pdmR3DevHlp_A20Set: caller='%s'/%d: fEnable=%d\n", pDevIns->pReg->szName, pDevIns->iInstance, fEnable));
PGMR3PhysSetA20(VMMGetCpu(pDevIns->Internal.s.pVMR3), fEnable);
}
/** @<API key>{PDMDEVHLPR3,pfnGetCpuId} */
static DECLCALLBACK(void) <API key>(PPDMDEVINS pDevIns, uint32_t iLeaf,
uint32_t *pEax, uint32_t *pEbx, uint32_t *pEcx, uint32_t *pEdx)
{
<API key>(pDevIns);
VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
LogFlow(("<API key>: caller='%s'/%d: iLeaf=%d pEax=%p pEbx=%p pEcx=%p pEdx=%p\n",
pDevIns->pReg->szName, pDevIns->iInstance, iLeaf, pEax, pEbx, pEcx, pEdx));
AssertPtr(pEax); AssertPtr(pEbx); AssertPtr(pEcx); AssertPtr(pEdx);
CPUMGetGuestCpuId(VMMGetCpu(pDevIns->Internal.s.pVMR3), iLeaf, 0 /*iSubLeaf*/, pEax, pEbx, pEcx, pEdx);
LogFlow(("<API key>: caller='%s'/%d: returns void - *pEax=%#x *pEbx=%#x *pEcx=%#x *pEdx=%#x\n",
pDevIns->pReg->szName, pDevIns->iInstance, *pEax, *pEbx, *pEcx, *pEdx));
}
/**
* The device helper structure for trusted devices.
*/
const PDMDEVHLPR3 <API key> =
{
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
pdmR3DevHlp_VMState,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
pdmR3DevHlp_CallR0,
<API key>,
<API key>,
0,
0,
0,
0,
0,
0,
0,
pdmR3DevHlp_GetUVM,
pdmR3DevHlp_GetVM,
<API key>,
<API key>,
<API key>,
<API key>,
pdmR3DevHlp_VMReset,
<API key>,
<API key>,
<API key>,
<API key>,
pdmR3DevHlp_A20Set,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key> /* the end */
};
/** @<API key>{PDMDEVHLPR3,pfnGetUVM} */
static DECLCALLBACK(PUVM) <API key>(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
<API key>(("Untrusted device called trusted helper! '%s'/%d\n", pDevIns->pReg->szName, pDevIns->iInstance));
return NULL;
}
/** @<API key>{PDMDEVHLPR3,pfnGetVM} */
static DECLCALLBACK(PVM) <API key>(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
<API key>(("Untrusted device called trusted helper! '%s'/%d\n", pDevIns->pReg->szName, pDevIns->iInstance));
return NULL;
}
/** @<API key>{PDMDEVHLPR3,pfnGetVMCPU} */
static DECLCALLBACK(PVMCPU) <API key>(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
<API key>(("Untrusted device called trusted helper! '%s'/%d\n", pDevIns->pReg->szName, pDevIns->iInstance));
return NULL;
}
/** @<API key>{PDMDEVHLPR3,pfnGetCurrentCpuId} */
static DECLCALLBACK(VMCPUID) <API key>(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
<API key>(("Untrusted device called trusted helper! '%s'/%d\n", pDevIns->pReg->szName, pDevIns->iInstance));
return NIL_VMCPUID;
}
/** @<API key>{PDMDEVHLPR3,<API key>} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTR3PTR pvHeap, unsigned cbSize)
{
<API key>(pDevIns);
NOREF(GCPhys); NOREF(pvHeap); NOREF(cbSize);
<API key>(("Untrusted device called trusted helper! '%s'/%d\n", pDevIns->pReg->szName, pDevIns->iInstance));
return VERR_ACCESS_DENIED;
}
/** @<API key>{PDMDEVHLPR3,<API key>} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns, RTGCPHYS GCPhys)
{
<API key>(pDevIns);
NOREF(GCPhys);
<API key>(("Untrusted device called trusted helper! '%s'/%d\n", pDevIns->pReg->szName, pDevIns->iInstance));
return VERR_ACCESS_DENIED;
}
/** @<API key>{PDMDEVHLPR3,pfnVMReset} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
<API key>(("Untrusted device called trusted helper! '%s'/%d\n", pDevIns->pReg->szName, pDevIns->iInstance));
return VERR_ACCESS_DENIED;
}
/** @<API key>{PDMDEVHLPR3,pfnVMSuspend} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
<API key>(("Untrusted device called trusted helper! '%s'/%d\n", pDevIns->pReg->szName, pDevIns->iInstance));
return VERR_ACCESS_DENIED;
}
/** @<API key>{PDMDEVHLPR3,<API key>} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
<API key>(("Untrusted device called trusted helper! '%s'/%d\n", pDevIns->pReg->szName, pDevIns->iInstance));
return VERR_ACCESS_DENIED;
}
/** @<API key>{PDMDEVHLPR3,pfnVMPowerOff} */
static DECLCALLBACK(int) <API key>(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
<API key>(("Untrusted device called trusted helper! '%s'/%d\n", pDevIns->pReg->szName, pDevIns->iInstance));
return VERR_ACCESS_DENIED;
}
/** @<API key>{PDMDEVHLPR3,pfnA20IsEnabled} */
static DECLCALLBACK(bool) <API key>(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
<API key>(("Untrusted device called trusted helper! '%s'/%d\n", pDevIns->pReg->szName, pDevIns->iInstance));
return false;
}
/** @<API key>{PDMDEVHLPR3,pfnA20Set} */
static DECLCALLBACK(void) <API key>(PPDMDEVINS pDevIns, bool fEnable)
{
<API key>(pDevIns);
<API key>(("Untrusted device called trusted helper! '%s'/%d\n", pDevIns->pReg->szName, pDevIns->iInstance));
NOREF(fEnable);
}
/** @<API key>{PDMDEVHLPR3,pfnGetCpuId} */
static DECLCALLBACK(void) <API key>(PPDMDEVINS pDevIns, uint32_t iLeaf,
uint32_t *pEax, uint32_t *pEbx, uint32_t *pEcx, uint32_t *pEdx)
{
<API key>(pDevIns);
NOREF(iLeaf); NOREF(pEax); NOREF(pEbx); NOREF(pEcx); NOREF(pEdx);
<API key>(("Untrusted device called trusted helper! '%s'/%d\n", pDevIns->pReg->szName, pDevIns->iInstance));
}
/** @<API key>{PDMDEVHLPR3,pfnGetSupDrvSession} */
static DECLCALLBACK(PSUPDRVSESSION) <API key>(PPDMDEVINS pDevIns)
{
<API key>(pDevIns);
<API key>(("Untrusted device called trusted helper! '%s'/%d\n", pDevIns->pReg->szName, pDevIns->iInstance));
return (PSUPDRVSESSION)0;
}
/**
* The device helper structure for non-trusted devices.
*/
const PDMDEVHLPR3 <API key> =
{
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
pdmR3DevHlp_VMState,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
pdmR3DevHlp_CallR0,
<API key>,
<API key>,
0,
0,
0,
0,
0,
0,
0,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key> /* the end */
};
/**
* Queue consumer callback for internal component.
*
* @returns Success indicator.
* If false the item will not be removed and the flushing will stop.
* @param pVM Pointer to the VM.
* @param pItem The item to consume. Upon return this item will be freed.
*/
DECLCALLBACK(bool) <API key>(PVM pVM, PPDMQUEUEITEMCORE pItem)
{
PPDMDEVHLPTASK pTask = (PPDMDEVHLPTASK)pItem;
LogFlow(("<API key>: enmOp=%d pDevIns=%p\n", pTask->enmOp, pTask->pDevInsR3));
switch (pTask->enmOp)
{
case <API key>:
PDMIsaSetIrq(pVM, pTask->u.SetIRQ.iIrq, pTask->u.SetIRQ.iLevel, pTask->u.SetIRQ.uTagSrc);
break;
case <API key>:
{
/* Same as <API key>, except we've got a tag already. */
PPDMDEVINS pDevIns = pTask->pDevInsR3;
PPCIDEVICE pPciDev = pDevIns->Internal.s.pPciDeviceR3;
if (pPciDev)
{
PPDMPCIBUS pBus = pDevIns->Internal.s.pPciBusR3; /** @todo the bus should be associated with the PCI device not the PDM device. */
Assert(pBus);
pdmLock(pVM);
pBus->pfnSetIrqR3(pBus->pDevInsR3, pPciDev, pTask->u.SetIRQ.iIrq,
pTask->u.SetIRQ.iLevel, pTask->u.SetIRQ.uTagSrc);
pdmUnlock(pVM);
}
else
<API key>(("No PCI device registered!\n"));
break;
}
case <API key>:
PDMIoApicSetIrq(pVM, pTask->u.SetIRQ.iIrq, pTask->u.SetIRQ.iLevel, pTask->u.SetIRQ.uTagSrc);
break;
default:
<API key>(("Invalid operation %d\n", pTask->enmOp));
break;
}
return true;
}
|
package com.avrgaming.civcraft.endgame;
import java.util.ArrayList;
import com.avrgaming.civcraft.main.CivGlobal;
import com.avrgaming.civcraft.main.CivMessage;
import com.avrgaming.civcraft.object.Civilization;
import com.avrgaming.civcraft.object.Town;
import com.avrgaming.civcraft.sessiondb.SessionEntry;
import com.avrgaming.civcraft.structure.wonders.Wonder;
public class EndConditionScience extends EndGameCondition {
String techname;
@Override
public void onLoad() {
techname = this.getString("tech");
}
@Override
public boolean check(Civilization civ) {
if (!civ.hasTechnology(techname)) {
return false;
}
if (civ.isAdminCiv()) {
return false;
}
boolean hasGreatLibrary = false;
for (Town town : civ.getTowns()) {
if (town.getMotherCiv() != null) {
continue;
}
for (Wonder wonder :town.getWonders()) {
if (wonder.isActive()) {
if (wonder.getConfigId().equals("w_greatlibrary")) {
hasGreatLibrary = true;
break;
}
}
}
if (hasGreatLibrary) {
break;
}
}
if (!hasGreatLibrary) {
return false;
}
return true;
}
@Override
public boolean finalWinCheck(Civilization civ) {
Civilization rival = <API key>();
if (rival != civ) {
CivMessage.global(civ.getName()+" doesn't have enough beakers for a scientific victory. The rival civilization of "+rival.getName()+" has more!");
return false;
}
return true;
}
public Civilization <API key>() {
double most = 0;
Civilization mostCiv = null;
for (Civilization civ : CivGlobal.getCivs()) {
double beakers = <API key>(civ);
if (beakers > most) {
most = beakers;
mostCiv = civ;
}
}
return mostCiv;
}
@Override
public String getSessionKey() {
return "endgame:science";
}
@Override
protected void onWarDefeat(Civilization civ) {
/* remove any extra beakers we might have. */
CivGlobal.getSessionDB().delete_all(getBeakerSessionKey(civ));
civ.removeTech(techname);
CivMessage.sendCiv(civ, "We were defeated while trying to achieve a science victory! We've lost all of our accumulated beakers and our victory tech!");
civ.save();
this.onFailure(civ);
}
public static String getBeakerSessionKey(Civilization civ) {
return "endgame:sciencebeakers:"+civ.getId();
}
public double <API key>(Civilization civ) {
ArrayList<SessionEntry> entries = CivGlobal.getSessionDB().lookup(getBeakerSessionKey(civ));
if (entries.size() == 0) {
return 0;
}
return Double.valueOf(entries.get(0).value);
}
public void <API key>(Civilization civ, double beakers) {
ArrayList<SessionEntry> entries = CivGlobal.getSessionDB().lookup(getBeakerSessionKey(civ));
double current = 0;
if (entries.size() == 0) {
CivGlobal.getSessionDB().add(getBeakerSessionKey(civ), ""+beakers, civ.getId(), 0, 0);
current += beakers;
} else {
current = Double.valueOf(entries.get(0).value);
current += beakers;
CivGlobal.getSessionDB().update(entries.get(0).request_id, entries.get(0).key, ""+current);
}
//DecimalFormat df = new DecimalFormat("
//CivMessage.sendCiv(civ, "Added "+df.format(beakers)+" beakers to our scientific victory! We now have "+df.format(current)+" beakers saved up.");
}
public static Double getBeakersFor(Civilization civ) {
ArrayList<SessionEntry> entries = CivGlobal.getSessionDB().lookup(getBeakerSessionKey(civ));
if (entries.size() == 0) {
return 0.0;
} else {
return Double.valueOf(entries.get(0).value);
}
}
}
|
package org.visage.jdi.request;
import org.visage.jdi.<API key>;
import org.visage.jdi.<API key>;
import org.visage.jdi.VisageWrapper;
import com.sun.jdi.ObjectReference;
import com.sun.jdi.ReferenceType;
import com.sun.jdi.request.StepRequest;
/**
*
* @author sundar
*/
public class VisageStepRequest extends VisageEventRequest implements StepRequest {
public VisageStepRequest(<API key> visagevm, StepRequest underlying) {
super(visagevm, underlying);
}
public void <API key>(String arg0) {
underlying().<API key>(arg0);
}
public void addClassFilter(ReferenceType arg0) {
underlying().addClassFilter(VisageWrapper.unwrap(arg0));
}
public void addClassFilter(String arg0) {
underlying().addClassFilter(arg0);
}
public void addInstanceFilter(ObjectReference ref) {
underlying().addInstanceFilter(VisageWrapper.unwrap(ref));
}
public int depth() {
return underlying().depth();
}
public int size() {
return underlying().size();
}
public <API key> thread() {
return VisageWrapper.wrap(virtualMachine(), underlying().thread());
}
@Override
protected StepRequest underlying() {
return (StepRequest) super.underlying();
}
}
|
#include "bmalloc.h"
#define EXPORT __attribute__((visibility("default")))
extern "C" {
EXPORT void* mbmalloc(size_t);
EXPORT void* mbmemalign(size_t, size_t);
EXPORT void mbfree(void*, size_t);
EXPORT void* mbrealloc(void*, size_t, size_t);
EXPORT void mbscavenge();
void* mbmalloc(size_t size)
{
return bmalloc::api::malloc(size);
}
void* mbmemalign(size_t alignment, size_t size)
{
return bmalloc::api::memalign(alignment, size);
}
void mbfree(void* p, size_t)
{
bmalloc::api::free(p);
}
void* mbrealloc(void* p, size_t, size_t size)
{
return bmalloc::api::realloc(p, size);
}
void mbscavenge()
{
bmalloc::api::scavenge();
}
} // extern "C"
|
package gr.softaware.lib_1_3.data.convert.csv;
import java.util.List;
/**
*
* @author siggouroglou
* @param <T> A class that implements the CsvGenerationModel interface.
*/
final public class CsvGenerator<T extends CsvGenerationModel> {
private final List<CsvGenerationModel> modelList;
public CsvGenerator(List<T> modelList) {
this.modelList = (List<CsvGenerationModel>)modelList;
}
public StringBuilder getContent() {
return getContent("\t", "\\t");
}
public StringBuilder getContent(String separator, String separatorAsString) {
StringBuilder builder = new StringBuilder();
// First line contains the separator.
builder.append("sep=").append(separatorAsString).append("\n");
// Get the header.
if(!modelList.isEmpty()) {
builder.append(modelList.get(0).<API key>(separator)).append("\n");
}
// Get the data.
modelList.stream().forEach((model) -> {
builder.append(model.toCsvFormattedRow(separator)).append("\n");
});
return builder;
}
}
|
<?php
class <API key> extends <API key>
{
protected $user_session = null;
protected $db;
protected $language_id = null;
protected $filter = null;
protected $user = null;
protected $baseurl = '';
public function init(){
Zend_Layout::startMvc(
array('layoutPath' => APPLICATION_PATH . '/admin/layouts', 'layout' => 'layout')
);
$this->db = Zend_Db_Table::getDefaultAdapter();
$this->user = new <API key>();
$this->baseurl = <API key>::getInstance()->getBaseUrl(); //actual base url function
$this->language_id = Zend_Registry::get('lang_id'); //get the instance of database adapter
$this->user_session = new <API key>("user_session"); // default namespace
$this->filter = new <API key>;
//Zend_Registry::set('lang_id',2);
ini_set("max_execution_time", 0);
$auth = Zend_Auth::getInstance();
//if not loggedin redirect to login page
if (!$auth->hasIdentity()){
$this->_redirect('/admin/index/login');;
}
/* if(isset($this->user_session->role_id)){
$role = array('1' => 'Admin','2' => 'Payment Manager','3' => 'Content Manager','4' => 'Listing Manager', '3' => 'Deals Manager' );
$this->view->user = array(
'user_id' => $this->user_session->user_id,
'email' => $this->user_session->email,
'role_id' => $this->user_session->role_id,
'role_name' => $role[$this->user_session->role_id],
'user_name' =>$this->user_session->firstname,
);
} */
}
// this is default output function
public function indexAction() {
}
public function newAction(){
//if not admin redirect to admin index dash board
/* if ($this->user_session->role_id != 1){
$this->_redirect('/admin/index');
} */
//show message if it is set true
if (isset($this->user_session->msg)){
$this->view->msg = $this->user_session->msg;
unset($this->user_session->msg);
}
//$this->adapter = new <API key>();
$form = new <API key>();
$this->view->form = $form;
if (!$this->_request->isPost()) {
//$form->role->setValue($this->user_session->selected);
$this->view->form = $form;
return;
}
$formData = $this->_request->getPost();
if (!$form->isValid($formData)) {
$this->view->form = $form;
return;
}
$exist = $this->user->checkEmail($formData['email']);
if($exist == true){
$this->view->msg = "<div class='errors'>Email (User ID) already exists. Please make another one .</div>";
return;
}
$formData['date_added'] = date("Y-m-d");
$this->view->msg = $this->user->addUser($formData);
//$this->user_session->selected = $formData['role'];
$this->user_session->msg = $this->view->msg;
//$this->_redirect('/admin/user/new');
//clear all form fields
$form->reset();
}
public function messagePageAction(){
$this->view->msg = $this->user_session->msg;
unset($this->user_session->country);
unset($this->user_session->state);
unset($this->user_session->add_more);
}
public function listAction(){
$query_string = $this->_request->getParam("query_string");
$results = null;
$query_string = trim($query_string);
if($query_string !=''){
if(is_string($query_string)){
$results = $this->user->findUser($query_string);
}
}
else{
$results = $this->user->getUsers();
}
if (count($results) > 0) {
$this->Paginator($results);
} else {
$this->view->empty_rec = true;
}
}
// for delete users
public function deleteUsersAction(){
$user_id = $this->_request->getParam('id');
$delete = $this->user->deleteUsers($user_id);
$this->_redirect('/admin/user/list/');
//var_dump($delete);
}
public function findUsersAction(){
//$this->ajaxed();
$email = $this->_request->getParam('email');
$results = $this->user->findUser($email);
if (count($results) > 0) {
$this->Paginator($results);
} else {
$this->view->empty_rec = true;
}
}
public function editAction(){
$form = new <API key>();
$user_id = $this->_request->getParam('user_id');
$result = $this->user->getUser($user_id);
$form->removeElement("password");
$this->view->user_id = $result->user_id;
$form->email->setValue($result->email);
$form->user_name->setValue($result->user_name);
//$form->role->setValue($result->role);
$this->view->form = $form;
if (!$this->_request->isPost()) {
$this->view->form = $form;
return;
}
$formData = $this->_request->getPost();
if (!$form->isValid($formData)) {
$this->view->form = $form;
return;
}
$result = $this->user->updateUser($formData);
$this->_redirect('admin/user/list');
}
// for chNEGE password user
public function <API key>(){
$user_id=$this->user_session->user_id;
$this->view->user_id=$user_id;
$form = new <API key>();
$this->view->form = $form;
$this->view->msg = "";
if (!$this->_request->isPost()) {
return;
}
$formData = $this->_request->getPost();
if (!$form->isValid($formData)) {
return;
}
//All business logics will come here
if(strcmp($formData['pwd_current'],$formData['pwd'] ) == 0){
$this->view->msg = "<div class='alert alert-danger'>Old and New password are same</div>";
$this->view->form = $form;
return;
}
if(strcmp($formData['pwd'],$formData['pwd_confirm'] ) != 0){
$this->view->msg = "<div class='alert alert-danger'>Passwords are not matching</div>";
$this->view->form = $form;
return;
}
// var_dump($formData);
if($this->user->passUpdate($user_id, $formData['pwd'])){
$this->view->msg = "<div class='alert alert-success'>Password successfully Updated</div>";
}else{
$this->view->msg = "<div class='alert alert-danger'>Password Update Failed. Try again</div>";
}
}
public function <API key>(){
$form = new <API key>();
$form->removeElement("user_id");
$form->removeElement("firstname");
$form->removeElement("lastname");
$form->removeElement("email");
$user = new <API key>();
$result = $user->getUser();
$form->password->setLabel("New Password");
$form->password->setValue($result->password);
$this->view->form = $form;
$formData;
if (!$this->_request->isPost()) {
$this->view->form = $form;
return;
}
$formData = $this->_request->getPost();
if (!$form->isValid($formData)) {
$this->view->form = $form;
return;
}
/*if(!$user->currentPass($formData['current_password'])){
$this->view->msg = "Wrong current password";
return;
}*/
else {
$result = $user->updatePassword($formData);
$this->view->msg = "Password is updated";
}
}
public function Paginator($results) {
$page = $this->_getParam('page', 1);
$paginator = Zend_Paginator::factory($results);
$paginator->setItemCountPerPage(20);
$paginator-><API key>($page);
$this->view->paginator = $paginator;
}
/*
public function confirmDeleteAction(){
$user_id = $this->_request->getParam('user_id');
$firstname = $this->_request->getParam('firstname');
$this->view->firstname = $firstname;
$this->view->user_id = $user_id;
}
*/
/* public function deleteAction(){
$user_id = $this->_request->getParam('user_id');
$user_table = new <API key>();
$flag = $user_table->removeUser($user_id);
if($flag){
$this->view->user_remove_report = "user has been removed! Successfully";
}
} */
public function ajaxed() {
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout()->disableLayout();
if (!$this->_request->isXmlHttpRequest()
)return; // if not a ajax request leave function
}
public function __call($method, $args) {
if ('Action' == substr($method, -6)) {
// If the action method was not found, forward to the
// index action
return $this->_redirect('admin/index');
}
// all other methods throw an exception
throw new Exception('Invalid method "'
. $method
. '" called',
500);
}
}
|
package de.Ox539.kitcard.reader;
/**
* ReadCardTask: Read an NFC tag using the Wallet class asynchronously.
*
* This class provides the glue calling the Wallet class and passing
* the information back to the Android UI layer. Detailed error
* information is not provided yet.
*
* @author Philipp Kern <pkern@debian.org>
*/
import de.Ox539.kitcard.reader.Wallet.ReadCardResult;
import android.nfc.Tag;
import android.nfc.tech.MifareClassic;
import android.os.AsyncTask;
import android.widget.Toast;
public class ReadCardTask extends AsyncTask<Tag, Integer, Pair<ReadCardResult, Wallet>> {
private ScanActivity mActivity;
public ReadCardTask(ScanActivity activity) {
super();
this.mActivity = activity;
}
protected Pair<ReadCardResult, Wallet> doInBackground(Tag... tags) {
MifareClassic card = null;
try {
card = MifareClassic.get(tags[0]);
} catch (<API key> e) {
/* Error while reading card. This problem occurs on HTC devices from the ONE series with Android Lollipop (status of June 2015)
* Try to repair the tag.
*/
card = MifareClassic.get(MifareUtils.repairTag(tags[0]));
}
if(card == null)
return new Pair<ReadCardResult, Wallet>(null, null);
final Wallet wallet = new Wallet(card);
final ReadCardResult result = wallet.readCard();
return new Pair<ReadCardResult, Wallet>(result, wallet);
}
protected void onPostExecute(Pair<ReadCardResult, Wallet> data) {
ReadCardResult result = data.getValue0();
if(result == ReadCardResult.FAILURE) {
// read failed
Toast.makeText(mActivity, mActivity.getResources().getString(R.string.kitcard_read_failed), Toast.LENGTH_LONG).show();
return;
} else if(result == ReadCardResult.OLD_STYLE_WALLET) {
// old-style wallet encountered
Toast.makeText(mActivity, mActivity.getResources().getString(R.string.<API key>), Toast.LENGTH_LONG).show();
return;
}
final Wallet wallet = data.getValue1();
mActivity.updateCardNumber(wallet.getCardNumber());
mActivity.updateBalance(wallet.getCurrentBalance());
mActivity.<API key>(wallet.<API key>());
mActivity.updateCardIssuer(wallet.getCardIssuer());
mActivity.updateCardType(wallet.getCardType());
}
}
|
/**
* DOC: Wireless regulatory infrastructure
*
* The usual implementation is for a driver to read a device EEPROM to
* determine which regulatory domain it should be operating under, then
* looking up the allowable channels in a driver-local table and finally
* registering those channels in the wiphy structure.
*
* Another set of compliance enforcement is for drivers to use their
* own compliance limits which can be stored on the EEPROM. The host
* driver or firmware may ensure these are used.
*
* In addition to all this we provide an extra layer of regulatory
* conformance. For drivers which do not have any regulatory
* information CRDA provides the complete regulatory solution.
* For others it provides a community effort on further restrictions
* to enhance compliance.
*
* Note: When number of rules --> infinity we will not be able to
* index on alpha2 any more, instead we'll probably have to
* rely on some SHA1 checksum of the regdomain for example.
*
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/kernel.h>
#include <linux/export.h>
#include <linux/slab.h>
#include <linux/list.h>
#include <linux/random.h>
#include <linux/ctype.h>
#include <linux/nl80211.h>
#include <linux/platform_device.h>
#include <linux/moduleparam.h>
#include <net/cfg80211.h>
#include "core.h"
#include "reg.h"
#include "regdb.h"
#include "nl80211.h"
#ifdef <API key>
#define REG_DBG_PRINT(format, args...) \
printk(KERN_DEBUG pr_fmt(format), ##args)
#else
#define REG_DBG_PRINT(args...)
#endif
static struct regulatory_request core_request_world = {
.initiator = <API key>,
.alpha2[0] = '0',
.alpha2[1] = '0',
.intersect = false,
.processed = true,
.country_ie_env = ENVIRON_ANY,
};
/* Receipt of information from last regulatory request */
static struct regulatory_request *last_request = &core_request_world;
/* To trigger userspace events */
static struct platform_device *reg_pdev;
static struct device_type reg_device_type = {
.uevent = reg_device_uevent,
};
/*
* Central wireless core regulatory domains, we only need two,
* the current one and a world regulatory domain in case we have no
* information to give us an alpha2
*/
const struct ieee80211_regdomain *cfg80211_regdomain;
/*
* Protects static reg.c components:
* - <API key>
* - cfg80211_regdom
* - last_request
*/
static DEFINE_MUTEX(reg_mutex);
static inline void assert_reg_lock(void)
{
lockdep_assert_held(®_mutex);
}
/* Used to queue up regulatory hints */
static LIST_HEAD(reg_requests_list);
static spinlock_t reg_requests_lock;
/* Used to queue up beacon hints for review */
static LIST_HEAD(reg_pending_beacons);
static spinlock_t <API key>;
/* Used to keep track of processed beacon hints */
static LIST_HEAD(reg_beacon_list);
struct reg_beacon {
struct list_head list;
struct ieee80211_channel chan;
};
static void reg_todo(struct work_struct *work);
static DECLARE_WORK(reg_work, reg_todo);
static void reg_timeout_work(struct work_struct *work);
static <API key>(reg_timeout, reg_timeout_work);
/* We keep a static world regulatory domain in case of the absence of CRDA */
static const struct ieee80211_regdomain world_regdom = {
.n_reg_rules = 5,
.alpha2 = "00",
.reg_rules = {
/* IEEE 802.11b/g, channels 1..11 */
REG_RULE(2412-10, 2462+10, 40, 6, 20, 0),
/* IEEE 802.11b/g, channels 12..13. No HT40
* channel fits here. */
REG_RULE(2467-10, 2472+10, 20, 6, 20,
<API key> |
NL80211_RRF_NO_IBSS),
/* IEEE 802.11 channel 14 - Only JP enables
* this and for 802.11b only */
REG_RULE(2484-10, 2484+10, 20, 6, 20,
<API key> |
NL80211_RRF_NO_IBSS |
NL80211_RRF_NO_OFDM),
/* IEEE 802.11a, channel 36..48 */
REG_RULE(5180-10, 5240+10, 40, 6, 20,
<API key> |
NL80211_RRF_NO_IBSS),
/* NB: 5260 MHz - 5700 MHz requies DFS */
/* IEEE 802.11a, channel 149..165 */
REG_RULE(5745-10, 5825+10, 40, 6, 20,
<API key> |
NL80211_RRF_NO_IBSS),
}
};
static const struct ieee80211_regdomain *<API key> =
&world_regdom;
static char *ieee80211_regdom = "00";
static char user_alpha2[2];
module_param(ieee80211_regdom, charp, 0444);
MODULE_PARM_DESC(ieee80211_regdom, "IEEE 802.11 regulatory domain code");
static void reset_regdomains(bool full_reset)
{
/* avoid freeing static information or freeing something twice */
if (cfg80211_regdomain == <API key>)
cfg80211_regdomain = NULL;
if (<API key> == &world_regdom)
<API key> = NULL;
if (cfg80211_regdomain == &world_regdom)
cfg80211_regdomain = NULL;
kfree(cfg80211_regdomain);
kfree(<API key>);
<API key> = &world_regdom;
cfg80211_regdomain = NULL;
if (!full_reset)
return;
if (last_request != &core_request_world)
kfree(last_request);
last_request = &core_request_world;
}
/*
* Dynamic world regulatory domain requested by the wireless
* core upon initialization
*/
static void <API key>(const struct ieee80211_regdomain *rd)
{
BUG_ON(!last_request);
reset_regdomains(false);
<API key> = rd;
cfg80211_regdomain = rd;
}
bool is_world_regdom(const char *alpha2)
{
if (!alpha2)
return false;
if (alpha2[0] == '0' && alpha2[1] == '0')
return true;
return false;
}
static bool is_alpha2_set(const char *alpha2)
{
if (!alpha2)
return false;
if (alpha2[0] != 0 && alpha2[1] != 0)
return true;
return false;
}
static bool is_unknown_alpha2(const char *alpha2)
{
if (!alpha2)
return false;
/*
* Special case where regulatory domain was built by driver
* but a specific alpha2 cannot be determined
*/
if (alpha2[0] == '9' && alpha2[1] == '9')
return true;
return false;
}
static bool <API key>(const char *alpha2)
{
if (!alpha2)
return false;
/*
* Special case where regulatory domain is the
* result of an intersection between two regulatory domain
* structures
*/
if (alpha2[0] == '9' && alpha2[1] == '8')
return true;
return false;
}
static bool is_an_alpha2(const char *alpha2)
{
if (!alpha2)
return false;
if (isalpha(alpha2[0]) && isalpha(alpha2[1]))
return true;
return false;
}
static bool alpha2_equal(const char *alpha2_x, const char *alpha2_y)
{
if (!alpha2_x || !alpha2_y)
return false;
if (alpha2_x[0] == alpha2_y[0] &&
alpha2_x[1] == alpha2_y[1])
return true;
return false;
}
static bool regdom_changes(const char *alpha2)
{
<API key>();
if (!cfg80211_regdomain)
return true;
if (alpha2_equal(cfg80211_regdomain->alpha2, alpha2))
return false;
return true;
}
/*
* The <API key> regdom alpha2 is cached, this lets
* you know if a valid regulatory hint with <API key>
* has ever been issued.
*/
static bool <API key>(void)
{
if (user_alpha2[0] == '9' && user_alpha2[1] == '7')
return false;
/* This would indicate a mistake on the design */
if (WARN((!is_world_regdom(user_alpha2) &&
!is_an_alpha2(user_alpha2)),
"Unexpected user alpha2: %c%c\n",
user_alpha2[0],
user_alpha2[1]))
return false;
return true;
}
static int reg_copy_regd(const struct ieee80211_regdomain **dst_regd,
const struct ieee80211_regdomain *src_regd)
{
struct ieee80211_regdomain *regd;
int size_of_regd = 0;
unsigned int i;
size_of_regd = sizeof(struct ieee80211_regdomain) +
((src_regd->n_reg_rules + 1) * sizeof(struct ieee80211_reg_rule));
regd = kzalloc(size_of_regd, GFP_KERNEL);
if (!regd)
return -ENOMEM;
memcpy(regd, src_regd, sizeof(struct ieee80211_regdomain));
for (i = 0; i < src_regd->n_reg_rules; i++)
memcpy(®d->reg_rules[i], &src_regd->reg_rules[i],
sizeof(struct ieee80211_reg_rule));
*dst_regd = regd;
return 0;
}
#ifdef <API key>
struct <API key> {
char alpha2[2];
struct list_head list;
};
static LIST_HEAD(<API key>);
static DEFINE_MUTEX(<API key>);
static void reg_regdb_search(struct work_struct *work)
{
struct <API key> *request;
const struct ieee80211_regdomain *curdom, *regdom;
int i, r;
mutex_lock(&<API key>);
while (!list_empty(&<API key>)) {
request = list_first_entry(&<API key>,
struct <API key>,
list);
list_del(&request->list);
for (i=0; i<reg_regdb_size; i++) {
curdom = reg_regdb[i];
if (!memcmp(request->alpha2, curdom->alpha2, 2)) {
r = reg_copy_regd(®dom, curdom);
if (r)
break;
mutex_lock(&cfg80211_mutex);
set_regdom(regdom);
mutex_unlock(&cfg80211_mutex);
break;
}
}
kfree(request);
}
mutex_unlock(&<API key>);
}
static DECLARE_WORK(reg_regdb_work, reg_regdb_search);
static void reg_regdb_query(const char *alpha2)
{
struct <API key> *request;
if (!alpha2)
return;
request = kzalloc(sizeof(struct <API key>), GFP_KERNEL);
if (!request)
return;
memcpy(request->alpha2, alpha2, 2);
mutex_lock(&<API key>);
list_add_tail(&request->list, &<API key>);
mutex_unlock(&<API key>);
schedule_work(®_regdb_work);
}
/* Feel free to add any other sanity checks here */
static void <API key>(void)
{
/* We should ideally BUILD_BUG_ON() but then random builds would fail */
WARN_ONCE(!reg_regdb_size, "db.txt is empty, you should update it...");
}
#else
static inline void <API key>(void) {}
static inline void reg_regdb_query(const char *alpha2) {}
#endif /* <API key> */
/*
* This lets us keep regulatory code which is updated on a regulatory
* basis in userspace. Country information is filled in by
* reg_device_uevent
*/
static int call_crda(const char *alpha2)
{
if (!is_world_regdom((char *) alpha2))
pr_info("Calling CRDA for country: %c%c\n",
alpha2[0], alpha2[1]);
else
pr_info("Calling CRDA to update world regulatory domain\n");
/* query internal regulatory database (if it exists) */
reg_regdb_query(alpha2);
return kobject_uevent(®_pdev->dev.kobj, KOBJ_CHANGE);
}
/* Used by nl80211 before kmalloc'ing our regulatory domain */
bool <API key>(const char *alpha2)
{
<API key>();
if (!last_request)
return false;
return alpha2_equal(last_request->alpha2, alpha2);
}
/* Sanity check on a regulatory rule */
static bool is_valid_reg_rule(const struct ieee80211_reg_rule *rule)
{
const struct <API key> *freq_range = &rule->freq_range;
u32 freq_diff;
if (freq_range->start_freq_khz <= 0 || freq_range->end_freq_khz <= 0)
return false;
if (freq_range->start_freq_khz > freq_range->end_freq_khz)
return false;
freq_diff = freq_range->end_freq_khz - freq_range->start_freq_khz;
if (freq_range->end_freq_khz <= freq_range->start_freq_khz ||
freq_range->max_bandwidth_khz > freq_diff)
return false;
return true;
}
static bool is_valid_rd(const struct ieee80211_regdomain *rd)
{
const struct ieee80211_reg_rule *reg_rule = NULL;
unsigned int i;
if (!rd->n_reg_rules)
return false;
if (WARN_ON(rd->n_reg_rules > <API key>))
return false;
for (i = 0; i < rd->n_reg_rules; i++) {
reg_rule = &rd->reg_rules[i];
if (!is_valid_reg_rule(reg_rule))
return false;
}
return true;
}
static bool reg_does_bw_fit(const struct <API key> *freq_range,
u32 center_freq_khz,
u32 bw_khz)
{
u32 start_freq_khz, end_freq_khz;
start_freq_khz = center_freq_khz - (bw_khz/2);
end_freq_khz = center_freq_khz + (bw_khz/2);
if (start_freq_khz >= freq_range->start_freq_khz &&
end_freq_khz <= freq_range->end_freq_khz)
return true;
return false;
}
/**
* freq_in_rule_band - tells us if a frequency is in a frequency band
* @freq_range: frequency rule we want to query
* @freq_khz: frequency we are inquiring about
*
* This lets us know if a specific frequency rule is or is not relevant to
* a specific frequency's band. Bands are device specific and artificial
* definitions (the "2.4 GHz band" and the "5 GHz band"), however it is
* safe for now to assume that a frequency rule should not be part of a
* frequency's band if the start freq or end freq are off by more than 2 GHz.
* This resolution can be lowered and should be considered as we add
* regulatory rule support for other "bands".
**/
static bool freq_in_rule_band(const struct <API key> *freq_range,
u32 freq_khz)
{
#define ONE_GHZ_IN_KHZ 1000000
if (abs(freq_khz - freq_range->start_freq_khz) <= (2 * ONE_GHZ_IN_KHZ))
return true;
if (abs(freq_khz - freq_range->end_freq_khz) <= (2 * ONE_GHZ_IN_KHZ))
return true;
return false;
#undef ONE_GHZ_IN_KHZ
}
/*
* Helper for regdom_intersect(), this does the real
* mathematical intersection fun
*/
static int reg_rules_intersect(
const struct ieee80211_reg_rule *rule1,
const struct ieee80211_reg_rule *rule2,
struct ieee80211_reg_rule *intersected_rule)
{
const struct <API key> *freq_range1, *freq_range2;
struct <API key> *freq_range;
const struct <API key> *power_rule1, *power_rule2;
struct <API key> *power_rule;
u32 freq_diff;
freq_range1 = &rule1->freq_range;
freq_range2 = &rule2->freq_range;
freq_range = &intersected_rule->freq_range;
power_rule1 = &rule1->power_rule;
power_rule2 = &rule2->power_rule;
power_rule = &intersected_rule->power_rule;
freq_range->start_freq_khz = max(freq_range1->start_freq_khz,
freq_range2->start_freq_khz);
freq_range->end_freq_khz = min(freq_range1->end_freq_khz,
freq_range2->end_freq_khz);
freq_range->max_bandwidth_khz = min(freq_range1->max_bandwidth_khz,
freq_range2->max_bandwidth_khz);
freq_diff = freq_range->end_freq_khz - freq_range->start_freq_khz;
if (freq_range->max_bandwidth_khz > freq_diff)
freq_range->max_bandwidth_khz = freq_diff;
power_rule->max_eirp = min(power_rule1->max_eirp,
power_rule2->max_eirp);
power_rule->max_antenna_gain = min(power_rule1->max_antenna_gain,
power_rule2->max_antenna_gain);
intersected_rule->flags = (rule1->flags | rule2->flags);
if (!is_valid_reg_rule(intersected_rule))
return -EINVAL;
return 0;
}
/**
* regdom_intersect - do the intersection between two regulatory domains
* @rd1: first regulatory domain
* @rd2: second regulatory domain
*
* Use this function to get the intersection between two regulatory domains.
* Once completed we will mark the alpha2 for the rd as intersected, "98",
* as no one single alpha2 can represent this regulatory domain.
*
* Returns a pointer to the regulatory domain structure which will hold the
* resulting intersection of rules between rd1 and rd2. We will
* kzalloc() this structure for you.
*/
static struct ieee80211_regdomain *regdom_intersect(
const struct ieee80211_regdomain *rd1,
const struct ieee80211_regdomain *rd2)
{
int r, size_of_regd;
unsigned int x, y;
unsigned int num_rules = 0, rule_idx = 0;
const struct ieee80211_reg_rule *rule1, *rule2;
struct ieee80211_reg_rule *intersected_rule;
struct ieee80211_regdomain *rd;
/* This is just a dummy holder to help us count */
struct ieee80211_reg_rule irule;
/* Uses the stack temporarily for counter arithmetic */
intersected_rule = &irule;
memset(intersected_rule, 0, sizeof(struct ieee80211_reg_rule));
if (!rd1 || !rd2)
return NULL;
/*
* First we get a count of the rules we'll need, then we actually
* build them. This is to so we can malloc() and free() a
* regdomain once. The reason we use reg_rules_intersect() here
* is it will return -EINVAL if the rule computed makes no sense.
* All rules that do check out OK are valid.
*/
for (x = 0; x < rd1->n_reg_rules; x++) {
rule1 = &rd1->reg_rules[x];
for (y = 0; y < rd2->n_reg_rules; y++) {
rule2 = &rd2->reg_rules[y];
if (!reg_rules_intersect(rule1, rule2,
intersected_rule))
num_rules++;
memset(intersected_rule, 0,
sizeof(struct ieee80211_reg_rule));
}
}
if (!num_rules)
return NULL;
size_of_regd = sizeof(struct ieee80211_regdomain) +
((num_rules + 1) * sizeof(struct ieee80211_reg_rule));
rd = kzalloc(size_of_regd, GFP_KERNEL);
if (!rd)
return NULL;
for (x = 0; x < rd1->n_reg_rules; x++) {
rule1 = &rd1->reg_rules[x];
for (y = 0; y < rd2->n_reg_rules; y++) {
rule2 = &rd2->reg_rules[y];
/*
* This time around instead of using the stack lets
* write to the target rule directly saving ourselves
* a memcpy()
*/
intersected_rule = &rd->reg_rules[rule_idx];
r = reg_rules_intersect(rule1, rule2,
intersected_rule);
/*
* No need to memset here the intersected rule here as
* we're not using the stack anymore
*/
if (r)
continue;
rule_idx++;
}
}
if (rule_idx != num_rules) {
kfree(rd);
return NULL;
}
rd->n_reg_rules = num_rules;
rd->alpha2[0] = '9';
rd->alpha2[1] = '8';
return rd;
}
/*
* XXX: add support for the rest of enum <API key>, we may
* want to just have the channel structure use these
*/
static u32 map_regdom_flags(u32 rd_flags)
{
u32 channel_flags = 0;
if (rd_flags & <API key>)
channel_flags |= <API key>;
if (rd_flags & NL80211_RRF_NO_IBSS)
channel_flags |= <API key>;
if (rd_flags & NL80211_RRF_DFS)
channel_flags |= <API key>;
return channel_flags;
}
static int freq_reg_info_regd(struct wiphy *wiphy,
u32 center_freq,
u32 desired_bw_khz,
const struct ieee80211_reg_rule **reg_rule,
const struct ieee80211_regdomain *custom_regd)
{
int i;
bool band_rule_found = false;
const struct ieee80211_regdomain *regd;
bool bw_fits = false;
if (!desired_bw_khz)
desired_bw_khz = MHZ_TO_KHZ(20);
regd = custom_regd ? custom_regd : cfg80211_regdomain;
/*
* Follow the driver's regulatory domain, if present, unless a country
* IE has been processed or a user wants to help complaince further
*/
if (!custom_regd &&
last_request->initiator != <API key> &&
last_request->initiator != <API key> &&
wiphy->regd)
regd = wiphy->regd;
if (!regd)
return -EINVAL;
for (i = 0; i < regd->n_reg_rules; i++) {
const struct ieee80211_reg_rule *rr;
const struct <API key> *fr = NULL;
rr = ®d->reg_rules[i];
fr = &rr->freq_range;
/*
* We only need to know if one frequency rule was
* was in center_freq's band, that's enough, so lets
* not overwrite it once found
*/
if (!band_rule_found)
band_rule_found = freq_in_rule_band(fr, center_freq);
bw_fits = reg_does_bw_fit(fr,
center_freq,
desired_bw_khz);
if (band_rule_found && bw_fits) {
*reg_rule = rr;
return 0;
}
}
if (!band_rule_found)
return -ERANGE;
return -EINVAL;
}
int freq_reg_info(struct wiphy *wiphy,
u32 center_freq,
u32 desired_bw_khz,
const struct ieee80211_reg_rule **reg_rule)
{
<API key>();
return freq_reg_info_regd(wiphy,
center_freq,
desired_bw_khz,
reg_rule,
NULL);
}
EXPORT_SYMBOL(freq_reg_info);
#ifdef <API key>
static const char *reg_initiator_name(enum <API key> initiator)
{
switch (initiator) {
case <API key>:
return "Set by core";
case <API key>:
return "Set by user";
case <API key>:
return "Set by driver";
case <API key>:
return "Set by country IE";
default:
WARN_ON(1);
return "Set by bug";
}
}
static void <API key>(struct ieee80211_channel *chan,
u32 desired_bw_khz,
const struct ieee80211_reg_rule *reg_rule)
{
const struct <API key> *power_rule;
const struct <API key> *freq_range;
char max_antenna_gain[32];
power_rule = ®_rule->power_rule;
freq_range = ®_rule->freq_range;
if (!power_rule->max_antenna_gain)
snprintf(max_antenna_gain, 32, "N/A");
else
snprintf(max_antenna_gain, 32, "%d", power_rule->max_antenna_gain);
REG_DBG_PRINT("Updating information on frequency %d MHz "
"for a %d MHz width channel with regulatory rule:\n",
chan->center_freq,
KHZ_TO_MHZ(desired_bw_khz));
REG_DBG_PRINT("%d KHz - %d KHz @ %d KHz), (%s mBi, %d mBm)\n",
freq_range->start_freq_khz,
freq_range->end_freq_khz,
freq_range->max_bandwidth_khz,
max_antenna_gain,
power_rule->max_eirp);
}
#else
static void <API key>(struct ieee80211_channel *chan,
u32 desired_bw_khz,
const struct ieee80211_reg_rule *reg_rule)
{
return;
}
#endif
/*
* Note that right now we assume the desired channel bandwidth
* is always 20 MHz for each individual channel (HT40 uses 20 MHz
* per channel, the primary and the extension channel). To support
* smaller custom bandwidths such as 5 MHz or 10 MHz we'll need a
* new ieee80211_channel.target_bw and re run the regulatory check
* on the wiphy with the target_bw specified. Then we can simply use
* that below for the desired_bw_khz below.
*/
static void handle_channel(struct wiphy *wiphy,
enum <API key> initiator,
enum ieee80211_band band,
unsigned int chan_idx)
{
int r;
u32 flags, bw_flags = 0;
u32 desired_bw_khz = MHZ_TO_KHZ(20);
const struct ieee80211_reg_rule *reg_rule = NULL;
const struct <API key> *power_rule = NULL;
const struct <API key> *freq_range = NULL;
struct <API key> *sband;
struct ieee80211_channel *chan;
struct wiphy *request_wiphy = NULL;
<API key>();
request_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx);
sband = wiphy->bands[band];
BUG_ON(chan_idx >= sband->n_channels);
chan = &sband->channels[chan_idx];
flags = chan->orig_flags;
r = freq_reg_info(wiphy,
MHZ_TO_KHZ(chan->center_freq),
desired_bw_khz,
®_rule);
if (r) {
/*
* We will disable all channels that do not match our
* received regulatory rule unless the hint is coming
* from a Country IE and the Country IE had no information
* about a band. The IEEE 802.11 spec allows for an AP
* to send only a subset of the regulatory rules allowed,
* so an AP in the US that only supports 2.4 GHz may only send
* a country IE with information for the 2.4 GHz band
* while 5 GHz is still supported.
*/
if (initiator == <API key> &&
r == -ERANGE)
return;
REG_DBG_PRINT("Disabling freq %d MHz\n", chan->center_freq);
chan->flags = <API key>;
return;
}
<API key>(chan, desired_bw_khz, reg_rule);
power_rule = ®_rule->power_rule;
freq_range = ®_rule->freq_range;
if (freq_range->max_bandwidth_khz < MHZ_TO_KHZ(40))
bw_flags = <API key>;
if (last_request->initiator == <API key> &&
request_wiphy && request_wiphy == wiphy &&
request_wiphy->flags & <API key>) {
/*
* This guarantees the driver's requested regulatory domain
* will always be used as a base for further regulatory
* settings
*/
chan->flags = chan->orig_flags =
map_regdom_flags(reg_rule->flags) | bw_flags;
chan->max_antenna_gain = chan->orig_mag =
(int) MBI_TO_DBI(power_rule->max_antenna_gain);
chan->max_power = chan->orig_mpwr =
(int) MBM_TO_DBM(power_rule->max_eirp);
return;
}
chan->beacon_found = false;
chan->flags = flags | bw_flags | map_regdom_flags(reg_rule->flags);
chan->max_antenna_gain = min(chan->orig_mag,
(int) MBI_TO_DBI(power_rule->max_antenna_gain));
if (chan->orig_mpwr)
chan->max_power = min(chan->orig_mpwr,
(int) MBM_TO_DBM(power_rule->max_eirp));
else
chan->max_power = (int) MBM_TO_DBM(power_rule->max_eirp);
}
static void handle_band(struct wiphy *wiphy,
enum ieee80211_band band,
enum <API key> initiator)
{
unsigned int i;
struct <API key> *sband;
BUG_ON(!wiphy->bands[band]);
sband = wiphy->bands[band];
for (i = 0; i < sband->n_channels; i++)
handle_channel(wiphy, initiator, band, i);
}
static bool ignore_reg_update(struct wiphy *wiphy,
enum <API key> initiator)
{
if (!last_request) {
REG_DBG_PRINT("Ignoring regulatory request %s since "
"last_request is not set\n",
reg_initiator_name(initiator));
return true;
}
if (initiator == <API key> &&
wiphy->flags & <API key>) {
REG_DBG_PRINT("Ignoring regulatory request %s "
"since the driver uses its own custom "
"regulatory domain\n",
reg_initiator_name(initiator));
return true;
}
/*
* wiphy->regd will be set once the device has its own
* desired regulatory domain set
*/
if (wiphy->flags & <API key> && !wiphy->regd &&
initiator != <API key> &&
!is_world_regdom(last_request->alpha2)) {
REG_DBG_PRINT("Ignoring regulatory request %s "
"since the driver requires its own regulatory "
"domain to be set first\n",
reg_initiator_name(initiator));
return true;
}
return false;
}
static void handle_reg_beacon(struct wiphy *wiphy,
unsigned int chan_idx,
struct reg_beacon *reg_beacon)
{
struct <API key> *sband;
struct ieee80211_channel *chan;
bool channel_changed = false;
struct ieee80211_channel chan_before;
<API key>();
sband = wiphy->bands[reg_beacon->chan.band];
chan = &sband->channels[chan_idx];
if (likely(chan->center_freq != reg_beacon->chan.center_freq))
return;
if (chan->beacon_found)
return;
chan->beacon_found = true;
if (wiphy->flags & <API key>)
return;
chan_before.center_freq = chan->center_freq;
chan_before.flags = chan->flags;
if (chan->flags & <API key>) {
chan->flags &= ~<API key>;
channel_changed = true;
}
if (chan->flags & <API key>) {
chan->flags &= ~<API key>;
channel_changed = true;
}
if (channel_changed)
<API key>(wiphy, &chan_before, chan);
}
/*
* Called when a scan on a wiphy finds a beacon on
* new channel
*/
static void <API key>(struct wiphy *wiphy,
struct reg_beacon *reg_beacon)
{
unsigned int i;
struct <API key> *sband;
<API key>();
if (!wiphy->bands[reg_beacon->chan.band])
return;
sband = wiphy->bands[reg_beacon->chan.band];
for (i = 0; i < sband->n_channels; i++)
handle_reg_beacon(wiphy, i, reg_beacon);
}
/*
* Called upon reg changes or a new wiphy is added
*/
static void <API key>(struct wiphy *wiphy)
{
unsigned int i;
struct <API key> *sband;
struct reg_beacon *reg_beacon;
<API key>();
if (list_empty(®_beacon_list))
return;
list_for_each_entry(reg_beacon, ®_beacon_list, list) {
if (!wiphy->bands[reg_beacon->chan.band])
continue;
sband = wiphy->bands[reg_beacon->chan.band];
for (i = 0; i < sband->n_channels; i++)
handle_reg_beacon(wiphy, i, reg_beacon);
}
}
static bool <API key>(struct wiphy *wiphy)
{
if (is_world_regdom(cfg80211_regdomain->alpha2) ||
(wiphy->regd && is_world_regdom(wiphy->regd->alpha2)))
return true;
if (last_request &&
last_request->initiator != <API key> &&
wiphy->flags & <API key>)
return true;
return false;
}
/* Reap the advantages of previously found beacons */
static void reg_process_beacons(struct wiphy *wiphy)
{
/*
* Means we are just firing up cfg80211, so no beacons would
* have been processed yet.
*/
if (!last_request)
return;
if (!<API key>(wiphy))
return;
<API key>(wiphy);
}
static bool is_ht40_not_allowed(struct ieee80211_channel *chan)
{
if (!chan)
return true;
if (chan->flags & <API key>)
return true;
/* This would happen when regulatory rules disallow HT40 completely */
if (<API key> == (chan->flags & (<API key>)))
return true;
return false;
}
static void <API key>(struct wiphy *wiphy,
enum ieee80211_band band,
unsigned int chan_idx)
{
struct <API key> *sband;
struct ieee80211_channel *channel;
struct ieee80211_channel *channel_before = NULL, *channel_after = NULL;
unsigned int i;
<API key>();
sband = wiphy->bands[band];
BUG_ON(chan_idx >= sband->n_channels);
channel = &sband->channels[chan_idx];
if (is_ht40_not_allowed(channel)) {
channel->flags |= <API key>;
return;
}
/*
* We need to ensure the extension channels exist to
* be able to use HT40- or HT40+, this finds them (or not)
*/
for (i = 0; i < sband->n_channels; i++) {
struct ieee80211_channel *c = &sband->channels[i];
if (c->center_freq == (channel->center_freq - 20))
channel_before = c;
if (c->center_freq == (channel->center_freq + 20))
channel_after = c;
}
/*
* Please note that this assumes target bandwidth is 20 MHz,
* if that ever changes we also need to change the below logic
* to include that as well.
*/
if (is_ht40_not_allowed(channel_before))
channel->flags |= <API key>;
else
channel->flags &= ~<API key>;
if (is_ht40_not_allowed(channel_after))
channel->flags |= <API key>;
else
channel->flags &= ~<API key>;
}
static void <API key>(struct wiphy *wiphy,
enum ieee80211_band band)
{
unsigned int i;
struct <API key> *sband;
BUG_ON(!wiphy->bands[band]);
sband = wiphy->bands[band];
for (i = 0; i < sband->n_channels; i++)
<API key>(wiphy, band, i);
}
static void <API key>(struct wiphy *wiphy)
{
enum ieee80211_band band;
if (!wiphy)
return;
for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
if (wiphy->bands[band])
<API key>(wiphy, band);
}
}
static void <API key>(struct wiphy *wiphy,
enum <API key> initiator)
{
enum ieee80211_band band;
assert_reg_lock();
if (ignore_reg_update(wiphy, initiator))
return;
for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
if (wiphy->bands[band])
handle_band(wiphy, band, initiator);
}
reg_process_beacons(wiphy);
<API key>(wiphy);
if (wiphy->reg_notifier)
wiphy->reg_notifier(wiphy, last_request);
}
void regulatory_update(struct wiphy *wiphy,
enum <API key> setby)
{
mutex_lock(®_mutex);
<API key>(wiphy, setby);
mutex_unlock(®_mutex);
}
static void <API key>(enum <API key> initiator)
{
struct <API key> *rdev;
list_for_each_entry(rdev, &cfg80211_rdev_list, list)
<API key>(&rdev->wiphy, initiator);
}
static void <API key>(struct wiphy *wiphy,
enum ieee80211_band band,
unsigned int chan_idx,
const struct ieee80211_regdomain *regd)
{
int r;
u32 desired_bw_khz = MHZ_TO_KHZ(20);
u32 bw_flags = 0;
const struct ieee80211_reg_rule *reg_rule = NULL;
const struct <API key> *power_rule = NULL;
const struct <API key> *freq_range = NULL;
struct <API key> *sband;
struct ieee80211_channel *chan;
assert_reg_lock();
sband = wiphy->bands[band];
BUG_ON(chan_idx >= sband->n_channels);
chan = &sband->channels[chan_idx];
r = freq_reg_info_regd(wiphy,
MHZ_TO_KHZ(chan->center_freq),
desired_bw_khz,
®_rule,
regd);
if (r) {
REG_DBG_PRINT("Disabling freq %d MHz as custom "
"regd has no rule that fits a %d MHz "
"wide channel\n",
chan->center_freq,
KHZ_TO_MHZ(desired_bw_khz));
chan->flags = <API key>;
return;
}
<API key>(chan, desired_bw_khz, reg_rule);
power_rule = ®_rule->power_rule;
freq_range = ®_rule->freq_range;
if (freq_range->max_bandwidth_khz < MHZ_TO_KHZ(40))
bw_flags = <API key>;
chan->flags |= map_regdom_flags(reg_rule->flags) | bw_flags;
chan->max_antenna_gain = (int) MBI_TO_DBI(power_rule->max_antenna_gain);
chan->max_power = (int) MBM_TO_DBM(power_rule->max_eirp);
}
static void handle_band_custom(struct wiphy *wiphy, enum ieee80211_band band,
const struct ieee80211_regdomain *regd)
{
unsigned int i;
struct <API key> *sband;
BUG_ON(!wiphy->bands[band]);
sband = wiphy->bands[band];
for (i = 0; i < sband->n_channels; i++)
<API key>(wiphy, band, i, regd);
}
/* Used by drivers prior to wiphy registration */
void <API key>(struct wiphy *wiphy,
const struct ieee80211_regdomain *regd)
{
enum ieee80211_band band;
unsigned int bands_set = 0;
mutex_lock(®_mutex);
for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
if (!wiphy->bands[band])
continue;
handle_band_custom(wiphy, band, regd);
bands_set++;
}
mutex_unlock(®_mutex);
/*
* no point in calling this if it won't have any effect
* on your device's supportd bands.
*/
WARN_ON(!bands_set);
}
EXPORT_SYMBOL(<API key>);
/*
* Return value which can be used by ignore_request() to indicate
* it has been determined we should intersect two regulatory domains
*/
#define REG_INTERSECT 1
/* This has the logic which determines when a new request
* should be ignored. */
static int ignore_request(struct wiphy *wiphy,
struct regulatory_request *pending_request)
{
struct wiphy *last_wiphy = NULL;
<API key>();
/* All initial requests are respected */
if (!last_request)
return 0;
switch (pending_request->initiator) {
case <API key>:
return 0;
case <API key>:
last_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx);
if (unlikely(!is_an_alpha2(pending_request->alpha2)))
return -EINVAL;
if (last_request->initiator ==
<API key>) {
if (last_wiphy != wiphy) {
/*
* Two cards with two APs claiming different
* Country IE alpha2s. We could
* intersect them, but that seems unlikely
* to be correct. Reject second one for now.
*/
if (regdom_changes(pending_request->alpha2))
return -EOPNOTSUPP;
return -EALREADY;
}
/*
* Two consecutive Country IE hints on the same wiphy.
* This should be picked up early by the driver/stack
*/
if (WARN_ON(regdom_changes(pending_request->alpha2)))
return 0;
return -EALREADY;
}
return 0;
case <API key>:
if (last_request->initiator == <API key>) {
if (regdom_changes(pending_request->alpha2))
return 0;
return -EALREADY;
}
/*
* This would happen if you unplug and plug your card
* back in or if you add a new device for which the previously
* loaded card also agrees on the regulatory domain.
*/
if (last_request->initiator == <API key> &&
!regdom_changes(pending_request->alpha2))
return -EALREADY;
return REG_INTERSECT;
case <API key>:
if (last_request->initiator == <API key>)
return REG_INTERSECT;
/*
* If the user knows better the user should set the regdom
* to their country before the IE is picked up
*/
if (last_request->initiator == <API key> &&
last_request->intersect)
return -EOPNOTSUPP;
/*
* Process user requests only after previous user/driver/core
* requests have been processed
*/
if (last_request->initiator == <API key> ||
last_request->initiator == <API key> ||
last_request->initiator == <API key>) {
if (regdom_changes(last_request->alpha2))
return -EAGAIN;
}
if (!regdom_changes(pending_request->alpha2))
return -EALREADY;
return 0;
}
return -EINVAL;
}
static void <API key>(void)
{
bool <API key> = false;
last_request->processed = true;
spin_lock(®_requests_lock);
if (!list_empty(®_requests_list))
<API key> = true;
spin_unlock(®_requests_lock);
if (last_request->initiator == <API key>)
<API key>(®_timeout);
if (<API key>)
schedule_work(®_work);
}
/**
* __regulatory_hint - hint to the wireless core a regulatory domain
* @wiphy: if the hint comes from country information from an AP, this
* is required to be set to the wiphy that received the information
* @pending_request: the regulatory request currently being processed
*
* The Wireless subsystem can use this function to hint to the wireless core
* what it believes should be the current regulatory domain.
*
* Returns zero if all went fine, %-EALREADY if a regulatory domain had
* already been set or other standard error codes.
*
* Caller must hold &cfg80211_mutex and ®_mutex
*/
static int __regulatory_hint(struct wiphy *wiphy,
struct regulatory_request *pending_request)
{
bool intersect = false;
int r = 0;
<API key>();
r = ignore_request(wiphy, pending_request);
if (r == REG_INTERSECT) {
if (pending_request->initiator ==
<API key>) {
r = reg_copy_regd(&wiphy->regd, cfg80211_regdomain);
if (r) {
kfree(pending_request);
return r;
}
}
intersect = true;
} else if (r) {
/*
* If the regulatory domain being requested by the
* driver has already been set just copy it to the
* wiphy
*/
if (r == -EALREADY &&
pending_request->initiator ==
<API key>) {
r = reg_copy_regd(&wiphy->regd, cfg80211_regdomain);
if (r) {
kfree(pending_request);
return r;
}
r = -EALREADY;
goto new_request;
}
kfree(pending_request);
return r;
}
new_request:
if (last_request != &core_request_world)
kfree(last_request);
last_request = pending_request;
last_request->intersect = intersect;
pending_request = NULL;
if (last_request->initiator == <API key>) {
user_alpha2[0] = last_request->alpha2[0];
user_alpha2[1] = last_request->alpha2[1];
}
/* When r == REG_INTERSECT we do need to call CRDA */
if (r < 0) {
/*
* Since CRDA will not be called in this case as we already
* have applied the requested regulatory domain before we just
* inform userspace we have processed the request
*/
if (r == -EALREADY) {
<API key>(last_request);
<API key>();
}
return r;
}
return call_crda(last_request->alpha2);
}
/* This processes *all* regulatory hints */
static void reg_process_hint(struct regulatory_request *reg_request)
{
int r = 0;
struct wiphy *wiphy = NULL;
enum <API key> initiator = reg_request->initiator;
BUG_ON(!reg_request->alpha2);
if (wiphy_idx_valid(reg_request->wiphy_idx))
wiphy = wiphy_idx_to_wiphy(reg_request->wiphy_idx);
if (reg_request->initiator == <API key> &&
!wiphy) {
kfree(reg_request);
return;
}
r = __regulatory_hint(wiphy, reg_request);
/* This is required so that the orig_* parameters are saved */
if (r == -EALREADY && wiphy &&
wiphy->flags & <API key>) {
<API key>(wiphy, initiator);
return;
}
/*
* We only time out user hints, given that they should be the only
* source of bogus requests.
*/
if (r != -EALREADY &&
reg_request->initiator == <API key>)
<API key>(®_timeout, msecs_to_jiffies(3142));
}
/*
* Processes regulatory hints, this is all the <API key>*
* Regulatory hints come on a first come first serve basis and we
* must process each one atomically.
*/
static void <API key>(void)
{
struct regulatory_request *reg_request;
mutex_lock(&cfg80211_mutex);
mutex_lock(®_mutex);
/* When last_request->processed becomes true this will be rescheduled */
if (last_request && !last_request->processed) {
REG_DBG_PRINT("Pending regulatory request, waiting "
"for it to be processed...\n");
goto out;
}
spin_lock(®_requests_lock);
if (list_empty(®_requests_list)) {
spin_unlock(®_requests_lock);
goto out;
}
reg_request = list_first_entry(®_requests_list,
struct regulatory_request,
list);
list_del_init(®_request->list);
spin_unlock(®_requests_lock);
reg_process_hint(reg_request);
out:
mutex_unlock(®_mutex);
mutex_unlock(&cfg80211_mutex);
}
/* Processes beacon hints -- this has nothing to do with country IEs */
static void <API key>(void)
{
struct <API key> *rdev;
struct reg_beacon *pending_beacon, *tmp;
/*
* No need to hold the reg_mutex here as we just touch wiphys
* and do not read or access regulatory variables.
*/
mutex_lock(&cfg80211_mutex);
/* This goes through the _pending_ beacon list */
spin_lock_bh(&<API key>);
if (list_empty(®_pending_beacons)) {
spin_unlock_bh(&<API key>);
goto out;
}
<API key>(pending_beacon, tmp,
®_pending_beacons, list) {
list_del_init(&pending_beacon->list);
/* Applies the beacon hint to current wiphys */
list_for_each_entry(rdev, &cfg80211_rdev_list, list)
<API key>(&rdev->wiphy, pending_beacon);
/* Remembers the beacon hint for new wiphys or reg changes */
list_add_tail(&pending_beacon->list, ®_beacon_list);
}
spin_unlock_bh(&<API key>);
out:
mutex_unlock(&cfg80211_mutex);
}
static void reg_todo(struct work_struct *work)
{
<API key>();
<API key>();
}
static void <API key>(struct regulatory_request *request)
{
if (isalpha(request->alpha2[0]))
request->alpha2[0] = toupper(request->alpha2[0]);
if (isalpha(request->alpha2[1]))
request->alpha2[1] = toupper(request->alpha2[1]);
spin_lock(®_requests_lock);
list_add_tail(&request->list, ®_requests_list);
spin_unlock(®_requests_lock);
schedule_work(®_work);
}
/*
* Core regulatory hint -- happens during cfg80211_init()
* and when we restore regulatory settings.
*/
static int <API key>(const char *alpha2)
{
struct regulatory_request *request;
request = kzalloc(sizeof(struct regulatory_request),
GFP_KERNEL);
if (!request)
return -ENOMEM;
request->alpha2[0] = alpha2[0];
request->alpha2[1] = alpha2[1];
request->initiator = <API key>;
<API key>(request);
return 0;
}
/* User hints */
int <API key>(const char *alpha2)
{
struct regulatory_request *request;
BUG_ON(!alpha2);
request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL);
if (!request)
return -ENOMEM;
request->wiphy_idx = WIPHY_IDX_STALE;
request->alpha2[0] = alpha2[0];
request->alpha2[1] = alpha2[1];
request->initiator = <API key>;
<API key>(request);
return 0;
}
/* Driver hints */
int regulatory_hint(struct wiphy *wiphy, const char *alpha2)
{
struct regulatory_request *request;
BUG_ON(!alpha2);
BUG_ON(!wiphy);
request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL);
if (!request)
return -ENOMEM;
request->wiphy_idx = get_wiphy_idx(wiphy);
/* Must have registered wiphy first */
BUG_ON(!wiphy_idx_valid(request->wiphy_idx));
request->alpha2[0] = alpha2[0];
request->alpha2[1] = alpha2[1];
request->initiator = <API key>;
<API key>(request);
return 0;
}
EXPORT_SYMBOL(regulatory_hint);
/*
* We hold wdev_lock() here so we cannot hold cfg80211_mutex() and
* therefore cannot iterate over the rdev list here.
*/
void regulatory_hint_11d(struct wiphy *wiphy,
enum ieee80211_band band,
u8 *country_ie,
u8 country_ie_len)
{
char alpha2[2];
enum environment_cap env = ENVIRON_ANY;
struct regulatory_request *request;
mutex_lock(®_mutex);
if (unlikely(!last_request))
goto out;
/* IE len must be evenly divisible by 2 */
if (country_ie_len & 0x01)
goto out;
if (country_ie_len < <API key>)
goto out;
alpha2[0] = country_ie[0];
alpha2[1] = country_ie[1];
if (country_ie[2] == 'I')
env = ENVIRON_INDOOR;
else if (country_ie[2] == 'O')
env = ENVIRON_OUTDOOR;
/*
* We will run this only upon a successful connection on cfg80211.
* We leave conflict resolution to the workqueue, where can hold
* cfg80211_mutex.
*/
if (likely(last_request->initiator ==
<API key> &&
wiphy_idx_valid(last_request->wiphy_idx)))
goto out;
request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL);
if (!request)
goto out;
request->wiphy_idx = get_wiphy_idx(wiphy);
request->alpha2[0] = alpha2[0];
request->alpha2[1] = alpha2[1];
request->initiator = <API key>;
request->country_ie_env = env;
mutex_unlock(®_mutex);
<API key>(request);
return;
out:
mutex_unlock(®_mutex);
}
static void restore_alpha2(char *alpha2, bool reset_user)
{
/* indicates there is no alpha2 to consider for restoration */
alpha2[0] = '9';
alpha2[1] = '7';
/* The user setting has precedence over the module parameter */
if (<API key>()) {
/* Unless we're asked to ignore it and reset it */
if (reset_user) {
REG_DBG_PRINT("Restoring regulatory settings "
"including user preference\n");
user_alpha2[0] = '9';
user_alpha2[1] = '7';
/*
* If we're ignoring user settings, we still need to
* check the module parameter to ensure we put things
* back as they were for a full restore.
*/
if (!is_world_regdom(ieee80211_regdom)) {
REG_DBG_PRINT("Keeping preference on "
"module parameter ieee80211_regdom: %c%c\n",
ieee80211_regdom[0],
ieee80211_regdom[1]);
alpha2[0] = ieee80211_regdom[0];
alpha2[1] = ieee80211_regdom[1];
}
} else {
REG_DBG_PRINT("Restoring regulatory settings "
"while preserving user preference for: %c%c\n",
user_alpha2[0],
user_alpha2[1]);
alpha2[0] = user_alpha2[0];
alpha2[1] = user_alpha2[1];
}
} else if (!is_world_regdom(ieee80211_regdom)) {
REG_DBG_PRINT("Keeping preference on "
"module parameter ieee80211_regdom: %c%c\n",
ieee80211_regdom[0],
ieee80211_regdom[1]);
alpha2[0] = ieee80211_regdom[0];
alpha2[1] = ieee80211_regdom[1];
} else
REG_DBG_PRINT("Restoring regulatory settings\n");
}
/*
* Restoring regulatory settings involves ingoring any
* possibly stale country IE information and user regulatory
* settings if so desired, this includes any beacon hints
* learned as we could have traveled outside to another country
* after disconnection. To restore regulatory settings we do
* exactly what we did at bootup:
*
* - send a core regulatory hint
* - send a user regulatory hint if applicable
*
* Device drivers that send a regulatory hint for a specific country
* keep their own regulatory domain on wiphy->regd so that does does
* not need to be remembered.
*/
static void <API key>(bool reset_user)
{
char alpha2[2];
struct reg_beacon *reg_beacon, *btmp;
struct regulatory_request *reg_request, *tmp;
LIST_HEAD(tmp_reg_req_list);
mutex_lock(&cfg80211_mutex);
mutex_lock(®_mutex);
reset_regdomains(true);
restore_alpha2(alpha2, reset_user);
/*
* If there's any pending requests we simply
* stash them to a temporary pending queue and
* add then after we've restored regulatory
* settings.
*/
spin_lock(®_requests_lock);
if (!list_empty(®_requests_list)) {
<API key>(reg_request, tmp,
®_requests_list, list) {
if (reg_request->initiator !=
<API key>)
continue;
list_del(®_request->list);
list_add_tail(®_request->list, &tmp_reg_req_list);
}
}
spin_unlock(®_requests_lock);
/* Clear beacon hints */
spin_lock_bh(&<API key>);
if (!list_empty(®_pending_beacons)) {
<API key>(reg_beacon, btmp,
®_pending_beacons, list) {
list_del(®_beacon->list);
kfree(reg_beacon);
}
}
spin_unlock_bh(&<API key>);
if (!list_empty(®_beacon_list)) {
<API key>(reg_beacon, btmp,
®_beacon_list, list) {
list_del(®_beacon->list);
kfree(reg_beacon);
}
}
/* First restore to the basic regulatory settings */
cfg80211_regdomain = <API key>;
mutex_unlock(®_mutex);
mutex_unlock(&cfg80211_mutex);
<API key>(cfg80211_regdomain->alpha2);
/*
* This restores the ieee80211_regdom module parameter
* preference or the last user requested regulatory
* settings, user regulatory settings takes precedence.
*/
if (is_an_alpha2(alpha2))
<API key>(user_alpha2);
if (list_empty(&tmp_reg_req_list))
return;
mutex_lock(&cfg80211_mutex);
mutex_lock(®_mutex);
spin_lock(®_requests_lock);
<API key>(reg_request, tmp, &tmp_reg_req_list, list) {
REG_DBG_PRINT("Adding request for country %c%c back "
"into the queue\n",
reg_request->alpha2[0],
reg_request->alpha2[1]);
list_del(®_request->list);
list_add_tail(®_request->list, ®_requests_list);
}
spin_unlock(®_requests_lock);
mutex_unlock(®_mutex);
mutex_unlock(&cfg80211_mutex);
REG_DBG_PRINT("Kicking the queue\n");
schedule_work(®_work);
}
void <API key>(void)
{
REG_DBG_PRINT("All devices are disconnected, going to "
"restore regulatory settings\n");
<API key>(false);
}
static bool <API key>(u16 freq)
{
if (freq == <API key>(12, IEEE80211_BAND_2GHZ) ||
freq == <API key>(13, IEEE80211_BAND_2GHZ) ||
freq == <API key>(14, IEEE80211_BAND_2GHZ))
return true;
return false;
}
int <API key>(struct wiphy *wiphy,
struct ieee80211_channel *beacon_chan,
gfp_t gfp)
{
struct reg_beacon *reg_beacon;
if (likely((beacon_chan->beacon_found ||
(beacon_chan->flags & <API key>) ||
(beacon_chan->band == IEEE80211_BAND_2GHZ &&
!<API key>(beacon_chan->center_freq)))))
return 0;
reg_beacon = kzalloc(sizeof(struct reg_beacon), gfp);
if (!reg_beacon)
return -ENOMEM;
REG_DBG_PRINT("Found new beacon on "
"frequency: %d MHz (Ch %d) on %s\n",
beacon_chan->center_freq,
<API key>(beacon_chan->center_freq),
wiphy_name(wiphy));
memcpy(®_beacon->chan, beacon_chan,
sizeof(struct ieee80211_channel));
/*
* Since we can be called from BH or and non-BH context
* we must use spin_lock_bh()
*/
spin_lock_bh(&<API key>);
list_add_tail(®_beacon->list, ®_pending_beacons);
spin_unlock_bh(&<API key>);
schedule_work(®_work);
return 0;
}
static void print_rd_rules(const struct ieee80211_regdomain *rd)
{
unsigned int i;
const struct ieee80211_reg_rule *reg_rule = NULL;
const struct <API key> *freq_range = NULL;
const struct <API key> *power_rule = NULL;
pr_info(" (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)\n");
for (i = 0; i < rd->n_reg_rules; i++) {
reg_rule = &rd->reg_rules[i];
freq_range = ®_rule->freq_range;
power_rule = ®_rule->power_rule;
/*
* There may not be documentation for max antenna gain
* in certain regions
*/
if (power_rule->max_antenna_gain)
pr_info(" (%d KHz - %d KHz @ %d KHz), (%d mBi, %d mBm)\n",
freq_range->start_freq_khz,
freq_range->end_freq_khz,
freq_range->max_bandwidth_khz,
power_rule->max_antenna_gain,
power_rule->max_eirp);
else
pr_info(" (%d KHz - %d KHz @ %d KHz), (N/A, %d mBm)\n",
freq_range->start_freq_khz,
freq_range->end_freq_khz,
freq_range->max_bandwidth_khz,
power_rule->max_eirp);
}
}
static void print_regdomain(const struct ieee80211_regdomain *rd)
{
if (<API key>(rd->alpha2)) {
if (last_request->initiator ==
<API key>) {
struct <API key> *rdev;
rdev = <API key>(
last_request->wiphy_idx);
if (rdev) {
pr_info("Current regulatory domain updated by AP to: %c%c\n",
rdev->country_ie_alpha2[0],
rdev->country_ie_alpha2[1]);
} else
pr_info("Current regulatory domain intersected:\n");
} else
pr_info("Current regulatory domain intersected:\n");
} else if (is_world_regdom(rd->alpha2))
pr_info("World regulatory domain updated:\n");
else {
if (is_unknown_alpha2(rd->alpha2))
pr_info("Regulatory domain changed to driver built-in settings (unknown country)\n");
else
pr_info("Regulatory domain changed to country: %c%c\n",
rd->alpha2[0], rd->alpha2[1]);
}
print_rd_rules(rd);
}
static void <API key>(const struct ieee80211_regdomain *rd)
{
pr_info("Regulatory domain: %c%c\n", rd->alpha2[0], rd->alpha2[1]);
print_rd_rules(rd);
}
/* Takes ownership of rd only if it doesn't fail */
static int __set_regdom(const struct ieee80211_regdomain *rd)
{
const struct ieee80211_regdomain *intersected_rd = NULL;
struct <API key> *rdev = NULL;
struct wiphy *request_wiphy;
/* Some basic sanity checks first */
if (is_world_regdom(rd->alpha2)) {
if (WARN_ON(!<API key>(rd->alpha2)))
return -EINVAL;
<API key>(rd);
return 0;
}
if (!is_alpha2_set(rd->alpha2) && !is_an_alpha2(rd->alpha2) &&
!is_unknown_alpha2(rd->alpha2))
return -EINVAL;
if (!last_request)
return -EINVAL;
/*
* Lets only bother proceeding on the same alpha2 if the current
* rd is non static (it means CRDA was present and was used last)
* and the pending request came in from a country IE
*/
if (last_request->initiator != <API key>) {
/*
* If someone else asked us to change the rd lets only bother
* checking if the alpha2 changes if CRDA was already called
*/
if (!regdom_changes(rd->alpha2))
return -EINVAL;
}
/*
* Now lets set the regulatory domain, update all driver channels
* and finally inform them of what we have done, in case they want
* to review or adjust their own settings based on their own
* internal EEPROM data
*/
if (WARN_ON(!<API key>(rd->alpha2)))
return -EINVAL;
if (!is_valid_rd(rd)) {
pr_err("Invalid regulatory domain detected:\n");
<API key>(rd);
return -EINVAL;
}
request_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx);
if (!request_wiphy &&
(last_request->initiator == <API key> ||
last_request->initiator == <API key>)) {
<API key>(®_timeout, 0);
return -ENODEV;
}
if (!last_request->intersect) {
int r;
if (last_request->initiator != <API key>) {
reset_regdomains(false);
cfg80211_regdomain = rd;
return 0;
}
/*
* For a driver hint, lets copy the regulatory domain the
* driver wanted to the wiphy to deal with conflicts
*/
/*
* Userspace could have sent two replies with only
* one kernel request.
*/
if (request_wiphy->regd)
return -EALREADY;
r = reg_copy_regd(&request_wiphy->regd, rd);
if (r)
return r;
reset_regdomains(false);
cfg80211_regdomain = rd;
return 0;
}
/* Intersection requires a bit more work */
if (last_request->initiator != <API key>) {
intersected_rd = regdom_intersect(rd, cfg80211_regdomain);
if (!intersected_rd)
return -EINVAL;
/*
* We can trash what CRDA provided now.
* However if a driver requested this specific regulatory
* domain we keep it for its private use
*/
if (last_request->initiator == <API key>)
request_wiphy->regd = rd;
else
kfree(rd);
rd = NULL;
reset_regdomains(false);
cfg80211_regdomain = intersected_rd;
return 0;
}
if (!intersected_rd)
return -EINVAL;
rdev = wiphy_to_dev(request_wiphy);
rdev->country_ie_alpha2[0] = rd->alpha2[0];
rdev->country_ie_alpha2[1] = rd->alpha2[1];
rdev->env = last_request->country_ie_env;
BUG_ON(intersected_rd == rd);
kfree(rd);
rd = NULL;
reset_regdomains(false);
cfg80211_regdomain = intersected_rd;
return 0;
}
/*
* Use this call to set the current regulatory domain. Conflicts with
* multiple drivers can be ironed out later. Caller must've already
* kmalloc'd the rd structure. Caller must hold cfg80211_mutex
*/
int set_regdom(const struct ieee80211_regdomain *rd)
{
int r;
<API key>();
mutex_lock(®_mutex);
/* Note that this doesn't update the wiphys, this is done below */
r = __set_regdom(rd);
if (r) {
kfree(rd);
mutex_unlock(®_mutex);
return r;
}
/* This would make this whole thing pointless */
if (!last_request->intersect)
BUG_ON(rd != cfg80211_regdomain);
/* update all wiphys now with the new established regulatory domain */
<API key>(last_request->initiator);
print_regdomain(cfg80211_regdomain);
<API key>(last_request);
<API key>();
mutex_unlock(®_mutex);
return r;
}
#ifdef CONFIG_HOTPLUG
int reg_device_uevent(struct device *dev, struct kobj_uevent_env *env)
{
if (last_request && !last_request->processed) {
if (add_uevent_var(env, "COUNTRY=%c%c",
last_request->alpha2[0],
last_request->alpha2[1]))
return -ENOMEM;
}
return 0;
}
#else
int reg_device_uevent(struct device *dev, struct kobj_uevent_env *env)
{
return -ENODEV;
}
#endif /* CONFIG_HOTPLUG */
/* Caller must hold cfg80211_mutex */
void reg_device_remove(struct wiphy *wiphy)
{
struct wiphy *request_wiphy = NULL;
<API key>();
mutex_lock(®_mutex);
kfree(wiphy->regd);
if (last_request)
request_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx);
if (!request_wiphy || request_wiphy != wiphy)
goto out;
last_request->wiphy_idx = WIPHY_IDX_STALE;
last_request->country_ie_env = ENVIRON_ANY;
out:
mutex_unlock(®_mutex);
}
static void reg_timeout_work(struct work_struct *work)
{
REG_DBG_PRINT("Timeout while waiting for CRDA to reply, "
"restoring regulatory settings\n");
<API key>(true);
}
int __init regulatory_init(void)
{
int err = 0;
reg_pdev = <API key>("regulatory", 0, NULL, 0);
if (IS_ERR(reg_pdev))
return PTR_ERR(reg_pdev);
reg_pdev->dev.type = ®_device_type;
spin_lock_init(®_requests_lock);
spin_lock_init(&<API key>);
<API key>();
cfg80211_regdomain = <API key>;
user_alpha2[0] = '9';
user_alpha2[1] = '7';
/* We always try to get an update for the static regdomain */
err = <API key>(cfg80211_regdomain->alpha2);
if (err) {
if (err == -ENOMEM)
return err;
/*
* N.B. kobject_uevent_env() can fail mainly for when we're out
* memory which is handled and propagated appropriately above
* but it can also fail during a netlink_broadcast() or during
* early boot for call_usermodehelper(). For now treat these
* errors as non-fatal.
*/
pr_err("kobject_uevent_env() was unable to call CRDA during init\n");
#ifdef <API key>
/* We want to find out exactly why when debugging */
WARN_ON(err);
#endif
}
/*
* Finally, if the user set the module parameter treat it
* as a user hint.
*/
if (!is_world_regdom(ieee80211_regdom))
<API key>(ieee80211_regdom);
return 0;
}
void /* __init_or_exit */ regulatory_exit(void)
{
struct regulatory_request *reg_request, *tmp;
struct reg_beacon *reg_beacon, *btmp;
cancel_work_sync(®_work);
<API key>(®_timeout);
mutex_lock(&cfg80211_mutex);
mutex_lock(®_mutex);
reset_regdomains(true);
<API key>(®_pdev->dev, true);
<API key>(reg_pdev);
spin_lock_bh(&<API key>);
if (!list_empty(®_pending_beacons)) {
<API key>(reg_beacon, btmp,
®_pending_beacons, list) {
list_del(®_beacon->list);
kfree(reg_beacon);
}
}
spin_unlock_bh(&<API key>);
if (!list_empty(®_beacon_list)) {
<API key>(reg_beacon, btmp,
®_beacon_list, list) {
list_del(®_beacon->list);
kfree(reg_beacon);
}
}
spin_lock(®_requests_lock);
if (!list_empty(®_requests_list)) {
<API key>(reg_request, tmp,
®_requests_list, list) {
list_del(®_request->list);
kfree(reg_request);
}
}
spin_unlock(®_requests_lock);
mutex_unlock(®_mutex);
mutex_unlock(&cfg80211_mutex);
}
|
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?>
<!DOCTYPE html>
<html lang="es_MX">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="css/reset.css">
<link rel="stylesheet" type="text/css" href="css/estilo.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<?php echo link_tag('css/sistema.css'); ?>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>
<body style="background-color: #ffffff;">
<div class="container-fluid1">
<div id="foo">
<p id="spin_label" style="position:absolute; width: 100%; top: 50%; margin-top: 60px; text-align: center;">
</p>
</div>
<div class="row-fluid1" id="wrapper1">
<div class="alert" id="messages"></div>
<!-- Inicia Formulario -->
|
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/phy/phy.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <dt-bindings/phy/phy-pistachio-usb.h>
#define USB_PHY_CONTROL0 0x00
#define <API key> 11
#define <API key> 1
#define USB_PHY_CONTROL1 0x04
#define <API key> 2
#define <API key> 0x7
#define <API key> 0x10
#define <API key> 4
#define <API key> 0x3
#define USB_PHY_STATUS 0x14
#define <API key> BIT(9)
#define <API key> BIT(8)
#define <API key> BIT(7)
struct pistachio_usb_phy {
struct device *dev;
struct regmap *cr_top;
struct clk *phy_clk;
bool vbus_drive;
unsigned int refclk;
};
static const unsigned long fsel_rate_map[] = {
9600000,
10000000,
12000000,
19200000,
20000000,
24000000,
0,
50000000,
};
static int <API key>(struct phy *phy)
{
struct pistachio_usb_phy *p_phy = phy_get_drvdata(phy);
unsigned long timeout, rate;
unsigned int i;
int ret;
ret = clk_prepare_enable(p_phy->phy_clk);
if (ret < 0) {
dev_err(p_phy->dev, "Failed to enable PHY clock: %d\n", ret);
return ret;
}
regmap_update_bits(p_phy->cr_top, <API key>,
<API key> <<
<API key>,
p_phy->refclk << <API key>);
if (p_phy->vbus_drive) {
/* allow USB block to control VBUS */
regmap_update_bits(p_phy->cr_top, USB_PHY_CONTROL0,
<API key> <<
<API key>,
1 << <API key>);
}
rate = clk_get_rate(p_phy->phy_clk);
if (p_phy->refclk == REFCLK_XO_CRYSTAL && rate != 12000000) {
dev_err(p_phy->dev, "Unsupported rate for XO crystal: %ld\n",
rate);
ret = -EINVAL;
goto disable_clk;
}
for (i = 0; i < ARRAY_SIZE(fsel_rate_map); i++) {
if (rate == fsel_rate_map[i])
break;
}
if (i == ARRAY_SIZE(fsel_rate_map)) {
dev_err(p_phy->dev, "Unsupported clock rate: %lu\n", rate);
ret = -EINVAL;
goto disable_clk;
}
regmap_update_bits(p_phy->cr_top, USB_PHY_CONTROL1,
<API key> <<
<API key>,
i << <API key>);
timeout = jiffies + msecs_to_jiffies(200);
while (time_before(jiffies, timeout)) {
unsigned int val;
regmap_read(p_phy->cr_top, USB_PHY_STATUS, &val);
if (val & <API key>) {
dev_err(p_phy->dev, "VBUS fault detected\n");
ret = -EIO;
goto disable_clk;
}
if ((val & <API key>) &&
(val & <API key>))
return 0;
usleep_range(1000, 1500);
}
dev_err(p_phy->dev, "Timed out waiting for PHY to power on\n");
ret = -ETIMEDOUT;
disable_clk:
<API key>(p_phy->phy_clk);
return ret;
}
static int <API key>(struct phy *phy)
{
struct pistachio_usb_phy *p_phy = phy_get_drvdata(phy);
<API key>(p_phy->phy_clk);
return 0;
}
static const struct phy_ops <API key> = {
.power_on = <API key>,
.power_off = <API key>,
.owner = THIS_MODULE,
};
static int <API key>(struct platform_device *pdev)
{
struct pistachio_usb_phy *p_phy;
struct phy_provider *provider;
struct phy *phy;
int ret;
p_phy = devm_kzalloc(&pdev->dev, sizeof(*p_phy), GFP_KERNEL);
if (!p_phy)
return -ENOMEM;
p_phy->dev = &pdev->dev;
<API key>(pdev, p_phy);
p_phy->cr_top = <API key>(p_phy->dev->of_node,
"img,cr-top");
if (IS_ERR(p_phy->cr_top)) {
dev_err(p_phy->dev, "Failed to get CR_TOP registers: %ld\n",
PTR_ERR(p_phy->cr_top));
return PTR_ERR(p_phy->cr_top);
}
p_phy->phy_clk = devm_clk_get(p_phy->dev, "usb_phy");
if (IS_ERR(p_phy->phy_clk)) {
dev_err(p_phy->dev, "Failed to get usb_phy clock: %ld\n",
PTR_ERR(p_phy->phy_clk));
return PTR_ERR(p_phy->phy_clk);
}
ret = <API key>(p_phy->dev->of_node, "img,refclk",
&p_phy->refclk);
if (ret < 0) {
dev_err(p_phy->dev, "No reference clock selector specified\n");
return ret;
}
p_phy->vbus_drive = <API key>(p_phy->dev->of_node, "enable-vbus-drive");
phy = devm_phy_create(p_phy->dev, NULL, &<API key>);
if (IS_ERR(phy)) {
dev_err(p_phy->dev, "Failed to create PHY: %ld\n",
PTR_ERR(phy));
return PTR_ERR(phy);
}
phy_set_drvdata(phy, p_phy);
provider = <API key>(p_phy->dev,
of_phy_simple_xlate);
if (IS_ERR(provider)) {
dev_err(p_phy->dev, "Failed to register PHY provider: %ld\n",
PTR_ERR(provider));
return PTR_ERR(provider);
}
return 0;
}
static const struct of_device_id <API key>[] = {
{ .compatible = "img,pistachio-usb-phy", },
{ },
};
MODULE_DEVICE_TABLE(of, <API key>);
static struct platform_driver <API key> = {
.probe = <API key>,
.driver = {
.name = "pistachio-usb-phy",
.of_match_table = <API key>,
},
};
<API key>(<API key>);
MODULE_AUTHOR("Andrew Bresticker <abrestic@chromium.org>");
MODULE_DESCRIPTION("IMG Pistachio USB2.0 PHY driver");
MODULE_LICENSE("GPL v2");
|
<?php
defined('_JEXEC') or die;
$supperAdmin = JFactory::isSupperAdmin();
// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
JHtml::_('bootstrap.tooltip');
JHtml::_('behavior.multiselect');
JHtml::_('formbehavior.chosen', 'select');
$user = JFactory::getUser();
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$canOrder = $user->authorise('core.edit.state', 'com_supperadmin');
$saveOrder = $listOrder == 'ordering';
if ($saveOrder) {
$saveOrderingUrl = 'index.php?option=com_supperadmin&task=modules.saveOrderAjax&tmpl=component';
JHtml::_('sortablelist.sortable', 'articleList', 'adminForm', strtolower($listDirn), $saveOrderingUrl);
}
$sortFields = $this->getSortFields();
?>
<script type="text/javascript">
Joomla.orderTable = function () {
table = document.getElementById("sortTable");
direction = document.getElementById("directionTable");
order = table.options[table.selectedIndex].value;
if (order != '<?php echo $listOrder; ?>') {
dirn = 'asc';
}
else {
dirn = direction.options[direction.selectedIndex].value;
}
Joomla.tableOrdering(order, dirn, '');
}
</script>
<div class="<API key>">
<?php echo $this->render_toolbar() ?>
<form action="<?php echo JRoute::_('index.php?option=com_supperadmin&view=modules'); ?>" method="post"
name="adminForm" id="adminForm">
<div id="main-container">
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="col-md-12">
<?php
echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this));
?>
</div>
</div>
<div class="row">
<div class="col-md-12">
<table class="table table-striped" id="itemList">
<thead>
<tr>
<th width="1%" class="nowrap center hidden-phone">
<?php echo JHtml::_('grid.sort', '<i class="icon-menu-2"></i>', 'ordering', $listDirn, $listOrder, null, 'asc', '<API key>'); ?>
</th>
<th width="1%" class="hidden-phone">
<?php echo JHtml::_('grid.checkall'); ?>
</th>
<th width="1%" class="nowrap center">
<?php echo JHtml::_('grid.sort', 'JSTATUS', 'enabled', $listDirn, $listOrder); ?>
</th>
<th class="title">
<?php echo JHtml::_('grid.sort', 'module title', 'name', $listDirn, $listOrder); ?>
</th>
<th class="title">
<?php echo JHtml::_('grid.sort', 'module name', 'name', $listDirn, $listOrder); ?>
</th>
<th class="title">
<?php echo JHtml::_('grid.sort', 'website', 'a.website_name', $listDirn, $listOrder); ?>
</th>
<th class="title">
<?php echo JHtml::_('grid.sort', 'Is System', 'a.issystem', $listDirn, $listOrder); ?>
</th>
<th width="5%" class="hidden-phone">
<?php echo JHtml::_('grid.sort', '<API key>', 'access', $listDirn, $listOrder); ?>
</th>
<th width="1%" class="nowrap center hidden-phone">
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ID', 'id', $listDirn, $listOrder); ?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="12">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php foreach ($this->items as $i => $item) :
$ordering = ($listOrder == 'ordering');
$canEdit = $user->authorise('core.edit', 'com_supperadmin');
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->get('id') || $item->checked_out == 0;
$canChange = $user->authorise('core.edit.state', 'com_supperadmin') && $canCheckin;
?>
<tr class="row<?php echo $i % 2; ?>" item-id="<?php echo $item->id ?>"
sortable-group-id="<?php echo $item->folder ?>">
<td class="order nowrap center hidden-phone">
<?php
$iconClass = '';
if (!$canChange) {
$iconClass = ' inactive';
} elseif (!$saveOrder) {
$iconClass = ' inactive tip-top hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED');
}
?>
<span class="sortable-handler<?php echo $iconClass ?>">
<i class="icon-menu"></i>
</span>
<?php if ($canChange && $saveOrder) : ?>
<input type="text" style="display:none" name="order[]" size="5"
value="<?php echo $item->ordering; ?>" class="width-20 text-area-order "/>
<?php endif; ?>
</td>
<td class="center hidden-phone">
<?php echo JHtml::_('grid.id', $i, $item->id); ?>
</td>
<td class="center">
<?php echo JHtml::_('jgrid.published', $item->enabled, $i, 'modules.', $canChange); ?>
</td>
<td>
<?php if ($item->checked_out) : ?>
<?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'supperadmin.', $canCheckin); ?>
<?php endif; ?>
<?php if ($canEdit) : ?>
<a class="quick-edit-title"
href="<?php echo JRoute::_('index.php?option=com_supperadmin&task=module.edit&id=' . (int)$item->id); ?>">
<?php echo $item->title; ?></a>
<?php else : ?>
<?php echo $item->title; ?>
<?php endif; ?>
</td>
<td>
<?php if ($item->checked_out) : ?>
<?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'supperadmin.', $canCheckin); ?>
<?php endif; ?>
<?php if ($canEdit) : ?>
<a class="quick-edit-title"
href="<?php echo JRoute::_('index.php?option=com_supperadmin&task=module.edit&id=' . (int)$item->id); ?>">
<?php echo $item->module; ?></a>
<?php else : ?>
<?php echo $item->module; ?>
<?php endif; ?>
</td>
<td class="center hidden-phone">
<?php echo $item->website_name ?>
</td>
<td class="center">
<?php echo JHtml::_('jgrid.is_system', $item->issystem, $i, 'modules.', $canChange); ?>
</td>
<td class="small hidden-phone">
<?php echo $this->escape($item->access_level); ?>
</td>
<td class="center hidden-phone">
<?php echo (int)$item->id; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="clearfix"></div>
<input type="hidden" name="task" value=""/>
<input type="hidden" name="boxchecked" value="0"/>
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>"/>
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>"/>
<?php echo JHtml::_('form.token'); ?>
</div>
</form>
</div>
<?php
// Search tools bar
echo JLayoutHelper::render('joomla.contextmenu.contextmenu', array('view' => $this), null, array('debug' => false));
?>
|
/**
@file storage/perfschema/pfs_setup_object.cc
Performance schema setup object (implementation).
*/
#include "my_global.h"
#include "my_sys.h"
#include "my_base.h"
#include "sql_string.h"
#include "pfs.h"
#include "pfs_stat.h"
#include "pfs_instr.h"
#include "pfs_setup_object.h"
#include "pfs_global.h"
/**
@addtogroup <API key>
@{
*/
uint <API key>= 0;
ulong setup_object_max;
PFS_setup_object *setup_object_array= NULL;
LF_HASH setup_object_hash;
static bool <API key>= false;
/**
Initialize the setup object buffers.
@param param sizing parameters
@return 0 on success
*/
int init_setup_object(const PFS_global_param *param)
{
setup_object_max= param-><API key>;
setup_object_array= NULL;
if (setup_object_max > 0)
{
setup_object_array= PFS_MALLOC_ARRAY(setup_object_max, sizeof(PFS_setup_object),
PFS_setup_object, MYF(MY_ZEROFILL));
if (unlikely(setup_object_array == NULL))
return 1;
}
return 0;
}
/** Cleanup all the setup object buffers. */
void <API key>(void)
{
pfs_free(setup_object_array);
setup_object_array= NULL;
setup_object_max= 0;
}
C_MODE_START
static uchar *<API key>(const uchar *entry, size_t *length,
my_bool)
{
const PFS_setup_object * const *typed_entry;
const PFS_setup_object *setup_object;
const void *result;
typed_entry= reinterpret_cast<const PFS_setup_object* const *> (entry);
DBUG_ASSERT(typed_entry != NULL);
setup_object= *typed_entry;
DBUG_ASSERT(setup_object != NULL);
*length= setup_object->m_key.m_key_length;
result= setup_object->m_key.m_hash_key;
return const_cast<uchar*> (reinterpret_cast<const uchar*> (result));
}
C_MODE_END
/**
Initialize the setup objects hash.
@return 0 on success
*/
int <API key>(void)
{
if ((! <API key>) && (setup_object_max > 0))
{
lf_hash_init(&setup_object_hash, sizeof(PFS_setup_object*), LF_HASH_UNIQUE,
0, 0, <API key>, &my_charset_bin);
/* setup_object_hash.size= setup_object_max; */
<API key>= true;
}
return 0;
}
/** Cleanup the setup objects hash. */
void <API key>(void)
{
if (<API key>)
{
<API key>= false;
lf_hash_destroy(&setup_object_hash);
}
}
static LF_PINS* <API key>(PFS_thread *thread)
{
if (unlikely(thread-><API key> == NULL))
{
if (! <API key>)
return NULL;
thread-><API key>= lf_hash_get_pins(&setup_object_hash);
}
return thread-><API key>;
}
static void <API key>(<API key> *key,
enum_object_type object_type,
const char *schema, uint schema_length,
const char *object, uint object_length)
{
DBUG_ASSERT(schema_length <= NAME_LEN);
DBUG_ASSERT(object_length <= NAME_LEN);
char *ptr= &key->m_hash_key[0];
ptr[0]= (char) object_type;
ptr++;
if (schema_length)
{
memcpy(ptr, schema, schema_length);
ptr+= schema_length;
}
ptr[0]= 0;
ptr++;
if (object_length)
{
memcpy(ptr, object, object_length);
ptr+= object_length;
}
ptr[0]= 0;
ptr++;
key->m_key_length= (uint)(ptr - &key->m_hash_key[0]);
}
int insert_setup_object(enum_object_type object_type, const String *schema,
const String *object, bool enabled, bool timed)
{
if (setup_object_max == 0)
return <API key>;
PFS_thread *thread= PFS_thread::get_current_thread();
if (unlikely(thread == NULL))
return HA_ERR_OUT_OF_MEM;
LF_PINS* pins= <API key>(thread);
if (unlikely(pins == NULL))
return HA_ERR_OUT_OF_MEM;
static uint PFS_ALIGNED <API key>= 0;
uint index;
uint attempts= 0;
PFS_setup_object *pfs;
while (++attempts <= setup_object_max)
{
/* See create_mutex() */
index= PFS_atomic::add_u32(& <API key>, 1) % setup_object_max;
pfs= setup_object_array + index;
if (pfs->m_lock.is_free())
{
if (pfs->m_lock.free_to_dirty())
{
<API key>(&pfs->m_key, object_type,
schema->ptr(), schema->length(),
object->ptr(), object->length());
pfs->m_schema_name= &pfs->m_key.m_hash_key[1];
pfs-><API key>= schema->length();
pfs->m_object_name= pfs->m_schema_name + pfs-><API key> + 1;
pfs-><API key>= object->length();
pfs->m_enabled= enabled;
pfs->m_timed= timed;
int res;
res= lf_hash_insert(&setup_object_hash, pins, &pfs);
if (likely(res == 0))
{
pfs->m_lock.dirty_to_allocated();
<API key>++;
return 0;
}
pfs->m_lock.dirty_to_free();
if (res > 0)
return <API key>;
/* OOM in lf_hash_insert */
return HA_ERR_OUT_OF_MEM;
}
}
}
return <API key>;
}
int delete_setup_object(enum_object_type object_type, const String *schema,
const String *object)
{
PFS_thread *thread= PFS_thread::get_current_thread();
if (unlikely(thread == NULL))
return HA_ERR_OUT_OF_MEM;
LF_PINS* pins= <API key>(thread);
if (unlikely(pins == NULL))
return HA_ERR_OUT_OF_MEM;
<API key> key;
<API key>(&key, object_type,
schema->ptr(), schema->length(),
object->ptr(), object->length());
PFS_setup_object **entry;
entry= reinterpret_cast<PFS_setup_object**>
(lf_hash_search(&setup_object_hash, pins, key.m_hash_key, key.m_key_length));
if (entry && (entry != MY_ERRPTR))
{
PFS_setup_object *pfs= *entry;
lf_hash_delete(&setup_object_hash, pins, key.m_hash_key, key.m_key_length);
pfs->m_lock.allocated_to_free();
}
<API key>(pins);
<API key>++;
return 0;
}
int reset_setup_object()
{
PFS_thread *thread= PFS_thread::get_current_thread();
if (unlikely(thread == NULL))
return HA_ERR_OUT_OF_MEM;
LF_PINS* pins= <API key>(thread);
if (unlikely(pins == NULL))
return HA_ERR_OUT_OF_MEM;
PFS_setup_object *pfs= setup_object_array;
PFS_setup_object *pfs_last= setup_object_array + setup_object_max;
for ( ; pfs < pfs_last; pfs++)
{
if (pfs->m_lock.is_populated())
{
lf_hash_delete(&setup_object_hash, pins,
pfs->m_key.m_hash_key, pfs->m_key.m_key_length);
pfs->m_lock.allocated_to_free();
}
}
<API key>++;
return 0;
}
long setup_object_count()
{
return setup_object_hash.count;
}
void lookup_setup_object(PFS_thread *thread,
enum_object_type object_type,
const char *schema_name, int schema_name_length,
const char *object_name, int object_name_length,
bool *enabled, bool *timed)
{
<API key> key;
PFS_setup_object **entry;
PFS_setup_object *pfs;
int i;
/*
The table io instrumentation uses "TABLE" and "TEMPORARY TABLE".
SETUP_OBJECT uses "TABLE" for both concepts.
There is no way to provide a different setup for:
- TABLE foo.bar
- TEMPORARY TABLE foo.bar
*/
DBUG_ASSERT(object_type != <API key>);
LF_PINS* pins= <API key>(thread);
if (unlikely(pins == NULL))
{
*enabled= false;
*timed= false;
return;
}
for (i= 1; i<=3; i++)
{
switch(i)
{
case 1:
/* Lookup OBJECT_TYPE + OBJECT_SCHEMA + OBJECT_NAME in SETUP_OBJECTS */
<API key>(&key,
object_type,
schema_name, schema_name_length,
object_name, object_name_length);
break;
case 2:
/* Lookup OBJECT_TYPE + OBJECT_SCHEMA + "%" in SETUP_OBJECTS */
<API key>(&key,
object_type,
schema_name, schema_name_length, "%", 1);
break;
case 3:
/* Lookup OBJECT_TYPE + "%" + "%" in SETUP_OBJECTS */
<API key>(&key, object_type, "%", 1, "%", 1);
break;
}
entry= reinterpret_cast<PFS_setup_object**>
(lf_hash_search(&setup_object_hash, pins, key.m_hash_key, key.m_key_length));
if (entry && (entry != MY_ERRPTR))
{
pfs= *entry;
*enabled= pfs->m_enabled;
*timed= pfs->m_timed;
<API key>(pins);
return;
}
<API key>(pins);
}
*enabled= false;
*timed= false;
return;
}
|
#!/usr/bin/env python
import glob, os, sys
import sipconfig
from PyQt4 import pyqtconfig
def get_diana_version():
depends = filter(lambda line: line.startswith("Depends:"),
open("debian/control").readlines())
for line in depends:
pieces = line.split()
for piece in pieces:
name_pieces = piece.strip(",").split("-")
if len(name_pieces) == 2 and name_pieces[0] == "diana":
return name_pieces[1]
return None
def <API key>():
line = open("debian/changelog").readline()
pieces = line.split()
return pieces[1][1:-1]
if __name__ == "__main__":
if len(sys.argv) not in (1, 3, 5):
sys.stderr.write("Usage: %s [<directory containing diana headers> <directory containing libdiana>] "
"[<directory containing metlibs headers> <directory containing metlibs libraries>]\n" % sys.argv[0])
sys.exit(1)
if len(sys.argv) == 5:
metlibs_inc_dir = sys.argv[3]
metlibs_lib_dir = sys.argv[4]
else:
metlibs_inc_dir = "/usr/include/metlibs"
metlibs_lib_dir = "/usr/lib"
if len(sys.argv) >= 3:
diana_inc_dir = sys.argv[1]
diana_lib_dir = sys.argv[2]
else:
diana_inc_dir = "/usr/include/diana"
diana_lib_dir = "/usr/lib"
qt_pkg_dir = os.getenv("qt_pkg_dir")
<API key> = os.getenv("<API key>")
dest_pkg_dir = os.path.join(<API key>, "metno")
config = pyqtconfig.Configuration()
# The name of the SIP build file generated by SIP and used by the build
# system.
sip_files_dir = "sip"
modules = ["std", "metlibs", "diana"]
if not os.path.exists("modules"):
os.mkdir("modules")
# Run SIP to generate the code.
output_dirs = []
for module in modules:
output_dir = os.path.join("modules", module)
build_file = module + ".sbf"
build_path = os.path.join(output_dir, build_file)
if not os.path.exists(output_dir):
os.mkdir(output_dir)
sip_file = os.path.join("sip", module, module+".sip")
command = " ".join([config.sip_bin,
"-c", output_dir,
"-b", build_path,
"-I"+config.sip_inc_dir,
"-I"+config.pyqt_sip_dir,
"-I"+diana_inc_dir,
"-I/usr/include",
"-I"+metlibs_inc_dir,
"-I"+qt_pkg_dir+"/include",
"-I"+qt_pkg_dir+"/share/sip/PyQt4",
"-Isip",
config.pyqt_sip_flags,
"-w",
"-o", # generate docstrings for signatures
sip_file])
sys.stdout.write(command+"\n")
sys.stdout.flush()
if os.system(command) != 0:
sys.exit(1)
# Create the Makefile (within the diana directory).
makefile = pyqtconfig.QtGuiModuleMakefile(
config, build_file, dir=output_dir,
install_dir=dest_pkg_dir,
qt=["QtCore", "QtGui", "QtNetwork", "QtXml", "QtXmlPatterns"]
)
if module == "diana":
makefile.extra_include_dirs += [
diana_inc_dir,
os.path.join(diana_inc_dir, "PaintGL"),
metlibs_inc_dir,
qt_pkg_dir+"/include"
]
makefile.extra_lib_dirs += [diana_lib_dir, qt_pkg_dir+"/lib"]
makefile.extra_lflags += ["-Wl,-rpath="+diana_lib_dir, "-Wl,-fPIC"]
makefile.extra_libs += ["diana"]
if module == "metlibs":
makefile.extra_include_dirs.append(diana_inc_dir)
makefile.extra_include_dirs.append("/usr/include/metlibs")
makefile.extra_lib_dirs += [diana_lib_dir, "/usr/lib", metlibs_lib_dir, qt_pkg_dir+"/lib"]
makefile.extra_lflags += ["-Wl,-rpath="+diana_lib_dir, "-Wl,-fPIC"]
makefile.extra_libs += ["miLogger", "coserver", "diana"]
makefile.generate()
output_dirs.append(output_dir)
# Update the metno package version.
diana_version = get_diana_version()
<API key> = <API key>()
if not diana_version or not <API key>:
sys.stderr.write("Failed to find version information for Diana (%s) "
"or python-diana (%s)\n" % (repr(diana_version),
repr(<API key>)))
sys.exit(1)
f = open("python/metno/versions.py", "w")
f.write('\ndiana_version = "%s"\<API key> = "%s"\n' % (
diana_version, <API key>))
# Generate the top-level Makefile.
python_files = glob.glob(os.path.join("python", "metno", "*.py"))
sipconfig.ParentMakefile(
configuration = config,
subdirs = output_dirs,
installs = [(python_files, dest_pkg_dir)]
).generate()
sys.exit()
|
// <API key>: GPL-2.0
#include "core/subsurface-string.h"
#include "qPrefDisplay.h"
#include "qPrefPrivate.h"
#include <QApplication>
#include <QFont>
static const QString group = QStringLiteral("Display");
QPointF qPrefDisplay::st_tooltip_position;
static const QPointF <API key> = QPointF(0,0);
QString qPrefDisplay::st_lastDir;
static const QString st_lastDir_default = "";
QString qPrefDisplay::st_theme;
static const QString st_theme_default = "Blue";
QString qPrefDisplay::st_userSurvey;
static const QString <API key> = "";
QByteArray qPrefDisplay::st_mainSplitter;
static const QByteArray <API key> = "";
QByteArray qPrefDisplay::st_topSplitter;
static const QByteArray <API key> = "";
QByteArray qPrefDisplay::st_bottomSplitter;
static const QByteArray <API key> = "";
bool qPrefDisplay::st_maximized;
static bool <API key> = false;
QByteArray qPrefDisplay::st_geometry;
static const QByteArray st_geometry_default = 0;
QByteArray qPrefDisplay::st_windowState;
static const QByteArray <API key> = 0;
int qPrefDisplay::st_lastState;
static int <API key> = false;
qPrefDisplay::qPrefDisplay(QObject *parent) : QObject(parent)
{
}
qPrefDisplay *qPrefDisplay::instance()
{
static qPrefDisplay *self = new qPrefDisplay;
return self;
}
void qPrefDisplay::loadSync(bool doSync)
{
<API key>(doSync);
disk_divelist_font(doSync);
disk_font_size(doSync);
disk_mobile_scale(doSync);
<API key>(doSync);
disk_show_developer(doSync);
if (!doSync) {
<API key>();
load_theme();
load_userSurvey();
load_mainSplitter();
load_topSplitter();
load_bottomSplitter();
load_maximized();
load_geometry();
load_windowState();
load_lastState();
}
}
void qPrefDisplay::set_divelist_font(const QString &value)
{
QString newValue = value;
if (value.contains(","))
newValue = value.left(value.indexOf(","));
if (newValue != prefs.divelist_font &&
!<API key>(qPrintable(newValue))) {
qPrefPrivate::copy_txt(&prefs.divelist_font, value);
disk_divelist_font(true);
qApp->setFont(QFont(newValue));
emit instance()-><API key>(value);
}
}
void qPrefDisplay::disk_divelist_font(bool doSync)
{
if (doSync)
qPrefPrivate::propSetValue(keyFromGroupAndName(group, "divelist_font"), prefs.divelist_font, default_prefs.divelist_font);
else
setCorrectFont();
}
void qPrefDisplay::set_font_size(double value)
{
if (!IS_FP_SAME(value, prefs.font_size)) {
prefs.font_size = value;
disk_font_size(true);
QFont defaultFont = qApp->font();
defaultFont.setPointSizeF(prefs.font_size * prefs.mobile_scale);
qApp->setFont(defaultFont);
emit instance()->font_sizeChanged(value);
}
}
void qPrefDisplay::disk_font_size(bool doSync)
{
// inverted logic compared to the other disk_xxx functions
if (!doSync)
setCorrectFont();
#if !defined(SUBSURFACE_MOBILE)
// we never want to save the font_size to disk - we always want to grab that from the system default
else
qPrefPrivate::propSetValue(keyFromGroupAndName(group, "font_size"), prefs.font_size, default_prefs.font_size);
#endif
}
void qPrefDisplay::set_mobile_scale(double value)
{
if (!IS_FP_SAME(value, prefs.mobile_scale)) {
prefs.mobile_scale = value;
disk_mobile_scale(true);
QFont defaultFont = qApp->font();
defaultFont.setPointSizeF(prefs.font_size * prefs.mobile_scale);
qApp->setFont(defaultFont);
emit instance()->mobile_scaleChanged(value);
emit instance()->font_sizeChanged(value);
}
}
void qPrefDisplay::disk_mobile_scale(bool doSync)
{
if (doSync) {
qPrefPrivate::propSetValue(keyFromGroupAndName(group, "mobile_scale"), prefs.mobile_scale, default_prefs.mobile_scale);
} else {
prefs.mobile_scale = qPrefPrivate::propValue(keyFromGroupAndName(group, "mobile_scale"), default_prefs.mobile_scale).toDouble();
setCorrectFont();
}
}
//JAN static const QString group = QStringLiteral("Animations");
<API key>(Display, "animation_speed", animation_speed);
<API key>(Display, "displayinvalid", <API key>);
<API key>(Display, "show_developer", show_developer);
void qPrefDisplay::setCorrectFont()
{
// get the font from the settings or our defaults
// respect the system default font size if none is explicitly set
QFont defaultFont = qPrefPrivate::propValue(keyFromGroupAndName(group, "divelist_font"), prefs.divelist_font).value<QFont>();
if (IS_FP_SAME(<API key>, -1.0)) {
prefs.font_size = qApp->font().pointSizeF();
<API key> = prefs.font_size; // this way we don't save it on exit
}
prefs.font_size = qPrefPrivate::propValue(keyFromGroupAndName(group, "font_size"), prefs.font_size).toFloat();
// painful effort to ignore previous default fonts on Windows - ridiculous
QString fontName = defaultFont.toString();
if (fontName.contains(","))
fontName = fontName.left(fontName.indexOf(","));
if (<API key>(qPrintable(fontName))) {
defaultFont = QFont(prefs.divelist_font);
} else {
free((void *)prefs.divelist_font);
prefs.divelist_font = copy_qstring(fontName);
}
defaultFont.setPointSizeF(prefs.font_size * prefs.mobile_scale);
qApp->setFont(defaultFont);
prefs.<API key> = qPrefPrivate::propValue(keyFromGroupAndName(group, "displayinvalid"), default_prefs.<API key>).toBool();
}
HANDLE_PROP_QSTRING(Display, "FileDialog/LastDir", lastDir);
HANDLE_PROP_QSTRING(Display, "Theme/currentTheme", theme);
HANDLE_PROP_QPOINTF(Display, "ProfileMap/tooltip_position", tooltip_position);
HANDLE_PROP_QSTRING(Display, "UserSurvey/SurveyDone", userSurvey);
<API key>(Display, "MainWindow/mainSplitter", mainSplitter);
<API key>(Display, "MainWindow/topSplitter", topSplitter);
<API key>(Display, "MainWindow/bottomSplitter", bottomSplitter);
HANDLE_PROP_BOOL(Display, "MainWindow/maximized", maximized);
<API key>(Display, "MainWindow/geometry", geometry);
<API key>(Display, "MainWindow/windowState", windowState);
HANDLE_PROP_INT(Display, "MainWindow/lastState", lastState);
|
from datetime import datetime
from flask import current_app
from flask.cli import with_appcontext
from invenio_db import db
from hepdata.cli import fix
from hepdata.ext.elasticsearch.api import index_record_ids, push_data_keywords
from hepdata.modules.submission.models import HEPSubmission, DataSubmission
from hepdata.modules.records.utils.common import get_record_by_id
from hepdata.modules.records.utils.doi_minter import <API key>
from hepdata.modules.records.utils.submission import <API key>
@fix.command()
@with_appcontext
def <API key>():
# Get submissions with missing IDs
missing_submissions = DataSubmission.query \
.join(HEPSubmission, HEPSubmission.publication_recid == DataSubmission.publication_recid) \
.filter(
DataSubmission.associated_recid == None,
DataSubmission.<API key> == None,
DataSubmission.version == HEPSubmission.version,
HEPSubmission.overall_status == 'finished')
missing_submissions = missing_submissions.all()
if not missing_submissions:
print("No datasubmissions found with missing record or inspire ids.")
return
# Organise missing submissions by publication
<API key> = {}
for submission in missing_submissions:
if submission.publication_recid in <API key>:
<API key>[submission.publication_recid].append(submission)
else:
<API key>[submission.publication_recid] = [submission]
# Loop through each publication
for publication_recid, submissions in <API key>.items():
publication_record = get_record_by_id(publication_recid)
current_time = "{:%Y-%m-%d %H:%M:%S}".format(datetime.utcnow())
<API key> = []
for submission in submissions:
# Finalise each data submission that does not have a record
<API key>(current_time, {},
<API key>,
publication_record, publication_recid,
submission,
submission.version)
# Register the datasubmission's DOI
if not current_app.config.get('TESTING', False):
<API key>.delay(submission.doi)
print(f"Generated DOI {submission.doi}")
else:
print(f"Would generate DOI {submission.doi}")
# <API key> does not commit, so commit once for each publication
db.session.commit()
# Reindex the publication and its updated datasubmissions
index_record_ids([publication_recid] + <API key>)
push_data_keywords(pub_ids=[publication_recid])
|
html, body {
background: #fff;
}
body {
margin: 0; /* Required */
}
#desktop {
position: relative;
min-width: 400px; /* Helps keep header content from wrapping */
height: 100%;
min-height: 100%;
overflow: hidden;
cursor: default; /* Fix for issue in IE7. IE7 wants to use the I-bar text cursor */
}
#desktopHeader {
background: #f2f2f2;
}
#<API key> {
position: relative;
height: 45px;
overflow: hidden;
background: #718BA6 url(../images/skin/bg-header.gif) repeat-x;
}
#desktopTitlebar {
padding: 7px 8px 6px 8px;
height: 32px;
background: url(../images/skin/logo.gif) no-repeat;
background-position: left 0;
}
#desktopTitlebar h1.applicationTitle {
display: none;
margin: 0;
padding: 0 5px 0 0;
font-size: 20px;
line-height: 25px;
font-weight: bold;
color: #fff;
}
#desktopTitlebar h2.tagline {
padding: 7px 0 0 0;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #d4dce4;
font-weight: bold;
text-align: center;
text-transform: uppercase;
}
#desktopTitlebar h2.tagline .taglineEm {
color: #fff;
font-weight: bold;
}
#topNav {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
position: absolute;
right: 0;
top: 0;
color: #d4dce4;
text-align: right;
padding: 13px 10px 0 0;
}
#topNav a {
color: #fff;
font-weight: normal;
}
#topNav a:hover {
text-decoration: none;
}
/* Navbar */
#desktopNavbar {
background: #f2f2f2;
/*height: 30px;*/
margin: 0 0px;
overflow: hidden; /* Remove this line if you want the menu to be backward compatible with Firefox 2 */
/* Fixes by Chris */
/*background-color: #ccc;*/
height: 20px;
margin-bottom: 5px;
border-bottom: 1px solid #3f3f3f;
}
#desktopNavbar ul {
padding: 0;
margin: 0;
list-style: none;
font-size: 12px;
}
#desktopNavbar li {
float: left;
}
#desktopNavbar a {
display: block;
}
#desktopNavbar ul li a {
/*padding: 6px 10px 6px 10px;*/
color: #333;
font-weight: normal;
/* Fix by Chris */
padding: 2px 10px 6px 10px;
}
#desktopNavbar ul li a:hover {
color: #333;
/* Fix By Chris */
background-color: #fff;
}
#desktopNavbar ul li a.arrow-right, #desktopNavbar ul li a:hover.arrow-right {
background-image: url(../images/skin/arrow-right.gif);
background-repeat: no-repeat;
background-position: right 7px;
}
#desktopNavbar li ul {
padding: 2px;
border: 1px solid #3f3f3f;
background: #fff url(../images/skin/bg-dropdown.gif) repeat-y;
position: absolute;
width: 164px;
left: -999em;
z-index: 8000;
/* Fix by Chris */
margin-top: -6px;
}
#desktopNavbar li:hover ul ul,
#desktopNavbar li.ieHover ul ul,
#desktopNavbar li:hover ul ul ul,
#desktopNavbar li.ieHover ul ul ul {
left: -999em;
}
#desktopNavbar li ul ul { /* <API key> lists */
margin: -22px 0 0 163px;
}
#desktopNavbar li ul li .check {
position: absolute;
top: 8px;
left: 6px;
width: 5px;
height: 5px;
background: #555;
overflow: hidden;
line-height: 1px;
font-size: 1px;
}
#desktopNavbar li ul li a {
position: relative;
/*padding: 1px 9px 1px 25px;*/
width: 130px;
color: #3f3f3f;
font-weight: normal;
/* Fix By Chris */
padding: 1px 9px 1px 20px; /* Reduce left padding */
}
#desktopNavbar li ul li a:hover {
background: #6C98D9;
color: #fff;
-moz-border-radius: 2px;
}
#desktopNavbar li ul li a:hover .check {
background: #fff;
}
#desktopNavbar li:hover ul,
#desktopNavbar li.ieHover ul,
#desktopNavbar li li.ieHover ul,
#desktopNavbar li li li.ieHover ul,
#desktopNavbar li li:hover ul,
#desktopNavbar li li li:hover ul { /* lists nested under hovered list items */
left: auto;
}
#desktopNavbar li:hover { /* For IE7 */
position: static;
}
li.divider {
margin-top: 2px;
padding-top: 3px;
border-top: 1px solid #ebebeb;
}
#pageWrapper {
position: relative;
overflow: hidden; /* This can be set to hidden or auto */
border-top: 1px solid #909090;
border-bottom: 1px solid #909090;
/*height: 100%;*/
}
/* Footer */
#<API key> {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 30px;
overflow: hidden;
}
#desktopFooter {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
height: 24px;
padding: 6px 8px 0 8px;
background: #f2f2f2;
}
/* Columns */
.column {
position: relative;
float: left;
overflow: hidden; /* Required by IE6 */
}
/* Panels */
.panel {
position: relative;
overflow: auto;
background: #f8f8f8;
border-bottom: 1px solid #b9b9b9;
}
.panelWrapper.collapsed .panel-header {
border-bottom: 0;
}
.panelAlt {
background: #f2f2f2;
}
.bottomPanel {
border-bottom: 0;
}
.pad {
padding: 8px;
}
#mainPanel {
background: #fff;
}
.panel-header {
position: relative;
background: #f1f1f1 url(../images/skin/bg-panel-header.gif) repeat-x;
height: 30px;
overflow: hidden;
border-bottom: 1px solid #d3d3d3;
}
.panel-headerContent {
padding-top: 2px;
}
.panel-headerContent.tabs {
background: url(../images/skin/tabs.gif) repeat-x;
background-position: left -68px;
}
.panel-header h2 {
display: inline-block;
font-size: 12px;
margin: 0;
padding: 3px 8px 0 8px;
height: 22px;
overflow: hidden;
color: #333;
}
.panel-collapse {
background: url(../images/skin/collapse-expand.gif) left top no-repeat;
}
.panel-expand {
background: url(../images/skin/collapse-expand.gif) left -16px no-repeat;
}
.icon16 {
margin: 4px 0 0 2px;
cursor: pointer;
}
/* Column and Panel Handles */
.horizontalHandle {
height: 4px;
line-height: 1px;
font-size: 1px;
overflow: hidden;
background: #eee url(../images/skin/<API key>.gif) repeat-x;
}
.horizontalHandle.detached .handleIcon {
background: transparent;
}
.horizontalHandle .handleIcon {
margin: 0 auto;
height: 4px;
line-height: 1px;
font-size: 1px;
overflow: hidden;
background: url(../images/skin/<API key>.gif) center center no-repeat;
}
.columnHandle {
min-height: 10px;
float: left;
width: 4px;
overflow: hidden;
background: #c3c3c3 url(../images/skin/handle-icon.gif) center center no-repeat;
border: 1px solid #909090;
border-top: 0;
border-bottom: 0;
}
/* Toolboxes */
.toolbox {
float: right;
margin-top: 3px;
padding: 0 5px;
height: 24px;
overflow: hidden;
text-align: right;
}
.<API key> {
}
div.toolbox.divider { /* Have to specify div here for IE6's sake */
background: url(../images/skin/toolbox-divider.gif) repeat-y;
padding-left: 8px;
}
.toolbox img.disabled {
cursor: default;
}
.iconWrapper {
display: inline-block;
height: 22px;
min-width: 22px;
overflow: hidden;
border: 1px solid transparent;
}
* html .iconWrapper {
padding: 1px;
border: 0;
}
.iconWrapper img {
cursor: pointer;
margin: 0;
padding: 3px;
}
.iconWrapper:hover {
border: 1px solid #a0a0a0;
-moz-border-radius: 3px;
}
#spinnerWrapper {
width: 16px;
height: 16px;
background: url(../images/skin/spinner-placeholder.gif) no-repeat;
margin: 4px 5px 0 5px;
}
#spinner {
display: none;
background: url(../images/skin/spinner.gif) no-repeat;
width: 16px;
height: 16px;
}
|
#include <ctype.h>
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <utilstr.h>
#include <rawverse.h>
#include <versekey.h>
#include <sysdata.h>
#include <filemgr.h>
#include <swbuf.h>
<API key>
/******************************************************************************
* RawVerse Statics
*/
int RawVerse::instance = 0;
const char RawVerse::nl = '\n';
/******************************************************************************
* RawVerse Constructor - Initializes data for instance of RawVerse
*
* ENT: ipath - path of the directory where data and index files are located.
* be sure to include the trailing separator (e.g. '/' or '\')
* (e.g. 'modules/texts/rawtext/webster/')
*/
RawVerse::RawVerse(const char *ipath, int fileMode)
{
SWBuf buf;
path = 0;
stdstr(&path, ipath);
if ((path[strlen(path)-1] == '/') || (path[strlen(path)-1] == '\\'))
path[strlen(path)-1] = 0;
if (fileMode == -1) { // try read/write if possible
fileMode = FileMgr::RDWR;
}
buf.setFormatted("%s/ot.vss", path);
idxfp[0] = FileMgr::getSystemFileMgr()->open(buf, fileMode, true);
buf.setFormatted("%s/nt.vss", path);
idxfp[1] = FileMgr::getSystemFileMgr()->open(buf, fileMode, true);
buf.setFormatted("%s/ot", path);
textfp[0] = FileMgr::getSystemFileMgr()->open(buf, fileMode, true);
buf.setFormatted("%s/nt", path);
textfp[1] = FileMgr::getSystemFileMgr()->open(buf, fileMode, true);
instance++;
}
/******************************************************************************
* RawVerse Destructor - Cleans up instance of RawVerse
*/
RawVerse::~RawVerse()
{
int loop1;
if (path)
delete [] path;
--instance;
for (loop1 = 0; loop1 < 2; loop1++) {
FileMgr::getSystemFileMgr()->close(idxfp[loop1]);
FileMgr::getSystemFileMgr()->close(textfp[loop1]);
}
}
/******************************************************************************
* RawVerse::findoffset - Finds the offset of the key verse from the indexes
*
* ENT: testmt - testament to find (0 - Bible/module introduction)
* idxoff - offset into .vss
* start - address to store the starting offset
* size - address to store the size of the entry
*/
void RawVerse::findOffset(char testmt, long idxoff, long *start, unsigned short *size) const {
idxoff *= 6;
if (!testmt)
testmt = ((idxfp[1]) ? 1:2);
if (idxfp[testmt-1]->getFd() >= 0) {
idxfp[testmt-1]->seek(idxoff, SEEK_SET);
__s32 tmpStart;
__u16 tmpSize;
idxfp[testmt-1]->read(&tmpStart, 4);
long len = idxfp[testmt-1]->read(&tmpSize, 2); // read size
*start = swordtoarch32(tmpStart);
*size = swordtoarch16(tmpSize);
if (len < 2) {
*size = (unsigned short)((*start) ? (textfp[testmt-1]->seek(0, SEEK_END) - (long)*start) : 0); // if for some reason we get an error reading size, make size to end of file
}
}
else {
*start = 0;
*size = 0;
}
}
/******************************************************************************
* RawVerse::readtext - gets text at a given offset
*
* ENT: testmt - testament file to search in (0 - Old; 1 - New)
* start - starting offset where the text is located in the file
* size - size of text entry + 2 (null)(null)
* buf - buffer to store text
*
*/
void RawVerse::readText(char testmt, long start, unsigned short size, SWBuf &buf) const {
buf = "";
buf.setFillByte(0);
buf.setSize(size + 1);
if (!testmt)
testmt = ((idxfp[1]) ? 1:2);
if (size) {
if (textfp[testmt-1]->getFd() >= 0) {
textfp[testmt-1]->seek(start, SEEK_SET);
textfp[testmt-1]->read(buf.getRawData(), (int)size);
}
}
}
/******************************************************************************
* RawVerse::settext - Sets text for current offset
*
* ENT: testmt - testament to find (0 - Bible/module introduction)
* idxoff - offset into .vss
* buf - buffer to store
* len - length of buffer (0 - null terminated)
*/
void RawVerse::doSetText(char testmt, long idxoff, const char *buf, long len)
{
__s32 start;
__u16 size;
idxoff *= 6;
if (!testmt)
testmt = ((idxfp[1]) ? 1:2);
size = (len < 0) ? strlen(buf) : len;
start = (__s32)textfp[testmt-1]->seek(0, SEEK_END);
idxfp[testmt-1]->seek(idxoff, SEEK_SET);
if (size) {
textfp[testmt-1]->seek(start, SEEK_SET);
textfp[testmt-1]->write(buf, (int)size);
// add a new line to make data file easier to read in an editor
textfp[testmt-1]->write(&nl, 1);
}
else {
start = 0;
}
start = archtosword32(start);
size = archtosword16(size);
idxfp[testmt-1]->write(&start, 4);
idxfp[testmt-1]->write(&size, 2);
}
/******************************************************************************
* RawVerse::linkentry - links one entry to another
*
* ENT: testmt - testament to find (0 - Bible/module introduction)
* destidxoff - dest offset into .vss
* srcidxoff - source offset into .vss
*/
void RawVerse::doLinkEntry(char testmt, long destidxoff, long srcidxoff) {
__s32 start;
__u16 size;
destidxoff *= 6;
srcidxoff *= 6;
if (!testmt)
testmt = ((idxfp[1]) ? 1:2);
// get source
idxfp[testmt-1]->seek(srcidxoff, SEEK_SET);
idxfp[testmt-1]->read(&start, 4);
idxfp[testmt-1]->read(&size, 2);
// write dest
idxfp[testmt-1]->seek(destidxoff, SEEK_SET);
idxfp[testmt-1]->write(&start, 4);
idxfp[testmt-1]->write(&size, 2);
}
/******************************************************************************
* RawVerse::createModule - Creates new module files
*
* ENT: path - directory to store module files
* RET: error status
*/
char RawVerse::createModule(const char *ipath, const char *v11n)
{
char *path = 0;
char *buf = new char [ strlen (ipath) + 20 ];
FileDesc *fd, *fd2;
stdstr(&path, ipath);
if ((path[strlen(path)-1] == '/') || (path[strlen(path)-1] == '\\'))
path[strlen(path)-1] = 0;
sprintf(buf, "%s/ot", path);
FileMgr::removeFile(buf);
fd = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE);
fd->getFd();
FileMgr::getSystemFileMgr()->close(fd);
sprintf(buf, "%s/nt", path);
FileMgr::removeFile(buf);
fd = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE);
fd->getFd();
FileMgr::getSystemFileMgr()->close(fd);
sprintf(buf, "%s/ot.vss", path);
FileMgr::removeFile(buf);
fd = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE);
fd->getFd();
sprintf(buf, "%s/nt.vss", path);
FileMgr::removeFile(buf);
fd2 = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE);
fd2->getFd();
VerseKey vk;
vk.<API key>(v11n);
vk.setIntros(1);
__s32 offset = 0;
__u16 size = 0;
offset = archtosword32(offset);
size = archtosword16(size);
for (vk = TOP; !vk.popError(); vk++) {
if (vk.getTestament() < 2) {
fd->write(&offset, 4);
fd->write(&size, 2);
}
else {
fd2->write(&offset, 4);
fd2->write(&size, 2);
}
}
fd2->write(&offset, 4);
fd2->write(&size, 2);
FileMgr::getSystemFileMgr()->close(fd);
FileMgr::getSystemFileMgr()->close(fd2);
delete [] path;
delete [] buf;
return 0;
}
SWORD_NAMESPACE_END
|
// <API key>.h
// Breannan Smith
// Last updated: 09/16/2015
#ifndef <API key>
#define <API key>
#include "scisim/Constraints/Constraint.h"
class <API key> final : public Constraint
{
public:
// sphere_idx: index of sphere
// r: radius of sphere
// n: collision normal
// kinematic_index: index of the kinematic body
// X: center of mass of kinematic object
// V: velocity of kinematic object
// omega: angular velocity of kinematic object
<API key>( const unsigned sphere_idx, const scalar& r, const Vector3s& n, const unsigned kinematic_index, const Vector3s& X, const Vector3s& V, const Vector3s& omega );
virtual ~<API key>() override;
// Inherited from Constraint
virtual scalar evalNdotV( const VectorXs& q, const VectorXs& v ) const override;
virtual void evalgradg( const VectorXs& q, const int col, SparseMatrixsc& G, const FlowableSystem& fsys ) const override;
virtual void <API key>( const VectorXs& q, const VectorXs& t, const unsigned column, SparseMatrixsc& D ) const override;
virtual int impactStencilSize() const override;
virtual int frictionStencilSize() const override;
virtual void <API key>( std::pair<int,int>& bodies ) const override;
virtual void getBodyIndices( std::pair<int,int>& bodies ) const override;
virtual void <API key>( const VectorXs& q, const int strt_idx, VectorXs& gdotN ) const override;
virtual void evalH( const VectorXs& q, const MatrixXXsc& basis, MatrixXXsc& H0, MatrixXXsc& H1 ) const override;
virtual bool <API key>() const override;
virtual bool <API key>() const override;
virtual bool <API key>() const override;
virtual std::string name() const override;
// For binary force output
virtual void <API key>( const VectorXs& q, VectorXs& contact_point ) const override;
virtual void <API key>( const VectorXs& q, VectorXs& contact_normal ) const override;
unsigned sphereIdx() const;
private:
virtual void computeContactBasis( const VectorXs& q, const VectorXs& v, MatrixXXsc& basis ) const override;
virtual VectorXs <API key>( const VectorXs& q, const VectorXs& v ) const override;
virtual void setBodyIndex0( const unsigned idx ) override;
virtual VectorXs <API key>( const VectorXs& q, const VectorXs& v ) const override;
//Vector3s <API key>( const VectorXs& q ) const;
// Index of the colliding sphere
unsigned m_sphere_idx;
// Sphere's radius
const scalar m_r;
// Normal to prevent penetration along
const Vector3s m_n;
// Index of the kinematic body
const unsigned m_kinematic_index;
// Center of the kinematic object
const Vector3s m_X;
// Translational velocity of the kinematic object
const Vector3s m_V;
// Rotational velocity of the kinematic object
const Vector3s m_omega;
};
#endif
|
#pragma once
#ifndef <API key>
#define <API key>
#include "UpdateFieldFlags.h"
// Auto generated for version 17359
// > Object
uint32 <API key>[OBJECT_END] =
{
UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID
UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID
UF_FLAG_PUBLIC, // OBJECT_FIELD_DATA
UF_FLAG_PUBLIC, // OBJECT_FIELD_DATA
UF_FLAG_PUBLIC, // OBJECT_FIELD_TYPE
<API key>, // <API key>
<API key> | UF_FLAG_URGENT, // <API key>
UF_FLAG_PUBLIC, // OBJECT_FIELD_SCALE
};
// > Object > Item
uint32 <API key>[ITEM_END] =
{
UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID
UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID
UF_FLAG_PUBLIC, // OBJECT_FIELD_DATA
UF_FLAG_PUBLIC, // OBJECT_FIELD_DATA
UF_FLAG_PUBLIC, // OBJECT_FIELD_TYPE
<API key>, // <API key>
<API key> | UF_FLAG_URGENT, // <API key>
UF_FLAG_PUBLIC, // OBJECT_FIELD_SCALE
UF_FLAG_PUBLIC, // ITEM_FIELD_OWNER
UF_FLAG_PUBLIC, // ITEM_FIELD_OWNER
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // ITEM_FIELD_CREATOR
UF_FLAG_PUBLIC, // ITEM_FIELD_CREATOR
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_OWNER, // <API key>
UF_FLAG_OWNER, // <API key>
UF_FLAG_OWNER, // <API key>
UF_FLAG_OWNER, // <API key>
UF_FLAG_OWNER, // <API key>
UF_FLAG_OWNER, // <API key>
UF_FLAG_OWNER, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_OWNER, // <API key>
UF_FLAG_OWNER, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_OWNER, // <API key>
};
// > Object > Item > Container
uint32 <API key>[CONTAINER_END] =
{
UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID
UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID
UF_FLAG_PUBLIC, // OBJECT_FIELD_DATA
UF_FLAG_PUBLIC, // OBJECT_FIELD_DATA
UF_FLAG_PUBLIC, // OBJECT_FIELD_TYPE
<API key>, // <API key>
<API key> | UF_FLAG_URGENT, // <API key>
UF_FLAG_PUBLIC, // OBJECT_FIELD_SCALE
UF_FLAG_PUBLIC, // ITEM_FIELD_OWNER
UF_FLAG_PUBLIC, // ITEM_FIELD_OWNER
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // ITEM_FIELD_CREATOR
UF_FLAG_PUBLIC, // ITEM_FIELD_CREATOR
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_OWNER, // <API key>
UF_FLAG_OWNER, // <API key>
UF_FLAG_OWNER, // <API key>
UF_FLAG_OWNER, // <API key>
UF_FLAG_OWNER, // <API key>
UF_FLAG_OWNER, // <API key>
UF_FLAG_OWNER, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_OWNER, // <API key>
UF_FLAG_OWNER, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_OWNER, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
};
// > Object > Unit
uint32 <API key>[UNIT_END] =
{
UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID
UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID
UF_FLAG_PUBLIC, // OBJECT_FIELD_DATA
UF_FLAG_PUBLIC, // OBJECT_FIELD_DATA
UF_FLAG_PUBLIC, // OBJECT_FIELD_TYPE
UF_FLAG_PUBLIC | <API key>, // <API key>
<API key> | UF_FLAG_URGENT, // <API key>
UF_FLAG_PUBLIC, // OBJECT_FIELD_SCALE
UF_FLAG_PUBLIC, // UNIT_FIELD_CHARM
UF_FLAG_PUBLIC, // UNIT_FIELD_CHARM
UF_FLAG_PUBLIC, // UNIT_FIELD_SUMMON
UF_FLAG_PUBLIC, // UNIT_FIELD_SUMMON
UF_FLAG_PRIVATE, // UNIT_FIELD_CRITTER
UF_FLAG_PRIVATE, // UNIT_FIELD_CRITTER
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // UNIT_FIELD_TARGET
UF_FLAG_PUBLIC, // UNIT_FIELD_TARGET
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC | UF_FLAG_URGENT, // <API key>
UF_FLAG_PUBLIC | UF_FLAG_URGENT, // <API key>
UF_FLAG_PUBLIC | UF_FLAG_URGENT, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // UNIT_FIELD_SEX
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // UNIT_FIELD_HEALTH
UF_FLAG_PUBLIC, // UNIT_FIELD_POWER
UF_FLAG_PUBLIC, // UNIT_FIELD_POWER
UF_FLAG_PUBLIC, // UNIT_FIELD_POWER
UF_FLAG_PUBLIC, // UNIT_FIELD_POWER
UF_FLAG_PUBLIC, // UNIT_FIELD_POWER
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_ALL_UNITS, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_ALL_UNITS, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_ALL_UNITS, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_ALL_UNITS, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_ALL_UNITS, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_ALL_UNITS, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_ALL_UNITS, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_ALL_UNITS, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_ALL_UNITS, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_ALL_UNITS, // <API key>
UF_FLAG_PUBLIC, // UNIT_FIELD_LEVEL
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // UNIT_FIELD_FLAGS
UF_FLAG_PUBLIC, // UNIT_FIELD_FLAGS2
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
<API key> | UF_FLAG_URGENT, // <API key>
UF_FLAG_PUBLIC | UF_FLAG_URGENT, // <API key>
UF_FLAG_PUBLIC | UF_FLAG_URGENT, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_EMPATH, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_EMPATH, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_EMPATH, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_EMPATH, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_OWNER, // <API key>
UF_FLAG_OWNER, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC | <API key>, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_STATS
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_STATS
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_STATS
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_STATS
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_STATS
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_EMPATH, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_EMPATH, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_EMPATH, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_EMPATH, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_EMPATH, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_EMPATH, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_EMPATH, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
};
// > Object > Unit > Player
uint32 <API key>[PLAYER_END] =
{
UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID
UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID
UF_FLAG_PUBLIC, // OBJECT_FIELD_DATA
UF_FLAG_PUBLIC, // OBJECT_FIELD_DATA
UF_FLAG_PUBLIC, // OBJECT_FIELD_TYPE
UF_FLAG_PUBLIC | <API key>, // <API key>
<API key> | UF_FLAG_URGENT, // <API key>
UF_FLAG_PUBLIC, // OBJECT_FIELD_SCALE
UF_FLAG_PUBLIC, // UNIT_FIELD_CHARM
UF_FLAG_PUBLIC, // UNIT_FIELD_CHARM
UF_FLAG_PUBLIC, // UNIT_FIELD_SUMMON
UF_FLAG_PUBLIC, // UNIT_FIELD_SUMMON
UF_FLAG_PRIVATE, // UNIT_FIELD_CRITTER
UF_FLAG_PRIVATE, // UNIT_FIELD_CRITTER
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // UNIT_FIELD_TARGET
UF_FLAG_PUBLIC, // UNIT_FIELD_TARGET
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC | UF_FLAG_URGENT, // <API key>
UF_FLAG_PUBLIC | UF_FLAG_URGENT, // <API key>
UF_FLAG_PUBLIC | UF_FLAG_URGENT, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // UNIT_FIELD_SEX
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // UNIT_FIELD_HEALTH
UF_FLAG_PUBLIC, // UNIT_FIELD_POWER
UF_FLAG_PUBLIC, // UNIT_FIELD_POWER
UF_FLAG_PUBLIC, // UNIT_FIELD_POWER
UF_FLAG_PUBLIC, // UNIT_FIELD_POWER
UF_FLAG_PUBLIC, // UNIT_FIELD_POWER
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_ALL_UNITS, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_ALL_UNITS, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_ALL_UNITS, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_ALL_UNITS, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_ALL_UNITS, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_ALL_UNITS, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_ALL_UNITS, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_ALL_UNITS, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_ALL_UNITS, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_ALL_UNITS, // <API key>
UF_FLAG_PUBLIC, // UNIT_FIELD_LEVEL
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // UNIT_FIELD_FLAGS
UF_FLAG_PUBLIC, // UNIT_FIELD_FLAGS2
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
<API key> | UF_FLAG_URGENT, // <API key>
UF_FLAG_PUBLIC | UF_FLAG_URGENT, // <API key>
UF_FLAG_PUBLIC | UF_FLAG_URGENT, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_EMPATH, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_EMPATH, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_EMPATH, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_EMPATH, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_OWNER, // <API key>
UF_FLAG_OWNER, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC | <API key>, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_STATS
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_STATS
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_STATS
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_STATS
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_STATS
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_EMPATH, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_EMPATH, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_EMPATH, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_EMPATH, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_EMPATH, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_EMPATH, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_EMPATH, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PRIVATE | UF_FLAG_OWNER, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
<API key>, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // PLAYER_FIELD_XP
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // PLAYER_FIELD_SKILL
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPHS
UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPHS
UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPHS
UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPHS
UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPHS
UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPHS
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE | <API key>, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE, // <API key>
UF_FLAG_PRIVATE | <API key>, // <API key>
UF_FLAG_PRIVATE, // <API key>
};
// > Object > GameObject
uint32 <API key>[GAMEOBJECT_END] =
{
UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID
UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID
UF_FLAG_PUBLIC, // OBJECT_FIELD_DATA
UF_FLAG_PUBLIC, // OBJECT_FIELD_DATA
UF_FLAG_PUBLIC, // OBJECT_FIELD_TYPE
<API key>, // <API key>
<API key> | UF_FLAG_URGENT, // <API key>
UF_FLAG_PUBLIC, // OBJECT_FIELD_SCALE
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC | UF_FLAG_URGENT, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC | UF_FLAG_URGENT, // <API key>
UF_FLAG_PUBLIC | UF_FLAG_URGENT, // <API key>
};
// > Object > DynamicObject
uint32 <API key>[DYNAMICOBJECT_END] =
{
UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID
UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID
UF_FLAG_PUBLIC, // OBJECT_FIELD_DATA
UF_FLAG_PUBLIC, // OBJECT_FIELD_DATA
UF_FLAG_PUBLIC, // OBJECT_FIELD_TYPE
<API key>, // <API key>
<API key> | UF_FLAG_URGENT, // <API key>
UF_FLAG_PUBLIC, // OBJECT_FIELD_SCALE
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
<API key>, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
};
// > Object > Corpse
uint32 <API key>[CORPSE_END] =
{
UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID
UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID
UF_FLAG_PUBLIC, // OBJECT_FIELD_DATA
UF_FLAG_PUBLIC, // OBJECT_FIELD_DATA
UF_FLAG_PUBLIC, // OBJECT_FIELD_TYPE
<API key>, // <API key>
<API key> | UF_FLAG_URGENT, // <API key>
UF_FLAG_PUBLIC, // OBJECT_FIELD_SCALE
UF_FLAG_PUBLIC, // CORPSE_FIELD_OWNER
UF_FLAG_PUBLIC, // CORPSE_FIELD_OWNER
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEMS
UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEMS
UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEMS
UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEMS
UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEMS
UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEMS
UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEMS
UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEMS
UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEMS
UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEMS
UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEMS
UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEMS
UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEMS
UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEMS
UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEMS
UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEMS
UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEMS
UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEMS
UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEMS
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // CORPSE_FIELD_FLAGS
<API key>, // <API key>
};
// > Object > AreaTrigger
uint32 <API key>[AREATRIGGER_END] =
{
UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID
UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID
UF_FLAG_PUBLIC, // OBJECT_FIELD_DATA
UF_FLAG_PUBLIC, // OBJECT_FIELD_DATA
UF_FLAG_PUBLIC, // OBJECT_FIELD_TYPE
<API key>, // <API key>
<API key> | UF_FLAG_URGENT, // <API key>
UF_FLAG_PUBLIC, // OBJECT_FIELD_SCALE
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
<API key>, // <API key>
UF_FLAG_PUBLIC | UF_FLAG_URGENT, // <API key>
};
// > Object > SceneObject
uint32 <API key>[SCENE_END] =
{
UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID
UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID
UF_FLAG_PUBLIC, // OBJECT_FIELD_DATA
UF_FLAG_PUBLIC, // OBJECT_FIELD_DATA
UF_FLAG_PUBLIC, // OBJECT_FIELD_TYPE
<API key>, // <API key>
<API key> | UF_FLAG_URGENT, // <API key>
UF_FLAG_PUBLIC, // OBJECT_FIELD_SCALE
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
UF_FLAG_PUBLIC, // <API key>
};
#endif
|
package gitmad.bitter.ui;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import gitmad.bitter.R;
import gitmad.bitter.model.Comment;
import gitmad.bitter.model.User;
import java.util.Map;
public class CommentAdapter extends ArrayAdapter<Comment> {
private Comment[] comments;
private Map<Comment, User> commentAuthors;
public CommentAdapter(Context context, Comment[] comments, Map<Comment,
User> commentAuthors) {
super(context, 0, comments); // TODO is the zero here correct?
this.comments = comments;
this.commentAuthors = commentAuthors;
}
public View getView(int position, View convertView, ViewGroup parent) {
Comment comment = comments[position];
if (convertView == null) {
convertView = LayoutInflater.from(getContext()).inflate(R.layout
.view_comment, parent, false);
}
TextView userText = (TextView) convertView.findViewById(R.id.user_text);
TextView commentText = (TextView) convertView.findViewById(R.id
.comment_text);
userText.setText(commentAuthors.get(comment).getName());
commentText.setText(comment.getText());
return convertView;
}
}
|
#!/bin/sh
# <API key>: LGPL-2.1-or-later
set -eu
cd "$MESON_SOURCE_ROOT"
if [ ! -f .git/hooks/pre-commit.sample -o -f .git/hooks/pre-commit ]; then
exit 2 # not needed
fi
cp -p .git/hooks/pre-commit.sample .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
echo 'Activated pre-commit hook'
|
cmd_fs/jbd/checkpoint.o := /opt/buildroot-gcc342/bin/<API key> -Wp,-MD,fs/jbd/.checkpoint.o.d -nostdinc -isystem /root/asuswrt-bender/tools/brcm/K26/<API key>.2.4/bin/../lib/gcc/mipsel-linux-uclibc/4.2.4/include -D__KERNEL__ -Iinclude -include include/linux/autoconf.h -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -O2 -mabi=32 -G 0 -mno-abicalls -fno-pic -pipe -msoft-float -ffreestanding -march=mips32r2 -Wa,-mips32r2 -Wa,--trap -Iinclude/asm-mips/rt2880 -Iinclude/asm-mips/mach-generic -fomit-frame-pointer -gdwarf-2 -fno-stack-protector -membedded-data -<API key> -funit-at-a-time -<API key> -Wno-pointer-sign -DMODULE -mlong-calls -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(checkpoint)" -D"KBUILD_MODNAME=KBUILD_STR(jbd)" -c -o fs/jbd/checkpoint.o fs/jbd/checkpoint.c
deps_fs/jbd/checkpoint.o := \
fs/jbd/checkpoint.c \
include/linux/time.h \
include/linux/types.h \
$(wildcard include/config/uid16.h) \
$(wildcard include/config/lbd.h) \
$(wildcard include/config/lsf.h) \
$(wildcard include/config/resources/64bit.h) \
include/linux/posix_types.h \
include/linux/stddef.h \
include/linux/compiler.h \
$(wildcard include/config/enable/must/check.h) \
include/linux/compiler-gcc4.h \
$(wildcard include/config/forced/inlining.h) \
include/linux/compiler-gcc.h \
include/asm/posix_types.h \
include/asm/sgidefs.h \
include/asm/types.h \
$(wildcard include/config/highmem.h) \
$(wildcard include/config/64bit/phys/addr.h) \
$(wildcard include/config/64bit.h) \
include/linux/seqlock.h \
include/linux/spinlock.h \
$(wildcard include/config/smp.h) \
$(wildcard include/config/debug/spinlock.h) \
$(wildcard include/config/preempt.h) \
$(wildcard include/config/debug/lock/alloc.h) \
include/linux/preempt.h \
$(wildcard include/config/debug/preempt.h) \
include/linux/thread_info.h \
include/linux/bitops.h \
include/asm/bitops.h \
$(wildcard include/config/cpu/mipsr2.h) \
$(wildcard include/config/cpu/mips32.h) \
$(wildcard include/config/cpu/mips64.h) \
include/linux/irqflags.h \
$(wildcard include/config/trace/irqflags.h) \
$(wildcard include/config/trace/irqflags/support.h) \
$(wildcard include/config/x86.h) \
include/asm/irqflags.h \
$(wildcard include/config/mips/mt/smtc.h) \
$(wildcard include/config/irq/cpu.h) \
$(wildcard include/config/mips/mt/smtc/instant/replay.h) \
include/asm/hazards.h \
$(wildcard include/config/cpu/r10000.h) \
$(wildcard include/config/cpu/rm9000.h) \
$(wildcard include/config/cpu/sb1.h) \
include/asm/barrier.h \
$(wildcard include/config/cpu/has/sync.h) \
$(wildcard include/config/cpu/has/wb.h) \
$(wildcard include/config/weak/ordering.h) \
include/asm/bug.h \
$(wildcard include/config/bug.h) \
include/asm/break.h \
include/asm-generic/bug.h \
$(wildcard include/config/generic/bug.h) \
$(wildcard include/config/debug/bugverbose.h) \
include/asm/byteorder.h \
$(wildcard include/config/cpu/mips64/r2.h) \
include/linux/byteorder/little_endian.h \
include/linux/byteorder/swab.h \
include/linux/byteorder/generic.h \
include/asm/cpu-features.h \
$(wildcard include/config/32bit.h) \
$(wildcard include/config/cpu/mipsr2/irq/vi.h) \
$(wildcard include/config/cpu/mipsr2/irq/ei.h) \
include/asm/cpu.h \
include/asm/cpu-info.h \
$(wildcard include/config/sgi/ip27.h) \
$(wildcard include/config/mips/mt.h) \
include/asm/cache.h \
$(wildcard include/config/mips/l1/cache/shift.h) \
include/asm-mips/mach-generic/kmalloc.h \
$(wildcard include/config/dma/coherent.h) \
include/asm-mips/mach-generic/<API key>.h \
include/asm/war.h \
$(wildcard include/config/sgi/ip22.h) \
$(wildcard include/config/sni/rm.h) \
$(wildcard include/config/cpu/r5432.h) \
$(wildcard include/config/sb1/pass/1/workarounds.h) \
$(wildcard include/config/sb1/pass/2/workarounds.h) \
$(wildcard include/config/mips/malta.h) \
$(wildcard include/config/mips/atlas.h) \
$(wildcard include/config/mips/sead.h) \
$(wildcard include/config/cpu/tx49xx.h) \
$(wildcard include/config/momenco/jaguar/atx.h) \
$(wildcard include/config/pmc/yosemite.h) \
$(wildcard include/config/basler/excite.h) \
$(wildcard include/config/momenco/ocelot/3.h) \
include/asm-generic/bitops/non-atomic.h \
include/asm-generic/bitops/fls64.h \
include/asm-generic/bitops/ffz.h \
include/asm-generic/bitops/find.h \
include/asm-generic/bitops/sched.h \
include/asm-generic/bitops/hweight.h \
include/asm-generic/bitops/ext2-non-atomic.h \
include/asm-generic/bitops/le.h \
include/asm-generic/bitops/ext2-atomic.h \
include/asm-generic/bitops/minix.h \
include/asm/thread_info.h \
$(wildcard include/config/page/size/4kb.h) \
$(wildcard include/config/page/size/8kb.h) \
$(wildcard include/config/page/size/16kb.h) \
$(wildcard include/config/page/size/64kb.h) \
$(wildcard include/config/debug/stack/usage.h) \
include/asm/processor.h \
$(wildcard include/config/mips/mt/fpaff.h) \
$(wildcard include/config/cpu/has/prefetch.h) \
include/linux/cpumask.h \
$(wildcard include/config/hotplug/cpu.h) \
include/linux/kernel.h \
$(wildcard include/config/preempt/voluntary.h) \
$(wildcard include/config/debug/spinlock/sleep.h) \
$(wildcard include/config/printk.h) \
$(wildcard include/config/numa.h) \
/root/asuswrt-bender/tools/brcm/K26/<API key>.2.4/bin/../lib/gcc/mipsel-linux-uclibc/4.2.4/include/stdarg.h \
include/linux/linkage.h \
include/asm/linkage.h \
include/linux/log2.h \
$(wildcard include/config/arch/has/ilog2/u32.h) \
$(wildcard include/config/arch/has/ilog2/u64.h) \
include/linux/threads.h \
$(wildcard include/config/nr/cpus.h) \
$(wildcard include/config/base/small.h) \
include/linux/bitmap.h \
include/linux/string.h \
include/asm/string.h \
$(wildcard include/config/cpu/r3000.h) \
include/asm/cachectl.h \
include/asm/mipsregs.h \
$(wildcard include/config/cpu/vr41xx.h) \
include/asm/prefetch.h \
include/asm/system.h \
include/asm/addrspace.h \
$(wildcard include/config/cpu/r4300.h) \
$(wildcard include/config/cpu/r4x00.h) \
$(wildcard include/config/cpu/r5000.h) \
$(wildcard include/config/cpu/rm7000.h) \
$(wildcard include/config/cpu/nevada.h) \
$(wildcard include/config/cpu/r8000.h) \
$(wildcard include/config/cpu/sb1a.h) \
include/asm-mips/mach-generic/spaces.h \
$(wildcard include/config/dma/noncoherent.h) \
include/asm/dsp.h \
include/linux/stringify.h \
include/linux/bottom_half.h \
include/linux/spinlock_types.h \
include/linux/lockdep.h \
$(wildcard include/config/lockdep.h) \
$(wildcard include/config/generic/hardirqs.h) \
$(wildcard include/config/prove/locking.h) \
include/linux/spinlock_types_up.h \
include/linux/spinlock_up.h \
include/linux/spinlock_api_up.h \
include/asm/atomic.h \
include/asm-generic/atomic.h \
include/linux/fs.h \
$(wildcard include/config/dnotify.h) \
$(wildcard include/config/sysfs.h) \
$(wildcard include/config/quota.h) \
$(wildcard include/config/inotify.h) \
$(wildcard include/config/security.h) \
$(wildcard include/config/epoll.h) \
$(wildcard include/config/auditsyscall.h) \
$(wildcard include/config/block.h) \
$(wildcard include/config/fs/xip.h) \
$(wildcard include/config/migration.h) \
include/linux/limits.h \
include/linux/ioctl.h \
include/asm/ioctl.h \
include/linux/wait.h \
include/linux/list.h \
$(wildcard include/config/debug/list.h) \
include/linux/poison.h \
include/linux/prefetch.h \
include/asm/current.h \
include/linux/kdev_t.h \
include/linux/dcache.h \
$(wildcard include/config/profiling.h) \
include/linux/cache.h \
$(wildcard include/config/arch/has/cache/line/size.h) \
include/linux/rcupdate.h \
include/linux/percpu.h \
include/linux/slab.h \
$(wildcard include/config/slab/debug.h) \
$(wildcard include/config/slub.h) \
$(wildcard include/config/slob.h) \
$(wildcard include/config/debug/slab.h) \
include/linux/gfp.h \
$(wildcard include/config/zone/dma.h) \
$(wildcard include/config/zone/dma32.h) \
include/linux/mmzone.h \
$(wildcard include/config/force/max/zoneorder.h) \
$(wildcard include/config/memory/hotplug.h) \
$(wildcard include/config/arch/populates/node/map.h) \
$(wildcard include/config/discontigmem.h) \
$(wildcard include/config/flat/node/mem/map.h) \
$(wildcard include/config/have/memory/present.h) \
$(wildcard include/config/need/node/memmap/size.h) \
$(wildcard include/config/need/multiple/nodes.h) \
$(wildcard include/config/sparsemem.h) \
$(wildcard include/config/have/arch/early/pfn/to/nid.h) \
$(wildcard include/config/flatmem.h) \
$(wildcard include/config/sparsemem/extreme.h) \
$(wildcard include/config/nodes/span/other/nodes.h) \
$(wildcard include/config/holes/in/zone.h) \
include/linux/numa.h \
$(wildcard include/config/nodes/shift.h) \
include/linux/init.h \
$(wildcard include/config/modules.h) \
$(wildcard include/config/hotplug.h) \
$(wildcard include/config/acpi/hotplug/memory.h) \
include/linux/nodemask.h \
include/asm/page.h \
$(wildcard include/config/build/elf64.h) \
$(wildcard include/config/limited/dma.h) \
include/linux/pfn.h \
include/asm/io.h \
include/asm-generic/iomap.h \
include/asm/pgtable-bits.h \
$(wildcard include/config/cpu/mips32/r1.h) \
$(wildcard include/config/cpu/tx39xx.h) \
$(wildcard include/config/mips/uncached.h) \
include/asm-mips/mach-generic/ioremap.h \
include/asm-mips/mach-generic/mangle-port.h \
$(wildcard include/config/swap/io/space.h) \
include/asm-generic/memory_model.h \
$(wildcard include/config/out/of/line/pfn/to/page.h) \
include/asm-generic/page.h \
include/linux/memory_hotplug.h \
$(wildcard include/config/have/arch/nodedata/extension.h) \
include/linux/notifier.h \
include/linux/errno.h \
include/asm/errno.h \
include/asm-generic/errno-base.h \
include/linux/mutex.h \
$(wildcard include/config/debug/mutexes.h) \
include/linux/rwsem.h \
$(wildcard include/config/rwsem/generic/spinlock.h) \
include/linux/rwsem-spinlock.h \
include/linux/srcu.h \
include/linux/topology.h \
$(wildcard include/config/sched/smt.h) \
$(wildcard include/config/sched/mc.h) \
include/linux/smp.h \
include/asm/topology.h \
include/asm-mips/mach-generic/topology.h \
include/asm-generic/topology.h \
include/linux/slub_def.h \
include/linux/workqueue.h \
include/linux/timer.h \
$(wildcard include/config/timer/stats.h) \
include/linux/ktime.h \
$(wildcard include/config/ktime/scalar.h) \
include/linux/jiffies.h \
include/linux/calc64.h \
include/asm/div64.h \
include/asm-generic/div64.h \
include/linux/timex.h \
$(wildcard include/config/time/interpolation.h) \
$(wildcard include/config/no/hz.h) \
include/asm/param.h \
$(wildcard include/config/hz.h) \
include/asm/timex.h \
include/asm-mips/mach-generic/timex.h \
include/linux/kobject.h \
include/linux/sysfs.h \
include/linux/kref.h \
include/asm/percpu.h \
include/asm-generic/percpu.h \
include/linux/namei.h \
include/linux/stat.h \
include/asm/stat.h \
include/linux/radix-tree.h \
include/linux/prio_tree.h \
include/linux/pid.h \
include/asm/semaphore.h \
include/linux/quota.h \
include/linux/dqblk_xfs.h \
include/linux/dqblk_v1.h \
include/linux/dqblk_v2.h \
include/linux/nfs_fs_i.h \
include/linux/nfs.h \
include/linux/sunrpc/msg_prot.h \
include/linux/fcntl.h \
include/asm/fcntl.h \
include/asm-generic/fcntl.h \
include/linux/err.h \
include/linux/jbd.h \
$(wildcard include/config/jbd/debug.h) \
$(wildcard include/config/buffer/debug.h) \
include/linux/buffer_head.h \
include/linux/pagemap.h \
include/linux/mm.h \
$(wildcard include/config/sysctl.h) \
$(wildcard include/config/mmu.h) \
$(wildcard include/config/stack/growsup.h) \
$(wildcard include/config/debug/vm.h) \
$(wildcard include/config/shmem.h) \
$(wildcard include/config/split/ptlock/cpus.h) \
$(wildcard include/config/ia64.h) \
$(wildcard include/config/proc/fs.h) \
$(wildcard include/config/debug/pagealloc.h) \
include/linux/capability.h \
include/linux/rbtree.h \
include/linux/debug_locks.h \
$(wildcard include/config/debug/locking/api/selftests.h) \
include/linux/backing-dev.h \
include/linux/mm_types.h \
include/asm/pgtable.h \
include/asm/pgtable-32.h \
include/asm/fixmap.h \
include/asm-generic/pgtable-nopmd.h \
include/asm-generic/pgtable-nopud.h \
include/asm-generic/pgtable.h \
include/linux/page-flags.h \
$(wildcard include/config/s390.h) \
$(wildcard include/config/swap.h) \
include/linux/vmstat.h \
$(wildcard include/config/vm/event/counters.h) \
include/linux/highmem.h \
include/linux/uaccess.h \
include/asm/uaccess.h \
include/asm-generic/uaccess.h \
include/asm/cacheflush.h \
include/asm/kmap_types.h \
$(wildcard include/config/debug/highmem.h) \
include/linux/journal-head.h \
include/linux/bit_spinlock.h \
include/linux/sched.h \
$(wildcard include/config/detect/softlockup.h) \
$(wildcard include/config/keys.h) \
$(wildcard include/config/bsd/process/acct.h) \
$(wildcard include/config/taskstats.h) \
$(wildcard include/config/inotify/user.h) \
$(wildcard include/config/schedstats.h) \
$(wildcard include/config/task/delay/acct.h) \
$(wildcard include/config/blk/dev/io/trace.h) \
$(wildcard include/config/cc/stackprotector.h) \
$(wildcard include/config/sysvipc.h) \
$(wildcard include/config/rt/mutexes.h) \
$(wildcard include/config/task/xacct.h) \
$(wildcard include/config/cpusets.h) \
$(wildcard include/config/compat.h) \
$(wildcard include/config/fault/injection.h) \
include/linux/auxvec.h \
include/asm/auxvec.h \
include/asm/ptrace.h \
$(wildcard include/config/cpu/has/smartmips.h) \
include/asm/isadep.h \
include/asm/mmu.h \
include/asm/cputime.h \
include/asm-generic/cputime.h \
include/linux/sem.h \
include/linux/ipc.h \
$(wildcard include/config/ipc/ns.h) \
include/asm/ipcbuf.h \
include/asm/sembuf.h \
include/linux/signal.h \
include/asm/signal.h \
$(wildcard include/config/trad/signals.h) \
$(wildcard include/config/binfmt/irix.h) \
include/asm-generic/signal.h \
include/asm/sigcontext.h \
include/asm/siginfo.h \
include/asm-generic/siginfo.h \
include/linux/securebits.h \
include/linux/fs_struct.h \
include/linux/completion.h \
include/linux/seccomp.h \
$(wildcard include/config/seccomp.h) \
include/linux/futex.h \
$(wildcard include/config/futex.h) \
include/linux/rtmutex.h \
$(wildcard include/config/debug/rt/mutexes.h) \
include/linux/plist.h \
$(wildcard include/config/debug/pi/list.h) \
include/linux/param.h \
include/linux/resource.h \
include/asm/resource.h \
include/asm-generic/resource.h \
include/linux/hrtimer.h \
$(wildcard include/config/high/res/timers.h) \
include/linux/task_io_accounting.h \
$(wildcard include/config/task/io/accounting.h) \
include/linux/aio.h \
include/linux/aio_abi.h \
include/linux/uio.h \
fs/jbd/checkpoint.o: $(deps_fs/jbd/checkpoint.o)
$(deps_fs/jbd/checkpoint.o):
|
package com.frinika.tootX.midi;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.sound.midi.<API key>;
import javax.sound.midi.ShortMessage;
public class MidiHashUtil {
static public long hashValue(ShortMessage mess) {
byte data[] = mess.getMessage();
long cmd = mess.getCommand();
if (cmd == ShortMessage.PITCH_BEND) {
return ((long) data[0] << 8);
} else {
return (((long) data[0] << 8) + data[1]);
}
}
static public void hashDisp(long hash) {
long cntrl = hash & 0xFF;
long cmd = (hash >> 8) & 0xFF;
long chn = (hash >> 16) & 0xFF;
System.out.println(chn + " " + cmd + " " + cntrl);
}
static ShortMessage <API key>(long hash, ShortMessage mess) {
if (mess == null) mess=new ShortMessage();
int status = (int) ((hash >> 8) & 0xFF);
int data1 = (int) (hash & 0xFF);
try {
mess.setMessage(status, data1, 0);
} catch (<API key> ex) {
Logger.getLogger(MidiHashUtil.class.getName()).log(Level.SEVERE, null, ex);
}
return mess;
}
}
|
/**
* SECTION:huey-enum
* @short_description: Types used by huey and libhuey
*
* These helper functions provide a way to marshal enumerated values to
* text and back again.
*
* See also: #CdClient, #CdDevice
*/
#include "config.h"
#include <glib.h>
#include "huey-enum.h"
/**
* huey_rc_to_string:
*
* Since: 0.1.29
**/
const gchar *
huey_rc_to_string (guchar value)
{
if (value == HUEY_RC_SUCCESS)
return "success";
if (value == HUEY_RC_LOCKED)
return "locked";
if (value == HUEY_RC_ERROR)
return "error";
if (value == HUEY_RC_RETRY)
return "retry";
if (value == HUEY_RC_UNKNOWN_5A)
return "unknown5a";
if (value == HUEY_RC_UNKNOWN_81)
return "unknown81";
return NULL;
}
/**
* <API key>:
*
* Since: 0.1.29
**/
const gchar *
<API key> (guchar value)
{
if (value == HUEY_CMD_GET_STATUS)
return "get-status";
if (value == HUEY_CMD_READ_GREEN)
return "read-green";
if (value == HUEY_CMD_READ_BLUE)
return "read-blue";
if (value == <API key>)
return "<API key>";
if (value == <API key>)
return "<API key>";
if (value == <API key>)
return "reg-write";
if (value == <API key>)
return "reg-read";
if (value == HUEY_CMD_UNLOCK)
return "unlock";
if (value == HUEY_CMD_UNKNOWN_0F)
return "unknown0f";
if (value == HUEY_CMD_UNKNOWN_10)
return "unknown10";
if (value == HUEY_CMD_UNKNOWN_11)
return "unknown11";
if (value == HUEY_CMD_UNKNOWN_12)
return "unknown12";
if (value == <API key>)
return "measure-rgb-crt";
if (value == HUEY_CMD_UNKNOWN_15)
return "unknown15(status?)";
if (value == <API key>)
return "measure-rgb";
if (value == HUEY_CMD_UNKNOWN_21)
return "unknown21";
if (value == <API key>)
return "get-ambient";
if (value == HUEY_CMD_SET_LEDS)
return "set-leds";
if (value == <API key>)
return "measure-rgb-alt";
return NULL;
}
|
#include <iostream>
#include "common.h"
using namespace storage;
using namespace std;
StorageInterface* s = NULL;
void
test(const string& device)
{
ResizeInfo resize_info;
ContentInfo content_info;
if (s->getFreeInfo(device, true, resize_info, true, content_info, true))
{
cout << device << " true" << endl;
cout << " " << resize_info.resize_freeK << " " << resize_info.df_freeK << " "
<< resize_info.usedK << " " << resize_info.resize_ok << endl;
cout << " " << content_info.windows << " " << content_info.efi << " "
<< content_info.homes << endl;
}
else
{
cout << device << " false" << endl;
}
}
int
main()
{
cout.setf(std::ios::boolalpha);
setup_logger();
setup_system("thalassa");
s = <API key>(TestEnvironment());
test("/dev/system/arvin");
test("/dev/system/root");
delete s;
}
|
#include <iostream>
using namespace std;
long long n, ans = 0;
long long dn[500][500];
long long rec(long long prlvl, long long sum)
{
if (sum < 0) return 0;
else if (sum == 0) return 1;
else
{
if (dn[prlvl][sum] != -1)
return dn[prlvl][sum];
else
{
long long res = 0;
for (int i = 1; i<prlvl; i++)
res += rec(i, sum - i);
return dn[prlvl][sum] = res;
}
}
}
void memorySet()
{
for (int i = 0; i<500; i++)
for (int j = 0; j<500; j++) dn[i][j] = -1;
}
int main()
{
memorySet();
cin >> n;
for (int i = 1; i<n; i++)
ans += rec(i, n - i);
cout << ans << endl;
}
|
# OpenStack ocata installation script on Ubuntu 16.04.2
# by kasidit chanchio
# vasabilab, dept of computer science,
# Thammasat University, Thailand
# Run this with sudo or as root
#!/bin/bash -x
cd $HOME/OPSInstaller/controller
pwd
echo "check chrony"
chronyc sources
sleep 1
#apt-get -y install debconf-utils
#<API key> <<< 'mariadb-server-5.5 mysql-server/root_password password mysqlpassword'
#<API key> <<< 'mariadb-server-5.5 mysql-server/root_password_again password mysqlpassword'
apt-get -y install mariadb-server
apt-get -y install python-pymysql
printf "* set openstack.cnf configuration... press any key\n"
sleep 2
#read varkey
#cp files/openstack.cnf /etc/mysql/conf.d/openstack.cnf
cp files/99-openstack.cnf /etc/mysql/mariadb.conf.d/99-openstack.cnf
#printf "* restart mysql & delete anonymous acct... press\n"
#read varkey
service mysql restart
printf "\n *** First, enter blank for mysql password. Then set new password to\n mysqlpassword \n*** \n"
sleep 2
<API key>
#mysql -u root -pmysqlpassword -e "UPDATE mysql.user SET Password=PASSWORD('mysqlpassword') WHERE User='root';"
#mysql -u root -pmysqlpassword -e "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
#mysql -u root -pmysqlpassword -e "DELETE FROM mysql.user WHERE User='';"
#mysql -u root -pmysqlpassword -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%';"
#mysql -u root -pmysqlpassword -e "FLUSH PRIVILEGES;"
#exit 0
#printf "* install nosql... press any key\n"
#read varkey
#apt-get -y install mongodb-server mongodb-clients python-pymongo
#cp files/mongodb.conf /etc/mongodb.conf
#service mongodb stop
#rm /var/lib/mongodb/journal/prealloc.*
#service mongodb start
|
#!/bin/sh
test_description='Binary diff and apply
'
. ./test-lib.sh
test_expect_success 'prepare repository' \
'echo AIT >a && echo BIT >b && echo CIT >c && echo DIT >d &&
git update-index --add a b c d &&
echo git >a &&
cat "$TEST_DIRECTORY"/test4012.png >b &&
echo git >c &&
cat b b >d'
cat > expected <<\EOF
a | 2 +-
b | Bin
c | 2 +-
d | Bin
4 files changed, 2 insertions(+), 2 deletions(-)
EOF
test_expect_success 'diff without --binary' \
'git diff | git apply --stat --summary >current &&
test_cmp expected current'
test_expect_success 'diff with --binary' \
'git diff --binary | git apply --stat --summary >current &&
test_cmp expected current'
# apply needs to be able to skip the binary material correctly
# in order to report the line number of a corrupt patch.
test_expect_success 'apply detecting corrupt patch correctly' \
'git diff | sed -e 's/-CIT/xCIT/' >broken &&
if git apply --stat --summary broken 2>detected
then
echo unhappy - should have detected an error
(exit 1)
else
echo happy
fi &&
detected=`cat detected` &&
detected=`expr "$detected" : "fatal.*at line \\([0-9]*\\)\$"` &&
detected=`sed -ne "${detected}p" broken` &&
test "$detected" = xCIT'
test_expect_success 'apply detecting corrupt patch correctly' \
'git diff --binary | sed -e 's/-CIT/xCIT/' >broken &&
if git apply --stat --summary broken 2>detected
then
echo unhappy - should have detected an error
(exit 1)
else
echo happy
fi &&
detected=`cat detected` &&
detected=`expr "$detected" : "fatal.*at line \\([0-9]*\\)\$"` &&
detected=`sed -ne "${detected}p" broken` &&
test "$detected" = xCIT'
test_expect_success 'initial commit' 'git commit -a -m initial'
# Try removal (b), modification (d), and creation (e).
test_expect_success 'diff-index with --binary' \
'echo AIT >a && mv b e && echo CIT >c && cat e >d &&
git update-index --add --remove a b c d e &&
tree0=`git write-tree` &&
git diff --cached --binary >current &&
git apply --stat --summary current'
test_expect_success 'apply binary patch' \
'git reset --hard &&
git apply --binary --index <current &&
tree1=`git write-tree` &&
test "$tree1" = "$tree0"'
q_to_nul() {
perl -pe 'y/Q/\000/'
}
nul_to_q() {
perl -pe 'y/\000/Q/'
}
test_expect_success 'diff --no-index with binary creation' '
echo Q | q_to_nul >binary &&
(:# hide error code from diff, which just indicates differences
git diff --binary --no-index /dev/null binary >current ||
true
) &&
rm binary &&
git apply --binary <current &&
echo Q >expected &&
nul_to_q <binary >actual &&
test_cmp expected actual
'
test_done
|
/* this file is part of ehci-hcd.c */
/*
* EHCI Root Hub ... the nonsharable stuff
*
* Registers don't need cpu_to_le32, that happens transparently
*/
#ifdef CONFIG_ARCH_MXS
#define MXS_USB_HOST_HACK
#include <linux/fsl_devices.h>
#endif
#define PORT_WAKE_BITS (PORT_WKOC_E|PORT_WKDISC_E|PORT_WKCONN_E)
#ifdef CONFIG_PM
static int ehci_hub_control(
struct usb_hcd *hcd,
u16 typeReq,
u16 wValue,
u16 wIndex,
char *buf,
u16 wLength
);
/* After a power loss, ports that were owned by the companion must be
* reset so that the companion can still own them.
*/
static void <API key>(struct ehci_hcd *ehci)
{
u32 __iomem *reg;
u32 status;
int port;
__le32 buf;
struct usb_hcd *hcd = ehci_to_hcd(ehci);
if (!ehci->owned_ports)
return;
/* Give the connections some time to appear */
msleep(20);
port = HCS_N_PORTS(ehci->hcs_params);
while (port
if (test_bit(port, &ehci->owned_ports)) {
reg = &ehci->regs->port_status[port];
status = ehci_readl(ehci, reg) & ~PORT_RWC_BITS;
/* Port already owned by companion? */
if (status & PORT_OWNER)
clear_bit(port, &ehci->owned_ports);
else if (test_bit(port, &ehci->companion_ports))
ehci_writel(ehci, status & ~PORT_PE, reg);
else
ehci_hub_control(hcd, SetPortFeature,
USB_PORT_FEAT_RESET, port + 1,
NULL, 0);
}
}
if (!ehci->owned_ports)
return;
msleep(90); /* Wait for resets to complete */
port = HCS_N_PORTS(ehci->hcs_params);
while (port
if (test_bit(port, &ehci->owned_ports)) {
ehci_hub_control(hcd, GetPortStatus,
0, port + 1,
(char *) &buf, sizeof(buf));
/* The companion should now own the port,
* but if something went wrong the port must not
* remain enabled.
*/
reg = &ehci->regs->port_status[port];
status = ehci_readl(ehci, reg) & ~PORT_RWC_BITS;
if (status & PORT_OWNER)
ehci_writel(ehci, status | PORT_CSC, reg);
else {
ehci_dbg(ehci, "failed handover port %d: %x\n",
port + 1, status);
ehci_writel(ehci, status & ~PORT_PE, reg);
}
}
}
ehci->owned_ports = 0;
}
static void <API key>(struct ehci_hcd *ehci,
bool suspending)
{
int port;
u32 temp;
/* If remote wakeup is enabled for the root hub but disabled
* for the controller, we must adjust all the port wakeup flags
* when the controller is suspended or resumed. In all other
* cases they don't need to be changed.
*/
if (!ehci_to_hcd(ehci)->self.root_hub->do_remote_wakeup ||
device_may_wakeup(ehci_to_hcd(ehci)->self.controller))
return;
/* clear phy low-power mode before changing wakeup flags */
if (ehci->has_hostpc) {
port = HCS_N_PORTS(ehci->hcs_params);
while (port
u32 __iomem *hostpc_reg;
hostpc_reg = (u32 __iomem *)((u8 *) ehci->regs
+ HOSTPC0 + 4 * port);
temp = ehci_readl(ehci, hostpc_reg);
ehci_writel(ehci, temp & ~HOSTPC_PHCD, hostpc_reg);
}
msleep(5);
}
port = HCS_N_PORTS(ehci->hcs_params);
while (port
u32 __iomem *reg = &ehci->regs->port_status[port];
u32 t1 = ehci_readl(ehci, reg) & ~PORT_RWC_BITS;
u32 t2 = t1 & ~PORT_WAKE_BITS;
/* If we are suspending the controller, clear the flags.
* If we are resuming the controller, set the wakeup flags.
*/
if (!suspending) {
if (t1 & PORT_CONNECT)
t2 |= PORT_WKOC_E | PORT_WKDISC_E;
else
t2 |= PORT_WKOC_E | PORT_WKCONN_E;
}
ehci_vdbg(ehci, "port %d, %08x -> %08x\n",
port + 1, t1, t2);
ehci_writel(ehci, t2, reg);
}
/* enter phy low-power mode again */
if (ehci->has_hostpc) {
port = HCS_N_PORTS(ehci->hcs_params);
while (port
u32 __iomem *hostpc_reg;
hostpc_reg = (u32 __iomem *)((u8 *) ehci->regs
+ HOSTPC0 + 4 * port);
temp = ehci_readl(ehci, hostpc_reg);
ehci_writel(ehci, temp | HOSTPC_PHCD, hostpc_reg);
}
}
}
static int ehci_bus_suspend (struct usb_hcd *hcd)
{
struct ehci_hcd *ehci = hcd_to_ehci (hcd);
int port;
int mask;
int changed;
ehci_dbg(ehci, "suspend root hub\n");
if (time_before (jiffies, ehci->next_statechange))
msleep(5);
del_timer_sync(&ehci->watchdog);
del_timer_sync(&ehci->iaa_watchdog);
spin_lock_irq (&ehci->lock);
/* Once the controller is stopped, port resumes that are already
* in progress won't complete. Hence if remote wakeup is enabled
* for the root hub and any ports are in the middle of a resume or
* remote wakeup, we must fail the suspend.
*/
if (hcd->self.root_hub->do_remote_wakeup) {
port = HCS_N_PORTS(ehci->hcs_params);
while (port
if (ehci->reset_done[port] != 0) {
spin_unlock_irq(&ehci->lock);
ehci_dbg(ehci, "suspend failed because "
"port %d is resuming\n",
port + 1);
return -EBUSY;
}
}
}
/* stop schedules, clean any completed work */
if (HC_IS_RUNNING(hcd->state)) {
ehci_quiesce (ehci);
hcd->state = HC_STATE_QUIESCING;
}
ehci->command = ehci_readl(ehci, &ehci->regs->command);
ehci_work(ehci);
/* Unlike other USB host controller types, EHCI doesn't have
* any notion of "global" or bus-wide suspend. The driver has
* to manually suspend all the active unsuspended ports, and
* then manually resume them in the bus_resume() routine.
*/
ehci->bus_suspended = 0;
ehci->owned_ports = 0;
changed = 0;
port = HCS_N_PORTS(ehci->hcs_params);
while (port
u32 __iomem *reg = &ehci->regs->port_status [port];
u32 t1 = ehci_readl(ehci, reg) & ~PORT_RWC_BITS;
u32 t2 = t1 & ~PORT_WAKE_BITS;
/* keep track of which ports we suspend */
if (t1 & PORT_OWNER)
set_bit(port, &ehci->owned_ports);
else if ((t1 & PORT_PE) && !(t1 & PORT_SUSPEND)) {
t2 |= PORT_SUSPEND;
set_bit(port, &ehci->bus_suspended);
}
/* enable remote wakeup on all ports, if told to do so */
if (hcd->self.root_hub->do_remote_wakeup) {
/* only enable appropriate wake bits, otherwise the
* hardware can not go phy low power mode. If a race
* condition happens here(connection change during bits
* set), the port change detection will finally fix it.
*/
if (t1 & PORT_CONNECT)
t2 |= PORT_WKOC_E | PORT_WKDISC_E;
else
t2 |= PORT_WKOC_E | PORT_WKCONN_E;
}
if (t1 != t2) {
ehci_vdbg (ehci, "port %d, %08x -> %08x\n",
port + 1, t1, t2);
ehci_writel(ehci, t2, reg);
changed = 1;
}
}
if (changed && ehci->has_hostpc) {
spin_unlock_irq(&ehci->lock);
msleep(5); /* 5 ms for HCD to enter low-power mode */
spin_lock_irq(&ehci->lock);
port = HCS_N_PORTS(ehci->hcs_params);
while (port
u32 __iomem *hostpc_reg;
u32 t3;
hostpc_reg = (u32 __iomem *)((u8 *) ehci->regs
+ HOSTPC0 + 4 * port);
t3 = ehci_readl(ehci, hostpc_reg);
ehci_writel(ehci, t3 | HOSTPC_PHCD, hostpc_reg);
t3 = ehci_readl(ehci, hostpc_reg);
ehci_dbg(ehci, "Port %d phy low-power mode %s\n",
port, (t3 & HOSTPC_PHCD) ?
"succeeded" : "failed");
}
}
/* Apparently some devices need a >= 1-uframe delay here */
if (ehci->bus_suspended)
udelay(150);
/* turn off now-idle HC */
ehci_halt (ehci);
hcd->state = HC_STATE_SUSPENDED;
if (ehci->reclaim)
end_unlink_async(ehci);
/* allow remote wakeup */
mask = INTR_MASK;
if (!hcd->self.root_hub->do_remote_wakeup)
mask &= ~STS_PCD;
ehci_writel(ehci, mask, &ehci->regs->intr_enable);
ehci_readl(ehci, &ehci->regs->intr_enable);
ehci->next_statechange = jiffies + msecs_to_jiffies(10);
spin_unlock_irq (&ehci->lock);
/* ehci_work() may have re-enabled the watchdog timer, which we do not
* want, and so we must delete any pending watchdog timer events.
*/
del_timer_sync(&ehci->watchdog);
return 0;
}
/* caller has locked the root hub, and should reset/reinit on error */
static int ehci_bus_resume (struct usb_hcd *hcd)
{
struct ehci_hcd *ehci = hcd_to_ehci (hcd);
u32 temp;
u32 power_okay;
int i;
u8 resume_needed = 0;
if (time_before (jiffies, ehci->next_statechange))
msleep(5);
spin_lock_irq (&ehci->lock);
if (!test_bit(<API key>, &hcd->flags)) {
spin_unlock_irq(&ehci->lock);
return -ESHUTDOWN;
}
if (unlikely(ehci->debug)) {
if (!dbgp_reset_prep())
ehci->debug = NULL;
else
<API key>();
}
/* Ideally and we've got a real resume here, and no port's power
* was lost. (For PCI, that means Vaux was maintained.) But we
* could instead be restoring a swsusp snapshot -- so that BIOS was
* the last user of the controller, not reset/pm hardware keeping
* state we gave to it.
*/
power_okay = ehci_readl(ehci, &ehci->regs->intr_enable);
ehci_dbg(ehci, "resume root hub%s\n",
power_okay ? "" : " after power loss");
/* at least some APM implementations will try to deliver
* IRQs right away, so delay them until we're ready.
*/
ehci_writel(ehci, 0, &ehci->regs->intr_enable);
/* re-init operational registers */
ehci_writel(ehci, 0, &ehci->regs->segment);
ehci_writel(ehci, ehci->periodic_dma, &ehci->regs->frame_list);
ehci_writel(ehci, (u32) ehci->async->qh_dma, &ehci->regs->async_next);
/* restore CMD_RUN, framelist size, and irq threshold */
ehci_writel(ehci, ehci->command, &ehci->regs->command);
/* Some controller/firmware combinations need a delay during which
* they set up the port statuses. See Bugzilla #8190. */
spin_unlock_irq(&ehci->lock);
msleep(8);
spin_lock_irq(&ehci->lock);
/* clear phy low-power mode before resume */
if (ehci->bus_suspended && ehci->has_hostpc) {
i = HCS_N_PORTS(ehci->hcs_params);
while (i
if (test_bit(i, &ehci->bus_suspended)) {
u32 __iomem *hostpc_reg;
hostpc_reg = (u32 __iomem *)((u8 *) ehci->regs
+ HOSTPC0 + 4 * i);
temp = ehci_readl(ehci, hostpc_reg);
ehci_writel(ehci, temp & ~HOSTPC_PHCD,
hostpc_reg);
}
}
spin_unlock_irq(&ehci->lock);
msleep(5);
spin_lock_irq(&ehci->lock);
}
/* manually resume the ports we suspended during bus_suspend() */
i = HCS_N_PORTS (ehci->hcs_params);
while (i
temp = ehci_readl(ehci, &ehci->regs->port_status [i]);
temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS);
if (test_bit(i, &ehci->bus_suspended) &&
(temp & PORT_SUSPEND)) {
temp |= PORT_RESUME;
resume_needed = 1;
}
ehci_writel(ehci, temp, &ehci->regs->port_status [i]);
}
/* msleep for 20ms only if code is trying to resume port */
if (resume_needed) {
spin_unlock_irq(&ehci->lock);
msleep(20);
#ifdef MXS_USB_HOST_HACK
{
struct <API key> *pdata;
pdata = hcd->self.controller->platform_data;
if (pdata && pdata->platform_resume)
pdata->platform_resume(pdata);
}
#endif
spin_lock_irq(&ehci->lock);
}
i = HCS_N_PORTS (ehci->hcs_params);
while (i
temp = ehci_readl(ehci, &ehci->regs->port_status [i]);
if (test_bit(i, &ehci->bus_suspended) &&
(temp & PORT_SUSPEND)) {
temp &= ~(PORT_RWC_BITS | PORT_RESUME);
ehci_writel(ehci, temp, &ehci->regs->port_status [i]);
ehci_vdbg (ehci, "resumed port %d\n", i + 1);
}
}
(void) ehci_readl(ehci, &ehci->regs->command);
/* maybe re-activate the schedule(s) */
temp = 0;
if (ehci->async->qh_next.qh)
temp |= CMD_ASE;
if (ehci->periodic_sched)
temp |= CMD_PSE;
if (temp) {
ehci->command |= temp;
ehci_writel(ehci, ehci->command, &ehci->regs->command);
}
ehci->next_statechange = jiffies + msecs_to_jiffies(5);
hcd->state = HC_STATE_RUNNING;
/* Now we can safely re-enable irqs */
ehci_writel(ehci, INTR_MASK, &ehci->regs->intr_enable);
spin_unlock_irq (&ehci->lock);
<API key>(ehci);
return 0;
}
#else
#define ehci_bus_suspend NULL
#define ehci_bus_resume NULL
#endif /* CONFIG_PM */
/* Display the ports dedicated to the companion controller */
static ssize_t show_companion(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct ehci_hcd *ehci;
int nports, index, n;
int count = PAGE_SIZE;
char *ptr = buf;
ehci = hcd_to_ehci(bus_to_hcd(dev_get_drvdata(dev)));
nports = HCS_N_PORTS(ehci->hcs_params);
for (index = 0; index < nports; ++index) {
if (test_bit(index, &ehci->companion_ports)) {
n = scnprintf(ptr, count, "%d\n", index + 1);
ptr += n;
count -= n;
}
}
return ptr - buf;
}
/*
* Sets the owner of a port
*/
static void set_owner(struct ehci_hcd *ehci, int portnum, int new_owner)
{
u32 __iomem *status_reg;
u32 port_status;
int try;
status_reg = &ehci->regs->port_status[portnum];
/*
* The controller won't set the OWNER bit if the port is
* enabled, so this loop will sometimes require at least two
* iterations: one to disable the port and one to set OWNER.
*/
for (try = 4; try > 0; --try) {
spin_lock_irq(&ehci->lock);
port_status = ehci_readl(ehci, status_reg);
if ((port_status & PORT_OWNER) == new_owner
|| (port_status & (PORT_OWNER | PORT_CONNECT))
== 0)
try = 0;
else {
port_status ^= PORT_OWNER;
port_status &= ~(PORT_PE | PORT_RWC_BITS);
ehci_writel(ehci, port_status, status_reg);
}
spin_unlock_irq(&ehci->lock);
if (try > 1)
msleep(5);
}
}
/*
* Dedicate or undedicate a port to the companion controller.
* Syntax is "[-]portnum", where a leading '-' sign means
* return control of the port to the EHCI controller.
*/
static ssize_t store_companion(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct ehci_hcd *ehci;
int portnum, new_owner;
ehci = hcd_to_ehci(bus_to_hcd(dev_get_drvdata(dev)));
new_owner = PORT_OWNER; /* Owned by companion */
if (sscanf(buf, "%d", &portnum) != 1)
return -EINVAL;
if (portnum < 0) {
portnum = - portnum;
new_owner = 0; /* Owned by EHCI */
}
if (portnum <= 0 || portnum > HCS_N_PORTS(ehci->hcs_params))
return -ENOENT;
portnum
if (new_owner)
set_bit(portnum, &ehci->companion_ports);
else
clear_bit(portnum, &ehci->companion_ports);
set_owner(ehci, portnum, new_owner);
return count;
}
static DEVICE_ATTR(companion, 0644, show_companion, store_companion);
static inline void <API key>(struct ehci_hcd *ehci)
{
int i;
/* with integrated TT there is no companion! */
if (!ehci_is_TDI(ehci))
i = device_create_file(ehci_to_hcd(ehci)->self.controller,
&dev_attr_companion);
}
static inline void <API key>(struct ehci_hcd *ehci)
{
/* with integrated TT there is no companion! */
if (!ehci_is_TDI(ehci))
device_remove_file(ehci_to_hcd(ehci)->self.controller,
&dev_attr_companion);
}
static int <API key> (
struct ehci_hcd *ehci,
int index,
u32 __iomem *status_reg,
int port_status
) {
if (!(port_status & PORT_CONNECT))
return port_status;
/* if reset finished and it's still not enabled -- handoff */
if (!(port_status & PORT_PE)) {
/* with integrated TT, there's nobody to hand it to! */
if (ehci_is_TDI(ehci)) {
ehci_dbg (ehci,
"Failed to enable port %d on root hub TT\n",
index+1);
return port_status;
}
ehci_dbg (ehci, "port %d full speed --> companion\n",
index + 1);
// what happens if HCS_N_CC(params) == 0 ?
port_status |= PORT_OWNER;
port_status &= ~PORT_RWC_BITS;
ehci_writel(ehci, port_status, status_reg);
/* ensure 440EPX ohci controller state is operational */
if (ehci->has_amcc_usb23)
set_ohci_hcfs(ehci, 1);
} else {
ehci_dbg (ehci, "port %d high speed\n", index + 1);
/* ensure 440EPx ohci controller state is suspended */
if (ehci->has_amcc_usb23)
set_ohci_hcfs(ehci, 0);
}
return port_status;
}
/* build "status change" packet (one or two bytes) from HC registers */
static int
<API key> (struct usb_hcd *hcd, char *buf)
{
struct ehci_hcd *ehci = hcd_to_ehci (hcd);
u32 temp, status = 0;
u32 mask;
int ports, i, retval = 1;
unsigned long flags;
/* if !USB_SUSPEND, root hub timers won't get shut down ... */
if (!HC_IS_RUNNING(hcd->state))
return 0;
/* init status to no-changes */
buf [0] = 0;
ports = HCS_N_PORTS (ehci->hcs_params);
if (ports > 7) {
buf [1] = 0;
retval++;
}
/* Some boards (mostly VIA?) report bogus overcurrent indications,
* causing massive log spam unless we completely ignore them. It
* may be relevant that VIA VT8235 controllers, where PORT_POWER is
* always set, seem to clear PORT_OCC and PORT_CSC when writing to
* PORT_POWER; that's surprising, but maybe within-spec.
*/
if (!ignore_oc)
mask = PORT_CSC | PORT_PEC | PORT_OCC;
else
mask = PORT_CSC | PORT_PEC;
// PORT_RESUME from hardware ~= PORT_STAT_C_SUSPEND
/* no hub change reports (bit 0) for now (power, ...) */
/* port N changes (bit N)? */
spin_lock_irqsave (&ehci->lock, flags);
for (i = 0; i < ports; i++) {
temp = ehci_readl(ehci, &ehci->regs->port_status [i]);
/*
* Return status information even for ports with OWNER set.
* Otherwise khubd wouldn't see the disconnect event when a
* high-speed device is switched over to the companion
* controller by the user.
*/
if ((temp & mask) != 0 || test_bit(i, &ehci->port_c_suspend)
|| (ehci->reset_done[i] && time_after_eq(
jiffies, ehci->reset_done[i]))) {
if (i < 7)
buf [0] |= 1 << (i + 1);
else
buf [1] |= 1 << (i - 7);
status = STS_PCD;
}
}
/* FIXME autosuspend idle root hubs */
<API key> (&ehci->lock, flags);
return status ? retval : 0;
}
static void
ehci_hub_descriptor (
struct ehci_hcd *ehci,
struct usb_hub_descriptor *desc
) {
int ports = HCS_N_PORTS (ehci->hcs_params);
u16 temp;
desc->bDescriptorType = 0x29;
desc->bPwrOn2PwrGood = 10; /* ehci 1.0, 2.3.9 says 20ms max */
desc->bHubContrCurrent = 0;
desc->bNbrPorts = ports;
temp = 1 + (ports / 8);
desc->bDescLength = 7 + 2 * temp;
/* two bitmaps: ports removable, and usb 1.0 legacy PortPwrCtrlMask */
memset (&desc->bitmap [0], 0, temp);
memset (&desc->bitmap [temp], 0xff, temp);
temp = 0x0008; /* per-port overcurrent reporting */
if (HCS_PPC (ehci->hcs_params))
temp |= 0x0001; /* per-port power control */
else
temp |= 0x0002; /* no power switching */
#if 0
// re-enable when we support <API key> below.
if (HCS_INDICATOR (ehci->hcs_params))
temp |= 0x0080; /* per-port indicators (LEDs) */
#endif
desc->wHubCharacteristics = cpu_to_le16(temp);
}
static int ehci_hub_control (
struct usb_hcd *hcd,
u16 typeReq,
u16 wValue,
u16 wIndex,
char *buf,
u16 wLength
) {
struct ehci_hcd *ehci = hcd_to_ehci (hcd);
int ports = HCS_N_PORTS (ehci->hcs_params);
u32 __iomem *status_reg = &ehci->regs->port_status[
(wIndex & 0xff) - 1];
u32 __iomem *hostpc_reg = NULL;
u32 temp, temp1, status;
unsigned long flags;
int retval = 0;
unsigned selector;
/*
* FIXME: support SetPortFeatures <API key>.
* HCS_INDICATOR may say we can change LEDs to off/amber/green.
* (track current state ourselves) ... blink for diagnostics,
* power, "this is the one", etc. EHCI spec supports this.
*/
if (ehci->has_hostpc)
hostpc_reg = (u32 __iomem *)((u8 *)ehci->regs
+ HOSTPC0 + 4 * ((wIndex & 0xff) - 1));
spin_lock_irqsave (&ehci->lock, flags);
switch (typeReq) {
case ClearHubFeature:
switch (wValue) {
case C_HUB_LOCAL_POWER:
case C_HUB_OVER_CURRENT:
/* no hub-wide feature/status flags */
break;
default:
goto error;
}
break;
case ClearPortFeature:
if (!wIndex || wIndex > ports)
goto error;
wIndex
temp = ehci_readl(ehci, status_reg);
/*
* Even if OWNER is set, so the port is owned by the
* companion controller, khubd needs to be able to clear
* the port-change status bits (especially
* <API key>).
*/
switch (wValue) {
case <API key>:
ehci_writel(ehci, temp & ~PORT_PE, status_reg);
break;
case <API key>:
ehci_writel(ehci, (temp & ~PORT_RWC_BITS) | PORT_PEC,
status_reg);
break;
case <API key>:
if (temp & PORT_RESET)
goto error;
if (ehci-><API key>)
break;
if (!(temp & PORT_SUSPEND))
break;
if ((temp & PORT_PE) == 0)
goto error;
/* clear phy low-power mode before resume */
if (hostpc_reg) {
temp1 = ehci_readl(ehci, hostpc_reg);
ehci_writel(ehci, temp1 & ~HOSTPC_PHCD,
hostpc_reg);
<API key>(&ehci->lock, flags);
msleep(5);/* wait to leave low-power mode */
spin_lock_irqsave(&ehci->lock, flags);
}
/* resume signaling for 20 msec */
temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS);
ehci_writel(ehci, temp | PORT_RESUME, status_reg);
ehci->reset_done[wIndex] = jiffies
+ msecs_to_jiffies(20);
break;
case <API key>:
clear_bit(wIndex, &ehci->port_c_suspend);
break;
case USB_PORT_FEAT_POWER:
if (HCS_PPC (ehci->hcs_params))
ehci_writel(ehci,
temp & ~(PORT_RWC_BITS | PORT_POWER),
status_reg);
break;
case <API key>:
ehci_writel(ehci, (temp & ~PORT_RWC_BITS) | PORT_CSC,
status_reg);
break;
case <API key>:
ehci_writel(ehci, (temp & ~PORT_RWC_BITS) | PORT_OCC,
status_reg);
break;
case <API key>:
/* GetPortStatus clears reset */
break;
default:
goto error;
}
ehci_readl(ehci, &ehci->regs->command); /* unblock posted write */
break;
case GetHubDescriptor:
ehci_hub_descriptor (ehci, (struct usb_hub_descriptor *)
buf);
break;
case GetHubStatus:
/* no hub-wide feature/status flags */
memset (buf, 0, 4);
//cpu_to_le32s ((u32 *) buf);
break;
case GetPortStatus:
if (!wIndex || wIndex > ports)
goto error;
wIndex
status = 0;
temp = ehci_readl(ehci, status_reg);
// wPortChange bits
if (temp & PORT_CSC)
status |= <API key> << 16;
if (temp & PORT_PEC)
status |= <API key> << 16;
if ((temp & PORT_OCC) && !ignore_oc){
status |= <API key> << 16;
/*
* Hubs should disable port power on over-current.
* However, not all EHCI implementations do this
* automatically, even if they _do_ support per-port
* power switching; they're allowed to just limit the
* current. khubd will turn the power back on.
*/
if (HCS_PPC (ehci->hcs_params)){
ehci_writel(ehci,
temp & ~(PORT_RWC_BITS | PORT_POWER),
status_reg);
}
}
/* whoever resumes must GetPortStatus to complete it!! */
if (temp & PORT_RESUME) {
/* Remote Wakeup received? */
if (!ehci->reset_done[wIndex]) {
/* resume signaling for 20 msec */
ehci->reset_done[wIndex] = jiffies
+ msecs_to_jiffies(20);
/* check the port again */
mod_timer(&ehci_to_hcd(ehci)->rh_timer,
ehci->reset_done[wIndex]);
}
/* resume completed? */
else if (time_after_eq(jiffies,
ehci->reset_done[wIndex])) {
clear_bit(wIndex, &ehci->suspended_ports);
set_bit(wIndex, &ehci->port_c_suspend);
ehci->reset_done[wIndex] = 0;
/* stop resume signaling */
temp = ehci_readl(ehci, status_reg);
ehci_writel(ehci,
temp & ~(PORT_RWC_BITS | PORT_RESUME),
status_reg);
retval = handshake(ehci, status_reg,
PORT_RESUME, 0, 2000 /* 2msec */);
if (retval != 0) {
ehci_err(ehci,
"port %d resume error %d\n",
wIndex + 1, retval);
goto error;
}
temp &= ~(PORT_SUSPEND|PORT_RESUME|(3<<10));
}
}
/* whoever resets must GetPortStatus to complete it!! */
if ((temp & PORT_RESET)
&& time_after_eq(jiffies,
ehci->reset_done[wIndex])) {
status |= <API key> << 16;
ehci->reset_done [wIndex] = 0;
/* force reset to complete */
ehci_writel(ehci, temp & ~(PORT_RWC_BITS | PORT_RESET),
status_reg);
/* REVISIT: some hardware needs 550+ usec to clear
* this bit; seems too long to spin routinely...
*/
retval = handshake(ehci, status_reg,
PORT_RESET, 0, 1000);
if (retval != 0) {
ehci_err (ehci, "port %d reset error %d\n",
wIndex + 1, retval);
goto error;
}
/* see what we found out */
temp = <API key> (ehci, wIndex, status_reg,
ehci_readl(ehci, status_reg));
}
if (!(temp & (PORT_RESUME|PORT_RESET)))
ehci->reset_done[wIndex] = 0;
/* transfer dedicated ports to the companion hc */
if ((temp & PORT_CONNECT) &&
test_bit(wIndex, &ehci->companion_ports)) {
temp &= ~PORT_RWC_BITS;
temp |= PORT_OWNER;
ehci_writel(ehci, temp, status_reg);
ehci_dbg(ehci, "port %d --> companion\n", wIndex + 1);
temp = ehci_readl(ehci, status_reg);
}
/*
* Even if OWNER is set, there's no harm letting khubd
* see the wPortStatus values (they should all be 0 except
* for PORT_POWER anyway).
*/
if (temp & PORT_CONNECT) {
status |= <API key>;
// status may be from integrated TT
if (ehci->has_hostpc) {
temp1 = ehci_readl(ehci, hostpc_reg);
status |= ehci_port_speed(ehci, temp1);
} else
status |= ehci_port_speed(ehci, temp);
}
if (temp & PORT_PE)
status |= <API key>;
/* maybe the port was unsuspended without our knowledge */
if (temp & (PORT_SUSPEND|PORT_RESUME)) {
status |= <API key>;
} else if (test_bit(wIndex, &ehci->suspended_ports)) {
clear_bit(wIndex, &ehci->suspended_ports);
ehci->reset_done[wIndex] = 0;
if (temp & PORT_PE)
set_bit(wIndex, &ehci->port_c_suspend);
}
if (temp & PORT_OC)
status |= <API key>;
if (temp & PORT_RESET)
status |= USB_PORT_STAT_RESET;
if (temp & PORT_POWER)
status |= USB_PORT_STAT_POWER;
if (test_bit(wIndex, &ehci->port_c_suspend))
status |= <API key> << 16;
#ifndef VERBOSE_DEBUG
if (status & ~0xffff) /* only if wPortChange is interesting */
#endif
dbg_port (ehci, "GetStatus", wIndex + 1, temp);
put_unaligned_le32(status, buf);
break;
case SetHubFeature:
switch (wValue) {
case C_HUB_LOCAL_POWER:
case C_HUB_OVER_CURRENT:
/* no hub-wide feature/status flags */
break;
default:
goto error;
}
break;
case SetPortFeature:
selector = wIndex >> 8;
wIndex &= 0xff;
if (unlikely(ehci->debug)) {
/* If the debug port is active any port
* feature requests should get denied */
if (wIndex == HCS_DEBUG_PORT(ehci->hcs_params) &&
(readl(&ehci->debug->control) & DBGP_ENABLED)) {
retval = -ENODEV;
goto error_exit;
}
}
if (!wIndex || wIndex > ports)
goto error;
wIndex
temp = ehci_readl(ehci, status_reg);
if (temp & PORT_OWNER)
break;
temp &= ~PORT_RWC_BITS;
switch (wValue) {
case <API key>:
if (ehci-><API key>)
break;
if ((temp & PORT_PE) == 0
|| (temp & PORT_RESET) != 0)
goto error;
/* After above check the port must be connected.
* Set appropriate bit thus could put phy into low power
* mode if we have hostpc feature
*/
temp &= ~PORT_WKCONN_E;
temp |= PORT_WKDISC_E | PORT_WKOC_E;
ehci_writel(ehci, temp | PORT_SUSPEND, status_reg);
#ifdef MXS_USB_HOST_HACK
<API key>(&ehci->lock, flags);
{
struct <API key> *pdata;
pdata = hcd->self.controller->platform_data;
if (pdata && pdata->platform_suspend)
pdata->platform_suspend(pdata);
}
spin_lock_irqsave(&ehci->lock, flags);
#endif
if (hostpc_reg) {
<API key>(&ehci->lock, flags);
msleep(5);/* 5ms for HCD enter low pwr mode */
spin_lock_irqsave(&ehci->lock, flags);
temp1 = ehci_readl(ehci, hostpc_reg);
ehci_writel(ehci, temp1 | HOSTPC_PHCD,
hostpc_reg);
temp1 = ehci_readl(ehci, hostpc_reg);
ehci_dbg(ehci, "Port%d phy low pwr mode %s\n",
wIndex, (temp1 & HOSTPC_PHCD) ?
"succeeded" : "failed");
}
set_bit(wIndex, &ehci->suspended_ports);
break;
case USB_PORT_FEAT_POWER:
if (HCS_PPC (ehci->hcs_params))
ehci_writel(ehci, temp | PORT_POWER,
status_reg);
break;
case USB_PORT_FEAT_RESET:
if (temp & PORT_RESUME)
goto error;
/* line status bits may report this as low speed,
* which can be fine if this root hub has a
* transaction translator built in.
*/
if ((temp & (PORT_PE|PORT_CONNECT)) == PORT_CONNECT
&& !ehci_is_TDI(ehci)
&& PORT_USB11 (temp)) {
ehci_dbg (ehci,
"port %d low speed --> companion\n",
wIndex + 1);
temp |= PORT_OWNER;
} else {
ehci_vdbg (ehci, "port %d reset\n", wIndex + 1);
temp |= PORT_RESET;
temp &= ~PORT_PE;
/*
* caller must wait, then call GetPortStatus
* usb 2.0 spec says 50 ms resets on root
*/
ehci->reset_done [wIndex] = jiffies
+ msecs_to_jiffies (50);
}
ehci_writel(ehci, temp, status_reg);
break;
/* For downstream facing ports (these): one hub port is put
* into test mode according to USB2 11.24.2.13, then the hub
* must be reset (which for root hub now means rmmod+modprobe,
* or else system reboot). See EHCI 2.3.9 and 4.14 for info
* about the EHCI-specific stuff.
*/
case USB_PORT_FEAT_TEST:
if (!selector || selector > 5)
goto error;
ehci_quiesce(ehci);
ehci_halt(ehci);
temp |= selector << 16;
ehci_writel(ehci, temp, status_reg);
break;
default:
goto error;
}
ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */
break;
default:
error:
/* "stall" on error */
retval = -EPIPE;
}
error_exit:
<API key> (&ehci->lock, flags);
return retval;
}
static void <API key>(struct usb_hcd *hcd, int portnum)
{
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
if (ehci_is_TDI(ehci))
return;
set_owner(ehci, --portnum, PORT_OWNER);
}
static int <API key>(struct usb_hcd *hcd, int portnum)
{
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
u32 __iomem *reg;
if (ehci_is_TDI(ehci))
return 0;
reg = &ehci->regs->port_status[portnum - 1];
return ehci_readl(ehci, reg) & PORT_OWNER;
}
|
#include "nateon.h"
#include "error.h"
const char *
<API key>(unsigned int type, gboolean *debug)
{
static char msg[NATEON_BUF_LEN];
*debug = FALSE;
switch (type) {
// case 0:
// g_snprintf(msg, sizeof(msg),
// _("Unable to parse message"));
// *debug = TRUE;
// break;
// case 200:
// g_snprintf(msg, sizeof(msg),
// _("Syntax Error (probably a client bug)"));
// *debug = TRUE;
// break;
// case 201:
// g_snprintf(msg, sizeof(msg),
// _("Invalid e-mail address"));
// break;
// case 205:
// g_snprintf(msg, sizeof(msg), _("User does not exist"));
// break;
// case 206:
// g_snprintf(msg, sizeof(msg),
// _("Fully qualified domain name missing"));
// break;
// case 207:
// g_snprintf(msg, sizeof(msg), _("Already logged in"));
// break;
// case 208:
// g_snprintf(msg, sizeof(msg), _("Invalid screen name"));
// break;
// case 209:
// g_snprintf(msg, sizeof(msg), _("Invalid friendly name"));
// break;
// case 210:
// g_snprintf(msg, sizeof(msg), _("List full"));
// break;
// case 215:
// g_snprintf(msg, sizeof(msg), _("Already there"));
// *debug = TRUE;
// break;
// case 216:
// g_snprintf(msg, sizeof(msg), _("Not on list"));
// break;
// case 217:
// g_snprintf(msg, sizeof(msg), _("User is offline"));
// break;
// case 218:
// g_snprintf(msg, sizeof(msg), _("Already in the mode"));
// *debug = TRUE;
// break;
// case 219:
// g_snprintf(msg, sizeof(msg), _("Already in opposite list"));
// *debug = TRUE;
// break;
// case 223:
// g_snprintf(msg, sizeof(msg), _("Too many groups"));
// break;
// case 224:
// g_snprintf(msg, sizeof(msg), _("Invalid group"));
// break;
// case 225:
// g_snprintf(msg, sizeof(msg), _("User not in group"));
// break;
// case 229:
// g_snprintf(msg, sizeof(msg), _("Group name too long"));
// break;
// case 230:
// g_snprintf(msg, sizeof(msg), _("Cannot remove group zero"));
// *debug = TRUE;
// break;
// case 231:
// g_snprintf(msg, sizeof(msg),
// _("Tried to add a user to a group "
// "that doesn't exist"));
// break;
// case 280:
// g_snprintf(msg, sizeof(msg), _("Switchboard failed"));
// *debug = TRUE;
// break;
// case 281:
// g_snprintf(msg, sizeof(msg), _("Notify transfer failed"));
// *debug = TRUE;
// break;
// case 300:
// g_snprintf(msg, sizeof(msg), _("Required fields missing"));
// *debug = TRUE;
// break;
// case 301:
// g_snprintf(msg, sizeof(msg), _("Too many hits to a FND"));
// *debug = TRUE;
// break;
// case 302:
// g_snprintf(msg, sizeof(msg), _("Not logged in"));
// break;
// case 500:
// g_snprintf(msg, sizeof(msg), _("Service temporarily unavailable"));
// break;
// case 501:
// g_snprintf(msg, sizeof(msg), _("Database server error"));
// *debug = TRUE;
// break;
// case 502:
// g_snprintf(msg, sizeof(msg), _("Command disabled"));
// *debug = TRUE;
// break;
// case 510:
// g_snprintf(msg, sizeof(msg), _("File operation error"));
// *debug = TRUE;
// break;
// case 520:
// g_snprintf(msg, sizeof(msg), _("Memory allocation error"));
// *debug = TRUE;
// break;
// case 540:
// g_snprintf(msg, sizeof(msg), _("Wrong CHL value sent to server"));
// *debug = TRUE;
// break;
// case 600:
// g_snprintf(msg, sizeof(msg), _("Server busy"));
// break;
// case 601:
// g_snprintf(msg, sizeof(msg), _("Server unavailable"));
// break;
// case 602:
// g_snprintf(msg, sizeof(msg), _("Peer notification server down"));
// *debug = TRUE;
// break;
// case 603:
// g_snprintf(msg, sizeof(msg), _("Database connect error"));
// *debug = TRUE;
// break;
// case 604:
// g_snprintf(msg, sizeof(msg),
// _("Server is going down (abandon ship)"));
// break;
// case 605:
// g_snprintf(msg, sizeof(msg), _("Server unavailable"));
// break;
// case 707:
// g_snprintf(msg, sizeof(msg), _("Error creating connection"));
// *debug = TRUE;
// break;
// case 710:
// g_snprintf(msg, sizeof(msg),
// _("CVR parameters are either unknown or not allowed"));
// *debug = TRUE;
// break;
// case 711:
// g_snprintf(msg, sizeof(msg), _("Unable to write"));
// break;
// case 712:
// g_snprintf(msg, sizeof(msg), _("Session overload"));
// *debug = TRUE;
// break;
// case 713:
// g_snprintf(msg, sizeof(msg), _("User is too active"));
// break;
// case 714:
// g_snprintf(msg, sizeof(msg), _("Too many sessions"));
// break;
// case 715:
// g_snprintf(msg, sizeof(msg), _("Passport not verified"));
// break;
// case 717:
// g_snprintf(msg, sizeof(msg), _("Bad friend file"));
// *debug = TRUE;
// break;
// case 731:
// g_snprintf(msg, sizeof(msg), _("Not expected"));
// *debug = TRUE;
// break;
// case 800:
// g_snprintf(msg, sizeof(msg),
// _("Friendly name changes too rapidly"));
// break;
// case 910:
// case 912:
// case 918:
// case 919:
// case 921:
// case 922:
// g_snprintf(msg, sizeof(msg), _("Server too busy"));
// break;
// case 911:
// case 917:
// g_snprintf(msg, sizeof(msg), _("Authentication failed"));
// break;
// case 913:
// g_snprintf(msg, sizeof(msg), _("Not allowed when offline"));
// break;
// case 914:
// case 915:
// case 916:
// g_snprintf(msg, sizeof(msg), _("Server unavailable"));
// break;
// case 920:
// g_snprintf(msg, sizeof(msg), _("Not accepting new users"));
// break;
// case 923:
// g_snprintf(msg, sizeof(msg),
// _("Kids Passport without parental consent"));
// break;
// case 924:
// g_snprintf(msg, sizeof(msg),
// _("Passport account not yet verified"));
// break;
// case 928:
// g_snprintf(msg, sizeof(msg), _("Bad ticket"));
// *debug = TRUE;
// break;
default:
g_snprintf(msg, sizeof(msg), _("Unknown Error Code %d"), type);
*debug = TRUE;
break;
}
return msg;
}
void
nateon_error_handle(NateonSession *session, unsigned int type)
{
char buf[NATEON_BUF_LEN];
gboolean debug;
g_snprintf(buf, sizeof(buf), _("NATEON Error: %s\n"),
<API key>(type, &debug));
if (debug)
<API key>("nateon", "error %d: %s\n", type, buf);
else
purple_notify_error(session->account->gc, NULL, buf, NULL);
}
|
<?php
class <API key> extends <API key>
{
public function webSectionTemplate($area)
{
$html = '';
$html.= '<div class="row-fluid">';
$html.= '<div class="span12">';
$html.= '<div class="page-header">';
$html.= '<h1>Header Layout Default</h1>';
$html.= '</div>';
$html.= '</div>';
$html.= '</div>';
$html.= '<div class="row-fluid">';
$html.= '<div class="span12">';
$html.= '<div class="page-header">';
$html.= '<h1>Menu <a href="/">'.$lang->translate('Home').'</a></h1>';
$html.= '</div>';
$html.= '</div>';
$html.= '</div>';
$html.= '<div class="row-fluid">';
$html.= '<div class="span6">';
$html.= '<div class="row-fluid">';
$html.= '<div class="page-header">';
$html.= '<h2>area 1</h2>';
$html.= $area[1];
$html.= '</div>';
$html.= '</div>';
$html.= '</div>';
$html.= '<div class="span6">';
$html.= '<div class="row-fluid">';
$html.= '<div class="page-header">';
$html.= '<h2>area 2</h2>';
$html.= $area[2];
$html.= '</div>';
$html.= '</div>';
$html.= '<div class="row-fluid">';
$html.= '<div class="page-header">';
$html.= '<h2>area 3</h2>';
$html.= $area[3];
$html.= '</div>';
$html.= '</div>';
$html.= '</div>';
$html.= '</div>';
//$html.= $area_1.' '.$area_2.' '.$area_3;
return $html;
}
}
|
#ifndef _ASMARM_PGTABLE_H
#define _ASMARM_PGTABLE_H
#include <linux/const.h>
#include <asm/proc-fns.h>
#ifndef CONFIG_MMU
#include <asm-generic/4level-fixup.h>
#include "pgtable-nommu.h"
#else
#include <asm-generic/pgtable-nopud.h>
#include <asm/memory.h>
#include <asm/pgtable-hwdef.h>
#ifdef CONFIG_ARM_LPAE
#include <asm/pgtable-3level.h>
#else
#include <asm/pgtable-2level.h>
#endif
/*
* Just any arbitrary offset to the start of the vmalloc VM area: the
* current 8MB value just means that there will be a 8MB "hole" after the
* physical memory until the kernel virtual memory starts. That means that
* any out-of-bounds memory accesses will hopefully be caught.
* The vmalloc() routines leaves a hole of 4kB between each vmalloced
* area for the same reason. ;)
*/
#define VMALLOC_OFFSET (8*1024*1024)
#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))
#define VMALLOC_END 0xff000000UL
#define LIBRARY_TEXT_START 0x0c000000
#ifndef __ASSEMBLY__
extern void __pte_error(const char *file, int line, pte_t);
extern void __pmd_error(const char *file, int line, pmd_t);
extern void __pgd_error(const char *file, int line, pgd_t);
#define pte_ERROR(pte) __pte_error(__FILE__, __LINE__, pte)
#define pmd_ERROR(pmd) __pmd_error(__FILE__, __LINE__, pmd)
#define pgd_ERROR(pgd) __pgd_error(__FILE__, __LINE__, pgd)
/*
* This is the lowest virtual address we can permit any user space
* mapping to be mapped at. This is particularly important for
* non-high vector CPUs.
*/
#define FIRST_USER_ADDRESS PAGE_SIZE
/*
* The pgprot_* and protection_map entries will be fixed up in runtime
* to include the cachable and bufferable bits based on memory policy,
* as well as any architecture dependent bits like global/ASID and SMP
* shared mapping bits.
*/
#define _L_PTE_DEFAULT L_PTE_PRESENT | L_PTE_YOUNG
extern pgprot_t pgprot_user;
extern pgprot_t pgprot_kernel;
#define _MOD_PROT(p, b) __pgprot(pgprot_val(p) | (b))
#define PAGE_NONE _MOD_PROT(pgprot_user, L_PTE_XN | L_PTE_RDONLY)
#define PAGE_SHARED _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_XN)
#define PAGE_SHARED_EXEC _MOD_PROT(pgprot_user, L_PTE_USER)
#define PAGE_COPY _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_RDONLY | L_PTE_XN)
#define PAGE_COPY_EXEC _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_RDONLY)
#define PAGE_READONLY _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_RDONLY | L_PTE_XN)
#define PAGE_READONLY_EXEC _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_RDONLY)
#define PAGE_KERNEL _MOD_PROT(pgprot_kernel, L_PTE_XN)
#define PAGE_KERNEL_EXEC pgprot_kernel
#define __PAGE_NONE __pgprot(_L_PTE_DEFAULT | L_PTE_RDONLY | L_PTE_XN)
#define __PAGE_SHARED __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_XN)
#define __PAGE_SHARED_EXEC __pgprot(_L_PTE_DEFAULT | L_PTE_USER)
#define __PAGE_COPY __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_RDONLY | L_PTE_XN)
#define __PAGE_COPY_EXEC __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_RDONLY)
#define __PAGE_READONLY __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_RDONLY | L_PTE_XN)
#define <API key> __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_RDONLY)
#define __pgprot_modify(prot,mask,bits) \
__pgprot((pgprot_val(prot) & ~(mask)) | (bits))
#define pgprot_noncached(prot) \
__pgprot_modify(prot, L_PTE_MT_MASK, L_PTE_MT_UNCACHED)
#define pgprot_writecombine(prot) \
__pgprot_modify(prot, L_PTE_MT_MASK, L_PTE_MT_BUFFERABLE)
#define <API key>(prot) \
__pgprot_modify(prot, L_PTE_MT_MASK, L_PTE_MT_UNCACHED)
#define pgprot_device(prot) \
__pgprot_modify(prot, L_PTE_MT_MASK, <API key>)
#define <API key>(prot) \
__pgprot_modify(prot, L_PTE_MT_MASK, <API key>)
#define <API key>(prot) \
__pgprot_modify(prot, L_PTE_MT_MASK, L_PTE_MT_WRITEBACK)
#define <API key>(prot) \
__pgprot_modify(prot, L_PTE_MT_MASK, L_PTE_MT_WRITEALLOC)
#ifdef <API key>
#define pgprot_dmacoherent(prot) \
__pgprot_modify(prot, L_PTE_MT_MASK, L_PTE_MT_BUFFERABLE | L_PTE_XN)
#define <API key>
#define COHERENT_IS_NORMAL 1
struct file;
extern pgprot_t <API key>(struct file *file, unsigned long pfn,
unsigned long size, pgprot_t vma_prot);
#else
#define pgprot_dmacoherent(prot) \
__pgprot_modify(prot, L_PTE_MT_MASK, L_PTE_MT_UNCACHED | L_PTE_XN)
#define COHERENT_IS_NORMAL 0
#endif
#endif /* __ASSEMBLY__ */
#define __P000 __PAGE_NONE
#define __P001 __PAGE_READONLY
#define __P010 __PAGE_COPY
#define __P011 __PAGE_COPY
#define __P100 <API key>
#define __P101 <API key>
#define __P110 __PAGE_COPY_EXEC
#define __P111 __PAGE_COPY_EXEC
#define __S000 __PAGE_NONE
#define __S001 __PAGE_READONLY
#define __S010 __PAGE_SHARED
#define __S011 __PAGE_SHARED
#define __S100 <API key>
#define __S101 <API key>
#define __S110 __PAGE_SHARED_EXEC
#define __S111 __PAGE_SHARED_EXEC
#ifndef __ASSEMBLY__
/*
* ZERO_PAGE is a global shared page that is always zero: used
* for zero-mapped memory areas etc..
*/
extern struct page *empty_zero_page;
#define ZERO_PAGE(vaddr) (empty_zero_page)
extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
/* to find an entry in a <API key> */
#define pgd_index(addr) ((addr) >> PGDIR_SHIFT)
#define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr))
/* to find an entry in a kernel <API key> */
#define pgd_offset_k(addr) pgd_offset(&init_mm, addr)
#define pmd_none(pmd) (!pmd_val(pmd))
#define pmd_present(pmd) (pmd_val(pmd))
static inline pte_t *pmd_page_vaddr(pmd_t pmd)
{
return __va(pmd_val(pmd) & PHYS_MASK & (s32)PAGE_MASK);
}
#define pmd_page(pmd) pfn_to_page(__phys_to_pfn(pmd_val(pmd) & PHYS_MASK))
#ifndef CONFIG_HIGHPTE
#define __pte_map(pmd) pmd_page_vaddr(*(pmd))
#define __pte_unmap(pte) do { } while (0)
#else
#define __pte_map(pmd) (pte_t *)kmap_atomic(pmd_page(*(pmd)))
#define __pte_unmap(pte) kunmap_atomic(pte)
#endif
#define pte_index(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
#define pte_offset_kernel(pmd,addr) (pmd_page_vaddr(*(pmd)) + pte_index(addr))
#define pte_offset_map(pmd,addr) (__pte_map(pmd) + pte_index(addr))
#define pte_unmap(pte) __pte_unmap(pte)
#define pte_pfn(pte) ((pte_val(pte) & PHYS_MASK) >> PAGE_SHIFT)
#define pfn_pte(pfn,prot) __pte(__pfn_to_phys(pfn) | pgprot_val(prot))
#define pte_page(pte) pfn_to_page(pte_pfn(pte))
#define mk_pte(page,prot) pfn_pte(page_to_pfn(page), prot)
#define pte_clear(mm,addr,ptep) set_pte_ext(ptep, __pte(0), 0)
#define pte_none(pte) (!pte_val(pte))
#define pte_present(pte) (pte_val(pte) & L_PTE_PRESENT)
#define pte_write(pte) (!(pte_val(pte) & L_PTE_RDONLY))
#define pte_dirty(pte) (pte_val(pte) & L_PTE_DIRTY)
#define pte_young(pte) (pte_val(pte) & L_PTE_YOUNG)
#define pte_exec(pte) (!(pte_val(pte) & L_PTE_XN))
#define pte_special(pte) (0)
#define pte_present_user(pte) \
((pte_val(pte) & (L_PTE_PRESENT | L_PTE_USER)) == \
(L_PTE_PRESENT | L_PTE_USER))
#if __LINUX_ARM_ARCH__ < 6
static inline void <API key>(pte_t pteval)
{
}
#else
extern void <API key>(pte_t pteval);
#endif
static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
pte_t *ptep, pte_t pteval)
{
unsigned long ext = 0;
if (addr < TASK_SIZE && pte_present_user(pteval)) {
<API key>(pteval);
ext |= PTE_EXT_NG;
}
set_pte_ext(ptep, pteval, ext);
}
#define PTE_BIT_FUNC(fn,op) \
static inline pte_t pte_##fn(pte_t pte) { pte_val(pte) op; return pte; }
PTE_BIT_FUNC(wrprotect, |= L_PTE_RDONLY);
PTE_BIT_FUNC(mkwrite, &= ~L_PTE_RDONLY);
PTE_BIT_FUNC(mkclean, &= ~L_PTE_DIRTY);
PTE_BIT_FUNC(mkdirty, |= L_PTE_DIRTY);
PTE_BIT_FUNC(mkold, &= ~L_PTE_YOUNG);
PTE_BIT_FUNC(mkyoung, |= L_PTE_YOUNG);
static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
{
const pteval_t mask = L_PTE_XN | L_PTE_RDONLY | L_PTE_USER;
pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask);
return pte;
}
#define __SWP_TYPE_SHIFT 3
#define __SWP_TYPE_BITS 5
#define __SWP_TYPE_MASK ((1 << __SWP_TYPE_BITS) - 1)
#define __SWP_OFFSET_SHIFT (__SWP_TYPE_BITS + __SWP_TYPE_SHIFT)
#define __swp_type(x) (((x).val >> __SWP_TYPE_SHIFT) & __SWP_TYPE_MASK)
#define __swp_offset(x) ((x).val >> __SWP_OFFSET_SHIFT)
#define __swp_entry(type,offset) ((swp_entry_t) { ((type) << __SWP_TYPE_SHIFT) | ((offset) << __SWP_OFFSET_SHIFT) })
#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
#define __swp_entry_to_pte(swp) ((pte_t) { (swp).val })
/*
* It is an error for the kernel to have more swap files than we can
* encode in the PTEs. This ensures that we know when MAX_SWAPFILES
* is increased beyond what we presently support.
*/
#define MAX_SWAPFILES_CHECK() BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > __SWP_TYPE_BITS)
#define pte_file(pte) (pte_val(pte) & L_PTE_FILE)
#define pte_to_pgoff(x) (pte_val(x) >> 3)
#define pgoff_to_pte(x) __pte(((x) << 3) | L_PTE_FILE)
#define PTE_FILE_MAX_BITS 29
/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
/* FIXME: this is not correct */
#define kern_addr_valid(addr) (1)
#include <asm-generic/pgtable.h>
/*
* We provide our own <API key> to cope with VIPT caches.
*/
#define <API key>
#define <API key>
/*
* remap a physical page `pfn' of size `size' with page protection `prot'
* into virtual address `from'
*/
#define io_remap_pfn_range(vma,from,pfn,size,prot) \
remap_pfn_range(vma,from,pfn,size,prot)
#define pgtable_cache_init() do { } while (0)
#endif /* !__ASSEMBLY__ */
#endif /* CONFIG_MMU */
#endif /* _ASMARM_PGTABLE_H */
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http:
<head>
<title>Qt 4.3: mainwindow.cpp Example File (sql/masterdetail/mainwindow.cpp)</title>
<link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http:
<td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="mainclasses.html"><font color="#004faf">Main Classes</font></a> · <a href="groups.html"><font color="#004faf">Grouped Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a> · <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http:
</h1>
#include "mainwindow.h"
#include "dialog.h"
#include <QtGui>
#include <QtSql>
#include <QtXml>
extern int uniqueAlbumId;
extern int uniqueArtistId;
MainWindow::MainWindow(const QString &artistTable, const QString &albumTable,
QFile *albumDetails, QWidget *parent)
: QMainWindow(parent)
{
file = albumDetails;
readAlbumData();
model = new <API key>(this);
model->setTable(albumTable);
model->setRelation(2, QSqlRelation(artistTable, "id", "artist"));
model->select();
QGroupBox *artists = <API key>();
QGroupBox *albums = createAlbumGroupBox();
QGroupBox *details = <API key>();
artistView->setCurrentIndex(0);
uniqueAlbumId = model->rowCount();
uniqueArtistId = artistView->count();
connect(model, SIGNAL(rowsInserted(QModelIndex, int, int)),
this, SLOT(updateHeader(QModelIndex, int, int)));
connect(model, SIGNAL(rowsRemoved(QModelIndex, int, int)),
this, SLOT(updateHeader(QModelIndex, int, int)));
QGridLayout *layout = new QGridLayout;
layout->addWidget(artists, 0, 0);
layout->addWidget(albums, 1, 0);
layout->addWidget(details, 0, 1, 2, 1);
layout->setColumnStretch(1, 1);
layout-><API key>(0, 500);
QWidget *widget = new QWidget;
widget->setLayout(layout);
setCentralWidget(widget);
createMenuBar();
showImageLabel();
resize(850, 400);
setWindowTitle(tr("Music Archive"));
}
void MainWindow::changeArtist(int row)
{
if (row > 0) {
QModelIndex index = model->relationModel(2)->index(row, 1);
model->setFilter("artist = '" + index.data().toString() + "'") ;
showArtistProfile(index);
} else if (row == 0) {
model->setFilter("");
showImageLabel();
} else {
return;
}
}
void MainWindow::showArtistProfile(QModelIndex index)
{
QSqlRecord record = model->relationModel(2)->record(index.row());
QString name = record.value("artist").toString();
QString count = record.value("albumcount").toString();
profileLabel->setText(tr("Artist : %1 \n" \
"Number of Albums: %2").arg(name).arg(count));
profileLabel->show();
iconLabel->show();
titleLabel->hide();
trackList->hide();
imageLabel->hide();
}
void MainWindow::showAlbumDetails(QModelIndex index)
{
QSqlRecord record = model->record(index.row());
QString artist = record.value("artist").toString();
QString title = record.value("title").toString();
QString year = record.value("year").toString();
QString albumId = record.value("albumid").toString();
showArtistProfile(indexOfArtist(artist));
titleLabel->setText(tr("Title: %1 (%2)").arg(title).arg(year));
titleLabel->show();
QDomNodeList albums = albumData.elementsByTagName("album");
for (int i = 0; i < albums.count(); i++) {
QDomNode album = albums.item(i);
if (album.toElement().attribute("id") == albumId) {
getTrackList(album.toElement());
break;
}
}
if (!trackList->count() == 0)
trackList->show();
}
void MainWindow::getTrackList(QDomNode album)
{
trackList->clear();
QDomNodeList tracks = album.childNodes();
QDomNode track;
QString trackNumber;
for (int j = 0; j < tracks.count(); j++) {
track = tracks.item(j);
trackNumber = track.toElement().attribute("number");
QListWidgetItem *item = new QListWidgetItem(trackList);
item->setText(trackNumber + ": " + track.toElement().text());
}
}
void MainWindow::addAlbum()
{
Dialog *dialog = new Dialog(model, albumData, file, this);
int accepted = dialog->exec();
if (accepted == 1) {
int lastRow = model->rowCount() - 1;
albumView->selectRow(lastRow);
albumView->scrollToBottom();
showAlbumDetails(model->index(lastRow, 0));
}
}
void MainWindow::deleteAlbum()
{
QModelIndexList selection = albumView->selectionModel()->selectedRows(0);
if (!selection.empty()) {
QModelIndex idIndex = selection.at(0);
int id = idIndex.data().toInt();
QString title = idIndex.sibling(idIndex.row(), 1).data().toString();
QString artist = idIndex.sibling(idIndex.row(), 2).data().toString();
QMessageBox::StandardButton button;
button = QMessageBox::question(this, tr("Delete Album"),
QString(tr("Are you sure you want to " \
"delete '%1' by '%2'?"))
.arg(title).arg(artist),
QMessageBox::Yes | QMessageBox::No);
if (button == QMessageBox::Yes) {
removeAlbumFromFile(id);
<API key>(idIndex);
decreaseAlbumCount(indexOfArtist(artist));
showImageLabel();
}
} else {
QMessageBox::information(this, tr("Delete Album"),
tr("Select the album you want to delete."));
}
}
void MainWindow::removeAlbumFromFile(int id)
{
QDomNodeList albums = albumData.elementsByTagName("album");
for (int i = 0; i < albums.count(); i++) {
QDomNode node = albums.item(i);
if (node.toElement().attribute("id").toInt() == id) {
albumData.elementsByTagName("archive").item(0).removeChild(node);
break;
}
}
<span class="comment"> /*
The following code is commented out since the example uses an in
memory database, i.e., altering the XML file will bring the data
out of sync.
if (!file->open(QIODevice::WriteOnly)) {
return;
} else {
QTextStream stream(file);
albumData.elementsByTagName("archive").item(0).save(stream, 4);
file->close();
}
*/</span>
}
void MainWindow::<API key>(QModelIndex index)
{
model->removeRow(index.row());
}
void MainWindow::decreaseAlbumCount(QModelIndex artistIndex)
{
int row = artistIndex.row();
QModelIndex albumCountIndex = artistIndex.sibling(row, 2);
int albumCount = albumCountIndex.data().toInt();
QSqlTableModel *artists = model->relationModel(2);
if (albumCount == 1) {
artists->removeRow(row);
showImageLabel();
} else {
artists->setData(albumCountIndex, QVariant(albumCount - 1));
}
}
void MainWindow::readAlbumData()
{
if (!file->open(QIODevice::ReadOnly))
return;
if (!albumData.setContent(file)) {
file->close();
return;
}
file->close();
}
QGroupBox* MainWindow::<API key>()
{
artistView = new QComboBox;
artistView->setModel(model->relationModel(2));
artistView->setModelColumn(1);
connect(artistView, SIGNAL(currentIndexChanged(int)),
this, SLOT(changeArtist(int)));
QGroupBox *box = new QGroupBox(tr("Artist"));
QGridLayout *layout = new QGridLayout;
layout->addWidget(artistView, 0, 0);
box->setLayout(layout);
return box;
}
QGroupBox* MainWindow::createAlbumGroupBox()
{
QGroupBox *box = new QGroupBox(tr("Album"));
albumView = new QTableView;
albumView->setEditTriggers(QAbstractItemView::NoEditTriggers);
albumView->setSortingEnabled(true);
albumView-><API key>(QAbstractItemView::SelectRows);
albumView->setSelectionMode(QAbstractItemView::SingleSelection);
albumView->setShowGrid(false);
albumView->verticalHeader()->hide();
albumView-><API key>(true);
albumView->setModel(model);
adjustHeader();
QLocale locale = albumView->locale();
locale.setNumberOptions(QLocale::OmitGroupSeparator);
albumView->setLocale(locale);
connect(albumView, SIGNAL(clicked(QModelIndex)),
this, SLOT(showAlbumDetails(QModelIndex)));
connect(albumView, SIGNAL(activated(QModelIndex)),
this, SLOT(showAlbumDetails(QModelIndex)));
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(albumView, 0, 0);
box->setLayout(layout);
return box;
}
QGroupBox* MainWindow::<API key>()
{
QGroupBox *box = new QGroupBox(tr("Details"));
profileLabel = new QLabel;
profileLabel->setWordWrap(true);
profileLabel->setAlignment(Qt::AlignBottom);
titleLabel = new QLabel;
titleLabel->setWordWrap(true);
titleLabel->setAlignment(Qt::AlignBottom);
iconLabel = new QLabel();
iconLabel->setAlignment(Qt::AlignBottom | Qt::AlignRight);
iconLabel->setPixmap(QPixmap(":/images/icon.png"));
imageLabel = new QLabel;
imageLabel->setWordWrap(true);
imageLabel->setAlignment(Qt::AlignCenter);
imageLabel->setPixmap(QPixmap(":/images/image.png"));
trackList = new QListWidget;
QGridLayout *layout = new QGridLayout;
layout->addWidget(imageLabel, 0, 0, 3, 2);
layout->addWidget(profileLabel, 0, 0);
layout->addWidget(iconLabel, 0, 1);
layout->addWidget(titleLabel, 1, 0, 1, 2);
layout->addWidget(trackList, 2, 0, 1, 2);
layout->setRowStretch(2, 1);
box->setLayout(layout);
return box;
}
void MainWindow::createMenuBar()
{
QAction *addAction = new QAction(tr("&Add album..."), this);
QAction *deleteAction = new QAction(tr("&Delete album..."), this);
QAction *quitAction = new QAction(tr("&Quit"), this);
QAction *aboutAction = new QAction(tr("&About"), this);
QAction *aboutQtAction = new QAction(tr("About &Qt"), this);
addAction->setShortcut(tr("Ctrl+A"));
deleteAction->setShortcut(tr("Ctrl+D"));
quitAction->setShortcut(tr("Ctrl+Q"));
QMenu *fileMenu = menuBar()->addMenu(tr("&File"));
fileMenu->addAction(addAction);
fileMenu->addAction(deleteAction);
fileMenu->addSeparator();
fileMenu->addAction(quitAction);
QMenu *helpMenu = menuBar()->addMenu(tr("&Help"));
helpMenu->addAction(aboutAction);
helpMenu->addAction(aboutQtAction);
connect(addAction, SIGNAL(triggered(bool)), this, SLOT(addAlbum()));
connect(deleteAction, SIGNAL(triggered(bool)), this, SLOT(deleteAlbum()));
connect(quitAction, SIGNAL(triggered(bool)), this, SLOT(close()));
connect(aboutAction, SIGNAL(triggered(bool)), this, SLOT(about()));
connect(aboutQtAction, SIGNAL(triggered(bool)), qApp, SLOT(aboutQt()));
}
void MainWindow::showImageLabel()
{
profileLabel->hide();
titleLabel->hide();
iconLabel->hide();
trackList->hide();
imageLabel->show();
}
QModelIndex MainWindow::indexOfArtist(const QString &artist)
{
QSqlTableModel *artistModel = model->relationModel(2);
for (int i = 0; i < artistModel->rowCount(); i++) {
QSqlRecord record = artistModel->record(i);
if (record.value("artist") == artist)
return artistModel->index(i, 1);
}
return QModelIndex();
}
void MainWindow::updateHeader(QModelIndex, int, int)
{
adjustHeader();
}
void MainWindow::adjustHeader()
{
albumView->hideColumn(0);
albumView->horizontalHeader()->setResizeMode(1, QHeaderView::Stretch);
albumView-><API key>(2);
albumView-><API key>(3);
}
void MainWindow::about()
{
QMessageBox::about(this, tr("About Music Archive"),
tr("<p>The <b>Music Archive</b> example shows how to present "
"data from different data sources in the same application. "
"The album titles, and the corresponding artists and release dates, "
"are kept in a database, while each album's tracks are stored "
"in an XML file. </p><p>The example also shows how to add as "
"well as remove data from both the database and the "
"associated XML file using the API provided by the QtSql and "
"QtXml modules, respectively.</p>"));
}</pre>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright © 2008 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.3.6</div></td>
</tr></table></div></address></body>
</html>
|
#include "queue.h"
#include <string.h>
#include <stdio.h>
typedef struct queue_element queue_element_t;
struct queue_element {
queue_element_t * next;
queue_element_t * prev;
queue_element_t * last;
void * payload;
};
void queue_add(queue_t * queue, void * ptr) {
if (*queue == NULL) {
queue_element_t * new_el = (queue_element_t *) malloc(sizeof(queue_element_t));
new_el->last = new_el;
new_el->next = NULL;
new_el->prev = NULL;
new_el->payload = ptr;
*queue = (void *) new_el;
} else {
queue_element_t * qe = (queue_element_t *) *queue;
queue_element_t * new_el = (queue_element_t *) malloc(sizeof(queue_element_t));
new_el->last = NULL;
new_el->next = NULL;
new_el->prev = qe->last;
new_el->payload = ptr;
qe->last->next = new_el;
qe->last = new_el;
}
}
void * queue_pop(queue_t * queue) {
if (*queue == NULL) return NULL;
queue_element_t * qe = (queue_element_t *) *queue;
if (qe->next != NULL) {
qe->next->prev = NULL;
qe->next->last = qe->last;
}
void * result = qe->payload;
*queue = (void *) qe->next;
free(qe);
return result;
}
/* Usage:
void queue_unit_test(void) {
queue_t queue = NULL;
int a = 1; int b = 3; int c = 5; int d = 18;
queue_add(&queue, (void *) &a);
queue_add(&queue, (void *) &b);
queue_add(&queue, (void *) &c);
queue_add(&queue, (void *) &d);
c = 12;
int * ans;
while ((ans = (int *) queue_pop(&queue)))
printf("%d ", *ans);
// prints out 1 3 12 18
}
*/
|
/* Some stuff to fetch, save and handle nicknames for your buddies */
void nick_set( account_t *acc, const char *handle, const char *nick );
char *nick_get( account_t *acc, const char *handle );
void nick_dedupe( account_t *acc, const char *handle, char nick[MAX_NICK_LENGTH+1] );
int nick_saved( account_t *acc, const char *handle );
void nick_del( account_t *acc, const char *handle );
void nick_strip( char *nick );
int nick_ok( const char *nick );
int nick_lc( char *nick );
int nick_uc( char *nick );
int nick_cmp( const char *a, const char *b );
char *nick_dup( const char *nick );
|
#include "BitArray.h"
namespace Rapid {
void BitArrayT::append(char const * Bytes, std::size_t Size)
{
mBytes.append(Bytes, Size);
}
std::size_t BitArrayT::size() const
{
return mBytes.size() * 8;
}
bool BitArrayT::operator[](std::size_t Index) const
{
auto ByteIndex = Index / 8;
auto BitIndex = Index % 8;
return static_cast<std::uint8_t>(mBytes[ByteIndex]) >> BitIndex & 0x1;
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.