code
stringlengths
3
1.05M
repo_name
stringlengths
4
116
path
stringlengths
3
942
language
stringclasses
30 values
license
stringclasses
15 values
size
int32
3
1.05M
--[=[ TR_INFO: request information about an active transaction this is the aux. library to encode the request buffer and decode the reply buffer. encode(options_t) -> encoded options string decode(info_buf, info_buf_len) -> decoded info table USAGE: - use it with isc_transaction_info() to encode the info request and decode the info result. - see info_codes table below for what you can request and the structure and meaning of the results. ]=] module(...,require 'fbclient.module') local info = require 'fbclient.info' local info_codes = { --read doc\sql.extensions\README.isc_info_xxx from firebird 2.5 sources for more info! isc_info_tra_id = 4, --number: current tran ID number isc_info_tra_oldest_interesting = 5, --number: oldest interesting tran ID when current tran started (firebird 2.0+) isc_info_tra_oldest_snapshot = 6, --number: min. tran ID of tra_oldest_active (firebird 2.0+) isc_info_tra_oldest_active = 7, --number: oldest active tran ID when current tran started (firebird 2.0+) isc_info_tra_isolation = 8, --pair: {one of isc_info_tra_isolation_flags, [one of isc_info_tra_read_committed_flags]}: (firebird 2.0+) isc_info_tra_access = 9, --string: 'isc_info_tra_readonly' or 'isc_info_tra_readwrite' (firebird 2.0+) isc_info_tra_lock_timeout = 10, --number: lock timeout value; fb 2.0+ } local info_code_lookup = index(info_codes) local info_buf_sizes = { isc_info_tra_id = INT_SIZE, isc_info_tra_oldest_interesting = INT_SIZE, isc_info_tra_oldest_snapshot = INT_SIZE, isc_info_tra_oldest_active = INT_SIZE, isc_info_tra_isolation = 1+1, -- for read_commited, you also get rec_version/no_rec_version flag! isc_info_tra_access = 1, isc_info_tra_lock_timeout = INT_SIZE, } local isc_info_tra_isolation_flags = { isc_info_tra_consistency = 1, isc_info_tra_concurrency = 2, isc_info_tra_read_committed = 3, } local isc_info_tra_read_committed_flags = { isc_info_tra_no_rec_version = 0, isc_info_tra_rec_version = 1, } local isc_info_tra_access_flags = { isc_info_tra_readonly = 0, isc_info_tra_readwrite = 1, } local decoders = { isc_info_tra_id = info.decode_unsigned, isc_info_tra_oldest_interesting = info.decode_unsigned, isc_info_tra_oldest_snapshot = info.decode_unsigned, isc_info_tra_oldest_active = info.decode_unsigned, isc_info_tra_isolation = function(s) local isolation = info.decode_enum(isc_info_tra_isolation_flags)(s:sub(1,1)) local read_commited_flag if isolation == 'isc_info_tra_read_committed' then read_commited_flag = info.decode_enum(isc_info_tra_read_committed_flags)(s:sub(2,2)) end return {isolation, read_commited_flag} end, isc_info_tra_access = info.decode_enum(isc_info_tra_access_flags), isc_info_tra_lock_timeout = info.decode_unsigned, } function encode(opts) return info.encode('TR_INFO', opts, info_codes, info_buf_sizes) end function decode(info_buf, info_buf_len) return info.decode('TR_INFO', info_buf, info_buf_len, info_code_lookup, decoders) end
tst2005googlecode/fbclient
lua/fbclient/tr_info.lua
Lua
mit
3,014
package runner import ( "strings" "testing" "gopkg.in/stretchr/testify.v1/assert" ) // https://wfuzz.googlecode.com/svn/trunk/wordlist/Injections/SQL.txt var fuzzList = ` ' " # - -- '%20-- --'; '%20; =%20' =%20; =%20-- \x23 \x27 \x3D%20\x3B' \x3D%20\x27 \x27\x4F\x52 SELECT * \x27\x6F\x72 SELECT * 'or%20select * admin'-- <>"'%;)(&+ '%20or%20''=' '%20or%20'x'='x "%20or%20"x"="x ')%20or%20('x'='x 0 or 1=1 ' or 0=0 -- " or 0=0 -- or 0=0 -- ' or 0=0 # " or 0=0 # or 0=0 # ' or 1=1-- " or 1=1-- ' or '1'='1'-- "' or 1 --'" or 1=1-- or%201=1 or%201=1 -- ' or 1=1 or ''=' " or 1=1 or ""=" ' or a=a-- " or "a"="a ') or ('a'='a ") or ("a"="a hi" or "a"="a hi" or 1=1 -- hi' or 1=1 -- hi' or 'a'='a hi') or ('a'='a hi") or ("a"="a 'hi' or 'x'='x'; @variable ,@variable PRINT PRINT @@variable select insert as or procedure limit order by asc desc delete update distinct having truncate replace like handler bfilename ' or username like '% ' or uname like '% ' or userid like '% ' or uid like '% ' or user like '% exec xp exec sp '; exec master..xp_cmdshell '; exec xp_regread t'exec master..xp_cmdshell 'nslookup www.google.com'-- --sp_password \x27UNION SELECT ' UNION SELECT ' UNION ALL SELECT ' or (EXISTS) ' (select top 1 '||UTL_HTTP.REQUEST 1;SELECT%20* to_timestamp_tz tz_offset &lt;&gt;&quot;'%;)(&amp;+ '%20or%201=1 %27%20or%201=1 %20$(sleep%2050) %20'sleep%2050' char%4039%41%2b%40SELECT &apos;%20OR 'sqlattempt1 (sqlattempt2) | %7C *| %2A%7C *(|(mail=*)) %2A%28%7C%28mail%3D%2A%29%29 *(|(objectclass=*)) %2A%28%7C%28objectclass%3D%2A%29%29 ( %28 ) %29 & %26 ! %21 ' or 1=1 or ''=' ' or ''=' x' or 1=1 or 'x'='y / // //* */* ` func init() { fuzzList += "\b" fuzzList += "\n" fuzzList += "\n" fuzzList += "\r" fuzzList += "\t" fuzzList += "Hello\tworld" } func TestSQLInjectionBuilder(t *testing.T) { for _, fuzz := range strings.Split(fuzzList, "\n") { if fuzz == "" { continue } fuzz = strings.Trim(fuzz, " \t") var id int64 var comment string err := testDB. InsertInto("comments"). Columns("comment"). Values(fuzz). SetIsInterpolated(true). Returning("id", "comment"). QueryScalar(&id, &comment) assert.True(t, id > 0) assert.Equal(t, fuzz, comment) var result int err = testDB.SQL(` SELECT 42 FROM comments WHERE id = $1 AND comment = $2 `, id, comment).QueryScalar(&result) assert.NoError(t, err) assert.Equal(t, 42, result) } } func TestSQLInjectionSQL(t *testing.T) { for _, fuzz := range strings.Split(fuzzList, "\n") { if fuzz == "" { continue } fuzz = strings.Trim(fuzz, " \t") var id int64 var comment string err := testDB. SQL(` INSERT INTO comments (comment) VALUES ($1) RETURNING id, comment `, fuzz). SetIsInterpolated(true). QueryScalar(&id, &comment) assert.True(t, id > 0) assert.Equal(t, fuzz, comment) var result int err = testDB.SQL(` SELECT 42 FROM comments WHERE id = $1 AND comment = $2 `, id, comment).QueryScalar(&result) assert.NoError(t, err) assert.Equal(t, 42, result) } }
mgutz/dat
sqlx-runner/sqli_test.go
GO
mit
3,048
ColorFrameReference.RelativeTime Property ========================================= Gets the timestamp of the referenced color frame. <span id="syntaxSection"></span> Syntax ====== <table> <colgroup> <col width="100%" /> </colgroup> <thead> <tr class="header"> <th align="left">C++</th> </tr> </thead> <tbody> <tr class="odd"> <td align="left"><pre><code>public: property TimeSpan RelativeTime { TimeSpan get (); }</code></pre></td> </tr> </tbody> </table> <table> <colgroup> <col width="100%" /> </colgroup> <thead> <tr class="header"> <th align="left">C#</th> </tr> </thead> <tbody> <tr class="odd"> <td align="left"><pre><code>public TimeSpan RelativeTime { get; }</code></pre></td> </tr> </tbody> </table> <table> <colgroup> <col width="100%" /> </colgroup> <thead> <tr class="header"> <th align="left">JavaScript</th> </tr> </thead> <tbody> <tr class="odd"> <td align="left"><pre><code>var relativeTime = colorFrameReference.relativeTime;</code></pre></td> </tr> </tbody> </table> <span id="ID4EU"></span> #### Property value [C++]  [C\#]  [JavaScript]  Type: [TimeSpan](http://msdn.microsoft.com/en-us/library/windows.foundation.timespan.aspx) Type: [TimeSpan](http://msdn.microsoft.com/en-us/library/system.timespan.aspx) Type: Number The timestamp of the referenced color frame. <span id="requirements"></span> Requirements ============ **Namespace:**WindowsPreview.Kinect **Metadata:**windowspreview.kinect.winmd <span id="ID4ECB"></span> See also ======== <span id="ID4EEB"></span> #### Reference [ColorFrameReference Class](../../ColorFrameReference_Class.md) [WindowsPreview.Kinect Namespace](../../../Kinect.md) <!--Please do not edit the data in the comment block below.--> <!-- TOCTitle : RelativeTime Property RLTitle : ColorFrameReference.RelativeTime Property KeywordK : RelativeTime property KeywordK : ColorFrameReference.RelativeTime property KeywordF : WindowsPreview.Kinect.ColorFrameReference.RelativeTime KeywordF : ColorFrameReference.RelativeTime KeywordF : RelativeTime KeywordF : WindowsPreview.Kinect.ColorFrameReference.RelativeTime KeywordA : P:WindowsPreview.Kinect.ColorFrameReference.RelativeTime AssetID : P:WindowsPreview.Kinect.ColorFrameReference.RelativeTime Locale : en-us CommunityContent : 1 APIType : Managed APILocation : windowspreview.kinect.winmd APIName : WindowsPreview.Kinect.ColorFrameReference.RelativeTime TargetOS : Windows TopicType : kbSyntax DevLang : VB DevLang : CSharp DevLang : JavaScript DevLang : C++ DocSet : K4Wv2 ProjType : K4Wv2Proj Technology : Kinect for Windows Product : Kinect for Windows SDK v2 productversion : 20 -->
UnaNancyOwen/Docs
Kinect4Windows2.0/k4w2/Reference/Kinect_for_Windows_v2/Kinect/ColorFrameReference_Class/Properties/RelativeTime_Property.md
Markdown
mit
2,675
import flask from donut import auth_utils from donut.modules.account import blueprint, helpers @blueprint.route("/request") def request_account(): """Provides a form to request an account.""" return flask.render_template("request_account.html") @blueprint.route("/request/submit", methods=["POST"]) def request_account_submit(): """Handles an account creation request.""" uid = flask.request.form.get("uid", None) last_name = flask.request.form.get("last_name", None) if uid is None or last_name is None: flask.flash("Invalid request.") return flask.redirect(flask.url_for("account.request_account")) success, error_msg = helpers.handle_request_account(uid, last_name) if success: flask.flash( "An email has been sent with a link to create your account.") return flask.redirect(flask.url_for("home")) else: flask.flash(error_msg) return flask.redirect(flask.url_for("account.request_account")) @blueprint.route("/create/<create_account_key>") def create_account(create_account_key): """Checks the key. If valid, displays the create account page.""" user_id = auth_utils.check_create_account_key(create_account_key) if user_id is None: flask.current_app.logger.warn( f'Invalid create_account_key: {create_account_key}') flask.flash("Invalid request. Please check your link and try again.") return flask.redirect(flask.url_for("home")) user_data = helpers.get_user_data(user_id) if user_data is None: flask.flash("An unexpected error occurred. Please contact DevTeam.") return flask.redirect(flask.url_for("home")) return flask.render_template( "create_account.html", user_data=user_data, key=create_account_key) @blueprint.route("/create/<create_account_key>/submit", methods=["POST"]) def create_account_submit(create_account_key): """Handles a create account request.""" user_id = auth_utils.check_create_account_key(create_account_key) if user_id is None: # Key is invalid. flask.current_app.logger.warn( f'Invalid create_account_key: {create_account_key}') flask.flash("Someone's been naughty.") return flask.redirect(flask.url_for("home")) username = flask.request.form.get("username", None) password = flask.request.form.get("password", None) password2 = flask.request.form.get("password2", None) if username is None \ or password is None \ or password2 is None: flask.current_app.logger.warn( f'Invalid create account form for user ID {user_id}') flask.flash("Invalid request.") return flask.redirect(flask.url_for("home")) if helpers.handle_create_account(user_id, username, password, password2): flask.session['username'] = username flask.current_app.logger.info( f'Created account with username {username} for user ID {user_id}') flask.flash("Account successfully created.") return flask.redirect(flask.url_for("home")) else: # Flashes already handled. return flask.redirect( flask.url_for( "account.create_account", create_account_key=create_account_key))
ASCIT/donut
donut/modules/account/routes.py
Python
mit
3,294
<!DOCTYPE html> <html ng-app="recoveryApp" lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="bower_components/angular/angular.js"></script> <script type="text/javascript" src="bower_components/sjcl/sjcl.js"></script> <script type="text/javascript" src="bower_components/bitcore/bitcore.min.js"></script> <script type="text/javascript" src="bower_components/bitcore/bitcore.js"></script> <script type="text/javascript" src="bower_components/bitcore-mnemonic/bitcore-mnemonic.min.js"></script> <script type="text/javascript" src="bower_components/jquery/dist/jquery.js"></script> <script type="text/javascript" src="bower_components/ng-lodash/build/ng-lodash.min.js"></script> <script type="text/javascript" src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script> <link rel="stylesheet" href="http://css-spinners.com/css/spinner/hexdots.css" type="text/css"> <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap-theme.min.css"> <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css"> <link rel="stylesheet" href="main.css"></link> <script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/md5.js"></script> <script type="text/javascript" src="js/services.js"></script> <script type="text/javascript" src="js/controllers.js"></script> <title>Copay recovery tool</title> </head> <div id="wrapper"> <header class="page-header"> <div class="container"> <img src="./img/logo-white.svg" alt="Copay" width="100" style="vertical-align: middle";> <span class="label">recovery tool</span> <ul class="pull-right"> <li><a href="https://github.com/bitpay/copay-recovery">View the Code</a></li> </ul> </div> </header> <body ng-controller="recoveryController" style="background-color:#F4F6F9"> <div class="container"> <div id="sendBlock" style="display: none;"> <div class="form-group"> <label>{{totalBalance}}</label> <div class="input-group"> <div class="input-group-addon" >Destination Address :</div> <input type="text" class="form-control" ng-model="addr"> </div> </div> <button class="btn btn-primary" ng-click="sendFunds()">Transfer</button><br><br> </div> <div id="inputs"> <h4>Wallet configuration:</h4> <div class="row"> <div class="col-md-3"> <label>Required signatures</label> <select class="pull-right" id="selectM"> <option id="1">1</option> <option id="2">2</option> <option id="3">3</option> <option id="4">4</option> <option id="5">5</option> <option id="6">6</option> </select><br> <label>Total Copayers</label> <select class="pull-right" id="selectN"> <option id="1">1</option> <option id="2">2</option> <option id="3">3</option> <option id="4">4</option> <option id="5">5</option> <option id="6">6</option> </select><br> <label>Network</label> <select class="pull-right" id="selectNet"> <option id="livenet">Livenet</option> <option id="testnet">Testnet</option> </select><br><br> </div> </div> <div class="form-group" id="block1"> <label>Backup for copayer 1:</label> <div class="form-group" id="backup1"> <input type="text" class="form-control" ng-model="backUp[1]" placeholder="Mnemonic or export wallet data"> </div> <div class="form-group" id="backupFile1"> <label>Or upload a file: </label> <input type="file" ng-model="file1" on-read-file="showContent($fileContent, 1)" accept="application/json, .txt" style="display: inline"> </div> <div class="form-group" id="password1"> <label>Password:</label> <input type="password" class="form-control" ng-model="pass[1]"> </div> <div class="form-goup" id="passwordX1"> <br> <label>Encrypted private key password (in case you have one):</label> <input type="password" class="form-control" ng-model="passX[1]" id="passX1"> </div><hr> </div> <div id="block2" style="display: none"> <label>Backup for copayer 2:</label> <br> <div class="form-group" id="backup2"> <input type="text" class="form-control" ng-model="backUp[2]" placeholder="Mnemonic or export wallet data"> </div> <div class="form-group" id="backupFile2"> <label>Or upload a file: </label> <input type="file" ng-model="file2" on-read-file="showContent($fileContent, 2)" accept="application/json, .txt" style="display: inline"> </div> <div class="form-group" id="password2"> <label>Password:</label> <input type="password" class="form-control" ng-model="pass[2]"> </div> <div class="form-goup" id="passwordX2"> <br> <label>Encrypted private key password (in case you have one):</label> <input type="password" class="form-control" ng-model="passX[2]" id="passX2"> </div><hr> </div> <div id="block3" style="display: none"> <label>Backup for copayer 3:</label> <br> <div class="form-group" id="backup3"> <input type="text" class="form-control" ng-model="backUp[3]" placeholder="Mnemonic or export wallet data"> </div> <div class="form-group" id="backupFile3"> <label>Or upload a file: </label> <input type="file" ng-model="file3" on-read-file="showContent($fileContent, 3)" accept="application/json, .txt" style="display: inline"> </div> <div class="form-group" id="password3"> <label>Password:</label> <input type="password" class="form-control" ng-model="pass[3]"> </div> <div class="form-goup" id="passwordX3"> <br> <label>Encrypted private key password (in case you have one):</label> <input type="password" class="form-control" ng-model="passX[3]" id="passX3"> </div><hr> </div> <div id="block4" style="display: none"> <br> <label>Backup for copayer 4:</label> <br> <div class="form-group" id="backup4"> <input type="text" class="form-control" ng-model="backUp[4]" placeholder="Mnemonic or export wallet data"> </div> <div class="form-group" id="backupFile4"> <label>Or upload a file: </label> <input type="file" ng-model="file4" on-read-file="showContent($fileContent, 4)" accept="application/json, .txt" style="display: inline"> </div> <div class="form-group" id="password4"> <label>Password:</label> <input type="password" class="form-control" ng-model="pass[4]"> </div> <div class="form-goup" id="passwordX4"> <br> <label>Encrypted private key password (in case you have one):</label> <input type="password" class="form-control" ng-model="passX[4]" id="passX4"> </div><hr> </div> <div id="block5" style="display: none"> <br> <label>Backup for copayer 5:</label> <br> <div class="form-group" id="backup5"> <input type="text" class="form-control" ng-model="backUp[5]" placeholder="Mnemonic or export wallet data"> </div> <div class="form-group" id="backupFile5"> <label>Or upload a file: </label> <input type="file" ng-model="file5" on-read-file="showContent($fileContent, 5)" accept="application/json, .txt" style="display: inline"> </div> <div class="form-group" id="password5"> <label>Password:</label> <input type="password" class="form-control" ng-model="pass[5]"> </div> <div class="form-goup" id="passwordX5"> <br> <label>Encrypted private key password (in case you have one):</label> <input type="password" class="form-control" ng-model="passX[5]" id="passX5"> </div><hr> </div> <div id="block6" style="display: none"> <br> <label>Backup for copayer 6:</label> <br> <div class="form-group" id="backup6"> <input type="text" class="form-control" ng-model="backUp[6]" placeholder="Mnemonic or export wallet data"> </div> <div class="form-group" id="backupFile6"> <label>Or upload a file: </label> <input type="file" ng-model="file6" on-read-file="showContent($fileContent, 6)" accept="application/json, .txt" style="display: inline"> </div> <div class="form-group" id="password6"> <label>Password:</label> <input type="password" class="form-control" ng-model="pass[6]"> </div> <div class="form-goup" id="passwordX6"> <br> <label>Encrypted private key password (in case you have one):</label> <input type="password" class="form-control" ng-model="passX[6]" id="passX6"> </div><hr> </div> <button class="btn btn-primary" ng-click="proccessInputs()">Scan wallet</button><br><br> </div> <div class="modal fade" id="myModal" data-backdrop="static" data-keyboard="false"> <div class="modal-dialog" style="position: absolute;display: block;top: 50%;left: 50%;"> <!-- Modal content--> <div class="hexdots-loader" ></div> </div> </div> <div id="successMessage" class="alert alert-success" style="display: none;"> {{successMessage}} </div> <div id="errorMessage" class="alert alert-danger" style="display: none;"> {{errorMessage}} </div> <div id="statusMessage" class="alert alert-info" style="display: none;"> {{statusMessage}} </div> </div> </body> <footer class="page-footer"> <div id="back" style="display: none"> <ul> <li><a href="http://bitpay.github.io/copay-recovery/">Back</a></li> </ul> </div> </footer> </div> </html>
bechi/copay-recovery
index.html
HTML
mit
12,586
package org.ominidi.api.controller; import org.ominidi.api.exception.ConnectionException; import org.ominidi.api.exception.NotFoundException; import org.ominidi.api.model.Errors; import org.ominidi.domain.model.Feed; import org.ominidi.domain.model.Post; import org.ominidi.facebook.service.PageFeedService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.*; import java.util.Optional; @RestController @RequestMapping("/api/v1") public class FeedController { private PageFeedService pageFeedService; @Autowired public FeedController(PageFeedService pageFeedService) { this.pageFeedService = pageFeedService; } @GetMapping(value = "/feed", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public Feed<Post> getFeed(@RequestParam(value = "u", required = false) Optional<String> feedUrl) { Optional<Feed<Post>> result = feedUrl.isPresent() ? pageFeedService.getFeed(feedUrl.get()) : pageFeedService.getFeed(); return result.orElseThrow(() -> new ConnectionException(Errors.CONNECTION_PROBLEM)); } @GetMapping(value = "/post/{id}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public Post getPost(@PathVariable(value = "id") String id) { return pageFeedService.getPostById(id).orElseThrow(() -> new NotFoundException(Errors.postNotFound(id))); } }
ominidi/ominidi-web
src/main/java/org/ominidi/api/controller/FeedController.java
Java
mit
1,506
#include "jsonobject.h" #include "jsonparser.h" namespace amgcommon { namespace json { JsonObject::JsonObject(string rawJson) { this->originalJson = rawJson; this->root = JsonNode(); } JsonObject::JsonObject(const JsonObject &a) { this->originalJson = a.originalJson; this->root = a.root; } JsonObject *JsonObject::clone() { return new JsonObject(*this); } JsonObject::~JsonObject() { } string JsonObject::toString() { return this->root.toString(); } JsonNode JsonObject::getRoot() { return root; } void JsonObject::setKey(string path, Object *value) { this->root.setKey(path, value); } Object *JsonObject::getKey(string path) { return this->root.getKey(path); } } }
agancsos/cpp
amgbuildagent/src/classes/amgcommon/json/jsonobject.cpp
C++
mit
1,076
default rel %define XMMWORD %define YMMWORD %define ZMMWORD section .text code align=64 EXTERN OPENSSL_ia32cap_P global sha1_block_data_order ALIGN 16 sha1_block_data_order: mov QWORD[8+rsp],rdi ;WIN64 prologue mov QWORD[16+rsp],rsi mov rax,rsp $L$SEH_begin_sha1_block_data_order: mov rdi,rcx mov rsi,rdx mov rdx,r8 lea r10,[OPENSSL_ia32cap_P] mov r9d,DWORD[r10] mov r8d,DWORD[4+r10] mov r10d,DWORD[8+r10] test r8d,512 jz NEAR $L$ialu and r8d,268435456 and r9d,1073741824 or r8d,r9d cmp r8d,1342177280 je NEAR _avx_shortcut jmp NEAR _ssse3_shortcut ALIGN 16 $L$ialu: mov rax,rsp push rbx push rbp push r12 push r13 push r14 mov r8,rdi sub rsp,72 mov r9,rsi and rsp,-64 mov r10,rdx mov QWORD[64+rsp],rax $L$prologue: mov esi,DWORD[r8] mov edi,DWORD[4+r8] mov r11d,DWORD[8+r8] mov r12d,DWORD[12+r8] mov r13d,DWORD[16+r8] jmp NEAR $L$loop ALIGN 16 $L$loop: mov edx,DWORD[r9] bswap edx mov ebp,DWORD[4+r9] mov eax,r12d mov DWORD[rsp],edx mov ecx,esi bswap ebp xor eax,r11d rol ecx,5 and eax,edi lea r13d,[1518500249+r13*1+rdx] add r13d,ecx xor eax,r12d rol edi,30 add r13d,eax mov r14d,DWORD[8+r9] mov eax,r11d mov DWORD[4+rsp],ebp mov ecx,r13d bswap r14d xor eax,edi rol ecx,5 and eax,esi lea r12d,[1518500249+r12*1+rbp] add r12d,ecx xor eax,r11d rol esi,30 add r12d,eax mov edx,DWORD[12+r9] mov eax,edi mov DWORD[8+rsp],r14d mov ecx,r12d bswap edx xor eax,esi rol ecx,5 and eax,r13d lea r11d,[1518500249+r11*1+r14] add r11d,ecx xor eax,edi rol r13d,30 add r11d,eax mov ebp,DWORD[16+r9] mov eax,esi mov DWORD[12+rsp],edx mov ecx,r11d bswap ebp xor eax,r13d rol ecx,5 and eax,r12d lea edi,[1518500249+rdi*1+rdx] add edi,ecx xor eax,esi rol r12d,30 add edi,eax mov r14d,DWORD[20+r9] mov eax,r13d mov DWORD[16+rsp],ebp mov ecx,edi bswap r14d xor eax,r12d rol ecx,5 and eax,r11d lea esi,[1518500249+rsi*1+rbp] add esi,ecx xor eax,r13d rol r11d,30 add esi,eax mov edx,DWORD[24+r9] mov eax,r12d mov DWORD[20+rsp],r14d mov ecx,esi bswap edx xor eax,r11d rol ecx,5 and eax,edi lea r13d,[1518500249+r13*1+r14] add r13d,ecx xor eax,r12d rol edi,30 add r13d,eax mov ebp,DWORD[28+r9] mov eax,r11d mov DWORD[24+rsp],edx mov ecx,r13d bswap ebp xor eax,edi rol ecx,5 and eax,esi lea r12d,[1518500249+r12*1+rdx] add r12d,ecx xor eax,r11d rol esi,30 add r12d,eax mov r14d,DWORD[32+r9] mov eax,edi mov DWORD[28+rsp],ebp mov ecx,r12d bswap r14d xor eax,esi rol ecx,5 and eax,r13d lea r11d,[1518500249+r11*1+rbp] add r11d,ecx xor eax,edi rol r13d,30 add r11d,eax mov edx,DWORD[36+r9] mov eax,esi mov DWORD[32+rsp],r14d mov ecx,r11d bswap edx xor eax,r13d rol ecx,5 and eax,r12d lea edi,[1518500249+rdi*1+r14] add edi,ecx xor eax,esi rol r12d,30 add edi,eax mov ebp,DWORD[40+r9] mov eax,r13d mov DWORD[36+rsp],edx mov ecx,edi bswap ebp xor eax,r12d rol ecx,5 and eax,r11d lea esi,[1518500249+rsi*1+rdx] add esi,ecx xor eax,r13d rol r11d,30 add esi,eax mov r14d,DWORD[44+r9] mov eax,r12d mov DWORD[40+rsp],ebp mov ecx,esi bswap r14d xor eax,r11d rol ecx,5 and eax,edi lea r13d,[1518500249+r13*1+rbp] add r13d,ecx xor eax,r12d rol edi,30 add r13d,eax mov edx,DWORD[48+r9] mov eax,r11d mov DWORD[44+rsp],r14d mov ecx,r13d bswap edx xor eax,edi rol ecx,5 and eax,esi lea r12d,[1518500249+r12*1+r14] add r12d,ecx xor eax,r11d rol esi,30 add r12d,eax mov ebp,DWORD[52+r9] mov eax,edi mov DWORD[48+rsp],edx mov ecx,r12d bswap ebp xor eax,esi rol ecx,5 and eax,r13d lea r11d,[1518500249+r11*1+rdx] add r11d,ecx xor eax,edi rol r13d,30 add r11d,eax mov r14d,DWORD[56+r9] mov eax,esi mov DWORD[52+rsp],ebp mov ecx,r11d bswap r14d xor eax,r13d rol ecx,5 and eax,r12d lea edi,[1518500249+rdi*1+rbp] add edi,ecx xor eax,esi rol r12d,30 add edi,eax mov edx,DWORD[60+r9] mov eax,r13d mov DWORD[56+rsp],r14d mov ecx,edi bswap edx xor eax,r12d rol ecx,5 and eax,r11d lea esi,[1518500249+rsi*1+r14] add esi,ecx xor eax,r13d rol r11d,30 add esi,eax xor ebp,DWORD[rsp] mov eax,r12d mov DWORD[60+rsp],edx mov ecx,esi xor ebp,DWORD[8+rsp] xor eax,r11d rol ecx,5 xor ebp,DWORD[32+rsp] and eax,edi lea r13d,[1518500249+r13*1+rdx] rol edi,30 xor eax,r12d add r13d,ecx rol ebp,1 add r13d,eax xor r14d,DWORD[4+rsp] mov eax,r11d mov DWORD[rsp],ebp mov ecx,r13d xor r14d,DWORD[12+rsp] xor eax,edi rol ecx,5 xor r14d,DWORD[36+rsp] and eax,esi lea r12d,[1518500249+r12*1+rbp] rol esi,30 xor eax,r11d add r12d,ecx rol r14d,1 add r12d,eax xor edx,DWORD[8+rsp] mov eax,edi mov DWORD[4+rsp],r14d mov ecx,r12d xor edx,DWORD[16+rsp] xor eax,esi rol ecx,5 xor edx,DWORD[40+rsp] and eax,r13d lea r11d,[1518500249+r11*1+r14] rol r13d,30 xor eax,edi add r11d,ecx rol edx,1 add r11d,eax xor ebp,DWORD[12+rsp] mov eax,esi mov DWORD[8+rsp],edx mov ecx,r11d xor ebp,DWORD[20+rsp] xor eax,r13d rol ecx,5 xor ebp,DWORD[44+rsp] and eax,r12d lea edi,[1518500249+rdi*1+rdx] rol r12d,30 xor eax,esi add edi,ecx rol ebp,1 add edi,eax xor r14d,DWORD[16+rsp] mov eax,r13d mov DWORD[12+rsp],ebp mov ecx,edi xor r14d,DWORD[24+rsp] xor eax,r12d rol ecx,5 xor r14d,DWORD[48+rsp] and eax,r11d lea esi,[1518500249+rsi*1+rbp] rol r11d,30 xor eax,r13d add esi,ecx rol r14d,1 add esi,eax xor edx,DWORD[20+rsp] mov eax,edi mov DWORD[16+rsp],r14d mov ecx,esi xor edx,DWORD[28+rsp] xor eax,r12d rol ecx,5 xor edx,DWORD[52+rsp] lea r13d,[1859775393+r13*1+r14] xor eax,r11d add r13d,ecx rol edi,30 add r13d,eax rol edx,1 xor ebp,DWORD[24+rsp] mov eax,esi mov DWORD[20+rsp],edx mov ecx,r13d xor ebp,DWORD[32+rsp] xor eax,r11d rol ecx,5 xor ebp,DWORD[56+rsp] lea r12d,[1859775393+r12*1+rdx] xor eax,edi add r12d,ecx rol esi,30 add r12d,eax rol ebp,1 xor r14d,DWORD[28+rsp] mov eax,r13d mov DWORD[24+rsp],ebp mov ecx,r12d xor r14d,DWORD[36+rsp] xor eax,edi rol ecx,5 xor r14d,DWORD[60+rsp] lea r11d,[1859775393+r11*1+rbp] xor eax,esi add r11d,ecx rol r13d,30 add r11d,eax rol r14d,1 xor edx,DWORD[32+rsp] mov eax,r12d mov DWORD[28+rsp],r14d mov ecx,r11d xor edx,DWORD[40+rsp] xor eax,esi rol ecx,5 xor edx,DWORD[rsp] lea edi,[1859775393+rdi*1+r14] xor eax,r13d add edi,ecx rol r12d,30 add edi,eax rol edx,1 xor ebp,DWORD[36+rsp] mov eax,r11d mov DWORD[32+rsp],edx mov ecx,edi xor ebp,DWORD[44+rsp] xor eax,r13d rol ecx,5 xor ebp,DWORD[4+rsp] lea esi,[1859775393+rsi*1+rdx] xor eax,r12d add esi,ecx rol r11d,30 add esi,eax rol ebp,1 xor r14d,DWORD[40+rsp] mov eax,edi mov DWORD[36+rsp],ebp mov ecx,esi xor r14d,DWORD[48+rsp] xor eax,r12d rol ecx,5 xor r14d,DWORD[8+rsp] lea r13d,[1859775393+r13*1+rbp] xor eax,r11d add r13d,ecx rol edi,30 add r13d,eax rol r14d,1 xor edx,DWORD[44+rsp] mov eax,esi mov DWORD[40+rsp],r14d mov ecx,r13d xor edx,DWORD[52+rsp] xor eax,r11d rol ecx,5 xor edx,DWORD[12+rsp] lea r12d,[1859775393+r12*1+r14] xor eax,edi add r12d,ecx rol esi,30 add r12d,eax rol edx,1 xor ebp,DWORD[48+rsp] mov eax,r13d mov DWORD[44+rsp],edx mov ecx,r12d xor ebp,DWORD[56+rsp] xor eax,edi rol ecx,5 xor ebp,DWORD[16+rsp] lea r11d,[1859775393+r11*1+rdx] xor eax,esi add r11d,ecx rol r13d,30 add r11d,eax rol ebp,1 xor r14d,DWORD[52+rsp] mov eax,r12d mov DWORD[48+rsp],ebp mov ecx,r11d xor r14d,DWORD[60+rsp] xor eax,esi rol ecx,5 xor r14d,DWORD[20+rsp] lea edi,[1859775393+rdi*1+rbp] xor eax,r13d add edi,ecx rol r12d,30 add edi,eax rol r14d,1 xor edx,DWORD[56+rsp] mov eax,r11d mov DWORD[52+rsp],r14d mov ecx,edi xor edx,DWORD[rsp] xor eax,r13d rol ecx,5 xor edx,DWORD[24+rsp] lea esi,[1859775393+rsi*1+r14] xor eax,r12d add esi,ecx rol r11d,30 add esi,eax rol edx,1 xor ebp,DWORD[60+rsp] mov eax,edi mov DWORD[56+rsp],edx mov ecx,esi xor ebp,DWORD[4+rsp] xor eax,r12d rol ecx,5 xor ebp,DWORD[28+rsp] lea r13d,[1859775393+r13*1+rdx] xor eax,r11d add r13d,ecx rol edi,30 add r13d,eax rol ebp,1 xor r14d,DWORD[rsp] mov eax,esi mov DWORD[60+rsp],ebp mov ecx,r13d xor r14d,DWORD[8+rsp] xor eax,r11d rol ecx,5 xor r14d,DWORD[32+rsp] lea r12d,[1859775393+r12*1+rbp] xor eax,edi add r12d,ecx rol esi,30 add r12d,eax rol r14d,1 xor edx,DWORD[4+rsp] mov eax,r13d mov DWORD[rsp],r14d mov ecx,r12d xor edx,DWORD[12+rsp] xor eax,edi rol ecx,5 xor edx,DWORD[36+rsp] lea r11d,[1859775393+r11*1+r14] xor eax,esi add r11d,ecx rol r13d,30 add r11d,eax rol edx,1 xor ebp,DWORD[8+rsp] mov eax,r12d mov DWORD[4+rsp],edx mov ecx,r11d xor ebp,DWORD[16+rsp] xor eax,esi rol ecx,5 xor ebp,DWORD[40+rsp] lea edi,[1859775393+rdi*1+rdx] xor eax,r13d add edi,ecx rol r12d,30 add edi,eax rol ebp,1 xor r14d,DWORD[12+rsp] mov eax,r11d mov DWORD[8+rsp],ebp mov ecx,edi xor r14d,DWORD[20+rsp] xor eax,r13d rol ecx,5 xor r14d,DWORD[44+rsp] lea esi,[1859775393+rsi*1+rbp] xor eax,r12d add esi,ecx rol r11d,30 add esi,eax rol r14d,1 xor edx,DWORD[16+rsp] mov eax,edi mov DWORD[12+rsp],r14d mov ecx,esi xor edx,DWORD[24+rsp] xor eax,r12d rol ecx,5 xor edx,DWORD[48+rsp] lea r13d,[1859775393+r13*1+r14] xor eax,r11d add r13d,ecx rol edi,30 add r13d,eax rol edx,1 xor ebp,DWORD[20+rsp] mov eax,esi mov DWORD[16+rsp],edx mov ecx,r13d xor ebp,DWORD[28+rsp] xor eax,r11d rol ecx,5 xor ebp,DWORD[52+rsp] lea r12d,[1859775393+r12*1+rdx] xor eax,edi add r12d,ecx rol esi,30 add r12d,eax rol ebp,1 xor r14d,DWORD[24+rsp] mov eax,r13d mov DWORD[20+rsp],ebp mov ecx,r12d xor r14d,DWORD[32+rsp] xor eax,edi rol ecx,5 xor r14d,DWORD[56+rsp] lea r11d,[1859775393+r11*1+rbp] xor eax,esi add r11d,ecx rol r13d,30 add r11d,eax rol r14d,1 xor edx,DWORD[28+rsp] mov eax,r12d mov DWORD[24+rsp],r14d mov ecx,r11d xor edx,DWORD[36+rsp] xor eax,esi rol ecx,5 xor edx,DWORD[60+rsp] lea edi,[1859775393+rdi*1+r14] xor eax,r13d add edi,ecx rol r12d,30 add edi,eax rol edx,1 xor ebp,DWORD[32+rsp] mov eax,r11d mov DWORD[28+rsp],edx mov ecx,edi xor ebp,DWORD[40+rsp] xor eax,r13d rol ecx,5 xor ebp,DWORD[rsp] lea esi,[1859775393+rsi*1+rdx] xor eax,r12d add esi,ecx rol r11d,30 add esi,eax rol ebp,1 xor r14d,DWORD[36+rsp] mov eax,r12d mov DWORD[32+rsp],ebp mov ebx,r12d xor r14d,DWORD[44+rsp] and eax,r11d mov ecx,esi xor r14d,DWORD[4+rsp] lea r13d,[((-1894007588))+r13*1+rbp] xor ebx,r11d rol ecx,5 add r13d,eax rol r14d,1 and ebx,edi add r13d,ecx rol edi,30 add r13d,ebx xor edx,DWORD[40+rsp] mov eax,r11d mov DWORD[36+rsp],r14d mov ebx,r11d xor edx,DWORD[48+rsp] and eax,edi mov ecx,r13d xor edx,DWORD[8+rsp] lea r12d,[((-1894007588))+r12*1+r14] xor ebx,edi rol ecx,5 add r12d,eax rol edx,1 and ebx,esi add r12d,ecx rol esi,30 add r12d,ebx xor ebp,DWORD[44+rsp] mov eax,edi mov DWORD[40+rsp],edx mov ebx,edi xor ebp,DWORD[52+rsp] and eax,esi mov ecx,r12d xor ebp,DWORD[12+rsp] lea r11d,[((-1894007588))+r11*1+rdx] xor ebx,esi rol ecx,5 add r11d,eax rol ebp,1 and ebx,r13d add r11d,ecx rol r13d,30 add r11d,ebx xor r14d,DWORD[48+rsp] mov eax,esi mov DWORD[44+rsp],ebp mov ebx,esi xor r14d,DWORD[56+rsp] and eax,r13d mov ecx,r11d xor r14d,DWORD[16+rsp] lea edi,[((-1894007588))+rdi*1+rbp] xor ebx,r13d rol ecx,5 add edi,eax rol r14d,1 and ebx,r12d add edi,ecx rol r12d,30 add edi,ebx xor edx,DWORD[52+rsp] mov eax,r13d mov DWORD[48+rsp],r14d mov ebx,r13d xor edx,DWORD[60+rsp] and eax,r12d mov ecx,edi xor edx,DWORD[20+rsp] lea esi,[((-1894007588))+rsi*1+r14] xor ebx,r12d rol ecx,5 add esi,eax rol edx,1 and ebx,r11d add esi,ecx rol r11d,30 add esi,ebx xor ebp,DWORD[56+rsp] mov eax,r12d mov DWORD[52+rsp],edx mov ebx,r12d xor ebp,DWORD[rsp] and eax,r11d mov ecx,esi xor ebp,DWORD[24+rsp] lea r13d,[((-1894007588))+r13*1+rdx] xor ebx,r11d rol ecx,5 add r13d,eax rol ebp,1 and ebx,edi add r13d,ecx rol edi,30 add r13d,ebx xor r14d,DWORD[60+rsp] mov eax,r11d mov DWORD[56+rsp],ebp mov ebx,r11d xor r14d,DWORD[4+rsp] and eax,edi mov ecx,r13d xor r14d,DWORD[28+rsp] lea r12d,[((-1894007588))+r12*1+rbp] xor ebx,edi rol ecx,5 add r12d,eax rol r14d,1 and ebx,esi add r12d,ecx rol esi,30 add r12d,ebx xor edx,DWORD[rsp] mov eax,edi mov DWORD[60+rsp],r14d mov ebx,edi xor edx,DWORD[8+rsp] and eax,esi mov ecx,r12d xor edx,DWORD[32+rsp] lea r11d,[((-1894007588))+r11*1+r14] xor ebx,esi rol ecx,5 add r11d,eax rol edx,1 and ebx,r13d add r11d,ecx rol r13d,30 add r11d,ebx xor ebp,DWORD[4+rsp] mov eax,esi mov DWORD[rsp],edx mov ebx,esi xor ebp,DWORD[12+rsp] and eax,r13d mov ecx,r11d xor ebp,DWORD[36+rsp] lea edi,[((-1894007588))+rdi*1+rdx] xor ebx,r13d rol ecx,5 add edi,eax rol ebp,1 and ebx,r12d add edi,ecx rol r12d,30 add edi,ebx xor r14d,DWORD[8+rsp] mov eax,r13d mov DWORD[4+rsp],ebp mov ebx,r13d xor r14d,DWORD[16+rsp] and eax,r12d mov ecx,edi xor r14d,DWORD[40+rsp] lea esi,[((-1894007588))+rsi*1+rbp] xor ebx,r12d rol ecx,5 add esi,eax rol r14d,1 and ebx,r11d add esi,ecx rol r11d,30 add esi,ebx xor edx,DWORD[12+rsp] mov eax,r12d mov DWORD[8+rsp],r14d mov ebx,r12d xor edx,DWORD[20+rsp] and eax,r11d mov ecx,esi xor edx,DWORD[44+rsp] lea r13d,[((-1894007588))+r13*1+r14] xor ebx,r11d rol ecx,5 add r13d,eax rol edx,1 and ebx,edi add r13d,ecx rol edi,30 add r13d,ebx xor ebp,DWORD[16+rsp] mov eax,r11d mov DWORD[12+rsp],edx mov ebx,r11d xor ebp,DWORD[24+rsp] and eax,edi mov ecx,r13d xor ebp,DWORD[48+rsp] lea r12d,[((-1894007588))+r12*1+rdx] xor ebx,edi rol ecx,5 add r12d,eax rol ebp,1 and ebx,esi add r12d,ecx rol esi,30 add r12d,ebx xor r14d,DWORD[20+rsp] mov eax,edi mov DWORD[16+rsp],ebp mov ebx,edi xor r14d,DWORD[28+rsp] and eax,esi mov ecx,r12d xor r14d,DWORD[52+rsp] lea r11d,[((-1894007588))+r11*1+rbp] xor ebx,esi rol ecx,5 add r11d,eax rol r14d,1 and ebx,r13d add r11d,ecx rol r13d,30 add r11d,ebx xor edx,DWORD[24+rsp] mov eax,esi mov DWORD[20+rsp],r14d mov ebx,esi xor edx,DWORD[32+rsp] and eax,r13d mov ecx,r11d xor edx,DWORD[56+rsp] lea edi,[((-1894007588))+rdi*1+r14] xor ebx,r13d rol ecx,5 add edi,eax rol edx,1 and ebx,r12d add edi,ecx rol r12d,30 add edi,ebx xor ebp,DWORD[28+rsp] mov eax,r13d mov DWORD[24+rsp],edx mov ebx,r13d xor ebp,DWORD[36+rsp] and eax,r12d mov ecx,edi xor ebp,DWORD[60+rsp] lea esi,[((-1894007588))+rsi*1+rdx] xor ebx,r12d rol ecx,5 add esi,eax rol ebp,1 and ebx,r11d add esi,ecx rol r11d,30 add esi,ebx xor r14d,DWORD[32+rsp] mov eax,r12d mov DWORD[28+rsp],ebp mov ebx,r12d xor r14d,DWORD[40+rsp] and eax,r11d mov ecx,esi xor r14d,DWORD[rsp] lea r13d,[((-1894007588))+r13*1+rbp] xor ebx,r11d rol ecx,5 add r13d,eax rol r14d,1 and ebx,edi add r13d,ecx rol edi,30 add r13d,ebx xor edx,DWORD[36+rsp] mov eax,r11d mov DWORD[32+rsp],r14d mov ebx,r11d xor edx,DWORD[44+rsp] and eax,edi mov ecx,r13d xor edx,DWORD[4+rsp] lea r12d,[((-1894007588))+r12*1+r14] xor ebx,edi rol ecx,5 add r12d,eax rol edx,1 and ebx,esi add r12d,ecx rol esi,30 add r12d,ebx xor ebp,DWORD[40+rsp] mov eax,edi mov DWORD[36+rsp],edx mov ebx,edi xor ebp,DWORD[48+rsp] and eax,esi mov ecx,r12d xor ebp,DWORD[8+rsp] lea r11d,[((-1894007588))+r11*1+rdx] xor ebx,esi rol ecx,5 add r11d,eax rol ebp,1 and ebx,r13d add r11d,ecx rol r13d,30 add r11d,ebx xor r14d,DWORD[44+rsp] mov eax,esi mov DWORD[40+rsp],ebp mov ebx,esi xor r14d,DWORD[52+rsp] and eax,r13d mov ecx,r11d xor r14d,DWORD[12+rsp] lea edi,[((-1894007588))+rdi*1+rbp] xor ebx,r13d rol ecx,5 add edi,eax rol r14d,1 and ebx,r12d add edi,ecx rol r12d,30 add edi,ebx xor edx,DWORD[48+rsp] mov eax,r13d mov DWORD[44+rsp],r14d mov ebx,r13d xor edx,DWORD[56+rsp] and eax,r12d mov ecx,edi xor edx,DWORD[16+rsp] lea esi,[((-1894007588))+rsi*1+r14] xor ebx,r12d rol ecx,5 add esi,eax rol edx,1 and ebx,r11d add esi,ecx rol r11d,30 add esi,ebx xor ebp,DWORD[52+rsp] mov eax,edi mov DWORD[48+rsp],edx mov ecx,esi xor ebp,DWORD[60+rsp] xor eax,r12d rol ecx,5 xor ebp,DWORD[20+rsp] lea r13d,[((-899497514))+r13*1+rdx] xor eax,r11d add r13d,ecx rol edi,30 add r13d,eax rol ebp,1 xor r14d,DWORD[56+rsp] mov eax,esi mov DWORD[52+rsp],ebp mov ecx,r13d xor r14d,DWORD[rsp] xor eax,r11d rol ecx,5 xor r14d,DWORD[24+rsp] lea r12d,[((-899497514))+r12*1+rbp] xor eax,edi add r12d,ecx rol esi,30 add r12d,eax rol r14d,1 xor edx,DWORD[60+rsp] mov eax,r13d mov DWORD[56+rsp],r14d mov ecx,r12d xor edx,DWORD[4+rsp] xor eax,edi rol ecx,5 xor edx,DWORD[28+rsp] lea r11d,[((-899497514))+r11*1+r14] xor eax,esi add r11d,ecx rol r13d,30 add r11d,eax rol edx,1 xor ebp,DWORD[rsp] mov eax,r12d mov DWORD[60+rsp],edx mov ecx,r11d xor ebp,DWORD[8+rsp] xor eax,esi rol ecx,5 xor ebp,DWORD[32+rsp] lea edi,[((-899497514))+rdi*1+rdx] xor eax,r13d add edi,ecx rol r12d,30 add edi,eax rol ebp,1 xor r14d,DWORD[4+rsp] mov eax,r11d mov DWORD[rsp],ebp mov ecx,edi xor r14d,DWORD[12+rsp] xor eax,r13d rol ecx,5 xor r14d,DWORD[36+rsp] lea esi,[((-899497514))+rsi*1+rbp] xor eax,r12d add esi,ecx rol r11d,30 add esi,eax rol r14d,1 xor edx,DWORD[8+rsp] mov eax,edi mov DWORD[4+rsp],r14d mov ecx,esi xor edx,DWORD[16+rsp] xor eax,r12d rol ecx,5 xor edx,DWORD[40+rsp] lea r13d,[((-899497514))+r13*1+r14] xor eax,r11d add r13d,ecx rol edi,30 add r13d,eax rol edx,1 xor ebp,DWORD[12+rsp] mov eax,esi mov DWORD[8+rsp],edx mov ecx,r13d xor ebp,DWORD[20+rsp] xor eax,r11d rol ecx,5 xor ebp,DWORD[44+rsp] lea r12d,[((-899497514))+r12*1+rdx] xor eax,edi add r12d,ecx rol esi,30 add r12d,eax rol ebp,1 xor r14d,DWORD[16+rsp] mov eax,r13d mov DWORD[12+rsp],ebp mov ecx,r12d xor r14d,DWORD[24+rsp] xor eax,edi rol ecx,5 xor r14d,DWORD[48+rsp] lea r11d,[((-899497514))+r11*1+rbp] xor eax,esi add r11d,ecx rol r13d,30 add r11d,eax rol r14d,1 xor edx,DWORD[20+rsp] mov eax,r12d mov DWORD[16+rsp],r14d mov ecx,r11d xor edx,DWORD[28+rsp] xor eax,esi rol ecx,5 xor edx,DWORD[52+rsp] lea edi,[((-899497514))+rdi*1+r14] xor eax,r13d add edi,ecx rol r12d,30 add edi,eax rol edx,1 xor ebp,DWORD[24+rsp] mov eax,r11d mov DWORD[20+rsp],edx mov ecx,edi xor ebp,DWORD[32+rsp] xor eax,r13d rol ecx,5 xor ebp,DWORD[56+rsp] lea esi,[((-899497514))+rsi*1+rdx] xor eax,r12d add esi,ecx rol r11d,30 add esi,eax rol ebp,1 xor r14d,DWORD[28+rsp] mov eax,edi mov DWORD[24+rsp],ebp mov ecx,esi xor r14d,DWORD[36+rsp] xor eax,r12d rol ecx,5 xor r14d,DWORD[60+rsp] lea r13d,[((-899497514))+r13*1+rbp] xor eax,r11d add r13d,ecx rol edi,30 add r13d,eax rol r14d,1 xor edx,DWORD[32+rsp] mov eax,esi mov DWORD[28+rsp],r14d mov ecx,r13d xor edx,DWORD[40+rsp] xor eax,r11d rol ecx,5 xor edx,DWORD[rsp] lea r12d,[((-899497514))+r12*1+r14] xor eax,edi add r12d,ecx rol esi,30 add r12d,eax rol edx,1 xor ebp,DWORD[36+rsp] mov eax,r13d mov ecx,r12d xor ebp,DWORD[44+rsp] xor eax,edi rol ecx,5 xor ebp,DWORD[4+rsp] lea r11d,[((-899497514))+r11*1+rdx] xor eax,esi add r11d,ecx rol r13d,30 add r11d,eax rol ebp,1 xor r14d,DWORD[40+rsp] mov eax,r12d mov ecx,r11d xor r14d,DWORD[48+rsp] xor eax,esi rol ecx,5 xor r14d,DWORD[8+rsp] lea edi,[((-899497514))+rdi*1+rbp] xor eax,r13d add edi,ecx rol r12d,30 add edi,eax rol r14d,1 xor edx,DWORD[44+rsp] mov eax,r11d mov ecx,edi xor edx,DWORD[52+rsp] xor eax,r13d rol ecx,5 xor edx,DWORD[12+rsp] lea esi,[((-899497514))+rsi*1+r14] xor eax,r12d add esi,ecx rol r11d,30 add esi,eax rol edx,1 xor ebp,DWORD[48+rsp] mov eax,edi mov ecx,esi xor ebp,DWORD[56+rsp] xor eax,r12d rol ecx,5 xor ebp,DWORD[16+rsp] lea r13d,[((-899497514))+r13*1+rdx] xor eax,r11d add r13d,ecx rol edi,30 add r13d,eax rol ebp,1 xor r14d,DWORD[52+rsp] mov eax,esi mov ecx,r13d xor r14d,DWORD[60+rsp] xor eax,r11d rol ecx,5 xor r14d,DWORD[20+rsp] lea r12d,[((-899497514))+r12*1+rbp] xor eax,edi add r12d,ecx rol esi,30 add r12d,eax rol r14d,1 xor edx,DWORD[56+rsp] mov eax,r13d mov ecx,r12d xor edx,DWORD[rsp] xor eax,edi rol ecx,5 xor edx,DWORD[24+rsp] lea r11d,[((-899497514))+r11*1+r14] xor eax,esi add r11d,ecx rol r13d,30 add r11d,eax rol edx,1 xor ebp,DWORD[60+rsp] mov eax,r12d mov ecx,r11d xor ebp,DWORD[4+rsp] xor eax,esi rol ecx,5 xor ebp,DWORD[28+rsp] lea edi,[((-899497514))+rdi*1+rdx] xor eax,r13d add edi,ecx rol r12d,30 add edi,eax rol ebp,1 mov eax,r11d mov ecx,edi xor eax,r13d lea esi,[((-899497514))+rsi*1+rbp] rol ecx,5 xor eax,r12d add esi,ecx rol r11d,30 add esi,eax add esi,DWORD[r8] add edi,DWORD[4+r8] add r11d,DWORD[8+r8] add r12d,DWORD[12+r8] add r13d,DWORD[16+r8] mov DWORD[r8],esi mov DWORD[4+r8],edi mov DWORD[8+r8],r11d mov DWORD[12+r8],r12d mov DWORD[16+r8],r13d sub r10,1 lea r9,[64+r9] jnz NEAR $L$loop mov rsi,QWORD[64+rsp] mov r14,QWORD[((-40))+rsi] mov r13,QWORD[((-32))+rsi] mov r12,QWORD[((-24))+rsi] mov rbp,QWORD[((-16))+rsi] mov rbx,QWORD[((-8))+rsi] lea rsp,[rsi] $L$epilogue: mov rdi,QWORD[8+rsp] ;WIN64 epilogue mov rsi,QWORD[16+rsp] DB 0F3h,0C3h ;repret $L$SEH_end_sha1_block_data_order: ALIGN 16 sha1_block_data_order_ssse3: mov QWORD[8+rsp],rdi ;WIN64 prologue mov QWORD[16+rsp],rsi mov rax,rsp $L$SEH_begin_sha1_block_data_order_ssse3: mov rdi,rcx mov rsi,rdx mov rdx,r8 _ssse3_shortcut: mov r11,rsp push rbx push rbp push r12 push r13 push r14 lea rsp,[((-160))+rsp] movaps XMMWORD[(-40-96)+r11],xmm6 movaps XMMWORD[(-40-80)+r11],xmm7 movaps XMMWORD[(-40-64)+r11],xmm8 movaps XMMWORD[(-40-48)+r11],xmm9 movaps XMMWORD[(-40-32)+r11],xmm10 movaps XMMWORD[(-40-16)+r11],xmm11 $L$prologue_ssse3: and rsp,-64 mov r8,rdi mov r9,rsi mov r10,rdx shl r10,6 add r10,r9 lea r14,[((K_XX_XX+64))] mov eax,DWORD[r8] mov ebx,DWORD[4+r8] mov ecx,DWORD[8+r8] mov edx,DWORD[12+r8] mov esi,ebx mov ebp,DWORD[16+r8] mov edi,ecx xor edi,edx and esi,edi movdqa xmm6,XMMWORD[64+r14] movdqa xmm9,XMMWORD[((-64))+r14] movdqu xmm0,XMMWORD[r9] movdqu xmm1,XMMWORD[16+r9] movdqu xmm2,XMMWORD[32+r9] movdqu xmm3,XMMWORD[48+r9] DB 102,15,56,0,198 DB 102,15,56,0,206 DB 102,15,56,0,214 add r9,64 paddd xmm0,xmm9 DB 102,15,56,0,222 paddd xmm1,xmm9 paddd xmm2,xmm9 movdqa XMMWORD[rsp],xmm0 psubd xmm0,xmm9 movdqa XMMWORD[16+rsp],xmm1 psubd xmm1,xmm9 movdqa XMMWORD[32+rsp],xmm2 psubd xmm2,xmm9 jmp NEAR $L$oop_ssse3 ALIGN 16 $L$oop_ssse3: ror ebx,2 pshufd xmm4,xmm0,238 xor esi,edx movdqa xmm8,xmm3 paddd xmm9,xmm3 mov edi,eax add ebp,DWORD[rsp] punpcklqdq xmm4,xmm1 xor ebx,ecx rol eax,5 add ebp,esi psrldq xmm8,4 and edi,ebx xor ebx,ecx pxor xmm4,xmm0 add ebp,eax ror eax,7 pxor xmm8,xmm2 xor edi,ecx mov esi,ebp add edx,DWORD[4+rsp] pxor xmm4,xmm8 xor eax,ebx rol ebp,5 movdqa XMMWORD[48+rsp],xmm9 add edx,edi and esi,eax movdqa xmm10,xmm4 xor eax,ebx add edx,ebp ror ebp,7 movdqa xmm8,xmm4 xor esi,ebx pslldq xmm10,12 paddd xmm4,xmm4 mov edi,edx add ecx,DWORD[8+rsp] psrld xmm8,31 xor ebp,eax rol edx,5 add ecx,esi movdqa xmm9,xmm10 and edi,ebp xor ebp,eax psrld xmm10,30 add ecx,edx ror edx,7 por xmm4,xmm8 xor edi,eax mov esi,ecx add ebx,DWORD[12+rsp] pslld xmm9,2 pxor xmm4,xmm10 xor edx,ebp movdqa xmm10,XMMWORD[((-64))+r14] rol ecx,5 add ebx,edi and esi,edx pxor xmm4,xmm9 xor edx,ebp add ebx,ecx ror ecx,7 pshufd xmm5,xmm1,238 xor esi,ebp movdqa xmm9,xmm4 paddd xmm10,xmm4 mov edi,ebx add eax,DWORD[16+rsp] punpcklqdq xmm5,xmm2 xor ecx,edx rol ebx,5 add eax,esi psrldq xmm9,4 and edi,ecx xor ecx,edx pxor xmm5,xmm1 add eax,ebx ror ebx,7 pxor xmm9,xmm3 xor edi,edx mov esi,eax add ebp,DWORD[20+rsp] pxor xmm5,xmm9 xor ebx,ecx rol eax,5 movdqa XMMWORD[rsp],xmm10 add ebp,edi and esi,ebx movdqa xmm8,xmm5 xor ebx,ecx add ebp,eax ror eax,7 movdqa xmm9,xmm5 xor esi,ecx pslldq xmm8,12 paddd xmm5,xmm5 mov edi,ebp add edx,DWORD[24+rsp] psrld xmm9,31 xor eax,ebx rol ebp,5 add edx,esi movdqa xmm10,xmm8 and edi,eax xor eax,ebx psrld xmm8,30 add edx,ebp ror ebp,7 por xmm5,xmm9 xor edi,ebx mov esi,edx add ecx,DWORD[28+rsp] pslld xmm10,2 pxor xmm5,xmm8 xor ebp,eax movdqa xmm8,XMMWORD[((-32))+r14] rol edx,5 add ecx,edi and esi,ebp pxor xmm5,xmm10 xor ebp,eax add ecx,edx ror edx,7 pshufd xmm6,xmm2,238 xor esi,eax movdqa xmm10,xmm5 paddd xmm8,xmm5 mov edi,ecx add ebx,DWORD[32+rsp] punpcklqdq xmm6,xmm3 xor edx,ebp rol ecx,5 add ebx,esi psrldq xmm10,4 and edi,edx xor edx,ebp pxor xmm6,xmm2 add ebx,ecx ror ecx,7 pxor xmm10,xmm4 xor edi,ebp mov esi,ebx add eax,DWORD[36+rsp] pxor xmm6,xmm10 xor ecx,edx rol ebx,5 movdqa XMMWORD[16+rsp],xmm8 add eax,edi and esi,ecx movdqa xmm9,xmm6 xor ecx,edx add eax,ebx ror ebx,7 movdqa xmm10,xmm6 xor esi,edx pslldq xmm9,12 paddd xmm6,xmm6 mov edi,eax add ebp,DWORD[40+rsp] psrld xmm10,31 xor ebx,ecx rol eax,5 add ebp,esi movdqa xmm8,xmm9 and edi,ebx xor ebx,ecx psrld xmm9,30 add ebp,eax ror eax,7 por xmm6,xmm10 xor edi,ecx mov esi,ebp add edx,DWORD[44+rsp] pslld xmm8,2 pxor xmm6,xmm9 xor eax,ebx movdqa xmm9,XMMWORD[((-32))+r14] rol ebp,5 add edx,edi and esi,eax pxor xmm6,xmm8 xor eax,ebx add edx,ebp ror ebp,7 pshufd xmm7,xmm3,238 xor esi,ebx movdqa xmm8,xmm6 paddd xmm9,xmm6 mov edi,edx add ecx,DWORD[48+rsp] punpcklqdq xmm7,xmm4 xor ebp,eax rol edx,5 add ecx,esi psrldq xmm8,4 and edi,ebp xor ebp,eax pxor xmm7,xmm3 add ecx,edx ror edx,7 pxor xmm8,xmm5 xor edi,eax mov esi,ecx add ebx,DWORD[52+rsp] pxor xmm7,xmm8 xor edx,ebp rol ecx,5 movdqa XMMWORD[32+rsp],xmm9 add ebx,edi and esi,edx movdqa xmm10,xmm7 xor edx,ebp add ebx,ecx ror ecx,7 movdqa xmm8,xmm7 xor esi,ebp pslldq xmm10,12 paddd xmm7,xmm7 mov edi,ebx add eax,DWORD[56+rsp] psrld xmm8,31 xor ecx,edx rol ebx,5 add eax,esi movdqa xmm9,xmm10 and edi,ecx xor ecx,edx psrld xmm10,30 add eax,ebx ror ebx,7 por xmm7,xmm8 xor edi,edx mov esi,eax add ebp,DWORD[60+rsp] pslld xmm9,2 pxor xmm7,xmm10 xor ebx,ecx movdqa xmm10,XMMWORD[((-32))+r14] rol eax,5 add ebp,edi and esi,ebx pxor xmm7,xmm9 pshufd xmm9,xmm6,238 xor ebx,ecx add ebp,eax ror eax,7 pxor xmm0,xmm4 xor esi,ecx mov edi,ebp add edx,DWORD[rsp] punpcklqdq xmm9,xmm7 xor eax,ebx rol ebp,5 pxor xmm0,xmm1 add edx,esi and edi,eax movdqa xmm8,xmm10 xor eax,ebx paddd xmm10,xmm7 add edx,ebp pxor xmm0,xmm9 ror ebp,7 xor edi,ebx mov esi,edx add ecx,DWORD[4+rsp] movdqa xmm9,xmm0 xor ebp,eax rol edx,5 movdqa XMMWORD[48+rsp],xmm10 add ecx,edi and esi,ebp xor ebp,eax pslld xmm0,2 add ecx,edx ror edx,7 psrld xmm9,30 xor esi,eax mov edi,ecx add ebx,DWORD[8+rsp] por xmm0,xmm9 xor edx,ebp rol ecx,5 pshufd xmm10,xmm7,238 add ebx,esi and edi,edx xor edx,ebp add ebx,ecx add eax,DWORD[12+rsp] xor edi,ebp mov esi,ebx rol ebx,5 add eax,edi xor esi,edx ror ecx,7 add eax,ebx pxor xmm1,xmm5 add ebp,DWORD[16+rsp] xor esi,ecx punpcklqdq xmm10,xmm0 mov edi,eax rol eax,5 pxor xmm1,xmm2 add ebp,esi xor edi,ecx movdqa xmm9,xmm8 ror ebx,7 paddd xmm8,xmm0 add ebp,eax pxor xmm1,xmm10 add edx,DWORD[20+rsp] xor edi,ebx mov esi,ebp rol ebp,5 movdqa xmm10,xmm1 add edx,edi xor esi,ebx movdqa XMMWORD[rsp],xmm8 ror eax,7 add edx,ebp add ecx,DWORD[24+rsp] pslld xmm1,2 xor esi,eax mov edi,edx psrld xmm10,30 rol edx,5 add ecx,esi xor edi,eax ror ebp,7 por xmm1,xmm10 add ecx,edx add ebx,DWORD[28+rsp] pshufd xmm8,xmm0,238 xor edi,ebp mov esi,ecx rol ecx,5 add ebx,edi xor esi,ebp ror edx,7 add ebx,ecx pxor xmm2,xmm6 add eax,DWORD[32+rsp] xor esi,edx punpcklqdq xmm8,xmm1 mov edi,ebx rol ebx,5 pxor xmm2,xmm3 add eax,esi xor edi,edx movdqa xmm10,XMMWORD[r14] ror ecx,7 paddd xmm9,xmm1 add eax,ebx pxor xmm2,xmm8 add ebp,DWORD[36+rsp] xor edi,ecx mov esi,eax rol eax,5 movdqa xmm8,xmm2 add ebp,edi xor esi,ecx movdqa XMMWORD[16+rsp],xmm9 ror ebx,7 add ebp,eax add edx,DWORD[40+rsp] pslld xmm2,2 xor esi,ebx mov edi,ebp psrld xmm8,30 rol ebp,5 add edx,esi xor edi,ebx ror eax,7 por xmm2,xmm8 add edx,ebp add ecx,DWORD[44+rsp] pshufd xmm9,xmm1,238 xor edi,eax mov esi,edx rol edx,5 add ecx,edi xor esi,eax ror ebp,7 add ecx,edx pxor xmm3,xmm7 add ebx,DWORD[48+rsp] xor esi,ebp punpcklqdq xmm9,xmm2 mov edi,ecx rol ecx,5 pxor xmm3,xmm4 add ebx,esi xor edi,ebp movdqa xmm8,xmm10 ror edx,7 paddd xmm10,xmm2 add ebx,ecx pxor xmm3,xmm9 add eax,DWORD[52+rsp] xor edi,edx mov esi,ebx rol ebx,5 movdqa xmm9,xmm3 add eax,edi xor esi,edx movdqa XMMWORD[32+rsp],xmm10 ror ecx,7 add eax,ebx add ebp,DWORD[56+rsp] pslld xmm3,2 xor esi,ecx mov edi,eax psrld xmm9,30 rol eax,5 add ebp,esi xor edi,ecx ror ebx,7 por xmm3,xmm9 add ebp,eax add edx,DWORD[60+rsp] pshufd xmm10,xmm2,238 xor edi,ebx mov esi,ebp rol ebp,5 add edx,edi xor esi,ebx ror eax,7 add edx,ebp pxor xmm4,xmm0 add ecx,DWORD[rsp] xor esi,eax punpcklqdq xmm10,xmm3 mov edi,edx rol edx,5 pxor xmm4,xmm5 add ecx,esi xor edi,eax movdqa xmm9,xmm8 ror ebp,7 paddd xmm8,xmm3 add ecx,edx pxor xmm4,xmm10 add ebx,DWORD[4+rsp] xor edi,ebp mov esi,ecx rol ecx,5 movdqa xmm10,xmm4 add ebx,edi xor esi,ebp movdqa XMMWORD[48+rsp],xmm8 ror edx,7 add ebx,ecx add eax,DWORD[8+rsp] pslld xmm4,2 xor esi,edx mov edi,ebx psrld xmm10,30 rol ebx,5 add eax,esi xor edi,edx ror ecx,7 por xmm4,xmm10 add eax,ebx add ebp,DWORD[12+rsp] pshufd xmm8,xmm3,238 xor edi,ecx mov esi,eax rol eax,5 add ebp,edi xor esi,ecx ror ebx,7 add ebp,eax pxor xmm5,xmm1 add edx,DWORD[16+rsp] xor esi,ebx punpcklqdq xmm8,xmm4 mov edi,ebp rol ebp,5 pxor xmm5,xmm6 add edx,esi xor edi,ebx movdqa xmm10,xmm9 ror eax,7 paddd xmm9,xmm4 add edx,ebp pxor xmm5,xmm8 add ecx,DWORD[20+rsp] xor edi,eax mov esi,edx rol edx,5 movdqa xmm8,xmm5 add ecx,edi xor esi,eax movdqa XMMWORD[rsp],xmm9 ror ebp,7 add ecx,edx add ebx,DWORD[24+rsp] pslld xmm5,2 xor esi,ebp mov edi,ecx psrld xmm8,30 rol ecx,5 add ebx,esi xor edi,ebp ror edx,7 por xmm5,xmm8 add ebx,ecx add eax,DWORD[28+rsp] pshufd xmm9,xmm4,238 ror ecx,7 mov esi,ebx xor edi,edx rol ebx,5 add eax,edi xor esi,ecx xor ecx,edx add eax,ebx pxor xmm6,xmm2 add ebp,DWORD[32+rsp] and esi,ecx xor ecx,edx ror ebx,7 punpcklqdq xmm9,xmm5 mov edi,eax xor esi,ecx pxor xmm6,xmm7 rol eax,5 add ebp,esi movdqa xmm8,xmm10 xor edi,ebx paddd xmm10,xmm5 xor ebx,ecx pxor xmm6,xmm9 add ebp,eax add edx,DWORD[36+rsp] and edi,ebx xor ebx,ecx ror eax,7 movdqa xmm9,xmm6 mov esi,ebp xor edi,ebx movdqa XMMWORD[16+rsp],xmm10 rol ebp,5 add edx,edi xor esi,eax pslld xmm6,2 xor eax,ebx add edx,ebp psrld xmm9,30 add ecx,DWORD[40+rsp] and esi,eax xor eax,ebx por xmm6,xmm9 ror ebp,7 mov edi,edx xor esi,eax rol edx,5 pshufd xmm10,xmm5,238 add ecx,esi xor edi,ebp xor ebp,eax add ecx,edx add ebx,DWORD[44+rsp] and edi,ebp xor ebp,eax ror edx,7 mov esi,ecx xor edi,ebp rol ecx,5 add ebx,edi xor esi,edx xor edx,ebp add ebx,ecx pxor xmm7,xmm3 add eax,DWORD[48+rsp] and esi,edx xor edx,ebp ror ecx,7 punpcklqdq xmm10,xmm6 mov edi,ebx xor esi,edx pxor xmm7,xmm0 rol ebx,5 add eax,esi movdqa xmm9,XMMWORD[32+r14] xor edi,ecx paddd xmm8,xmm6 xor ecx,edx pxor xmm7,xmm10 add eax,ebx add ebp,DWORD[52+rsp] and edi,ecx xor ecx,edx ror ebx,7 movdqa xmm10,xmm7 mov esi,eax xor edi,ecx movdqa XMMWORD[32+rsp],xmm8 rol eax,5 add ebp,edi xor esi,ebx pslld xmm7,2 xor ebx,ecx add ebp,eax psrld xmm10,30 add edx,DWORD[56+rsp] and esi,ebx xor ebx,ecx por xmm7,xmm10 ror eax,7 mov edi,ebp xor esi,ebx rol ebp,5 pshufd xmm8,xmm6,238 add edx,esi xor edi,eax xor eax,ebx add edx,ebp add ecx,DWORD[60+rsp] and edi,eax xor eax,ebx ror ebp,7 mov esi,edx xor edi,eax rol edx,5 add ecx,edi xor esi,ebp xor ebp,eax add ecx,edx pxor xmm0,xmm4 add ebx,DWORD[rsp] and esi,ebp xor ebp,eax ror edx,7 punpcklqdq xmm8,xmm7 mov edi,ecx xor esi,ebp pxor xmm0,xmm1 rol ecx,5 add ebx,esi movdqa xmm10,xmm9 xor edi,edx paddd xmm9,xmm7 xor edx,ebp pxor xmm0,xmm8 add ebx,ecx add eax,DWORD[4+rsp] and edi,edx xor edx,ebp ror ecx,7 movdqa xmm8,xmm0 mov esi,ebx xor edi,edx movdqa XMMWORD[48+rsp],xmm9 rol ebx,5 add eax,edi xor esi,ecx pslld xmm0,2 xor ecx,edx add eax,ebx psrld xmm8,30 add ebp,DWORD[8+rsp] and esi,ecx xor ecx,edx por xmm0,xmm8 ror ebx,7 mov edi,eax xor esi,ecx rol eax,5 pshufd xmm9,xmm7,238 add ebp,esi xor edi,ebx xor ebx,ecx add ebp,eax add edx,DWORD[12+rsp] and edi,ebx xor ebx,ecx ror eax,7 mov esi,ebp xor edi,ebx rol ebp,5 add edx,edi xor esi,eax xor eax,ebx add edx,ebp pxor xmm1,xmm5 add ecx,DWORD[16+rsp] and esi,eax xor eax,ebx ror ebp,7 punpcklqdq xmm9,xmm0 mov edi,edx xor esi,eax pxor xmm1,xmm2 rol edx,5 add ecx,esi movdqa xmm8,xmm10 xor edi,ebp paddd xmm10,xmm0 xor ebp,eax pxor xmm1,xmm9 add ecx,edx add ebx,DWORD[20+rsp] and edi,ebp xor ebp,eax ror edx,7 movdqa xmm9,xmm1 mov esi,ecx xor edi,ebp movdqa XMMWORD[rsp],xmm10 rol ecx,5 add ebx,edi xor esi,edx pslld xmm1,2 xor edx,ebp add ebx,ecx psrld xmm9,30 add eax,DWORD[24+rsp] and esi,edx xor edx,ebp por xmm1,xmm9 ror ecx,7 mov edi,ebx xor esi,edx rol ebx,5 pshufd xmm10,xmm0,238 add eax,esi xor edi,ecx xor ecx,edx add eax,ebx add ebp,DWORD[28+rsp] and edi,ecx xor ecx,edx ror ebx,7 mov esi,eax xor edi,ecx rol eax,5 add ebp,edi xor esi,ebx xor ebx,ecx add ebp,eax pxor xmm2,xmm6 add edx,DWORD[32+rsp] and esi,ebx xor ebx,ecx ror eax,7 punpcklqdq xmm10,xmm1 mov edi,ebp xor esi,ebx pxor xmm2,xmm3 rol ebp,5 add edx,esi movdqa xmm9,xmm8 xor edi,eax paddd xmm8,xmm1 xor eax,ebx pxor xmm2,xmm10 add edx,ebp add ecx,DWORD[36+rsp] and edi,eax xor eax,ebx ror ebp,7 movdqa xmm10,xmm2 mov esi,edx xor edi,eax movdqa XMMWORD[16+rsp],xmm8 rol edx,5 add ecx,edi xor esi,ebp pslld xmm2,2 xor ebp,eax add ecx,edx psrld xmm10,30 add ebx,DWORD[40+rsp] and esi,ebp xor ebp,eax por xmm2,xmm10 ror edx,7 mov edi,ecx xor esi,ebp rol ecx,5 pshufd xmm8,xmm1,238 add ebx,esi xor edi,edx xor edx,ebp add ebx,ecx add eax,DWORD[44+rsp] and edi,edx xor edx,ebp ror ecx,7 mov esi,ebx xor edi,edx rol ebx,5 add eax,edi xor esi,edx add eax,ebx pxor xmm3,xmm7 add ebp,DWORD[48+rsp] xor esi,ecx punpcklqdq xmm8,xmm2 mov edi,eax rol eax,5 pxor xmm3,xmm4 add ebp,esi xor edi,ecx movdqa xmm10,xmm9 ror ebx,7 paddd xmm9,xmm2 add ebp,eax pxor xmm3,xmm8 add edx,DWORD[52+rsp] xor edi,ebx mov esi,ebp rol ebp,5 movdqa xmm8,xmm3 add edx,edi xor esi,ebx movdqa XMMWORD[32+rsp],xmm9 ror eax,7 add edx,ebp add ecx,DWORD[56+rsp] pslld xmm3,2 xor esi,eax mov edi,edx psrld xmm8,30 rol edx,5 add ecx,esi xor edi,eax ror ebp,7 por xmm3,xmm8 add ecx,edx add ebx,DWORD[60+rsp] xor edi,ebp mov esi,ecx rol ecx,5 add ebx,edi xor esi,ebp ror edx,7 add ebx,ecx add eax,DWORD[rsp] xor esi,edx mov edi,ebx rol ebx,5 paddd xmm10,xmm3 add eax,esi xor edi,edx movdqa XMMWORD[48+rsp],xmm10 ror ecx,7 add eax,ebx add ebp,DWORD[4+rsp] xor edi,ecx mov esi,eax rol eax,5 add ebp,edi xor esi,ecx ror ebx,7 add ebp,eax add edx,DWORD[8+rsp] xor esi,ebx mov edi,ebp rol ebp,5 add edx,esi xor edi,ebx ror eax,7 add edx,ebp add ecx,DWORD[12+rsp] xor edi,eax mov esi,edx rol edx,5 add ecx,edi xor esi,eax ror ebp,7 add ecx,edx cmp r9,r10 je NEAR $L$done_ssse3 movdqa xmm6,XMMWORD[64+r14] movdqa xmm9,XMMWORD[((-64))+r14] movdqu xmm0,XMMWORD[r9] movdqu xmm1,XMMWORD[16+r9] movdqu xmm2,XMMWORD[32+r9] movdqu xmm3,XMMWORD[48+r9] DB 102,15,56,0,198 add r9,64 add ebx,DWORD[16+rsp] xor esi,ebp mov edi,ecx DB 102,15,56,0,206 rol ecx,5 add ebx,esi xor edi,ebp ror edx,7 paddd xmm0,xmm9 add ebx,ecx add eax,DWORD[20+rsp] xor edi,edx mov esi,ebx movdqa XMMWORD[rsp],xmm0 rol ebx,5 add eax,edi xor esi,edx ror ecx,7 psubd xmm0,xmm9 add eax,ebx add ebp,DWORD[24+rsp] xor esi,ecx mov edi,eax rol eax,5 add ebp,esi xor edi,ecx ror ebx,7 add ebp,eax add edx,DWORD[28+rsp] xor edi,ebx mov esi,ebp rol ebp,5 add edx,edi xor esi,ebx ror eax,7 add edx,ebp add ecx,DWORD[32+rsp] xor esi,eax mov edi,edx DB 102,15,56,0,214 rol edx,5 add ecx,esi xor edi,eax ror ebp,7 paddd xmm1,xmm9 add ecx,edx add ebx,DWORD[36+rsp] xor edi,ebp mov esi,ecx movdqa XMMWORD[16+rsp],xmm1 rol ecx,5 add ebx,edi xor esi,ebp ror edx,7 psubd xmm1,xmm9 add ebx,ecx add eax,DWORD[40+rsp] xor esi,edx mov edi,ebx rol ebx,5 add eax,esi xor edi,edx ror ecx,7 add eax,ebx add ebp,DWORD[44+rsp] xor edi,ecx mov esi,eax rol eax,5 add ebp,edi xor esi,ecx ror ebx,7 add ebp,eax add edx,DWORD[48+rsp] xor esi,ebx mov edi,ebp DB 102,15,56,0,222 rol ebp,5 add edx,esi xor edi,ebx ror eax,7 paddd xmm2,xmm9 add edx,ebp add ecx,DWORD[52+rsp] xor edi,eax mov esi,edx movdqa XMMWORD[32+rsp],xmm2 rol edx,5 add ecx,edi xor esi,eax ror ebp,7 psubd xmm2,xmm9 add ecx,edx add ebx,DWORD[56+rsp] xor esi,ebp mov edi,ecx rol ecx,5 add ebx,esi xor edi,ebp ror edx,7 add ebx,ecx add eax,DWORD[60+rsp] xor edi,edx mov esi,ebx rol ebx,5 add eax,edi ror ecx,7 add eax,ebx add eax,DWORD[r8] add esi,DWORD[4+r8] add ecx,DWORD[8+r8] add edx,DWORD[12+r8] mov DWORD[r8],eax add ebp,DWORD[16+r8] mov DWORD[4+r8],esi mov ebx,esi mov DWORD[8+r8],ecx mov edi,ecx mov DWORD[12+r8],edx xor edi,edx mov DWORD[16+r8],ebp and esi,edi jmp NEAR $L$oop_ssse3 ALIGN 16 $L$done_ssse3: add ebx,DWORD[16+rsp] xor esi,ebp mov edi,ecx rol ecx,5 add ebx,esi xor edi,ebp ror edx,7 add ebx,ecx add eax,DWORD[20+rsp] xor edi,edx mov esi,ebx rol ebx,5 add eax,edi xor esi,edx ror ecx,7 add eax,ebx add ebp,DWORD[24+rsp] xor esi,ecx mov edi,eax rol eax,5 add ebp,esi xor edi,ecx ror ebx,7 add ebp,eax add edx,DWORD[28+rsp] xor edi,ebx mov esi,ebp rol ebp,5 add edx,edi xor esi,ebx ror eax,7 add edx,ebp add ecx,DWORD[32+rsp] xor esi,eax mov edi,edx rol edx,5 add ecx,esi xor edi,eax ror ebp,7 add ecx,edx add ebx,DWORD[36+rsp] xor edi,ebp mov esi,ecx rol ecx,5 add ebx,edi xor esi,ebp ror edx,7 add ebx,ecx add eax,DWORD[40+rsp] xor esi,edx mov edi,ebx rol ebx,5 add eax,esi xor edi,edx ror ecx,7 add eax,ebx add ebp,DWORD[44+rsp] xor edi,ecx mov esi,eax rol eax,5 add ebp,edi xor esi,ecx ror ebx,7 add ebp,eax add edx,DWORD[48+rsp] xor esi,ebx mov edi,ebp rol ebp,5 add edx,esi xor edi,ebx ror eax,7 add edx,ebp add ecx,DWORD[52+rsp] xor edi,eax mov esi,edx rol edx,5 add ecx,edi xor esi,eax ror ebp,7 add ecx,edx add ebx,DWORD[56+rsp] xor esi,ebp mov edi,ecx rol ecx,5 add ebx,esi xor edi,ebp ror edx,7 add ebx,ecx add eax,DWORD[60+rsp] xor edi,edx mov esi,ebx rol ebx,5 add eax,edi ror ecx,7 add eax,ebx add eax,DWORD[r8] add esi,DWORD[4+r8] add ecx,DWORD[8+r8] mov DWORD[r8],eax add edx,DWORD[12+r8] mov DWORD[4+r8],esi add ebp,DWORD[16+r8] mov DWORD[8+r8],ecx mov DWORD[12+r8],edx mov DWORD[16+r8],ebp movaps xmm6,XMMWORD[((-40-96))+r11] movaps xmm7,XMMWORD[((-40-80))+r11] movaps xmm8,XMMWORD[((-40-64))+r11] movaps xmm9,XMMWORD[((-40-48))+r11] movaps xmm10,XMMWORD[((-40-32))+r11] movaps xmm11,XMMWORD[((-40-16))+r11] mov r14,QWORD[((-40))+r11] mov r13,QWORD[((-32))+r11] mov r12,QWORD[((-24))+r11] mov rbp,QWORD[((-16))+r11] mov rbx,QWORD[((-8))+r11] lea rsp,[r11] $L$epilogue_ssse3: mov rdi,QWORD[8+rsp] ;WIN64 epilogue mov rsi,QWORD[16+rsp] DB 0F3h,0C3h ;repret $L$SEH_end_sha1_block_data_order_ssse3: ALIGN 16 sha1_block_data_order_avx: mov QWORD[8+rsp],rdi ;WIN64 prologue mov QWORD[16+rsp],rsi mov rax,rsp $L$SEH_begin_sha1_block_data_order_avx: mov rdi,rcx mov rsi,rdx mov rdx,r8 _avx_shortcut: mov r11,rsp push rbx push rbp push r12 push r13 push r14 lea rsp,[((-160))+rsp] vzeroupper vmovaps XMMWORD[(-40-96)+r11],xmm6 vmovaps XMMWORD[(-40-80)+r11],xmm7 vmovaps XMMWORD[(-40-64)+r11],xmm8 vmovaps XMMWORD[(-40-48)+r11],xmm9 vmovaps XMMWORD[(-40-32)+r11],xmm10 vmovaps XMMWORD[(-40-16)+r11],xmm11 $L$prologue_avx: and rsp,-64 mov r8,rdi mov r9,rsi mov r10,rdx shl r10,6 add r10,r9 lea r14,[((K_XX_XX+64))] mov eax,DWORD[r8] mov ebx,DWORD[4+r8] mov ecx,DWORD[8+r8] mov edx,DWORD[12+r8] mov esi,ebx mov ebp,DWORD[16+r8] mov edi,ecx xor edi,edx and esi,edi vmovdqa xmm6,XMMWORD[64+r14] vmovdqa xmm11,XMMWORD[((-64))+r14] vmovdqu xmm0,XMMWORD[r9] vmovdqu xmm1,XMMWORD[16+r9] vmovdqu xmm2,XMMWORD[32+r9] vmovdqu xmm3,XMMWORD[48+r9] vpshufb xmm0,xmm0,xmm6 add r9,64 vpshufb xmm1,xmm1,xmm6 vpshufb xmm2,xmm2,xmm6 vpshufb xmm3,xmm3,xmm6 vpaddd xmm4,xmm0,xmm11 vpaddd xmm5,xmm1,xmm11 vpaddd xmm6,xmm2,xmm11 vmovdqa XMMWORD[rsp],xmm4 vmovdqa XMMWORD[16+rsp],xmm5 vmovdqa XMMWORD[32+rsp],xmm6 jmp NEAR $L$oop_avx ALIGN 16 $L$oop_avx: shrd ebx,ebx,2 xor esi,edx vpalignr xmm4,xmm1,xmm0,8 mov edi,eax add ebp,DWORD[rsp] vpaddd xmm9,xmm11,xmm3 xor ebx,ecx shld eax,eax,5 vpsrldq xmm8,xmm3,4 add ebp,esi and edi,ebx vpxor xmm4,xmm4,xmm0 xor ebx,ecx add ebp,eax vpxor xmm8,xmm8,xmm2 shrd eax,eax,7 xor edi,ecx mov esi,ebp add edx,DWORD[4+rsp] vpxor xmm4,xmm4,xmm8 xor eax,ebx shld ebp,ebp,5 vmovdqa XMMWORD[48+rsp],xmm9 add edx,edi and esi,eax vpsrld xmm8,xmm4,31 xor eax,ebx add edx,ebp shrd ebp,ebp,7 xor esi,ebx vpslldq xmm10,xmm4,12 vpaddd xmm4,xmm4,xmm4 mov edi,edx add ecx,DWORD[8+rsp] xor ebp,eax shld edx,edx,5 vpsrld xmm9,xmm10,30 vpor xmm4,xmm4,xmm8 add ecx,esi and edi,ebp xor ebp,eax add ecx,edx vpslld xmm10,xmm10,2 vpxor xmm4,xmm4,xmm9 shrd edx,edx,7 xor edi,eax mov esi,ecx add ebx,DWORD[12+rsp] vpxor xmm4,xmm4,xmm10 xor edx,ebp shld ecx,ecx,5 add ebx,edi and esi,edx xor edx,ebp add ebx,ecx shrd ecx,ecx,7 xor esi,ebp vpalignr xmm5,xmm2,xmm1,8 mov edi,ebx add eax,DWORD[16+rsp] vpaddd xmm9,xmm11,xmm4 xor ecx,edx shld ebx,ebx,5 vpsrldq xmm8,xmm4,4 add eax,esi and edi,ecx vpxor xmm5,xmm5,xmm1 xor ecx,edx add eax,ebx vpxor xmm8,xmm8,xmm3 shrd ebx,ebx,7 xor edi,edx mov esi,eax add ebp,DWORD[20+rsp] vpxor xmm5,xmm5,xmm8 xor ebx,ecx shld eax,eax,5 vmovdqa XMMWORD[rsp],xmm9 add ebp,edi and esi,ebx vpsrld xmm8,xmm5,31 xor ebx,ecx add ebp,eax shrd eax,eax,7 xor esi,ecx vpslldq xmm10,xmm5,12 vpaddd xmm5,xmm5,xmm5 mov edi,ebp add edx,DWORD[24+rsp] xor eax,ebx shld ebp,ebp,5 vpsrld xmm9,xmm10,30 vpor xmm5,xmm5,xmm8 add edx,esi and edi,eax xor eax,ebx add edx,ebp vpslld xmm10,xmm10,2 vpxor xmm5,xmm5,xmm9 shrd ebp,ebp,7 xor edi,ebx mov esi,edx add ecx,DWORD[28+rsp] vpxor xmm5,xmm5,xmm10 xor ebp,eax shld edx,edx,5 vmovdqa xmm11,XMMWORD[((-32))+r14] add ecx,edi and esi,ebp xor ebp,eax add ecx,edx shrd edx,edx,7 xor esi,eax vpalignr xmm6,xmm3,xmm2,8 mov edi,ecx add ebx,DWORD[32+rsp] vpaddd xmm9,xmm11,xmm5 xor edx,ebp shld ecx,ecx,5 vpsrldq xmm8,xmm5,4 add ebx,esi and edi,edx vpxor xmm6,xmm6,xmm2 xor edx,ebp add ebx,ecx vpxor xmm8,xmm8,xmm4 shrd ecx,ecx,7 xor edi,ebp mov esi,ebx add eax,DWORD[36+rsp] vpxor xmm6,xmm6,xmm8 xor ecx,edx shld ebx,ebx,5 vmovdqa XMMWORD[16+rsp],xmm9 add eax,edi and esi,ecx vpsrld xmm8,xmm6,31 xor ecx,edx add eax,ebx shrd ebx,ebx,7 xor esi,edx vpslldq xmm10,xmm6,12 vpaddd xmm6,xmm6,xmm6 mov edi,eax add ebp,DWORD[40+rsp] xor ebx,ecx shld eax,eax,5 vpsrld xmm9,xmm10,30 vpor xmm6,xmm6,xmm8 add ebp,esi and edi,ebx xor ebx,ecx add ebp,eax vpslld xmm10,xmm10,2 vpxor xmm6,xmm6,xmm9 shrd eax,eax,7 xor edi,ecx mov esi,ebp add edx,DWORD[44+rsp] vpxor xmm6,xmm6,xmm10 xor eax,ebx shld ebp,ebp,5 add edx,edi and esi,eax xor eax,ebx add edx,ebp shrd ebp,ebp,7 xor esi,ebx vpalignr xmm7,xmm4,xmm3,8 mov edi,edx add ecx,DWORD[48+rsp] vpaddd xmm9,xmm11,xmm6 xor ebp,eax shld edx,edx,5 vpsrldq xmm8,xmm6,4 add ecx,esi and edi,ebp vpxor xmm7,xmm7,xmm3 xor ebp,eax add ecx,edx vpxor xmm8,xmm8,xmm5 shrd edx,edx,7 xor edi,eax mov esi,ecx add ebx,DWORD[52+rsp] vpxor xmm7,xmm7,xmm8 xor edx,ebp shld ecx,ecx,5 vmovdqa XMMWORD[32+rsp],xmm9 add ebx,edi and esi,edx vpsrld xmm8,xmm7,31 xor edx,ebp add ebx,ecx shrd ecx,ecx,7 xor esi,ebp vpslldq xmm10,xmm7,12 vpaddd xmm7,xmm7,xmm7 mov edi,ebx add eax,DWORD[56+rsp] xor ecx,edx shld ebx,ebx,5 vpsrld xmm9,xmm10,30 vpor xmm7,xmm7,xmm8 add eax,esi and edi,ecx xor ecx,edx add eax,ebx vpslld xmm10,xmm10,2 vpxor xmm7,xmm7,xmm9 shrd ebx,ebx,7 xor edi,edx mov esi,eax add ebp,DWORD[60+rsp] vpxor xmm7,xmm7,xmm10 xor ebx,ecx shld eax,eax,5 add ebp,edi and esi,ebx xor ebx,ecx add ebp,eax vpalignr xmm8,xmm7,xmm6,8 vpxor xmm0,xmm0,xmm4 shrd eax,eax,7 xor esi,ecx mov edi,ebp add edx,DWORD[rsp] vpxor xmm0,xmm0,xmm1 xor eax,ebx shld ebp,ebp,5 vpaddd xmm9,xmm11,xmm7 add edx,esi and edi,eax vpxor xmm0,xmm0,xmm8 xor eax,ebx add edx,ebp shrd ebp,ebp,7 xor edi,ebx vpsrld xmm8,xmm0,30 vmovdqa XMMWORD[48+rsp],xmm9 mov esi,edx add ecx,DWORD[4+rsp] xor ebp,eax shld edx,edx,5 vpslld xmm0,xmm0,2 add ecx,edi and esi,ebp xor ebp,eax add ecx,edx shrd edx,edx,7 xor esi,eax mov edi,ecx add ebx,DWORD[8+rsp] vpor xmm0,xmm0,xmm8 xor edx,ebp shld ecx,ecx,5 add ebx,esi and edi,edx xor edx,ebp add ebx,ecx add eax,DWORD[12+rsp] xor edi,ebp mov esi,ebx shld ebx,ebx,5 add eax,edi xor esi,edx shrd ecx,ecx,7 add eax,ebx vpalignr xmm8,xmm0,xmm7,8 vpxor xmm1,xmm1,xmm5 add ebp,DWORD[16+rsp] xor esi,ecx mov edi,eax shld eax,eax,5 vpxor xmm1,xmm1,xmm2 add ebp,esi xor edi,ecx vpaddd xmm9,xmm11,xmm0 shrd ebx,ebx,7 add ebp,eax vpxor xmm1,xmm1,xmm8 add edx,DWORD[20+rsp] xor edi,ebx mov esi,ebp shld ebp,ebp,5 vpsrld xmm8,xmm1,30 vmovdqa XMMWORD[rsp],xmm9 add edx,edi xor esi,ebx shrd eax,eax,7 add edx,ebp vpslld xmm1,xmm1,2 add ecx,DWORD[24+rsp] xor esi,eax mov edi,edx shld edx,edx,5 add ecx,esi xor edi,eax shrd ebp,ebp,7 add ecx,edx vpor xmm1,xmm1,xmm8 add ebx,DWORD[28+rsp] xor edi,ebp mov esi,ecx shld ecx,ecx,5 add ebx,edi xor esi,ebp shrd edx,edx,7 add ebx,ecx vpalignr xmm8,xmm1,xmm0,8 vpxor xmm2,xmm2,xmm6 add eax,DWORD[32+rsp] xor esi,edx mov edi,ebx shld ebx,ebx,5 vpxor xmm2,xmm2,xmm3 add eax,esi xor edi,edx vpaddd xmm9,xmm11,xmm1 vmovdqa xmm11,XMMWORD[r14] shrd ecx,ecx,7 add eax,ebx vpxor xmm2,xmm2,xmm8 add ebp,DWORD[36+rsp] xor edi,ecx mov esi,eax shld eax,eax,5 vpsrld xmm8,xmm2,30 vmovdqa XMMWORD[16+rsp],xmm9 add ebp,edi xor esi,ecx shrd ebx,ebx,7 add ebp,eax vpslld xmm2,xmm2,2 add edx,DWORD[40+rsp] xor esi,ebx mov edi,ebp shld ebp,ebp,5 add edx,esi xor edi,ebx shrd eax,eax,7 add edx,ebp vpor xmm2,xmm2,xmm8 add ecx,DWORD[44+rsp] xor edi,eax mov esi,edx shld edx,edx,5 add ecx,edi xor esi,eax shrd ebp,ebp,7 add ecx,edx vpalignr xmm8,xmm2,xmm1,8 vpxor xmm3,xmm3,xmm7 add ebx,DWORD[48+rsp] xor esi,ebp mov edi,ecx shld ecx,ecx,5 vpxor xmm3,xmm3,xmm4 add ebx,esi xor edi,ebp vpaddd xmm9,xmm11,xmm2 shrd edx,edx,7 add ebx,ecx vpxor xmm3,xmm3,xmm8 add eax,DWORD[52+rsp] xor edi,edx mov esi,ebx shld ebx,ebx,5 vpsrld xmm8,xmm3,30 vmovdqa XMMWORD[32+rsp],xmm9 add eax,edi xor esi,edx shrd ecx,ecx,7 add eax,ebx vpslld xmm3,xmm3,2 add ebp,DWORD[56+rsp] xor esi,ecx mov edi,eax shld eax,eax,5 add ebp,esi xor edi,ecx shrd ebx,ebx,7 add ebp,eax vpor xmm3,xmm3,xmm8 add edx,DWORD[60+rsp] xor edi,ebx mov esi,ebp shld ebp,ebp,5 add edx,edi xor esi,ebx shrd eax,eax,7 add edx,ebp vpalignr xmm8,xmm3,xmm2,8 vpxor xmm4,xmm4,xmm0 add ecx,DWORD[rsp] xor esi,eax mov edi,edx shld edx,edx,5 vpxor xmm4,xmm4,xmm5 add ecx,esi xor edi,eax vpaddd xmm9,xmm11,xmm3 shrd ebp,ebp,7 add ecx,edx vpxor xmm4,xmm4,xmm8 add ebx,DWORD[4+rsp] xor edi,ebp mov esi,ecx shld ecx,ecx,5 vpsrld xmm8,xmm4,30 vmovdqa XMMWORD[48+rsp],xmm9 add ebx,edi xor esi,ebp shrd edx,edx,7 add ebx,ecx vpslld xmm4,xmm4,2 add eax,DWORD[8+rsp] xor esi,edx mov edi,ebx shld ebx,ebx,5 add eax,esi xor edi,edx shrd ecx,ecx,7 add eax,ebx vpor xmm4,xmm4,xmm8 add ebp,DWORD[12+rsp] xor edi,ecx mov esi,eax shld eax,eax,5 add ebp,edi xor esi,ecx shrd ebx,ebx,7 add ebp,eax vpalignr xmm8,xmm4,xmm3,8 vpxor xmm5,xmm5,xmm1 add edx,DWORD[16+rsp] xor esi,ebx mov edi,ebp shld ebp,ebp,5 vpxor xmm5,xmm5,xmm6 add edx,esi xor edi,ebx vpaddd xmm9,xmm11,xmm4 shrd eax,eax,7 add edx,ebp vpxor xmm5,xmm5,xmm8 add ecx,DWORD[20+rsp] xor edi,eax mov esi,edx shld edx,edx,5 vpsrld xmm8,xmm5,30 vmovdqa XMMWORD[rsp],xmm9 add ecx,edi xor esi,eax shrd ebp,ebp,7 add ecx,edx vpslld xmm5,xmm5,2 add ebx,DWORD[24+rsp] xor esi,ebp mov edi,ecx shld ecx,ecx,5 add ebx,esi xor edi,ebp shrd edx,edx,7 add ebx,ecx vpor xmm5,xmm5,xmm8 add eax,DWORD[28+rsp] shrd ecx,ecx,7 mov esi,ebx xor edi,edx shld ebx,ebx,5 add eax,edi xor esi,ecx xor ecx,edx add eax,ebx vpalignr xmm8,xmm5,xmm4,8 vpxor xmm6,xmm6,xmm2 add ebp,DWORD[32+rsp] and esi,ecx xor ecx,edx shrd ebx,ebx,7 vpxor xmm6,xmm6,xmm7 mov edi,eax xor esi,ecx vpaddd xmm9,xmm11,xmm5 shld eax,eax,5 add ebp,esi vpxor xmm6,xmm6,xmm8 xor edi,ebx xor ebx,ecx add ebp,eax add edx,DWORD[36+rsp] vpsrld xmm8,xmm6,30 vmovdqa XMMWORD[16+rsp],xmm9 and edi,ebx xor ebx,ecx shrd eax,eax,7 mov esi,ebp vpslld xmm6,xmm6,2 xor edi,ebx shld ebp,ebp,5 add edx,edi xor esi,eax xor eax,ebx add edx,ebp add ecx,DWORD[40+rsp] and esi,eax vpor xmm6,xmm6,xmm8 xor eax,ebx shrd ebp,ebp,7 mov edi,edx xor esi,eax shld edx,edx,5 add ecx,esi xor edi,ebp xor ebp,eax add ecx,edx add ebx,DWORD[44+rsp] and edi,ebp xor ebp,eax shrd edx,edx,7 mov esi,ecx xor edi,ebp shld ecx,ecx,5 add ebx,edi xor esi,edx xor edx,ebp add ebx,ecx vpalignr xmm8,xmm6,xmm5,8 vpxor xmm7,xmm7,xmm3 add eax,DWORD[48+rsp] and esi,edx xor edx,ebp shrd ecx,ecx,7 vpxor xmm7,xmm7,xmm0 mov edi,ebx xor esi,edx vpaddd xmm9,xmm11,xmm6 vmovdqa xmm11,XMMWORD[32+r14] shld ebx,ebx,5 add eax,esi vpxor xmm7,xmm7,xmm8 xor edi,ecx xor ecx,edx add eax,ebx add ebp,DWORD[52+rsp] vpsrld xmm8,xmm7,30 vmovdqa XMMWORD[32+rsp],xmm9 and edi,ecx xor ecx,edx shrd ebx,ebx,7 mov esi,eax vpslld xmm7,xmm7,2 xor edi,ecx shld eax,eax,5 add ebp,edi xor esi,ebx xor ebx,ecx add ebp,eax add edx,DWORD[56+rsp] and esi,ebx vpor xmm7,xmm7,xmm8 xor ebx,ecx shrd eax,eax,7 mov edi,ebp xor esi,ebx shld ebp,ebp,5 add edx,esi xor edi,eax xor eax,ebx add edx,ebp add ecx,DWORD[60+rsp] and edi,eax xor eax,ebx shrd ebp,ebp,7 mov esi,edx xor edi,eax shld edx,edx,5 add ecx,edi xor esi,ebp xor ebp,eax add ecx,edx vpalignr xmm8,xmm7,xmm6,8 vpxor xmm0,xmm0,xmm4 add ebx,DWORD[rsp] and esi,ebp xor ebp,eax shrd edx,edx,7 vpxor xmm0,xmm0,xmm1 mov edi,ecx xor esi,ebp vpaddd xmm9,xmm11,xmm7 shld ecx,ecx,5 add ebx,esi vpxor xmm0,xmm0,xmm8 xor edi,edx xor edx,ebp add ebx,ecx add eax,DWORD[4+rsp] vpsrld xmm8,xmm0,30 vmovdqa XMMWORD[48+rsp],xmm9 and edi,edx xor edx,ebp shrd ecx,ecx,7 mov esi,ebx vpslld xmm0,xmm0,2 xor edi,edx shld ebx,ebx,5 add eax,edi xor esi,ecx xor ecx,edx add eax,ebx add ebp,DWORD[8+rsp] and esi,ecx vpor xmm0,xmm0,xmm8 xor ecx,edx shrd ebx,ebx,7 mov edi,eax xor esi,ecx shld eax,eax,5 add ebp,esi xor edi,ebx xor ebx,ecx add ebp,eax add edx,DWORD[12+rsp] and edi,ebx xor ebx,ecx shrd eax,eax,7 mov esi,ebp xor edi,ebx shld ebp,ebp,5 add edx,edi xor esi,eax xor eax,ebx add edx,ebp vpalignr xmm8,xmm0,xmm7,8 vpxor xmm1,xmm1,xmm5 add ecx,DWORD[16+rsp] and esi,eax xor eax,ebx shrd ebp,ebp,7 vpxor xmm1,xmm1,xmm2 mov edi,edx xor esi,eax vpaddd xmm9,xmm11,xmm0 shld edx,edx,5 add ecx,esi vpxor xmm1,xmm1,xmm8 xor edi,ebp xor ebp,eax add ecx,edx add ebx,DWORD[20+rsp] vpsrld xmm8,xmm1,30 vmovdqa XMMWORD[rsp],xmm9 and edi,ebp xor ebp,eax shrd edx,edx,7 mov esi,ecx vpslld xmm1,xmm1,2 xor edi,ebp shld ecx,ecx,5 add ebx,edi xor esi,edx xor edx,ebp add ebx,ecx add eax,DWORD[24+rsp] and esi,edx vpor xmm1,xmm1,xmm8 xor edx,ebp shrd ecx,ecx,7 mov edi,ebx xor esi,edx shld ebx,ebx,5 add eax,esi xor edi,ecx xor ecx,edx add eax,ebx add ebp,DWORD[28+rsp] and edi,ecx xor ecx,edx shrd ebx,ebx,7 mov esi,eax xor edi,ecx shld eax,eax,5 add ebp,edi xor esi,ebx xor ebx,ecx add ebp,eax vpalignr xmm8,xmm1,xmm0,8 vpxor xmm2,xmm2,xmm6 add edx,DWORD[32+rsp] and esi,ebx xor ebx,ecx shrd eax,eax,7 vpxor xmm2,xmm2,xmm3 mov edi,ebp xor esi,ebx vpaddd xmm9,xmm11,xmm1 shld ebp,ebp,5 add edx,esi vpxor xmm2,xmm2,xmm8 xor edi,eax xor eax,ebx add edx,ebp add ecx,DWORD[36+rsp] vpsrld xmm8,xmm2,30 vmovdqa XMMWORD[16+rsp],xmm9 and edi,eax xor eax,ebx shrd ebp,ebp,7 mov esi,edx vpslld xmm2,xmm2,2 xor edi,eax shld edx,edx,5 add ecx,edi xor esi,ebp xor ebp,eax add ecx,edx add ebx,DWORD[40+rsp] and esi,ebp vpor xmm2,xmm2,xmm8 xor ebp,eax shrd edx,edx,7 mov edi,ecx xor esi,ebp shld ecx,ecx,5 add ebx,esi xor edi,edx xor edx,ebp add ebx,ecx add eax,DWORD[44+rsp] and edi,edx xor edx,ebp shrd ecx,ecx,7 mov esi,ebx xor edi,edx shld ebx,ebx,5 add eax,edi xor esi,edx add eax,ebx vpalignr xmm8,xmm2,xmm1,8 vpxor xmm3,xmm3,xmm7 add ebp,DWORD[48+rsp] xor esi,ecx mov edi,eax shld eax,eax,5 vpxor xmm3,xmm3,xmm4 add ebp,esi xor edi,ecx vpaddd xmm9,xmm11,xmm2 shrd ebx,ebx,7 add ebp,eax vpxor xmm3,xmm3,xmm8 add edx,DWORD[52+rsp] xor edi,ebx mov esi,ebp shld ebp,ebp,5 vpsrld xmm8,xmm3,30 vmovdqa XMMWORD[32+rsp],xmm9 add edx,edi xor esi,ebx shrd eax,eax,7 add edx,ebp vpslld xmm3,xmm3,2 add ecx,DWORD[56+rsp] xor esi,eax mov edi,edx shld edx,edx,5 add ecx,esi xor edi,eax shrd ebp,ebp,7 add ecx,edx vpor xmm3,xmm3,xmm8 add ebx,DWORD[60+rsp] xor edi,ebp mov esi,ecx shld ecx,ecx,5 add ebx,edi xor esi,ebp shrd edx,edx,7 add ebx,ecx add eax,DWORD[rsp] vpaddd xmm9,xmm11,xmm3 xor esi,edx mov edi,ebx shld ebx,ebx,5 add eax,esi vmovdqa XMMWORD[48+rsp],xmm9 xor edi,edx shrd ecx,ecx,7 add eax,ebx add ebp,DWORD[4+rsp] xor edi,ecx mov esi,eax shld eax,eax,5 add ebp,edi xor esi,ecx shrd ebx,ebx,7 add ebp,eax add edx,DWORD[8+rsp] xor esi,ebx mov edi,ebp shld ebp,ebp,5 add edx,esi xor edi,ebx shrd eax,eax,7 add edx,ebp add ecx,DWORD[12+rsp] xor edi,eax mov esi,edx shld edx,edx,5 add ecx,edi xor esi,eax shrd ebp,ebp,7 add ecx,edx cmp r9,r10 je NEAR $L$done_avx vmovdqa xmm6,XMMWORD[64+r14] vmovdqa xmm11,XMMWORD[((-64))+r14] vmovdqu xmm0,XMMWORD[r9] vmovdqu xmm1,XMMWORD[16+r9] vmovdqu xmm2,XMMWORD[32+r9] vmovdqu xmm3,XMMWORD[48+r9] vpshufb xmm0,xmm0,xmm6 add r9,64 add ebx,DWORD[16+rsp] xor esi,ebp vpshufb xmm1,xmm1,xmm6 mov edi,ecx shld ecx,ecx,5 vpaddd xmm4,xmm0,xmm11 add ebx,esi xor edi,ebp shrd edx,edx,7 add ebx,ecx vmovdqa XMMWORD[rsp],xmm4 add eax,DWORD[20+rsp] xor edi,edx mov esi,ebx shld ebx,ebx,5 add eax,edi xor esi,edx shrd ecx,ecx,7 add eax,ebx add ebp,DWORD[24+rsp] xor esi,ecx mov edi,eax shld eax,eax,5 add ebp,esi xor edi,ecx shrd ebx,ebx,7 add ebp,eax add edx,DWORD[28+rsp] xor edi,ebx mov esi,ebp shld ebp,ebp,5 add edx,edi xor esi,ebx shrd eax,eax,7 add edx,ebp add ecx,DWORD[32+rsp] xor esi,eax vpshufb xmm2,xmm2,xmm6 mov edi,edx shld edx,edx,5 vpaddd xmm5,xmm1,xmm11 add ecx,esi xor edi,eax shrd ebp,ebp,7 add ecx,edx vmovdqa XMMWORD[16+rsp],xmm5 add ebx,DWORD[36+rsp] xor edi,ebp mov esi,ecx shld ecx,ecx,5 add ebx,edi xor esi,ebp shrd edx,edx,7 add ebx,ecx add eax,DWORD[40+rsp] xor esi,edx mov edi,ebx shld ebx,ebx,5 add eax,esi xor edi,edx shrd ecx,ecx,7 add eax,ebx add ebp,DWORD[44+rsp] xor edi,ecx mov esi,eax shld eax,eax,5 add ebp,edi xor esi,ecx shrd ebx,ebx,7 add ebp,eax add edx,DWORD[48+rsp] xor esi,ebx vpshufb xmm3,xmm3,xmm6 mov edi,ebp shld ebp,ebp,5 vpaddd xmm6,xmm2,xmm11 add edx,esi xor edi,ebx shrd eax,eax,7 add edx,ebp vmovdqa XMMWORD[32+rsp],xmm6 add ecx,DWORD[52+rsp] xor edi,eax mov esi,edx shld edx,edx,5 add ecx,edi xor esi,eax shrd ebp,ebp,7 add ecx,edx add ebx,DWORD[56+rsp] xor esi,ebp mov edi,ecx shld ecx,ecx,5 add ebx,esi xor edi,ebp shrd edx,edx,7 add ebx,ecx add eax,DWORD[60+rsp] xor edi,edx mov esi,ebx shld ebx,ebx,5 add eax,edi shrd ecx,ecx,7 add eax,ebx add eax,DWORD[r8] add esi,DWORD[4+r8] add ecx,DWORD[8+r8] add edx,DWORD[12+r8] mov DWORD[r8],eax add ebp,DWORD[16+r8] mov DWORD[4+r8],esi mov ebx,esi mov DWORD[8+r8],ecx mov edi,ecx mov DWORD[12+r8],edx xor edi,edx mov DWORD[16+r8],ebp and esi,edi jmp NEAR $L$oop_avx ALIGN 16 $L$done_avx: add ebx,DWORD[16+rsp] xor esi,ebp mov edi,ecx shld ecx,ecx,5 add ebx,esi xor edi,ebp shrd edx,edx,7 add ebx,ecx add eax,DWORD[20+rsp] xor edi,edx mov esi,ebx shld ebx,ebx,5 add eax,edi xor esi,edx shrd ecx,ecx,7 add eax,ebx add ebp,DWORD[24+rsp] xor esi,ecx mov edi,eax shld eax,eax,5 add ebp,esi xor edi,ecx shrd ebx,ebx,7 add ebp,eax add edx,DWORD[28+rsp] xor edi,ebx mov esi,ebp shld ebp,ebp,5 add edx,edi xor esi,ebx shrd eax,eax,7 add edx,ebp add ecx,DWORD[32+rsp] xor esi,eax mov edi,edx shld edx,edx,5 add ecx,esi xor edi,eax shrd ebp,ebp,7 add ecx,edx add ebx,DWORD[36+rsp] xor edi,ebp mov esi,ecx shld ecx,ecx,5 add ebx,edi xor esi,ebp shrd edx,edx,7 add ebx,ecx add eax,DWORD[40+rsp] xor esi,edx mov edi,ebx shld ebx,ebx,5 add eax,esi xor edi,edx shrd ecx,ecx,7 add eax,ebx add ebp,DWORD[44+rsp] xor edi,ecx mov esi,eax shld eax,eax,5 add ebp,edi xor esi,ecx shrd ebx,ebx,7 add ebp,eax add edx,DWORD[48+rsp] xor esi,ebx mov edi,ebp shld ebp,ebp,5 add edx,esi xor edi,ebx shrd eax,eax,7 add edx,ebp add ecx,DWORD[52+rsp] xor edi,eax mov esi,edx shld edx,edx,5 add ecx,edi xor esi,eax shrd ebp,ebp,7 add ecx,edx add ebx,DWORD[56+rsp] xor esi,ebp mov edi,ecx shld ecx,ecx,5 add ebx,esi xor edi,ebp shrd edx,edx,7 add ebx,ecx add eax,DWORD[60+rsp] xor edi,edx mov esi,ebx shld ebx,ebx,5 add eax,edi shrd ecx,ecx,7 add eax,ebx vzeroupper add eax,DWORD[r8] add esi,DWORD[4+r8] add ecx,DWORD[8+r8] mov DWORD[r8],eax add edx,DWORD[12+r8] mov DWORD[4+r8],esi add ebp,DWORD[16+r8] mov DWORD[8+r8],ecx mov DWORD[12+r8],edx mov DWORD[16+r8],ebp movaps xmm6,XMMWORD[((-40-96))+r11] movaps xmm7,XMMWORD[((-40-80))+r11] movaps xmm8,XMMWORD[((-40-64))+r11] movaps xmm9,XMMWORD[((-40-48))+r11] movaps xmm10,XMMWORD[((-40-32))+r11] movaps xmm11,XMMWORD[((-40-16))+r11] mov r14,QWORD[((-40))+r11] mov r13,QWORD[((-32))+r11] mov r12,QWORD[((-24))+r11] mov rbp,QWORD[((-16))+r11] mov rbx,QWORD[((-8))+r11] lea rsp,[r11] $L$epilogue_avx: mov rdi,QWORD[8+rsp] ;WIN64 epilogue mov rsi,QWORD[16+rsp] DB 0F3h,0C3h ;repret $L$SEH_end_sha1_block_data_order_avx: ALIGN 64 K_XX_XX: DD 0x5a827999,0x5a827999,0x5a827999,0x5a827999 DD 0x5a827999,0x5a827999,0x5a827999,0x5a827999 DD 0x6ed9eba1,0x6ed9eba1,0x6ed9eba1,0x6ed9eba1 DD 0x6ed9eba1,0x6ed9eba1,0x6ed9eba1,0x6ed9eba1 DD 0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc DD 0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc DD 0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6 DD 0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6 DD 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f DD 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f DB 0xf,0xe,0xd,0xc,0xb,0xa,0x9,0x8,0x7,0x6,0x5,0x4,0x3,0x2,0x1,0x0 DB 83,72,65,49,32,98,108,111,99,107,32,116,114,97,110,115 DB 102,111,114,109,32,102,111,114,32,120,56,54,95,54,52,44 DB 32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60 DB 97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114 DB 103,62,0 ALIGN 64 EXTERN __imp_RtlVirtualUnwind ALIGN 16 se_handler: push rsi push rdi push rbx push rbp push r12 push r13 push r14 push r15 pushfq sub rsp,64 mov rax,QWORD[120+r8] mov rbx,QWORD[248+r8] lea r10,[$L$prologue] cmp rbx,r10 jb NEAR $L$common_seh_tail mov rax,QWORD[152+r8] lea r10,[$L$epilogue] cmp rbx,r10 jae NEAR $L$common_seh_tail mov rax,QWORD[64+rax] mov rbx,QWORD[((-8))+rax] mov rbp,QWORD[((-16))+rax] mov r12,QWORD[((-24))+rax] mov r13,QWORD[((-32))+rax] mov r14,QWORD[((-40))+rax] mov QWORD[144+r8],rbx mov QWORD[160+r8],rbp mov QWORD[216+r8],r12 mov QWORD[224+r8],r13 mov QWORD[232+r8],r14 jmp NEAR $L$common_seh_tail ALIGN 16 ssse3_handler: push rsi push rdi push rbx push rbp push r12 push r13 push r14 push r15 pushfq sub rsp,64 mov rax,QWORD[120+r8] mov rbx,QWORD[248+r8] mov rsi,QWORD[8+r9] mov r11,QWORD[56+r9] mov r10d,DWORD[r11] lea r10,[r10*1+rsi] cmp rbx,r10 jb NEAR $L$common_seh_tail mov rax,QWORD[208+r8] mov r10d,DWORD[4+r11] lea r10,[r10*1+rsi] cmp rbx,r10 jae NEAR $L$common_seh_tail lea rsi,[((-40-96))+rax] lea rdi,[512+r8] mov ecx,12 DD 0xa548f3fc mov rbx,QWORD[((-8))+rax] mov rbp,QWORD[((-16))+rax] mov r12,QWORD[((-24))+rax] mov r13,QWORD[((-32))+rax] mov r14,QWORD[((-40))+rax] mov QWORD[144+r8],rbx mov QWORD[160+r8],rbp mov QWORD[216+r8],r12 mov QWORD[224+r8],r13 mov QWORD[232+r8],r14 $L$common_seh_tail: mov rdi,QWORD[8+rax] mov rsi,QWORD[16+rax] mov QWORD[152+r8],rax mov QWORD[168+r8],rsi mov QWORD[176+r8],rdi mov rdi,QWORD[40+r9] mov rsi,r8 mov ecx,154 DD 0xa548f3fc mov rsi,r9 xor rcx,rcx mov rdx,QWORD[8+rsi] mov r8,QWORD[rsi] mov r9,QWORD[16+rsi] mov r10,QWORD[40+rsi] lea r11,[56+rsi] lea r12,[24+rsi] mov QWORD[32+rsp],r10 mov QWORD[40+rsp],r11 mov QWORD[48+rsp],r12 mov QWORD[56+rsp],rcx call QWORD[__imp_RtlVirtualUnwind] mov eax,1 add rsp,64 popfq pop r15 pop r14 pop r13 pop r12 pop rbp pop rbx pop rdi pop rsi DB 0F3h,0C3h ;repret section .pdata rdata align=4 ALIGN 4 DD $L$SEH_begin_sha1_block_data_order wrt ..imagebase DD $L$SEH_end_sha1_block_data_order wrt ..imagebase DD $L$SEH_info_sha1_block_data_order wrt ..imagebase DD $L$SEH_begin_sha1_block_data_order_ssse3 wrt ..imagebase DD $L$SEH_end_sha1_block_data_order_ssse3 wrt ..imagebase DD $L$SEH_info_sha1_block_data_order_ssse3 wrt ..imagebase DD $L$SEH_begin_sha1_block_data_order_avx wrt ..imagebase DD $L$SEH_end_sha1_block_data_order_avx wrt ..imagebase DD $L$SEH_info_sha1_block_data_order_avx wrt ..imagebase section .xdata rdata align=8 ALIGN 8 $L$SEH_info_sha1_block_data_order: DB 9,0,0,0 DD se_handler wrt ..imagebase $L$SEH_info_sha1_block_data_order_ssse3: DB 9,0,0,0 DD ssse3_handler wrt ..imagebase DD $L$prologue_ssse3 wrt ..imagebase,$L$epilogue_ssse3 wrt ..imagebase $L$SEH_info_sha1_block_data_order_avx: DB 9,0,0,0 DD ssse3_handler wrt ..imagebase DD $L$prologue_avx wrt ..imagebase,$L$epilogue_avx wrt ..imagebase
chpatrick/boring-crypto
cbits/win-x86_64/crypto/fipsmodule/sha1-x86_64.asm
Assembly
mit
62,409
/* * FILE: RDDSampleUtilsTest * Copyright (c) 2015 - 2018 GeoSpark Development Team * * MIT License * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * */ package org.datasyslab.geospark.utils; import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; public class RDDSampleUtilsTest { /** * Test get sample numbers. */ @Test public void testGetSampleNumbers() { assertEquals(10, RDDSampleUtils.getSampleNumbers(2, 10, -1)); assertEquals(100, RDDSampleUtils.getSampleNumbers(2, 100, -1)); assertEquals(10, RDDSampleUtils.getSampleNumbers(5, 1000, -1)); assertEquals(100, RDDSampleUtils.getSampleNumbers(5, 10000, -1)); assertEquals(100, RDDSampleUtils.getSampleNumbers(5, 10001, -1)); assertEquals(1000, RDDSampleUtils.getSampleNumbers(5, 100011, -1)); assertEquals(99, RDDSampleUtils.getSampleNumbers(6, 100011, 99)); assertEquals(999, RDDSampleUtils.getSampleNumbers(20, 999, -1)); assertEquals(40, RDDSampleUtils.getSampleNumbers(20, 1000, -1)); } /** * Test too many partitions. */ @Test public void testTooManyPartitions() { assertFailure(505, 999); assertFailure(505, 1000); assertFailure(10, 1000, 2100); } private void assertFailure(int numPartitions, long totalNumberOfRecords) { assertFailure(numPartitions, totalNumberOfRecords, -1); } private void assertFailure(int numPartitions, long totalNumberOfRecords, int givenSampleNumber) { try { RDDSampleUtils.getSampleNumbers(numPartitions, totalNumberOfRecords, givenSampleNumber); fail("Expected IllegalArgumentException"); } catch (IllegalArgumentException e) { // expected } } }
Sarwat/GeoSpark
core/src/test/java/org/datasyslab/geospark/utils/RDDSampleUtilsTest.java
Java
mit
2,880
<?php /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * Class for axis handling. * * PHP versions 4 and 5 * * LICENSE: This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or (at your * option) any later version. This library is distributed in the hope that it * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser * General Public License for more details. You should have received a copy of * the GNU Lesser General Public License along with this library; if not, write * to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * 02111-1307 USA * * @category Images * @package Image_Graph * @subpackage Axis * @author Jesper Veggerby <[email protected]> * @copyright Copyright (C) 2003, 2004 Jesper Veggerby Hansen * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id: Category.php,v 1.19 2006/03/02 12:15:17 nosey Exp $ * @link http://pear.php.net/package/Image_Graph */ /** * Include file Image/Graph/Axis.php */ require_once 'Image/Graph/Axis.php'; /** * A normal axis thats displays labels with a 'interval' of 1. * This is basically a normal axis where the range is * the number of labels defined, that is the range is explicitly defined * when constructing the axis. * * @category Images * @package Image_Graph * @subpackage Axis * @author Jesper Veggerby <[email protected]> * @copyright Copyright (C) 2003, 2004 Jesper Veggerby Hansen * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Image_Graph */ class Image_Graph_Axis_Category extends Image_Graph_Axis { /** * The labels shown on the axis * @var array * @access private */ var $_labels = false; /** * Image_Graph_Axis_Category [Constructor]. * * @param int $type The type (direction) of the Axis */ function Image_Graph_Axis_Category($type = IMAGE_GRAPH_AXIS_X) { parent::Image_Graph_Axis($type); $this->_labels = array(); $this->setlabelInterval(1); } /** * Gets the minimum value the axis will show. * * This is always 0 * * @return double The minumum value * @access private */ function _getMinimum() { return 0; } /** * Gets the maximum value the axis will show. * * This is always the number of labels passed to the constructor. * * @return double The maximum value * @access private */ function _getMaximum() { return count($this->_labels) - 1; } /** * Sets the minimum value the axis will show. * * A minimum cannot be set on a SequentialAxis, it is always 0. * * @param double Minimum The minumum value to use on the axis * @access private */ function _setMinimum($minimum) { } /** * Sets the maximum value the axis will show * * A maximum cannot be set on a SequentialAxis, it is always the number * of labels passed to the constructor. * * @param double Maximum The maximum value to use on the axis * @access private */ function _setMaximum($maximum) { } /** * Forces the minimum value of the axis * * <b>A minimum cannot be set on this type of axis</b> * * To modify the labels which are displayed on the axis, instead use * setLabelInterval($labels) where $labels is an array containing the * values/labels the axis should display. <b>Note!</b> Only values in * this array will then be displayed on the graph! * * @param double $minimum A minimum cannot be set on this type of axis */ function forceMinimum($minimum, $userEnforce = true) { } /** * Forces the maximum value of the axis * * <b>A maximum cannot be set on this type of axis</b> * * To modify the labels which are displayed on the axis, instead use * setLabelInterval($labels) where $labels is an array containing the * values/labels the axis should display. <b>Note!</b> Only values in * this array will then be displayed on the graph! * * @param double $maximum A maximum cannot be set on this type of axis */ function forceMaximum($maximum, $userEnforce = true) { } /** * Sets an interval for where labels are shown on the axis. * * The label interval is rounded to nearest integer value. * * @param double $labelInterval The interval with which labels are shown */ function setLabelInterval($labelInterval = 'auto', $level = 1) { if (is_array($labelInterval)) { parent::setLabelInterval($labelInterval); } elseif ($labelInterval == 'auto') { parent::setLabelInterval(1); } else { parent::setLabelInterval(round($labelInterval)); } } /** * Preprocessor for values, ie for using logarithmic axis * * @param double $value The value to preprocess * @return double The preprocessed value * @access private */ function _value($value) { // $the_value = array_search($value, $this->_labels); if (isset($this->_labels[$value])) { $the_value = $this->_labels[$value]; if ($the_value !== false) { return $the_value + ($this->_pushValues ? 0.5 : 0); } else { return 0; } } } /** * Get the minor label interval with which axis label ticks are drawn. * * For a sequential axis this is always disabled (i.e false) * * @return double The minor label interval, always false * @access private */ function _minorLabelInterval() { return false; } /** * Get the size in pixels of the axis. * * For an x-axis this is the width of the axis including labels, and for an * y-axis it is the corrresponding height * * @return int The size of the axis * @access private */ function _size() { if (!$this->_visible) { return 0; } $this->_canvas->setFont($this->_getFont()); $maxSize = 0; foreach($this->_labels as $label => $id) { $labelPosition = $this->_point($label); if (is_object($this->_dataPreProcessor)) { $labelText = $this->_dataPreProcessor->_process($label); } else { $labelText = $label; } if ((($this->_type == IMAGE_GRAPH_AXIS_X) && (!$this->_transpose)) || (($this->_type != IMAGE_GRAPH_AXIS_X) && ($this->_transpose))) { $maxSize = max($maxSize, $this->_canvas->textHeight($labelText)); } else { $maxSize = max($maxSize, $this->_canvas->textWidth($labelText)); } } if ($this->_title) { $this->_canvas->setFont($this->_getTitleFont()); if ((($this->_type == IMAGE_GRAPH_AXIS_X) && (!$this->_transpose)) || (($this->_type != IMAGE_GRAPH_AXIS_X) && ($this->_transpose))) { $maxSize += $this->_canvas->textHeight($this->_title); } else { $maxSize += $this->_canvas->textWidth($this->_title); } $maxSize += 10; } return $maxSize +3; } /** * Apply the dataset to the axis. * * This calculates the order of the categories, which is very important * for fx. line plots, so that the line does not "go backwards", consider * these X-sets:<p> * 1: (1, 2, 3, 4, 5, 6)<br> * 2: (0, 1, 2, 3, 4, 5, 6, 7)<p> * If they are not ordered, but simply appended, the categories on the axis * would be:<p> * X: (1, 2, 3, 4, 5, 6, 0, 7)<p> * Which would render the a line for the second plot to show incorrectly. * Instead this algorithm, uses and 'value- is- before' method to see that * the 0 is before a 1 in the second set, and that it should also be before * a 1 in the X set. Hence:<p> * X: (0, 1, 2, 3, 4, 5, 6, 7) * * @param Image_Graph_Dataset $dataset The dataset * @access private */ function _applyDataset(&$dataset) { $newLabels = array(); $allLabels = array(); $dataset->_reset(); $count = 0; $count_new = 0; while ($point = $dataset->_next()) { if ($this->_type == IMAGE_GRAPH_AXIS_X) { $data = $point['X']; } else { $data = $point['Y']; } if (!isset($this->_labels[$data])) { $newLabels[$data] = $count_new++; //$this->_labels[] = $data; } $allLabels[$data] = $count++; } if (count($this->_labels) == 0) { $this->_labels = $newLabels; } elseif ((is_array($newLabels)) && (count($newLabels) > 0)) { // get all intersecting labels $intersect = array_intersect(array_keys($allLabels), array_keys($this->_labels)); // traverse all new and find their relative position withing the // intersec, fx value X0 is before X1 in the intersection, which // means that X0 should be placed before X1 in the label array foreach($newLabels as $newLabel => $id) { $key = $allLabels[$newLabel]; reset($intersect); $this_value = false; // intersect indexes are the same as in allLabels! $first = true; while ((list($id, $value) = each($intersect)) && ($this_value === false)) { if (($first) && ($id > $key)) { $this_value = $value; } elseif ($id >= $key) { $this_value = $value; } $first = false; } if ($this_value === false) { // the new label was not found before anything in the // intersection -> append it $this->_labels[$newLabel] = count($this->_labels); } else { // the new label was found before $this_value in the // intersection, insert the label before this position in // the label array // $key = $this->_labels[$this_value]; $keys = array_keys($this->_labels); $key = array_search($this_value, $keys); $pre = array_slice($keys, 0, $key); $pre[] = $newLabel; $post = array_slice($keys, $key); $this->_labels = array_flip(array_merge($pre, $post)); } } unset($keys); } $labels = array_keys($this->_labels); $i = 0; foreach ($labels as $label) { $this->_labels[$label] = $i++; } // $this->_labels = array_values(array_unique($this->_labels)); $this->_calcLabelInterval(); } /** * Return the label distance. * * @return int The distance between 2 adjacent labels * @access private */ function _labelDistance($level = 1) { reset($this->_labels); list($l1) = each($this->_labels); list($l2) = each($this->_labels); return abs($this->_point($l2) - $this->_point($l1)); } /** * Get next label point * * @param doubt $point The current point, if omitted or false, the first is * returned * @return double The next label point * @access private */ function _getNextLabel($currentLabel = false, $level = 1) { if ($currentLabel === false) { reset($this->_labels); } $result = false; $count = ($currentLabel === false ? $this->_labelInterval() - 1 : 0); while ($count < $this->_labelInterval()) { $result = (list($label) = each($this->_labels)); $count++; } if ($result) { return $label; } else { return false; } } /** * Is the axis numeric or not? * * @return bool True if numeric, false if not * @access private */ function _isNumeric() { return false; } /** * Output the axis * * @return bool Was the output 'good' (true) or 'bad' (false). * @access private */ function _done() { $result = true; if (Image_Graph_Element::_done() === false) { $result = false; } $this->_canvas->startGroup(get_class($this)); $this->_drawAxisLines(); $this->_canvas->startGroup(get_class($this) . '_ticks'); $label = false; while (($label = $this->_getNextLabel($label)) !== false) { $this->_drawTick($label); } $this->_canvas->endGroup(); $this->_canvas->endGroup(); return $result; } } ?>
extremeframework/extremeframework
library/external/PEAR/Image/Graph/Axis/Category.php
PHP
mit
13,647
/** * Created by huangyao on 14-10-1. */ var _ = require('lodash'); var color =require('colors'); var fs =require('fs'); var config = require('../config.js'); var path = require('path'); var mongoose = require("mongoose"); var lcommon = require('lush').common; console.log(config.db); mongoose.connect(config.db,function (err) { if(err){ throw new Error('db connect error!\n'+err); } console.log('db connect success!'.yellow); }); // console.log('point'); // var models = { // // init : function (callback) { // fs.readdir(path+'/module',function (err,files) { // if(err){ // throw err; // } // // console.log(files); // return callback(files.filter(function (item) { // return !(item === "index.js" || item === "." || item === ".."); // })); // }); // }, // }; // // // models.init(function (files) { // // console.log(files); // for (var item in files) { // //reuire all modules // // console.log(lcommon.literat(files[item]).slice(0,-3)); // console.log(files[item]); // item = files[item].split('.')[0]; // require('./'+ item); // var m = lcommon.literat(item); // console.log('loading and use ',m,' model'); // exports[m] = mongoose.model(m); // // // _.extend(models,file.exports); // // console.log(file); // } // }); // var models = fs.readdirSync(path.resolve('.','module')); models.forEach(function(item,index){ if(item !== '.' && item !== '..' && item !== 'index.js'){ // console.log(item.indexOf('.js')); //ends with .js if(item.indexOf('.js') == (item.length-3)){ item = item.split('.')[0]; require('./'+ item); var m = lcommon.literat(item); console.log('loading and use ',m,' model'); exports[m] = mongoose.model(m); } } });
NodeAndroid/Action_server
module/index.js
JavaScript
mit
1,812
namespace SalesDatabase.Models { using System.Collections.Generic; public class StoreLocation { public StoreLocation() { this.SalesInStore = new HashSet<Sale>(); } public int Id { get; set; } public string LocationName { get; set; } public ICollection<Sale> SalesInStore { get; set; } } }
sevdalin/Software-University-SoftUni
Db Advanced - EF Core/04. EntityFramework Code-First Advanced/SalesDatabase/Models/StoreLocation.cs
C#
mit
371
# -*- coding:utf-8 -*- from re import sub from itertools import islice ''' 如何调整字符串的文本格式 ''' # 将日志文件中的日期格式转变为美国日期格式mm/dd/yyyy # 使用正则表达式模块中的sub函数进行替换字符串 with open("./log.log","r") as f: for line in islice(f,0,None): #print sub("(\d{4})-(\d{2})-(\d{2})",r"\2/\3/\1",line) # 可以为每个匹配组起一个别名 print sub("(?P<year>\d{4})-(?P<month>\d{2})-(?P<day>\d{2})",r"\g<month>/\g<day>/\g<>",line)
liuhll/BlogAndArticle
Notes/Python/src/exercise/string_repalce_by_resub.py
Python
mit
537
#============================================================================== # Copyright (c) 2013 Urusov Andrey <[email protected]> #============================================================================== MACRO(ADD_PCH SOURCE_FILES NO_PCH_FILES PROJECT_PATH PCH_PATH_LOCAL PCH_FILE_NAME) SET(PCH_PATH_LOCAL_INTERNAL ${PCH_PATH_LOCAL}) IF (${PCH_PATH_LOCAL_INTERNAL} STREQUAL "./" OR ${PCH_PATH_LOCAL_INTERNAL} STREQUAL ".") SET(PCH_PATH_LOCAL_INTERNAL) ELSE() SET(PCH_PATH_LOCAL_INTERNAL ${PCH_PATH_LOCAL_INTERNAL}/) ENDIF() SET(PCH_FILE_HEADER_IN_SOURCE ${PROJECT_PATH}/${PCH_PATH_LOCAL_INTERNAL}${PCH_FILE_NAME}.h) SET(PCH_BINARY_OUT ${CMAKE_CURRENT_BINARY_DIR}/${PCH_FILE_NAME}.pch) SET(PHP_FILE_CPP ${PCH_PATH_LOCAL_INTERNAL}${PCH_FILE_NAME}.cpp) FOREACH(source_file ${SOURCE_FILES}) GET_FILENAME_COMPONENT(CPP ${source_file} EXT) IF(${CPP} STREQUAL ".cpp") IF(${source_file} STREQUAL ${PHP_FILE_CPP}) SET_SOURCE_FILES_PROPERTIES(${PHP_FILE_CPP} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} /Yc${PCH_FILE_HEADER_IN_SOURCE} /Fp${PCH_BINARY_OUT}" ) SET_SOURCE_FILES_PROPERTIES(${PHP_FILE_CPP} PROPERTIES OBJECT_OUTPUTS ${PCH_BINARY_OUT} ) ELSE() LIST(FIND NO_PCH_FILES ${source_file} no_pch_index) IF(${no_pch_index} EQUAL -1) SET_SOURCE_FILES_PROPERTIES(${source_file} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} /Yu${PCH_FILE_HEADER_IN_SOURCE} /Fp${PCH_BINARY_OUT}" ) SET_SOURCE_FILES_PROPERTIES(${source_file} PROPERTIES OBJECT_DEPENDS ${PCH_BINARY_OUT} ) ENDIF(${no_pch_index} EQUAL -1) ENDIF() ENDIF() ENDFOREACH(source_file) ENDMACRO(ADD_PCH)
AlexChernov/rdo_studio
cmake/pch.cmake
CMake
mit
1,954
version https://git-lfs.github.com/spec/v1 oid sha256:054dbc79bbfc64911008a1e140813a8705dfc5cff35cbffd8bf7bc1f74c446b6 size 5257
yogeshsaroya/new-cdnjs
ajax/libs/flot/0.8.0/jquery.flot.fillbetween.js
JavaScript
mit
129
/* form elements */ input[type="submit"], input[type="text"], input[type="password"], input[type="submit"], input[type="tel"], button[type="button"], button[type="submit"], textarea { -webkit-appearance: none; -moz-appearance: none; -o-appearance: none; border-radius: 0 !important; } input[type="text"] { padding: 0; } /* web accecibility settings */ a:focus, select:focus, input[type="radio"]:focus, input[type="checkbox"]:focus, input[type="text"]:focus, input[type="tel"]:focus, input[type="password"]:focus, button:focus, textarea:focus { outline: #ccc dashed 1px; } a:active, select:active, input[type="radio"]:active, input[type="checkbox"]:active, input[type="text"]:active, input[type="tel"]:active, input[type="password"]:active, textarea:active { outline: 0; } /* default fonts & color */ body { font-size: 14px; margin: 0; color: white; background: #002144; } select, input, button, textarea { font-family: 'source-han-sans-korean', sans-serif; } a { text-decoration: none; color: inherit; } .setWidth { margin: 0 auto; } #contentWrap { margin-bottom: 100px; } .modalFull { display: none; } .topCover { display: none; } .mobile { display: none; } /* preloader */ #preloader { position: fixed; z-index: 500; top: 0; left: 0; right: 0; bottom: 0; background: url(../images/ajax-loader.gif) center no-repeat #002144; } /* header */ #headerMobile { display: none; } .gnbMobileBtn { display: none; } header .setWidth { padding: 10px 0; } header #logo { padding-top: 20px; } header #logo a { display: block; } header #logo img { width: 200px; } header nav.gnb { float: right; } header nav.gnb > ul { float: right; } header nav.gnb > ul > li { float: left; position: relative; } header nav.gnb > ul > li.last ul { right: 0; } header nav.gnb li ul { display: none; position: absolute; width: 140px; background: white; } header nav.gnb li li a { color: #002144; } header nav.gnb > ul > li.active ul { display: block; } header nav.gnb a { display: block; padding: 10px; } header nav.gnb a:hover { background: #f05f5f; color: white; } header nav.shortMenu ul { float: right; } header nav.shortMenu li { float: left; } header nav.shortMenu a { display: block; padding: 10px; } nav.lnb li a { display: block; padding: 10px 10px; } nav.lnb li a:hover { background: #f05f5f; } /* footer */ footer { clear: both; } footer nav.footerMenu li { float: left; } footer nav.footerMenu a { display: block; padding: 10px; } footer nav.footerMenu li:first-child a { padding-left: 0; } footer .familySite { position: relative; } footer .familySite:hover ul { display: block; } footer .familySite p { border: 1px solid white; } footer .familySite p a { display: block; padding: 10px; } footer .familySite ul { position: absolute; width: 100%; bottom: 38px; display: none; border: 1px solid white; border-top: 0 none; } footer .familySite li:last-child a { border-bottom: 0 none; } footer .familySite li a { display: block; padding: 10px; border-top: 1px solid white; background: #002144; } footer .familySite li a:hover { background: #f05f5f; } footer .copyright { clear: both; padding: 10px 0; font-size: 0.9em; } footer .copyright .logoFooter a { display: block; } footer .copyright .logoFooter img { width: 100%; max-width: 200px; } footer address { margin-bottom: 5px; }
chocoma87/sp.framework
css/layout.css
CSS
mit
3,612
module Supa class Builder COMMANDS_WITH_DEFAULT_INTERFACE = %w(attribute virtual object namespace collection append).freeze def initialize(subject, representer:, tree:) @subject = subject @representer = representer @tree = tree end COMMANDS_WITH_DEFAULT_INTERFACE.each do |command| klass = Supa::Commands.const_get(command.capitalize) define_method(command) do |name, **options, &block| klass.new(@subject, representer: @representer, tree: @tree, name: name, options: options, &block).represent end end def attributes(*names, **options) Supa::Commands::Attributes.new( @subject, representer: @representer, tree: @tree, name: names, options: options ).represent end def to_hash @tree.to_hash end def to_json Oj.dump(to_hash, mode: :strict) end end end
dasnotme/supa
lib/supa/builder.rb
Ruby
mit
931
import org.scalatest.{Matchers, FunSuite} class SeriesTest extends FunSuite with Matchers { test("slices of one") { Series.slices(1, "") should be (List()) Series.slices(1, "01234") should be (List(List(0), List(1), List(2), List(3), List(4))) } test("slices of two") { Series.slices(2, "") should be (List()) Series.slices(2, "01") should be (List(List(0, 1))) Series.slices(2, "01234") should be (List(List(0, 1), List(1, 2), List(2, 3), List(3, 4))) } test("slices of three") { Series.slices(3, "") should be (List()) Series.slices(3, "012") should be (List(List(0, 1, 2))) Series.slices(3, "01234") should be (List(List(0, 1, 2), List(1, 2, 3), List(2, 3, 4))) } }
nlochschmidt/xscala
series/src/test/scala/SeriesTest.scala
Scala
mit
735
/**************************************************************************//** * Copyright (c) 2016 by Silicon Laboratories Inc. All rights reserved. * * http://developer.silabs.com/legal/version/v11/Silicon_Labs_Software_License_Agreement.txt *****************************************************************************/ #include "uart_1.h" #if EFM8PDL_UART1_AUTO_PAGE == 1 // declare variable needed for autopage enter/exit #define DECL_PAGE uint8_t savedPage // enter autopage section #define SET_PAGE(p) do \ { \ savedPage = SFRPAGE; /* save current SFR page */ \ SFRPAGE = (p); /* set SFR page */ \ } while(0) // exit autopage section #define RESTORE_PAGE do \ { \ SFRPAGE = savedPage; /* restore saved SFR page */ \ } while(0) #else #define DECL_PAGE #define SET_PAGE(x) #define RESTORE_PAGE #endif //EFM8PDL_UART1_AUTO_PAGE // SFR page used to access UART1 registers #define UART1_SFR_PAGE 0x20 // Clock prescaler values for baud rate initialization #define NUM_PRESC 8 static const uint8_t PRESC[NUM_PRESC] = {1, 4, 8, 12, 16, 24, 32, 48}; static const uint8_t PRESC_ENUM[NUM_PRESC] = {SBCON1_BPS__DIV_BY_1, SBCON1_BPS__DIV_BY_4, SBCON1_BPS__DIV_BY_8, SBCON1_BPS__DIV_BY_12, SBCON1_BPS__DIV_BY_16, SBCON1_BPS__DIV_BY_24, SBCON1_BPS__DIV_BY_32, SBCON1_BPS__DIV_BY_48}; static void UART1_initBaudRate(uint32_t sysclk, uint32_t baudrate) { uint8_t i; uint8_t min_presc; uint16_t reload; DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); // Calculate baud rate prescaler and baud rate reload // value to maximize precision. // See reference manual for calculation details min_presc = ((*((uint16_t*)(&sysclk)) >> 1) + baudrate) / baudrate; // calculate minimum prescaler necessary for(i = 0; i < NUM_PRESC; ++i) { if(PRESC[i] >= min_presc) // use a prescaler that is equal or just greater than the minimum { reload = ((1 << 16) - (sysclk / (2 * baudrate * PRESC[i]))); // calculate reload value using prescaler SBRL1 = reload; SBCON1 |= (SBCON1_BREN__ENABLED | PRESC_ENUM[i]); // enable baud rate with calculated prescaler RESTORE_PAGE; return; } } // Baud rate is too small to be match while(1); } //========================================================= // Runtime API //========================================================= #if (EFM8PDL_UART1_AUTO_PAGE == 1) uint8_t UART1_getIntFlags(void) { uint8_t val; DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); val = SCON1 & (UART1_TX_IF | UART1_RX_IF); RESTORE_PAGE; return val; } void UART1_clearIntFlags(uint8_t flags) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); SCON1 &= ~(flags); RESTORE_PAGE; } void UART1_enableTxInt(bool enable) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); UART1FCN1_TIE = enable; RESTORE_PAGE; } void UART1_enableRxInt(bool enable) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); UART1FCN1_RIE = enable; RESTORE_PAGE; } void UART1_initTxPolling(void) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); SCON1_TI = 1; RESTORE_PAGE; } void UART1_write(uint8_t value) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); SBUF1 = value; RESTORE_PAGE; } uint8_t UART1_read(void) { uint8_t val; DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); val = SBUF1; RESTORE_PAGE; return val; } #endif void UART1_writeWithExtraBit(uint16_t value) { uint8_t shift, mask; DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); // Calculate shift and mask for data length shift = ((SMOD1 & SMOD1_SDL__FMASK) >> SMOD1_SDL__SHIFT) + 5; mask = 0xFF >> (8 - shift); SCON1_TBX = (value >> shift) & 0x1; SBUF1 = (value & mask); RESTORE_PAGE; } uint16_t UART1_readWithExtraBit(void) { uint8_t shift, mask; uint16_t val; DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); // Calculate shift and mask for data length shift = ((SMOD1 & SMOD1_SDL__FMASK) >> SMOD1_SDL__SHIFT) + 5; mask = 0xFF >> (8 - shift); val = SCON1_RBX; val = val << shift; val |= (SBUF1 & mask); RESTORE_PAGE; return val; } #if (EFM8PDL_UART1_AUTO_PAGE == 1) uint8_t UART1_getErrFlags(void) { uint8_t val; DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); val = SCON1 & (UART1_RXOVR_EF | UART1_PARITY_EF); RESTORE_PAGE; return val; } void UART1_clearErrFlags(uint8_t flags) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); SCON1 &= ~flags; RESTORE_PAGE; } uint8_t UART1_getFifoIntFlags(void) { uint8_t val; DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); val = UART1FCN1 & (UART1_TFRQ_IF | UART1_RFRQ_IF); RESTORE_PAGE; return val; } #endif void UART1_enableTxFifoInt(bool enable) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); if(enable) { UART1FCN0 |= UART1FCN0_TFRQE__ENABLED; } else { UART1FCN0 &= ~UART1FCN0_TFRQE__ENABLED; } RESTORE_PAGE; } void UART1_enableRxFifoInt(bool enable) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); if(enable) { UART1FCN0 |= UART1FCN0_RFRQE__ENABLED; } else { UART1FCN0 &= ~UART1FCN0_RFRQE__ENABLED; } RESTORE_PAGE; } #if (EFM8PDL_UART1_AUTO_PAGE == 1) uint8_t UART1_getTxFifoCount(void) { uint8_t txcnt; DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); txcnt = (UART1FCT & UART1FCT_TXCNT__FMASK) >> UART1FCT_TXCNT__SHIFT; RESTORE_PAGE; return txcnt; } uint8_t UART1_getRxFifoCount(void) { uint8_t rxcnt; DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); rxcnt = (UART1FCT & UART1FCT_RXCNT__FMASK) >> UART1FCT_RXCNT__SHIFT; RESTORE_PAGE; return rxcnt; } #endif bool UART1_isTxFifoFull(void){ bool txfull; DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); if(UART1FCN1 & UART1FCN1_TXNF__NOT_FULL) { txfull = false; } else { txfull = true; } RESTORE_PAGE; return txfull; } void UART1_stallTxFifo(bool enable) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); if(enable) { UART1FCN1 |= UART1FCN1_TXHOLD__HOLD; } else { UART1FCN1 &= ~UART1FCN1_TXHOLD__HOLD; } RESTORE_PAGE; } #if (EFM8PDL_UART1_AUTO_PAGE == 1) void UART1_flushTxFifo(void) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); UART1FCN0 |= UART1FCN0_TFLSH__FLUSH; RESTORE_PAGE; } void UART1_flushRxFifo(void) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); UART1FCN0 |= UART1FCN0_RFLSH__FLUSH; RESTORE_PAGE; } uint8_t UART1_getAutobaudIntFlag(void) { uint8_t val; DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); val = UART1LIN & UART1_AUTOBAUD_IF; RESTORE_PAGE; return val; } void UART1_clearAutobaudIntFlag(void) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); UART1LIN &= ~UART1_AUTOBAUD_IF; RESTORE_PAGE; } #endif void UART1_enableAutobaud(bool enable) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); if(enable) { UART1LIN |= (UART1LIN_AUTOBDE__ENABLED | UART1LIN_SYNCDIE__ENABLED); } else { UART1LIN &= ~(UART1LIN_AUTOBDE__ENABLED | UART1LIN_SYNCDIE__ENABLED); } RESTORE_PAGE; } //========================================================= // Initialization API //========================================================= void UART1_init(uint32_t sysclk, uint32_t baudrate, UART1_DataLen_t datalen, UART1_StopLen_t stoplen, UART1_FeatureBit_t featbit, UART1_ParityType_t partype, UART1_RxEnable_t rxen, UART1_Multiproc_t mcen) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); UART1_initBaudRate(sysclk, baudrate); SCON1 = rxen; SMOD1 = datalen | stoplen | featbit | partype | mcen; RESTORE_PAGE; } void UART1_initWithAutobaud(UART1_BrPrescaler_t presc, UART1_StopLen_t stoplen, UART1_FeatureBit_t featbit, UART1_ParityType_t partype, UART1_RxEnable_t rxen, UART1_Multiproc_t mcen) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); SCON1 = rxen; SMOD1 = SMOD1_SDL__8_BITS | stoplen | featbit | partype | mcen; UART1LIN = (UART1LIN_AUTOBDE__ENABLED | UART1LIN_SYNCDIE__ENABLED); SBCON1 = (SBCON1_BREN__ENABLED | presc); RESTORE_PAGE; } void UART1_reset(void) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); SCON1 = SCON1_OVR__NOT_SET | SCON1_PERR__NOT_SET | SCON1_REN__RECEIVE_DISABLED | SCON1_TBX__LOW | SCON1_RBX__LOW | SCON1_TI__NOT_SET | SCON1_RI__NOT_SET; SMOD1 = SMOD1_MCE__MULTI_DISABLED | SMOD1_SPT__ODD_PARITY | SMOD1_PE__PARITY_DISABLED | SMOD1_SDL__8_BITS | SMOD1_XBE__DISABLED | SMOD1_SBL__SHORT; SBCON1 = SBCON1_BREN__DISABLED | SBCON1_BPS__DIV_BY_1; UART1LIN = (UART1LIN_AUTOBDE__DISABLED | UART1LIN_SYNCDIE__DISABLED); RESTORE_PAGE; } void UART1_initTxFifo(UART1_TxFifoThreshold_t txth, UART1_TxFifoInt_t txint) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); UART1FCN0 &= ~(UART1FCN0_TFRQE__BMASK | UART1FCN0_TFLSH__BMASK | UART1FCN0_TXTH__FMASK | UART1FCN0_TFRQE__BMASK); UART1FCN0 |= (txth | txint); UART1FCN1 &= ~(UART1FCN1_TFRQ__BMASK | UART1FCN1_TXHOLD__BMASK | UART1FCN1_TXNF__BMASK | UART1FCN1_TIE__BMASK); UART1FCN1 |= (UART1FCN1_TFRQ__SET | UART1FCN1_TXHOLD__CONTINUE | UART1FCN1_TIE__DISABLED); RESTORE_PAGE; } void UART1_initRxFifo(UART1_RxFiFoThreshold_t rxth, UART1_RxFifoTimeout_t rxto, UART1_RxFifoInt_t rxint) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); UART1FCN0 &= ~(UART1FCN0_RFRQE__BMASK | UART1FCN0_RFLSH__BMASK | UART1FCN0_RXTH__FMASK | UART1FCN0_RFRQE__BMASK); UART1FCN0 |= (rxth | rxint); UART1FCN1 &= ~(UART1FCN1_RFRQ__BMASK | UART1FCN1_RXTO__FMASK | UART1FCN1_RIE__BMASK); UART1FCN1 |= (UART1FCN1_RFRQ__SET | rxto | UART1FCN1_RIE__DISABLED); RESTORE_PAGE; } //========================================================= // Buffer Access API //========================================================= #if EFM8PDL_UART1_USE_BUFFER == 1 SI_SEGMENT_VARIABLE(txRemaining, static uint8_t, SI_SEG_XDATA) = 0; SI_SEGMENT_VARIABLE(rxRemaining, static uint8_t, SI_SEG_XDATA) = 0; SI_SEGMENT_VARIABLE_SEGMENT_POINTER(txBuffer, static uint8_t, EFM8PDL_UART1_TX_BUFTYPE, SI_SEG_XDATA); SI_SEGMENT_VARIABLE_SEGMENT_POINTER(rxBuffer, static uint8_t, EFM8PDL_UART1_RX_BUFTYPE, SI_SEG_XDATA); SI_INTERRUPT(UART1_ISR, UART1_IRQn) { #if (EFM8PDL_UART1_USE_ERR_CALLBACK == 1) uint8_t discard; uint8_t errors; #endif //EFM8PDL_UART1_USE_ERR_CALLBACK // If auto-baud sync word detected to set baudrate, clear flag and disable auto-baud detection if (UART1LIN & UART1_AUTOBAUD_IF) { UART1LIN &= ~(UART1_AUTOBAUD_IF | UART1LIN_AUTOBDE__ENABLED | UART1LIN_SYNCDIE__ENABLED); } // If rx fifo request interrupt is set and enabled if ((UART1FCN1 & UART1_RFRQ_IF) && (UART1FCN0 & UART1FCN0_RFRQE__ENABLED)) { // Read bytes as long as rx fifo count is not zero and there // is room in the tx buffer while (rxRemaining && ((UART1FCT & UART1FCT_RXCNT__FMASK) >> UART1FCT_RXCNT__SHIFT)) { #if (EFM8PDL_UART1_USE_ERR_CALLBACK == 1) // If parity or overrun error, clear flags, and call user errors = SCON1 & (UART1_RXOVR_EF | UART1_PARITY_EF); if(errors) { SCON1 &= ~errors; UART1_transferErrorCb(errors); } // Store byte if there is no parity error a if (errors & UART1_PARITY_EF) { discard = SBUF1; } else #endif //EFM8PDL_UART1_USE_ERR_CALLBACK { *rxBuffer = SBUF1; ++rxBuffer; --rxRemaining; if (!rxRemaining) { UART1_receiveCompleteCb(); } } } if(!rxRemaining) { // Flush Fifo if there is no room available in rx buffer UART1FCN0 |= UART1FCN0_RFLSH__FLUSH; } } // If tx fifo request interrupt is set and enabled if ((UART1FCN1 & UART1_TFRQ_IF) && (UART1FCN0 & UART1FCN0_TFRQE__ENABLED)) { // Write bytes as long as the tx fifo is not full and there // is room in the tx buffer while (txRemaining && (UART1FCN1 & UART1FCN1_TXNF__NOT_FULL)) { SBUF1 = *txBuffer; ++txBuffer; --txRemaining; } if(!txRemaining) { UART1_transmitCompleteCb(); } } } void UART1_writeBuffer(SI_VARIABLE_SEGMENT_POINTER(buffer, uint8_t, EFM8PDL_UART1_RX_BUFTYPE), uint8_t length) { // Initialize internal data txBuffer = buffer; txRemaining = length; // Enable tx fifo interrupts to kick off transfer UART1FCN0 |= UART1FCN0_TFRQE__ENABLED; } void UART1_readBuffer(SI_VARIABLE_SEGMENT_POINTER(buffer, uint8_t, EFM8PDL_UART1_TX_BUFTYPE), uint8_t length) { // Initialize internal data rxBuffer = buffer; rxRemaining = length; } void UART1_abortTx(void) { txRemaining = 0; UART1_flushTxFifo(); } void UART1_abortRx(void) { rxRemaining = 0; UART1_flushRxFifo(); } uint8_t UART1_txBytesRemaining(void) { return txRemaining; } uint8_t UART1_rxBytesRemaining(void) { return rxRemaining; } #endif //EFM8PDL_UART1_USE_BUFFER //========================================================= // STDIO API //========================================================= #if EFM8PDL_UART1_USE_STDIO == 1 char putchar(char c){ DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); while(!SCON1_TI); SBUF1 = c; SCON1_TI = 0; RESTORE_PAGE; return c; } char _getkey(void){ char val; DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); while(!SCON1_RI); SCON1_RI = 0; val = SBUF1; RESTORE_PAGE; return val; } void UART1_initStdio(uint32_t sysclk, uint32_t baudrate) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); SCON1 |= SCON1_REN__RECEIVE_ENABLED | SCON1_TI__SET; SMOD1 |= SMOD1_SDL__8_BITS; UART1_initBaudRate(sysclk, baudrate); RESTORE_PAGE; } #endif //EFM8PDL_UART0_USE_STDIO
ahtn/keyplus
ports/efm8/efm8/mcu/EFM8UB3/peripheral_driver/src/uart_1.c
C
mit
14,124
define(["widgetjs/widgetjs", "lodash", "jquery", "prettify", "code", "bootstrap"], function(widgetjs, lodash, jQuery, prettify, code) { var examples = {}; examples.modals = code({ group: "Modals", label: "Modals", links: ["http://getbootstrap.com/javascript/#modals"], example : function(html) { // Modal html.div({"class": "clearfix bs-example-modal"}, html.div({ klass: "modal"}, html.div({ klass: "modal-dialog"}, html.div({ klass: "modal-content"}, html.div({ klass: "modal-header"}, html.button({ type: "button", klass: "close", "data-dismiss": "modal", "aria-hidden": "true"}, "&times;" ), html.h4({ klass: "modal-title"}, "Modal title" ) ), html.div({ klass: "modal-body"}, html.p( "One fine body&hellip;" ) ), html.div({ klass: "modal-footer"}, html.button({ type: "button", klass: "btn btn-default", "data-dismiss": "modal"}, "Close" ), html.button({ type: "button", klass: "btn btn-primary"}, "Save changes" ) ) ) ) ) ); } }); examples.modalsDemo = code({ group: "Modals", label: "Live Demo", links: ["http://getbootstrap.com/javascript/#modals"], example : function(html) { // Modal html.div({ id: "myModal", klass: "modal fade"}, html.div({ klass: "modal-dialog"}, html.div({ klass: "modal-content"}, html.div({ klass: "modal-header"}, html.button({ type: "button", klass: "close", "data-dismiss": "modal", "aria-hidden": "true"}, "&times;" ), html.h4({ klass: "modal-title"}, "Modal title" ) ), html.div({ klass: "modal-body"}, html.p( "One fine body&hellip;" ) ), html.div({ klass: "modal-footer"}, html.button({ type: "button", klass: "btn btn-default", "data-dismiss": "modal"}, "Close" ), html.button({ type: "button", klass: "btn btn-primary"}, "Save changes" ) ) ) ) ); html.button({ klass: "btn btn-primary btn-lg", "data-toggle": "modal", "data-target": "#myModal"}, "Show modal"); } }); examples.toolTips = code({ group: "Tooltips", label: "Live Demo", links: ["http://getbootstrap.com/javascript/#tooltips"], example : function(html) { // TOOLTIPS html.div({ klass: "tooltip-demo"}, html.div({ klass: "bs-example-tooltips"}, html.button({ type: "button", klass: "btn btn-default", "data-toggle": "tooltip", "data-placement": "left", title: "", "data-original-title": "Tooltip on left"}, "Tooltip on left" ), html.button({ type: "button", klass: "btn btn-default", "data-toggle": "tooltip", "data-placement": "top", title: "", "data-original-title": "Tooltip on top"}, "Tooltip on top" ), html.button({ type: "button", klass: "btn btn-default", "data-toggle": "tooltip", "data-placement": "bottom", title: "", "data-original-title": "Tooltip on bottom"}, "Tooltip on bottom" ), html.button({ type: "button", klass: "btn btn-default", "data-toggle": "tooltip", "data-placement": "right", title: "", "data-original-title": "Tooltip on right"}, "Tooltip on right" ) ) ); jQuery(".bs-example-tooltips").tooltip(); } }); examples.popovers = code({ group: "Popovers", label: "Popovers", links: ["http://getbootstrap.com/javascript/#popovers"], example : function(html) { // Popovers html.div({ klass: "bs-example-popovers"}, html.button({ type: "button", klass: "btn btn-default", "data-container": "body", "data-toggle": "popover", "data-placement": "left", "data-content": "Vivamus sagittis lacus vel augue laoreet rutrum faucibus.", "data-original-title": "", title: ""}, "Left" ), html.button({ type: "button", klass: "btn btn-default", "data-container": "body", "data-toggle": "popover", "data-placement": "top", "data-content": "Vivamus sagittis lacus vel augue laoreet rutrum faucibus.", "data-original-title": "", title: ""}, "Top" ), html.button({ type: "button", klass: "btn btn-default", "data-container": "body", "data-toggle": "popover", "data-placement": "bottom", "data-content": "Vivamus sagittis lacus vel augue laoreet rutrum faucibus.", "data-original-title": "", title: ""}, "Bottom" ), html.button({ type: "button", klass: "btn btn-default", "data-container": "body", "data-toggle": "popover", "data-placement": "right", "data-content": "Vivamus sagittis lacus vel augue laoreet rutrum faucibus.", "data-original-title": "", title: ""}, "Right" ) ); jQuery(".bs-example-popovers button").popover(); } }); examples.buttonsCheckbox = code({ group: "Buttons", label: "Checkbox", links: ["http://getbootstrap.com/javascript/#buttons"], example : function(html) { html.div({ style: "padding-bottom: 24px;"}, html.div({ klass: "btn-group", "data-toggle": "buttons"}, html.label({ klass: "btn btn-primary"}, html.input({ type: "checkbox"}), "Option 1" ), html.label({ klass: "btn btn-primary"}, html.input({ type: "checkbox"}), "Option 2" ), html.label({ klass: "btn btn-primary"}, html.input({ type: "checkbox"}), "Option 3" ) ) ); } }); examples.buttonsRadio= code({ group: "Buttons", label: "Radio", links: ["http://getbootstrap.com/javascript/#buttons"], example : function(html) { html.div({ style: "padding-bottom: 24px;"}, html.div({ klass: "btn-group", "data-toggle": "buttons"}, html.label({ klass: "btn btn-primary"}, html.input({ type: "radio"}), "Option 1" ), html.label({ klass: "btn btn-primary"}, html.input({ type: "radio"}), "Option 2" ), html.label({ klass: "btn btn-primary"}, html.input({ type: "radio"}), "Option 3" ) ) ); } }); examples.collapse = code({ group: "Collapse", label: "Collapse", links: ["http://getbootstrap.com/javascript/#collapse"], example : function(html) { html.div({ klass: "panel-group", id: "accordion"}, html.div({ klass: "panel panel-default"}, html.div({ klass: "panel-heading"}, html.h4({ klass: "panel-title"}, html.a({ "data-toggle": "collapse", "data-parent": "#accordion", href: "#collapseOne"}, "Heading #1" ) ) ), html.div({ id: "collapseOne", klass: "panel-collapse collapse in"}, html.div({ klass: "panel-body"}, "Content" ) ) ), html.div({ klass: "panel panel-default"}, html.div({ klass: "panel-heading"}, html.h4({ klass: "panel-title"}, html.a({ "data-toggle": "collapse", "data-parent": "#accordion", href: "#collapseTwo"}, "Heading #2" ) ) ), html.div({ id: "collapseTwo", klass: "panel-collapse collapse"}, html.div({ klass: "panel-body"}, "Content" ) ) ), html.div({ klass: "panel panel-default"}, html.div({ klass: "panel-heading"}, html.h4({ klass: "panel-title"}, html.a({ "data-toggle": "collapse", "data-parent": "#accordion", href: "#collapseThree"}, "Heading #2" ) ) ), html.div({ id: "collapseThree", klass: "panel-collapse collapse"}, html.div({ klass: "panel-body"}, "Content" ) ) ) ); } }); return examples; });
foretagsplatsen/widget-js
sample/bootstrap/javascriptExamples.js
JavaScript
mit
10,606
class AddCorrectAnswerToQuestions < ActiveRecord::Migration def change add_column :questions, :correct_answer, :integer, :default => nil end end
lowellmower/star_overflow
db/migrate/20150711152543_add_correct_answer_to_questions.rb
Ruby
mit
153
module.exports = require('./lib/dustjs-browserify');
scottbrady/dustjs-browserify
index.js
JavaScript
mit
52
namespace GE.WebUI.ViewModels { public sealed class VMGameMenuEmptyGame { public string IconPath { get; set; } public string GoodImagePath { get; set; } public string BadImagePath { get; set; } } }
simlex-titul2005/game-exe.com
GE.WebUI/ViewModels/VMGameMenuEmptyGame.cs
C#
mit
236
version https://git-lfs.github.com/spec/v1 oid sha256:94e212e6fc0c837cd9fff7fca8feff0187a0a22a97c7bd4c6d8f05c5cc358519 size 3077
yogeshsaroya/new-cdnjs
ajax/libs/yui/3.16.0/scrollview-list/scrollview-list.js
JavaScript
mit
129
/* orconfig.h. Generated from orconfig.h.in by configure. */ /* orconfig.h.in. Generated from configure.ac by autoheader. */ #include <openssl/opensslv.h> /* Define if building universal (internal helper macro) */ /* #undef AC_APPLE_UNIVERSAL_BUILD */ /* tor's configuration directory */ #define CONFDIR "/usr/local/etc/tor" /* Defined if we're not going to look for a torrc in SYSCONF */ /* #undef DISABLE_SYSTEM_TORRC */ /* shared data dir */ #define SHARE_DATADIR "/usr/share" /* home tor folder */ #define LOCALSTATEDIR "" /* Defined if we have a curve25519 implementation */ #define CURVE25519_ENABLED 1 /* Enable dmalloc's malloc function check */ /* #undef DMALLOC_FUNC_CHECK */ /* Define to 1 iff memset(0) sets doubles to 0.0 */ #define DOUBLE_0_REP_IS_ZERO_BYTES 1 /* Defined if we try to use freelists for buffer RAM chunks */ #define ENABLE_BUF_FREELISTS 1 /* Defined if we default to host local appdata paths on Windows */ /* #undef ENABLE_LOCAL_APPDATA */ /* Defined if we will try to use multithreading */ #define ENABLE_THREADS 1 /* Define if enum is always signed */ /* #undef ENUM_VALS_ARE_SIGNED */ /* Define to nothing if C supports flexible array members, and to 1 if it does not. That way, with a declaration like `struct s { int n; double d[FLEXIBLE_ARRAY_MEMBER]; };', the struct hack can be used with pre-C99 compilers. When computing the size of such an object, don't use 'sizeof (struct s)' as it overestimates the size. Use 'offsetof (struct s, d)' instead. Don't use 'offsetof (struct s, d[0])', as this doesn't work with MSVC and with C++ compilers. */ #define FLEXIBLE_ARRAY_MEMBER /**/ /* Define to 1 if you have the `accept4' function. */ /* #undef HAVE_ACCEPT4 */ /* Define to 1 if you have the <arpa/inet.h> header file. */ #define HAVE_ARPA_INET_H 1 /* Define to 1 if you have the <assert.h> header file. */ #define HAVE_ASSERT_H 1 /* Define to 1 if you have the `backtrace' function. */ #define HAVE_BACKTRACE 1 /* Define to 1 if you have the `backtrace_symbols_fd' function. */ #define HAVE_BACKTRACE_SYMBOLS_FD 1 /* Define to 1 if you have the `cap_set_proc' function. */ /* #undef HAVE_CAP_SET_PROC */ /* Defined if the requested minimum BOOST version is satisfied */ #define HAVE_BOOST 1 /* Define to 1 if you have <boost/filesystem/path.hpp> */ #define HAVE_BOOST_FILESYSTEM_PATH_HPP 1 /* Define to 1 if you have <boost/system/error_code.hpp> */ #define HAVE_BOOST_SYSTEM_ERROR_CODE_HPP 1 /* Define to 1 if you have the `clock_gettime' function. */ /* #undef HAVE_CLOCK_GETTIME */ /* Define to 1 if you have the <crt_externs.h> header file. */ #define HAVE_CRT_EXTERNS_H 1 /* Define to 1 if you have the <crypto_scalarmult_curve25519.h> header file. */ /* #undef HAVE_CRYPTO_SCALARMULT_CURVE25519_H */ /* Define to 1 if you have the <cygwin/signal.h> header file. */ /* #undef HAVE_CYGWIN_SIGNAL_H */ /* Define to 1 if you have the declaration of `mlockall', and to 0 if you don't. */ #define HAVE_DECL_MLOCKALL 1 /* Define to 1 if you have the <dlfcn.h> header file. */ #define HAVE_DLFCN_H 1 /* Define to 1 if you have the declaration of `SecureZeroMemory', and to 0 if you don't. */ /* #undef HAVE_DECL_SECUREZEROMEMORY */ /* Define to 1 if you have the declaration of `_getwch', and to 0 if you don't. */ /* #undef HAVE_DECL__GETWCH */ /* Define to 1 if you have the <dmalloc.h> header file. */ /* #undef HAVE_DMALLOC_H */ /* Define to 1 if you have the `dmalloc_strdup' function. */ /* #undef HAVE_DMALLOC_STRDUP */ /* Define to 1 if you have the `dmalloc_strndup' function. */ /* #undef HAVE_DMALLOC_STRNDUP */ /* Define to 1 if you have the <errno.h> header file. */ #define HAVE_ERRNO_H 1 /* Define to 1 if you have the `evdns_set_outgoing_bind_address' function. */ /* #undef HAVE_EVDNS_SET_OUTGOING_BIND_ADDRESS */ /* Define to 1 if you have the <event2/bufferevent_ssl.h> header file. */ #define HAVE_EVENT2_BUFFEREVENT_SSL_H 1 /* Define to 1 if you have the <event2/dns.h> header file. */ #define HAVE_EVENT2_DNS_H 1 /* Define to 1 if you have the <event2/event.h> header file. */ #define HAVE_EVENT2_EVENT_H 1 /* Define to 1 if you have the `eventfd' function. */ /* #undef HAVE_EVENTFD */ /* Define to 1 if you have the `event_base_loopexit' function. */ #define HAVE_EVENT_BASE_LOOPEXIT 1 /* Define to 1 if you have the `event_get_method' function. */ #define HAVE_EVENT_GET_METHOD 1 /* Define to 1 if you have the `event_get_version' function. */ #define HAVE_EVENT_GET_VERSION 1 /* Define to 1 if you have the `event_get_version_number' function. */ #define HAVE_EVENT_GET_VERSION_NUMBER 1 /* Define to 1 if you have the `EVP_PBE_scrypt' function. */ /* #undef HAVE_EVP_PBE_SCRYPT */ /* Define to 1 if you have the `evutil_secure_rng_init' function. */ #define HAVE_EVUTIL_SECURE_RNG_INIT 1 /* Define to 1 if you have the `evutil_secure_rng_set_urandom_device_file' function. */ /* #undef HAVE_EVUTIL_SECURE_RNG_SET_URANDOM_DEVICE_FILE */ /* Define to 1 if you have the <execinfo.h> header file. */ #define HAVE_EXECINFO_H 1 /* Define to 1 if you have the `explicit_bzero' function. */ /* #undef HAVE_EXPLICIT_BZERO */ /* Defined if we have extern char **environ already declared */ /* #undef HAVE_EXTERN_ENVIRON_DECLARED */ /* Define to 1 if you have the <fcntl.h> header file. */ #define HAVE_FCNTL_H 1 /* Define to 1 if you have the `flock' function. */ #define HAVE_FLOCK 1 /* Define to 1 if you have the `ftime' function. */ #define HAVE_FTIME 1 /* Define to 1 if you have the `getaddrinfo' function. */ #define HAVE_GETADDRINFO 1 /* Define to 1 if you have the `getentropy' function. */ /* #undef HAVE_GETENTROPY */ /* Define this if you have any gethostbyname_r() */ /* #undef HAVE_GETHOSTBYNAME_R */ /* Define this if gethostbyname_r takes 3 arguments */ /* #undef HAVE_GETHOSTBYNAME_R_3_ARG */ /* Define this if gethostbyname_r takes 5 arguments */ /* #undef HAVE_GETHOSTBYNAME_R_5_ARG */ /* Define this if gethostbyname_r takes 6 arguments */ /* #undef HAVE_GETHOSTBYNAME_R_6_ARG */ /* Define to 1 if you have the `getifaddrs' function. */ #define HAVE_GETIFADDRS 1 /* Define to 1 if you have the `getpass' function. */ #define HAVE_GETPASS 1 /* Define to 1 if you have the `getresgid' function. */ /* #undef HAVE_GETRESGID */ /* Define to 1 if you have the `getresuid' function. */ /* #undef HAVE_GETRESUID */ /* Define to 1 if you have the `getrlimit' function. */ #define HAVE_GETRLIMIT 1 /* Define to 1 if you have the `gettimeofday' function. */ #define HAVE_GETTIMEOFDAY 1 /* Define to 1 if you have the `gmtime_r' function. */ #define HAVE_GMTIME_R 1 /* Define to 1 if you have the <grp.h> header file. */ #define HAVE_GRP_H 1 /* Define to 1 if you have the `htonll' function. */ /* #undef HAVE_HTONLL */ /* Define to 1 if you have the <ifaddrs.h> header file. */ #define HAVE_IFADDRS_H 1 /* Define to 1 if you have the `inet_aton' function. */ #define HAVE_INET_ATON 1 /* Define to 1 if you have the <inttypes.h> header file. */ #define HAVE_INTTYPES_H 1 /* Define to 1 if you have the `ioctl' function. */ #define HAVE_IOCTL 1 /* Define to 1 if you have the `issetugid' function. */ #define HAVE_ISSETUGID 1 /* Define to 1 if you have the `cap' library (-lcap). */ /* #undef HAVE_LIBCAP */ /* Define to 1 if you have the <libscrypt.h> header file. */ /* #undef HAVE_LIBSCRYPT_H */ /* Define to 1 if you have the `libscrypt_scrypt' function. */ /* #undef HAVE_LIBSCRYPT_SCRYPT */ /* Define to 1 if you have the <limits.h> header file. */ #define HAVE_LIMITS_H 1 /* Define to 1 if you have the <linux/if.h> header file. */ /* #undef HAVE_LINUX_IF_H */ /* Define to 1 if you have the <linux/netfilter_ipv4.h> header file. */ /* #undef HAVE_LINUX_NETFILTER_IPV4_H */ /* Define to 1 if you have the <linux/netfilter_ipv6/ip6_tables.h> header file. */ /* #undef HAVE_LINUX_NETFILTER_IPV6_IP6_TABLES_H */ /* Define to 1 if you have the <linux/types.h> header file. */ /* #undef HAVE_LINUX_TYPES_H */ /* Define to 1 if you have the `llround' function. */ #define HAVE_LLROUND 1 /* Define to 1 if you have the `localtime_r' function. */ #define HAVE_LOCALTIME_R 1 /* Define to 1 if you have the `lround' function. */ #define HAVE_LROUND 1 /* Define to 1 if you have the <machine/limits.h> header file. */ #define HAVE_MACHINE_LIMITS_H 1 /* Defined if the compiler supports __FUNCTION__ */ #define HAVE_MACRO__FUNCTION__ 1 /* Defined if the compiler supports __FUNC__ */ /* #undef HAVE_MACRO__FUNC__ */ /* Defined if the compiler supports __func__ */ #define HAVE_MACRO__func__ 1 /* Define to 1 if you have the `mallinfo' function. */ /* #undef HAVE_MALLINFO */ /* Define to 1 if you have the <malloc.h> header file. */ /* #undef HAVE_MALLOC_H */ /* Define to 1 if you have the <malloc/malloc.h> header file. */ #define HAVE_MALLOC_MALLOC_H 1 /* Define to 1 if you have the <malloc_np.h> header file. */ /* #undef HAVE_MALLOC_NP_H */ /* Define to 1 if you have the `memmem' function. */ #define HAVE_MEMMEM 1 /* Define to 1 if you have the <memory.h> header file. */ #define HAVE_MEMORY_H 1 /* Define to 1 if you have the `memset_s' function. */ /* #undef HAVE_MEMSET_S */ /* Define to 1 if you have the `mlockall' function. */ #define HAVE_MLOCKALL 1 /* Define to 1 if you have the <nacl/crypto_scalarmult_curve25519.h> header file. */ /* #undef HAVE_NACL_CRYPTO_SCALARMULT_CURVE25519_H */ /* Define to 1 if you have the <netdb.h> header file. */ #define HAVE_NETDB_H 1 /* Define to 1 if you have the <netinet/in6.h> header file. */ /* #undef HAVE_NETINET_IN6_H */ /* Define to 1 if you have the <netinet/in.h> header file. */ #define HAVE_NETINET_IN_H 1 /* Define to 1 if you have the <net/if.h> header file. */ #define HAVE_NET_IF_H 1 /* Define to 1 if you have the <net/pfvar.h> header file. */ /* #undef HAVE_NET_PFVAR_H */ /* Define to 1 if you have the `pipe' function. */ #define HAVE_PIPE 1 /* Define to 1 if you have the `pipe2' function. */ /* #undef HAVE_PIPE2 */ /* Define to 1 if you have the `prctl' function. */ /* #undef HAVE_PRCTL */ /* Define to 1 if you have the `pthread_condattr_setclock' function. */ /* #undef HAVE_PTHREAD_CONDATTR_SETCLOCK */ /* Define to 1 if you have the `pthread_create' function. */ #define HAVE_PTHREAD_CREATE 1 /* Define to 1 if you have the <pthread.h> header file. */ #define HAVE_PTHREAD_H 1 /* Define to 1 if you have the <pwd.h> header file. */ #define HAVE_PWD_H 1 /* Define to 1 if you have the `readpassphrase' function. */ #define HAVE_READPASSPHRASE 1 /* Define to 1 if you have the <readpassphrase.h> header file. */ #define HAVE_READPASSPHRASE_H 1 /* Define to 1 if you have the `rint' function. */ #define HAVE_RINT 1 /* Define to 1 if the system has the type `rlim_t'. */ #define HAVE_RLIM_T 1 /* Define to 1 if you have the `RtlSecureZeroMemory' function. */ /* #undef HAVE_RTLSECUREZEROMEMORY */ /* Define to 1 if the system has the type `sa_family_t'. */ #define HAVE_SA_FAMILY_T 1 /* Define to 1 if you have the <seccomp.h> header file. */ /* #undef HAVE_SECCOMP_H */ /* Define to 1 if you have the `SecureZeroMemory' function. */ /* #undef HAVE_SECUREZEROMEMORY */ /* Define to 1 if you have the `sigaction' function. */ #define HAVE_SIGACTION 1 /* Define to 1 if you have the <signal.h> header file. */ #define HAVE_SIGNAL_H 1 /* Define to 1 if you have the `socketpair' function. */ #define HAVE_SOCKETPAIR 1 /* Define to 1 if the system has the type `ssize_t'. */ #define HAVE_SSIZE_T 1 /* Define to 1 if you have the `SSL_CIPHER_find' function. */ /* #undef HAVE_SSL_CIPHER_FIND */ /* Define to 1 if you have the `SSL_get_client_ciphers' function. */ #define HAVE_SSL_GET_CLIENT_CIPHERS 1 /* Define to 1 if you have the `SSL_get_client_random' function. */ #define HAVE_SSL_GET_CLIENT_RANDOM 1 /* Define to 1 if you have the `SSL_get_server_random' function. */ #define HAVE_SSL_GET_SERVER_RANDOM 1 /* Define to 1 if you have the `SSL_SESSION_get_master_key' function. */ #define HAVE_SSL_SESSION_GET_MASTER_KEY 1 /* Define to 1 if you have the `statvfs' function. */ #define HAVE_STATVFS 1 /* Define to 1 if you have the <stdint.h> header file. */ #define HAVE_STDINT_H 1 /* Define to 1 if you have the <stdlib.h> header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the <strings.h> header file. */ #define HAVE_STRINGS_H 1 /* Define to 1 if you have the <string.h> header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the `strlcat' function. */ #define HAVE_STRLCAT 1 /* Define to 1 if you have the `strlcpy' function. */ #define HAVE_STRLCPY 1 /* Define to 1 if you have the `strnlen' function. */ #define HAVE_STRNLEN 1 /* Define to 1 if you have the `strptime' function. */ #define HAVE_STRPTIME 1 /* Define to 1 if you have the `strtok_r' function. */ #define HAVE_STRTOK_R 1 /* Define to 1 if you have the `strtoull' function. */ #define HAVE_STRTOULL 1 /* Define to 1 if `min_heap_idx' is a member of `struct event'. */ /* #undef HAVE_STRUCT_EVENT_MIN_HEAP_IDX */ /* Define to 1 if the system has the type `struct in6_addr'. */ #define HAVE_STRUCT_IN6_ADDR 1 /* Define to 1 if `s6_addr16' is a member of `struct in6_addr'. */ /* #undef HAVE_STRUCT_IN6_ADDR_S6_ADDR16 */ /* Define to 1 if `s6_addr32' is a member of `struct in6_addr'. */ /* #undef HAVE_STRUCT_IN6_ADDR_S6_ADDR32 */ /* Define to 1 if the system has the type `struct sockaddr_in6'. */ #define HAVE_STRUCT_SOCKADDR_IN6 1 /* Define to 1 if `sin6_len' is a member of `struct sockaddr_in6'. */ #define HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN 1 /* Define to 1 if `sin_len' is a member of `struct sockaddr_in'. */ #define HAVE_STRUCT_SOCKADDR_IN_SIN_LEN 1 /* Define to 1 if `get_cipher_by_char' is a member of `struct ssl_method_st'. */ /* #undef HAVE_STRUCT_SSL_METHOD_ST_GET_CIPHER_BY_CHAR */ /* Define to 1 if `tv_sec' is a member of `struct timeval'. */ #define HAVE_STRUCT_TIMEVAL_TV_SEC 1 /* Define to 1 if you have the `sysconf' function. */ #define HAVE_SYSCONF 1 /* Define to 1 if you have the `sysctl' function. */ #define HAVE_SYSCTL 1 /* Define to 1 if you have the <syslog.h> header file. */ #define HAVE_SYSLOG_H 1 /* Have systemd */ /* #undef HAVE_SYSTEMD */ /* Have systemd v209 or more */ /* #undef HAVE_SYSTEMD_209 */ /* Define to 1 if you have the <sys/capability.h> header file. */ /* #undef HAVE_SYS_CAPABILITY_H */ /* Define to 1 if you have the <sys/eventfd.h> header file. */ /* #undef HAVE_SYS_EVENTFD_H */ /* Define to 1 if you have the <sys/fcntl.h> header file. */ #define HAVE_SYS_FCNTL_H 1 /* Define to 1 if you have the <sys/file.h> header file. */ #define HAVE_SYS_FILE_H 1 /* Define to 1 if you have the <sys/ioctl.h> header file. */ #define HAVE_SYS_IOCTL_H 1 /* Define to 1 if you have the <sys/limits.h> header file. */ /* #undef HAVE_SYS_LIMITS_H */ /* Define to 1 if you have the <sys/mman.h> header file. */ #define HAVE_SYS_MMAN_H 1 /* Define to 1 if you have the <sys/param.h> header file. */ #define HAVE_SYS_PARAM_H 1 /* Define to 1 if you have the <sys/prctl.h> header file. */ /* #undef HAVE_SYS_PRCTL_H */ /* Define to 1 if you have the <sys/resource.h> header file. */ #define HAVE_SYS_RESOURCE_H 1 /* Define to 1 if you have the <sys/select.h> header file. */ #define HAVE_SYS_SELECT_H 1 /* Define to 1 if you have the <sys/socket.h> header file. */ #define HAVE_SYS_SOCKET_H 1 /* Define to 1 if you have the <sys/statvfs.h> header file. */ #define HAVE_SYS_STATVFS_H 1 /* Define to 1 if you have the <sys/stat.h> header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the <sys/syscall.h> header file. */ #define HAVE_SYS_SYSCALL_H 1 /* Define to 1 if you have the <sys/sysctl.h> header file. */ #define HAVE_SYS_SYSCTL_H 1 /* Define to 1 if you have the <sys/syslimits.h> header file. */ #define HAVE_SYS_SYSLIMITS_H 1 /* Define to 1 if you have the <sys/time.h> header file. */ #define HAVE_SYS_TIME_H 1 /* Define to 1 if you have the <sys/types.h> header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the <sys/ucontext.h> header file. */ #define HAVE_SYS_UCONTEXT_H 1 /* Define to 1 if you have the <sys/un.h> header file. */ #define HAVE_SYS_UN_H 1 /* Define to 1 if you have the <sys/utime.h> header file. */ /* #undef HAVE_SYS_UTIME_H */ /* Define to 1 if you have the <sys/wait.h> header file. */ #define HAVE_SYS_WAIT_H 1 /* Define to 1 if you have the <time.h> header file. */ #define HAVE_TIME_H 1 /* Define to 1 if you have the `timingsafe_memcmp' function. */ /* #undef HAVE_TIMINGSAFE_MEMCMP */ /* Define to 1 if you have the `TLS_method' function. */ /* #undef HAVE_TLS_METHOD */ /* Define to 1 if you have the <ucontext.h> header file. */ /* #undef HAVE_UCONTEXT_H */ /* Define to 1 if the system has the type `uint'. */ #define HAVE_UINT 1 /* Define to 1 if you have the `uname' function. */ #define HAVE_UNAME 1 /* Define to 1 if you have the <unistd.h> header file. */ #define HAVE_UNISTD_H 1 /* Define to 1 if you have the `usleep' function. */ #define HAVE_USLEEP 1 /* Define to 1 if you have the <utime.h> header file. */ #define HAVE_UTIME_H 1 /* Define to 1 if the system has the type `u_char'. */ #define HAVE_U_CHAR 1 /* Define to 1 if you have the `vasprintf' function. */ #define HAVE_VASPRINTF 1 /* Define to 1 if you have the `_NSGetEnviron' function. */ #define HAVE__NSGETENVIRON 1 /* Define to 1 if you have the `_vscprintf' function. */ /* #undef HAVE__VSCPRINTF */ /* Defined if we want to keep track of how much of each kind of resource we download. */ /* #undef INSTRUMENT_DOWNLOADS */ /* name of the syslog facility */ #define LOGFACILITY LOG_DAEMON /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #define LT_OBJDIR ".libs/" /* Define to 1 iff malloc(0) returns a pointer */ #define MALLOC_ZERO_WORKS 1 /* Define to 1 if we are building with UPnP. */ /* #undef MINIUPNPC */ /* libminiupnpc version 1.5 found */ /* #undef MINIUPNPC15 */ /* Define to 1 if we are building with nat-pmp. */ /* #undef NAT_PMP */ /* Define to 1 iff memset(0) sets pointers to NULL */ #define NULL_REP_IS_ZERO_BYTES 1 /* "Define to handle pf on OpenBSD properly" */ /* #undef OPENBSD */ /* Name of package */ #define PACKAGE "tor" /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "" /* Define to the full name of this package. */ #define PACKAGE_NAME "tor" /* Define to the full name and version of this package. */ #define PACKAGE_STRING "tor 0.3.0.9" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "tor" /* Define to the home page for this package. */ #define PACKAGE_URL "" /* Define to the version of this package. */ #define PACKAGE_VERSION "0.3.0.9" /* How to access the PC from a struct ucontext */ #define PC_FROM_UCONTEXT uc_mcontext->__ss.__rip /* Define to 1 iff right-shifting a negative value performs sign-extension */ #define RSHIFT_DOES_SIGN_EXTEND 1 /* The size of `cell_t', as computed by sizeof. */ #define SIZEOF_CELL_T 0 /* The size of `char', as computed by sizeof. */ #define SIZEOF_CHAR 1 /* The size of `int', as computed by sizeof. */ #define SIZEOF_INT 4 /* The size of `int16_t', as computed by sizeof. */ #define SIZEOF_INT16_T 2 /* The size of `int32_t', as computed by sizeof. */ #define SIZEOF_INT32_T 4 /* The size of `int64_t', as computed by sizeof. */ #define SIZEOF_INT64_T 8 /* The size of `int8_t', as computed by sizeof. */ #define SIZEOF_INT8_T 1 /* The size of `intptr_t', as computed by sizeof. */ #define SIZEOF_INTPTR_T 8 /* The size of `long', as computed by sizeof. */ #define SIZEOF_LONG 8 /* The size of `long long', as computed by sizeof. */ #define SIZEOF_LONG_LONG 8 /* The size of `pid_t', as computed by sizeof. */ #define SIZEOF_PID_T 4 /* The size of `short', as computed by sizeof. */ #define SIZEOF_SHORT 2 /* The size of `size_t', as computed by sizeof. */ #define SIZEOF_SIZE_T 8 /* The size of `socklen_t', as computed by sizeof. */ #define SIZEOF_SOCKLEN_T 4 /* The size of `time_t', as computed by sizeof. */ #define SIZEOF_TIME_T 8 /* The size of `uint16_t', as computed by sizeof. */ #define SIZEOF_UINT16_T 2 /* The size of `uint32_t', as computed by sizeof. */ #define SIZEOF_UINT32_T 4 /* The size of `uint64_t', as computed by sizeof. */ #define SIZEOF_UINT64_T 8 /* The size of `uint8_t', as computed by sizeof. */ #define SIZEOF_UINT8_T 1 /* The size of `uintptr_t', as computed by sizeof. */ #define SIZEOF_UINTPTR_T 8 /* The size of `void *', as computed by sizeof. */ #define SIZEOF_VOID_P 8 /* The size of `__int64', as computed by sizeof. */ #define SIZEOF___INT64 0 /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Define if time_t is signed */ #define TIME_T_IS_SIGNED 1 /* Defined if we're going to use Libevent's buffered IO API */ /* #undef USE_BUFFEREVENTS */ /* Defined if we should use an internal curve25519_donna{,_c64} implementation */ #define USE_CURVE25519_DONNA 1 /* Defined if we should use a curve25519 from nacl */ /* #undef USE_CURVE25519_NACL */ /* Debug memory allocation library */ /* #undef USE_DMALLOC */ /* "Define to enable transparent proxy support" */ /* #undef USE_TRANSPARENT */ /* Define to 1 iff we represent negative integers with two's complement */ #define USING_TWOS_COMPLEMENT 1 /* Version number of package */ #define VERSION "0.3.0.9" /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN /* # undef WORDS_BIGENDIAN */ # endif #endif /* Enable large inode numbers on Mac OS X 10.5. */ #ifndef _DARWIN_USE_64_BIT_INODE # define _DARWIN_USE_64_BIT_INODE 1 #endif /* Number of bits in a file offset, on hosts where this is settable. */ /* #undef _FILE_OFFSET_BITS */ /* Define for large files, on AIX-style hosts. */ /* #undef _LARGE_FILES */ /* Define on some platforms to activate x_r() functions in time.h */ /* #undef _REENTRANT */ /* Define to `unsigned short' if <sys/types.h> does not define. */ /* #undef u_int16_t */ /* Define to `unsigned long' if <sys/types.h> does not define. */ /* #undef u_int32_t */ /* Define to `unsigned long long' if <sys/types.h> does not define. */ /* #undef u_int64_t */ /* Define to `unsigned char' if <sys/types.h> does not define. */ /* #undef u_int8_t */
StealthSend/Stealth
src/tor/adapter/orconfig_apple.h
C
mit
22,512
// // This source file is part of appleseed. // Visit http://appleseedhq.net/ for additional information and resources. // // This software is released under the MIT license. // // Copyright (c) 2010-2013 Francois Beaune, Jupiter Jazz Limited // Copyright (c) 2014-2017 Francois Beaune, The appleseedhq Organization // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef APPLESEED_RENDERER_MODELING_TEXTURE_TEXTURE_H #define APPLESEED_RENDERER_MODELING_TEXTURE_TEXTURE_H // appleseed.renderer headers. #include "renderer/modeling/entity/entity.h" // appleseed.foundation headers. #include "foundation/image/colorspace.h" #include "foundation/utility/uid.h" // appleseed.main headers. #include "main/dllsymbol.h" // Standard headers. #include <cstddef> // Forward declarations. namespace foundation { class CanvasProperties; } namespace foundation { class Tile; } namespace renderer { class ParamArray; } namespace renderer { // // The base class for textures. // class APPLESEED_DLLSYMBOL Texture : public Entity { public: // Return the unique ID of this class of entities. static foundation::UniqueID get_class_uid(); // Constructor. Texture( const char* name, const ParamArray& params); // Return a string identifying the model of this entity. virtual const char* get_model() const = 0; // Return the color space of the texture. virtual foundation::ColorSpace get_color_space() const = 0; // Access canvas properties. virtual const foundation::CanvasProperties& properties() = 0; // Load a given tile. virtual foundation::Tile* load_tile( const size_t tile_x, const size_t tile_y) = 0; // Unload a given tile. virtual void unload_tile( const size_t tile_x, const size_t tile_y, const foundation::Tile* tile) = 0; }; } // namespace renderer #endif // !APPLESEED_RENDERER_MODELING_TEXTURE_TEXTURE_H
aiivashchenko/appleseed
src/appleseed/renderer/modeling/texture/texture.h
C
mit
3,072
# ----------------------------------------------------------------------------- # Copyright (c) 2014 GarageGames, LLC # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. # ----------------------------------------------------------------------------- project("Torque3DEngine") if( CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 8 ) set( TORQUE_CPU_X64 ON ) elseif( CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 4 ) set( TORQUE_CPU_X32 ON ) endif() if(NOT TORQUE_TEMPLATE) set(TORQUE_TEMPLATE "BaseGame" CACHE STRING "the template to use") endif() if(NOT TORQUE_APP_DIR) set(TORQUE_APP_DIR "${CMAKE_SOURCE_DIR}/My Projects/${TORQUE_APP_NAME}" CACHE STRING "final installation location") endif() if(NOT projectOutDir) set(projectOutDir "${TORQUE_APP_DIR}/game") endif() if(NOT projectSrcDir) set(projectSrcDir "${TORQUE_APP_DIR}/source") endif() set(libDir "${CMAKE_SOURCE_DIR}/Engine/lib") set(srcDir "${CMAKE_SOURCE_DIR}/Engine/source") set(cmakeDir "${CMAKE_SOURCE_DIR}/Tools/CMake") # hide some things mark_as_advanced(CMAKE_INSTALL_PREFIX) mark_as_advanced(CMAKE_CONFIGURATION_TYPES) # output folders #set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${projectOutDir}/game) #set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${projectOutDir}/game) #set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${projectOutDir}/game) ############################################################################### ### Source File Handling ############################################################################### # finds and adds sources files in a folder macro(addPath dir) set(tmp_files "") set(glob_config GLOB) if(${ARGC} GREATER 1 AND "${ARGV1}" STREQUAL "REC") set(glob_config GLOB_RECURSE) endif() set(mac_files "") if(APPLE) set(mac_files ${dir}/*.mm ${dir}/*.m) endif() file(${glob_config} tmp_files ${dir}/*.cpp ${dir}/*.c ${dir}/*.cc ${dir}/*.h ${mac_files} #${dir}/*.asm ) foreach(entry ${BLACKLIST}) list(REMOVE_ITEM tmp_files ${dir}/${entry}) endforeach() LIST(APPEND ${PROJECT_NAME}_files "${tmp_files}") LIST(APPEND ${PROJECT_NAME}_paths "${dir}") #message(STATUS "addPath ${PROJECT_NAME} : ${tmp_files}") endmacro() # adds a file to the sources macro(addFile filename) LIST(APPEND ${PROJECT_NAME}_files "${filename}") #message(STATUS "addFile ${PROJECT_NAME} : ${filename}") endmacro() # finds and adds sources files in a folder recursively macro(addPathRec dir) addPath("${dir}" "REC") endmacro() ############################################################################### ### Definition Handling ############################################################################### macro(__addDef def config) # two possibilities: a) target already known, so add it directly, or b) target not yet known, so add it to its cache if(TARGET ${PROJECT_NAME}) #message(STATUS "directly applying defs: ${PROJECT_NAME} with config ${config}: ${def}") if("${config}" STREQUAL "") set_property(TARGET ${PROJECT_NAME} APPEND PROPERTY COMPILE_DEFINITIONS ${def}) else() set_property(TARGET ${PROJECT_NAME} APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:${config}>:${def}>) endif() else() if("${config}" STREQUAL "") list(APPEND ${PROJECT_NAME}_defs_ ${def}) else() list(APPEND ${PROJECT_NAME}_defs_ $<$<CONFIG:${config}>:${def}>) endif() #message(STATUS "added definition to cache: ${PROJECT_NAME}_defs_: ${${PROJECT_NAME}_defs_}") endif() endmacro() # adds a definition: argument 1: Nothing(for all), _DEBUG, _RELEASE, <more build configurations> macro(addDef def) set(def_configs "") if(${ARGC} GREATER 1) foreach(config ${ARGN}) __addDef(${def} ${config}) endforeach() else() __addDef(${def} "") endif() endmacro() # this applies cached definitions onto the target macro(_process_defs) if(DEFINED ${PROJECT_NAME}_defs_) set_property(TARGET ${PROJECT_NAME} APPEND PROPERTY COMPILE_DEFINITIONS ${${PROJECT_NAME}_defs_}) #message(STATUS "applying defs to project ${PROJECT_NAME}: ${${PROJECT_NAME}_defs_}") endif() endmacro() ############################################################################### ### Source Library Handling ############################################################################### macro(addLibSrc libPath) set(cached_project_name ${PROJECT_NAME}) include(${libPath}) project(${cached_project_name}) endmacro() ############################################################################### ### Linked Library Handling ############################################################################### macro(addLib libs) foreach(lib ${libs}) # check if we can build it ourselfs if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/libraries/${lib}.cmake") addLibSrc("${CMAKE_CURRENT_SOURCE_DIR}/libraries/${lib}.cmake") endif() # then link against it # two possibilities: a) target already known, so add it directly, or b) target not yet known, so add it to its cache if(TARGET ${PROJECT_NAME}) target_link_libraries(${PROJECT_NAME} "${lib}") else() list(APPEND ${PROJECT_NAME}_libs ${lib}) endif() endforeach() endmacro() #addLibRelease will add to only release builds macro(addLibRelease libs) foreach(lib ${libs}) # check if we can build it ourselfs if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/libraries/${lib}.cmake") addLibSrc("${CMAKE_CURRENT_SOURCE_DIR}/libraries/${lib}.cmake") endif() # then link against it # two possibilities: a) target already known, so add it directly, or b) target not yet known, so add it to its cache if(TARGET ${PROJECT_NAME}) target_link_libraries(${PROJECT_NAME} optimized "${lib}") else() list(APPEND ${PROJECT_NAME}_libsRelease ${lib}) endif() endforeach() endmacro() #addLibDebug will add to only debug builds macro(addLibDebug libs) foreach(lib ${libs}) # check if we can build it ourselfs if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/libraries/${lib}.cmake") addLibSrc("${CMAKE_CURRENT_SOURCE_DIR}/libraries/${lib}.cmake") endif() # then link against it # two possibilities: a) target already known, so add it directly, or b) target not yet known, so add it to its cache if(TARGET ${PROJECT_NAME}) target_link_libraries(${PROJECT_NAME} debug "${lib}") else() list(APPEND ${PROJECT_NAME}_libsDebug ${lib}) endif() endforeach() endmacro() # this applies cached definitions onto the target macro(_process_libs) if(DEFINED ${PROJECT_NAME}_libs) target_link_libraries(${PROJECT_NAME} "${${PROJECT_NAME}_libs}") endif() if(DEFINED ${PROJECT_NAME}_libsRelease) target_link_libraries(${PROJECT_NAME} optimized "${${PROJECT_NAME}_libsRelease}") endif() if(DEFINED ${PROJECT_NAME}_libsDebug) target_link_libraries(${PROJECT_NAME} debug "${${PROJECT_NAME}_libsDebug}") endif() endmacro() # apple frameworks macro(addFramework framework) if (APPLE) addLib("-framework ${framework}") endif() endmacro() ############################################################################### ### Include Handling ############################################################################### macro(addInclude incPath) if(TARGET ${PROJECT_NAME}) set_property(TARGET ${PROJECT_NAME} APPEND PROPERTY INCLUDE_DIRECTORIES "${incPath}") else() list(APPEND ${PROJECT_NAME}_includes ${incPath}) endif() endmacro() # this applies cached definitions onto the target macro(_process_includes) if(DEFINED ${PROJECT_NAME}_includes) set_property(TARGET ${PROJECT_NAME} APPEND PROPERTY INCLUDE_DIRECTORIES "${${PROJECT_NAME}_includes}") endif() endmacro() ############################################################################### macro(_postTargetProcess) _process_includes() _process_defs() _process_libs() endmacro() # adds a path to search for libs macro(addLibPath dir) link_directories(${dir}) endmacro() # creates a proper filter for VS macro(generateFilters relDir) foreach(f ${${PROJECT_NAME}_files}) # Get the path of the file relative to ${DIRECTORY}, # then alter it (not compulsory) file(RELATIVE_PATH SRCGR ${relDir} ${f}) set(SRCGR "${PROJECT_NAME}/${SRCGR}") # Extract the folder, ie remove the filename part string(REGEX REPLACE "(.*)(/[^/]*)$" "\\1" SRCGR ${SRCGR}) # do not have any ../ dirs string(REPLACE "../" "" SRCGR ${SRCGR}) # Source_group expects \\ (double antislash), not / (slash) string(REPLACE / \\ SRCGR ${SRCGR}) #STRING(REPLACE "//" "/" SRCGR ${SRCGR}) #message(STATUS "FILE: ${f} -> ${SRCGR}") source_group("${SRCGR}" FILES ${f}) endforeach() endmacro() # creates a proper filter for VS macro(generateFiltersSpecial relDir) foreach(f ${${PROJECT_NAME}_files}) # Get the path of the file relative to ${DIRECTORY}, # then alter it (not compulsory) file(RELATIVE_PATH SRCGR ${relDir} ${f}) set(SRCGR "torque3d/${SRCGR}") # Extract the folder, ie remove the filename part string(REGEX REPLACE "(.*)(/[^/]*)$" "\\1" SRCGR ${SRCGR}) # do not have any ../ dirs string(REPLACE "../" "" SRCGR ${SRCGR}) IF("${SRCGR}" MATCHES "^torque3d/My Projects/.*$") string(REPLACE "torque3d/My Projects/${PROJECT_NAME}/" "" SRCGR ${SRCGR}) string(REPLACE "/source" "" SRCGR ${SRCGR}) endif() # Source_group expects \\ (double antislash), not / (slash) string(REPLACE / \\ SRCGR ${SRCGR}) #STRING(REPLACE "//" "/" SRCGR ${SRCGR}) IF(EXISTS "${f}" AND NOT IS_DIRECTORY "${f}") #message(STATUS "FILE: ${f} -> ${SRCGR}") source_group("${SRCGR}" FILES ${f}) endif() endforeach() endmacro() # macro to add a static library macro(finishLibrary) # more paths? if(${ARGC} GREATER 0) foreach(dir ${ARGV0}) addPath("${dir}") endforeach() endif() # now inspect the paths we got set(firstDir "") foreach(dir ${${PROJECT_NAME}_paths}) if("${firstDir}" STREQUAL "") set(firstDir "${dir}") endif() endforeach() generateFilters("${firstDir}") # set per target compile flags if(TORQUE_CXX_FLAGS_${PROJECT_NAME}) set_source_files_properties(${${PROJECT_NAME}_files} PROPERTIES COMPILE_FLAGS "${TORQUE_CXX_FLAGS_${PROJECT_NAME}}") else() set_source_files_properties(${${PROJECT_NAME}_files} PROPERTIES COMPILE_FLAGS "${TORQUE_CXX_FLAGS_LIBS}") endif() if(TORQUE_STATIC) add_library("${PROJECT_NAME}" STATIC ${${PROJECT_NAME}_files}) else() add_library("${PROJECT_NAME}" SHARED ${${PROJECT_NAME}_files}) endif() # omg - only use the first folder ... otherwise we get lots of header name collisions #foreach(dir ${${PROJECT_NAME}_paths}) addInclude("${firstDir}") #endforeach() _postTargetProcess() endmacro() # macro to add an executable macro(finishExecutable) # now inspect the paths we got set(firstDir "") foreach(dir ${${PROJECT_NAME}_paths}) if("${firstDir}" STREQUAL "") set(firstDir "${dir}") endif() endforeach() generateFiltersSpecial("${firstDir}") # set per target compile flags if(TORQUE_CXX_FLAGS_${PROJECT_NAME}) set_source_files_properties(${${PROJECT_NAME}_files} PROPERTIES COMPILE_FLAGS "${TORQUE_CXX_FLAGS_${PROJECT_NAME}}") else() set_source_files_properties(${${PROJECT_NAME}_files} PROPERTIES COMPILE_FLAGS "${TORQUE_CXX_FLAGS_EXECUTABLES}") endif() if (APPLE) set(ICON_FILE "${projectSrcDir}/torque.icns") set_source_files_properties(${ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") add_executable("${PROJECT_NAME}" MACOSX_BUNDLE ${ICON_FILE} ${${PROJECT_NAME}_files}) else() add_executable("${PROJECT_NAME}" WIN32 ${${PROJECT_NAME}_files}) endif() addInclude("${firstDir}") _postTargetProcess() endmacro() macro(setupVersionNumbers) set(TORQUE_APP_VERSION_MAJOR 1 CACHE INTEGER "") set(TORQUE_APP_VERSION_MINOR 0 CACHE INTEGER "") set(TORQUE_APP_VERSION_PATCH 0 CACHE INTEGER "") set(TORQUE_APP_VERSION_TWEAK 0 CACHE INTEGER "") mark_as_advanced(TORQUE_APP_VERSION_TWEAK) MATH(EXPR TORQUE_APP_VERSION "${TORQUE_APP_VERSION_MAJOR} * 1000 + ${TORQUE_APP_VERSION_MINOR} * 100 + ${TORQUE_APP_VERSION_PATCH} * 10 + ${TORQUE_APP_VERSION_TWEAK}") set(TORQUE_APP_VERSION_STRING "${TORQUE_APP_VERSION_MAJOR}.${TORQUE_APP_VERSION_MINOR}.${TORQUE_APP_VERSION_PATCH}.${TORQUE_APP_VERSION_TWEAK}") #message(STATUS "version numbers: ${TORQUE_APP_VERSION} / ${TORQUE_APP_VERSION_STRING}") endmacro() macro(setupPackaging) INCLUDE(CPack) # only enable zips for now set(CPACK_BINARY_NSIS OFF CACHE INTERNAL "" FORCE) set(CPACK_BINARY_ZIP ON CACHE INTERNAL "" FORCE) set(CPACK_SOURCE_ZIP OFF CACHE INTERNAL "" FORCE) SET(CPACK_GENERATOR "ZIP") SET(CPACK_PACKAGE_VENDOR "${PROJECT_NAME}") SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_NAME}") SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 1) SET(CPACK_OUTPUT_FILE_PREFIX "${TORQUE_APP_DIR}/packages/${PROJECT_NAME}") SET(CPACK_PACKAGE_INSTALL_DIRECTORY "") #SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt") #SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt") SET(CPACK_PACKAGE_VERSION_MAJOR "${TORQUE_APP_VERSION_MAJOR}") SET(CPACK_PACKAGE_VERSION_MINOR "${TORQUE_APP_VERSION_MINOR}") SET(CPACK_PACKAGE_VERSION_PATCH "${TORQUE_APP_VERSION_PATCH}") #SET(CPACK_PACKAGE_EXECUTABLES "${PROJECT_NAME}" "${PROJECT_NAME}") SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${TORQUE_APP_VERSION_STRING}") #SET(CPACK_SOURCE_STRIP_FILES "") endmacro() # always static for now set(TORQUE_STATIC ON) #option(TORQUE_STATIC "enables or disable static" OFF) if(WIN32) set(TORQUE_CXX_FLAGS_EXECUTABLES "/wd4018 /wd4100 /wd4121 /wd4127 /wd4130 /wd4244 /wd4245 /wd4389 /wd4511 /wd4512 /wd4800 /wd4995 " CACHE TYPE STRING) mark_as_advanced(TORQUE_CXX_FLAGS_EXECUTABLES) set(TORQUE_CXX_FLAGS_LIBS "/W0" CACHE TYPE STRING) mark_as_advanced(TORQUE_CXX_FLAGS_LIBS) set(TORQUE_CXX_FLAGS_COMMON_DEFAULT "-DUNICODE -D_UNICODE -D_CRT_SECURE_NO_WARNINGS /MP /O2 /Ob2 /Oi /Ot /Oy /GT /Zi /W4 /nologo /GF /EHsc /GS- /Gy- /Qpar- /fp:precise /fp:except- /GR /Zc:wchar_t-" ) if( TORQUE_CPU_X32 ) set(TORQUE_CXX_FLAGS_COMMON_DEFAULT "${TORQUE_CXX_FLAGS_COMMON_DEFAULT} /arch:SSE2") endif() set(TORQUE_CXX_FLAGS_COMMON ${TORQUE_CXX_FLAGS_COMMON_DEFAULT} CACHE TYPE STRING) mark_as_advanced(TORQUE_CXX_FLAGS_COMMON) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORQUE_CXX_FLAGS_COMMON}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS}") set(CMAKE_EXE_LINKER_FLAGS "/LARGEADDRESSAWARE") #set(STATIC_LIBRARY_FLAGS "/OPT:NOREF") # Force static runtime libraries if(TORQUE_STATIC) FOREACH(flag CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT) STRING(REPLACE "/MD" "/MT" "${flag}" "${${flag}}") SET("${flag}" "${${flag}} /EHsc") ENDFOREACH() endif() else() # TODO: improve default settings on other platforms set(TORQUE_CXX_FLAGS_EXECUTABLES "" CACHE TYPE STRING) mark_as_advanced(TORQUE_CXX_FLAGS_EXECUTABLES) set(TORQUE_CXX_FLAGS_LIBS "" CACHE TYPE STRING) mark_as_advanced(TORQUE_CXX_FLAGS_LIBS) set(TORQUE_CXX_FLAGS_COMMON "" CACHE TYPE STRING) mark_as_advanced(TORQUE_CXX_FLAGS) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORQUE_CXX_FLAGS}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS}") endif() if(UNIX AND NOT APPLE) SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${projectOutDir}") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${projectOutDir}") SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${projectOutDir}") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${projectOutDir}") endif() if(APPLE) SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${projectOutDir}") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${projectOutDir}") SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${projectOutDir}") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${projectOutDir}") endif() # fix the debug/release subfolders on windows if(MSVC) SET("CMAKE_RUNTIME_OUTPUT_DIRECTORY" "${projectOutDir}") FOREACH(CONF ${CMAKE_CONFIGURATION_TYPES}) # Go uppercase (DEBUG, RELEASE...) STRING(TOUPPER "${CONF}" CONF) #SET("CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CONF}" "${projectOutDir}") SET("CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CONF}" "${projectOutDir}") ENDFOREACH() endif()
Bloodknight/Torque3D
Tools/CMake/basics.cmake
CMake
mit
18,376
#ifndef BOOST_NETWORK_PROTOCOL_HTTP_IMPL_HTTP_SYNC_CONNECTION_20100601 #define BOOST_NETWORK_PROTOCOL_HTTP_IMPL_HTTP_SYNC_CONNECTION_20100601 // Copyright 2013 Google, Inc. // Copyright 2010 (C) Dean Michael Berris // Copyright 2010 (C) Sinefunc, Inc. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include <iterator> #include <functional> #include <asio/deadline_timer.hpp> #include <asio/streambuf.hpp> #include <boost/network/protocol/http/algorithms/linearize.hpp> #include <boost/network/protocol/http/response.hpp> #include <boost/network/protocol/http/traits/resolver_policy.hpp> #include <boost/network/traits/string.hpp> namespace boost { namespace network { namespace http { namespace impl { template <class Tag, unsigned version_major, unsigned version_minor> struct sync_connection_base_impl; template <class Tag, unsigned version_major, unsigned version_minor> struct sync_connection_base; template <class Tag, unsigned version_major, unsigned version_minor> struct http_sync_connection : public virtual sync_connection_base<Tag, version_major, version_minor>, sync_connection_base_impl<Tag, version_major, version_minor>, std::enable_shared_from_this< http_sync_connection<Tag, version_major, version_minor> > { typedef typename resolver_policy<Tag>::type resolver_base; typedef typename resolver_base::resolver_type resolver_type; typedef typename string<Tag>::type string_type; typedef std::function<typename resolver_base::resolver_iterator_pair( resolver_type&, string_type const&, string_type const&)> resolver_function_type; typedef http_sync_connection<Tag, version_major, version_minor> this_type; typedef sync_connection_base_impl<Tag, version_major, version_minor> connection_base; typedef std::function<bool(string_type&)> body_generator_function_type; http_sync_connection(resolver_type& resolver, resolver_function_type resolve, int timeout) : connection_base(), timeout_(timeout), timer_(resolver.get_io_service()), resolver_(resolver), resolve_(std::move(resolve)), socket_(resolver.get_io_service()) {} void init_socket(string_type const& hostname, string_type const& port) { connection_base::init_socket(socket_, resolver_, hostname, port, resolve_); } void send_request_impl(string_type const& method, basic_request<Tag> const& request_, body_generator_function_type generator) { asio::streambuf request_buffer; linearize( request_, method, version_major, version_minor, std::ostreambuf_iterator<typename char_<Tag>::type>(&request_buffer)); connection_base::send_request_impl(socket_, method, request_buffer); if (generator) { string_type chunk; while (generator(chunk)) { std::copy(chunk.begin(), chunk.end(), std::ostreambuf_iterator<typename char_<Tag>::type>( &request_buffer)); chunk.clear(); connection_base::send_request_impl(socket_, method, request_buffer); } } if (timeout_ > 0) { timer_.expires_from_now(boost::posix_time::seconds(timeout_)); auto self = this->shared_from_this(); timer_.async_wait([=] (std::error_code const &ec) { self->handle_timeout(ec); }); } } void read_status(basic_response<Tag>& response_, asio::streambuf& response_buffer) { connection_base::read_status(socket_, response_, response_buffer); } void read_headers(basic_response<Tag>& response, asio::streambuf& response_buffer) { connection_base::read_headers(socket_, response, response_buffer); } void read_body(basic_response<Tag>& response_, asio::streambuf& response_buffer) { connection_base::read_body(socket_, response_, response_buffer); typename headers_range<basic_response<Tag> >::type connection_range = headers(response_)["Connection"]; if (version_major == 1 && version_minor == 1 && !boost::empty(connection_range) && boost::iequals(std::begin(connection_range)->second, "close")) { close_socket(); } else if (version_major == 1 && version_minor == 0) { close_socket(); } } bool is_open() { return socket_.is_open(); } void close_socket() { timer_.cancel(); if (!is_open()) { return; } std::error_code ignored; socket_.shutdown(asio::ip::tcp::socket::shutdown_both, ignored); if (ignored) { return; } socket_.close(ignored); } private: void handle_timeout(std::error_code const& ec) { if (!ec) { close_socket(); } } int timeout_; asio::deadline_timer timer_; resolver_type& resolver_; resolver_function_type resolve_; asio::ip::tcp::socket socket_; }; } // namespace impl } // namespace http } // namespace network } // namespace boost #endif // BOOST_NETWORK_PROTOCOL_HTTP_IMPL_HTTP_SYNC_CONNECTION_20100
medsouz/AnvilClient
AnvilEldorado/Depends/Include/boost/network/protocol/http/client/connection/sync_normal.hpp
C++
mit
5,139
import React from 'react' import Icon from 'react-icon-base' const IoTshirtOutline = props => ( <Icon viewBox="0 0 40 40" {...props}> <g><path d="m11.4 6.7l-8.1 2.4 0.8 2.5 3.1-0.3 3-0.4-0.2 3-1.1 19.9h17.2l-1.1-19.9-0.2-3 3 0.4 3.1 0.3 0.8-2.5-8.1-2.4c-0.5 0.6-1 1.1-1.6 1.5-1.2 0.8-2.7 1.2-4.5 1.2-2.7-0.1-4.6-0.9-6.1-2.7z m11.1-2.9l12.5 3.7-2.5 6.9-5-0.6 1.3 22.5h-22.5l1.2-22.5-5 0.6-2.5-6.9 12.5-3.7c1.1 2.1 2.4 3 5 3.1 2.6 0 3.9-1 5-3.1z"/></g> </Icon> ) export default IoTshirtOutline
bengimbel/Solstice-React-Contacts-Project
node_modules/react-icons/io/tshirt-outline.js
JavaScript
mit
511
import {NgbCalendarIslamicCivil} from './ngb-calendar-islamic-civil'; import {NgbDate} from '../ngb-date'; import {Injectable} from '@angular/core'; /** * Umalqura calendar is one type of Hijri calendars used in islamic countries. * This Calendar is used by Saudi Arabia for administrative purpose. * Unlike tabular calendars, the algorithm involves astronomical calculation, but it's still deterministic. * http://cldr.unicode.org/development/development-process/design-proposals/islamic-calendar-types */ const GREGORIAN_FIRST_DATE = new Date(1882, 10, 12); const GREGORIAN_LAST_DATE = new Date(2174, 10, 25); const HIJRI_BEGIN = 1300; const HIJRI_END = 1600; const ONE_DAY = 1000 * 60 * 60 * 24; const MONTH_LENGTH = [ // 1300-1304 '101010101010', '110101010100', '111011001001', '011011010100', '011011101010', // 1305-1309 '001101101100', '101010101101', '010101010101', '011010101001', '011110010010', // 1310-1314 '101110101001', '010111010100', '101011011010', '010101011100', '110100101101', // 1315-1319 '011010010101', '011101001010', '101101010100', '101101101010', '010110101101', // 1320-1324 '010010101110', '101001001111', '010100010111', '011010001011', '011010100101', // 1325-1329 '101011010101', '001011010110', '100101011011', '010010011101', '101001001101', // 1330-1334 '110100100110', '110110010101', '010110101100', '100110110110', '001010111010', // 1335-1339 '101001011011', '010100101011', '101010010101', '011011001010', '101011101001', // 1340-1344 '001011110100', '100101110110', '001010110110', '100101010110', '101011001010', // 1345-1349 '101110100100', '101111010010', '010111011001', '001011011100', '100101101101', // 1350-1354 '010101001101', '101010100101', '101101010010', '101110100101', '010110110100', // 1355-1359 '100110110110', '010101010111', '001010010111', '010101001011', '011010100011', // 1360-1364 '011101010010', '101101100101', '010101101010', '101010101011', '010100101011', // 1365-1369 '110010010101', '110101001010', '110110100101', '010111001010', '101011010110', // 1370-1374 '100101010111', '010010101011', '100101001011', '101010100101', '101101010010', // 1375-1379 '101101101010', '010101110101', '001001110110', '100010110111', '010001011011', // 1380-1384 '010101010101', '010110101001', '010110110100', '100111011010', '010011011101', // 1385-1389 '001001101110', '100100110110', '101010101010', '110101010100', '110110110010', // 1390-1394 '010111010101', '001011011010', '100101011011', '010010101011', '101001010101', // 1395-1399 '101101001001', '101101100100', '101101110001', '010110110100', '101010110101', // 1400-1404 '101001010101', '110100100101', '111010010010', '111011001001', '011011010100', // 1405-1409 '101011101001', '100101101011', '010010101011', '101010010011', '110101001001', // 1410-1414 '110110100100', '110110110010', '101010111001', '010010111010', '101001011011', // 1415-1419 '010100101011', '101010010101', '101100101010', '101101010101', '010101011100', // 1420-1424 '010010111101', '001000111101', '100100011101', '101010010101', '101101001010', // 1425-1429 '101101011010', '010101101101', '001010110110', '100100111011', '010010011011', // 1430-1434 '011001010101', '011010101001', '011101010100', '101101101010', '010101101100', // 1435-1439 '101010101101', '010101010101', '101100101001', '101110010010', '101110101001', // 1440-1444 '010111010100', '101011011010', '010101011010', '101010101011', '010110010101', // 1445-1449 '011101001001', '011101100100', '101110101010', '010110110101', '001010110110', // 1450-1454 '101001010110', '111001001101', '101100100101', '101101010010', '101101101010', // 1455-1459 '010110101101', '001010101110', '100100101111', '010010010111', '011001001011', // 1460-1464 '011010100101', '011010101100', '101011010110', '010101011101', '010010011101', // 1465-1469 '101001001101', '110100010110', '110110010101', '010110101010', '010110110101', // 1470-1474 '001011011010', '100101011011', '010010101101', '010110010101', '011011001010', // 1475-1479 '011011100100', '101011101010', '010011110101', '001010110110', '100101010110', // 1480-1484 '101010101010', '101101010100', '101111010010', '010111011001', '001011101010', // 1485-1489 '100101101101', '010010101101', '101010010101', '101101001010', '101110100101', // 1490-1494 '010110110010', '100110110101', '010011010110', '101010010111', '010101000111', // 1495-1499 '011010010011', '011101001001', '101101010101', '010101101010', '101001101011', // 1500-1504 '010100101011', '101010001011', '110101000110', '110110100011', '010111001010', // 1505-1509 '101011010110', '010011011011', '001001101011', '100101001011', '101010100101', // 1510-1514 '101101010010', '101101101001', '010101110101', '000101110110', '100010110111', // 1515-1519 '001001011011', '010100101011', '010101100101', '010110110100', '100111011010', // 1520-1524 '010011101101', '000101101101', '100010110110', '101010100110', '110101010010', // 1525-1529 '110110101001', '010111010100', '101011011010', '100101011011', '010010101011', // 1530-1534 '011001010011', '011100101001', '011101100010', '101110101001', '010110110010', // 1535-1539 '101010110101', '010101010101', '101100100101', '110110010010', '111011001001', // 1540-1544 '011011010010', '101011101001', '010101101011', '010010101011', '101001010101', // 1545-1549 '110100101001', '110101010100', '110110101010', '100110110101', '010010111010', // 1550-1554 '101000111011', '010010011011', '101001001101', '101010101010', '101011010101', // 1555-1559 '001011011010', '100101011101', '010001011110', '101000101110', '110010011010', // 1560-1564 '110101010101', '011010110010', '011010111001', '010010111010', '101001011101', // 1565-1569 '010100101101', '101010010101', '101101010010', '101110101000', '101110110100', // 1570-1574 '010110111001', '001011011010', '100101011010', '101101001010', '110110100100', // 1575-1579 '111011010001', '011011101000', '101101101010', '010101101101', '010100110101', // 1580-1584 '011010010101', '110101001010', '110110101000', '110111010100', '011011011010', // 1585-1589 '010101011011', '001010011101', '011000101011', '101100010101', '101101001010', // 1590-1594 '101110010101', '010110101010', '101010101110', '100100101110', '110010001111', // 1595-1599 '010100100111', '011010010101', '011010101010', '101011010110', '010101011101', // 1600 '001010011101' ]; function getDaysDiff(date1: Date, date2: Date): number { const diff = Math.abs(date1.getTime() - date2.getTime()); return Math.round(diff / ONE_DAY); } @Injectable() export class NgbCalendarIslamicUmalqura extends NgbCalendarIslamicCivil { /** * Returns the equivalent islamic(Umalqura) date value for a give input Gregorian date. * `gdate` is s JS Date to be converted to Hijri. */ fromGregorian(gDate: Date): NgbDate { let hDay = 1, hMonth = 0, hYear = 1300; let daysDiff = getDaysDiff(gDate, GREGORIAN_FIRST_DATE); if (gDate.getTime() - GREGORIAN_FIRST_DATE.getTime() >= 0 && gDate.getTime() - GREGORIAN_LAST_DATE.getTime() <= 0) { let year = 1300; for (let i = 0; i < MONTH_LENGTH.length; i++, year++) { for (let j = 0; j < 12; j++) { let numOfDays = +MONTH_LENGTH[i][j] + 29; if (daysDiff <= numOfDays) { hDay = daysDiff + 1; if (hDay > numOfDays) { hDay = 1; j++; } if (j > 11) { j = 0; year++; } hMonth = j; hYear = year; return new NgbDate(hYear, hMonth + 1, hDay); } daysDiff = daysDiff - numOfDays; } } } else { return super.fromGregorian(gDate); } } /** * Converts the current Hijri date to Gregorian. */ toGregorian(hDate: NgbDate): Date { const hYear = hDate.year; const hMonth = hDate.month - 1; const hDay = hDate.day; let gDate = new Date(GREGORIAN_FIRST_DATE); let dayDiff = hDay - 1; if (hYear >= HIJRI_BEGIN && hYear <= HIJRI_END) { for (let y = 0; y < hYear - HIJRI_BEGIN; y++) { for (let m = 0; m < 12; m++) { dayDiff += +MONTH_LENGTH[y][m] + 29; } } for (let m = 0; m < hMonth; m++) { dayDiff += +MONTH_LENGTH[hYear - HIJRI_BEGIN][m] + 29; } gDate.setDate(GREGORIAN_FIRST_DATE.getDate() + dayDiff); } else { gDate = super.toGregorian(hDate); } return gDate; } /** * Returns the number of days in a specific Hijri hMonth. * `hMonth` is 1 for Muharram, 2 for Safar, etc. * `hYear` is any Hijri hYear. */ getDaysPerMonth(hMonth: number, hYear: number): number { if (hYear >= HIJRI_BEGIN && hYear <= HIJRI_END) { const pos = hYear - HIJRI_BEGIN; return +MONTH_LENGTH[pos][hMonth - 1] + 29; } return super.getDaysPerMonth(hMonth, hYear); } }
ktriek/ng-bootstrap
src/datepicker/hijri/ngb-calendar-islamic-umalqura.ts
TypeScript
mit
9,063
# Supported tags and respective `Dockerfile` links - [`3.1.23`, `3.1`, `3`, `latest` (*Dockerfile*)](https://github.com/docker-library/celery/blob/0652407560f353e749cbe001e8bdbb5db86c2291/Dockerfile) [![](https://badge.imagelayers.io/celery:latest.svg)](https://imagelayers.io/?images=celery:3.1.23) For more information about this image and its history, please see [the relevant manifest file (`library/celery`)](https://github.com/docker-library/official-images/blob/master/library/celery). This image is updated via [pull requests to the `docker-library/official-images` GitHub repo](https://github.com/docker-library/official-images/pulls?q=label%3Alibrary%2Fcelery). For detailed information about the virtual/transfer sizes and individual layers of each of the above supported tags, please see [the `celery/tag-details.md` file](https://github.com/docker-library/docs/blob/master/celery/tag-details.md) in [the `docker-library/docs` GitHub repo](https://github.com/docker-library/docs). # Celery Celery is an open source asynchronous task queue/job queue based on distributed message passing. It is focused on real-time operation, but supports scheduling as well. > [wikipedia.org/wiki/Celery_Task_Queue](https://en.wikipedia.org/wiki/Celery_Task_Queue) # How to use this image ## start a celery worker (RabbitMQ Broker) ```console $ docker run --link some-rabbit:rabbit --name some-celery -d celery ``` ### check the status of the cluster ```console $ docker run --link some-rabbit:rabbit --rm celery celery status ``` ## start a celery worker (Redis Broker) ```console $ docker run --link some-redis:redis -e CELERY_BROKER_URL=redis://redis --name some-celery -d celery ``` ### check the status of the cluster ```console $ docker run --link some-redis:redis -e CELERY_BROKER_URL=redis://redis --rm celery celery status ``` # Supported Docker versions This image is officially supported on Docker version 1.11.1. Support for older versions (down to 1.6) is provided on a best-effort basis. Please see [the Docker installation documentation](https://docs.docker.com/installation/) for details on how to upgrade your Docker daemon. # User Feedback ## Documentation Documentation for this image is stored in the [`celery/` directory](https://github.com/docker-library/docs/tree/master/celery) of the [`docker-library/docs` GitHub repo](https://github.com/docker-library/docs). Be sure to familiarize yourself with the [repository's `README.md` file](https://github.com/docker-library/docs/blob/master/README.md) before attempting a pull request. ## Issues If you have any problems with or questions about this image, please contact us through a [GitHub issue](https://github.com/docker-library/celery/issues). If the issue is related to a CVE, please check for [a `cve-tracker` issue on the `official-images` repository first](https://github.com/docker-library/official-images/issues?q=label%3Acve-tracker). You can also reach many of the official image maintainers via the `#docker-library` IRC channel on [Freenode](https://freenode.net). ## Contributing You are invited to contribute new features, fixes, or updates, large or small; we are always thrilled to receive pull requests, and do our best to process them as fast as we can. Before you start to code, we recommend discussing your plans through a [GitHub issue](https://github.com/docker-library/celery/issues), especially for more ambitious contributions. This gives other contributors a chance to point you in the right direction, give you feedback on your design, and help you find out if someone else is working on the same thing.
pierreozoux/docs
celery/README.md
Markdown
mit
3,628
declare module "react-apollo" { declare function graphql(query: Object, options: Object): Function; }
NewSpring/apollos-core
.types/react-apollo.js
JavaScript
mit
104
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Permalinks</title> <link rel="stylesheet" href="../assets/css/ghost.min.css"> <!-- Styles not needed for this. Just to get around various bits that Ember handles for us. --> <style> @media (max-width: 900px) { .settings-nav { top: 0; left: -100%; } .settings-content { margin-left: 0; } } </style> </head> <body class="ember-application settings settings-view-general" data-apps="false" data-filestorage="true" data-blogurl="http://127.0.0.1:2368"> <div id="container"><a class="sr-only sr-only-focusable" href="#gh-main">Skip to main content</a> <nav class="global-nav" role="navigation"> <a class="nav-item ghost-logo" href="/" title="/"> <div class="nav-label"><i class="icon-ghost"></i> <span>Visit blog</span> </div> </a> <a class="nav-item nav-content js-nav-item" href="/ghost/"> <div class="nav-label"><i class="icon-content"></i> Content</div> </a> <a class="nav-item nav-new js-nav-item" href="/ghost/editor/"> <div class="nav-label"><i class="icon-add"></i> New Post</div> </a> <a class="nav-item nav-settings js-nav-item active" href="/ghost/settings/"> <div class="nav-label"><i class="icon-settings2"></i> Settings</div> </a> <div class="nav-item user-menu" data-href="#"> <div class=" nav-label"> <div class="image"> <img src="../../../core/shared/img/user-image.png" alt="Paul Davis's profile picture"> </div> <div class="name"> Paul Davis <i class="icon-chevron-down"></i> <small>Profile &amp; Settings</small> </div> </div> </div> </nav> <div class="nav-cover js-nav-cover"></div> <main id="gh-main" class="viewport" role="main" data-notification-count="0" data-bindattr-448="448"> <aside class="notifications top"> </aside> <aside class="notifications bottom"> </aside> <div> <header class="page-header"> <button class="menu-button js-menu-button" data-ember-action="1221"> <span class="sr-only">Menu</span> </button> <h2 class="page-title">Settings</h2> </header> <div class="page-content"> <nav class="settings-nav js-settings-nav"> <ul> <li class="settings-nav-general icon-settings active"><a class="active" href="/ghost/settings/general/">General</a> </li> <li class="settings-nav-users icon-users"><a href="/ghost/settings/users/">Users</a> </li> <li class="settings-nav-about icon-pacman"><a href="/ghost/settings/about/">About</a> </li> </ul> </nav> <section class="settings-content js-settings-content fade-in"> <header class="settings-view-header"> <a class="gh-btn gh-btn-default gh-btn-back active" href="/ghost/settings/"><span>Back</span></a> <h2 class="page-title">General</h2> <section class="page-actions"> <button type="button" class="gh-btn gh-btn-blue" data-ember-action="1271"><span>Save</span></button> </section> </header> <section class="content settings-general"> <form id="settings-general" novalidate="novalidate"> <div class="form-group"> <label for="blog-title">Blog Title</label> <input id="blog-title" class="" type="text" name="general[title]" value="Paul Davis"> <p>The name of your blog</p> </div> <div class="form-group"> <label for="blog-logo">Blog Logo</label> <button type="button" class="gh-btn gh-btn-green js-modal-logo" data-ember-action="1277"><span>Upload Image</span></button> <p>Display a sexy logo for your publication</p> </div> <fieldset> <div class="form-group"> <label for="postsPerPage">Posts per page</label> <input id="postsPerPage" class="" type="number" name="general[postsPerPage]" min="1" max="1000" value="5"> <p>How many posts should be displayed on each page</p> </div> <div class="form-group"> <label for="blog-permalinks">Permalinks</label> <label class="permalink-input-wrapper input" tabindex="0"> <div class="permalink-fake-input"> <span class="permalink-domain">http://myblog.ghost.io</span> <span class="permalink-parameter label label-default">journal</span> <span class="permalink-parameter label label-default">year</span> <span class="permalink-parameter label label-default">hello</span> <span class="permalink-parameter label label-default">agaian</span> <span class="permalink-parameter label label-default">this</span> <span class="permalink-parameter label label-default">is</span> <span class="permalink-parameter label label-default">nice</span> <span class="permalink-parameter label label-default">yo</span> <span class="permalink-parameter label label-default">yo</span> <span class="permalink-parameter label label-default">yo</span> <input id="blog-permalinks" class="permalink-input" type="text" name="general[permalinks]"> </div> <div class="popover"> <button class="permalink-help button icon-question hover-me"> <span class="hidden">URL Structure Formatting</span> </button> <div class="popover-item closed popover-triangle-bottom"> <div class="popover-title">URL Structure Formatting</div> <div class="popover-desc">You can use dynamic variables in this field.</div> <div class="popover-body"> <p> <b>%t</b> - The title of your post (or page)<br> <b>%c</b> - The tag which your post is categorised in<br> <b>%y</b> - The year your post was published<br> <b>%m</b> - The month your post was published<br> <b>%d</b> - The day your post was published </p> </div> </div> </div> </label> <p>The default URL structure for your blog</p> </div> <div class="form-group for-select"> <label for="activeTheme">Theme</label> <span class="gh-select" data-bindattr-1286="1286" tabindex="0" data-select-text="Casper - 1.1.0"> <select id="activeTheme" class="ember-select" name="general[activeTheme]"> <option value="casper">Casper - 1.1.0</option> <option value="hayleybrowne">HJB - 0.5</option> <option value="mono">Mono - 0.1.0</option> <option value="pad-gs">PAD-GS - 0.8</option> <option value="pauladamdavis">PAD - 0.8</option> </select> </span> <p>Select a theme for your blog</p> </div> </fieldset> </form> </section> </section> </div> </div> </main> </div> </body> </html> <script src="../../../bower_components/jquery/dist/jquery.js"></script> <script> $(function(){ $('.permalink-input-wrapper').on('click', function(){ $(this).addClass('focus'); $('#blog-permalinks').focus(); }); $('#blog-permalinks').on('blur', function(){ $('.permalink-input-wrapper').removeClass('focus'); }); $('.hover-me').hover(function(){ $(this).next('.popover-item').addClass('open fade-in').removeClass('closed fade-out'); }, function(){ $(this).next('.popover-item').removeClass('fade-in').addClass('fade-out'); $(this).next('.popover-item').on('animationend webkitAnimationEnd oanimationend MSAnimationEnd', function (event) { if (event.originalEvent.animationName === 'fade-out') { $(this).removeClass('open fade-out').addClass('closed'); } }); }); function convertToSlug(Text){ return Text.toLowerCase().replace(/[^\w ]+/g,'').replace(/ +/g,'-').trim(); } $('#blog-permalinks').on('keyup', function(e){ // 188 = comma // Append the new parameter when pressing comma if (e.keyCode === 188) { var input_val = convertToSlug($(this).val()); var the_param = '<span class="permalink-parameter label label-default">' + input_val + '</span>'; // If a parameter exists, append after it. // Else append after the domain if ($('.permalink-parameter').length) { $('.permalink-parameter:last').after(the_param); } else { $('.permalink-domain').after(the_param); } $(this).val(''); } // 8 = backspace // When backspace is pressed AND the input is empty, delete the last parameter if (e.keyCode === 8 && $(this).val() == '') { $('.permalink-parameter:last').remove(); } }); }); </script>
JohnONolan/Ghost-Admin
app/html/permalinks.html
HTML
mit
12,426
<?php namespace Chamilo\Application\Weblcms\Tool\Implementation\ExamAssignment\Ajax\Component; use Chamilo\Application\Weblcms\Tool\Implementation\ExamAssignment\Ajax\Manager; use Symfony\Component\HttpFoundation\JsonResponse; /** * @package Chamilo\Application\Weblcms\Tool\Implementation\ExamAssignment\Ajax\Component * * @author Stefan Gabriëls - Hogeschool Gent */ class ListUsersComponent extends Manager { /** * @return string */ function run() { try { $publication = $this->getAjaxComponent()->getContentObjectPublication(); $users = $this->getUserOvertimeService()->getUsersByPublication($publication); return new JsonResponse([self::PARAM_RESULTS => $users]); } catch(\Exception $ex) { $this->getExceptionLogger()->logException($ex); return new JsonResponse([self::PARAM_ERROR_MESSAGE => $ex->getMessage()], 500); } } }
forelo/cosnics
src/Chamilo/Application/Weblcms/Tool/Implementation/ExamAssignment/Ajax/Component/ListUsersComponent.php
PHP
mit
970
/* * Copyright (c) 2000-2018 Apple Computer, Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* * attr.h - attribute data structures and interfaces * * Copyright (c) 1998, Apple Computer, Inc. All Rights Reserved. */ #ifndef _SYS_ATTR_H_ #define _SYS_ATTR_H_ #include <sys/appleapiopts.h> #ifdef __APPLE_API_UNSTABLE #include <sys/types.h> #include <sys/ucred.h> #include <sys/time.h> #include <sys/cdefs.h> #define FSOPT_NOFOLLOW 0x00000001 #define FSOPT_NOINMEMUPDATE 0x00000002 #define FSOPT_REPORT_FULLSIZE 0x00000004 /* The following option only valid when requesting ATTR_CMN_RETURNED_ATTRS */ #define FSOPT_PACK_INVAL_ATTRS 0x00000008 #define FSOPT_ATTR_CMN_EXTENDED 0x00000020 /* we currently aren't anywhere near this amount for a valid * fssearchblock.sizeofsearchparams1 or fssearchblock.sizeofsearchparams2 * but we put a sanity check in to avoid abuse of the value passed in from * user land. */ #define SEARCHFS_MAX_SEARCHPARMS 4096 typedef u_int32_t text_encoding_t; typedef u_int32_t fsobj_type_t; typedef u_int32_t fsobj_tag_t; typedef u_int32_t fsfile_type_t; typedef u_int32_t fsvolid_t; #include <sys/_types/_fsobj_id_t.h> /* file object id type */ typedef u_int32_t attrgroup_t; struct attrlist { u_short bitmapcount; /* number of attr. bit sets in list (should be 5) */ u_int16_t reserved; /* (to maintain 4-byte alignment) */ attrgroup_t commonattr; /* common attribute group */ attrgroup_t volattr; /* Volume attribute group */ attrgroup_t dirattr; /* directory attribute group */ attrgroup_t fileattr; /* file attribute group */ attrgroup_t forkattr; /* fork attribute group */ }; #define ATTR_BIT_MAP_COUNT 5 typedef struct attribute_set { attrgroup_t commonattr; /* common attribute group */ attrgroup_t volattr; /* Volume attribute group */ attrgroup_t dirattr; /* directory attribute group */ attrgroup_t fileattr; /* file attribute group */ attrgroup_t forkattr; /* fork attribute group */ } attribute_set_t; typedef struct attrreference { int32_t attr_dataoffset; u_int32_t attr_length; } attrreference_t; /* XXX PPD This is derived from HFSVolumePriv.h and should perhaps be referenced from there? */ struct diskextent { u_int32_t startblock; /* first block allocated */ u_int32_t blockcount; /* number of blocks allocated */ }; typedef struct diskextent extentrecord[8]; typedef u_int32_t vol_capabilities_set_t[4]; #define VOL_CAPABILITIES_FORMAT 0 #define VOL_CAPABILITIES_INTERFACES 1 #define VOL_CAPABILITIES_RESERVED1 2 #define VOL_CAPABILITIES_RESERVED2 3 typedef struct vol_capabilities_attr { vol_capabilities_set_t capabilities; vol_capabilities_set_t valid; } vol_capabilities_attr_t; /* * XXX this value needs to be raised - 3893388 */ #define ATTR_MAX_BUFFER 8192 /* * VOL_CAP_FMT_PERSISTENTOBJECTIDS: When set, the volume has object IDs * that are persistent (retain their values even when the volume is * unmounted and remounted), and a file or directory can be looked up * by ID. Volumes that support VolFS and can support Carbon File ID * references should set this bit. * * VOL_CAP_FMT_SYMBOLICLINKS: When set, the volume supports symbolic * links. The symlink(), readlink(), and lstat() calls all use this * symbolic link. * * VOL_CAP_FMT_HARDLINKS: When set, the volume supports hard links. * The link() call creates hard links. * * VOL_CAP_FMT_JOURNAL: When set, the volume is capable of supporting * a journal used to speed recovery in case of unplanned shutdown * (such as a power outage or crash). This bit does not necessarily * mean the volume is actively using a journal for recovery. * * VOL_CAP_FMT_JOURNAL_ACTIVE: When set, the volume is currently using * a journal for use in speeding recovery after an unplanned shutdown. * This bit can be set only if VOL_CAP_FMT_JOURNAL is also set. * * VOL_CAP_FMT_NO_ROOT_TIMES: When set, the volume format does not * store reliable times for the root directory, so you should not * depend on them to detect changes, etc. * * VOL_CAP_FMT_SPARSE_FILES: When set, the volume supports sparse files. * That is, files which can have "holes" that have never been written * to, and are not allocated on disk. Sparse files may have an * allocated size that is less than the file's logical length. * * VOL_CAP_FMT_ZERO_RUNS: For security reasons, parts of a file (runs) * that have never been written to must appear to contain zeroes. When * this bit is set, the volume keeps track of allocated but unwritten * runs of a file so that it can substitute zeroes without actually * writing zeroes to the media. This provides performance similar to * sparse files, but not the space savings. * * VOL_CAP_FMT_CASE_SENSITIVE: When set, file and directory names are * case sensitive (upper and lower case are different). When clear, * an upper case character is equivalent to a lower case character, * and you can't have two names that differ solely in the case of * the characters. * * VOL_CAP_FMT_CASE_PRESERVING: When set, file and directory names * preserve the difference between upper and lower case. If clear, * the volume may change the case of some characters (typically * making them all upper or all lower case). A volume that sets * VOL_CAP_FMT_CASE_SENSITIVE should also set VOL_CAP_FMT_CASE_PRESERVING. * * VOL_CAP_FMT_FAST_STATFS: This bit is used as a hint to upper layers * (especially Carbon) that statfs() is fast enough that its results * need not be cached by those upper layers. A volume that caches * the statfs information in its in-memory structures should set this bit. * A volume that must always read from disk or always perform a network * transaction should not set this bit. * * VOL_CAP_FMT_2TB_FILESIZE: If this bit is set the volume format supports * file sizes larger than 4GB, and potentially up to 2TB; it does not * indicate whether the filesystem supports files larger than that. * * VOL_CAP_FMT_OPENDENYMODES: When set, the volume supports open deny * modes (e.g. "open for read write, deny write"; effectively, mandatory * file locking based on open modes). * * VOL_CAP_FMT_HIDDEN_FILES: When set, the volume supports the UF_HIDDEN * file flag, and the UF_HIDDEN flag is mapped to that volume's native * "hidden" or "invisible" bit (which may be the invisible bit from the * Finder Info extended attribute). * * VOL_CAP_FMT_PATH_FROM_ID: When set, the volume supports the ability * to derive a pathname to the root of the file system given only the * id of an object. This also implies that object ids on this file * system are persistent and not recycled. This is a very specialized * capability and it is assumed that most file systems will not support * it. Its use is for legacy non-posix APIs like ResolveFileIDRef. * * VOL_CAP_FMT_NO_VOLUME_SIZES: When set, the volume does not support * returning values for total data blocks, available blocks, or free blocks * (as in f_blocks, f_bavail, or f_bfree in "struct statfs"). Historically, * those values were set to 0xFFFFFFFF for volumes that did not support them. * * VOL_CAP_FMT_DECMPFS_COMPRESSION: When set, the volume supports transparent * decompression of compressed files using decmpfs. * * VOL_CAP_FMT_64BIT_OBJECT_IDS: When set, the volume uses object IDs that * are 64-bit. This means that ATTR_CMN_FILEID and ATTR_CMN_PARENTID are the * only legitimate attributes for obtaining object IDs from this volume and the * 32-bit fid_objno fields of the fsobj_id_t returned by ATTR_CMN_OBJID, * ATTR_CMN_OBJPERMID, and ATTR_CMN_PAROBJID are undefined. * * VOL_CAP_FMT_DIR_HARDLINKS: When set, the volume supports directory * hard links. * * VOL_CAP_FMT_DOCUMENT_ID: When set, the volume supports document IDs * (an ID which persists across object ID changes) for document revisions. * * VOL_CAP_FMT_WRITE_GENERATION_COUNT: When set, the volume supports write * generation counts (a count of how many times an object has been modified) * * VOL_CAP_FMT_NO_IMMUTABLE_FILES: When set, the volume does not support * setting the UF_IMMUTABLE flag. * * VOL_CAP_FMT_NO_PERMISSIONS: When set, the volume does not support setting * permissions. * * VOL_CAP_FMT_SHARED_SPACE: When set, the volume supports sharing space with * other filesystems i.e. multiple logical filesystems can exist in the same * "partition". An implication of this is that the filesystem which sets * this capability treats waitfor arguments to VFS_SYNC as bit flags. * * VOL_CAP_FMT_VOL_GROUPS: When set, this volume is part of a volume-group * that implies multiple volumes must be mounted in order to boot and root the * operating system. Typically, this means a read-only system volume and a * writable data volume. */ #define VOL_CAP_FMT_PERSISTENTOBJECTIDS 0x00000001 #define VOL_CAP_FMT_SYMBOLICLINKS 0x00000002 #define VOL_CAP_FMT_HARDLINKS 0x00000004 #define VOL_CAP_FMT_JOURNAL 0x00000008 #define VOL_CAP_FMT_JOURNAL_ACTIVE 0x00000010 #define VOL_CAP_FMT_NO_ROOT_TIMES 0x00000020 #define VOL_CAP_FMT_SPARSE_FILES 0x00000040 #define VOL_CAP_FMT_ZERO_RUNS 0x00000080 #define VOL_CAP_FMT_CASE_SENSITIVE 0x00000100 #define VOL_CAP_FMT_CASE_PRESERVING 0x00000200 #define VOL_CAP_FMT_FAST_STATFS 0x00000400 #define VOL_CAP_FMT_2TB_FILESIZE 0x00000800 #define VOL_CAP_FMT_OPENDENYMODES 0x00001000 #define VOL_CAP_FMT_HIDDEN_FILES 0x00002000 #define VOL_CAP_FMT_PATH_FROM_ID 0x00004000 #define VOL_CAP_FMT_NO_VOLUME_SIZES 0x00008000 #define VOL_CAP_FMT_DECMPFS_COMPRESSION 0x00010000 #define VOL_CAP_FMT_64BIT_OBJECT_IDS 0x00020000 #define VOL_CAP_FMT_DIR_HARDLINKS 0x00040000 #define VOL_CAP_FMT_DOCUMENT_ID 0x00080000 #define VOL_CAP_FMT_WRITE_GENERATION_COUNT 0x00100000 #define VOL_CAP_FMT_NO_IMMUTABLE_FILES 0x00200000 #define VOL_CAP_FMT_NO_PERMISSIONS 0x00400000 #define VOL_CAP_FMT_SHARED_SPACE 0x00800000 #define VOL_CAP_FMT_VOL_GROUPS 0x01000000 /* * VOL_CAP_INT_SEARCHFS: When set, the volume implements the * searchfs() system call (the vnop_searchfs vnode operation). * * VOL_CAP_INT_ATTRLIST: When set, the volume implements the * getattrlist() and setattrlist() system calls (vnop_getattrlist * and vnop_setattrlist vnode operations) for the volume, files, * and directories. The volume may or may not implement the * readdirattr() system call. XXX Is there any minimum set * of attributes that should be supported? To determine the * set of supported attributes, get the ATTR_VOL_ATTRIBUTES * attribute of the volume. * * VOL_CAP_INT_NFSEXPORT: When set, the volume implements exporting * of NFS volumes. * * VOL_CAP_INT_READDIRATTR: When set, the volume implements the * readdirattr() system call (vnop_readdirattr vnode operation). * * VOL_CAP_INT_EXCHANGEDATA: When set, the volume implements the * exchangedata() system call (VNOP_EXCHANGE vnode operation). * * VOL_CAP_INT_COPYFILE: When set, the volume implements the * VOP_COPYFILE vnode operation. (XXX There should be a copyfile() * system call in <unistd.h>.) * * VOL_CAP_INT_ALLOCATE: When set, the volume implements the * VNOP_ALLOCATE vnode operation, which means it implements the * F_PREALLOCATE selector of fcntl(2). * * VOL_CAP_INT_VOL_RENAME: When set, the volume implements the * ATTR_VOL_NAME attribute for both getattrlist() and setattrlist(). * The volume can be renamed by setting ATTR_VOL_NAME with setattrlist(). * * VOL_CAP_INT_ADVLOCK: When set, the volume implements POSIX style * byte range locks via vnop_advlock (accessible from fcntl(2)). * * VOL_CAP_INT_FLOCK: When set, the volume implements whole-file flock(2) * style locks via vnop_advlock. This includes the O_EXLOCK and O_SHLOCK * flags of the open(2) call. * * VOL_CAP_INT_EXTENDED_SECURITY: When set, the volume implements * extended security (ACLs). * * VOL_CAP_INT_USERACCESS: When set, the volume supports the * ATTR_CMN_USERACCESS attribute (used to get the user's access * mode to the file). * * VOL_CAP_INT_MANLOCK: When set, the volume supports AFP-style * mandatory byte range locks via an ioctl(). * * VOL_CAP_INT_EXTENDED_ATTR: When set, the volume implements * native extended attribues. * * VOL_CAP_INT_NAMEDSTREAMS: When set, the volume supports * native named streams. * * VOL_CAP_INT_CLONE: When set, the volume supports clones. * * VOL_CAP_INT_SNAPSHOT: When set, the volume supports snapshots. * * VOL_CAP_INT_RENAME_SWAP: When set, the volume supports swapping * file system objects. * * VOL_CAP_INT_RENAME_EXCL: When set, the volume supports an * exclusive rename operation. * * VOL_CAP_INT_RENAME_OPENFAIL: When set, the volume may fail rename * operations on files that are open. */ #define VOL_CAP_INT_SEARCHFS 0x00000001 #define VOL_CAP_INT_ATTRLIST 0x00000002 #define VOL_CAP_INT_NFSEXPORT 0x00000004 #define VOL_CAP_INT_READDIRATTR 0x00000008 #define VOL_CAP_INT_EXCHANGEDATA 0x00000010 #define VOL_CAP_INT_COPYFILE 0x00000020 #define VOL_CAP_INT_ALLOCATE 0x00000040 #define VOL_CAP_INT_VOL_RENAME 0x00000080 #define VOL_CAP_INT_ADVLOCK 0x00000100 #define VOL_CAP_INT_FLOCK 0x00000200 #define VOL_CAP_INT_EXTENDED_SECURITY 0x00000400 #define VOL_CAP_INT_USERACCESS 0x00000800 #define VOL_CAP_INT_MANLOCK 0x00001000 #define VOL_CAP_INT_NAMEDSTREAMS 0x00002000 #define VOL_CAP_INT_EXTENDED_ATTR 0x00004000 #define VOL_CAP_INT_CLONE 0x00010000 #define VOL_CAP_INT_SNAPSHOT 0x00020000 #define VOL_CAP_INT_RENAME_SWAP 0x00040000 #define VOL_CAP_INT_RENAME_EXCL 0x00080000 #define VOL_CAP_INT_RENAME_OPENFAIL 0x00100000 typedef struct vol_attributes_attr { attribute_set_t validattr; attribute_set_t nativeattr; } vol_attributes_attr_t; #define ATTR_CMN_NAME 0x00000001 #define ATTR_CMN_DEVID 0x00000002 #define ATTR_CMN_FSID 0x00000004 #define ATTR_CMN_OBJTYPE 0x00000008 #define ATTR_CMN_OBJTAG 0x00000010 #define ATTR_CMN_OBJID 0x00000020 #define ATTR_CMN_OBJPERMANENTID 0x00000040 #define ATTR_CMN_PAROBJID 0x00000080 #define ATTR_CMN_SCRIPT 0x00000100 #define ATTR_CMN_CRTIME 0x00000200 #define ATTR_CMN_MODTIME 0x00000400 #define ATTR_CMN_CHGTIME 0x00000800 #define ATTR_CMN_ACCTIME 0x00001000 #define ATTR_CMN_BKUPTIME 0x00002000 #define ATTR_CMN_FNDRINFO 0x00004000 #define ATTR_CMN_OWNERID 0x00008000 #define ATTR_CMN_GRPID 0x00010000 #define ATTR_CMN_ACCESSMASK 0x00020000 #define ATTR_CMN_FLAGS 0x00040000 /* The following were defined as: */ /* #define ATTR_CMN_NAMEDATTRCOUNT 0x00080000 */ /* #define ATTR_CMN_NAMEDATTRLIST 0x00100000 */ /* These bits have been salvaged for use as: */ /* #define ATTR_CMN_GEN_COUNT 0x00080000 */ /* #define ATTR_CMN_DOCUMENT_ID 0x00100000 */ /* They can only be used with the FSOPT_ATTR_CMN_EXTENDED */ /* option flag. */ #define ATTR_CMN_GEN_COUNT 0x00080000 #define ATTR_CMN_DOCUMENT_ID 0x00100000 #define ATTR_CMN_USERACCESS 0x00200000 #define ATTR_CMN_EXTENDED_SECURITY 0x00400000 #define ATTR_CMN_UUID 0x00800000 #define ATTR_CMN_GRPUUID 0x01000000 #define ATTR_CMN_FILEID 0x02000000 #define ATTR_CMN_PARENTID 0x04000000 #define ATTR_CMN_FULLPATH 0x08000000 #define ATTR_CMN_ADDEDTIME 0x10000000 #define ATTR_CMN_ERROR 0x20000000 #define ATTR_CMN_DATA_PROTECT_FLAGS 0x40000000 /* * ATTR_CMN_RETURNED_ATTRS is only valid with getattrlist(2) and * getattrlistbulk(2). It is always the first attribute in the return buffer. */ #define ATTR_CMN_RETURNED_ATTRS 0x80000000 #define ATTR_CMN_VALIDMASK 0xFFFFFFFF /* * The settable ATTR_CMN_* attributes include the following: * ATTR_CMN_SCRIPT * ATTR_CMN_CRTIME * ATTR_CMN_MODTIME * ATTR_CMN_CHGTIME * * ATTR_CMN_ACCTIME * ATTR_CMN_BKUPTIME * ATTR_CMN_FNDRINFO * ATTR_CMN_OWNERID * * ATTR_CMN_GRPID * ATTR_CMN_ACCESSMASK * ATTR_CMN_FLAGS * * ATTR_CMN_EXTENDED_SECURITY * ATTR_CMN_UUID * * ATTR_CMN_GRPUUID * * ATTR_CMN_DATA_PROTECT_FLAGS */ #define ATTR_CMN_SETMASK 0x51C7FF00 #define ATTR_CMN_VOLSETMASK 0x00006700 #define ATTR_VOL_FSTYPE 0x00000001 #define ATTR_VOL_SIGNATURE 0x00000002 #define ATTR_VOL_SIZE 0x00000004 #define ATTR_VOL_SPACEFREE 0x00000008 #define ATTR_VOL_SPACEAVAIL 0x00000010 #define ATTR_VOL_MINALLOCATION 0x00000020 #define ATTR_VOL_ALLOCATIONCLUMP 0x00000040 #define ATTR_VOL_IOBLOCKSIZE 0x00000080 #define ATTR_VOL_OBJCOUNT 0x00000100 #define ATTR_VOL_FILECOUNT 0x00000200 #define ATTR_VOL_DIRCOUNT 0x00000400 #define ATTR_VOL_MAXOBJCOUNT 0x00000800 #define ATTR_VOL_MOUNTPOINT 0x00001000 #define ATTR_VOL_NAME 0x00002000 #define ATTR_VOL_MOUNTFLAGS 0x00004000 #define ATTR_VOL_MOUNTEDDEVICE 0x00008000 #define ATTR_VOL_ENCODINGSUSED 0x00010000 #define ATTR_VOL_CAPABILITIES 0x00020000 #define ATTR_VOL_UUID 0x00040000 #define ATTR_VOL_QUOTA_SIZE 0x10000000 #define ATTR_VOL_RESERVED_SIZE 0x20000000 #define ATTR_VOL_ATTRIBUTES 0x40000000 #define ATTR_VOL_INFO 0x80000000 #define ATTR_VOL_VALIDMASK 0xF007FFFF /* * The list of settable ATTR_VOL_* attributes include the following: * ATTR_VOL_NAME * ATTR_VOL_INFO */ #define ATTR_VOL_SETMASK 0x80002000 /* File/directory attributes: */ #define ATTR_DIR_LINKCOUNT 0x00000001 #define ATTR_DIR_ENTRYCOUNT 0x00000002 #define ATTR_DIR_MOUNTSTATUS 0x00000004 #define ATTR_DIR_ALLOCSIZE 0x00000008 #define ATTR_DIR_IOBLOCKSIZE 0x00000010 #define ATTR_DIR_DATALENGTH 0x00000020 /* ATTR_DIR_MOUNTSTATUS Flags: */ #define DIR_MNTSTATUS_MNTPOINT 0x00000001 #define DIR_MNTSTATUS_TRIGGER 0x00000002 #define ATTR_DIR_VALIDMASK 0x0000003f #define ATTR_DIR_SETMASK 0x00000000 #define ATTR_FILE_LINKCOUNT 0x00000001 #define ATTR_FILE_TOTALSIZE 0x00000002 #define ATTR_FILE_ALLOCSIZE 0x00000004 #define ATTR_FILE_IOBLOCKSIZE 0x00000008 #define ATTR_FILE_DEVTYPE 0x00000020 #define ATTR_FILE_FORKCOUNT 0x00000080 #define ATTR_FILE_FORKLIST 0x00000100 #define ATTR_FILE_DATALENGTH 0x00000200 #define ATTR_FILE_DATAALLOCSIZE 0x00000400 #define ATTR_FILE_RSRCLENGTH 0x00001000 #define ATTR_FILE_RSRCALLOCSIZE 0x00002000 #define ATTR_FILE_VALIDMASK 0x000037FF /* * Settable ATTR_FILE_* attributes include: * ATTR_FILE_DEVTYPE */ #define ATTR_FILE_SETMASK 0x00000020 /* CMNEXT attributes extend the common attributes, but in the forkattr field */ #define ATTR_CMNEXT_RELPATH 0x00000004 #define ATTR_CMNEXT_PRIVATESIZE 0x00000008 #define ATTR_CMNEXT_LINKID 0x00000010 #define ATTR_CMNEXT_NOFIRMLINKPATH 0x00000020 #define ATTR_CMNEXT_REALDEVID 0x00000040 #define ATTR_CMNEXT_REALFSID 0x00000080 #define ATTR_CMNEXT_CLONEID 0x00000100 #define ATTR_CMNEXT_EXT_FLAGS 0x00000200 #define ATTR_CMNEXT_VALIDMASK 0x000003fc #define ATTR_CMNEXT_SETMASK 0x00000000 /* Deprecated fork attributes */ #define ATTR_FORK_TOTALSIZE 0x00000001 #define ATTR_FORK_ALLOCSIZE 0x00000002 #define ATTR_FORK_RESERVED 0xffffffff #define ATTR_FORK_VALIDMASK 0x00000003 #define ATTR_FORK_SETMASK 0x00000000 /* Obsolete, implemented, not supported */ #define ATTR_CMN_NAMEDATTRCOUNT 0x00080000 #define ATTR_CMN_NAMEDATTRLIST 0x00100000 #define ATTR_FILE_CLUMPSIZE 0x00000010 /* obsolete */ #define ATTR_FILE_FILETYPE 0x00000040 /* always zero */ #define ATTR_FILE_DATAEXTENTS 0x00000800 /* obsolete, HFS-specific */ #define ATTR_FILE_RSRCEXTENTS 0x00004000 /* obsolete, HFS-specific */ /* Required attributes for getattrlistbulk(2) */ #define ATTR_BULK_REQUIRED (ATTR_CMN_NAME | ATTR_CMN_RETURNED_ATTRS) /* * Searchfs */ #define SRCHFS_START 0x00000001 #define SRCHFS_MATCHPARTIALNAMES 0x00000002 #define SRCHFS_MATCHDIRS 0x00000004 #define SRCHFS_MATCHFILES 0x00000008 #define SRCHFS_SKIPLINKS 0x00000010 #define SRCHFS_SKIPINVISIBLE 0x00000020 #define SRCHFS_SKIPPACKAGES 0x00000040 #define SRCHFS_SKIPINAPPROPRIATE 0x00000080 #define SRCHFS_NEGATEPARAMS 0x80000000 #define SRCHFS_VALIDOPTIONSMASK 0x800000FF struct fssearchblock { struct attrlist *returnattrs; void *returnbuffer; size_t returnbuffersize; u_long maxmatches; struct timeval timelimit; void *searchparams1; size_t sizeofsearchparams1; void *searchparams2; size_t sizeofsearchparams2; struct attrlist searchattrs; }; struct searchstate { uint32_t ss_union_flags; // for SRCHFS_START uint32_t ss_union_layer; // 0 = top u_char ss_fsstate[548]; // fs private } __attribute__((packed)); #define FST_EOF (-1) /* end-of-file offset */ #endif /* __APPLE_API_UNSTABLE */ #endif /* !_SYS_ATTR_H_ */
andrewrk/zig
lib/libc/include/x86_64-macos.10-gnu/sys/attr.h
C
mit
25,045
/* * deferred.js * * Copyright 2011, HeavyLifters Network Ltd. All rights reserved. */ ;(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._suppressAlreadyCalled = false } if (typeof Object.defineProperty === 'function') { var _consumeThrownExceptions = true Object.defineProperty(Deferred, 'consumeThrownExceptions', { enumerable: false, set: function(v) { _consumeThrownExceptions = v }, get: function() { return _consumeThrownExceptions } }) } else { Deferred.consumeThrownExceptions = true } Deferred.prototype.cancel = function() { if (!this.called) { if (typeof this._canceller === 'function') { this._canceller(this) } else { this._suppressAlreadyCalled = 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._suppressAlreadyCalled) { d._suppressAlreadyCalled = 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.consumeThrownExceptions) { 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._cancelDeferredsWhenCancelled = opts.cancelDeferredsWhenCancelled if (this._length === 0 && !this._fireOnFirstResult) { this.resolve(this._results) } for (var i = 0, n = this._length; i < n; ++i) { ds[i].both(deferredListCallback(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.cancelDeferredsWhenCancelled = function() { this._cancelDeferredsWhenCancelled = true } var _deferredCancel = Deferred.prototype.cancel DeferredList.prototype.cancel = function() { _deferredCancel.call(this) if (this._cancelDeferredsWhenCancelled) { for (var i = 0; i < this._length; ++i) { this._deferreds[i].cancel() } } } function deferredListCallback(d, i) { return function(result) { var isErr = result instanceof Failure , myResult = (isErr && d._consumeErrors) ? null : result // Support nesting if (result instanceof Deferred) { result.both(deferredListCallback(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 } } }())
heavylifters/deferred-js
lib/deferred.js
JavaScript
mit
8,895
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // 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 = () => ((PerfectModTestPlayer)Player).CheckFailed(shouldMiss && testData.FailOnMiss) }); protected override TestPlayer CreateModPlayer(Ruleset ruleset) => new PerfectModTestPlayer(); private class PerfectModTestPlayer : TestPlayer { public PerfectModTestPlayer() : 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; } } } }
2yangk23/osu
osu.Game/Tests/Visual/ModPerfectTestScene.cs
C#
mit
2,076
/***************************************************************************/ /* */ /* pshinter.c */ /* */ /* FreeType PostScript Hinting module */ /* */ /* Copyright 2001-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #define FT_MAKE_OPTION_SINGLE_OBJECT #include <ft2build.h> #include "pshpic.c" #include "pshrec.c" #include "pshglob.c" #include "pshalgo.c" #include "pshmod.c" /* END */
yapingxin/saturn-gui-lib-workshop
Lib/FreeType/freetype-2.6.2/src/pshinter/pshinter.c
C
mit
1,453
'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" // https://developers.google.com/identity/protocols/OAuth2InstalledApp billingOrigin: utils.envOverride('FIREBASE_BILLING_URL', 'https://cloudbilling.googleapis.com'), clientId: utils.envOverride('FIREBASE_CLIENT_ID', '563584335869-fgrhgmd47bqnekij5i8b5pr03ho849e6.apps.googleusercontent.com'), clientSecret: utils.envOverride('FIREBASE_CLIENT_SECRET', 'j9iVZfS8kkCEFUPaAeJV0sAi'), cloudloggingOrigin: utils.envOverride('FIREBASE_CLOUDLOGGING_URL', 'https://logging.googleapis.com'), adminOrigin: utils.envOverride('FIREBASE_ADMIN_URL', 'https://admin.firebase.com'), apikeysOrigin: utils.envOverride('FIREBASE_APIKEYS_URL', 'https://apikeys.googleapis.com'), appengineOrigin: utils.envOverride('FIREBASE_APPENGINE_URL', 'https://appengine.googleapis.com'), authOrigin: utils.envOverride('FIREBASE_AUTH_URL', 'https://accounts.google.com'), consoleOrigin: utils.envOverride('FIREBASE_CONSOLE_URL', 'https://console.firebase.google.com'), deployOrigin: utils.envOverride('FIREBASE_DEPLOY_URL', utils.envOverride('FIREBASE_UPLOAD_URL', 'https://deploy.firebase.com')), functionsOrigin: utils.envOverride('FIREBASE_FUNCTIONS_URL', 'https://cloudfunctions.googleapis.com'), googleOrigin: utils.envOverride('FIREBASE_TOKEN_URL', utils.envOverride('FIREBASE_GOOGLE_URL', 'https://www.googleapis.com')), hostingOrigin: utils.envOverride('FIREBASE_HOSTING_URL', 'https://firebaseapp.com'), realtimeOrigin: utils.envOverride('FIREBASE_REALTIME_URL', 'https://firebaseio.com'), rulesOrigin: utils.envOverride('FIREBASE_RULES_URL', 'https://firebaserules.googleapis.com'), runtimeconfigOrigin: utils.envOverride('FIREBASE_RUNTIMECONFIG_URL', 'https://runtimeconfig.googleapis.com'), setToken: function(token) { refreshToken = token; }, setScopes: function(s) { commandScopes = _.uniq(_.flatten([ scopes.EMAIL, scopes.OPENID, scopes.CLOUD_PROJECTS_READONLY, 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;
CharlesSanford/personal-site
node_modules/firebase-tools/lib/api.js
JavaScript
mit
6,556
/**! * urllib - test/fixtures/server.js * * Copyright(c) 2011 - 2014 fengmk2 and other contributors. * MIT Licensed * * Authors: * fengmk2 <[email protected]> (http://fengmk2.github.com) */ "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 === '/redirect_no_location') { 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('X-Request-Content-Type', 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;
pmq20/urllib
test/fixtures/server.js
JavaScript
mit
5,950
/* 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; }
anishacharya/Codility-Challenges
FrogJump.cpp
C++
mit
751
// Type definitions for @ag-grid-community/core v25.0.1 // Project: http://www.ag-grid.com/ // Definitions by: Niall Crosby <https://github.com/ag-grid/> export declare function convertToSet<T>(list: T[]): Set<T>;
ceolter/angular-grid
community-modules/core/dist/es6/utils/set.d.ts
TypeScript
mit
214
package com.dubture.twig.core.model; public interface IFunction extends ITwigCallable { }
gencer/Twig-Eclipse-Plugin
com.dubture.twig.core/src/com/dubture/twig/core/model/IFunction.java
Java
mit
91
#!/usr/bin/env python # # GrovePi Example for using the Grove Slide Potentiometer (http://www.seeedstudio.com/wiki/Grove_-_Slide_Potentiometer) # # The GrovePi connects the Raspberry Pi and Grove sensors. You can learn more about GrovePi here: http://www.dexterindustries.com/GrovePi # # Have a question about this example? Ask on the forums here: http://forum.dexterindustries.com/c/grovepi # ''' ## License The MIT License (MIT) GrovePi for the Raspberry Pi: an open source platform for connecting Grove Sensors to the Raspberry Pi. Copyright (C) 2015 Dexter Industries Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ''' import time import grovepi # Connect the Grove Slide Potentiometer to analog port A0 # OUT,LED,VCC,GND slide = 0 # pin 1 (yellow wire) # The device has an onboard LED accessible as pin 2 on port A0 # OUT,LED,VCC,GND led = 1 # pin 2 (white wire) grovepi.pinMode(slide,"INPUT") grovepi.pinMode(led,"OUTPUT") time.sleep(1) while True: try: # Read sensor value from potentiometer sensor_value = grovepi.analogRead(slide) # Illuminate onboard LED if sensor_value > 500: grovepi.digitalWrite(led,1) else: grovepi.digitalWrite(led,0) print("sensor_value =", sensor_value) except IOError: print ("Error")
karan259/GrovePi
Software/Python/grove_slide_potentiometer.py
Python
mit
2,307
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"; } }
svgorbunov/Mariculture
src/main/java/maritech/nei/MTNEIConfig.java
Java
mit
676
# Aufgabe: `super` und `extends` einsetzen ## Lernziel Methoden unter Verwendung von `super` und `extends` gestalten, sodass sie flexibel auch mit Sub- bzw. Supertypen umgehen können. ## Umgebung * Eclipse ## Aufgabe In dieser Aufgabe sollen Sie die Klasse `Liste` aus der zweiten Aufgabe dieses Kapitels erweitern. D.h. Sie müssen Ihre Lösung zuerst in diese Aufgabe umkopieren, damit Sie eine funktionierende Liste haben. Fügen Sie zwei Methoden hinzu: * `fillFrom`: befüllt die Liste mit den Daten aus einer anderen (übergebene) Liste. * `copyInto`: kopiert die Daten der Liste in eine andere (übergebene) Liste. Verwenden Sie für Ihre Lösung `super` und `extends` zusammen mit Wildcards (`?`). Kommentieren Sie die Testmethode in den vorhandenen Tests ein und führen Sie diese danach aus. Versichern Sie sich, dass Ihre Implementierung korrekt funktioniert, bevor Sie die Lösung abgeben. ## Abgabe Aktivieren Sie Checkstyle für das Projekt (falls nicht bereits geschehen) und korrigieren Sie alle Fehlermeldungen bevor Sie das Ergebnis abgeben. Committen Sie Ihre Lösung und pushen Sie sie danach in Ihr Repository.
tpe-lecture/repo-27
08_generics/04_super_extends/readme.md
Markdown
mit
1,154
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 { /** Sprite, das durch das Bild läuft. */ 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(); } }
tpe-lecture/repo-27
06_ausnahmen/02_finally/src/tpe/exceptions/trycatchfinally/GameBoard.java
Java
mit
955
<?= form_open('', array("class"=>"form-horizontal", "id"=>"frm_menu")); ?> <div class="form-group <?= form_error('title') ? ' error' : ''; ?>"> <label for="title" class="control-label col-sm-2"><?= lang('menus_title'); ?></label> <div class="col-sm-4"> <input type="hidden" id="menuid" name="menuid" value="<?php echo set_value('menuid', isset($data->id) ? $data->id : ''); ?>"> <input type="hidden" id="type" name="type" value="<?= isset($type) ? $type : 'add' ?>"> <input id="title" type="text" name="title" class="form-control" maxlength="100" value="<?php echo set_value('title', isset($data->title) ? $data->title : ''); ?>" /> </div> <div class="col-sm-10 col-sm-offset-2"> <span class="help-inline"><?php echo form_error('title'); ?></span> </div> </div> <div class="form-group <?= form_error('link') ? ' error' : ''; ?>"> <label for="link" class="control-label col-sm-2"><?= lang('menus_link'); ?></label> <div class="col-sm-4"> <input id="link" type="text" name="link" class="form-control" maxlength="255" value="<?php echo set_value('link', isset($data->link) ? $data->link : ''); ?>" /> </div> <div class="col-sm-10 col-sm-offset-2"> <span class="help-inline"><?php echo form_error('link'); ?></span> </div> </div> <div class="form-group <?= form_error('icon') ? ' error' : ''; ?>"> <label for="icon" class="control-label col-sm-2"><?= lang('menus_icon'); ?></label> <div class="col-sm-4"> <input id="icon" type="text" name="icon" class="form-control" maxlength="255" value="<?php echo set_value('icon', isset($data->icon) ? $data->icon : ''); ?>" /> <span>e.g. "fa fa-angle-right"</span> </div> <div class="col-sm-10 col-sm-offset-2"> <span class="help-inline"><?php echo form_error('icon'); ?></span> </div> </div> <div class="form-group <?= form_error('target') ? ' error' : ''; ?>"> <label for="target" class="control-label col-sm-2"><?= lang('menus_target'); ?></label> <div class="col-sm-3"> <select id="target" name="target" class="form-control"> <option value="sametab" <?php echo set_select('target', 'sametab', isset($data->target) && $data->target=="sametab"); ?>>Same Tab</option> <option value="_blank" <?php echo set_select('target', '_blank', isset($data->target) && $data->target=="_blank"); ?>>New Tab</option> </select> </div> <div class="col-sm-10 col-sm-offset-2"> <span class="help-inline"><?php echo form_error('target'); ?></span> </div> </div> <div class="form-group <?= form_error('group_menu') ? ' error' : ''; ?>"> <label for="group_menu" class="control-label col-sm-2"><?= lang('menus_group'); ?></label> <div class="col-sm-3"> <select id="group_menu" name="group_menu" class="form-control"> <?php foreach ($group_menus as $key => $gr) : ?> <option value="<?= $gr->id; ?>" <?= set_select('group_menu', $gr->id, isset($data->group_menu) && $data->group_menu == $gr->id) ?>><?= $gr->group_name ?></option> <?php endforeach; ?> </select> </div> <div class="col-sm-10 col-sm-offset-2"> <span class="help-inline"><?php echo form_error('group_menu'); ?></span> </div> </div> <div class="form-group <?= form_error('parent_id') ? ' error' : ''; ?>"> <label for="parent_id" class="control-label col-sm-2"><?= lang('menus_parent'); ?></label> <div class="col-sm-4"> <select id="parent_id" name="parent_id" class="form-control"> <option value="0">This is parent menu</option> <?php foreach ($parents as $key => $parent) : ?> <option value="<?= $parent->id; ?>" <?= set_select('parent_id', $parent->id, isset($data->parent_id) && $data->parent_id == $parent->id) ?>><?= $parent->title ?></option> <?php endforeach; ?> </select> </div> <div class="col-sm-10 col-sm-offset-2"> <span class="help-inline"><?php echo form_error('parent_id'); ?></span> </div> </div> <div class="form-group <?= form_error('permission_id') ? ' error' : ''; ?>"> <label for="permission_id" class="control-label col-sm-2"><?= lang('menus_permissions'); ?></label> <div class="col-sm-4"> <select id="permission_id" name="permission_id" class="form-control"> <?php foreach ($permissions as $key => $permission) : ?> <option value="<?= $permission->id_permission; ?>" <?= set_select('permission_id', $permission->id_permission, isset($data->permission_id) && $data->permission_id == $permission->id_permission) ?>><?= $permission->nm_permission ?></option> <?php endforeach; ?> </select> </div> <div class="col-sm-10 col-sm-offset-2"> <span class="help-inline"><?php echo form_error('permission_id'); ?></span> </div> </div> <div class="form-group "> <label for="status" class="control-label col-sm-2"><?php echo lang('menus_status'); ?></label> <div class="col-sm-2"> <select name="status" id="status" class="form-control"> <option value="1" <?php echo set_select('status', '1', isset($data->status) && $data->status == 1); ?>><?php echo lang('menus_active'); ?></option> <option value="0" <?php echo set_select('status', '0', isset($data->status) && $data->status == 0); ?>><?php echo lang('menus_inactive'); ?></option> </select> </div> </div> <div class="form-group" style="margin-bottom: 5px;"> <div class="col-sm-offset-2 col-sm-6"> <input type="button" name="save" onclick="save_menu()" class="btn btn-primary btn-flat" value="<?php echo lang('menus_save'); ?>" /> <?php echo lang('menus_or').' ' . "<input type='button' name='btn_cancel' class='btn btn-danger btn-flat' onclick='cancel()' value='".lang('menus_cancel')."' />"; ?> <div id='alert_edit' class='alert-success text-center col-md-5 pull-right' style="padding: 5px;display: none;">Menu saved</div> </div> </div> <?= form_close();?> <script type="text/javascript"> $().ready(function(){ var ns = $('ol.sortable').nestedSortable({ forcePlaceholderSize: true, handle: 'div', helper: 'clone', items: 'li', opacity: .6, placeholder: 'placeholder', revert: 250, tabSize: 20, tolerance: 'pointer', toleranceElement: '> div', maxLevels: 2, isTree: true, startCollapsed: false }); $('.disclose').on('click', function() { $(this).closest('li').toggleClass('mjs-nestedSortable-collapsed').toggleClass('mjs-nestedSortable-expanded'); $(this).toggleClass('ui-icon-plusthick').toggleClass('ui-icon-minusthick'); }); $("#title").focus(); }); //Edit Menu function editmenu(idmenu){ if(idmenu!=""){ var url = 'menus/edit/'+idmenu; $("#frm_menu_head").html("Edit Menu"); $("#form-area").load(siteurl+url); $("#title").focus(); } } function save_order_menu(){ var formdata = $('ol.sortable').nestedSortable('serialize'); token_hash = $("#frm_menu_order [name='ci_csrf_token']").val(); formdata = formdata+'&ci_csrf_token='+token_hash; $.ajax({ url : siteurl+"menus/save_order", data : formdata, dataType : "json", type : "post", success: function(msg){ if(msg['save']==1){ $("#frm_menu_order [name='ci_csrf_token']").val(msg['token']); $("#alert_save").html("Menu order saved"); $("#alert_save").removeClass("alert-danger"); $("#alert_save").removeClass("alert-success"); $("#alert_save").addClass("alert-success"); $("#alert_save").show(); setTimeout(function(){ $("#alert_save").hide(); window.location.reload(); },2000); }else{ $("#frm_menu_order [name='ci_csrf_token']").val(msg['token']); $("#alert_save").html("Menu saving failed"); $("#alert_save").removeClass("alert-danger"); $("#alert_save").removeClass("alert-success"); $("#alert_save").addClass("alert-danger"); $("#alert_save").show(); setTimeout(function(){ $("#alert_save").hide(); },2000); } } }); } //Cancel Edit or Add function cancel(){ $("#menuid").val(""); $("#type").val("add"); $("#title").val(""); $("#link").val(""); $("#icon").val(""); $("#taget").val("sametab"); $("#group_menu").val($("#group_menu option:first").val()); $("#parent_id").val(0); $("#parent_id").prop("disabled",false); $("#permission_id").val($("#permission_id option:first").val()); $("#taget").val(1); $("#frm_menu_head").html("Add New Menu"); } //Save Menu function save_menu(){ var title = $("#title").val().trim(); var formdata = $("#frm_menu").serialize(); if(title!=""){ $.ajax({ url : siteurl+"menus/save_menus_ajax", data : formdata, dataType : "json", type : "post", success: function(msg){ if(msg['save']==1){ $("#frm_menu [name='ci_csrf_token']").val(msg['token']); $("#alert_edit").html("Menu saved"); $("#alert_edit").removeClass("alert-danger"); $("#alert_edit").removeClass("alert-success"); $("#alert_edit").addClass("alert-success"); $("#alert_edit").show(); setTimeout(function(){ $("#alert_edit").hide(); window.location.reload(); //reset form cancel(); },2000); }else{ $("#frm_menu [name='ci_csrf_token']").val(msg['token']); $("#alert_edit").html("Menu saving failed"); $("#alert_edit").removeClass("alert-danger"); $("#alert_edit").removeClass("alert-success"); $("#alert_edit").addClass("alert-danger"); $("#alert_edit").show(); setTimeout(function(){ $("#alert_edit").hide(); },2000); } } }); }else{ $("#alert_edit").html("Title must be filled"); $("#alert_edit").removeClass("alert-danger"); $("#alert_edit").removeClass("alert-success"); $("#alert_edit").addClass("alert-danger"); $("#alert_edit").show(); setTimeout(function(){ $("#alert_edit").hide(); },2000); } } //Delete Menu function delete_menu(id){ var idmenu = id; var token_hash = $("#frm_menu_order [name='ci_csrf_token']").val(); var conf = confirm("Are you sure you want to delete this menu ?"); if(idmenu!=="") { if(conf){ $.ajax({ url : siteurl+"menus/delete", data : ({id: idmenu, ci_csrf_token: token_hash}), type : "post", dataType : "json", success : function(msg){ if(msg['delete']==1) { $("#frm_menu_order [name='ci_csrf_token']").val(msg['token']); $("#alert_save").html("Menu deleted"); $("#alert_save").removeClass("alert-danger"); $("#alert_save").removeClass("alert-success"); $("#alert_save").addClass("alert-success"); $("#alert_save").show(); setTimeout(function(){ $("#alert_save").hide(); window.location.reload(); },2000); }else if(msg['delete']==2){ $("#frm_menu_order [name='ci_csrf_token']").val(msg['token']); $("#alert_save").html("Delete child first"); $("#alert_save").removeClass("alert-danger"); $("#alert_save").removeClass("alert-success"); $("#alert_save").addClass("alert-danger"); $("#alert_save").show(); setTimeout(function(){ $("#alert_save").hide(); },2000); }else{ $("#frm_menu_order [name='ci_csrf_token']").val(msg['token']); $("#alert_save").html("Deletion failed"); $("#alert_save").removeClass("alert-danger"); $("#alert_save").removeClass("alert-success"); $("#alert_save").addClass("alert-danger"); $("#alert_save").show(); setTimeout(function(){ $("#alert_save").hide(); },2000); } } }); } } } </script>
suwitolt/ci3-adminlte-hmvc
application/modules/menus/views/menus_form.php
PHP
mit
14,064
/** * @license Highcharts JS v8.2.2 (2020-10-22) * @module highcharts/modules/funnel3d * @requires highcharts * @requires highcharts/highcharts-3d * @requires highcharts/modules/cylinder * * Highcharts funnel module * * (c) 2010-2019 Kacper Madej * * License: www.highcharts.com/license */ 'use strict'; import '../../Series/Funnel3DSeries.js';
cdnjs/cdnjs
ajax/libs/highcharts/8.2.2/es-modules/masters/modules/funnel3d.src.js
JavaScript
mit
357
#!/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 packages. # 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 opportunistically-encrypted 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 # pass through without being greylisted. So please note [dnswl's license terms](https://www.dnswl.org/?page_id=9): # > Every user with more than 100’000 queries per day on the public nameserver # > 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 # ### Basic Settings # 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 \ maximal_queue_lifetime=2d \ bounce_queue_lifetime=1d # ### Outgoing Mail # Enable the 'submission' port 587 smtpd server and tweak its settings. # # * Do not add the OpenDMAC Authentication-Results 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. # * Require the best ciphers for incoming connections per http://baldric.net/2013/12/07/tls-ciphers-in-postfix-and-dovecot/. # 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 smtpd_tls_security_level=encrypt -o smtpd_tls_ciphers=high -o smtpd_tls_exclude_ciphers=aNULL,DES,3DES,MD5,DES+MD5,RC4 -o smtpd_tls_mandatory_protocols=!SSLv2,!SSLv3 -o cleanup_service_name=authclean" \ "authclean=unix n - - - 0 cleanup -o header_checks=pcre:/etc/postfix/outgoing_mail_header_filters" # Install the `outgoing_mail_header_filters` file required by the new 'authclean' service. cp conf/postfix_outgoing_mail_header_filters /etc/postfix/outgoing_mail_header_filters # Modify the `outgoing_mail_header_filters` 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/outgoing_mail_header_filters sed -i "s/PUBLIC_IP/$PUBLIC_IP/" /etc/postfix/outgoing_mail_header_filters # 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 \ smtpd_tls_security_level=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 \ smtpd_tls_dh1024_param_file=$STORAGE_ROOT/ssl/dh2048.pem \ smtpd_tls_protocols=\!SSLv2,\!SSLv3 \ smtpd_tls_ciphers=medium \ smtpd_tls_exclude_ciphers=aNULL,RC4 \ smtpd_tls_received_header=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: # # * `permit_sasl_authenticated`: Authenticated users (i.e. on port 587). # * `permit_mynetworks`: Mail that originates locally. # * `reject_unauth_destination`: No one else. (Permits mail whose destination is local and rejects other mail.) tools/editconf.py /etc/postfix/main.cf \ smtpd_relay_restrictions=permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination # ### DANE # 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 `smtp_dns_support_level=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 \ smtp_tls_mandatory_protocols=\!SSLv2,\!SSLv3 \ smtp_tls_ciphers=medium \ smtp_tls_exclude_ciphers=aNULL,RC4 \ smtp_tls_security_level=dane \ smtp_dns_support_level=dnssec \ smtp_tls_CAfile=/etc/ssl/certs/ca-certificates.crt \ smtp_tls_loglevel=2 # ### Incoming Mail # 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. # # * `reject_non_fqdn_sender`: Reject not-nice-looking return paths. # * `reject_unknown_sender_domain`: Reject return paths with invalid domains. # * `reject_authenticated_sender_login_mismatch`: Reject if mail FROM address does not match the client SASL login # * `reject_rhsbl_sender`: Reject return paths that use blacklisted domains. # * `permit_sasl_authenticated`: 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 # * `reject_unlisted_recipient`: Although Postfix will reject mail to unknown recipients, it's nicer to reject such mail ahead of greylisting rather than after. # * `check_policy_service`: 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 \ smtpd_sender_restrictions="reject_non_fqdn_sender,reject_unknown_sender_domain,reject_authenticated_sender_login_mismatch,reject_rhsbl_sender dbl.spamhaus.org" \ smtpd_recipient_restrictions=permit_sasl_authenticated,permit_mynetworks,"reject_rbl_client zen.spamhaus.org",reject_unlisted_recipient,"check_policy_service 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
nstanke/mailinabox
setup/mail-postfix.sh
Shell
cc0-1.0
11,611
<!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>
dongnan-cn/electron-pm
release-builds/AKKA Project Management Tool-win32-ia32/resources/app.asar.unpacked/lib/dhtmlxGrid/samples/dhtmlxCombo/07_events/03_onchange_onselectionchange.html
HTML
cc0-1.0
1,490
#pragma once #include "AudioData.h" #include <string> //2D indexing: column-major order, 0-based: #define IDX2D(row, column) (((column) * rows) + (row)) class ImageToSoundscapeConverter { 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 acoustical_size_of_head_m; 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> waveformCacheLeftChannel; std::vector<float> waveformCacheRightChannel; AudioData audioData; float rnd(void); void initWaveformCacheStereo(); void processMono(const std::vector<float> &image); void processStereo(const std::vector<float> &image); public: ImageToSoundscapeConverter(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 acoustical_size_of_head_m = 0.20); void Process(const std::vector<float> &image); AudioData& GetAudioData() { return audioData; } };
aftersight/After-Sight-Model-1
raspivoice_standalone/ImageToSoundscape.h
C
cc0-1.0
1,470
--- title: "Proporción de mujeres en edad de procrear (de 15 a 49 años) que practican la planificación familiar con métodos modernos" lang: es permalink: /es/3-7-1/ sdg_goal: 3 layout: indicator indicator: "3.7.1" target_id: "3.7" ---
CroatianBureauOfStatistics/sdg-indicators
_indicators/es/3-7-1.md
Markdown
cc0-1.0
240
/* * Copyright 2012 Red Hat, Inc. and/or its affiliates. * * Licensed under the Eclipse Public License version 1.0, available at * http://www.eclipse.org/legal/epl-v10.html */ 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.AddonDependencyEntry; import org.jboss.forge.furnace.repositories.MutableAddonRepository; 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 PreShutdownEventTest { @Deployment(order = 2) public static AddonArchive getDeployment() { AddonArchive archive = ShrinkWrap.create(AddonArchive.class) .addAsAddonDependencies( AddonDependencyEntry.create("dep1") ); archive.addAsLocalServices(PreShutdownEventTest.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(RecordingEventManager.class) .addAsLocalServices(RecordingEventManager.class); return archive; } @Test(timeout = 5000) public void testPreShutdownIsCalled() throws Exception { Furnace furnace = LocalServices.getFurnace(getClass().getClassLoader()); AddonRegistry registry = furnace.getAddonRegistry(); Addon dep2 = registry.getAddon(AddonId.from("dep2", "2")); RecordingEventManager manager = registry.getServices(RecordingEventManager.class).get(); Assert.assertEquals(3, manager.getPostStartupCount()); MutableAddonRepository repository = (MutableAddonRepository) furnace.getRepositories().get(0); repository.disable(dep2.getId()); Addons.waitUntilStopped(dep2); Assert.assertEquals(1, manager.getPreShutdownCount()); } }
pplatek/furnace
container-tests/src/test/java/test/org/jboss/forge/furnace/lifecycle/PreShutdownEventTest.java
Java
epl-1.0
2,843
/** * Copyright (c) 2014-2015 openHAB UG (haftungsbeschraenkt) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html */ 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.ItemChannelLinkRegistry; 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(ItemChannelLinkResource.PATH_LINKS) @Api(value = ItemChannelLinkResource.PATH_LINKS) public class ItemChannelLinkResource implements RESTResource { /** The URI path to this resource */ public static final String PATH_LINKS = "links"; private ItemChannelLinkRegistry itemChannelLinkRegistry; 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 = itemChannelLinkRegistry.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) { itemChannelLinkRegistry.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 (itemChannelLinkRegistry.get(linkId) == null) { String message = "Link " + linkId + " does not exist!"; return JSONResponse.createResponse(Status.NOT_FOUND, null, message); } ItemChannelLink result = itemChannelLinkRegistry .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 unsetThingLinkManager(ThingLinkManager thingLinkManager) { this.thingLinkManager = null; } protected void setItemChannelLinkRegistry(ItemChannelLinkRegistry itemChannelLinkRegistry) { this.itemChannelLinkRegistry = itemChannelLinkRegistry; } protected void unsetItemChannelLinkRegistry(ItemChannelLinkRegistry itemChannelLinkRegistry) { this.itemChannelLinkRegistry = 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; } }
marinmitev/smarthome
bundles/io/org.eclipse.smarthome.io.rest.core/src/main/java/org/eclipse/smarthome/io/rest/core/link/ItemChannelLinkResource.java
Java
epl-1.0
5,631
/******************************************************************************* * Copyright (c) 2017, 2021 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ 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.LibertyOPRepeatActions; 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.LibertyServerWrapper; @RunWith(FATRunner.class) @LibertyServerWrapper @Mode(TestMode.FULL) public class LibertyOP_BasicTests_oauth_usingSocialConfig extends Social_BasicTests { public static Class<?> thisClass = LibertyOP_BasicTests_oauth_usingSocialConfig.class; public static RSCommonTestTools rsTools = new RSCommonTestTools(); @ClassRule public static RepeatTests r = RepeatTests.with(LibertyOPRepeatActions.usingUserInfo()).andWith(LibertyOPRepeatActions.usingIntrospect()); @BeforeClass public static void setUp() throws Exception { classOverrideValidationEndpointValue = FATSuite.UserApiEndpoint; List<String> startMsgs = new ArrayList<String>(); startMsgs.add("CWWKT0016I.*" + SocialConstants.SOCIAL_DEFAULT_CONTEXT_ROOT); List<String> extraApps = new ArrayList<String>(); extraApps.add(SocialConstants.HELLOWORLD_SERVLET); // TODO fix List<String> opStartMsgs = new ArrayList<String>(); // opStartMsgs.add("CWWKS1600I.*" + SocialConstants.OIDCCONFIGMEDIATOR_APP); opStartMsgs.add("CWWKS1631I.*"); // TODO fix List<String> opExtraApps = new ArrayList<String>(); opExtraApps.add(SocialConstants.OP_SAMPLE_APP); String[] propagationTokenTypes = rsTools.chooseTokenSettings(SocialConstants.OIDC_OP); String tokenType = propagationTokenTypes[0]; String certType = propagationTokenTypes[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", "server_LibertyOP_basicTests_oauth_usingSocialConfig.xml", SocialConstants.GENERIC_SERVER, extraApps, SocialConstants.DO_NOT_USE_DERBY, startMsgs); setActionsForProvider(SocialConstants.LIBERTYOP_PROVIDER, SocialConstants.OAUTH_OP); setGenericVSSpeicificProviderFlags(GenericConfig, "server_LibertyOP_basicTests_oauth_usingSocialConfig"); socialSettings = updateLibertyOPSettings(socialSettings); } }
OpenLiberty/open-liberty
dev/com.ibm.ws.security.social_fat.commonTest.LibertyOP/fat/src/com/ibm/ws/security/social/fat/LibertyOP/LibertyOP_BasicTests_oauth_usingSocialConfig.java
Java
epl-1.0
3,772
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vIBM 2.2.3-11/28/2011 06:21 AM(foreman)- // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2014.06.11 at 05:49:00 PM EDT // package com.ibm.jbatch.jsl.model.v2; import javax.annotation.Generated; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for Batchlet complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="Batchlet"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="properties" type="{https://jakarta.ee/xml/ns/jakartaee}Properties" minOccurs="0"/> * &lt;/sequence> * &lt;attribute name="ref" use="required" type="{https://jakarta.ee/xml/ns/jakartaee}artifactRef" /> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Batchlet", propOrder = { "properties" }) @Generated(value = "com.ibm.jtc.jax.tools.xjc.Driver", date = "2014-06-11T05:49:00-04:00", comments = "JAXB RI v2.2.3-11/28/2011 06:21 AM(foreman)-") public class Batchlet extends com.ibm.jbatch.jsl.model.Batchlet { @Generated(value = "com.ibm.jtc.jax.tools.xjc.Driver", date = "2014-06-11T05:49:00-04:00", comments = "JAXB RI v2.2.3-11/28/2011 06:21 AM(foreman)-") protected JSLProperties properties; @XmlAttribute(name = "ref", required = true) @Generated(value = "com.ibm.jtc.jax.tools.xjc.Driver", date = "2014-06-11T05:49:00-04:00", comments = "JAXB RI v2.2.3-11/28/2011 06:21 AM(foreman)-") protected String ref; /** {@inheritDoc} */ @Override @Generated(value = "com.ibm.jtc.jax.tools.xjc.Driver", date = "2014-06-11T05:49:00-04:00", comments = "JAXB RI v2.2.3-11/28/2011 06:21 AM(foreman)-") public JSLProperties getProperties() { return properties; } /** {@inheritDoc} */ @Override @Generated(value = "com.ibm.jtc.jax.tools.xjc.Driver", date = "2014-06-11T05:49:00-04:00", comments = "JAXB RI v2.2.3-11/28/2011 06:21 AM(foreman)-") public void setProperties(com.ibm.jbatch.jsl.model.JSLProperties value) { this.properties = (JSLProperties) value; } /** {@inheritDoc} */ @Override @Generated(value = "com.ibm.jtc.jax.tools.xjc.Driver", date = "2014-06-11T05:49:00-04:00", comments = "JAXB RI v2.2.3-11/28/2011 06:21 AM(foreman)-") public String getRef() { return ref; } /** {@inheritDoc} */ @Override @Generated(value = "com.ibm.jtc.jax.tools.xjc.Driver", date = "2014-06-11T05:49:00-04:00", comments = "JAXB RI v2.2.3-11/28/2011 06:21 AM(foreman)-") public void setRef(String value) { this.ref = value; } /** * Copyright 2013 International Business Machines Corp. * * See the NOTICE file distributed with this work for additional information * regarding copyright ownership. Licensed under the Apache License, * Version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * Appended by build tooling. */ @Override public String toString() { StringBuilder buf = new StringBuilder(100); buf.append("Batchlet: ref=" + ref); buf.append("\n"); buf.append("Properties = " + com.ibm.jbatch.jsl.model.helper.PropertiesToStringHelper.getString(properties)); return buf.toString(); } }
OpenLiberty/open-liberty
dev/com.ibm.jbatch.jsl.model/src/com/ibm/jbatch/jsl/model/v2/Batchlet.java
Java
epl-1.0
4,330
/* * Copyright (c) 2012-2017 Red Hat, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Red Hat, Inc. - initial API and implementation */ 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.HttpServletRequestWrapper; 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.RequestTokenExtractor; 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 ([email protected]) */ @Singleton public class MachineLoginFilter implements Filter { @Inject private RequestTokenExtractor tokenExtractor; @Inject private MachineTokenRegistry machineTokenRegistry; @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 = machineTokenRegistry.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 HttpServletRequestWrapper(httpRequest) { @Override public String getRemoteUser() { return subject.getUserName(); } @Override public Principal getUserPrincipal() { return subject::getUserName; } }; } @Override public void destroy() {} }
TypeFox/che
multiuser/machine-auth/che-multiuser-machine-authentication/src/main/java/org/eclipse/che/multiuser/machine/authentication/server/MachineLoginFilter.java
Java
epl-1.0
3,592
/******************************************************************************* * Copyright (c) 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ 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; } }
OpenLiberty/open-liberty
dev/com.ibm.ws.cdi.jee_fat/test-applications/resourceWebServicesProvider.war/src/com/ibm/ws/cdi/services/impl/MyPojoUser.java
Java
epl-1.0
840
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package javax.faces; import java.lang.reflect.Method; import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.logging.Level; import java.util.logging.Logger; import javax.faces.context.ExternalContext; /** * Provide utility methods used by FactoryFinder class to lookup for SPI interface FactoryFinderProvider. * * @since 2.0.5 */ class _FactoryFinderProviderFactory { public static final String FACTORY_FINDER_PROVIDER_FACTORY_CLASS_NAME = "org.apache.myfaces.spi" + ".FactoryFinderProviderFactory"; public static final String FACTORY_FINDER_PROVIDER_CLASS_NAME = "org.apache.myfaces.spi.FactoryFinderProvider"; public static final String INJECTION_PROVIDER_FACTORY_CLASS_NAME = "org.apache.myfaces.spi.InjectionProviderFactory"; // INJECTION_PROVIDER_CLASS_NAME to provide use of new Injection Provider methods which take a // a class as an input. This is required for CDI 1.2, particularly in regard to constructor injection/ public static final String INJECTION_PROVIDER_CLASS_NAME = "com.ibm.ws.jsf.spi.WASInjectionProvider"; // MANAGED_OBJECT_CLASS_NAME added for CDI 1.2 support. Because CDI now creates the class, inject needs // to return two objects : the instance of the required class and the creational context. To do this // an Managed object is returned from which both of the required objects can be obtained. public static final String MANAGED_OBJECT_CLASS_NAME = "com.ibm.ws.managedobject.ManagedObject"; public static final Class<?> FACTORY_FINDER_PROVIDER_FACTORY_CLASS; public static final Method FACTORY_FINDER_PROVIDER_GET_INSTANCE_METHOD; public static final Method FACTORY_FINDER_PROVIDER_FACTORY_GET_FACTORY_FINDER_METHOD; public static final Class<?> FACTORY_FINDER_PROVIDER_CLASS; public static final Method FACTORY_FINDER_PROVIDER_GET_FACTORY_METHOD; public static final Method FACTORY_FINDER_PROVIDER_SET_FACTORY_METHOD; public static final Method FACTORY_FINDER_PROVIDER_RELEASE_FACTORIES_METHOD; public static final Class<?> INJECTION_PROVIDER_FACTORY_CLASS; public static final Method INJECTION_PROVIDER_FACTORY_GET_INSTANCE_METHOD; public static final Method INJECTION_PROVIDER_FACTORY_GET_INJECTION_PROVIDER_METHOD; public static final Class<?> INJECTION_PROVIDER_CLASS; public static final Method INJECTION_PROVIDER_INJECT_OBJECT_METHOD; public static final Method INJECTION_PROVIDER_INJECT_CLASS_METHOD; public static final Method INJECTION_PROVIDER_POST_CONSTRUCT_METHOD; public static final Method INJECTION_PROVIDER_PRE_DESTROY_METHOD; // New for CDI 1.2 public static final Class<?> MANAGED_OBJECT_CLASS; public static final Method MANAGED_OBJECT_GET_OBJECT_METHOD; public static final Method MANAGED_OBJECT_GET_CONTEXT_DATA_METHOD; static { Class factoryFinderFactoryClass = null; Method factoryFinderproviderFactoryGetMethod = null; Method factoryFinderproviderFactoryGetFactoryFinderMethod = null; Class<?> factoryFinderProviderClass = null; Method factoryFinderProviderGetFactoryMethod = null; Method factoryFinderProviderSetFactoryMethod = null; Method factoryFinderProviderReleaseFactoriesMethod = null; Class injectionProviderFactoryClass = null; Method injectionProviderFactoryGetInstanceMethod = null; Method injectionProviderFactoryGetInjectionProviderMethod = null; Class injectionProviderClass = null; Method injectionProviderInjectObjectMethod = null; Method injectionProviderInjectClassMethod = null; Method injectionProviderPostConstructMethod = null; Method injectionProviderPreDestroyMethod = null; Class managedObjectClass = null; Method managedObjectGetObjectMethod = null; Method managedObjectGetContextDataMethod = null; try { factoryFinderFactoryClass = classForName(FACTORY_FINDER_PROVIDER_FACTORY_CLASS_NAME); if (factoryFinderFactoryClass != null) { factoryFinderproviderFactoryGetMethod = factoryFinderFactoryClass.getMethod ("getInstance", null); factoryFinderproviderFactoryGetFactoryFinderMethod = factoryFinderFactoryClass .getMethod("getFactoryFinderProvider", null); } factoryFinderProviderClass = classForName(FACTORY_FINDER_PROVIDER_CLASS_NAME); if (factoryFinderProviderClass != null) { factoryFinderProviderGetFactoryMethod = factoryFinderProviderClass.getMethod("getFactory", new Class[]{String.class}); factoryFinderProviderSetFactoryMethod = factoryFinderProviderClass.getMethod("setFactory", new Class[]{String.class, String.class}); factoryFinderProviderReleaseFactoriesMethod = factoryFinderProviderClass.getMethod ("releaseFactories", null); } injectionProviderFactoryClass = classForName(INJECTION_PROVIDER_FACTORY_CLASS_NAME); if (injectionProviderFactoryClass != null) { injectionProviderFactoryGetInstanceMethod = injectionProviderFactoryClass. getMethod("getInjectionProviderFactory", null); injectionProviderFactoryGetInjectionProviderMethod = injectionProviderFactoryClass. getMethod("getInjectionProvider", ExternalContext.class); } injectionProviderClass = classForName(INJECTION_PROVIDER_CLASS_NAME); if (injectionProviderClass != null) { injectionProviderInjectObjectMethod = injectionProviderClass. getMethod("inject", Object.class); injectionProviderInjectClassMethod = injectionProviderClass. getMethod("inject", Class.class); injectionProviderPostConstructMethod = injectionProviderClass. getMethod("postConstruct", Object.class, Object.class); injectionProviderPreDestroyMethod = injectionProviderClass. getMethod("preDestroy", Object.class, Object.class); } // get managed object and getObject and getContextData methods for CDI 1.2 support. // getObject() is used to the created object instance // getContextData(Class) is used to get the creational context managedObjectClass = classForName(MANAGED_OBJECT_CLASS_NAME); if (managedObjectClass != null) { managedObjectGetObjectMethod = managedObjectClass.getMethod("getObject", null); managedObjectGetContextDataMethod = managedObjectClass.getMethod("getContextData", Class.class); } } catch (Exception e) { // no op } FACTORY_FINDER_PROVIDER_FACTORY_CLASS = factoryFinderFactoryClass; FACTORY_FINDER_PROVIDER_GET_INSTANCE_METHOD = factoryFinderproviderFactoryGetMethod; FACTORY_FINDER_PROVIDER_FACTORY_GET_FACTORY_FINDER_METHOD = factoryFinderproviderFactoryGetFactoryFinderMethod; FACTORY_FINDER_PROVIDER_CLASS = factoryFinderProviderClass; FACTORY_FINDER_PROVIDER_GET_FACTORY_METHOD = factoryFinderProviderGetFactoryMethod; FACTORY_FINDER_PROVIDER_SET_FACTORY_METHOD = factoryFinderProviderSetFactoryMethod; FACTORY_FINDER_PROVIDER_RELEASE_FACTORIES_METHOD = factoryFinderProviderReleaseFactoriesMethod; INJECTION_PROVIDER_FACTORY_CLASS = injectionProviderFactoryClass; INJECTION_PROVIDER_FACTORY_GET_INSTANCE_METHOD = injectionProviderFactoryGetInstanceMethod; INJECTION_PROVIDER_FACTORY_GET_INJECTION_PROVIDER_METHOD = injectionProviderFactoryGetInjectionProviderMethod; INJECTION_PROVIDER_CLASS = injectionProviderClass; INJECTION_PROVIDER_INJECT_OBJECT_METHOD = injectionProviderInjectObjectMethod; INJECTION_PROVIDER_INJECT_CLASS_METHOD = injectionProviderInjectClassMethod; INJECTION_PROVIDER_POST_CONSTRUCT_METHOD = injectionProviderPostConstructMethod; INJECTION_PROVIDER_PRE_DESTROY_METHOD = injectionProviderPreDestroyMethod; MANAGED_OBJECT_CLASS = managedObjectClass; MANAGED_OBJECT_GET_OBJECT_METHOD = managedObjectGetObjectMethod; MANAGED_OBJECT_GET_CONTEXT_DATA_METHOD = managedObjectGetContextDataMethod; } public static Object getInstance() { if (FACTORY_FINDER_PROVIDER_GET_INSTANCE_METHOD != null) { try { return FACTORY_FINDER_PROVIDER_GET_INSTANCE_METHOD.invoke(FACTORY_FINDER_PROVIDER_FACTORY_CLASS, null); } catch (Exception e) { //No op Logger log = Logger.getLogger(_FactoryFinderProviderFactory.class.getName()); if (log.isLoggable(Level.WARNING)) { log.log(Level.WARNING, "Cannot retrieve current FactoryFinder instance from " + "FactoryFinderProviderFactory." + " Default strategy using thread context class loader will be used.", e); } } } return null; } // ~ Methods Copied from _ClassUtils // ------------------------------------------------------------------------------------ /** * Tries a Class.loadClass with the context class loader of the current thread first and automatically falls back * to * the ClassUtils class loader (i.e. the loader of the myfaces.jar lib) if necessary. * * @param type fully qualified name of a non-primitive non-array class * @return the corresponding Class * @throws NullPointerException if type is null * @throws ClassNotFoundException */ public static Class<?> classForName(String type) throws ClassNotFoundException { if (type == null) { throw new NullPointerException("type"); } try { // Try WebApp ClassLoader first return Class.forName(type, false, // do not initialize for faster startup getContextClassLoader()); } catch (ClassNotFoundException ignore) { // fallback: Try ClassLoader for ClassUtils (i.e. the myfaces.jar lib) return Class.forName(type, false, // do not initialize for faster startup _FactoryFinderProviderFactory.class.getClassLoader()); } } /** * Gets the ClassLoader associated with the current thread. Returns the class loader associated with the specified * default object if no context loader is associated with the current thread. * * @return ClassLoader */ protected static ClassLoader getContextClassLoader() { if (System.getSecurityManager() != null) { try { Object cl = AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws PrivilegedActionException { return Thread.currentThread().getContextClassLoader(); } }); return (ClassLoader) cl; } catch (PrivilegedActionException pae) { throw new FacesException(pae); } } else { return Thread.currentThread().getContextClassLoader(); } } }
OpenLiberty/open-liberty
dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/_FactoryFinderProviderFactory.java
Java
epl-1.0
12,732
/** * Copyright (c) 2010-2020 Contributors to the openHAB project * * See the NOTICE file(s) distributed with this work for additional * information. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0 * * SPDX-License-Identifier: EPL-2.0 */ 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.IncreaseDecreaseType; 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.RewindFastforwardType; 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 commandTransformation; 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(IncreaseDecreaseType.INCREASE, increaseValue); commandStringMap.put(IncreaseDecreaseType.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(RewindFastforwardType.REWIND, rewindValue); commandStringMap.put(RewindFastforwardType.FASTFORWARD, fastforwardValue); initialized = true; } private void addToMaps(@Nullable String value, State state) { if (value != null) { commandStringMap.put((Command) state, value); stringStateMap.put(value, state); } } }
openhab/openhab2
bundles/org.openhab.binding.http/src/main/java/org/openhab/binding/http/internal/config/HttpChannelConfig.java
Java
epl-1.0
4,709
/******************************************************************************* * Copyright (c) 2012 Max Hohenegger. * All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse * Public License v1.0 which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Max Hohenegger - initial implementation ******************************************************************************/ 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 { }
Treehopper/c0ffee_tips
eu.hohenegger.c0ffee_tips.tests/src/eu/hohenegger/c0ffee_tips/tests/AllTests.java
Java
epl-1.0
791
/* * Hibernate, Relational Persistence for Idiomatic Java * * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * indicated by the @author tags or express copyright attribution * statements applied by the authors. All third-party contributions are * distributed under license by Red Hat Middleware LLC. * * This copyrighted material is made available to anyone wishing to use, modify, * copy, or redistribute it subject to the terms and conditions of the GNU * Lesser General Public License, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this distribution; if not, write to: * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA * */ 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.DynamicFilterParameterSpecification; import org.hibernate.param.CollectionFilterKeyParameterSpecification; import org.hibernate.engine.JoinSequence; import org.hibernate.engine.SessionFactoryImplementor; import org.hibernate.engine.LoadQueryInfluencers; 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 JoinSequence-related * 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.useThetaStyleImplicitJoins ) { // 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.isDereferencedBySubclassProperty() ) { // 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.isDereferencedBySuperclassOrSubclassProperty(), fromElement.getWithClauseFragment(), fromElement.getWithClauseJoinAlias() ); String frag = joinFragment.toFromFragmentString(); String whereFrag = joinFragment.toWhereFragmentString(); // 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 + "]" ); } processDynamicFilterParameters( 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 processDynamicFilterParameters( final String sqlFragment, final ParameterContainer container, final HqlSqlWalker walker) { if ( walker.getEnabledFilters().isEmpty() && ( ! hasDynamicFilterParam( sqlFragment ) ) && ( ! ( hasCollectionFilterParam( sqlFragment ) ) ) ) { return; } Dialect dialect = walker.getSessionFactoryHelper().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 = LoadQueryInfluencers.parseFilterParameterName( 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.getSessionFactoryHelper().getFactory() ) ) ); final String bindFragment = ( value != null && Collection.class.isInstance( value ) ) ? StringHelper.join( ",", ArrayHelper.fillArray( typeBindFragment, ( ( Collection ) value ).size() ) ) : typeBindFragment; result.append( bindFragment ); container.addEmbeddedParameter( new DynamicFilterParameterSpecification( parts[0], parts[1], type ) ); } else { result.append( token ); } } container.setText( result.toString() ); } private static boolean hasDynamicFilterParam(String sqlFragment) { return sqlFragment.indexOf( ParserHelper.HQL_VARIABLE_PREFIX ) < 0; } private static boolean hasCollectionFilterParam(String sqlFragment) { return sqlFragment.indexOf( "?" ) < 0; } }
ControlSystemStudio/cs-studio
thirdparty/plugins/org.csstudio.platform.libs.hibernate/project/core/src/main/java/org/hibernate/hql/ast/util/JoinProcessor.java
Java
epl-1.0
9,793
/** * Copyright (c) 2010-2016 by the respective copyright holders. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html */ package org.openhab.binding.tinkerforge.internal.model.impl; import java.lang.reflect.InvocationTargetException; 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.TinkerforgeErrorHandler; import org.openhab.binding.tinkerforge.internal.model.MBaseDevice; import org.openhab.binding.tinkerforge.internal.model.MIndustrialQuadRelay; import org.openhab.binding.tinkerforge.internal.model.MIndustrialQuadRelayBricklet; 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.NotConnectedException; 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.MIndustrialQuadRelayImpl#getSwitchState * <em>Switch State</em>}</li> * <li>{@link org.openhab.binding.tinkerforge.internal.model.impl.MIndustrialQuadRelayImpl#getLogger * <em>Logger</em>}</li> * <li>{@link org.openhab.binding.tinkerforge.internal.model.impl.MIndustrialQuadRelayImpl#getUid <em>Uid</em>} * </li> * <li>{@link org.openhab.binding.tinkerforge.internal.model.impl.MIndustrialQuadRelayImpl#isPoll <em>Poll</em>} * </li> * <li>{@link org.openhab.binding.tinkerforge.internal.model.impl.MIndustrialQuadRelayImpl#getEnabledA * <em>Enabled A</em>}</li> * <li>{@link org.openhab.binding.tinkerforge.internal.model.impl.MIndustrialQuadRelayImpl#getSubId * <em>Sub Id</em>}</li> * <li>{@link org.openhab.binding.tinkerforge.internal.model.impl.MIndustrialQuadRelayImpl#getMbrick * <em>Mbrick</em>}</li> * <li>{@link org.openhab.binding.tinkerforge.internal.model.impl.MIndustrialQuadRelayImpl#getDeviceType * <em>Device Type</em>}</li> * </ul> * </p> * * @generated */ public class MIndustrialQuadRelayImpl extends MinimalEObjectImpl.Container implements MIndustrialQuadRelay { /** * 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 SWITCH_STATE_EDEFAULT = 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 = SWITCH_STATE_EDEFAULT; /** * 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 DEVICE_TYPE_EDEFAULT = "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 = DEVICE_TYPE_EDEFAULT; private short relayNum; private int mask; private static final byte DEFAULT_SELECTION_MASK = 0000000000000001; private static final byte OFF_BYTE = 0000000000000000; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ protected MIndustrialQuadRelayImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ @Override protected EClass eStaticClass() { return ModelPackage.Literals.MINDUSTRIAL_QUAD_RELAY; } /** * <!-- 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 (eNotificationRequired()) { eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.MINDUSTRIAL_QUAD_RELAY__SWITCH_STATE, oldSwitchState, switchState)); } } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated NOT */ @Override public void turnSwitch(OnOffValue state) { logger.debug("turnSwitchState called on: {}", MIndustrialQuadRelayBrickletImpl.class); try { if (state == OnOffValue.OFF) { logger.debug("setSwitchValue off"); getMbrick().getTinkerforgeDevice().setSelectedValues(mask, OFF_BYTE); } else if (state == OnOffValue.ON) { logger.debug("setSwitchState on"); getMbrick().getTinkerforgeDevice().setSelectedValues(mask, mask); } else { logger.error("{} unkown switchstate {}", LoggerConstants.TFMODELUPDATE, state); } setSwitchState(state); } catch (TimeoutException e) { TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_TIMEOUT_EXCEPTION, e); } catch (NotConnectedException e) { TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_NOT_CONNECTION_EXCEPTION, e); } } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated NOT */ @Override public void fetchSwitchState() { OnOffValue value = OnOffValue.UNDEF; try { int deviceValue = getMbrick().getTinkerforgeDevice().getValue(); if ((deviceValue & mask) == mask) { value = OnOffValue.ON; } else { value = OnOffValue.OFF; } setSwitchState(value); } catch (TimeoutException e) { TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_TIMEOUT_EXCEPTION, e); } catch (NotConnectedException e) { TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_NOT_CONNECTION_EXCEPTION, 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 (eNotificationRequired()) { eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.MINDUSTRIAL_QUAD_RELAY__LOGGER, 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 (eNotificationRequired()) { eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.MINDUSTRIAL_QUAD_RELAY__UID, 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 (eNotificationRequired()) { eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.MINDUSTRIAL_QUAD_RELAY__POLL, 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 (eNotificationRequired()) { eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.MINDUSTRIAL_QUAD_RELAY__ENABLED_A, 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 (eNotificationRequired()) { eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.MINDUSTRIAL_QUAD_RELAY__SUB_ID, oldSubId, subId)); } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ @Override public MIndustrialQuadRelayBricklet getMbrick() { if (eContainerFeatureID() != ModelPackage.MINDUSTRIAL_QUAD_RELAY__MBRICK) { return null; } return (MIndustrialQuadRelayBricklet) eContainer(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ public NotificationChain basicSetMbrick(MIndustrialQuadRelayBricklet newMbrick, NotificationChain msgs) { msgs = eBasicSetContainer((InternalEObject) newMbrick, ModelPackage.MINDUSTRIAL_QUAD_RELAY__MBRICK, msgs); return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ @Override public void setMbrick(MIndustrialQuadRelayBricklet newMbrick) { if (newMbrick != eInternalContainer() || (eContainerFeatureID() != ModelPackage.MINDUSTRIAL_QUAD_RELAY__MBRICK && newMbrick != null)) { if (EcoreUtil.isAncestor(this, newMbrick)) { throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); } NotificationChain msgs = null; if (eInternalContainer() != null) { msgs = eBasicRemoveFromContainer(msgs); } if (newMbrick != null) { msgs = ((InternalEObject) newMbrick).eInverseAdd(this, ModelPackage.MSUB_DEVICE_HOLDER__MSUBDEVICES, MSubDeviceHolder.class, msgs); } msgs = basicSetMbrick(newMbrick, msgs); if (msgs != null) { msgs.dispatch(); } } else if (eNotificationRequired()) { eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.MINDUSTRIAL_QUAD_RELAY__MBRICK, 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(MIndustrialQuadRelay.class); relayNum = Short.parseShort(String.valueOf(subId.charAt(subId.length() - 1))); mask = DEFAULT_SELECTION_MASK << relayNum; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated NOT */ @Override public void enable() { logger.debug("enable called on MIndustrialQuadRelayImpl"); 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.MINDUSTRIAL_QUAD_RELAY__MBRICK: if (eInternalContainer() != null) { msgs = eBasicRemoveFromContainer(msgs); } return basicSetMbrick((MIndustrialQuadRelayBricklet) 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.MINDUSTRIAL_QUAD_RELAY__MBRICK: return basicSetMbrick(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ @Override public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { switch (eContainerFeatureID()) { case ModelPackage.MINDUSTRIAL_QUAD_RELAY__MBRICK: return eInternalContainer().eInverseRemove(this, ModelPackage.MSUB_DEVICE_HOLDER__MSUBDEVICES, MSubDeviceHolder.class, msgs); } return super.eBasicRemoveFromContainerFeature(msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case ModelPackage.MINDUSTRIAL_QUAD_RELAY__SWITCH_STATE: return getSwitchState(); case ModelPackage.MINDUSTRIAL_QUAD_RELAY__LOGGER: return getLogger(); case ModelPackage.MINDUSTRIAL_QUAD_RELAY__UID: return getUid(); case ModelPackage.MINDUSTRIAL_QUAD_RELAY__POLL: return isPoll(); case ModelPackage.MINDUSTRIAL_QUAD_RELAY__ENABLED_A: return getEnabledA(); case ModelPackage.MINDUSTRIAL_QUAD_RELAY__SUB_ID: return getSubId(); case ModelPackage.MINDUSTRIAL_QUAD_RELAY__MBRICK: return getMbrick(); case ModelPackage.MINDUSTRIAL_QUAD_RELAY__DEVICE_TYPE: 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.MINDUSTRIAL_QUAD_RELAY__SWITCH_STATE: setSwitchState((OnOffValue) newValue); return; case ModelPackage.MINDUSTRIAL_QUAD_RELAY__LOGGER: setLogger((Logger) newValue); return; case ModelPackage.MINDUSTRIAL_QUAD_RELAY__UID: setUid((String) newValue); return; case ModelPackage.MINDUSTRIAL_QUAD_RELAY__POLL: setPoll((Boolean) newValue); return; case ModelPackage.MINDUSTRIAL_QUAD_RELAY__ENABLED_A: setEnabledA((AtomicBoolean) newValue); return; case ModelPackage.MINDUSTRIAL_QUAD_RELAY__SUB_ID: setSubId((String) newValue); return; case ModelPackage.MINDUSTRIAL_QUAD_RELAY__MBRICK: setMbrick((MIndustrialQuadRelayBricklet) newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case ModelPackage.MINDUSTRIAL_QUAD_RELAY__SWITCH_STATE: setSwitchState(SWITCH_STATE_EDEFAULT); return; case ModelPackage.MINDUSTRIAL_QUAD_RELAY__LOGGER: setLogger(LOGGER_EDEFAULT); return; case ModelPackage.MINDUSTRIAL_QUAD_RELAY__UID: setUid(UID_EDEFAULT); return; case ModelPackage.MINDUSTRIAL_QUAD_RELAY__POLL: setPoll(POLL_EDEFAULT); return; case ModelPackage.MINDUSTRIAL_QUAD_RELAY__ENABLED_A: setEnabledA(ENABLED_A_EDEFAULT); return; case ModelPackage.MINDUSTRIAL_QUAD_RELAY__SUB_ID: setSubId(SUB_ID_EDEFAULT); return; case ModelPackage.MINDUSTRIAL_QUAD_RELAY__MBRICK: setMbrick((MIndustrialQuadRelayBricklet) null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case ModelPackage.MINDUSTRIAL_QUAD_RELAY__SWITCH_STATE: return SWITCH_STATE_EDEFAULT == null ? switchState != null : !SWITCH_STATE_EDEFAULT.equals(switchState); case ModelPackage.MINDUSTRIAL_QUAD_RELAY__LOGGER: return LOGGER_EDEFAULT == null ? logger != null : !LOGGER_EDEFAULT.equals(logger); case ModelPackage.MINDUSTRIAL_QUAD_RELAY__UID: return UID_EDEFAULT == null ? uid != null : !UID_EDEFAULT.equals(uid); case ModelPackage.MINDUSTRIAL_QUAD_RELAY__POLL: return poll != POLL_EDEFAULT; case ModelPackage.MINDUSTRIAL_QUAD_RELAY__ENABLED_A: return ENABLED_A_EDEFAULT == null ? enabledA != null : !ENABLED_A_EDEFAULT.equals(enabledA); case ModelPackage.MINDUSTRIAL_QUAD_RELAY__SUB_ID: return SUB_ID_EDEFAULT == null ? subId != null : !SUB_ID_EDEFAULT.equals(subId); case ModelPackage.MINDUSTRIAL_QUAD_RELAY__MBRICK: return getMbrick() != null; case ModelPackage.MINDUSTRIAL_QUAD_RELAY__DEVICE_TYPE: return DEVICE_TYPE_EDEFAULT == null ? deviceType != null : !DEVICE_TYPE_EDEFAULT.equals(deviceType); } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ @Override public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { if (baseClass == MBaseDevice.class) { switch (derivedFeatureID) { case ModelPackage.MINDUSTRIAL_QUAD_RELAY__LOGGER: return ModelPackage.MBASE_DEVICE__LOGGER; case ModelPackage.MINDUSTRIAL_QUAD_RELAY__UID: return ModelPackage.MBASE_DEVICE__UID; case ModelPackage.MINDUSTRIAL_QUAD_RELAY__POLL: return ModelPackage.MBASE_DEVICE__POLL; case ModelPackage.MINDUSTRIAL_QUAD_RELAY__ENABLED_A: return ModelPackage.MBASE_DEVICE__ENABLED_A; default: return -1; } } if (baseClass == MSubDevice.class) { switch (derivedFeatureID) { case ModelPackage.MINDUSTRIAL_QUAD_RELAY__SUB_ID: return ModelPackage.MSUB_DEVICE__SUB_ID; case ModelPackage.MINDUSTRIAL_QUAD_RELAY__MBRICK: return ModelPackage.MSUB_DEVICE__MBRICK; default: return -1; } } return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ @Override public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { if (baseClass == MBaseDevice.class) { switch (baseFeatureID) { case ModelPackage.MBASE_DEVICE__LOGGER: return ModelPackage.MINDUSTRIAL_QUAD_RELAY__LOGGER; case ModelPackage.MBASE_DEVICE__UID: return ModelPackage.MINDUSTRIAL_QUAD_RELAY__UID; case ModelPackage.MBASE_DEVICE__POLL: return ModelPackage.MINDUSTRIAL_QUAD_RELAY__POLL; case ModelPackage.MBASE_DEVICE__ENABLED_A: return ModelPackage.MINDUSTRIAL_QUAD_RELAY__ENABLED_A; default: return -1; } } if (baseClass == MSubDevice.class) { switch (baseFeatureID) { case ModelPackage.MSUB_DEVICE__SUB_ID: return ModelPackage.MINDUSTRIAL_QUAD_RELAY__SUB_ID; case ModelPackage.MSUB_DEVICE__MBRICK: return ModelPackage.MINDUSTRIAL_QUAD_RELAY__MBRICK; default: return -1; } } return super.eDerivedStructuralFeatureID(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.MINDUSTRIAL_QUAD_RELAY___INIT; case ModelPackage.MBASE_DEVICE___ENABLE: return ModelPackage.MINDUSTRIAL_QUAD_RELAY___ENABLE; case ModelPackage.MBASE_DEVICE___DISABLE: return ModelPackage.MINDUSTRIAL_QUAD_RELAY___DISABLE; 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 InvocationTargetException { switch (operationID) { case ModelPackage.MINDUSTRIAL_QUAD_RELAY___INIT: init(); return null; case ModelPackage.MINDUSTRIAL_QUAD_RELAY___ENABLE: enable(); return null; case ModelPackage.MINDUSTRIAL_QUAD_RELAY___DISABLE: disable(); return null; case ModelPackage.MINDUSTRIAL_QUAD_RELAY___TURN_SWITCH__ONOFFVALUE: turnSwitch((OnOffValue) arguments.get(0)); return null; case ModelPackage.MINDUSTRIAL_QUAD_RELAY___FETCH_SWITCH_STATE: 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(); } } // MIndustrialQuadRelayImpl
sytone/openhab
bundles/binding/org.openhab.binding.tinkerforge/src/main/java/org/openhab/binding/tinkerforge/internal/model/impl/MIndustrialQuadRelayImpl.java
Java
epl-1.0
28,553
#!/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/ cp /tmp/ffmpeg_report/* /tmp/e2e/report/ } set -x # Validate selenium base URL if [ -z "$TS_SELENIUM_BASE_URL" ]; then echo "The \"TS_SELENIUM_BASE_URL\" is not set!"; echo "Please, set the \"TS_SELENIUM_BASE_URL\" environment variable." exit 1 fi # Set testing suite if [ -z "$TEST_SUITE" ]; then TEST_SUITE=test-happy-path fi # Launch display mode and VNC server export DISPLAY=':20' Xvfb :20 -screen 0 1920x1080x24 > /dev/null 2>&1 & x11vnc -display :20 -N -forever > /dev/null 2>&1 & echo '' echo '#######################' echo '' echo 'For remote debug connect to the VNC server 0.0.0.0:5920' echo '' echo '#######################' echo '' # Launch selenium server /usr/bin/supervisord --configuration /etc/supervisord.conf & \ export TS_SELENIUM_REMOTE_DRIVER_URL=http://localhost:4444/wd/hub # Check selenium server launching expectedStatus=200 currentTry=1 maximumAttempts=5 while [ $(curl -s -o /dev/null -w "%{http_code}" --fail http://localhost:4444/wd/hub/status) != $expectedStatus ]; do if (( currentTry > maximumAttempts )); then status=$(curl -s -o /dev/null -w "%{http_code}" --fail http://localhost:4444/wd/hub/status) echo "Exceeded the maximum number of checking attempts," echo "selenium server status is '$status' and it is different from '$expectedStatus'"; exit 1; fi; echo "Wait selenium server availability ..." curentTry=$((curentTry + 1)) sleep 1 done # Print information about launching tests if mount | grep 'e2e'; then echo "The local code is mounted. Executing local code." cd /tmp/e2e || exit npm install else echo "Executing e2e tests from an image." cd /tmp/e2e || exit fi # Launch tests if [ $TS_LOAD_TESTS ]; then timestamp=$(date +%s) user_folder="$TS_SELENIUM_USERNAME-$timestamp" export TS_SELENIUM_REPORT_FOLDER="./$user_folder/report" export TS_SELENIUM_LOAD_TEST_REPORT_FOLDER="./$user_folder/load-test-folder" CONSOLE_LOGS="./$user_folder/console-log.txt" mkdir $user_folder touch $CONSOLE_LOGS npm run $TEST_SUITE 2>&1 | tee $CONSOLE_LOGS echo "Tarring files and sending them via FTP..." tar -cf $user_folder.tar ./$user_folder ftp -vn load-tests-ftp-service << End_script user user pass1234 binary put $user_folder.tar quit End_script echo "Files sent to load-tests-ftp-service." else SCREEN_RECORDING=${VIDEO_RECORDING:-true} if [ "${SCREEN_RECORDING}" == "true" ]; then echo "Starting ffmpeg recording..." mkdir -p /tmp/ffmpeg_report nohup ffmpeg -y -video_size 1920x1080 -framerate 24 -f x11grab -i :20.0 /tmp/ffmpeg_report/output.mp4 2> /tmp/ffmpeg_report/ffmpeg_err.txt > /tmp/ffmpeg_report/ffmpeg_std.txt & ffmpeg_pid=$! trap kill_ffmpeg 2 15 fi echo "Running TEST_SUITE: $TEST_SUITE with user: $TS_SELENIUM_USERNAME" npm run $TEST_SUITE EXIT_CODE=$? if [ "${SCREEN_RECORDING}" == "true" ]; then kill_ffmpeg fi exit $EXIT_CODE fi
codenvy/che
dockerfiles/e2e/entrypoint.sh
Shell
epl-1.0
3,085
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 createComponentPrefix(String componentName) { return componentName + "_"; } /** * @param referencePropertyName 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 createToOneRelationPrefix(String referencePropertyName) { return referencePropertyName + "_"; } public static String getReferencedEntityName(Value value) { if (value instanceof ToOne) { return ((ToOne) value).getReferencedEntityName(); } else if (value instanceof OneToMany) { return ((OneToMany) value).getReferencedEntityName(); } else if (value instanceof Collection) { return getReferencedEntityName(((Collection) value).getElement()); } return null; } }
ControlSystemStudio/cs-studio
thirdparty/plugins/org.csstudio.platform.libs.hibernate/project/envers/src/main/java/org/hibernate/envers/tools/MappingTools.java
Java
epl-1.0
1,365
/******************************************************************************* * Copyright (c) 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package com.ibm.ws.security.oauth20.web; import java.io.IOException; import java.io.UnsupportedEncodingException; 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.ReferenceCardinality; import org.osgi.service.component.annotations.ReferencePolicy; import org.osgi.service.component.annotations.ReferencePolicyOption; 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.OAuth20AccessDeniedException; import com.ibm.oauth.core.api.error.oauth20.OAuth20DuplicateParameterException; 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.OAuth20EnhancedTokenCache; import com.ibm.ws.security.oauth20.api.OAuth20Provider; import com.ibm.ws.security.oauth20.error.impl.OAuth20TokenRequestExceptionHandler; import com.ibm.ws.security.oauth20.exception.OAuth20BadParameterException; 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.OAuth20ProviderUtils; 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.ReferrerURLCookieHandler; import com.ibm.ws.webcontainer.security.WebAppSecurityCollaboratorImpl; import com.ibm.wsspi.kernel.service.utils.AtomicServiceReference; import com.ibm.wsspi.kernel.service.utils.ConcurrentServiceReferenceMap; import com.ibm.wsspi.security.oauth20.JwtAccessTokenMediator; import com.ibm.wsspi.security.oauth20.TokenIntrospectProvider; @Component(service = OAuth20EndpointServices.class, name = "com.ibm.ws.security.oauth20.web.OAuth20EndpointServices", immediate = true, configurationPolicy = ConfigurationPolicy.IGNORE, property = "service.vendor=IBM") public class OAuth20EndpointServices { private static TraceComponent tc = Tr.register(OAuth20EndpointServices.class); private static TraceComponent tc2 = Tr.register(OAuth20EndpointServices.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 KEY_SECURITY_SERVICE = "securityService"; protected final AtomicServiceReference<SecurityService> securityServiceRef = new AtomicServiceReference<SecurityService>(KEY_SECURITY_SERVICE); public static final String KEY_TOKEN_INTROSPECT_PROVIDER = "tokenIntrospectProvider"; private final ConcurrentServiceReferenceMap<String, TokenIntrospectProvider> tokenIntrospectProviderRef = new ConcurrentServiceReferenceMap<String, TokenIntrospectProvider>(KEY_TOKEN_INTROSPECT_PROVIDER); public static final String KEY_JWT_MEDIATOR = "jwtAccessTokenMediator"; private final ConcurrentServiceReferenceMap<String, JwtAccessTokenMediator> jwtAccessTokenMediatorRef = new ConcurrentServiceReferenceMap<String, JwtAccessTokenMediator>(KEY_JWT_MEDIATOR); public static final String KEY_OAUTH_CLIENT_METATYPE_SERVICE = "oauth20ClientMetatypeService"; private static final AtomicServiceReference<OAuth20ClientMetatypeService> oauth20ClientMetatypeServiceRef = new AtomicServiceReference<OAuth20ClientMetatypeService>(KEY_OAUTH_CLIENT_METATYPE_SERVICE); private static final String ATTR_NONCE = "consentNonce"; public static final String AUTHENTICATED = "authenticated"; protected volatile ClientAuthentication clientAuthentication = new ClientAuthentication(); protected volatile ClientAuthorization clientAuthorization = new ClientAuthorization(); protected volatile UserAuthentication userAuthentication = new UserAuthentication(); protected volatile CoverageMapEndpointServices coverageMapServices = new CoverageMapEndpointServices(); protected volatile RegistrationEndpointServices registrationEndpointServices = new RegistrationEndpointServices(); protected volatile Consent consent = new Consent(); protected volatile TokenExchange tokenExchange = new TokenExchange(); @Reference(service = SecurityService.class, name = KEY_SECURITY_SERVICE, policy = ReferencePolicy.DYNAMIC, policyOption = ReferencePolicyOption.GREEDY) protected void setSecurityService(ServiceReference<SecurityService> reference) { securityServiceRef.setReference(reference); } protected void unsetSecurityService(ServiceReference<SecurityService> reference) { securityServiceRef.unsetReference(reference); } @Reference(service = TokenIntrospectProvider.class, name = KEY_TOKEN_INTROSPECT_PROVIDER, policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE, policyOption = ReferencePolicyOption.GREEDY) protected void setTokenIntrospectProvider(ServiceReference<TokenIntrospectProvider> ref) { synchronized (tokenIntrospectProviderRef) { tokenIntrospectProviderRef.putReference((String) ref.getProperty(KEY_SERVICE_PID), ref); } } protected void unsetTokenIntrospectProvider(ServiceReference<TokenIntrospectProvider> ref) { synchronized (tokenIntrospectProviderRef) { tokenIntrospectProviderRef.removeReference((String) ref.getProperty(KEY_SERVICE_PID), ref); } } @Reference(service = JwtAccessTokenMediator.class, name = KEY_JWT_MEDIATOR, policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.OPTIONAL, policyOption = ReferencePolicyOption.GREEDY) protected void setJwtAccessTokenMediator(ServiceReference<JwtAccessTokenMediator> ref) { synchronized (jwtAccessTokenMediatorRef) { jwtAccessTokenMediatorRef.putReference((String) ref.getProperty(KEY_SERVICE_PID), ref); } } protected void unsetJwtAccessTokenMediator(ServiceReference<JwtAccessTokenMediator> ref) { synchronized (jwtAccessTokenMediatorRef) { jwtAccessTokenMediatorRef.removeReference((String) ref.getProperty(KEY_SERVICE_PID), ref); } } @Reference(service = OAuth20ClientMetatypeService.class, name = KEY_OAUTH_CLIENT_METATYPE_SERVICE, policy = ReferencePolicy.DYNAMIC) protected void setOAuth20ClientMetatypeService(ServiceReference<OAuth20ClientMetatypeService> ref) { oauth20ClientMetatypeServiceRef.setReference(ref); } protected void unsetOAuth20ClientMetatypeService(ServiceReference<OAuth20ClientMetatypeService> ref) { oauth20ClientMetatypeServiceRef.unsetReference(ref); } @Activate protected void activate(ComponentContext cc) { securityServiceRef.activate(cc); tokenIntrospectProviderRef.activate(cc); jwtAccessTokenMediatorRef.activate(cc); oauth20ClientMetatypeServiceRef.activate(cc); ConfigUtils.setJwtAccessTokenMediatorService(jwtAccessTokenMediatorRef); TokenIntrospect.setTokenIntrospect(tokenIntrospectProviderRef); // The TraceComponent object was not initialized with the message bundle containing this message, so we cannot use // Tr.info(tc, "OAUTH_ENDPOINT_SERVICE_ACTIVATED"). Eventually these messages will be merged into one file, making this infoMsg variable unnecessary String infoMsg = TraceNLS.getFormattedMessage(this.getClass(), MESSAGE_BUNDLE, "OAUTH_ENDPOINT_SERVICE_ACTIVATED", null, "CWWKS1410I: The OAuth endpoint service is activated."); Tr.info(tc, infoMsg); } @Deactivate protected void deactivate(ComponentContext cc) { securityServiceRef.deactivate(cc); tokenIntrospectProviderRef.deactivate(cc); jwtAccessTokenMediatorRef.deactivate(cc); oauth20ClientMetatypeServiceRef.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.getRequestStringForTrace(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.getRequestStringForTrace(request, "client_secret")); } handleEndpointRequest(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 handleEndpointRequest(HttpServletRequest request, HttpServletResponse response, ServletContext servletContext, OAuth20Provider oauth20Provider, EndpointType endpointType, AttributeList oidcOptionalParams) throws ServletException, IOException { checkHttpsRequirement(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 isBrowserWithBasicAuth = false; UIAccessTokenBuilder uitb = null; if (tc.isDebugEnabled()) { Tr.debug(tc, "endpointType[" + endpointType + "]"); } try { switch (endpointType) { case authorize: OAuthResult result = processAuthorizationRequest(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 (clientAuthentication.verify(oauth20Provider, request, response, endpointType)) { processTokenRequest(oauth20Provider, request, response); } break; case introspect: if (clientAuthentication.verify(oauth20Provider, request, response, endpointType)) { introspect(oauth20Provider, request, response); } break; case revoke: if (clientAuthentication.verify(oauth20Provider, request, response, endpointType)) { revoke(oauth20Provider, request, response); } break; case coverage_map: // non-spec extension coverageMapServices.handleEndpointRequest(oauth20Provider, request, response); break; case registration: secureEndpointServices(oauth20Provider, request, response, servletContext, RegistrationEndpointServices.ROLE_REQUIRED, true); registrationEndpointServices.handleEndpointRequest(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, RegistrationEndpointServices.ROLE_REQUIRED)) { break; } // new MockUiPage(request, response).render(); // TODO: replace with hook to real ui. RequestDispatcher rd = servletContext.getRequestDispatcher("WEB-CONTENT/clientAdmin/index.jsp"); rd.forward(request, response); break; case personalTokenManagement: 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 UIAccessTokenBuilder(oauth20Provider, request); uitb.createHeaderValuesForUI(); // new MockUiPage(request, response).render(); // TODO: replace with hook to real ui. RequestDispatcher rd2 = servletContext.getRequestDispatcher("WEB-CONTENT/accountManager/index.jsp"); rd2.forward(request, response); break; case usersTokenManagement: 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 UIAccessTokenBuilder(oauth20Provider, request); uitb.createHeaderValuesForUI(); // new MockUiPage(request, response).render(); // TODO: replace with hook to real ui. RequestDispatcher rd3 = servletContext.getRequestDispatcher("WEB-CONTENT/tokenManager/index.jsp"); rd3.forward(request, response); break; case clientMetatype: serveClientMetatypeRequest(request, response); break; default: break; } } catch (OidcServerException e) { if (!isBrowserWithBasicAuth) { // 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.OAuth20EndpointServices", "324", this); } } boolean suppressBasicAuthChallenge = isBrowserWithBasicAuth; // ui must NOT log in using basic auth, so logout function will work. WebUtils.sendErrorJSON(response, e.getHttpStatus(), e.getErrorCode(), e.getErrorDescription(request.getLocales()), suppressBasicAuthChallenge); } } // 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 = handleUIUserAuthentication(request, response, servletContext, provider, options); if (!isUIAuthenticationComplete(request, response, provider, result, requiredRole)) { return false; } return true; } private boolean isUIAuthenticationComplete(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 serveClientMetatypeRequest(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { OAuth20ClientMetatypeService metatypeService = oauth20ClientMetatypeServiceRef.getService(); if (metatypeService == null) { response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); return; } metatypeService.sendClientMetatypeData(request, response); } private boolean checkUIConfig(OAuth20Provider provider, HttpServletRequest request) { String uri = request.getRequestURI(); String id = provider.getInternalClientId(); String secret = provider.getInternalClientSecret(); 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.isAppPasswordAllowed() || client.isAppTokenAllowed()); } if (!result) { Tr.warning(tc2, "OAUTH_UI_ENDPOINT_NOT_ENABLED", uri); } return result; } /** * Perform logout. call base security logout to clear ltpa cookie. * Then redirect to a configured logout page if available, else a default. * * This does NOT implement * OpenID Connect Session Management 1.0 draft 28. as of Nov. 2017 * https://openid.net/specs/openid-connect-session-1_0.html#RedirectionAfterLogout * * Instead it is a simpler approach that just deletes the ltpa (sso) cookie * and sends a simple error page if things go wrong. * * @param provider * @param request * @param response */ 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().sendDefaultErrorPage(request, response); return; } // not part of spec: logout url defined in config, not client-specific String logoutRedirectURL = provider.getLogoutRedirectURL(); 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().sendDefaultLogoutPage(request, response); } } catch (IOException e) { FFDCFilter.processException(e, this.getClass().getName(), "logout", new Object[] {}); new LogoutPages().sendDefaultErrorPage(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 (UnsupportedEncodingException e) { // ffdc } } return encodedURL; } public OAuthResult processAuthorizationRequest(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.isClientAutoAuthorized(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.validateAuthorization(provider, request, response); if (oauthResult.getStatus() != OAuthResult.STATUS_OK) { if (tc.isDebugEnabled()) { Tr.debug(tc, "Status is OK, returning result"); } return oauthResult; } } oauthResult = handleUserAuthentication(oauthResult, request, response, servletContext, provider, reqConsentNonce, options, autoAuthz, afterLogin); return oauthResult; } /** * Adds the id_token_hint_status, id_token_hint_username, and id_token_hint_clientid attributes from the options list * into attrList, if those attributes exist. * * @param options * @param attrList */ private void setTokenHintAttributes(AttributeList options, AttributeList attrList) { String value = options.getAttributeValueByName(OIDCConstants.OIDC_AUTHZ_PARAM_ID_TOKEN_HINT_STATUS); if (value != null) { attrList.setAttribute(OIDCConstants.OIDC_AUTHZ_PARAM_ID_TOKEN_HINT_STATUS, OAuth20Constants.ATTRTYPE_REQUEST, new String[] { value }); } value = options.getAttributeValueByName(OIDCConstants.OIDC_AUTHZ_PARAM_ID_TOKEN_HINT_USERNAME); if (value != null) { attrList.setAttribute(OIDCConstants.OIDC_AUTHZ_PARAM_ID_TOKEN_HINT_USERNAME, OAuth20Constants.ATTRTYPE_REQUEST, new String[] { value }); } value = options.getAttributeValueByName(OIDCConstants.OIDC_AUTHZ_PARAM_ID_TOKEN_HINT_CLIENTID); if (value != null) { attrList.setAttribute(OIDCConstants.OIDC_AUTHZ_PARAM_ID_TOKEN_HINT_CLIENTID, OAuth20Constants.ATTRTYPE_REQUEST, new String[] { value }); } } /** * @param attrs * @param request * @return OAuthResultImpl if validation failed, null otherwise. */ private OAuthResultImpl validateIdTokenHintIfPresent(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 createTokenLimitResult(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); } } OAuth20AccessDeniedException e = new OAuth20AccessDeniedException("security.oauth20.token.limit.external.error"); e.setHttpStatusCode(HttpServletResponse.SC_BAD_REQUEST); OAuthResult oauthResultWithExcep = new OAuthResultImpl(OAuthResult.STATUS_FAILED, attrs, e); return oauthResultWithExcep; } private OAuthResult handleUIUserAuthentication(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.handleAuthenticationWithOAuthResult(provider, request, response, prompt, securityServiceRef, servletContext, OAuth20EndpointServices.AUTHENTICATED, oauthResult); } if (request.getUserPrincipal() == null) { // must be redirect return oauthResult; } else if (CookieHelper.getCookieValue(request.getCookies(), ReferrerURLCookieHandler.CUSTOM_RELOGIN_URL_COOKIENAME) != null) { ReferrerURLCookieHandler handler = WebAppSecurityCollaboratorImpl.getGlobalWebAppSecurityConfig().createReferrerURLCookieHandler(); // GM 2017.05.31 // ReferrerURLCookieHandler handler = new ReferrerURLCookieHandler(WebAppSecurityCollaboratorImpl.getGlobalWebAppSecurityConfig()); handler.invalidateReferrerURLCookie(request, response, ReferrerURLCookieHandler.CUSTOM_RELOGIN_URL_COOKIENAME); } 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({ OAuth20BadParameterException.class }) private OAuthResult handleUserAuthentication(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.getAttributeValuesByName(OAuth20Constants.SCOPE); if (options != null) { setTokenHintAttributes(options, attrs); } String[] validResources = attrs.getAttributeValuesByName(OAuth20Constants.RESOURCE); if (validResources != null) { options.setAttribute(OAuth20Constants.RESOURCE, OAuth20Constants.ATTRTYPE_PARAM_OAUTH, 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.ATTRTYPE_PARAM_QUERY, 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 = validateIdTokenHintIfPresent(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.handleAuthenticationWithOAuthResult(provider, request, response, prompt, securityServiceRef, servletContext, OAuth20EndpointServices.AUTHENTICATED, oauthResult); } if (request.getUserPrincipal() == null) { // must be redirect return oauthResult; } else if (CookieHelper.getCookieValue(request.getCookies(), ReferrerURLCookieHandler.CUSTOM_RELOGIN_URL_COOKIENAME) != null) { ReferrerURLCookieHandler handler = WebAppSecurityCollaboratorImpl.getGlobalWebAppSecurityConfig().createReferrerURLCookieHandler(); // GM 2017.05.31 // ReferrerURLCookieHandler handler = new ReferrerURLCookieHandler(WebAppSecurityCollaboratorImpl.getGlobalWebAppSecurityConfig()); handler.invalidateReferrerURLCookie(request, response, ReferrerURLCookieHandler.CUSTOM_RELOGIN_URL_COOKIENAME); } 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.isPreAuthorizedScope(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.errorConsentRequired(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 createTokenLimitResult(attrs, request, clientId); } if (request.getAttribute(OAuth20Constants.OIDC_REQUEST_OBJECT_ATTR_NAME) != null) { // Ensure that the reduced scopes list is not empty oauthResult = clientAuthorization.checkForEmptyScopeSetAfterConsent(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 = OAuth20ProviderUtils.getOidcOAuth20Client(provider, clientId); OAuth20ProviderUtils.validateResource(request, options, client); } catch (OAuth20BadParameterException e) { // some exceptions need to handled separately WebUtils.throwOidcServerException(request, e); } catch (OAuth20Exception e) { WebUtils.throwOidcServerException(request, e); } if (options != null) { options.setAttribute(OAuth20Constants.SCOPE, OAuth20Constants.ATTRTYPE_RESPONSE_ATTRIBUTE, reducedScopes); } if (provider.isTrackOAuthClients()) { OAuthClientTracker clientTracker = new OAuthClientTracker(request, response, provider); clientTracker.trackOAuthClient(clientId); } consent.handleConsent(provider, request, prompt, clientId); getExternalClaimsFromWSSubject(request, options); oauthResult = provider.processAuthorization(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 secureEndpointServices(OAuth20Provider provider, HttpServletRequest request, HttpServletResponse response, ServletContext servletContext, String requiredRole, boolean fallbackToBasicAuth) throws OidcServerException { try { userAuthentication.handleBasicAuthenticationWithRequiredRole(provider, request, response, securityServiceRef, servletContext, requiredRole, fallbackToBasicAuth); } catch (OidcServerException e) { if (fallbackToBasicAuth) { if (e.getHttpStatus() == HttpServletResponse.SC_UNAUTHORIZED) { response.setHeader(RegistrationEndpointServices.HDR_WWW_AUTHENTICATE, RegistrationEndpointServices.UNAUTHORIZED_HEADER_VALUE); } } throw e; } } @FFDCIgnore({ OAuth20BadParameterException.class }) public void processTokenRequest(OAuth20Provider provider, HttpServletRequest request, HttpServletResponse response) throws ServletException, OidcServerException { String clientId = (String) request.getAttribute("authenticatedClient"); try { // checking resource OidcBaseClient client = OAuth20ProviderUtils.getOidcOAuth20Client(provider, clientId); if (client == null || !client.isEnabled()) { throw new OidcServerException("security.oauth20.error.invalid.client", OIDCConstants.ERROR_INVALID_CLIENT_METADATA, HttpServletResponse.SC_BAD_REQUEST); } OAuth20ProviderUtils.validateResource(request, null, client); } catch (OAuth20BadParameterException e) { // some exceptions need to handled separately WebUtils.throwOidcServerException(request, e); } catch (OAuth20Exception e) { WebUtils.throwOidcServerException(request, e); } OAuthResult result = clientAuthorization.validateAndHandle2LegsScope(provider, request, response, clientId); if (result.getStatus() == OAuthResult.STATUS_OK) { result = provider.processTokenRequest(clientId, request, response); } if (result.getStatus() != OAuthResult.STATUS_OK) { OAuth20TokenRequestExceptionHandler handler = new OAuth20TokenRequestExceptionHandler(); handler.handleResultException(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.ERROR_CODE_INVALID_REQUEST, null); // invalid_request return; } String tokenLookupStr = tokenString; OAuth20Token token = null; boolean isAppPasswordOrToken = false; if (OidcOAuth20Util.isJwtToken(tokenString)) { tokenLookupStr = com.ibm.ws.security.oauth20.util.HashUtils.digest(tokenString); } else if (tokenString.length() == (provider.getAccessTokenLength() + 2)) { // app-token String encode = provider.getAccessTokenEncoding(); if (OAuth20Constants.PLAIN_ENCODING.equals(encode)) { // must be app-password or app-token tokenLookupStr = EndpointUtils.computeTokenHash(tokenString); } else { tokenLookupStr = EndpointUtils.computeTokenHash(tokenString, encode); } isAppPasswordOrToken = true; } if (isAppPasswordOrToken) { 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.TOKENTYPE_AUTHORIZATION_GRANT) && token.getSubType().equals(OAuth20Constants.SUBTYPE_REFRESH_TOKEN)) || token.getType().equals(OAuth20Constants.TOKENTYPE_ACCESS_TOKEN))) { // 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 (isAppPasswordOrToken) { provider.getTokenCache().removeByHash(tokenLookupStr); } else { provider.getTokenCache().remove(tokenLookupStr); } if (token.getSubType().equals(OAuth20Constants.SUBTYPE_REFRESH_TOKEN)) { removeAssociatedAccessTokens(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.ERROR_CODE_UNSUPPORTED_TOKEN_TYPE, 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, "OAUTH_INVALID_CLIENT", new Object[] { "revoke", request.getRequestURI() }, defaultMsg); WebUtils.sendErrorJSON(response, HttpServletResponse.SC_BAD_REQUEST, Constants.ERROR_CODE_INVALID_CLIENT, errorMsg); } } catch (OAuth20DuplicateParameterException e) { // Duplicate parameter found in request WebUtils.sendErrorJSON(response, HttpServletResponse.SC_BAD_REQUEST, Constants.ERROR_CODE_INVALID_REQUEST, e.getMessage()); } catch (Exception e) { if (tc.isDebugEnabled()) { Tr.debug(tc, "Internal error processing token revoke request", e); } try { response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } 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 removeAssociatedAccessTokens(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.getRevokeAccessTokensWithRefreshTokens()) { if (tc.isDebugEnabled()) { Tr.debug(tc, "provider prop revokeAccessTokensWithRefreshTokens is false, returning"); } return; } String username = refreshToken.getUsername(); String clientId = refreshToken.getClientId(); String refreshTokenId = refreshToken.getId(); OAuth20EnhancedTokenCache 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.TOKENTYPE_ACCESS_TOKEN.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 checkHttpsRequirement(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.getClientTokenCacheSize(); 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.OAUTH_REQUEST_OBJECT_ATTR_NAME); if (oauth20Request == null) { String errorMsg = TraceNLS.getFormattedMessage(this.getClass(), MESSAGE_BUNDLE, "OAUTH_REQUEST_ATTRIBUTE_MISSING", new Object[] { request.getRequestURI(), OAuth20Constants.OAUTH_REQUEST_OBJECT_ATTR_NAME }, "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, "OAUTH_PROVIDER_OBJECT_NULL", new Object[] { oauth20Request.getProviderName(), OAuth20Constants.OAUTH_REQUEST_OBJECT_ATTR_NAME }, "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[]> getExternalClaimsFromWSSubject(HttpServletRequest request, AttributeList options) { final String methodName = "getExternalClaimsFromWSSubject"; try { String externalClaimNames = options.getAttributeValueByName(OAuth20Constants.EXTERNAL_CLAIM_NAMES); 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.EXTERNAL_CLAIMS_PREFIX + 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.getPublicCredentials(); 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); OAuth20AccessDeniedException e = new OAuth20AccessDeniedException("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 OidcEndpointServices return TokenIntrospect.getUserClaimsMap(userClaims, groupsOnly); } protected UserClaims getUserClaimsObj(OAuth20Provider provider, OAuth20Token accessToken) throws IOException { // keep this method for OidcEndpointServices return TokenIntrospect.getUserClaimsObj(provider, accessToken); } }
kgibm/open-liberty
dev/com.ibm.ws.security.oauth/src/com/ibm/ws/security/oauth20/web/OAuth20EndpointServices.java
Java
epl-1.0
60,040
/******************************************************************************* * Copyright (c) 2005-2010, G. Weirich and Elexis * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * G. Weirich - initial implementation * D. Lutz - adapted for importing data from other databases * *******************************************************************************/ 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.DBImportFirstPage_connection, Messages.DBImportFirstPage_typeOfDB, Images.IMG_LOGO.getImageDescriptor(ImageSize._75x66_TitleDialogIconSize)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ setMessage(Messages.DBImportFirstPage_selectType + Messages.DBImportFirstPage_enterNameODBC); //$NON-NLS-1$ setDescription(Messages.DBImportFirstPage_theDesrciption); //$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.DBImportFirstPage_Connection); //$NON-NLS-1$ Composite body = form.getBody(); body.setLayout(new TableWrapLayout()); tk.createLabel(body, Messages.DBImportFirstPage_EnterType); //$NON-NLS-1$ dbTypes = new List(body, SWT.BORDER); dbTypes.setItems(supportedDB); dbTypes.addSelectionListener(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.DBImportFirstPage_serverAddress); //$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.DBImportFirstPage_databaseName); //$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); } }
sazgin/elexis-3-core
ch.elexis.core.ui/src/ch/elexis/core/ui/wizards/DBImportFirstPage.java
Java
epl-1.0
4,493
/******************************************************************************* * Copyright (c) 2020 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ 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; } }
OpenLiberty/open-liberty
dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/MavenRepository.java
Java
epl-1.0
1,293
/******************************************************************************* * Copyright (c) 2011, 2016 Eurotech and/or its affiliates and others * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Eurotech - initial API and implementation * *******************************************************************************/ 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 AbstractStorableListResult<E extends Storable> extends ArrayList<E> implements StorableListResult<E> { private Object nextKey; private Integer totalCount; public AbstractStorableListResult() { nextKey = null; totalCount = null; } public AbstractStorableListResult(Object nextKey) { this.nextKey = nextKey; this.totalCount = null; } public AbstractStorableListResult(Object nextKeyOffset, Integer totalCount) { this(nextKeyOffset); this.totalCount = totalCount; } public Object getNextKey() { return nextKey; } public Integer getTotalCount() { return totalCount; } }
muros-ct/kapua
service/datastore/internal/src/main/java/org/eclipse/kapua/service/datastore/internal/model/query/AbstractStorableListResult.java
Java
epl-1.0
1,524
/******************************************************************************* * Copyright (c) 2017, 2020 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ 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.FeatureReplacementAction; 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(FeatureReplacementAction.EE8_FEATURES()) .andWith(new JakartaEE9Action()); }
OpenLiberty/open-liberty
dev/com.ibm.ws.transaction.core_fat.startMultiEJB/fat/src/com/ibm/ws/transaction/test/FATSuite.java
Java
epl-1.0
1,724
/** * Copyright (c) 2010-2021 Contributors to the openHAB project * * See the NOTICE file(s) distributed with this work for additional * information. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0 * * SPDX-License-Identifier: EPL-2.0 */ 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 LxControlTrackerTest extends LxControlTest { @BeforeEach public void setup() { setupControl("132aa43b-01d4-56ea-ffff403fb0c34b9e", "0b734138-037d-034e-ffff403fb0c34b9e", "0fe650c2-0004-d446-ffff504f9410790f", "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 testLoxoneStateChanges() { 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)); } } }
MikeJMajor/openhab2-addons-dlinksmarthome
bundles/org.openhab.binding.loxone/src/test/java/org/openhab/binding/loxone/internal/controls/LxControlTrackerTest.java
Java
epl-1.0
1,684
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; // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.kpdus.com/jad.html // 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; } }
sehrgut/minecraft-smp-mocreatures
moCreatures/server/debug/sources/moCreatures/items/ItemSharkEgg.java
Java
epl-1.0
1,137
/******************************************************************************* * Copyright (C) 2008, 2009 Robin Rosenberg <[email protected]> * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html *******************************************************************************/ 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() .addRefsChangedListener(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 = GitQuickDiffProvider.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.GitDocument_errorResolveQuickdiff, 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.GitDocument_errorLoadCommit, 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.GitDocument_errorLoadTree, 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.GitDocument_errorRefreshQuickdiff, 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(); } } } }
jdcasey/EGit
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/decorators/GitDocument.java
Java
epl-1.0
8,708
/******************************************************************************* * Copyright (c) 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ // 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 SYSTEMMESSAGESOURCEUUID = 2; public final static int SYSTEMMESSAGEVALUE = 3; public final static int SECURITYUSERID = 4; public final static int SECURITYSENTBYSYSTEM = 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; }
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/schema/JsHdrAccess.java
Java
epl-1.0
1,422
///******************************************************************************* // * Copyright (c) 2015, 2016 EfficiOS Inc., Alexandre Montplaisir // * // * All rights reserved. This program and the accompanying materials are // * made available under the terms of the Eclipse Public License v1.0 which // * accompanies this distribution, and is available at // * http://www.eclipse.org/legal/epl-v10.html // *******************************************************************************/ // //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.LamiReportViewTabPage; // ///** // * 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 LamiReportViewTabPage} parent page // * @return The new viewer // */ // static ILamiViewer createLamiTable(Composite parent, LamiReportViewTabPage 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 LamiReportViewTabPage} parent page // * @param chartModel // * The information about the chart to display // * @return The new viewer // */ // static ILamiViewer createLamiChart(Composite parent, LamiReportViewTabPage 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 UnsupportedOperationException("Unsupported chart type: " + chartModel.toString()); //$NON-NLS-1$ // } // } //}
alexmonthy/lttng-scope
lttng-scope/src/main/java/org/lttng/scope/lami/viewers/ILamiViewer.java
Java
epl-1.0
2,501
/******************************************************************************* * Copyright (c) 2017, 2021 Red Hat Inc and others * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 * which is available at https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat Inc - initial API and implementation *******************************************************************************/ 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 DeploymentUninstallPackageRequest { @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; } }
stzilli/kapua
simulator-kura/src/main/java/org/eclipse/kapua/kura/simulator/app/deploy/DeploymentUninstallPackageRequest.java
Java
epl-1.0
1,787
/** * Copyright (c) 2020 Bosch.IO GmbH and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html */ 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.TagAssignmentListener; import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider; 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 TagAssignementComboBox extends HorizontalLayout { private static final long serialVersionUID = 1L; private final Collection<ProxyTag> allAssignableTags; private final transient Set<TagAssignmentListener> listeners = Sets.newConcurrentHashSet(); private final ComboBox<ProxyTag> assignableTagsComboBox; private final boolean readOnlyMode; /** * Constructor. * * @param i18n * the i18n * @param readOnlyMode * if true the combobox will be disabled so no assignment can be * done. */ TagAssignementComboBox(final VaadinMessageSource i18n, final boolean readOnlyMode) { this.readOnlyMode = readOnlyMode; setWidth("100%"); this.assignableTagsComboBox = getAssignableTagsComboBox( i18n.getMessage(UIMessageIdProvider.TOOLTIP_SELECT_TAG)); this.allAssignableTags = new HashSet<>(); this.assignableTagsComboBox.setItems(allAssignableTags); addComponent(assignableTagsComboBox); } private ComboBox<ProxyTag> getAssignableTagsComboBox(final String description) { final ComboBox<ProxyTag> tagsComboBox = new ComboBox<>(); tagsComboBox.setId(UIComponentIdProvider.TAG_SELECTION_ID); tagsComboBox.setDescription(description); tagsComboBox.addStyleName(ValoTheme.COMBOBOX_TINY); tagsComboBox.setEnabled(!readOnlyMode); tagsComboBox.setWidth("100%"); tagsComboBox.setEmptySelectionAllowed(true); tagsComboBox.setItemCaptionGenerator(ProxyTag::getName); tagsComboBox.addValueChangeListener(event -> assignTag(event.getValue())); return tagsComboBox; } private void assignTag(final ProxyTag tagData) { if (tagData == null || readOnlyMode) { return; } allAssignableTags.remove(tagData); assignableTagsComboBox.clear(); assignableTagsComboBox.getDataProvider().refreshAll(); notifyListenersTagAssigned(tagData); } /** * Initializes the Combobox with all assignable tags. * * @param assignableTags * assignable tags */ void initializeAssignableTags(final List<ProxyTag> assignableTags) { allAssignableTags.addAll(assignableTags); assignableTagsComboBox.getDataProvider().refreshAll(); } /** * Removes all Tags from Combobox. */ void removeAllTags() { allAssignableTags.clear(); assignableTagsComboBox.clear(); assignableTagsComboBox.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); assignableTagsComboBox.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; } findAssignableTagById(tagData.getId()).ifPresent(tagToUpdate -> updateAssignableTag(tagToUpdate, tagData)); } private Optional<ProxyTag> findAssignableTagById(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); assignableTagsComboBox.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) { findAssignableTagById(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); assignableTagsComboBox.getDataProvider().refreshAll(); } /** * Registers an {@link TagAssignmentListener} on the combobox. * * @param listener * the listener to register */ void addTagAssignmentListener(final TagAssignmentListener listener) { listeners.add(listener); } /** * Removes a {@link TagAssignmentListener} from the combobox, * * @param listener * the listener that should be removed. */ void removeTagAssignmentListener(final TagAssignmentListener listener) { listeners.remove(listener); } private void notifyListenersTagAssigned(final ProxyTag tagData) { listeners.forEach(listener -> listener.assignTag(tagData)); } }
eclipse/hawkbit
hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/tagdetails/TagAssignementComboBox.java
Java
epl-1.0
6,274
/** * Copyright (c) 2010-2021 Contributors to the openHAB project * * See the NOTICE file(s) distributed with this work for additional * information. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0 * * SPDX-License-Identifier: EPL-2.0 */ package org.openhab.binding.fronius.internal.api; import com.google.gson.annotations.SerializedName; /** * The {@link HeadRequestArguments} is responsible for storing * the "RequestArguments" node from the {@link Head} * * @author Thomas Rokohl - Initial contribution */ public class HeadRequestArguments { @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; } }
paulianttila/openhab2
bundles/org.openhab.binding.fronius/src/main/java/org/openhab/binding/fronius/internal/api/HeadRequestArguments.java
Java
epl-1.0
1,893
/** * Copyright (c) 2010-2020 Contributors to the openHAB project * * See the NOTICE file(s) distributed with this work for additional * information. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0 * * SPDX-License-Identifier: EPL-2.0 */ package org.openhab.binding.vigicrues.internal.dto.vigicrues; import java.util.List; import com.google.gson.annotations.SerializedName; /** * The {@link TerEntVigiCru} is the Java class used to map the JSON * response to an vigicrue api endpoint request. * * @author Gaël L'hopital - Initial contribution */ 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 vicDtHrCreatEntVigiCru; * * @SerializedName("vic:DtHrMajEntVigiCru") * public String vicDtHrMajEntVigiCru; * * @SerializedName("vic:StEntVigiCru") * public String vicStEntVigiCru; * public int count_aNMoinsUn; * * @SerializedName("LinkInfoCru") * public String linkInfoCru; */ } @SerializedName("vic:TerEntVigiCru") public VicTerEntVigiCru vicTerEntVigiCru; }
openhab/openhab2
bundles/org.openhab.binding.vigicrues/src/main/java/org/openhab/binding/vigicrues/internal/dto/vigicrues/TerEntVigiCru.java
Java
epl-1.0
1,863
/******************************************************************************* * Copyright (c) 2009-04-24 Joacim Jacobsson. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Joacim Jacobsson - first implementation *******************************************************************************/ #ifndef PARSER_COMMON_H_ #define PARSER_COMMON_H_ #include <btree/btree.h> #include "btree_bison.h" struct SParserContext { StringBuffer m_Parsed; StringBuffer m_Original; ParserContextFunctions 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_ */
AntonioModer/calltree
libs/btree/source/parser/parser.h
C
epl-1.0
1,461
/******************************************************************************* * Copyright (c) 2016, 2021 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ 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.MapToUserRegistryWithRegMismatch2ServerTests; import componenttest.custom.junit.runner.FATRunner; import componenttest.custom.junit.runner.Mode; import componenttest.custom.junit.runner.Mode.TestMode; import componenttest.topology.impl.LibertyServerWrapper; 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/MapToUserRegistryWithRegMismatch2ServerTests.java @LibertyServerWrapper @Mode(TestMode.FULL) @RunWith(FATRunner.class) public class OAuthMapToUserRegistryWithRegMismatch2ServerTests extends MapToUserRegistryWithRegMismatch2ServerTests { private static final Class<?> thisClass = OAuthMapToUserRegistryWithRegMismatch2ServerTests.class; @BeforeClass public static void setupBeforeTest() throws Exception { /* * These tests have not been configured to run with the local LDAP server. */ Assume.assumeTrue(!LDAPUtils.USE_LOCAL_LDAP_SERVER); 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, "server_orig_maptest_ldap.xml", Constants.OAUTH_OP, extraApps, Constants.DO_NOT_USE_DERBY, extraApps); genericTestServer = commonSetUp(RSServerName, "server_orig_maptest_mismatchregistry.xml", Constants.GENERIC_SERVER, extraApps2, Constants.DO_NOT_USE_DERBY, extraMsgs2, null, Constants.OAUTH_OP); targetProvider = Constants.OAUTHCONFIGSAMPLE_APP; flowType = Constants.WEB_CLIENT_FLOW; goodActions = Constants.BASIC_PROTECTED_RESOURCE_RS_PROTECTED_RESOURCE_ACTIONS; // set RS protected resource to point to second server. testSettings.setRSProtectedResource(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"); } }
OpenLiberty/open-liberty
dev/com.ibm.ws.security.oidc.server_fat.jaxrs.config/fat/src/com/ibm/ws/security/openidconnect/server/fat/jaxrs/config/OAuth/OAuthMapToUserRegistryWithRegMismatch2ServerTests.java
Java
epl-1.0
4,019
/******************************************************************************* * Copyright (c) 2016, 2021 Eurotech and/or its affiliates and others * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 * which is available at https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Eurotech - initial API and implementation *******************************************************************************/ package org.eclipse.kapua; /** * KapuaIllegalNullArgumentException 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>NullPointerException</tt> as the latter is too easily confused with programming bugs. * * @since 1.0 * */ public class KapuaIllegalNullArgumentException extends KapuaIllegalArgumentException { private static final long serialVersionUID = -8762712571192128282L; /** * Constructor * * @param argumentName */ public KapuaIllegalNullArgumentException(String argumentName) { super(KapuaErrorCodes.ILLEGAL_NULL_ARGUMENT, argumentName, null); } }
stzilli/kapua
service/api/src/main/java/org/eclipse/kapua/KapuaIllegalNullArgumentException.java
Java
epl-1.0
1,278
<!-- 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://www.arduino.cc/) --> <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&uacute;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 util_make_basic_auth(user, password) { var tok = user + ':' + (password || "arduino"); var hash = btoa(tok); return "Basic " + hash; } function add_basic_auth_headers_if_password(ajax_call_options, password) { if (password && password !== "") { ajax_call_options.headers = { Authorization: util_make_basic_auth("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 storage_retrieve_all(callback) { var ajax_call_options = { url: "/data/get", timeout: 10000, success: callback, error: error_handler }; add_basic_auth_headers_if_password(ajax_call_options, $("#password").val()); $.ajax(ajax_call_options) } function storage_delete_by_key(key, callback) { var ajax_call_options = { url: "/data/delete/" + encodeURIComponent(key), timeout: 10000, success: callback, error: error_handler }; add_basic_auth_headers_if_password(ajax_call_options, $("#password").val()); $.ajax(ajax_call_options) } function storage_update_key_value(key, value, callback) { var ajax_call_options = { url: "/data/put/" + encodeURIComponent(key) + "/" + encodeURIComponent(value), timeout: 10000, success: callback, error: error_handler }; add_basic_auth_headers_if_password(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 confirm_storage_key_deletion(event) { var key = $(event.target).attr("name"); if (confirm("Are you sure you want to delete key \"" + key + "\" ?")) { storage_delete_by_key(key, function() { $("#storage").html(please_wait_message); storage_retrieve_all(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++) { storage_update_key_value(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); storage_retrieve_all(repaint_storage); $("#storage").on("click", "input[type=button]", confirm_storage_key_deletion); $("#update").on("click", function() { update_storage(function() { $("#storage").html(please_wait_message); storage_retrieve_all(repaint_storage); }) }); $("#refresh").on("click", function() { $("#storage").html(please_wait_message); storage_retrieve_all(repaint_storage); }); if (window.location.protocol === "http:") { $("#warning").attr("style", ""); } }); </script> </body> </html>
geog-opensource/geog-linino
package/dragino/luci-app-iot-webpanel/www/keystore_manager_example/index.html
HTML
gpl-2.0
7,148
/* * Copyright (c) 2000, 2001, 2002 Fabrice Bellard * Copyright (c) 2007 Mans Rullgard * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #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-- = 0; 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, AV_BPRINT_SIZE_UNLIMITED); av_bprint_escape(&dstbuf, src, special_chars, mode, flags); if (!av_bprint_is_complete(&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 overlong_encoding_mins[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 < overlong_encoding_mins[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 & AV_UTF8_FLAG_ACCEPT_INVALID_BIG_CODES)) ret = AVERROR(EILSEQ); if (code < 0x20 && code != 0x9 && code != 0xA && code != 0xD && flags & AV_UTF8_FLAG_EXCLUDE_XML_INVALID_CONTROL_CODES) ret = AVERROR(EILSEQ); if (code >= 0xD800 && code <= 0xDFFF && !(flags & AV_UTF8_FLAG_ACCEPT_SURROGATES)) ret = AVERROR(EILSEQ); if ((code == 0xFFFE || code == 0xFFFF) && !(flags & AV_UTF8_FLAG_ACCEPT_NON_CHARACTERS)) 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 */
devintaietta/Remote-Player-Audio
dipendenze/dacompilare/ffmpeg-2.6.3/libavutil/avstring.c
C
gpl-2.0
10,363
<?php /** * Community Builder (TM) cbconditional Chinese (China) language file Frontend * @version $Id:$ * @copyright (C) 2004-2014 www.joomlapolis.com / Lightning MultiCom SA - and its licensors, all rights reserved * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU/GPL version 2 */ /** * 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 'TAB_CONDITION_PREFERENCES_21582b' => 'Tab condition preferences', 'SELECT_CONDITIONAL_DISPLAY_FOR_THIS_TAB_244679' => 'Select conditional display for this tab.', 'NORMAL_CB_SETTINGS_a0f77c' => 'Normal CB settings', 'TAB_CONDITIONAL_46ba5c' => 'Tab conditional', 'IF_bfa9de' => 'If...', 'SELECT_FIELD_TO_MATCH_VALUE_AGAINST_IN_DETERMINING_c94841' => 'Select field to match value against in determining this tabs display.', 'FIELD_6f16a5' => 'Field', 'VALUE_689202' => 'Value', 'VIEW_ACCESS_LEVELS_c06927' => 'View Access Levels', 'USERGROUPS_6ad0aa' => 'Usergroups', 'FIELDS_a4ca5e' => 'Fields', 'VALUE_f14e9e' => 'Value...', 'INPUT_SUBSTITUTION_SUPPORTED_VALUE_TO_MATCH_AGAINS_4be26b' => '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]).', 'ENABLE_OR_DISABLE_TRANSLATION_OF_LANGUAGE_STRINGS__8263a9' => 'Enable or disable translation of language strings in value.', 'TRANSLATE_VALUE_22a4e1' => 'Translate Value', 'HAS_7bac0f' => 'Has...', 'SELECT_THE_VIEW_ACCESS_LEVELS_TO_MATCH_AGAINST_THE_1c9be8' => '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.', 'SELECT_THE_USERGROUPS_TO_MATCH_AGAINST_THE_USER_TH_dc4e06' => 'Select the usergroups to match against the user. The user only needs to have one of the selected usergroups to match.', 'IS_9149c7' => 'Is...', 'SELECT_OPERATOR_TO_COMPARE_FIELD_VALUE_AGAINST_INP_43ce0f' => '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', 'GREATER_THAN_OR_EQUAL_TO_93301c' => 'Greater Than or Equal To', 'LESS_THAN_OR_EQUAL_TO_3181f2' => 'Less Than or Equal To', 'EMPTY_ce2c8a' => 'Empty', 'NOT_EMPTY_f49248' => 'Not Empty', 'DOES_CONTAIN_396955' => 'Does Contain', 'DOES_NOT_CONTAIN_ef739c' => 'Does Not Contain', 'IS_REGEX_44846d' => 'Is REGEX', 'IS_NOT_REGEX_4bddfd' => 'Is Not REGEX', 'TO_4a384a' => 'To...', 'INPUT_SUBSTITUTION_SUPPORTED_VALUE_TO_MATCH_AGAINS_07c86e' => '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...', 'SELECT_HOW_TO_HANDLE_THIS_TABS_DISPLAY_BASED_ON_FI_ff33e1' => 'Select how to handle this tabs display based on field value match.', 'FOR_0ba2b3' => 'For...', 'ENABLE_OR_DISABLE_CONDITIONAL_USAGE_ON_REGISTRATIO_cb622e' => 'Enable or disable conditional usage on registration.', 'REGISTRATION_0f98b7' => 'Registration', 'ENABLE_OR_DISABLE_CONDITIONAL_USAGE_ON_PROFILE_EDI_5bfd08' => 'Enable or disable conditional usage on profile edit.', 'PROFILE_EDIT_24f0eb' => 'Profile Edit', 'ENABLE_OR_DISABLE_CONDITIONAL_USAGE_ON_PROFILE_VIE_b815a1' => 'Enable or disable conditional usage on profile view.', 'PROFILE_VIEW_307f0e' => 'Profile View', 'FIELD_CONDITION_PREFERENCES_757bb6' => 'Field condition preferences', 'SELECT_CONDITIONAL_DISPLAY_FOR_THIS_FIELD_329dc4' => 'Select conditional display for this field.', 'FIELD_CONDITIONAL_OTHERS_453f6f' => 'Field conditional others', 'FIELD_CONDITIONAL_SELF_281138' => 'Field conditional self', 'SELECT_FIELD_TO_MATCH_VALUE_AGAINST_IN_DETERMINING_7d601b' => 'Select field to match value against in determining this fields display.', 'SELECT_FIELD_24af14' => '--- Select Field ---', 'SELECT_FIELDS_TO_SHOW_IF_VALUE_IS_MATCHED_f63533' => 'Select fields to show if value is matched.', 'SELECT_FIELDS_5be58c' => '--- Select Fields ---', 'SELECT_FIELDS_TO_HIDE_IF_VALUE_IS_MATCHED_e0a204' => 'Select fields to hide if value is matched.', 'FIELD_OPTIONS_9b3c51' => 'Field Options', 'SELECT_FIELD_OPTIONS_TO_SHOW_IF_VALUE_IS_MATCHED_459bc1' => 'Select field options to show if value is matched.', 'SELECT_FIELD_OPTIONS_837903' => '--- Select Field Options ---', 'SELECT_FIELD_OPTIONS_TO_HIDE_IF_VALUE_IS_MATCHED_01f5ab' => 'Select field options to hide if value is matched.', 'SELECT_HOW_TO_HANDLE_THIS_FIELDS_DISPLAY_BASED_ON__32d89f' => 'Select how to handle this fields display based on field value match.', 'ENABLE_OR_DISABLE_CONDITIONAL_USAGE_ON_USERLISTS_S_15983a' => 'Enable or disable conditional usage on userlists searching.', 'USERLISTS_SEARCH_fad6c1' => 'Userlists Search', 'ENABLE_OR_DISABLE_CONDITIONAL_USAGE_ON_USERLISTS_V_a02f8c' => 'Enable or disable conditional usage on userlists view.', 'USERLISTS_VIEW_72449c' => 'Userlists View', 'ENABLE_OR_DISABLE_USAGE_OF_CONDITIONS_IN_BACKEND_0b15b5' => 'Enable or disable usage of conditions in Backend.', 'BACKEND_2e427c' => 'Backend', 'ENABLE_OR_DISABLE_RESET_OF_FIELD_VALUES_TO_BLANK_I_278676' => 'Enable or disable reset of field values to blank if condition is not met.', 'RESET_526d68' => 'Reset', );
bobozhangshao/HeartCare
components/com_comprofiler/plugin/language/zh-cn/cbplugin/cbconditional-language.php
PHP
gpl-2.0
5,636
/* * Copyright (C) 2014 Michael Joyce <[email protected]> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 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; /** * Annotates a DOM with location data during the construction process. * <p> * http://javacoalface.blogspot.ca/2011/04/line-and-column-numbers-in-xml-dom.html * <p> * @author Michael Joyce <[email protected]> */ 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); } } } } }
emmental/isetools
src/main/java/ca/nines/ise/util/LocationAnnotator.java
Java
gpl-2.0
5,912
package net.indrix.arara.servlets.pagination; import java.sql.SQLException; import java.util.List; import net.indrix.arara.dao.DatabaseDownException; public class SoundBySpeciePaginationController extends SoundPaginationController { /** * Creates a new PaginationController 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 SoundBySpeciePaginationController(int soundsPerPage, boolean identification) { super(soundsPerPage, identification); } @Override protected List retrieveAllData() throws DatabaseDownException, SQLException { logger.debug("SoundBySpeciePaginationController.retrieveAllData : retrieving all sounds..."); List listOfSounds = null; if (id != -1){ listOfSounds = model.retrieveIDsForSpecie(getId()); } else { listOfSounds = model.retrieveIDsForSpecieName(getText()); } logger.debug("SoundBySpeciePaginationController.retrieveAllData : " + listOfSounds.size() + " sounds retrieved..."); return listOfSounds; } }
BackupTheBerlios/arara-svn
core/trunk/src/main/java/net/indrix/arara/servlets/pagination/SoundBySpeciePaginationController.java
Java
gpl-2.0
1,289
/* 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 PyEval_ThreadsInitialized() 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 _PyBindGenWrapperFlags { PYBINDGEN_WRAPPER_FLAG_NONE = 0, PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED = (1<<0), } PyBindGenWrapperFlags; #include "ns3/uan-module.h" #include <ostream> #include <sstream> #include <typeinfo> #include <map> #include <iostream> /* --- forward declarations --- */ typedef struct { PyObject_HEAD ns3::Address *obj; PyBindGenWrapperFlags flags:8; } PyNs3Address; extern PyTypeObject *_PyNs3Address_Type; #define PyNs3Address_Type (*_PyNs3Address_Type) extern std::map<void*, PyObject*> *_PyNs3Address_wrapper_registry; #define PyNs3Address_wrapper_registry (*_PyNs3Address_wrapper_registry) typedef struct { PyObject_HEAD ns3::AttributeConstructionList *obj; PyBindGenWrapperFlags flags:8; } PyNs3AttributeConstructionList; extern PyTypeObject *_PyNs3AttributeConstructionList_Type; #define PyNs3AttributeConstructionList_Type (*_PyNs3AttributeConstructionList_Type) extern std::map<void*, PyObject*> *_PyNs3AttributeConstructionList_wrapper_registry; #define PyNs3AttributeConstructionList_wrapper_registry (*_PyNs3AttributeConstructionList_wrapper_registry) typedef struct { PyObject_HEAD ns3::AttributeConstructionList::Item *obj; PyBindGenWrapperFlags flags:8; } PyNs3AttributeConstructionListItem; extern PyTypeObject *_PyNs3AttributeConstructionListItem_Type; #define PyNs3AttributeConstructionListItem_Type (*_PyNs3AttributeConstructionListItem_Type) extern std::map<void*, PyObject*> *_PyNs3AttributeConstructionListItem_wrapper_registry; #define PyNs3AttributeConstructionListItem_wrapper_registry (*_PyNs3AttributeConstructionListItem_wrapper_registry) typedef struct { PyObject_HEAD ns3::Buffer *obj; PyBindGenWrapperFlags flags:8; } PyNs3Buffer; extern PyTypeObject *_PyNs3Buffer_Type; #define PyNs3Buffer_Type (*_PyNs3Buffer_Type) extern std::map<void*, PyObject*> *_PyNs3Buffer_wrapper_registry; #define PyNs3Buffer_wrapper_registry (*_PyNs3Buffer_wrapper_registry) typedef struct { PyObject_HEAD ns3::Buffer::Iterator *obj; PyBindGenWrapperFlags flags:8; } PyNs3BufferIterator; extern PyTypeObject *_PyNs3BufferIterator_Type; #define PyNs3BufferIterator_Type (*_PyNs3BufferIterator_Type) extern std::map<void*, PyObject*> *_PyNs3BufferIterator_wrapper_registry; #define PyNs3BufferIterator_wrapper_registry (*_PyNs3BufferIterator_wrapper_registry) typedef struct { PyObject_HEAD ns3::ByteTagIterator *obj; PyBindGenWrapperFlags flags:8; } PyNs3ByteTagIterator; extern PyTypeObject *_PyNs3ByteTagIterator_Type; #define PyNs3ByteTagIterator_Type (*_PyNs3ByteTagIterator_Type) extern std::map<void*, PyObject*> *_PyNs3ByteTagIterator_wrapper_registry; #define PyNs3ByteTagIterator_wrapper_registry (*_PyNs3ByteTagIterator_wrapper_registry) typedef struct { PyObject_HEAD ns3::ByteTagIterator::Item *obj; PyBindGenWrapperFlags flags:8; } PyNs3ByteTagIteratorItem; extern PyTypeObject *_PyNs3ByteTagIteratorItem_Type; #define PyNs3ByteTagIteratorItem_Type (*_PyNs3ByteTagIteratorItem_Type) extern std::map<void*, PyObject*> *_PyNs3ByteTagIteratorItem_wrapper_registry; #define PyNs3ByteTagIteratorItem_wrapper_registry (*_PyNs3ByteTagIteratorItem_wrapper_registry) typedef struct { PyObject_HEAD ns3::ByteTagList *obj; PyBindGenWrapperFlags flags:8; } PyNs3ByteTagList; extern PyTypeObject *_PyNs3ByteTagList_Type; #define PyNs3ByteTagList_Type (*_PyNs3ByteTagList_Type) extern std::map<void*, PyObject*> *_PyNs3ByteTagList_wrapper_registry; #define PyNs3ByteTagList_wrapper_registry (*_PyNs3ByteTagList_wrapper_registry) typedef struct { PyObject_HEAD ns3::ByteTagList::Iterator *obj; PyBindGenWrapperFlags flags:8; } PyNs3ByteTagListIterator; extern PyTypeObject *_PyNs3ByteTagListIterator_Type; #define PyNs3ByteTagListIterator_Type (*_PyNs3ByteTagListIterator_Type) extern std::map<void*, PyObject*> *_PyNs3ByteTagListIterator_wrapper_registry; #define PyNs3ByteTagListIterator_wrapper_registry (*_PyNs3ByteTagListIterator_wrapper_registry) typedef struct { PyObject_HEAD ns3::ByteTagList::Iterator::Item *obj; PyBindGenWrapperFlags flags:8; } PyNs3ByteTagListIteratorItem; extern PyTypeObject *_PyNs3ByteTagListIteratorItem_Type; #define PyNs3ByteTagListIteratorItem_Type (*_PyNs3ByteTagListIteratorItem_Type) extern std::map<void*, PyObject*> *_PyNs3ByteTagListIteratorItem_wrapper_registry; #define PyNs3ByteTagListIteratorItem_wrapper_registry (*_PyNs3ByteTagListIteratorItem_wrapper_registry) typedef struct { PyObject_HEAD ns3::CallbackBase *obj; PyBindGenWrapperFlags flags:8; } PyNs3CallbackBase; extern PyTypeObject *_PyNs3CallbackBase_Type; #define PyNs3CallbackBase_Type (*_PyNs3CallbackBase_Type) extern std::map<void*, PyObject*> *_PyNs3CallbackBase_wrapper_registry; #define PyNs3CallbackBase_wrapper_registry (*_PyNs3CallbackBase_wrapper_registry) typedef struct { PyObject_HEAD ns3::DeviceEnergyModelContainer *obj; PyBindGenWrapperFlags flags:8; } PyNs3DeviceEnergyModelContainer; extern PyTypeObject *_PyNs3DeviceEnergyModelContainer_Type; #define PyNs3DeviceEnergyModelContainer_Type (*_PyNs3DeviceEnergyModelContainer_Type) extern std::map<void*, PyObject*> *_PyNs3DeviceEnergyModelContainer_wrapper_registry; #define PyNs3DeviceEnergyModelContainer_wrapper_registry (*_PyNs3DeviceEnergyModelContainer_wrapper_registry) typedef struct { PyObject_HEAD ns3::DeviceEnergyModelHelper *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3DeviceEnergyModelHelper; extern PyTypeObject *_PyNs3DeviceEnergyModelHelper_Type; #define PyNs3DeviceEnergyModelHelper_Type (*_PyNs3DeviceEnergyModelHelper_Type) class PyNs3DeviceEnergyModelHelper__PythonHelper : public ns3::DeviceEnergyModelHelper { public: PyObject *m_pyself; void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3DeviceEnergyModelHelper__PythonHelper() { Py_CLEAR(m_pyself); } }; extern std::map<void*, PyObject*> *_PyNs3DeviceEnergyModelHelper_wrapper_registry; #define PyNs3DeviceEnergyModelHelper_wrapper_registry (*_PyNs3DeviceEnergyModelHelper_wrapper_registry) typedef struct { PyObject_HEAD ns3::EnergySourceHelper *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3EnergySourceHelper; extern PyTypeObject *_PyNs3EnergySourceHelper_Type; #define PyNs3EnergySourceHelper_Type (*_PyNs3EnergySourceHelper_Type) class PyNs3EnergySourceHelper__PythonHelper : public ns3::EnergySourceHelper { public: PyObject *m_pyself; void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3EnergySourceHelper__PythonHelper() { Py_CLEAR(m_pyself); } }; extern std::map<void*, PyObject*> *_PyNs3EnergySourceHelper_wrapper_registry; #define PyNs3EnergySourceHelper_wrapper_registry (*_PyNs3EnergySourceHelper_wrapper_registry) typedef struct { PyObject_HEAD ns3::EventId *obj; PyBindGenWrapperFlags flags:8; } PyNs3EventId; extern PyTypeObject *_PyNs3EventId_Type; #define PyNs3EventId_Type (*_PyNs3EventId_Type) extern std::map<void*, PyObject*> *_PyNs3EventId_wrapper_registry; #define PyNs3EventId_wrapper_registry (*_PyNs3EventId_wrapper_registry) typedef struct { PyObject_HEAD ns3::Ipv4Address *obj; PyBindGenWrapperFlags flags:8; } PyNs3Ipv4Address; extern PyTypeObject *_PyNs3Ipv4Address_Type; #define PyNs3Ipv4Address_Type (*_PyNs3Ipv4Address_Type) extern std::map<void*, PyObject*> *_PyNs3Ipv4Address_wrapper_registry; #define PyNs3Ipv4Address_wrapper_registry (*_PyNs3Ipv4Address_wrapper_registry) typedef struct { PyObject_HEAD ns3::Ipv4Mask *obj; PyBindGenWrapperFlags flags:8; } PyNs3Ipv4Mask; extern PyTypeObject *_PyNs3Ipv4Mask_Type; #define PyNs3Ipv4Mask_Type (*_PyNs3Ipv4Mask_Type) extern std::map<void*, PyObject*> *_PyNs3Ipv4Mask_wrapper_registry; #define PyNs3Ipv4Mask_wrapper_registry (*_PyNs3Ipv4Mask_wrapper_registry) typedef struct { PyObject_HEAD ns3::Ipv6Address *obj; PyBindGenWrapperFlags flags:8; } PyNs3Ipv6Address; extern PyTypeObject *_PyNs3Ipv6Address_Type; #define PyNs3Ipv6Address_Type (*_PyNs3Ipv6Address_Type) extern std::map<void*, PyObject*> *_PyNs3Ipv6Address_wrapper_registry; #define PyNs3Ipv6Address_wrapper_registry (*_PyNs3Ipv6Address_wrapper_registry) typedef struct { PyObject_HEAD ns3::Ipv6Prefix *obj; PyBindGenWrapperFlags flags:8; } PyNs3Ipv6Prefix; extern PyTypeObject *_PyNs3Ipv6Prefix_Type; #define PyNs3Ipv6Prefix_Type (*_PyNs3Ipv6Prefix_Type) extern std::map<void*, PyObject*> *_PyNs3Ipv6Prefix_wrapper_registry; #define PyNs3Ipv6Prefix_wrapper_registry (*_PyNs3Ipv6Prefix_wrapper_registry) typedef struct { PyObject_HEAD ns3::NetDeviceContainer *obj; PyBindGenWrapperFlags flags:8; } PyNs3NetDeviceContainer; extern PyTypeObject *_PyNs3NetDeviceContainer_Type; #define PyNs3NetDeviceContainer_Type (*_PyNs3NetDeviceContainer_Type) extern std::map<void*, PyObject*> *_PyNs3NetDeviceContainer_wrapper_registry; #define PyNs3NetDeviceContainer_wrapper_registry (*_PyNs3NetDeviceContainer_wrapper_registry) typedef struct { PyObject_HEAD ns3::NodeContainer *obj; PyBindGenWrapperFlags flags:8; } PyNs3NodeContainer; extern PyTypeObject *_PyNs3NodeContainer_Type; #define PyNs3NodeContainer_Type (*_PyNs3NodeContainer_Type) extern std::map<void*, PyObject*> *_PyNs3NodeContainer_wrapper_registry; #define PyNs3NodeContainer_wrapper_registry (*_PyNs3NodeContainer_wrapper_registry) typedef struct { PyObject_HEAD ns3::ObjectBase *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3ObjectBase; extern PyTypeObject *_PyNs3ObjectBase_Type; #define PyNs3ObjectBase_Type (*_PyNs3ObjectBase_Type) class PyNs3ObjectBase__PythonHelper : public ns3::ObjectBase { public: PyObject *m_pyself; void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3ObjectBase__PythonHelper() { Py_CLEAR(m_pyself); } }; extern std::map<void*, PyObject*> *_PyNs3ObjectBase_wrapper_registry; #define PyNs3ObjectBase_wrapper_registry (*_PyNs3ObjectBase_wrapper_registry) typedef struct { PyObject_HEAD ns3::ObjectDeleter *obj; PyBindGenWrapperFlags flags:8; } PyNs3ObjectDeleter; extern PyTypeObject *_PyNs3ObjectDeleter_Type; #define PyNs3ObjectDeleter_Type (*_PyNs3ObjectDeleter_Type) extern std::map<void*, PyObject*> *_PyNs3ObjectDeleter_wrapper_registry; #define PyNs3ObjectDeleter_wrapper_registry (*_PyNs3ObjectDeleter_wrapper_registry) typedef struct { PyObject_HEAD ns3::ObjectFactory *obj; PyBindGenWrapperFlags flags:8; } PyNs3ObjectFactory; extern PyTypeObject *_PyNs3ObjectFactory_Type; #define PyNs3ObjectFactory_Type (*_PyNs3ObjectFactory_Type) extern std::map<void*, PyObject*> *_PyNs3ObjectFactory_wrapper_registry; #define PyNs3ObjectFactory_wrapper_registry (*_PyNs3ObjectFactory_wrapper_registry) typedef struct { PyObject_HEAD ns3::PacketMetadata *obj; PyBindGenWrapperFlags flags:8; } PyNs3PacketMetadata; extern PyTypeObject *_PyNs3PacketMetadata_Type; #define PyNs3PacketMetadata_Type (*_PyNs3PacketMetadata_Type) extern std::map<void*, PyObject*> *_PyNs3PacketMetadata_wrapper_registry; #define PyNs3PacketMetadata_wrapper_registry (*_PyNs3PacketMetadata_wrapper_registry) typedef struct { PyObject_HEAD ns3::PacketMetadata::Item *obj; PyBindGenWrapperFlags flags:8; } PyNs3PacketMetadataItem; extern PyTypeObject *_PyNs3PacketMetadataItem_Type; #define PyNs3PacketMetadataItem_Type (*_PyNs3PacketMetadataItem_Type) extern std::map<void*, PyObject*> *_PyNs3PacketMetadataItem_wrapper_registry; #define PyNs3PacketMetadataItem_wrapper_registry (*_PyNs3PacketMetadataItem_wrapper_registry) typedef struct { PyObject_HEAD ns3::PacketMetadata::ItemIterator *obj; PyBindGenWrapperFlags flags:8; } PyNs3PacketMetadataItemIterator; extern PyTypeObject *_PyNs3PacketMetadataItemIterator_Type; #define PyNs3PacketMetadataItemIterator_Type (*_PyNs3PacketMetadataItemIterator_Type) extern std::map<void*, PyObject*> *_PyNs3PacketMetadataItemIterator_wrapper_registry; #define PyNs3PacketMetadataItemIterator_wrapper_registry (*_PyNs3PacketMetadataItemIterator_wrapper_registry) typedef struct { PyObject_HEAD ns3::PacketTagIterator *obj; PyBindGenWrapperFlags flags:8; } PyNs3PacketTagIterator; extern PyTypeObject *_PyNs3PacketTagIterator_Type; #define PyNs3PacketTagIterator_Type (*_PyNs3PacketTagIterator_Type) extern std::map<void*, PyObject*> *_PyNs3PacketTagIterator_wrapper_registry; #define PyNs3PacketTagIterator_wrapper_registry (*_PyNs3PacketTagIterator_wrapper_registry) typedef struct { PyObject_HEAD ns3::PacketTagIterator::Item *obj; PyBindGenWrapperFlags flags:8; } PyNs3PacketTagIteratorItem; extern PyTypeObject *_PyNs3PacketTagIteratorItem_Type; #define PyNs3PacketTagIteratorItem_Type (*_PyNs3PacketTagIteratorItem_Type) extern std::map<void*, PyObject*> *_PyNs3PacketTagIteratorItem_wrapper_registry; #define PyNs3PacketTagIteratorItem_wrapper_registry (*_PyNs3PacketTagIteratorItem_wrapper_registry) typedef struct { PyObject_HEAD ns3::PacketTagList *obj; PyBindGenWrapperFlags flags:8; } PyNs3PacketTagList; extern PyTypeObject *_PyNs3PacketTagList_Type; #define PyNs3PacketTagList_Type (*_PyNs3PacketTagList_Type) extern std::map<void*, PyObject*> *_PyNs3PacketTagList_wrapper_registry; #define PyNs3PacketTagList_wrapper_registry (*_PyNs3PacketTagList_wrapper_registry) typedef struct { PyObject_HEAD ns3::PacketTagList::TagData *obj; PyBindGenWrapperFlags flags:8; } PyNs3PacketTagListTagData; extern PyTypeObject *_PyNs3PacketTagListTagData_Type; #define PyNs3PacketTagListTagData_Type (*_PyNs3PacketTagListTagData_Type) extern std::map<void*, PyObject*> *_PyNs3PacketTagListTagData_wrapper_registry; #define PyNs3PacketTagListTagData_wrapper_registry (*_PyNs3PacketTagListTagData_wrapper_registry) typedef struct { PyObject_HEAD ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter > *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter; extern PyTypeObject *_PyNs3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_Type; #define PyNs3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_Type (*_PyNs3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_Type) #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::__si_class_type_info *_typeinfo = dynamic_cast<const abi::__si_class_type_info*> (&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::__si_class_type_info*> (_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 *_PyNs3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter__typeid_map; #define PyNs3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter__typeid_map (*_PyNs3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter__typeid_map) typedef struct { PyObject_HEAD ns3::Simulator *obj; PyBindGenWrapperFlags flags:8; } PyNs3Simulator; extern PyTypeObject *_PyNs3Simulator_Type; #define PyNs3Simulator_Type (*_PyNs3Simulator_Type) extern std::map<void*, PyObject*> *_PyNs3Simulator_wrapper_registry; #define PyNs3Simulator_wrapper_registry (*_PyNs3Simulator_wrapper_registry) typedef struct { PyObject_HEAD ns3::Tag *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3Tag; extern PyTypeObject *_PyNs3Tag_Type; #define PyNs3Tag_Type (*_PyNs3Tag_Type) typedef struct { PyObject_HEAD ns3::TagBuffer *obj; PyBindGenWrapperFlags flags:8; } PyNs3TagBuffer; extern PyTypeObject *_PyNs3TagBuffer_Type; #define PyNs3TagBuffer_Type (*_PyNs3TagBuffer_Type) extern std::map<void*, PyObject*> *_PyNs3TagBuffer_wrapper_registry; #define PyNs3TagBuffer_wrapper_registry (*_PyNs3TagBuffer_wrapper_registry) typedef struct { PyObject_HEAD ns3::TracedValue< double > *obj; PyBindGenWrapperFlags flags:8; } PyNs3TracedValue__Double; extern PyTypeObject *_PyNs3TracedValue__Double_Type; #define PyNs3TracedValue__Double_Type (*_PyNs3TracedValue__Double_Type) extern std::map<void*, PyObject*> *_PyNs3TracedValue__Double_wrapper_registry; #define PyNs3TracedValue__Double_wrapper_registry (*_PyNs3TracedValue__Double_wrapper_registry) typedef struct { PyObject_HEAD ns3::TypeId *obj; PyBindGenWrapperFlags flags:8; } PyNs3TypeId; extern PyTypeObject *_PyNs3TypeId_Type; #define PyNs3TypeId_Type (*_PyNs3TypeId_Type) extern std::map<void*, PyObject*> *_PyNs3TypeId_wrapper_registry; #define PyNs3TypeId_wrapper_registry (*_PyNs3TypeId_wrapper_registry) typedef struct { PyObject_HEAD ns3::TypeId::AttributeInformation *obj; PyBindGenWrapperFlags flags:8; } PyNs3TypeIdAttributeInformation; extern PyTypeObject *_PyNs3TypeIdAttributeInformation_Type; #define PyNs3TypeIdAttributeInformation_Type (*_PyNs3TypeIdAttributeInformation_Type) extern std::map<void*, PyObject*> *_PyNs3TypeIdAttributeInformation_wrapper_registry; #define PyNs3TypeIdAttributeInformation_wrapper_registry (*_PyNs3TypeIdAttributeInformation_wrapper_registry) typedef struct { PyObject_HEAD ns3::TypeId::TraceSourceInformation *obj; PyBindGenWrapperFlags flags:8; } PyNs3TypeIdTraceSourceInformation; extern PyTypeObject *_PyNs3TypeIdTraceSourceInformation_Type; #define PyNs3TypeIdTraceSourceInformation_Type (*_PyNs3TypeIdTraceSourceInformation_Type) extern std::map<void*, PyObject*> *_PyNs3TypeIdTraceSourceInformation_wrapper_registry; #define PyNs3TypeIdTraceSourceInformation_wrapper_registry (*_PyNs3TypeIdTraceSourceInformation_wrapper_registry) typedef struct { PyObject_HEAD ns3::Vector2D *obj; PyBindGenWrapperFlags flags:8; } PyNs3Vector2D; extern PyTypeObject *_PyNs3Vector2D_Type; #define PyNs3Vector2D_Type (*_PyNs3Vector2D_Type) extern std::map<void*, PyObject*> *_PyNs3Vector2D_wrapper_registry; #define PyNs3Vector2D_wrapper_registry (*_PyNs3Vector2D_wrapper_registry) typedef struct { PyObject_HEAD ns3::Vector3D *obj; PyBindGenWrapperFlags flags:8; } PyNs3Vector3D; extern PyTypeObject *_PyNs3Vector3D_Type; #define PyNs3Vector3D_Type (*_PyNs3Vector3D_Type) extern std::map<void*, PyObject*> *_PyNs3Vector3D_wrapper_registry; #define PyNs3Vector3D_wrapper_registry (*_PyNs3Vector3D_wrapper_registry) typedef struct { PyObject_HEAD ns3::empty *obj; PyBindGenWrapperFlags flags:8; } PyNs3Empty; extern PyTypeObject *_PyNs3Empty_Type; #define PyNs3Empty_Type (*_PyNs3Empty_Type) extern std::map<void*, PyObject*> *_PyNs3Empty_wrapper_registry; #define PyNs3Empty_wrapper_registry (*_PyNs3Empty_wrapper_registry) typedef struct { PyObject_HEAD ns3::int64x64_t *obj; PyBindGenWrapperFlags flags:8; } PyNs3Int64x64_t; extern PyTypeObject *_PyNs3Int64x64_t_Type; #define PyNs3Int64x64_t_Type (*_PyNs3Int64x64_t_Type) extern std::map<void*, PyObject*> *_PyNs3Int64x64_t_wrapper_registry; #define PyNs3Int64x64_t_wrapper_registry (*_PyNs3Int64x64_t_wrapper_registry) typedef struct { PyObject_HEAD ns3::Chunk *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3Chunk; extern PyTypeObject *_PyNs3Chunk_Type; #define PyNs3Chunk_Type (*_PyNs3Chunk_Type) typedef struct { PyObject_HEAD ns3::Header *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3Header; extern PyTypeObject *_PyNs3Header_Type; #define PyNs3Header_Type (*_PyNs3Header_Type) typedef struct { PyObject_HEAD ns3::Object *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3Object; extern PyTypeObject *_PyNs3Object_Type; #define PyNs3Object_Type (*_PyNs3Object_Type) class PyNs3Object__PythonHelper : public ns3::Object { public: PyObject *m_pyself; void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3Object__PythonHelper() { Py_CLEAR(m_pyself); } }; typedef struct { PyObject_HEAD ns3::Object::AggregateIterator *obj; PyBindGenWrapperFlags flags:8; } PyNs3ObjectAggregateIterator; extern PyTypeObject *_PyNs3ObjectAggregateIterator_Type; #define PyNs3ObjectAggregateIterator_Type (*_PyNs3ObjectAggregateIterator_Type) extern std::map<void*, PyObject*> *_PyNs3ObjectAggregateIterator_wrapper_registry; #define PyNs3ObjectAggregateIterator_wrapper_registry (*_PyNs3ObjectAggregateIterator_wrapper_registry) typedef struct { PyObject_HEAD ns3::RandomVariableStream *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3RandomVariableStream; extern PyTypeObject *_PyNs3RandomVariableStream_Type; #define PyNs3RandomVariableStream_Type (*_PyNs3RandomVariableStream_Type) class PyNs3RandomVariableStream__PythonHelper : public ns3::RandomVariableStream { public: PyObject *m_pyself; void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3RandomVariableStream__PythonHelper() { Py_CLEAR(m_pyself); } }; typedef struct { PyObject_HEAD ns3::SequentialRandomVariable *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3SequentialRandomVariable; extern PyTypeObject *_PyNs3SequentialRandomVariable_Type; #define PyNs3SequentialRandomVariable_Type (*_PyNs3SequentialRandomVariable_Type) class PyNs3SequentialRandomVariable__PythonHelper : public ns3::SequentialRandomVariable { public: PyObject *m_pyself; void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3SequentialRandomVariable__PythonHelper() { Py_CLEAR(m_pyself); } }; typedef struct { PyObject_HEAD ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > *obj; PyBindGenWrapperFlags 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; PyBindGenWrapperFlags 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; PyBindGenWrapperFlags 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; PyBindGenWrapperFlags 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; PyBindGenWrapperFlags 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; PyBindGenWrapperFlags 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; PyBindGenWrapperFlags flags:8; } PyNs3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt__; 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; PyBindGenWrapperFlags 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; PyBindGenWrapperFlags flags:8; } PyNs3Time; extern PyTypeObject *_PyNs3Time_Type; #define PyNs3Time_Type (*_PyNs3Time_Type) extern std::map<void*, PyObject*> *_PyNs3Time_wrapper_registry; #define PyNs3Time_wrapper_registry (*_PyNs3Time_wrapper_registry) typedef struct { PyObject_HEAD ns3::TraceSourceAccessor *obj; PyBindGenWrapperFlags flags:8; } PyNs3TraceSourceAccessor; extern PyTypeObject *_PyNs3TraceSourceAccessor_Type; #define PyNs3TraceSourceAccessor_Type (*_PyNs3TraceSourceAccessor_Type) typedef struct { PyObject_HEAD ns3::Trailer *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3Trailer; extern PyTypeObject *_PyNs3Trailer_Type; #define PyNs3Trailer_Type (*_PyNs3Trailer_Type) typedef struct { PyObject_HEAD ns3::TriangularRandomVariable *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3TriangularRandomVariable; extern PyTypeObject *_PyNs3TriangularRandomVariable_Type; #define PyNs3TriangularRandomVariable_Type (*_PyNs3TriangularRandomVariable_Type) class PyNs3TriangularRandomVariable__PythonHelper : public ns3::TriangularRandomVariable { public: PyObject *m_pyself; void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3TriangularRandomVariable__PythonHelper() { Py_CLEAR(m_pyself); } }; typedef struct { PyObject_HEAD ns3::UniformRandomVariable *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UniformRandomVariable; extern PyTypeObject *_PyNs3UniformRandomVariable_Type; #define PyNs3UniformRandomVariable_Type (*_PyNs3UniformRandomVariable_Type) class PyNs3UniformRandomVariable__PythonHelper : public ns3::UniformRandomVariable { public: PyObject *m_pyself; void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3UniformRandomVariable__PythonHelper() { Py_CLEAR(m_pyself); } }; typedef struct { PyObject_HEAD ns3::WeibullRandomVariable *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3WeibullRandomVariable; extern PyTypeObject *_PyNs3WeibullRandomVariable_Type; #define PyNs3WeibullRandomVariable_Type (*_PyNs3WeibullRandomVariable_Type) class PyNs3WeibullRandomVariable__PythonHelper : public ns3::WeibullRandomVariable { public: PyObject *m_pyself; void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3WeibullRandomVariable__PythonHelper() { Py_CLEAR(m_pyself); } }; typedef struct { PyObject_HEAD ns3::ZetaRandomVariable *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3ZetaRandomVariable; extern PyTypeObject *_PyNs3ZetaRandomVariable_Type; #define PyNs3ZetaRandomVariable_Type (*_PyNs3ZetaRandomVariable_Type) class PyNs3ZetaRandomVariable__PythonHelper : public ns3::ZetaRandomVariable { public: PyObject *m_pyself; void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3ZetaRandomVariable__PythonHelper() { Py_CLEAR(m_pyself); } }; typedef struct { PyObject_HEAD ns3::ZipfRandomVariable *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3ZipfRandomVariable; extern PyTypeObject *_PyNs3ZipfRandomVariable_Type; #define PyNs3ZipfRandomVariable_Type (*_PyNs3ZipfRandomVariable_Type) class PyNs3ZipfRandomVariable__PythonHelper : public ns3::ZipfRandomVariable { public: PyObject *m_pyself; void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3ZipfRandomVariable__PythonHelper() { Py_CLEAR(m_pyself); } }; typedef struct { PyObject_HEAD ns3::AttributeAccessor *obj; PyBindGenWrapperFlags flags:8; } PyNs3AttributeAccessor; extern PyTypeObject *_PyNs3AttributeAccessor_Type; #define PyNs3AttributeAccessor_Type (*_PyNs3AttributeAccessor_Type) typedef struct { PyObject_HEAD ns3::AttributeChecker *obj; PyBindGenWrapperFlags flags:8; } PyNs3AttributeChecker; extern PyTypeObject *_PyNs3AttributeChecker_Type; #define PyNs3AttributeChecker_Type (*_PyNs3AttributeChecker_Type) typedef struct { PyObject_HEAD ns3::AttributeValue *obj; PyBindGenWrapperFlags flags:8; } PyNs3AttributeValue; extern PyTypeObject *_PyNs3AttributeValue_Type; #define PyNs3AttributeValue_Type (*_PyNs3AttributeValue_Type) typedef struct { PyObject_HEAD ns3::BooleanChecker *obj; PyBindGenWrapperFlags flags:8; } PyNs3BooleanChecker; extern PyTypeObject *_PyNs3BooleanChecker_Type; #define PyNs3BooleanChecker_Type (*_PyNs3BooleanChecker_Type) typedef struct { PyObject_HEAD ns3::BooleanValue *obj; PyBindGenWrapperFlags flags:8; } PyNs3BooleanValue; extern PyTypeObject *_PyNs3BooleanValue_Type; #define PyNs3BooleanValue_Type (*_PyNs3BooleanValue_Type) typedef struct { PyObject_HEAD ns3::CallbackChecker *obj; PyBindGenWrapperFlags flags:8; } PyNs3CallbackChecker; extern PyTypeObject *_PyNs3CallbackChecker_Type; #define PyNs3CallbackChecker_Type (*_PyNs3CallbackChecker_Type) typedef struct { PyObject_HEAD ns3::CallbackImplBase *obj; PyBindGenWrapperFlags flags:8; } PyNs3CallbackImplBase; extern PyTypeObject *_PyNs3CallbackImplBase_Type; #define PyNs3CallbackImplBase_Type (*_PyNs3CallbackImplBase_Type) typedef struct { PyObject_HEAD ns3::CallbackValue *obj; PyBindGenWrapperFlags flags:8; } PyNs3CallbackValue; extern PyTypeObject *_PyNs3CallbackValue_Type; #define PyNs3CallbackValue_Type (*_PyNs3CallbackValue_Type) typedef struct { PyObject_HEAD ns3::Channel *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3Channel; extern PyTypeObject *_PyNs3Channel_Type; #define PyNs3Channel_Type (*_PyNs3Channel_Type) class PyNs3Channel__PythonHelper : public ns3::Channel { public: PyObject *m_pyself; void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3Channel__PythonHelper() { Py_CLEAR(m_pyself); } }; typedef struct { PyObject_HEAD ns3::ConstantRandomVariable *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3ConstantRandomVariable; extern PyTypeObject *_PyNs3ConstantRandomVariable_Type; #define PyNs3ConstantRandomVariable_Type (*_PyNs3ConstantRandomVariable_Type) class PyNs3ConstantRandomVariable__PythonHelper : public ns3::ConstantRandomVariable { public: PyObject *m_pyself; void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3ConstantRandomVariable__PythonHelper() { Py_CLEAR(m_pyself); } }; typedef struct { PyObject_HEAD ns3::DeterministicRandomVariable *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3DeterministicRandomVariable; extern PyTypeObject *_PyNs3DeterministicRandomVariable_Type; #define PyNs3DeterministicRandomVariable_Type (*_PyNs3DeterministicRandomVariable_Type) class PyNs3DeterministicRandomVariable__PythonHelper : public ns3::DeterministicRandomVariable { public: PyObject *m_pyself; void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3DeterministicRandomVariable__PythonHelper() { Py_CLEAR(m_pyself); } }; typedef struct { PyObject_HEAD ns3::DeviceEnergyModel *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3DeviceEnergyModel; extern PyTypeObject *_PyNs3DeviceEnergyModel_Type; #define PyNs3DeviceEnergyModel_Type (*_PyNs3DeviceEnergyModel_Type) class PyNs3DeviceEnergyModel__PythonHelper : public ns3::DeviceEnergyModel { public: PyObject *m_pyself; void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3DeviceEnergyModel__PythonHelper() { Py_CLEAR(m_pyself); } }; typedef struct { PyObject_HEAD ns3::DoubleValue *obj; PyBindGenWrapperFlags flags:8; } PyNs3DoubleValue; extern PyTypeObject *_PyNs3DoubleValue_Type; #define PyNs3DoubleValue_Type (*_PyNs3DoubleValue_Type) typedef struct { PyObject_HEAD ns3::EmpiricalRandomVariable *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3EmpiricalRandomVariable; extern PyTypeObject *_PyNs3EmpiricalRandomVariable_Type; #define PyNs3EmpiricalRandomVariable_Type (*_PyNs3EmpiricalRandomVariable_Type) class PyNs3EmpiricalRandomVariable__PythonHelper : public ns3::EmpiricalRandomVariable { public: PyObject *m_pyself; void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3EmpiricalRandomVariable__PythonHelper() { Py_CLEAR(m_pyself); } }; typedef struct { PyObject_HEAD ns3::EmptyAttributeValue *obj; PyBindGenWrapperFlags flags:8; } PyNs3EmptyAttributeValue; extern PyTypeObject *_PyNs3EmptyAttributeValue_Type; #define PyNs3EmptyAttributeValue_Type (*_PyNs3EmptyAttributeValue_Type) typedef struct { PyObject_HEAD ns3::EnergySource *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3EnergySource; extern PyTypeObject *_PyNs3EnergySource_Type; #define PyNs3EnergySource_Type (*_PyNs3EnergySource_Type) class PyNs3EnergySource__PythonHelper : public ns3::EnergySource { public: PyObject *m_pyself; void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3EnergySource__PythonHelper() { Py_CLEAR(m_pyself); } }; typedef struct { PyObject_HEAD ns3::EnergySourceContainer *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3EnergySourceContainer; extern PyTypeObject *_PyNs3EnergySourceContainer_Type; #define PyNs3EnergySourceContainer_Type (*_PyNs3EnergySourceContainer_Type) class PyNs3EnergySourceContainer__PythonHelper : public ns3::EnergySourceContainer { public: PyObject *m_pyself; void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3EnergySourceContainer__PythonHelper() { Py_CLEAR(m_pyself); } }; typedef struct { PyObject_HEAD ns3::EnumChecker *obj; PyBindGenWrapperFlags flags:8; } PyNs3EnumChecker; extern PyTypeObject *_PyNs3EnumChecker_Type; #define PyNs3EnumChecker_Type (*_PyNs3EnumChecker_Type) typedef struct { PyObject_HEAD ns3::EnumValue *obj; PyBindGenWrapperFlags flags:8; } PyNs3EnumValue; extern PyTypeObject *_PyNs3EnumValue_Type; #define PyNs3EnumValue_Type (*_PyNs3EnumValue_Type) typedef struct { PyObject_HEAD ns3::ErlangRandomVariable *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3ErlangRandomVariable; extern PyTypeObject *_PyNs3ErlangRandomVariable_Type; #define PyNs3ErlangRandomVariable_Type (*_PyNs3ErlangRandomVariable_Type) class PyNs3ErlangRandomVariable__PythonHelper : public ns3::ErlangRandomVariable { public: PyObject *m_pyself; void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3ErlangRandomVariable__PythonHelper() { Py_CLEAR(m_pyself); } }; typedef struct { PyObject_HEAD ns3::EventImpl *obj; PyBindGenWrapperFlags flags:8; } PyNs3EventImpl; extern PyTypeObject *_PyNs3EventImpl_Type; #define PyNs3EventImpl_Type (*_PyNs3EventImpl_Type) typedef struct { PyObject_HEAD ns3::ExponentialRandomVariable *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3ExponentialRandomVariable; extern PyTypeObject *_PyNs3ExponentialRandomVariable_Type; #define PyNs3ExponentialRandomVariable_Type (*_PyNs3ExponentialRandomVariable_Type) class PyNs3ExponentialRandomVariable__PythonHelper : public ns3::ExponentialRandomVariable { public: PyObject *m_pyself; void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3ExponentialRandomVariable__PythonHelper() { Py_CLEAR(m_pyself); } }; typedef struct { PyObject_HEAD ns3::GammaRandomVariable *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3GammaRandomVariable; extern PyTypeObject *_PyNs3GammaRandomVariable_Type; #define PyNs3GammaRandomVariable_Type (*_PyNs3GammaRandomVariable_Type) class PyNs3GammaRandomVariable__PythonHelper : public ns3::GammaRandomVariable { public: PyObject *m_pyself; void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3GammaRandomVariable__PythonHelper() { Py_CLEAR(m_pyself); } }; typedef struct { PyObject_HEAD ns3::IntegerValue *obj; PyBindGenWrapperFlags flags:8; } PyNs3IntegerValue; extern PyTypeObject *_PyNs3IntegerValue_Type; #define PyNs3IntegerValue_Type (*_PyNs3IntegerValue_Type) typedef struct { PyObject_HEAD ns3::Ipv4AddressChecker *obj; PyBindGenWrapperFlags flags:8; } PyNs3Ipv4AddressChecker; extern PyTypeObject *_PyNs3Ipv4AddressChecker_Type; #define PyNs3Ipv4AddressChecker_Type (*_PyNs3Ipv4AddressChecker_Type) typedef struct { PyObject_HEAD ns3::Ipv4AddressValue *obj; PyBindGenWrapperFlags flags:8; } PyNs3Ipv4AddressValue; extern PyTypeObject *_PyNs3Ipv4AddressValue_Type; #define PyNs3Ipv4AddressValue_Type (*_PyNs3Ipv4AddressValue_Type) typedef struct { PyObject_HEAD ns3::Ipv4MaskChecker *obj; PyBindGenWrapperFlags flags:8; } PyNs3Ipv4MaskChecker; extern PyTypeObject *_PyNs3Ipv4MaskChecker_Type; #define PyNs3Ipv4MaskChecker_Type (*_PyNs3Ipv4MaskChecker_Type) typedef struct { PyObject_HEAD ns3::Ipv4MaskValue *obj; PyBindGenWrapperFlags flags:8; } PyNs3Ipv4MaskValue; extern PyTypeObject *_PyNs3Ipv4MaskValue_Type; #define PyNs3Ipv4MaskValue_Type (*_PyNs3Ipv4MaskValue_Type) typedef struct { PyObject_HEAD ns3::Ipv6AddressChecker *obj; PyBindGenWrapperFlags flags:8; } PyNs3Ipv6AddressChecker; extern PyTypeObject *_PyNs3Ipv6AddressChecker_Type; #define PyNs3Ipv6AddressChecker_Type (*_PyNs3Ipv6AddressChecker_Type) typedef struct { PyObject_HEAD ns3::Ipv6AddressValue *obj; PyBindGenWrapperFlags flags:8; } PyNs3Ipv6AddressValue; extern PyTypeObject *_PyNs3Ipv6AddressValue_Type; #define PyNs3Ipv6AddressValue_Type (*_PyNs3Ipv6AddressValue_Type) typedef struct { PyObject_HEAD ns3::Ipv6PrefixChecker *obj; PyBindGenWrapperFlags flags:8; } PyNs3Ipv6PrefixChecker; extern PyTypeObject *_PyNs3Ipv6PrefixChecker_Type; #define PyNs3Ipv6PrefixChecker_Type (*_PyNs3Ipv6PrefixChecker_Type) typedef struct { PyObject_HEAD ns3::Ipv6PrefixValue *obj; PyBindGenWrapperFlags flags:8; } PyNs3Ipv6PrefixValue; extern PyTypeObject *_PyNs3Ipv6PrefixValue_Type; #define PyNs3Ipv6PrefixValue_Type (*_PyNs3Ipv6PrefixValue_Type) typedef struct { PyObject_HEAD ns3::LogNormalRandomVariable *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3LogNormalRandomVariable; extern PyTypeObject *_PyNs3LogNormalRandomVariable_Type; #define PyNs3LogNormalRandomVariable_Type (*_PyNs3LogNormalRandomVariable_Type) class PyNs3LogNormalRandomVariable__PythonHelper : public ns3::LogNormalRandomVariable { public: PyObject *m_pyself; void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3LogNormalRandomVariable__PythonHelper() { Py_CLEAR(m_pyself); } }; typedef struct { PyObject_HEAD ns3::MobilityModel *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3MobilityModel; extern PyTypeObject *_PyNs3MobilityModel_Type; #define PyNs3MobilityModel_Type (*_PyNs3MobilityModel_Type) class PyNs3MobilityModel__PythonHelper : public ns3::MobilityModel { public: PyObject *m_pyself; void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3MobilityModel__PythonHelper() { Py_CLEAR(m_pyself); } }; typedef struct { PyObject_HEAD ns3::NetDevice *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3NetDevice; extern PyTypeObject *_PyNs3NetDevice_Type; #define PyNs3NetDevice_Type (*_PyNs3NetDevice_Type) typedef struct { PyObject_HEAD ns3::NixVector *obj; PyBindGenWrapperFlags flags:8; } PyNs3NixVector; extern PyTypeObject *_PyNs3NixVector_Type; #define PyNs3NixVector_Type (*_PyNs3NixVector_Type) typedef struct { PyObject_HEAD ns3::Node *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3Node; extern PyTypeObject *_PyNs3Node_Type; #define PyNs3Node_Type (*_PyNs3Node_Type) class PyNs3Node__PythonHelper : public ns3::Node { public: PyObject *m_pyself; void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3Node__PythonHelper() { Py_CLEAR(m_pyself); } }; typedef struct { PyObject_HEAD ns3::NormalRandomVariable *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3NormalRandomVariable; extern PyTypeObject *_PyNs3NormalRandomVariable_Type; #define PyNs3NormalRandomVariable_Type (*_PyNs3NormalRandomVariable_Type) class PyNs3NormalRandomVariable__PythonHelper : public ns3::NormalRandomVariable { public: PyObject *m_pyself; void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3NormalRandomVariable__PythonHelper() { Py_CLEAR(m_pyself); } }; typedef struct { PyObject_HEAD ns3::ObjectFactoryChecker *obj; PyBindGenWrapperFlags flags:8; } PyNs3ObjectFactoryChecker; extern PyTypeObject *_PyNs3ObjectFactoryChecker_Type; #define PyNs3ObjectFactoryChecker_Type (*_PyNs3ObjectFactoryChecker_Type) typedef struct { PyObject_HEAD ns3::ObjectFactoryValue *obj; PyBindGenWrapperFlags flags:8; } PyNs3ObjectFactoryValue; extern PyTypeObject *_PyNs3ObjectFactoryValue_Type; #define PyNs3ObjectFactoryValue_Type (*_PyNs3ObjectFactoryValue_Type) typedef struct { PyObject_HEAD ns3::Packet *obj; PyBindGenWrapperFlags flags:8; } PyNs3Packet; extern PyTypeObject *_PyNs3Packet_Type; #define PyNs3Packet_Type (*_PyNs3Packet_Type) typedef struct { PyObject_HEAD ns3::ParetoRandomVariable *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3ParetoRandomVariable; extern PyTypeObject *_PyNs3ParetoRandomVariable_Type; #define PyNs3ParetoRandomVariable_Type (*_PyNs3ParetoRandomVariable_Type) class PyNs3ParetoRandomVariable__PythonHelper : public ns3::ParetoRandomVariable { public: PyObject *m_pyself; void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3ParetoRandomVariable__PythonHelper() { Py_CLEAR(m_pyself); } }; typedef struct { PyObject_HEAD ns3::PointerChecker *obj; PyBindGenWrapperFlags flags:8; } PyNs3PointerChecker; extern PyTypeObject *_PyNs3PointerChecker_Type; #define PyNs3PointerChecker_Type (*_PyNs3PointerChecker_Type) typedef struct { PyObject_HEAD ns3::PointerValue *obj; PyBindGenWrapperFlags flags:8; } PyNs3PointerValue; extern PyTypeObject *_PyNs3PointerValue_Type; #define PyNs3PointerValue_Type (*_PyNs3PointerValue_Type) typedef struct { PyObject_HEAD ns3::TimeChecker *obj; PyBindGenWrapperFlags flags:8; } PyNs3TimeChecker; extern PyTypeObject *_PyNs3TimeChecker_Type; #define PyNs3TimeChecker_Type (*_PyNs3TimeChecker_Type) typedef struct { PyObject_HEAD ns3::TimeValue *obj; PyBindGenWrapperFlags flags:8; } PyNs3TimeValue; extern PyTypeObject *_PyNs3TimeValue_Type; #define PyNs3TimeValue_Type (*_PyNs3TimeValue_Type) typedef struct { PyObject_HEAD ns3::TypeIdChecker *obj; PyBindGenWrapperFlags flags:8; } PyNs3TypeIdChecker; extern PyTypeObject *_PyNs3TypeIdChecker_Type; #define PyNs3TypeIdChecker_Type (*_PyNs3TypeIdChecker_Type) typedef struct { PyObject_HEAD ns3::TypeIdValue *obj; PyBindGenWrapperFlags flags:8; } PyNs3TypeIdValue; extern PyTypeObject *_PyNs3TypeIdValue_Type; #define PyNs3TypeIdValue_Type (*_PyNs3TypeIdValue_Type) typedef struct { PyObject_HEAD ns3::UintegerValue *obj; PyBindGenWrapperFlags flags:8; } PyNs3UintegerValue; extern PyTypeObject *_PyNs3UintegerValue_Type; #define PyNs3UintegerValue_Type (*_PyNs3UintegerValue_Type) typedef struct { PyObject_HEAD ns3::Vector2DChecker *obj; PyBindGenWrapperFlags flags:8; } PyNs3Vector2DChecker; extern PyTypeObject *_PyNs3Vector2DChecker_Type; #define PyNs3Vector2DChecker_Type (*_PyNs3Vector2DChecker_Type) typedef struct { PyObject_HEAD ns3::Vector2DValue *obj; PyBindGenWrapperFlags flags:8; } PyNs3Vector2DValue; extern PyTypeObject *_PyNs3Vector2DValue_Type; #define PyNs3Vector2DValue_Type (*_PyNs3Vector2DValue_Type) typedef struct { PyObject_HEAD ns3::Vector3DChecker *obj; PyBindGenWrapperFlags flags:8; } PyNs3Vector3DChecker; extern PyTypeObject *_PyNs3Vector3DChecker_Type; #define PyNs3Vector3DChecker_Type (*_PyNs3Vector3DChecker_Type) typedef struct { PyObject_HEAD ns3::Vector3DValue *obj; PyBindGenWrapperFlags flags:8; } PyNs3Vector3DValue; extern PyTypeObject *_PyNs3Vector3DValue_Type; #define PyNs3Vector3DValue_Type (*_PyNs3Vector3DValue_Type) typedef struct { PyObject_HEAD ns3::AddressChecker *obj; PyBindGenWrapperFlags flags:8; } PyNs3AddressChecker; extern PyTypeObject *_PyNs3AddressChecker_Type; #define PyNs3AddressChecker_Type (*_PyNs3AddressChecker_Type) typedef struct { PyObject_HEAD ns3::AddressValue *obj; PyBindGenWrapperFlags flags:8; } PyNs3AddressValue; extern PyTypeObject *_PyNs3AddressValue_Type; #define PyNs3AddressValue_Type (*_PyNs3AddressValue_Type) typedef struct { PyObject_HEAD ns3::Reservation *obj; PyBindGenWrapperFlags flags:8; } PyNs3Reservation; extern PyTypeObject PyNs3Reservation_Type; extern std::map<void*, PyObject*> PyNs3Reservation_wrapper_registry; typedef struct { PyObject_HEAD ns3::Tap *obj; PyBindGenWrapperFlags flags:8; } PyNs3Tap; extern PyTypeObject PyNs3Tap_Type; extern std::map<void*, PyObject*> PyNs3Tap_wrapper_registry; typedef struct { PyObject_HEAD ns3::UanAddress *obj; PyBindGenWrapperFlags flags:8; } PyNs3UanAddress; extern PyTypeObject PyNs3UanAddress_Type; extern std::map<void*, PyObject*> PyNs3UanAddress_wrapper_registry; typedef struct { PyObject_HEAD ns3::UanHelper *obj; PyBindGenWrapperFlags flags:8; } PyNs3UanHelper; extern PyTypeObject PyNs3UanHelper_Type; extern std::map<void*, PyObject*> PyNs3UanHelper_wrapper_registry; typedef struct { PyObject_HEAD ns3::UanModesList *obj; PyBindGenWrapperFlags flags:8; } PyNs3UanModesList; extern PyTypeObject PyNs3UanModesList_Type; extern std::map<void*, PyObject*> PyNs3UanModesList_wrapper_registry; typedef struct { PyObject_HEAD ns3::UanPacketArrival *obj; PyBindGenWrapperFlags flags:8; } PyNs3UanPacketArrival; extern PyTypeObject PyNs3UanPacketArrival_Type; extern std::map<void*, PyObject*> PyNs3UanPacketArrival_wrapper_registry; typedef struct { PyObject_HEAD ns3::UanPdp *obj; PyBindGenWrapperFlags flags:8; } PyNs3UanPdp; extern PyTypeObject PyNs3UanPdp_Type; extern std::map<void*, PyObject*> PyNs3UanPdp_wrapper_registry; typedef struct { PyObject_HEAD ns3::UanPhyListener *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UanPhyListener; extern PyTypeObject PyNs3UanPhyListener_Type; class PyNs3UanPhyListener__PythonHelper : public ns3::UanPhyListener { public: PyObject *m_pyself; PyNs3UanPhyListener__PythonHelper() : ns3::UanPhyListener(), m_pyself(NULL) {} PyNs3UanPhyListener__PythonHelper(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 ~PyNs3UanPhyListener__PythonHelper() { 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*> PyNs3UanPhyListener_wrapper_registry; typedef struct { PyObject_HEAD ns3::UanTxMode *obj; PyBindGenWrapperFlags flags:8; } PyNs3UanTxMode; extern PyTypeObject PyNs3UanTxMode_Type; extern std::map<void*, PyObject*> PyNs3UanTxMode_wrapper_registry; typedef struct { PyObject_HEAD ns3::UanTxModeFactory *obj; PyBindGenWrapperFlags flags:8; } PyNs3UanTxModeFactory; extern PyTypeObject PyNs3UanTxModeFactory_Type; extern std::map<void*, PyObject*> PyNs3UanTxModeFactory_wrapper_registry; typedef struct { PyObject_HEAD ns3::AcousticModemEnergyModelHelper *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3AcousticModemEnergyModelHelper; extern PyTypeObject PyNs3AcousticModemEnergyModelHelper_Type; class PyNs3AcousticModemEnergyModelHelper__PythonHelper : public ns3::AcousticModemEnergyModelHelper { public: PyObject *m_pyself; PyNs3AcousticModemEnergyModelHelper__PythonHelper(ns3::AcousticModemEnergyModelHelper const & arg0) : ns3::AcousticModemEnergyModelHelper(arg0), m_pyself(NULL) {} PyNs3AcousticModemEnergyModelHelper__PythonHelper() : ns3::AcousticModemEnergyModelHelper(), m_pyself(NULL) {} void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3AcousticModemEnergyModelHelper__PythonHelper() { 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; PyBindGenWrapperFlags flags:8; } PyNs3UanHeaderCommon; extern PyTypeObject PyNs3UanHeaderCommon_Type; typedef struct { PyObject_HEAD ns3::UanHeaderRcAck *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UanHeaderRcAck; extern PyTypeObject PyNs3UanHeaderRcAck_Type; typedef struct { PyObject_HEAD ns3::UanHeaderRcCts *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UanHeaderRcCts; extern PyTypeObject PyNs3UanHeaderRcCts_Type; typedef struct { PyObject_HEAD ns3::UanHeaderRcCtsGlobal *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UanHeaderRcCtsGlobal; extern PyTypeObject PyNs3UanHeaderRcCtsGlobal_Type; typedef struct { PyObject_HEAD ns3::UanHeaderRcData *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UanHeaderRcData; extern PyTypeObject PyNs3UanHeaderRcData_Type; typedef struct { PyObject_HEAD ns3::UanHeaderRcRts *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UanHeaderRcRts; extern PyTypeObject PyNs3UanHeaderRcRts_Type; typedef struct { PyObject_HEAD ns3::UanMac *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UanMac; extern PyTypeObject PyNs3UanMac_Type; typedef struct { PyObject_HEAD ns3::UanMacAloha *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UanMacAloha; extern PyTypeObject PyNs3UanMacAloha_Type; class PyNs3UanMacAloha__PythonHelper : public ns3::UanMacAloha { public: PyObject *m_pyself; PyNs3UanMacAloha__PythonHelper(ns3::UanMacAloha const & arg0) : ns3::UanMacAloha(arg0), m_pyself(NULL) {} PyNs3UanMacAloha__PythonHelper() : ns3::UanMacAloha(), m_pyself(NULL) {} void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3UanMacAloha__PythonHelper() { Py_CLEAR(m_pyself); } static PyObject * _wrap_NotifyConstructionCompleted(PyNs3UanMacAloha *self); inline void NotifyConstructionCompleted__parent_caller() { ns3::ObjectBase::NotifyConstructionCompleted(); } static PyObject * _wrap_NotifyNewAggregate(PyNs3UanMacAloha *self); inline void NotifyNewAggregate__parent_caller() { ns3::Object::NotifyNewAggregate(); } static PyObject * _wrap_DoStart(PyNs3UanMacAloha *self); inline void DoStart__parent_caller() { ns3::Object::DoStart(); } static PyObject * _wrap_DoDispose(PyNs3UanMacAloha *self); inline void DoDispose__parent_caller() { 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 NotifyConstructionCompleted(); static ns3::TypeId GetTypeId (void) { static ns3::TypeId tid = ns3::TypeId ("PyNs3UanMacAloha__PythonHelper") .SetParent< ns3::UanMacAloha > () ; return tid; } }; NS_OBJECT_ENSURE_REGISTERED (PyNs3UanMacAloha__PythonHelper); typedef struct { PyObject_HEAD ns3::UanMacCw *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UanMacCw; extern PyTypeObject PyNs3UanMacCw_Type; class PyNs3UanMacCw__PythonHelper : public ns3::UanMacCw { public: PyObject *m_pyself; PyNs3UanMacCw__PythonHelper(ns3::UanMacCw const & arg0) : ns3::UanMacCw(arg0), m_pyself(NULL) {} PyNs3UanMacCw__PythonHelper() : ns3::UanMacCw(), m_pyself(NULL) {} void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3UanMacCw__PythonHelper() { Py_CLEAR(m_pyself); } static PyObject * _wrap_NotifyConstructionCompleted(PyNs3UanMacCw *self); inline void NotifyConstructionCompleted__parent_caller() { ns3::ObjectBase::NotifyConstructionCompleted(); } static PyObject * _wrap_NotifyNewAggregate(PyNs3UanMacCw *self); inline void NotifyNewAggregate__parent_caller() { ns3::Object::NotifyNewAggregate(); } static PyObject * _wrap_DoStart(PyNs3UanMacCw *self); inline void DoStart__parent_caller() { ns3::Object::DoStart(); } static PyObject * _wrap_DoDispose(PyNs3UanMacCw *self); inline void DoDispose__parent_caller() { 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 NotifyConstructionCompleted(); static ns3::TypeId GetTypeId (void) { static ns3::TypeId tid = ns3::TypeId ("PyNs3UanMacCw__PythonHelper") .SetParent< ns3::UanMacCw > () ; return tid; } }; NS_OBJECT_ENSURE_REGISTERED (PyNs3UanMacCw__PythonHelper); typedef struct { PyObject_HEAD ns3::UanMacRc *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UanMacRc; extern PyTypeObject PyNs3UanMacRc_Type; class PyNs3UanMacRc__PythonHelper : public ns3::UanMacRc { public: PyObject *m_pyself; PyNs3UanMacRc__PythonHelper(ns3::UanMacRc const & arg0) : ns3::UanMacRc(arg0), m_pyself(NULL) {} PyNs3UanMacRc__PythonHelper() : ns3::UanMacRc(), m_pyself(NULL) {} void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3UanMacRc__PythonHelper() { Py_CLEAR(m_pyself); } static PyObject * _wrap_NotifyConstructionCompleted(PyNs3UanMacRc *self); inline void NotifyConstructionCompleted__parent_caller() { ns3::ObjectBase::NotifyConstructionCompleted(); } static PyObject * _wrap_NotifyNewAggregate(PyNs3UanMacRc *self); inline void NotifyNewAggregate__parent_caller() { ns3::Object::NotifyNewAggregate(); } static PyObject * _wrap_DoStart(PyNs3UanMacRc *self); inline void DoStart__parent_caller() { ns3::Object::DoStart(); } static PyObject * _wrap_DoDispose(PyNs3UanMacRc *self); inline void DoDispose__parent_caller() { 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 NotifyConstructionCompleted(); static ns3::TypeId GetTypeId (void) { static ns3::TypeId tid = ns3::TypeId ("PyNs3UanMacRc__PythonHelper") .SetParent< ns3::UanMacRc > () ; return tid; } }; NS_OBJECT_ENSURE_REGISTERED (PyNs3UanMacRc__PythonHelper); typedef struct { PyObject_HEAD ns3::UanMacRcGw *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UanMacRcGw; extern PyTypeObject PyNs3UanMacRcGw_Type; class PyNs3UanMacRcGw__PythonHelper : public ns3::UanMacRcGw { public: PyObject *m_pyself; PyNs3UanMacRcGw__PythonHelper(ns3::UanMacRcGw const & arg0) : ns3::UanMacRcGw(arg0), m_pyself(NULL) {} PyNs3UanMacRcGw__PythonHelper() : ns3::UanMacRcGw(), m_pyself(NULL) {} void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3UanMacRcGw__PythonHelper() { Py_CLEAR(m_pyself); } static PyObject * _wrap_NotifyConstructionCompleted(PyNs3UanMacRcGw *self); inline void NotifyConstructionCompleted__parent_caller() { ns3::ObjectBase::NotifyConstructionCompleted(); } static PyObject * _wrap_NotifyNewAggregate(PyNs3UanMacRcGw *self); inline void NotifyNewAggregate__parent_caller() { ns3::Object::NotifyNewAggregate(); } static PyObject * _wrap_DoStart(PyNs3UanMacRcGw *self); inline void DoStart__parent_caller() { ns3::Object::DoStart(); } static PyObject * _wrap_DoDispose(PyNs3UanMacRcGw *self); inline void DoDispose__parent_caller() { 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 NotifyConstructionCompleted(); static ns3::TypeId GetTypeId (void) { static ns3::TypeId tid = ns3::TypeId ("PyNs3UanMacRcGw__PythonHelper") .SetParent< ns3::UanMacRcGw > () ; return tid; } }; NS_OBJECT_ENSURE_REGISTERED (PyNs3UanMacRcGw__PythonHelper); typedef struct { PyObject_HEAD ns3::UanNoiseModel *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UanNoiseModel; extern PyTypeObject PyNs3UanNoiseModel_Type; class PyNs3UanNoiseModel__PythonHelper : public ns3::UanNoiseModel { public: PyObject *m_pyself; PyNs3UanNoiseModel__PythonHelper() : ns3::UanNoiseModel(), m_pyself(NULL) {} PyNs3UanNoiseModel__PythonHelper(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 ~PyNs3UanNoiseModel__PythonHelper() { Py_CLEAR(m_pyself); } static PyObject * _wrap_NotifyConstructionCompleted(PyNs3UanNoiseModel *self); inline void NotifyConstructionCompleted__parent_caller() { ns3::ObjectBase::NotifyConstructionCompleted(); } static PyObject * _wrap_NotifyNewAggregate(PyNs3UanNoiseModel *self); inline void NotifyNewAggregate__parent_caller() { ns3::Object::NotifyNewAggregate(); } static PyObject * _wrap_DoStart(PyNs3UanNoiseModel *self); inline void DoStart__parent_caller() { 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 NotifyConstructionCompleted(); static ns3::TypeId GetTypeId (void) { static ns3::TypeId tid = ns3::TypeId ("PyNs3UanNoiseModel__PythonHelper") .SetParent< ns3::UanNoiseModel > () ; return tid; } }; NS_OBJECT_ENSURE_REGISTERED (PyNs3UanNoiseModel__PythonHelper); typedef struct { PyObject_HEAD ns3::UanNoiseModelDefault *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UanNoiseModelDefault; extern PyTypeObject PyNs3UanNoiseModelDefault_Type; class PyNs3UanNoiseModelDefault__PythonHelper : public ns3::UanNoiseModelDefault { public: PyObject *m_pyself; PyNs3UanNoiseModelDefault__PythonHelper(ns3::UanNoiseModelDefault const & arg0) : ns3::UanNoiseModelDefault(arg0), m_pyself(NULL) {} PyNs3UanNoiseModelDefault__PythonHelper() : ns3::UanNoiseModelDefault(), m_pyself(NULL) {} void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3UanNoiseModelDefault__PythonHelper() { Py_CLEAR(m_pyself); } static PyObject * _wrap_NotifyConstructionCompleted(PyNs3UanNoiseModelDefault *self); inline void NotifyConstructionCompleted__parent_caller() { ns3::ObjectBase::NotifyConstructionCompleted(); } static PyObject * _wrap_NotifyNewAggregate(PyNs3UanNoiseModelDefault *self); inline void NotifyNewAggregate__parent_caller() { ns3::Object::NotifyNewAggregate(); } static PyObject * _wrap_DoStart(PyNs3UanNoiseModelDefault *self); inline void DoStart__parent_caller() { 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 NotifyConstructionCompleted(); static ns3::TypeId GetTypeId (void) { static ns3::TypeId tid = ns3::TypeId ("PyNs3UanNoiseModelDefault__PythonHelper") .SetParent< ns3::UanNoiseModelDefault > () ; return tid; } }; NS_OBJECT_ENSURE_REGISTERED (PyNs3UanNoiseModelDefault__PythonHelper); typedef struct { PyObject_HEAD ns3::UanPhy *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UanPhy; extern PyTypeObject PyNs3UanPhy_Type; typedef struct { PyObject_HEAD ns3::UanPhyCalcSinr *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UanPhyCalcSinr; extern PyTypeObject PyNs3UanPhyCalcSinr_Type; class PyNs3UanPhyCalcSinr__PythonHelper : public ns3::UanPhyCalcSinr { public: PyObject *m_pyself; PyNs3UanPhyCalcSinr__PythonHelper() : ns3::UanPhyCalcSinr(), m_pyself(NULL) {} PyNs3UanPhyCalcSinr__PythonHelper(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 ~PyNs3UanPhyCalcSinr__PythonHelper() { Py_CLEAR(m_pyself); } static PyObject * _wrap_NotifyConstructionCompleted(PyNs3UanPhyCalcSinr *self); inline void NotifyConstructionCompleted__parent_caller() { ns3::ObjectBase::NotifyConstructionCompleted(); } static PyObject * _wrap_NotifyNewAggregate(PyNs3UanPhyCalcSinr *self); inline void NotifyNewAggregate__parent_caller() { ns3::Object::NotifyNewAggregate(); } static PyObject * _wrap_DoStart(PyNs3UanPhyCalcSinr *self); inline void DoStart__parent_caller() { 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 NotifyConstructionCompleted(); static ns3::TypeId GetTypeId (void) { static ns3::TypeId tid = ns3::TypeId ("PyNs3UanPhyCalcSinr__PythonHelper") .SetParent< ns3::UanPhyCalcSinr > () ; return tid; } }; NS_OBJECT_ENSURE_REGISTERED (PyNs3UanPhyCalcSinr__PythonHelper); typedef struct { PyObject_HEAD ns3::UanPhyCalcSinrDefault *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UanPhyCalcSinrDefault; extern PyTypeObject PyNs3UanPhyCalcSinrDefault_Type; class PyNs3UanPhyCalcSinrDefault__PythonHelper : public ns3::UanPhyCalcSinrDefault { public: PyObject *m_pyself; PyNs3UanPhyCalcSinrDefault__PythonHelper(ns3::UanPhyCalcSinrDefault const & arg0) : ns3::UanPhyCalcSinrDefault(arg0), m_pyself(NULL) {} PyNs3UanPhyCalcSinrDefault__PythonHelper() : ns3::UanPhyCalcSinrDefault(), m_pyself(NULL) {} void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3UanPhyCalcSinrDefault__PythonHelper() { Py_CLEAR(m_pyself); } static PyObject * _wrap_NotifyConstructionCompleted(PyNs3UanPhyCalcSinrDefault *self); inline void NotifyConstructionCompleted__parent_caller() { ns3::ObjectBase::NotifyConstructionCompleted(); } static PyObject * _wrap_NotifyNewAggregate(PyNs3UanPhyCalcSinrDefault *self); inline void NotifyNewAggregate__parent_caller() { ns3::Object::NotifyNewAggregate(); } static PyObject * _wrap_DoStart(PyNs3UanPhyCalcSinrDefault *self); inline void DoStart__parent_caller() { 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 NotifyConstructionCompleted(); static ns3::TypeId GetTypeId (void) { static ns3::TypeId tid = ns3::TypeId ("PyNs3UanPhyCalcSinrDefault__PythonHelper") .SetParent< ns3::UanPhyCalcSinrDefault > () ; return tid; } }; NS_OBJECT_ENSURE_REGISTERED (PyNs3UanPhyCalcSinrDefault__PythonHelper); typedef struct { PyObject_HEAD ns3::UanPhyCalcSinrDual *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UanPhyCalcSinrDual; extern PyTypeObject PyNs3UanPhyCalcSinrDual_Type; class PyNs3UanPhyCalcSinrDual__PythonHelper : public ns3::UanPhyCalcSinrDual { public: PyObject *m_pyself; PyNs3UanPhyCalcSinrDual__PythonHelper(ns3::UanPhyCalcSinrDual const & arg0) : ns3::UanPhyCalcSinrDual(arg0), m_pyself(NULL) {} PyNs3UanPhyCalcSinrDual__PythonHelper() : ns3::UanPhyCalcSinrDual(), m_pyself(NULL) {} void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3UanPhyCalcSinrDual__PythonHelper() { Py_CLEAR(m_pyself); } static PyObject * _wrap_NotifyConstructionCompleted(PyNs3UanPhyCalcSinrDual *self); inline void NotifyConstructionCompleted__parent_caller() { ns3::ObjectBase::NotifyConstructionCompleted(); } static PyObject * _wrap_NotifyNewAggregate(PyNs3UanPhyCalcSinrDual *self); inline void NotifyNewAggregate__parent_caller() { ns3::Object::NotifyNewAggregate(); } static PyObject * _wrap_DoStart(PyNs3UanPhyCalcSinrDual *self); inline void DoStart__parent_caller() { 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 NotifyConstructionCompleted(); static ns3::TypeId GetTypeId (void) { static ns3::TypeId tid = ns3::TypeId ("PyNs3UanPhyCalcSinrDual__PythonHelper") .SetParent< ns3::UanPhyCalcSinrDual > () ; return tid; } }; NS_OBJECT_ENSURE_REGISTERED (PyNs3UanPhyCalcSinrDual__PythonHelper); typedef struct { PyObject_HEAD ns3::UanPhyCalcSinrFhFsk *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UanPhyCalcSinrFhFsk; extern PyTypeObject PyNs3UanPhyCalcSinrFhFsk_Type; class PyNs3UanPhyCalcSinrFhFsk__PythonHelper : public ns3::UanPhyCalcSinrFhFsk { public: PyObject *m_pyself; PyNs3UanPhyCalcSinrFhFsk__PythonHelper(ns3::UanPhyCalcSinrFhFsk const & arg0) : ns3::UanPhyCalcSinrFhFsk(arg0), m_pyself(NULL) {} PyNs3UanPhyCalcSinrFhFsk__PythonHelper() : ns3::UanPhyCalcSinrFhFsk(), m_pyself(NULL) {} void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3UanPhyCalcSinrFhFsk__PythonHelper() { Py_CLEAR(m_pyself); } static PyObject * _wrap_NotifyConstructionCompleted(PyNs3UanPhyCalcSinrFhFsk *self); inline void NotifyConstructionCompleted__parent_caller() { ns3::ObjectBase::NotifyConstructionCompleted(); } static PyObject * _wrap_NotifyNewAggregate(PyNs3UanPhyCalcSinrFhFsk *self); inline void NotifyNewAggregate__parent_caller() { ns3::Object::NotifyNewAggregate(); } static PyObject * _wrap_DoStart(PyNs3UanPhyCalcSinrFhFsk *self); inline void DoStart__parent_caller() { 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 NotifyConstructionCompleted(); static ns3::TypeId GetTypeId (void) { static ns3::TypeId tid = ns3::TypeId ("PyNs3UanPhyCalcSinrFhFsk__PythonHelper") .SetParent< ns3::UanPhyCalcSinrFhFsk > () ; return tid; } }; NS_OBJECT_ENSURE_REGISTERED (PyNs3UanPhyCalcSinrFhFsk__PythonHelper); typedef struct { PyObject_HEAD ns3::UanPhyDual *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UanPhyDual; extern PyTypeObject PyNs3UanPhyDual_Type; typedef struct { PyObject_HEAD ns3::UanPhyGen *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UanPhyGen; extern PyTypeObject PyNs3UanPhyGen_Type; typedef struct { PyObject_HEAD ns3::UanPhyPer *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UanPhyPer; extern PyTypeObject PyNs3UanPhyPer_Type; class PyNs3UanPhyPer__PythonHelper : public ns3::UanPhyPer { public: PyObject *m_pyself; PyNs3UanPhyPer__PythonHelper() : ns3::UanPhyPer(), m_pyself(NULL) {} PyNs3UanPhyPer__PythonHelper(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 ~PyNs3UanPhyPer__PythonHelper() { Py_CLEAR(m_pyself); } static PyObject * _wrap_NotifyConstructionCompleted(PyNs3UanPhyPer *self); inline void NotifyConstructionCompleted__parent_caller() { ns3::ObjectBase::NotifyConstructionCompleted(); } static PyObject * _wrap_NotifyNewAggregate(PyNs3UanPhyPer *self); inline void NotifyNewAggregate__parent_caller() { ns3::Object::NotifyNewAggregate(); } static PyObject * _wrap_DoStart(PyNs3UanPhyPer *self); inline void DoStart__parent_caller() { 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 NotifyConstructionCompleted(); static ns3::TypeId GetTypeId (void) { static ns3::TypeId tid = ns3::TypeId ("PyNs3UanPhyPer__PythonHelper") .SetParent< ns3::UanPhyPer > () ; return tid; } }; NS_OBJECT_ENSURE_REGISTERED (PyNs3UanPhyPer__PythonHelper); typedef struct { PyObject_HEAD ns3::UanPhyPerGenDefault *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UanPhyPerGenDefault; extern PyTypeObject PyNs3UanPhyPerGenDefault_Type; class PyNs3UanPhyPerGenDefault__PythonHelper : public ns3::UanPhyPerGenDefault { public: PyObject *m_pyself; PyNs3UanPhyPerGenDefault__PythonHelper(ns3::UanPhyPerGenDefault const & arg0) : ns3::UanPhyPerGenDefault(arg0), m_pyself(NULL) {} PyNs3UanPhyPerGenDefault__PythonHelper() : ns3::UanPhyPerGenDefault(), m_pyself(NULL) {} void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3UanPhyPerGenDefault__PythonHelper() { Py_CLEAR(m_pyself); } static PyObject * _wrap_NotifyConstructionCompleted(PyNs3UanPhyPerGenDefault *self); inline void NotifyConstructionCompleted__parent_caller() { ns3::ObjectBase::NotifyConstructionCompleted(); } static PyObject * _wrap_NotifyNewAggregate(PyNs3UanPhyPerGenDefault *self); inline void NotifyNewAggregate__parent_caller() { ns3::Object::NotifyNewAggregate(); } static PyObject * _wrap_DoStart(PyNs3UanPhyPerGenDefault *self); inline void DoStart__parent_caller() { 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 NotifyConstructionCompleted(); static ns3::TypeId GetTypeId (void) { static ns3::TypeId tid = ns3::TypeId ("PyNs3UanPhyPerGenDefault__PythonHelper") .SetParent< ns3::UanPhyPerGenDefault > () ; return tid; } }; NS_OBJECT_ENSURE_REGISTERED (PyNs3UanPhyPerGenDefault__PythonHelper); typedef struct { PyObject_HEAD ns3::UanPhyPerUmodem *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UanPhyPerUmodem; extern PyTypeObject PyNs3UanPhyPerUmodem_Type; class PyNs3UanPhyPerUmodem__PythonHelper : public ns3::UanPhyPerUmodem { public: PyObject *m_pyself; PyNs3UanPhyPerUmodem__PythonHelper(ns3::UanPhyPerUmodem const & arg0) : ns3::UanPhyPerUmodem(arg0), m_pyself(NULL) {} PyNs3UanPhyPerUmodem__PythonHelper() : ns3::UanPhyPerUmodem(), m_pyself(NULL) {} void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3UanPhyPerUmodem__PythonHelper() { Py_CLEAR(m_pyself); } static PyObject * _wrap_NotifyConstructionCompleted(PyNs3UanPhyPerUmodem *self); inline void NotifyConstructionCompleted__parent_caller() { ns3::ObjectBase::NotifyConstructionCompleted(); } static PyObject * _wrap_NotifyNewAggregate(PyNs3UanPhyPerUmodem *self); inline void NotifyNewAggregate__parent_caller() { ns3::Object::NotifyNewAggregate(); } static PyObject * _wrap_DoStart(PyNs3UanPhyPerUmodem *self); inline void DoStart__parent_caller() { 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 NotifyConstructionCompleted(); static ns3::TypeId GetTypeId (void) { static ns3::TypeId tid = ns3::TypeId ("PyNs3UanPhyPerUmodem__PythonHelper") .SetParent< ns3::UanPhyPerUmodem > () ; return tid; } }; NS_OBJECT_ENSURE_REGISTERED (PyNs3UanPhyPerUmodem__PythonHelper); typedef struct { PyObject_HEAD ns3::UanPropModel *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UanPropModel; extern PyTypeObject PyNs3UanPropModel_Type; class PyNs3UanPropModel__PythonHelper : public ns3::UanPropModel { public: PyObject *m_pyself; PyNs3UanPropModel__PythonHelper() : ns3::UanPropModel(), m_pyself(NULL) {} PyNs3UanPropModel__PythonHelper(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 ~PyNs3UanPropModel__PythonHelper() { Py_CLEAR(m_pyself); } static PyObject * _wrap_NotifyConstructionCompleted(PyNs3UanPropModel *self); inline void NotifyConstructionCompleted__parent_caller() { ns3::ObjectBase::NotifyConstructionCompleted(); } static PyObject * _wrap_NotifyNewAggregate(PyNs3UanPropModel *self); inline void NotifyNewAggregate__parent_caller() { ns3::Object::NotifyNewAggregate(); } static PyObject * _wrap_DoStart(PyNs3UanPropModel *self); inline void DoStart__parent_caller() { 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 NotifyConstructionCompleted(); static ns3::TypeId GetTypeId (void) { static ns3::TypeId tid = ns3::TypeId ("PyNs3UanPropModel__PythonHelper") .SetParent< ns3::UanPropModel > () ; return tid; } }; NS_OBJECT_ENSURE_REGISTERED (PyNs3UanPropModel__PythonHelper); typedef struct { PyObject_HEAD ns3::UanPropModelIdeal *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UanPropModelIdeal; extern PyTypeObject PyNs3UanPropModelIdeal_Type; class PyNs3UanPropModelIdeal__PythonHelper : public ns3::UanPropModelIdeal { public: PyObject *m_pyself; PyNs3UanPropModelIdeal__PythonHelper(ns3::UanPropModelIdeal const & arg0) : ns3::UanPropModelIdeal(arg0), m_pyself(NULL) {} PyNs3UanPropModelIdeal__PythonHelper() : ns3::UanPropModelIdeal(), m_pyself(NULL) {} void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3UanPropModelIdeal__PythonHelper() { Py_CLEAR(m_pyself); } static PyObject * _wrap_NotifyConstructionCompleted(PyNs3UanPropModelIdeal *self); inline void NotifyConstructionCompleted__parent_caller() { ns3::ObjectBase::NotifyConstructionCompleted(); } static PyObject * _wrap_NotifyNewAggregate(PyNs3UanPropModelIdeal *self); inline void NotifyNewAggregate__parent_caller() { ns3::Object::NotifyNewAggregate(); } static PyObject * _wrap_DoStart(PyNs3UanPropModelIdeal *self); inline void DoStart__parent_caller() { 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 NotifyConstructionCompleted(); static ns3::TypeId GetTypeId (void) { static ns3::TypeId tid = ns3::TypeId ("PyNs3UanPropModelIdeal__PythonHelper") .SetParent< ns3::UanPropModelIdeal > () ; return tid; } }; NS_OBJECT_ENSURE_REGISTERED (PyNs3UanPropModelIdeal__PythonHelper); typedef struct { PyObject_HEAD ns3::UanPropModelThorp *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UanPropModelThorp; extern PyTypeObject PyNs3UanPropModelThorp_Type; class PyNs3UanPropModelThorp__PythonHelper : public ns3::UanPropModelThorp { public: PyObject *m_pyself; PyNs3UanPropModelThorp__PythonHelper(ns3::UanPropModelThorp const & arg0) : ns3::UanPropModelThorp(arg0), m_pyself(NULL) {} PyNs3UanPropModelThorp__PythonHelper() : ns3::UanPropModelThorp(), m_pyself(NULL) {} void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3UanPropModelThorp__PythonHelper() { Py_CLEAR(m_pyself); } static PyObject * _wrap_NotifyConstructionCompleted(PyNs3UanPropModelThorp *self); inline void NotifyConstructionCompleted__parent_caller() { ns3::ObjectBase::NotifyConstructionCompleted(); } static PyObject * _wrap_NotifyNewAggregate(PyNs3UanPropModelThorp *self); inline void NotifyNewAggregate__parent_caller() { ns3::Object::NotifyNewAggregate(); } static PyObject * _wrap_DoStart(PyNs3UanPropModelThorp *self); inline void DoStart__parent_caller() { 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 NotifyConstructionCompleted(); static ns3::TypeId GetTypeId (void) { static ns3::TypeId tid = ns3::TypeId ("PyNs3UanPropModelThorp__PythonHelper") .SetParent< ns3::UanPropModelThorp > () ; return tid; } }; NS_OBJECT_ENSURE_REGISTERED (PyNs3UanPropModelThorp__PythonHelper); typedef struct { PyObject_HEAD ns3::UanTransducer *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UanTransducer; extern PyTypeObject PyNs3UanTransducer_Type; typedef struct { PyObject_HEAD ns3::UanTransducerHd *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UanTransducerHd; extern PyTypeObject PyNs3UanTransducerHd_Type; typedef struct { PyObject_HEAD ns3::UanChannel *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UanChannel; extern PyTypeObject PyNs3UanChannel_Type; class PyNs3UanChannel__PythonHelper : public ns3::UanChannel { public: PyObject *m_pyself; PyNs3UanChannel__PythonHelper(ns3::UanChannel const & arg0) : ns3::UanChannel(arg0), m_pyself(NULL) {} PyNs3UanChannel__PythonHelper() : ns3::UanChannel(), m_pyself(NULL) {} void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3UanChannel__PythonHelper() { Py_CLEAR(m_pyself); } static PyObject * _wrap_NotifyConstructionCompleted(PyNs3UanChannel *self); inline void NotifyConstructionCompleted__parent_caller() { ns3::ObjectBase::NotifyConstructionCompleted(); } static PyObject * _wrap_NotifyNewAggregate(PyNs3UanChannel *self); inline void NotifyNewAggregate__parent_caller() { ns3::Object::NotifyNewAggregate(); } static PyObject * _wrap_DoStart(PyNs3UanChannel *self); inline void DoStart__parent_caller() { ns3::Object::DoStart(); } static PyObject * _wrap_DoDispose(PyNs3UanChannel *self); inline void DoDispose__parent_caller() { 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 NotifyConstructionCompleted(); static ns3::TypeId GetTypeId (void) { static ns3::TypeId tid = ns3::TypeId ("PyNs3UanChannel__PythonHelper") .SetParent< ns3::UanChannel > () ; return tid; } }; NS_OBJECT_ENSURE_REGISTERED (PyNs3UanChannel__PythonHelper); typedef struct { PyObject_HEAD ns3::UanModesListChecker *obj; PyBindGenWrapperFlags flags:8; } PyNs3UanModesListChecker; extern PyTypeObject PyNs3UanModesListChecker_Type; typedef struct { PyObject_HEAD ns3::UanModesListValue *obj; PyBindGenWrapperFlags flags:8; } PyNs3UanModesListValue; extern PyTypeObject PyNs3UanModesListValue_Type; typedef struct { PyObject_HEAD ns3::UanNetDevice *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3UanNetDevice; extern PyTypeObject PyNs3UanNetDevice_Type; typedef struct { PyObject_HEAD ns3::AcousticModemEnergyModel *obj; PyObject *inst_dict; PyBindGenWrapperFlags flags:8; } PyNs3AcousticModemEnergyModel; extern PyTypeObject PyNs3AcousticModemEnergyModel_Type; class PyNs3AcousticModemEnergyModel__PythonHelper : public ns3::AcousticModemEnergyModel { public: PyObject *m_pyself; PyNs3AcousticModemEnergyModel__PythonHelper(ns3::AcousticModemEnergyModel const & arg0) : ns3::AcousticModemEnergyModel(arg0), m_pyself(NULL) {} PyNs3AcousticModemEnergyModel__PythonHelper() : ns3::AcousticModemEnergyModel(), m_pyself(NULL) {} void set_pyobj(PyObject *pyobj) { Py_XDECREF(m_pyself); Py_INCREF(pyobj); m_pyself = pyobj; } virtual ~PyNs3AcousticModemEnergyModel__PythonHelper() { Py_CLEAR(m_pyself); } static PyObject * _wrap_NotifyConstructionCompleted(PyNs3AcousticModemEnergyModel *self); inline void NotifyConstructionCompleted__parent_caller() { ns3::ObjectBase::NotifyConstructionCompleted(); } static PyObject * _wrap_NotifyNewAggregate(PyNs3AcousticModemEnergyModel *self); inline void NotifyNewAggregate__parent_caller() { ns3::Object::NotifyNewAggregate(); } static PyObject * _wrap_DoStart(PyNs3AcousticModemEnergyModel *self); inline void DoStart__parent_caller() { ns3::Object::DoStart(); } virtual void ChangeState(int newState); virtual ns3::Ptr< ns3::Node > GetNode() const; virtual double GetTotalEnergyConsumption() const; virtual void HandleEnergyDepletion(); 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 NotifyConstructionCompleted(); static ns3::TypeId GetTypeId (void) { static ns3::TypeId tid = ns3::TypeId ("PyNs3AcousticModemEnergyModel__PythonHelper") .SetParent< ns3::AcousticModemEnergyModel > () ; return tid; } }; NS_OBJECT_ENSURE_REGISTERED (PyNs3AcousticModemEnergyModel__PythonHelper); typedef struct { PyObject_HEAD std::vector< ns3::Tap > *obj; } Pystd__vector__lt___ns3__Tap___gt__; typedef struct { PyObject_HEAD Pystd__vector__lt___ns3__Tap___gt__ *container; std::vector< ns3::Tap >::iterator *iterator; } Pystd__vector__lt___ns3__Tap___gt__Iter; extern PyTypeObject Pystd__vector__lt___ns3__Tap___gt___Type; extern PyTypeObject Pystd__vector__lt___ns3__Tap___gt__Iter_Type; int _wrap_convert_py2c__std__vector__lt___ns3__Tap___gt__(PyObject *arg, std::vector< ns3::Tap > *container); typedef struct { PyObject_HEAD std::vector< double > *obj; } Pystd__vector__lt___double___gt__; typedef struct { PyObject_HEAD Pystd__vector__lt___double___gt__ *container; std::vector< double >::iterator *iterator; } Pystd__vector__lt___double___gt__Iter; extern PyTypeObject Pystd__vector__lt___double___gt___Type; extern PyTypeObject Pystd__vector__lt___double___gt__Iter_Type; int _wrap_convert_py2c__std__vector__lt___double___gt__(PyObject *arg, std::vector< double > *container); typedef struct { PyObject_HEAD std::set< unsigned char > *obj; } Pystd__set__lt___unsigned_char___gt__; typedef struct { PyObject_HEAD Pystd__set__lt___unsigned_char___gt__ *container; std::set< unsigned char >::iterator *iterator; } Pystd__set__lt___unsigned_char___gt__Iter; extern PyTypeObject Pystd__set__lt___unsigned_char___gt___Type; extern PyTypeObject Pystd__set__lt___unsigned_char___gt__Iter_Type; int _wrap_convert_py2c__std__set__lt___unsigned_char___gt__(PyObject *arg, std::set< unsigned char > *container); typedef struct { PyObject_HEAD std::list< ns3::UanPacketArrival > *obj; } Pystd__list__lt___ns3__UanPacketArrival___gt__; typedef struct { PyObject_HEAD Pystd__list__lt___ns3__UanPacketArrival___gt__ *container; std::list< ns3::UanPacketArrival >::iterator *iterator; } Pystd__list__lt___ns3__UanPacketArrival___gt__Iter; extern PyTypeObject Pystd__list__lt___ns3__UanPacketArrival___gt___Type; extern PyTypeObject Pystd__list__lt___ns3__UanPacketArrival___gt__Iter_Type; int _wrap_convert_py2c__std__list__lt___ns3__UanPacketArrival___gt__(PyObject *arg, std::list< ns3::UanPacketArrival > *container); typedef struct { PyObject_HEAD std::list< ns3::Ptr< ns3::UanPhy > > *obj; } Pystd__list__lt___ns3__Ptr__lt___ns3__UanPhy___gt_____gt__; typedef struct { PyObject_HEAD Pystd__list__lt___ns3__Ptr__lt___ns3__UanPhy___gt_____gt__ *container; std::list< ns3::Ptr< ns3::UanPhy > >::iterator *iterator; } Pystd__list__lt___ns3__Ptr__lt___ns3__UanPhy___gt_____gt__Iter; extern PyTypeObject Pystd__list__lt___ns3__Ptr__lt___ns3__UanPhy___gt_____gt___Type; extern PyTypeObject Pystd__list__lt___ns3__Ptr__lt___ns3__UanPhy___gt_____gt__Iter_Type; int _wrap_convert_py2c__std__list__lt___ns3__Ptr__lt___ns3__UanPhy___gt_____gt__(PyObject *arg, std::list< ns3::Ptr< ns3::UanPhy > > *container); typedef struct { PyObject_HEAD std::list< ns3::Ptr< ns3::UanTransducer > > *obj; } Pystd__list__lt___ns3__Ptr__lt___ns3__UanTransducer___gt_____gt__; typedef struct { PyObject_HEAD Pystd__list__lt___ns3__Ptr__lt___ns3__UanTransducer___gt_____gt__ *container; std::list< ns3::Ptr< ns3::UanTransducer > >::iterator *iterator; } Pystd__list__lt___ns3__Ptr__lt___ns3__UanTransducer___gt_____gt__Iter; extern PyTypeObject Pystd__list__lt___ns3__Ptr__lt___ns3__UanTransducer___gt_____gt___Type; extern PyTypeObject Pystd__list__lt___ns3__Ptr__lt___ns3__UanTransducer___gt_____gt__Iter_Type; 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 = (PyEval_ThreadsInitialized() ? 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 (PyEval_ThreadsInitialized()) 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 (PyEval_ThreadsInitialized()) PyGILState_Release(__py_gil_state); return; } Py_DECREF(py_retval); Py_DECREF(args); if (PyEval_ThreadsInitialized()) 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 = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0); args = Py_BuildValue((char *) "()"); py_retval = PyObject_CallObject(m_callback, args); if (py_retval == NULL) { Py_DECREF(args); if (PyEval_ThreadsInitialized()) 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 (PyEval_ThreadsInitialized()) PyGILState_Release(__py_gil_state); return; } Py_DECREF(py_retval); Py_DECREF(args); if (PyEval_ThreadsInitialized()) 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 = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0); wrapper_lookup_iter = PyNs3Empty_wrapper_registry.find((void *) const_cast<ns3::Packet *> (ns3::PeekPointer (arg1))); if (wrapper_lookup_iter == PyNs3Empty_wrapper_registry.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 = PYBINDGEN_WRAPPER_FLAG_NONE; const_cast<ns3::Packet *> (ns3::PeekPointer (arg1))->Ref(); py_Packet->obj = const_cast<ns3::Packet *> (ns3::PeekPointer (arg1)); PyNs3Empty_wrapper_registry[(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 (PyEval_ThreadsInitialized()) 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 (PyEval_ThreadsInitialized()) PyGILState_Release(__py_gil_state); return; } Py_DECREF(py_retval); Py_DECREF(args); if (PyEval_ThreadsInitialized()) 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 = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0); wrapper_lookup_iter = PyNs3Empty_wrapper_registry.find((void *) const_cast<ns3::Packet *> (ns3::PeekPointer (arg1))); if (wrapper_lookup_iter == PyNs3Empty_wrapper_registry.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 = PYBINDGEN_WRAPPER_FLAG_NONE; const_cast<ns3::Packet *> (ns3::PeekPointer (arg1))->Ref(); py_Packet->obj = const_cast<ns3::Packet *> (ns3::PeekPointer (arg1)); PyNs3Empty_wrapper_registry[(void *) py_Packet->obj] = (PyObject *) py_Packet; } py_UanTxMode = PyObject_New(PyNs3UanTxMode, &PyNs3UanTxMode_Type); py_UanTxMode->flags = PYBINDGEN_WRAPPER_FLAG_NONE; py_UanTxMode->obj = new ns3::UanTxMode(arg3); PyNs3UanTxMode_wrapper_registry[(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 (PyEval_ThreadsInitialized()) 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 (PyEval_ThreadsInitialized()) PyGILState_Release(__py_gil_state); return; } Py_DECREF(py_retval); Py_DECREF(args); if (PyEval_ThreadsInitialized()) 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 = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0); wrapper_lookup_iter = PyNs3Empty_wrapper_registry.find((void *) const_cast<ns3::Packet *> (ns3::PeekPointer (arg1))); if (wrapper_lookup_iter == PyNs3Empty_wrapper_registry.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 = PYBINDGEN_WRAPPER_FLAG_NONE; const_cast<ns3::Packet *> (ns3::PeekPointer (arg1))->Ref(); py_Packet->obj = const_cast<ns3::Packet *> (ns3::PeekPointer (arg1)); PyNs3Empty_wrapper_registry[(void *) py_Packet->obj] = (PyObject *) py_Packet; } py_UanAddress = PyObject_New(PyNs3UanAddress, &PyNs3UanAddress_Type); py_UanAddress->flags = PYBINDGEN_WRAPPER_FLAG_NONE; py_UanAddress->obj = new ns3::UanAddress(arg2); PyNs3UanAddress_wrapper_registry[(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 (PyEval_ThreadsInitialized()) 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 (PyEval_ThreadsInitialized()) PyGILState_Release(__py_gil_state); return; } Py_DECREF(py_retval); Py_DECREF(args); if (PyEval_ThreadsInitialized()) 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 wrapper_lookup_iter2; PyTypeObject *wrapper_type2 = 0; PyNs3Address *py_Address; PyObject *args; PyObject *py_boolretval; __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0); wrapper_lookup_iter = PyNs3ObjectBase_wrapper_registry.find((void *) const_cast<ns3::NetDevice *> (ns3::PeekPointer (arg1))); if (wrapper_lookup_iter == PyNs3ObjectBase_wrapper_registry.end()) { py_NetDevice = NULL; } else { py_NetDevice = (PyNs3NetDevice *) wrapper_lookup_iter->second; Py_INCREF(py_NetDevice); } if (py_NetDevice == NULL) { wrapper_type = PyNs3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter__typeid_map.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 = PYBINDGEN_WRAPPER_FLAG_NONE; const_cast<ns3::NetDevice *> (ns3::PeekPointer (arg1))->Ref(); py_NetDevice->obj = const_cast<ns3::NetDevice *> (ns3::PeekPointer (arg1)); PyNs3ObjectBase_wrapper_registry[(void *) py_NetDevice->obj] = (PyObject *) py_NetDevice; } wrapper_lookup_iter2 = PyNs3Empty_wrapper_registry.find((void *) const_cast<ns3::Packet *> (ns3::PeekPointer (arg2))); if (wrapper_lookup_iter2 == PyNs3Empty_wrapper_registry.end()) { py_Packet = NULL; } else { py_Packet = (PyNs3Packet *) wrapper_lookup_iter2->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 = PYBINDGEN_WRAPPER_FLAG_NONE; const_cast<ns3::Packet *> (ns3::PeekPointer (arg2))->Ref(); py_Packet->obj = const_cast<ns3::Packet *> (ns3::PeekPointer (arg2)); PyNs3Empty_wrapper_registry[(void *) py_Packet->obj] = (PyObject *) py_Packet; } py_Address = PyObject_New(PyNs3Address, &PyNs3Address_Type); py_Address->flags = PYBINDGEN_WRAPPER_FLAG_NONE; py_Address->obj = new ns3::Address(arg4); PyNs3Address_wrapper_registry[(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 (PyEval_ThreadsInitialized()) 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 (PyEval_ThreadsInitialized()) PyGILState_Release(__py_gil_state); return false; } retval = PyObject_IsTrue(py_boolretval); Py_DECREF(py_retval); Py_DECREF(args); if (PyEval_ThreadsInitialized()) 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 wrapper_lookup_iter2; PyTypeObject *wrapper_type2 = 0; PyNs3Address *py_Address; PyNs3Address *py_Address2; PyObject *args; __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0); wrapper_lookup_iter = PyNs3ObjectBase_wrapper_registry.find((void *) const_cast<ns3::NetDevice *> (ns3::PeekPointer (arg1))); if (wrapper_lookup_iter == PyNs3ObjectBase_wrapper_registry.end()) { py_NetDevice = NULL; } else { py_NetDevice = (PyNs3NetDevice *) wrapper_lookup_iter->second; Py_INCREF(py_NetDevice); } if (py_NetDevice == NULL) { wrapper_type = PyNs3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter__typeid_map.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 = PYBINDGEN_WRAPPER_FLAG_NONE; const_cast<ns3::NetDevice *> (ns3::PeekPointer (arg1))->Ref(); py_NetDevice->obj = const_cast<ns3::NetDevice *> (ns3::PeekPointer (arg1)); PyNs3ObjectBase_wrapper_registry[(void *) py_NetDevice->obj] = (PyObject *) py_NetDevice; } wrapper_lookup_iter2 = PyNs3Empty_wrapper_registry.find((void *) const_cast<ns3::Packet *> (ns3::PeekPointer (arg2))); if (wrapper_lookup_iter2 == PyNs3Empty_wrapper_registry.end()) { py_Packet = NULL; } else { py_Packet = (PyNs3Packet *) wrapper_lookup_iter2->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 = PYBINDGEN_WRAPPER_FLAG_NONE; const_cast<ns3::Packet *> (ns3::PeekPointer (arg2))->Ref(); py_Packet->obj = const_cast<ns3::Packet *> (ns3::PeekPointer (arg2)); PyNs3Empty_wrapper_registry[(void *) py_Packet->obj] = (PyObject *) py_Packet; } py_Address = PyObject_New(PyNs3Address, &PyNs3Address_Type); py_Address->flags = PYBINDGEN_WRAPPER_FLAG_NONE; py_Address->obj = new ns3::Address(arg4); PyNs3Address_wrapper_registry[(void *) py_Address->obj] = (PyObject *) py_Address; py_Address2 = PyObject_New(PyNs3Address, &PyNs3Address_Type); py_Address2->flags = PYBINDGEN_WRAPPER_FLAG_NONE; py_Address2->obj = new ns3::Address(arg5); PyNs3Address_wrapper_registry[(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 (PyEval_ThreadsInitialized()) 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 (PyEval_ThreadsInitialized()) PyGILState_Release(__py_gil_state); return; } Py_DECREF(py_retval); Py_DECREF(args); if (PyEval_ThreadsInitialized()) PyGILState_Release(__py_gil_state); return; } }; int _wrap_convert_py2c__ns3__Tap(PyObject *value, ns3::Tap *address); int _wrap_convert_py2c__double(PyObject *value, double *address); int _wrap_convert_py2c__unsigned_char(PyObject *value, unsigned char *address); int _wrap_convert_py2c__ns3__UanPacketArrival(PyObject *value, ns3::UanPacketArrival *address); int _wrap_convert_py2c__ns3__Ptr__lt___ns3__UanPhy___gt__(PyObject *value, ns3::Ptr< ns3::UanPhy > *address); int _wrap_convert_py2c__ns3__Ptr__lt___ns3__UanTransducer___gt__(PyObject *value, ns3::Ptr< ns3::UanTransducer > *address);
cyc805/VM
build/src/uan/bindings/ns3module.h
C
gpl-2.0
127,736
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.OrderAcceptReceiptPO; import po.OrganizationPO; import po.VehiclePO; /** * BusinessData */ public interface BusinessDataService extends Remote { // 根据营业厅ID(找到文件)和营业厅业务员ID(查找文件内容),ID为null就返回第一个 public BusinessPO getBusinessInfo(String organizationID, String ID) throws RemoteException; // 根据营业厅ID和车辆ID查询车辆PO public VehiclePO getVehicleInfo(String organizationID, String vehicleID) throws RemoteException; // 营业厅每日一个,每日早上8点发货一次 public boolean addReceipt(String organizationID, OrderAcceptReceiptPO po) throws RemoteException; // 获得某营业厅的全部车辆信息 public ArrayList<VehiclePO> getVehicleInfos(String organizationID) throws RemoteException; // 添加装车单到今日装车单文件中 public boolean addEnVehicleReceipt(String organizationID, ArrayList<EnVehicleReceiptPO> pos) throws RemoteException; // 增加一个车辆信息VehiclePO到VehiclePOList中 public boolean addVehicle(String organizationID, VehiclePO po) throws RemoteException; // 删除VehiclePOList中的一个车辆信息VehiclePO public boolean deleteVehicle(String organizationID, VehiclePO po) throws RemoteException; // 修改VehiclePOList中的一个车辆信息VehiclePO 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 getNumOfOrderAcceptReceipt(String organizationID) throws RemoteException; // 返回规定日期的所有GatheringReceipt,time格式 2015-11-23 public ArrayList<GatheringReceiptPO> getGatheringReceipt(String time) throws RemoteException; public ArrayList<GatheringReceiptPO> getGatheringReceiptByHallID(String organization) throws RemoteException; public ArrayList<GatheringReceiptPO> getGatheringReceiptByBoth(String organization, String time) throws RemoteException; // 增加一个DistributeOrder到本营业厅今日的文件中,一天也就一个 public boolean addDistributeReceipt(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> getSubmittedGatheringReceiptInfo() throws RemoteException; /** * Lizi 派件单 */ public ArrayList<DistributeReceiptPO> getSubmittedDistributeReceiptInfo() throws RemoteException; /** * Lizi 装车 */ public ArrayList<EnVehicleReceiptPO> getSubmittedEnVehicleReceiptInfo() throws RemoteException; /** * Lizi 到达单 */ public ArrayList<OrderAcceptReceiptPO> getSubmittedOrderAcceptReceiptInfo() throws RemoteException; public void saveDistributeReceiptInfo(DistributeReceiptPO po) throws RemoteException; public void saveOrderAcceptReceiptInfo(OrderAcceptReceiptPO po) throws RemoteException; public void saveEnVehicleReceiptInfo(EnVehicleReceiptPO po) throws RemoteException; public void saveGatheringReceiptInfo(GatheringReceiptPO po) throws RemoteException; // public boolean addDriverTime(String organizationID, String driverID) throws RemoteException; public ArrayList<OrganizationPO> getOrganizationInfos() throws RemoteException; public int getNumOfVehicles(String organizationID) throws RemoteException; public int getNumOfDrivers(String organizationID) throws RemoteException; public int getNumOfEnVechileReceipt(String organizationID) throws RemoteException; public int getNumOfOrderReceipt(String organizationID) throws RemoteException; public int getNumOfOrderDistributeReceipt(String organizationID) throws RemoteException; // // /** // * 返回待转运的订单的列表 // */ // public ArrayList<OrderPO> getTransferOrders() throws RemoteException; // // /** // * 返回待派送的订单的列表 // */ // public ArrayList<VehiclePO> getFreeVehicles() throws RemoteException; // // /** // * 生成装车单 // */ // public boolean addEnVehicleReceiptPO(EnVehicleReceiptPO po) throws // RemoteException; // // /** // * 获取收款汇总单 // */ // public ArrayList<GatheringReceiptPO> getGatheringReceiptPOs() throws // RemoteException; // // /** // * 增加收货单 // */ // public boolean addReceipt(OrderAcceptReceiptPO po) throws // RemoteException; // // /** // * 增加收款汇总单 // */ // // public boolean addGatheringReceipt(GatheringReceiptPO po); }
Disguiser-w/SE2
ELS_SERVICE/src/main/java/dataservice/businessdataservice/BusinessDataService.java
Java
gpl-2.0
5,469
# OpenStack ocata installation script on Ubuntu 16.04.2 # by kasidit chanchio # vasabilab, dept of computer science, # Thammasat University, Thailand # # Copyright 2017 Kasidit Chanchio # # 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/ \ --bootstrap-internal-url http://controller:5000/v3/ \ --bootstrap-public-url 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
kasidit/openstack-ocata-installer
documents/Example.OPSInstaller/controller/exe-stage09-SUDO-keystone.sh
Shell
gpl-2.0
1,087
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 usePlotGradientColor attribute (gradientCheckBox.checked) ?revenueChart.setChartAttribute('usePlotGradientColor', 1) : revenueChart.setChartAttribute('usePlotGradientColor', 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 "usePlotGradientColor": "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(); });
sguha-work/fiddletest
backup/fiddles/Chart/Data_plots/Configuring_gradient_fill_for_columns_in_column_charts/demo.js
JavaScript
gpl-2.0
1,726
/* Copyright (C) 2009 - 2012 by Bartosz Waresiak <[email protected]> Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. See the COPYING file for more details. */ #ifndef FORMULA_AI_FUNCTION_TABLE_HPP_INCLUDED #define FORMULA_AI_FUNCTION_TABLE_HPP_INCLUDED #include "formula_function.hpp" #include <set> namespace ai { class formula_ai; } namespace game_logic { class ai_function_symbol_table : public function_symbol_table { public: explicit ai_function_symbol_table(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 /* FORMULA_AI_FUNCTION_TABLE_HPP_INCLUDED */
asimonov-im/wesnoth
src/ai/formula/function_table.hpp
C++
gpl-2.0
1,169
/* -*- mode: c -*- */ /* Copyright (C) 2005-2016 Alexander Chernov <[email protected]> */ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #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 cpu_get_performance_info(unsigned char **p_model, unsigned char **p_mhz) { *p_model = NULL; *p_mhz = NULL; }
misty-fungus/ejudge-debian
win32/cpu.c
C
gpl-2.0
878
/* * This file is part of the UCB release of Plan 9. It is subject to the license * terms in the LICENSE file found in the top-level directory of this * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No * part of the UCB release of Plan 9, including this file, may be copied, * modified, propagated, or distributed except according to the terms contained * in the LICENSE file. */ #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]; /* * To generate a specific output frequency, the reference (m), * feedback (n), and post dividers (p) must be loaded with the * appropriate divide-down ratios. In the following r is the * XTALIN frequency (usually RefFreq) and t is the target frequency * (vga->f). * * Use the maximum reference divider left by the BIOS for now, * otherwise MCLK might be a concern. It can be calculated as * follows: * Upper Limit of PLL Lock Range * Minimum PLLREFCLK = ----------------------------- * (2*255) * * XTALIN * m = Floor[-----------------] * Minimum PLLREFCLK * * For an upper limit of 135MHz and XTALIN of 14.318MHz m * would be 54. */ m = mp->pll[PLLm]; vga->m[0] = m; /* * The post divider may be 1, 2, 4 or 8 and is determined by * calculating * t*m * q = ----- * (2*r) * and using the result to look-up p. */ 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 }, /* DRAM: ≤1M, > 1M */ { 9, 8 }, /* SDRAM: ≤1M, > 1M */ }; static ushort cyclesperqwordtab[2][2] = { { 3, 2 }, /* DRAM: ≤1M, > 1M */ { 2, 1 }, /* SDRAM: ≤1M, > 1M */ }; 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; } /* * (2*r*n) * f = ------- * (m*p) */ 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 */ };
brho/plan9
sys/src/cmd/aux/vga/mach64xx.c
C
gpl-2.0
30,679
/*! * address.js - Description * Copyright © 2012 by Ingenesis Limited. All rights reserved. * Licensed under the GPLv3 {@see license.txt} */ (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 = $('#shipping-address-fields'), billFields = $('#billing-address-fields'), 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 });
sharpmachine/whiteantelopestudio.com
wp-content/plugins/shopp/core/ui/behaviors/address.js
JavaScript
gpl-2.0
4,137
/* soundeffects.c * An example on how to use libmikmod to play sound effects. * * (C) 2004, Raphael Assenat ([email protected]) * * This example is distributed in the hope that it will be useful, * but WITHOUT ANY WARRENTY; without event the implied warrenty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * */ #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 */ MikMod_RegisterAllDrivers(); /* 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); } MikMod_DisableOutput(); Sample_Free(sfx2); Sample_Free(sfx1); MikMod_Exit(); return 0; }
gameblabla/methane
source/gcw/libmikmod-3.3.7/examples/soundeffects/soundeffects.c
C
gpl-2.0
2,980
/*++ drivers/i2c/busses/wmt-i2c-bus-3.c Copyright (c) 2013 WonderMedia Technologies, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. WonderMedia Technologies, Inc. 10F, 529, Chung-Cheng Road, Hsin-Tien, Taipei 231, R.O.C. --*/ /* 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 /* ms*/ #define MAX_RX_TIMEOUT 500 /* ms*/ #define CTRL_GPIO GPIO_CTRL_GP23_I2C3_BYTE_ADDR #define PU_EN_GPIO PULL_EN_GP23_I2C3_BYTE_ADDR #define PU_CTRL_GPIO PULL_CTRL_GP23_I2C3_BYTE_ADDR #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 i2c_wmt_wait_bus_not_busy(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 wmt_i2c3_power_state = 0;/*0:power on, 1:suspend, 2:shutdown*/ EXPORT_SYMBOL(wmt_i2c3_is_master); /**/ /* variable*/ /*-------------------------------------------------*/ static volatile struct wmt_i2c_s i2c ; DECLARE_WAIT_QUEUE_HEAD(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 == WMT_I2C_API_I2C_ADDR) return ret ; if (wmt_i2c3_power_state == 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)) { i2c_wmt_wait_bus_not_busy(); 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); } spin_unlock_irqrestore(&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 &= ~(I2C_CR_TX_NEXT_NO_ACK); /*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)(I2C_TCR_STANDARD_MODE|I2C_TCR_MASTER_READ |\ (slave_addr & I2C_TCR_SLAVE_ADDR_MASK)) ; else if (i2c.i2c_mode == I2C_FAST_MODE) tcr_value = (unsigned short)(I2C_TCR_FAST_MODE|I2C_TCR_MASTER_READ |\ (slave_addr & I2C_TCR_SLAVE_ADDR_MASK)) ; if (length == 1) i2c.regs->cr_reg |= I2C_CR_TX_NEXT_NO_ACK; /*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 == WMT_I2C_API_I2C_ADDR) 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 &= ~(I2C_CR_TX_NEXT_NO_ACK); /*clear NEXT_NO_ACK*/ if (length == 0) i2c.regs->cdr_reg = 0 ; else i2c.regs->cdr_reg = (unsigned short)(buf[xfer_length] & I2C_CDR_DATA_WRITE_MASK) ; tcr_value = 0 ; if (i2c.i2c_mode == I2C_STANDARD_MODE) tcr_value = (unsigned short)(I2C_TCR_STANDARD_MODE|I2C_TCR_MASTER_WRITE |\ (slave_addr & I2C_TCR_SLAVE_ADDR_MASK)) ; else if (i2c.i2c_mode == I2C_FAST_MODE) tcr_value = (unsigned short)(I2C_TCR_FAST_MODE|I2C_TCR_MASTER_WRITE |\ (slave_addr & I2C_TCR_SLAVE_ADDR_MASK)) ; 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 = i2c_wmt_wait_bus_not_busy() ; 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 &= ~(I2C_CR_TX_NEXT_NO_ACK); /*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)(I2C_TCR_STANDARD_MODE|I2C_TCR_MASTER_READ |\ (slave_addr & I2C_TCR_SLAVE_ADDR_MASK)) ; } else if (i2c.i2c_mode == I2C_FAST_MODE) { tcr_value = (unsigned short)(I2C_TCR_FAST_MODE|I2C_TCR_MASTER_READ |\ (slave_addr & I2C_TCR_SLAVE_ADDR_MASK)) ; } if (length == 1) i2c.regs->cr_reg |= I2C_CR_TX_NEXT_NO_ACK; /*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 = wait_event_interruptible_timeout(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 |= (I2C_CR_TX_NEXT_NO_ACK | 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 == WMT_I2C_API_I2C_ADDR) 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 = i2c_wmt_wait_bus_not_busy() ; 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] & I2C_CDR_DATA_WRITE_MASK) ; 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)(I2C_TCR_STANDARD_MODE|I2C_TCR_MASTER_WRITE |\ (slave_addr & I2C_TCR_SLAVE_ADDR_MASK)) ; else if (i2c.i2c_mode == I2C_FAST_MODE) tcr_value = (unsigned short)(I2C_TCR_FAST_MODE|I2C_TCR_MASTER_WRITE |\ (slave_addr & I2C_TCR_SLAVE_ADDR_MASK)) ; 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 = wait_event_interruptible_timeout(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 & I2C_CSR_RCV_ACK_MASK) == 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] & I2C_CDR_DATA_WRITE_MASK) ; 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 i2c_wmt_wait_bus_not_busy(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 = I2C_ISR_ALL_WRITE_CLEAR ; /* 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 = I2C_ISR_ALL_WRITE_CLEAR ; /* 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 wmt_i2c_transfer_msg(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) i2c_wmt_wait_bus_not_busy(); 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 &= ~(I2C_CR_TX_NEXT_NO_ACK); /*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)(I2C_TCR_STANDARD_MODE|I2C_TCR_MASTER_READ |\ (slave_addr & I2C_TCR_SLAVE_ADDR_MASK)) ; } else if (i2c.i2c_mode == I2C_FAST_MODE) { tcr_value = (unsigned short)(I2C_TCR_FAST_MODE|I2C_TCR_MASTER_READ |\ (slave_addr & I2C_TCR_SLAVE_ADDR_MASK)) ; } if (length == 1) i2c.regs->cr_reg |= I2C_CR_TX_NEXT_NO_ACK; /*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) i2c_wmt_wait_bus_not_busy(); 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] & I2C_CDR_DATA_WRITE_MASK) ; 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)(I2C_TCR_STANDARD_MODE|I2C_TCR_MASTER_WRITE |\ (slave_addr & I2C_TCR_SLAVE_ADDR_MASK)) ; else if (i2c.i2c_mode == I2C_FAST_MODE) tcr_value = (unsigned short)(I2C_TCR_FAST_MODE|I2C_TCR_MASTER_WRITE |\ (slave_addr & I2C_TCR_SLAVE_ADDR_MASK)) ; 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 = I2C_ISR_NACK_ADDR_WRITE_CLEAR ; tmp = i2c.regs->csr_reg ; /* read clear*/ i2c.isr_nack = 1 ; wakeup = 1 ; } if ((isr_status & I2C_ISR_BYTE_END && ((csr_reg & I2C_CSR_RCV_ACK_MASK) == 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 = I2C_ISR_BYTE_END_WRITE_CLEAR ; i2c.isr_nack = 1 ; wakeup = 1 ; } else if (isr_status & I2C_ISR_BYTE_END) { i2c.regs->isr_reg = I2C_ISR_BYTE_END_WRITE_CLEAR ; 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 | I2C_CR_TX_NEXT_NO_ACK); } /*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; wmt_i2c_transfer_msg(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; wmt_i2c_transfer_msg(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; wmt_i2c_transfer_msg(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; wmt_i2c_transfer_msg(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] & I2C_CDR_DATA_WRITE_MASK); /*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 & I2C_ISR_SCL_TIME_OUT) { 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 = I2C_ISR_SCL_TIME_OUT_WRITE_CLEAR | I2C_ISR_BYTE_END_WRITE_CLEAR; i2c.isr_timeout = 1 ; wakeup = 1; #endif i2c.regs->isr_reg = I2C_ISR_SCL_TIME_OUT_WRITE_CLEAR ; } if (wakeup) { /*spin_lock_irqsave(&i2c_wmt_irqlock, flags);*/ i2c.isr_int_pending = 1; /*spin_unlock_irqrestore(&i2c_wmt_irqlock, flags);*/ wake_up(&i2c3_wait); } else DPRINTK("i2c_err : unknown I2C ISR Handle 0x%4.4X" , isr_status) ; spin_unlock_irqrestore(&i2c3_wmt_irqlock, flags); return IRQ_HANDLED; } static int i2c_wmt_resource_init(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 i2c_wmt_resource_release(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: i2c_wmt_wait_bus_not_busy, 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"); wmt_i2c3_power_state = 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"); GPIO_CTRL_GP23_I2C3_BYTE_VAL &= ~(BIT0 | BIT1); PULL_EN_GP23_I2C3_BYTE_VAL |= (BIT0 | BIT1); PULL_CTRL_GP23_I2C3_BYTE_VAL |= (BIT0 | BIT1); PIN_SHARING_SEL_4BYTE_VAL &= ~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 CONFIG_I2C_SLAVE_WMT 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 CONFIG_I2C_SLAVE_WMT #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); PIN_SHARING_SEL_4BYTE_VAL &= ~BIT28; i2c.regs->cr_reg = 0 ; i2c.regs->div_reg = APB_96M_I2C_DIV ; i2c.regs->isr_reg = I2C_ISR_ALL_WRITE_CLEAR ; /* 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 = I2C_ISR_ALL_WRITE_CLEAR ; /* 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 (i2c_wmt_resource_init() == 0) { if (wmt_i2c_add_bus(&i2c_wmt_ops) < 0) { i2c_wmt_resource_release(); printk(KERN_INFO "i2c: Failed to add bus\n"); return -ENODEV; } } else return -ENODEV; INIT_LIST_HEAD(&wmt_i2c_fifohead); #ifdef CONFIG_PM register_syscore_ops(&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); i2c_wmt_resource_release(); 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);
FOSSEE/FOSSEE-netbook-kernel-source
drivers/i2c/busses/wmt-i2c-bus-3.c
C
gpl-2.0
32,741
/* BlueZ - Bluetooth protocol stack for Linux Copyright (C) 2010 Nokia Corporation Copyright (c) 2011-2012 The Linux Foundation. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation; 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 OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. */ /* 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 mgmt_pending_free_work { 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 mgmt_ev_cmd_complete *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(MGMT_EV_CMD_COMPLETE); 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 mgmt_rp_read_version rp; BT_DBG("sock %p", sk); rp.version = MGMT_VERSION; put_unaligned_le16(MGMT_REVISION, &rp.revision); return cmd_complete(sk, MGMT_INDEX_NONE, MGMT_OP_READ_VERSION, &rp, sizeof(rp)); } static int read_index_list(struct sock *sk) { struct mgmt_rp_read_index_list *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, MGMT_OP_READ_INDEX_LIST, rp, rp_len); kfree(rp); return err; } static int read_controller_info(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 mgmt_pending_free_worker(struct work_struct *work) { struct mgmt_pending_free_work *free_work = container_of(work, struct mgmt_pending_free_work, 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 mgmt_pending_free_work *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, mgmt_pending_free_worker); 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 mgmt_pending_foreach(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, HCI_OP_WRITE_CLASS_OF_DEV, sizeof(cod), cod); if (err == 0) memcpy(hdev->dev_class, cod, 3); return err; } static int set_limited_discoverable(struct sock *sk, u16 index, unsigned char *data, u16 len) { struct mgmt_mode *cp; struct hci_dev *hdev; struct pending_cmd *cmd; struct hci_cp_write_current_iac_lap 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, MGMT_OP_SET_LIMIT_DISCOVERABLE, EINVAL); hdev = hci_dev_get(index); if (!hdev) return cmd_status(sk, index, MGMT_OP_SET_LIMIT_DISCOVERABLE, ENODEV); hci_dev_lock_bh(hdev); if (!test_bit(HCI_UP, &hdev->flags)) { err = cmd_status(sk, index, MGMT_OP_SET_LIMIT_DISCOVERABLE, ENETDOWN); goto failed; } if (mgmt_pending_find(MGMT_OP_SET_LIMIT_DISCOVERABLE, index)) { err = cmd_status(sk, index, MGMT_OP_SET_LIMIT_DISCOVERABLE, EBUSY); goto failed; } if (cp->val == test_bit(HCI_ISCAN, &hdev->flags) && test_bit(HCI_PSCAN, &hdev->flags)) { err = cmd_status(sk, index, MGMT_OP_SET_LIMIT_DISCOVERABLE, EALREADY); goto failed; } cmd = mgmt_pending_add(sk, MGMT_OP_SET_LIMIT_DISCOVERABLE, 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 & MGMT_MAJOR_CLASS_LIMITED) update_cod = 0; hdev->major_class |= MGMT_MAJOR_CLASS_LIMITED; } else { if (!(hdev->major_class & MGMT_MAJOR_CLASS_LIMITED)) update_cod = 0; hdev->major_class &= ~MGMT_MAJOR_CLASS_LIMITED; } if (update_cod) err = update_class(hdev); if (err >= 0) err = hci_send_cmd(hdev, HCI_OP_WRITE_CURRENT_IAC_LAP, 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, MGMT_OP_SET_DISCOVERABLE, EINVAL); hdev = hci_dev_get(index); if (!hdev) return cmd_status(sk, index, MGMT_OP_SET_DISCOVERABLE, ENODEV); hci_dev_lock_bh(hdev); if (!test_bit(HCI_UP, &hdev->flags)) { err = cmd_status(sk, index, MGMT_OP_SET_DISCOVERABLE, ENETDOWN); goto failed; } if (mgmt_pending_find(MGMT_OP_SET_DISCOVERABLE, index) || mgmt_pending_find(MGMT_OP_SET_CONNECTABLE, index)) { err = cmd_status(sk, index, MGMT_OP_SET_DISCOVERABLE, EBUSY); goto failed; } if (cp->val == test_bit(HCI_ISCAN, &hdev->flags) && test_bit(HCI_PSCAN, &hdev->flags)) { err = cmd_status(sk, index, MGMT_OP_SET_DISCOVERABLE, EALREADY); goto failed; } cmd = mgmt_pending_add(sk, MGMT_OP_SET_DISCOVERABLE, index, data, len); if (!cmd) { err = -ENOMEM; goto failed; } scan = SCAN_PAGE; if (cp->val) scan |= SCAN_INQUIRY; err = hci_send_cmd(hdev, HCI_OP_WRITE_SCAN_ENABLE, 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, MGMT_OP_SET_CONNECTABLE, EINVAL); hdev = hci_dev_get(index); if (!hdev) return cmd_status(sk, index, MGMT_OP_SET_CONNECTABLE, ENODEV); hci_dev_lock_bh(hdev); if (!test_bit(HCI_UP, &hdev->flags)) { err = cmd_status(sk, index, MGMT_OP_SET_CONNECTABLE, ENETDOWN); goto failed; } if (mgmt_pending_find(MGMT_OP_SET_DISCOVERABLE, index) || mgmt_pending_find(MGMT_OP_SET_CONNECTABLE, index)) { err = cmd_status(sk, index, MGMT_OP_SET_CONNECTABLE, EBUSY); goto failed; } if (cp->val == test_bit(HCI_PSCAN, &hdev->flags)) { err = cmd_status(sk, index, MGMT_OP_SET_CONNECTABLE, EALREADY); goto failed; } cmd = mgmt_pending_add(sk, MGMT_OP_SET_CONNECTABLE, index, data, len); if (!cmd) { err = -ENOMEM; goto failed; } if (cp->val) scan = SCAN_PAGE; else scan = 0; err = hci_send_cmd(hdev, HCI_OP_WRITE_SCAN_ENABLE, 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, MGMT_OP_SET_PAIRABLE, EINVAL); hdev = hci_dev_get(index); if (!hdev) return cmd_status(sk, index, MGMT_OP_SET_PAIRABLE, 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, MGMT_OP_SET_PAIRABLE, 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 mgmt_cp_set_dev_class *cp; int err; cp = (void *) data; BT_DBG("request for hci%u", index); if (len != sizeof(*cp)) return cmd_status(sk, index, MGMT_OP_SET_DEV_CLASS, EINVAL); hdev = hci_dev_get(index); if (!hdev) return cmd_status(sk, index, MGMT_OP_SET_DEV_CLASS, ENODEV); hci_dev_lock_bh(hdev); hdev->major_class &= ~MGMT_MAJOR_CLASS_MASK; hdev->major_class |= cp->major & MGMT_MAJOR_CLASS_MASK; hdev->minor_class = cp->minor; if (test_bit(HCI_UP, &hdev->flags)) { err = update_class(hdev); if (err == 0) err = cmd_complete(sk, index, MGMT_OP_SET_DEV_CLASS, hdev->dev_class, sizeof(u8)*3); } else err = cmd_complete(sk, index, MGMT_OP_SET_DEV_CLASS, 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 mgmt_cp_set_service_cache *cp; int err; cp = (void *) data; if (len != sizeof(*cp)) return cmd_status(sk, index, MGMT_OP_SET_SERVICE_CACHE, EINVAL); hdev = hci_dev_get(index); if (!hdev) return cmd_status(sk, index, MGMT_OP_SET_SERVICE_CACHE, 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, MGMT_OP_SET_SERVICE_CACHE, 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 = hci_conn_hash_lookup_ba(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 = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr); if (!conn) { conn = hci_conn_hash_lookup_ba(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 mgmt_rp_get_connections *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, MGMT_OP_GET_CONNECTIONS, 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, MGMT_OP_GET_CONNECTIONS, 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 mgmt_cp_pin_code_reply *cp; struct hci_cp_pin_code_reply reply; struct pending_cmd *cmd; int err; BT_DBG(""); cp = (void *) data; if (len != sizeof(*cp)) return cmd_status(sk, index, MGMT_OP_PIN_CODE_REPLY, EINVAL); hdev = hci_dev_get(index); if (!hdev) return cmd_status(sk, index, MGMT_OP_PIN_CODE_REPLY, ENODEV); hci_dev_lock_bh(hdev); if (!test_bit(HCI_UP, &hdev->flags)) { err = cmd_status(sk, index, MGMT_OP_PIN_CODE_REPLY, ENETDOWN); goto failed; } cmd = mgmt_pending_add(sk, MGMT_OP_PIN_CODE_REPLY, 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, HCI_OP_PIN_CODE_REPLY, 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 mgmt_cp_encrypt_link *cp; struct hci_cp_set_conn_encrypt enc; struct hci_conn *conn; int err = 0; BT_DBG(""); cp = (void *) data; if (len != sizeof(*cp)) return cmd_status(sk, index, MGMT_OP_ENCRYPT_LINK, EINVAL); hdev = hci_dev_get(index); if (!hdev) return cmd_status(sk, index, MGMT_OP_ENCRYPT_LINK, ENODEV); hci_dev_lock_bh(hdev); if (!test_bit(HCI_UP, &hdev->flags)) { err = cmd_status(sk, index, MGMT_OP_ENCRYPT_LINK, ENETDOWN); goto done; } conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr); if (!conn) { err = cmd_status(sk, index, MGMT_OP_ENCRYPT_LINK, ENOTCONN); goto done; } if (test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) { err = cmd_status(sk, index, MGMT_OP_ENCRYPT_LINK, 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, HCI_OP_SET_CONN_ENCRYPT, sizeof(enc), &enc); } else { conn->auth_initiator = 1; if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->pend)) { struct hci_cp_auth_requested cp; cp.handle = cpu_to_le16(conn->handle); err = hci_send_cmd(conn->hdev, HCI_OP_AUTH_REQUESTED, 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 mgmt_cp_pin_code_neg_reply *cp; struct pending_cmd *cmd; int err; BT_DBG(""); cp = (void *) data; if (len != sizeof(*cp)) return cmd_status(sk, index, MGMT_OP_PIN_CODE_NEG_REPLY, EINVAL); hdev = hci_dev_get(index); if (!hdev) return cmd_status(sk, index, MGMT_OP_PIN_CODE_NEG_REPLY, ENODEV); hci_dev_lock_bh(hdev); if (!test_bit(HCI_UP, &hdev->flags)) { err = cmd_status(sk, index, MGMT_OP_PIN_CODE_NEG_REPLY, ENETDOWN); goto failed; } cmd = mgmt_pending_add(sk, MGMT_OP_PIN_CODE_NEG_REPLY, index, data, len); if (!cmd) { err = -ENOMEM; goto failed; } err = hci_send_cmd(hdev, HCI_OP_PIN_CODE_NEG_REPLY, 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 le_add_dev_white_list(struct sock *sk, u16 index, unsigned char *data, u16 len) { struct hci_dev *hdev; struct mgmt_cp_le_add_dev_white_list *cp; int err = 0; BT_DBG(""); cp = (void *) data; if (len != sizeof(*cp)) return cmd_status(sk, index, MGMT_OP_LE_ADD_DEV_WHITE_LIST, EINVAL); hdev = hci_dev_get(index); if (!hdev) return cmd_status(sk, index, MGMT_OP_LE_ADD_DEV_WHITE_LIST, ENODEV); hci_dev_lock_bh(hdev); if (!test_bit(HCI_UP, &hdev->flags)) { err = cmd_status(sk, index, MGMT_OP_LE_ADD_DEV_WHITE_LIST, ENETDOWN); goto failed; } hci_le_add_dev_white_list(hdev, &cp->bdaddr); failed: hci_dev_unlock_bh(hdev); hci_dev_put(hdev); return err; } static int le_remove_dev_white_list(struct sock *sk, u16 index, unsigned char *data, u16 len) { struct hci_dev *hdev; struct mgmt_cp_le_remove_dev_white_list *cp; int err = 0; BT_DBG(""); cp = (void *) data; if (len != sizeof(*cp)) return cmd_status(sk, index, MGMT_OP_LE_REMOVE_DEV_WHITE_LIST, EINVAL); hdev = hci_dev_get(index); if (!hdev) return cmd_status(sk, index, MGMT_OP_LE_REMOVE_DEV_WHITE_LIST, ENODEV); hci_dev_lock_bh(hdev); if (!test_bit(HCI_UP, &hdev->flags)) { err = cmd_status(sk, index, MGMT_OP_LE_REMOVE_DEV_WHITE_LIST, ENETDOWN); goto failed; } hci_le_remove_dev_white_list(hdev, &cp->bdaddr); failed: hci_dev_unlock_bh(hdev); hci_dev_put(hdev); return err; } static int le_create_conn_white_list(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, MGMT_OP_LE_CREATE_CONN_WHITE_LIST, ENODEV); hci_dev_lock_bh(hdev); if (!test_bit(HCI_UP, &hdev->flags)) { err = cmd_status(sk, index, MGMT_OP_LE_CREATE_CONN_WHITE_LIST, ENETDOWN); goto failed; } cmd = mgmt_pending_add(sk, MGMT_OP_LE_CREATE_CONN_WHITE_LIST, index, NULL, 0); if (!cmd) { err = -ENOMEM; goto failed; } sec_level = BT_SECURITY_MEDIUM; auth_type = HCI_AT_GENERAL_BONDING; 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 le_cancel_create_conn_white_list(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, MGMT_OP_LE_CANCEL_CREATE_CONN_WHITE_LIST, ENODEV); hci_dev_lock_bh(hdev); if (!test_bit(HCI_UP, &hdev->flags)) { err = cmd_status(sk, index, MGMT_OP_LE_CANCEL_CREATE_CONN_WHITE_LIST, ENETDOWN); goto failed; } hci_le_cancel_create_connect(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, MGMT_OP_LE_CLEAR_WHITE_LIST, ENODEV); hci_dev_lock_bh(hdev); if (!test_bit(HCI_UP, &hdev->flags)) { err = cmd_status(sk, index, MGMT_OP_LE_CLEAR_WHITE_LIST, ENETDOWN); goto failed; } err = hci_send_cmd(hdev, HCI_OP_LE_CLEAR_WHITE_LIST, 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 mgmt_cp_set_io_capability *cp; BT_DBG(""); cp = (void *) data; if (len != sizeof(*cp)) return cmd_status(sk, index, MGMT_OP_SET_IO_CAPABILITY, EINVAL); hdev = hci_dev_get(index); if (!hdev) return cmd_status(sk, index, MGMT_OP_SET_IO_CAPABILITY, 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, MGMT_OP_SET_IO_CAPABILITY, 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 pairing_security_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; } if (conn->type == LE_LINK) smp_link_encrypt_cmplt(conn->l2cap_data, status, status ? 0 : 1); else pairing_complete(cmd, status); } static void pairing_connect_complete_cb(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 discovery_terminated(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 = HCI_AT_DEDICATED_BONDING; 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 = pairing_connect_complete_cb; conn->security_cfm_cb = pairing_security_complete_cb; 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 mgmt_cp_user_confirm_reply *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 == MGMT_OP_USER_CONFIRM_NEG_REPLY) hci_op = HCI_OP_USER_CONFIRM_NEG_REPLY; else hci_op = HCI_OP_USER_CONFIRM_REPLY; 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 = hci_conn_hash_lookup_ba(hdev, LE_LINK, &cp->bdaddr); if (le_conn) { err = le_user_confirm_reply(le_conn, mgmt_op, (void *) cp); goto done; } BT_DBG("BR/EDR: %s", mgmt_op == MGMT_OP_USER_CONFIRM_NEG_REPLY ? "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 mgmt_cp_resolve_name *mgmt_cp = (void *) data; struct hci_cp_remote_name_req hci_cp; struct hci_dev *hdev; struct pending_cmd *cmd; int err; BT_DBG(""); if (len != sizeof(*mgmt_cp)) return cmd_status(sk, index, MGMT_OP_RESOLVE_NAME, EINVAL); hdev = hci_dev_get(index); if (!hdev) return cmd_status(sk, index, MGMT_OP_RESOLVE_NAME, ENODEV); hci_dev_lock_bh(hdev); cmd = mgmt_pending_add(sk, MGMT_OP_RESOLVE_NAME, 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, HCI_OP_REMOTE_NAME_REQ, 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 mgmt_cp_cancel_resolve_name *mgmt_cp = (void *) data; struct hci_cp_remote_name_req_cancel hci_cp; struct hci_dev *hdev; int err; BT_DBG(""); if (len != sizeof(*mgmt_cp)) return cmd_status(sk, index, MGMT_OP_CANCEL_RESOLVE_NAME, EINVAL); hdev = hci_dev_get(index); if (!hdev) return cmd_status(sk, index, MGMT_OP_CANCEL_RESOLVE_NAME, 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, HCI_OP_REMOTE_NAME_REQ_CANCEL, sizeof(hci_cp), &hci_cp); hci_dev_unlock_bh(hdev); hci_dev_put(hdev); return err; } static int set_connection_params(struct sock *sk, u16 index, unsigned char *data, u16 len) { struct mgmt_cp_set_connection_params *cp = (void *) data; struct hci_dev *hdev; struct hci_conn *conn; int err; BT_DBG(""); if (len != sizeof(*cp)) return cmd_status(sk, index, MGMT_OP_SET_CONNECTION_PARAMS, EINVAL); hdev = hci_dev_get(index); if (!hdev) return cmd_status(sk, index, MGMT_OP_SET_CONNECTION_PARAMS, ENODEV); hci_dev_lock_bh(hdev); conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, &cp->bdaddr); if (!conn) { err = cmd_status(sk, index, MGMT_OP_SET_CONNECTION_PARAMS, 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, MGMT_OP_SET_CONNECTION_PARAMS, 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 mgmt_cp_read_tx_power_level *cp = (void *) data; struct hci_cp_read_tx_power 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, MGMT_OP_READ_TX_POWER_LEVEL, EINVAL); hdev = hci_dev_get(index); if (!hdev) return cmd_status(sk, index, MGMT_OP_READ_TX_POWER_LEVEL, ENODEV); hci_dev_lock_bh(hdev); if (!test_bit(HCI_UP, &hdev->flags)) { err = cmd_status(sk, index, MGMT_OP_READ_TX_POWER_LEVEL, ENETDOWN); goto unlock; } if (mgmt_pending_find(MGMT_OP_READ_TX_POWER_LEVEL, index)) { err = cmd_status(sk, index, MGMT_OP_READ_TX_POWER_LEVEL, EBUSY); goto unlock; } cmd = mgmt_pending_add(sk, MGMT_OP_READ_TX_POWER_LEVEL, index, data, len); if (!cmd) { err = -ENOMEM; goto unlock; } conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr); if (!conn) conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, &cp->bdaddr); if (!conn) { err = cmd_status(sk, index, MGMT_OP_READ_TX_POWER_LEVEL, 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, HCI_OP_READ_TX_POWER, 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 mgmt_cp_set_rssi_reporter *cp = (void *) data; struct hci_dev *hdev; struct hci_conn *conn; int err = 0; if (len != sizeof(*cp)) return cmd_status(sk, index, MGMT_OP_SET_RSSI_REPORTER, EINVAL); hdev = hci_dev_get(index); if (!hdev) return cmd_status(sk, index, MGMT_OP_SET_RSSI_REPORTER, ENODEV); hci_dev_lock_bh(hdev); conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, &cp->bdaddr); if (!conn) { err = cmd_status(sk, index, MGMT_OP_SET_RSSI_REPORTER, ENOTCONN); goto failed; } BT_DBG("updateOnThreshExceed %d ", cp->updateOnThreshExceed); hci_conn_set_rssi_reporter(conn, cp->rssi_threshold, __le16_to_cpu(cp->interval), cp->updateOnThreshExceed); 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 mgmt_cp_unset_rssi_reporter *cp = (void *) data; struct hci_dev *hdev; struct hci_conn *conn; int err = 0; if (len != sizeof(*cp)) return cmd_status(sk, index, MGMT_OP_UNSET_RSSI_REPORTER, EINVAL); hdev = hci_dev_get(index); if (!hdev) return cmd_status(sk, index, MGMT_OP_UNSET_RSSI_REPORTER, ENODEV); hci_dev_lock_bh(hdev); conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, &cp->bdaddr); if (!conn) { err = cmd_status(sk, index, MGMT_OP_UNSET_RSSI_REPORTER, ENOTCONN); goto failed; } hci_conn_unset_rssi_reporter(conn); failed: hci_dev_unlock_bh(hdev); hci_dev_put(hdev); return err; } static int le_cancel_create_conn(struct sock *sk, u16 index, unsigned char *data, u16 len) { struct mgmt_cp_le_cancel_create_conn *cp = (void *) data; struct hci_dev *hdev; int err = 0; if (len != sizeof(*cp)) return cmd_status(sk, index, MGMT_OP_LE_CANCEL_CREATE_CONN, EINVAL); hdev = hci_dev_get(index); if (!hdev) return cmd_status(sk, index, MGMT_OP_LE_CANCEL_CREATE_CONN, ENODEV); hci_dev_lock_bh(hdev); if (!test_bit(HCI_UP, &hdev->flags)) { err = cmd_status(sk, index, MGMT_OP_LE_CANCEL_CREATE_CONN, ENETDOWN); goto failed; } hci_le_cancel_create_connect(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 mgmt_cp_set_local_name *mgmt_cp = (void *) data; struct hci_cp_write_local_name hci_cp; struct hci_dev *hdev; struct pending_cmd *cmd; int err; BT_DBG(""); if (len != sizeof(*mgmt_cp)) return cmd_status(sk, index, MGMT_OP_SET_LOCAL_NAME, EINVAL); hdev = hci_dev_get(index); if (!hdev) return cmd_status(sk, index, MGMT_OP_SET_LOCAL_NAME, ENODEV); hci_dev_lock_bh(hdev); cmd = mgmt_pending_add(sk, MGMT_OP_SET_LOCAL_NAME, 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, HCI_OP_WRITE_LOCAL_NAME, 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 == MGMT_OP_START_DISCOVERY) { ev.val = 1; cmd_status(cmd->sk, cmd->index, MGMT_OP_START_DISCOVERY, 0); } else { ev.val = 0; cmd_complete(cmd->sk, cmd->index, MGMT_OP_STOP_DISCOVERY, NULL, 0); if (cmd->opcode == MGMT_OP_STOP_DISCOVERY) { 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 mgmt_inquiry_started(u16 index) { BT_DBG(""); mgmt_pending_foreach(MGMT_OP_START_DISCOVERY, index, discovery_rsp, NULL); } void mgmt_inquiry_complete_evt(u16 index, u8 status) { struct hci_dev *hdev; struct hci_cp_le_set_scan_enable 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)) { mgmt_pending_foreach(MGMT_OP_STOP_DISCOVERY, index, discovery_terminated, 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, HCI_OP_LE_SET_SCAN_ENABLE, 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) mgmt_pending_foreach(MGMT_OP_STOP_DISCOVERY, index, discovery_terminated, 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 hci_cp_le_set_scan_enable le_cp = {0, 0}; if (test_bit(HCI_UP, &hdev->flags)) { if (hdev->disco_state == SCAN_LE) hci_send_cmd(hdev, HCI_OP_LE_SET_SCAN_ENABLE, sizeof(le_cp), &le_cp); else hci_send_cmd(hdev, HCI_OP_INQUIRY_CANCEL, 0, NULL); } hdev->disco_state = SCAN_IDLE; } mgmt_event(MGMT_EV_DISCOVERING, hdev->id, &cp, sizeof(cp), NULL); cmd = mgmt_pending_find(MGMT_OP_STOP_DISCOVERY, hdev->id); if (cmd) mgmt_pending_remove(cmd); hci_dev_unlock_bh(hdev); hci_dev_put(hdev); } void mgmt_disco_le_timeout(unsigned long data) { struct hci_dev *hdev = (void *)data; struct hci_cp_le_set_scan_enable 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, HCI_OP_LE_SET_SCAN_ENABLE, 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, MGMT_OP_START_DISCOVERY, 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, MGMT_OP_START_DISCOVERY, 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 hci_cp_le_set_scan_parameters 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, HCI_OP_LE_SET_SCAN_PARAMETERS, 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(MGMT_OP_STOP_DISCOVERY, index); if (!cmd) mgmt_pending_add(sk, MGMT_OP_STOP_DISCOVERY, 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, MGMT_OP_START_DISCOVERY, -err); return err; } static int stop_discovery(struct sock *sk, u16 index) { struct hci_cp_le_set_scan_enable 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, MGMT_OP_STOP_DISCOVERY, 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, HCI_OP_LE_SET_SCAN_ENABLE, sizeof(le_cp), &le_cp); if (err >= 0) { mgmt_pending_foreach(MGMT_OP_STOP_DISCOVERY, index, discovery_terminated, NULL); err = cmd_complete(sk, index, MGMT_OP_STOP_DISCOVERY, NULL, 0); } } else if (state == SCAN_BR) err = hci_send_cmd(hdev, HCI_OP_INQUIRY_CANCEL, 0, NULL); cmd = mgmt_pending_find(MGMT_OP_STOP_DISCOVERY, 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, MGMT_OP_STOP_DISCOVERY, -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, MGMT_OP_READ_LOCAL_OOB_DATA, ENODEV); hci_dev_lock_bh(hdev); if (!test_bit(HCI_UP, &hdev->flags)) { err = cmd_status(sk, index, MGMT_OP_READ_LOCAL_OOB_DATA, ENETDOWN); goto unlock; } if (!(hdev->features[6] & LMP_SIMPLE_PAIR)) { err = cmd_status(sk, index, MGMT_OP_READ_LOCAL_OOB_DATA, EOPNOTSUPP); goto unlock; } if (mgmt_pending_find(MGMT_OP_READ_LOCAL_OOB_DATA, index)) { err = cmd_status(sk, index, MGMT_OP_READ_LOCAL_OOB_DATA, EBUSY); goto unlock; } cmd = mgmt_pending_add(sk, MGMT_OP_READ_LOCAL_OOB_DATA, index, NULL, 0); if (!cmd) { err = -ENOMEM; goto unlock; } err = hci_send_cmd(hdev, HCI_OP_READ_LOCAL_OOB_DATA, 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 mgmt_cp_add_remote_oob_data *cp = (void *) data; int err; BT_DBG("hci%u ", index); if (len != sizeof(*cp)) return cmd_status(sk, index, MGMT_OP_ADD_REMOTE_OOB_DATA, EINVAL); hdev = hci_dev_get(index); if (!hdev) return cmd_status(sk, index, MGMT_OP_ADD_REMOTE_OOB_DATA, ENODEV); hci_dev_lock_bh(hdev); err = hci_add_remote_oob_data(hdev, &cp->bdaddr, cp->hash, cp->randomizer); if (err < 0) err = cmd_status(sk, index, MGMT_OP_ADD_REMOTE_OOB_DATA, -err); else err = cmd_complete(sk, index, MGMT_OP_ADD_REMOTE_OOB_DATA, NULL, 0); hci_dev_unlock_bh(hdev); hci_dev_put(hdev); return err; } static int remove_remote_oob_data(struct sock *sk, u16 index, unsigned char *data, u16 len) { struct hci_dev *hdev; struct mgmt_cp_remove_remote_oob_data *cp = (void *) data; int err; BT_DBG("hci%u ", index); if (len != sizeof(*cp)) return cmd_status(sk, index, MGMT_OP_REMOVE_REMOTE_OOB_DATA, EINVAL); hdev = hci_dev_get(index); if (!hdev) return cmd_status(sk, index, MGMT_OP_REMOVE_REMOTE_OOB_DATA, ENODEV); hci_dev_lock_bh(hdev); err = hci_remove_remote_oob_data(hdev, &cp->bdaddr); if (err < 0) err = cmd_status(sk, index, MGMT_OP_REMOVE_REMOTE_OOB_DATA, -err); else err = cmd_complete(sk, index, MGMT_OP_REMOVE_REMOTE_OOB_DATA, 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 MGMT_OP_READ_VERSION: err = read_version(sk); break; case MGMT_OP_READ_INDEX_LIST: err = read_index_list(sk); break; case MGMT_OP_READ_INFO: err = read_controller_info(sk, index); break; case MGMT_OP_SET_POWERED: err = set_powered(sk, index, buf + sizeof(*hdr), len); break; case MGMT_OP_SET_DISCOVERABLE: err = set_discoverable(sk, index, buf + sizeof(*hdr), len); break; case MGMT_OP_SET_LIMIT_DISCOVERABLE: err = set_limited_discoverable(sk, index, buf + sizeof(*hdr), len); break; case MGMT_OP_SET_CONNECTABLE: err = set_connectable(sk, index, buf + sizeof(*hdr), len); break; case MGMT_OP_SET_PAIRABLE: 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 MGMT_OP_SET_DEV_CLASS: err = set_dev_class(sk, index, buf + sizeof(*hdr), len); break; case MGMT_OP_SET_SERVICE_CACHE: 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 MGMT_OP_GET_CONNECTIONS: err = get_connections(sk, index); break; case MGMT_OP_PIN_CODE_REPLY: err = pin_code_reply(sk, index, buf + sizeof(*hdr), len); break; case MGMT_OP_PIN_CODE_NEG_REPLY: err = pin_code_neg_reply(sk, index, buf + sizeof(*hdr), len); break; case MGMT_OP_SET_IO_CAPABILITY: 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 MGMT_OP_USER_CONFIRM_REPLY: case MGMT_OP_USER_PASSKEY_REPLY: case MGMT_OP_USER_CONFIRM_NEG_REPLY: err = user_confirm_reply(sk, index, buf + sizeof(*hdr), len, opcode); break; case MGMT_OP_SET_LOCAL_NAME: err = set_local_name(sk, index, buf + sizeof(*hdr), len); break; case MGMT_OP_START_DISCOVERY: err = start_discovery(sk, index); break; case MGMT_OP_STOP_DISCOVERY: err = stop_discovery(sk, index); break; case MGMT_OP_RESOLVE_NAME: err = resolve_name(sk, index, buf + sizeof(*hdr), len); break; case MGMT_OP_CANCEL_RESOLVE_NAME: err = cancel_resolve_name(sk, index, buf + sizeof(*hdr), len); break; case MGMT_OP_SET_CONNECTION_PARAMS: err = set_connection_params(sk, index, buf + sizeof(*hdr), len); break; case MGMT_OP_SET_RSSI_REPORTER: err = set_rssi_reporter(sk, index, buf + sizeof(*hdr), len); break; case MGMT_OP_UNSET_RSSI_REPORTER: err = unset_rssi_reporter(sk, index, buf + sizeof(*hdr), len); break; case MGMT_OP_READ_LOCAL_OOB_DATA: err = read_local_oob_data(sk, index); break; case MGMT_OP_ADD_REMOTE_OOB_DATA: err = add_remote_oob_data(sk, index, buf + sizeof(*hdr), len); break; case MGMT_OP_REMOVE_REMOTE_OOB_DATA: err = remove_remote_oob_data(sk, index, buf + sizeof(*hdr), len); break; case MGMT_OP_ENCRYPT_LINK: err = encrypt_link(sk, index, buf + sizeof(*hdr), len); break; case MGMT_OP_LE_ADD_DEV_WHITE_LIST: err = le_add_dev_white_list(sk, index, buf + sizeof(*hdr), len); break; case MGMT_OP_LE_REMOVE_DEV_WHITE_LIST: err = le_remove_dev_white_list(sk, index, buf + sizeof(*hdr), len); break; case MGMT_OP_LE_CLEAR_WHITE_LIST: err = le_clear_white_list(sk, index); break; case MGMT_OP_LE_CREATE_CONN_WHITE_LIST: err = le_create_conn_white_list(sk, index); break; case MGMT_OP_LE_CANCEL_CREATE_CONN_WHITE_LIST: err = le_cancel_create_conn_white_list(sk, index); break; case MGMT_OP_LE_CANCEL_CREATE_CONN: err = le_cancel_create_conn(sk, index, buf + sizeof(*hdr), len); break; case MGMT_OP_READ_TX_POWER_LEVEL: 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); mgmt_pending_foreach(0, index, cmd_status_rsp, &status); return mgmt_event(MGMT_EV_INDEX_REMOVED, 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); mgmt_pending_foreach(MGMT_OP_SET_POWERED, index, mode_rsp, &match); if (!powered) { u8 status = ENETDOWN; mgmt_pending_foreach(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 mgmt_set_powered_failed(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 = MGMT_STATUS_RFKILLED; 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; mgmt_pending_foreach(MGMT_OP_SET_DISCOVERABLE, index, mode_rsp, &match); ev.val = discoverable; ret = mgmt_event(MGMT_EV_DISCOVERABLE, 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; mgmt_pending_foreach(MGMT_OP_SET_CONNECTABLE, 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(MGMT_OP_LE_CREATE_CONN_WHITE_LIST, 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 mgmt_ev_le_conn_params ev; bacpy(&ev.bdaddr, bdaddr); ev.interval = interval; ev.latency = latency; ev.timeout = timeout; return mgmt_event(MGMT_EV_LE_CONN_PARAMS, 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 mgmt_ev_disconnected ev; struct sock *sk = NULL; int err; bacpy(&ev.bdaddr, bdaddr); ev.reason = reason; err = mgmt_event(MGMT_EV_DISCONNECTED, index, &ev, sizeof(ev), sk); if (sk) sock_put(sk); mgmt_pending_foreach(MGMT_OP_DISCONNECT, index, disconnect_rsp, &sk); return err; } int mgmt_disconnect_failed(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 mgmt_ev_connect_failed ev; bacpy(&ev.bdaddr, bdaddr); ev.status = status; return mgmt_event(MGMT_EV_CONNECT_FAILED, index, &ev, sizeof(ev), NULL); } int mgmt_pin_code_request(u16 index, bdaddr_t *bdaddr) { struct mgmt_ev_pin_code_request ev; BT_DBG("hci%u", index); bacpy(&ev.bdaddr, bdaddr); ev.secure = 0; return mgmt_event(MGMT_EV_PIN_CODE_REQUEST, index, &ev, sizeof(ev), NULL); } int mgmt_pin_code_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status) { struct pending_cmd *cmd; struct mgmt_rp_pin_code_reply rp; int err; cmd = mgmt_pending_find(MGMT_OP_PIN_CODE_REPLY, index); if (!cmd) return -ENOENT; bacpy(&rp.bdaddr, bdaddr); rp.status = status; err = cmd_complete(cmd->sk, index, MGMT_OP_PIN_CODE_REPLY, &rp, sizeof(rp)); mgmt_pending_remove(cmd); return err; } int mgmt_pin_code_neg_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status) { struct pending_cmd *cmd; struct mgmt_rp_pin_code_reply rp; int err; cmd = mgmt_pending_find(MGMT_OP_PIN_CODE_NEG_REPLY, index); if (!cmd) return -ENOENT; bacpy(&rp.bdaddr, bdaddr); rp.status = status; err = cmd_complete(cmd->sk, index, MGMT_OP_PIN_CODE_NEG_REPLY, &rp, sizeof(rp)); mgmt_pending_remove(cmd); return err; } int mgmt_user_confirm_request(u16 index, u8 event, bdaddr_t *bdaddr, __le32 value) { struct mgmt_ev_user_confirm_request 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 = hci_conn_hash_lookup_ba(hdev, ACL_LINK, bdaddr); ev.auto_confirm = 0; if (!conn || event != HCI_EV_USER_CONFIRM_REQUEST) 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 & HCI_AT_DEDICATED_BONDING) && 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(MGMT_EV_USER_CONFIRM_REQUEST, index, &ev, sizeof(ev), NULL); } int mgmt_user_passkey_request(u16 index, bdaddr_t *bdaddr) { struct mgmt_ev_user_passkey_request ev; BT_DBG("hci%u", index); bacpy(&ev.bdaddr, bdaddr); return mgmt_event(MGMT_EV_USER_PASSKEY_REQUEST, index, &ev, sizeof(ev), NULL); } static int confirm_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status, u8 opcode) { struct pending_cmd *cmd; struct mgmt_rp_user_confirm_reply 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 mgmt_user_confirm_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status) { return confirm_reply_complete(index, bdaddr, status, MGMT_OP_USER_CONFIRM_REPLY); } int mgmt_user_confirm_neg_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status) { return confirm_reply_complete(index, bdaddr, status, MGMT_OP_USER_CONFIRM_NEG_REPLY); } 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 mgmt_set_local_name_complete(u16 index, u8 *name, u8 status) { struct pending_cmd *cmd; struct hci_dev *hdev; struct mgmt_cp_set_local_name ev; int err; memset(&ev, 0, sizeof(ev)); memcpy(ev.name, name, HCI_MAX_NAME_LENGTH); cmd = mgmt_pending_find(MGMT_OP_SET_LOCAL_NAME, index); if (!cmd) goto send_event; if (status) { err = cmd_status(cmd->sk, index, MGMT_OP_SET_LOCAL_NAME, EIO); goto failed; } hdev = hci_dev_get(index); if (hdev) { update_eir(hdev); hci_dev_put(hdev); } err = cmd_complete(cmd->sk, index, MGMT_OP_SET_LOCAL_NAME, &ev, sizeof(ev)); if (err < 0) goto failed; send_event: err = mgmt_event(MGMT_EV_LOCAL_NAME_CHANGED, index, &ev, sizeof(ev), cmd ? cmd->sk : NULL); failed: if (cmd) mgmt_pending_remove(cmd); return err; } int mgmt_read_local_oob_data_reply_complete(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(MGMT_OP_READ_LOCAL_OOB_DATA, index); if (!cmd) return -ENOENT; if (status) { err = cmd_status(cmd->sk, index, MGMT_OP_READ_LOCAL_OOB_DATA, EIO); } else { struct mgmt_rp_read_local_oob_data rp; memcpy(rp.hash, hash, sizeof(rp.hash)); memcpy(rp.randomizer, randomizer, sizeof(rp.randomizer)); err = cmd_complete(cmd->sk, index, MGMT_OP_READ_LOCAL_OOB_DATA, &rp, sizeof(rp)); } mgmt_pending_remove(cmd); return err; } void mgmt_read_rssi_complete(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 = hci_conn_hash_lookup_handle(hdev, handle); if (!conn) return; BT_DBG("rssi_update_thresh_exceed : %d ", conn->rssi_update_thresh_exceed); BT_DBG("RSSI Threshold : %d , recvd RSSI : %d ", conn->rssi_threshold, rssi); if (conn->rssi_update_thresh_exceed == 1) { BT_DBG("rssi_update_thresh_exceed == 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 { hci_conn_set_rssi_reporter(conn, conn->rssi_threshold, conn->rssi_update_interval, conn->rssi_update_thresh_exceed); } } else { BT_DBG("rssi_update_thresh_exceed == 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 { hci_conn_set_rssi_reporter(conn, conn->rssi_threshold, conn->rssi_update_interval, conn->rssi_update_thresh_exceed); } } } int mgmt_read_tx_power_failed(u16 index) { struct pending_cmd *cmd; int err; cmd = mgmt_pending_find(MGMT_OP_READ_TX_POWER_LEVEL, index); if (!cmd) return -ENOENT; err = cmd_status(cmd->sk, index, MGMT_OP_READ_TX_POWER_LEVEL, EIO); mgmt_pending_remove(cmd); return err; } int mgmt_read_tx_power_complete(u16 index, bdaddr_t *bdaddr, s8 level, u8 status) { struct pending_cmd *cmd; struct mgmt_rp_read_tx_power_level rp; int err; cmd = mgmt_pending_find(MGMT_OP_READ_TX_POWER_LEVEL, index); if (!cmd) return -ENOENT; bacpy(&rp.bdaddr, bdaddr); rp.status = status; rp.level = level; err = cmd_complete(cmd->sk, index, MGMT_OP_READ_TX_POWER_LEVEL, &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 mgmt_ev_device_found 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(MGMT_EV_DEVICE_FOUND, 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 hci_cp_le_set_scan_enable 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, HCI_OP_LE_SET_SCAN_ENABLE, 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 mgmt_ev_encrypt_change ev; BT_DBG("hci%u", index); bacpy(&ev.bdaddr, bdaddr); ev.status = status; return mgmt_event(MGMT_EV_ENCRYPT_CHANGE, index, &ev, sizeof(ev), NULL); } int mgmt_remote_class(u16 index, bdaddr_t *bdaddr, u8 dev_class[3]) { struct mgmt_ev_remote_class ev; memset(&ev, 0, sizeof(ev)); bacpy(&ev.bdaddr, bdaddr); memcpy(ev.dev_class, dev_class, 3); return mgmt_event(MGMT_EV_REMOTE_CLASS, index, &ev, sizeof(ev), NULL); } int mgmt_remote_version(u16 index, bdaddr_t *bdaddr, u8 ver, u16 mnf, u16 sub_ver) { struct mgmt_ev_remote_version 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(MGMT_EV_REMOTE_VERSION, index, &ev, sizeof(ev), NULL); } int mgmt_remote_features(u16 index, bdaddr_t *bdaddr, u8 features[8]) { struct mgmt_ev_remote_features ev; memset(&ev, 0, sizeof(ev)); bacpy(&ev.bdaddr, bdaddr); memcpy(ev.features, features, sizeof(ev.features)); return mgmt_event(MGMT_EV_REMOTE_FEATURES, index, &ev, sizeof(ev), NULL); }
BrateloSlava/kernel_apq8064
net/bluetooth/mgmt.c
C
gpl-2.0
77,823
/* * Copyright (C) 2013 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef NetworkProcessPlatformStrategies_h #define NetworkProcessPlatformStrategies_h #include <WebCore/LoaderStrategy.h> #include <WebCore/PlatformStrategies.h> namespace WebKit { class NetworkProcessPlatformStrategies : public WebCore::PlatformStrategies { public: static void initialize(); private: // WebCore::PlatformStrategies WebCore::CookiesStrategy* createCookiesStrategy() override; WebCore::LoaderStrategy* createLoaderStrategy() override; WebCore::PasteboardStrategy* createPasteboardStrategy() override; WebCore::PluginStrategy* createPluginStrategy() override; WebCore::BlobRegistry* createBlobRegistry() override; }; } // namespace WebKit #endif // NetworkProcessPlatformStrategies_h
qtproject/qtwebkit
Source/WebKit2/NetworkProcess/NetworkProcessPlatformStrategies.h
C
gpl-2.0
2,094