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
select count(*) from (select processing_id from processing WHERE workflow_run_id IS NULL AND ancestor_workflow_run_id IS NULL EXCEPT select parent_id from processing_relationship EXCEPT select child_id from processing_relationship EXCEPT select processing_id from processing_experiments EXCEPT select processing_id from processing_files EXCEPT select processing_id from processing_ius EXCEPT select processing_id from processing_lanes EXCEPT select processing_id from processing_samples EXCEPT select processing_id from processing_sequencer_runs EXCEPT select processing_id from processing_studies) AS foo;
SeqWare/seqware
seqware-meta-db/cleanup_scripts/identify_orphan_processing.sql
SQL
gpl-3.0
625
/* * Cppcheck - A tool for static C/C++ code analysis * Copyright (C) 2007-2016 Cppcheck team. * * 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 3 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/>. */ //--------------------------------------------------------------------------- #ifndef checkunusedvarH #define checkunusedvarH //--------------------------------------------------------------------------- #include "config.h" #include "check.h" #include <map> class Type; class Scope; class Variables; /// @addtogroup Checks /// @{ /** @brief Various small checks */ class CPPCHECKLIB CheckUnusedVar : public Check { public: /** @brief This constructor is used when registering the CheckClass */ CheckUnusedVar() : Check(myName()) { } /** @brief This constructor is used when running checks. */ CheckUnusedVar(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) : Check(myName(), tokenizer, settings, errorLogger) { } /** @brief Run checks against the normal token list */ void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { CheckUnusedVar checkUnusedVar(tokenizer, settings, errorLogger); // Coding style checks checkUnusedVar.checkStructMemberUsage(); checkUnusedVar.checkFunctionVariableUsage(); } /** @brief Run checks against the simplified token list */ void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { (void)tokenizer; (void)settings; (void)errorLogger; } /** @brief %Check for unused function variables */ void checkFunctionVariableUsage_iterateScopes(const Scope* const scope, Variables& variables, bool insideLoop); void checkFunctionVariableUsage(); /** @brief %Check that all struct members are used */ void checkStructMemberUsage(); private: bool isRecordTypeWithoutSideEffects(const Type* type); bool isEmptyType(const Type* type); // Error messages.. void unusedStructMemberError(const Token *tok, const std::string &structname, const std::string &varname, bool isUnion = false); void unusedVariableError(const Token *tok, const std::string &varname); void allocatedButUnusedVariableError(const Token *tok, const std::string &varname); void unreadVariableError(const Token *tok, const std::string &varname); void unassignedVariableError(const Token *tok, const std::string &varname); void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const { CheckUnusedVar c(nullptr, settings, errorLogger); // style/warning c.unusedVariableError(nullptr, "varname"); c.allocatedButUnusedVariableError(nullptr, "varname"); c.unreadVariableError(nullptr, "varname"); c.unassignedVariableError(nullptr, "varname"); c.unusedStructMemberError(nullptr, "structname", "variable"); } static std::string myName() { return "UnusedVar"; } std::string classInfo() const { return "UnusedVar checks\n" // style "- unused variable\n" "- allocated but unused variable\n" "- unred variable\n" "- unassigned variable\n" "- unused struct member\n"; } std::map<const Type *,bool> isRecordTypeWithoutSideEffectsMap; std::map<const Type *,bool> isEmptyTypeMap; }; /// @} //--------------------------------------------------------------------------- #endif // checkunusedvarH
Nicobubu/cppcheck
lib/checkunusedvar.h
C
gpl-3.0
4,138
#ifndef MANTID_MANTIDWIDGETS_ALGORITHMHINTSTRATEGYTEST_H #define MANTID_MANTIDWIDGETS_ALGORITHMHINTSTRATEGYTEST_H #include <cxxtest/TestSuite.h> #include "MantidAPI/FrameworkManager.h" #include "MantidAPI/AlgorithmManager.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidKernel/ArrayProperty.h" #include "MantidKernel/BoundedValidator.h" #include "MantidQtWidgets/Common/HintStrategy.h" #include "MantidQtWidgets/Common/AlgorithmHintStrategy.h" #include <boost/scoped_ptr.hpp> using namespace MantidQt::MantidWidgets; using namespace Mantid::API; //===================================================================================== // Functional tests //===================================================================================== class AlgorithmHintStrategyTest : public CxxTest::TestSuite { // Inner class :: Fake Algorithm class FakeAlgorithm : public Algorithm { public: FakeAlgorithm() {} ~FakeAlgorithm() override {} const std::string name() const override { return "Fake Algorithm"; }; int version() const override { return 1; }; const std::string category() const override { return ""; }; const std::string summary() const override { return "A Fake Algorithm"; }; private: void init() override { declareProperty("IntValue", 0); declareProperty("DoubleValue", 0.01); declareProperty("BoolValue", false); declareProperty("StringValue", "Empty"); auto mustBePositive = boost::make_shared<Mantid::Kernel::BoundedValidator<int>>(); mustBePositive->setLower(0); declareProperty("PositiveIntValue", 0, mustBePositive); declareProperty("PositiveIntValue1", 0, mustBePositive); declareProperty( Mantid::Kernel::make_unique<Mantid::Kernel::ArrayProperty<int>>( "IntArray")); declareProperty( Mantid::Kernel::make_unique<Mantid::Kernel::ArrayProperty<double>>( "DoubleArray")); declareProperty(Mantid::Kernel::make_unique< Mantid::Kernel::ArrayProperty<std::string>>("StringArray")); }; void exec() override { return; }; }; public: // This pair of boilerplate methods prevent the suite being created statically // This means the constructor isn't called when running other tests static AlgorithmHintStrategyTest *createSuite() { return new AlgorithmHintStrategyTest(); } static void destroySuite(AlgorithmHintStrategyTest *suite) { delete suite; } AlgorithmHintStrategyTest() { m_propAlg = static_cast<IAlgorithm_sptr>(new FakeAlgorithm()); m_propAlg->initialize(); // Expected hints for PropertyAlgorithm m_propMap["IntValue"] = ""; m_propMap["DoubleValue"] = ""; m_propMap["BoolValue"] = ""; m_propMap["StringValue"] = ""; m_propMap["PositiveIntValue"] = ""; m_propMap["PositiveIntValue1"] = ""; m_propMap["IntArray"] = ""; m_propMap["DoubleArray"] = ""; m_propMap["StringArray"] = ""; } void testCreateHints() { boost::scoped_ptr<HintStrategy> strategy( new AlgorithmHintStrategy(m_propAlg, std::set<std::string>())); TS_ASSERT_EQUALS(m_propMap, strategy->createHints()); } void testBlacklist() { std::set<std::string> blacklist; blacklist.insert("DoubleValue"); blacklist.insert("IntArray"); boost::scoped_ptr<HintStrategy> strategy( new AlgorithmHintStrategy(m_propAlg, blacklist)); auto expected = m_propMap; expected.erase("DoubleValue"); expected.erase("IntArray"); TS_ASSERT_EQUALS(expected, strategy->createHints()); } protected: IAlgorithm_sptr m_propAlg; std::map<std::string, std::string> m_propMap; }; #endif /*MANTID_MANTIDWIDGETS_ALGORITHMHINTSTRATEGYTEST_H */
wdzhou/mantid
qt/widgets/common/test/AlgorithmHintStrategyTest.h
C
gpl-3.0
3,723
package robot; @SuppressWarnings("all") public class OrAspectOrAspectProperties { }
INSA-Rennes/TP4INFO
IDM/robot.operational/src/xtend-gen/robot/OrAspectOrAspectProperties.java
Java
gpl-3.0
85
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>Axis2/C: Axutil_duration</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.5.3 --> <div class="tabs"> <ul> <li><a href="index.html"><span>Main&nbsp;Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li> <li><a href="examples.html"><span>Examples</span></a></li> <li> <form action="search.php" method="get"> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td> <td><input type="text" name="query" value="" size="20" accesskey="s"/></td> </tr> </table> </form> </li> </ul> </div> <h1>Axutil_duration<br> <small> [<a class="el" href="group__axis2__util.html">utilities</a>]</small> </h1><table border="0" cellpadding="0" cellspacing="0"> <tr><td></td></tr> <tr><td colspan="2"><br><h2>Typedefs</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g3b1bbd97498a2eba8ab72d7187be3846"></a><!-- doxytag: member="axutil_duration::axutil_duration_t" ref="g3b1bbd97498a2eba8ab72d7187be3846" args="" --> typedef struct <br> axutil_duration&nbsp;</td><td class="memItemRight" valign="bottom"><b>axutil_duration_t</b></td></tr> <tr><td colspan="2"><br><h2>Functions</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">AXIS2_EXTERN <br> axutil_duration_t *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__axutil__duration.html#g16290b58f9407559bf66a271985a1430">axutil_duration_create</a> (<a class="el" href="structaxutil__env.html">axutil_env_t</a> *env)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ge43158e9af48612b610b2810b9826568"></a><!-- doxytag: member="axutil_duration::axutil_duration_create_from_values" ref="ge43158e9af48612b610b2810b9826568" args="(const axutil_env_t *env, axis2_bool_t negative, int years, int months, int days, int hours, int minutes, double seconds)" --> AXIS2_EXTERN <br> axutil_duration_t *&nbsp;</td><td class="memItemRight" valign="bottom"><b>axutil_duration_create_from_values</b> (const <a class="el" href="structaxutil__env.html">axutil_env_t</a> *env, axis2_bool_t negative, int years, int months, int days, int hours, int minutes, double seconds)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g7447afeb2efaae420f6f66ef10095a38"></a><!-- doxytag: member="axutil_duration::axutil_duration_create_from_string" ref="g7447afeb2efaae420f6f66ef10095a38" args="(const axutil_env_t *env, const axis2_char_t *duration_str)" --> AXIS2_EXTERN <br> axutil_duration_t *&nbsp;</td><td class="memItemRight" valign="bottom"><b>axutil_duration_create_from_string</b> (const <a class="el" href="structaxutil__env.html">axutil_env_t</a> *env, const axis2_char_t *duration_str)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g43eb29e18a81a6cc6f776151172e1f1b"></a><!-- doxytag: member="axutil_duration::axutil_duration_free" ref="g43eb29e18a81a6cc6f776151172e1f1b" args="(axutil_duration_t *duration, const axutil_env_t *env)" --> AXIS2_EXTERN <br> axis2_status_t&nbsp;</td><td class="memItemRight" valign="bottom"><b>axutil_duration_free</b> (axutil_duration_t *duration, const <a class="el" href="structaxutil__env.html">axutil_env_t</a> *env)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g90579b9e81c683148266dea5fddb8d9c"></a><!-- doxytag: member="axutil_duration::axutil_duration_deserialize_duration" ref="g90579b9e81c683148266dea5fddb8d9c" args="(axutil_duration_t *duration, const axutil_env_t *env, const char *duration_str)" --> AXIS2_EXTERN <br> axis2_status_t&nbsp;</td><td class="memItemRight" valign="bottom"><b>axutil_duration_deserialize_duration</b> (axutil_duration_t *duration, const <a class="el" href="structaxutil__env.html">axutil_env_t</a> *env, const char *duration_str)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga4355762118956b9c8eac3503873bcac"></a><!-- doxytag: member="axutil_duration::axutil_duration_serialize_duration" ref="ga4355762118956b9c8eac3503873bcac" args="(axutil_duration_t *duration, const axutil_env_t *env)" --> AXIS2_EXTERN char *&nbsp;</td><td class="memItemRight" valign="bottom"><b>axutil_duration_serialize_duration</b> (axutil_duration_t *duration, const <a class="el" href="structaxutil__env.html">axutil_env_t</a> *env)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g589f281118ce548c15c3befd303f0158"></a><!-- doxytag: member="axutil_duration::axutil_duration_set_duration" ref="g589f281118ce548c15c3befd303f0158" args="(axutil_duration_t *duration, const axutil_env_t *env, axis2_bool_t negative, int years, int months, int days, int hours, int mins, double seconds)" --> AXIS2_EXTERN <br> axis2_status_t&nbsp;</td><td class="memItemRight" valign="bottom"><b>axutil_duration_set_duration</b> (axutil_duration_t *duration, const <a class="el" href="structaxutil__env.html">axutil_env_t</a> *env, axis2_bool_t negative, int years, int months, int days, int hours, int mins, double seconds)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g2df7b6b1ae42261b263d452b0334b21e"></a><!-- doxytag: member="axutil_duration::axutil_duration_get_years" ref="g2df7b6b1ae42261b263d452b0334b21e" args="(axutil_duration_t *duration, const axutil_env_t *env)" --> AXIS2_EXTERN int&nbsp;</td><td class="memItemRight" valign="bottom"><b>axutil_duration_get_years</b> (axutil_duration_t *duration, const <a class="el" href="structaxutil__env.html">axutil_env_t</a> *env)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="gc4c15cca67efdbf296e78b7a4a1c6fb3"></a><!-- doxytag: member="axutil_duration::axutil_duration_set_years" ref="gc4c15cca67efdbf296e78b7a4a1c6fb3" args="(axutil_duration_t *duration, const axutil_env_t *env, int years)" --> AXIS2_EXTERN <br> axis2_status_t&nbsp;</td><td class="memItemRight" valign="bottom"><b>axutil_duration_set_years</b> (axutil_duration_t *duration, const <a class="el" href="structaxutil__env.html">axutil_env_t</a> *env, int years)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g280ca69f68cef6831e97d62617c541d6"></a><!-- doxytag: member="axutil_duration::axutil_duration_get_months" ref="g280ca69f68cef6831e97d62617c541d6" args="(axutil_duration_t *duration, const axutil_env_t *env)" --> AXIS2_EXTERN int&nbsp;</td><td class="memItemRight" valign="bottom"><b>axutil_duration_get_months</b> (axutil_duration_t *duration, const <a class="el" href="structaxutil__env.html">axutil_env_t</a> *env)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g4ad2268b7443c74aab9ed2bdef806a9a"></a><!-- doxytag: member="axutil_duration::axutil_duration_set_months" ref="g4ad2268b7443c74aab9ed2bdef806a9a" args="(axutil_duration_t *duration, const axutil_env_t *env, int months)" --> AXIS2_EXTERN <br> axis2_status_t&nbsp;</td><td class="memItemRight" valign="bottom"><b>axutil_duration_set_months</b> (axutil_duration_t *duration, const <a class="el" href="structaxutil__env.html">axutil_env_t</a> *env, int months)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="gbbc148b9b1c3d450555ba2c6ce77d7d4"></a><!-- doxytag: member="axutil_duration::axutil_duration_get_days" ref="gbbc148b9b1c3d450555ba2c6ce77d7d4" args="(axutil_duration_t *duration, const axutil_env_t *env)" --> AXIS2_EXTERN int&nbsp;</td><td class="memItemRight" valign="bottom"><b>axutil_duration_get_days</b> (axutil_duration_t *duration, const <a class="el" href="structaxutil__env.html">axutil_env_t</a> *env)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g334e4adfbdb39f3980d6862e15abff59"></a><!-- doxytag: member="axutil_duration::axutil_duration_set_days" ref="g334e4adfbdb39f3980d6862e15abff59" args="(axutil_duration_t *duration, const axutil_env_t *env, int days)" --> AXIS2_EXTERN <br> axis2_status_t&nbsp;</td><td class="memItemRight" valign="bottom"><b>axutil_duration_set_days</b> (axutil_duration_t *duration, const <a class="el" href="structaxutil__env.html">axutil_env_t</a> *env, int days)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="gc5ac3bbb310d26ed8274636a9e2ae5f8"></a><!-- doxytag: member="axutil_duration::axutil_duration_get_hours" ref="gc5ac3bbb310d26ed8274636a9e2ae5f8" args="(axutil_duration_t *duration, const axutil_env_t *env)" --> AXIS2_EXTERN int&nbsp;</td><td class="memItemRight" valign="bottom"><b>axutil_duration_get_hours</b> (axutil_duration_t *duration, const <a class="el" href="structaxutil__env.html">axutil_env_t</a> *env)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g894f6742f8573c6800ba213b7f8ef34d"></a><!-- doxytag: member="axutil_duration::axutil_duration_set_hours" ref="g894f6742f8573c6800ba213b7f8ef34d" args="(axutil_duration_t *duration, const axutil_env_t *env, int hours)" --> AXIS2_EXTERN <br> axis2_status_t&nbsp;</td><td class="memItemRight" valign="bottom"><b>axutil_duration_set_hours</b> (axutil_duration_t *duration, const <a class="el" href="structaxutil__env.html">axutil_env_t</a> *env, int hours)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g0a67643a62d4ad5d66574c5f6bfb1dce"></a><!-- doxytag: member="axutil_duration::axutil_duration_get_mins" ref="g0a67643a62d4ad5d66574c5f6bfb1dce" args="(axutil_duration_t *duration, const axutil_env_t *env)" --> AXIS2_EXTERN int&nbsp;</td><td class="memItemRight" valign="bottom"><b>axutil_duration_get_mins</b> (axutil_duration_t *duration, const <a class="el" href="structaxutil__env.html">axutil_env_t</a> *env)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="gdb003ce593facb6615a47efbc0ffd310"></a><!-- doxytag: member="axutil_duration::axutil_duration_set_mins" ref="gdb003ce593facb6615a47efbc0ffd310" args="(axutil_duration_t *duration, const axutil_env_t *env, int mins)" --> AXIS2_EXTERN <br> axis2_status_t&nbsp;</td><td class="memItemRight" valign="bottom"><b>axutil_duration_set_mins</b> (axutil_duration_t *duration, const <a class="el" href="structaxutil__env.html">axutil_env_t</a> *env, int mins)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g0165940378f50d4e090995fd92c10892"></a><!-- doxytag: member="axutil_duration::axutil_duration_get_seconds" ref="g0165940378f50d4e090995fd92c10892" args="(axutil_duration_t *duration, const axutil_env_t *env)" --> AXIS2_EXTERN double&nbsp;</td><td class="memItemRight" valign="bottom"><b>axutil_duration_get_seconds</b> (axutil_duration_t *duration, const <a class="el" href="structaxutil__env.html">axutil_env_t</a> *env)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g9dd060a6efaf47cb87ef4ac5d02a0a83"></a><!-- doxytag: member="axutil_duration::axutil_duration_set_seconds" ref="g9dd060a6efaf47cb87ef4ac5d02a0a83" args="(axutil_duration_t *duration, const axutil_env_t *env, double seconds)" --> AXIS2_EXTERN <br> axis2_status_t&nbsp;</td><td class="memItemRight" valign="bottom"><b>axutil_duration_set_seconds</b> (axutil_duration_t *duration, const <a class="el" href="structaxutil__env.html">axutil_env_t</a> *env, double seconds)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g5f71556ad7b17688e1fd5f506a1c9bab"></a><!-- doxytag: member="axutil_duration::axutil_duration_get_is_negative" ref="g5f71556ad7b17688e1fd5f506a1c9bab" args="(axutil_duration_t *duration, const axutil_env_t *env)" --> AXIS2_EXTERN axis2_bool_t&nbsp;</td><td class="memItemRight" valign="bottom"><b>axutil_duration_get_is_negative</b> (axutil_duration_t *duration, const <a class="el" href="structaxutil__env.html">axutil_env_t</a> *env)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="gaf1611c85de7607b95d26462f9326c3e"></a><!-- doxytag: member="axutil_duration::axutil_duration_set_is_negative" ref="gaf1611c85de7607b95d26462f9326c3e" args="(axutil_duration_t *duration, const axutil_env_t *env, axis2_bool_t is_negative)" --> AXIS2_EXTERN <br> axis2_status_t&nbsp;</td><td class="memItemRight" valign="bottom"><b>axutil_duration_set_is_negative</b> (axutil_duration_t *duration, const <a class="el" href="structaxutil__env.html">axutil_env_t</a> *env, axis2_bool_t is_negative)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="gc8d620633177db931d3420c6f0d2a9e5"></a><!-- doxytag: member="axutil_duration::axutil_duration_compare" ref="gc8d620633177db931d3420c6f0d2a9e5" args="(axutil_duration_t *duration_one, axutil_duration_t *duration_two, axutil_env_t *env)" --> AXIS2_EXTERN axis2_bool_t&nbsp;</td><td class="memItemRight" valign="bottom"><b>axutil_duration_compare</b> (axutil_duration_t *duration_one, axutil_duration_t *duration_two, <a class="el" href="structaxutil__env.html">axutil_env_t</a> *env)</td></tr> </table> <hr><h2>Function Documentation</h2> <a class="anchor" name="g16290b58f9407559bf66a271985a1430"></a><!-- doxytag: member="axutil_duration.h::axutil_duration_create" ref="g16290b58f9407559bf66a271985a1430" args="(axutil_env_t *env)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">AXIS2_EXTERN axutil_duration_t* axutil_duration_create </td> <td>(</td> <td class="paramtype"><a class="el" href="structaxutil__env.html">axutil_env_t</a> *&nbsp;</td> <td class="paramname"> <em>env</em> </td> <td>&nbsp;)&nbsp;</td> <td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> Creates axutil_duration struct with current date time <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>env</em>&nbsp;</td><td>double pointer to environment struct. MUST NOT be NULL </td></tr> </table> </dl> <dl class="return" compact><dt><b>Returns:</b></dt><dd>pointer to newly created axutil_duration struct </dd></dl> </div> </div><p> <hr size="1"><address style="text-align: right;"><small>Generated on Fri Apr 17 11:54:22 2009 for Axis2/C by&nbsp; <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> </body> </html>
akimdi/laba2
axis2c_2/docs/api/html/group__axutil__duration.html
HTML
gpl-3.0
15,324
/************************************************************************************************** Filename: nwk.c Revised: $Date: 2009-03-11 15:29:07 -0700 (Wed, 11 Mar 2009) $ Revision: $Revision: 19382 $ Author $Author: lfriedman $ Description: This file supports the SimpliciTI network layer. Copyright 2007-2009 Texas Instruments Incorporated. All rights reserved. IMPORTANT: Your use of this Software is limited to those specific rights granted under the terms of a software license agreement between the user who downloaded the software, his/her employer (which must be your employer) and Texas Instruments Incorporated (the "License"). You may not use this Software unless you agree to abide by the terms of the License. The License limits your use, and you acknowledge, that the Software may not be modified, copied or distributed unless embedded on a Texas Instruments microcontroller or used solely and exclusively in conjunction with a Texas Instruments radio frequency transceiver, which is integrated into your product. Other than for the foregoing purpose, you may not use, reproduce, copy, prepare derivative works of, modify, distribute, perform, display or sell this Software and/or its documentation for any purpose. YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS. Should you have any questions regarding your right to use this Software, contact Texas Instruments Incorporated at www.TI.com. **************************************************************************************************/ /****************************************************************************** * INCLUDES */ #include <string.h> #include "bsp.h" #include "mrfi.h" #include "nwk_types.h" #include "nwk_frame.h" #include "nwk.h" #include "nwk_app.h" #include "nwk_globals.h" #include "nwk_QMgmt.h" /****************************************************************************** * MACROS */ /************************* NETWORK MANIFEST CONSTANT SANITY CHECKS ****************************/ #if !defined(ACCESS_POINT) && !defined(RANGE_EXTENDER) && !defined(END_DEVICE) #error ERROR: No SimpliciTI device type defined #endif #if defined(END_DEVICE) && !defined(RX_POLLS) #define RX_USER #endif #ifndef MAX_HOPS #define MAX_HOPS 3 #elif MAX_HOPS > 4 #error ERROR: MAX_HOPS must be 4 or fewer #endif #ifndef MAX_APP_PAYLOAD #error ERROR: MAX_APP_PAYLOAD must be defined #endif #if ( MAX_PAYLOAD < MAX_FREQ_APP_FRAME ) #error ERROR: Application payload size too small for Frequency frame #endif #if ( MAX_PAYLOAD < MAX_JOIN_APP_FRAME ) #error ERROR: Application payload size too small for Join frame #endif #if ( MAX_PAYLOAD < MAX_LINK_APP_FRAME ) #error ERROR: Application payload size too small for Link frame #endif #if ( MAX_PAYLOAD < MAX_MGMT_APP_FRAME ) #error ERROR: Application payload size too small for Management frame #endif #if ( MAX_PAYLOAD < MAX_SEC_APP_FRAME ) #error ERROR: Application payload size too small for Security frame #endif #if ( MAX_PAYLOAD < MAX_PING_APP_FRAME ) #error ERROR: Application payload size too small for Ping frame #endif #if NWK_FREQ_TBL_SIZE < 1 #error ERROR: NWK_FREQ_TBL_SIZE must be > 0 #endif /************************* END NETWORK MANIFEST CONSTANT SANITY CHECKS ************************/ /****************************************************************************** * CONSTANTS AND DEFINES */ #define SYS_NUM_CONNECTIONS (NUM_CONNECTIONS+1) /* Increment this if the persistentContext_t structure is changed. It will help * detect the upgrade context: any saved values will have a version with a * lower number. */ #define CONNTABLEINFO_STRUCTURE_VERSION 1 #define SIZEOF_NV_OBJ sizeof(sPersistInfo) /****************************************************************************** * TYPEDEFS */ /* This structure aggregates eveything necessary to save if we want to restore * the connection information later. */ typedef struct { const uint8_t structureVersion; /* to dectect upgrades... */ uint8_t numConnections; /* count includes the UUD port/link ID */ /* The next two are used to detect overlapping port assignments. When _sending_ a * link frame the local port is assigned from the top down. When sending a _reply_ * the assignment is bottom up. Overlapping assignments are rejected. That said it * is extremely unlikely that this will ever happen. If it does the test implemented * here is overly cautious (it will reject assignments when it needn't). But we leave * it that way on the assumption that it will never happen anyway. */ uint8_t curNextLinkPort; uint8_t curMaxReplyPort; linkID_t nextLinkID; #ifdef ACCESS_POINT sfInfo_t sSandFContext; #endif /* Connection table entries last... */ connInfo_t connStruct[SYS_NUM_CONNECTIONS]; } persistentContext_t; /****************************************************************************** * LOCAL VARIABLES */ /* This will be overwritten if we restore the structure from NV for example. * Note that restoring will not permit overwriting the version element as it * is declared 'const'. */ static persistentContext_t sPersistInfo = {CONNTABLEINFO_STRUCTURE_VERSION}; /****************************************************************************** * LOCAL FUNCTIONS */ static uint8_t map_lid2idx(linkID_t, uint8_t *); static void initializeConnection(connInfo_t *); /****************************************************************************** * GLOBAL VARIABLES */ /****************************************************************************** * GLOBAL FUNCTIONS */ /****************************************************************************** * @fn nwk_nwkInit * * @brief Initialize NWK conext. * * input parameters * * output parameters * * @return Status of operation. */ smplStatus_t nwk_nwkInit(uint8_t (*f)(linkID_t)) { /* Truly ugly initialization because CCE won't initialize properly. Must * skip first const element. Yuk. */ memset((((uint8_t *)&sPersistInfo)+1), 0x0, (sizeof(sPersistInfo)-1)); /* OK. The zeroed elements are set. Now go back and do fixups... */ sPersistInfo.numConnections = SYS_NUM_CONNECTIONS; sPersistInfo.curNextLinkPort = SMPL_PORT_USER_MAX; sPersistInfo.curMaxReplyPort = PORT_BASE_NUMBER; sPersistInfo.nextLinkID = 1; /* initialize globals */ nwk_globalsInit(); /* initialize frame processing */ nwk_frameInit(f); /* initialize queue manager */ nwk_QInit(); /* initialize each network application. */ nwk_freqInit(); nwk_pingInit(); nwk_joinInit(f); nwk_mgmtInit(); nwk_linkInit(); nwk_securityInit(); /* set up the last connection as the broadcast port mapped to the broadcast Link ID */ if (CONNSTATE_FREE == sPersistInfo.connStruct[NUM_CONNECTIONS].connState) { sPersistInfo.connStruct[NUM_CONNECTIONS].connState = CONNSTATE_CONNECTED; sPersistInfo.connStruct[NUM_CONNECTIONS].hops2target = MAX_HOPS; sPersistInfo.connStruct[NUM_CONNECTIONS].portRx = SMPL_PORT_USER_BCAST; sPersistInfo.connStruct[NUM_CONNECTIONS].portTx = SMPL_PORT_USER_BCAST; sPersistInfo.connStruct[NUM_CONNECTIONS].thisLinkID = SMPL_LINKID_USER_UUD; /* set peer address to broadcast so it is used when Application sends to the broadcast Link ID */ memcpy(sPersistInfo.connStruct[NUM_CONNECTIONS].peerAddr, nwk_getBCastAddress(), NET_ADDR_SIZE); } return SMPL_SUCCESS; } /****************************************************************************** * @fn nwk_getNextConnection * * @brief Return the next free connection structure if on is available. * * input parameters * * output parameters * The returned structure has the Rx port number populated based on the * free strucure found. This is the port queried when the app wants to * do a receive. * * @return pointer to the new connInfo_t structure. NULL if there is * no room in connection structure array. */ connInfo_t *nwk_getNextConnection() { uint8_t i; for (i=0; i<SYS_NUM_CONNECTIONS; ++i) { if (sPersistInfo.connStruct[i].connState == CONNSTATE_CONNECTED) { continue; } break; } if (SYS_NUM_CONNECTIONS == i) { return (connInfo_t *)0; } initializeConnection(&sPersistInfo.connStruct[i]); return &sPersistInfo.connStruct[i]; } /************************************************************************************ * @fn initializeConnection * * @brief Initialize some elements of a Connection table entry. * * input parameters * @param pCInfo - pointer to Connection Table entry to initialize. The file * scope variable holding the next link ID value is also updated. * * output parameters * @param pCInfo - certain elements are set to specific values. * * * @return void */ static void initializeConnection(connInfo_t *pCInfo) { linkID_t *locLID = &sPersistInfo.nextLinkID; uint8_t tmp; /* this element will be populated during the exchange with the peer. */ pCInfo->portTx = 0; pCInfo->connState = CONNSTATE_CONNECTED; pCInfo->thisLinkID = *locLID; /* Generate the next Link ID. This isn't foolproof. If the count wraps * we can end up with confusing duplicates. We can protect aginst using * one that is already in use but we can't protect against a stale Link ID * remembered by an application that doesn't know its connection has been * torn down. The test for 0 will hopefully never be true (indicating a wrap). */ (*locLID)++; while (!*locLID || (*locLID == SMPL_LINKID_USER_UUD) || map_lid2idx(*locLID, &tmp)) { (*locLID)++; } return; } /****************************************************************************** * @fn nwk_freeConnection * * @brief Return the connection structure to the free pool. Currently * this routine is only called when a link freame is sent and * no reply is received so the freeing steps are pretty simple. * But eventually this will be more complex so this place-holder * is introduced. * * input parameters * @param pCInfo - pointer to entry to be freed * * output parameters * * @return None. */ void nwk_freeConnection(connInfo_t *pCInfo) { #if NUM_CONNECTIONS > 0 pCInfo->connState = CONNSTATE_FREE; #endif } /****************************************************************************** * @fn nwk_getConnInfo * * @brief Return the connection info structure to which the input Link ID maps. * * input parameters * @param port - port for which mapping desired * * output parameters * * @return pointer to connInfo_t structure found. NULL if no mapping * found or entry not valid. */ connInfo_t *nwk_getConnInfo(linkID_t linkID) { uint8_t idx, rc; rc = map_lid2idx(linkID, &idx); return (rc && (CONNSTATE_CONNECTED == sPersistInfo.connStruct[idx].connState)) ? &sPersistInfo.connStruct[idx] : (connInfo_t *)0; } /****************************************************************************** * @fn nwk_isLinkDuplicate * * @brief Help determine if the link has already been established.. Defense * against duplicate link frames. This file owns the data structure * so the comparison is done here. * * input parameters * @param addr - pointer to address of linker in question * @param remotePort - remote port number provided by linker * * output parameters * * @return Returns pointer to connection entry if the address and remote Port * match an existing entry, otherwise 0. */ connInfo_t *nwk_isLinkDuplicate(uint8_t *addr, uint8_t remotePort) { #if NUM_CONNECTIONS > 0 uint8_t i; connInfo_t *ptr = sPersistInfo.connStruct; for (i=0; i<NUM_CONNECTIONS; ++i,++ptr) { if (CONNSTATE_CONNECTED == ptr->connState) { if (!(memcmp(ptr->peerAddr, addr, NET_ADDR_SIZE)) && (ptr->portTx == remotePort)) { return ptr; } } } #endif return (connInfo_t *)NULL; } /****************************************************************************** * @fn nwk_findAddressMatch * * @brief Used to look for an address match in the Connection table. * Match is based on source address in frame. * * input parameters * @param frame - pointer to frame in question * * output parameters * * @return Returns non-zero if a match is found, otherwise 0. */ uint8_t nwk_findAddressMatch(mrfiPacket_t *frame) { #if NUM_CONNECTIONS > 0 uint8_t i; connInfo_t *ptr = sPersistInfo.connStruct; for (i=0; i<NUM_CONNECTIONS; ++i,++ptr) { if (CONNSTATE_CONNECTED == ptr->connState) { if (!(memcmp(ptr->peerAddr, MRFI_P_SRC_ADDR(frame), NET_ADDR_SIZE))) { return 1; } } } #endif return 0; } #ifdef ACCESS_POINT /****************************************************************************** * @fn nwk_getSFInfoPtr * * @brief Get pointer to store-and-forward information object kept in the * NV object aggregate. * * input parameters * * output parameters * * @return Returns pointer to the store-nad-forward object. */ sfInfo_t *nwk_getSFInfoPtr(void) { return &sPersistInfo.sSandFContext; } #if defined(AP_IS_DATA_HUB) /*************************************************************************************** * @fn nwk_saveJoinedDevice * * @brief Save the address of a joining device on the Connection Table expecting * a Link frame to follow. Only for when AP is a data hub. We want to * use the space already allocated for a connection able entry instead * of having redundant arrays for alread-joined devices in the data hub * case. * * input parameters * @param frame - pointer to frame containing address or joining device. * * output parameters * * @return Returns non-zero if this is a new device and it is saved. Returns * 0 if device already there or there is no room in the Connection * Table. */ uint8_t nwk_saveJoinedDevice(mrfiPacket_t *frame) { uint8_t i; connInfo_t *avail = 0; connInfo_t *ptr = sPersistInfo.connStruct; for (i=0; i<NUM_CONNECTIONS; ++i, ++ptr) { if ((ptr->connState == CONNSTATE_CONNECTED) || (ptr->connState == CONNSTATE_JOINED)) { if (!memcmp(ptr->peerAddr, MRFI_P_SRC_ADDR(frame), NET_ADDR_SIZE)) { return 0; } } else { avail = ptr; } } if (!avail) { return 0; } avail->connState = CONNSTATE_JOINED; memcpy(avail->peerAddr, MRFI_P_SRC_ADDR(frame), NET_ADDR_SIZE); return 1; } /*********************************************************************************** * @fn nwk_findAlreadyJoined * * @brief Used when AP is a data hub to look for an address match in the * Connection table for a device that is already enterd in the joined * state. This means that the Connection Table resource is already * allocated so the link-listen doesn't have to do it again. Match is * based on source address in frame. Thsi shoudl only be called from * the Link-listen context during the link frame reply. * * If found the Connection Table entry is initialized as if it were * found using the nwk_getNextConnection() method. * * input parameters * @param frame - pointer to frame in question * * output parameters * * @return Returns pointer to Connection Table entry if match is found, otherwise * 0. This call will only fail if the Connection Table was full when the * device tried to join initially. */ connInfo_t *nwk_findAlreadyJoined(mrfiPacket_t *frame) { uint8_t i; connInfo_t *ptr = sPersistInfo.connStruct; for (i=0; i<NUM_CONNECTIONS; ++i,++ptr) { /* Look for an entry in the JOINED state */ if (CONNSTATE_JOINED == ptr->connState) { /* Is this it? */ if (!(memcmp(&ptr->peerAddr, MRFI_P_SRC_ADDR(frame), NET_ADDR_SIZE))) { /* Yes. Initilize tabel entry and return the pointer. */ initializeConnection(ptr); return ptr; } } } /* Nothing found... */ return (connInfo_t *)NULL; } #endif /* AP_IS_DATA_HUB */ #endif /* ACCESS_POINT */ /****************************************************************************** * @fn nwk_checkConnInfo * * @brief Do a sanity/validity check on the connection info * * input parameters * @param ptr - pointer to a valid connection info structure to validate * @param which - Tx or Rx port checked * * output parameters * * @return Status of operation. */ smplStatus_t nwk_checkConnInfo(connInfo_t *ptr, uint8_t which) { uint8_t port; /* make sure port isn't null and that the entry is active */ port = (CHK_RX == which) ? ptr->portRx : ptr->portTx; if (!port || (CONNSTATE_FREE == ptr->connState)) { return SMPL_BAD_PARAM; } /* validate port number */ if (port < PORT_BASE_NUMBER) { return SMPL_BAD_PARAM; } return SMPL_SUCCESS; } /****************************************************************************** * @fn nwk_isConnectionValid * * @brief Do a sanity/validity check on the frame target address by * validating frame against connection info * * input parameters * @param frame - pointer to frame in question * * output parameters * @param lid - link ID of found connection * * @return 0 if connection specified in frame is not valid, otherwise non-zero. */ uint8_t nwk_isConnectionValid(mrfiPacket_t *frame, linkID_t *lid) { uint8_t i; connInfo_t *ptr = sPersistInfo.connStruct; uint8_t port = GET_FROM_FRAME(MRFI_P_PAYLOAD(frame), F_PORT_OS); for (i=0; i<SYS_NUM_CONNECTIONS; ++i,++ptr) { if (CONNSTATE_CONNECTED == ptr->connState) { /* check port first since we're done if the port is the user bcast port. */ if (port == ptr->portRx) { /* yep...ports match. */ if ((SMPL_PORT_USER_BCAST == port) || !(memcmp(ptr->peerAddr, MRFI_P_SRC_ADDR(frame), NET_ADDR_SIZE))) { uint8_t rc = 1; /* we're done. */ *lid = ptr->thisLinkID; #ifdef APP_AUTO_ACK /* can't ack the broadcast port... */ if (!(SMPL_PORT_USER_BCAST == port)) { if (GET_FROM_FRAME(MRFI_P_PAYLOAD(frame), F_ACK_REQ)) { /* Ack requested. Send ack now */ nwk_sendAckReply(frame, ptr->portTx); } else if (GET_FROM_FRAME(MRFI_P_PAYLOAD(frame), F_ACK_RPLY)) { /* This is a reply. Signal that it was received by resetting the * saved transaction ID in the connection object if they match. The * main thread is polling this value. The setting here is in the * Rx ISR thread. */ if (ptr->ackTID == GET_FROM_FRAME(MRFI_P_PAYLOAD(frame), F_TRACTID_OS)) { ptr->ackTID = 0; } /* This causes the frame to be dropped. All ack frames are * dropped. */ rc = 0; } } #endif /* APP_AUTO_ACK */ /* Unconditionally kill the reply delay semaphore. This used to be done * unconditionally in the calling routine. */ MRFI_PostKillSem(); return rc; } } } } /* no matches */ return 0; } /****************************************************************************** * @fn nwk_allocateLocalRxPort * * @brief Allocate a local port on which to receive frames from a peer. * * Allocation differs depending on whether the allocation is for * a link reply frame or a link frame. In the former case we * know the address of the peer so we can ensure allocating a * unique port number for that address. The same port number can be * used mulitple times for distinct peers. Allocations are done from * the bottom of the namespace upward. * * If allocation is for a link frame we do not yet know the peer * address so we must ensure the port number is unique now. * Allocations are done from the top of the namespace downward. * * The two allocation methods track the extreme values used in each * case to detect overlap, i.e., exhausted namespace. This can only * happen if the number of connections supported is greater than the * total namespace available. * * input parameters * @param which - Sending a link frame or a link reply frame * @param newPtr - pointer to connection info structure to be populated * * output parameters * @param newPtr->portRx - element is populated with port number. * * @return Non-zero if port number assigned. 0 if no port available. */ uint8_t nwk_allocateLocalRxPort(uint8_t which, connInfo_t *newPtr) { #if NUM_CONNECTIONS > 0 uint8_t num, i; uint8_t marker[NUM_CONNECTIONS]; connInfo_t *ptr = sPersistInfo.connStruct; memset(&marker, 0x0, sizeof(marker)); for (i=0; i<NUM_CONNECTIONS; ++i,++ptr) { /* Mark the port number as used unless it's a statically allocated port */ if ((ptr != newPtr) && (CONNSTATE_CONNECTED == ptr->connState) && (ptr->portRx <= SMPL_PORT_USER_MAX)) { if (LINK_SEND == which) { if (ptr->portRx > sPersistInfo.curNextLinkPort) { marker[SMPL_PORT_USER_MAX - ptr->portRx] = 1; } } else if (!memcmp(ptr->peerAddr, newPtr->peerAddr, NET_ADDR_SIZE)) { marker[ptr->portRx - PORT_BASE_NUMBER] = 1; } } } num = 0; for (i=0; i<NUM_CONNECTIONS; ++i) { if (!marker[i]) { if (LINK_REPLY == which) { num = PORT_BASE_NUMBER + i; } else { num = SMPL_PORT_USER_MAX - i; } break; } } if (LINK_REPLY == which) { /* if the number we have doesn't overlap the assignment of ports used * for sending link frames, use it. */ if (num <= sPersistInfo.curNextLinkPort) { if (num > sPersistInfo.curMaxReplyPort) { /* remember maximum port number used */ sPersistInfo.curMaxReplyPort = num; } } else { /* the port number we need has already been used in the other context. It may or * may not have been used for the same address but we don't bother to check...we * just reject the asignment. This is the overly cautious part but is extermely * unlikely to ever occur. */ num = 0; } } else { /* if the number we have doesn't overlap the assignment of ports used * for sending link frame replies, use it. */ if (num >= sPersistInfo.curMaxReplyPort) { if (num == sPersistInfo.curNextLinkPort) { sPersistInfo.curNextLinkPort--; } } else { /* the port number we need has already been used in the other context. It may or * may not have been used for the same address but we don't bother to check...we * just reject the asignment. This is the overly cautious part but is extermely * unlikely to ever occur. */ num = 0; } } newPtr->portRx = num; return num; #else return 0; #endif /* NUM_CONNECTIONS > 0 */ } /******************************************************************************* * @fn nwk_isValidReply * * @brief Examine a frame to see if it is a valid reply when compared with * expected parameters. * * input parameters * @param frame - pointer to frmae being examined * @param tid - expected transaction ID in application payload * @param infoOffset - offset to payload information containing reply hint * @param tidOffset - offset to transaction ID in payload * * output parameters * * @return reply category: * SMPL_NOT_REPLY: not a reply * SMPL_MY_REPLY : a reply that matches input parameters * SMPL_A_REPLY : a reply but does not match input parameters */ uint8_t nwk_isValidReply(mrfiPacket_t *frame, uint8_t tid, uint8_t infoOffset, uint8_t tidOffset) { uint8_t rc = SMPL_NOT_REPLY; if ((*(MRFI_P_PAYLOAD(frame)+F_APP_PAYLOAD_OS+infoOffset) & NWK_APP_REPLY_BIT)) { if ((*(MRFI_P_PAYLOAD(frame)+F_APP_PAYLOAD_OS+tidOffset) == tid) && !memcmp(MRFI_P_DST_ADDR(frame), nwk_getMyAddress(), NET_ADDR_SIZE)) { rc = SMPL_MY_REPLY; } else { rc = SMPL_A_REPLY; } } return rc; } /****************************************************************************** * @fn map_lid2idx * * @brief Map link ID to index into connection table. * * input parameters * @param lid - Link ID to be matched * * output parameters * @param idx - populated with index into connection table * * @return Non-zero if Link ID found and output is valid else 0. */ static uint8_t map_lid2idx(linkID_t lid, uint8_t *idx) { uint8_t i; connInfo_t *ptr = sPersistInfo.connStruct; for (i=0; i<SYS_NUM_CONNECTIONS; ++i, ++ptr) { if ((CONNSTATE_CONNECTED == ptr->connState) && (ptr->thisLinkID == lid)) { *idx = i; return 1; } } return 0; } /****************************************************************************** * @fn nwk_findPeer * * @brief Find connection entry for a peer * * input parameters * @param peerAddr - address of peer * @param peerPort - port on which this device was sending to peer. * * output parameters * * @return Pointer to matching connection table entry else 0. */ connInfo_t *nwk_findPeer(addr_t *peerAddr, uint8_t peerPort) { uint8_t i; connInfo_t *ptr = sPersistInfo.connStruct; for (i=0; i<SYS_NUM_CONNECTIONS; ++i, ++ptr) { if (CONNSTATE_CONNECTED == ptr->connState) { if (!memcmp(peerAddr, ptr->peerAddr, NET_ADDR_SIZE)) { if (peerPort == ptr->portTx) { return ptr; } } } } return (connInfo_t *)NULL; } /****************************************************************************** * @fn nwk_checkAppMsgTID * * @brief Compare received TID to last-seen TID to decide whether the * received message is a duplicate or we missed some. * * input parameters * @param lastTID - last-seen TID * @param appMsgTID - TID from current application payload. * * output parameters * * @return Returns zero if message with supplied TID should be discarded. * Otherwise returns non-zero. In this case the message should be * processed. The last-seen TID should be updated with the current * application payload TID. * */ uint8_t nwk_checkAppMsgTID(appPTid_t lastTID, appPTid_t appMsgTID) { uint8_t rc = 0; /* If the values are equal this is a duplicate. We're done. */ if (lastTID != appMsgTID) { /* Is the new TID bigger? */ if (appMsgTID > lastTID) { /* In this case the current payload is OK unless we've received a late * (duplicate) message that occurred just before the TID wrapped. This is * considered a duplicate and we should discard it. */ if (!(DUP_TID_AFTER_WRAP(lastTID, appMsgTID))) { rc = 1; } } else { /* New TID is smaller. Accept the payload if this is the wrap case or we missed * the specific wrap frame but are still within the range in which we assume * we missed it. Otherwise is a genuine late frame so we should ignore it. */ if (CHECK_TID_WRAP(lastTID, appMsgTID)) { rc = 1; } } } return rc; } /****************************************************************************** * @fn nwk_getNumObjectFromMsg * * @brief Get a numeric object from a message buffer. Take care of * alignment and endianess issues. * * input parameters * @param src - pointer to object location in message buffer * @param objSize - size of numeric object * * output parameters * @param dest - pointer to numeric type variable receiving the object * contains aligned number in correct endian order on return. * * @return void. There is no warning if there is no case for the supplied * object size. A simple copy is then done. Alignment is * guaranteed only for object size cases defined (and * vacuously size 1). * */ void nwk_getNumObjectFromMsg(void *src, void *dest, uint8_t objSize) { /* Take care of alignment */ memmove(dest, src, objSize); /* Take care of endianess */ switch(objSize) { case 2: *((uint16_t *)dest) = ntohs(*((uint16_t *)dest)); break; case 4: *((uint32_t *)dest) = ntohl(*((uint32_t *)dest)); break; } return; } /****************************************************************************** * @fn nwk_putNumObjectIntoMsg * * @brief Put a numeric object into a message buffer. Take care of * alignment and endianess issues. * * input parameters * @param src - pointer to numeric type variable providing the object * @param objSize - size of numeric object. Fuction works for object size 1. * * output parameters * @param dest - pointer to object location in message buffer where the * correct endian order representation will be placed. * * @return void. There is no warning if there is no case for the supplied * object size. A simple copy is then done. * */ void nwk_putNumObjectIntoMsg(void *src, void *dest, uint8_t objSize) { uint8_t *ptr; uint16_t u16; uint32_t u32; /* Take care of endianess */ switch(objSize) { case 1: ptr = (uint8_t *)src; break; case 2: u16 = htons(*((uint16_t *)src)); ptr = (uint8_t *)&u16; break; case 4: u32 = htonl(*((uint32_t *)src)); ptr = (uint8_t *)&u32; break; default: ptr = (uint8_t *)src; break; } /* Take care of alignment */ memmove(dest, ptr, objSize); return; } /****************************************************************************** * @fn nwk_NVObj * * @brief GET and SET support for NV object (connection context). * * input parameters * @param action - GET or SET * @param val - (GET/SET) pointer to NV IOCTL object. * (SET) NV length and version values to be used for sanity * checks. * * output parameters * @param val - (GET) Version number of NV object, size of NV object and * pointer to the connection context memory. * - (SET) Pointer to the connection context memory. * * @return SMPL_SUCCESS * SMPL_BAD_PARAM Object version or size do not conform on a SET call * or illegal action specified. */ smplStatus_t nwk_NVObj(ioctlAction_t action, ioctlNVObj_t *val) { #ifdef NVOBJECT_SUPPORT smplStatus_t rc = SMPL_SUCCESS; if (IOCTL_ACT_GET == action) { /* Populate helper objects */ val->objLen = SIZEOF_NV_OBJ; val->objVersion = sPersistInfo.structureVersion; /* Set pointer to connection context if address of pointer is not null */ if (val->objPtr) { *(val->objPtr) = (uint8_t *)&sPersistInfo; } } else { rc = SMPL_BAD_PARAM; } return rc; #else /* NVOBJECT_SUPPORT */ return SMPL_BAD_PARAM; #endif }
mr-daydream/boss
firmware/Components/simpliciti/nwk/nwk.c
C
gpl-3.0
33,988
/** * This example demonstrates a Tab Panel with its Tab Bar rendered inside the panel header. * This configuration allows panel title and tabs to be displayed parallel to each other. */ Ext.define('KitchenSink.view.tab.HeaderTabs', { extend: 'Ext.container.Container', xtype: 'header-tabs', //<example> exampleTitle: 'Header Tabs', profiles: { classic: { icon1: 'classic/resources/images/icons/fam/cog.gif', icon2: 'classic/resources/images/icons/fam/user.gif', icon3: 'classic/resources/images/icons/fam/accept.gif', iconAdd: 'classic/resources/images/icons/fam/add.gif', iconHeader: 'classic/resources/images/icons/fam/application_view_list.png', buttonUI: 'default', width: 700, plain: true }, neptune: { glyph1: 42, glyph2: 70, glyph3: 86, glyphAdd: 43, glyphHeader: 77, buttonUI: 'default-toolbar', width: 800, plain: true }, 'neptune-touch': { width: 900 }, triton: { plain: false } }, //</example> layout: { type: 'hbox', align: 'middle' }, viewModel: true, initComponent: function() { Ext.apply(this, { width: this.profileInfo.width, items: [{ xtype: 'fieldset', title: 'Options', layout: 'auto', margin: '0 20 0 0', items: [{ xtype: 'fieldcontainer', fieldLabel: 'Header Position', items: [{ xtype: 'segmentedbutton', reference: 'positionBtn', value: 'top', items: [ { text: 'Top', value: 'top' }, { text: 'Right', value: 'right' }, { text: 'Bottom', value: 'bottom' }, { text: 'Left', value: 'left' } ] }] }, { xtype: 'fieldcontainer', fieldLabel: 'Tab Rotation', items: [{ xtype: 'segmentedbutton', reference: 'tabRotationBtn', value: 'default', items: [ { text: 'Default', value: 'default' }, { text: 'None', value: 0 }, { text: '90deg', value: 1 }, { text: '270deg', value: 2 } ] }] }, { xtype: 'fieldcontainer', fieldLabel: 'Title Rotation', items: [{ xtype: 'segmentedbutton', reference: 'titleRotationBtn', value: 'default', items: [ { text: 'Default', value: 'default' }, { text: 'None', value: 0 }, { text: '90deg', value: 1 }, { text: '270deg', value: 2 } ] }] }, { xtype: 'fieldcontainer', fieldLabel: 'Title Align', items: [{ xtype: 'segmentedbutton', reference: 'titleAlignBtn', value: 'left', items: [ { text: 'Left', value: 'left' }, { text: 'Center', value: 'center' }, { text: 'Right', value: 'right' } ] }] }, { xtype: 'fieldcontainer', fieldLabel: 'Icon Align', items: [{ xtype: 'segmentedbutton', reference: 'iconAlignBtn', value: 'left', items: [ { text: 'Top', value: 'top' }, { text: 'Right', value: 'right' }, { text: 'Bottom', value: 'bottom' }, { text: 'Left', value: 'left' } ] }] }] }, { xtype: 'tabpanel', title: 'Tab Panel', flex: 1, height: 500, icon: this.profileInfo.iconHeader, glyph: this.profileInfo.glyphHeader, tabBarHeaderPosition: 2, reference: 'tabpanel', plain: this.profileInfo.plain, defaults: { bodyPadding: 10, scrollable: true, border: false }, bind: { headerPosition: '{positionBtn.value}', tabRotation: '{tabRotationBtn.value}', titleRotation: '{titleRotationBtn.value}', titleAlign: '{titleAlignBtn.value}', iconAlign: '{iconAlignBtn.value}' }, items: [{ title: 'Tab 1', icon: this.profileInfo.icon1, glyph: this.profileInfo.glyph1, html: KitchenSink.DummyText.longText }, { title: 'Tab 2', icon: this.profileInfo.icon2, glyph: this.profileInfo.glyph2, html: KitchenSink.DummyText.extraLongText }] }] }); this.callParent(); } });
gedOHub/GClientGUI
ext/examples/kitchensink/classic/samples/view/tab/HeaderTabs.js
JavaScript
gpl-3.0
5,980
import numpy as np def show_as_height_map(height, mat): from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt x, y = np.meshgrid(np.arange(height), np.arange(height)) fig = plt.figure() ax = fig.add_subplot(111, projection="3d") ax.plot_surface(x, y, mat) plt.title("height map") plt.show() def update_pixel(pixel, mean, magnitude): return mean + (2 * pixel * magnitude) - magnitude def main(n, smooth_factor, plot_enable): height = (1 << n) + 1 mat = np.random.random((height, height)) i = height - 1 magnitude = 1 # seeds init mat[0, 0] = update_pixel(mat[0, 0], 0, magnitude) mat[0, height - 1] = update_pixel(mat[0, height - 1], 0, magnitude) mat[height - 1, height - 1] = update_pixel( mat[height - 1, height - 1], 0, magnitude ) mat[0, height - 1] = update_pixel(mat[0, height - 1], 0, magnitude) while i > 1: id_ = i >> 1 magnitude *= smooth_factor for xIndex in range(id_, height, i): # Beginning of the Diamond Step for yIndex in range(id_, height, i): mean = ( mat[xIndex - id_, yIndex - id_] + mat[xIndex - id_, yIndex + id_] + mat[xIndex + id_, yIndex + id_] + mat[xIndex + id_, yIndex - id_] ) / 4 mat[xIndex, yIndex] = update_pixel(mat[xIndex, yIndex], mean, magnitude) for xIndex in range(0, height, id_): # Beginning of the Square Step if xIndex % i == 0: shift = id_ else: shift = 0 for yIndex in range(shift, height, i): sum_ = 0 n = 0 if xIndex >= id_: sum_ += mat[xIndex - id_, yIndex] n += 1 if xIndex + id_ < height: sum_ += mat[xIndex + id_, yIndex] n += 1 if yIndex >= id_: sum_ += mat[xIndex, yIndex - id_] n += 1 if yIndex + id_ < height: sum_ += mat[xIndex, yIndex + id_] n += 1 mean = sum_ / n mat[xIndex, yIndex] = update_pixel(mat[xIndex, yIndex], mean, magnitude) i = id_ if plot_enable: show_as_height_map(height, mat) return mat def check_smooth_factor(value): fvalue = float(value) if fvalue < 0 or fvalue > 1: raise argparse.ArgumentTypeError("%s is an invalid smooth factor value" % value) return fvalue def check_positive(value): ivalue = int(value) if ivalue <= 0: raise argparse.ArgumentTypeError("%s is an invalid positive int value" % value) return ivalue if __name__ == "__main__": import argparse parser = argparse.ArgumentParser(description="machine generated calculation") parser.add_argument( "-n", help="the size of the image will be 2**n + 1", required=False, default=8, type=check_positive, ) parser.add_argument( "-s", help="smooth factor, needs to be in range of [0, 1], value of 0 means image is very smooth," "value of 1 means image is very rough", required=False, default=0.5, type=check_smooth_factor, ) parser.add_argument("-p", help="plot with matplotlib", action="store_true") args = parser.parse_args() main(args.n, args.s, args.p)
nickdex/cosmos
code/computer_graphics/src/diamond_square/diamond_square.py
Python
gpl-3.0
3,544
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- # # Copyright (C) 2015, 2016 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import logging import os import platform import shutil import subprocess import time logger = logging.getLogger(__name__) def create_snappy_image(output_directory): logger.info('Creating a snappy image to run the tests.') image_path = os.path.join(output_directory, 'snappy.img') subprocess.check_call( ['sudo', 'ubuntu-device-flash', '--verbose', 'core', '15.04', '--channel', 'stable', '--output', image_path, '--developer-mode']) return image_path class LocalTestbed: def wait(self): pass def run_command(self, command, cwd=None): if isinstance(command, list): command = ' '.join(command) if not cwd: logger.warning('Running from /tmp') cwd = '/tmp' return subprocess.check_output( command, shell=True, cwd=cwd, stderr=subprocess.STDOUT).decode('utf-8') def run_command_in_background(self, command, cwd=None): if not cwd: logger.warning('Running from /tmp') cwd = '/tmp' return subprocess.Popen(command, cwd=cwd) def copy_file(self, src, dst): shutil.copy(src, dst) class SshTestbed: def __init__(self, ip, port, user, proxy=None, private_key=None): super().__init__() self.ip = ip self.port = port self.user = user self.proxy = proxy self.private_key = private_key def wait(self, timeout=300, sleep=10): logger.debug('Waiting for ssh to be enabled in the testbed...') while (timeout > 0): try: self.run_command(['echo', 'testing ssh']) break except subprocess.CalledProcessError: if timeout <= 0: logger.error('Timed out waiting for ssh in the testbed.') raise else: time.sleep(sleep) timeout -= sleep def run_command(self, command, cwd=None): ssh_command = self._prepare_ssh_command(command) return subprocess.check_output( ssh_command, stderr=subprocess.STDOUT).decode('utf-8') def _prepare_ssh_command(self, command): if isinstance(command, str): command = [command] if self.proxy: command = [ 'http_proxy={}'.format(self.proxy), 'https_proxy={}'.format(self.proxy)] + command ssh_command = ['ssh', '-l', self.user, '-p', self.port, self.ip] ssh_command.extend(self._get_options()) ssh_command.extend(command) return ssh_command def run_command_in_background(self, command, cwd=None): ssh_command = self._prepare_ssh_command(command) return subprocess.Popen(ssh_command) def _get_options(self): options = [ '-o', 'UserKnownHostsFile=/dev/null', '-o', 'StrictHostKeyChecking=no', '-o', 'LogLevel=error', ] if self.private_key: options.extend(['-i', self.private_key]) return options def copy_file(self, local_file_path, remote_file_path): scp_command = ['scp', '-P', self.port] scp_command.extend(self._get_options()) scp_command.extend([ local_file_path, '{}@{}:{}'.format( self.user, self.ip, remote_file_path)]) subprocess.check_call(scp_command) class QemuTestbed(SshTestbed): def __init__( self, image_path, ssh_port, user, private_key, redirect_ports): super().__init__('localhost', ssh_port, user, private_key) self._image_path = image_path self._process = None self._redirect_ports = redirect_ports def create(self): logger.info('Running the snappy image in a virtual machine.') ports = ' -redir tcp:{}::22'.format(self.port) for port in self._redirect_ports: ports += ' -redir tcp:{0}::{0}'.format(port) qemu_command = ( 'qemu-system-{}' + ' -snapshot' + ' -enable-kvm' + ' -m 512 -nographic -net user -net nic,model=virtio' + ' -drive file={}' + ',if=virtio' + ' -monitor none -serial none').format( platform.machine(), self._image_path) + ports self._process = subprocess.Popen(qemu_command, shell=True) def delete(self): if self._process: self._process.kill()
dholbach/snapcraft
snaps_tests/testbed.py
Python
gpl-3.0
5,150
<?php class MCrypt { private $iv = 'com.nowsci.odmiv'; //private $key = 'MyEncPasswordaaa'; function __construct() { } function formatKey($key) { $newkey = $key; if (strlen($key) > 16) { $newkey = substr($key, 0, 16); } else if (strlen($key) < 16) { while (strlen($newkey) < 16) { $newkey .= "0"; } } return $newkey; } function encrypt($str, $key) { //$key = $this->hex2bin($key); $iv = $this->iv; $td = mcrypt_module_open('rijndael-128', '', 'cbc', $iv); mcrypt_generic_init($td, $key, $iv); $encrypted = mcrypt_generic($td, $str); mcrypt_generic_deinit($td); mcrypt_module_close($td); return bin2hex($encrypted); } function decrypt($code, $key) { //$key = $this->hex2bin($key); $code = $this->hex2bin($code); $iv = $this->iv; $td = mcrypt_module_open('rijndael-128', '', 'cbc', $iv); mcrypt_generic_init($td, $key, $iv); $decrypted = mdecrypt_generic($td, $code); mcrypt_generic_deinit($td); mcrypt_module_close($td); return utf8_encode(trim($decrypted)); } protected function hex2bin($hexdata) { $bindata = ''; for ($i = 0; $i < strlen($hexdata); $i += 2) { $bindata .= chr(hexdec(substr($hexdata, $i, 2))); } return $bindata; } } ?>
Fmstrat/odm-web
odm/include/mcrypt.php
PHP
gpl-3.0
1,275
// DO NOT EDIT -- generated by mk-ops #if !defined (octave_mx_i16nda_i8nda_h) #define octave_mx_i16nda_i8nda_h 1 #include "int16NDArray.h" #include "int8NDArray.h" #include "mx-op-decl.h" NDND_CMP_OP_DECLS (int16NDArray, int8NDArray, OCTAVE_API) NDND_BOOL_OP_DECLS (int16NDArray, int8NDArray, OCTAVE_API) #endif
aJanker/TypeChef-LinuxAnalysis
linux26333/systems/redhat/usr/include/octave-3.2.4/octave/mx-i16nda-i8nda.h
C
gpl-3.0
312
package{ name = "tokens", version = "1.0", depends = { "util", "mathcore", "matrix" }, keywords = { }, description = "", -- targets como en ant target{ name = "init", mkdir{ dir = "build" }, mkdir{ dir = "include" }, }, target{ name = "clean", delete{ dir = "build" }, delete{ dir = "include" }, }, target{ name = "provide", depends = "init", copy{ file= "c_src/*.h", dest_dir = "include" }, provide_bind{ file = "binding/bind_tokens.lua.cc" , dest_dir = "include" }, }, target{ name = "build", depends = "provide", use_timestamp = true, object{ file = "c_src/*.cc", dest_dir = "build", -- flags = "-std=c99", }, object{ file = "c_src/*.cu", dest_dir = "build", -- flags = "-std=c99", }, luac{ orig_dir = "lua_src", dest_dir = "build", }, build_bind{ file = "binding/bind_tokens.lua.cc", dest_dir = "build" }, }, target{ name = "document", document_src{ }, document_bind{ }, }, }
pakozm/april-ann
packages/basics/tokens/package.lua
Lua
gpl-3.0
1,122
<!DOCTYPE html> <html lang="en"> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/> <meta charset="utf-8"/> <title>API Documentation</title> <meta name="author" content=""/> <meta name="description" content=""/> <link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css" rel="stylesheet"> <link href="http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css" rel="stylesheet"> <link href="../css/prism.css" rel="stylesheet" media="all"/> <link href="../css/template.css" rel="stylesheet" media="all"/> <!--[if lt IE 9]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script> <![endif]--> <script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.min.js" type="text/javascript"></script> <script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script> <script src="../js/jquery.smooth-scroll.js"></script> <script src="../js/prism.min.js"></script> <!-- TODO: Add http://jscrollpane.kelvinluck.com/ to style the scrollbars for browsers not using webkit--> <script type="text/javascript"> function loadExternalCodeSnippets() { Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function (pre) { var src = pre.getAttribute('data-src'); var extension = (src.match(/\.(\w+)$/) || [, ''])[1]; var language = 'php'; var code = document.createElement('code'); code.className = 'language-' + language; pre.textContent = ''; code.textContent = 'Loading…'; pre.appendChild(code); var xhr = new XMLHttpRequest(); xhr.open('GET', src, true); xhr.onreadystatechange = function () { if (xhr.readyState == 4) { if (xhr.status < 400 && xhr.responseText) { code.textContent = xhr.responseText; Prism.highlightElement(code); } else if (xhr.status >= 400) { code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText; } else { code.textContent = '✖ Error: File does not exist or is empty'; } } }; xhr.send(null); }); } $(document).ready(function(){ loadExternalCodeSnippets(); }); $('#source-view').on('shown', function () { loadExternalCodeSnippets(); }) </script> <link rel="shortcut icon" href="../images/favicon.ico"/> <link rel="apple-touch-icon" href="../images/apple-touch-icon.png"/> <link rel="apple-touch-icon" sizes="72x72" href="../images/apple-touch-icon-72x72.png"/> <link rel="apple-touch-icon" sizes="114x114" href="../images/apple-touch-icon-114x114.png"/> </head> <body> <div class="navbar navbar-fixed-top"> <div class="navbar-inner"> <div class="container"> <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <i class="icon-ellipsis-vertical"></i> </a> <a class="brand" href="../index.html">API Documentation</a> <div class="nav-collapse"> <ul class="nav pull-right"> <li class="dropdown"> <a href="../index.html" class="dropdown-toggle" data-toggle="dropdown"> API Documentation <b class="caret"></b> </a> <ul class="dropdown-menu"> </ul> </li> <li class="dropdown" id="charts-menu"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> Charts <b class="caret"></b> </a> <ul class="dropdown-menu"> <li> <a href="../graphs/class.html"> <i class="icon-list-alt"></i>&#160;Class hierarchy diagram </a> </li> </ul> </li> <li class="dropdown" id="reports-menu"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> Reports <b class="caret"></b> </a> <ul class="dropdown-menu"> <li> <a href="../reports/errors.html"> <i class="icon-list-alt"></i>&#160;Errors </a> </li> <li> <a href="../reports/markers.html"> <i class="icon-list-alt"></i>&#160;Markers </a> </li> </ul> </li> </ul> </div> </div> </div> <!--<div class="go_to_top">--> <!--<a href="#___" style="color: inherit">Back to top&#160;&#160;<i class="icon-upload icon-white"></i></a>--> <!--</div>--> </div> <div id="___" class="container-fluid"> <section class="row-fluid"> <div class="span2 sidebar"> <div class="accordion" style="margin-bottom: 0"> <div class="accordion-group"> <div class="accordion-heading"> <a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1791145528"></a> <a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a> </div> <div id="namespace-1791145528" class="accordion-body collapse in"> <div class="accordion-inner"> <ul> <li class="class"><a href="../classes/Partecipazione.html">Partecipazione</a></li> <li class="class"><a href="../classes/Dimissione.html">Dimissione</a></li> <li class="class"><a href="../classes/Zip.html">Zip</a></li> <li class="class"><a href="../classes/Commento.html">Commento</a></li> <li class="class"><a href="../classes/Utente.html">Utente</a></li> <li class="class"><a href="../classes/Appartenenza.html">Appartenenza</a></li> <li class="class"><a href="../classes/Anonimo.html">Anonimo</a></li> <li class="class"><a href="../classes/Documento.html">Documento</a></li> <li class="class"><a href="../classes/Mail.html">Mail</a></li> <li class="class"><a href="../classes/Sessione.html">Sessione</a></li> <li class="class"><a href="../classes/Entita.html">Entita</a></li> <li class="class"><a href="../classes/Area.html">Area</a></li> <li class="class"><a href="../classes/RichiestaTurno.html">RichiestaTurno</a></li> <li class="class"><a href="../classes/Annunci.html">Annunci</a></li> <li class="class"><a href="../classes/Gruppo.html">Gruppo</a></li> <li class="class"><a href="../classes/Patentirichieste.html">Patentirichieste</a></li> <li class="class"><a href="../classes/Reperibilita.html">Reperibilita</a></li> <li class="class"><a href="../classes/GeocoderResult.html">GeocoderResult</a></li> <li class="class"><a href="../classes/AppartenenzaGruppo.html">AppartenenzaGruppo</a></li> <li class="class"><a href="../classes/Ricerca.html">Ricerca</a></li> <li class="class"><a href="../classes/APIServer.html">APIServer</a></li> <li class="class"><a href="../classes/Volontario.html">Volontario</a></li> <li class="class"><a href="../classes/Veicoli.html">Veicoli</a></li> <li class="class"><a href="../classes/Regionale.html">Regionale</a></li> <li class="class"><a href="../classes/ElementoRichiesta.html">ElementoRichiesta</a></li> <li class="class"><a href="../classes/ICalendar.html">ICalendar</a></li> <li class="class"><a href="../classes/Errore.html">Errore</a></li> <li class="class"><a href="../classes/File.html">File</a></li> <li class="class"><a href="../classes/Quota.html">Quota</a></li> <li class="class"><a href="../classes/Comitato.html">Comitato</a></li> <li class="class"><a href="../classes/Oggetto.html">Oggetto</a></li> <li class="class"><a href="../classes/Avatar.html">Avatar</a></li> <li class="class"><a href="../classes/Persona.html">Persona</a></li> <li class="class"><a href="../classes/Trasferimento.html">Trasferimento</a></li> <li class="class"><a href="../classes/Turno.html">Turno</a></li> <li class="class"><a href="../classes/Attivita.html">Attivita</a></li> <li class="class"><a href="../classes/Provinciale.html">Provinciale</a></li> <li class="class"><a href="../classes/PDF.html">PDF</a></li> <li class="class"><a href="../classes/Estensione.html">Estensione</a></li> <li class="class"><a href="../classes/Autorizzazione.html">Autorizzazione</a></li> <li class="class"><a href="../classes/Coturno.html">Coturno</a></li> <li class="class"><a href="../classes/Nazionale.html">Nazionale</a></li> <li class="class"><a href="../classes/TitoloPersonale.html">TitoloPersonale</a></li> <li class="class"><a href="../classes/Delegato.html">Delegato</a></li> <li class="class"><a href="../classes/Email.html">Email</a></li> <li class="class"><a href="../classes/Riserva.html">Riserva</a></li> <li class="class"><a href="../classes/Excel.html">Excel</a></li> <li class="class"><a href="../classes/GeoPolitica.html">GeoPolitica</a></li> <li class="class"><a href="../classes/Geocoder.html">Geocoder</a></li> <li class="class"><a href="../classes/GeoEntita.html">GeoEntita</a></li> <li class="class"><a href="../classes/DT.html">DT</a></li> <li class="class"><a href="../classes/Locale.html">Locale</a></li> <li class="class"><a href="../classes/Titolo.html">Titolo</a></li> <li class="class"><a href="../classes/ePDO.html">ePDO</a></li> </ul> </div> </div> </div> </div> </div> </section> <section class="row-fluid"> <div class="span10 offset2"> <div class="row-fluid"> <div class="span8 content class"> <nav> <a href="../namespaces/default.html">\</a> <i class="icon-level-up"></i> </nav> <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal"><i class="icon-code"></i></a> <h1><small>\</small>APIServer</h1> <p><em></em></p> <section id="summary"> <h2>Summary</h2> <section class="row-fluid heading"> <section class="span4"> <a href="#methods">Methods</a> </section> <section class="span4"> <a href="#properties">Properties</a> </section> <section class="span4"> <a href="#constants">Constants</a> </section> </section> <section class="row-fluid public"> <section class="span4"> <a href="../classes/APIServer.html#method___construct" class="">__construct()</a><br /> <a href="../classes/APIServer.html#method_esegui" class="">esegui()</a><br /> <a href="../classes/APIServer.html#method_api_user" class="">api_user()</a><br /> <a href="../classes/APIServer.html#method_api_login" class="">api_login()</a><br /> <a href="../classes/APIServer.html#method_api_ciao" class="">api_ciao()</a><br /> <a href="../classes/APIServer.html#method_api_logout" class="">api_logout()</a><br /> <a href="../classes/APIServer.html#method_api_cercaTitolo" class="">api_cercaTitolo()</a><br /> <a href="../classes/APIServer.html#method_api_attivita" class="">api_attivita()</a><br /> <a href="../classes/APIServer.html#method_api_geocoding" class="">api_geocoding()</a><br /> <a href="../classes/APIServer.html#method_api_me" class="">api_me()</a><br /> <a href="../classes/APIServer.html#method_api_comitati" class="">api_comitati()</a><br /> <a href="../classes/APIServer.html#method_api_autorizza" class="">api_autorizza()</a><br /> <a href="../classes/APIServer.html#method_api_scansione" class="">api_scansione()</a><br /> <a href="../classes/APIServer.html#method_api_area_cancella" class="">api_area_cancella()</a><br /> <a href="../classes/APIServer.html#method_api_volontari_cerca" class="">api_volontari_cerca()</a><br /> </section> <section class="span4"> <a href="../classes/APIServer.html#property_par" class="">$par</a><br /> </section> <section class="span4"> <em>No constants found</em> </section> </section> <section class="row-fluid protected"> <section class="span4"> <em>No protected methods found</em> </section> <section class="span4"> <em>No protected properties found</em> </section> <section class="span4"> <em>N/A</em> </section> </section> <section class="row-fluid private"> <section class="span4"> <a href="../classes/APIServer.html#method_richiediLogin" class="">richiediLogin()</a><br /> <a href="../classes/APIServer.html#method_richiedi" class="">richiedi()</a><br /> <a href="../classes/APIServer.html#method_api_welcome" class="">api_welcome()</a><br /> </section> <section class="span4"> <a href="../classes/APIServer.html#property_db" class="">$db</a><br /> <a href="../classes/APIServer.html#property_sessione" class="">$sessione</a><br /> </section> <section class="span4"> <em>N/A</em> </section> </section> </section> </div> <aside class="span4 detailsbar"> <dl> <dt>File</dt> <dd><a href="../files/core.class.APIServer.class.php.html"><div class="path-wrapper">core/class/APIServer.class.php</div></a></dd> <dt>Package</dt> <dd><div class="namespace-wrapper">\Gaia</div></dd> <dt>Class hierarchy</dt> <dd class="hierarchy"> <div class="namespace-wrapper">\APIServer</div> </dd> </dl> <h2>Tags</h2> <table class="table table-condensed"> <tr><td colspan="2"><em>None found</em></td></tr> </table> </aside> </div> <a id="properties" name="properties"></a> <div class="row-fluid"> <div class="span8 content class"> <h2>Properties</h2> </div> <aside class="span4 detailsbar"></aside> </div> <div class="row-fluid"> <div class="span8 content class"> <a id="property_par" name="property_par" class="anchor"></a> <article class="property"> <h3 class="public ">$par</h3> <pre class="signature">$par</pre> <p><em></em></p> </article> </div> <aside class="span4 detailsbar"> <h1><i class="icon-arrow-down"></i></h1> <dl> </dl> <h2>Tags</h2> <table class="table table-condensed"> <tr><td colspan="2"><em>None found</em></td></tr> </table> </aside> </div> <div class="row-fluid"> <div class="span8 content class"> <a id="property_db" name="property_db" class="anchor"></a> <article class="property"> <h3 class="private ">$db</h3> <pre class="signature">$db</pre> <p><em></em></p> </article> </div> <aside class="span4 detailsbar"> <h1><i class="icon-arrow-down"></i></h1> <dl> </dl> <h2>Tags</h2> <table class="table table-condensed"> <tr><td colspan="2"><em>None found</em></td></tr> </table> </aside> </div> <div class="row-fluid"> <div class="span8 content class"> <a id="property_sessione" name="property_sessione" class="anchor"></a> <article class="property"> <h3 class="private ">$sessione</h3> <pre class="signature">$sessione</pre> <p><em></em></p> </article> </div> <aside class="span4 detailsbar"> <h1><i class="icon-arrow-down"></i></h1> <dl> </dl> <h2>Tags</h2> <table class="table table-condensed"> <tr><td colspan="2"><em>None found</em></td></tr> </table> </aside> </div> <a id="methods" name="methods"></a> <div class="row-fluid"> <div class="span8 content class"><h2>Methods</h2></div> <aside class="span4 detailsbar"></aside> </div> <div class="row-fluid"> <div class="span8 content class"> <a id="method___construct" name="method___construct" class="anchor"></a> <article class="method"> <h3 class="public ">__construct()</h3> <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a> <pre class="signature" style="margin-right: 54px;">__construct( <span class="argument">$sid</span>)</pre> <p><em></em></p> <h4>Parameters</h4> <table class="table table-condensed table-hover"> <tr> <td></td> <td>$sid</td> <td> </td> </tr> </table> </article> </div> <aside class="span4 detailsbar"> <h1><i class="icon-arrow-down"></i></h1> <dl> </dl> <h2>Tags</h2> <table class="table table-condensed"> <tr><td colspan="2"><em>None found</em></td></tr> </table> </aside> </div> <div class="row-fluid"> <div class="span8 content class"> <a id="method_esegui" name="method_esegui" class="anchor"></a> <article class="method"> <h3 class="public ">esegui()</h3> <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a> <pre class="signature" style="margin-right: 54px;">esegui( <span class="argument">$azione</span>)</pre> <p><em></em></p> <h4>Parameters</h4> <table class="table table-condensed table-hover"> <tr> <td></td> <td>$azione</td> <td> </td> </tr> </table> </article> </div> <aside class="span4 detailsbar"> <h1><i class="icon-arrow-down"></i></h1> <dl> </dl> <h2>Tags</h2> <table class="table table-condensed"> <tr><td colspan="2"><em>None found</em></td></tr> </table> </aside> </div> <div class="row-fluid"> <div class="span8 content class"> <a id="method_api_user" name="method_api_user" class="anchor"></a> <article class="method"> <h3 class="public ">api_user()</h3> <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a> <pre class="signature" style="margin-right: 54px;">api_user()</pre> <p><em></em></p> </article> </div> <aside class="span4 detailsbar"> <h1><i class="icon-arrow-down"></i></h1> <dl> </dl> <h2>Tags</h2> <table class="table table-condensed"> <tr><td colspan="2"><em>None found</em></td></tr> </table> </aside> </div> <div class="row-fluid"> <div class="span8 content class"> <a id="method_api_login" name="method_api_login" class="anchor"></a> <article class="method"> <h3 class="public ">api_login()</h3> <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a> <pre class="signature" style="margin-right: 54px;">api_login()</pre> <p><em></em></p> </article> </div> <aside class="span4 detailsbar"> <h1><i class="icon-arrow-down"></i></h1> <dl> </dl> <h2>Tags</h2> <table class="table table-condensed"> <tr><td colspan="2"><em>None found</em></td></tr> </table> </aside> </div> <div class="row-fluid"> <div class="span8 content class"> <a id="method_api_ciao" name="method_api_ciao" class="anchor"></a> <article class="method"> <h3 class="public ">api_ciao()</h3> <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a> <pre class="signature" style="margin-right: 54px;">api_ciao()</pre> <p><em></em></p> </article> </div> <aside class="span4 detailsbar"> <h1><i class="icon-arrow-down"></i></h1> <dl> </dl> <h2>Tags</h2> <table class="table table-condensed"> <tr><td colspan="2"><em>None found</em></td></tr> </table> </aside> </div> <div class="row-fluid"> <div class="span8 content class"> <a id="method_api_logout" name="method_api_logout" class="anchor"></a> <article class="method"> <h3 class="public ">api_logout()</h3> <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a> <pre class="signature" style="margin-right: 54px;">api_logout()</pre> <p><em></em></p> </article> </div> <aside class="span4 detailsbar"> <h1><i class="icon-arrow-down"></i></h1> <dl> </dl> <h2>Tags</h2> <table class="table table-condensed"> <tr><td colspan="2"><em>None found</em></td></tr> </table> </aside> </div> <div class="row-fluid"> <div class="span8 content class"> <a id="method_api_cercaTitolo" name="method_api_cercaTitolo" class="anchor"></a> <article class="method"> <h3 class="public ">api_cercaTitolo()</h3> <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a> <pre class="signature" style="margin-right: 54px;">api_cercaTitolo()</pre> <p><em></em></p> </article> </div> <aside class="span4 detailsbar"> <h1><i class="icon-arrow-down"></i></h1> <dl> </dl> <h2>Tags</h2> <table class="table table-condensed"> <tr><td colspan="2"><em>None found</em></td></tr> </table> </aside> </div> <div class="row-fluid"> <div class="span8 content class"> <a id="method_api_attivita" name="method_api_attivita" class="anchor"></a> <article class="method"> <h3 class="public ">api_attivita()</h3> <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a> <pre class="signature" style="margin-right: 54px;">api_attivita()</pre> <p><em></em></p> </article> </div> <aside class="span4 detailsbar"> <h1><i class="icon-arrow-down"></i></h1> <dl> </dl> <h2>Tags</h2> <table class="table table-condensed"> <tr><td colspan="2"><em>None found</em></td></tr> </table> </aside> </div> <div class="row-fluid"> <div class="span8 content class"> <a id="method_api_geocoding" name="method_api_geocoding" class="anchor"></a> <article class="method"> <h3 class="public ">api_geocoding()</h3> <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a> <pre class="signature" style="margin-right: 54px;">api_geocoding()</pre> <p><em></em></p> </article> </div> <aside class="span4 detailsbar"> <h1><i class="icon-arrow-down"></i></h1> <dl> </dl> <h2>Tags</h2> <table class="table table-condensed"> <tr><td colspan="2"><em>None found</em></td></tr> </table> </aside> </div> <div class="row-fluid"> <div class="span8 content class"> <a id="method_api_me" name="method_api_me" class="anchor"></a> <article class="method"> <h3 class="public ">api_me()</h3> <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a> <pre class="signature" style="margin-right: 54px;">api_me()</pre> <p><em></em></p> </article> </div> <aside class="span4 detailsbar"> <h1><i class="icon-arrow-down"></i></h1> <dl> </dl> <h2>Tags</h2> <table class="table table-condensed"> <tr><td colspan="2"><em>None found</em></td></tr> </table> </aside> </div> <div class="row-fluid"> <div class="span8 content class"> <a id="method_api_comitati" name="method_api_comitati" class="anchor"></a> <article class="method"> <h3 class="public ">api_comitati()</h3> <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a> <pre class="signature" style="margin-right: 54px;">api_comitati()</pre> <p><em></em></p> </article> </div> <aside class="span4 detailsbar"> <h1><i class="icon-arrow-down"></i></h1> <dl> </dl> <h2>Tags</h2> <table class="table table-condensed"> <tr><td colspan="2"><em>None found</em></td></tr> </table> </aside> </div> <div class="row-fluid"> <div class="span8 content class"> <a id="method_api_autorizza" name="method_api_autorizza" class="anchor"></a> <article class="method"> <h3 class="public ">api_autorizza()</h3> <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a> <pre class="signature" style="margin-right: 54px;">api_autorizza()</pre> <p><em></em></p> </article> </div> <aside class="span4 detailsbar"> <h1><i class="icon-arrow-down"></i></h1> <dl> </dl> <h2>Tags</h2> <table class="table table-condensed"> <tr><td colspan="2"><em>None found</em></td></tr> </table> </aside> </div> <div class="row-fluid"> <div class="span8 content class"> <a id="method_api_scansione" name="method_api_scansione" class="anchor"></a> <article class="method"> <h3 class="public ">api_scansione()</h3> <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a> <pre class="signature" style="margin-right: 54px;">api_scansione()</pre> <p><em></em></p> </article> </div> <aside class="span4 detailsbar"> <h1><i class="icon-arrow-down"></i></h1> <dl> </dl> <h2>Tags</h2> <table class="table table-condensed"> <tr><td colspan="2"><em>None found</em></td></tr> </table> </aside> </div> <div class="row-fluid"> <div class="span8 content class"> <a id="method_api_area_cancella" name="method_api_area_cancella" class="anchor"></a> <article class="method"> <h3 class="public ">api_area_cancella()</h3> <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a> <pre class="signature" style="margin-right: 54px;">api_area_cancella()</pre> <p><em></em></p> </article> </div> <aside class="span4 detailsbar"> <h1><i class="icon-arrow-down"></i></h1> <dl> </dl> <h2>Tags</h2> <table class="table table-condensed"> <tr><td colspan="2"><em>None found</em></td></tr> </table> </aside> </div> <div class="row-fluid"> <div class="span8 content class"> <a id="method_api_volontari_cerca" name="method_api_volontari_cerca" class="anchor"></a> <article class="method"> <h3 class="public ">api_volontari_cerca()</h3> <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a> <pre class="signature" style="margin-right: 54px;">api_volontari_cerca()</pre> <p><em></em></p> </article> </div> <aside class="span4 detailsbar"> <h1><i class="icon-arrow-down"></i></h1> <dl> </dl> <h2>Tags</h2> <table class="table table-condensed"> <tr><td colspan="2"><em>None found</em></td></tr> </table> </aside> </div> <div class="row-fluid"> <div class="span8 content class"> <a id="method_richiediLogin" name="method_richiediLogin" class="anchor"></a> <article class="method"> <h3 class="private ">richiediLogin()</h3> <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a> <pre class="signature" style="margin-right: 54px;">richiediLogin()</pre> <p><em></em></p> </article> </div> <aside class="span4 detailsbar"> <h1><i class="icon-arrow-down"></i></h1> <dl> </dl> <h2>Tags</h2> <table class="table table-condensed"> <tr><td colspan="2"><em>None found</em></td></tr> </table> </aside> </div> <div class="row-fluid"> <div class="span8 content class"> <a id="method_richiedi" name="method_richiedi" class="anchor"></a> <article class="method"> <h3 class="private ">richiedi()</h3> <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a> <pre class="signature" style="margin-right: 54px;">richiedi( <span class="argument">$campi</span>)</pre> <p><em></em></p> <h4>Parameters</h4> <table class="table table-condensed table-hover"> <tr> <td></td> <td>$campi</td> <td> </td> </tr> </table> </article> </div> <aside class="span4 detailsbar"> <h1><i class="icon-arrow-down"></i></h1> <dl> </dl> <h2>Tags</h2> <table class="table table-condensed"> <tr><td colspan="2"><em>None found</em></td></tr> </table> </aside> </div> <div class="row-fluid"> <div class="span8 content class"> <a id="method_api_welcome" name="method_api_welcome" class="anchor"></a> <article class="method"> <h3 class="private ">api_welcome()</h3> <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a> <pre class="signature" style="margin-right: 54px;">api_welcome()</pre> <p><em></em></p> </article> </div> <aside class="span4 detailsbar"> <h1><i class="icon-arrow-down"></i></h1> <dl> </dl> <h2>Tags</h2> <table class="table table-condensed"> <tr><td colspan="2"><em>None found</em></td></tr> </table> </aside> </div> </div> </section> <div id="source-view" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="source-view-label" aria-hidden="true"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h3 id="source-view-label">APIServer.class.php</h3> </div> <div class="modal-body"> <pre data-src="../files/core/class/APIServer.class.php.txt" class="language-php line-numbers"></pre> </div> </div> <footer class="row-fluid"> <section class="span10 offset2"> <section class="row-fluid"> <section class="span10 offset1"> <section class="row-fluid footer-sections"> <section class="span4"> <h1><i class="icon-code"></i></h1> <div> <ul> </ul> </div> </section> <section class="span4"> <h1><i class="icon-bar-chart"></i></h1> <div> <ul> <li><a href="">Class Hierarchy Diagram</a></li> </ul> </div> </section> <section class="span4"> <h1><i class="icon-pushpin"></i></h1> <div> <ul> <li><a href="">Errors</a></li> <li><a href="">Markers</a></li> </ul> </div> </section> </section> </section> </section> <section class="row-fluid"> <section class="span10 offset1"> <hr /> Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored on September 18th, 2013 at 18:37. </section> </section> </section> </footer> </div> </body> </html>
CroceRossaCatania/gaia
docs/classes/APIServer.html
HTML
gpl-3.0
48,471
/* * This definitions of the PIC16F1619 MCU. * * This file is part of the GNU PIC library for SDCC, originally * created by Molnar Karoly <[email protected]> 2016. * * This file is generated automatically by the cinc2h.pl, 2016-04-13 17:23:10 UTC. * * SDCC is licensed under the GNU Public license (GPL) v2. Note that * this license covers the code to the compiler and other executables, * but explicitly does not cover any code or objects generated by sdcc. * * For pic device libraries and header files which are derived from * Microchip header (.inc) and linker script (.lkr) files Microchip * requires that "The header files should state that they are only to be * used with authentic Microchip devices" which makes them incompatible * with the GPL. Pic device libraries and header files are located at * non-free/lib and non-free/include directories respectively. * Sdcc should be run with the --use-non-free command line option in * order to include non-free header files and libraries. * * See http://sdcc.sourceforge.net/ for the latest information on sdcc. */ #include <pic16f1619.h> //============================================================================== __at(0x0000) __sfr INDF0; __at(0x0001) __sfr INDF1; __at(0x0002) __sfr PCL; __at(0x0003) __sfr STATUS; __at(0x0003) volatile __STATUSbits_t STATUSbits; __at(0x0004) __sfr FSR0; __at(0x0004) __sfr FSR0L; __at(0x0005) __sfr FSR0H; __at(0x0006) __sfr FSR1; __at(0x0006) __sfr FSR1L; __at(0x0007) __sfr FSR1H; __at(0x0008) __sfr BSR; __at(0x0008) volatile __BSRbits_t BSRbits; __at(0x0009) __sfr WREG; __at(0x000A) __sfr PCLATH; __at(0x000B) __sfr INTCON; __at(0x000B) volatile __INTCONbits_t INTCONbits; __at(0x000C) __sfr PORTA; __at(0x000C) volatile __PORTAbits_t PORTAbits; __at(0x000D) __sfr PORTB; __at(0x000D) volatile __PORTBbits_t PORTBbits; __at(0x000E) __sfr PORTC; __at(0x000E) volatile __PORTCbits_t PORTCbits; __at(0x0010) __sfr PIR1; __at(0x0010) volatile __PIR1bits_t PIR1bits; __at(0x0011) __sfr PIR2; __at(0x0011) volatile __PIR2bits_t PIR2bits; __at(0x0012) __sfr PIR3; __at(0x0012) volatile __PIR3bits_t PIR3bits; __at(0x0013) __sfr PIR4; __at(0x0013) volatile __PIR4bits_t PIR4bits; __at(0x0014) __sfr PIR5; __at(0x0014) volatile __PIR5bits_t PIR5bits; __at(0x0015) __sfr TMR0; __at(0x0016) __sfr TMR1; __at(0x0016) __sfr TMR1L; __at(0x0017) __sfr TMR1H; __at(0x0018) __sfr T1CON; __at(0x0018) volatile __T1CONbits_t T1CONbits; __at(0x0019) __sfr T1GCON; __at(0x0019) volatile __T1GCONbits_t T1GCONbits; __at(0x001A) __sfr T2TMR; __at(0x001A) __sfr TMR2; __at(0x001B) __sfr PR2; __at(0x001B) __sfr T2PR; __at(0x001C) __sfr T2CON; __at(0x001C) volatile __T2CONbits_t T2CONbits; __at(0x001D) __sfr T2HLT; __at(0x001D) volatile __T2HLTbits_t T2HLTbits; __at(0x001E) __sfr T2CLKCON; __at(0x001E) volatile __T2CLKCONbits_t T2CLKCONbits; __at(0x001F) __sfr T2RST; __at(0x001F) volatile __T2RSTbits_t T2RSTbits; __at(0x008C) __sfr TRISA; __at(0x008C) volatile __TRISAbits_t TRISAbits; __at(0x008D) __sfr TRISB; __at(0x008D) volatile __TRISBbits_t TRISBbits; __at(0x008E) __sfr TRISC; __at(0x008E) volatile __TRISCbits_t TRISCbits; __at(0x0090) __sfr PIE1; __at(0x0090) volatile __PIE1bits_t PIE1bits; __at(0x0091) __sfr PIE2; __at(0x0091) volatile __PIE2bits_t PIE2bits; __at(0x0092) __sfr PIE3; __at(0x0092) volatile __PIE3bits_t PIE3bits; __at(0x0093) __sfr PIE4; __at(0x0093) volatile __PIE4bits_t PIE4bits; __at(0x0094) __sfr PIE5; __at(0x0094) volatile __PIE5bits_t PIE5bits; __at(0x0095) __sfr OPTION_REG; __at(0x0095) volatile __OPTION_REGbits_t OPTION_REGbits; __at(0x0096) __sfr PCON; __at(0x0096) volatile __PCONbits_t PCONbits; __at(0x0098) __sfr OSCTUNE; __at(0x0098) volatile __OSCTUNEbits_t OSCTUNEbits; __at(0x0099) __sfr OSCCON; __at(0x0099) volatile __OSCCONbits_t OSCCONbits; __at(0x009A) __sfr OSCSTAT; __at(0x009A) volatile __OSCSTATbits_t OSCSTATbits; __at(0x009B) __sfr ADRES; __at(0x009B) __sfr ADRESL; __at(0x009C) __sfr ADRESH; __at(0x009D) __sfr ADCON0; __at(0x009D) volatile __ADCON0bits_t ADCON0bits; __at(0x009E) __sfr ADCON1; __at(0x009E) volatile __ADCON1bits_t ADCON1bits; __at(0x009F) __sfr ADCON2; __at(0x009F) volatile __ADCON2bits_t ADCON2bits; __at(0x010C) __sfr LATA; __at(0x010C) volatile __LATAbits_t LATAbits; __at(0x010D) __sfr LATB; __at(0x010D) volatile __LATBbits_t LATBbits; __at(0x010E) __sfr LATC; __at(0x010E) volatile __LATCbits_t LATCbits; __at(0x0111) __sfr CM1CON0; __at(0x0111) volatile __CM1CON0bits_t CM1CON0bits; __at(0x0112) __sfr CM1CON1; __at(0x0112) volatile __CM1CON1bits_t CM1CON1bits; __at(0x0113) __sfr CM2CON0; __at(0x0113) volatile __CM2CON0bits_t CM2CON0bits; __at(0x0114) __sfr CM2CON1; __at(0x0114) volatile __CM2CON1bits_t CM2CON1bits; __at(0x0115) __sfr CMOUT; __at(0x0115) volatile __CMOUTbits_t CMOUTbits; __at(0x0116) __sfr BORCON; __at(0x0116) volatile __BORCONbits_t BORCONbits; __at(0x0117) __sfr FVRCON; __at(0x0117) volatile __FVRCONbits_t FVRCONbits; __at(0x0118) __sfr DAC1CON0; __at(0x0118) volatile __DAC1CON0bits_t DAC1CON0bits; __at(0x0119) __sfr DAC1CON1; __at(0x0119) volatile __DAC1CON1bits_t DAC1CON1bits; __at(0x011C) __sfr ZCD1CON; __at(0x011C) volatile __ZCD1CONbits_t ZCD1CONbits; __at(0x018C) __sfr ANSELA; __at(0x018C) volatile __ANSELAbits_t ANSELAbits; __at(0x018D) __sfr ANSELB; __at(0x018D) volatile __ANSELBbits_t ANSELBbits; __at(0x018E) __sfr ANSELC; __at(0x018E) volatile __ANSELCbits_t ANSELCbits; __at(0x0191) __sfr PMADR; __at(0x0191) __sfr PMADRL; __at(0x0192) __sfr PMADRH; __at(0x0193) __sfr PMDAT; __at(0x0193) __sfr PMDATL; __at(0x0194) __sfr PMDATH; __at(0x0195) __sfr PMCON1; __at(0x0195) volatile __PMCON1bits_t PMCON1bits; __at(0x0196) __sfr PMCON2; __at(0x0197) __sfr VREGCON; __at(0x0197) volatile __VREGCONbits_t VREGCONbits; __at(0x0199) __sfr RC1REG; __at(0x0199) __sfr RCREG; __at(0x0199) __sfr RCREG1; __at(0x019A) __sfr TX1REG; __at(0x019A) __sfr TXREG; __at(0x019A) __sfr TXREG1; __at(0x019B) __sfr SP1BRG; __at(0x019B) __sfr SP1BRGL; __at(0x019B) __sfr SPBRG; __at(0x019B) __sfr SPBRG1; __at(0x019B) __sfr SPBRGL; __at(0x019C) __sfr SP1BRGH; __at(0x019C) __sfr SPBRGH; __at(0x019C) __sfr SPBRGH1; __at(0x019D) __sfr RC1STA; __at(0x019D) volatile __RC1STAbits_t RC1STAbits; __at(0x019D) __sfr RCSTA; __at(0x019D) volatile __RCSTAbits_t RCSTAbits; __at(0x019D) __sfr RCSTA1; __at(0x019D) volatile __RCSTA1bits_t RCSTA1bits; __at(0x019E) __sfr TX1STA; __at(0x019E) volatile __TX1STAbits_t TX1STAbits; __at(0x019E) __sfr TXSTA; __at(0x019E) volatile __TXSTAbits_t TXSTAbits; __at(0x019E) __sfr TXSTA1; __at(0x019E) volatile __TXSTA1bits_t TXSTA1bits; __at(0x019F) __sfr BAUD1CON; __at(0x019F) volatile __BAUD1CONbits_t BAUD1CONbits; __at(0x019F) __sfr BAUDCON; __at(0x019F) volatile __BAUDCONbits_t BAUDCONbits; __at(0x019F) __sfr BAUDCON1; __at(0x019F) volatile __BAUDCON1bits_t BAUDCON1bits; __at(0x019F) __sfr BAUDCTL; __at(0x019F) volatile __BAUDCTLbits_t BAUDCTLbits; __at(0x019F) __sfr BAUDCTL1; __at(0x019F) volatile __BAUDCTL1bits_t BAUDCTL1bits; __at(0x020C) __sfr WPUA; __at(0x020C) volatile __WPUAbits_t WPUAbits; __at(0x020D) __sfr WPUB; __at(0x020D) volatile __WPUBbits_t WPUBbits; __at(0x020E) __sfr WPUC; __at(0x020E) volatile __WPUCbits_t WPUCbits; __at(0x0211) __sfr SSP1BUF; __at(0x0211) volatile __SSP1BUFbits_t SSP1BUFbits; __at(0x0211) __sfr SSPBUF; __at(0x0211) volatile __SSPBUFbits_t SSPBUFbits; __at(0x0212) __sfr SSP1ADD; __at(0x0212) volatile __SSP1ADDbits_t SSP1ADDbits; __at(0x0212) __sfr SSPADD; __at(0x0212) volatile __SSPADDbits_t SSPADDbits; __at(0x0213) __sfr SSP1MSK; __at(0x0213) volatile __SSP1MSKbits_t SSP1MSKbits; __at(0x0213) __sfr SSPMSK; __at(0x0213) volatile __SSPMSKbits_t SSPMSKbits; __at(0x0214) __sfr SSP1STAT; __at(0x0214) volatile __SSP1STATbits_t SSP1STATbits; __at(0x0214) __sfr SSPSTAT; __at(0x0214) volatile __SSPSTATbits_t SSPSTATbits; __at(0x0215) __sfr SSP1CON; __at(0x0215) volatile __SSP1CONbits_t SSP1CONbits; __at(0x0215) __sfr SSP1CON1; __at(0x0215) volatile __SSP1CON1bits_t SSP1CON1bits; __at(0x0215) __sfr SSPCON; __at(0x0215) volatile __SSPCONbits_t SSPCONbits; __at(0x0215) __sfr SSPCON1; __at(0x0215) volatile __SSPCON1bits_t SSPCON1bits; __at(0x0216) __sfr SSP1CON2; __at(0x0216) volatile __SSP1CON2bits_t SSP1CON2bits; __at(0x0216) __sfr SSPCON2; __at(0x0216) volatile __SSPCON2bits_t SSPCON2bits; __at(0x0217) __sfr SSP1CON3; __at(0x0217) volatile __SSP1CON3bits_t SSP1CON3bits; __at(0x0217) __sfr SSPCON3; __at(0x0217) volatile __SSPCON3bits_t SSPCON3bits; __at(0x028C) __sfr ODCONA; __at(0x028C) volatile __ODCONAbits_t ODCONAbits; __at(0x028D) __sfr ODCONB; __at(0x028D) volatile __ODCONBbits_t ODCONBbits; __at(0x028E) __sfr ODCONC; __at(0x028E) volatile __ODCONCbits_t ODCONCbits; __at(0x0291) __sfr CCPR1; __at(0x0291) __sfr CCPR1L; __at(0x0292) __sfr CCPR1H; __at(0x0293) __sfr CCP1CON; __at(0x0293) volatile __CCP1CONbits_t CCP1CONbits; __at(0x0294) __sfr CCP1CAP; __at(0x0294) volatile __CCP1CAPbits_t CCP1CAPbits; __at(0x0298) __sfr CCPR2; __at(0x0298) __sfr CCPR2L; __at(0x0299) __sfr CCPR2H; __at(0x029A) __sfr CCP2CON; __at(0x029A) volatile __CCP2CONbits_t CCP2CONbits; __at(0x029B) __sfr CCP2CAP; __at(0x029B) volatile __CCP2CAPbits_t CCP2CAPbits; __at(0x029E) __sfr CCPTMRS; __at(0x029E) volatile __CCPTMRSbits_t CCPTMRSbits; __at(0x030C) __sfr SLRCONA; __at(0x030C) volatile __SLRCONAbits_t SLRCONAbits; __at(0x030D) __sfr SLRCONB; __at(0x030D) volatile __SLRCONBbits_t SLRCONBbits; __at(0x030E) __sfr SLRCONC; __at(0x030E) volatile __SLRCONCbits_t SLRCONCbits; __at(0x038C) __sfr INLVLA; __at(0x038C) volatile __INLVLAbits_t INLVLAbits; __at(0x038D) __sfr INLVLB; __at(0x038D) volatile __INLVLBbits_t INLVLBbits; __at(0x038E) __sfr INLVLC; __at(0x038E) volatile __INLVLCbits_t INLVLCbits; __at(0x0391) __sfr IOCAP; __at(0x0391) volatile __IOCAPbits_t IOCAPbits; __at(0x0392) __sfr IOCAN; __at(0x0392) volatile __IOCANbits_t IOCANbits; __at(0x0393) __sfr IOCAF; __at(0x0393) volatile __IOCAFbits_t IOCAFbits; __at(0x0394) __sfr IOCBP; __at(0x0394) volatile __IOCBPbits_t IOCBPbits; __at(0x0395) __sfr IOCBN; __at(0x0395) volatile __IOCBNbits_t IOCBNbits; __at(0x0396) __sfr IOCBF; __at(0x0396) volatile __IOCBFbits_t IOCBFbits; __at(0x0397) __sfr IOCCP; __at(0x0397) volatile __IOCCPbits_t IOCCPbits; __at(0x0398) __sfr IOCCN; __at(0x0398) volatile __IOCCNbits_t IOCCNbits; __at(0x0399) __sfr IOCCF; __at(0x0399) volatile __IOCCFbits_t IOCCFbits; __at(0x040E) __sfr HIDRVC; __at(0x040E) volatile __HIDRVCbits_t HIDRVCbits; __at(0x0413) __sfr T4TMR; __at(0x0413) __sfr TMR4; __at(0x0414) __sfr PR4; __at(0x0414) __sfr T4PR; __at(0x0415) __sfr T4CON; __at(0x0415) volatile __T4CONbits_t T4CONbits; __at(0x0416) __sfr T4HLT; __at(0x0416) volatile __T4HLTbits_t T4HLTbits; __at(0x0417) __sfr T4CLKCON; __at(0x0417) volatile __T4CLKCONbits_t T4CLKCONbits; __at(0x0418) __sfr T4RST; __at(0x0418) volatile __T4RSTbits_t T4RSTbits; __at(0x041A) __sfr T6TMR; __at(0x041A) __sfr TMR6; __at(0x041B) __sfr PR6; __at(0x041B) __sfr T6PR; __at(0x041C) __sfr T6CON; __at(0x041C) volatile __T6CONbits_t T6CONbits; __at(0x041D) __sfr T6HLT; __at(0x041D) volatile __T6HLTbits_t T6HLTbits; __at(0x041E) __sfr T6CLKCON; __at(0x041E) volatile __T6CLKCONbits_t T6CLKCONbits; __at(0x041F) __sfr T6RST; __at(0x041F) volatile __T6RSTbits_t T6RSTbits; __at(0x0493) __sfr TMR3L; __at(0x0494) __sfr TMR3H; __at(0x0495) __sfr T3CON; __at(0x0495) volatile __T3CONbits_t T3CONbits; __at(0x0496) __sfr T3GCON; __at(0x0496) volatile __T3GCONbits_t T3GCONbits; __at(0x049A) __sfr TMR5L; __at(0x049B) __sfr TMR5H; __at(0x049C) __sfr T5CON; __at(0x049C) volatile __T5CONbits_t T5CONbits; __at(0x049D) __sfr T5GCON; __at(0x049D) volatile __T5GCONbits_t T5GCONbits; __at(0x058C) __sfr PID1SET; __at(0x058C) __sfr PID1SETL; __at(0x058C) volatile __PID1SETLbits_t PID1SETLbits; __at(0x058D) __sfr PID1SETH; __at(0x058D) volatile __PID1SETHbits_t PID1SETHbits; __at(0x058E) __sfr PID1IN; __at(0x058E) __sfr PID1INL; __at(0x058E) volatile __PID1INLbits_t PID1INLbits; __at(0x058F) __sfr PID1INH; __at(0x058F) volatile __PID1INHbits_t PID1INHbits; __at(0x0590) __sfr PID1K1; __at(0x0590) __sfr PID1K1L; __at(0x0590) volatile __PID1K1Lbits_t PID1K1Lbits; __at(0x0591) __sfr PID1K1H; __at(0x0591) volatile __PID1K1Hbits_t PID1K1Hbits; __at(0x0592) __sfr PID1K2; __at(0x0592) __sfr PID1K2L; __at(0x0592) volatile __PID1K2Lbits_t PID1K2Lbits; __at(0x0593) __sfr PID1K2H; __at(0x0593) volatile __PID1K2Hbits_t PID1K2Hbits; __at(0x0594) __sfr PID1K3; __at(0x0594) __sfr PID1K3L; __at(0x0594) volatile __PID1K3Lbits_t PID1K3Lbits; __at(0x0595) __sfr PID1K3H; __at(0x0595) volatile __PID1K3Hbits_t PID1K3Hbits; __at(0x0596) __sfr PID1OUT; __at(0x0596) __sfr PID1OUTLL; __at(0x0596) volatile __PID1OUTLLbits_t PID1OUTLLbits; __at(0x0597) __sfr PID1OUTLH; __at(0x0597) volatile __PID1OUTLHbits_t PID1OUTLHbits; __at(0x0598) __sfr PID1OUTHL; __at(0x0598) volatile __PID1OUTHLbits_t PID1OUTHLbits; __at(0x0599) __sfr PID1OUTHH; __at(0x0599) volatile __PID1OUTHHbits_t PID1OUTHHbits; __at(0x059A) __sfr PID1OUTU; __at(0x059A) volatile __PID1OUTUbits_t PID1OUTUbits; __at(0x059B) __sfr PID1Z1; __at(0x059B) __sfr PID1Z1L; __at(0x059B) volatile __PID1Z1Lbits_t PID1Z1Lbits; __at(0x059C) __sfr PID1Z1H; __at(0x059C) volatile __PID1Z1Hbits_t PID1Z1Hbits; __at(0x059D) __sfr PID1Z1U; __at(0x059D) volatile __PID1Z1Ubits_t PID1Z1Ubits; __at(0x060C) __sfr PID1Z2; __at(0x060C) __sfr PID1Z2L; __at(0x060C) volatile __PID1Z2Lbits_t PID1Z2Lbits; __at(0x060D) __sfr PID1Z2H; __at(0x060D) volatile __PID1Z2Hbits_t PID1Z2Hbits; __at(0x060E) __sfr PID1Z2U; __at(0x060E) volatile __PID1Z2Ubits_t PID1Z2Ubits; __at(0x060F) __sfr PID1ACC; __at(0x060F) __sfr PID1ACCLL; __at(0x060F) volatile __PID1ACCLLbits_t PID1ACCLLbits; __at(0x0610) __sfr PID1ACCLH; __at(0x0610) volatile __PID1ACCLHbits_t PID1ACCLHbits; __at(0x0611) __sfr PID1ACCHL; __at(0x0611) volatile __PID1ACCHLbits_t PID1ACCHLbits; __at(0x0612) __sfr PID1ACCHH; __at(0x0612) volatile __PID1ACCHHbits_t PID1ACCHHbits; __at(0x0613) __sfr PID1ACCU; __at(0x0613) volatile __PID1ACCUbits_t PID1ACCUbits; __at(0x0614) __sfr PID1CON; __at(0x0614) volatile __PID1CONbits_t PID1CONbits; __at(0x0617) __sfr PWM3DCL; __at(0x0617) volatile __PWM3DCLbits_t PWM3DCLbits; __at(0x0618) __sfr PWM3DCH; __at(0x0618) volatile __PWM3DCHbits_t PWM3DCHbits; __at(0x0619) __sfr PWM3CON; __at(0x0619) volatile __PWM3CONbits_t PWM3CONbits; __at(0x061A) __sfr PWM4DCL; __at(0x061A) volatile __PWM4DCLbits_t PWM4DCLbits; __at(0x061B) __sfr PWM4DCH; __at(0x061B) volatile __PWM4DCHbits_t PWM4DCHbits; __at(0x061C) __sfr PWM4CON; __at(0x061C) volatile __PWM4CONbits_t PWM4CONbits; __at(0x0691) __sfr CWG1DBR; __at(0x0691) volatile __CWG1DBRbits_t CWG1DBRbits; __at(0x0692) __sfr CWG1DBF; __at(0x0692) volatile __CWG1DBFbits_t CWG1DBFbits; __at(0x0693) __sfr CWG1AS0; __at(0x0693) volatile __CWG1AS0bits_t CWG1AS0bits; __at(0x0694) __sfr CWG1AS1; __at(0x0694) volatile __CWG1AS1bits_t CWG1AS1bits; __at(0x0695) __sfr CWG1OCON0; __at(0x0695) volatile __CWG1OCON0bits_t CWG1OCON0bits; __at(0x0696) __sfr CWG1CON0; __at(0x0696) volatile __CWG1CON0bits_t CWG1CON0bits; __at(0x0697) __sfr CWG1CON1; __at(0x0697) volatile __CWG1CON1bits_t CWG1CON1bits; __at(0x0699) __sfr CWG1CLKCON; __at(0x0699) volatile __CWG1CLKCONbits_t CWG1CLKCONbits; __at(0x069A) __sfr CWG1ISM; __at(0x069A) volatile __CWG1ISMbits_t CWG1ISMbits; __at(0x0711) __sfr WDTCON0; __at(0x0711) volatile __WDTCON0bits_t WDTCON0bits; __at(0x0712) __sfr WDTCON1; __at(0x0712) volatile __WDTCON1bits_t WDTCON1bits; __at(0x0713) __sfr WDTPSL; __at(0x0713) volatile __WDTPSLbits_t WDTPSLbits; __at(0x0714) __sfr WDTPSH; __at(0x0714) volatile __WDTPSHbits_t WDTPSHbits; __at(0x0715) __sfr WDTTMR; __at(0x0715) volatile __WDTTMRbits_t WDTTMRbits; __at(0x0718) __sfr SCANLADR; __at(0x0718) __sfr SCANLADRL; __at(0x0718) volatile __SCANLADRLbits_t SCANLADRLbits; __at(0x0719) __sfr SCANLADRH; __at(0x0719) volatile __SCANLADRHbits_t SCANLADRHbits; __at(0x071A) __sfr SCANHADR; __at(0x071A) __sfr SCANHADRL; __at(0x071A) volatile __SCANHADRLbits_t SCANHADRLbits; __at(0x071B) __sfr SCANHADRH; __at(0x071B) volatile __SCANHADRHbits_t SCANHADRHbits; __at(0x071C) __sfr SCANCON0; __at(0x071C) volatile __SCANCON0bits_t SCANCON0bits; __at(0x071D) __sfr SCANTRIG; __at(0x071D) volatile __SCANTRIGbits_t SCANTRIGbits; __at(0x0791) __sfr CRCDAT; __at(0x0791) __sfr CRCDATL; __at(0x0791) volatile __CRCDATLbits_t CRCDATLbits; __at(0x0792) __sfr CRCDATH; __at(0x0792) volatile __CRCDATHbits_t CRCDATHbits; __at(0x0793) __sfr CRCACC; __at(0x0793) __sfr CRCACCL; __at(0x0793) volatile __CRCACCLbits_t CRCACCLbits; __at(0x0794) __sfr CRCACCH; __at(0x0794) volatile __CRCACCHbits_t CRCACCHbits; __at(0x0795) __sfr CRCSHIFT; __at(0x0795) __sfr CRCSHIFTL; __at(0x0795) volatile __CRCSHIFTLbits_t CRCSHIFTLbits; __at(0x0796) __sfr CRCSHIFTH; __at(0x0796) volatile __CRCSHIFTHbits_t CRCSHIFTHbits; __at(0x0797) __sfr CRCXOR; __at(0x0797) __sfr CRCXORL; __at(0x0797) volatile __CRCXORLbits_t CRCXORLbits; __at(0x0798) __sfr CRCXORH; __at(0x0798) volatile __CRCXORHbits_t CRCXORHbits; __at(0x0799) __sfr CRCCON0; __at(0x0799) volatile __CRCCON0bits_t CRCCON0bits; __at(0x079A) __sfr CRCCON1; __at(0x079A) volatile __CRCCON1bits_t CRCCON1bits; __at(0x080C) __sfr AT1RES; __at(0x080C) __sfr AT1RESL; __at(0x080C) volatile __AT1RESLbits_t AT1RESLbits; __at(0x080D) __sfr AT1RESH; __at(0x080D) volatile __AT1RESHbits_t AT1RESHbits; __at(0x080E) __sfr AT1MISS; __at(0x080E) __sfr AT1MISSL; __at(0x080E) volatile __AT1MISSLbits_t AT1MISSLbits; __at(0x080F) __sfr AT1MISSH; __at(0x080F) volatile __AT1MISSHbits_t AT1MISSHbits; __at(0x0810) __sfr AT1PER; __at(0x0810) __sfr AT1PERL; __at(0x0810) volatile __AT1PERLbits_t AT1PERLbits; __at(0x0811) __sfr AT1PERH; __at(0x0811) volatile __AT1PERHbits_t AT1PERHbits; __at(0x0812) __sfr AT1PHS; __at(0x0812) __sfr AT1PHSL; __at(0x0812) volatile __AT1PHSLbits_t AT1PHSLbits; __at(0x0813) __sfr AT1PHSH; __at(0x0813) volatile __AT1PHSHbits_t AT1PHSHbits; __at(0x0814) __sfr AT1CON0; __at(0x0814) volatile __AT1CON0bits_t AT1CON0bits; __at(0x0815) __sfr AT1CON1; __at(0x0815) volatile __AT1CON1bits_t AT1CON1bits; __at(0x0816) __sfr AT1IR0; __at(0x0816) volatile __AT1IR0bits_t AT1IR0bits; __at(0x0817) __sfr AT1IE0; __at(0x0817) volatile __AT1IE0bits_t AT1IE0bits; __at(0x0818) __sfr AT1IR1; __at(0x0818) volatile __AT1IR1bits_t AT1IR1bits; __at(0x0819) __sfr AT1IE1; __at(0x0819) volatile __AT1IE1bits_t AT1IE1bits; __at(0x081A) __sfr AT1STPT; __at(0x081A) __sfr AT1STPTL; __at(0x081A) volatile __AT1STPTLbits_t AT1STPTLbits; __at(0x081B) __sfr AT1STPTH; __at(0x081B) volatile __AT1STPTHbits_t AT1STPTHbits; __at(0x081C) __sfr AT1ERR; __at(0x081C) __sfr AT1ERRL; __at(0x081C) volatile __AT1ERRLbits_t AT1ERRLbits; __at(0x081D) __sfr AT1ERRH; __at(0x081D) volatile __AT1ERRHbits_t AT1ERRHbits; __at(0x088C) __sfr AT1CLK; __at(0x088C) volatile __AT1CLKbits_t AT1CLKbits; __at(0x088D) __sfr AT1SIG; __at(0x088D) volatile __AT1SIGbits_t AT1SIGbits; __at(0x088E) __sfr AT1CSEL1; __at(0x088E) volatile __AT1CSEL1bits_t AT1CSEL1bits; __at(0x088F) __sfr AT1CC1; __at(0x088F) __sfr AT1CC1L; __at(0x088F) volatile __AT1CC1Lbits_t AT1CC1Lbits; __at(0x0890) __sfr AT1CC1H; __at(0x0890) volatile __AT1CC1Hbits_t AT1CC1Hbits; __at(0x0891) __sfr AT1CCON1; __at(0x0891) volatile __AT1CCON1bits_t AT1CCON1bits; __at(0x0892) __sfr AT1CSEL2; __at(0x0892) volatile __AT1CSEL2bits_t AT1CSEL2bits; __at(0x0893) __sfr AT1CC2; __at(0x0893) __sfr AT1CC2L; __at(0x0893) volatile __AT1CC2Lbits_t AT1CC2Lbits; __at(0x0894) __sfr AT1CC2H; __at(0x0894) volatile __AT1CC2Hbits_t AT1CC2Hbits; __at(0x0895) __sfr AT1CCON2; __at(0x0895) volatile __AT1CCON2bits_t AT1CCON2bits; __at(0x0896) __sfr AT1CSEL3; __at(0x0896) volatile __AT1CSEL3bits_t AT1CSEL3bits; __at(0x0897) __sfr AT1CC3; __at(0x0897) __sfr AT1CC3L; __at(0x0897) volatile __AT1CC3Lbits_t AT1CC3Lbits; __at(0x0898) __sfr AT1CC3H; __at(0x0898) volatile __AT1CC3Hbits_t AT1CC3Hbits; __at(0x0899) __sfr AT1CCON3; __at(0x0899) volatile __AT1CCON3bits_t AT1CCON3bits; __at(0x0D8C) __sfr SMT1TMR; __at(0x0D8C) __sfr SMT1TMRL; __at(0x0D8C) volatile __SMT1TMRLbits_t SMT1TMRLbits; __at(0x0D8D) __sfr SMT1TMRH; __at(0x0D8D) volatile __SMT1TMRHbits_t SMT1TMRHbits; __at(0x0D8E) __sfr SMT1TMRU; __at(0x0D8E) volatile __SMT1TMRUbits_t SMT1TMRUbits; __at(0x0D8F) __sfr SMT1CPR; __at(0x0D8F) __sfr SMT1CPRL; __at(0x0D8F) volatile __SMT1CPRLbits_t SMT1CPRLbits; __at(0x0D90) __sfr SMT1CPRH; __at(0x0D90) volatile __SMT1CPRHbits_t SMT1CPRHbits; __at(0x0D91) __sfr SMT1CPRU; __at(0x0D91) volatile __SMT1CPRUbits_t SMT1CPRUbits; __at(0x0D92) __sfr SMT1CPW; __at(0x0D92) __sfr SMT1CPWL; __at(0x0D92) volatile __SMT1CPWLbits_t SMT1CPWLbits; __at(0x0D93) __sfr SMT1CPWH; __at(0x0D93) volatile __SMT1CPWHbits_t SMT1CPWHbits; __at(0x0D94) __sfr SMT1CPWU; __at(0x0D94) volatile __SMT1CPWUbits_t SMT1CPWUbits; __at(0x0D95) __sfr SMT1PR; __at(0x0D95) __sfr SMT1PRL; __at(0x0D95) volatile __SMT1PRLbits_t SMT1PRLbits; __at(0x0D96) __sfr SMT1PRH; __at(0x0D96) volatile __SMT1PRHbits_t SMT1PRHbits; __at(0x0D97) __sfr SMT1PRU; __at(0x0D97) volatile __SMT1PRUbits_t SMT1PRUbits; __at(0x0D98) __sfr SMT1CON0; __at(0x0D98) volatile __SMT1CON0bits_t SMT1CON0bits; __at(0x0D99) __sfr SMT1CON1; __at(0x0D99) volatile __SMT1CON1bits_t SMT1CON1bits; __at(0x0D9A) __sfr SMT1STAT; __at(0x0D9A) volatile __SMT1STATbits_t SMT1STATbits; __at(0x0D9B) __sfr SMT1CLK; __at(0x0D9B) volatile __SMT1CLKbits_t SMT1CLKbits; __at(0x0D9C) __sfr SMT1SIG; __at(0x0D9C) volatile __SMT1SIGbits_t SMT1SIGbits; __at(0x0D9D) __sfr SMT1WIN; __at(0x0D9D) volatile __SMT1WINbits_t SMT1WINbits; __at(0x0D9E) __sfr SMT2TMR; __at(0x0D9E) __sfr SMT2TMRL; __at(0x0D9E) volatile __SMT2TMRLbits_t SMT2TMRLbits; __at(0x0D9F) __sfr SMT2TMRH; __at(0x0D9F) volatile __SMT2TMRHbits_t SMT2TMRHbits; __at(0x0DA0) __sfr SMT2TMRU; __at(0x0DA0) volatile __SMT2TMRUbits_t SMT2TMRUbits; __at(0x0DA1) __sfr SMT2CPR; __at(0x0DA1) __sfr SMT2CPRL; __at(0x0DA1) volatile __SMT2CPRLbits_t SMT2CPRLbits; __at(0x0DA2) __sfr SMT2CPRH; __at(0x0DA2) volatile __SMT2CPRHbits_t SMT2CPRHbits; __at(0x0DA3) __sfr SMT2CPRU; __at(0x0DA3) volatile __SMT2CPRUbits_t SMT2CPRUbits; __at(0x0DA4) __sfr SMT2CPW; __at(0x0DA4) __sfr SMT2CPWL; __at(0x0DA4) volatile __SMT2CPWLbits_t SMT2CPWLbits; __at(0x0DA5) __sfr SMT2CPWH; __at(0x0DA5) volatile __SMT2CPWHbits_t SMT2CPWHbits; __at(0x0DA6) __sfr SMT2CPWU; __at(0x0DA6) volatile __SMT2CPWUbits_t SMT2CPWUbits; __at(0x0DA7) __sfr SMT2PR; __at(0x0DA7) __sfr SMT2PRL; __at(0x0DA7) volatile __SMT2PRLbits_t SMT2PRLbits; __at(0x0DA8) __sfr SMT2PRH; __at(0x0DA8) volatile __SMT2PRHbits_t SMT2PRHbits; __at(0x0DA9) __sfr SMT2PRU; __at(0x0DA9) volatile __SMT2PRUbits_t SMT2PRUbits; __at(0x0DAA) __sfr SMT2CON0; __at(0x0DAA) volatile __SMT2CON0bits_t SMT2CON0bits; __at(0x0DAB) __sfr SMT2CON1; __at(0x0DAB) volatile __SMT2CON1bits_t SMT2CON1bits; __at(0x0DAC) __sfr SMT2STAT; __at(0x0DAC) volatile __SMT2STATbits_t SMT2STATbits; __at(0x0DAD) __sfr SMT2CLK; __at(0x0DAD) volatile __SMT2CLKbits_t SMT2CLKbits; __at(0x0DAE) __sfr SMT2SIG; __at(0x0DAE) volatile __SMT2SIGbits_t SMT2SIGbits; __at(0x0DAF) __sfr SMT2WIN; __at(0x0DAF) volatile __SMT2WINbits_t SMT2WINbits; __at(0x0E0F) __sfr PPSLOCK; __at(0x0E0F) volatile __PPSLOCKbits_t PPSLOCKbits; __at(0x0E10) __sfr INTPPS; __at(0x0E10) volatile __INTPPSbits_t INTPPSbits; __at(0x0E11) __sfr T0CKIPPS; __at(0x0E11) volatile __T0CKIPPSbits_t T0CKIPPSbits; __at(0x0E12) __sfr T1CKIPPS; __at(0x0E12) volatile __T1CKIPPSbits_t T1CKIPPSbits; __at(0x0E13) __sfr T1GPPS; __at(0x0E13) volatile __T1GPPSbits_t T1GPPSbits; __at(0x0E14) __sfr CCP1PPS; __at(0x0E14) volatile __CCP1PPSbits_t CCP1PPSbits; __at(0x0E15) __sfr CCP2PPS; __at(0x0E15) volatile __CCP2PPSbits_t CCP2PPSbits; __at(0x0E16) __sfr ATINPPS; __at(0x0E16) volatile __ATINPPSbits_t ATINPPSbits; __at(0x0E17) __sfr CWGINPPS; __at(0x0E17) volatile __CWGINPPSbits_t CWGINPPSbits; __at(0x0E18) __sfr T2PPS; __at(0x0E18) volatile __T2PPSbits_t T2PPSbits; __at(0x0E19) __sfr T3CKIPPS; __at(0x0E19) volatile __T3CKIPPSbits_t T3CKIPPSbits; __at(0x0E1A) __sfr T3GPPS; __at(0x0E1A) volatile __T3GPPSbits_t T3GPPSbits; __at(0x0E1B) __sfr T4PPS; __at(0x0E1B) volatile __T4PPSbits_t T4PPSbits; __at(0x0E1C) __sfr T5CKIPPS; __at(0x0E1C) volatile __T5CKIPPSbits_t T5CKIPPSbits; __at(0x0E1D) __sfr T5GPPS; __at(0x0E1D) volatile __T5GPPSbits_t T5GPPSbits; __at(0x0E1E) __sfr T6PPS; __at(0x0E1E) volatile __T6PPSbits_t T6PPSbits; __at(0x0E1F) __sfr ATCC1PPS; __at(0x0E1F) volatile __ATCC1PPSbits_t ATCC1PPSbits; __at(0x0E20) __sfr SSPCLKPPS; __at(0x0E20) volatile __SSPCLKPPSbits_t SSPCLKPPSbits; __at(0x0E21) __sfr SSPDATPPS; __at(0x0E21) volatile __SSPDATPPSbits_t SSPDATPPSbits; __at(0x0E22) __sfr SSPSSPPS; __at(0x0E22) volatile __SSPSSPPSbits_t SSPSSPPSbits; __at(0x0E23) __sfr ATCC2PPS; __at(0x0E23) volatile __ATCC2PPSbits_t ATCC2PPSbits; __at(0x0E24) __sfr RXPPS; __at(0x0E24) volatile __RXPPSbits_t RXPPSbits; __at(0x0E25) __sfr CKPPS; __at(0x0E25) volatile __CKPPSbits_t CKPPSbits; __at(0x0E26) __sfr SMT1SIGPPS; __at(0x0E26) volatile __SMT1SIGPPSbits_t SMT1SIGPPSbits; __at(0x0E27) __sfr SMT1WINPPS; __at(0x0E27) volatile __SMT1WINPPSbits_t SMT1WINPPSbits; __at(0x0E28) __sfr CLCIN0PPS; __at(0x0E28) volatile __CLCIN0PPSbits_t CLCIN0PPSbits; __at(0x0E29) __sfr CLCIN1PPS; __at(0x0E29) volatile __CLCIN1PPSbits_t CLCIN1PPSbits; __at(0x0E2A) __sfr CLCIN2PPS; __at(0x0E2A) volatile __CLCIN2PPSbits_t CLCIN2PPSbits; __at(0x0E2B) __sfr CLCIN3PPS; __at(0x0E2B) volatile __CLCIN3PPSbits_t CLCIN3PPSbits; __at(0x0E2C) __sfr SMT2SIGPPS; __at(0x0E2C) volatile __SMT2SIGPPSbits_t SMT2SIGPPSbits; __at(0x0E2D) __sfr SMT2WINPPS; __at(0x0E2D) volatile __SMT2WINPPSbits_t SMT2WINPPSbits; __at(0x0E2E) __sfr ATCC3PPS; __at(0x0E2E) volatile __ATCC3PPSbits_t ATCC3PPSbits; __at(0x0E90) __sfr RA0PPS; __at(0x0E90) volatile __RA0PPSbits_t RA0PPSbits; __at(0x0E91) __sfr RA1PPS; __at(0x0E91) volatile __RA1PPSbits_t RA1PPSbits; __at(0x0E92) __sfr RA2PPS; __at(0x0E92) volatile __RA2PPSbits_t RA2PPSbits; __at(0x0E94) __sfr RA4PPS; __at(0x0E94) volatile __RA4PPSbits_t RA4PPSbits; __at(0x0E95) __sfr RA5PPS; __at(0x0E95) volatile __RA5PPSbits_t RA5PPSbits; __at(0x0E9C) __sfr RB4PPS; __at(0x0E9C) volatile __RB4PPSbits_t RB4PPSbits; __at(0x0E9D) __sfr RB5PPS; __at(0x0E9D) volatile __RB5PPSbits_t RB5PPSbits; __at(0x0E9E) __sfr RB6PPS; __at(0x0E9E) volatile __RB6PPSbits_t RB6PPSbits; __at(0x0E9F) __sfr RB7PPS; __at(0x0E9F) volatile __RB7PPSbits_t RB7PPSbits; __at(0x0EA0) __sfr RC0PPS; __at(0x0EA0) volatile __RC0PPSbits_t RC0PPSbits; __at(0x0EA1) __sfr RC1PPS; __at(0x0EA1) volatile __RC1PPSbits_t RC1PPSbits; __at(0x0EA2) __sfr RC2PPS; __at(0x0EA2) volatile __RC2PPSbits_t RC2PPSbits; __at(0x0EA3) __sfr RC3PPS; __at(0x0EA3) volatile __RC3PPSbits_t RC3PPSbits; __at(0x0EA4) __sfr RC4PPS; __at(0x0EA4) volatile __RC4PPSbits_t RC4PPSbits; __at(0x0EA5) __sfr RC5PPS; __at(0x0EA5) volatile __RC5PPSbits_t RC5PPSbits; __at(0x0EA6) __sfr RC6PPS; __at(0x0EA6) volatile __RC6PPSbits_t RC6PPSbits; __at(0x0EA7) __sfr RC7PPS; __at(0x0EA7) volatile __RC7PPSbits_t RC7PPSbits; __at(0x0F0F) __sfr CLCDATA; __at(0x0F0F) volatile __CLCDATAbits_t CLCDATAbits; __at(0x0F10) __sfr CLC1CON; __at(0x0F10) volatile __CLC1CONbits_t CLC1CONbits; __at(0x0F11) __sfr CLC1POL; __at(0x0F11) volatile __CLC1POLbits_t CLC1POLbits; __at(0x0F12) __sfr CLC1SEL0; __at(0x0F12) volatile __CLC1SEL0bits_t CLC1SEL0bits; __at(0x0F13) __sfr CLC1SEL1; __at(0x0F13) volatile __CLC1SEL1bits_t CLC1SEL1bits; __at(0x0F14) __sfr CLC1SEL2; __at(0x0F14) volatile __CLC1SEL2bits_t CLC1SEL2bits; __at(0x0F15) __sfr CLC1SEL3; __at(0x0F15) volatile __CLC1SEL3bits_t CLC1SEL3bits; __at(0x0F16) __sfr CLC1GLS0; __at(0x0F16) volatile __CLC1GLS0bits_t CLC1GLS0bits; __at(0x0F17) __sfr CLC1GLS1; __at(0x0F17) volatile __CLC1GLS1bits_t CLC1GLS1bits; __at(0x0F18) __sfr CLC1GLS2; __at(0x0F18) volatile __CLC1GLS2bits_t CLC1GLS2bits; __at(0x0F19) __sfr CLC1GLS3; __at(0x0F19) volatile __CLC1GLS3bits_t CLC1GLS3bits; __at(0x0F1A) __sfr CLC2CON; __at(0x0F1A) volatile __CLC2CONbits_t CLC2CONbits; __at(0x0F1B) __sfr CLC2POL; __at(0x0F1B) volatile __CLC2POLbits_t CLC2POLbits; __at(0x0F1C) __sfr CLC2SEL0; __at(0x0F1C) volatile __CLC2SEL0bits_t CLC2SEL0bits; __at(0x0F1D) __sfr CLC2SEL1; __at(0x0F1D) volatile __CLC2SEL1bits_t CLC2SEL1bits; __at(0x0F1E) __sfr CLC2SEL2; __at(0x0F1E) volatile __CLC2SEL2bits_t CLC2SEL2bits; __at(0x0F1F) __sfr CLC2SEL3; __at(0x0F1F) volatile __CLC2SEL3bits_t CLC2SEL3bits; __at(0x0F20) __sfr CLC2GLS0; __at(0x0F20) volatile __CLC2GLS0bits_t CLC2GLS0bits; __at(0x0F21) __sfr CLC2GLS1; __at(0x0F21) volatile __CLC2GLS1bits_t CLC2GLS1bits; __at(0x0F22) __sfr CLC2GLS2; __at(0x0F22) volatile __CLC2GLS2bits_t CLC2GLS2bits; __at(0x0F23) __sfr CLC2GLS3; __at(0x0F23) volatile __CLC2GLS3bits_t CLC2GLS3bits; __at(0x0F24) __sfr CLC3CON; __at(0x0F24) volatile __CLC3CONbits_t CLC3CONbits; __at(0x0F25) __sfr CLC3POL; __at(0x0F25) volatile __CLC3POLbits_t CLC3POLbits; __at(0x0F26) __sfr CLC3SEL0; __at(0x0F26) volatile __CLC3SEL0bits_t CLC3SEL0bits; __at(0x0F27) __sfr CLC3SEL1; __at(0x0F27) volatile __CLC3SEL1bits_t CLC3SEL1bits; __at(0x0F28) __sfr CLC3SEL2; __at(0x0F28) volatile __CLC3SEL2bits_t CLC3SEL2bits; __at(0x0F29) __sfr CLC3SEL3; __at(0x0F29) volatile __CLC3SEL3bits_t CLC3SEL3bits; __at(0x0F2A) __sfr CLC3GLS0; __at(0x0F2A) volatile __CLC3GLS0bits_t CLC3GLS0bits; __at(0x0F2B) __sfr CLC3GLS1; __at(0x0F2B) volatile __CLC3GLS1bits_t CLC3GLS1bits; __at(0x0F2C) __sfr CLC3GLS2; __at(0x0F2C) volatile __CLC3GLS2bits_t CLC3GLS2bits; __at(0x0F2D) __sfr CLC3GLS3; __at(0x0F2D) volatile __CLC3GLS3bits_t CLC3GLS3bits; __at(0x0F2E) __sfr CLC4CON; __at(0x0F2E) volatile __CLC4CONbits_t CLC4CONbits; __at(0x0F2F) __sfr CLC4POL; __at(0x0F2F) volatile __CLC4POLbits_t CLC4POLbits; __at(0x0F30) __sfr CLC4SEL0; __at(0x0F30) volatile __CLC4SEL0bits_t CLC4SEL0bits; __at(0x0F31) __sfr CLC4SEL1; __at(0x0F31) volatile __CLC4SEL1bits_t CLC4SEL1bits; __at(0x0F32) __sfr CLC4SEL2; __at(0x0F32) volatile __CLC4SEL2bits_t CLC4SEL2bits; __at(0x0F33) __sfr CLC4SEL3; __at(0x0F33) volatile __CLC4SEL3bits_t CLC4SEL3bits; __at(0x0F34) __sfr CLC4GLS0; __at(0x0F34) volatile __CLC4GLS0bits_t CLC4GLS0bits; __at(0x0F35) __sfr CLC4GLS1; __at(0x0F35) volatile __CLC4GLS1bits_t CLC4GLS1bits; __at(0x0F36) __sfr CLC4GLS2; __at(0x0F36) volatile __CLC4GLS2bits_t CLC4GLS2bits; __at(0x0F37) __sfr CLC4GLS3; __at(0x0F37) volatile __CLC4GLS3bits_t CLC4GLS3bits; __at(0x0FE4) __sfr STATUS_SHAD; __at(0x0FE4) volatile __STATUS_SHADbits_t STATUS_SHADbits; __at(0x0FE5) __sfr WREG_SHAD; __at(0x0FE6) __sfr BSR_SHAD; __at(0x0FE7) __sfr PCLATH_SHAD; __at(0x0FE8) __sfr FSR0L_SHAD; __at(0x0FE9) __sfr FSR0H_SHAD; __at(0x0FEA) __sfr FSR1L_SHAD; __at(0x0FEB) __sfr FSR1H_SHAD; __at(0x0FED) __sfr STKPTR; __at(0x0FEE) __sfr TOSL; __at(0x0FEF) __sfr TOSH;
dfreniche/cpctelera
cpctelera/tools/sdcc-3.6.8-r9946/src/device/non-free/lib/pic14/libdev/pic16f1619.c
C
gpl-3.0
31,117
/* * Copyright (C) 2011 Jiri Simacek * * This file is part of forester. * * forester 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 3 of the License, or * any later version. * * forester 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 forester. If not, see <http://www.gnu.org/licenses/>. */ // Forester headers #include "executionmanager.hh" #include "sequentialinstruction.hh" #include "jump.hh" void SequentialInstruction::finalize( const std::unordered_map<const CodeStorage::Block*, AbstractInstruction*>& codeIndex, std::vector<AbstractInstruction*>::const_iterator cur) { this->next_ = *(cur + 1); while (this->next_->getType() == fi_type_e::fiJump) { // shortcut jump instruction assert(dynamic_cast<FI_jmp*>(this->next_) != nullptr); this->next_ = static_cast<FI_jmp*>(this->next_)->getTarget(codeIndex); } } SymState* RegisterAssignment::reverseAndIsect( ExecutionManager& execMan, const SymState& fwdPred, const SymState& bwdSucc) const { // copy the previous value of register dstReg_ SymState* tmpState = execMan.copyStateWithNewRegs(bwdSucc, fwdPred.GetInstr()); tmpState->SetReg(dstReg_, fwdPred.GetReg(dstReg_)); return tmpState; } SymState* VoidInstruction::reverseAndIsect( ExecutionManager& execMan, const SymState& fwdPred, const SymState& bwdSucc) const { (void)fwdPred; return execMan.copyState(bwdSucc); }
martinhruska/forester
fa/sequentialinstruction.cc
C++
gpl-3.0
1,903
// Copyright 2015-2017 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity 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 3 of the License, or // (at your option) any later version. // Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>. //! Structure to hold network settings configured from CLI /// Networking & RPC settings #[derive(Debug, PartialEq, Clone)] pub struct NetworkSettings { /// Node name pub name: String, /// Name of the chain we are connected to pub chain: String, /// Networking port pub network_port: u16, /// Is JSON-RPC server enabled? pub rpc_enabled: bool, /// Interface that JSON-RPC listens on pub rpc_interface: String, /// Port for JSON-RPC server pub rpc_port: u16, } impl Default for NetworkSettings { fn default() -> Self { NetworkSettings { name: "".into(), chain: "foundation".into(), network_port: 30303, rpc_enabled: true, rpc_interface: "127.0.0.1".into(), rpc_port: 8545 } } }
destenson/ethcore--parity
rpc/src/v1/helpers/network_settings.rs
Rust
gpl-3.0
1,425
.incoming { color: #ff7800; } .outgoing { color: #707070; } .status { color: #ff7800; } .greyed { color: #CCCCCC; } .incoming_link a { color: #ff7800; } .outgoing_link a { color: #707070; } .status_link a { color: #ff7800; } .greyed_link a { color: #999999; }
codebutler/synapse
src/Synapse.QtClient/resources/themes/minimal_mod.AdiumMessageStyle/Contents/Resources/Variants/Grey vs Orange.css
CSS
gpl-3.0
261
// Copyright 2012 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #if V8_TARGET_ARCH_X87 #include "src/codegen.h" #include "src/debug/debug.h" #include "src/x87/frames-x87.h" namespace v8 { namespace internal { #define __ ACCESS_MASM(masm) void EmitDebugBreakSlot(MacroAssembler* masm) { Label check_codesize; __ bind(&check_codesize); __ Nop(Assembler::kDebugBreakSlotLength); DCHECK_EQ(Assembler::kDebugBreakSlotLength, masm->SizeOfCodeGeneratedSince(&check_codesize)); } void DebugCodegen::GenerateSlot(MacroAssembler* masm, RelocInfo::Mode mode) { // Generate enough nop's to make space for a call instruction. masm->RecordDebugBreakSlot(mode); EmitDebugBreakSlot(masm); } void DebugCodegen::ClearDebugBreakSlot(Isolate* isolate, Address pc) { CodePatcher patcher(isolate, pc, Assembler::kDebugBreakSlotLength); EmitDebugBreakSlot(patcher.masm()); } void DebugCodegen::PatchDebugBreakSlot(Isolate* isolate, Address pc, Handle<Code> code) { DCHECK(code->is_debug_stub()); static const int kSize = Assembler::kDebugBreakSlotLength; CodePatcher patcher(isolate, pc, kSize); // Add a label for checking the size of the code used for returning. Label check_codesize; patcher.masm()->bind(&check_codesize); patcher.masm()->call(code->entry(), RelocInfo::NONE32); // Check that the size of the code generated is as expected. DCHECK_EQ(kSize, patcher.masm()->SizeOfCodeGeneratedSince(&check_codesize)); } bool DebugCodegen::DebugBreakSlotIsPatched(Address pc) { return !Assembler::IsNop(pc); } void DebugCodegen::GenerateDebugBreakStub(MacroAssembler* masm, DebugBreakCallHelperMode mode) { __ RecordComment("Debug break"); // Enter an internal frame. { FrameScope scope(masm, StackFrame::INTERNAL); // Load padding words on stack. for (int i = 0; i < LiveEdit::kFramePaddingInitialSize; i++) { __ push(Immediate(Smi::FromInt(LiveEdit::kFramePaddingValue))); } __ push(Immediate(Smi::FromInt(LiveEdit::kFramePaddingInitialSize))); // Push arguments for DebugBreak call. if (mode == SAVE_RESULT_REGISTER) { // Break on return. __ push(eax); } else { // Non-return breaks. __ Push(masm->isolate()->factory()->the_hole_value()); } __ Move(eax, Immediate(1)); __ mov(ebx, Immediate(ExternalReference( Runtime::FunctionForId(Runtime::kDebugBreak), masm->isolate()))); CEntryStub ceb(masm->isolate(), 1); __ CallStub(&ceb); if (FLAG_debug_code) { for (int i = 0; i < kNumJSCallerSaved; ++i) { Register reg = {JSCallerSavedCode(i)}; // Do not clobber eax if mode is SAVE_RESULT_REGISTER. It will // contain return value of the function. if (!(reg.is(eax) && (mode == SAVE_RESULT_REGISTER))) { __ Move(reg, Immediate(kDebugZapValue)); } } } __ pop(ebx); // We divide stored value by 2 (untagging) and multiply it by word's size. STATIC_ASSERT(kSmiTagSize == 1 && kSmiShiftSize == 0); __ lea(esp, Operand(esp, ebx, times_half_pointer_size, 0)); // Get rid of the internal frame. } // This call did not replace a call , so there will be an unwanted // return address left on the stack. Here we get rid of that. __ add(esp, Immediate(kPointerSize)); // Now that the break point has been handled, resume normal execution by // jumping to the target address intended by the caller and that was // overwritten by the address of DebugBreakXXX. ExternalReference after_break_target = ExternalReference::debug_after_break_target_address(masm->isolate()); __ jmp(Operand::StaticVariable(after_break_target)); } void DebugCodegen::GenerateFrameDropperLiveEdit(MacroAssembler* masm) { // We do not know our frame height, but set esp based on ebp. __ lea(esp, Operand(ebp, FrameDropperFrameConstants::kFunctionOffset)); __ pop(edi); // Function. __ add(esp, Immediate(-FrameDropperFrameConstants::kCodeOffset)); // INTERNAL // frame // marker // and code __ pop(ebp); ParameterCount dummy(0); __ FloodFunctionIfStepping(edi, no_reg, dummy, dummy); // Load context from the function. __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); // Clear new.target register as a safety measure. __ mov(edx, masm->isolate()->factory()->undefined_value()); // Get function code. __ mov(ebx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); __ mov(ebx, FieldOperand(ebx, SharedFunctionInfo::kCodeOffset)); __ lea(ebx, FieldOperand(ebx, Code::kHeaderSize)); // Re-run JSFunction, edi is function, esi is context. __ jmp(ebx); } const bool LiveEdit::kFrameDropperSupported = true; #undef __ } // namespace internal } // namespace v8 #endif // V8_TARGET_ARCH_X87
TrossSoftwareAndTech/webvt
lib/node-v7.2.0/deps/v8/src/debug/x87/debug-x87.cc
C++
gpl-3.0
5,182
<?php class No_Iframes extends Plugin { private $host; function about() { return array(1.0, "Remove embedded iframes (unless whitelisted)", "fox"); } function init($host) { $this->host = $host; $host->add_hook($host::HOOK_SANITIZE, $this); } /** * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ function hook_sanitize($doc, $site_url, $allowed_elements, $disallowed_attributes) { $xpath = new DOMXpath($doc); $entries = $xpath->query('//iframe'); foreach ($entries as $entry) { if (!iframe_whitelisted($entry)) $entry->parentNode->removeChild($entry); } return array($doc, $allowed_elements, $disallowed_attributes); } function api_version() { return 2; } }
maerco/tinytinyrss
plugins/no_iframes/init.php
PHP
gpl-3.0
714
/* * This declarations of the PIC18LF6627 MCU. * * This file is part of the GNU PIC library for SDCC, originally * created by Molnar Karoly <[email protected]> 2016. * * This file is generated automatically by the cinc2h.pl, 2016-04-13 17:24:07 UTC. * * SDCC is licensed under the GNU Public license (GPL) v2. Note that * this license covers the code to the compiler and other executables, * but explicitly does not cover any code or objects generated by sdcc. * * For pic device libraries and header files which are derived from * Microchip header (.inc) and linker script (.lkr) files Microchip * requires that "The header files should state that they are only to be * used with authentic Microchip devices" which makes them incompatible * with the GPL. Pic device libraries and header files are located at * non-free/lib and non-free/include directories respectively. * Sdcc should be run with the --use-non-free command line option in * order to include non-free header files and libraries. * * See http://sdcc.sourceforge.net/ for the latest information on sdcc. */ #ifndef __PIC18LF6627_H__ #define __PIC18LF6627_H__ //============================================================================== //============================================================================== // // Register Definitions // //============================================================================== //============================================================================== // SSP2CON2 Bits extern __at(0x0F62) __sfr SSP2CON2; typedef union { struct { unsigned SEN : 1; unsigned RSEN : 1; unsigned PEN : 1; unsigned RCEN : 1; unsigned ACKEN : 1; unsigned ACKDT : 1; unsigned ACKSTAT : 1; unsigned GCEN : 1; }; struct { unsigned SEN2 : 1; unsigned RSEN2 : 1; unsigned PEN2 : 1; unsigned RCEN2 : 1; unsigned ACKEN2 : 1; unsigned ACKDT2 : 1; unsigned ACKSTAT2 : 1; unsigned GCEN2 : 1; }; } __SSP2CON2bits_t; extern __at(0x0F62) volatile __SSP2CON2bits_t SSP2CON2bits; #define _SSP2CON2_SEN 0x01 #define _SSP2CON2_SEN2 0x01 #define _SSP2CON2_RSEN 0x02 #define _SSP2CON2_RSEN2 0x02 #define _SSP2CON2_PEN 0x04 #define _SSP2CON2_PEN2 0x04 #define _SSP2CON2_RCEN 0x08 #define _SSP2CON2_RCEN2 0x08 #define _SSP2CON2_ACKEN 0x10 #define _SSP2CON2_ACKEN2 0x10 #define _SSP2CON2_ACKDT 0x20 #define _SSP2CON2_ACKDT2 0x20 #define _SSP2CON2_ACKSTAT 0x40 #define _SSP2CON2_ACKSTAT2 0x40 #define _SSP2CON2_GCEN 0x80 #define _SSP2CON2_GCEN2 0x80 //============================================================================== //============================================================================== // SSP2CON1 Bits extern __at(0x0F63) __sfr SSP2CON1; typedef union { struct { unsigned SSPM0 : 1; unsigned SSPM1 : 1; unsigned SSPM2 : 1; unsigned SSPM3 : 1; unsigned CKP : 1; unsigned SSPEN : 1; unsigned SSPOV : 1; unsigned WCOL : 1; }; struct { unsigned SSPM02 : 1; unsigned SSPM12 : 1; unsigned SSPM22 : 1; unsigned SSPM32 : 1; unsigned CKP2 : 1; unsigned SSPEN2 : 1; unsigned SSPOV2 : 1; unsigned WCOL2 : 1; }; } __SSP2CON1bits_t; extern __at(0x0F63) volatile __SSP2CON1bits_t SSP2CON1bits; #define _SSP2CON1_SSPM0 0x01 #define _SSP2CON1_SSPM02 0x01 #define _SSP2CON1_SSPM1 0x02 #define _SSP2CON1_SSPM12 0x02 #define _SSP2CON1_SSPM2 0x04 #define _SSP2CON1_SSPM22 0x04 #define _SSP2CON1_SSPM3 0x08 #define _SSP2CON1_SSPM32 0x08 #define _SSP2CON1_CKP 0x10 #define _SSP2CON1_CKP2 0x10 #define _SSP2CON1_SSPEN 0x20 #define _SSP2CON1_SSPEN2 0x20 #define _SSP2CON1_SSPOV 0x40 #define _SSP2CON1_SSPOV2 0x40 #define _SSP2CON1_WCOL 0x80 #define _SSP2CON1_WCOL2 0x80 //============================================================================== //============================================================================== // SSP2STAT Bits extern __at(0x0F64) __sfr SSP2STAT; typedef union { struct { unsigned BF : 1; unsigned UA : 1; unsigned R_NOT_W : 1; unsigned S : 1; unsigned P : 1; unsigned D_NOT_A : 1; unsigned CKE : 1; unsigned SMP : 1; }; struct { unsigned BF2 : 1; unsigned UA2 : 1; unsigned R_W : 1; unsigned I2C_START : 1; unsigned I2C_STOP : 1; unsigned D_A : 1; unsigned CKE2 : 1; unsigned SMP2 : 1; }; struct { unsigned : 1; unsigned : 1; unsigned I2C_READ : 1; unsigned START2 : 1; unsigned STOP2 : 1; unsigned I2C_DAT : 1; unsigned : 1; unsigned : 1; }; struct { unsigned : 1; unsigned : 1; unsigned NOT_W : 1; unsigned : 1; unsigned : 1; unsigned NOT_A : 1; unsigned : 1; unsigned : 1; }; struct { unsigned : 1; unsigned : 1; unsigned NOT_WRITE : 1; unsigned : 1; unsigned : 1; unsigned NOT_ADDRESS : 1; unsigned : 1; unsigned : 1; }; struct { unsigned : 1; unsigned : 1; unsigned READ_WRITE : 1; unsigned : 1; unsigned : 1; unsigned DATA_ADDRESS : 1; unsigned : 1; unsigned : 1; }; struct { unsigned : 1; unsigned : 1; unsigned R : 1; unsigned : 1; unsigned : 1; unsigned D : 1; unsigned : 1; unsigned : 1; }; struct { unsigned : 1; unsigned : 1; unsigned RW2 : 1; unsigned : 1; unsigned : 1; unsigned DA2 : 1; unsigned : 1; unsigned : 1; }; } __SSP2STATbits_t; extern __at(0x0F64) volatile __SSP2STATbits_t SSP2STATbits; #define _SSP2STAT_BF 0x01 #define _SSP2STAT_BF2 0x01 #define _SSP2STAT_UA 0x02 #define _SSP2STAT_UA2 0x02 #define _SSP2STAT_R_NOT_W 0x04 #define _SSP2STAT_R_W 0x04 #define _SSP2STAT_I2C_READ 0x04 #define _SSP2STAT_NOT_W 0x04 #define _SSP2STAT_NOT_WRITE 0x04 #define _SSP2STAT_READ_WRITE 0x04 #define _SSP2STAT_R 0x04 #define _SSP2STAT_RW2 0x04 #define _SSP2STAT_S 0x08 #define _SSP2STAT_I2C_START 0x08 #define _SSP2STAT_START2 0x08 #define _SSP2STAT_P 0x10 #define _SSP2STAT_I2C_STOP 0x10 #define _SSP2STAT_STOP2 0x10 #define _SSP2STAT_D_NOT_A 0x20 #define _SSP2STAT_D_A 0x20 #define _SSP2STAT_I2C_DAT 0x20 #define _SSP2STAT_NOT_A 0x20 #define _SSP2STAT_NOT_ADDRESS 0x20 #define _SSP2STAT_DATA_ADDRESS 0x20 #define _SSP2STAT_D 0x20 #define _SSP2STAT_DA2 0x20 #define _SSP2STAT_CKE 0x40 #define _SSP2STAT_CKE2 0x40 #define _SSP2STAT_SMP 0x80 #define _SSP2STAT_SMP2 0x80 //============================================================================== extern __at(0x0F65) __sfr SSP2ADD; extern __at(0x0F66) __sfr SSP2BUF; //============================================================================== // ECCP2DEL Bits extern __at(0x0F67) __sfr ECCP2DEL; typedef union { struct { unsigned P2DC0 : 1; unsigned P2DC1 : 1; unsigned P2DC2 : 1; unsigned P2DC3 : 1; unsigned P2DC4 : 1; unsigned P2DC5 : 1; unsigned P2DC6 : 1; unsigned P2RSEN : 1; }; struct { unsigned PDC0 : 1; unsigned PDC1 : 1; unsigned PDC2 : 1; unsigned PDC3 : 1; unsigned PDC4 : 1; unsigned PDC5 : 1; unsigned PDC6 : 1; unsigned PRSEN : 1; }; struct { unsigned PDC : 7; unsigned : 1; }; struct { unsigned P2DC : 7; unsigned : 1; }; } __ECCP2DELbits_t; extern __at(0x0F67) volatile __ECCP2DELbits_t ECCP2DELbits; #define _ECCP2DEL_P2DC0 0x01 #define _ECCP2DEL_PDC0 0x01 #define _ECCP2DEL_P2DC1 0x02 #define _ECCP2DEL_PDC1 0x02 #define _ECCP2DEL_P2DC2 0x04 #define _ECCP2DEL_PDC2 0x04 #define _ECCP2DEL_P2DC3 0x08 #define _ECCP2DEL_PDC3 0x08 #define _ECCP2DEL_P2DC4 0x10 #define _ECCP2DEL_PDC4 0x10 #define _ECCP2DEL_P2DC5 0x20 #define _ECCP2DEL_PDC5 0x20 #define _ECCP2DEL_P2DC6 0x40 #define _ECCP2DEL_PDC6 0x40 #define _ECCP2DEL_P2RSEN 0x80 #define _ECCP2DEL_PRSEN 0x80 //============================================================================== //============================================================================== // ECCP2AS Bits extern __at(0x0F68) __sfr ECCP2AS; typedef union { struct { unsigned PSS2BD0 : 1; unsigned PSS2BD1 : 1; unsigned PSS2AC0 : 1; unsigned PSS2AC1 : 1; unsigned ECCP2AS0 : 1; unsigned ECCP2AS1 : 1; unsigned ECCP2AS2 : 1; unsigned ECCP2ASE : 1; }; struct { unsigned PSSBD0 : 1; unsigned PSSBD1 : 1; unsigned PSSAC0 : 1; unsigned PSSAC1 : 1; unsigned ECCPAS0 : 1; unsigned ECCPAS1 : 1; unsigned ECCPAS2 : 1; unsigned ECCPASE : 1; }; struct { unsigned PSSBD : 2; unsigned : 6; }; struct { unsigned PSS2BD : 2; unsigned : 6; }; struct { unsigned : 2; unsigned PSS2AC : 2; unsigned : 4; }; struct { unsigned : 2; unsigned PSSAC : 2; unsigned : 4; }; struct { unsigned : 4; unsigned ECCP2AS : 3; unsigned : 1; }; struct { unsigned : 4; unsigned ECCPAS : 3; unsigned : 1; }; } __ECCP2ASbits_t; extern __at(0x0F68) volatile __ECCP2ASbits_t ECCP2ASbits; #define _ECCP2AS_PSS2BD0 0x01 #define _ECCP2AS_PSSBD0 0x01 #define _ECCP2AS_PSS2BD1 0x02 #define _ECCP2AS_PSSBD1 0x02 #define _ECCP2AS_PSS2AC0 0x04 #define _ECCP2AS_PSSAC0 0x04 #define _ECCP2AS_PSS2AC1 0x08 #define _ECCP2AS_PSSAC1 0x08 #define _ECCP2AS_ECCP2AS0 0x10 #define _ECCP2AS_ECCPAS0 0x10 #define _ECCP2AS_ECCP2AS1 0x20 #define _ECCP2AS_ECCPAS1 0x20 #define _ECCP2AS_ECCP2AS2 0x40 #define _ECCP2AS_ECCPAS2 0x40 #define _ECCP2AS_ECCP2ASE 0x80 #define _ECCP2AS_ECCPASE 0x80 //============================================================================== //============================================================================== // ECCP3DEL Bits extern __at(0x0F69) __sfr ECCP3DEL; typedef union { struct { unsigned P3DC0 : 1; unsigned P3DC1 : 1; unsigned P3DC2 : 1; unsigned P3DC3 : 1; unsigned P3DC4 : 1; unsigned P3DC5 : 1; unsigned P3DC6 : 1; unsigned P3RSEN : 1; }; struct { unsigned PDC0 : 1; unsigned PDC1 : 1; unsigned PDC2 : 1; unsigned PDC3 : 1; unsigned PDC4 : 1; unsigned PDC5 : 1; unsigned PDC6 : 1; unsigned PRSEN : 1; }; struct { unsigned PDC : 7; unsigned : 1; }; struct { unsigned P3DC : 7; unsigned : 1; }; } __ECCP3DELbits_t; extern __at(0x0F69) volatile __ECCP3DELbits_t ECCP3DELbits; #define _ECCP3DEL_P3DC0 0x01 #define _ECCP3DEL_PDC0 0x01 #define _ECCP3DEL_P3DC1 0x02 #define _ECCP3DEL_PDC1 0x02 #define _ECCP3DEL_P3DC2 0x04 #define _ECCP3DEL_PDC2 0x04 #define _ECCP3DEL_P3DC3 0x08 #define _ECCP3DEL_PDC3 0x08 #define _ECCP3DEL_P3DC4 0x10 #define _ECCP3DEL_PDC4 0x10 #define _ECCP3DEL_P3DC5 0x20 #define _ECCP3DEL_PDC5 0x20 #define _ECCP3DEL_P3DC6 0x40 #define _ECCP3DEL_PDC6 0x40 #define _ECCP3DEL_P3RSEN 0x80 #define _ECCP3DEL_PRSEN 0x80 //============================================================================== //============================================================================== // ECCP3AS Bits extern __at(0x0F6A) __sfr ECCP3AS; typedef union { struct { unsigned PSS3BD0 : 1; unsigned PSS3BD1 : 1; unsigned PSS3AC0 : 1; unsigned PSS3AC1 : 1; unsigned ECCP3AS0 : 1; unsigned ECCP3AS1 : 1; unsigned ECCP3AS2 : 1; unsigned ECCP3ASE : 1; }; struct { unsigned PSSBD0 : 1; unsigned PSSBD1 : 1; unsigned PSSAC0 : 1; unsigned PSSAC1 : 1; unsigned ECCPAS0 : 1; unsigned ECCPAS1 : 1; unsigned ECCPAS2 : 1; unsigned ECCPASE : 1; }; struct { unsigned PSS3BD : 2; unsigned : 6; }; struct { unsigned PSSBD : 2; unsigned : 6; }; struct { unsigned : 2; unsigned PSS3AC : 2; unsigned : 4; }; struct { unsigned : 2; unsigned PSSAC : 2; unsigned : 4; }; struct { unsigned : 4; unsigned ECCPAS : 3; unsigned : 1; }; struct { unsigned : 4; unsigned ECCP3AS : 3; unsigned : 1; }; } __ECCP3ASbits_t; extern __at(0x0F6A) volatile __ECCP3ASbits_t ECCP3ASbits; #define _ECCP3AS_PSS3BD0 0x01 #define _ECCP3AS_PSSBD0 0x01 #define _ECCP3AS_PSS3BD1 0x02 #define _ECCP3AS_PSSBD1 0x02 #define _ECCP3AS_PSS3AC0 0x04 #define _ECCP3AS_PSSAC0 0x04 #define _ECCP3AS_PSS3AC1 0x08 #define _ECCP3AS_PSSAC1 0x08 #define _ECCP3AS_ECCP3AS0 0x10 #define _ECCP3AS_ECCPAS0 0x10 #define _ECCP3AS_ECCP3AS1 0x20 #define _ECCP3AS_ECCPAS1 0x20 #define _ECCP3AS_ECCP3AS2 0x40 #define _ECCP3AS_ECCPAS2 0x40 #define _ECCP3AS_ECCP3ASE 0x80 #define _ECCP3AS_ECCPASE 0x80 //============================================================================== //============================================================================== // RCSTA2 Bits extern __at(0x0F6B) __sfr RCSTA2; typedef union { struct { unsigned RX9D : 1; unsigned OERR : 1; unsigned FERR : 1; unsigned ADDEN : 1; unsigned CREN : 1; unsigned SREN : 1; unsigned RX9 : 1; unsigned SPEN : 1; }; struct { unsigned RCD8 : 1; unsigned OERR2 : 1; unsigned FERR2 : 1; unsigned ADDEN2 : 1; unsigned CREN2 : 1; unsigned SREN2 : 1; unsigned RC9 : 1; unsigned SPEN2 : 1; }; struct { unsigned RX9D2 : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned NOT_RC8 : 1; unsigned : 1; }; struct { unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned RC8_9 : 1; unsigned : 1; }; struct { unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned RX92 : 1; unsigned : 1; }; } __RCSTA2bits_t; extern __at(0x0F6B) volatile __RCSTA2bits_t RCSTA2bits; #define _RCSTA2_RX9D 0x01 #define _RCSTA2_RCD8 0x01 #define _RCSTA2_RX9D2 0x01 #define _RCSTA2_OERR 0x02 #define _RCSTA2_OERR2 0x02 #define _RCSTA2_FERR 0x04 #define _RCSTA2_FERR2 0x04 #define _RCSTA2_ADDEN 0x08 #define _RCSTA2_ADDEN2 0x08 #define _RCSTA2_CREN 0x10 #define _RCSTA2_CREN2 0x10 #define _RCSTA2_SREN 0x20 #define _RCSTA2_SREN2 0x20 #define _RCSTA2_RX9 0x40 #define _RCSTA2_RC9 0x40 #define _RCSTA2_NOT_RC8 0x40 #define _RCSTA2_RC8_9 0x40 #define _RCSTA2_RX92 0x40 #define _RCSTA2_SPEN 0x80 #define _RCSTA2_SPEN2 0x80 //============================================================================== //============================================================================== // TXSTA2 Bits extern __at(0x0F6C) __sfr TXSTA2; typedef union { struct { unsigned TX9D : 1; unsigned TRMT : 1; unsigned BRGH : 1; unsigned SENDB : 1; unsigned SYNC : 1; unsigned TXEN : 1; unsigned TX9 : 1; unsigned CSRC : 1; }; struct { unsigned TXD8 : 1; unsigned TRMT2 : 1; unsigned BRGH2 : 1; unsigned SENDB2 : 1; unsigned SYNC2 : 1; unsigned TXEN2 : 1; unsigned TX8_9 : 1; unsigned CSRC2 : 1; }; struct { unsigned TX9D2 : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned NOT_TX8 : 1; unsigned : 1; }; struct { unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned TX92 : 1; unsigned : 1; }; } __TXSTA2bits_t; extern __at(0x0F6C) volatile __TXSTA2bits_t TXSTA2bits; #define _TXSTA2_TX9D 0x01 #define _TXSTA2_TXD8 0x01 #define _TXSTA2_TX9D2 0x01 #define _TXSTA2_TRMT 0x02 #define _TXSTA2_TRMT2 0x02 #define _TXSTA2_BRGH 0x04 #define _TXSTA2_BRGH2 0x04 #define _TXSTA2_SENDB 0x08 #define _TXSTA2_SENDB2 0x08 #define _TXSTA2_SYNC 0x10 #define _TXSTA2_SYNC2 0x10 #define _TXSTA2_TXEN 0x20 #define _TXSTA2_TXEN2 0x20 #define _TXSTA2_TX9 0x40 #define _TXSTA2_TX8_9 0x40 #define _TXSTA2_NOT_TX8 0x40 #define _TXSTA2_TX92 0x40 #define _TXSTA2_CSRC 0x80 #define _TXSTA2_CSRC2 0x80 //============================================================================== extern __at(0x0F6D) __sfr TXREG2; extern __at(0x0F6E) __sfr RCREG2; extern __at(0x0F6F) __sfr SPBRG2; //============================================================================== // CCP5CON Bits extern __at(0x0F70) __sfr CCP5CON; typedef union { struct { unsigned CCP5M0 : 1; unsigned CCP5M1 : 1; unsigned CCP5M2 : 1; unsigned CCP5M3 : 1; unsigned DCCP5Y : 1; unsigned DCCP5X : 1; unsigned : 1; unsigned : 1; }; struct { unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned DC5B0 : 1; unsigned DC5B1 : 1; unsigned : 1; unsigned : 1; }; struct { unsigned CCP5M : 4; unsigned : 4; }; struct { unsigned : 4; unsigned DC5B : 2; unsigned : 2; }; } __CCP5CONbits_t; extern __at(0x0F70) volatile __CCP5CONbits_t CCP5CONbits; #define _CCP5M0 0x01 #define _CCP5M1 0x02 #define _CCP5M2 0x04 #define _CCP5M3 0x08 #define _DCCP5Y 0x10 #define _DC5B0 0x10 #define _DCCP5X 0x20 #define _DC5B1 0x20 //============================================================================== extern __at(0x0F71) __sfr CCPR5; extern __at(0x0F71) __sfr CCPR5L; extern __at(0x0F72) __sfr CCPR5H; //============================================================================== // CCP4CON Bits extern __at(0x0F73) __sfr CCP4CON; typedef union { struct { unsigned CCP4M0 : 1; unsigned CCP4M1 : 1; unsigned CCP4M2 : 1; unsigned CCP4M3 : 1; unsigned DCCP4Y : 1; unsigned DCCP4X : 1; unsigned : 1; unsigned : 1; }; struct { unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned DC4B0 : 1; unsigned DC4B1 : 1; unsigned : 1; unsigned : 1; }; struct { unsigned CCP4M : 4; unsigned : 4; }; struct { unsigned : 4; unsigned DC4B : 2; unsigned : 2; }; } __CCP4CONbits_t; extern __at(0x0F73) volatile __CCP4CONbits_t CCP4CONbits; #define _CCP4M0 0x01 #define _CCP4M1 0x02 #define _CCP4M2 0x04 #define _CCP4M3 0x08 #define _DCCP4Y 0x10 #define _DC4B0 0x10 #define _DCCP4X 0x20 #define _DC4B1 0x20 //============================================================================== extern __at(0x0F74) __sfr CCPR4; extern __at(0x0F74) __sfr CCPR4L; extern __at(0x0F75) __sfr CCPR4H; //============================================================================== // T4CON Bits extern __at(0x0F76) __sfr T4CON; typedef union { struct { unsigned T4CKPS0 : 1; unsigned T4CKPS1 : 1; unsigned TMR4ON : 1; unsigned T4OUTPS0 : 1; unsigned T4OUTPS1 : 1; unsigned T4OUTPS2 : 1; unsigned T4OUTPS3 : 1; unsigned : 1; }; struct { unsigned T4CKPS : 2; unsigned : 6; }; struct { unsigned : 3; unsigned T4OUTPS : 4; unsigned : 1; }; } __T4CONbits_t; extern __at(0x0F76) volatile __T4CONbits_t T4CONbits; #define _T4CKPS0 0x01 #define _T4CKPS1 0x02 #define _TMR4ON 0x04 #define _T4OUTPS0 0x08 #define _T4OUTPS1 0x10 #define _T4OUTPS2 0x20 #define _T4OUTPS3 0x40 //============================================================================== extern __at(0x0F77) __sfr PR4; extern __at(0x0F78) __sfr TMR4; //============================================================================== // ECCP1DEL Bits extern __at(0x0F79) __sfr ECCP1DEL; typedef union { struct { unsigned P1DC0 : 1; unsigned P1DC1 : 1; unsigned P1DC2 : 1; unsigned P1DC3 : 1; unsigned P1DC4 : 1; unsigned P1DC5 : 1; unsigned P1DC6 : 1; unsigned P1RSEN : 1; }; struct { unsigned PDC0 : 1; unsigned PDC1 : 1; unsigned PDC2 : 1; unsigned PDC3 : 1; unsigned PDC4 : 1; unsigned PDC5 : 1; unsigned PDC6 : 1; unsigned PRSEN : 1; }; struct { unsigned PDC : 7; unsigned : 1; }; struct { unsigned P1DC : 7; unsigned : 1; }; } __ECCP1DELbits_t; extern __at(0x0F79) volatile __ECCP1DELbits_t ECCP1DELbits; #define _P1DC0 0x01 #define _PDC0 0x01 #define _P1DC1 0x02 #define _PDC1 0x02 #define _P1DC2 0x04 #define _PDC2 0x04 #define _P1DC3 0x08 #define _PDC3 0x08 #define _P1DC4 0x10 #define _PDC4 0x10 #define _P1DC5 0x20 #define _PDC5 0x20 #define _P1DC6 0x40 #define _PDC6 0x40 #define _P1RSEN 0x80 #define _PRSEN 0x80 //============================================================================== //============================================================================== // BAUDCON2 Bits extern __at(0x0F7C) __sfr BAUDCON2; typedef union { struct { unsigned ABDEN : 1; unsigned WUE : 1; unsigned : 1; unsigned BRG16 : 1; unsigned SCKP : 1; unsigned : 1; unsigned RCIDL : 1; unsigned ABDOVF : 1; }; struct { unsigned ABDEN2 : 1; unsigned WUE2 : 1; unsigned : 1; unsigned BRG162 : 1; unsigned SCKP2 : 1; unsigned : 1; unsigned RCMT : 1; unsigned ABDOVF2 : 1; }; struct { unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned RCIDL2 : 1; unsigned : 1; }; } __BAUDCON2bits_t; extern __at(0x0F7C) volatile __BAUDCON2bits_t BAUDCON2bits; #define _BAUDCON2_ABDEN 0x01 #define _BAUDCON2_ABDEN2 0x01 #define _BAUDCON2_WUE 0x02 #define _BAUDCON2_WUE2 0x02 #define _BAUDCON2_BRG16 0x08 #define _BAUDCON2_BRG162 0x08 #define _BAUDCON2_SCKP 0x10 #define _BAUDCON2_SCKP2 0x10 #define _BAUDCON2_RCIDL 0x40 #define _BAUDCON2_RCMT 0x40 #define _BAUDCON2_RCIDL2 0x40 #define _BAUDCON2_ABDOVF 0x80 #define _BAUDCON2_ABDOVF2 0x80 //============================================================================== extern __at(0x0F7D) __sfr SPBRGH2; //============================================================================== // BAUDCON Bits extern __at(0x0F7E) __sfr BAUDCON; typedef union { struct { unsigned ABDEN : 1; unsigned WUE : 1; unsigned : 1; unsigned BRG16 : 1; unsigned SCKP : 1; unsigned : 1; unsigned RCIDL : 1; unsigned ABDOVF : 1; }; struct { unsigned ABDEN1 : 1; unsigned WUE1 : 1; unsigned : 1; unsigned BRG161 : 1; unsigned SCKP1 : 1; unsigned : 1; unsigned RCMT : 1; unsigned ABDOVF1 : 1; }; struct { unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned RCIDL1 : 1; unsigned : 1; }; } __BAUDCONbits_t; extern __at(0x0F7E) volatile __BAUDCONbits_t BAUDCONbits; #define _ABDEN 0x01 #define _ABDEN1 0x01 #define _WUE 0x02 #define _WUE1 0x02 #define _BRG16 0x08 #define _BRG161 0x08 #define _SCKP 0x10 #define _SCKP1 0x10 #define _RCIDL 0x40 #define _RCMT 0x40 #define _RCIDL1 0x40 #define _ABDOVF 0x80 #define _ABDOVF1 0x80 //============================================================================== //============================================================================== // BAUDCON1 Bits extern __at(0x0F7E) __sfr BAUDCON1; typedef union { struct { unsigned ABDEN : 1; unsigned WUE : 1; unsigned : 1; unsigned BRG16 : 1; unsigned SCKP : 1; unsigned : 1; unsigned RCIDL : 1; unsigned ABDOVF : 1; }; struct { unsigned ABDEN1 : 1; unsigned WUE1 : 1; unsigned : 1; unsigned BRG161 : 1; unsigned SCKP1 : 1; unsigned : 1; unsigned RCMT : 1; unsigned ABDOVF1 : 1; }; struct { unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned RCIDL1 : 1; unsigned : 1; }; } __BAUDCON1bits_t; extern __at(0x0F7E) volatile __BAUDCON1bits_t BAUDCON1bits; #define _BAUDCON1_ABDEN 0x01 #define _BAUDCON1_ABDEN1 0x01 #define _BAUDCON1_WUE 0x02 #define _BAUDCON1_WUE1 0x02 #define _BAUDCON1_BRG16 0x08 #define _BAUDCON1_BRG161 0x08 #define _BAUDCON1_SCKP 0x10 #define _BAUDCON1_SCKP1 0x10 #define _BAUDCON1_RCIDL 0x40 #define _BAUDCON1_RCMT 0x40 #define _BAUDCON1_RCIDL1 0x40 #define _BAUDCON1_ABDOVF 0x80 #define _BAUDCON1_ABDOVF1 0x80 //============================================================================== extern __at(0x0F7F) __sfr SPBRGH; extern __at(0x0F7F) __sfr SPBRGH1; //============================================================================== // PORTA Bits extern __at(0x0F80) __sfr PORTA; typedef union { struct { unsigned RA0 : 1; unsigned RA1 : 1; unsigned RA2 : 1; unsigned RA3 : 1; unsigned RA4 : 1; unsigned RA5 : 1; unsigned RA6 : 1; unsigned RA7 : 1; }; struct { unsigned AN0 : 1; unsigned AN1 : 1; unsigned VREFM : 1; unsigned VREFP : 1; unsigned T0CKI : 1; unsigned LVDIN : 1; unsigned : 1; unsigned : 1; }; struct { unsigned : 1; unsigned : 1; unsigned AN2 : 1; unsigned AN3 : 1; unsigned : 1; unsigned AN4 : 1; unsigned : 1; unsigned : 1; }; struct { unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned HLVDIN : 1; unsigned : 1; unsigned : 1; }; } __PORTAbits_t; extern __at(0x0F80) volatile __PORTAbits_t PORTAbits; #define _PORTA_RA0 0x01 #define _PORTA_AN0 0x01 #define _PORTA_RA1 0x02 #define _PORTA_AN1 0x02 #define _PORTA_RA2 0x04 #define _PORTA_VREFM 0x04 #define _PORTA_AN2 0x04 #define _PORTA_RA3 0x08 #define _PORTA_VREFP 0x08 #define _PORTA_AN3 0x08 #define _PORTA_RA4 0x10 #define _PORTA_T0CKI 0x10 #define _PORTA_RA5 0x20 #define _PORTA_LVDIN 0x20 #define _PORTA_AN4 0x20 #define _PORTA_HLVDIN 0x20 #define _PORTA_RA6 0x40 #define _PORTA_RA7 0x80 //============================================================================== //============================================================================== // PORTB Bits extern __at(0x0F81) __sfr PORTB; typedef union { struct { unsigned RB0 : 1; unsigned RB1 : 1; unsigned RB2 : 1; unsigned RB3 : 1; unsigned RB4 : 1; unsigned RB5 : 1; unsigned RB6 : 1; unsigned RB7 : 1; }; struct { unsigned INT0 : 1; unsigned INT1 : 1; unsigned INT2 : 1; unsigned INT3 : 1; unsigned KBI0 : 1; unsigned KBI1 : 1; unsigned KBI2 : 1; unsigned KBI3 : 1; }; struct { unsigned FLT0 : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; }; struct { unsigned INT : 4; unsigned : 4; }; struct { unsigned : 4; unsigned KBI : 4; }; } __PORTBbits_t; extern __at(0x0F81) volatile __PORTBbits_t PORTBbits; #define _PORTB_RB0 0x01 #define _PORTB_INT0 0x01 #define _PORTB_FLT0 0x01 #define _PORTB_RB1 0x02 #define _PORTB_INT1 0x02 #define _PORTB_RB2 0x04 #define _PORTB_INT2 0x04 #define _PORTB_RB3 0x08 #define _PORTB_INT3 0x08 #define _PORTB_RB4 0x10 #define _PORTB_KBI0 0x10 #define _PORTB_RB5 0x20 #define _PORTB_KBI1 0x20 #define _PORTB_RB6 0x40 #define _PORTB_KBI2 0x40 #define _PORTB_RB7 0x80 #define _PORTB_KBI3 0x80 //============================================================================== //============================================================================== // PORTC Bits extern __at(0x0F82) __sfr PORTC; typedef union { struct { unsigned RC0 : 1; unsigned RC1 : 1; unsigned RC2 : 1; unsigned RC3 : 1; unsigned RC4 : 1; unsigned RC5 : 1; unsigned RC6 : 1; unsigned RC7 : 1; }; struct { unsigned T1OSO : 1; unsigned T1OSI : 1; unsigned ECCP1 : 1; unsigned SCK : 1; unsigned SDI : 1; unsigned SDO : 1; unsigned TX : 1; unsigned RX : 1; }; struct { unsigned T13CKI : 1; unsigned ECCP2 : 1; unsigned CCP1 : 1; unsigned SCL : 1; unsigned SDA : 1; unsigned SDO1 : 1; unsigned CK : 1; unsigned DT1 : 1; }; struct { unsigned : 1; unsigned CCP2 : 1; unsigned P1A : 1; unsigned SCL1 : 1; unsigned SDA1 : 1; unsigned : 1; unsigned CK1 : 1; unsigned RX1 : 1; }; struct { unsigned : 1; unsigned P2A : 1; unsigned : 1; unsigned SCK1 : 1; unsigned SDI1 : 1; unsigned : 1; unsigned TX1 : 1; unsigned : 1; }; } __PORTCbits_t; extern __at(0x0F82) volatile __PORTCbits_t PORTCbits; #define _PORTC_RC0 0x01 #define _PORTC_T1OSO 0x01 #define _PORTC_T13CKI 0x01 #define _PORTC_RC1 0x02 #define _PORTC_T1OSI 0x02 #define _PORTC_ECCP2 0x02 #define _PORTC_CCP2 0x02 #define _PORTC_P2A 0x02 #define _PORTC_RC2 0x04 #define _PORTC_ECCP1 0x04 #define _PORTC_CCP1 0x04 #define _PORTC_P1A 0x04 #define _PORTC_RC3 0x08 #define _PORTC_SCK 0x08 #define _PORTC_SCL 0x08 #define _PORTC_SCL1 0x08 #define _PORTC_SCK1 0x08 #define _PORTC_RC4 0x10 #define _PORTC_SDI 0x10 #define _PORTC_SDA 0x10 #define _PORTC_SDA1 0x10 #define _PORTC_SDI1 0x10 #define _PORTC_RC5 0x20 #define _PORTC_SDO 0x20 #define _PORTC_SDO1 0x20 #define _PORTC_RC6 0x40 #define _PORTC_TX 0x40 #define _PORTC_CK 0x40 #define _PORTC_CK1 0x40 #define _PORTC_TX1 0x40 #define _PORTC_RC7 0x80 #define _PORTC_RX 0x80 #define _PORTC_DT1 0x80 #define _PORTC_RX1 0x80 //============================================================================== //============================================================================== // PORTD Bits extern __at(0x0F83) __sfr PORTD; typedef union { struct { unsigned RD0 : 1; unsigned RD1 : 1; unsigned RD2 : 1; unsigned RD3 : 1; unsigned RD4 : 1; unsigned RD5 : 1; unsigned RD6 : 1; unsigned RD7 : 1; }; struct { unsigned PSP0 : 1; unsigned PSP1 : 1; unsigned PSP2 : 1; unsigned PSP3 : 1; unsigned PSP4 : 1; unsigned PSP5 : 1; unsigned PSP6 : 1; unsigned PSP7 : 1; }; struct { unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned SDO2 : 1; unsigned SDA2 : 1; unsigned SCL2 : 1; unsigned SS2 : 1; }; struct { unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned SDI2 : 1; unsigned SCK2 : 1; unsigned NOT_SS2 : 1; }; } __PORTDbits_t; extern __at(0x0F83) volatile __PORTDbits_t PORTDbits; #define _PORTD_RD0 0x01 #define _PORTD_PSP0 0x01 #define _PORTD_RD1 0x02 #define _PORTD_PSP1 0x02 #define _PORTD_RD2 0x04 #define _PORTD_PSP2 0x04 #define _PORTD_RD3 0x08 #define _PORTD_PSP3 0x08 #define _PORTD_RD4 0x10 #define _PORTD_PSP4 0x10 #define _PORTD_SDO2 0x10 #define _PORTD_RD5 0x20 #define _PORTD_PSP5 0x20 #define _PORTD_SDA2 0x20 #define _PORTD_SDI2 0x20 #define _PORTD_RD6 0x40 #define _PORTD_PSP6 0x40 #define _PORTD_SCL2 0x40 #define _PORTD_SCK2 0x40 #define _PORTD_RD7 0x80 #define _PORTD_PSP7 0x80 #define _PORTD_SS2 0x80 #define _PORTD_NOT_SS2 0x80 //============================================================================== //============================================================================== // PORTE Bits extern __at(0x0F84) __sfr PORTE; typedef union { struct { unsigned RE0 : 1; unsigned RE1 : 1; unsigned RE2 : 1; unsigned RE3 : 1; unsigned RE4 : 1; unsigned RE5 : 1; unsigned RE6 : 1; unsigned RE7 : 1; }; struct { unsigned RD : 1; unsigned WR : 1; unsigned CS : 1; unsigned P3C : 1; unsigned P3B : 1; unsigned P1C : 1; unsigned P1B : 1; unsigned ECCP2 : 1; }; struct { unsigned NOT_RD : 1; unsigned NOT_WR : 1; unsigned NOT_CS : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned CCP2 : 1; }; struct { unsigned P2D : 1; unsigned P2C : 1; unsigned P2B : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned P2A : 1; }; } __PORTEbits_t; extern __at(0x0F84) volatile __PORTEbits_t PORTEbits; #define _PORTE_RE0 0x01 #define _PORTE_RD 0x01 #define _PORTE_NOT_RD 0x01 #define _PORTE_P2D 0x01 #define _PORTE_RE1 0x02 #define _PORTE_WR 0x02 #define _PORTE_NOT_WR 0x02 #define _PORTE_P2C 0x02 #define _PORTE_RE2 0x04 #define _PORTE_CS 0x04 #define _PORTE_NOT_CS 0x04 #define _PORTE_P2B 0x04 #define _PORTE_RE3 0x08 #define _PORTE_P3C 0x08 #define _PORTE_RE4 0x10 #define _PORTE_P3B 0x10 #define _PORTE_RE5 0x20 #define _PORTE_P1C 0x20 #define _PORTE_RE6 0x40 #define _PORTE_P1B 0x40 #define _PORTE_RE7 0x80 #define _PORTE_ECCP2 0x80 #define _PORTE_CCP2 0x80 #define _PORTE_P2A 0x80 //============================================================================== //============================================================================== // PORTF Bits extern __at(0x0F85) __sfr PORTF; typedef union { struct { unsigned RF0 : 1; unsigned RF1 : 1; unsigned RF2 : 1; unsigned RF3 : 1; unsigned RF4 : 1; unsigned RF5 : 1; unsigned RF6 : 1; unsigned RF7 : 1; }; struct { unsigned AN5 : 1; unsigned AN6 : 1; unsigned AN7 : 1; unsigned AN8 : 1; unsigned AN9 : 1; unsigned AN10 : 1; unsigned AN11 : 1; unsigned SS1 : 1; }; struct { unsigned : 1; unsigned C2OUT : 1; unsigned C1OUT : 1; unsigned : 1; unsigned : 1; unsigned CVREF : 1; unsigned : 1; unsigned NOT_SS1 : 1; }; } __PORTFbits_t; extern __at(0x0F85) volatile __PORTFbits_t PORTFbits; #define _PORTF_RF0 0x01 #define _PORTF_AN5 0x01 #define _PORTF_RF1 0x02 #define _PORTF_AN6 0x02 #define _PORTF_C2OUT 0x02 #define _PORTF_RF2 0x04 #define _PORTF_AN7 0x04 #define _PORTF_C1OUT 0x04 #define _PORTF_RF3 0x08 #define _PORTF_AN8 0x08 #define _PORTF_RF4 0x10 #define _PORTF_AN9 0x10 #define _PORTF_RF5 0x20 #define _PORTF_AN10 0x20 #define _PORTF_CVREF 0x20 #define _PORTF_RF6 0x40 #define _PORTF_AN11 0x40 #define _PORTF_RF7 0x80 #define _PORTF_SS1 0x80 #define _PORTF_NOT_SS1 0x80 //============================================================================== //============================================================================== // PORTG Bits extern __at(0x0F86) __sfr PORTG; typedef union { struct { unsigned RG0 : 1; unsigned RG1 : 1; unsigned RG2 : 1; unsigned RG3 : 1; unsigned RG4 : 1; unsigned RG5 : 1; unsigned : 1; unsigned : 1; }; struct { unsigned ECCP3 : 1; unsigned TX2 : 1; unsigned RX2 : 1; unsigned CCP4 : 1; unsigned CCP5 : 1; unsigned MCLR : 1; unsigned : 1; unsigned : 1; }; struct { unsigned P3A : 1; unsigned CK2 : 1; unsigned DT2 : 1; unsigned P3D : 1; unsigned P1D : 1; unsigned NOT_MCLR : 1; unsigned : 1; unsigned : 1; }; struct { unsigned CCP3 : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; }; struct { unsigned RG : 6; unsigned : 2; }; } __PORTGbits_t; extern __at(0x0F86) volatile __PORTGbits_t PORTGbits; #define _PORTG_RG0 0x01 #define _PORTG_ECCP3 0x01 #define _PORTG_P3A 0x01 #define _PORTG_CCP3 0x01 #define _PORTG_RG1 0x02 #define _PORTG_TX2 0x02 #define _PORTG_CK2 0x02 #define _PORTG_RG2 0x04 #define _PORTG_RX2 0x04 #define _PORTG_DT2 0x04 #define _PORTG_RG3 0x08 #define _PORTG_CCP4 0x08 #define _PORTG_P3D 0x08 #define _PORTG_RG4 0x10 #define _PORTG_CCP5 0x10 #define _PORTG_P1D 0x10 #define _PORTG_RG5 0x20 #define _PORTG_MCLR 0x20 #define _PORTG_NOT_MCLR 0x20 //============================================================================== //============================================================================== // LATA Bits extern __at(0x0F89) __sfr LATA; typedef struct { unsigned LATA0 : 1; unsigned LATA1 : 1; unsigned LATA2 : 1; unsigned LATA3 : 1; unsigned LATA4 : 1; unsigned LATA5 : 1; unsigned LATA6 : 1; unsigned LATA7 : 1; } __LATAbits_t; extern __at(0x0F89) volatile __LATAbits_t LATAbits; #define _LATA0 0x01 #define _LATA1 0x02 #define _LATA2 0x04 #define _LATA3 0x08 #define _LATA4 0x10 #define _LATA5 0x20 #define _LATA6 0x40 #define _LATA7 0x80 //============================================================================== //============================================================================== // LATB Bits extern __at(0x0F8A) __sfr LATB; typedef struct { unsigned LATB0 : 1; unsigned LATB1 : 1; unsigned LATB2 : 1; unsigned LATB3 : 1; unsigned LATB4 : 1; unsigned LATB5 : 1; unsigned LATB6 : 1; unsigned LATB7 : 1; } __LATBbits_t; extern __at(0x0F8A) volatile __LATBbits_t LATBbits; #define _LATB0 0x01 #define _LATB1 0x02 #define _LATB2 0x04 #define _LATB3 0x08 #define _LATB4 0x10 #define _LATB5 0x20 #define _LATB6 0x40 #define _LATB7 0x80 //============================================================================== //============================================================================== // LATC Bits extern __at(0x0F8B) __sfr LATC; typedef struct { unsigned LATC0 : 1; unsigned LATC1 : 1; unsigned LATC2 : 1; unsigned LATC3 : 1; unsigned LATC4 : 1; unsigned LATC5 : 1; unsigned LATC6 : 1; unsigned LATC7 : 1; } __LATCbits_t; extern __at(0x0F8B) volatile __LATCbits_t LATCbits; #define _LATC0 0x01 #define _LATC1 0x02 #define _LATC2 0x04 #define _LATC3 0x08 #define _LATC4 0x10 #define _LATC5 0x20 #define _LATC6 0x40 #define _LATC7 0x80 //============================================================================== //============================================================================== // LATD Bits extern __at(0x0F8C) __sfr LATD; typedef struct { unsigned LATD0 : 1; unsigned LATD1 : 1; unsigned LATD2 : 1; unsigned LATD3 : 1; unsigned LATD4 : 1; unsigned LATD5 : 1; unsigned LATD6 : 1; unsigned LATD7 : 1; } __LATDbits_t; extern __at(0x0F8C) volatile __LATDbits_t LATDbits; #define _LATD0 0x01 #define _LATD1 0x02 #define _LATD2 0x04 #define _LATD3 0x08 #define _LATD4 0x10 #define _LATD5 0x20 #define _LATD6 0x40 #define _LATD7 0x80 //============================================================================== //============================================================================== // LATE Bits extern __at(0x0F8D) __sfr LATE; typedef struct { unsigned LATE0 : 1; unsigned LATE1 : 1; unsigned LATE2 : 1; unsigned LATE3 : 1; unsigned LATE4 : 1; unsigned LATE5 : 1; unsigned LATE6 : 1; unsigned LATE7 : 1; } __LATEbits_t; extern __at(0x0F8D) volatile __LATEbits_t LATEbits; #define _LATE0 0x01 #define _LATE1 0x02 #define _LATE2 0x04 #define _LATE3 0x08 #define _LATE4 0x10 #define _LATE5 0x20 #define _LATE6 0x40 #define _LATE7 0x80 //============================================================================== //============================================================================== // LATF Bits extern __at(0x0F8E) __sfr LATF; typedef struct { unsigned LATF0 : 1; unsigned LATF1 : 1; unsigned LATF2 : 1; unsigned LATF3 : 1; unsigned LATF4 : 1; unsigned LATF5 : 1; unsigned LATF6 : 1; unsigned LATF7 : 1; } __LATFbits_t; extern __at(0x0F8E) volatile __LATFbits_t LATFbits; #define _LATF0 0x01 #define _LATF1 0x02 #define _LATF2 0x04 #define _LATF3 0x08 #define _LATF4 0x10 #define _LATF5 0x20 #define _LATF6 0x40 #define _LATF7 0x80 //============================================================================== //============================================================================== // LATG Bits extern __at(0x0F8F) __sfr LATG; typedef union { struct { unsigned LATG0 : 1; unsigned LATG1 : 1; unsigned LATG2 : 1; unsigned LATG3 : 1; unsigned LATG4 : 1; unsigned LATG5 : 1; unsigned : 1; unsigned : 1; }; struct { unsigned LATG : 6; unsigned : 2; }; } __LATGbits_t; extern __at(0x0F8F) volatile __LATGbits_t LATGbits; #define _LATG0 0x01 #define _LATG1 0x02 #define _LATG2 0x04 #define _LATG3 0x08 #define _LATG4 0x10 #define _LATG5 0x20 //============================================================================== //============================================================================== // DDRA Bits extern __at(0x0F92) __sfr DDRA; typedef union { struct { unsigned TRISA0 : 1; unsigned TRISA1 : 1; unsigned TRISA2 : 1; unsigned TRISA3 : 1; unsigned TRISA4 : 1; unsigned TRISA5 : 1; unsigned TRISA6 : 1; unsigned TRISA7 : 1; }; struct { unsigned RA0 : 1; unsigned RA1 : 1; unsigned RA2 : 1; unsigned RA3 : 1; unsigned RA4 : 1; unsigned RA5 : 1; unsigned RA6 : 1; unsigned RA7 : 1; }; } __DDRAbits_t; extern __at(0x0F92) volatile __DDRAbits_t DDRAbits; #define _TRISA0 0x01 #define _RA0 0x01 #define _TRISA1 0x02 #define _RA1 0x02 #define _TRISA2 0x04 #define _RA2 0x04 #define _TRISA3 0x08 #define _RA3 0x08 #define _TRISA4 0x10 #define _RA4 0x10 #define _TRISA5 0x20 #define _RA5 0x20 #define _TRISA6 0x40 #define _RA6 0x40 #define _TRISA7 0x80 #define _RA7 0x80 //============================================================================== //============================================================================== // TRISA Bits extern __at(0x0F92) __sfr TRISA; typedef union { struct { unsigned TRISA0 : 1; unsigned TRISA1 : 1; unsigned TRISA2 : 1; unsigned TRISA3 : 1; unsigned TRISA4 : 1; unsigned TRISA5 : 1; unsigned TRISA6 : 1; unsigned TRISA7 : 1; }; struct { unsigned RA0 : 1; unsigned RA1 : 1; unsigned RA2 : 1; unsigned RA3 : 1; unsigned RA4 : 1; unsigned RA5 : 1; unsigned RA6 : 1; unsigned RA7 : 1; }; } __TRISAbits_t; extern __at(0x0F92) volatile __TRISAbits_t TRISAbits; #define _TRISA_TRISA0 0x01 #define _TRISA_RA0 0x01 #define _TRISA_TRISA1 0x02 #define _TRISA_RA1 0x02 #define _TRISA_TRISA2 0x04 #define _TRISA_RA2 0x04 #define _TRISA_TRISA3 0x08 #define _TRISA_RA3 0x08 #define _TRISA_TRISA4 0x10 #define _TRISA_RA4 0x10 #define _TRISA_TRISA5 0x20 #define _TRISA_RA5 0x20 #define _TRISA_TRISA6 0x40 #define _TRISA_RA6 0x40 #define _TRISA_TRISA7 0x80 #define _TRISA_RA7 0x80 //============================================================================== //============================================================================== // DDRB Bits extern __at(0x0F93) __sfr DDRB; typedef union { struct { unsigned TRISB0 : 1; unsigned TRISB1 : 1; unsigned TRISB2 : 1; unsigned TRISB3 : 1; unsigned TRISB4 : 1; unsigned TRISB5 : 1; unsigned TRISB6 : 1; unsigned TRISB7 : 1; }; struct { unsigned RB0 : 1; unsigned RB1 : 1; unsigned RB2 : 1; unsigned RB3 : 1; unsigned RB4 : 1; unsigned RB5 : 1; unsigned RB6 : 1; unsigned RB7 : 1; }; } __DDRBbits_t; extern __at(0x0F93) volatile __DDRBbits_t DDRBbits; #define _TRISB0 0x01 #define _RB0 0x01 #define _TRISB1 0x02 #define _RB1 0x02 #define _TRISB2 0x04 #define _RB2 0x04 #define _TRISB3 0x08 #define _RB3 0x08 #define _TRISB4 0x10 #define _RB4 0x10 #define _TRISB5 0x20 #define _RB5 0x20 #define _TRISB6 0x40 #define _RB6 0x40 #define _TRISB7 0x80 #define _RB7 0x80 //============================================================================== //============================================================================== // TRISB Bits extern __at(0x0F93) __sfr TRISB; typedef union { struct { unsigned TRISB0 : 1; unsigned TRISB1 : 1; unsigned TRISB2 : 1; unsigned TRISB3 : 1; unsigned TRISB4 : 1; unsigned TRISB5 : 1; unsigned TRISB6 : 1; unsigned TRISB7 : 1; }; struct { unsigned RB0 : 1; unsigned RB1 : 1; unsigned RB2 : 1; unsigned RB3 : 1; unsigned RB4 : 1; unsigned RB5 : 1; unsigned RB6 : 1; unsigned RB7 : 1; }; } __TRISBbits_t; extern __at(0x0F93) volatile __TRISBbits_t TRISBbits; #define _TRISB_TRISB0 0x01 #define _TRISB_RB0 0x01 #define _TRISB_TRISB1 0x02 #define _TRISB_RB1 0x02 #define _TRISB_TRISB2 0x04 #define _TRISB_RB2 0x04 #define _TRISB_TRISB3 0x08 #define _TRISB_RB3 0x08 #define _TRISB_TRISB4 0x10 #define _TRISB_RB4 0x10 #define _TRISB_TRISB5 0x20 #define _TRISB_RB5 0x20 #define _TRISB_TRISB6 0x40 #define _TRISB_RB6 0x40 #define _TRISB_TRISB7 0x80 #define _TRISB_RB7 0x80 //============================================================================== //============================================================================== // DDRC Bits extern __at(0x0F94) __sfr DDRC; typedef union { struct { unsigned TRISC0 : 1; unsigned TRISC1 : 1; unsigned TRISC2 : 1; unsigned TRISC3 : 1; unsigned TRISC4 : 1; unsigned TRISC5 : 1; unsigned TRISC6 : 1; unsigned TRISC7 : 1; }; struct { unsigned RC0 : 1; unsigned RC1 : 1; unsigned RC2 : 1; unsigned RC3 : 1; unsigned RC4 : 1; unsigned RC5 : 1; unsigned RC6 : 1; unsigned RC7 : 1; }; } __DDRCbits_t; extern __at(0x0F94) volatile __DDRCbits_t DDRCbits; #define _TRISC0 0x01 #define _RC0 0x01 #define _TRISC1 0x02 #define _RC1 0x02 #define _TRISC2 0x04 #define _RC2 0x04 #define _TRISC3 0x08 #define _RC3 0x08 #define _TRISC4 0x10 #define _RC4 0x10 #define _TRISC5 0x20 #define _RC5 0x20 #define _TRISC6 0x40 #define _RC6 0x40 #define _TRISC7 0x80 #define _RC7 0x80 //============================================================================== //============================================================================== // TRISC Bits extern __at(0x0F94) __sfr TRISC; typedef union { struct { unsigned TRISC0 : 1; unsigned TRISC1 : 1; unsigned TRISC2 : 1; unsigned TRISC3 : 1; unsigned TRISC4 : 1; unsigned TRISC5 : 1; unsigned TRISC6 : 1; unsigned TRISC7 : 1; }; struct { unsigned RC0 : 1; unsigned RC1 : 1; unsigned RC2 : 1; unsigned RC3 : 1; unsigned RC4 : 1; unsigned RC5 : 1; unsigned RC6 : 1; unsigned RC7 : 1; }; } __TRISCbits_t; extern __at(0x0F94) volatile __TRISCbits_t TRISCbits; #define _TRISC_TRISC0 0x01 #define _TRISC_RC0 0x01 #define _TRISC_TRISC1 0x02 #define _TRISC_RC1 0x02 #define _TRISC_TRISC2 0x04 #define _TRISC_RC2 0x04 #define _TRISC_TRISC3 0x08 #define _TRISC_RC3 0x08 #define _TRISC_TRISC4 0x10 #define _TRISC_RC4 0x10 #define _TRISC_TRISC5 0x20 #define _TRISC_RC5 0x20 #define _TRISC_TRISC6 0x40 #define _TRISC_RC6 0x40 #define _TRISC_TRISC7 0x80 #define _TRISC_RC7 0x80 //============================================================================== //============================================================================== // DDRD Bits extern __at(0x0F95) __sfr DDRD; typedef union { struct { unsigned TRISD0 : 1; unsigned TRISD1 : 1; unsigned TRISD2 : 1; unsigned TRISD3 : 1; unsigned TRISD4 : 1; unsigned TRISD5 : 1; unsigned TRISD6 : 1; unsigned TRISD7 : 1; }; struct { unsigned RD0 : 1; unsigned RD1 : 1; unsigned RD2 : 1; unsigned RD3 : 1; unsigned RD4 : 1; unsigned RD5 : 1; unsigned RD6 : 1; unsigned RD7 : 1; }; } __DDRDbits_t; extern __at(0x0F95) volatile __DDRDbits_t DDRDbits; #define _TRISD0 0x01 #define _RD0 0x01 #define _TRISD1 0x02 #define _RD1 0x02 #define _TRISD2 0x04 #define _RD2 0x04 #define _TRISD3 0x08 #define _RD3 0x08 #define _TRISD4 0x10 #define _RD4 0x10 #define _TRISD5 0x20 #define _RD5 0x20 #define _TRISD6 0x40 #define _RD6 0x40 #define _TRISD7 0x80 #define _RD7 0x80 //============================================================================== //============================================================================== // TRISD Bits extern __at(0x0F95) __sfr TRISD; typedef union { struct { unsigned TRISD0 : 1; unsigned TRISD1 : 1; unsigned TRISD2 : 1; unsigned TRISD3 : 1; unsigned TRISD4 : 1; unsigned TRISD5 : 1; unsigned TRISD6 : 1; unsigned TRISD7 : 1; }; struct { unsigned RD0 : 1; unsigned RD1 : 1; unsigned RD2 : 1; unsigned RD3 : 1; unsigned RD4 : 1; unsigned RD5 : 1; unsigned RD6 : 1; unsigned RD7 : 1; }; } __TRISDbits_t; extern __at(0x0F95) volatile __TRISDbits_t TRISDbits; #define _TRISD_TRISD0 0x01 #define _TRISD_RD0 0x01 #define _TRISD_TRISD1 0x02 #define _TRISD_RD1 0x02 #define _TRISD_TRISD2 0x04 #define _TRISD_RD2 0x04 #define _TRISD_TRISD3 0x08 #define _TRISD_RD3 0x08 #define _TRISD_TRISD4 0x10 #define _TRISD_RD4 0x10 #define _TRISD_TRISD5 0x20 #define _TRISD_RD5 0x20 #define _TRISD_TRISD6 0x40 #define _TRISD_RD6 0x40 #define _TRISD_TRISD7 0x80 #define _TRISD_RD7 0x80 //============================================================================== //============================================================================== // DDRE Bits extern __at(0x0F96) __sfr DDRE; typedef union { struct { unsigned TRISE0 : 1; unsigned TRISE1 : 1; unsigned TRISE2 : 1; unsigned TRISE3 : 1; unsigned TRISE4 : 1; unsigned TRISE5 : 1; unsigned TRISE6 : 1; unsigned TRISE7 : 1; }; struct { unsigned RE0 : 1; unsigned RE1 : 1; unsigned RE2 : 1; unsigned RE3 : 1; unsigned RE4 : 1; unsigned RE5 : 1; unsigned RE6 : 1; unsigned RE7 : 1; }; } __DDREbits_t; extern __at(0x0F96) volatile __DDREbits_t DDREbits; #define _TRISE0 0x01 #define _RE0 0x01 #define _TRISE1 0x02 #define _RE1 0x02 #define _TRISE2 0x04 #define _RE2 0x04 #define _TRISE3 0x08 #define _RE3 0x08 #define _TRISE4 0x10 #define _RE4 0x10 #define _TRISE5 0x20 #define _RE5 0x20 #define _TRISE6 0x40 #define _RE6 0x40 #define _TRISE7 0x80 #define _RE7 0x80 //============================================================================== //============================================================================== // TRISE Bits extern __at(0x0F96) __sfr TRISE; typedef union { struct { unsigned TRISE0 : 1; unsigned TRISE1 : 1; unsigned TRISE2 : 1; unsigned TRISE3 : 1; unsigned TRISE4 : 1; unsigned TRISE5 : 1; unsigned TRISE6 : 1; unsigned TRISE7 : 1; }; struct { unsigned RE0 : 1; unsigned RE1 : 1; unsigned RE2 : 1; unsigned RE3 : 1; unsigned RE4 : 1; unsigned RE5 : 1; unsigned RE6 : 1; unsigned RE7 : 1; }; } __TRISEbits_t; extern __at(0x0F96) volatile __TRISEbits_t TRISEbits; #define _TRISE_TRISE0 0x01 #define _TRISE_RE0 0x01 #define _TRISE_TRISE1 0x02 #define _TRISE_RE1 0x02 #define _TRISE_TRISE2 0x04 #define _TRISE_RE2 0x04 #define _TRISE_TRISE3 0x08 #define _TRISE_RE3 0x08 #define _TRISE_TRISE4 0x10 #define _TRISE_RE4 0x10 #define _TRISE_TRISE5 0x20 #define _TRISE_RE5 0x20 #define _TRISE_TRISE6 0x40 #define _TRISE_RE6 0x40 #define _TRISE_TRISE7 0x80 #define _TRISE_RE7 0x80 //============================================================================== //============================================================================== // DDRF Bits extern __at(0x0F97) __sfr DDRF; typedef union { struct { unsigned TRISF0 : 1; unsigned TRISF1 : 1; unsigned TRISF2 : 1; unsigned TRISF3 : 1; unsigned TRISF4 : 1; unsigned TRISF5 : 1; unsigned TRISF6 : 1; unsigned TRISF7 : 1; }; struct { unsigned RF0 : 1; unsigned RF1 : 1; unsigned RF2 : 1; unsigned RF3 : 1; unsigned RF4 : 1; unsigned RF5 : 1; unsigned RF6 : 1; unsigned RF7 : 1; }; } __DDRFbits_t; extern __at(0x0F97) volatile __DDRFbits_t DDRFbits; #define _TRISF0 0x01 #define _RF0 0x01 #define _TRISF1 0x02 #define _RF1 0x02 #define _TRISF2 0x04 #define _RF2 0x04 #define _TRISF3 0x08 #define _RF3 0x08 #define _TRISF4 0x10 #define _RF4 0x10 #define _TRISF5 0x20 #define _RF5 0x20 #define _TRISF6 0x40 #define _RF6 0x40 #define _TRISF7 0x80 #define _RF7 0x80 //============================================================================== //============================================================================== // TRISF Bits extern __at(0x0F97) __sfr TRISF; typedef union { struct { unsigned TRISF0 : 1; unsigned TRISF1 : 1; unsigned TRISF2 : 1; unsigned TRISF3 : 1; unsigned TRISF4 : 1; unsigned TRISF5 : 1; unsigned TRISF6 : 1; unsigned TRISF7 : 1; }; struct { unsigned RF0 : 1; unsigned RF1 : 1; unsigned RF2 : 1; unsigned RF3 : 1; unsigned RF4 : 1; unsigned RF5 : 1; unsigned RF6 : 1; unsigned RF7 : 1; }; } __TRISFbits_t; extern __at(0x0F97) volatile __TRISFbits_t TRISFbits; #define _TRISF_TRISF0 0x01 #define _TRISF_RF0 0x01 #define _TRISF_TRISF1 0x02 #define _TRISF_RF1 0x02 #define _TRISF_TRISF2 0x04 #define _TRISF_RF2 0x04 #define _TRISF_TRISF3 0x08 #define _TRISF_RF3 0x08 #define _TRISF_TRISF4 0x10 #define _TRISF_RF4 0x10 #define _TRISF_TRISF5 0x20 #define _TRISF_RF5 0x20 #define _TRISF_TRISF6 0x40 #define _TRISF_RF6 0x40 #define _TRISF_TRISF7 0x80 #define _TRISF_RF7 0x80 //============================================================================== //============================================================================== // DDRG Bits extern __at(0x0F98) __sfr DDRG; typedef union { struct { unsigned TRISG0 : 1; unsigned TRISG1 : 1; unsigned TRISG2 : 1; unsigned TRISG3 : 1; unsigned TRISG4 : 1; unsigned : 1; unsigned : 1; unsigned : 1; }; struct { unsigned RG0 : 1; unsigned RG1 : 1; unsigned RG2 : 1; unsigned RG3 : 1; unsigned RG4 : 1; unsigned : 1; unsigned : 1; unsigned : 1; }; struct { unsigned RG : 5; unsigned : 3; }; struct { unsigned TRISG : 5; unsigned : 3; }; } __DDRGbits_t; extern __at(0x0F98) volatile __DDRGbits_t DDRGbits; #define _TRISG0 0x01 #define _RG0 0x01 #define _TRISG1 0x02 #define _RG1 0x02 #define _TRISG2 0x04 #define _RG2 0x04 #define _TRISG3 0x08 #define _RG3 0x08 #define _TRISG4 0x10 #define _RG4 0x10 //============================================================================== //============================================================================== // TRISG Bits extern __at(0x0F98) __sfr TRISG; typedef union { struct { unsigned TRISG0 : 1; unsigned TRISG1 : 1; unsigned TRISG2 : 1; unsigned TRISG3 : 1; unsigned TRISG4 : 1; unsigned : 1; unsigned : 1; unsigned : 1; }; struct { unsigned RG0 : 1; unsigned RG1 : 1; unsigned RG2 : 1; unsigned RG3 : 1; unsigned RG4 : 1; unsigned : 1; unsigned : 1; unsigned : 1; }; struct { unsigned RG : 5; unsigned : 3; }; struct { unsigned TRISG : 5; unsigned : 3; }; } __TRISGbits_t; extern __at(0x0F98) volatile __TRISGbits_t TRISGbits; #define _TRISG_TRISG0 0x01 #define _TRISG_RG0 0x01 #define _TRISG_TRISG1 0x02 #define _TRISG_RG1 0x02 #define _TRISG_TRISG2 0x04 #define _TRISG_RG2 0x04 #define _TRISG_TRISG3 0x08 #define _TRISG_RG3 0x08 #define _TRISG_TRISG4 0x10 #define _TRISG_RG4 0x10 //============================================================================== //============================================================================== // OSCTUNE Bits extern __at(0x0F9B) __sfr OSCTUNE; typedef union { struct { unsigned TUN0 : 1; unsigned TUN1 : 1; unsigned TUN2 : 1; unsigned TUN3 : 1; unsigned TUN4 : 1; unsigned : 1; unsigned PLLEN : 1; unsigned INTSRC : 1; }; struct { unsigned TUN : 5; unsigned : 3; }; } __OSCTUNEbits_t; extern __at(0x0F9B) volatile __OSCTUNEbits_t OSCTUNEbits; #define _TUN0 0x01 #define _TUN1 0x02 #define _TUN2 0x04 #define _TUN3 0x08 #define _TUN4 0x10 #define _PLLEN 0x40 #define _INTSRC 0x80 //============================================================================== //============================================================================== // PIE1 Bits extern __at(0x0F9D) __sfr PIE1; typedef union { struct { unsigned TMR1IE : 1; unsigned TMR2IE : 1; unsigned CCP1IE : 1; unsigned SSP1IE : 1; unsigned TX1IE : 1; unsigned RC1IE : 1; unsigned ADIE : 1; unsigned PSPIE : 1; }; struct { unsigned : 1; unsigned : 1; unsigned : 1; unsigned SSPIE : 1; unsigned TXIE : 1; unsigned RCIE : 1; unsigned : 1; unsigned : 1; }; } __PIE1bits_t; extern __at(0x0F9D) volatile __PIE1bits_t PIE1bits; #define _TMR1IE 0x01 #define _TMR2IE 0x02 #define _CCP1IE 0x04 #define _SSP1IE 0x08 #define _SSPIE 0x08 #define _TX1IE 0x10 #define _TXIE 0x10 #define _RC1IE 0x20 #define _RCIE 0x20 #define _ADIE 0x40 #define _PSPIE 0x80 //============================================================================== //============================================================================== // PIR1 Bits extern __at(0x0F9E) __sfr PIR1; typedef union { struct { unsigned TMR1IF : 1; unsigned TMR2IF : 1; unsigned CCP1IF : 1; unsigned SSP1IF : 1; unsigned TX1IF : 1; unsigned RC1IF : 1; unsigned ADIF : 1; unsigned PSPIF : 1; }; struct { unsigned : 1; unsigned : 1; unsigned : 1; unsigned SSPIF : 1; unsigned TXIF : 1; unsigned RCIF : 1; unsigned : 1; unsigned : 1; }; } __PIR1bits_t; extern __at(0x0F9E) volatile __PIR1bits_t PIR1bits; #define _TMR1IF 0x01 #define _TMR2IF 0x02 #define _CCP1IF 0x04 #define _SSP1IF 0x08 #define _SSPIF 0x08 #define _TX1IF 0x10 #define _TXIF 0x10 #define _RC1IF 0x20 #define _RCIF 0x20 #define _ADIF 0x40 #define _PSPIF 0x80 //============================================================================== //============================================================================== // IPR1 Bits extern __at(0x0F9F) __sfr IPR1; typedef union { struct { unsigned TMR1IP : 1; unsigned TMR2IP : 1; unsigned CCP1IP : 1; unsigned SSP1IP : 1; unsigned TX1IP : 1; unsigned RC1IP : 1; unsigned ADIP : 1; unsigned PSPIP : 1; }; struct { unsigned : 1; unsigned : 1; unsigned : 1; unsigned SSPIP : 1; unsigned TXIP : 1; unsigned RCIP : 1; unsigned : 1; unsigned : 1; }; } __IPR1bits_t; extern __at(0x0F9F) volatile __IPR1bits_t IPR1bits; #define _TMR1IP 0x01 #define _TMR2IP 0x02 #define _CCP1IP 0x04 #define _SSP1IP 0x08 #define _SSPIP 0x08 #define _TX1IP 0x10 #define _TXIP 0x10 #define _RC1IP 0x20 #define _RCIP 0x20 #define _ADIP 0x40 #define _PSPIP 0x80 //============================================================================== //============================================================================== // PIE2 Bits extern __at(0x0FA0) __sfr PIE2; typedef union { struct { unsigned CCP2IE : 1; unsigned TMR3IE : 1; unsigned HLVDIE : 1; unsigned BCL1IE : 1; unsigned EEIE : 1; unsigned : 1; unsigned CMIE : 1; unsigned OSCFIE : 1; }; struct { unsigned : 1; unsigned : 1; unsigned LVDIE : 1; unsigned BCLIE : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; }; } __PIE2bits_t; extern __at(0x0FA0) volatile __PIE2bits_t PIE2bits; #define _CCP2IE 0x01 #define _TMR3IE 0x02 #define _HLVDIE 0x04 #define _LVDIE 0x04 #define _BCL1IE 0x08 #define _BCLIE 0x08 #define _EEIE 0x10 #define _CMIE 0x40 #define _OSCFIE 0x80 //============================================================================== //============================================================================== // PIR2 Bits extern __at(0x0FA1) __sfr PIR2; typedef union { struct { unsigned CCP2IF : 1; unsigned TMR3IF : 1; unsigned HLVDIF : 1; unsigned BCL1IF : 1; unsigned EEIF : 1; unsigned : 1; unsigned CMIF : 1; unsigned OSCFIF : 1; }; struct { unsigned : 1; unsigned : 1; unsigned LVDIF : 1; unsigned BCLIF : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; }; } __PIR2bits_t; extern __at(0x0FA1) volatile __PIR2bits_t PIR2bits; #define _CCP2IF 0x01 #define _TMR3IF 0x02 #define _HLVDIF 0x04 #define _LVDIF 0x04 #define _BCL1IF 0x08 #define _BCLIF 0x08 #define _EEIF 0x10 #define _CMIF 0x40 #define _OSCFIF 0x80 //============================================================================== //============================================================================== // IPR2 Bits extern __at(0x0FA2) __sfr IPR2; typedef union { struct { unsigned CCP2IP : 1; unsigned TMR3IP : 1; unsigned HLVDIP : 1; unsigned BCL1IP : 1; unsigned EEIP : 1; unsigned : 1; unsigned CMIP : 1; unsigned OSCFIP : 1; }; struct { unsigned : 1; unsigned : 1; unsigned LVDIP : 1; unsigned BCLIP : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; }; } __IPR2bits_t; extern __at(0x0FA2) volatile __IPR2bits_t IPR2bits; #define _CCP2IP 0x01 #define _TMR3IP 0x02 #define _HLVDIP 0x04 #define _LVDIP 0x04 #define _BCL1IP 0x08 #define _BCLIP 0x08 #define _EEIP 0x10 #define _CMIP 0x40 #define _OSCFIP 0x80 //============================================================================== //============================================================================== // PIE3 Bits extern __at(0x0FA3) __sfr PIE3; typedef struct { unsigned CCP3IE : 1; unsigned CCP4IE : 1; unsigned CCP5IE : 1; unsigned TMR4IE : 1; unsigned TX2IE : 1; unsigned RC2IE : 1; unsigned BCL2IE : 1; unsigned SSP2IE : 1; } __PIE3bits_t; extern __at(0x0FA3) volatile __PIE3bits_t PIE3bits; #define _CCP3IE 0x01 #define _CCP4IE 0x02 #define _CCP5IE 0x04 #define _TMR4IE 0x08 #define _TX2IE 0x10 #define _RC2IE 0x20 #define _BCL2IE 0x40 #define _SSP2IE 0x80 //============================================================================== //============================================================================== // PIR3 Bits extern __at(0x0FA4) __sfr PIR3; typedef struct { unsigned CCP3IF : 1; unsigned CCP4IF : 1; unsigned CCP5IF : 1; unsigned TMR4IF : 1; unsigned TX2IF : 1; unsigned RC2IF : 1; unsigned BCL2IF : 1; unsigned SSP2IF : 1; } __PIR3bits_t; extern __at(0x0FA4) volatile __PIR3bits_t PIR3bits; #define _CCP3IF 0x01 #define _CCP4IF 0x02 #define _CCP5IF 0x04 #define _TMR4IF 0x08 #define _TX2IF 0x10 #define _RC2IF 0x20 #define _BCL2IF 0x40 #define _SSP2IF 0x80 //============================================================================== //============================================================================== // IPR3 Bits extern __at(0x0FA5) __sfr IPR3; typedef struct { unsigned CCP3IP : 1; unsigned CCP4IP : 1; unsigned CCP5IP : 1; unsigned TMR4IP : 1; unsigned TX2IP : 1; unsigned RC2IP : 1; unsigned BCL2IP : 1; unsigned SSP2IP : 1; } __IPR3bits_t; extern __at(0x0FA5) volatile __IPR3bits_t IPR3bits; #define _CCP3IP 0x01 #define _CCP4IP 0x02 #define _CCP5IP 0x04 #define _TMR4IP 0x08 #define _TX2IP 0x10 #define _RC2IP 0x20 #define _BCL2IP 0x40 #define _SSP2IP 0x80 //============================================================================== //============================================================================== // EECON1 Bits extern __at(0x0FA6) __sfr EECON1; typedef struct { unsigned RD : 1; unsigned WR : 1; unsigned WREN : 1; unsigned WRERR : 1; unsigned FREE : 1; unsigned : 1; unsigned CFGS : 1; unsigned EEPGD : 1; } __EECON1bits_t; extern __at(0x0FA6) volatile __EECON1bits_t EECON1bits; #define _RD 0x01 #define _WR 0x02 #define _WREN 0x04 #define _WRERR 0x08 #define _FREE 0x10 #define _CFGS 0x40 #define _EEPGD 0x80 //============================================================================== extern __at(0x0FA7) __sfr EECON2; extern __at(0x0FA8) __sfr EEDATA; extern __at(0x0FA9) __sfr EEADR; extern __at(0x0FAA) __sfr EEADRH; //============================================================================== // RCSTA Bits extern __at(0x0FAB) __sfr RCSTA; typedef union { struct { unsigned RX9D : 1; unsigned OERR : 1; unsigned FERR : 1; unsigned ADDEN : 1; unsigned CREN : 1; unsigned SREN : 1; unsigned RX9 : 1; unsigned SPEN : 1; }; struct { unsigned RCD8 : 1; unsigned OERR1 : 1; unsigned FERR1 : 1; unsigned ADDEN1 : 1; unsigned CREN1 : 1; unsigned SREN1 : 1; unsigned RC9 : 1; unsigned SPEN1 : 1; }; struct { unsigned RX9D1 : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned NOT_RC8 : 1; unsigned : 1; }; struct { unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned RC8_9 : 1; unsigned : 1; }; struct { unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned RX91 : 1; unsigned : 1; }; } __RCSTAbits_t; extern __at(0x0FAB) volatile __RCSTAbits_t RCSTAbits; #define _RX9D 0x01 #define _RCD8 0x01 #define _RX9D1 0x01 #define _OERR 0x02 #define _OERR1 0x02 #define _FERR 0x04 #define _FERR1 0x04 #define _ADDEN 0x08 #define _ADDEN1 0x08 #define _CREN 0x10 #define _CREN1 0x10 #define _SREN 0x20 #define _SREN1 0x20 #define _RX9 0x40 #define _RC9 0x40 #define _NOT_RC8 0x40 #define _RC8_9 0x40 #define _RX91 0x40 #define _SPEN 0x80 #define _SPEN1 0x80 //============================================================================== //============================================================================== // RCSTA1 Bits extern __at(0x0FAB) __sfr RCSTA1; typedef union { struct { unsigned RX9D : 1; unsigned OERR : 1; unsigned FERR : 1; unsigned ADDEN : 1; unsigned CREN : 1; unsigned SREN : 1; unsigned RX9 : 1; unsigned SPEN : 1; }; struct { unsigned RCD8 : 1; unsigned OERR1 : 1; unsigned FERR1 : 1; unsigned ADDEN1 : 1; unsigned CREN1 : 1; unsigned SREN1 : 1; unsigned RC9 : 1; unsigned SPEN1 : 1; }; struct { unsigned RX9D1 : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned NOT_RC8 : 1; unsigned : 1; }; struct { unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned RC8_9 : 1; unsigned : 1; }; struct { unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned RX91 : 1; unsigned : 1; }; } __RCSTA1bits_t; extern __at(0x0FAB) volatile __RCSTA1bits_t RCSTA1bits; #define _RCSTA1_RX9D 0x01 #define _RCSTA1_RCD8 0x01 #define _RCSTA1_RX9D1 0x01 #define _RCSTA1_OERR 0x02 #define _RCSTA1_OERR1 0x02 #define _RCSTA1_FERR 0x04 #define _RCSTA1_FERR1 0x04 #define _RCSTA1_ADDEN 0x08 #define _RCSTA1_ADDEN1 0x08 #define _RCSTA1_CREN 0x10 #define _RCSTA1_CREN1 0x10 #define _RCSTA1_SREN 0x20 #define _RCSTA1_SREN1 0x20 #define _RCSTA1_RX9 0x40 #define _RCSTA1_RC9 0x40 #define _RCSTA1_NOT_RC8 0x40 #define _RCSTA1_RC8_9 0x40 #define _RCSTA1_RX91 0x40 #define _RCSTA1_SPEN 0x80 #define _RCSTA1_SPEN1 0x80 //============================================================================== //============================================================================== // TXSTA Bits extern __at(0x0FAC) __sfr TXSTA; typedef union { struct { unsigned TX9D : 1; unsigned TRMT : 1; unsigned BRGH : 1; unsigned SENDB : 1; unsigned SYNC : 1; unsigned TXEN : 1; unsigned TX9 : 1; unsigned CSRC : 1; }; struct { unsigned TXD8 : 1; unsigned TRMT1 : 1; unsigned BRGH1 : 1; unsigned SENDB1 : 1; unsigned SYNC1 : 1; unsigned TXEN1 : 1; unsigned TX8_9 : 1; unsigned CSRC1 : 1; }; struct { unsigned TX9D1 : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned NOT_TX8 : 1; unsigned : 1; }; struct { unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned TX91 : 1; unsigned : 1; }; } __TXSTAbits_t; extern __at(0x0FAC) volatile __TXSTAbits_t TXSTAbits; #define _TX9D 0x01 #define _TXD8 0x01 #define _TX9D1 0x01 #define _TRMT 0x02 #define _TRMT1 0x02 #define _BRGH 0x04 #define _BRGH1 0x04 #define _SENDB 0x08 #define _SENDB1 0x08 #define _SYNC 0x10 #define _SYNC1 0x10 #define _TXEN 0x20 #define _TXEN1 0x20 #define _TX9 0x40 #define _TX8_9 0x40 #define _NOT_TX8 0x40 #define _TX91 0x40 #define _CSRC 0x80 #define _CSRC1 0x80 //============================================================================== //============================================================================== // TXSTA1 Bits extern __at(0x0FAC) __sfr TXSTA1; typedef union { struct { unsigned TX9D : 1; unsigned TRMT : 1; unsigned BRGH : 1; unsigned SENDB : 1; unsigned SYNC : 1; unsigned TXEN : 1; unsigned TX9 : 1; unsigned CSRC : 1; }; struct { unsigned TXD8 : 1; unsigned TRMT1 : 1; unsigned BRGH1 : 1; unsigned SENDB1 : 1; unsigned SYNC1 : 1; unsigned TXEN1 : 1; unsigned TX8_9 : 1; unsigned CSRC1 : 1; }; struct { unsigned TX9D1 : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned NOT_TX8 : 1; unsigned : 1; }; struct { unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned TX91 : 1; unsigned : 1; }; } __TXSTA1bits_t; extern __at(0x0FAC) volatile __TXSTA1bits_t TXSTA1bits; #define _TXSTA1_TX9D 0x01 #define _TXSTA1_TXD8 0x01 #define _TXSTA1_TX9D1 0x01 #define _TXSTA1_TRMT 0x02 #define _TXSTA1_TRMT1 0x02 #define _TXSTA1_BRGH 0x04 #define _TXSTA1_BRGH1 0x04 #define _TXSTA1_SENDB 0x08 #define _TXSTA1_SENDB1 0x08 #define _TXSTA1_SYNC 0x10 #define _TXSTA1_SYNC1 0x10 #define _TXSTA1_TXEN 0x20 #define _TXSTA1_TXEN1 0x20 #define _TXSTA1_TX9 0x40 #define _TXSTA1_TX8_9 0x40 #define _TXSTA1_NOT_TX8 0x40 #define _TXSTA1_TX91 0x40 #define _TXSTA1_CSRC 0x80 #define _TXSTA1_CSRC1 0x80 //============================================================================== extern __at(0x0FAD) __sfr TXREG; extern __at(0x0FAD) __sfr TXREG1; extern __at(0x0FAE) __sfr RCREG; extern __at(0x0FAE) __sfr RCREG1; extern __at(0x0FAF) __sfr SPBRG; extern __at(0x0FAF) __sfr SPBRG1; //============================================================================== // PSPCON Bits extern __at(0x0FB0) __sfr PSPCON; typedef struct { unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned PSPMODE : 1; unsigned IBOV : 1; unsigned OBF : 1; unsigned IBF : 1; } __PSPCONbits_t; extern __at(0x0FB0) volatile __PSPCONbits_t PSPCONbits; #define _PSPMODE 0x10 #define _IBOV 0x20 #define _OBF 0x40 #define _IBF 0x80 //============================================================================== //============================================================================== // T3CON Bits extern __at(0x0FB1) __sfr T3CON; typedef union { struct { unsigned TMR3ON : 1; unsigned TMR3CS : 1; unsigned NOT_T3SYNC : 1; unsigned T3CCP1 : 1; unsigned T3CKPS0 : 1; unsigned T3CKPS1 : 1; unsigned T3CCP2 : 1; unsigned RD16 : 1; }; struct { unsigned : 1; unsigned : 1; unsigned T3SYNC : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; }; struct { unsigned : 1; unsigned : 1; unsigned T3INSYNC : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; }; struct { unsigned : 4; unsigned T3CKPS : 2; unsigned : 2; }; } __T3CONbits_t; extern __at(0x0FB1) volatile __T3CONbits_t T3CONbits; #define _T3CON_TMR3ON 0x01 #define _T3CON_TMR3CS 0x02 #define _T3CON_NOT_T3SYNC 0x04 #define _T3CON_T3SYNC 0x04 #define _T3CON_T3INSYNC 0x04 #define _T3CON_T3CCP1 0x08 #define _T3CON_T3CKPS0 0x10 #define _T3CON_T3CKPS1 0x20 #define _T3CON_T3CCP2 0x40 #define _T3CON_RD16 0x80 //============================================================================== extern __at(0x0FB2) __sfr TMR3; extern __at(0x0FB2) __sfr TMR3L; extern __at(0x0FB3) __sfr TMR3H; //============================================================================== // CMCON Bits extern __at(0x0FB4) __sfr CMCON; typedef union { struct { unsigned CM0 : 1; unsigned CM1 : 1; unsigned CM2 : 1; unsigned CIS : 1; unsigned C1INV : 1; unsigned C2INV : 1; unsigned C1OUT : 1; unsigned C2OUT : 1; }; struct { unsigned CM : 3; unsigned : 5; }; } __CMCONbits_t; extern __at(0x0FB4) volatile __CMCONbits_t CMCONbits; #define _CM0 0x01 #define _CM1 0x02 #define _CM2 0x04 #define _CIS 0x08 #define _C1INV 0x10 #define _C2INV 0x20 #define _C1OUT 0x40 #define _C2OUT 0x80 //============================================================================== //============================================================================== // CVRCON Bits extern __at(0x0FB5) __sfr CVRCON; typedef union { struct { unsigned CVR0 : 1; unsigned CVR1 : 1; unsigned CVR2 : 1; unsigned CVR3 : 1; unsigned CVRSS : 1; unsigned CVRR : 1; unsigned CVROE : 1; unsigned CVREN : 1; }; struct { unsigned CVR : 4; unsigned : 4; }; } __CVRCONbits_t; extern __at(0x0FB5) volatile __CVRCONbits_t CVRCONbits; #define _CVR0 0x01 #define _CVR1 0x02 #define _CVR2 0x04 #define _CVR3 0x08 #define _CVRSS 0x10 #define _CVRR 0x20 #define _CVROE 0x40 #define _CVREN 0x80 //============================================================================== //============================================================================== // ECCP1AS Bits extern __at(0x0FB6) __sfr ECCP1AS; typedef union { struct { unsigned PSS1BD0 : 1; unsigned PSS1BD1 : 1; unsigned PSS1AC0 : 1; unsigned PSS1AC1 : 1; unsigned ECCP1AS0 : 1; unsigned ECCP1AS1 : 1; unsigned ECCP1AS2 : 1; unsigned ECCP1ASE : 1; }; struct { unsigned PSSBD0 : 1; unsigned PSSBD1 : 1; unsigned PSSAC0 : 1; unsigned PSSAC1 : 1; unsigned ECCPAS0 : 1; unsigned ECCPAS1 : 1; unsigned ECCPAS2 : 1; unsigned ECCPASE : 1; }; struct { unsigned PSS1BD : 2; unsigned : 6; }; struct { unsigned PSSBD : 2; unsigned : 6; }; struct { unsigned : 2; unsigned PSS1AC : 2; unsigned : 4; }; struct { unsigned : 2; unsigned PSSAC : 2; unsigned : 4; }; struct { unsigned : 4; unsigned ECCPAS : 3; unsigned : 1; }; struct { unsigned : 4; unsigned ECCP1AS : 3; unsigned : 1; }; } __ECCP1ASbits_t; extern __at(0x0FB6) volatile __ECCP1ASbits_t ECCP1ASbits; #define _PSS1BD0 0x01 #define _PSSBD0 0x01 #define _PSS1BD1 0x02 #define _PSSBD1 0x02 #define _PSS1AC0 0x04 #define _PSSAC0 0x04 #define _PSS1AC1 0x08 #define _PSSAC1 0x08 #define _ECCP1AS0 0x10 #define _ECCPAS0 0x10 #define _ECCP1AS1 0x20 #define _ECCPAS1 0x20 #define _ECCP1AS2 0x40 #define _ECCPAS2 0x40 #define _ECCP1ASE 0x80 #define _ECCPASE 0x80 //============================================================================== //============================================================================== // CCP3CON Bits extern __at(0x0FB7) __sfr CCP3CON; typedef union { struct { unsigned CCP3M0 : 1; unsigned CCP3M1 : 1; unsigned CCP3M2 : 1; unsigned CCP3M3 : 1; unsigned DC3B0 : 1; unsigned DC3B1 : 1; unsigned P3M0 : 1; unsigned P3M1 : 1; }; struct { unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned CCP3Y : 1; unsigned CCP3X : 1; unsigned : 1; unsigned : 1; }; struct { unsigned CCP3M : 4; unsigned : 4; }; struct { unsigned : 4; unsigned DC3B : 2; unsigned : 2; }; struct { unsigned : 6; unsigned P3M : 2; }; } __CCP3CONbits_t; extern __at(0x0FB7) volatile __CCP3CONbits_t CCP3CONbits; #define _CCP3M0 0x01 #define _CCP3M1 0x02 #define _CCP3M2 0x04 #define _CCP3M3 0x08 #define _DC3B0 0x10 #define _CCP3Y 0x10 #define _DC3B1 0x20 #define _CCP3X 0x20 #define _P3M0 0x40 #define _P3M1 0x80 //============================================================================== //============================================================================== // ECCP3CON Bits extern __at(0x0FB7) __sfr ECCP3CON; typedef union { struct { unsigned CCP3M0 : 1; unsigned CCP3M1 : 1; unsigned CCP3M2 : 1; unsigned CCP3M3 : 1; unsigned DC3B0 : 1; unsigned DC3B1 : 1; unsigned P3M0 : 1; unsigned P3M1 : 1; }; struct { unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned CCP3Y : 1; unsigned CCP3X : 1; unsigned : 1; unsigned : 1; }; struct { unsigned CCP3M : 4; unsigned : 4; }; struct { unsigned : 4; unsigned DC3B : 2; unsigned : 2; }; struct { unsigned : 6; unsigned P3M : 2; }; } __ECCP3CONbits_t; extern __at(0x0FB7) volatile __ECCP3CONbits_t ECCP3CONbits; #define _ECCP3CON_CCP3M0 0x01 #define _ECCP3CON_CCP3M1 0x02 #define _ECCP3CON_CCP3M2 0x04 #define _ECCP3CON_CCP3M3 0x08 #define _ECCP3CON_DC3B0 0x10 #define _ECCP3CON_CCP3Y 0x10 #define _ECCP3CON_DC3B1 0x20 #define _ECCP3CON_CCP3X 0x20 #define _ECCP3CON_P3M0 0x40 #define _ECCP3CON_P3M1 0x80 //============================================================================== extern __at(0x0FB8) __sfr CCPR3; extern __at(0x0FB8) __sfr CCPR3L; extern __at(0x0FB9) __sfr CCPR3H; //============================================================================== // CCP2CON Bits extern __at(0x0FBA) __sfr CCP2CON; typedef union { struct { unsigned CCP2M0 : 1; unsigned CCP2M1 : 1; unsigned CCP2M2 : 1; unsigned CCP2M3 : 1; unsigned DC2B0 : 1; unsigned DC2B1 : 1; unsigned P2M0 : 1; unsigned P2M1 : 1; }; struct { unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned CCP2Y : 1; unsigned CCP2X : 1; unsigned : 1; unsigned : 1; }; struct { unsigned CCP2M : 4; unsigned : 4; }; struct { unsigned : 4; unsigned DC2B : 2; unsigned : 2; }; struct { unsigned : 6; unsigned P2M : 2; }; } __CCP2CONbits_t; extern __at(0x0FBA) volatile __CCP2CONbits_t CCP2CONbits; #define _CCP2M0 0x01 #define _CCP2M1 0x02 #define _CCP2M2 0x04 #define _CCP2M3 0x08 #define _DC2B0 0x10 #define _CCP2Y 0x10 #define _DC2B1 0x20 #define _CCP2X 0x20 #define _P2M0 0x40 #define _P2M1 0x80 //============================================================================== //============================================================================== // ECCP2CON Bits extern __at(0x0FBA) __sfr ECCP2CON; typedef union { struct { unsigned CCP2M0 : 1; unsigned CCP2M1 : 1; unsigned CCP2M2 : 1; unsigned CCP2M3 : 1; unsigned DC2B0 : 1; unsigned DC2B1 : 1; unsigned P2M0 : 1; unsigned P2M1 : 1; }; struct { unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned CCP2Y : 1; unsigned CCP2X : 1; unsigned : 1; unsigned : 1; }; struct { unsigned CCP2M : 4; unsigned : 4; }; struct { unsigned : 4; unsigned DC2B : 2; unsigned : 2; }; struct { unsigned : 6; unsigned P2M : 2; }; } __ECCP2CONbits_t; extern __at(0x0FBA) volatile __ECCP2CONbits_t ECCP2CONbits; #define _ECCP2CON_CCP2M0 0x01 #define _ECCP2CON_CCP2M1 0x02 #define _ECCP2CON_CCP2M2 0x04 #define _ECCP2CON_CCP2M3 0x08 #define _ECCP2CON_DC2B0 0x10 #define _ECCP2CON_CCP2Y 0x10 #define _ECCP2CON_DC2B1 0x20 #define _ECCP2CON_CCP2X 0x20 #define _ECCP2CON_P2M0 0x40 #define _ECCP2CON_P2M1 0x80 //============================================================================== extern __at(0x0FBB) __sfr CCPR2; extern __at(0x0FBB) __sfr CCPR2L; extern __at(0x0FBC) __sfr CCPR2H; //============================================================================== // CCP1CON Bits extern __at(0x0FBD) __sfr CCP1CON; typedef union { struct { unsigned CCP1M0 : 1; unsigned CCP1M1 : 1; unsigned CCP1M2 : 1; unsigned CCP1M3 : 1; unsigned DC1B0 : 1; unsigned DC1B1 : 1; unsigned P1M0 : 1; unsigned P1M1 : 1; }; struct { unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned CCP1Y : 1; unsigned CCP1X : 1; unsigned : 1; unsigned : 1; }; struct { unsigned CCP1M : 4; unsigned : 4; }; struct { unsigned : 4; unsigned DC1B : 2; unsigned : 2; }; struct { unsigned : 6; unsigned P1M : 2; }; } __CCP1CONbits_t; extern __at(0x0FBD) volatile __CCP1CONbits_t CCP1CONbits; #define _CCP1M0 0x01 #define _CCP1M1 0x02 #define _CCP1M2 0x04 #define _CCP1M3 0x08 #define _DC1B0 0x10 #define _CCP1Y 0x10 #define _DC1B1 0x20 #define _CCP1X 0x20 #define _P1M0 0x40 #define _P1M1 0x80 //============================================================================== //============================================================================== // ECCP1CON Bits extern __at(0x0FBD) __sfr ECCP1CON; typedef union { struct { unsigned CCP1M0 : 1; unsigned CCP1M1 : 1; unsigned CCP1M2 : 1; unsigned CCP1M3 : 1; unsigned DC1B0 : 1; unsigned DC1B1 : 1; unsigned P1M0 : 1; unsigned P1M1 : 1; }; struct { unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned CCP1Y : 1; unsigned CCP1X : 1; unsigned : 1; unsigned : 1; }; struct { unsigned CCP1M : 4; unsigned : 4; }; struct { unsigned : 4; unsigned DC1B : 2; unsigned : 2; }; struct { unsigned : 6; unsigned P1M : 2; }; } __ECCP1CONbits_t; extern __at(0x0FBD) volatile __ECCP1CONbits_t ECCP1CONbits; #define _ECCP1CON_CCP1M0 0x01 #define _ECCP1CON_CCP1M1 0x02 #define _ECCP1CON_CCP1M2 0x04 #define _ECCP1CON_CCP1M3 0x08 #define _ECCP1CON_DC1B0 0x10 #define _ECCP1CON_CCP1Y 0x10 #define _ECCP1CON_DC1B1 0x20 #define _ECCP1CON_CCP1X 0x20 #define _ECCP1CON_P1M0 0x40 #define _ECCP1CON_P1M1 0x80 //============================================================================== extern __at(0x0FBE) __sfr CCPR1; extern __at(0x0FBE) __sfr CCPR1L; extern __at(0x0FBF) __sfr CCPR1H; //============================================================================== // ADCON2 Bits extern __at(0x0FC0) __sfr ADCON2; typedef union { struct { unsigned ADCS0 : 1; unsigned ADCS1 : 1; unsigned ADCS2 : 1; unsigned ACQT0 : 1; unsigned ACQT1 : 1; unsigned ACQT2 : 1; unsigned : 1; unsigned ADFM : 1; }; struct { unsigned ADCS : 3; unsigned : 5; }; struct { unsigned : 3; unsigned ACQT : 3; unsigned : 2; }; } __ADCON2bits_t; extern __at(0x0FC0) volatile __ADCON2bits_t ADCON2bits; #define _ADCS0 0x01 #define _ADCS1 0x02 #define _ADCS2 0x04 #define _ACQT0 0x08 #define _ACQT1 0x10 #define _ACQT2 0x20 #define _ADFM 0x80 //============================================================================== //============================================================================== // ADCON1 Bits extern __at(0x0FC1) __sfr ADCON1; typedef union { struct { unsigned PCFG0 : 1; unsigned PCFG1 : 1; unsigned PCFG2 : 1; unsigned PCFG3 : 1; unsigned VCFG0 : 1; unsigned VCFG1 : 1; unsigned : 1; unsigned : 1; }; struct { unsigned PCFG : 4; unsigned : 4; }; struct { unsigned : 4; unsigned VCFG : 2; unsigned : 2; }; } __ADCON1bits_t; extern __at(0x0FC1) volatile __ADCON1bits_t ADCON1bits; #define _PCFG0 0x01 #define _PCFG1 0x02 #define _PCFG2 0x04 #define _PCFG3 0x08 #define _VCFG0 0x10 #define _VCFG1 0x20 //============================================================================== //============================================================================== // ADCON0 Bits extern __at(0x0FC2) __sfr ADCON0; typedef union { struct { unsigned ADON : 1; unsigned GO_NOT_DONE : 1; unsigned CHS0 : 1; unsigned CHS1 : 1; unsigned CHS2 : 1; unsigned CHS3 : 1; unsigned : 1; unsigned : 1; }; struct { unsigned : 1; unsigned DONE : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; }; struct { unsigned : 1; unsigned GO_DONE : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; }; struct { unsigned : 1; unsigned GO : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; }; struct { unsigned : 1; unsigned NOT_DONE : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; }; struct { unsigned : 2; unsigned CHS : 4; unsigned : 2; }; } __ADCON0bits_t; extern __at(0x0FC2) volatile __ADCON0bits_t ADCON0bits; #define _ADON 0x01 #define _GO_NOT_DONE 0x02 #define _DONE 0x02 #define _GO_DONE 0x02 #define _GO 0x02 #define _NOT_DONE 0x02 #define _CHS0 0x04 #define _CHS1 0x08 #define _CHS2 0x10 #define _CHS3 0x20 //============================================================================== extern __at(0x0FC3) __sfr ADRES; extern __at(0x0FC3) __sfr ADRESL; extern __at(0x0FC4) __sfr ADRESH; //============================================================================== // SSP1CON2 Bits extern __at(0x0FC5) __sfr SSP1CON2; typedef struct { unsigned SEN : 1; unsigned RSEN : 1; unsigned PEN : 1; unsigned RCEN : 1; unsigned ACKEN : 1; unsigned ACKDT : 1; unsigned ACKSTAT : 1; unsigned GCEN : 1; } __SSP1CON2bits_t; extern __at(0x0FC5) volatile __SSP1CON2bits_t SSP1CON2bits; #define _SEN 0x01 #define _RSEN 0x02 #define _PEN 0x04 #define _RCEN 0x08 #define _ACKEN 0x10 #define _ACKDT 0x20 #define _ACKSTAT 0x40 #define _GCEN 0x80 //============================================================================== //============================================================================== // SSPCON2 Bits extern __at(0x0FC5) __sfr SSPCON2; typedef struct { unsigned SEN : 1; unsigned RSEN : 1; unsigned PEN : 1; unsigned RCEN : 1; unsigned ACKEN : 1; unsigned ACKDT : 1; unsigned ACKSTAT : 1; unsigned GCEN : 1; } __SSPCON2bits_t; extern __at(0x0FC5) volatile __SSPCON2bits_t SSPCON2bits; #define _SSPCON2_SEN 0x01 #define _SSPCON2_RSEN 0x02 #define _SSPCON2_PEN 0x04 #define _SSPCON2_RCEN 0x08 #define _SSPCON2_ACKEN 0x10 #define _SSPCON2_ACKDT 0x20 #define _SSPCON2_ACKSTAT 0x40 #define _SSPCON2_GCEN 0x80 //============================================================================== //============================================================================== // SSP1CON1 Bits extern __at(0x0FC6) __sfr SSP1CON1; typedef union { struct { unsigned SSPM0 : 1; unsigned SSPM1 : 1; unsigned SSPM2 : 1; unsigned SSPM3 : 1; unsigned CKP : 1; unsigned SSPEN : 1; unsigned SSPOV : 1; unsigned WCOL : 1; }; struct { unsigned SSPM : 4; unsigned : 4; }; } __SSP1CON1bits_t; extern __at(0x0FC6) volatile __SSP1CON1bits_t SSP1CON1bits; #define _SSPM0 0x01 #define _SSPM1 0x02 #define _SSPM2 0x04 #define _SSPM3 0x08 #define _CKP 0x10 #define _SSPEN 0x20 #define _SSPOV 0x40 #define _WCOL 0x80 //============================================================================== //============================================================================== // SSPCON1 Bits extern __at(0x0FC6) __sfr SSPCON1; typedef union { struct { unsigned SSPM0 : 1; unsigned SSPM1 : 1; unsigned SSPM2 : 1; unsigned SSPM3 : 1; unsigned CKP : 1; unsigned SSPEN : 1; unsigned SSPOV : 1; unsigned WCOL : 1; }; struct { unsigned SSPM : 4; unsigned : 4; }; } __SSPCON1bits_t; extern __at(0x0FC6) volatile __SSPCON1bits_t SSPCON1bits; #define _SSPCON1_SSPM0 0x01 #define _SSPCON1_SSPM1 0x02 #define _SSPCON1_SSPM2 0x04 #define _SSPCON1_SSPM3 0x08 #define _SSPCON1_CKP 0x10 #define _SSPCON1_SSPEN 0x20 #define _SSPCON1_SSPOV 0x40 #define _SSPCON1_WCOL 0x80 //============================================================================== //============================================================================== // SSP1STAT Bits extern __at(0x0FC7) __sfr SSP1STAT; typedef union { struct { unsigned BF : 1; unsigned UA : 1; unsigned R_NOT_W : 1; unsigned S : 1; unsigned P : 1; unsigned D_NOT_A : 1; unsigned CKE : 1; unsigned SMP : 1; }; struct { unsigned : 1; unsigned : 1; unsigned R_W : 1; unsigned I2C_START : 1; unsigned I2C_STOP : 1; unsigned D_A : 1; unsigned : 1; unsigned : 1; }; struct { unsigned : 1; unsigned : 1; unsigned I2C_READ : 1; unsigned : 1; unsigned : 1; unsigned I2C_DAT : 1; unsigned : 1; unsigned : 1; }; struct { unsigned : 1; unsigned : 1; unsigned NOT_W : 1; unsigned : 1; unsigned : 1; unsigned NOT_A : 1; unsigned : 1; unsigned : 1; }; struct { unsigned : 1; unsigned : 1; unsigned NOT_WRITE : 1; unsigned : 1; unsigned : 1; unsigned NOT_ADDRESS : 1; unsigned : 1; unsigned : 1; }; struct { unsigned : 1; unsigned : 1; unsigned READ_WRITE : 1; unsigned : 1; unsigned : 1; unsigned DATA_ADDRESS : 1; unsigned : 1; unsigned : 1; }; struct { unsigned : 1; unsigned : 1; unsigned R : 1; unsigned : 1; unsigned : 1; unsigned D : 1; unsigned : 1; unsigned : 1; }; } __SSP1STATbits_t; extern __at(0x0FC7) volatile __SSP1STATbits_t SSP1STATbits; #define _BF 0x01 #define _UA 0x02 #define _R_NOT_W 0x04 #define _R_W 0x04 #define _I2C_READ 0x04 #define _NOT_W 0x04 #define _NOT_WRITE 0x04 #define _READ_WRITE 0x04 #define _R 0x04 #define _S 0x08 #define _I2C_START 0x08 #define _P 0x10 #define _I2C_STOP 0x10 #define _D_NOT_A 0x20 #define _D_A 0x20 #define _I2C_DAT 0x20 #define _NOT_A 0x20 #define _NOT_ADDRESS 0x20 #define _DATA_ADDRESS 0x20 #define _D 0x20 #define _CKE 0x40 #define _SMP 0x80 //============================================================================== //============================================================================== // SSPSTAT Bits extern __at(0x0FC7) __sfr SSPSTAT; typedef union { struct { unsigned BF : 1; unsigned UA : 1; unsigned R_NOT_W : 1; unsigned S : 1; unsigned P : 1; unsigned D_NOT_A : 1; unsigned CKE : 1; unsigned SMP : 1; }; struct { unsigned : 1; unsigned : 1; unsigned R_W : 1; unsigned I2C_START : 1; unsigned I2C_STOP : 1; unsigned D_A : 1; unsigned : 1; unsigned : 1; }; struct { unsigned : 1; unsigned : 1; unsigned I2C_READ : 1; unsigned : 1; unsigned : 1; unsigned I2C_DAT : 1; unsigned : 1; unsigned : 1; }; struct { unsigned : 1; unsigned : 1; unsigned NOT_W : 1; unsigned : 1; unsigned : 1; unsigned NOT_A : 1; unsigned : 1; unsigned : 1; }; struct { unsigned : 1; unsigned : 1; unsigned NOT_WRITE : 1; unsigned : 1; unsigned : 1; unsigned NOT_ADDRESS : 1; unsigned : 1; unsigned : 1; }; struct { unsigned : 1; unsigned : 1; unsigned READ_WRITE : 1; unsigned : 1; unsigned : 1; unsigned DATA_ADDRESS : 1; unsigned : 1; unsigned : 1; }; struct { unsigned : 1; unsigned : 1; unsigned R : 1; unsigned : 1; unsigned : 1; unsigned D : 1; unsigned : 1; unsigned : 1; }; } __SSPSTATbits_t; extern __at(0x0FC7) volatile __SSPSTATbits_t SSPSTATbits; #define _SSPSTAT_BF 0x01 #define _SSPSTAT_UA 0x02 #define _SSPSTAT_R_NOT_W 0x04 #define _SSPSTAT_R_W 0x04 #define _SSPSTAT_I2C_READ 0x04 #define _SSPSTAT_NOT_W 0x04 #define _SSPSTAT_NOT_WRITE 0x04 #define _SSPSTAT_READ_WRITE 0x04 #define _SSPSTAT_R 0x04 #define _SSPSTAT_S 0x08 #define _SSPSTAT_I2C_START 0x08 #define _SSPSTAT_P 0x10 #define _SSPSTAT_I2C_STOP 0x10 #define _SSPSTAT_D_NOT_A 0x20 #define _SSPSTAT_D_A 0x20 #define _SSPSTAT_I2C_DAT 0x20 #define _SSPSTAT_NOT_A 0x20 #define _SSPSTAT_NOT_ADDRESS 0x20 #define _SSPSTAT_DATA_ADDRESS 0x20 #define _SSPSTAT_D 0x20 #define _SSPSTAT_CKE 0x40 #define _SSPSTAT_SMP 0x80 //============================================================================== extern __at(0x0FC8) __sfr SSP1ADD; extern __at(0x0FC8) __sfr SSPADD; extern __at(0x0FC9) __sfr SSP1BUF; extern __at(0x0FC9) __sfr SSPBUF; //============================================================================== // T2CON Bits extern __at(0x0FCA) __sfr T2CON; typedef union { struct { unsigned T2CKPS0 : 1; unsigned T2CKPS1 : 1; unsigned TMR2ON : 1; unsigned T2OUTPS0 : 1; unsigned T2OUTPS1 : 1; unsigned T2OUTPS2 : 1; unsigned T2OUTPS3 : 1; unsigned : 1; }; struct { unsigned T2CKPS : 2; unsigned : 6; }; struct { unsigned : 3; unsigned T2OUTPS : 4; unsigned : 1; }; } __T2CONbits_t; extern __at(0x0FCA) volatile __T2CONbits_t T2CONbits; #define _T2CKPS0 0x01 #define _T2CKPS1 0x02 #define _TMR2ON 0x04 #define _T2OUTPS0 0x08 #define _T2OUTPS1 0x10 #define _T2OUTPS2 0x20 #define _T2OUTPS3 0x40 //============================================================================== extern __at(0x0FCB) __sfr PR2; extern __at(0x0FCC) __sfr TMR2; //============================================================================== // T1CON Bits extern __at(0x0FCD) __sfr T1CON; typedef union { struct { unsigned TMR1ON : 1; unsigned TMR1CS : 1; unsigned NOT_T1SYNC : 1; unsigned T1OSCEN : 1; unsigned T1CKPS0 : 1; unsigned T1CKPS1 : 1; unsigned T1RUN : 1; unsigned RD16 : 1; }; struct { unsigned : 1; unsigned : 1; unsigned T1SYNC : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; }; struct { unsigned : 1; unsigned : 1; unsigned T1INSYNC : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; }; struct { unsigned : 4; unsigned T1CKPS : 2; unsigned : 2; }; } __T1CONbits_t; extern __at(0x0FCD) volatile __T1CONbits_t T1CONbits; #define _TMR1ON 0x01 #define _TMR1CS 0x02 #define _NOT_T1SYNC 0x04 #define _T1SYNC 0x04 #define _T1INSYNC 0x04 #define _T1OSCEN 0x08 #define _T1CKPS0 0x10 #define _T1CKPS1 0x20 #define _T1RUN 0x40 #define _RD16 0x80 //============================================================================== extern __at(0x0FCE) __sfr TMR1; extern __at(0x0FCE) __sfr TMR1L; extern __at(0x0FCF) __sfr TMR1H; //============================================================================== // RCON Bits extern __at(0x0FD0) __sfr RCON; typedef union { struct { unsigned NOT_BOR : 1; unsigned NOT_POR : 1; unsigned NOT_PD : 1; unsigned NOT_TO : 1; unsigned NOT_RI : 1; unsigned : 1; unsigned SBOREN : 1; unsigned IPEN : 1; }; struct { unsigned BOR : 1; unsigned POR : 1; unsigned PD : 1; unsigned TO : 1; unsigned RI : 1; unsigned : 1; unsigned : 1; unsigned : 1; }; } __RCONbits_t; extern __at(0x0FD0) volatile __RCONbits_t RCONbits; #define _NOT_BOR 0x01 #define _BOR 0x01 #define _NOT_POR 0x02 #define _POR 0x02 #define _NOT_PD 0x04 #define _PD 0x04 #define _NOT_TO 0x08 #define _TO 0x08 #define _NOT_RI 0x10 #define _RI 0x10 #define _SBOREN 0x40 #define _IPEN 0x80 //============================================================================== //============================================================================== // WDTCON Bits extern __at(0x0FD1) __sfr WDTCON; typedef union { struct { unsigned SWDTEN : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; }; struct { unsigned SWDTE : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; }; } __WDTCONbits_t; extern __at(0x0FD1) volatile __WDTCONbits_t WDTCONbits; #define _SWDTEN 0x01 #define _SWDTE 0x01 //============================================================================== //============================================================================== // HLVDCON Bits extern __at(0x0FD2) __sfr HLVDCON; typedef union { struct { unsigned HLVDL0 : 1; unsigned HLVDL1 : 1; unsigned HLVDL2 : 1; unsigned HLVDL3 : 1; unsigned HLVDEN : 1; unsigned IRVST : 1; unsigned : 1; unsigned VDIRMAG : 1; }; struct { unsigned LVV0 : 1; unsigned LVV1 : 1; unsigned LVV2 : 1; unsigned LVV3 : 1; unsigned LVDEN : 1; unsigned IVRST : 1; unsigned : 1; unsigned : 1; }; struct { unsigned LVDL0 : 1; unsigned LVDL1 : 1; unsigned LVDL2 : 1; unsigned LVDL3 : 1; unsigned : 1; unsigned BGST : 1; unsigned : 1; unsigned : 1; }; struct { unsigned LVDL : 4; unsigned : 4; }; struct { unsigned LVV : 4; unsigned : 4; }; struct { unsigned HLVDL : 4; unsigned : 4; }; } __HLVDCONbits_t; extern __at(0x0FD2) volatile __HLVDCONbits_t HLVDCONbits; #define _HLVDL0 0x01 #define _LVV0 0x01 #define _LVDL0 0x01 #define _HLVDL1 0x02 #define _LVV1 0x02 #define _LVDL1 0x02 #define _HLVDL2 0x04 #define _LVV2 0x04 #define _LVDL2 0x04 #define _HLVDL3 0x08 #define _LVV3 0x08 #define _LVDL3 0x08 #define _HLVDEN 0x10 #define _LVDEN 0x10 #define _IRVST 0x20 #define _IVRST 0x20 #define _BGST 0x20 #define _VDIRMAG 0x80 //============================================================================== //============================================================================== // LVDCON Bits extern __at(0x0FD2) __sfr LVDCON; typedef union { struct { unsigned HLVDL0 : 1; unsigned HLVDL1 : 1; unsigned HLVDL2 : 1; unsigned HLVDL3 : 1; unsigned HLVDEN : 1; unsigned IRVST : 1; unsigned : 1; unsigned VDIRMAG : 1; }; struct { unsigned LVV0 : 1; unsigned LVV1 : 1; unsigned LVV2 : 1; unsigned LVV3 : 1; unsigned LVDEN : 1; unsigned IVRST : 1; unsigned : 1; unsigned : 1; }; struct { unsigned LVDL0 : 1; unsigned LVDL1 : 1; unsigned LVDL2 : 1; unsigned LVDL3 : 1; unsigned : 1; unsigned BGST : 1; unsigned : 1; unsigned : 1; }; struct { unsigned LVDL : 4; unsigned : 4; }; struct { unsigned HLVDL : 4; unsigned : 4; }; struct { unsigned LVV : 4; unsigned : 4; }; } __LVDCONbits_t; extern __at(0x0FD2) volatile __LVDCONbits_t LVDCONbits; #define _LVDCON_HLVDL0 0x01 #define _LVDCON_LVV0 0x01 #define _LVDCON_LVDL0 0x01 #define _LVDCON_HLVDL1 0x02 #define _LVDCON_LVV1 0x02 #define _LVDCON_LVDL1 0x02 #define _LVDCON_HLVDL2 0x04 #define _LVDCON_LVV2 0x04 #define _LVDCON_LVDL2 0x04 #define _LVDCON_HLVDL3 0x08 #define _LVDCON_LVV3 0x08 #define _LVDCON_LVDL3 0x08 #define _LVDCON_HLVDEN 0x10 #define _LVDCON_LVDEN 0x10 #define _LVDCON_IRVST 0x20 #define _LVDCON_IVRST 0x20 #define _LVDCON_BGST 0x20 #define _LVDCON_VDIRMAG 0x80 //============================================================================== //============================================================================== // OSCCON Bits extern __at(0x0FD3) __sfr OSCCON; typedef union { struct { unsigned SCS0 : 1; unsigned SCS1 : 1; unsigned IOFS : 1; unsigned OSTS : 1; unsigned IRCF0 : 1; unsigned IRCF1 : 1; unsigned IRCF2 : 1; unsigned IDLEN : 1; }; struct { unsigned : 1; unsigned : 1; unsigned FLTS : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; }; struct { unsigned SCS : 2; unsigned : 6; }; struct { unsigned : 4; unsigned IRCF : 3; unsigned : 1; }; } __OSCCONbits_t; extern __at(0x0FD3) volatile __OSCCONbits_t OSCCONbits; #define _SCS0 0x01 #define _SCS1 0x02 #define _IOFS 0x04 #define _FLTS 0x04 #define _OSTS 0x08 #define _IRCF0 0x10 #define _IRCF1 0x20 #define _IRCF2 0x40 #define _IDLEN 0x80 //============================================================================== //============================================================================== // T0CON Bits extern __at(0x0FD5) __sfr T0CON; typedef union { struct { unsigned T0PS0 : 1; unsigned T0PS1 : 1; unsigned T0PS2 : 1; unsigned PSA : 1; unsigned T0SE : 1; unsigned T0CS : 1; unsigned T08BIT : 1; unsigned TMR0ON : 1; }; struct { unsigned : 1; unsigned : 1; unsigned : 1; unsigned T0PS3 : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; }; struct { unsigned T0PS : 4; unsigned : 4; }; } __T0CONbits_t; extern __at(0x0FD5) volatile __T0CONbits_t T0CONbits; #define _T0PS0 0x01 #define _T0PS1 0x02 #define _T0PS2 0x04 #define _PSA 0x08 #define _T0PS3 0x08 #define _T0SE 0x10 #define _T0CS 0x20 #define _T08BIT 0x40 #define _TMR0ON 0x80 //============================================================================== extern __at(0x0FD6) __sfr TMR0; extern __at(0x0FD6) __sfr TMR0L; extern __at(0x0FD7) __sfr TMR0H; //============================================================================== // STATUS Bits extern __at(0x0FD8) __sfr STATUS; typedef struct { unsigned C : 1; unsigned DC : 1; unsigned Z : 1; unsigned OV : 1; unsigned N : 1; unsigned : 1; unsigned : 1; unsigned : 1; } __STATUSbits_t; extern __at(0x0FD8) volatile __STATUSbits_t STATUSbits; #define _C 0x01 #define _DC 0x02 #define _Z 0x04 #define _OV 0x08 #define _N 0x10 //============================================================================== extern __at(0x0FD9) __sfr FSR2L; extern __at(0x0FDA) __sfr FSR2H; extern __at(0x0FDB) __sfr PLUSW2; extern __at(0x0FDC) __sfr PREINC2; extern __at(0x0FDD) __sfr POSTDEC2; extern __at(0x0FDE) __sfr POSTINC2; extern __at(0x0FDF) __sfr INDF2; extern __at(0x0FE0) __sfr BSR; extern __at(0x0FE1) __sfr FSR1L; extern __at(0x0FE2) __sfr FSR1H; extern __at(0x0FE3) __sfr PLUSW1; extern __at(0x0FE4) __sfr PREINC1; extern __at(0x0FE5) __sfr POSTDEC1; extern __at(0x0FE6) __sfr POSTINC1; extern __at(0x0FE7) __sfr INDF1; extern __at(0x0FE8) __sfr WREG; extern __at(0x0FE9) __sfr FSR0L; extern __at(0x0FEA) __sfr FSR0H; extern __at(0x0FEB) __sfr PLUSW0; extern __at(0x0FEC) __sfr PREINC0; extern __at(0x0FED) __sfr POSTDEC0; extern __at(0x0FEE) __sfr POSTINC0; extern __at(0x0FEF) __sfr INDF0; //============================================================================== // INTCON3 Bits extern __at(0x0FF0) __sfr INTCON3; typedef union { struct { unsigned INT1IF : 1; unsigned INT2IF : 1; unsigned INT3IF : 1; unsigned INT1IE : 1; unsigned INT2IE : 1; unsigned INT3IE : 1; unsigned INT1IP : 1; unsigned INT2IP : 1; }; struct { unsigned INT1F : 1; unsigned INT2F : 1; unsigned INT3F : 1; unsigned INT1E : 1; unsigned INT2E : 1; unsigned INT3E : 1; unsigned INT1P : 1; unsigned INT2P : 1; }; } __INTCON3bits_t; extern __at(0x0FF0) volatile __INTCON3bits_t INTCON3bits; #define _INT1IF 0x01 #define _INT1F 0x01 #define _INT2IF 0x02 #define _INT2F 0x02 #define _INT3IF 0x04 #define _INT3F 0x04 #define _INT1IE 0x08 #define _INT1E 0x08 #define _INT2IE 0x10 #define _INT2E 0x10 #define _INT3IE 0x20 #define _INT3E 0x20 #define _INT1IP 0x40 #define _INT1P 0x40 #define _INT2IP 0x80 #define _INT2P 0x80 //============================================================================== //============================================================================== // INTCON2 Bits extern __at(0x0FF1) __sfr INTCON2; typedef union { struct { unsigned RBIP : 1; unsigned INT3IP : 1; unsigned TMR0IP : 1; unsigned INTEDG3 : 1; unsigned INTEDG2 : 1; unsigned INTEDG1 : 1; unsigned INTEDG0 : 1; unsigned NOT_RBPU : 1; }; struct { unsigned : 1; unsigned INT3P : 1; unsigned T0IP : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned RBPU : 1; }; } __INTCON2bits_t; extern __at(0x0FF1) volatile __INTCON2bits_t INTCON2bits; #define _RBIP 0x01 #define _INT3IP 0x02 #define _INT3P 0x02 #define _TMR0IP 0x04 #define _T0IP 0x04 #define _INTEDG3 0x08 #define _INTEDG2 0x10 #define _INTEDG1 0x20 #define _INTEDG0 0x40 #define _NOT_RBPU 0x80 #define _RBPU 0x80 //============================================================================== //============================================================================== // INTCON Bits extern __at(0x0FF2) __sfr INTCON; typedef union { struct { unsigned RBIF : 1; unsigned INT0IF : 1; unsigned TMR0IF : 1; unsigned RBIE : 1; unsigned INT0IE : 1; unsigned TMR0IE : 1; unsigned PEIE_GIEL : 1; unsigned GIE_GIEH : 1; }; struct { unsigned : 1; unsigned INT0F : 1; unsigned T0IF : 1; unsigned : 1; unsigned INT0E : 1; unsigned T0IE : 1; unsigned PEIE : 1; unsigned GIE : 1; }; struct { unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned : 1; unsigned GIEL : 1; unsigned GIEH : 1; }; } __INTCONbits_t; extern __at(0x0FF2) volatile __INTCONbits_t INTCONbits; #define _RBIF 0x01 #define _INT0IF 0x02 #define _INT0F 0x02 #define _TMR0IF 0x04 #define _T0IF 0x04 #define _RBIE 0x08 #define _INT0IE 0x10 #define _INT0E 0x10 #define _TMR0IE 0x20 #define _T0IE 0x20 #define _PEIE_GIEL 0x40 #define _PEIE 0x40 #define _GIEL 0x40 #define _GIE_GIEH 0x80 #define _GIE 0x80 #define _GIEH 0x80 //============================================================================== extern __at(0x0FF3) __sfr PROD; extern __at(0x0FF3) __sfr PRODL; extern __at(0x0FF4) __sfr PRODH; extern __at(0x0FF5) __sfr TABLAT; extern __at(0x0FF6) __sfr TBLPTR; extern __at(0x0FF6) __sfr TBLPTRL; extern __at(0x0FF7) __sfr TBLPTRH; extern __at(0x0FF8) __sfr TBLPTRU; extern __at(0x0FF9) __sfr PC; extern __at(0x0FF9) __sfr PCL; extern __at(0x0FFA) __sfr PCLATH; extern __at(0x0FFB) __sfr PCLATU; //============================================================================== // STKPTR Bits extern __at(0x0FFC) __sfr STKPTR; typedef union { struct { unsigned STKPTR0 : 1; unsigned STKPTR1 : 1; unsigned STKPTR2 : 1; unsigned STKPTR3 : 1; unsigned STKPTR4 : 1; unsigned : 1; unsigned STKUNF : 1; unsigned STKFUL : 1; }; struct { unsigned SP0 : 1; unsigned SP1 : 1; unsigned SP2 : 1; unsigned SP3 : 1; unsigned SP4 : 1; unsigned : 1; unsigned : 1; unsigned STKOVF : 1; }; struct { unsigned SP : 5; unsigned : 3; }; struct { unsigned STKPTR : 5; unsigned : 3; }; } __STKPTRbits_t; extern __at(0x0FFC) volatile __STKPTRbits_t STKPTRbits; #define _STKPTR0 0x01 #define _SP0 0x01 #define _STKPTR1 0x02 #define _SP1 0x02 #define _STKPTR2 0x04 #define _SP2 0x04 #define _STKPTR3 0x08 #define _SP3 0x08 #define _STKPTR4 0x10 #define _SP4 0x10 #define _STKUNF 0x40 #define _STKFUL 0x80 #define _STKOVF 0x80 //============================================================================== extern __at(0x0FFD) __sfr TOS; extern __at(0x0FFD) __sfr TOSL; extern __at(0x0FFE) __sfr TOSH; extern __at(0x0FFF) __sfr TOSU; //============================================================================== // // Configuration Bits // //============================================================================== #define __CONFIG1H 0x300001 #define __CONFIG2L 0x300002 #define __CONFIG2H 0x300003 #define __CONFIG3H 0x300005 #define __CONFIG4L 0x300006 #define __CONFIG5L 0x300008 #define __CONFIG5H 0x300009 #define __CONFIG6L 0x30000A #define __CONFIG6H 0x30000B #define __CONFIG7L 0x30000C #define __CONFIG7H 0x30000D //----------------------------- CONFIG1H Options ------------------------------- #define _OSC_LP_1H 0xF0 // LP oscillator. #define _OSC_XT_1H 0xF1 // XT oscillator. #define _OSC_HS_1H 0xF2 // HS oscillator. #define _OSC_RC_1H 0xF3 // External RC oscillator, CLKO function on RA6. #define _OSC_EC_1H 0xF4 // EC oscillator, CLKO function on RA6. #define _OSC_ECIO6_1H 0xF5 // EC oscillator, port function on RA6. #define _OSC_HSPLL_1H 0xF6 // HS oscillator, PLL enabled (Clock Frequency = 4 x FOSC1). #define _OSC_RCIO6_1H 0xF7 // External RC oscillator, port function on RA6. #define _OSC_INTIO67_1H 0xF8 // Internal oscillator block, port function on RA6 and RA7. #define _OSC_INTIO7_1H 0xF9 // Internal oscillator block, CLKO function on RA6, port function on RA7. #define _FCMEN_OFF_1H 0xBF // Fail-Safe Clock Monitor disabled. #define _FCMEN_ON_1H 0xFF // Fail-Safe Clock Monitor enabled. #define _IESO_OFF_1H 0x7F // Two-Speed Start-up disabled. #define _IESO_ON_1H 0xFF // Two-Speed Start-up enabled. //----------------------------- CONFIG2L Options ------------------------------- #define _PWRT_ON_2L 0xFE // PWRT enabled. #define _PWRT_OFF_2L 0xFF // PWRT disabled. #define _BOREN_OFF_2L 0xF9 // Brown-out Reset disabled in hardware and software. #define _BOREN_ON_2L 0xFB // Brown-out Reset enabled and controlled by software (SBOREN is enabled). #define _BOREN_NOSLP_2L 0xFD // Brown-out Reset enabled in hardware only and disabled in Sleep mode (SBOREN is disabled). #define _BOREN_SBORDIS_2L 0xFF // Brown-out Reset enabled in hardware only (SBOREN is disabled). #define _BORV_0_2L 0xE7 // Maximum setting. #define _BORV_1_2L 0xEF #define _BORV_2_2L 0xF7 #define _BORV_3_2L 0xFF // Minimum setting. //----------------------------- CONFIG2H Options ------------------------------- #define _WDT_OFF_2H 0xFE // WDT disabled (control is placed on the SWDTEN bit). #define _WDT_ON_2H 0xFF // WDT enabled. #define _WDTPS_1_2H 0xE1 // 1:1. #define _WDTPS_2_2H 0xE3 // 1:2. #define _WDTPS_4_2H 0xE5 // 1:4. #define _WDTPS_8_2H 0xE7 // 1:8. #define _WDTPS_16_2H 0xE9 // 1:16. #define _WDTPS_32_2H 0xEB // 1:32. #define _WDTPS_64_2H 0xED // 1:64. #define _WDTPS_128_2H 0xEF // 1:128. #define _WDTPS_256_2H 0xF1 // 1:256. #define _WDTPS_512_2H 0xF3 // 1:512. #define _WDTPS_1024_2H 0xF5 // 1:1024. #define _WDTPS_2048_2H 0xF7 // 1:2048. #define _WDTPS_4096_2H 0xF9 // 1:4096. #define _WDTPS_8192_2H 0xFB // 1:8192. #define _WDTPS_16384_2H 0xFD // 1:16384. #define _WDTPS_32768_2H 0xFF // 1:32768. //----------------------------- CONFIG3H Options ------------------------------- #define _CCP2MX_PORTE_3H 0xFE // ECCP2 input/output is multiplexed with RE7. #define _CCP2MX_PORTC_3H 0xFF // ECCP2 input/output is multiplexed with RC1. #define _LPT1OSC_OFF_3H 0xFB // Timer1 configured for higher power operation. #define _LPT1OSC_ON_3H 0xFF // Timer1 configured for low-power operation. #define _MCLRE_OFF_3H 0x7F // RG5 input pin enabled; MCLR disabled. #define _MCLRE_ON_3H 0xFF // MCLR pin enabled; RG5 input pin disabled. //----------------------------- CONFIG4L Options ------------------------------- #define _STVREN_OFF_4L 0xFE // Stack full/underflow will not cause Reset. #define _STVREN_ON_4L 0xFF // Stack full/underflow will cause Reset. #define _LVP_OFF_4L 0xFB // Single-Supply ICSP disabled. #define _LVP_ON_4L 0xFF // Single-Supply ICSP enabled. #define _BBSIZ_BB2K_4L 0xCF // 1K word (2 Kbytes) Boot Block size. #define _BBSIZ_BB4K_4L 0xDF // 2K words (4 Kbytes) Boot Block size. #define _BBSIZ_BB8K_4L 0xEF // 4K words (8 Kbytes) Boot Block size. #define _XINST_OFF_4L 0xBF // Instruction set extension and Indexed Addressing mode disabled (Legacy mode). #define _XINST_ON_4L 0xFF // Instruction set extension and Indexed Addressing mode enabled. #define _DEBUG_ON_4L 0x7F // Background debugger enabled, RB6 and RB7 are dedicated to In-Circuit Debug. #define _DEBUG_OFF_4L 0xFF // Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins. //----------------------------- CONFIG5L Options ------------------------------- #define _CP0_ON_5L 0xFE // Block 0 (000800, 001000 or 002000-003FFFh) code-protected. #define _CP0_OFF_5L 0xFF // Block 0 (000800, 001000 or 002000-003FFFh) not code-protected. #define _CP1_ON_5L 0xFD // Block 1 (004000-007FFFh) code-protected. #define _CP1_OFF_5L 0xFF // Block 1 (004000-007FFFh) not code-protected. #define _CP2_ON_5L 0xFB // Block 2 (008000-00BFFFh) code-protected. #define _CP2_OFF_5L 0xFF // Block 2 (008000-00BFFFh) not code-protected. #define _CP3_ON_5L 0xF7 // Block 3 (00C000-00FFFFh) code-protected. #define _CP3_OFF_5L 0xFF // Block 3 (00C000-00FFFFh) not code-protected. #define _CP4_ON_5L 0xEF // Block 4 (010000-013FFFh) code-protected. #define _CP4_OFF_5L 0xFF // Block 4 (010000-013FFFh) not code-protected. #define _CP5_ON_5L 0xDF // Block 5 (014000-017FFFh) code-protected. #define _CP5_OFF_5L 0xFF // Block 5 (014000-017FFFh) not code-protected. //----------------------------- CONFIG5H Options ------------------------------- #define _CPB_ON_5H 0xBF // Boot Block (000000-0007FFh) code-protected. #define _CPB_OFF_5H 0xFF // Boot Block (000000-0007FFh) not code-protected. #define _CPD_ON_5H 0x7F // Data EEPROM code-protected. #define _CPD_OFF_5H 0xFF // Data EEPROM not code-protected. //----------------------------- CONFIG6L Options ------------------------------- #define _WRT0_ON_6L 0xFE // Block 0 (000800, 001000 or 002000-003FFFh) write-protected. #define _WRT0_OFF_6L 0xFF // Block 0 (000800, 001000 or 002000-003FFFh) not write-protected. #define _WRT1_ON_6L 0xFD // Block 1 (004000-007FFFh) write-protected. #define _WRT1_OFF_6L 0xFF // Block 1 (004000-007FFFh) not write-protected. #define _WRT2_ON_6L 0xFB // Block 2 (008000-00BFFFh) write-protected. #define _WRT2_OFF_6L 0xFF // Block 2 (008000-00BFFFh) not write-protected. #define _WRT3_ON_6L 0xF7 // Block 3 (00C000-00FFFFh) write-protected. #define _WRT3_OFF_6L 0xFF // Block 3 (00C000-00FFFFh) not write-protected. #define _WRT4_ON_6L 0xEF // Block 4 (010000-013FFFh) write-protected. #define _WRT4_OFF_6L 0xFF // Block 4 (010000-013FFFh) not write-protected. #define _WRT5_ON_6L 0xDF // Block 5 (014000-017FFFh) write-protected. #define _WRT5_OFF_6L 0xFF // Block 5 (014000-017FFFh) not write-protected. //----------------------------- CONFIG6H Options ------------------------------- #define _WRTC_ON_6H 0xDF // Configuration registers (300000-3000FFh) write-protected. #define _WRTC_OFF_6H 0xFF // Configuration registers (300000-3000FFh) not write-protected. #define _WRTB_ON_6H 0xBF // Boot Block (000000-007FFF, 000FFF or 001FFFh) write-protected. #define _WRTB_OFF_6H 0xFF // Boot Block (000000-007FFF, 000FFF or 001FFFh) not write-protected. #define _WRTD_ON_6H 0x7F // Data EEPROM write-protected. #define _WRTD_OFF_6H 0xFF // Data EEPROM not write-protected. //----------------------------- CONFIG7L Options ------------------------------- #define _EBTR0_ON_7L 0xFE // Block 0 (000800, 001000 or 002000-003FFFh) protected from table reads executed in other blocks. #define _EBTR0_OFF_7L 0xFF // Block 0 (000800, 001000 or 002000-003FFFh) not protected from table reads executed in other blocks. #define _EBTR1_ON_7L 0xFD // Block 1 (004000-007FFFh) protected from table reads executed in other blocks. #define _EBTR1_OFF_7L 0xFF // Block 1 (004000-007FFFh) not protected from table reads executed in other blocks. #define _EBTR2_ON_7L 0xFB // Block 2 (008000-00BFFFh) protected from table reads executed in other blocks. #define _EBTR2_OFF_7L 0xFF // Block 2 (008000-00BFFFh) not protected from table reads executed in other blocks. #define _EBTR3_ON_7L 0xF7 // Block 3 (00C000-00FFFFh) protected from table reads executed in other blocks. #define _EBTR3_OFF_7L 0xFF // Block 3 (00C000-00FFFFh) not protected from table reads executed in other blocks. #define _EBTR4_ON_7L 0xEF // Block 4 (010000-013FFFh) protected from table reads executed in other blocks. #define _EBTR4_OFF_7L 0xFF // Block 4 (010000-013FFFh) not protected from table reads executed in other blocks. #define _EBTR5_ON_7L 0xDF // Block 5 (014000-017FFFh) protected from table reads executed in other blocks. #define _EBTR5_OFF_7L 0xFF // Block 5 (014000-017FFFh) not protected from table reads executed in other blocks. //----------------------------- CONFIG7H Options ------------------------------- #define _EBTRB_ON_7H 0xBF // Boot Block (000000-007FFF, 000FFF or 001FFFh) protected from table reads executed in other blocks. #define _EBTRB_OFF_7H 0xFF // Boot Block (000000-007FFF, 000FFF or 001FFFh) not protected from table reads executed in other blocks. //============================================================================== #define __DEVID1 0x3FFFFE #define __DEVID2 0x3FFFFF #define __IDLOC0 0x200000 #define __IDLOC1 0x200001 #define __IDLOC2 0x200002 #define __IDLOC3 0x200003 #define __IDLOC4 0x200004 #define __IDLOC5 0x200005 #define __IDLOC6 0x200006 #define __IDLOC7 0x200007 #endif // #ifndef __PIC18LF6627_H__
dfreniche/cpctelera
cpctelera/tools/sdcc-3.6.8-r9946/src/device/non-free/include/pic16/pic18lf6627.h
C
gpl-3.0
166,201
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h" #include <utility> #include <vector> #include "base/lazy_instance.h" #include "base/memory/ptr_util.h" #include "base/strings/string_number_conversions.h" #include "base/task_runner_util.h" #include "chrome/browser/extensions/api/tabs/tabs_constants.h" #include "chrome/browser/extensions/extension_tab_util.h" #include "chrome/browser/profiles/profile.h" #include "content/public/browser/media_device_id.h" #include "content/public/browser/web_contents.h" #include "extensions/browser/event_router.h" #include "extensions/browser/extension_registry.h" #include "extensions/common/error_utils.h" #include "extensions/common/permissions/permissions_data.h" #include "media/audio/audio_device_description.h" #include "media/audio/audio_output_controller.h" #include "url/gurl.h" #include "url/origin.h" namespace extensions { using content::BrowserThread; using content::RenderProcessHost; using media::AudioDeviceNames; using media::AudioManager; namespace wap = api::webrtc_audio_private; using api::webrtc_audio_private::RequestInfo; static base::LazyInstance< BrowserContextKeyedAPIFactory<WebrtcAudioPrivateEventService> > g_factory = LAZY_INSTANCE_INITIALIZER; WebrtcAudioPrivateEventService::WebrtcAudioPrivateEventService( content::BrowserContext* context) : browser_context_(context) { // In unit tests, the SystemMonitor may not be created. base::SystemMonitor* system_monitor = base::SystemMonitor::Get(); if (system_monitor) system_monitor->AddDevicesChangedObserver(this); } WebrtcAudioPrivateEventService::~WebrtcAudioPrivateEventService() { } void WebrtcAudioPrivateEventService::Shutdown() { // In unit tests, the SystemMonitor may not be created. base::SystemMonitor* system_monitor = base::SystemMonitor::Get(); if (system_monitor) system_monitor->RemoveDevicesChangedObserver(this); } // static BrowserContextKeyedAPIFactory<WebrtcAudioPrivateEventService>* WebrtcAudioPrivateEventService::GetFactoryInstance() { return g_factory.Pointer(); } // static const char* WebrtcAudioPrivateEventService::service_name() { return "WebrtcAudioPrivateEventService"; } void WebrtcAudioPrivateEventService::OnDevicesChanged( base::SystemMonitor::DeviceType device_type) { switch (device_type) { case base::SystemMonitor::DEVTYPE_AUDIO: case base::SystemMonitor::DEVTYPE_VIDEO_CAPTURE: SignalEvent(); break; default: // No action needed. break; } } void WebrtcAudioPrivateEventService::SignalEvent() { using api::webrtc_audio_private::OnSinksChanged::kEventName; EventRouter* router = EventRouter::Get(browser_context_); if (!router || !router->HasEventListener(kEventName)) return; for (const scoped_refptr<const extensions::Extension>& extension : ExtensionRegistry::Get(browser_context_)->enabled_extensions()) { const std::string& extension_id = extension->id(); if (router->ExtensionHasEventListener(extension_id, kEventName) && extension->permissions_data()->HasAPIPermission("webrtcAudioPrivate")) { std::unique_ptr<Event> event = base::MakeUnique<Event>( events::WEBRTC_AUDIO_PRIVATE_ON_SINKS_CHANGED, kEventName, base::MakeUnique<base::ListValue>()); router->DispatchEventToExtension(extension_id, std::move(event)); } } } WebrtcAudioPrivateFunction::WebrtcAudioPrivateFunction() {} WebrtcAudioPrivateFunction::~WebrtcAudioPrivateFunction() { } void WebrtcAudioPrivateFunction::GetOutputDeviceNames() { scoped_refptr<base::SingleThreadTaskRunner> audio_manager_runner = AudioManager::Get()->GetTaskRunner(); if (!audio_manager_runner->BelongsToCurrentThread()) { DCHECK_CURRENTLY_ON(BrowserThread::UI); audio_manager_runner->PostTask( FROM_HERE, base::Bind(&WebrtcAudioPrivateFunction::GetOutputDeviceNames, this)); return; } std::unique_ptr<AudioDeviceNames> device_names(new AudioDeviceNames); AudioManager::Get()->GetAudioOutputDeviceNames(device_names.get()); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&WebrtcAudioPrivateFunction::OnOutputDeviceNames, this, base::Passed(&device_names))); } void WebrtcAudioPrivateFunction::OnOutputDeviceNames( std::unique_ptr<AudioDeviceNames> device_names) { NOTREACHED(); } bool WebrtcAudioPrivateFunction::GetControllerList(const RequestInfo& request) { content::RenderProcessHost* rph = nullptr; // If |guest_process_id| is defined, directly use this id to find the // corresponding RenderProcessHost. if (request.guest_process_id.get()) { rph = content::RenderProcessHost::FromID(*request.guest_process_id); } else if (request.tab_id.get()) { int tab_id = *request.tab_id; content::WebContents* contents = NULL; if (!ExtensionTabUtil::GetTabById(tab_id, GetProfile(), true, NULL, NULL, &contents, NULL)) { error_ = extensions::ErrorUtils::FormatErrorMessage( extensions::tabs_constants::kTabNotFoundError, base::IntToString(tab_id)); return false; } rph = contents->GetRenderProcessHost(); } else { return false; } if (!rph) return false; rph->GetAudioOutputControllers( base::Bind(&WebrtcAudioPrivateFunction::OnControllerList, this)); return true; } void WebrtcAudioPrivateFunction::OnControllerList( const content::RenderProcessHost::AudioOutputControllerList& list) { NOTREACHED(); } void WebrtcAudioPrivateFunction::CalculateHMAC(const std::string& raw_id) { if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&WebrtcAudioPrivateFunction::CalculateHMAC, this, raw_id)); return; } std::string hmac = CalculateHMACImpl(raw_id); BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind(&WebrtcAudioPrivateFunction::OnHMACCalculated, this, hmac)); } void WebrtcAudioPrivateFunction::OnHMACCalculated(const std::string& hmac) { NOTREACHED(); } std::string WebrtcAudioPrivateFunction::CalculateHMACImpl( const std::string& raw_id) { DCHECK_CURRENTLY_ON(BrowserThread::IO); // We don't hash the default device name, and we always return // "default" for the default device. There is code in SetActiveSink // that transforms "default" to the empty string, and code in // GetActiveSink that ensures we return "default" if we get the // empty string as the current device ID. if (media::AudioDeviceDescription::IsDefaultDevice(raw_id)) return media::AudioDeviceDescription::kDefaultDeviceId; url::Origin security_origin(source_url().GetOrigin()); return content::GetHMACForMediaDeviceID(device_id_salt(), security_origin, raw_id); } void WebrtcAudioPrivateFunction::InitDeviceIDSalt() { device_id_salt_ = GetProfile()->GetResourceContext()->GetMediaDeviceIDSalt(); } std::string WebrtcAudioPrivateFunction::device_id_salt() const { return device_id_salt_; } bool WebrtcAudioPrivateGetSinksFunction::RunAsync() { DCHECK_CURRENTLY_ON(BrowserThread::UI); InitDeviceIDSalt(); GetOutputDeviceNames(); return true; } void WebrtcAudioPrivateGetSinksFunction::OnOutputDeviceNames( std::unique_ptr<AudioDeviceNames> raw_ids) { DCHECK_CURRENTLY_ON(BrowserThread::IO); std::vector<wap::SinkInfo> results; for (const media::AudioDeviceName& name : *raw_ids) { wap::SinkInfo info; info.sink_id = CalculateHMACImpl(name.unique_id); info.sink_label = name.device_name; // TODO(joi): Add other parameters. results.push_back(std::move(info)); } // It's safe to directly set the results here (from a thread other // than the UI thread, on which an AsyncExtensionFunction otherwise // normally runs) because there is one instance of this object per // function call, no actor outside of this object is modifying the // results_ member, and the different method invocations on this // object run strictly in sequence; first RunAsync on the UI thread, // then DoQuery on the audio IO thread, then DoneOnUIThread on the // UI thread. results_ = wap::GetSinks::Results::Create(results); BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind(&WebrtcAudioPrivateGetSinksFunction::DoneOnUIThread, this)); } void WebrtcAudioPrivateGetSinksFunction::DoneOnUIThread() { SendResponse(true); } bool WebrtcAudioPrivateGetActiveSinkFunction::RunAsync() { DCHECK_CURRENTLY_ON(BrowserThread::UI); InitDeviceIDSalt(); std::unique_ptr<wap::GetActiveSink::Params> params( wap::GetActiveSink::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); return GetControllerList(params->request); } void WebrtcAudioPrivateGetActiveSinkFunction::OnControllerList( const RenderProcessHost::AudioOutputControllerList& controllers) { DCHECK_CURRENTLY_ON(BrowserThread::UI); if (controllers.empty()) { // If there is no current audio stream for the rvh, we return an // empty string as the sink ID. DVLOG(2) << "chrome.webrtcAudioPrivate.getActiveSink: No controllers."; results_.reset( wap::GetActiveSink::Results::Create(std::string()).release()); SendResponse(true); } else { DVLOG(2) << "chrome.webrtcAudioPrivate.getActiveSink: " << controllers.size() << " controllers."; // TODO(joi): Debug-only, DCHECK that all items have the same ID. // Send the raw ID through CalculateHMAC, and send the result in // OnHMACCalculated. (*controllers.begin())->GetOutputDeviceId( base::Bind(&WebrtcAudioPrivateGetActiveSinkFunction::CalculateHMAC, this)); } } void WebrtcAudioPrivateGetActiveSinkFunction::OnHMACCalculated( const std::string& hmac_id) { DCHECK_CURRENTLY_ON(BrowserThread::UI); std::string result = hmac_id; if (result.empty()) { DVLOG(2) << "Received empty ID, replacing with default ID."; result = media::AudioDeviceDescription::kDefaultDeviceId; } results_ = wap::GetActiveSink::Results::Create(result); SendResponse(true); } WebrtcAudioPrivateSetActiveSinkFunction:: WebrtcAudioPrivateSetActiveSinkFunction() : num_remaining_sink_ids_(0) { } WebrtcAudioPrivateSetActiveSinkFunction:: ~WebrtcAudioPrivateSetActiveSinkFunction() { } bool WebrtcAudioPrivateSetActiveSinkFunction::RunAsync() { DCHECK_CURRENTLY_ON(BrowserThread::UI); std::unique_ptr<wap::SetActiveSink::Params> params( wap::SetActiveSink::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); InitDeviceIDSalt(); if (params->request.guest_process_id.get()) { request_info_.guest_process_id.reset( new int(*params->request.guest_process_id)); } else if (params->request.tab_id.get()) { request_info_.tab_id.reset(new int(*params->request.tab_id)); } else { return false; } sink_id_ = params->sink_id; return GetControllerList(request_info_); } void WebrtcAudioPrivateSetActiveSinkFunction::OnControllerList( const RenderProcessHost::AudioOutputControllerList& controllers) { DCHECK_CURRENTLY_ON(BrowserThread::UI); std::string requested_process_type; int requested_process_id; if (request_info_.guest_process_id.get()) { requested_process_type = "guestProcessId"; requested_process_id = *request_info_.guest_process_id; } else { requested_process_type = "tabId"; requested_process_id = *request_info_.tab_id; } controllers_ = controllers; num_remaining_sink_ids_ = controllers_.size(); if (num_remaining_sink_ids_ == 0) { error_ = extensions::ErrorUtils::FormatErrorMessage( "No active stream for " + requested_process_type + " *", base::IntToString(requested_process_id)); SendResponse(false); } else { // We need to get the output device names, and calculate the HMAC // for each, to find the raw ID for the ID provided to this API // function call. GetOutputDeviceNames(); } } void WebrtcAudioPrivateSetActiveSinkFunction::OnOutputDeviceNames( std::unique_ptr<AudioDeviceNames> device_names) { DCHECK_CURRENTLY_ON(BrowserThread::IO); std::string raw_sink_id; if (sink_id_ == media::AudioDeviceDescription::kDefaultDeviceId) { DVLOG(2) << "Received default ID, replacing with empty ID."; raw_sink_id = ""; } else { for (AudioDeviceNames::const_iterator it = device_names->begin(); it != device_names->end(); ++it) { if (sink_id_ == CalculateHMACImpl(it->unique_id)) { raw_sink_id = it->unique_id; break; } } if (raw_sink_id.empty()) DVLOG(2) << "Found no matching raw sink ID for HMAC " << sink_id_; } RenderProcessHost::AudioOutputControllerList::const_iterator it = controllers_.begin(); for (; it != controllers_.end(); ++it) { (*it)->SwitchOutputDevice(raw_sink_id, base::Bind( &WebrtcAudioPrivateSetActiveSinkFunction::SwitchDone, this)); } } void WebrtcAudioPrivateSetActiveSinkFunction::SwitchDone() { if (--num_remaining_sink_ids_ == 0) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind(&WebrtcAudioPrivateSetActiveSinkFunction::DoneOnUIThread, this)); } } void WebrtcAudioPrivateSetActiveSinkFunction::DoneOnUIThread() { SendResponse(true); } WebrtcAudioPrivateGetAssociatedSinkFunction:: WebrtcAudioPrivateGetAssociatedSinkFunction() { } WebrtcAudioPrivateGetAssociatedSinkFunction:: ~WebrtcAudioPrivateGetAssociatedSinkFunction() { } bool WebrtcAudioPrivateGetAssociatedSinkFunction::RunAsync() { params_ = wap::GetAssociatedSink::Params::Create(*args_); DCHECK_CURRENTLY_ON(BrowserThread::UI); EXTENSION_FUNCTION_VALIDATE(params_.get()); InitDeviceIDSalt(); AudioManager::Get()->GetTaskRunner()->PostTask( FROM_HERE, base::Bind(&WebrtcAudioPrivateGetAssociatedSinkFunction:: GetDevicesOnDeviceThread, this)); return true; } void WebrtcAudioPrivateGetAssociatedSinkFunction::GetDevicesOnDeviceThread() { DCHECK(AudioManager::Get()->GetTaskRunner()->BelongsToCurrentThread()); AudioManager::Get()->GetAudioInputDeviceNames(&source_devices_); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&WebrtcAudioPrivateGetAssociatedSinkFunction:: GetRawSourceIDOnIOThread, this)); } void WebrtcAudioPrivateGetAssociatedSinkFunction::GetRawSourceIDOnIOThread() { DCHECK_CURRENTLY_ON(BrowserThread::IO); url::Origin security_origin(GURL(params_->security_origin)); std::string source_id_in_origin(params_->source_id_in_origin); // Find the raw source ID for source_id_in_origin. std::string raw_source_id; for (AudioDeviceNames::const_iterator it = source_devices_.begin(); it != source_devices_.end(); ++it) { const std::string& id = it->unique_id; if (content::DoesMediaDeviceIDMatchHMAC(device_id_salt(), security_origin, source_id_in_origin, id)) { raw_source_id = id; DVLOG(2) << "Found raw ID " << raw_source_id << " for source ID in origin " << source_id_in_origin; break; } } AudioManager::Get()->GetTaskRunner()->PostTask( FROM_HERE, base::Bind(&WebrtcAudioPrivateGetAssociatedSinkFunction:: GetAssociatedSinkOnDeviceThread, this, raw_source_id)); } void WebrtcAudioPrivateGetAssociatedSinkFunction::GetAssociatedSinkOnDeviceThread( const std::string& raw_source_id) { DCHECK(AudioManager::Get()->GetTaskRunner()->BelongsToCurrentThread()); // We return an empty string if there is no associated output device. std::string raw_sink_id; if (!raw_source_id.empty()) { raw_sink_id = AudioManager::Get()->GetAssociatedOutputDeviceID(raw_source_id); } CalculateHMAC(raw_sink_id); } void WebrtcAudioPrivateGetAssociatedSinkFunction::OnHMACCalculated( const std::string& associated_sink_id) { DCHECK_CURRENTLY_ON(BrowserThread::UI); if (associated_sink_id == media::AudioDeviceDescription::kDefaultDeviceId) { DVLOG(2) << "Got default ID, replacing with empty ID."; results_ = wap::GetAssociatedSink::Results::Create(""); } else { results_ = wap::GetAssociatedSink::Results::Create(associated_sink_id); } SendResponse(true); } } // namespace extensions
geminy/aidear
oss/qt/qt-everywhere-opensource-src-5.9.0/qtwebengine/src/3rdparty/chromium/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc
C++
gpl-3.0
16,708
/* radare - LGPL - Copyright 2015-2017 - pancake */ #include <r_types.h> #include <r_util.h> #include <r_lib.h> #include <r_bin.h> #ifdef _MSC_VER typedef struct art_header_t { #else typedef struct __packed art_header_t { #endif ut8 magic[4]; ut8 version[4]; ut32 image_base; ut32 image_size; ut32 bitmap_offset; ut32 bitmap_size; ut32 checksum; /* adler32 */ ut32 oat_file_begin; // oat_file_begin ut32 oat_data_begin; ut32 oat_data_end; ut32 oat_file_end; /* patch_delta is the amount of the base address the image is relocated */ st32 patch_delta; /* image_roots: address of an array of objects needed to initialize */ ut32 image_roots; ut32 compile_pic; } ARTHeader; typedef struct { Sdb *kv; ARTHeader art; } ArtObj; static int art_header_load(ARTHeader *art, RBuffer *buf, Sdb *db) { /* TODO: handle read errors here */ if (r_buf_size (buf) < sizeof (ARTHeader)) { return false; } (void) r_buf_fread_at (buf, 0, (ut8 *) art, "IIiiiiiiiiiiii", 1); sdb_set (db, "img.base", sdb_fmt (0, "0x%x", art->image_base), 0); sdb_set (db, "img.size", sdb_fmt (0, "0x%x", art->image_size), 0); sdb_set (db, "art.checksum", sdb_fmt (0, "0x%x", art->checksum), 0); sdb_set (db, "art.version", sdb_fmt (0, "%c%c%c", art->version[0], art->version[1], art->version[2]), 0); sdb_set (db, "oat.begin", sdb_fmt (0, "0x%x", art->oat_file_begin), 0); sdb_set (db, "oat.end", sdb_fmt (0, "0x%x", art->oat_file_end), 0); sdb_set (db, "oat_data.begin", sdb_fmt (0, "0x%x", art->oat_data_begin), 0); sdb_set (db, "oat_data.end", sdb_fmt (0, "0x%x", art->oat_data_end), 0); sdb_set (db, "patch_delta", sdb_fmt (0, "0x%x", art->patch_delta), 0); sdb_set (db, "image_roots", sdb_fmt (0, "0x%x", art->image_roots), 0); sdb_set (db, "compile_pic", sdb_fmt (0, "0x%x", art->compile_pic), 0); return true; } static Sdb *get_sdb(RBinFile *bf) { RBinObject *o = bf->o; if (!o) { return NULL; } ArtObj *ao = o->bin_obj; return ao? ao->kv: NULL; } static void *load_bytes(RBinFile *arch, const ut8 *buf, ut64 sz, ut64 la, Sdb *sdb){ ArtObj *ao = R_NEW0 (ArtObj); if (!ao) { return NULL; } ao->kv = sdb_new0 (); if (!ao->kv) { free (ao); return NULL; } art_header_load (&ao->art, arch->buf, ao->kv); sdb_ns_set (sdb, "info", ao->kv); return ao; } static bool load(RBinFile *arch) { return true; } static int destroy(RBinFile *arch) { return true; } static ut64 baddr(RBinFile *arch) { ArtObj *ao = arch->o->bin_obj; return ao? ao->art.image_base: 0; } static RList *strings(RBinFile *arch) { return NULL; } static RBinInfo *info(RBinFile *arch) { ArtObj *ao; RBinInfo *ret; if (!arch || !arch->o || !arch->o->bin_obj) { return NULL; } ret = R_NEW0 (RBinInfo); if (!ret) { return NULL; } // art_header_load (&art, arch->buf); ao = arch->o->bin_obj; ret->lang = NULL; ret->file = arch->file? strdup (arch->file): NULL; ret->type = strdup ("ART"); ret->bclass = malloc (5); memcpy (ret->bclass, &ao->art.version, 4); ret->bclass[3] = 0; ret->rclass = strdup ("program"); ret->os = strdup ("android"); ret->subsystem = strdup ("unknown"); ret->machine = strdup ("arm"); ret->arch = strdup ("arm"); ret->has_va = 1; ret->has_lit = true; ret->has_pi = ao->art.compile_pic; ret->bits = 16; // 32? 64? ret->big_endian = 0; ret->dbg_info = 0; return ret; } static bool check_bytes(const ut8 *buf, ut64 length) { return (buf && length > 3 && !strncmp ((const char *) buf, "art\n", 4)); } static RList *entries(RBinFile *arch) { RList *ret; RBinAddr *ptr = NULL; if (!(ret = r_list_new ())) { return NULL; } ret->free = free; if (!(ptr = R_NEW0 (RBinAddr))) { return ret; } ptr->paddr = ptr->vaddr = 0; r_list_append (ret, ptr); return ret; } static RList *sections(RBinFile *arch) { ArtObj *ao = arch->o->bin_obj; if (!ao) { return NULL; } ARTHeader art = ao->art; RList *ret = NULL; RBinSection *ptr = NULL; if (!(ret = r_list_new ())) { return NULL; } ret->free = free; if (!(ptr = R_NEW0 (RBinSection))) { return ret; } strncpy (ptr->name, "load", R_BIN_SIZEOF_STRINGS); ptr->size = arch->buf->length; ptr->vsize = art.image_size; // TODO: align? ptr->paddr = 0; ptr->vaddr = art.image_base; ptr->srwx = R_BIN_SCN_READABLE | R_BIN_SCN_MAP; // r-- ptr->add = true; r_list_append (ret, ptr); if (!(ptr = R_NEW0 (RBinSection))) { return ret; } strncpy (ptr->name, "bitmap", R_BIN_SIZEOF_STRINGS); ptr->size = art.bitmap_size; ptr->vsize = art.bitmap_size; ptr->paddr = art.bitmap_offset; ptr->vaddr = art.image_base + art.bitmap_offset; ptr->srwx = R_BIN_SCN_READABLE | R_BIN_SCN_EXECUTABLE | R_BIN_SCN_MAP; // r-x ptr->add = true; r_list_append (ret, ptr); if (!(ptr = R_NEW0 (RBinSection))) { return ret; } strncpy (ptr->name, "oat", R_BIN_SIZEOF_STRINGS); ptr->paddr = art.bitmap_offset; ptr->vaddr = art.oat_file_begin; ptr->size = art.oat_file_end - art.oat_file_begin; ptr->vsize = ptr->size; ptr->srwx = R_BIN_SCN_READABLE | R_BIN_SCN_EXECUTABLE | R_BIN_SCN_MAP; // r-x ptr->add = true; r_list_append (ret, ptr); if (!(ptr = R_NEW0 (RBinSection))) { return ret; } strncpy (ptr->name, "oat_data", R_BIN_SIZEOF_STRINGS); ptr->paddr = art.bitmap_offset; ptr->vaddr = art.oat_data_begin; ptr->size = art.oat_data_end - art.oat_data_begin; ptr->vsize = ptr->size; ptr->srwx = R_BIN_SCN_READABLE | R_BIN_SCN_MAP; // r-- ptr->add = true; r_list_append (ret, ptr); return ret; } RBinPlugin r_bin_plugin_art = { .name = "art", .desc = "Android Runtime", .license = "LGPL3", .get_sdb = &get_sdb, .load = &load, .load_bytes = &load_bytes, .destroy = &destroy, .check_bytes = &check_bytes, .baddr = &baddr, .sections = &sections, .entries = entries, .strings = &strings, .info = &info, }; #ifndef CORELIB RLibStruct radare_plugin = { .type = R_LIB_TYPE_BIN, .data = &r_bin_plugin_art, .version = R2_VERSION }; #endif
8tab/radare2
libr/bin/p/bin_art.c
C
gpl-3.0
5,884
<?php /** * Key-value field class. */ abstract class RWMB_Key_Value_Field extends RWMB_Text_Field { /** * Get field HTML * * @param mixed $meta * @param array $field * @return string */ static function html( $meta, $field ) { // Key $key = isset( $meta[0] ) ? $meta[0] : ''; $attributes = self::get_attributes( $field, $key ); $attributes['placeholder'] = $field['placeholder']['key']; $html = sprintf( '<input %s>', self::render_attributes( $attributes ) ); // Value $val = isset( $meta[1] ) ? $meta[1] : ''; $attributes = self::get_attributes( $field, $val ); $attributes['placeholder'] = $field['placeholder']['value']; $html .= sprintf( '<input %s>', self::render_attributes( $attributes ) ); return $html; } /** * Show begin HTML markup for fields * * @param mixed $meta * @param array $field * @return string */ static function begin_html( $meta, $field ) { $desc = $field['desc'] ? "<p id='{$field['id']}_description' class='description'>{$field['desc']}</p>" : ''; if ( empty( $field['name'] ) ) return '<div class="rwmb-input">' . $desc; return sprintf( '<div class="rwmb-label"> <label for="%s">%s</label> </div> <div class="rwmb-input"> %s', $field['id'], $field['name'], $desc ); } /** * Do not show field description. * @param array $field * @return string */ public static function element_description( $field ) { return ''; } /** * Escape meta for field output * * @param mixed $meta * @return mixed */ static function esc_meta( $meta ) { foreach ( (array) $meta as $k => $pairs ) { $meta[$k] = array_map( 'esc_attr', (array) $pairs ); } return $meta; } /** * Sanitize field value. * * @param mixed $new * @param mixed $old * @param int $post_id * @param array $field * * @return string */ static function value( $new, $old, $post_id, $field ) { foreach ( $new as &$arr ) { if ( empty( $arr[0] ) && empty( $arr[1] ) ) $arr = false; } $new = array_filter( $new ); return $new; } /** * Normalize parameters for field * * @param array $field * @return array */ static function normalize( $field ) { $field = parent::normalize( $field ); $field['clone'] = true; $field['multiple'] = true; $field['attributes']['type'] = 'text'; $field['placeholder'] = wp_parse_args( (array) $field['placeholder'], array( 'key' => 'Key', 'value' => 'Value', ) ); return $field; } /** * Format value for the helper functions. * @param array $field Field parameter * @param string|array $value The field meta value * @return string */ public static function format_value( $field, $value ) { $output = '<ul>'; foreach ( $value as $subvalue ) { $output .= sprintf( '<li><label>%s</label>: %s</li>', $subvalue[0], $subvalue[1] ); } $output .= '</ul>'; return $output; } }
mahdCompany/fnl-website
wp-content/themes/eventum/lib/meta-box/inc/fields/key-value.php
PHP
gpl-3.0
3,063
/* // g2o - General Graph Optimization // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "simulator.h" #include "rand.h" #include <map> #include <iostream> #include <cmath> using namespace std; namespace g2o { namespace tutorial { using namespace Eigen; # ifdef _MSC_VER inline double round(double number) { return number < 0.0 ? ceil(number - 0.5) : floor(number + 0.5); } # endif typedef std::map<int, std::map<int, Simulator::LandmarkPtrVector> > LandmarkGrid; Simulator::Simulator() { time_t seed = time(0); Rand::seed_rand(static_cast<unsigned int>(seed)); } Simulator::~Simulator() { } void Simulator::simulate(int numNodes, const SE2& sensorOffset) { // simulate a robot observing landmarks while travelling on a grid int steps = 5; double stepLen = 1.0; int boundArea = 50; double maxSensorRangeLandmarks = 2.5 * stepLen; int landMarksPerSquareMeter = 1; double observationProb = 0.8; int landmarksRange=2; Vector2d transNoise(0.05, 0.01); double rotNoise = DEG2RAD(2.); Vector2d landmarkNoise(0.05, 0.05); Vector2d bound(boundArea, boundArea); // bound ? VectorXd probLimits(MO_NUM_ELEMS); for (int i = 0; i < probLimits.size(); ++i) probLimits[i] = (i + 1) / (double) MO_NUM_ELEMS; Matrix3d covariance; covariance.fill(0.); covariance(0, 0) = transNoise[0]*transNoise[0]; covariance(1, 1) = transNoise[1]*transNoise[1]; covariance(2, 2) = rotNoise*rotNoise; Matrix3d information = covariance.inverse(); SE2 maxStepTransf(stepLen * steps, 0, 0); Simulator::PosesVector& poses = _poses; //pose poses.clear(); LandmarkVector& landmarks = _landmarks; //landmarks landmarks.clear(); Simulator::GridPose firstPose; firstPose.id = 0; firstPose.truePose = SE2(0,0,0); firstPose.simulatorPose = SE2(0,0,0); poses.push_back(firstPose); //add pose(0) cerr << "Simulator: sampling nodes ..."; while ((int)poses.size() < numNodes) { // add straight motions for (int i = 1; i < steps && (int)poses.size() < numNodes; ++i) { // the pose is global odometry Simulator::GridPose nextGridPose = generateNewPose(poses.back(), SE2(stepLen,0,0), transNoise, rotNoise); poses.push_back(nextGridPose); //add pose vector } if ((int)poses.size() == numNodes) break; // sample a new motion direction change direction double sampleMove = Rand::uniform_rand(0., 1.); int motionDirection = 0; while (probLimits[motionDirection] < sampleMove && motionDirection+1 < MO_NUM_ELEMS) { motionDirection++; } SE2 nextMotionStep = getMotion(motionDirection, stepLen); Simulator::GridPose nextGridPose = generateNewPose(poses.back(), nextMotionStep, transNoise, rotNoise); // boundaries check // check whether we will walk outside the boundaries in the next iteration SE2 nextStepFinalPose = nextGridPose.truePose * maxStepTransf; if (fabs(nextStepFinalPose.translation().x()) >= bound[0] || fabs(nextStepFinalPose.translation().y()) >= bound[1]) { //cerr << "b"; // will be outside boundaries using this for (int i = 0; i < MO_NUM_ELEMS; ++i) { nextMotionStep = getMotion(i, stepLen); nextGridPose = generateNewPose(poses.back(), nextMotionStep, transNoise, rotNoise); nextStepFinalPose = nextGridPose.truePose * maxStepTransf; if (fabs(nextStepFinalPose.translation().x()) < bound[0] && fabs(nextStepFinalPose.translation().y()) < bound[1]) break; } } poses.push_back(nextGridPose); //add pose vector } cerr << "done." << endl; // creating landmarks along the trajectory cerr << "Simulator: Creating landmarks ... "; LandmarkGrid grid; for (PosesVector::const_iterator it = poses.begin(); it != poses.end(); ++it) { int ccx = (int)round(it->truePose.translation().x()); int ccy = (int)round(it->truePose.translation().y()); for (int a=-landmarksRange; a<=landmarksRange; a++) for (int b=-landmarksRange; b<=landmarksRange; b++) { int cx=ccx+a; int cy=ccy+b; /** * @brief Subscript ( @c [] ) access to %map data. * @param __k The key for which data should be retrieved. * @return A reference to the data of the (key,data) %pair. * * Allows for easy lookup with the subscript ( @c [] ) * operator. Returns data associated with the key specified in * subscript. If the key does not exist, a pair with that key * is created using default values, which is then returned. * * Lookup requires logarithmic time. */ LandmarkPtrVector& landmarksForCell = grid[cx][cy]; //landmark vector if (landmarksForCell.size() == 0) { for (int i = 0; i < landMarksPerSquareMeter; ++i) { Landmark* l = new Landmark(); double offx, offy; do { offx = Rand::uniform_rand(-0.5*stepLen, 0.5*stepLen); offy = Rand::uniform_rand(-0.5*stepLen, 0.5*stepLen); } while (hypot_sqr(offx, offy) < 0.25*0.25); l->truePose[0] = cx + offx; l->truePose[1] = cy + offy; landmarksForCell.push_back(l); //the global pos landmarks } } } } cerr << "done." << endl; cerr << "Simulator: Simulating landmark observations for the poses ... "; double maxSensorSqr = maxSensorRangeLandmarks * maxSensorRangeLandmarks; int globalId = 0; for (PosesVector::iterator it = poses.begin(); it != poses.end(); ++it) { Simulator::GridPose& pv = *it; int cx = (int)round(it->truePose.translation().x()); int cy = (int)round(it->truePose.translation().y()); int numGridCells = (int)(maxSensorRangeLandmarks) + 1; pv.id = globalId++; SE2 trueInv = pv.truePose.inverse(); for (int xx = cx - numGridCells; xx <= cx + numGridCells; ++xx) for (int yy = cy - numGridCells; yy <= cy + numGridCells; ++yy) { LandmarkPtrVector& landmarksForCell = grid[xx][yy]; if (landmarksForCell.size() == 0) continue; for (size_t i = 0; i < landmarksForCell.size(); ++i) { Landmark* l = landmarksForCell[i]; double dSqr = hypot_sqr(pv.truePose.translation().x() - l->truePose.x(), pv.truePose.translation().y() - l->truePose.y()); if (dSqr > maxSensorSqr) continue; double obs = Rand::uniform_rand(0.0, 1.0); if (obs > observationProb) // we do not see this one... continue; if (l->id < 0) l->id = globalId++; if (l->seenBy.size() == 0) { Vector2d trueObservation = trueInv * l->truePose; Vector2d observation = trueObservation; observation[0] += Rand::gauss_rand(0., landmarkNoise[0]); observation[1] += Rand::gauss_rand(0., landmarkNoise[1]); l->simulatedPose = pv.simulatorPose * observation; } l->seenBy.push_back(pv.id); // add seen pose to landmark pv.landmarks.push_back(l); // add landmark to pose } } } cerr << "done." << endl; // add the odometry measurements _odometry.clear(); cerr << "Simulator: Adding odometry measurements ... "; for (size_t i = 1; i < poses.size(); ++i) { const GridPose& prev = poses[i-1]; const GridPose& p = poses[i]; _odometry.push_back(GridEdge()); GridEdge& edge = _odometry.back(); edge.from = prev.id; edge.to = p.id; edge.trueTransf = prev.truePose.inverse() * p.truePose; edge.simulatorTransf = prev.simulatorPose.inverse() * p.simulatorPose; edge.information = information; } cerr << "done." << endl; _landmarks.clear(); _landmarkObservations.clear(); // add the landmark observations { cerr << "Simulator: add landmark observations ... "; Matrix2d covariance; covariance.fill(0.); covariance(0, 0) = landmarkNoise[0]*landmarkNoise[0]; covariance(1, 1) = landmarkNoise[1]*landmarkNoise[1]; Matrix2d information = covariance.inverse(); for (size_t i = 0; i < poses.size(); ++i) { const GridPose& p = poses[i]; for (size_t j = 0; j < p.landmarks.size(); ++j) { Landmark* l = p.landmarks[j]; if (l->seenBy.size() > 0 && l->seenBy[0] == p.id) { landmarks.push_back(*l); // add it when first observed. } } } for (size_t i = 0; i < poses.size(); ++i) { const GridPose& p = poses[i]; SE2 trueInv = (p.truePose * sensorOffset).inverse(); for (size_t j = 0; j < p.landmarks.size(); ++j) { Landmark* l = p.landmarks[j]; Vector2d observation; Vector2d trueObservation = trueInv * l->truePose; observation = trueObservation; if (l->seenBy.size() > 0 && l->seenBy[0] == p.id) { // write the initial position of the landmark observation = (p.simulatorPose * sensorOffset).inverse() * l->simulatedPose; } else { // create observation for the LANDMARK using the true positions observation[0] += Rand::gauss_rand(0., landmarkNoise[0]); observation[1] += Rand::gauss_rand(0., landmarkNoise[1]); } _landmarkObservations.push_back(LandmarkEdge()); // add landmark edge LandmarkEdge& le = _landmarkObservations.back(); le.from = p.id; le.to = l->id; le.trueMeas = trueObservation; le.simulatorMeas = observation; // global pose le.information = information; } } cerr << "done." << endl; } // cleaning up for (LandmarkGrid::iterator it = grid.begin(); it != grid.end(); ++it) { for (std::map<int, Simulator::LandmarkPtrVector>::iterator itt = it->second.begin(); itt != it->second.end(); ++itt) { Simulator::LandmarkPtrVector& landmarks = itt->second; for (size_t i = 0; i < landmarks.size(); ++i) delete landmarks[i]; } } } Simulator::GridPose Simulator::generateNewPose(const Simulator::GridPose& prev, const SE2& trueMotion, const Eigen::Vector2d& transNoise, double rotNoise) { Simulator::GridPose nextPose; nextPose.id = prev.id + 1; nextPose.truePose = prev.truePose * trueMotion; SE2 noiseMotion = sampleTransformation(trueMotion, transNoise, rotNoise); nextPose.simulatorPose = prev.simulatorPose * noiseMotion; return nextPose; } SE2 Simulator::getMotion(int motionDirection, double stepLen) { switch (motionDirection) { case MO_LEFT: return SE2(stepLen, 0, 0.5*M_PI); case MO_RIGHT: return SE2(stepLen, 0, -0.5*M_PI); default: cerr << "Unknown motion direction" << endl; return SE2(stepLen, 0, -0.5*M_PI); } } SE2 Simulator::sampleTransformation(const SE2& trueMotion_, const Eigen::Vector2d& transNoise, double rotNoise) { Vector3d trueMotion = trueMotion_.toVector(); SE2 noiseMotion( trueMotion[0] + Rand::gauss_rand(0.0, transNoise[0]), trueMotion[1] + Rand::gauss_rand(0.0, transNoise[1]), trueMotion[2] + Rand::gauss_rand(0.0, rotNoise)); return noiseMotion; } } // end namespace } // end namespace
kintzhao/cv_ekfslam
tutorial_slam2d/class/simulator.cpp
C++
gpl-3.0
14,071
/* Copyright (C) 2014-2016 [email protected] This file is part of dnSpy dnSpy 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 3 of the License, or (at your option) any later version. dnSpy 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 dnSpy. If not, see <http://www.gnu.org/licenses/>. */ using System; using System.Diagnostics; using System.IO; using dnlib.DotNet; using dnSpy.Shared.Files; using dnSpy.Shared.MVVM; namespace dnSpy.Files.Tabs.Dialogs { sealed class GACFileVM : ViewModelBase { public object NameObject { get { return this; } } public object VersionObject { get { return this; } } public string Name { get { return gacFileInfo.Assembly.Name; } } public Version Version { get { return gacFileInfo.Assembly.Version; } } public bool IsExe { get { return gacFileInfo.Path.EndsWith(".exe", StringComparison.OrdinalIgnoreCase); } } public string CreatedBy { get { if (createdBy == null) CalculateInfo(); return createdBy; } } string createdBy; public string FileVersion { get { if (fileVersion == null) CalculateInfo(); return fileVersion; } } string fileVersion; public string Path { get { return gacFileInfo.Path; } } public bool IsDuplicate { get { return isDuplicate; } set { if (isDuplicate != value) { isDuplicate = value; OnPropertyChanged("IsDuplicate"); } } } bool isDuplicate; public IAssembly Assembly { get { return gacFileInfo.Assembly; } } public OpenFromGACVM Owner { get { return owner; } } readonly OpenFromGACVM owner; readonly GacFileInfo gacFileInfo; public GACFileVM(OpenFromGACVM owner, GacFileInfo gacFileInfo) { this.owner = owner; this.gacFileInfo = gacFileInfo; } string CalculateCreatedByFromAttribute() { if (!File.Exists(gacFileInfo.Path)) return string.Empty; try { using (var mod = ModuleDefMD.Load(gacFileInfo.Path)) return GetCreatedBy(mod) ?? string.Empty; } catch (BadImageFormatException) { } catch (IOException) { } return string.Empty; } string GetCreatedBy(ModuleDef mod) { var asm = mod.Assembly; if (asm == null) return null; var ca = asm.CustomAttributes.Find("System.Reflection.AssemblyCompanyAttribute"); if (ca == null) return null; if (ca.ConstructorArguments.Count != 1) return null; var arg = ca.ConstructorArguments[0]; var s = arg.Value as UTF8String; if (UTF8String.IsNull(s)) return null; return s; } void CalculateInfo() { createdBy = string.Empty; fileVersion = string.Empty; if (!File.Exists(gacFileInfo.Path)) return; var info = FileVersionInfo.GetVersionInfo(gacFileInfo.Path); fileVersion = Filter(info.FileVersion ?? string.Empty); createdBy = Filter(info.CompanyName); if (string.IsNullOrWhiteSpace(createdBy)) createdBy = CalculateCreatedByFromAttribute() ?? string.Empty; } static string Filter(string s) { if (s == null) return string.Empty; const int MAX = 512; if (s.Length > MAX) s = s.Substring(0, MAX); return s; } } }
levisre/dnSpy
dnSpy/Files/Tabs/Dialogs/GACFileVM.cs
C#
gpl-3.0
3,534
using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Windows.Forms; using System.Reflection; namespace distribution_explorer { partial class distexAboutBox : Form { public distexAboutBox() { InitializeComponent(); // Initialize the AboutBox to display the product information from the assembly information. // Change assembly information settings for your application through either: // - Project->Properties->Application->Assembly Information // - AssemblyInfo.cs this.Text = String.Format("About {0}", AssemblyTitle); this.labelProductName.Text = AssemblyProduct; this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion); this.labelCopyright.Text = AssemblyCopyright; this.labelCompanyName.Text = AssemblyCompany; this.textBoxDescription.Text = AssemblyDescription; // URL http://boost-consulting.com/vault/index.php?action=downloadfile&filename=math_toolkit.html&directory=Math%20-%20Numerics& } #region Assembly Attribute Accessors public string AssemblyTitle { get { // Get all Title attributes on this assembly object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false); // If there is at least one Title attribute if (attributes.Length > 0) { // Select the first one AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0]; // If it is not an empty string, return it if (titleAttribute.Title != "") return titleAttribute.Title; } // If there was no Title attribute, or if the Title attribute was the empty string, return the .exe name return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase); } } public string AssemblyVersion { get { return Assembly.GetExecutingAssembly().GetName().Version.ToString(); } } public string AssemblyDescription { get { // Get all Description attributes on this assembly object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false); // If there aren't any Description attributes, return an empty string if (attributes.Length == 0) return ""; // If there is a Description attribute, return its value return ((AssemblyDescriptionAttribute)attributes[0]).Description; } } public string AssemblyProduct { get { // Get all Product attributes on this assembly object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false); // If there aren't any Product attributes, return an empty string if (attributes.Length == 0) return ""; // If there is a Product attribute, return its value return ((AssemblyProductAttribute)attributes[0]).Product; } } public string AssemblyCopyright { get { // Get all Copyright attributes on this assembly object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); // If there aren't any Copyright attributes, return an empty string if (attributes.Length == 0) return ""; // If there is a Copyright attribute, return its value return ((AssemblyCopyrightAttribute)attributes[0]).Copyright; } } public string AssemblyCompany { get { // Get all Company attributes on this assembly object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false); // If there aren't any Company attributes, return an empty string if (attributes.Length == 0) return ""; // If there is a Company attribute, return its value return ((AssemblyCompanyAttribute)attributes[0]).Company; } } #endregion } }
kelvindk/Video-Stabilization
boost_1_42_0/libs/math/dot_net_example/distribution_explorer/distexAboutBox.cs
C#
gpl-3.0
4,820
<html><body>Priestess Athenia:<br> I am waiting on Iason Heine's decision. Only with his support can we rejuvinate this zone to its original splendor. Do you perhaps know of him?<br> <Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest Q00237_WindsOfChange 32643-02.html">"I do. I've brought you a letter from the man, actually."</Button> </body></html>
karolusw/l2j
game/data/scripts/quests/Q00237_WindsOfChange/32643-01.html
HTML
gpl-3.0
357
<!DOCTYPE html> <html lang="en"> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/> <meta charset="utf-8"/> <title>API Documentation</title> <meta name="author" content=""/> <meta name="description" content=""/> <link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css" rel="stylesheet"> <link href="http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css" rel="stylesheet"> <link href="../css/prism.css" rel="stylesheet" media="all"/> <link href="../css/template.css" rel="stylesheet" media="all"/> <!--[if lt IE 9]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script> <![endif]--> <script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.min.js" type="text/javascript"></script> <script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script> <script src="../js/jquery.smooth-scroll.js"></script> <script src="../js/prism.min.js"></script> <!-- TODO: Add http://jscrollpane.kelvinluck.com/ to style the scrollbars for browsers not using webkit--> <script type="text/javascript"> function loadExternalCodeSnippets() { Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function (pre) { var src = pre.getAttribute('data-src'); var extension = (src.match(/\.(\w+)$/) || [, ''])[1]; var language = 'php'; var code = document.createElement('code'); code.className = 'language-' + language; pre.textContent = ''; code.textContent = 'Loading…'; pre.appendChild(code); var xhr = new XMLHttpRequest(); xhr.open('GET', src, true); xhr.onreadystatechange = function () { if (xhr.readyState == 4) { if (xhr.status < 400 && xhr.responseText) { code.textContent = xhr.responseText; Prism.highlightElement(code); } else if (xhr.status >= 400) { code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText; } else { code.textContent = '✖ Error: File does not exist or is empty'; } } }; xhr.send(null); }); } $(document).ready(function(){ loadExternalCodeSnippets(); }); $('#source-view').on('shown', function () { loadExternalCodeSnippets(); }) </script> <link rel="shortcut icon" href="../images/favicon.ico"/> <link rel="apple-touch-icon" href="../images/apple-touch-icon.png"/> <link rel="apple-touch-icon" sizes="72x72" href="../images/apple-touch-icon-72x72.png"/> <link rel="apple-touch-icon" sizes="114x114" href="../images/apple-touch-icon-114x114.png"/> </head> <body> <div class="navbar navbar-fixed-top"> <div class="navbar-inner"> <div class="container"> <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <i class="icon-ellipsis-vertical"></i> </a> <a class="brand" href="../index.html">API Documentation</a> <div class="nav-collapse"> <ul class="nav pull-right"> <li class="dropdown"> <a href="../index.html" class="dropdown-toggle" data-toggle="dropdown"> API Documentation <b class="caret"></b> </a> <ul class="dropdown-menu"> </ul> </li> <li class="dropdown" id="charts-menu"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> Charts <b class="caret"></b> </a> <ul class="dropdown-menu"> <li> <a href="../graphs/class.html"> <i class="icon-list-alt"></i>&#160;Class hierarchy diagram </a> </li> </ul> </li> <li class="dropdown" id="reports-menu"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> Reports <b class="caret"></b> </a> <ul class="dropdown-menu"> <li> <a href="../reports/errors.html"> <i class="icon-list-alt"></i>&#160;Errors </a> </li> <li> <a href="../reports/markers.html"> <i class="icon-list-alt"></i>&#160;Markers </a> </li> </ul> </li> </ul> </div> </div> </div> <!--<div class="go_to_top">--> <!--<a href="#___" style="color: inherit">Back to top&#160;&#160;<i class="icon-upload icon-white"></i></a>--> <!--</div>--> </div> <div id="___" class="container-fluid"> <section class="row-fluid"> <div class="span2 sidebar"> <div class="accordion" style="margin-bottom: 0"> <div class="accordion-group"> <div class="accordion-heading"> <a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-3360190"></a> <a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a> </div> <div id="namespace-3360190" class="accordion-body collapse in"> <div class="accordion-inner"> <ul> <li class="class"><a href="../classes/Partecipazione.html">Partecipazione</a></li> <li class="class"><a href="../classes/Dimissione.html">Dimissione</a></li> <li class="class"><a href="../classes/Zip.html">Zip</a></li> <li class="class"><a href="../classes/Commento.html">Commento</a></li> <li class="class"><a href="../classes/Utente.html">Utente</a></li> <li class="class"><a href="../classes/Appartenenza.html">Appartenenza</a></li> <li class="class"><a href="../classes/Anonimo.html">Anonimo</a></li> <li class="class"><a href="../classes/Documento.html">Documento</a></li> <li class="class"><a href="../classes/Mail.html">Mail</a></li> <li class="class"><a href="../classes/Sessione.html">Sessione</a></li> <li class="class"><a href="../classes/Entita.html">Entita</a></li> <li class="class"><a href="../classes/Area.html">Area</a></li> <li class="class"><a href="../classes/RichiestaTurno.html">RichiestaTurno</a></li> <li class="class"><a href="../classes/Annunci.html">Annunci</a></li> <li class="class"><a href="../classes/Gruppo.html">Gruppo</a></li> <li class="class"><a href="../classes/Patentirichieste.html">Patentirichieste</a></li> <li class="class"><a href="../classes/Reperibilita.html">Reperibilita</a></li> <li class="class"><a href="../classes/GeocoderResult.html">GeocoderResult</a></li> <li class="class"><a href="../classes/AppartenenzaGruppo.html">AppartenenzaGruppo</a></li> <li class="class"><a href="../classes/Ricerca.html">Ricerca</a></li> <li class="class"><a href="../classes/APIServer.html">APIServer</a></li> <li class="class"><a href="../classes/Volontario.html">Volontario</a></li> <li class="class"><a href="../classes/Veicoli.html">Veicoli</a></li> <li class="class"><a href="../classes/Regionale.html">Regionale</a></li> <li class="class"><a href="../classes/ElementoRichiesta.html">ElementoRichiesta</a></li> <li class="class"><a href="../classes/ICalendar.html">ICalendar</a></li> <li class="class"><a href="../classes/Errore.html">Errore</a></li> <li class="class"><a href="../classes/File.html">File</a></li> <li class="class"><a href="../classes/Quota.html">Quota</a></li> <li class="class"><a href="../classes/Comitato.html">Comitato</a></li> <li class="class"><a href="../classes/Oggetto.html">Oggetto</a></li> <li class="class"><a href="../classes/Avatar.html">Avatar</a></li> <li class="class"><a href="../classes/Persona.html">Persona</a></li> <li class="class"><a href="../classes/Trasferimento.html">Trasferimento</a></li> <li class="class"><a href="../classes/Turno.html">Turno</a></li> <li class="class"><a href="../classes/Attivita.html">Attivita</a></li> <li class="class"><a href="../classes/Provinciale.html">Provinciale</a></li> <li class="class"><a href="../classes/PDF.html">PDF</a></li> <li class="class"><a href="../classes/Estensione.html">Estensione</a></li> <li class="class"><a href="../classes/Autorizzazione.html">Autorizzazione</a></li> <li class="class"><a href="../classes/Coturno.html">Coturno</a></li> <li class="class"><a href="../classes/Nazionale.html">Nazionale</a></li> <li class="class"><a href="../classes/TitoloPersonale.html">TitoloPersonale</a></li> <li class="class"><a href="../classes/Delegato.html">Delegato</a></li> <li class="class"><a href="../classes/Email.html">Email</a></li> <li class="class"><a href="../classes/Riserva.html">Riserva</a></li> <li class="class"><a href="../classes/Excel.html">Excel</a></li> <li class="class"><a href="../classes/GeoPolitica.html">GeoPolitica</a></li> <li class="class"><a href="../classes/Geocoder.html">Geocoder</a></li> <li class="class"><a href="../classes/GeoEntita.html">GeoEntita</a></li> <li class="class"><a href="../classes/DT.html">DT</a></li> <li class="class"><a href="../classes/Locale.html">Locale</a></li> <li class="class"><a href="../classes/Titolo.html">Titolo</a></li> <li class="class"><a href="../classes/ePDO.html">ePDO</a></li> </ul> </div> </div> </div> </div> </div> </section> <section class="row-fluid"> <div class="span10 offset2"> <div class="row-fluid"> <div class="span8 content file"> <nav> </nav> <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal"><i class="icon-code"></i></a> <h1><small>inc</small>admin.script.php</h1> <p><em></em></p> </div> <aside class="span4 detailsbar"> <dl> <dt>Package</dt> <dd><div class="namespace-wrapper">Gaia</div></dd> </dl> <h2>Tags</h2> <table class="table table-condensed"> <tr><td colspan="2"><em>None found</em></td></tr> </table> </aside> </div> </div> </section> <div id="source-view" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="source-view-label" aria-hidden="true"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h3 id="source-view-label"></h3> </div> <div class="modal-body"> <pre data-src="../files/inc/admin.script.php.txt" class="language-php line-numbers"></pre> </div> </div> <footer class="row-fluid"> <section class="span10 offset2"> <section class="row-fluid"> <section class="span10 offset1"> <section class="row-fluid footer-sections"> <section class="span4"> <h1><i class="icon-code"></i></h1> <div> <ul> </ul> </div> </section> <section class="span4"> <h1><i class="icon-bar-chart"></i></h1> <div> <ul> <li><a href="">Class Hierarchy Diagram</a></li> </ul> </div> </section> <section class="span4"> <h1><i class="icon-pushpin"></i></h1> <div> <ul> <li><a href="">Errors</a></li> <li><a href="">Markers</a></li> </ul> </div> </section> </section> </section> </section> <section class="row-fluid"> <section class="span10 offset1"> <hr /> Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored on September 18th, 2013 at 18:37. </section> </section> </section> </footer> </div> </body> </html>
CroceRossaCatania/gaia
docs/files/inc.admin.script.php.html
HTML
gpl-3.0
17,055
/* Test of rounding towards negative infinity. Copyright (C) 2007-2013 Free Software Foundation, 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 3 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/>. */ /* Written by Bruno Haible <[email protected]>, 2007. */ #include <config.h> #include <math.h> #include "signature.h" SIGNATURE_CHECK (floor, double, (double)); #include "isnand-nolibm.h" #include "minus-zero.h" #include "infinity.h" #include "nan.h" #include "macros.h" int main (int argc, char **argv _GL_UNUSED) { /* Zero. */ ASSERT (floor (0.0) == 0.0); ASSERT (floor (minus_zerod) == 0.0); /* Positive numbers. */ ASSERT (floor (0.3) == 0.0); ASSERT (floor (0.7) == 0.0); ASSERT (floor (1.0) == 1.0); ASSERT (floor (1.5) == 1.0); ASSERT (floor (1.999) == 1.0); ASSERT (floor (2.0) == 2.0); ASSERT (floor (65535.999) == 65535.0); ASSERT (floor (65536.0) == 65536.0); ASSERT (floor (2.341e31) == 2.341e31); /* Negative numbers. */ ASSERT (floor (-0.3) == -1.0); ASSERT (floor (-0.7) == -1.0); ASSERT (floor (-1.0) == -1.0); ASSERT (floor (-1.001) == -2.0); ASSERT (floor (-1.5) == -2.0); ASSERT (floor (-1.999) == -2.0); ASSERT (floor (-2.0) == -2.0); ASSERT (floor (-65535.999) == -65536.0); ASSERT (floor (-65536.0) == -65536.0); ASSERT (floor (-2.341e31) == -2.341e31); /* Infinite numbers. */ ASSERT (floor (Infinityd ()) == Infinityd ()); ASSERT (floor (- Infinityd ()) == - Infinityd ()); /* NaNs. */ ASSERT (isnand (floor (NaNd ()))); return 0; }
Distrotech/libunistring
gnulib/tests/test-floor1.c
C
gpl-3.0
2,080
<?php defined ('ITCS') or die ("Go away."); $link_Id = IRequest::getVar('linkId'); $Link=explode("_",$link_Id); $type=$Link[0]; $typeID=$Link[1]; global $my,$Config; if($type!=NULL && (int)$typeID > 0): ?> <div class="file_select_box"> <div id="tabs"> <div class="attach_menu"> <ul> <li id="li_mycomputer" class="activ"> <a onclick="Attach.attachTab('mycomputer');" href="javascript:void(0);">My Computer</a> </li> <li id="li_googledrive"> <a onclick="Attach.attachTab('googledrive');" href="javascript:void(0);">Google Drive</a> </li> </ul> </div> <div id="div_mycomputer"> <form id="fileupload" method="post" enctype="multipart/form-data"> <span id="imgMessage"></span> <div class="file_upload"><input id="file_input" type="file" name="files" onchange="Attach.uploadimg(this)" /> <span><img id="img_progress" src="<?php echo $Config->site; ?>images/photo_loader.gif" style="width:200px; height:20px; display:none;"/></span> <span class="sp_image_upload" id="uploadedImage"></span> <span id="msg"></span> </div> <br /> <input type="hidden" name="view" value="attach" /> <input type="hidden" name="task" value="ajaxUpload" /> <input type="hidden" name="type" value="<?php echo $type; ?>" /> <input type="hidden" id="getlinkId" name="link_id" value="<?php echo $typeID; ?>" /> <input type="hidden" id="baseUrl" name="baseUrl" value="<?php echo $Config->site; ?>" /> </form> <div class="login_btns" style="text-align:center;"> <input type="submit" value="Attach" class="login btn_1" onclick="Attach.submitform('fileupload');" /> </div> <?php else: ?> <p>SORRY!! You are not Authorized to attach File!</p> <?php endif; ?> <div class="clear"></div> </div> <div id="div_googledrive" style="display:none;"> <?php require 'config.php'; require_once 'google-api-php-client/src/io/Google_HttpRequest.php'; require_once 'google-api-php-client/src/Google_Client.php'; require_once 'google-api-php-client/src/contrib/Google_DriveService.php'; if(count($this->google_token) != 0) { $token_key = $this->google_token->token_key; $client = new Google_Client(); $client->setClientId($oauth_client_id); $client->setClientSecret($oauth_secret); $client->setRedirectUri($oauth_redirect); $client->setScopes(array('https://www.googleapis.com/auth/userinfo.profile', 'https://www.googleapis.com/auth/userinfo.email', 'https://www.googleapis.com/auth/drive', 'https://www.googleapis.com/auth/calendar', 'https://www.googleapis.com/auth/drive.apps.readonly')); $service = new Google_DriveService($client); $client->setAccessToken($token_key); $file = new Google_DriveFile(); $listAllFiles = $service->files->listFiles($token_key); $i = 0; foreach($listAllFiles['items'] as $value):?> <form id="googlefileupload" method="post" enctype="multipart/form-data"> <?php $id = "file".$i; if($value['webContentLink'] != ''): $drivefileDetails = implode(",",array("title"=>$value['title'],"webContentLink"=>$value['webContentLink'],"iconLink"=>$value['iconLink'])); ?> <input type="radio" name="googlefile" id="<?php echo $id;?>" value="<?php echo $drivefileDetails; ?>" /><img src="<?php echo $value['iconLink']; ?>" /><?php echo " ".$value['title']; ?> <br /> <?php else: ?> <input type="radio" name="googlefile" id="<?php echo $id;?>" value="<?php echo $value['title']; ?>" onclick="alert('Please at first share your document with ITCSLIVE.');document.getElementById('<?php echo $id; ?>').checked = false;" /><img src="<?php echo $value['iconLink']; ?>" /><?php echo " ".$value['title']; ?><br /> <?php endif; $i++; endforeach; ?> <div class="login_btns" style="text-align:center;"> <input type="hidden" name="view" value="attach" /> <input type="hidden" name="task" value="googleupload" /> <input type="submit" value="Attach" class="login btn_1" /> </div> </form> <?php } else { echo "<a target='_parent' href='".$Config->site."dashboard'>Link Google Account</a>"; } ?> <div class="clear"></div> </div> <div class="clear"></div> </div> </div> <script type="text/javascript"> jQuery(document).ready(function() { parent.jQuery.colorbox.resize({width:"50%", height:"70%"}); }); </script>
subikar/letsport
templates/itcslive/attach/index.php
PHP
gpl-3.0
4,417
/* GDB RSP and ARM Simulator Copyright (C) 2015 Wong Yan Yin, <[email protected]>, Jackson Teh Ka Sing, <[email protected]> This file is part of GDB RSP and ARM Simulator. 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 3 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/>. */ #include "CMNImmediate.h" /* CMN Immediate Encoding T1 CMN<c> <Rn>,#<const> 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 |1 1 1 1 0 |i||0| 1 0 0 0 |1| Rn |0| imm3 | 1 1 1 1| imm8 | where : <c><q> See Standard assembler syntax fields on page A6-7. <Rn> Specifies the register that contains the operand. This register is allowed to be the SP. <const> Specifies the immediate value to be added to the value obtained from <Rn>. See Modified immediate constants in Thumb instructions on page A5-15 for the range of allowed values. */ void CMNImmediateT1(uint32_t instruction) { uint32_t imm8 = getBits(instruction, 7, 0); uint32_t Rn = getBits(instruction, 19, 16); uint32_t imm3 = getBits(instruction, 14, 12); uint32_t i = getBits(instruction, 26, 26); uint32_t bit7 = getBits(instruction, 7, 7); uint32_t temp = (i << 3 ) | imm3; uint32_t modifyControl = (temp << 1) | bit7; uint32_t ModifiedConstant = ModifyImmediateConstant(modifyControl, imm8, 0); if(inITBlock()) { if( checkCondition(cond) ) executeCMNImmediate(Rn, ModifiedConstant); shiftITState(); } else executeCMNImmediate(Rn, ModifiedConstant); coreReg[PC] += 4; } /* This instruction adds an immediate value to a register value, and discard the result. Input: Rn register value which will be added with immediate immediate immediate value which will be added with Rn and update the status flag */ void executeCMNImmediate(uint32_t Rn, uint32_t immediate) { uint32_t backupRn = coreReg[Rn]; uint32_t result = coreReg[Rn] + immediate; //get the result of Rn + immediate updateZeroFlag(result); updateNegativeFlag(result); updateOverflowFlagAddition(backupRn, immediate, result); updateCarryFlagAddition(backupRn, immediate); }
JacksonTeh/GDB-RSP-ARM-Cortex-M-Simulator
src/ARMSimulator/CMNImmediate.c
C
gpl-3.0
2,797
!>@file t_FFTW_wrapper.f90 !!@brief module t_FFTW_wrapper !! !!@author H. Matsui !!@date Programmed in Oct., 2012 ! !>@brief Fourier transform using FFTW Ver.3 !! !!@verbatim !! ------------------------------------------------------------------ !! subroutine init_FFTW_type(Ncomp, Nfft, WK) !! subroutine finalize_FFTW_type(Ncomp, WK) !! subroutine verify_wk_FFTW_type(Ncomp, Nfft, WK) !! !! wrapper subroutine for initierize FFT by FFTW !! ------------------------------------------------------------------ !! !! subroutine FFTW_forward_type(Nsmp, Nstacksmp, Ncomp, Nfft, X, WK) !! ------------------------------------------------------------------ !! !! wrapper subroutine for forward Fourier transform by FFTW3 !! !! a_{k} = \frac{2}{Nfft} \sum_{j=0}^{Nfft-1} x_{j} \cos (\frac{2\pi j k}{Nfft}) !! b_{k} = \frac{2}{Nfft} \sum_{j=0}^{Nfft-1} x_{j} \cos (\frac{2\pi j k}{Nfft}) !! !! a_{0} = \frac{1}{Nfft} \sum_{j=0}^{Nfft-1} x_{j} !! K = Nfft/2.... !! a_{k} = \frac{1}{Nfft} \sum_{j=0}^{Nfft-1} x_{j} \cos (\frac{2\pi j k}{Nfft}) !! !! ------------------------------------------------------------------ !! !! subroutine FFTW_backward_type(Nsmp, Nstacksmp, Ncomp, Nfft, & !! X, WK) !! ------------------------------------------------------------------ !! !! wrapper subroutine for backward Fourier transform by FFTW3 !! !! x_{k} = a_{0} + (-1)^{j} a_{Nfft/2} + sum_{k=1}^{Nfft/2-1} !! (a_{k} \cos(2\pijk/Nfft) + b_{k} \sin(2\pijk/Nfft)) !! !! ------------------------------------------------------------------ !! !! i = 1: a_{0} !! i = 2: a_{Nfft/2} !! i = 3: a_{1} !! i = 4: b_{1} !! ... !! i = 2*k+1: a_{k} !! i = 2*k+2: b_{k} !! ... !! i = Nfft-1: a_{Nfft/2-1} !! i = Nfft: b_{Nfft/2-1} !! !! ------------------------------------------------------------------ !!@endverbatim !! !!@n @param Nsmp Number of SMP processors !!@n @param Nstacksmp(0:Nsmp) End number for each SMP process !!@n @param Ncomp Number of components for Fourier transforms !!@n @param Nfft Data length for eadh FFT !!@n @param X(Ncomp, Nfft) Data for Fourier transform !!@n @param WK Work structure for FFTW3 ! module t_FFTW_wrapper ! use m_precision use m_constants ! use FFTW3_wrapper ! implicit none ! !> structure for working data for FFTW type working_FFTW !> plan ID for backward transform integer(kind = fftw_plan), pointer :: plan_backward(:) !> plan ID for forward transform integer(kind = fftw_plan), pointer :: plan_forward(:) ! !> normalization parameter for FFTW (= 1 / Nfft) real(kind = kreal) :: aNfft !> real data for multiple Fourier transform real(kind = kreal), pointer :: X_FFTW(:,:) !> spectrum data for multiple Fourier transform complex(kind = fftw_complex), pointer :: C_FFTW(:,:) !> flag for number of components for Fourier transform integer(kind = kint) :: iflag_fft_len = -1 end type working_FFTW ! private :: alloc_work_4_FFTW_t, dealloc_work_4_FFTW_t ! ! ------------------------------------------------------------------ ! contains ! ! ------------------------------------------------------------------ ! subroutine init_FFTW_type(Ncomp, Nfft, WK) ! integer(kind = kint), intent(in) :: Ncomp, Nfft ! type(working_FFTW), intent(inout) :: WK ! ! call alloc_work_4_FFTW_t(Ncomp, Ncomp, Nfft, WK) call init_4_FFTW_smp(Ncomp, Nfft, WK%plan_forward, & & WK%plan_backward, WK%aNfft, WK%X_FFTW, WK%C_FFTW) ! end subroutine init_FFTW_type ! ! ------------------------------------------------------------------ ! subroutine finalize_FFTW_type(Ncomp, WK) ! integer(kind = kint), intent(in) :: Ncomp ! type(working_FFTW), intent(inout) :: WK ! ! call destroy_FFTW_smp(Ncomp, WK%plan_forward, WK%plan_backward) call dealloc_work_4_FFTW_t(WK) ! end subroutine finalize_FFTW_type ! ! ------------------------------------------------------------------ ! subroutine verify_wk_FFTW_type(Ncomp, Nfft, WK) ! integer(kind = kint), intent(in) :: Ncomp, Nfft ! type(working_FFTW), intent(inout) :: WK ! ! if(WK%iflag_fft_len .lt. 0) then call init_FFTW_type(Ncomp, Nfft, WK) return end if ! if( WK%iflag_fft_len .ne. Nfft*Ncomp) then call finalize_FFTW_type(Ncomp, WK) call init_FFTW_type(Ncomp, Nfft, WK) end if ! end subroutine verify_wk_FFTW_type ! ! ------------------------------------------------------------------ ! ------------------------------------------------------------------ ! subroutine FFTW_forward_type(Nsmp, Nstacksmp, Ncomp, Nfft, X, WK) ! integer(kind = kint), intent(in) :: Nsmp, Nstacksmp(0:Nsmp) integer(kind = kint), intent(in) :: Ncomp, Nfft ! real(kind = kreal), intent(inout) :: X(Ncomp, Nfft) type(working_FFTW), intent(inout) :: WK ! ! call FFTW_forward_SMP(WK%plan_forward, Nsmp, Nstacksmp, & & Ncomp, Nfft, WK%aNfft, X, WK%X_FFTW, WK%C_FFTW) ! end subroutine FFTW_forward_type ! ! ------------------------------------------------------------------ ! subroutine FFTW_backward_type(Nsmp, Nstacksmp, Ncomp, Nfft, & & X, WK) ! integer(kind = kint), intent(in) :: Nsmp, Nstacksmp(0:Nsmp) integer(kind = kint), intent(in) :: Ncomp, Nfft ! real(kind = kreal), intent(inout) :: X(Ncomp,Nfft) type(working_FFTW), intent(inout) :: WK ! ! call FFTW_backward_SMP(WK%plan_backward, Nsmp, Nstacksmp, & & Ncomp, Nfft, X, WK%X_FFTW, WK%C_FFTW) ! end subroutine FFTW_backward_type ! ! ------------------------------------------------------------------ ! ------------------------------------------------------------------ ! subroutine alloc_work_4_FFTW_t(Nplan, Ncomp, Nfft, WK) ! integer(kind = kint), intent(in) :: Nplan, Ncomp, Nfft type(working_FFTW), intent(inout) :: WK ! ! allocate(WK%plan_forward(Nplan)) allocate(WK%plan_backward(Nplan)) ! WK%iflag_fft_len = Nfft*Ncomp allocate( WK%X_FFTW(Nfft,Ncomp) ) allocate( WK%C_FFTW(Nfft/2+1,Ncomp) ) WK%X_FFTW = 0.0d0 WK%C_FFTW = 0.0d0 ! end subroutine alloc_work_4_FFTW_t ! ! ------------------------------------------------------------------ ! subroutine dealloc_work_4_FFTW_t(WK) ! type(working_FFTW), intent(inout) :: WK ! deallocate(WK%X_FFTW, WK%C_FFTW) deallocate(WK%plan_forward, WK%plan_backward) WK%iflag_fft_len = 0 ! end subroutine dealloc_work_4_FFTW_t ! ! ------------------------------------------------------------------ ! end module t_FFTW_wrapper
hlokavarapu/calypso
src/Fortran_libraries/SERIAL_src/FFT_wrapper/t_FFTW_wrapper.f90
FORTRAN
gpl-3.0
6,880
/* * Copyright (C) 2013 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.gallery3d.jpegstream; public interface JpegConfig { // Pixel formats public static final int FORMAT_GRAYSCALE = 0x001; // 1 byte/pixel public static final int FORMAT_RGB = 0x003; // 3 bytes/pixel RGBRGBRGBRGB... public static final int FORMAT_RGBA = 0x004; // 4 bytes/pixel RGBARGBARGBARGBA... public static final int FORMAT_ABGR = 0x104; // 4 bytes/pixel ABGRABGRABGR... // Jni error codes static final int J_SUCCESS = 0; static final int J_ERROR_FATAL = -1; static final int J_ERROR_BAD_ARGS = -2; static final int J_EXCEPTION = -3; static final int J_DONE = -4; }
s20121035/rk3288_android5.1_repo
packages/apps/Gallery2/gallerycommon/src/com/android/gallery3d/jpegstream/JpegConfig.java
Java
gpl-3.0
1,254
<? /** * Todo - a Joomla example extension built with Nooku Framework. * * @package Todo * @copyright Copyright (C) 2011 - 2014 Timble CVBA. (http://www.timble.net) * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> * @link https://github.com/nooku/joomla-todo for the canonical source repository */ defined('KOOWA') or die; ?> <? // No items message ?> <? if ($total == 0): ?> <p class="alert alert-info"> <?= translate('You do not have any items yet.'); ?> </p> <? else: ?> <div class="koowa mod_todo mod_todo--items"> <ul> <? foreach ($items as $item): ?> <li class="module_item"> <p class="koowa_header"> <? // Header title ?> <span class="koowa_header__item"> <a href="<?= route('option=com_todo&view=item&id='.$item->id); ?>" class="koowa_header__title_link" data-title="<?= escape($item->title); ?>" data-id="<?= $item->id; ?>"> <?= escape($item->title);?></a> </span> </p> <p class="module_item__info"> <? // Created ?> <? if ($module->params->show_created): ?> <span class="module_item__date"> <?= helper('date.format', array('date' => $item->created_on)); ?> </span> <? endif; ?> </p> </li> <? endforeach; ?> </ul> </div> <? endif; ?>
left23/JiGS
modules/mod_todo_items/tmpl/default.html.php
PHP
gpl-3.0
1,543
/* This file is part of Darling. Copyright (C) 2012 Lubos Dolezel Darling 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 3 of the License, or (at your option) any later version. Darling 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 Darling. If not, see <http://www.gnu.org/licenses/>. */ #include "config.h" #include "public.h" #include "MachOLoader.h" #include "FileMap.h" #include "trace.h" #include <cstring> #include <cstdlib> #include <map> #include <set> #include <link.h> #include <stddef.h> #include "../util/log.h" #include "../util/leb.h" extern FileMap g_file_map; extern "C" char* dyld_getDarwinExecutablePath(); std::set<LoaderHookFunc*> g_machoLoaderHooks; uint32_t _dyld_image_count(void) { return g_file_map.images().size(); } const struct mach_header* _dyld_get_image_header(uint32_t image_index) { return g_file_map.images().at(image_index)->header; } intptr_t _dyld_get_image_vmaddr_slide(uint32_t image_index) { return g_file_map.images().at(image_index)->slide; } const char* _dyld_get_image_name(uint32_t image_index) { return g_file_map.images().at(image_index)->filename.c_str(); } char* getsectdata(const struct mach_header* header, const char* segname, const char* sectname, unsigned long* size) { FileMap::ImageMap* imageMap = 0; if (!segname || !sectname || !size) { LOG << "Warning: getsectdata() called with NULL pointers\n"; // abort(); return nullptr; } // Find the loaded image the header belongs to for (FileMap::ImageMap* entry : g_file_map.images()) { if (entry->header == header) { imageMap = entry; break; } } if (!imageMap) return 0; // Original dyld's man page indicates that it would still somehow proceed, but we don't bother for (const MachO::Section& sect : imageMap->sections) { if (sect.segment == segname && sect.section == sectname) { char* addr = reinterpret_cast<char*>(sect.addr); *size = sect.size; addr += imageMap->slide; return addr; } } return 0; } void _dyld_register_func_for_add_image(LoaderHookFunc* func) { // Needed for ObjC g_machoLoaderHooks.insert(func); } void _dyld_register_func_for_remove_image(LoaderHookFunc* func) { g_machoLoaderHooks.erase(func); } int32_t NSVersionOfRunTimeLibrary(const char* libraryName) { return -1; } int32_t NSVersionOfLinkTimeLibrary(const char* libraryName) { return -1; } int _NSGetExecutablePath(char* buf, unsigned int* size) { strncpy(buf, dyld_getDarwinExecutablePath(), (*size)-1); buf[(*size)-1] = 0; *size = strlen(buf); return 0; } const char* dyld_image_path_containing_address(const void* addr) { return g_file_map.fileNameForAddr(addr); } struct CBData { void* addr; struct dyld_unwind_sections* info; }; #pragma pack(1) struct eh_frame_hdr { uint8_t version, eh_frame_ptr_enc, fde_count_enc, table_enc; uint8_t eh_frame_ptr[]; }; #pragma pack() static uintptr_t readEncodedPointer(const eh_frame_hdr* hdr) { uint8_t format = hdr->eh_frame_ptr_enc & 0xf; uint8_t rel = hdr->eh_frame_ptr_enc & 0xf0; uintptr_t val; bool isSigned = false; if (hdr->eh_frame_ptr_enc == 0xff) return 0; switch (format) { case 1: // unsigned LEB { const uint8_t* ptr = reinterpret_cast<const uint8_t*>(hdr->eh_frame_ptr); val = uleb128(ptr); break; } case 2: // 2 bytes val = *reinterpret_cast<const uint16_t*>(hdr->eh_frame_ptr); break; case 3: val = *reinterpret_cast<const uint32_t*>(hdr->eh_frame_ptr); break; case 4: val = *reinterpret_cast<const uint64_t*>(hdr->eh_frame_ptr); break; case 9: // signed LEB { const uint8_t* ptr = reinterpret_cast<const uint8_t*>(hdr->eh_frame_ptr); val = sleb128(ptr); break; } // FIXME: add 'dlpi_addr' (base address) to these? case 0xa: val = *reinterpret_cast<const int16_t*>(hdr->eh_frame_ptr); break; case 0xb: val = *reinterpret_cast<const int32_t*>(hdr->eh_frame_ptr); break; case 0xc: val = *reinterpret_cast<const int64_t*>(hdr->eh_frame_ptr); break; default: return 0; } switch (rel) { case 0: // no change break; case 0x10: // pcrel val += reinterpret_cast<uintptr_t>(hdr) + 4; break; case 0x30: // eh_frame_hdr rel val += reinterpret_cast<uintptr_t>(hdr); break; default: return 0; } return val; } static int dlCallback(struct dl_phdr_info *info, size_t size, void *data) { CBData* cbdata = static_cast<CBData*>(data); bool addrMatch = false; void* maxAddr = 0; const eh_frame_hdr* ehdr = 0; if (cbdata->info->dwarf_section) // we already have a match return 0; //std::cout << "Looking into " << info->dlpi_name << std::endl; if (size < offsetof(struct dl_phdr_info, dlpi_phnum)) return 0; for (int i = 0; i < info->dlpi_phnum; i++) { const ElfW(Phdr)* phdr = &info->dlpi_phdr[i]; /* if (strstr(info->dlpi_name, "cxxdarwin")) { std::cout << "type: " << phdr->p_type << "; vaddr: " << phdr->p_vaddr << std::endl; } */ if (phdr->p_type == PT_LOAD) { void* from = reinterpret_cast<void*>(uintptr_t(info->dlpi_addr) + uintptr_t(phdr->p_vaddr)); void* to = reinterpret_cast<char*>(from) + phdr->p_memsz; if (cbdata->addr >= from && cbdata->addr < to) addrMatch = true; if (to > maxAddr) maxAddr = to; // TODO: could this be improved? libunwind does the same } else if (phdr->p_type == PT_GNU_EH_FRAME) { //std::cout << "Found .eh_frame_hdr in " << info->dlpi_name << std::endl; ehdr = reinterpret_cast<eh_frame_hdr*>(uintptr_t(info->dlpi_addr) + phdr->p_vaddr); // cbdata->info->dwarf_section_length = phdr->p_memsz; } } if (addrMatch && ehdr) { //std::cout << "*** Match found! " << info->dlpi_name << std::endl; // Now we find .eh_frame from .eh_frame_hdr if (ehdr->version != 1) return 0; cbdata->info->dwarf_section = reinterpret_cast<void*>(readEncodedPointer(ehdr)); cbdata->info->dwarf_section_length = uintptr_t(maxAddr) - uintptr_t(cbdata->info->dwarf_section); } return 0; } bool _dyld_find_unwind_sections(void* addr, struct dyld_unwind_sections* info) { TRACE1(addr); const FileMap::ImageMap* map = g_file_map.imageMapForAddr(addr); if (!map) // in ELF { memset(info, 0, sizeof(*info)); CBData data = { addr, info }; dl_iterate_phdr(dlCallback, &data); std::cout << "Dwarf section at " << info->dwarf_section << std::endl; return info->dwarf_section != 0; } else // in Mach-O { info->mh = map->header; info->dwarf_section = reinterpret_cast<const void*>(map->eh_frame.first + map->slide); info->dwarf_section_length = map->eh_frame.second; // FIXME: we would get "malformed __unwind_info" warnings otherwise // info->compact_unwind_section = reinterpret_cast<const void*>(map->unwind_info.first + map->slide); // info->compact_unwind_section_length = map->unwind_info.second; info->compact_unwind_section = 0; info->compact_unwind_section_length = 0; return true; } }
MyOwnClone/darling
src/dyld/public.cpp
C++
gpl-3.0
7,263
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_memalloc.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: lbogar <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/07 19:39:28 by lbogar #+# #+# */ /* Updated: 2016/11/07 19:39:30 by lbogar ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" void *ft_memalloc(size_t size) { void *ptr; ptr = malloc(size); if (ptr == NULL) return (NULL); else return (ft_memset(ptr, 0, size)); }
wise-panda/42
libft/ft_memalloc.c
C
gpl-3.0
1,058
(function () { 'use strict'; /* ngInject */ function Notifications() { var module = { restrict: 'E', templateUrl: 'scripts/notifications/notifications-partial.html', controller: 'NotificationsController', controllerAs: 'ntf', bindToController: true }; return module; } angular.module('ase.notifications') .directive('aseNotifications', Notifications); })();
WorldBank-Transport/DRIVER
schema_editor/app/scripts/notifications/notifications-directive.js
JavaScript
gpl-3.0
469
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.messages = exports.ruleName = undefined; exports.default = function (expectation) { var checker = (0, _utils.whitespaceChecker)("space", expectation, messages); return function (root, result) { var validOptions = (0, _utils.validateOptions)(result, ruleName, { actual: expectation, possible: ["always", "never", "always-single-line", "never-single-line", "always-multi-line", "never-multi-line"] }); if (!validOptions) { return; } // Check both kinds of statement: rules and at-rules root.walkRules(check); root.walkAtRules(check); function check(statement) { // Return early if blockless or has empty block if (!(0, _utils.hasBlock)(statement) || (0, _utils.hasEmptyBlock)(statement)) { return; } var source = (0, _utils.blockString)(statement); var statementString = statement.toString(); var index = statementString.length - 2; if (statementString[index - 1] === "\r") { index -= 1; } checker.before({ source: source, index: source.length - 1, err: function err(msg) { (0, _utils.report)({ message: msg, node: statement, index: index, result: result, ruleName: ruleName }); } }); } }; }; var _utils = require("../../utils"); var ruleName = exports.ruleName = "block-closing-brace-space-before"; var messages = exports.messages = (0, _utils.ruleMessages)(ruleName, { expectedBefore: function expectedBefore() { return "Expected single space before \"}\""; }, rejectedBefore: function rejectedBefore() { return "Unexpected whitespace before \"}\""; }, expectedBeforeSingleLine: function expectedBeforeSingleLine() { return "Expected single space before \"}\" of a single-line block"; }, rejectedBeforeSingleLine: function rejectedBeforeSingleLine() { return "Unexpected whitespace before \"}\" of a single-line block"; }, expectedBeforeMultiLine: function expectedBeforeMultiLine() { return "Expected single space before \"}\" of a multi-line block"; }, rejectedBeforeMultiLine: function rejectedBeforeMultiLine() { return "Unexpected whitespace before \"}\" of a multi-line block"; } });
AmrataRamchandani/moodle
node_modules/stylelint/dist/rules/block-closing-brace-space-before/index.js
JavaScript
gpl-3.0
2,383
/** * <copyright> * </copyright> * * */ package robotG.resource.robot.util; /** * A utility class that bundles all dependencies to the Eclipse platform. Clients * of this class must check whether the Eclipse bundles are available in the * classpath. If they are not available, this class is not used, which allows to * run resource plug-in that are generated by EMFText in stand-alone mode. In this * case the EMF JARs are sufficient to parse and print resources. */ public class RobotEclipseProxy { /** * Adds all registered load option provider extension to the given map. Load * option providers can be used to set default options for loading resources (e.g. * input stream pre-processors). */ public void getDefaultLoadOptionProviderExtensions(java.util.Map<Object, Object> optionsMap) { if (org.eclipse.core.runtime.Platform.isRunning()) { // find default load option providers org.eclipse.core.runtime.IExtensionRegistry extensionRegistry = org.eclipse.core.runtime.Platform.getExtensionRegistry(); org.eclipse.core.runtime.IConfigurationElement configurationElements[] = extensionRegistry.getConfigurationElementsFor(robotG.resource.robot.mopp.RobotPlugin.EP_DEFAULT_LOAD_OPTIONS_ID); for (org.eclipse.core.runtime.IConfigurationElement element : configurationElements) { try { robotG.resource.robot.IRobotOptionProvider provider = (robotG.resource.robot.IRobotOptionProvider) element.createExecutableExtension("class"); final java.util.Map<?, ?> options = provider.getOptions(); final java.util.Collection<?> keys = options.keySet(); for (Object key : keys) { robotG.resource.robot.util.RobotMapUtil.putAndMergeKeys(optionsMap, key, options.get(key)); } } catch (org.eclipse.core.runtime.CoreException ce) { new robotG.resource.robot.util.RobotRuntimeUtil().logError("Exception while getting default options.", ce); } } } } /** * Adds all registered resource factory extensions to the given map. Such * extensions can be used to register multiple resource factories for the same * file extension. */ public void getResourceFactoryExtensions(java.util.Map<String, org.eclipse.emf.ecore.resource.Resource.Factory> factories) { if (org.eclipse.core.runtime.Platform.isRunning()) { org.eclipse.core.runtime.IExtensionRegistry extensionRegistry = org.eclipse.core.runtime.Platform.getExtensionRegistry(); org.eclipse.core.runtime.IConfigurationElement configurationElements[] = extensionRegistry.getConfigurationElementsFor(robotG.resource.robot.mopp.RobotPlugin.EP_ADDITIONAL_EXTENSION_PARSER_ID); for (org.eclipse.core.runtime.IConfigurationElement element : configurationElements) { try { String type = element.getAttribute("type"); org.eclipse.emf.ecore.resource.Resource.Factory factory = (org.eclipse.emf.ecore.resource.Resource.Factory) element.createExecutableExtension("class"); if (type == null) { type = ""; } org.eclipse.emf.ecore.resource.Resource.Factory otherFactory = factories.get(type); if (otherFactory != null) { Class<?> superClass = factory.getClass().getSuperclass(); while(superClass != Object.class) { if (superClass.equals(otherFactory.getClass())) { factories.put(type, factory); break; } superClass = superClass.getClass(); } } else { factories.put(type, factory); } } catch (org.eclipse.core.runtime.CoreException ce) { new robotG.resource.robot.util.RobotRuntimeUtil().logError("Exception while getting default options.", ce); } } } } /** * Gets the resource that is contained in the give file. */ public robotG.resource.robot.mopp.RobotResource getResource(org.eclipse.core.resources.IFile file) { org.eclipse.emf.ecore.resource.ResourceSet rs = new org.eclipse.emf.ecore.resource.impl.ResourceSetImpl(); org.eclipse.emf.ecore.resource.Resource resource = rs.getResource(org.eclipse.emf.common.util.URI.createPlatformResourceURI(file.getFullPath().toString(),true), true); return (robotG.resource.robot.mopp.RobotResource) resource; } /** * Checks all registered EMF validation constraints. Note: EMF validation does not * work if OSGi is not running. */ @SuppressWarnings("restriction") public void checkEMFValidationConstraints(robotG.resource.robot.IRobotTextResource resource, org.eclipse.emf.ecore.EObject root) { // The EMF validation framework code throws a NPE if the validation plug-in is not // loaded. This is a bug, which is fixed in the Helios release. Nonetheless, we // need to catch the exception here. if (new robotG.resource.robot.util.RobotRuntimeUtil().isEclipsePlatformRunning()) { // The EMF validation framework code throws a NPE if the validation plug-in is not // loaded. This is a workaround for bug 322079. if (org.eclipse.emf.validation.internal.EMFModelValidationPlugin.getPlugin() != null) { try { org.eclipse.emf.validation.service.ModelValidationService service = org.eclipse.emf.validation.service.ModelValidationService.getInstance(); org.eclipse.emf.validation.service.IBatchValidator validator = service.<org.eclipse.emf.ecore.EObject, org.eclipse.emf.validation.service.IBatchValidator>newValidator(org.eclipse.emf.validation.model.EvaluationMode.BATCH); validator.setIncludeLiveConstraints(true); org.eclipse.core.runtime.IStatus status = validator.validate(root); addStatus(status, resource, root); } catch (Throwable t) { new robotG.resource.robot.util.RobotRuntimeUtil().logError("Exception while checking contraints provided by EMF validator classes.", t); } } } } public void addStatus(org.eclipse.core.runtime.IStatus status, robotG.resource.robot.IRobotTextResource resource, org.eclipse.emf.ecore.EObject root) { java.util.List<org.eclipse.emf.ecore.EObject> causes = new java.util.ArrayList<org.eclipse.emf.ecore.EObject>(); causes.add(root); if (status instanceof org.eclipse.emf.validation.model.ConstraintStatus) { org.eclipse.emf.validation.model.ConstraintStatus constraintStatus = (org.eclipse.emf.validation.model.ConstraintStatus) status; java.util.Set<org.eclipse.emf.ecore.EObject> resultLocus = constraintStatus.getResultLocus(); causes.clear(); causes.addAll(resultLocus); } boolean hasChildren = status.getChildren() != null && status.getChildren().length > 0; // Ignore composite status objects that have children. The actual status // information is then contained in the child objects. if (!status.isMultiStatus() || !hasChildren) { if (status.getSeverity() == org.eclipse.core.runtime.IStatus.ERROR) { for (org.eclipse.emf.ecore.EObject cause : causes) { resource.addError(status.getMessage(), robotG.resource.robot.RobotEProblemType.ANALYSIS_PROBLEM, cause); } } if (status.getSeverity() == org.eclipse.core.runtime.IStatus.WARNING) { for (org.eclipse.emf.ecore.EObject cause : causes) { resource.addWarning(status.getMessage(), robotG.resource.robot.RobotEProblemType.ANALYSIS_PROBLEM, cause); } } } for (org.eclipse.core.runtime.IStatus child : status.getChildren()) { addStatus(child, resource, root); } } /** * Returns the encoding for this resource that is specified in the workspace file * properties or determined by the default workspace encoding in Eclipse. */ public String getPlatformResourceEncoding(org.eclipse.emf.common.util.URI uri) { // We can't determine the encoding if the platform is not running. if (!new robotG.resource.robot.util.RobotRuntimeUtil().isEclipsePlatformRunning()) { return null; } if (uri != null && uri.isPlatform()) { String platformString = uri.toPlatformString(true); org.eclipse.core.resources.IResource platformResource = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().findMember(platformString); if (platformResource instanceof org.eclipse.core.resources.IFile) { org.eclipse.core.resources.IFile file = (org.eclipse.core.resources.IFile) platformResource; try { return file.getCharset(); } catch (org.eclipse.core.runtime.CoreException ce) { new robotG.resource.robot.util.RobotRuntimeUtil().logWarning("Could not determine encoding of platform resource: " + uri.toString(), ce); } } } return null; } }
INSA-Rennes/TP4INFO
IDM/robotG.resource.robot/src-gen/robotG/resource/robot/util/RobotEclipseProxy.java
Java
gpl-3.0
8,356
using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; using MissionPlanner.ArduPilot; using MissionPlanner.Comms; using MissionPlanner.Utilities; namespace Xamarin { public class Test { public static IBlueToothDevice BlueToothDevice { get; set; } public static IUSBDevices UsbDevices { get; set; } public static IRadio Radio { get; set; } public static IGPS GPS { get; set; } public static ISystemInfo SystemInfo { get; set; } } public interface ISystemInfo { string GetSystemTag(); } public interface IGPS { Task<(double lat,double lng,double alt)> GetPosition(); } public interface IBlueToothDevice { Task<List<DeviceInfo>> GetDeviceInfoList(); Task<ICommsSerial> GetBT(DeviceInfo first); } public interface IRadio { void Toggle(); } public interface IUSBDevices { /// <summary> /// Turn a native type into a DeviceInfo /// </summary> /// <param name="devicein"></param> /// <returns></returns> DeviceInfo GetDeviceInfo(object devicein); /// <summary> /// Turn a generic deviceinfo into a icommsserial /// </summary> /// <param name="di"></param> /// <returns></returns> Task<ICommsSerial> GetUSB(DeviceInfo di); /// <summary> /// Get a list of all devices /// </summary> /// <returns></returns> Task<List<DeviceInfo>> GetDeviceInfoList(); /// <summary> /// Called when a device is plugged or unplugged /// </summary> void USBEventCallBack(object usbDeviceReceiver, object device); event EventHandler<DeviceInfo> USBEvent; } }
ArduPilot/MissionPlanner
ExtLibs/Xamarin/Xamarin/ITest.cs
C#
gpl-3.0
1,921
/* * Copyright Droids Corporation, Microb Technology, Eirbot (2009) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Revision : $Id $ * */ /* WARNING : this file is automatically generated by scripts. * You should not edit it. If you find something wrong in it, * write to [email protected] */ /* prescalers timer 0 */ #define TIMER0_PRESCALER_DIV_0 0 #define TIMER0_PRESCALER_DIV_1 1 #define TIMER0_PRESCALER_DIV_8 2 #define TIMER0_PRESCALER_DIV_64 3 #define TIMER0_PRESCALER_DIV_256 4 #define TIMER0_PRESCALER_DIV_1024 5 #define TIMER0_PRESCALER_DIV_FALL 6 #define TIMER0_PRESCALER_DIV_RISE 7 #define TIMER0_PRESCALER_REG_0 0 #define TIMER0_PRESCALER_REG_1 1 #define TIMER0_PRESCALER_REG_2 8 #define TIMER0_PRESCALER_REG_3 64 #define TIMER0_PRESCALER_REG_4 256 #define TIMER0_PRESCALER_REG_5 1024 #define TIMER0_PRESCALER_REG_6 -1 #define TIMER0_PRESCALER_REG_7 -2 /* prescalers timer 1 */ #define TIMER1_PRESCALER_DIV_0 0 #define TIMER1_PRESCALER_DIV_1 1 #define TIMER1_PRESCALER_DIV_8 2 #define TIMER1_PRESCALER_DIV_64 3 #define TIMER1_PRESCALER_DIV_256 4 #define TIMER1_PRESCALER_DIV_1024 5 #define TIMER1_PRESCALER_DIV_FALL 6 #define TIMER1_PRESCALER_DIV_RISE 7 #define TIMER1_PRESCALER_REG_0 0 #define TIMER1_PRESCALER_REG_1 1 #define TIMER1_PRESCALER_REG_2 8 #define TIMER1_PRESCALER_REG_3 64 #define TIMER1_PRESCALER_REG_4 256 #define TIMER1_PRESCALER_REG_5 1024 #define TIMER1_PRESCALER_REG_6 -1 #define TIMER1_PRESCALER_REG_7 -2 /* prescalers timer 2 */ #define TIMER2_PRESCALER_DIV_0 0 #define TIMER2_PRESCALER_DIV_1 1 #define TIMER2_PRESCALER_DIV_8 2 #define TIMER2_PRESCALER_DIV_32 3 #define TIMER2_PRESCALER_DIV_64 4 #define TIMER2_PRESCALER_DIV_128 5 #define TIMER2_PRESCALER_DIV_256 6 #define TIMER2_PRESCALER_DIV_1024 7 #define TIMER2_PRESCALER_REG_0 0 #define TIMER2_PRESCALER_REG_1 1 #define TIMER2_PRESCALER_REG_2 8 #define TIMER2_PRESCALER_REG_3 32 #define TIMER2_PRESCALER_REG_4 64 #define TIMER2_PRESCALER_REG_5 128 #define TIMER2_PRESCALER_REG_6 256 #define TIMER2_PRESCALER_REG_7 1024 /* available timers */ #define TIMER0_AVAILABLE #define TIMER0A_AVAILABLE #define TIMER0B_AVAILABLE #define TIMER1_AVAILABLE #define TIMER1A_AVAILABLE #define TIMER1B_AVAILABLE #define TIMER2_AVAILABLE #define TIMER2A_AVAILABLE #define TIMER2B_AVAILABLE /* overflow interrupt number */ #define SIG_OVERFLOW0_NUM 0 #define SIG_OVERFLOW1_NUM 1 #define SIG_OVERFLOW2_NUM 2 #define SIG_OVERFLOW_TOTAL_NUM 3 /* output compare interrupt number */ #define SIG_OUTPUT_COMPARE0A_NUM 0 #define SIG_OUTPUT_COMPARE0B_NUM 1 #define SIG_OUTPUT_COMPARE1A_NUM 2 #define SIG_OUTPUT_COMPARE1B_NUM 3 #define SIG_OUTPUT_COMPARE2A_NUM 4 #define SIG_OUTPUT_COMPARE2B_NUM 5 #define SIG_OUTPUT_COMPARE_TOTAL_NUM 6 /* Pwm nums */ #define PWM0A_NUM 0 #define PWM0B_NUM 1 #define PWM1A_NUM 2 #define PWM1B_NUM 3 #define PWM2A_NUM 4 #define PWM2B_NUM 5 #define PWM_TOTAL_NUM 6 /* input capture interrupt number */ #define SIG_INPUT_CAPTURE1_NUM 0 #define SIG_INPUT_CAPTURE_TOTAL_NUM 1 /* ADMUX */ #define MUX0_REG ADMUX #define MUX1_REG ADMUX #define MUX2_REG ADMUX #define MUX3_REG ADMUX #define MUX4_REG ADMUX #define ADLAR_REG ADMUX #define REFS0_REG ADMUX #define REFS1_REG ADMUX /* WDTCSR */ #define WDP0_REG WDTCSR #define WDP1_REG WDTCSR #define WDP2_REG WDTCSR #define WDE_REG WDTCSR #define WDCE_REG WDTCSR #define WDP3_REG WDTCSR #define WDIE_REG WDTCSR #define WDIF_REG WDTCSR /* EEDR */ #define EEDR0_REG EEDR #define EEDR1_REG EEDR #define EEDR2_REG EEDR #define EEDR3_REG EEDR #define EEDR4_REG EEDR #define EEDR5_REG EEDR #define EEDR6_REG EEDR #define EEDR7_REG EEDR /* ACSR */ #define ACIS0_REG ACSR #define ACIS1_REG ACSR #define ACIC_REG ACSR #define ACIE_REG ACSR #define ACI_REG ACSR #define ACO_REG ACSR #define ACBG_REG ACSR #define ACD_REG ACSR /* SPCR0 */ #define SPR00_REG SPCR0 #define SPR10_REG SPCR0 #define CPHA0_REG SPCR0 #define CPOL0_REG SPCR0 #define MSTR0_REG SPCR0 #define DORD0_REG SPCR0 #define SPE0_REG SPCR0 #define SPIE0_REG SPCR0 /* RAMPZ */ #define RAMPZ0_REG RAMPZ /* OCR2B */ #define OCR2B_0_REG OCR2B #define OCR2B_1_REG OCR2B #define OCR2B_2_REG OCR2B #define OCR2B_3_REG OCR2B #define OCR2B_4_REG OCR2B #define OCR2B_5_REG OCR2B #define OCR2B_6_REG OCR2B #define OCR2B_7_REG OCR2B /* OCR2A */ #define OCR2A_0_REG OCR2A #define OCR2A_1_REG OCR2A #define OCR2A_2_REG OCR2A #define OCR2A_3_REG OCR2A #define OCR2A_4_REG OCR2A #define OCR2A_5_REG OCR2A #define OCR2A_6_REG OCR2A #define OCR2A_7_REG OCR2A /* SPH */ #define SP8_REG SPH #define SP9_REG SPH #define SP10_REG SPH #define SP11_REG SPH #define SP12_REG SPH /* ICR1L */ #define ICR1L0_REG ICR1L #define ICR1L1_REG ICR1L #define ICR1L2_REG ICR1L #define ICR1L3_REG ICR1L #define ICR1L4_REG ICR1L #define ICR1L5_REG ICR1L #define ICR1L6_REG ICR1L #define ICR1L7_REG ICR1L /* TWSR */ #define TWPS0_REG TWSR #define TWPS1_REG TWSR #define TWS3_REG TWSR #define TWS4_REG TWSR #define TWS5_REG TWSR #define TWS6_REG TWSR #define TWS7_REG TWSR /* UCSR0A */ #define MPCM0_REG UCSR0A #define U2X0_REG UCSR0A #define UPE0_REG UCSR0A #define DOR0_REG UCSR0A #define FE0_REG UCSR0A #define UDRE0_REG UCSR0A #define TXC0_REG UCSR0A #define RXC0_REG UCSR0A /* UCSR0C */ #define UCPOL0_REG UCSR0C #define UCSZ00_REG UCSR0C #define UCSZ01_REG UCSR0C #define USBS0_REG UCSR0C #define UPM00_REG UCSR0C #define UPM01_REG UCSR0C #define UMSEL00_REG UCSR0C #define UMSEL01_REG UCSR0C /* UCSR0B */ #define TXB80_REG UCSR0B #define RXB80_REG UCSR0B #define UCSZ02_REG UCSR0B #define TXEN0_REG UCSR0B #define RXEN0_REG UCSR0B #define UDRIE0_REG UCSR0B #define TXCIE0_REG UCSR0B #define RXCIE0_REG UCSR0B /* TCNT1H */ #define TCNT1H0_REG TCNT1H #define TCNT1H1_REG TCNT1H #define TCNT1H2_REG TCNT1H #define TCNT1H3_REG TCNT1H #define TCNT1H4_REG TCNT1H #define TCNT1H5_REG TCNT1H #define TCNT1H6_REG TCNT1H #define TCNT1H7_REG TCNT1H /* PORTC */ #define PORTC0_REG PORTC #define PORTC1_REG PORTC #define PORTC2_REG PORTC #define PORTC3_REG PORTC #define PORTC4_REG PORTC #define PORTC5_REG PORTC #define PORTC6_REG PORTC #define PORTC7_REG PORTC /* PORTA */ #define PORTA0_REG PORTA #define PORTA1_REG PORTA #define PORTA2_REG PORTA #define PORTA3_REG PORTA #define PORTA4_REG PORTA #define PORTA5_REG PORTA #define PORTA6_REG PORTA #define PORTA7_REG PORTA /* UDR1 */ #define UDR1_0_REG UDR1 #define UDR1_1_REG UDR1 #define UDR1_2_REG UDR1 #define UDR1_3_REG UDR1 #define UDR1_4_REG UDR1 #define UDR1_5_REG UDR1 #define UDR1_6_REG UDR1 #define UDR1_7_REG UDR1 /* UDR0 */ #define UDR0_0_REG UDR0 #define UDR0_1_REG UDR0 #define UDR0_2_REG UDR0 #define UDR0_3_REG UDR0 #define UDR0_4_REG UDR0 #define UDR0_5_REG UDR0 #define UDR0_6_REG UDR0 #define UDR0_7_REG UDR0 /* EICRA */ #define ISC00_REG EICRA #define ISC01_REG EICRA #define ISC10_REG EICRA #define ISC11_REG EICRA #define ISC20_REG EICRA #define ISC21_REG EICRA /* DIDR0 */ #define ADC0D_REG DIDR0 #define ADC1D_REG DIDR0 #define ADC2D_REG DIDR0 #define ADC3D_REG DIDR0 #define ADC4D_REG DIDR0 #define ADC5D_REG DIDR0 #define ADC6D_REG DIDR0 #define ADC7D_REG DIDR0 /* DIDR1 */ #define AIN0D_REG DIDR1 #define AIN1D_REG DIDR1 /* SPDR0 */ #define SPDRB0_REG SPDR0 #define SPDRB1_REG SPDR0 #define SPDRB2_REG SPDR0 #define SPDRB3_REG SPDR0 #define SPDRB4_REG SPDR0 #define SPDRB5_REG SPDR0 #define SPDRB6_REG SPDR0 #define SPDRB7_REG SPDR0 /* ASSR */ #define TCR2BUB_REG ASSR #define TCR2AUB_REG ASSR #define OCR2BUB_REG ASSR #define OCR2AUB_REG ASSR #define TCN2UB_REG ASSR #define AS2_REG ASSR #define EXCLK_REG ASSR /* CLKPR */ #define CLKPS0_REG CLKPR #define CLKPS1_REG CLKPR #define CLKPS2_REG CLKPR #define CLKPS3_REG CLKPR #define CLKPCE_REG CLKPR /* SREG */ #define C_REG SREG #define Z_REG SREG #define N_REG SREG #define V_REG SREG #define S_REG SREG #define H_REG SREG #define T_REG SREG #define I_REG SREG /* UBRR1L */ #define UBRR_0_REG UBRR1L #define UBRR_1_REG UBRR1L #define UBRR_2_REG UBRR1L #define UBRR_3_REG UBRR1L #define UBRR_4_REG UBRR1L #define UBRR_5_REG UBRR1L #define UBRR_6_REG UBRR1L #define UBRR_7_REG UBRR1L /* DDRC */ #define DDC0_REG DDRC #define DDC1_REG DDRC #define DDC2_REG DDRC #define DDC3_REG DDRC #define DDC4_REG DDRC #define DDC5_REG DDRC #define DDC6_REG DDRC #define DDC7_REG DDRC /* DDRA */ #define DDA0_REG DDRA #define DDA1_REG DDRA #define DDA2_REG DDRA #define DDA3_REG DDRA #define DDA4_REG DDRA #define DDA5_REG DDRA #define DDA6_REG DDRA #define DDA7_REG DDRA /* UBRR1H */ #define UBRR_8_REG UBRR1H #define UBRR_9_REG UBRR1H #define UBRR_10_REG UBRR1H #define UBRR_11_REG UBRR1H /* TCCR1C */ #define FOC1B_REG TCCR1C #define FOC1A_REG TCCR1C /* TCCR1B */ #define CS10_REG TCCR1B #define CS11_REG TCCR1B #define CS12_REG TCCR1B #define WGM12_REG TCCR1B #define WGM13_REG TCCR1B #define ICES1_REG TCCR1B #define ICNC1_REG TCCR1B /* OSCCAL */ #define CAL0_REG OSCCAL #define CAL1_REG OSCCAL #define CAL2_REG OSCCAL #define CAL3_REG OSCCAL #define CAL4_REG OSCCAL #define CAL5_REG OSCCAL #define CAL6_REG OSCCAL #define CAL7_REG OSCCAL /* GPIOR1 */ #define GPIOR10_REG GPIOR1 #define GPIOR11_REG GPIOR1 #define GPIOR12_REG GPIOR1 #define GPIOR13_REG GPIOR1 #define GPIOR14_REG GPIOR1 #define GPIOR15_REG GPIOR1 #define GPIOR16_REG GPIOR1 #define GPIOR17_REG GPIOR1 /* GPIOR0 */ #define GPIOR00_REG GPIOR0 #define GPIOR01_REG GPIOR0 #define GPIOR02_REG GPIOR0 #define GPIOR03_REG GPIOR0 #define GPIOR04_REG GPIOR0 #define GPIOR05_REG GPIOR0 #define GPIOR06_REG GPIOR0 #define GPIOR07_REG GPIOR0 /* GPIOR2 */ #define GPIOR20_REG GPIOR2 #define GPIOR21_REG GPIOR2 #define GPIOR22_REG GPIOR2 #define GPIOR23_REG GPIOR2 #define GPIOR24_REG GPIOR2 #define GPIOR25_REG GPIOR2 #define GPIOR26_REG GPIOR2 #define GPIOR27_REG GPIOR2 /* SPSR0 */ #define SPI2X0_REG SPSR0 #define WCOL0_REG SPSR0 #define SPIF0_REG SPSR0 /* PCICR */ #define PCIE0_REG PCICR #define PCIE1_REG PCICR #define PCIE2_REG PCICR #define PCIE3_REG PCICR /* TCNT2 */ #define TCNT2_0_REG TCNT2 #define TCNT2_1_REG TCNT2 #define TCNT2_2_REG TCNT2 #define TCNT2_3_REG TCNT2 #define TCNT2_4_REG TCNT2 #define TCNT2_5_REG TCNT2 #define TCNT2_6_REG TCNT2 #define TCNT2_7_REG TCNT2 /* TCNT0 */ #define TCNT0_0_REG TCNT0 #define TCNT0_1_REG TCNT0 #define TCNT0_2_REG TCNT0 #define TCNT0_3_REG TCNT0 #define TCNT0_4_REG TCNT0 #define TCNT0_5_REG TCNT0 #define TCNT0_6_REG TCNT0 #define TCNT0_7_REG TCNT0 /* TWAR */ #define TWGCE_REG TWAR #define TWA0_REG TWAR #define TWA1_REG TWAR #define TWA2_REG TWAR #define TWA3_REG TWAR #define TWA4_REG TWAR #define TWA5_REG TWAR #define TWA6_REG TWAR /* TCCR0B */ #define CS00_REG TCCR0B #define CS01_REG TCCR0B #define CS02_REG TCCR0B #define WGM02_REG TCCR0B #define FOC0B_REG TCCR0B #define FOC0A_REG TCCR0B /* TCCR0A */ #define WGM00_REG TCCR0A #define WGM01_REG TCCR0A #define COM0B0_REG TCCR0A #define COM0B1_REG TCCR0A #define COM0A0_REG TCCR0A #define COM0A1_REG TCCR0A /* TIFR2 */ #define TOV2_REG TIFR2 #define OCF2A_REG TIFR2 #define OCF2B_REG TIFR2 /* TIFR0 */ #define TOV0_REG TIFR0 #define OCF0A_REG TIFR0 #define OCF0B_REG TIFR0 /* TIFR1 */ #define TOV1_REG TIFR1 #define OCF1A_REG TIFR1 #define OCF1B_REG TIFR1 #define ICF1_REG TIFR1 /* GTCCR */ #define PSRSYNC_REG GTCCR #define TSM_REG GTCCR #define PSRASY_REG GTCCR /* TWBR */ #define TWBR0_REG TWBR #define TWBR1_REG TWBR #define TWBR2_REG TWBR #define TWBR3_REG TWBR #define TWBR4_REG TWBR #define TWBR5_REG TWBR #define TWBR6_REG TWBR #define TWBR7_REG TWBR /* ICR1H */ #define ICR1H0_REG ICR1H #define ICR1H1_REG ICR1H #define ICR1H2_REG ICR1H #define ICR1H3_REG ICR1H #define ICR1H4_REG ICR1H #define ICR1H5_REG ICR1H #define ICR1H6_REG ICR1H #define ICR1H7_REG ICR1H /* OCR1BL */ /* #define OCR1AL0_REG OCR1BL */ /* dup in OCR1AL */ /* #define OCR1AL1_REG OCR1BL */ /* dup in OCR1AL */ /* #define OCR1AL2_REG OCR1BL */ /* dup in OCR1AL */ /* #define OCR1AL3_REG OCR1BL */ /* dup in OCR1AL */ /* #define OCR1AL4_REG OCR1BL */ /* dup in OCR1AL */ /* #define OCR1AL5_REG OCR1BL */ /* dup in OCR1AL */ /* #define OCR1AL6_REG OCR1BL */ /* dup in OCR1AL */ /* #define OCR1AL7_REG OCR1BL */ /* dup in OCR1AL */ /* PCIFR */ #define PCIF0_REG PCIFR #define PCIF1_REG PCIFR #define PCIF2_REG PCIFR #define PCIF3_REG PCIFR /* SPL */ #define SP0_REG SPL #define SP1_REG SPL #define SP2_REG SPL #define SP3_REG SPL #define SP4_REG SPL #define SP5_REG SPL #define SP6_REG SPL #define SP7_REG SPL /* OCR1BH */ /* #define OCR1AH0_REG OCR1BH */ /* dup in OCR1AH */ /* #define OCR1AH1_REG OCR1BH */ /* dup in OCR1AH */ /* #define OCR1AH2_REG OCR1BH */ /* dup in OCR1AH */ /* #define OCR1AH3_REG OCR1BH */ /* dup in OCR1AH */ /* #define OCR1AH4_REG OCR1BH */ /* dup in OCR1AH */ /* #define OCR1AH5_REG OCR1BH */ /* dup in OCR1AH */ /* #define OCR1AH6_REG OCR1BH */ /* dup in OCR1AH */ /* #define OCR1AH7_REG OCR1BH */ /* dup in OCR1AH */ /* EECR */ #define EERE_REG EECR #define EEPE_REG EECR #define EEMPE_REG EECR #define EERIE_REG EECR #define EEPM0_REG EECR #define EEPM1_REG EECR /* SMCR */ #define SE_REG SMCR #define SM0_REG SMCR #define SM1_REG SMCR #define SM2_REG SMCR /* TWCR */ #define TWIE_REG TWCR #define TWEN_REG TWCR #define TWWC_REG TWCR #define TWSTO_REG TWCR #define TWSTA_REG TWCR #define TWEA_REG TWCR #define TWINT_REG TWCR /* TCCR2A */ #define WGM20_REG TCCR2A #define WGM21_REG TCCR2A #define COM2B0_REG TCCR2A #define COM2B1_REG TCCR2A #define COM2A0_REG TCCR2A #define COM2A1_REG TCCR2A /* TCCR2B */ #define CS20_REG TCCR2B #define CS21_REG TCCR2B #define CS22_REG TCCR2B #define WGM22_REG TCCR2B #define FOC2B_REG TCCR2B #define FOC2A_REG TCCR2B /* UBRR0H */ #define UBRR8_REG UBRR0H #define UBRR9_REG UBRR0H #define UBRR10_REG UBRR0H #define UBRR11_REG UBRR0H /* UBRR0L */ #define UBRR0_REG UBRR0L #define UBRR1_REG UBRR0L #define UBRR2_REG UBRR0L #define UBRR3_REG UBRR0L #define UBRR4_REG UBRR0L #define UBRR5_REG UBRR0L #define UBRR6_REG UBRR0L #define UBRR7_REG UBRR0L /* EEARH */ #define EEAR8_REG EEARH #define EEAR9_REG EEARH #define EEAR10_REG EEARH #define EEAR11_REG EEARH /* EEARL */ #define EEAR0_REG EEARL #define EEAR1_REG EEARL #define EEAR2_REG EEARL #define EEAR3_REG EEARL #define EEAR4_REG EEARL #define EEAR5_REG EEARL #define EEAR6_REG EEARL #define EEAR7_REG EEARL /* MCUCR */ #define JTD_REG MCUCR #define IVCE_REG MCUCR #define IVSEL_REG MCUCR #define PUD_REG MCUCR #define BODSE_REG MCUCR #define BODS_REG MCUCR /* MCUSR */ #define JTRF_REG MCUSR #define PORF_REG MCUSR #define EXTRF_REG MCUSR #define BORF_REG MCUSR #define WDRF_REG MCUSR /* OCDR */ #define OCDR0_REG OCDR #define OCDR1_REG OCDR #define OCDR2_REG OCDR #define OCDR3_REG OCDR #define OCDR4_REG OCDR #define OCDR5_REG OCDR #define OCDR6_REG OCDR #define OCDR7_REG OCDR /* PINA */ #define PINA0_REG PINA #define PINA1_REG PINA #define PINA2_REG PINA #define PINA3_REG PINA #define PINA4_REG PINA #define PINA5_REG PINA #define PINA6_REG PINA #define PINA7_REG PINA /* UCSR1B */ #define TXB81_REG UCSR1B #define RXB81_REG UCSR1B #define UCSZ12_REG UCSR1B #define TXEN1_REG UCSR1B #define RXEN1_REG UCSR1B #define UDRIE1_REG UCSR1B #define TXCIE1_REG UCSR1B #define RXCIE1_REG UCSR1B /* UCSR1C */ #define UCPOL1_REG UCSR1C #define UCSZ10_REG UCSR1C #define UCSZ11_REG UCSR1C #define USBS1_REG UCSR1C #define UPM10_REG UCSR1C #define UPM11_REG UCSR1C #define UMSEL10_REG UCSR1C #define UMSEL11_REG UCSR1C /* UCSR1A */ #define MPCM1_REG UCSR1A #define U2X1_REG UCSR1A #define UPE1_REG UCSR1A #define DOR1_REG UCSR1A #define FE1_REG UCSR1A #define UDRE1_REG UCSR1A #define TXC1_REG UCSR1A #define RXC1_REG UCSR1A /* DDRB */ #define DDB0_REG DDRB #define DDB1_REG DDRB #define DDB2_REG DDRB #define DDB3_REG DDRB #define DDB4_REG DDRB #define DDB5_REG DDRB #define DDB6_REG DDRB #define DDB7_REG DDRB /* TWDR */ #define TWD0_REG TWDR #define TWD1_REG TWDR #define TWD2_REG TWDR #define TWD3_REG TWDR #define TWD4_REG TWDR #define TWD5_REG TWDR #define TWD6_REG TWDR #define TWD7_REG TWDR /* TWAMR */ #define TWAM0_REG TWAMR #define TWAM1_REG TWAMR #define TWAM2_REG TWAMR #define TWAM3_REG TWAMR #define TWAM4_REG TWAMR #define TWAM5_REG TWAMR #define TWAM6_REG TWAMR /* ADCSRA */ #define ADPS0_REG ADCSRA #define ADPS1_REG ADCSRA #define ADPS2_REG ADCSRA #define ADIE_REG ADCSRA #define ADIF_REG ADCSRA #define ADATE_REG ADCSRA #define ADSC_REG ADCSRA #define ADEN_REG ADCSRA /* ADCSRB */ #define ACME_REG ADCSRB #define ADTS0_REG ADCSRB #define ADTS1_REG ADCSRB #define ADTS2_REG ADCSRB /* PRR0 */ #define PRADC_REG PRR0 #define PRUSART0_REG PRR0 #define PRSPI_REG PRR0 #define PRTIM1_REG PRR0 #define PRUSART1_REG PRR0 #define PRTIM0_REG PRR0 #define PRTIM2_REG PRR0 #define PRTWI_REG PRR0 /* TCCR1A */ #define WGM10_REG TCCR1A #define WGM11_REG TCCR1A #define COM1B0_REG TCCR1A #define COM1B1_REG TCCR1A #define COM1A0_REG TCCR1A #define COM1A1_REG TCCR1A /* OCR0A */ #define OCROA_0_REG OCR0A #define OCROA_1_REG OCR0A #define OCROA_2_REG OCR0A #define OCROA_3_REG OCR0A #define OCROA_4_REG OCR0A #define OCROA_5_REG OCR0A #define OCROA_6_REG OCR0A #define OCROA_7_REG OCR0A /* OCR0B */ #define OCR0B_0_REG OCR0B #define OCR0B_1_REG OCR0B #define OCR0B_2_REG OCR0B #define OCR0B_3_REG OCR0B #define OCR0B_4_REG OCR0B #define OCR0B_5_REG OCR0B #define OCR0B_6_REG OCR0B #define OCR0B_7_REG OCR0B /* TCNT1L */ #define TCNT1L0_REG TCNT1L #define TCNT1L1_REG TCNT1L #define TCNT1L2_REG TCNT1L #define TCNT1L3_REG TCNT1L #define TCNT1L4_REG TCNT1L #define TCNT1L5_REG TCNT1L #define TCNT1L6_REG TCNT1L #define TCNT1L7_REG TCNT1L /* DDRD */ #define DDD0_REG DDRD #define DDD1_REG DDRD #define DDD2_REG DDRD #define DDD3_REG DDRD #define DDD4_REG DDRD #define DDD5_REG DDRD #define DDD6_REG DDRD #define DDD7_REG DDRD /* PORTD */ #define PORTD0_REG PORTD #define PORTD1_REG PORTD #define PORTD2_REG PORTD #define PORTD3_REG PORTD #define PORTD4_REG PORTD #define PORTD5_REG PORTD #define PORTD6_REG PORTD #define PORTD7_REG PORTD /* SPMCSR */ #define SPMEN_REG SPMCSR #define PGERS_REG SPMCSR #define PGWRT_REG SPMCSR #define BLBSET_REG SPMCSR #define RWWSRE_REG SPMCSR #define SIGRD_REG SPMCSR #define RWWSB_REG SPMCSR #define SPMIE_REG SPMCSR /* PORTB */ #define PORTB0_REG PORTB #define PORTB1_REG PORTB #define PORTB2_REG PORTB #define PORTB3_REG PORTB #define PORTB4_REG PORTB #define PORTB5_REG PORTB #define PORTB6_REG PORTB #define PORTB7_REG PORTB /* ADCL */ #define ADCL0_REG ADCL #define ADCL1_REG ADCL #define ADCL2_REG ADCL #define ADCL3_REG ADCL #define ADCL4_REG ADCL #define ADCL5_REG ADCL #define ADCL6_REG ADCL #define ADCL7_REG ADCL /* ADCH */ #define ADCH0_REG ADCH #define ADCH1_REG ADCH #define ADCH2_REG ADCH #define ADCH3_REG ADCH #define ADCH4_REG ADCH #define ADCH5_REG ADCH #define ADCH6_REG ADCH #define ADCH7_REG ADCH /* TIMSK2 */ #define TOIE2_REG TIMSK2 #define OCIE2A_REG TIMSK2 #define OCIE2B_REG TIMSK2 /* EIMSK */ #define INT0_REG EIMSK #define INT1_REG EIMSK #define INT2_REG EIMSK /* TIMSK0 */ #define TOIE0_REG TIMSK0 #define OCIE0A_REG TIMSK0 #define OCIE0B_REG TIMSK0 /* TIMSK1 */ #define TOIE1_REG TIMSK1 #define OCIE1A_REG TIMSK1 #define OCIE1B_REG TIMSK1 #define ICIE1_REG TIMSK1 /* PCMSK0 */ #define PCINT0_REG PCMSK0 #define PCINT1_REG PCMSK0 #define PCINT2_REG PCMSK0 #define PCINT3_REG PCMSK0 #define PCINT4_REG PCMSK0 #define PCINT5_REG PCMSK0 #define PCINT6_REG PCMSK0 #define PCINT7_REG PCMSK0 /* PCMSK1 */ #define PCINT8_REG PCMSK1 #define PCINT9_REG PCMSK1 #define PCINT10_REG PCMSK1 #define PCINT11_REG PCMSK1 #define PCINT12_REG PCMSK1 #define PCINT13_REG PCMSK1 #define PCINT14_REG PCMSK1 #define PCINT15_REG PCMSK1 /* PCMSK2 */ #define PCINT16_REG PCMSK2 #define PCINT17_REG PCMSK2 #define PCINT18_REG PCMSK2 #define PCINT19_REG PCMSK2 #define PCINT20_REG PCMSK2 #define PCINT21_REG PCMSK2 #define PCINT22_REG PCMSK2 #define PCINT23_REG PCMSK2 /* PCMSK3 */ #define PCINT24_REG PCMSK3 #define PCINT25_REG PCMSK3 #define PCINT26_REG PCMSK3 #define PCINT27_REG PCMSK3 #define PCINT28_REG PCMSK3 #define PCINT29_REG PCMSK3 #define PCINT30_REG PCMSK3 #define PCINT31_REG PCMSK3 /* PINC */ #define PINC0_REG PINC #define PINC1_REG PINC #define PINC2_REG PINC #define PINC3_REG PINC #define PINC4_REG PINC #define PINC5_REG PINC #define PINC6_REG PINC #define PINC7_REG PINC /* PINB */ #define PINB0_REG PINB #define PINB1_REG PINB #define PINB2_REG PINB #define PINB3_REG PINB #define PINB4_REG PINB #define PINB5_REG PINB #define PINB6_REG PINB #define PINB7_REG PINB /* EIFR */ #define INTF0_REG EIFR #define INTF1_REG EIFR #define INTF2_REG EIFR /* PIND */ #define PIND0_REG PIND #define PIND1_REG PIND #define PIND2_REG PIND #define PIND3_REG PIND #define PIND4_REG PIND #define PIND5_REG PIND #define PIND6_REG PIND #define PIND7_REG PIND /* OCR1AH */ /* #define OCR1AH0_REG OCR1AH */ /* dup in OCR1BH */ /* #define OCR1AH1_REG OCR1AH */ /* dup in OCR1BH */ /* #define OCR1AH2_REG OCR1AH */ /* dup in OCR1BH */ /* #define OCR1AH3_REG OCR1AH */ /* dup in OCR1BH */ /* #define OCR1AH4_REG OCR1AH */ /* dup in OCR1BH */ /* #define OCR1AH5_REG OCR1AH */ /* dup in OCR1BH */ /* #define OCR1AH6_REG OCR1AH */ /* dup in OCR1BH */ /* #define OCR1AH7_REG OCR1AH */ /* dup in OCR1BH */ /* OCR1AL */ /* #define OCR1AL0_REG OCR1AL */ /* dup in OCR1BL */ /* #define OCR1AL1_REG OCR1AL */ /* dup in OCR1BL */ /* #define OCR1AL2_REG OCR1AL */ /* dup in OCR1BL */ /* #define OCR1AL3_REG OCR1AL */ /* dup in OCR1BL */ /* #define OCR1AL4_REG OCR1AL */ /* dup in OCR1BL */ /* #define OCR1AL5_REG OCR1AL */ /* dup in OCR1BL */ /* #define OCR1AL6_REG OCR1AL */ /* dup in OCR1BL */ /* #define OCR1AL7_REG OCR1AL */ /* dup in OCR1BL */ /* pins mapping */ #define ADC0_PORT PORTA #define ADC0_BIT 0 #define PCINT0_PORT PORTA #define PCINT0_BIT 0 #define ADC1_PORT PORTA #define ADC1_BIT 1 #define PCINT1_PORT PORTA #define PCINT1_BIT 1 #define ADC2_PORT PORTA #define ADC2_BIT 2 #define PCINT2_PORT PORTA #define PCINT2_BIT 2 #define ADC3_PORT PORTA #define ADC3_BIT 3 #define PCINT3_PORT PORTA #define PCINT3_BIT 3 #define ADC4_PORT PORTA #define ADC4_BIT 4 #define PCINT4_PORT PORTA #define PCINT4_BIT 4 #define ADC5_PORT PORTA #define ADC5_BIT 5 #define PCINT5_PORT PORTA #define PCINT5_BIT 5 #define ADC6_PORT PORTA #define ADC6_BIT 6 #define PCINT6_PORT PORTA #define PCINT6_BIT 6 #define ADC7_PORT PORTA #define ADC7_BIT 7 #define PCINT7_PORT PORTA #define PCINT7_BIT 7 #define XCK_PORT PORTB #define XCK_BIT 0 #define T0_PORT PORTB #define T0_BIT 0 #define PCINT9_PORT PORTB #define PCINT9_BIT 0 #define T1_PORT PORTB #define T1_BIT 1 #define CLKO_PORT PORTB #define CLKO_BIT 1 #define PCINT9_PORT PORTB #define PCINT9_BIT 1 #define AIN0_PORT PORTB #define AIN0_BIT 2 #define INT2_PORT PORTB #define INT2_BIT 2 #define PCINT10_PORT PORTB #define PCINT10_BIT 2 #define AIN1_PORT PORTB #define AIN1_BIT 3 #define OC0A_PORT PORTB #define OC0A_BIT 3 #define PCINT11_PORT PORTB #define PCINT11_BIT 3 #define SS_PORT PORTB #define SS_BIT 4 #define OC0B_PORT PORTB #define OC0B_BIT 4 #define PCINT12_PORT PORTB #define PCINT12_BIT 4 #define MOSI_PORT PORTB #define MOSI_BIT 5 #define PCINT13_PORT PORTB #define PCINT13_BIT 5 #define MISO_PORT PORTB #define MISO_BIT 6 #define PCINT14_PORT PORTB #define PCINT14_BIT 6 #define SCK_PORT PORTB #define SCK_BIT 7 #define PCINT15_PORT PORTB #define PCINT15_BIT 7 #define SCL_PORT PORTC #define SCL_BIT 0 #define PCINT16_PORT PORTC #define PCINT16_BIT 0 #define SDA_PORT PORTC #define SDA_BIT 1 #define PCINT17_PORT PORTC #define PCINT17_BIT 1 #define TCK_PORT PORTC #define TCK_BIT 2 #define PCINT18_PORT PORTC #define PCINT18_BIT 2 #define TMS_PORT PORTC #define TMS_BIT 3 #define PCINT19_PORT PORTC #define PCINT19_BIT 3 #define TDO_PORT PORTC #define TDO_BIT 4 #define PCINT20_PORT PORTC #define PCINT20_BIT 4 #define TDI_PORT PORTC #define TDI_BIT 5 #define PCINT21_PORT PORTC #define PCINT21_BIT 5 #define TOSC1_PORT PORTC #define TOSC1_BIT 6 #define PCINT22_PORT PORTC #define PCINT22_BIT 6 #define TOSC2_PORT PORTC #define TOSC2_BIT 7 #define PCINT23_PORT PORTC #define PCINT23_BIT 7 #define RXD_PORT PORTD #define RXD_BIT 0 #define PCINT24_PORT PORTD #define PCINT24_BIT 0 #define TXD_PORT PORTD #define TXD_BIT 1 #define PCINT25_PORT PORTD #define PCINT25_BIT 1 #define INT0_PORT PORTD #define INT0_BIT 2 #define PCINT26_PORT PORTD #define PCINT26_BIT 2 #define INT1_PORT PORTD #define INT1_BIT 3 #define PCINT27_PORT PORTD #define PCINT27_BIT 3 #define OC1B_PORT PORTD #define OC1B_BIT 4 #define PCINT28_PORT PORTD #define PCINT28_BIT 4 #define OC1A_PORT PORTD #define OC1A_BIT 5 #define PCINT29_PORT PORTD #define PCINT29_BIT 5 #define ICP_PORT PORTD #define ICP_BIT 6 #define OC2B_PORT PORTD #define OC2B_BIT 6 #define PCINT30_PORT PORTD #define PCINT30_BIT 6 #define OC2A_PORT PORTD #define OC2A_BIT 7 #define PCINT31_PORT PORTD #define PCINT31_BIT 7
eurobotics/aversive4dspic
include/aversive/parts/ATmega324PA.h
C
gpl-3.0
32,797
/**************************************************************************** * USB Loader GX Team * * Main loadup of the application * * libwiigui * Tantric 2009 ***************************************************************************/ #include <gccore.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/dir.h> #include <ogcsys.h> #include <unistd.h> #include <locale.h> #include <wiiuse/wpad.h> #include <di/di.h> #include <sys/iosupport.h> #include "video.h" #include "menu/menus.h" #include "memory/mem2.h" #include "wad/nandtitle.h" #include "StartUpProcess.h" #include "sys.h" extern "C" { extern s32 MagicPatches(s32); void __exception_setreload(int t); } int main(int argc, char *argv[]) { __exception_setreload(20); // activate magic access rights MagicPatches(1); // init video InitVideo(); // video frame buffers must be in mem1 MEM2_init(48); // init gecko InitGecko(); // redirect stdout and stderr to gecko USBGeckoOutput(); NandTitles.Get(); setlocale(LC_ALL, "en.UTF-8"); if(StartUpProcess::Run(argc, argv) < 0) return -1; MainMenu(MENU_DISCLIST); return 0; }
Garfunkiel/usbloader-gx-tabmod
source/main.cpp
C++
gpl-3.0
1,136
/* * include/configs/porter.h * This file is Porter board configuration. * * Copyright (C) 2015 Renesas Electronics Corporation * Copyright (C) 2015 Cogent Embedded, Inc. * * SPDX-License-Identifier: GPL-2.0 */ #ifndef __PORTER_H #define __PORTER_H #undef DEBUG #define CONFIG_R8A7791 #define CONFIG_RMOBILE_BOARD_STRING "Porter" #include "rcar-gen2-common.h" #if defined(CONFIG_RMOBILE_EXTRAM_BOOT) #define CONFIG_SYS_TEXT_BASE 0x70000000 #else #define CONFIG_SYS_TEXT_BASE 0xE6304000 #endif #if defined(CONFIG_RMOBILE_EXTRAM_BOOT) #define CONFIG_SYS_INIT_SP_ADDR 0x7003FFFC #else #define CONFIG_SYS_INIT_SP_ADDR 0xE633fffC #endif #define STACK_AREA_SIZE 0xC000 #define LOW_LEVEL_MERAM_STACK \ (CONFIG_SYS_INIT_SP_ADDR + STACK_AREA_SIZE - 4) /* MEMORY */ #define RCAR_GEN2_SDRAM_BASE 0x40000000 #define RCAR_GEN2_SDRAM_SIZE (2048u * 1024 * 1024) #define RCAR_GEN2_UBOOT_SDRAM_SIZE (1024u * 1024 * 1024) /* SCIF */ #define CONFIG_SCIF_CONSOLE /* FLASH */ #define CONFIG_SPI #define CONFIG_SPI_FLASH_BAR #define CONFIG_SH_QSPI #define CONFIG_SPI_FLASH #define CONFIG_SPI_FLASH_SPANSION #define CONFIG_SPI_FLASH_QUAD #define CONFIG_SYS_NO_FLASH /* SH Ether */ #define CONFIG_NET_MULTI #define CONFIG_SH_ETHER #define CONFIG_SH_ETHER_USE_PORT 0 #define CONFIG_SH_ETHER_PHY_ADDR 0x1 #define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII #define CONFIG_SH_ETHER_CACHE_WRITEBACK #define CONFIG_SH_ETHER_CACHE_INVALIDATE #define CONFIG_SH_ETHER_ALIGNE_SIZE 64 #define CONFIG_PHYLIB #define CONFIG_PHY_MICREL #define CONFIG_BITBANGMII #define CONFIG_BITBANGMII_MULTI /* Board Clock */ #define RMOBILE_XTAL_CLK 20000000u #define CONFIG_SYS_CLK_FREQ RMOBILE_XTAL_CLK #define CONFIG_SH_TMU_CLK_FREQ (CONFIG_SYS_CLK_FREQ / 2) #define CONFIG_PLL1_CLK_FREQ (CONFIG_SYS_CLK_FREQ * 156 / 2) #define CONFIG_P_CLK_FREQ (CONFIG_PLL1_CLK_FREQ / 24) #define CONFIG_SYS_TMU_CLK_DIV 4 /* i2c */ #define CONFIG_CMD_I2C #define CONFIG_SYS_I2C #define CONFIG_SYS_I2C_SH #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_SH_NUM_CONTROLLERS 3 #define CONFIG_SYS_I2C_SH_SPEED0 400000 #define CONFIG_SYS_I2C_SH_SPEED1 400000 #define CONFIG_SYS_I2C_SH_SPEED2 400000 #define CONFIG_SH_I2C_DATA_HIGH 4 #define CONFIG_SH_I2C_DATA_LOW 5 #define CONFIG_SH_I2C_CLOCK 10000000 #define CONFIG_SYS_I2C_POWERIC_ADDR 0x58 /* da9063 */ /* USB */ #define CONFIG_USB_EHCI #define CONFIG_USB_EHCI_RMOBILE #define CONFIG_USB_MAX_CONTROLLER_COUNT 2 #define CONFIG_USB_STORAGE /* SD */ #define CONFIG_MMC #define CONFIG_CMD_MMC #define CONFIG_GENERIC_MMC #define CONFIG_SH_SDHI_FREQ 97500000 /* Module stop status bits */ /* INTC-RT */ #define CONFIG_SMSTP0_ENA 0x00400000 /* MSIF */ #define CONFIG_SMSTP2_ENA 0x00002000 /* INTC-SYS, IRQC */ #define CONFIG_SMSTP4_ENA 0x00000180 /* SCIF0 */ #define CONFIG_SMSTP7_ENA 0x00200000 #endif /* __PORTER_H */
sdphome/UHF_Reader
u-boot-2015.04/include/configs/porter.h
C
gpl-3.0
2,854
-- ToME - Tales of Maj'Eyal -- Copyright (C) 2009 - 2014 Nicolas Casalini -- -- 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 3 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/>. -- -- Nicolas Casalini "DarkGod" -- [email protected] setStatusAll{no_teleport=true, no_vaulted=true} defineTile(',', "GRASS") defineTile(';', "GRASS_DARK1") defineTile('~', "DEEP_WATER") defineTile('%', "POISON_DEEP_WATER") defineTile('$', "GRASS_DARK1", {random_filter={add_levels=25, type="money"}}) defineTile('*', "GRASS", {random_filter={add_levels=25, type="gem"}}) defineTile('&', "TREE_DARK", {random_filter={add_levels=15, subtype="amulet", tome_mod="vault"}}) defineTile('^', "GRASS_DARK1", nil, nil, {random_filter={add_levels=15, name="poison vine"}}) defineTile('+', "GRASS", nil, nil, {random_filter={add_levels=15, name="poison vine"}}) defineTile('#', "GRASS_DARK1", nil, {random_filter={add_levels=30, subtype="plants", never_move=1}}) rotates = {"default", "90", "180", "270", "flipx", "flipy"} return { [[,,,^,;,,,^;,,;++,,+,]], [[,#,,,,;;;,,;,;#,,,;,]], [[~~,,#,,#;;;;,;*;;,,;]], [[,;~$,,+,*#,,,#;+#,,,]], [[;,,#~,#,$,^,,^,$,,,;]], [[,#*,+~+,$,,#,;,#^,,#]], [[,,;,$~,;;%%*,+,;,;,,]], [[;,#,^~;,+,#%%;;;^#,;]], [[;,*,,;~~~%%,%%%,,;,;]], [[,#,^,;%#%~%%%#%,#;+,]], [[,,,%,;$%%$~$%,%,;$,#]], [[;+$%%%;#%,~,%^,%$#,,]], [[;,#%%;#%%%~%%%%,%,,^]], [[,,$%;%;%#+&~~~#;%,,,]], [[^$,%%%,%%+%%%%~%,+,;]], [[,,%%#%%%*%$%~$~;%,,,]], [[,%#,#$;#;#%~%~%%%$#;]], [[;,%$,$,$^*%,~%,#+,#,]], [[,#,,^,+$,#,%;;%;,;,;]], [[,;;,,#,,,^,++,,,;;,,]], }
festevezga/ToME---t-engine4
game/modules/tome/data/maps/vaults/old-forest-swamp.lua
Lua
gpl-3.0
2,073
#ifndef _RE2C_IR_DFA_DFA_ #define _RE2C_IR_DFA_DFA_ #include "src/util/c99_stdint.h" #include <vector> #include "src/ir/regexp/regexp.h" #include "src/parse/rules.h" #include "src/util/forbid_copy.h" namespace re2c { struct nfa_t; class RuleOp; struct dfa_state_t { size_t *arcs; RuleOp *rule; bool ctx; dfa_state_t() : arcs(NULL) , rule(NULL) , ctx(false) {} ~dfa_state_t() { delete[] arcs; } FORBID_COPY(dfa_state_t); }; struct dfa_t { static const size_t NIL; std::vector<dfa_state_t*> states; const size_t nchars; dfa_t(const nfa_t &nfa, const charset_t &charset, rules_t &rules); ~dfa_t(); }; enum dfa_minimization_t { DFA_MINIMIZATION_TABLE, DFA_MINIMIZATION_MOORE }; void minimization(dfa_t &dfa); void fillpoints(const dfa_t &dfa, std::vector<size_t> &fill); } // namespace re2c #endif // _RE2C_IR_DFA_DFA_
Xane123/MaryMagicalAdventure
tools/re2c/src/ir/dfa/dfa.h
C
gpl-3.0
853
using Polynomials using UnicodePlots searchdir(path,key) = filter(x->contains(x,key), readdir(path)) csvfiles = searchdir("./",".csv") function fitobs(species,x,y,order = 40) xaxis = 1:length(x)#linspace(0,1,length(x)) println(xaxis) fit = polyfit(y,xaxis) print(fit) #Since this will be run in a terminal we can use unicode plotting to check that we are not overfitting. ypred = [fit(x) for x in xaxis] #divided by 1e-8 to get rid of the log axis requirement as per original plot println(ypred) #plotting #myplot = lineplot(xaxis,ypred, title = species, name = "Prediction", color=:blue,border=:bold) #myplot = scatterplot!(myplot, xaxis,y, name = "Observations",color=:magenta) println(myplot) end x=[] y=[] for file in csvfiles names = split(file,"-pp") scale = names[2][1] if scale == 't' scale = 1e-12 elseif scale == 'v' scale = 1e-9 else scale = 1 end data = [] open(file) do f data = [split(i,",") for i in readlines(f)] end x = [float(i[1]) for i in data] y = [log10(float(i[2])*scale) for i in data] myplot = scatterplot(x,y, name = "Observations",color=:magenta) fitobs(names[1],x,y) end
wolfiex/DSMACC-testing
src/examples/del/constrain_obs/GetPaste.jl
Julia
gpl-3.0
1,217
/* Unexec for DEC alpha. Copyright (C) 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. Author: Rainer Schoepf <[email protected]> This file is part of GNU Emacs. GNU Emacs 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 3 of the License, or (at your option) any later version. GNU Emacs 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 GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> #include <sys/types.h> #include <sys/file.h> #include <sys/stat.h> #include <sys/mman.h> #include <stdio.h> #include <errno.h> #ifdef HAVE_STRING_H #include <string.h> #endif #if !defined (__NetBSD__) && !defined (__OpenBSD__) #include <filehdr.h> #include <aouthdr.h> #include <scnhdr.h> #include <syms.h> #ifndef __linux__ # include <reloc.h> # include <elf_abi.h> #endif #else /* __NetBSD__ or __OpenBSD__ */ /* * NetBSD/Alpha does not have 'normal' user-land ECOFF support because * there's no desire to support ECOFF as the executable format in the * long term. */ #include <sys/exec_ecoff.h> /* Structures, constants, etc., that NetBSD defines strangely. */ #define filehdr ecoff_filehdr #define aouthdr ecoff_aouthdr #define scnhdr ecoff_scnhdr #define HDRR struct ecoff_symhdr #define pHDRR HDRR * #define cbHDRR sizeof(HDRR) #ifdef __OpenBSD__ #define ALPHAMAGIC ECOFF_MAGIC_NATIVE_ALPHA #else #define ALPHAMAGIC ECOFF_MAGIC_NETBSD_ALPHA #endif #define ZMAGIC ECOFF_ZMAGIC /* Misc. constants that NetBSD doesn't define at all. */ #define ALPHAUMAGIC 0617 #define _MIPS_NSCNS_MAX 35 #define STYP_TEXT 0x00000020 #define STYP_DATA 0x00000040 #define STYP_BSS 0x00000080 #define STYP_RDATA 0x00000100 #define STYP_SDATA 0x00000200 #define STYP_SBSS 0x00000400 #define STYP_INIT 0x80000000 #define _TEXT ".text" #define _DATA ".data" #define _BSS ".bss" #define _INIT ".init" #define _RDATA ".rdata" #define _SDATA ".sdata" #define _SBSS ".sbss" #endif /* __NetBSD__ || __OpenBSD__ */ static void fatal_unexec __P ((char *, char *)); static void mark_x __P ((char *)); static void update_dynamic_symbols __P ((char *, char *, int, struct aouthdr)); #define READ(_fd, _buffer, _size, _error_message, _error_arg) \ errno = EEOF; \ if (read (_fd, _buffer, _size) != _size) \ fatal_unexec (_error_message, _error_arg); #define WRITE(_fd, _buffer, _size, _error_message, _error_arg) \ if (write (_fd, _buffer, _size) != _size) \ fatal_unexec (_error_message, _error_arg); #define SEEK(_fd, _position, _error_message, _error_arg) \ errno = EEOF; \ if (lseek (_fd, _position, L_SET) != _position) \ fatal_unexec (_error_message, _error_arg); #ifdef HAVE_UNISTD_H #include <unistd.h> #else void *sbrk (); #endif #define EEOF -1 static struct scnhdr *text_section; static struct scnhdr *rel_dyn_section; static struct scnhdr *dynstr_section; static struct scnhdr *dynsym_section; static struct scnhdr *init_section; static struct scnhdr *finit_section; static struct scnhdr *rdata_section; static struct scnhdr *rconst_section; static struct scnhdr *data_section; static struct scnhdr *pdata_section; static struct scnhdr *xdata_section; static struct scnhdr *got_section; static struct scnhdr *lit8_section; static struct scnhdr *lit4_section; static struct scnhdr *sdata_section; static struct scnhdr *sbss_section; static struct scnhdr *bss_section; static struct scnhdr old_data_scnhdr; static unsigned long Brk; struct headers { struct filehdr fhdr; struct aouthdr aout; struct scnhdr section[_MIPS_NSCNS_MAX]; }; void unexec (new_name, a_name, data_start, bss_start, entry_address) char *new_name, *a_name; unsigned long data_start, bss_start, entry_address; { int new, old; char * oldptr; struct headers ohdr, nhdr; struct stat stat; long pagesize, brk; long newsyms, symrel; int nread; int i; long vaddr, scnptr; #define BUFSIZE 8192 char buffer[BUFSIZE]; if ((old = open (a_name, O_RDONLY)) < 0) fatal_unexec ("opening %s", a_name); new = creat (new_name, 0666); if (new < 0) fatal_unexec ("creating %s", new_name); if ((fstat (old, &stat) == -1)) fatal_unexec ("fstat %s", a_name); oldptr = (char *)mmap (0, stat.st_size, PROT_READ, MAP_FILE|MAP_SHARED, old, 0); if (oldptr == (char *)-1) fatal_unexec ("mmap %s", a_name); close (old); /* This is a copy of the a.out header of the original executable */ ohdr = (*(struct headers *)oldptr); /* This is where we build the new header from the in-memory copy */ nhdr = *((struct headers *)TEXT_START); /* First do some consistency checks */ if (nhdr.fhdr.f_magic != ALPHAMAGIC && nhdr.fhdr.f_magic != ALPHAUMAGIC) { fprintf (stderr, "unexec: input file magic number is %x, not %x or %x.\n", nhdr.fhdr.f_magic, ALPHAMAGIC, ALPHAUMAGIC); exit (1); } if (nhdr.fhdr.f_opthdr != sizeof (nhdr.aout)) { fprintf (stderr, "unexec: input a.out header is %d bytes, not %d.\n", nhdr.fhdr.f_opthdr, (int)sizeof (nhdr.aout)); exit (1); } if (nhdr.aout.magic != ZMAGIC) { fprintf (stderr, "unexec: input file a.out magic number is %o, not %o.\n", nhdr.aout.magic, ZMAGIC); exit (1); } /* Now check the existence of certain header section and grab their addresses. */ #define CHECK_SCNHDR(ptr, name, flags) \ ptr = NULL; \ for (i = 0; i < nhdr.fhdr.f_nscns && !ptr; i++) \ if (strncmp (nhdr.section[i].s_name, name, 8) == 0) \ { \ if (nhdr.section[i].s_flags != flags) \ fprintf (stderr, "unexec: %x flags (%x expected) in %s section.\n", \ nhdr.section[i].s_flags, flags, name); \ ptr = nhdr.section + i; \ } \ CHECK_SCNHDR (text_section, _TEXT, STYP_TEXT); CHECK_SCNHDR (init_section, _INIT, STYP_INIT); #ifdef _REL_DYN CHECK_SCNHDR (rel_dyn_section, _REL_DYN, STYP_REL_DYN); #endif /* _REL_DYN */ #ifdef _DYNSYM CHECK_SCNHDR (dynsym_section, _DYNSYM, STYP_DYNSYM); #endif /* _REL_DYN */ #ifdef _DYNSTR CHECK_SCNHDR (dynstr_section, _DYNSTR, STYP_DYNSTR); #endif /* _REL_DYN */ #ifdef _FINI CHECK_SCNHDR (finit_section, _FINI, STYP_FINI); #endif /* _FINI */ CHECK_SCNHDR (rdata_section, _RDATA, STYP_RDATA); #ifdef _RCONST CHECK_SCNHDR (rconst_section, _RCONST, STYP_RCONST); #endif #ifdef _PDATA CHECK_SCNHDR (pdata_section, _PDATA, STYP_PDATA); #endif /* _PDATA */ #ifdef _GOT CHECK_SCNHDR (got_section, _GOT, STYP_GOT); #endif /* _GOT */ CHECK_SCNHDR (data_section, _DATA, STYP_DATA); #ifdef _XDATA CHECK_SCNHDR (xdata_section, _XDATA, STYP_XDATA); #endif /* _XDATA */ #ifdef _LIT8 CHECK_SCNHDR (lit8_section, _LIT8, STYP_LIT8); CHECK_SCNHDR (lit4_section, _LIT4, STYP_LIT4); #endif /* _LIT8 */ CHECK_SCNHDR (sdata_section, _SDATA, STYP_SDATA); CHECK_SCNHDR (sbss_section, _SBSS, STYP_SBSS); CHECK_SCNHDR (bss_section, _BSS, STYP_BSS); pagesize = getpagesize (); brk = (((long) (sbrk (0))) + pagesize - 1) & (-pagesize); /* Remember the current break */ Brk = brk; bcopy (data_section, &old_data_scnhdr, sizeof (old_data_scnhdr)); nhdr.aout.dsize = brk - DATA_START; nhdr.aout.bsize = 0; if (entry_address == 0) { extern __start (); nhdr.aout.entry = (unsigned long)__start; } else nhdr.aout.entry = entry_address; nhdr.aout.bss_start = nhdr.aout.data_start + nhdr.aout.dsize; if (rdata_section != NULL) { rdata_section->s_size = data_start - DATA_START; /* Adjust start and virtual addresses of rdata_section, too. */ rdata_section->s_vaddr = DATA_START; rdata_section->s_paddr = DATA_START; rdata_section->s_scnptr = text_section->s_scnptr + nhdr.aout.tsize; } data_section->s_vaddr = data_start; data_section->s_paddr = data_start; data_section->s_size = brk - data_start; if (rdata_section != NULL) { data_section->s_scnptr = rdata_section->s_scnptr + rdata_section->s_size; } vaddr = data_section->s_vaddr + data_section->s_size; scnptr = data_section->s_scnptr + data_section->s_size; if (lit8_section != NULL) { lit8_section->s_vaddr = vaddr; lit8_section->s_paddr = vaddr; lit8_section->s_size = 0; lit8_section->s_scnptr = scnptr; } if (lit4_section != NULL) { lit4_section->s_vaddr = vaddr; lit4_section->s_paddr = vaddr; lit4_section->s_size = 0; lit4_section->s_scnptr = scnptr; } if (sdata_section != NULL) { sdata_section->s_vaddr = vaddr; sdata_section->s_paddr = vaddr; sdata_section->s_size = 0; sdata_section->s_scnptr = scnptr; } #ifdef _XDATA if (xdata_section != NULL) { xdata_section->s_vaddr = vaddr; xdata_section->s_paddr = vaddr; xdata_section->s_size = 0; xdata_section->s_scnptr = scnptr; } #endif #ifdef _GOT if (got_section != NULL) { bcopy (got_section, buffer, sizeof (struct scnhdr)); got_section->s_vaddr = vaddr; got_section->s_paddr = vaddr; got_section->s_size = 0; got_section->s_scnptr = scnptr; } #endif /*_GOT */ if (sbss_section != NULL) { sbss_section->s_vaddr = vaddr; sbss_section->s_paddr = vaddr; sbss_section->s_size = 0; sbss_section->s_scnptr = scnptr; } if (bss_section != NULL) { bss_section->s_vaddr = vaddr; bss_section->s_paddr = vaddr; bss_section->s_size = 0; bss_section->s_scnptr = scnptr; } WRITE (new, (char *)TEXT_START, nhdr.aout.tsize, "writing text section to %s", new_name); WRITE (new, (char *)DATA_START, nhdr.aout.dsize, "writing data section to %s", new_name); #ifdef _GOT #define old_got_section ((struct scnhdr *)buffer) if (got_section != NULL) { SEEK (new, old_got_section->s_scnptr, "seeking to start of got_section in %s", new_name); WRITE (new, oldptr + old_got_section->s_scnptr, old_got_section->s_size, "writing new got_section of %s", new_name); SEEK (new, nhdr.aout.tsize + nhdr.aout.dsize, "seeking to end of data section of %s", new_name); } #undef old_got_section #endif /* * Construct new symbol table header */ bcopy (oldptr + nhdr.fhdr.f_symptr, buffer, cbHDRR); #define symhdr ((pHDRR)buffer) newsyms = nhdr.aout.tsize + nhdr.aout.dsize; symrel = newsyms - nhdr.fhdr.f_symptr; nhdr.fhdr.f_symptr = newsyms; symhdr->cbLineOffset += symrel; symhdr->cbDnOffset += symrel; symhdr->cbPdOffset += symrel; symhdr->cbSymOffset += symrel; symhdr->cbOptOffset += symrel; symhdr->cbAuxOffset += symrel; symhdr->cbSsOffset += symrel; symhdr->cbSsExtOffset += symrel; symhdr->cbFdOffset += symrel; symhdr->cbRfdOffset += symrel; symhdr->cbExtOffset += symrel; WRITE (new, buffer, cbHDRR, "writing symbol table header of %s", new_name); /* * Copy the symbol table and line numbers */ WRITE (new, oldptr + ohdr.fhdr.f_symptr + cbHDRR, stat.st_size - ohdr.fhdr.f_symptr - cbHDRR, "writing symbol table of %s", new_name); #ifdef _REL_DYN if (rel_dyn_section) update_dynamic_symbols (oldptr, new_name, new, nhdr.aout); #endif #undef symhdr SEEK (new, 0, "seeking to start of header in %s", new_name); WRITE (new, &nhdr, sizeof (nhdr), "writing header of %s", new_name); close (old); close (new); mark_x (new_name); } static void update_dynamic_symbols (old, new_name, new, aout) char *old; /* Pointer to old executable */ char *new_name; /* Name of new executable */ int new; /* File descriptor for new executable */ struct aouthdr aout; /* a.out info from the file header */ { #if !defined (__linux__) && !defined (__NetBSD__) && !defined (__OpenBSD__) typedef struct dynrel_info { char * addr; unsigned type:8; unsigned index:24; unsigned info:8; unsigned pad:8; } dr_info; int nsyms = rel_dyn_section->s_size / sizeof (struct dynrel_info); int i; dr_info * rd_base = (dr_info *) (old + rel_dyn_section->s_scnptr); Elf32_Sym * ds_base = (Elf32_Sym *) (old + dynsym_section->s_scnptr); for (i = 0; i < nsyms; i++) { register Elf32_Sym x; if (rd_base[i].index == 0) continue; x = ds_base[rd_base[i].index]; #if 0 fprintf (stderr, "Object inspected: %s, addr = %lx, shndx = %x", old + dynstr_section->s_scnptr + x.st_name, rd_base[i].addr, x.st_shndx); #endif if ((ELF32_ST_BIND (x.st_info) == STB_GLOBAL) && (x.st_shndx == 0) /* && (x.st_value == NULL) */ ) { /* OK, this is probably a reference to an object in a shared library, so copy the old value. This is done in several steps: 1. reladdr is the address of the location in question relative to the start of the data section, 2. oldref is the addr is the mapped in temacs executable, 3. newref is the address of the location in question in the undumped executable, 4. len is the size of the object reference in bytes -- currently only 4 (long) and 8 (quad) are supported. */ register unsigned long reladdr = (long)rd_base[i].addr - old_data_scnhdr.s_vaddr; char * oldref = old + old_data_scnhdr.s_scnptr + reladdr; unsigned long newref = aout.tsize + reladdr; int len; #if 0 fprintf (stderr, "...relocated\n"); #endif if (rd_base[i].type == R_REFLONG) len = 4; else if (rd_base[i].type == R_REFQUAD) len = 8; else fatal_unexec ("unrecognized relocation type in .dyn.rel section (symbol #%d)", (char *) i); SEEK (new, newref, "seeking to dynamic symbol in %s", new_name); WRITE (new, oldref, len, "writing old dynrel info in %s", new_name); } #if 0 else fprintf (stderr, "...not relocated\n"); #endif } #endif /* not __linux__ and not __NetBSD__ and not __OpenBSD__ */ } /* * mark_x * * After successfully building the new a.out, mark it executable */ static void mark_x (name) char *name; { struct stat sbuf; int um = umask (777); umask (um); if (stat (name, &sbuf) < 0) fatal_unexec ("getting protection on %s", name); sbuf.st_mode |= 0111 & ~um; if (chmod (name, sbuf.st_mode) < 0) fatal_unexec ("setting protection on %s", name); } static void fatal_unexec (s, arg) char *s; char *arg; { if (errno == EEOF) fputs ("unexec: unexpected end of file, ", stderr); else fprintf (stderr, "unexec: %s, ", strerror (errno)); fprintf (stderr, s, arg); fputs (".\n", stderr); exit (1); } /* arch-tag: 46316c49-ee08-4aa3-942b-00798902f5bd (do not change this comment) */
id774-2/emacs
src/unexalpha.c
C
gpl-3.0
15,033
/* * Basic Open API - Open Link Interface * Version 1.3 * * Copyright (c) ETAS GmbH. All rights reserved. * * $Revision: 4794 $ */ /** * @file * @brief IFlexRayEvent definition * @remark The header structure of the OLI may change * in future releases. Don't include this * header directly. Use @ref OLI.h instead. */ #if !defined(__OLI_IFLEXRAYEVENT__INCLUDED__) #define __OLI_IFLEXRAYEVENT__INCLUDED__ // include used interface and constants #include "FlexRayBase.h" #include "../Common/IEvent.h" // open ETAS::OLI namespace #include "../Common/BeginNamespace.h" #ifdef _DOXYGEN namespace ETAS { namespace OLI { #endif /** * @ingroup GROUP_OLI_FLEXRAY_MESSAGES * @brief Interface for all FlexRay bus events. * * Extends the base interface by adding a method to get @ref * GetProtocolOperationControlStatus "additional status information". * * This interface's implementation of @ref IMessage::GetID returns a @ref FlexRayEventCode. * * @remark All public methods are thread-safe. * @remark The lifetime of all objects implementing this interface * is defined by the @ref IRxQueue "receive queue" instance * that contains them. * @since BOA 1.3 * @see IRxQueue, IFlexRayLink, IFlexRayEventFilter */ OLI_INTERFACE IFlexRayEvent : public IEvent { protected: /** @brief Destructor. This destructor has been hidden since objects implementing this class are controlled by the receiving queue. @exception <none> This function must not throw exceptions. @since BOA 1.3 */ virtual ~IFlexRayEvent() OLI_NOTHROW {}; public: /** The unique identifier for the type of this interface and will be returned by @ref IMessage::GetType. */ enum {TYPE = FLEXRAY_TYPE_EVENT_BASE + 1}; /** @brief Specific OCI error code. @return Protocol operation control state code. Only valid if @ref GetID() returns @ref FLEXRAY_EVENT_POCS_CHANGE. @exception <none> This function must not throw exceptions. @since BOA 1.3 */ virtual FlexRayControllerProtocolOperationControlStatus OLI_CALL GetProtocolOperationControlStatus() const OLI_NOTHROW = 0; }; // close ETAS::OLI namespace #ifdef _DOXYGEN } } #endif #include "../Common/EndNamespace.h" #endif // !defined(__OLI_IFLEXRAYEVENT__INCLUDED__)
Mariale13/UDS_Protocol
Sources/CAN_ETAS_BOA/EXTERNAL_INCLUDE/OLI/FlexRay/IFlexRayEvent.h
C
gpl-3.0
2,446
/* * Copyright (C) 2006-2011 by RoboLab - University of Extremadura * * This file is part of RoboComp * * RoboComp 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 3 of the License, or * (at your option) any later version. * * RoboComp 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 RoboComp. If not, see <http://www.gnu.org/licenses/>. */ #ifndef COMMONBEHAVIORI_H #define COMMONBEHAVIORI_H // QT includes #include <QtCore/QObject> // Ice includes #include <Ice/Ice.h> #include <CommonBehavior.h> #include <config.h> #include "worker.h" #include "monitor.h" using namespace RoboCompCommonBehavior; /** \class CommonBehaviorI <p>Servant for components common behaviors. This class implements the methods of the public interface of CommonBehavior. */ class CommonBehaviorI : public QObject , public virtual RoboCompCommonBehavior::CommonBehavior { Q_OBJECT public: CommonBehaviorI( Monitor *_monitor, QObject *parent = 0 ); ~CommonBehaviorI(); int getPeriod( const Ice::Current & = Ice::Current()); void setPeriod(int period, const Ice::Current & = Ice::Current()); int timeAwake( const Ice::Current & = Ice::Current()); void killYourSelf( const Ice::Current & = Ice::Current()); ParameterList getParameterList( const Ice::Current & = Ice::Current()); void setParameterList(const RoboCompCommonBehavior::ParameterList &l, const Ice::Current & = Ice::Current()); void reloadConfig( const Ice::Current& = Ice::Current()); RoboCompCommonBehavior::State getState(const Ice::Current& = Ice::Current()); // QMutex *mutex; private: Monitor *monitor; ///*<monitor Pointer to access monitor methods. It's used to set or read component configuration. public slots: }; #endif
robocomp/robocomp-robolab
experimental/laserRGBDComp2/src/commonbehaviorI.h
C
gpl-3.0
2,129
<?php /* * This file is part of Totara LMS * * Copyright (C) 2010 onwards Totara Learning Solutions LTD * * 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 3 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/>. * * @author Ciaran Irvine <[email protected]> * @package tool * @subpackage tool_totara_timezonefix */ /** * Strings for component 'tool_totara_timezonefix', language 'en', branch 'TOTARA_22' * * @package tool * @subpackage timezonefix * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ $string['pluginname'] = 'Check User Timezones'; $string['infomessage'] = 'This tool checks the timezones specified in the profiles of your users. In order for timezones to work correctly a location-based timezone should be specified, e.g. America/New_York, Europe/London, Asia/Singapore. Some timezone abbreviations (e.g. CET, EST) and UTC offsets (e.g +/-4.5) will not calculate Daylight Savings changes correctly.<br><br>This tool will allow you to change unsuported timezones to an approved format.'; $string['badusertimezonemessage'] = 'Some users have timezones specified in their profiles which are no longer supported. Timezones should be set to a location-based string, e.g. America/New_York, Europe/London, Asia/Singapore. Use the Check User Timezones tool found in Site Administration -> Location to fix timezones for all users.'; $string['nobadusertimezones'] = 'All user profile timezones are correct'; $string['numbadusertimezones'] = 'Timezones need to be adjusted for {$a} users'; $string['badzone'] = 'Unsupported Timezone'; $string['numusers'] = 'Number of Users'; $string['replacewith'] = 'Change To'; $string['updatetimezones'] = 'Update timezones'; $string['updatetimezonesuccess'] = 'Timezone {$a->badzone} changed to {$a->replacewith} successfully'; $string['error:updatetimezone'] = 'An error occured when attempting to change timezone {$a->badzone} to {$a->replacewith}'; $string['error:unknownzones'] = 'There are unknown timezones set for {$a->numusers} users! The following timezones are set in user profiles but are not valid timezone identifiers:<br />{$a->badzonelist}';
totara/seedlings
admin/tool/totara_timezonefix/lang/en/tool_totara_timezonefix.php
PHP
gpl-3.0
2,695
/* -*- Mode: JS; tab-width: 4; indent-tabs-mode: nil; -*- * vim: set sw=4 ts=4 et tw=78: * ***** BEGIN LICENSE BLOCK ***** * * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is the Narcissus JavaScript engine. * * The Initial Developer of the Original Code is * Brendan Eich <[email protected]>. * Portions created by the Initial Developer are Copyright (C) 2004 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Tom Austin <[email protected]> * Brendan Eich <[email protected]> * Shu-Yu Guo <[email protected]> * Dave Herman <[email protected]> * Dimitris Vardoulakis <[email protected]> * Patrick Walton <[email protected]> * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * Narcissus - JS implemented in JS. * * Parser. */ Narcissus.parser = (function() { var lexer = Narcissus.lexer; var definitions = Narcissus.definitions; const StringMap = definitions.StringMap; const Stack = definitions.Stack; // Set constants in the local scope. eval(definitions.consts); /* * pushDestructuringVarDecls :: (node, hoisting node) -> void * * Recursively add all destructured declarations to varDecls. */ function pushDestructuringVarDecls(n, s) { for (var i in n) { var sub = n[i]; if (sub.type === IDENTIFIER) { s.varDecls.push(sub); } else { pushDestructuringVarDecls(sub, s); } } } // NESTING_TOP: top-level // NESTING_SHALLOW: nested within static forms such as { ... } or labeled statement // NESTING_DEEP: nested within dynamic forms such as if, loops, etc. const NESTING_TOP = 0, NESTING_SHALLOW = 1, NESTING_DEEP = 2; function StaticContext(parentScript, parentBlock, inFunction, inForLoopInit, nesting) { this.parentScript = parentScript; this.parentBlock = parentBlock; this.inFunction = inFunction; this.inForLoopInit = inForLoopInit; this.nesting = nesting; this.allLabels = new Stack(); this.currentLabels = new Stack(); this.labeledTargets = new Stack(); this.defaultTarget = null; Narcissus.options.ecma3OnlyMode && (this.ecma3OnlyMode = true); Narcissus.options.parenFreeMode && (this.parenFreeMode = true); } StaticContext.prototype = { ecma3OnlyMode: false, parenFreeMode: false, // non-destructive update via prototype extension update: function(ext) { var desc = {}; for (var key in ext) { desc[key] = { value: ext[key], writable: true, enumerable: true, configurable: true } } return Object.create(this, desc); }, pushLabel: function(label) { return this.update({ currentLabels: this.currentLabels.push(label), allLabels: this.allLabels.push(label) }); }, pushTarget: function(target) { var isDefaultTarget = target.isLoop || target.type === SWITCH; if (isDefaultTarget) target.target = this.defaultTarget; if (this.currentLabels.isEmpty()) { return isDefaultTarget ? this.update({ defaultTarget: target }) : this; } target.labels = new StringMap(); this.currentLabels.forEach(function(label) { target.labels.set(label, true); }); return this.update({ currentLabels: new Stack(), labeledTargets: this.labeledTargets.push(target), defaultTarget: isDefaultTarget ? target : this.defaultTarget }); }, nest: function(atLeast) { var nesting = Math.max(this.nesting, atLeast); return (nesting !== this.nesting) ? this.update({ nesting: nesting }) : this; } }; /* * Script :: (tokenizer, boolean) -> node * * Parses the toplevel and function bodies. */ function Script(t, inFunction) { var n = new Node(t, scriptInit()); var x = new StaticContext(n, n, inFunction, false, NESTING_TOP); Statements(t, x, n); return n; } // We extend Array slightly with a top-of-stack method. definitions.defineProperty(Array.prototype, "top", function() { return this.length && this[this.length-1]; }, false, false, true); /* * Node :: (tokenizer, optional init object) -> node */ function Node(t, init) { var token = t.token; if (token) { // If init.type exists it will override token.type. this.type = token.type; this.value = token.value; this.lineno = token.lineno; // Start and end are file positions for error handling. this.start = token.start; this.end = token.end; } else { this.lineno = t.lineno; } // Node uses a tokenizer for debugging (getSource, filename getter). this.tokenizer = t; this.children = []; for (var prop in init) this[prop] = init[prop]; } var Np = Node.prototype = {}; Np.constructor = Node; Np.toSource = Object.prototype.toSource; // Always use push to add operands to an expression, to update start and end. Np.push = function (kid) { // kid can be null e.g. [1, , 2]. if (kid !== null) { if (kid.start < this.start) this.start = kid.start; if (this.end < kid.end) this.end = kid.end; } return this.children.push(kid); } Node.indentLevel = 0; function tokenString(tt) { var t = definitions.tokens[tt]; return /^\W/.test(t) ? definitions.opTypeNames[t] : t.toUpperCase(); } Np.toString = function () { var a = []; for (var i in this) { if (this.hasOwnProperty(i) && i !== 'type' && i !== 'target') a.push({id: i, value: this[i]}); } a.sort(function (a,b) { return (a.id < b.id) ? -1 : 1; }); const INDENTATION = " "; var n = ++Node.indentLevel; var s = "{\n" + INDENTATION.repeat(n) + "type: " + tokenString(this.type); for (i = 0; i < a.length; i++) s += ", " + a[i].id + ": " + a[i].value; //s += ",\n" + INDENTATION.repeat(n) + a[i].id + ": " + a[i].value; n = --Node.indentLevel; s += "\n" + INDENTATION.repeat(n) + "}"; return s; } Np.getSource = function () { return this.tokenizer.source.slice(this.start, this.end); }; /* * Helper init objects for common nodes. */ const LOOP_INIT = { isLoop: true }; function blockInit() { return { type: BLOCK, varDecls: [] }; } function scriptInit() { return { type: SCRIPT, funDecls: [], varDecls: [], modDecls: [], impDecls: [], expDecls: [], loadDeps: [], hasEmptyReturn: false, hasReturnWithValue: false, isGenerator: false }; } definitions.defineGetter(Np, "filename", function() { return this.tokenizer.filename; }); definitions.defineGetter(Np, "length", function() { throw new Error("Node.prototype.length is gone; " + "use n.children.length instead"); }); definitions.defineProperty(String.prototype, "repeat", function(n) { var s = "", t = this + s; while (--n >= 0) s += t; return s; }, false, false, true); function MaybeLeftParen(t, x) { if (x.parenFreeMode) return t.match(LEFT_PAREN) ? LEFT_PAREN : END; return t.mustMatch(LEFT_PAREN).type; } function MaybeRightParen(t, p) { if (p === LEFT_PAREN) t.mustMatch(RIGHT_PAREN); } /* * Statements :: (tokenizer, compiler context, node) -> void * * Parses a sequence of Statements. */ function Statements(t, x, n) { try { while (!t.done && t.peek(true) !== RIGHT_CURLY) n.push(Statement(t, x)); } catch (e) { if (t.done) t.unexpectedEOF = true; throw e; } } function Block(t, x) { t.mustMatch(LEFT_CURLY); var n = new Node(t, blockInit()); Statements(t, x.update({ parentBlock: n }).pushTarget(n), n); t.mustMatch(RIGHT_CURLY); n.end = t.token.end; return n; } const DECLARED_FORM = 0, EXPRESSED_FORM = 1, STATEMENT_FORM = 2; /* * Statement :: (tokenizer, compiler context) -> node * * Parses a Statement. */ function Statement(t, x) { var i, label, n, n2, p, c, ss, tt = t.get(true), tt2, x2, x3; // Cases for statements ending in a right curly return early, avoiding the // common semicolon insertion magic after this switch. switch (tt) { case FUNCTION: // DECLARED_FORM extends funDecls of x, STATEMENT_FORM doesn't. return FunctionDefinition(t, x, true, (x.nesting !== NESTING_TOP) ? STATEMENT_FORM : DECLARED_FORM); case LEFT_CURLY: n = new Node(t, blockInit()); Statements(t, x.update({ parentBlock: n }).pushTarget(n).nest(NESTING_SHALLOW), n); t.mustMatch(RIGHT_CURLY); n.end = t.token.end; return n; case IF: n = new Node(t); n.condition = HeadExpression(t, x); x2 = x.pushTarget(n).nest(NESTING_DEEP); n.thenPart = Statement(t, x2); n.elsePart = t.match(ELSE) ? Statement(t, x2) : null; return n; case SWITCH: // This allows CASEs after a DEFAULT, which is in the standard. n = new Node(t, { cases: [], defaultIndex: -1 }); n.discriminant = HeadExpression(t, x); x2 = x.pushTarget(n).nest(NESTING_DEEP); t.mustMatch(LEFT_CURLY); while ((tt = t.get()) !== RIGHT_CURLY) { switch (tt) { case DEFAULT: if (n.defaultIndex >= 0) throw t.newSyntaxError("More than one switch default"); // FALL THROUGH case CASE: n2 = new Node(t); if (tt === DEFAULT) n.defaultIndex = n.cases.length; else n2.caseLabel = Expression(t, x2, COLON); break; default: throw t.newSyntaxError("Invalid switch case"); } t.mustMatch(COLON); n2.statements = new Node(t, blockInit()); while ((tt=t.peek(true)) !== CASE && tt !== DEFAULT && tt !== RIGHT_CURLY) n2.statements.push(Statement(t, x2)); n.cases.push(n2); } n.end = t.token.end; return n; case FOR: n = new Node(t, LOOP_INIT); if (t.match(IDENTIFIER)) { if (t.token.value === "each") n.isEach = true; else t.unget(); } if (!x.parenFreeMode) t.mustMatch(LEFT_PAREN); x2 = x.pushTarget(n).nest(NESTING_DEEP); x3 = x.update({ inForLoopInit: true }); if ((tt = t.peek()) !== SEMICOLON) { if (tt === VAR || tt === CONST) { t.get(); n2 = Variables(t, x3); } else if (tt === LET) { t.get(); if (t.peek() === LEFT_PAREN) { n2 = LetBlock(t, x3, false); } else { // Let in for head, we need to add an implicit block // around the rest of the for. x3.parentBlock = n; n.varDecls = []; n2 = Variables(t, x3); } } else { n2 = Expression(t, x3); } } if (n2 && t.match(IN)) { n.type = FOR_IN; n.object = Expression(t, x3); if (n2.type === VAR || n2.type === LET) { c = n2.children; // Destructuring turns one decl into multiples, so either // there must be only one destructuring or only one // decl. if (c.length !== 1 && n2.destructurings.length !== 1) { throw new SyntaxError("Invalid for..in left-hand side", t.filename, n2.lineno); } if (n2.destructurings.length > 0) { n.iterator = n2.destructurings[0]; } else { n.iterator = c[0]; } n.varDecl = n2; } else { if (n2.type === ARRAY_INIT || n2.type === OBJECT_INIT) { n2.destructuredNames = checkDestructuring(t, x3, n2); } n.iterator = n2; } } else { n.setup = n2; t.mustMatch(SEMICOLON); if (n.isEach) throw t.newSyntaxError("Invalid for each..in loop"); n.condition = (t.peek() === SEMICOLON) ? null : Expression(t, x3); t.mustMatch(SEMICOLON); tt2 = t.peek(); n.update = (x.parenFreeMode ? tt2 === LEFT_CURLY || definitions.isStatementStartCode[tt2] : tt2 === RIGHT_PAREN) ? null : Expression(t, x3); } if (!x.parenFreeMode) t.mustMatch(RIGHT_PAREN); n.body = Statement(t, x2); n.end = t.token.end; return n; case WHILE: n = new Node(t, { isLoop: true }); n.condition = HeadExpression(t, x); n.body = Statement(t, x.pushTarget(n).nest(NESTING_DEEP)); n.end = t.token.end; return n; case DO: n = new Node(t, { isLoop: true }); n.body = Statement(t, x.pushTarget(n).nest(NESTING_DEEP)); t.mustMatch(WHILE); n.condition = HeadExpression(t, x); if (!x.ecmaStrictMode) { // <script language="JavaScript"> (without version hints) may need // automatic semicolon insertion without a newline after do-while. // See http://bugzilla.mozilla.org/show_bug.cgi?id=238945. t.match(SEMICOLON); n.end = t.token.end; return n; } break; case BREAK: case CONTINUE: n = new Node(t); // handle the |foo: break foo;| corner case x2 = x.pushTarget(n); if (t.peekOnSameLine() === IDENTIFIER) { t.get(); n.label = t.token.value; } n.target = n.label ? x2.labeledTargets.find(function(target) { return target.labels.has(n.label) }) : x2.defaultTarget; if (!n.target) throw t.newSyntaxError("Invalid " + ((tt === BREAK) ? "break" : "continue")); //if (!n.target.isLoop && tt === CONTINUE) // throw t.newSyntaxError("Invalid continue"); if (tt === CONTINUE) { for (var ttt = n.target; ttt && !ttt.isLoop; ttt = ttt.target) ; if (!ttt) throw t.newSyntaxError("Invalid continue"); } break; case TRY: n = new Node(t, { catchClauses: [] }); n.tryBlock = Block(t, x); while (t.match(CATCH)) { n2 = new Node(t); p = MaybeLeftParen(t, x); switch (t.get()) { case LEFT_BRACKET: case LEFT_CURLY: // Destructured catch identifiers. t.unget(); n2.varName = DestructuringExpression(t, x, true); break; case IDENTIFIER: n2.varName = t.token.value; break; default: throw t.newSyntaxError("missing identifier in catch"); break; } if (t.match(IF)) { if (x.ecma3OnlyMode) throw t.newSyntaxError("Illegal catch guard"); if (n.catchClauses.length && !n.catchClauses.top().guard) throw t.newSyntaxError("Guarded catch after unguarded"); n2.guard = Expression(t, x); } MaybeRightParen(t, p); n2.block = Block(t, x); n.catchClauses.push(n2); } if (t.match(FINALLY)) n.finallyBlock = Block(t, x); if (!n.catchClauses.length && !n.finallyBlock) throw t.newSyntaxError("Invalid try statement"); n.end = t.token.end; return n; case CATCH: case FINALLY: throw t.newSyntaxError(definitions.tokens[tt] + " without preceding try"); case THROW: n = new Node(t); n.exception = Expression(t, x); break; case RETURN: n = ReturnOrYield(t, x); break; case WITH: n = new Node(t); n.object = HeadExpression(t, x); n.body = Statement(t, x.pushTarget(n).nest(NESTING_DEEP)); n.end = t.token.end; return n; case VAR: case CONST: n = Variables(t, x); n.eligibleForASI = true; break; case LET: if (t.peek() === LEFT_PAREN) n = LetBlock(t, x, true); else n = Variables(t, x); n.eligibleForASI = true; break; case DEBUGGER: n = new Node(t); break; case NEWLINE: case SEMICOLON: n = new Node(t, { type: SEMICOLON }); n.expression = null; return n; default: if (tt === IDENTIFIER) { tt = t.peek(); // Labeled statement. if (tt === COLON) { label = t.token.value; if (x.allLabels.has(label)) throw t.newSyntaxError("Duplicate label"); t.get(); n = new Node(t, { type: LABEL, label: label }); n.statement = Statement(t, x.pushLabel(label).nest(NESTING_SHALLOW)); n.target = (n.statement.type === LABEL) ? n.statement.target : n.statement; n.end = t.token.end; return n; } } // Expression statement. // We unget the current token to parse the expression as a whole. n = new Node(t, { type: SEMICOLON }); t.unget(); n.expression = Expression(t, x); n.end = n.expression.end; break; } MagicalSemicolon(t); n.end = t.token.end; return n; } function MagicalSemicolon(t) { var tt; if (t.lineno === t.token.lineno) { tt = t.peekOnSameLine(); if (tt !== END && tt !== NEWLINE && tt !== SEMICOLON && tt !== RIGHT_CURLY) throw t.newSyntaxError("missing ; before statement"); } t.match(SEMICOLON); } function ReturnOrYield(t, x) { var n, b, tt = t.token.type, tt2; var parentScript = x.parentScript; if (tt === RETURN) { // Disabled test because node accepts return at top level in modules if (false && !x.inFunction) throw t.newSyntaxError("Return not in function"); } else /* if (tt === YIELD) */ { if (!x.inFunction) throw t.newSyntaxError("Yield not in function"); parentScript.isGenerator = true; } n = new Node(t, { value: undefined }); tt2 = t.peek(true); if (tt2 !== END && tt2 !== NEWLINE && tt2 !== SEMICOLON && tt2 !== RIGHT_CURLY && (tt !== YIELD || (tt2 !== tt && tt2 !== RIGHT_BRACKET && tt2 !== RIGHT_PAREN && tt2 !== COLON && tt2 !== COMMA))) { if (tt === RETURN) { n.value = Expression(t, x); parentScript.hasReturnWithValue = true; } else { n.value = AssignExpression(t, x); } } else if (tt === RETURN) { parentScript.hasEmptyReturn = true; } // Disallow return v; in generator. if (parentScript.hasReturnWithValue && parentScript.isGenerator) throw t.newSyntaxError("Generator returns a value"); return n; } /* * FunctionDefinition :: (tokenizer, compiler context, boolean, * DECLARED_FORM or EXPRESSED_FORM or STATEMENT_FORM) * -> node */ function FunctionDefinition(t, x, requireName, functionForm) { var tt; var f = new Node(t, { params: [] }); if (f.type !== FUNCTION) f.type = (f.value === "get") ? GETTER : SETTER; if (t.match(IDENTIFIER)) f.name = t.token.value; else if (requireName) throw t.newSyntaxError("missing function identifier"); var x2 = new StaticContext(null, null, true, false, NESTING_TOP); t.mustMatch(LEFT_PAREN); if (!t.match(RIGHT_PAREN)) { do { switch (t.get()) { case LEFT_BRACKET: case LEFT_CURLY: // Destructured formal parameters. t.unget(); f.params.push(DestructuringExpression(t, x2)); break; case IDENTIFIER: f.params.push(t.token.value); break; default: throw t.newSyntaxError("missing formal parameter"); break; } } while (t.match(COMMA)); t.mustMatch(RIGHT_PAREN); } // Do we have an expression closure or a normal body? tt = t.get(); if (tt !== LEFT_CURLY) t.unget(); if (tt !== LEFT_CURLY) { f.body = AssignExpression(t, x2); if (f.body.isGenerator) throw t.newSyntaxError("Generator returns a value"); } else { f.body = Script(t, true); } if (tt === LEFT_CURLY) t.mustMatch(RIGHT_CURLY); f.end = t.token.end; f.functionForm = functionForm; if (functionForm === DECLARED_FORM) x.parentScript.funDecls.push(f); return f; } /* * Variables :: (tokenizer, compiler context) -> node * * Parses a comma-separated list of var declarations (and maybe * initializations). */ function Variables(t, x, letBlock) { var n, n2, ss, i, s, tt; tt = t.token.type; switch (tt) { case VAR: case CONST: s = x.parentScript; break; case LET: s = x.parentBlock; break; case LEFT_PAREN: tt = LET; s = letBlock; break; } n = new Node(t, { type: tt, destructurings: [] }); do { tt = t.get(); if (tt === LEFT_BRACKET || tt === LEFT_CURLY) { // Need to unget to parse the full destructured expression. t.unget(); var dexp = DestructuringExpression(t, x, true); n2 = new Node(t, { type: IDENTIFIER, name: dexp, readOnly: n.type === CONST }); n.push(n2); pushDestructuringVarDecls(n2.name.destructuredNames, s); n.destructurings.push({ exp: dexp, decl: n2 }); if (x.inForLoopInit && t.peek() === IN) { continue; } t.mustMatch(ASSIGN); if (t.token.assignOp) throw t.newSyntaxError("Invalid variable initialization"); n2.initializer = AssignExpression(t, x); continue; } if (tt !== IDENTIFIER) throw t.newSyntaxError("missing variable name"); n2 = new Node(t, { type: IDENTIFIER, name: t.token.value, readOnly: n.type === CONST }); n.push(n2); s.varDecls.push(n2); if (t.match(ASSIGN)) { if (t.token.assignOp) throw t.newSyntaxError("Invalid variable initialization"); n2.initializer = AssignExpression(t, x); } } while (t.match(COMMA)); n.end = t.token.end; return n; } /* * LetBlock :: (tokenizer, compiler context, boolean) -> node * * Does not handle let inside of for loop init. */ function LetBlock(t, x, isStatement) { var n, n2; // t.token.type must be LET n = new Node(t, { type: LET_BLOCK, varDecls: [] }); t.mustMatch(LEFT_PAREN); n.variables = Variables(t, x, n); t.mustMatch(RIGHT_PAREN); if (isStatement && t.peek() !== LEFT_CURLY) { /* * If this is really an expression in let statement guise, then we * need to wrap the LET_BLOCK node in a SEMICOLON node so that we pop * the return value of the expression. */ n2 = new Node(t, { type: SEMICOLON, expression: n }); isStatement = false; } if (isStatement) n.block = Block(t, x); else n.expression = AssignExpression(t, x); return n; } function checkDestructuring(t, x, n, simpleNamesOnly) { if (n.type === ARRAY_COMP) throw t.newSyntaxError("Invalid array comprehension left-hand side"); if (n.type !== ARRAY_INIT && n.type !== OBJECT_INIT) return; var lhss = {}; var nn, n2, idx, sub, cc, c = n.children; for (var i = 0, j = c.length; i < j; i++) { if (!(nn = c[i])) continue; if (nn.type === PROPERTY_INIT) { cc = nn.children; sub = cc[1]; idx = cc[0].value; } else if (n.type === OBJECT_INIT) { // Do we have destructuring shorthand {foo, bar}? sub = nn; idx = nn.value; } else { sub = nn; idx = i; } if (sub.type === ARRAY_INIT || sub.type === OBJECT_INIT) { lhss[idx] = checkDestructuring(t, x, sub, simpleNamesOnly); } else { if (simpleNamesOnly && sub.type !== IDENTIFIER) { // In declarations, lhs must be simple names throw t.newSyntaxError("missing name in pattern"); } lhss[idx] = sub; } } return lhss; } function DestructuringExpression(t, x, simpleNamesOnly) { var n = PrimaryExpression(t, x); // Keep the list of lefthand sides for varDecls n.destructuredNames = checkDestructuring(t, x, n, simpleNamesOnly); return n; } function GeneratorExpression(t, x, e) { return new Node(t, { type: GENERATOR, expression: e, tail: ComprehensionTail(t, x) }); } function ComprehensionTail(t, x) { var body, n, n2, n3, p; // t.token.type must be FOR body = new Node(t, { type: COMP_TAIL }); do { // Comprehension tails are always for..in loops. n = new Node(t, { type: FOR_IN, isLoop: true }); if (t.match(IDENTIFIER)) { // But sometimes they're for each..in. if (t.token.value === "each") n.isEach = true; else t.unget(); } p = MaybeLeftParen(t, x); switch(t.get()) { case LEFT_BRACKET: case LEFT_CURLY: t.unget(); // Destructured left side of for in comprehension tails. n.iterator = DestructuringExpression(t, x); break; case IDENTIFIER: n.iterator = n3 = new Node(t, { type: IDENTIFIER }); n3.name = n3.value; n.varDecl = n2 = new Node(t, { type: VAR }); n2.push(n3); x.parentScript.varDecls.push(n3); // Don't add to varDecls since the semantics of comprehensions is // such that the variables are in their own function when // desugared. break; default: throw t.newSyntaxError("missing identifier"); } t.mustMatch(IN); n.object = Expression(t, x); MaybeRightParen(t, p); body.push(n); } while (t.match(FOR)); // Optional guard. if (t.match(IF)) body.guard = HeadExpression(t, x); return body; } function HeadExpression(t, x) { var p = MaybeLeftParen(t, x); var n = ParenExpression(t, x); MaybeRightParen(t, p); if (p === END && !n.parenthesized) { var tt = t.peek(); if (tt !== LEFT_CURLY && !definitions.isStatementStartCode[tt]) throw t.newSyntaxError("Unparenthesized head followed by unbraced body"); } return n; } function ParenExpression(t, x) { // Always accept the 'in' operator in a parenthesized expression, // where it's unambiguous, even if we might be parsing the init of a // for statement. var n = Expression(t, x.update({ inForLoopInit: x.inForLoopInit && (t.token.type === LEFT_PAREN) })); if (t.match(FOR)) { if (n.type === YIELD && !n.parenthesized) throw t.newSyntaxError("Yield expression must be parenthesized"); if (n.type === COMMA && !n.parenthesized) throw t.newSyntaxError("Generator expression must be parenthesized"); n = GeneratorExpression(t, x, n); } return n; } /* * Expression :: (tokenizer, compiler context) -> node * * Top-down expression parser matched against SpiderMonkey. */ function Expression(t, x) { var n, n2; n = AssignExpression(t, x); if (t.match(COMMA)) { n2 = new Node(t, { type: COMMA }); n2.push(n); n = n2; do { n2 = n.children[n.children.length-1]; if (n2.type === YIELD && !n2.parenthesized) throw t.newSyntaxError("Yield expression must be parenthesized"); n.push(AssignExpression(t, x)); } while (t.match(COMMA)); } return n; } function AssignExpression(t, x) { var n, lhs; // Have to treat yield like an operand because it could be the leftmost // operand of the expression. if (t.match(YIELD, true)) return ReturnOrYield(t, x); n = new Node(t, { type: ASSIGN }); lhs = ConditionalExpression(t, x); if (!t.match(ASSIGN)) { return lhs; } switch (lhs.type) { case OBJECT_INIT: case ARRAY_INIT: lhs.destructuredNames = checkDestructuring(t, x, lhs); // FALL THROUGH case IDENTIFIER: case DOT: case INDEX: case CALL: break; default: throw t.newSyntaxError("Bad left-hand side of assignment"); break; } n.assignOp = t.token.assignOp; n.push(lhs); n.push(AssignExpression(t, x)); return n; } function ConditionalExpression(t, x) { var n, n2; n = OrExpression(t, x); if (t.match(HOOK)) { n2 = n; n = new Node(t, { type: HOOK }); n.push(n2); /* * Always accept the 'in' operator in the middle clause of a ternary, * where it's unambiguous, even if we might be parsing the init of a * for statement. */ n.push(AssignExpression(t, x.update({ inForLoopInit: false }))); if (!t.match(COLON)) throw t.newSyntaxError("missing : after ?"); n.push(AssignExpression(t, x)); } return n; } function OrExpression(t, x) { var n, n2; n = AndExpression(t, x); while (t.match(OR)) { n2 = new Node(t); n2.push(n); n2.push(AndExpression(t, x)); n = n2; } return n; } function AndExpression(t, x) { var n, n2; n = BitwiseOrExpression(t, x); while (t.match(AND)) { n2 = new Node(t); n2.push(n); n2.push(BitwiseOrExpression(t, x)); n = n2; } return n; } function BitwiseOrExpression(t, x) { var n, n2; n = BitwiseXorExpression(t, x); while (t.match(BITWISE_OR)) { n2 = new Node(t); n2.push(n); n2.push(BitwiseXorExpression(t, x)); n = n2; } return n; } function BitwiseXorExpression(t, x) { var n, n2; n = BitwiseAndExpression(t, x); while (t.match(BITWISE_XOR)) { n2 = new Node(t); n2.push(n); n2.push(BitwiseAndExpression(t, x)); n = n2; } return n; } function BitwiseAndExpression(t, x) { var n, n2; n = EqualityExpression(t, x); while (t.match(BITWISE_AND)) { n2 = new Node(t); n2.push(n); n2.push(EqualityExpression(t, x)); n = n2; } return n; } function EqualityExpression(t, x) { var n, n2; n = RelationalExpression(t, x); while (t.match(EQ) || t.match(NE) || t.match(STRICT_EQ) || t.match(STRICT_NE)) { n2 = new Node(t); n2.push(n); n2.push(RelationalExpression(t, x)); n = n2; } return n; } function RelationalExpression(t, x) { var n, n2; /* * Uses of the in operator in shiftExprs are always unambiguous, * so unset the flag that prohibits recognizing it. */ var x2 = x.update({ inForLoopInit: false }); n = ShiftExpression(t, x2); while ((t.match(LT) || t.match(LE) || t.match(GE) || t.match(GT) || (!x.inForLoopInit && t.match(IN)) || t.match(INSTANCEOF))) { n2 = new Node(t); n2.push(n); n2.push(ShiftExpression(t, x2)); n = n2; } return n; } function ShiftExpression(t, x) { var n, n2; n = AddExpression(t, x); while (t.match(LSH) || t.match(RSH) || t.match(URSH)) { n2 = new Node(t); n2.push(n); n2.push(AddExpression(t, x)); n = n2; } return n; } function AddExpression(t, x) { var n, n2; n = MultiplyExpression(t, x); while (t.match(PLUS) || t.match(MINUS)) { n2 = new Node(t); n2.push(n); n2.push(MultiplyExpression(t, x)); n = n2; } return n; } function MultiplyExpression(t, x) { var n, n2; n = UnaryExpression(t, x); while (t.match(MUL) || t.match(DIV) || t.match(MOD)) { n2 = new Node(t); n2.push(n); n2.push(UnaryExpression(t, x)); n = n2; } return n; } function UnaryExpression(t, x) { var n, n2, tt; switch (tt = t.get(true)) { case DELETE: case VOID: case TYPEOF: case NOT: case BITWISE_NOT: case PLUS: case MINUS: if (tt === PLUS) n = new Node(t, { type: UNARY_PLUS }); else if (tt === MINUS) n = new Node(t, { type: UNARY_MINUS }); else n = new Node(t); n.push(UnaryExpression(t, x)); break; case INCREMENT: case DECREMENT: // Prefix increment/decrement. n = new Node(t); n.push(MemberExpression(t, x, true)); break; default: t.unget(); n = MemberExpression(t, x, true); // Don't look across a newline boundary for a postfix {in,de}crement. if (t.tokens[(t.tokenIndex + t.lookahead - 1) & 3].lineno === t.lineno) { if (t.match(INCREMENT) || t.match(DECREMENT)) { n2 = new Node(t, { postfix: true }); n2.push(n); n = n2; } } break; } return n; } function MemberExpression(t, x, allowCallSyntax) { var n, n2, name, tt; if (t.match(NEW)) { n = new Node(t); n.push(MemberExpression(t, x, false)); if (t.match(LEFT_PAREN)) { n.type = NEW_WITH_ARGS; n.push(ArgumentList(t, x)); } } else { n = PrimaryExpression(t, x); } while ((tt = t.get()) !== END) { switch (tt) { case DOT: n2 = new Node(t); n2.push(n); t.forceIdentifier(); n2.push(new Node(t)); break; case LEFT_BRACKET: n2 = new Node(t, { type: INDEX }); n2.push(n); n2.push(Expression(t, x)); t.mustMatch(RIGHT_BRACKET); n2.end = t.token.end; break; case LEFT_PAREN: if (allowCallSyntax) { n2 = new Node(t, { type: CALL }); n2.push(n); n2.push(ArgumentList(t, x)); break; } // FALL THROUGH default: t.unget(); return n; } n = n2; } return n; } function ArgumentList(t, x) { var n, n2; n = new Node(t, { type: LIST }); if (t.match(RIGHT_PAREN, true)) { n.end = t.token.end; return n; } do { n2 = AssignExpression(t, x); if (n2.type === YIELD && !n2.parenthesized && t.peek() === COMMA) throw t.newSyntaxError("Yield expression must be parenthesized"); if (t.match(FOR)) { n2 = GeneratorExpression(t, x, n2); if (n.children.length > 1 || t.peek(true) === COMMA) throw t.newSyntaxError("Generator expression must be parenthesized"); } n.push(n2); } while (t.match(COMMA)); t.mustMatch(RIGHT_PAREN); n.end = t.token.end; return n; } function PrimaryExpression(t, x) { var n, n2, tt = t.get(true); switch (tt) { case FUNCTION: n = FunctionDefinition(t, x, false, EXPRESSED_FORM); break; case LEFT_BRACKET: n = new Node(t, { type: ARRAY_INIT }); while ((tt = t.peek(true)) !== RIGHT_BRACKET) { if (tt === COMMA) { t.get(); n.push(null); continue; } n.push(AssignExpression(t, x)); if (tt !== COMMA && !t.match(COMMA)) break; } // If we matched exactly one element and got a FOR, we have an // array comprehension. if (n.children.length === 1 && t.match(FOR)) { n2 = new Node(t, { type: ARRAY_COMP, expression: n.children[0], tail: ComprehensionTail(t, x) }); n = n2; } t.mustMatch(RIGHT_BRACKET); n.end = t.token.end; break; case LEFT_CURLY: var id, fd; n = new Node(t, { type: OBJECT_INIT }); object_init: if (!t.match(RIGHT_CURLY)) { do { tt = t.get(); if ((t.token.value === "get" || t.token.value === "set") && t.peek() === IDENTIFIER) { if (x.ecma3OnlyMode) throw t.newSyntaxError("Illegal property accessor"); n.push(FunctionDefinition(t, x, true, EXPRESSED_FORM)); } else { switch (tt) { case IDENTIFIER: case NUMBER: case STRING: id = new Node(t, { type: IDENTIFIER }); break; case RIGHT_CURLY: if (x.ecma3OnlyMode) throw t.newSyntaxError("Illegal trailing ,"); break object_init; default: if (t.token.value in definitions.keywords) { id = new Node(t, { type: IDENTIFIER }); break; } throw t.newSyntaxError("Invalid property name"); } if (t.match(COLON)) { n2 = new Node(t, { type: PROPERTY_INIT }); n2.push(id); n2.push(AssignExpression(t, x)); n.push(n2); } else { // Support, e.g., |var {x, y} = o| as destructuring shorthand // for |var {x: x, y: y} = o|, per proposed JS2/ES4 for JS1.8. if (t.peek() !== COMMA && t.peek() !== RIGHT_CURLY) throw t.newSyntaxError("missing : after property"); n.push(id); } } } while (t.match(COMMA)); t.mustMatch(RIGHT_CURLY); } n.end = t.token.end; break; case LEFT_PAREN: var start = t.token.start; n = ParenExpression(t, x); t.mustMatch(RIGHT_PAREN); n.start = start; n.end = t.token.end; n.parenthesized = true; break; case LET: n = LetBlock(t, x, false); break; case NULL: case THIS: case TRUE: case FALSE: case IDENTIFIER: case NUMBER: case STRING: case REGEXP: n = new Node(t); break; default: throw t.newSyntaxError("missing operand"); break; } return n; } /* * parse :: (source, filename, line number) -> node */ function parse(s, f, l) { var t = new lexer.Tokenizer(s, f, l); var n = Script(t, false); if (!t.done) throw t.newSyntaxError("Syntax error"); return n; } /* * parseStdin :: (source, {line number}) -> node */ function parseStdin(s, ln) { for (;;) { try { var t = new lexer.Tokenizer(s, "stdin", ln.value); var n = Script(t, false); ln.value = t.lineno; return n; } catch (e) { if (!t.unexpectedEOF) throw e; var more = readline(); if (!more) throw e; s += "\n" + more; } } } return { parse: parse, parseStdin: parseStdin, Node: Node, DECLARED_FORM: DECLARED_FORM, EXPRESSED_FORM: EXPRESSED_FORM, STATEMENT_FORM: STATEMENT_FORM, Tokenizer: lexer.Tokenizer, FunctionDefinition: FunctionDefinition }; }());
Lethrir/Neo4JDemo
node_modules/neo4j/node_modules/streamline/deps/narcissus/lib/jsparse.js
JavaScript
gpl-3.0
47,994
<?php namespace Innova\AudioRecorderBundle\Installation; use Claroline\InstallationBundle\Additional\AdditionalInstaller as BaseInstaller; use Innova\AudioRecorderBundle\DataFixtures\DefaultData; class AdditionalInstaller extends BaseInstaller { public function postInstall() { $default = new DefaultData(); $default->load($this->container->get('claroline.persistence.object_manager')); } }
remytms/Distribution
plugin/audio-recorder/Installation/AdditionalInstaller.php
PHP
gpl-3.0
422
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>gSOAP WS-Security: /Users/engelen/Projects/gsoap/plugin/wsseapi.c File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.7.4 --> <div id="top"> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">gSOAP WS-Security&#160;<span id="projectnumber">2.8 Stable</span></div> </td> </tr> </tbody> </table> </div> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="pages.html"><span>Related&#160;Pages</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="globals.html"><span>File&#160;Members</span></a></li> </ul> </div> </div> <div class="header"> <div class="summary"> <a href="#nested-classes">Classes</a> &#124; <a href="#define-members">Defines</a> &#124; <a href="#func-members">Functions</a> &#124; <a href="#var-members">Variables</a> </div> <div class="headertitle"> <div class="title">/Users/engelen/Projects/gsoap/plugin/wsseapi.c File Reference</div> </div> </div> <div class="contents"> <div class="textblock"><code>#include &quot;<a class="el" href="wsseapi_8h.html">wsseapi.h</a>&quot;</code><br/> <code>#include &quot;<a class="el" href="smdevp_8h.html">smdevp.h</a>&quot;</code><br/> <code>#include &quot;<a class="el" href="mecevp_8h.html">mecevp.h</a>&quot;</code><br/> <code>#include &quot;<a class="el" href="threads_8h.html">threads.h</a>&quot;</code><br/> </div><div class="textblock"><div class="dynheader"> Include dependency graph for wsseapi.c:</div> <div class="dyncontent"> <div class="center"><img src="wsseapi_8c__incl.png" border="0" usemap="#_2_users_2engelen_2_projects_2gsoap_2plugin_2wsseapi_8c" alt=""/></div> <map name="_2_users_2engelen_2_projects_2gsoap_2plugin_2wsseapi_8c" id="_2_users_2engelen_2_projects_2gsoap_2plugin_2wsseapi_8c"> <area shape="rect" id="node3" href="wsseapi_8h.html" title="wsseapi.h" alt="" coords="108,83,188,111"/><area shape="rect" id="node7" href="smdevp_8h.html" title="smdevp.h" alt="" coords="4,161,83,189"/><area shape="rect" id="node11" href="mecevp_8h.html" title="mecevp.h" alt="" coords="202,161,280,189"/><area shape="rect" id="node16" href="threads_8h.html" title="threads.h" alt="" coords="295,83,371,111"/></map> </div> </div><table class="memberdecls"> <tr><td colspan="2"><h2><a name="nested-classes"></a> Classes</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structsoap__wsse__session.html">soap_wsse_session</a></td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Digest authentication session data. <a href="structsoap__wsse__session.html#details">More...</a><br/></td></tr> <tr><td colspan="2"><h2><a name="define-members"></a> Defines</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a5c6f8145831c10a4dbd0465a923908c6">SOAP_WSSE_MAX_REF</a>&#160;&#160;&#160;(100)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a12d6f49d99323ae66d2a6ee154f90469">SOAP_WSSE_CLKSKEW</a>&#160;&#160;&#160;(300)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a65c55be8ba01ac63f64fddbe0e82b75b">SOAP_WSSE_NONCELEN</a>&#160;&#160;&#160;(20)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a5de15cf324b79588e67e4ccbba2119ae">SOAP_WSSE_NONCETIME</a>&#160;&#160;&#160;(SOAP_WSSE_CLKSKEW + 240)</td></tr> <tr><td colspan="2"><h2><a name="func-members"></a> Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a3dafa97e60020d63fdd4be32aefa4119">soap_wsse_ids</a> (struct soap *soap, const char *tags)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">converts tag name(s) to id name(s) <a href="#a3dafa97e60020d63fdd4be32aefa4119"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#acb666de6b99187df159aaee8219317bd">soap_wsse_session_verify</a> (struct soap *soap, const char hash[SOAP_SMD_SHA1_SIZE], const char *created, const char *nonce)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Verifies and updates the digest, nonce, and creation time against the digest authentication session database to prevent replay attacks. <a href="#acb666de6b99187df159aaee8219317bd"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a0dd21015cab9811c9da9b08117401ad5">soap_wsse_session_cleanup</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Removes expired authentication data from the digest authentication session database. <a href="#a0dd21015cab9811c9da9b08117401ad5"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#ae341110563279cc6f5cc57c22eaa7a8b">calc_digest</a> (struct soap *soap, const char *created, const char *nonce, int noncelen, const char *password, char hash[SOAP_SMD_SHA1_SIZE])</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates digest value SHA1(created, nonce, password) <a href="#ae341110563279cc6f5cc57c22eaa7a8b"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a1c4fe3f38985fd0c526a03fdbafc2ad1">calc_nonce</a> (struct soap *soap, char nonce[SOAP_WSSE_NONCELEN])</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates randomized nonce (also uses time() in case a poorly seeded PRNG is used) <a href="#a1c4fe3f38985fd0c526a03fdbafc2ad1"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a5c63323384afeaeba5321bb65ad1db86">soap_wsse_init</a> (struct soap *soap, struct <a class="el" href="structsoap__wsse__data.html">soap_wsse_data</a> *data, const void *(*arg)(struct soap *, int, const char *, int *))</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes plugin data. <a href="#a5c63323384afeaeba5321bb65ad1db86"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a491ec857faca76dce6ff59218e58626c">soap_wsse_copy</a> (struct soap *soap, struct soap_plugin *dst, struct soap_plugin *src)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Copies plugin data to localize plugin data for threads. <a href="#a491ec857faca76dce6ff59218e58626c"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a67455a9af65734dc71fa3e3bf66a6738">soap_wsse_delete</a> (struct soap *soap, struct soap_plugin *p)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Deletes plugin data. <a href="#a67455a9af65734dc71fa3e3bf66a6738"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#aa3df0ea602c9868f5e1c7d636aeeddf9">soap_wsse_preparesend</a> (struct soap *soap, const char *buf, size_t len)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Takes a piece of the XML message (tokenized) to compute digest. <a href="#aa3df0ea602c9868f5e1c7d636aeeddf9"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a0a65a4a97fc2ed131ef7a24da07ba08f">soap_wsse_preparefinalsend</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Collects the digests of all the wsu:Id elements and populates the SignedInfo. <a href="#a0a65a4a97fc2ed131ef7a24da07ba08f"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a9f2b5e6c2242b3516e624d1b2b25ee1e">soap_wsse_preparecleanup</a> (struct soap *soap, struct <a class="el" href="structsoap__wsse__data.html">soap_wsse_data</a> *data)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Restores engine state. <a href="#a9f2b5e6c2242b3516e624d1b2b25ee1e"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#ae3558fa3952e01ec72fbd5f9bf4b1b37">soap_wsse_preparefinalrecv</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Verify signature and SignedInfo digests initiated with soap_wsse_verify_auto. <a href="#ae3558fa3952e01ec72fbd5f9bf4b1b37"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a278a5511160aade2c206b0225781ff04">soap_wsse_header</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">This callback is invoked as soon as the SOAP Header is received, we need to obtain the encrypted key when the message is encrypted to start decryption. <a href="#a278a5511160aade2c206b0225781ff04"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a903b3f58fd8b9699751c703793f06435">soap_wsse_element_begin_in</a> (struct soap *soap, const char *tag)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">This callback is invoked as soon as a starting tag of an element is received by the XML parser. <a href="#a903b3f58fd8b9699751c703793f06435"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#ae095227834179806af2ea7dc90bd961e">soap_wsse_element_end_in</a> (struct soap *soap, const char *tag1, const char *tag2)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">This callback is invoked as soon as an ending tag of an element is received by the XML parser. <a href="#ae095227834179806af2ea7dc90bd961e"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#ad7924c5bd34781df563ed2339eab59f3">soap_wsse_element_begin_out</a> (struct soap *soap, const char *tag)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">This callback is invoked as soon as a starting tag of an element is to be sent by the XML generator. <a href="#ad7924c5bd34781df563ed2339eab59f3"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a04ac9993d22e7b868135f9b7ebcca8e0">soap_wsse_element_end_out</a> (struct soap *soap, const char *tag)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">This callback is invoked as soon as an ending tag of an element is to be sent by the XML generator. <a href="#a04ac9993d22e7b868135f9b7ebcca8e0"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#add4f5148c87d213a69f86c9fc72a8001">soap_wsse_verify_nested</a> (struct soap *soap, struct soap_dom_element *dom, const char *URI, const char *tag)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Counts signed matching elements from the dom node and down. <a href="#add4f5148c87d213a69f86c9fc72a8001"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="struct__wsse_____security.html">_wsse__Security</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a6f167767a1a7763be6dc2b8eff75e419">soap_wsse_add_Security</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds Security header element. <a href="#a6f167767a1a7763be6dc2b8eff75e419"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="struct__wsse_____security.html">_wsse__Security</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#aba5822fee3cafde84e4bcae41a37fc69">soap_wsse_add_Security_actor</a> (struct soap *soap, const char *actor)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds Security header element with actor or role attribute. <a href="#aba5822fee3cafde84e4bcae41a37fc69"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#ac06c7021592b2aaca50f73e0de9dec7c">soap_wsse_delete_Security</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Deletes Security header element. <a href="#ac06c7021592b2aaca50f73e0de9dec7c"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="struct__wsse_____security.html">_wsse__Security</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a5d9f35b53cbf1b94d7bc3fdfa1728485">soap_wsse_Security</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns Security header element if present. <a href="#a5d9f35b53cbf1b94d7bc3fdfa1728485"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="structds_____signature_type.html">ds__SignatureType</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a07b4f0c2995df0a695a6f06e2519151f">soap_wsse_add_Signature</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds Signature header element. <a href="#a07b4f0c2995df0a695a6f06e2519151f"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#ad817f20012b39724f7351909b0b79df2">soap_wsse_delete_Signature</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Deletes Signature header element. <a href="#ad817f20012b39724f7351909b0b79df2"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="structds_____signature_type.html">ds__SignatureType</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a4b8fe90c13170958dcee629a519c4451">soap_wsse_Signature</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns Signature header element if present. <a href="#a4b8fe90c13170958dcee629a519c4451"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a71fe27aee76db1d0a635afe106d8b109">soap_wsse_add_Timestamp</a> (struct soap *soap, const char *id, time_t lifetime)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds Timestamp element with optional expiration date+time (lifetime). <a href="#a71fe27aee76db1d0a635afe106d8b109"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="struct__wsu_____timestamp.html">_wsu__Timestamp</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a55271d6c4b775d88995a5e4837142b0f">soap_wsse_Timestamp</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns Timestamp element if present. <a href="#a55271d6c4b775d88995a5e4837142b0f"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a98422cde0e2b7b14d65212f7061101fa">soap_wsse_verify_Timestamp</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Verifies the Timestamp/Expires element against the current time. <a href="#a98422cde0e2b7b14d65212f7061101fa"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a37f32e51bceabf2e2823516a1737548f">soap_wsse_add_UsernameTokenText</a> (struct soap *soap, const char *id, const char *username, const char *password)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds UsernameToken element with optional clear-text password. <a href="#a37f32e51bceabf2e2823516a1737548f"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#ac9fe59008bdf12d7a007ac48e6ebb613">soap_wsse_add_UsernameTokenDigest</a> (struct soap *soap, const char *id, const char *username, const char *password)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds UsernameToken element for digest authentication. <a href="#ac9fe59008bdf12d7a007ac48e6ebb613"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="struct__wsse_____username_token.html">_wsse__UsernameToken</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a6bde1e5babdeb24b2f88666a837d4c21">soap_wsse_UsernameToken</a> (struct soap *soap, const char *id)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns UsernameToken element if present. <a href="#a6bde1e5babdeb24b2f88666a837d4c21"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a936a081cece9995f265b885e113ff5db">soap_wsse_get_Username</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns UsernameToken/username string or wsse:FailedAuthentication fault. <a href="#a936a081cece9995f265b885e113ff5db"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#aeb0afd01a5036e4f1314a3cfe8575bd5">soap_wsse_verify_Password</a> (struct soap *soap, const char *password)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Verifies the supplied password or sets wsse:FailedAuthentication fault. <a href="#aeb0afd01a5036e4f1314a3cfe8575bd5"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a272ece3d02d7fbb5309cda9d1b252822">soap_wsse_add_BinarySecurityToken</a> (struct soap *soap, const char *id, const char *valueType, const unsigned char *data, int size)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds BinarySecurityToken element. <a href="#a272ece3d02d7fbb5309cda9d1b252822"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a53075fb3cec4ec4e70fb11850fecb401">soap_wsse_add_BinarySecurityTokenX509</a> (struct soap *soap, const char *id, X509 *cert)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds BinarySecurityToken element with X509 certificate. <a href="#a53075fb3cec4ec4e70fb11850fecb401"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#ad88d8317bcbbcda4cdc8d1bcfb2e0f18">soap_wsse_add_BinarySecurityTokenPEM</a> (struct soap *soap, const char *id, const char *filename)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds BinarySecurityToken element from a PEM file. <a href="#ad88d8317bcbbcda4cdc8d1bcfb2e0f18"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="struct__wsse_____binary_security_token.html">_wsse__BinarySecurityToken</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#ab0d5552252e672a0ea24af9b6595bd2c">soap_wsse_BinarySecurityToken</a> (struct soap *soap, const char *id)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns BinarySecurityToken element if present. <a href="#ab0d5552252e672a0ea24af9b6595bd2c"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a7496da1dd76aa06e6657365b5c7dd76d">soap_wsse_get_BinarySecurityToken</a> (struct soap *soap, const char *id, char **valueType, unsigned char **data, int *size)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Get wsse:BinarySecurityToken element token data in binary form. <a href="#a7496da1dd76aa06e6657365b5c7dd76d"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">X509 *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#af88b4ff21d348c6b256b72b600514e14">soap_wsse_get_BinarySecurityTokenX509</a> (struct soap *soap, const char *id)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Get X509 wsse:BinarySecurityToken certificate and verify its content. <a href="#af88b4ff21d348c6b256b72b600514e14"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a8f5879e7d5bd3580ea400ccd1982d747">soap_wsse_verify_X509</a> (struct soap *soap, X509 *cert)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Verifies X509 certificate against soap-&gt;cafile, soap-&gt;capath, and soap-&gt;crlfile. <a href="#a8f5879e7d5bd3580ea400ccd1982d747"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="structds_____signed_info_type.html">ds__SignedInfoType</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#ab4a10d08044dd66da337f684385ed2cf">soap_wsse_add_SignedInfo</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds SignedInfo element. <a href="#ab4a10d08044dd66da337f684385ed2cf"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#afc50e18a5777eb58f1aed0833a02d477">soap_wsse_add_SignedInfo_Reference</a> (struct soap *soap, const char *URI, const char *transform, const char *inclusiveNamespaces, const char *HA)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds SignedInfo element with Reference URI, transform algorithm used, and digest value. <a href="#afc50e18a5777eb58f1aed0833a02d477"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a398f98d62dfba91d04cff19230fb6722">soap_wsse_add_SignedInfo_SignatureMethod</a> (struct soap *soap, const char *method, int canonical)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds SignedInfo element with SignatureMethod. <a href="#a398f98d62dfba91d04cff19230fb6722"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="structds_____signed_info_type.html">ds__SignedInfoType</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a216e30bdddd04d328398126851d0f87a">soap_wsse_SignedInfo</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns SignedInfo element if present. <a href="#a216e30bdddd04d328398126851d0f87a"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#afd4c4268cc8f9d667cc44586fb635b5d">soap_wsse_get_SignedInfo_SignatureMethod</a> (struct soap *soap, int *alg)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Get SignatureMethod algorithm. <a href="#afd4c4268cc8f9d667cc44586fb635b5d"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a7399c40e0019bc1ae797fccf92f81fc7">soap_wsse_add_SignatureValue</a> (struct soap *soap, int alg, const void *key, int keylen)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds SignedInfo/SignatureMethod element, signs the SignedInfo element, and adds the resulting SignatureValue element. <a href="#a7399c40e0019bc1ae797fccf92f81fc7"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a8ab7e709b0423cd68d3fec96b3db3734">soap_wsse_verify_SignatureValue</a> (struct soap *soap, int alg, const void *key, int keylen)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Verifies the SignatureValue of a SignedInfo element. <a href="#a8ab7e709b0423cd68d3fec96b3db3734"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a75b7ca484637dfc49143546072dd5f4b">soap_wsse_verify_SignedInfo</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Verifies the digest values of the XML elements referenced by the SignedInfo References. <a href="#a75b7ca484637dfc49143546072dd5f4b"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#acf1c213ea26a2286f9c0457849bd6290">soap_wsse_verify_digest</a> (struct soap *soap, int alg, int canonical, const char *id, unsigned char hash[SOAP_SMD_MAX_SIZE])</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Verifies the digest value of an XML element referenced by id against the hash. <a href="#acf1c213ea26a2286f9c0457849bd6290"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="structds_____key_info_type.html">ds__KeyInfoType</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#ac80606801677bc109bcef606655f6e23">soap_wsse_add_KeyInfo</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds KeyInfo element. <a href="#ac80606801677bc109bcef606655f6e23"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="structds_____key_info_type.html">ds__KeyInfoType</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a3978578b5dd8dc7065e9946982fe7d57">soap_wsse_KeyInfo</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns KeyInfo element if present. <a href="#a3978578b5dd8dc7065e9946982fe7d57"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a25240140007f1776479e81dd43457f40">soap_wsse_add_KeyInfo_KeyName</a> (struct soap *soap, const char *name)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds KeyName element. <a href="#a25240140007f1776479e81dd43457f40"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#aeb7b82c21d0022bd1ac08c843cefe75f">soap_wsse_get_KeyInfo_KeyName</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns KeyName element if present. <a href="#aeb7b82c21d0022bd1ac08c843cefe75f"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#aa1557c59801a0c3e4a77c1cb56cc2d9e">soap_wsse_add_KeyInfo_SecurityTokenReferenceURI</a> (struct soap *soap, const char *URI, const char *valueType)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds KeyInfo element with SecurityTokenReference URI. <a href="#aa1557c59801a0c3e4a77c1cb56cc2d9e"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a72df80abd1d36cea516feda3a84672cf">soap_wsse_add_KeyInfo_SecurityTokenReferenceX509</a> (struct soap *soap, const char *URI)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds KeyInfo element with SecurityTokenReference URI to an X509 cert. <a href="#a72df80abd1d36cea516feda3a84672cf"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#aaf44a9fdec53a3a7ec2ff1a9dae6c51c">soap_wsse_get_KeyInfo_SecurityTokenReferenceURI</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a SecurityTokenReference URI if present. <a href="#aaf44a9fdec53a3a7ec2ff1a9dae6c51c"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#ad7f620007d3395a0e361495f2034492a">soap_wsse_get_KeyInfo_SecurityTokenReferenceValueType</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a SecurityTokenReference ValueType if present. <a href="#ad7f620007d3395a0e361495f2034492a"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">X509 *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#afeea66260af15add6e581e8dfc18361a">soap_wsse_get_KeyInfo_SecurityTokenReferenceX509</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a X509 certificate if present as a BinarySecurity token. <a href="#afeea66260af15add6e581e8dfc18361a"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a83ad7822556d691020209fa12d1c79a7">soap_wsse_add_KeyInfo_SecurityTokenReferenceKeyIdentifier</a> (struct soap *soap, const char *id, const char *valueType, unsigned char *data, int size)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds KeyInfo element with SecurityTokenReference/KeyIdentifier binary data. <a href="#a83ad7822556d691020209fa12d1c79a7"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#aa828d0c93226ca87c382a831fcdc703c">soap_wsse_get_KeyInfo_SecurityTokenReferenceKeyIdentifierValueType</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns KeyInfo/SecurityTokenReference/KeyIdentifier/ValueType if present. <a href="#aa828d0c93226ca87c382a831fcdc703c"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">const unsigned char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#af7c3fc130e6925df8af8d004c925c008">soap_wsse_get_KeyInfo_SecurityTokenReferenceKeyIdentifier</a> (struct soap *soap, int *size)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns KeyInfo/SecurityTokenReference/KeyIdentifier binary data. <a href="#af7c3fc130e6925df8af8d004c925c008"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a8fcf5947eb011d73b6a6b1308123a536">soap_wsse_add_KeyInfo_SecurityTokenReferenceEmbedded</a> (struct soap *soap, const char *id, const char *valueType)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds KeyInfo element with Embedded SecurityTokenReference. <a href="#a8fcf5947eb011d73b6a6b1308123a536"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#ada212bdc526df8c2e2f3d7e4e7655179">soap_wsse_add_EncryptedKey</a> (struct soap *soap, const char *URI, X509 *cert, const char *subjectkeyid)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds EncryptedKey header element and initiates the encryption of the SOAP Body. <a href="#ada212bdc526df8c2e2f3d7e4e7655179"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#aac8dc04e8092bb3c15d3f35d206e2488">soap_wsse_add_EncryptedKey_encrypt_only</a> (struct soap *soap, const char *URI, X509 *cert, const char *subjectkeyid, const char *tags)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds EncryptedKey header element and initiates encryption of the given XML elements specified in the tags string. Should be used in combination with soap_wsse_set_wsu_id to set wsu:Id for given XML element tags. <a href="#aac8dc04e8092bb3c15d3f35d206e2488"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#afcfdd54e7c220fb90e11c75da3bbbe88">soap_wsse_verify_EncryptedKey</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Verifies the EncryptedKey header information (certificate validity requires soap-&gt;cacert to be set). Retrieves the decryption key from the token handler callback to decrypt the decryption key. <a href="#afcfdd54e7c220fb90e11c75da3bbbe88"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#ad276cfcbd007515a6dce80c646e23ef5">soap_wsse_delete_EncryptedKey</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Deletes EncryptedKey header element. <a href="#ad276cfcbd007515a6dce80c646e23ef5"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="structxenc_____encrypted_key_type.html">xenc__EncryptedKeyType</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a82fe0ee01741a65f835fa0ffaad0a157">soap_wsse_EncryptedKey</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns EncryptedKey header element if present. <a href="#a82fe0ee01741a65f835fa0ffaad0a157"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#aeec61121d56b2cf85e48997376c0b50a">soap_wsse_add_EncryptedKey_DataReferenceURI</a> (struct soap *soap, const char *URI)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds a DataReference URI to the EncryptedKey header element. <a href="#aeec61121d56b2cf85e48997376c0b50a"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#acbd56e9f4e7da00b1db51bca3e4f226b">soap_wsse_add_DataReferenceURI</a> (struct soap *soap, const char *URI)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds a DataReference URI to the WS-Security header element. <a href="#acbd56e9f4e7da00b1db51bca3e4f226b"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#aac4234bd51599c36aec7bf7888191fb0">soap_wsse_sender_fault_subcode</a> (struct soap *soap, const char *faultsubcode, const char *faultstring, const char *faultdetail)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets sender SOAP Fault (sub)code for server fault response. <a href="#aac4234bd51599c36aec7bf7888191fb0"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a5cec82648247163c63a28d624b2b9fe8">soap_wsse_receiver_fault_subcode</a> (struct soap *soap, const char *faultsubcode, const char *faultstring, const char *faultdetail)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets receiver SOAP Fault (sub)code for server fault response. <a href="#a5cec82648247163c63a28d624b2b9fe8"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a0e7d820ea5bf71efb136bb7f0ffbb71f">soap_wsse_sender_fault</a> (struct soap *soap, const char *faultstring, const char *faultdetail)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets sender SOAP Fault for server fault response. <a href="#a0e7d820ea5bf71efb136bb7f0ffbb71f"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a7590c46443ff1c74365091d2d7806829">soap_wsse_receiver_fault</a> (struct soap *soap, const char *faultstring, const char *faultdetail)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets receiver SOAP Fault for server fault response. <a href="#a7590c46443ff1c74365091d2d7806829"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a2d9787c17c1738314cfb3c2fc4aca3ff">soap_wsse_fault</a> (struct soap *soap, <a class="el" href="wsse_8h.html#aaade5f4816d66546a0817dade206f50f">wsse__FaultcodeEnum</a> fault, const char *detail)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets SOAP Fault (sub)code for server response. <a href="#a2d9787c17c1738314cfb3c2fc4aca3ff"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#af15bedb61bffb589683354bc37d20c3a">soap_wsse</a> (struct soap *soap, struct soap_plugin *p, void *arg)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Plugin registry function, used with soap_register_plugin. <a href="#af15bedb61bffb589683354bc37d20c3a"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#adda41aaa5f46c651fb03816cc17d76aa">soap_wsse_init</a> (struct soap *soap, struct <a class="el" href="structsoap__wsse__data.html">soap_wsse_data</a> *data, const void *(*arg)(struct soap *, int alg, const char *keyname, int *keylen))</td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a9582748dda80d0307e253f1a86c0c454">soap_wsse_set_wsu_id</a> (struct soap *soap, const char *tags)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the elements that are to be extended with wsu:Id attributes. The wsu:Id attribute values are set to the string value of the tag's QName by replacing colons with hyphens to produce an xsd:ID value. <a href="#a9582748dda80d0307e253f1a86c0c454"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a16e38c1160a47ad2cb60d1b7d5dba777">soap_wsse_sign_only</a> (struct soap *soap, const char *tags)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Filters only the specified wsu:Id names for signing. Can be used with <a class="el" href="wsseapi_8h.html#a9582748dda80d0307e253f1a86c0c454" title="Sets the elements that are to be extended with wsu:Id attributes. The wsu:Id attribute values are set...">soap_wsse_set_wsu_id()</a> and if so should use the element tag names. <a href="#a16e38c1160a47ad2cb60d1b7d5dba777"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#aa3ac2afb86a25ec1e1d8e4515133e9ad">soap_wsse_sign</a> (struct soap *soap, int alg, const void *key, int keylen)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Uses the wsse plugin to sign all wsu:Id attributed elements. <a href="#aa3ac2afb86a25ec1e1d8e4515133e9ad"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#ab653754f1a287ba06bd808cf89548c38">soap_wsse_sign_body</a> (struct soap *soap, int alg, const void *key, int keylen)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Uses the wsse plugin to sign all wsu:Id attributed elements, including the SOAP Body (by adding a wsu:Id="Body" attribute). <a href="#ab653754f1a287ba06bd808cf89548c38"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a8a246ebd371d9e92c74ec1e29bf92f3a">soap_wsse_verify_init</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Uses the wsse plugin to initiate the verification of the signature and SignedInfo Reference digests. <a href="#a8a246ebd371d9e92c74ec1e29bf92f3a"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a7321b451910e1d3887b328f03de92f34">soap_wsse_verify_auto</a> (struct soap *soap, int alg, const void *key, size_t keylen)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Uses the wsse plugin to initiate the automatic verification of the signature and SignedInfo Reference digests. <a href="#a7321b451910e1d3887b328f03de92f34"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a07db8f284ab2bb564248999fe02d0169">soap_wsse_verify_done</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Terminates the automatic verification of signatures. <a href="#a07db8f284ab2bb564248999fe02d0169"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a3fbe81de521579f026dd1ba8e81c59c1">soap_wsse_verify_element</a> (struct soap *soap, const char *URI, const char *tag)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Post-checks the presence of signed element(s). Does not verify the signature of these elements, which is done with <a class="el" href="wsseapi_8c.html#a7321b451910e1d3887b328f03de92f34">soap_wsse_verify_auto</a>. <a href="#a3fbe81de521579f026dd1ba8e81c59c1"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a5ccbce0f1a4a8f103e921a918f932a20">soap_wsse_verify_body</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Post-checks the presence of signed SOAP Body. Does not verify the signature of the Body, which is done with <a class="el" href="wsseapi_8c.html#a7321b451910e1d3887b328f03de92f34">soap_wsse_verify_auto</a>. <a href="#a5ccbce0f1a4a8f103e921a918f932a20"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#ac12c951db671e4e29810d0f0ae7f1b63">soap_wsse_encrypt_body</a> (struct soap *soap, int alg, const void *key, int keylen)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Initiates the encryption of the SOAP Body. The algorithm should be SOAP_MEC_ENC_DES_CBC for symmetric encryption. Use soap_wsse_add_EncryptedKey for public key encryption. <a href="#ac12c951db671e4e29810d0f0ae7f1b63"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a3c417c369946561cbf72566349041805">soap_wsse_encrypt_only</a> (struct soap *soap, int alg, const void *key, int keylen, const char *tags)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Initiates the encryption of XML elements specified in the tags string. Should be used in combination with soap_wsse_set_wsu_id to set wsu:Id for given XML element tags. The algorithm should be SOAP_MEC_ENC_DES_CBC for symmetric encryption. Use soap_wsse_add_EncryptedKey_encrypt_only for public key encryption. <a href="#a3c417c369946561cbf72566349041805"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#ae783dfb65a01ad8d8e6e7ca1e5b3d805">soap_wsse_encrypt</a> (struct soap *soap, int alg, const void *key, int keylen)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Start encryption. This function is supposed to be used internally only. The algorithm should be SOAP_MEC_ENC_DES_CBC for symmetric encryption. Use soap_wsse_add_EncryptedKey for public key encryption. <a href="#ae783dfb65a01ad8d8e6e7ca1e5b3d805"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a403569990cf3278a361552aecaf51ffc">soap_wsse_decrypt_auto</a> (struct soap *soap, int alg, const void *key, int keylen)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Start automatic decryption when needed using the specified key. This function should be used just once. The algorithm should be SOAP_MEC_ENV_DEC_DES_CBC for public key encryption/decryption and SOAP_MEC_DEC_DES_CBC for symmetric shared secret keys. <a href="#a403569990cf3278a361552aecaf51ffc"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a6cf2cef0b56d9f537f8964d99ad4651a">soap_wsse_encrypt_begin</a> (struct soap *soap, const char *id, const char *URI, const char *keyname, const unsigned char *key)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Emit XML encryption tags and start encryption of the XML element content. <a href="#a6cf2cef0b56d9f537f8964d99ad4651a"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a67d96a5fbfb37797a1223155957111cb">soap_wsse_encrypt_end</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Emit XML encryption end tags and stop encryption of the XML element content. <a href="#a67d96a5fbfb37797a1223155957111cb"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#adc905be8ab736b213c35fa9114eecfd9">soap_wsse_decrypt_begin</a> (struct soap *soap, const unsigned char *key)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Check for XML encryption tags and start decryption of the XML element content. If the KeyInfo element is present, the security_token_handler callback will be used to obtain a decryption key based on the key name. Otherwise the current decryption key will be used. <a href="#adc905be8ab736b213c35fa9114eecfd9"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a1862170fdd18b54ab832347308d23019">soap_wsse_decrypt_end</a> (struct soap *soap)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Check for XML encryption ending tags and stop decryption of the XML element content. <a href="#a1862170fdd18b54ab832347308d23019"></a><br/></td></tr> <tr><td colspan="2"><h2><a name="var-members"></a> Variables</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">const char&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a08c28b1011e1b370838312729cca9c01">soap_wsse_id</a> [14] = SOAP_WSSE_ID</td></tr> <tr><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a38dfc9981f0859b1307c302d8497c08c">wsse_PasswordTextURI</a> = &quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText&quot;</td></tr> <tr><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a000638936fff26e30a3f256c495c1aa8">wsse_PasswordDigestURI</a> = &quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest&quot;</td></tr> <tr><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a7d0ae8f2dd1beaabdaa4884ea5dd41e4">wsse_Base64BinaryURI</a> = &quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary&quot;</td></tr> <tr><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#ac07968b1c372e976758745ba7089c367">wsse_X509v3URI</a> = &quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3&quot;</td></tr> <tr><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a88d310451ae729bbf0fdd149a9d7511c">wsse_X509v3SubjectKeyIdentifierURI</a> = &quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509SubjectKeyIdentifier&quot;</td></tr> <tr><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a71140ac907117b2bbf37f14939166a15">ds_sha1URI</a> = &quot;http://www.w3.org/2000/09/xmldsig#sha1&quot;</td></tr> <tr><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a352a6e78890296ade9e25de397f1096c">ds_hmac_sha1URI</a> = &quot;http://www.w3.org/2000/09/xmldsig#hmac-sha1&quot;</td></tr> <tr><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a1f62c1715e0f49fd54ffc263e45a12eb">ds_dsa_sha1URI</a> = &quot;http://www.w3.org/2000/09/xmldsig#dsa-sha1&quot;</td></tr> <tr><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#ad57129724eb01a743b6583afc522a131">ds_rsa_sha1URI</a> = &quot;http://www.w3.org/2000/09/xmldsig#rsa-sha1&quot;</td></tr> <tr><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a6c5bdcb80c33d0c3d35050091bd2cec5">xenc_rsa15URI</a> = &quot;http://www.w3.org/2001/04/xmlenc#rsa-1_5&quot;</td></tr> <tr><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a159d359ac83617f624b54d467db4e0b1">xenc_3desURI</a> = &quot;http://www.w3.org/2001/04/xmlenc#tripledes-cbc&quot;</td></tr> <tr><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#ad7aea4af6b24389f66019e8984d4b05c">ds_URI</a> = &quot;http://www.w3.org/2000/09/xmldsig#&quot;</td></tr> <tr><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a4089697df0f14ecf44cf0fb6098f4f78">c14n_URI</a> = &quot;http://www.w3.org/2001/10/xml-exc-c14n#&quot;</td></tr> <tr><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#adb66cffe8d95c5d511987189173a993c">wsu_URI</a> = &quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd&quot;</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static struct <a class="el" href="structsoap__wsse__session.html">soap_wsse_session</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a777b5d06409128e7bcb97703b4f40f06">soap_wsse_session</a> = NULL</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static MUTEX_TYPE&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wsseapi_8c.html#a627ba14d70ad7f79d61e2e93485be6ce">soap_wsse_session_lock</a> = MUTEX_INITIALIZER</td></tr> </table> <hr/><h2>Define Documentation</h2> <a class="anchor" id="a12d6f49d99323ae66d2a6ee154f90469"></a><!-- doxytag: member="wsseapi.c::SOAP_WSSE_CLKSKEW" ref="a12d6f49d99323ae66d2a6ee154f90469" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define SOAP_WSSE_CLKSKEW&#160;&#160;&#160;(300)</td> </tr> </table> </div> <div class="memdoc"> <p>Clock skew between machines (in sec) to fit message expiration in window </p> </div> </div> <a class="anchor" id="a5c6f8145831c10a4dbd0465a923908c6"></a><!-- doxytag: member="wsseapi.c::SOAP_WSSE_MAX_REF" ref="a5c6f8145831c10a4dbd0465a923908c6" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define SOAP_WSSE_MAX_REF&#160;&#160;&#160;(100)</td> </tr> </table> </div> <div class="memdoc"> <p>Maximum number of SignedInfo References </p> </div> </div> <a class="anchor" id="a65c55be8ba01ac63f64fddbe0e82b75b"></a><!-- doxytag: member="wsseapi.c::SOAP_WSSE_NONCELEN" ref="a65c55be8ba01ac63f64fddbe0e82b75b" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define SOAP_WSSE_NONCELEN&#160;&#160;&#160;(20)</td> </tr> </table> </div> <div class="memdoc"> <p>Size of the random nonce </p> </div> </div> <a class="anchor" id="a5de15cf324b79588e67e4ccbba2119ae"></a><!-- doxytag: member="wsseapi.c::SOAP_WSSE_NONCETIME" ref="a5de15cf324b79588e67e4ccbba2119ae" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define SOAP_WSSE_NONCETIME&#160;&#160;&#160;(SOAP_WSSE_CLKSKEW + 240)</td> </tr> </table> </div> <div class="memdoc"> <p>Digest authentication accepts messages that are not older than creation time + SOAP_WSSE_NONCETIME </p> </div> </div> <hr/><h2>Function Documentation</h2> <a class="anchor" id="ae341110563279cc6f5cc57c22eaa7a8b"></a><!-- doxytag: member="wsseapi.c::calc_digest" ref="ae341110563279cc6f5cc57c22eaa7a8b" args="(struct soap *soap, const char *created, const char *nonce, int noncelen, const char *password, char hash[SOAP_SMD_SHA1_SIZE])" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static void calc_digest </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>created</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>nonce</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>noncelen</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>password</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">char&#160;</td> <td class="paramname"><em>hash</em>[SOAP_SMD_SHA1_SIZE]&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Calculates digest value SHA1(created, nonce, password) </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">created</td><td>string (XSD dateTime format) </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">nonce</td><td>value </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">noncelen</td><td>length of nonce value </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">password</td><td>string </td></tr> <tr><td class="paramdir">[out]</td><td class="paramname">hash</td><td>SHA1 digest </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a1c4fe3f38985fd0c526a03fdbafc2ad1"></a><!-- doxytag: member="wsseapi.c::calc_nonce" ref="a1c4fe3f38985fd0c526a03fdbafc2ad1" args="(struct soap *soap, char nonce[SOAP_WSSE_NONCELEN])" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static void calc_nonce </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">char&#160;</td> <td class="paramname"><em>nonce</em>[SOAP_WSSE_NONCELEN]&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Calculates randomized nonce (also uses time() in case a poorly seeded PRNG is used) </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[out]</td><td class="paramname">nonce</td><td>value </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="af15bedb61bffb589683354bc37d20c3a"></a><!-- doxytag: member="wsseapi.c::soap_wsse" ref="af15bedb61bffb589683354bc37d20c3a" args="(struct soap *soap, struct soap_plugin *p, void *arg)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">struct soap_plugin *&#160;</td> <td class="paramname"><em>p</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">void *&#160;</td> <td class="paramname"><em>arg</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Plugin registry function, used with soap_register_plugin. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in,out]</td><td class="paramname">p</td><td>plugin created in registry </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">arg</td><td>passed from soap_register_plugin_arg is an optional security token handler callback </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK </dd></dl> </div> </div> <a class="anchor" id="a272ece3d02d7fbb5309cda9d1b252822"></a><!-- doxytag: member="wsseapi.c::soap_wsse_add_BinarySecurityToken" ref="a272ece3d02d7fbb5309cda9d1b252822" args="(struct soap *soap, const char *id, const char *valueType, const unsigned char *data, int size)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_add_BinarySecurityToken </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>id</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>valueType</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const unsigned char *&#160;</td> <td class="paramname"><em>data</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>size</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Adds BinarySecurityToken element. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">id</td><td>string for signature referencing or NULL </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">valueType</td><td>string </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">data</td><td>points to binary token data </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">size</td><td>is length of binary token </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK </dd></dl> </div> </div> <a class="anchor" id="ad88d8317bcbbcda4cdc8d1bcfb2e0f18"></a><!-- doxytag: member="wsseapi.c::soap_wsse_add_BinarySecurityTokenPEM" ref="ad88d8317bcbbcda4cdc8d1bcfb2e0f18" args="(struct soap *soap, const char *id, const char *filename)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_add_BinarySecurityTokenPEM </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>id</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>filename</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Adds BinarySecurityToken element from a PEM file. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">id</td><td>string for signature reference </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">filename</td><td></td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK or SOAP_FAULT with wsse__InvalidSecurity fault when file cannot be read or does not contain a valid certificate</dd></dl> <p>This function uses PEM_read_X509 from the the OpenSSL library to read a certificate from a PEM formatted file. </p> </div> </div> <a class="anchor" id="a53075fb3cec4ec4e70fb11850fecb401"></a><!-- doxytag: member="wsseapi.c::soap_wsse_add_BinarySecurityTokenX509" ref="a53075fb3cec4ec4e70fb11850fecb401" args="(struct soap *soap, const char *id, X509 *cert)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_add_BinarySecurityTokenX509 </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>id</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">X509 *&#160;</td> <td class="paramname"><em>cert</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Adds BinarySecurityToken element with X509 certificate. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">id</td><td>string for signature reference </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">cert</td><td>points to the X509 certificate </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK or SOAP_EOM</dd></dl> <p>This function uses i2d_X509 from the the OpenSSL library to convert an X509 object to binary DER format. </p> </div> </div> <a class="anchor" id="acbd56e9f4e7da00b1db51bca3e4f226b"></a><!-- doxytag: member="wsseapi.c::soap_wsse_add_DataReferenceURI" ref="acbd56e9f4e7da00b1db51bca3e4f226b" args="(struct soap *soap, const char *URI)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_add_DataReferenceURI </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>URI</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Adds a DataReference URI to the WS-Security header element. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">URI</td><td>value of the URI ID </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK or error code </dd></dl> </div> </div> <a class="anchor" id="ada212bdc526df8c2e2f3d7e4e7655179"></a><!-- doxytag: member="wsseapi.c::soap_wsse_add_EncryptedKey" ref="ada212bdc526df8c2e2f3d7e4e7655179" args="(struct soap *soap, const char *URI, X509 *cert, const char *subjectkeyid)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_add_EncryptedKey </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>URI</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">X509 *&#160;</td> <td class="paramname"><em>cert</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>subjectkeyid</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Adds EncryptedKey header element and initiates the encryption of the SOAP Body. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">URI</td><td>a unique identifier for the key, required for interoperability </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">cert</td><td>the X509 certificate with public key or NULL </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">subjectkeyid</td><td>string identification of the subject which when set to non-NULL is used instead of embedding the public key in the message </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd><a class="el" href="structxenc_____encrypted_key_type.html" title="&quot;http://www.w3.org/2001/04/xmlenc#&quot;:EncryptedKeyType is a complexType with complexContent extension o...">xenc__EncryptedKeyType</a> object</dd></dl> <p>This function adds the encrypted key or subject key ID to the WS-Security header and initiates encryption of the SOAP Body. An X509 certificate must be provided. The certificate is embedded in the WS-Security EncryptedKey header. If the subjectkeyid string is non-NULL the subject key ID is used in the EncryptedKey header instead of the X509 certificate content. </p> </div> </div> <a class="anchor" id="aeec61121d56b2cf85e48997376c0b50a"></a><!-- doxytag: member="wsseapi.c::soap_wsse_add_EncryptedKey_DataReferenceURI" ref="aeec61121d56b2cf85e48997376c0b50a" args="(struct soap *soap, const char *URI)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_add_EncryptedKey_DataReferenceURI </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>URI</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Adds a DataReference URI to the EncryptedKey header element. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">URI</td><td>value of the URI ID </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK or error code </dd></dl> </div> </div> <a class="anchor" id="aac8dc04e8092bb3c15d3f35d206e2488"></a><!-- doxytag: member="wsseapi.c::soap_wsse_add_EncryptedKey_encrypt_only" ref="aac8dc04e8092bb3c15d3f35d206e2488" args="(struct soap *soap, const char *URI, X509 *cert, const char *subjectkeyid, const char *tags)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_add_EncryptedKey_encrypt_only </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>URI</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">X509 *&#160;</td> <td class="paramname"><em>cert</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>subjectkeyid</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>tags</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Adds EncryptedKey header element and initiates encryption of the given XML elements specified in the tags string. Should be used in combination with soap_wsse_set_wsu_id to set wsu:Id for given XML element tags. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">URI</td><td>a unique identifier for the key, required for interoperability </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">cert</td><td>the X509 certificate with public key or NULL </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">subjectkeyid</td><td>string identification of the subject which when set to non-NULL is used instead of embedding the public key in the message </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">tags</td><td>space-separated string of element tag names to encrypt </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd><a class="el" href="structxenc_____encrypted_key_type.html" title="&quot;http://www.w3.org/2001/04/xmlenc#&quot;:EncryptedKeyType is a complexType with complexContent extension o...">xenc__EncryptedKeyType</a> object</dd></dl> <p>This function adds the encrypted key or subject key ID to the WS-Security header and initiates encryption of the elements given by the string of tag names. An X509 certificate must be provided. The certificate is embedded in the WS-Security EncryptedKey header. If the subjectkeyid string is non-NULL the subject key ID is used in the EncryptedKey header instead of the X509 certificate content.</p> <p>WARNING: Use <a class="el" href="wsseapi_8c.html#aac8dc04e8092bb3c15d3f35d206e2488">soap_wsse_add_EncryptedKey_encrypt_only</a> only in combination with <a class="el" href="wsseapi_8c.html#a9582748dda80d0307e253f1a86c0c454">soap_wsse_set_wsu_id</a> with the tag names of the elements to be encrypted. OTHERWISE THE GIVEN XML ELEMENTS ARE NOT ENCRYPTED AND WILL BE SENT IN THE CLEAR.</p> <p>WARNING: The elements identified with <a class="el" href="wsseapi_8c.html#a9582748dda80d0307e253f1a86c0c454">soap_wsse_set_wsu_id</a> to encrypt MUST occur EXACTLY ONCE in the SOAP Body.</p> <p>WARNING: Encryption/decryption of elements with simple content (CDATA content) IS NOT SUPPORTED. This means that elements you want to encrypt with this function must have complex content. That is, only encrypt elements with sub elements or encrypt the entire SOAP Body. </p> </div> </div> <a class="anchor" id="ac80606801677bc109bcef606655f6e23"></a><!-- doxytag: member="wsseapi.c::soap_wsse_add_KeyInfo" ref="ac80606801677bc109bcef606655f6e23" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">struct <a class="el" href="structds_____key_info_type.html">ds__KeyInfoType</a>* soap_wsse_add_KeyInfo </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td><code> [read]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Adds KeyInfo element. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>ds__KeyInfo object </dd></dl> </div> </div> <a class="anchor" id="a25240140007f1776479e81dd43457f40"></a><!-- doxytag: member="wsseapi.c::soap_wsse_add_KeyInfo_KeyName" ref="a25240140007f1776479e81dd43457f40" args="(struct soap *soap, const char *name)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_add_KeyInfo_KeyName </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>name</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Adds KeyName element. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">name</td><td>string of the KeyName </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK</dd></dl> <p>Note: the recommended method to add Key information is to utilize KeyIdentifier instead of KeyName. A KeyName is useful mainly for internal use. </p> </div> </div> <a class="anchor" id="a8fcf5947eb011d73b6a6b1308123a536"></a><!-- doxytag: member="wsseapi.c::soap_wsse_add_KeyInfo_SecurityTokenReferenceEmbedded" ref="a8fcf5947eb011d73b6a6b1308123a536" args="(struct soap *soap, const char *id, const char *valueType)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_add_KeyInfo_SecurityTokenReferenceEmbedded </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>id</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>valueType</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Adds KeyInfo element with Embedded SecurityTokenReference. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">id</td><td>string for signature reference </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">valueType</td><td>string </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK</dd></dl> <p>Note: this function does not add embedded tokens automatically. See code for comments. </p> </div> </div> <a class="anchor" id="a83ad7822556d691020209fa12d1c79a7"></a><!-- doxytag: member="wsseapi.c::soap_wsse_add_KeyInfo_SecurityTokenReferenceKeyIdentifier" ref="a83ad7822556d691020209fa12d1c79a7" args="(struct soap *soap, const char *id, const char *valueType, unsigned char *data, int size)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_add_KeyInfo_SecurityTokenReferenceKeyIdentifier </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>id</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>valueType</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>data</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>size</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Adds KeyInfo element with SecurityTokenReference/KeyIdentifier binary data. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">id</td><td>string for signature reference </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">valueType</td><td>string </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">data</td><td>binary data </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">size</td><td>of binary data </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK </dd></dl> </div> </div> <a class="anchor" id="aa1557c59801a0c3e4a77c1cb56cc2d9e"></a><!-- doxytag: member="wsseapi.c::soap_wsse_add_KeyInfo_SecurityTokenReferenceURI" ref="aa1557c59801a0c3e4a77c1cb56cc2d9e" args="(struct soap *soap, const char *URI, const char *valueType)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_add_KeyInfo_SecurityTokenReferenceURI </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>URI</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>valueType</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Adds KeyInfo element with SecurityTokenReference URI. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">URI</td><td>string referencing a security token </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">valueType</td><td>string or NULL </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK </dd></dl> </div> </div> <a class="anchor" id="a72df80abd1d36cea516feda3a84672cf"></a><!-- doxytag: member="wsseapi.c::soap_wsse_add_KeyInfo_SecurityTokenReferenceX509" ref="a72df80abd1d36cea516feda3a84672cf" args="(struct soap *soap, const char *URI)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_add_KeyInfo_SecurityTokenReferenceX509 </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>URI</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Adds KeyInfo element with SecurityTokenReference URI to an X509 cert. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">URI</td><td>string referencing an X509 certificate </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK </dd></dl> </div> </div> <a class="anchor" id="a6f167767a1a7763be6dc2b8eff75e419"></a><!-- doxytag: member="wsseapi.c::soap_wsse_add_Security" ref="a6f167767a1a7763be6dc2b8eff75e419" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">struct <a class="el" href="struct__wsse_____security.html">_wsse__Security</a>* soap_wsse_add_Security </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td><code> [read]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Adds Security header element. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd><a class="el" href="struct__wsse_____security.html" title="This element defines the wsse:Security SOAP header element per Section 4. Imported element _wsse__Sec...">_wsse__Security</a> object </dd></dl> </div> </div> <a class="anchor" id="aba5822fee3cafde84e4bcae41a37fc69"></a><!-- doxytag: member="wsseapi.c::soap_wsse_add_Security_actor" ref="aba5822fee3cafde84e4bcae41a37fc69" args="(struct soap *soap, const char *actor)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">struct <a class="el" href="struct__wsse_____security.html">_wsse__Security</a>* soap_wsse_add_Security_actor </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>actor</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [read]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Adds Security header element with actor or role attribute. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramname">actor</td><td>string </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd><a class="el" href="struct__wsse_____security.html" title="This element defines the wsse:Security SOAP header element per Section 4. Imported element _wsse__Sec...">_wsse__Security</a> object </dd></dl> </div> </div> <a class="anchor" id="a07b4f0c2995df0a695a6f06e2519151f"></a><!-- doxytag: member="wsseapi.c::soap_wsse_add_Signature" ref="a07b4f0c2995df0a695a6f06e2519151f" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">struct <a class="el" href="structds_____signature_type.html">ds__SignatureType</a>* soap_wsse_add_Signature </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td><code> [read]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Adds Signature header element. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd><a class="el" href="structds_____signature_type.html" title="Imported complexType &quot;http://www.w3.org/2000/09/xmldsig#&quot;:SignatureType from typemap WS/WS-typemap...">ds__SignatureType</a> object </dd></dl> </div> </div> <a class="anchor" id="a7399c40e0019bc1ae797fccf92f81fc7"></a><!-- doxytag: member="wsseapi.c::soap_wsse_add_SignatureValue" ref="a7399c40e0019bc1ae797fccf92f81fc7" args="(struct soap *soap, int alg, const void *key, int keylen)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_add_SignatureValue </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>alg</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const void *&#160;</td> <td class="paramname"><em>key</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>keylen</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Adds SignedInfo/SignatureMethod element, signs the SignedInfo element, and adds the resulting SignatureValue element. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">alg</td><td>is SOAP_SMD_HMAC_SHA1, SOAP_SMD_SIGN_DSA_SHA1, or SOAP_SMD_SIGN_RSA_SHA1 </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">key</td><td>to use to sign (HMAC or EVP_PKEY) </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">keylen</td><td>length of HMAC key </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK, SOAP_EOM, or fault</dd></dl> <p>To sign the SignedInfo element with this function, populate SignedInfo with Reference elements first using soap_wsse_add_SignedInfo_Reference. The SignedInfo element must not be modified after signing.</p> <p>The SOAP_XML_INDENT and SOAP_XML_CANONICAL flags are used to serialize the SignedInfo to compute the signature. </p> </div> </div> <a class="anchor" id="ab4a10d08044dd66da337f684385ed2cf"></a><!-- doxytag: member="wsseapi.c::soap_wsse_add_SignedInfo" ref="ab4a10d08044dd66da337f684385ed2cf" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">struct <a class="el" href="structds_____signed_info_type.html">ds__SignedInfoType</a>* soap_wsse_add_SignedInfo </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td><code> [read]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Adds SignedInfo element. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd><a class="el" href="structds_____signed_info_type.html" title="&quot;http://www.w3.org/2000/09/xmldsig#&quot;:SignedInfoType is a complexType.">ds__SignedInfoType</a> object </dd></dl> </div> </div> <a class="anchor" id="afc50e18a5777eb58f1aed0833a02d477"></a><!-- doxytag: member="wsseapi.c::soap_wsse_add_SignedInfo_Reference" ref="afc50e18a5777eb58f1aed0833a02d477" args="(struct soap *soap, const char *URI, const char *transform, const char *inclusiveNamespaces, const char *HA)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_add_SignedInfo_Reference </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>URI</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>transform</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>inclusiveNamespaces</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>HA</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Adds SignedInfo element with Reference URI, transform algorithm used, and digest value. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">URI</td><td>reference </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">transform</td><td>string should be c14n_URI for exc-c14n or NULL </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">inclusiveNamespaces</td><td>used by the exc-c14n transform or NULL </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">HA</td><td>is the SHA1 digest in binary form (length=SOAP_SMD_SHA1_SIZE) </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK or SOAP_EOM when references exceed SOAP_WSSE_MAX_REF</dd></dl> <p>This function can be called to add more references to the wsse:SignedInfo element. A maximum number of SOAP_WSSE_MAX_REF references can be added. The digest method is always SHA1. Note: XPath transforms cannot be specified in this release. </p> </div> </div> <a class="anchor" id="a398f98d62dfba91d04cff19230fb6722"></a><!-- doxytag: member="wsseapi.c::soap_wsse_add_SignedInfo_SignatureMethod" ref="a398f98d62dfba91d04cff19230fb6722" args="(struct soap *soap, const char *method, int canonical)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_add_SignedInfo_SignatureMethod </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>method</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>canonical</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Adds SignedInfo element with SignatureMethod. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">method</td><td>is the URI of the signature algorithm (e.g. ds_rsa_sha1) </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">canonical</td><td>flag indicating that SignedInfo is signed in exc-c14n form </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK</dd></dl> <p>Note: the c14n:InclusiveNamespaces/PrefixList is set to "SOAP-ENV wsse". </p> </div> </div> <a class="anchor" id="a71fe27aee76db1d0a635afe106d8b109"></a><!-- doxytag: member="wsseapi.c::soap_wsse_add_Timestamp" ref="a71fe27aee76db1d0a635afe106d8b109" args="(struct soap *soap, const char *id, time_t lifetime)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_add_Timestamp </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>id</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">time_t&#160;</td> <td class="paramname"><em>lifetime</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Adds Timestamp element with optional expiration date+time (lifetime). </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir">[in]</td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">id</td><td>for signature referencing or NULL </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">lifetime</td><td>expressed in time_t units, or 0 for no expiration </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK </dd></dl> </div> </div> <a class="anchor" id="ac9fe59008bdf12d7a007ac48e6ebb613"></a><!-- doxytag: member="wsseapi.c::soap_wsse_add_UsernameTokenDigest" ref="ac9fe59008bdf12d7a007ac48e6ebb613" args="(struct soap *soap, const char *id, const char *username, const char *password)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_add_UsernameTokenDigest </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>id</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>username</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>password</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Adds UsernameToken element for digest authentication. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">id</td><td>string for signature referencing or NULL </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">username</td><td>string </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">password</td><td>string </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK</dd></dl> <p>Computes SHA1 digest of the time stamp, a nonce, and the password. The digest provides the authentication credentials. Passwords are NOT sent in the clear. Note: this release supports the use of at most one UsernameToken in the header. </p> </div> </div> <a class="anchor" id="a37f32e51bceabf2e2823516a1737548f"></a><!-- doxytag: member="wsseapi.c::soap_wsse_add_UsernameTokenText" ref="a37f32e51bceabf2e2823516a1737548f" args="(struct soap *soap, const char *id, const char *username, const char *password)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_add_UsernameTokenText </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>id</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>username</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>password</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Adds UsernameToken element with optional clear-text password. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">id</td><td>string for signature referencing or NULL </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">username</td><td>string </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">password</td><td>string or NULL to omit the password </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK</dd></dl> <p>Passwords are sent in the clear, so transport-level encryption is required. Note: this release supports the use of at most one UsernameToken in the header. </p> </div> </div> <a class="anchor" id="ab0d5552252e672a0ea24af9b6595bd2c"></a><!-- doxytag: member="wsseapi.c::soap_wsse_BinarySecurityToken" ref="ab0d5552252e672a0ea24af9b6595bd2c" args="(struct soap *soap, const char *id)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">struct <a class="el" href="struct__wsse_____binary_security_token.html">_wsse__BinarySecurityToken</a>* soap_wsse_BinarySecurityToken </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>id</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [read]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns BinarySecurityToken element if present. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">id</td><td>string of token to get or NULL </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd><a class="el" href="struct__wsse_____binary_security_token.html" title="This element defines the wsse:BinarySecurityToken element per Section 4.2. Imported element _wsse__Bi...">_wsse__BinarySecurityToken</a> object or NULL </dd></dl> </div> </div> <a class="anchor" id="a491ec857faca76dce6ff59218e58626c"></a><!-- doxytag: member="wsseapi.c::soap_wsse_copy" ref="a491ec857faca76dce6ff59218e58626c" args="(struct soap *soap, struct soap_plugin *dst, struct soap_plugin *src)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static int soap_wsse_copy </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">struct soap_plugin *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">struct soap_plugin *&#160;</td> <td class="paramname"><em>src</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Copies plugin data to localize plugin data for threads. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[out]</td><td class="paramname">dst</td><td>target plugin </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">src</td><td>source plugin </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK </dd></dl> </div> </div> <a class="anchor" id="a403569990cf3278a361552aecaf51ffc"></a><!-- doxytag: member="wsseapi.c::soap_wsse_decrypt_auto" ref="a403569990cf3278a361552aecaf51ffc" args="(struct soap *soap, int alg, const void *key, int keylen)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_decrypt_auto </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>alg</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const void *&#160;</td> <td class="paramname"><em>key</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>keylen</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Start automatic decryption when needed using the specified key. This function should be used just once. The algorithm should be SOAP_MEC_ENV_DEC_DES_CBC for public key encryption/decryption and SOAP_MEC_DEC_DES_CBC for symmetric shared secret keys. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">alg</td><td>the decryption algorithm, </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">key</td><td>the decryption key for the algorithm, a private RSA key or a shared secret key </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">keylen</td><td>use 0 for public-key encryption/decryption or the shared secret decryption key length, 20 bytes for a DES CBC 160-bit key </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK or error code</dd></dl> <p>This function can be called once before multiple messages are received with WS-Security encrypted content, where only one key is used for encryption (public key or shared secret key). The default decryption key is set. If multiple decryption keys should be used, do NOT use this function but set the security_token_handler callback of the wsse plugin. See <a class="el" href="wsse.html#wsse_9_2">Decrypting Message Parts</a>. Use a NULL key to remove the default decryption key. </p> </div> </div> <a class="anchor" id="adc905be8ab736b213c35fa9114eecfd9"></a><!-- doxytag: member="wsseapi.c::soap_wsse_decrypt_begin" ref="adc905be8ab736b213c35fa9114eecfd9" args="(struct soap *soap, const unsigned char *key)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_decrypt_begin </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const unsigned char *&#160;</td> <td class="paramname"><em>key</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Check for XML encryption tags and start decryption of the XML element content. If the KeyInfo element is present, the security_token_handler callback will be used to obtain a decryption key based on the key name. Otherwise the current decryption key will be used. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">key</td><td>optional triple DES key for decryption (to override the current key) </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK or error code </dd></dl> </div> </div> <a class="anchor" id="a1862170fdd18b54ab832347308d23019"></a><!-- doxytag: member="wsseapi.c::soap_wsse_decrypt_end" ref="a1862170fdd18b54ab832347308d23019" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_decrypt_end </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Check for XML encryption ending tags and stop decryption of the XML element content. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK or error code </dd></dl> </div> </div> <a class="anchor" id="a67455a9af65734dc71fa3e3bf66a6738"></a><!-- doxytag: member="wsseapi.c::soap_wsse_delete" ref="a67455a9af65734dc71fa3e3bf66a6738" args="(struct soap *soap, struct soap_plugin *p)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static void soap_wsse_delete </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">struct soap_plugin *&#160;</td> <td class="paramname"><em>p</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Deletes plugin data. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in,out]</td><td class="paramname">p</td><td>plugin </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK </dd></dl> </div> </div> <a class="anchor" id="ad276cfcbd007515a6dce80c646e23ef5"></a><!-- doxytag: member="wsseapi.c::soap_wsse_delete_EncryptedKey" ref="ad276cfcbd007515a6dce80c646e23ef5" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void soap_wsse_delete_EncryptedKey </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Deletes EncryptedKey header element. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="ac06c7021592b2aaca50f73e0de9dec7c"></a><!-- doxytag: member="wsseapi.c::soap_wsse_delete_Security" ref="ac06c7021592b2aaca50f73e0de9dec7c" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void soap_wsse_delete_Security </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Deletes Security header element. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="ad817f20012b39724f7351909b0b79df2"></a><!-- doxytag: member="wsseapi.c::soap_wsse_delete_Signature" ref="ad817f20012b39724f7351909b0b79df2" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void soap_wsse_delete_Signature </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Deletes Signature header element. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a903b3f58fd8b9699751c703793f06435"></a><!-- doxytag: member="wsseapi.c::soap_wsse_element_begin_in" ref="a903b3f58fd8b9699751c703793f06435" args="(struct soap *soap, const char *tag)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static int soap_wsse_element_begin_in </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>tag</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>This callback is invoked as soon as a starting tag of an element is received by the XML parser. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">tag</td><td>name of the element parsed </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK or error code </dd></dl> </div> </div> <a class="anchor" id="ad7924c5bd34781df563ed2339eab59f3"></a><!-- doxytag: member="wsseapi.c::soap_wsse_element_begin_out" ref="ad7924c5bd34781df563ed2339eab59f3" args="(struct soap *soap, const char *tag)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static int soap_wsse_element_begin_out </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>tag</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>This callback is invoked as soon as a starting tag of an element is to be sent by the XML generator. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">tag</td><td>name of the element </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK or error code </dd></dl> </div> </div> <a class="anchor" id="ae095227834179806af2ea7dc90bd961e"></a><!-- doxytag: member="wsseapi.c::soap_wsse_element_end_in" ref="ae095227834179806af2ea7dc90bd961e" args="(struct soap *soap, const char *tag1, const char *tag2)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static int soap_wsse_element_end_in </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>tag1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>tag2</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>This callback is invoked as soon as an ending tag of an element is received by the XML parser. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">tag1</td><td>name of the element parsed </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">tag2</td><td>name of the element that was expected by the parser's state, or NULL </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK or error code </dd></dl> </div> </div> <a class="anchor" id="a04ac9993d22e7b868135f9b7ebcca8e0"></a><!-- doxytag: member="wsseapi.c::soap_wsse_element_end_out" ref="a04ac9993d22e7b868135f9b7ebcca8e0" args="(struct soap *soap, const char *tag)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static int soap_wsse_element_end_out </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>tag</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>This callback is invoked as soon as an ending tag of an element is to be sent by the XML generator. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">tag</td><td>name of the element </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK or error code </dd></dl> </div> </div> <a class="anchor" id="ae783dfb65a01ad8d8e6e7ca1e5b3d805"></a><!-- doxytag: member="wsseapi.c::soap_wsse_encrypt" ref="ae783dfb65a01ad8d8e6e7ca1e5b3d805" args="(struct soap *soap, int alg, const void *key, int keylen)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_encrypt </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>alg</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const void *&#160;</td> <td class="paramname"><em>key</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>keylen</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Start encryption. This function is supposed to be used internally only. The algorithm should be SOAP_MEC_ENC_DES_CBC for symmetric encryption. Use soap_wsse_add_EncryptedKey for public key encryption. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">alg</td><td>the encryption algorithm, should be SOAP_MEC_ENC_DES_CBC </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">key</td><td>the encryption key, a DES CBC 160-bit key </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">keylen</td><td>the encryption key length, 20 bytes for a DES CBC 160-bit key </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK or error code </dd></dl> </div> </div> <a class="anchor" id="a6cf2cef0b56d9f537f8964d99ad4651a"></a><!-- doxytag: member="wsseapi.c::soap_wsse_encrypt_begin" ref="a6cf2cef0b56d9f537f8964d99ad4651a" args="(struct soap *soap, const char *id, const char *URI, const char *keyname, const unsigned char *key)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_encrypt_begin </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>id</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>URI</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>keyname</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const unsigned char *&#160;</td> <td class="paramname"><em>key</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Emit XML encryption tags and start encryption of the XML element content. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">id</td><td>string for the EncryptedData element Id attribute </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">URI</td><td>string for the encrypted element wsu:Id attribute </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">keyname</td><td>optional subject key name </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">key</td><td>optional triple DES key for encryption (to override the current key) </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK or error code </dd></dl> </div> </div> <a class="anchor" id="ac12c951db671e4e29810d0f0ae7f1b63"></a><!-- doxytag: member="wsseapi.c::soap_wsse_encrypt_body" ref="ac12c951db671e4e29810d0f0ae7f1b63" args="(struct soap *soap, int alg, const void *key, int keylen)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_encrypt_body </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>alg</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const void *&#160;</td> <td class="paramname"><em>key</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>keylen</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Initiates the encryption of the SOAP Body. The algorithm should be SOAP_MEC_ENC_DES_CBC for symmetric encryption. Use soap_wsse_add_EncryptedKey for public key encryption. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">alg</td><td>the encryption algorithm, should be SOAP_MEC_ENC_DES_CBC </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">key</td><td>the encryption key, a DES CBC 160-bit key </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">keylen</td><td>the encryption key length, 20 bytes for a DES CBC 160-bit key </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK or error code</dd></dl> <p>This function initiates the encryption of the SOAP Body using an RSA public key or a symmetric shared secret key. No WS-Security EncryptedKey header will be set. Use soap_wsse_add_EncryptedKey instead for public key encryption. </p> </div> </div> <a class="anchor" id="a67d96a5fbfb37797a1223155957111cb"></a><!-- doxytag: member="wsseapi.c::soap_wsse_encrypt_end" ref="a67d96a5fbfb37797a1223155957111cb" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_encrypt_end </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Emit XML encryption end tags and stop encryption of the XML element content. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK or error code </dd></dl> </div> </div> <a class="anchor" id="a3c417c369946561cbf72566349041805"></a><!-- doxytag: member="wsseapi.c::soap_wsse_encrypt_only" ref="a3c417c369946561cbf72566349041805" args="(struct soap *soap, int alg, const void *key, int keylen, const char *tags)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_encrypt_only </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>alg</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const void *&#160;</td> <td class="paramname"><em>key</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>keylen</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>tags</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Initiates the encryption of XML elements specified in the tags string. Should be used in combination with soap_wsse_set_wsu_id to set wsu:Id for given XML element tags. The algorithm should be SOAP_MEC_ENC_DES_CBC for symmetric encryption. Use soap_wsse_add_EncryptedKey_encrypt_only for public key encryption. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">alg</td><td>the encryption algorithm, should be SOAP_MEC_ENC_DES_CBC </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">key</td><td>the encryption key, a DES CBC 160-bit key </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">keylen</td><td>the encryption key length, 20 bytes for a DES CBC 160-bit key </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">tags</td><td>string of space-separated qualified and unqualified tag names </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK or error code</dd></dl> <p>This function initiates the encryption using an RSA public key or a symmetric shared secret key. No WS-Security EncryptedKey header will be set. Use soap_wsse_add_EncryptedKey instead for public key encryption.</p> <p>WARNING: Use <a class="el" href="wsseapi_8c.html#aac8dc04e8092bb3c15d3f35d206e2488">soap_wsse_add_EncryptedKey_encrypt_only</a> only in combination with <a class="el" href="wsseapi_8c.html#a9582748dda80d0307e253f1a86c0c454">soap_wsse_set_wsu_id</a> with the tag names of the elements to be encrypted. OTHERWISE THE GIVEN XML ELEMENTS ARE NOT ENCRYPTED AND WILL BE SENT IN THE CLEAR.</p> <p>WARNING: The elements identified with <a class="el" href="wsseapi_8c.html#a9582748dda80d0307e253f1a86c0c454">soap_wsse_set_wsu_id</a> to encrypt MUST occur EXACTLY ONCE in the SOAP Body.</p> <p>WARNING: Encryption/decryption of elements with simple content (CDATA content) IS NOT SUPPORTED. This means that elements you want to encrypt with this function must have complex content. That is, only encrypt elements with sub elements or encrypt the entire SOAP Body. </p> </div> </div> <a class="anchor" id="a82fe0ee01741a65f835fa0ffaad0a157"></a><!-- doxytag: member="wsseapi.c::soap_wsse_EncryptedKey" ref="a82fe0ee01741a65f835fa0ffaad0a157" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">struct <a class="el" href="structxenc_____encrypted_key_type.html">xenc__EncryptedKeyType</a>* soap_wsse_EncryptedKey </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td><code> [read]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns EncryptedKey header element if present. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd><a class="el" href="structxenc_____encrypted_key_type.html" title="&quot;http://www.w3.org/2001/04/xmlenc#&quot;:EncryptedKeyType is a complexType with complexContent extension o...">xenc__EncryptedKeyType</a> object or NULL </dd></dl> </div> </div> <a class="anchor" id="a2d9787c17c1738314cfb3c2fc4aca3ff"></a><!-- doxytag: member="wsseapi.c::soap_wsse_fault" ref="a2d9787c17c1738314cfb3c2fc4aca3ff" args="(struct soap *soap, wsse__FaultcodeEnum fault, const char *detail)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_fault </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="wsse_8h.html#aaade5f4816d66546a0817dade206f50f">wsse__FaultcodeEnum</a>&#160;</td> <td class="paramname"><em>fault</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>detail</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Sets SOAP Fault (sub)code for server response. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">fault</td><td>is one of wsse:FaultcodeEnum </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">detail</td><td>string with optional text message </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_FAULT </dd></dl> </div> </div> <a class="anchor" id="a7496da1dd76aa06e6657365b5c7dd76d"></a><!-- doxytag: member="wsseapi.c::soap_wsse_get_BinarySecurityToken" ref="a7496da1dd76aa06e6657365b5c7dd76d" args="(struct soap *soap, const char *id, char **valueType, unsigned char **data, int *size)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_get_BinarySecurityToken </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>id</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">char **&#160;</td> <td class="paramname"><em>valueType</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char **&#160;</td> <td class="paramname"><em>data</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int *&#160;</td> <td class="paramname"><em>size</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Get wsse:BinarySecurityToken element token data in binary form. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">id</td><td>string of token to get or NULL </td></tr> <tr><td class="paramdir">[out]</td><td class="paramname">valueType</td><td>string </td></tr> <tr><td class="paramdir">[out]</td><td class="paramname">data</td><td>points to binary token data </td></tr> <tr><td class="paramdir">[out]</td><td class="paramname">size</td><td>is length of binary token </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK or SOAP_FAULT with wsse:SecurityTokenUnavailable fault </dd></dl> </div> </div> <a class="anchor" id="af88b4ff21d348c6b256b72b600514e14"></a><!-- doxytag: member="wsseapi.c::soap_wsse_get_BinarySecurityTokenX509" ref="af88b4ff21d348c6b256b72b600514e14" args="(struct soap *soap, const char *id)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">X509* soap_wsse_get_BinarySecurityTokenX509 </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>id</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Get X509 wsse:BinarySecurityToken certificate and verify its content. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">id</td><td>string of token to get or NULL </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>X509 certificate (dynamically allocated) or NULL with wsse:SecurityTokenUnavailable fault </dd></dl> </div> </div> <a class="anchor" id="aeb7b82c21d0022bd1ac08c843cefe75f"></a><!-- doxytag: member="wsseapi.c::soap_wsse_get_KeyInfo_KeyName" ref="aeb7b82c21d0022bd1ac08c843cefe75f" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const char* soap_wsse_get_KeyInfo_KeyName </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Returns KeyName element if present. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>string or NULL </dd></dl> </div> </div> <a class="anchor" id="af7c3fc130e6925df8af8d004c925c008"></a><!-- doxytag: member="wsseapi.c::soap_wsse_get_KeyInfo_SecurityTokenReferenceKeyIdentifier" ref="af7c3fc130e6925df8af8d004c925c008" args="(struct soap *soap, int *size)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const unsigned char* soap_wsse_get_KeyInfo_SecurityTokenReferenceKeyIdentifier </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int *&#160;</td> <td class="paramname"><em>size</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Returns KeyInfo/SecurityTokenReference/KeyIdentifier binary data. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[out]</td><td class="paramname">size</td><td>is set to the size of the decoded data </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>data or NULL </dd></dl> </div> </div> <a class="anchor" id="aa828d0c93226ca87c382a831fcdc703c"></a><!-- doxytag: member="wsseapi.c::soap_wsse_get_KeyInfo_SecurityTokenReferenceKeyIdentifierValueType" ref="aa828d0c93226ca87c382a831fcdc703c" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const char* soap_wsse_get_KeyInfo_SecurityTokenReferenceKeyIdentifierValueType </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Returns KeyInfo/SecurityTokenReference/KeyIdentifier/ValueType if present. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>string or NULL </dd></dl> </div> </div> <a class="anchor" id="aaf44a9fdec53a3a7ec2ff1a9dae6c51c"></a><!-- doxytag: member="wsseapi.c::soap_wsse_get_KeyInfo_SecurityTokenReferenceURI" ref="aaf44a9fdec53a3a7ec2ff1a9dae6c51c" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const char* soap_wsse_get_KeyInfo_SecurityTokenReferenceURI </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Returns a SecurityTokenReference URI if present. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>string or NULL </dd></dl> </div> </div> <a class="anchor" id="ad7f620007d3395a0e361495f2034492a"></a><!-- doxytag: member="wsseapi.c::soap_wsse_get_KeyInfo_SecurityTokenReferenceValueType" ref="ad7f620007d3395a0e361495f2034492a" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const char* soap_wsse_get_KeyInfo_SecurityTokenReferenceValueType </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Returns a SecurityTokenReference ValueType if present. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>string or NULL </dd></dl> </div> </div> <a class="anchor" id="afeea66260af15add6e581e8dfc18361a"></a><!-- doxytag: member="wsseapi.c::soap_wsse_get_KeyInfo_SecurityTokenReferenceX509" ref="afeea66260af15add6e581e8dfc18361a" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">X509* soap_wsse_get_KeyInfo_SecurityTokenReferenceX509 </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Returns a X509 certificate if present as a BinarySecurity token. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>X509 object or NULL with wsse:SecurityTokenUnavailable fault </dd></dl> </div> </div> <a class="anchor" id="afd4c4268cc8f9d667cc44586fb635b5d"></a><!-- doxytag: member="wsseapi.c::soap_wsse_get_SignedInfo_SignatureMethod" ref="afd4c4268cc8f9d667cc44586fb635b5d" args="(struct soap *soap, int *alg)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_get_SignedInfo_SignatureMethod </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int *&#160;</td> <td class="paramname"><em>alg</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Get SignatureMethod algorithm. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[out]</td><td class="paramname">alg</td><td>is SOAP_SMD_HMAC_SHA1, SOAP_SMD_VRFY_DSA_SHA1, or SOAP_SMD_VRFY_RSA_SHA1 </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK or SOAP_FAULT with wsse:UnsupportedAlgorithm or wsse:FailedCheck fault </dd></dl> </div> </div> <a class="anchor" id="a936a081cece9995f265b885e113ff5db"></a><!-- doxytag: member="wsseapi.c::soap_wsse_get_Username" ref="a936a081cece9995f265b885e113ff5db" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const char* soap_wsse_get_Username </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Returns UsernameToken/username string or wsse:FailedAuthentication fault. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>UsernameToken/username string or NULL with wsse:FailedAuthentication fault error set </dd></dl> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="wsseapi_8c.html#aeb0afd01a5036e4f1314a3cfe8575bd5" title="Verifies the supplied password or sets wsse:FailedAuthentication fault.">soap_wsse_verify_Password</a></dd></dl> <p>The returned username should be used to lookup the user's password in a dictionary or database for server-side authentication with soap_wsse_verify_Password. </p> </div> </div> <a class="anchor" id="a278a5511160aade2c206b0225781ff04"></a><!-- doxytag: member="wsseapi.c::soap_wsse_header" ref="a278a5511160aade2c206b0225781ff04" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static int soap_wsse_header </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>This callback is invoked as soon as the SOAP Header is received, we need to obtain the encrypted key when the message is encrypted to start decryption. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK or error code </dd></dl> </div> </div> <a class="anchor" id="a3dafa97e60020d63fdd4be32aefa4119"></a><!-- doxytag: member="wsseapi.c::soap_wsse_ids" ref="a3dafa97e60020d63fdd4be32aefa4119" args="(struct soap *soap, const char *tags)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static char * soap_wsse_ids </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>tags</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>converts tag name(s) to id name(s) </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">tags</td><td>string of space-separated (un)qualified tag names </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>string of ids </dd></dl> </div> </div> <a class="anchor" id="a5c63323384afeaeba5321bb65ad1db86"></a><!-- doxytag: member="wsseapi.c::soap_wsse_init" ref="a5c63323384afeaeba5321bb65ad1db86" args="(struct soap *soap, struct soap_wsse_data *data, const void *(*arg)(struct soap *, int, const char *, int *))" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_init </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">struct <a class="el" href="structsoap__wsse__data.html">soap_wsse_data</a> *&#160;</td> <td class="paramname"><em>data</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const void *(*)(struct soap *, int, const char *, int *)&#160;</td> <td class="paramname"><em>arg</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Initializes plugin data. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in,out]</td><td class="paramname">data</td><td>plugin data </td></tr> <tr><td class="paramdir"></td><td class="paramname">arg</td><td>security token handler callback </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK </dd></dl> </div> </div> <a class="anchor" id="adda41aaa5f46c651fb03816cc17d76aa"></a><!-- doxytag: member="wsseapi.c::soap_wsse_init" ref="adda41aaa5f46c651fb03816cc17d76aa" args="(struct soap *soap, struct soap_wsse_data *data, const void *(*arg)(struct soap *, int alg, const char *keyname, int *keylen))" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static int soap_wsse_init </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">struct <a class="el" href="structsoap__wsse__data.html">soap_wsse_data</a> *&#160;</td> <td class="paramname"><em>data</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const void *(*)(struct soap *, int alg, const char *keyname, int *keylen)&#160;</td> <td class="paramname"><em>arg</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> </div> </div> <a class="anchor" id="a3978578b5dd8dc7065e9946982fe7d57"></a><!-- doxytag: member="wsseapi.c::soap_wsse_KeyInfo" ref="a3978578b5dd8dc7065e9946982fe7d57" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">struct <a class="el" href="structds_____key_info_type.html">ds__KeyInfoType</a>* soap_wsse_KeyInfo </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td><code> [read]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns KeyInfo element if present. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>ds__KeyInfo object or NULL </dd></dl> </div> </div> <a class="anchor" id="a9f2b5e6c2242b3516e624d1b2b25ee1e"></a><!-- doxytag: member="wsseapi.c::soap_wsse_preparecleanup" ref="a9f2b5e6c2242b3516e624d1b2b25ee1e" args="(struct soap *soap, struct soap_wsse_data *data)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static void soap_wsse_preparecleanup </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">struct <a class="el" href="structsoap__wsse__data.html">soap_wsse_data</a> *&#160;</td> <td class="paramname"><em>data</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Restores engine state. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in,out]</td><td class="paramname">data</td><td>plugin data </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="ae3558fa3952e01ec72fbd5f9bf4b1b37"></a><!-- doxytag: member="wsseapi.c::soap_wsse_preparefinalrecv" ref="ae3558fa3952e01ec72fbd5f9bf4b1b37" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static int soap_wsse_preparefinalrecv </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Verify signature and SignedInfo digests initiated with soap_wsse_verify_auto. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK or fault </dd></dl> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="wsseapi_8c.html#a7321b451910e1d3887b328f03de92f34" title="Uses the wsse plugin to initiate the automatic verification of the signature and SignedInfo Reference...">soap_wsse_verify_auto</a></dd></dl> <p>This callback is invoked just after a message was received. </p> </div> </div> <a class="anchor" id="a0a65a4a97fc2ed131ef7a24da07ba08f"></a><!-- doxytag: member="wsseapi.c::soap_wsse_preparefinalsend" ref="a0a65a4a97fc2ed131ef7a24da07ba08f" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static int soap_wsse_preparefinalsend </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Collects the digests of all the wsu:Id elements and populates the SignedInfo. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK or fault</dd></dl> <p>This callback is invoked just before the message is sent. </p> </div> </div> <a class="anchor" id="aa3df0ea602c9868f5e1c7d636aeeddf9"></a><!-- doxytag: member="wsseapi.c::soap_wsse_preparesend" ref="aa3df0ea602c9868f5e1c7d636aeeddf9" args="(struct soap *soap, const char *buf, size_t len)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static int soap_wsse_preparesend </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>buf</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t&#160;</td> <td class="paramname"><em>len</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Takes a piece of the XML message (tokenized) to compute digest. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">buf</td><td>string (XML "tokenized") to be sent </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">len</td><td>buf length </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK or fault</dd></dl> <p>This callback is invoked to analyze a message (usually during the HTTP content length phase). Note: nested elements with wsu:Id attributes cannot be individually signed in this release. </p> </div> </div> <a class="anchor" id="a7590c46443ff1c74365091d2d7806829"></a><!-- doxytag: member="wsseapi.c::soap_wsse_receiver_fault" ref="a7590c46443ff1c74365091d2d7806829" args="(struct soap *soap, const char *faultstring, const char *faultdetail)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_receiver_fault </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>faultstring</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>faultdetail</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Sets receiver SOAP Fault for server fault response. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">faultstring</td><td>fault string </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">faultdetail</td><td>detail string </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_FAULT </dd></dl> </div> </div> <a class="anchor" id="a5cec82648247163c63a28d624b2b9fe8"></a><!-- doxytag: member="wsseapi.c::soap_wsse_receiver_fault_subcode" ref="a5cec82648247163c63a28d624b2b9fe8" args="(struct soap *soap, const char *faultsubcode, const char *faultstring, const char *faultdetail)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_receiver_fault_subcode </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>faultsubcode</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>faultstring</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>faultdetail</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Sets receiver SOAP Fault (sub)code for server fault response. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">faultsubcode</td><td>sub code string </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">faultstring</td><td>fault string </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">faultdetail</td><td>detail string </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_FAULT </dd></dl> </div> </div> <a class="anchor" id="a5d9f35b53cbf1b94d7bc3fdfa1728485"></a><!-- doxytag: member="wsseapi.c::soap_wsse_Security" ref="a5d9f35b53cbf1b94d7bc3fdfa1728485" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">struct <a class="el" href="struct__wsse_____security.html">_wsse__Security</a>* soap_wsse_Security </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td><code> [read]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns Security header element if present. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd><a class="el" href="struct__wsse_____security.html" title="This element defines the wsse:Security SOAP header element per Section 4. Imported element _wsse__Sec...">_wsse__Security</a> object or NULL </dd></dl> </div> </div> <a class="anchor" id="a0e7d820ea5bf71efb136bb7f0ffbb71f"></a><!-- doxytag: member="wsseapi.c::soap_wsse_sender_fault" ref="a0e7d820ea5bf71efb136bb7f0ffbb71f" args="(struct soap *soap, const char *faultstring, const char *faultdetail)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_sender_fault </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>faultstring</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>faultdetail</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Sets sender SOAP Fault for server fault response. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">faultstring</td><td>fault string </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">faultdetail</td><td>detail string </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_FAULT </dd></dl> </div> </div> <a class="anchor" id="aac4234bd51599c36aec7bf7888191fb0"></a><!-- doxytag: member="wsseapi.c::soap_wsse_sender_fault_subcode" ref="aac4234bd51599c36aec7bf7888191fb0" args="(struct soap *soap, const char *faultsubcode, const char *faultstring, const char *faultdetail)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_sender_fault_subcode </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>faultsubcode</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>faultstring</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>faultdetail</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Sets sender SOAP Fault (sub)code for server fault response. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">faultsubcode</td><td>sub code string </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">faultstring</td><td>fault string </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">faultdetail</td><td>detail string </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_FAULT </dd></dl> </div> </div> <a class="anchor" id="a0dd21015cab9811c9da9b08117401ad5"></a><!-- doxytag: member="wsseapi.c::soap_wsse_session_cleanup" ref="a0dd21015cab9811c9da9b08117401ad5" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static void soap_wsse_session_cleanup </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Removes expired authentication data from the digest authentication session database. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="acb666de6b99187df159aaee8219317bd"></a><!-- doxytag: member="wsseapi.c::soap_wsse_session_verify" ref="acb666de6b99187df159aaee8219317bd" args="(struct soap *soap, const char hash[SOAP_SMD_SHA1_SIZE], const char *created, const char *nonce)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static int soap_wsse_session_verify </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char&#160;</td> <td class="paramname"><em>hash</em>[SOAP_SMD_SHA1_SIZE], </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>created</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>nonce</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Verifies and updates the digest, nonce, and creation time against the digest authentication session database to prevent replay attacks. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">hash</td><td>binary digest value of PasswordDigest </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">created</td><td>string </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">nonce</td><td>string (base64) </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK or SOAP_FAULT </dd></dl> </div> </div> <a class="anchor" id="a9582748dda80d0307e253f1a86c0c454"></a><!-- doxytag: member="wsseapi.c::soap_wsse_set_wsu_id" ref="a9582748dda80d0307e253f1a86c0c454" args="(struct soap *soap, const char *tags)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_set_wsu_id </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>tags</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Sets the elements that are to be extended with wsu:Id attributes. The wsu:Id attribute values are set to the string value of the tag's QName by replacing colons with hyphens to produce an xsd:ID value. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">tags</td><td>string of space-separated qualified and unqualified element tag names </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK </dd></dl> </div> </div> <a class="anchor" id="aa3ac2afb86a25ec1e1d8e4515133e9ad"></a><!-- doxytag: member="wsseapi.c::soap_wsse_sign" ref="aa3ac2afb86a25ec1e1d8e4515133e9ad" args="(struct soap *soap, int alg, const void *key, int keylen)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_sign </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>alg</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const void *&#160;</td> <td class="paramname"><em>key</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>keylen</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Uses the wsse plugin to sign all wsu:Id attributed elements. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">alg</td><td>is the signature algorithm SOAP_SMD_HMAC_SHA1, SOAP_SMD_SIGN_DSA_SHA1, or SOAP_SMD_SIGN_RSA_SHA1 </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">key</td><td>is the HMAC secret key or DSA/RSA private EVP_PKEY </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">keylen</td><td>is the HMAC key length </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK or fault</dd></dl> <p>This function does not actually sign the message, but initiates the plugin's signature algorithm to sign the message upon message transfer. </p> </div> </div> <a class="anchor" id="ab653754f1a287ba06bd808cf89548c38"></a><!-- doxytag: member="wsseapi.c::soap_wsse_sign_body" ref="ab653754f1a287ba06bd808cf89548c38" args="(struct soap *soap, int alg, const void *key, int keylen)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_sign_body </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>alg</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const void *&#160;</td> <td class="paramname"><em>key</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>keylen</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Uses the wsse plugin to sign all wsu:Id attributed elements, including the SOAP Body (by adding a wsu:Id="Body" attribute). </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">alg</td><td>is the signature algorithm SOAP_SMD_HMAC_SHA1, SOAP_SMD_SIGN_DSA_SHA1, or SOAP_SMD_SIGN_RSA_SHA1 </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">key</td><td>is the HMAC secret key or DSA/RSA private EVP_PKEY </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">keylen</td><td>is the HMAC key length </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK</dd></dl> <p>This function does not actually sign the message, but initiates the plugin's signature algorithm to sign the message upon message transfer. </p> </div> </div> <a class="anchor" id="a16e38c1160a47ad2cb60d1b7d5dba777"></a><!-- doxytag: member="wsseapi.c::soap_wsse_sign_only" ref="a16e38c1160a47ad2cb60d1b7d5dba777" args="(struct soap *soap, const char *tags)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_sign_only </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>tags</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filters only the specified wsu:Id names for signing. Can be used with <a class="el" href="wsseapi_8h.html#a9582748dda80d0307e253f1a86c0c454" title="Sets the elements that are to be extended with wsu:Id attributes. The wsu:Id attribute values are set...">soap_wsse_set_wsu_id()</a> and if so should use the element tag names. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">tags</td><td>string of space-separated qualified and unqualified tag names </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK </dd></dl> </div> </div> <a class="anchor" id="a4b8fe90c13170958dcee629a519c4451"></a><!-- doxytag: member="wsseapi.c::soap_wsse_Signature" ref="a4b8fe90c13170958dcee629a519c4451" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">struct <a class="el" href="structds_____signature_type.html">ds__SignatureType</a>* soap_wsse_Signature </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td><code> [read]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns Signature header element if present. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd><a class="el" href="structds_____signature_type.html" title="Imported complexType &quot;http://www.w3.org/2000/09/xmldsig#&quot;:SignatureType from typemap WS/WS-typemap...">ds__SignatureType</a> object or NULL </dd></dl> </div> </div> <a class="anchor" id="a216e30bdddd04d328398126851d0f87a"></a><!-- doxytag: member="wsseapi.c::soap_wsse_SignedInfo" ref="a216e30bdddd04d328398126851d0f87a" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">struct <a class="el" href="structds_____signed_info_type.html">ds__SignedInfoType</a>* soap_wsse_SignedInfo </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td><code> [read]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns SignedInfo element if present. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd><a class="el" href="structds_____signed_info_type.html" title="&quot;http://www.w3.org/2000/09/xmldsig#&quot;:SignedInfoType is a complexType.">ds__SignedInfoType</a> object or NULL </dd></dl> </div> </div> <a class="anchor" id="a55271d6c4b775d88995a5e4837142b0f"></a><!-- doxytag: member="wsseapi.c::soap_wsse_Timestamp" ref="a55271d6c4b775d88995a5e4837142b0f" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">struct <a class="el" href="struct__wsu_____timestamp.html">_wsu__Timestamp</a>* soap_wsse_Timestamp </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td><code> [read]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns Timestamp element if present. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd><a class="el" href="struct__wsu_____timestamp.html" title="This element allows Timestamps to be applied anywhere element wildcards are present, including as a SOAP header. Imported element _wsu__Timestamp from typemap WS/WS-typemap.dat.">_wsu__Timestamp</a> object or NULL </dd></dl> </div> </div> <a class="anchor" id="a6bde1e5babdeb24b2f88666a837d4c21"></a><!-- doxytag: member="wsseapi.c::soap_wsse_UsernameToken" ref="a6bde1e5babdeb24b2f88666a837d4c21" args="(struct soap *soap, const char *id)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">struct <a class="el" href="struct__wsse_____username_token.html">_wsse__UsernameToken</a>* soap_wsse_UsernameToken </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>id</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [read]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns UsernameToken element if present. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">id</td><td>string of UsernameToken or NULL </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd><a class="el" href="struct__wsse_____username_token.html" title="This element defines the wsse:UsernameToken element per Section 4.1. Imported element _wsse__Username...">_wsse__UsernameToken</a> object or NULL</dd></dl> <p>Note: this release supports the use of at most one UsernameToken in the header. </p> </div> </div> <a class="anchor" id="a7321b451910e1d3887b328f03de92f34"></a><!-- doxytag: member="wsseapi.c::soap_wsse_verify_auto" ref="a7321b451910e1d3887b328f03de92f34" args="(struct soap *soap, int alg, const void *key, size_t keylen)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_verify_auto </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>alg</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const void *&#160;</td> <td class="paramname"><em>key</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t&#160;</td> <td class="paramname"><em>keylen</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Uses the wsse plugin to initiate the automatic verification of the signature and SignedInfo Reference digests. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">alg</td><td>to verify signature if signature has no secret or public key, use SOAP_SMD_NONE to omit </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">key</td><td>is HMAC key or EVP_PKEY or NULL </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">keylen</td><td>is HMAC key length or 0 </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK</dd></dl> <p>This function does not actually verify the message, but initiates the plugin's algorithm to store the message in a DOM to automatically verify the signature and digests. If the message does not contain a key to verify the signature, the alg, key, and keylen parameters are used. It is important that the X509 certificate used to verify the signature, which requires soap-&gt;cafile and/or soap-&gt;capath to be set. </p> </div> </div> <a class="anchor" id="a5ccbce0f1a4a8f103e921a918f932a20"></a><!-- doxytag: member="wsseapi.c::soap_wsse_verify_body" ref="a5ccbce0f1a4a8f103e921a918f932a20" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_verify_body </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Post-checks the presence of signed SOAP Body. Does not verify the signature of the Body, which is done with <a class="el" href="wsseapi_8c.html#a7321b451910e1d3887b328f03de92f34">soap_wsse_verify_auto</a>. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK (signed) or SOAP_ERR</dd></dl> <p>This function does not actually verify the signature of the Body. It checks whether the Body is signed and thus its integrity is preserved. Clients should call this function after invocation. Services should call this function inside a service operation. This function traverses the entire DOM, so performance is determined by the size of a message. </p> </div> </div> <a class="anchor" id="acf1c213ea26a2286f9c0457849bd6290"></a><!-- doxytag: member="wsseapi.c::soap_wsse_verify_digest" ref="acf1c213ea26a2286f9c0457849bd6290" args="(struct soap *soap, int alg, int canonical, const char *id, unsigned char hash[SOAP_SMD_MAX_SIZE])" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_verify_digest </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>alg</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>canonical</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>id</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>hash</em>[SOAP_SMD_MAX_SIZE]&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Verifies the digest value of an XML element referenced by id against the hash. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">alg</td><td>digest algorithm </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">canonical</td><td>flag indicating that element is signed in exc-c14n form </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">id</td><td>string of the XML element to verify </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">hash</td><td>digest value to verify against </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK or fault </dd></dl> </div> </div> <a class="anchor" id="a07db8f284ab2bb564248999fe02d0169"></a><!-- doxytag: member="wsseapi.c::soap_wsse_verify_done" ref="a07db8f284ab2bb564248999fe02d0169" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_verify_done </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Terminates the automatic verification of signatures. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK </dd></dl> </div> </div> <a class="anchor" id="a3fbe81de521579f026dd1ba8e81c59c1"></a><!-- doxytag: member="wsseapi.c::soap_wsse_verify_element" ref="a3fbe81de521579f026dd1ba8e81c59c1" args="(struct soap *soap, const char *URI, const char *tag)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">size_t soap_wsse_verify_element </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>URI</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>tag</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Post-checks the presence of signed element(s). Does not verify the signature of these elements, which is done with <a class="el" href="wsseapi_8c.html#a7321b451910e1d3887b328f03de92f34">soap_wsse_verify_auto</a>. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramname">URI</td><td>namespace of element(s) </td></tr> <tr><td class="paramname">tag</td><td>name of element(s) </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>number of matching elements signed.</dd></dl> <p>This function does not actually verify the signature of each element, but checks whether the elements are signed and thus their integrity is preserved. Signed element nesting rules are obeyed, so if the matching element is a descendent of a signed element, it is signed as well. Thus, the verification process follows nesting rules.</p> <p>Client should call this function after invocation. Services should call this function inside a service operation. This function traverses the entire DOM, so performance is determined by the size of a message.</p> <p>To check the SOAP Body (either using SOAP 1.1 or 1.2), <a class="el" href="wsseapi_8c.html#a3fbe81de521579f026dd1ba8e81c59c1">soap_wsse_verify_element</a>(soap, namespaces[0].ns, "Body"). To check whether the Timestamp was signed (assuming it is present and message expiration checked with <a class="el" href="wsseapi_8c.html#a98422cde0e2b7b14d65212f7061101fa">soap_wsse_verify_Timestamp</a>), use <a class="el" href="wsseapi_8c.html#a3fbe81de521579f026dd1ba8e81c59c1">soap_wsse_verify_element</a>(soap, "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd", "Timestamp").</p> <p>Note: for future releases XPath queries (or forms of these) will be considered. </p> </div> </div> <a class="anchor" id="afcfdd54e7c220fb90e11c75da3bbbe88"></a><!-- doxytag: member="wsseapi.c::soap_wsse_verify_EncryptedKey" ref="afcfdd54e7c220fb90e11c75da3bbbe88" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_verify_EncryptedKey </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Verifies the EncryptedKey header information (certificate validity requires soap-&gt;cacert to be set). Retrieves the decryption key from the token handler callback to decrypt the decryption key. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK or error code </dd></dl> </div> </div> <a class="anchor" id="a8a246ebd371d9e92c74ec1e29bf92f3a"></a><!-- doxytag: member="wsseapi.c::soap_wsse_verify_init" ref="a8a246ebd371d9e92c74ec1e29bf92f3a" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_verify_init </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Uses the wsse plugin to initiate the verification of the signature and SignedInfo Reference digests. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK</dd></dl> <p>This function does not actually verify the message, but initiates the plugin's data to store the message in a DOM to verify the signature. The signature and digests in the DOM must be verified manually. </p> </div> </div> <a class="anchor" id="add4f5148c87d213a69f86c9fc72a8001"></a><!-- doxytag: member="wsseapi.c::soap_wsse_verify_nested" ref="add4f5148c87d213a69f86c9fc72a8001" args="(struct soap *soap, struct soap_dom_element *dom, const char *URI, const char *tag)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static size_t soap_wsse_verify_nested </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">struct soap_dom_element *&#160;</td> <td class="paramname"><em>dom</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>URI</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>tag</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Counts signed matching elements from the dom node and down. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramname">dom</td><td>node to check and down </td></tr> <tr><td class="paramname">URI</td><td>namespace of element(s) </td></tr> <tr><td class="paramname">tag</td><td>name of element(s) </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>number of matching elements. </dd></dl> </div> </div> <a class="anchor" id="aeb0afd01a5036e4f1314a3cfe8575bd5"></a><!-- doxytag: member="wsseapi.c::soap_wsse_verify_Password" ref="aeb0afd01a5036e4f1314a3cfe8575bd5" args="(struct soap *soap, const char *password)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_verify_Password </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>password</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Verifies the supplied password or sets wsse:FailedAuthentication fault. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">password</td><td>string to verify against </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK (authorized) or SOAP_FAULT with wsse:FailedAuthentication fault</dd></dl> <p>The verification supports both clear-text password verification and digest password authentication. For digest authentication a history mechanism with a digest authentication session database ensures protection against replay attacks. Note: this release supports the use of at most one UsernameToken in the header. </p> </div> </div> <a class="anchor" id="a8ab7e709b0423cd68d3fec96b3db3734"></a><!-- doxytag: member="wsseapi.c::soap_wsse_verify_SignatureValue" ref="a8ab7e709b0423cd68d3fec96b3db3734" args="(struct soap *soap, int alg, const void *key, int keylen)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_verify_SignatureValue </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>alg</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const void *&#160;</td> <td class="paramname"><em>key</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>keylen</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Verifies the SignatureValue of a SignedInfo element. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">alg</td><td>is SOAP_SMD_HMAC_SHA1, SOAP_SMD_VRFY_DSA_SHA1, or SOAP_SMD_VRFY_RSA_SHA1 determined by the SignedInfo/SignatureMethod </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">key</td><td>to use to verify (HMAC or EVP_PKEY) </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">keylen</td><td>length of HMAC key </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK, SOAP_EOM, or fault</dd></dl> <p>This function searches for the SignedInfo element in the soap-&gt;dom DOM tree to verify the signature in the SignatureValue element. Using the DOM ensures we will verify the signature of a SignedInfo as it was exactly received by the parser, by using the -DWITH_DOM compile flag and SOAP_XML_DOM runtime flag. If there is no DOM, it verifies the signature of the deserialized SignedInfo element in the SOAP Header. However, serializing deserialized data may change the octet stream that was signed, unless we're using gSOAP as producers and consumers (with the SOAP_XML_INDENT flag reset). </p> </div> </div> <a class="anchor" id="a75b7ca484637dfc49143546072dd5f4b"></a><!-- doxytag: member="wsseapi.c::soap_wsse_verify_SignedInfo" ref="a75b7ca484637dfc49143546072dd5f4b" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_verify_SignedInfo </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Verifies the digest values of the XML elements referenced by the SignedInfo References. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK or fault</dd></dl> <p>This function searches for the SignedInfo element in the soap-&gt;dom DOM tree to verify the digests contained therein. Using the DOM ensures we will verify the digests of the locally signed elements as they were exactly received by the parser, by using the -DWITH_DOM compile flag and SOAP_XML_DOM runtime flag. If there is no DOM, the function fails. </p> </div> </div> <a class="anchor" id="a98422cde0e2b7b14d65212f7061101fa"></a><!-- doxytag: member="wsseapi.c::soap_wsse_verify_Timestamp" ref="a98422cde0e2b7b14d65212f7061101fa" args="(struct soap *soap)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_verify_Timestamp </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Verifies the Timestamp/Expires element against the current time. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">soap</td><td>context </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK or SOAP_FAULT with wsse:FailedAuthentication fault</dd></dl> <p>Sets wsse:FailedAuthentication fault if wsu:Timestamp is expired. The SOAP_WSSE_CLKSKEW value is used as a margin to mitigate clock skew. Keeps silent when no timestamp is supplied or no expiration date is included in the wsu:Timestamp element. </p> </div> </div> <a class="anchor" id="a8f5879e7d5bd3580ea400ccd1982d747"></a><!-- doxytag: member="wsseapi.c::soap_wsse_verify_X509" ref="a8f5879e7d5bd3580ea400ccd1982d747" args="(struct soap *soap, X509 *cert)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int soap_wsse_verify_X509 </td> <td>(</td> <td class="paramtype">struct soap *&#160;</td> <td class="paramname"><em>soap</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">X509 *&#160;</td> <td class="paramname"><em>cert</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Verifies X509 certificate against soap-&gt;cafile, soap-&gt;capath, and soap-&gt;crlfile. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir"></td><td class="paramname">soap</td><td>context </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">cert</td><td>X509 certificate </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>SOAP_OK or fault</dd></dl> <p>This is an expensive operation. Whenever a new soap context is created, the cafile and objects are loaded into that context each time we need to verify a certificate. </p> </div> </div> <hr/><h2>Variable Documentation</h2> <a class="anchor" id="a4089697df0f14ecf44cf0fb6098f4f78"></a><!-- doxytag: member="wsseapi.c::c14n_URI" ref="a4089697df0f14ecf44cf0fb6098f4f78" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const char* <a class="el" href="wsseapi_8c.html#a4089697df0f14ecf44cf0fb6098f4f78">c14n_URI</a> = &quot;http://www.w3.org/2001/10/xml-exc-c14n#&quot;</td> </tr> </table> </div> <div class="memdoc"> </div> </div> <a class="anchor" id="a1f62c1715e0f49fd54ffc263e45a12eb"></a><!-- doxytag: member="wsseapi.c::ds_dsa_sha1URI" ref="a1f62c1715e0f49fd54ffc263e45a12eb" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const char* <a class="el" href="wsseapi_8c.html#a1f62c1715e0f49fd54ffc263e45a12eb">ds_dsa_sha1URI</a> = &quot;http://www.w3.org/2000/09/xmldsig#dsa-sha1&quot;</td> </tr> </table> </div> <div class="memdoc"> </div> </div> <a class="anchor" id="a352a6e78890296ade9e25de397f1096c"></a><!-- doxytag: member="wsseapi.c::ds_hmac_sha1URI" ref="a352a6e78890296ade9e25de397f1096c" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const char* <a class="el" href="wsseapi_8c.html#a352a6e78890296ade9e25de397f1096c">ds_hmac_sha1URI</a> = &quot;http://www.w3.org/2000/09/xmldsig#hmac-sha1&quot;</td> </tr> </table> </div> <div class="memdoc"> </div> </div> <a class="anchor" id="ad57129724eb01a743b6583afc522a131"></a><!-- doxytag: member="wsseapi.c::ds_rsa_sha1URI" ref="ad57129724eb01a743b6583afc522a131" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const char* <a class="el" href="wsseapi_8c.html#ad57129724eb01a743b6583afc522a131">ds_rsa_sha1URI</a> = &quot;http://www.w3.org/2000/09/xmldsig#rsa-sha1&quot;</td> </tr> </table> </div> <div class="memdoc"> </div> </div> <a class="anchor" id="a71140ac907117b2bbf37f14939166a15"></a><!-- doxytag: member="wsseapi.c::ds_sha1URI" ref="a71140ac907117b2bbf37f14939166a15" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const char* <a class="el" href="wsseapi_8c.html#a71140ac907117b2bbf37f14939166a15">ds_sha1URI</a> = &quot;http://www.w3.org/2000/09/xmldsig#sha1&quot;</td> </tr> </table> </div> <div class="memdoc"> </div> </div> <a class="anchor" id="ad7aea4af6b24389f66019e8984d4b05c"></a><!-- doxytag: member="wsseapi.c::ds_URI" ref="ad7aea4af6b24389f66019e8984d4b05c" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const char* <a class="el" href="wsseapi_8c.html#ad7aea4af6b24389f66019e8984d4b05c">ds_URI</a> = &quot;http://www.w3.org/2000/09/xmldsig#&quot;</td> </tr> </table> </div> <div class="memdoc"> </div> </div> <a class="anchor" id="a08c28b1011e1b370838312729cca9c01"></a><!-- doxytag: member="wsseapi.c::soap_wsse_id" ref="a08c28b1011e1b370838312729cca9c01" args="[14]" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const char <a class="el" href="wsseapi_8c.html#a08c28b1011e1b370838312729cca9c01">soap_wsse_id</a>[14] = SOAP_WSSE_ID</td> </tr> </table> </div> <div class="memdoc"> <p>Plugin identification for plugin registry </p> </div> </div> <a class="anchor" id="a777b5d06409128e7bcb97703b4f40f06"></a><!-- doxytag: member="wsseapi.c::soap_wsse_session" ref="a777b5d06409128e7bcb97703b4f40f06" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">struct <a class="el" href="structsoap__wsse__session.html">soap_wsse_session</a>* <a class="el" href="structsoap__wsse__session.html">soap_wsse_session</a> = NULL<code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>The digest authentication session database </p> </div> </div> <a class="anchor" id="a627ba14d70ad7f79d61e2e93485be6ce"></a><!-- doxytag: member="wsseapi.c::soap_wsse_session_lock" ref="a627ba14d70ad7f79d61e2e93485be6ce" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">MUTEX_TYPE <a class="el" href="wsseapi_8c.html#a627ba14d70ad7f79d61e2e93485be6ce">soap_wsse_session_lock</a> = MUTEX_INITIALIZER<code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Lock for digest authentication session database exclusive access </p> </div> </div> <a class="anchor" id="a7d0ae8f2dd1beaabdaa4884ea5dd41e4"></a><!-- doxytag: member="wsseapi.c::wsse_Base64BinaryURI" ref="a7d0ae8f2dd1beaabdaa4884ea5dd41e4" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const char* <a class="el" href="wsseapi_8c.html#a7d0ae8f2dd1beaabdaa4884ea5dd41e4">wsse_Base64BinaryURI</a> = &quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary&quot;</td> </tr> </table> </div> <div class="memdoc"> </div> </div> <a class="anchor" id="a000638936fff26e30a3f256c495c1aa8"></a><!-- doxytag: member="wsseapi.c::wsse_PasswordDigestURI" ref="a000638936fff26e30a3f256c495c1aa8" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const char* <a class="el" href="wsseapi_8c.html#a000638936fff26e30a3f256c495c1aa8">wsse_PasswordDigestURI</a> = &quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest&quot;</td> </tr> </table> </div> <div class="memdoc"> </div> </div> <a class="anchor" id="a38dfc9981f0859b1307c302d8497c08c"></a><!-- doxytag: member="wsseapi.c::wsse_PasswordTextURI" ref="a38dfc9981f0859b1307c302d8497c08c" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const char* <a class="el" href="wsseapi_8c.html#a38dfc9981f0859b1307c302d8497c08c">wsse_PasswordTextURI</a> = &quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText&quot;</td> </tr> </table> </div> <div class="memdoc"> </div> </div> <a class="anchor" id="a88d310451ae729bbf0fdd149a9d7511c"></a><!-- doxytag: member="wsseapi.c::wsse_X509v3SubjectKeyIdentifierURI" ref="a88d310451ae729bbf0fdd149a9d7511c" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const char* <a class="el" href="wsseapi_8c.html#a88d310451ae729bbf0fdd149a9d7511c">wsse_X509v3SubjectKeyIdentifierURI</a> = &quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509SubjectKeyIdentifier&quot;</td> </tr> </table> </div> <div class="memdoc"> </div> </div> <a class="anchor" id="ac07968b1c372e976758745ba7089c367"></a><!-- doxytag: member="wsseapi.c::wsse_X509v3URI" ref="ac07968b1c372e976758745ba7089c367" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const char* <a class="el" href="wsseapi_8c.html#ac07968b1c372e976758745ba7089c367">wsse_X509v3URI</a> = &quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3&quot;</td> </tr> </table> </div> <div class="memdoc"> </div> </div> <a class="anchor" id="adb66cffe8d95c5d511987189173a993c"></a><!-- doxytag: member="wsseapi.c::wsu_URI" ref="adb66cffe8d95c5d511987189173a993c" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const char* <a class="el" href="wsseapi_8c.html#adb66cffe8d95c5d511987189173a993c">wsu_URI</a> = &quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd&quot;</td> </tr> </table> </div> <div class="memdoc"> </div> </div> <a class="anchor" id="a159d359ac83617f624b54d467db4e0b1"></a><!-- doxytag: member="wsseapi.c::xenc_3desURI" ref="a159d359ac83617f624b54d467db4e0b1" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const char* <a class="el" href="wsseapi_8c.html#a159d359ac83617f624b54d467db4e0b1">xenc_3desURI</a> = &quot;http://www.w3.org/2001/04/xmlenc#tripledes-cbc&quot;</td> </tr> </table> </div> <div class="memdoc"> </div> </div> <a class="anchor" id="a6c5bdcb80c33d0c3d35050091bd2cec5"></a><!-- doxytag: member="wsseapi.c::xenc_rsa15URI" ref="a6c5bdcb80c33d0c3d35050091bd2cec5" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const char* <a class="el" href="wsseapi_8c.html#a6c5bdcb80c33d0c3d35050091bd2cec5">xenc_rsa15URI</a> = &quot;http://www.w3.org/2001/04/xmlenc#rsa-1_5&quot;</td> </tr> </table> </div> <div class="memdoc"> </div> </div> </div> <hr class="footer"/><address class="footer"><small>Generated on Mon Dec 12 2011 11:10:45 for gSOAP WS-Security by&#160; <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address> </body> </html>
nelsonblaha/Verse
3rdparty/gsoap/doc/wsse/html/wsseapi_8c.html
HTML
gpl-3.0
216,128
<?php namespace HM\Coding\Standards\Tests; class Two_Parts {}
jazzsequence/games-collector
vendor/humanmade/coding-standards/HM/Tests/Files/ClassFileNameUnitTest/class-twoparts.php
PHP
gpl-3.0
64
var gulp = require('gulp'); var config = require('../../config.js'); var utils = require('../../utils.js'); gulp.task('build-jquery-file-upload-widget', [], function(){ return utils.buildJsGroup([ config.paths.nodes + 'blueimp-file-upload/js/vendor/jquery.ui.widget.js' ], 'jquery.ui.widget', 'vendors/jquery-file-upload'); }); gulp.task('build-jquery-file-transport', [], function(){ return utils.buildJsGroup([ config.paths.nodes + 'blueimp-file-upload/js/jquery.iframe-transport.js' ], 'jquery.iframe-transport', 'vendors/jquery-file-upload'); }); gulp.task('build-jquery-file-upload', ['build-jquery-file-transport', 'build-jquery-file-upload-widget'], function(){ return utils.buildJsGroup([ config.paths.nodes + 'blueimp-file-upload/js/jquery.fileupload.js' ], 'jquery.fileupload', 'vendors/jquery-file-upload'); });
nmaillat/Phraseanet
resources/gulp/components/vendors/jquery-file-upload.js
JavaScript
gpl-3.0
875
<div class="form-group" ng-class="{'has-error': has_error}"> <label class="col-lg-3 control-label" for="type"> Widget Type<span class="text-danger" ng-if="!is_disabled">*</span> </label> <div class="col-lg-6"> <p class="form-control-static" ng-if="is_disabled">{{selected_type.description}}</p> <select ng-show="!is_disabled" class="form-control" name="type" id="type" ng-model="selected_type" ng-options="v.description for (k,v) in select_values"></select> </div> </div>
brucetsao/XBeeZigBeeCloudKit
src/app/widget_settings/widget-type-settings-item.tpl.html
HTML
mpl-2.0
536
// Copied from OpenQA namespace Winium.StoreApps.Common { /// <summary> /// Values describing the list of commands understood by a remote server using the JSON wire protocol. /// /// </summary> public static class DriverCommand { #region Static Fields #region Selenium /// <summary> /// Represents the AcceptAlert command /// /// </summary> public static readonly string AcceptAlert = "acceptAlert"; /// <summary> /// Represents adding a cookie command /// /// </summary> public static readonly string AddCookie = "addCookie"; /// <summary> /// Represents ClearElement command /// /// </summary> public static readonly string ClearElement = "clearElement"; /// <summary> /// Represents ClickElement command /// /// </summary> public static readonly string ClickElement = "clickElement"; /// <summary> /// Represents a Browser close command /// /// </summary> public static readonly string Close = "close"; /// <summary> /// Represents the Define Driver Mapping command /// /// </summary> public static readonly string DefineDriverMapping = "defineDriverMapping"; /// <summary> /// Represents Deleting all cookies command /// /// </summary> public static readonly string DeleteAllCookies = "deleteAllCookies"; /// <summary> /// Represents deleting a cookie command /// /// </summary> public static readonly string DeleteCookie = "deleteCookie"; /// <summary> /// Describes an element /// /// </summary> public static readonly string DescribeElement = "describeElement"; /// <summary> /// Represents the DismissAlert command /// /// </summary> public static readonly string DismissAlert = "dismissAlert"; /// <summary> /// Represents ElementEquals command /// /// </summary> public static readonly string ElementEquals = "elementEquals"; /// <summary> /// Represents ExecuteAsyncScript command /// /// </summary> public static readonly string ExecuteAsyncScript = "executeAsyncScript"; /// <summary> /// Represents ExecuteScript command /// /// </summary> public static readonly string ExecuteScript = "executeScript"; /// <summary> /// Represents FindChildElement command /// /// </summary> public static readonly string FindChildElement = "findChildElement"; /// <summary> /// Represents FindChildElements command /// /// </summary> public static readonly string FindChildElements = "findChildElements"; /// <summary> /// Represents FindElement command /// /// </summary> public static readonly string FindElement = "findElement"; /// <summary> /// Represents FindElements command /// /// </summary> public static readonly string FindElements = "findElements"; /// <summary> /// Represents a GET command /// /// </summary> public static readonly string Get = "get"; /// <summary> /// Represents GetActiveElement command /// /// </summary> public static readonly string GetActiveElement = "getActiveElement"; /// <summary> /// Represents the GetAlertText command /// /// </summary> public static readonly string GetAlertText = "getAlertText"; /// <summary> /// Represents getting all cookies command /// /// </summary> public static readonly string GetAllCookies = "getCookies"; /// <summary> /// Represents GetCurrentUrl command /// /// </summary> public static readonly string GetCurrentUrl = "getCurrentUrl"; /// <summary> /// Represents GetCurrentWindowHandle command /// /// </summary> public static readonly string GetCurrentWindowHandle = "getCurrentWindowHandle"; /// <summary> /// Represents GetElementAttribute command /// /// </summary> public static readonly string GetElementAttribute = "getElementAttribute"; /// <summary> /// Represents GetElementLocation command /// /// </summary> public static readonly string GetElementLocation = "getElementLocation"; /// <summary> /// Represents GetElementLocationOnceScrolledIntoView command /// /// </summary> public static readonly string GetElementLocationOnceScrolledIntoView = "getElementLocationOnceScrolledIntoView"; /// <summary> /// Represents GetElementSize command /// /// </summary> public static readonly string GetElementSize = "getElementSize"; /// <summary> /// Represents GetElementTagName command /// /// </summary> public static readonly string GetElementTagName = "getElementTagName"; /// <summary> /// Represents GetElementText command /// /// </summary> public static readonly string GetElementText = "getElementText"; /// <summary> /// Represents GetElementValueOfCSSProperty command /// /// </summary> public static readonly string GetElementValueOfCssProperty = "getElementValueOfCssProperty"; /// <summary> /// Represents GetOrientation command /// /// </summary> public static readonly string GetOrientation = "getOrientation"; /// <summary> /// Represents GetPageSource command /// /// </summary> public static readonly string GetPageSource = "getPageSource"; /// <summary> /// Represents the Get Session Capabilities command /// /// </summary> public static readonly string GetSessionCapabilities = "getSessionCapabilities"; /// <summary> /// Represents the Get Session List command /// /// </summary> public static readonly string GetSessionList = "getSessionList"; /// <summary> /// Represents GetTitle command /// /// </summary> public static readonly string GetTitle = "getTitle"; /// <summary> /// Represents GetWindowHandles command /// /// </summary> public static readonly string GetWindowHandles = "getWindowHandles"; /// <summary> /// Represents GetWindowPosition command /// /// </summary> public static readonly string GetWindowPosition = "getWindowPosition"; /// <summary> /// Represents GetWindowSize command /// /// </summary> public static readonly string GetWindowSize = "getWindowSize"; /// <summary> /// Represents a Browser going back command /// /// </summary> public static readonly string GoBack = "goBack"; /// <summary> /// Represents a Browser going forward command /// /// </summary> public static readonly string GoForward = "goForward"; /// <summary> /// Represents the ImplicitlyWait command /// /// </summary> public static readonly string ImplicitlyWait = "implicitlyWait"; /// <summary> /// Represents IsElementDisplayed command /// /// </summary> public static readonly string IsElementDisplayed = "isElementDisplayed"; /// <summary> /// Represents IsElementEnabled command /// /// </summary> public static readonly string IsElementEnabled = "isElementEnabled"; /// <summary> /// Represents IsElementSelected command /// /// </summary> public static readonly string IsElementSelected = "isElementSelected"; /// <summary> /// Represents MaximizeWindow command /// /// </summary> public static readonly string MaximizeWindow = "maximizeWindow"; /// <summary> /// Represents the MouseClick command. /// /// </summary> public static readonly string MouseClick = "mouseClick"; /// <summary> /// Represents the MouseDoubleClick command. /// /// </summary> public static readonly string MouseDoubleClick = "mouseDoubleClick"; /// <summary> /// Represents the MouseDown command. /// /// </summary> public static readonly string MouseDown = "mouseDown"; /// <summary> /// Represents the MouseMoveTo command. /// /// </summary> public static readonly string MouseMoveTo = "mouseMoveTo"; /// <summary> /// Represents the MouseUp command. /// /// </summary> public static readonly string MouseUp = "mouseUp"; /// <summary> /// Represents a New Session command /// /// </summary> public static readonly string NewSession = "newSession"; /// <summary> /// Represents a browser quit command /// /// </summary> public static readonly string Quit = "quit"; /// <summary> /// Represents a Browser refreshing command /// /// </summary> public static readonly string Refresh = "refresh"; /// <summary> /// Represents Screenshot command /// /// </summary> public static readonly string Screenshot = "screenshot"; /// <summary> /// Represents the SendKeysToActiveElement command. /// /// </summary> public static readonly string SendKeysToActiveElement = "sendKeysToActiveElement"; /// <summary> /// Represents SendKeysToElements command /// /// </summary> public static readonly string SendKeysToElement = "sendKeysToElement"; /// <summary> /// Represents the SetAlertValue command /// /// </summary> public static readonly string SetAlertValue = "setAlertValue"; /// <summary> /// Represents the SetAsyncScriptTimeout command /// /// </summary> public static readonly string SetAsyncScriptTimeout = "setScriptTimeout"; /// <summary> /// Represents SetOrientation command /// /// </summary> public static readonly string SetOrientation = "setOrientation"; /// <summary> /// Represents the SetTimeout command /// /// </summary> public static readonly string SetTimeout = "setTimeout"; /// <summary> /// Represents SetWindowPosition command /// /// </summary> public static readonly string SetWindowPosition = "setWindowPosition"; /// <summary> /// Represents SetWindowSize command /// /// </summary> public static readonly string SetWindowSize = "setWindowSize"; /// <summary> /// Represents the Status command. /// /// </summary> public static readonly string Status = "status"; /// <summary> /// Represents SubmitElement command /// /// </summary> public static readonly string SubmitElement = "submitElement"; /// <summary> /// Represents SwitchToFrame command /// /// </summary> public static readonly string SwitchToFrame = "switchToFrame"; /// <summary> /// Represents SwitchToParentFrame command /// /// </summary> public static readonly string SwitchToParentFrame = "switchToParentFrame"; /// <summary> /// Represents SwitchToWindow command /// /// </summary> public static readonly string SwitchToWindow = "switchToWindow"; /// <summary> /// Represents the TouchDoubleTap command. /// /// </summary> public static readonly string TouchDoubleTap = "touchDoubleTap"; /// <summary> /// Represents the TouchFlick command. /// /// </summary> public static readonly string TouchFlick = "touchFlick"; /// <summary> /// Represents the TouchLongPress command. /// /// </summary> public static readonly string TouchLongPress = "touchLongPress"; /// <summary> /// Represents the TouchMove command. /// /// </summary> public static readonly string TouchMove = "touchMove"; /// <summary> /// Represents the TouchPress command. /// /// </summary> public static readonly string TouchPress = "touchDown"; /// <summary> /// Represents the TouchRelease command. /// /// </summary> public static readonly string TouchRelease = "touchUp"; /// <summary> /// Represents the TouchScroll command. /// /// </summary> public static readonly string TouchScroll = "touchScroll"; /// <summary> /// Represents the TouchSingleTap command. /// /// </summary> public static readonly string TouchSingleTap = "touchSingleTap"; /// <summary> /// Represents the UploadFile command. /// /// </summary> public static readonly string UploadFile = "uploadFile"; #endregion #region Winium /// <summary> /// Represents additional driver commnad FindDataGridCell. /// /// </summary> public static readonly string FindDataGridCell = "findDataGridCell"; /// <summary> /// Represents additional driver commnad GetDataGridColumnCount. /// /// </summary> public static readonly string GetDataGridColumnCount = "getDataGridColumnCount"; /// <summary> /// Represents additional driver commnad GetDataGridRowCount. /// /// </summary> public static readonly string GetDataGridRowCount = "getDataGridRowCount"; /// <summary> /// Represents additional driver commnad ScrollToDataGridCell. /// /// </summary> public static readonly string ScrollToDataGridCell = "scrollToDataGridCell"; /// <summary> /// Represents additional driver commnad ScrollToDataGridCell. /// /// </summary> public static readonly string SelectDataGridCell = "selectDataGridCell"; /// <summary> /// Represents additional driver commnad IsComboBoxExpanded. /// /// </summary> public static readonly string IsComboBoxExpanded = "isComboBoxExpanded"; /// <summary> /// Represents additional driver commnad ExpandComboBox. /// /// </summary> public static readonly string ExpandComboBox = "expandComboBox"; /// <summary> /// Represents additional driver commnad CollapseComboBox. /// /// </summary> public static readonly string CollapseComboBox = "collapseComboBox"; /// <summary> /// Represents additional driver commnad FindComboBoxSelectedItem. /// /// </summary> public static readonly string FindComboBoxSelectedItem = "findComboBoxSelectedItem"; /// <summary> /// Represents additional driver commnad ScrollToComboBoxItem. /// /// </summary> public static readonly string ScrollToComboBoxItem = "scrollToComboBoxItem"; /// <summary> /// Represents additional driver commnad ScrollToListBoxItem. /// /// </summary> public static readonly string ScrollToListBoxItem = "scrollToListBoxItem"; /// <summary> /// Represents additional driver commnad FindMenuItem. /// /// </summary> public static readonly string FindMenuItem = "findMenuItem"; /// <summary> /// Represents additional driver commnad SelectMenuItem. /// /// </summary> public static readonly string SelectMenuItem = "selectMenuItem"; #endregion #endregion } }
jorik041/Winium.Desktop
src/Winium.StoreApps.Common/DriverCommand.cs
C#
mpl-2.0
16,767
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import sys, re, types, os, glob, logging import traceback import logging from uuid import uuid1 from lxml import etree from Peach.Engine.dom import * from Peach.Engine import dom import Peach.Engine from Peach.Mutators import * from Peach.Engine.common import * from Peach.Engine.incoming import DataCracker from Peach.mutatestrategies import * from Peach.config import getInstanceProvider def PeachStr(s): """ Our implementation of str() which does not convert None to 'None'. """ if s is None: return None return str(s) class PeachResolver(etree.Resolver): def resolve(self, url, id, context): scheme, filename = url.split(":", 1) # raise PeachException("URL Exception: scheme required") # Add the files path to our sys.path if scheme == 'file': if os.path.isfile(filename): newpath = os.path.abspath('.') if newpath not in sys.path: sys.path.append(newpath) return self.resolve_file(open(filename), context) for d in sys.path: for new_fn in (os.path.join(d, filename), os.path.join(d, 'Peach/Engine', filename)): if os.path.isfile(new_fn): newpath = os.path.abspath(os.path.split(new_fn)[0]) if newpath not in sys.path: sys.path.append(newpath) return self.resolve_file(open(new_fn), context) raise PeachException("Peach was unable to locate [%s]" % url) return etree.Resolver.resolve(self, url, id, context) class ParseTemplate(object): """ The Peach 2 XML -> Peach DOM parser. Uses lxml library. Parser returns a top level context object that contains things like templates, namespaces, etc. """ dontCrack = False def __init__(self, configs=None): self._parser = etree.XMLParser(remove_comments=True) self._parser.resolvers.add(PeachResolver()) if configs is None: self._configs = {} else: self._configs = configs def _getBooleanAttribute(self, node, name): """If node has no attribute named |name| return True.""" v = self._getAttribute(node, name) if not v: return True v = v.lower() r = v in ('true', 'yes', '1') if not r: assert v in ('false', 'no', '0') return r def substituteConfigVariables(self, xmlString, final=False): result = [] pos = 0 numVarsLeft = 0 numVarsFound = 0 unresolved = [] if not final: logging.info("Analyzing XML for potential macros.") for m in re.finditer(r"\$(\w+:?\w*)\$", xmlString): result.append(xmlString[pos:m.start(0)]) varName = m.group(1) handled = False if varName in self._configs: logging.debug('Setting "{}" to "{}"'.format(varName, self._configs[varName])) result.append(self._configs[varName]) handled = True elif ':' in varName: # Instance provider (instanceProviderName, identifier) = varName.split(':') instanceProvider = getInstanceProvider(instanceProviderName) try: instance = str(instanceProvider.getInstanceById(identifier, self._configs)) logging.debug('Setting "{}" to "{}"'.format(varName, instance)) result.append(instance) handled = True except Exception: # allow it to fail for now, probably need other macros to resolve this pass if not handled: result.append(m.group(0)) unresolved.append(m.group(1)) numVarsLeft += 1 pos = m.end(0) numVarsFound += 1 result.append(xmlString[pos:]) if not final: logging.info("Found {} macros, {} resolved.".format(numVarsFound, numVarsFound - numVarsLeft)) elif unresolved: for u in unresolved: logging.warning("Unresolved macro: %s" % u) return "".join(result) def parse(self, uri): """ Parse a Peach XML file pointed to by uri. """ logging.info(highlight.info("Parsing %s" % uri)) doc = etree.parse(uri, parser=self._parser, base_url="http://phed.org").getroot() if "_target" in self._configs: target = etree.parse(self._configs["_target"], parser=self._parser, base_url="http://phed.org").getroot() if split_ns(target.tag)[1] != 'Peach': raise PeachException("First element in document must be Peach, not '%s'" % target.tag) for child in target.iterchildren(): doc.append(child) del self._configs["_target"] # try early to find configuration macros self.FindConfigurations(doc) xmlString = etree.tostring(doc) return self.parseString(xmlString, findConfigs=False) def parseString(self, xml, findConfigs=True): """ Parse a string as Peach XML. """ xml = self.substituteConfigVariables(xml) doc = etree.fromstring(xml, parser=self._parser, base_url="http://phed.org") return self.HandleDocument(doc, findConfigs=findConfigs) def GetClassesInModule(self, module): """ Return array of class names in module """ classes = [] for item in dir(module): i = getattr(module, item) if type(i) == type and item[0] != '_': classes.append(item) elif type(i) == types.MethodType and item[0] != '_': classes.append(item) elif type(i) == types.FunctionType and item[0] != '_': classes.append(item) elif repr(i).startswith("<class"): classes.append(item) return classes def FindConfigurations(self, doc): # FIRST check for a configuration section. If one exists, we need to parse it and then restart. #print "Looking for Configuration element" has_config = False for child in doc.iterchildren(): child_tag = split_ns(child.tag)[1] if child_tag != 'Configuration': continue #assert not has_config, "Multiple <Configuration> elements" has_config = True #print "Found Configuration element" for child in child.iterchildren(): child_tag = split_ns(child.tag)[1] assert child_tag == "Macro", "Unknown child in Configuration element: {}".format(child_tag) name = child.get("name") if name not in self._configs: #print "\t%s = %s" % (name, child.get("value")) self._configs[name] = child.get("value") else: #print "\t%s = %s [dropped]" % (name, child.get("value")) pass return has_config def HandleDocument(self, doc, uri="", findConfigs=True): if findConfigs and self.FindConfigurations(doc): return self.parseString(etree.tostring(doc), findConfigs=False) #self.StripComments(doc) self.StripText(doc) ePeach = doc if split_ns(ePeach.tag)[1] != 'Peach': raise PeachException("First element in document must be Peach, not '%s'" % ePeach.tag) peach = dom.Peach() peach.peachPitUri = uri #peach.node = doc self.context = peach peach.mutators = None #: List of nodes that need some parse love list of [xmlNode, parent] self.unfinishedReferences = [] for i in ['templates', 'data', 'agents', 'namespaces', 'tests', 'runs']: setattr(peach, i, ElementWithChildren()) # Peach attributes for i in ['version', 'author', 'description']: setattr(peach, i, self._getAttribute(ePeach, i)) # The good stuff -- We are going todo multiple passes here to increase the likely hood # that things will turn out okay. # Pass 1 -- Include, PythonPath, Defaults for child in ePeach.iterchildren(): child_tag = split_ns(child.tag)[1] if child_tag == 'Include': # Include this file nsName = self._getAttribute(child, 'ns') nsSrc = self._getAttribute(child, 'src') parser = ParseTemplate(self._configs) ns = parser.parse(nsSrc) ns.name = nsName + ':' + nsSrc ns.nsName = nsName ns.nsSrc = nsSrc ns.elementType = 'namespace' ns.toXml = new_instancemethod(dom.Namespace.toXml, ns) nss = Namespace() nss.ns = ns nss.nsName = nsName nss.nsSrc = nsSrc nss.name = nsName + ":" + nsSrc nss.parent = peach ns.parent = nss peach.append(nss) peach.namespaces.append(ns) setattr(peach.namespaces, nsName, ns) elif child_tag == 'PythonPath': # Add a search path p = self.HandlePythonPath(child, peach) peach.append(p) sys.path.append(p.name) elif child_tag == 'Defaults': self.HandleDefaults(child, peach) # one last check for unresolved macros for child in ePeach.iterdescendants(): for k,v in list(child.items()): child.set(k, self.substituteConfigVariables(v, final=True)) # Pass 2 -- Import for child in ePeach.iterchildren(): child_tag = split_ns(child.tag)[1] if child_tag == 'Import': # Import module if child.get('import') is None: raise PeachException("Import element did not have import attribute!") importStr = self._getAttribute(child, 'import') if child.get('from') is not None: fromStr = self._getAttribute(child, 'from') if importStr == "*": module = __import__(PeachStr(fromStr), globals(), locals(), [PeachStr(importStr)], -1) try: # If we are a module with other modules in us then we have an __all__ for item in module.__all__: globals()["PeachXml_" + item] = getattr(module, item) except: # Else we just have some classes in us with no __all__ for item in self.GetClassesInModule(module): globals()["PeachXml_" + item] = getattr(module, item) else: module = __import__(PeachStr(fromStr), globals(), locals(), [PeachStr(importStr)], -1) for item in importStr.split(','): item = item.strip() globals()["PeachXml_" + item] = getattr(module, item) else: globals()["PeachXml_" + importStr] = __import__(PeachStr(importStr), globals(), locals(), [], -1) Holder.globals = globals() Holder.locals = locals() i = Element() i.elementType = 'import' i.importStr = self._getAttribute(child, 'import') i.fromStr = self._getAttribute(child, 'from') peach.append(i) # Pass 3 -- Template for child in ePeach.iterchildren(): child_tag = split_ns(child.tag)[1] if child_tag == "Python": code = self._getAttribute(child, "code") if code is not None: exec(code) elif child_tag == 'Analyzer': self.HandleAnalyzerTopLevel(child, peach) elif child_tag == 'DataModel' or child_tag == 'Template': # do something template = self.HandleTemplate(child, peach) #template.node = child peach.append(template) peach.templates.append(template) setattr(peach.templates, template.name, template) # Pass 4 -- Data, Agent for child in ePeach.iterchildren(): child_tag = split_ns(child.tag)[1] if child_tag == 'Data': # do data data = self.HandleData(child, peach) #data.node = child peach.append(data) peach.data.append(data) setattr(peach.data, data.name, data) elif child_tag == 'Agent': agent = self.HandleAgent(child, None) #agent.node = child peach.append(agent) peach.agents.append(agent) setattr(peach.agents, agent.name, agent) elif child_tag == 'StateModel' or child_tag == 'StateMachine': stateMachine = self.HandleStateMachine(child, peach) #stateMachine.node = child peach.append(stateMachine) elif child_tag == 'Mutators': if self._getBooleanAttribute(child, "enabled"): mutators = self.HandleMutators(child, peach) peach.mutators = mutators # Pass 5 -- Tests for child in ePeach.iterchildren(): child_tag = split_ns(child.tag)[1] if child_tag == 'Test': tests = self.HandleTest(child, None) #tests.node = child peach.append(tests) peach.tests.append(tests) setattr(peach.tests, tests.name, tests) elif child_tag == 'Run': run = self.HandleRun(child, None) #run.node = child peach.append(run) peach.runs.append(run) setattr(peach.runs, run.name, run) # Pass 6 -- Analyzers # Simce analyzers can modify the DOM we need to make our list # of objects we will look at first! objs = [] for child in peach.getElementsByType(Blob): if child.analyzer is not None and child.defaultValue is not None and child not in objs: objs.append(child) for child in peach.getElementsByType(String): if child.analyzer is not None and child.defaultValue is not None and child not in objs: objs.append(child) for child in objs: try: analyzer = eval("%s()" % child.analyzer) except: analyzer = eval("PeachXml_" + "%s()" % child.analyzer) analyzer.asDataElement(child, {}, child.defaultValue) # We suck, so fix this up peach._FixParents() peach.verifyDomMap() #peach.printDomMap() return peach def StripComments(self, node): i = 0 while i < len(node): if not etree.iselement(node[i]): del node[i] # may not preserve text, don't care else: self.StripComments(node[i]) i += 1 def StripText(self, node): node.text = node.tail = None for desc in node.iterdescendants(): desc.text = desc.tail = None def GetRef(self, str, parent=None, childAttr='templates'): """ Get the object indicated by ref. Currently the object must have been defined prior to this point in the XML """ #print "GetRef(%s) -- Starting" % str origStr = str baseObj = self.context hasNamespace = False isTopName = True found = False # Parse out a namespace if str.find(":") > -1: ns, tmp = str.split(':') str = tmp #print "GetRef(%s): Found namepsace: %s" % (str, ns) # Check for namespace if hasattr(self.context.namespaces, ns): baseObj = getattr(self.context.namespaces, ns) else: #print self raise PeachException("Unable to locate namespace: " + origStr) hasNamespace = True for name in str.split('.'): #print "GetRef(%s): Looking for part %s" % (str, name) found = False if not hasNamespace and isTopName and parent is not None: # check parent, walk up from current parent to top # level parent checking at each level. while parent is not None and not found: #print "GetRef(%s): Parent.name: %s" % (name, parent.name) if hasattr(parent, 'name') and parent.name == name: baseObj = parent found = True elif hasattr(parent, name): baseObj = getattr(parent, name) found = True elif hasattr(parent.children, name): baseObj = getattr(parent.children, name) found = True elif hasattr(parent, childAttr) and hasattr(getattr(parent, childAttr), name): baseObj = getattr(getattr(parent, childAttr), name) found = True else: parent = parent.parent # check base obj elif hasattr(baseObj, name): baseObj = getattr(baseObj, name) found = True # check childAttr elif hasattr(baseObj, childAttr): obj = getattr(baseObj, childAttr) if hasattr(obj, name): baseObj = getattr(obj, name) found = True else: raise PeachException("Could not resolve ref %s" % origStr) # check childAttr if found == False and hasattr(baseObj, childAttr): obj = getattr(baseObj, childAttr) if hasattr(obj, name): baseObj = getattr(obj, name) found = True # check across namespaces if we can't find it in ours if isTopName and found == False: for child in baseObj: if child.elementType != 'namespace': continue #print "GetRef(%s): CHecking namepsace: %s" % (str, child.name) ret = self._SearchNamespaces(child, name, childAttr) if ret: #print "GetRef(%s) Found part %s in namespace" % (str, name) baseObj = ret found = True isTopName = False if not found: raise PeachException("Unable to resolve reference: %s" % origStr) return baseObj def _SearchNamespaces(self, obj, name, attr): """ Used by GetRef to search across namespaces """ #print "_SearchNamespaces(%s, %s)" % (obj.name, name) #print "dir(obj): ", dir(obj) # Namespaces are stuffed under this variable # if we have it we should be it :) if hasattr(obj, 'ns'): obj = obj.ns if hasattr(obj, name): return getattr(obj, name) elif hasattr(obj, attr) and hasattr(getattr(obj, attr), name): return getattr(getattr(obj, attr), name) for child in obj: if child.elementType != 'namespace': continue ret = self._SearchNamespaces(child, name, attr) if ret is not None: return ret return None def GetDataRef(self, str): """ Get the data object indicated by ref. Currently the object must have been defined prior to this point in the XML. """ origStr = str baseObj = self.context # Parse out a namespace if str.find(":") > -1: ns, tmp = str.split(':') str = tmp #print "GetRef(): Found namepsace:",ns # Check for namespace if hasattr(self.context.namespaces, ns): baseObj = getattr(self.context.namespaces, ns) else: raise PeachException("Unable to locate namespace") for name in str.split('.'): # check base obj if hasattr(baseObj, name): baseObj = getattr(baseObj, name) # check templates elif hasattr(baseObj, 'data') and hasattr(baseObj.data, name): baseObj = getattr(baseObj.data, name) else: raise PeachException("Could not resolve ref '%s'" % origStr) return baseObj _regsHex = ( re.compile(r"^([,\s]*\\x([a-zA-Z0-9]{2})[,\s]*)"), re.compile(r"^([,\s]*%([a-zA-Z0-9]{2})[,\s]*)"), re.compile(r"^([,\s]*0x([a-zA-Z0-9]{2})[,\s]*)"), re.compile(r"^([,\s]*x([a-zA-Z0-9]{2})[,\s]*)"), re.compile(r"^([,\s]*([a-zA-Z0-9]{2})[,\s]*)") ) def GetValueFromNode(self, node): value = None type = 'string' if node.get('valueType') is not None: type = self._getAttribute(node, 'valueType') if not (type == 'literal' or type == 'hex'): type = 'string' if node.get('value') is not None: value = self._getAttribute(node, 'value') # Convert variouse forms of hex into a binary string if type == 'hex': if len(value) == 1: value = "0" + value ret = '' valueLen = len(value) + 1 while valueLen > len(value): valueLen = len(value) for i in range(len(self._regsHex)): match = self._regsHex[i].search(value) if match is not None: while match is not None: ret += chr(int(match.group(2), 16)) value = self._regsHex[i].sub('', value) match = self._regsHex[i].search(value) break return ret elif type == 'literal': return eval(value) if value is not None and (type == 'string' or node.get('valueType') is None): value = re.sub(r"([^\\])\\n", r"\1\n", value) value = re.sub(r"([^\\])\\r", r"\1\r", value) value = re.sub(r"([^\\])\\t", r"\1\t", value) value = re.sub(r"([^\\])\\n", r"\1\n", value) value = re.sub(r"([^\\])\\r", r"\1\r", value) value = re.sub(r"([^\\])\\t", r"\1\t", value) value = re.sub(r"^\\n", r"\n", value) value = re.sub(r"^\\r", r"\r", value) value = re.sub(r"^\\t", r"\t", value) value = re.sub(r"\\\\", r"\\", value) return value def GetValueFromNodeString(self, node): """ This one is specific to <String> elements. We want to preserve unicode characters. """ value = None type = 'string' if node.get('valueType') is not None: type = self._getAttribute(node, 'valueType') if not type in ['literal', 'hex', 'string']: raise PeachException("Error: [%s] has invalid valueType attribute." % node.getFullname()) if node.get('value') is not None: value = node.get('value') # Convert variouse forms of hex into a binary string if type == 'hex': value = str(value) if len(value) == 1: value = "0" + value ret = '' valueLen = len(value) + 1 while valueLen > len(value): valueLen = len(value) for i in range(len(self._regsHex)): match = self._regsHex[i].search(value) if match is not None: while match is not None: ret += chr(int(match.group(2), 16)) value = self._regsHex[i].sub('', value) match = self._regsHex[i].search(value) break return ret elif type == 'literal': value = eval(value) if value is not None and type == 'string': value = re.sub(r"([^\\])\\n", r"\1\n", value) value = re.sub(r"([^\\])\\r", r"\1\r", value) value = re.sub(r"([^\\])\\t", r"\1\t", value) value = re.sub(r"([^\\])\\n", r"\1\n", value) value = re.sub(r"([^\\])\\r", r"\1\r", value) value = re.sub(r"([^\\])\\t", r"\1\t", value) value = re.sub(r"^\\n", r"\n", value) value = re.sub(r"^\\r", r"\r", value) value = re.sub(r"^\\t", r"\t", value) value = re.sub(r"\\\\", r"\\", value) return value def GetValueFromNodeNumber(self, node): value = None type = 'string' if node.get('valueType') is not None: type = self._getAttribute(node, 'valueType') if not type in ['literal', 'hex', 'string']: raise PeachException("Error: [%s] has invalid valueType attribute." % node.getFullname()) if node.get('value') is not None: value = self._getAttribute(node, 'value') # Convert variouse forms of hex into a binary string if type == 'hex': if len(value) == 1: value = "0" + value ret = '' valueLen = len(value) + 1 while valueLen > len(value): valueLen = len(value) for i in range(len(self._regsHex)): match = self._regsHex[i].search(value) if match is not None: while match is not None: ret += match.group(2) value = self._regsHex[i].sub('', value) match = self._regsHex[i].search(value) break return int(ret, 16) elif type == 'literal': value = eval(value) return value # Handlers for Template ################################################### def HandleTemplate(self, node, parent): """ Parse an element named Template. Can handle actual Template elements and also reference Template elements. e.g.: <Template name="Xyz"> ... </Template> or <Template ref="Xyz" /> """ template = None # ref if node.get('ref') is not None: # We have a base template obj = self.GetRef(self._getAttribute(node, 'ref')) template = obj.copy(parent) template.ref = self._getAttribute(node, 'ref') template.parent = parent else: template = Template(self._getAttribute(node, 'name')) template.ref = None template.parent = parent # name if node.get('name') is not None: template.name = self._getAttribute(node, 'name') template.elementType = 'template' # mutable mutable = self._getAttribute(node, 'mutable') if mutable is None or len(mutable) == 0: template.isMutable = True elif mutable.lower() == 'true': template.isMutable = True elif mutable.lower() == 'false': template.isMutable = False else: raise PeachException( "Attribute 'mutable' has unexpected value [%s], only 'true' and 'false' are supported." % mutable) # pointer pointer = self._getAttribute(node, 'pointer') if pointer is None: pass elif pointer.lower() == 'true': template.isPointer = True elif pointer.lower() == 'false': template.isPointer = False else: raise PeachException( "Attribute 'pointer' has unexpected value [%s], only 'true' and 'false' are supported." % pointer) # pointerDepth if node.get("pointerDepth") is not None: template.pointerDepth = self._getAttribute(node, 'pointerDepth') # children self.HandleDataContainerChildren(node, template) # Switch any references to old name if node.get('ref') is not None: oldName = self._getAttribute(node, 'ref') for relation in template._genRelationsInDataModelFromHere(): if relation.of == oldName: relation.of = template.name elif relation.From == oldName: relation.From = template.name #template.printDomMap() return template def HandleCommonTemplate(self, node, elem): """ Handle the common children of data elements like String and Number. """ elem.onArrayNext = self._getAttribute(node, "onArrayNext") for child in node: child_nodeName = split_ns(child.tag)[1] if child_nodeName == 'Relation': relation = self.HandleRelation(child, elem) elem.relations.append(relation) elif child_nodeName == 'Transformer': if elem.transformer is not None: raise PeachException("Error, data element [%s] already has a transformer." % elem.name) elem.transformer = self.HandleTransformer(child, elem) elif child_nodeName == 'Fixup': self.HandleFixup(child, elem) elif child_nodeName == 'Placement': self.HandlePlacement(child, elem) elif child_nodeName == 'Hint': self.HandleHint(child, elem) else: raise PeachException("Found unexpected child node '%s' in element '%s'." % (child_nodeName, elem.name)) def HandleTransformer(self, node, parent): """ Handle Transformer element """ transformer = Transformer(parent) childTransformer = None params = [] # class if node.get("class") is None: raise PeachException("Transformer element missing class attribute") generatorClass = self._getAttribute(node, "class") transformer.classStr = generatorClass # children for child in node.iterchildren(): child_nodeName = split_ns(child.tag)[1] if child_nodeName == 'Transformer': if childTransformer is not None: raise PeachException("A transformer can only have one child transformer") childTransformer = self.HandleTransformer(child, transformer) continue if child_nodeName == 'Param': param = self.HandleParam(child, transformer) transformer.append(param) params.append([param.name, param.defaultValue]) code = "PeachXml_" + generatorClass + '(' isFirst = True for param in params: if not isFirst: code += ', ' else: isFirst = False code += PeachStr(param[1]) code += ')' trans = eval(code, globals(), locals()) if childTransformer is not None: trans.addTransformer(childTransformer.transformer) transformer.transformer = trans if parent is not None: parent.transformer = transformer transformer.parent = parent #parent.append(transformer) return transformer def HandleDefaults(self, node, parent): """ Handle data element defaults """ # children for child in node.iterchildren(): child_nodeName = split_ns(child.tag)[1] if child_nodeName == 'Blob': if child.get('valueType') is not None: Blob.defaultValueType = self._getAttribute(child, 'valueType') if Blob.defaultValueType not in ['string', 'literal', 'hex']: raise PeachException("Error, default value for Blob.valueType incorrect.") if child.get('lengthType') is not None: Blob.defaultLengthType = self._getAttribute(child, 'lengthType') if Blob.defaultLengthType not in ['string', 'literal', 'calc']: raise PeachException("Error, default value for Blob.lengthType incorrect.") elif child_nodeName == 'Flags': if child.get('endian') is not None: Flags.defaultEndian = self._getAttribute(child, 'endian') if Flags.defaultEndian not in ['little', 'big', 'network']: raise PeachException("Error, default value for Flags.endian incorrect.") elif child_nodeName == 'Number': if child.get('endian') is not None: Number.defaultEndian = self._getAttribute(child, 'endian') if Number.defaultEndian not in ['little', 'big', 'network']: raise PeachException("Error, default value for Number.endian incorrect.") if child.get('size') is not None: Number.defaultSize = int(self._getAttribute(child, 'size')) if Number.defaultSize not in Number._allowedSizes: raise PeachException("Error, default value for Number.size incorrect.") if child.get('signed') is not None: Number.defaultSigned = self._getAttribute(child, 'signed') if Number.defaultSigned not in ['true', 'false']: raise PeachException("Error, default value for Number.signed incorrect.") if Number.defaultSigned == 'true': Number.defaultSigned = True else: Number.defaultSigned = False if child.get('valueType') is not None: Number.defaultValueType = self._getAttribute(child, 'valueType') if Number.defaultValueType not in ['string', 'literal', 'hex']: raise PeachException("Error, default value for Number.valueType incorrect.") elif child_nodeName == 'String': if child.get('valueType') is not None: String.defaultValueType = self._getAttribute(child, 'valueType') if String.defaultValueType not in ['string', 'literal', 'hex']: raise PeachException("Error, default value for String.valueType incorrect.") if child.get('lengthType') is not None: String.defaultLengthType = self._getAttribute(child, 'lengthType') if String.defaultLengthType not in ['string', 'literal', 'calc']: raise PeachException("Error, default value for String.lengthType incorrect.") if child.get('padCharacter') is not None: String.defaultPadCharacter = child.get('padCharacter') if child.get('type') is not None: String.defaultType = self._getAttribute(child, 'type') if String.defaultType not in ['wchar', 'char', 'utf8']: raise PeachException("Error, default value for String.type incorrect.") if child.get('nullTerminated') is not None: String.defaultNullTerminated = self._getAttribute(child, 'nullTerminated') if String.defaultNullTerminated not in ['true', 'false']: raise PeachException("Error, default value for String.nullTerminated incorrect.") if String.defaultNullTerminated == 'true': String.defaultNullTerminated = True else: String.defaultNullTerminated = False def HandleFixup(self, node, parent): """ Handle Fixup element """ fixup = Fixup(parent) params = [] # class if node.get("class") is None: raise PeachException("Fixup element missing class attribute") fixup.classStr = self._getAttribute(node, "class") # children for child in node.iterchildren(): if split_ns(child.tag)[1] == 'Param': param = self.HandleParam(child, fixup) fixup.append(param) params.append([param.name, param.defaultValue]) code = "PeachXml_" + fixup.classStr + '(' isFirst = True for param in params: if not isFirst: code += ', ' else: isFirst = False code += PeachStr(param[1]) code += ')' fixup.fixup = eval(code, globals(), locals()) if parent is not None: if parent.fixup is not None: raise PeachException("Error, data element [%s] already has a fixup." % parent.name) parent.fixup = fixup return fixup def HandlePlacement(self, node, parent): """ Handle Placement element """ placement = Placement(parent) placement.after = self._getAttribute(node, "after") placement.before = self._getAttribute(node, "before") if placement.after is None and placement.before is None: raise PeachException("Error: Placement element must have an 'after' or 'before' attribute.") if placement.after is not None and placement.before is not None: raise PeachException("Error: Placement can only have one of 'after' or 'before' but not both.") if parent is not None: if parent.placement is not None: raise PeachException("Error, data element [%s] already has a placement." % parent.name) #print "Setting placement on",parent.name parent.placement = placement #parent.append(placement) return placement def HandleRelation(self, node, elem): if node.get("type") is None: raise PeachException("Relation element does not have type attribute") type = self._getAttribute(node, "type") of = self._getAttribute(node, "of") From = self._getAttribute(node, "from") name = self._getAttribute(node, "name") when = self._getAttribute(node, "when") expressionGet = self._getAttribute(node, "expressionGet") expressionSet = self._getAttribute(node, "expressionSet") relative = self._getAttribute(node, "relative") if of is None and From is None and when is None: raise PeachException("Relation element does not have of, from, or when attribute.") if type not in ['size', 'count', 'index', 'when', 'offset']: raise PeachException("Unknown type value in Relation element") relation = Relation(name, elem) relation.of = of relation.From = From relation.type = type relation.when = when relation.expressionGet = expressionGet relation.expressionSet = expressionSet if self._getAttribute(node, "isOutputOnly") is not None and self._getAttribute(node, "isOutputOnly") in ["True", "true"]: relation.isOutputOnly = True if relative is not None: if relative.lower() in ["true", "1"]: relation.relative = True relation.relativeTo = self._getAttribute(node, "relativeTo") elif relative.lower() in ["false", "0"]: relation.relative = False relation.relativeTo = None else: raise PeachException("Error: Value of Relation relative attribute is not true or false.") return relation def HandleAnalyzerTopLevel(self, node, elem): if node.get("class") is None: raise PeachException("Analyzer element must have a 'class' attribute") # Locate any arguments args = {} for child in node.iterchildren(): if split_ns(child.tag)[1] == 'Param' and child.get('name') is not None: args[self._getAttribute(child, 'name')] = self._getAttribute(child, 'value') cls = self._getAttribute(node, "class") try: obj = eval("%s()" % cls) except: raise PeachException("Error creating analyzer '%s': %s" % (obj, repr(sys.exc_info()))) if not obj.supportTopLevel: raise PeachException("Analyzer '%s' does not support use as top-level element" % cls) obj.asTopLevel(self.context, args) def HandleCommonDataElementAttributes(self, node, element): """ Handle attributes common to all DataElements such as: - minOccurs, maxOccurs - mutable - isStatic - constraint - pointer - pointerDepth - token """ # min/maxOccurs self._HandleOccurs(node, element) # isStatic/token isStatic = self._getAttribute(node, 'isStatic') if isStatic is None: isStatic = self._getAttribute(node, 'token') if isStatic is None or len(isStatic) == 0: element.isStatic = False elif isStatic.lower() == 'true': element.isStatic = True elif isStatic.lower() == 'false': element.isStatic = False else: if node.get("isStatic") is not None: raise PeachException( "Attribute 'isStatic' has unexpected value [%s], only 'true' and 'false' are supported." % isStatic) else: raise PeachException( "Attribute 'token' has unexpected value [%s], only 'true' and 'false' are supported." % isStatic) # mutable mutable = self._getAttribute(node, 'mutable') if mutable is None or len(mutable) == 0: element.isMutable = True elif mutable.lower() == 'true': element.isMutable = True elif mutable.lower() == 'false': element.isMutable = False else: raise PeachException( "Attribute 'mutable' has unexpected value [%s], only 'true' and 'false' are supported." % mutable) # pointer pointer = self._getAttribute(node, 'pointer') if pointer is None: pass elif pointer.lower() == 'true': element.isPointer = True elif pointer.lower() == 'false': element.isPointer = False else: raise PeachException( "Attribute 'pointer' has unexpected value [%s], only 'true' and 'false' are supported." % pointer) # pointerDepth if node.get("pointerDepth") is not None: element.pointerDepth = self._getAttribute(node, 'pointerDepth') # constraint element.constraint = self._getAttribute(node, "constraint") def _HandleOccurs(self, node, element): """ Grab min, max, and generated Occurs attributes """ if node.get('generatedOccurs') is not None: element.generatedOccurs = self._getAttribute(node, 'generatedOccurs') else: element.generatedOccurs = 10 occurs = self._getAttribute(node, 'occurs') minOccurs = self._getAttribute(node, 'minOccurs') maxOccurs = self._getAttribute(node, 'maxOccurs') if minOccurs is None: minOccurs = 1 else: minOccurs = eval(minOccurs) if maxOccurs is None: maxOccurs = 1 else: maxOccurs = eval(maxOccurs) if minOccurs is not None and maxOccurs is not None: element.minOccurs = int(minOccurs) element.maxOccurs = int(maxOccurs) elif minOccurs is not None and maxOccurs is None: element.minOccurs = int(minOccurs) element.maxOccurs = 1024 elif maxOccurs is not None and minOccurs is None: element.minOccurs = 0 element.maxOccurs = int(maxOccurs) else: element.minOccurs = 1 element.maxOccurs = 1 if occurs is not None: element.occurs = element.minOccurs = element.maxOccurs = int(occurs) def HandleBlock(self, node, parent): # name if node.get('name') is not None: name = self._getAttribute(node, 'name') else: name = None # ref if node.get('ref') is not None: oldName = self._getAttribute(node, "ref") if name is None or len(name) == 0: name = Element.getUniqueName() # We have a base template obj = self.GetRef(self._getAttribute(node, 'ref'), parent) block = obj.copy(parent) block.name = name block.parent = parent block.ref = self._getAttribute(node, 'ref') # Block may not be a block! if getattr(block, 'toXml', None) is None: block.toXml = new_instancemethod(dom.Block.toXml, block) block.elementType = 'block' else: block = dom.Block(name, parent) block.ref = None #block.node = node # length (in bytes) if node.get('lengthType') is not None and self._getAttribute(node, 'lengthType') == 'calc': block.lengthType = self._getAttribute(node, 'lengthType') block.lengthCalc = self._getAttribute(node, 'length') block.length = -1 elif node.get('length') is not None: length = self._getAttribute(node, 'length') if length is not None and len(length) != 0: block.length = int(length) else: block.length = None # alignment try: alignment = self._getAttribute(node, 'alignment') if len(alignment) == 0: alignment = None except: alignment = None if alignment is not None: block.isAligned = True block.alignment = int(alignment) ** 2 # common attributes self.HandleCommonDataElementAttributes(node, block) # children self.HandleDataContainerChildren(node, block) # Switch any references to old name if node.get('ref') is not None: for relation in block._genRelationsInDataModelFromHere(): if relation.of == oldName: relation.of = name elif relation.From == oldName: relation.From = name # Add to parent parent.append(block) return block def HandleDataContainerChildren(self, node, parent, errorOnUnknown=True): """ Handle parsing conatiner children. This method will handle children of DataElement types for containers like Block, Choice, and Template. Can be used by Custom types to create Custom container types. @type node: XML Element @param node: Current XML Node being handled @type parent: ElementWithChildren @param parent: Parent of this DataElement @type errorOnUnknown: Boolean @param errorOnUnknonw: Should we throw an error on unexpected child node (default True) """ # children for child in node.iterchildren(): name = self._getAttribute(child, 'name') if name is not None and '.' in name: # Replace a deep node, can only happen if we # have a ref on us. if node.get('ref') is None: raise PeachException( "Error, periods (.) are not allowed in element names unless overrideing deep elements when a parent reference (ref). Name: [%s]" % name) # Okay, lets locate the real parent. obj = parent for part in name.split('.')[:-1]: if part not in obj: raise PeachException( "Error, unable to resolve [%s] in deep parent of [%s] override." % (part, name)) obj = obj[part] if obj is None: raise PeachException("Error, unable to resolve deep parent of [%s] override." % name) # Remove periods from name child.set('name', name.split('.')[-1]) # Handle child with new parent. self._HandleDataContainerChildren(node, child, obj, errorOnUnknown) else: self._HandleDataContainerChildren(node, child, parent, errorOnUnknown) def _HandleDataContainerChildren(self, node, child, parent, errorOnUnknown=True): node_nodeName = split_ns(node.tag)[1] child_nodeName = split_ns(child.tag)[1] if child_nodeName == 'Block': self.HandleBlock(child, parent) elif child_nodeName == 'String': self.HandleString(child, parent) elif child_nodeName == 'Number': self.HandleNumber(child, parent) elif child_nodeName == 'Flags': self.HandleFlags(child, parent) elif child_nodeName == 'Flag': self.HandleFlag(child, parent) elif child_nodeName == 'Blob': self.HandleBlob(child, parent) elif child_nodeName == 'Choice': self.HandleChoice(child, parent) elif child_nodeName == 'Transformer': parent.transformer = self.HandleTransformer(child, parent) elif child_nodeName == 'Relation': relation = self.HandleRelation(child, parent) parent.relations.append(relation) elif child_nodeName == 'Fixup': self.HandleFixup(child, parent) elif child_nodeName == 'Placement': self.HandlePlacement(child, parent) elif child_nodeName == 'Hint': self.HandleHint(child, parent) elif child_nodeName == 'Seek': self.HandleSeek(child, parent) elif child_nodeName == 'Custom': self.HandleCustom(child, parent) elif child_nodeName == 'Asn1': self.HandleAsn1(child, parent) elif child_nodeName == 'XmlElement': # special XmlElement reference if child.get('ref') is not None: # This is our special case, if we ref we suck the children # of the ref into our selves. This is tricky! # get and copy our ref obj = self.GetRef(self._getAttribute(child, 'ref'), parent.parent) newobj = obj.copy(parent) newobj.parent = None # first verify all children are XmlElement or XmlAttribute for subchild in newobj: if not isinstance(subchild, XmlElement) and not isinstance(subchild, XmlAttribute): raise PeachException( "Error, special XmlElement ref case, reference must only have Xml elements!! (%s,%s,%s)" % ( subchild.parent.name, subchild.name, subchild)) # now move over children for subchild in newobj: parent.append(subchild) # remove replaced element if self._getAttribute(child, 'name') in parent: del parent[self._getAttribute(child, 'name')] else: self.HandleXmlElement(child, parent) elif child_nodeName == 'XmlAttribute': self.HandleXmlAttribute(child, parent) elif errorOnUnknown: raise PeachException( PeachStr("found unexpected node [%s] in Element: %s" % (child_nodeName, node_nodeName))) def HandleMutators(self, node, parent): # name name = self._getAttribute(node, 'name') mutators = dom.Mutators(name, parent) # children for child in node.iterchildren(): child_nodeName = split_ns(child.tag)[1] if child_nodeName != 'Mutator': raise PeachException(PeachStr("Found unexpected node in Mutators element: %s" % child_nodeName)) if child.get('class') is None: raise PeachException("Mutator element does not have required class attribute") mutator = Mutator(self._getAttribute(child, 'class'), mutators) mutators.append(mutator) parent.append(mutators) return mutators def HandleChoice(self, node, parent): # name name = self._getAttribute(node, 'name') # ref if node.get('ref') is not None: if name is None or len(name) == 0: name = Element.getUniqueName() # We have a base template obj = self.GetRef(self._getAttribute(node, 'ref'), parent) #print "About to deep copy: ", obj, " for ref: ", self._getAttribute(node, 'ref') block = obj.copy(parent) block.name = name block.parent = parent block.ref = self._getAttribute(node, 'ref') else: block = Choice(name, parent) block.ref = None block.elementType = 'choice' # length (in bytes) if self._getAttribute(node, 'lengthType') == 'calc': block.lengthType = self._getAttribute(node, 'lengthType') block.lengthCalc = self._getAttribute(node, 'length') block.length = -1 elif node.get('length') is not None: length = self._getAttribute(node, 'length') if length is not None and len(length) != 0: block.length = int(length) else: block.length = None # common attributes self.HandleCommonDataElementAttributes(node, block) # children self.HandleDataContainerChildren(node, block) parent.append(block) return block def HandleAsn1(self, node, parent): # name name = self._getAttribute(node, 'name') # ref if node.get('ref') is not None: raise PeachException("Asn1 element does not yet support ref!") # #if name == None or len(name) == 0: # name = Element.getUniqueName() # ## We have a base template #obj = self.GetRef( self._getAttribute(node, 'ref'), parent ) # ##print "About to deep copy: ", obj, " for ref: ", self._getAttribute(node, 'ref') # #block = obj.copy(parent) #block.name = name #block.parent = parent #block.ref = self._getAttribute(node, 'ref') else: block = Asn1Type(name, parent) block.ref = None # encode type if node.get("encode"): block.encodeType = node.get("encode") # asn1Type if node.get("type") is None: raise PeachException("Error, all Asn1 elements must have 'type' attribute.") block.asn1Type = node.get("type") # Tag Stuff if node.get("tagNumber") is not None: try: block.tagClass = Asn1Type.ASN1_TAG_CLASS_MAP[self._getAttribute(node, "tagClass").lower()] block.tagFormat = Asn1Type.ASN1_TAG_TYPE_MAP[self._getAttribute(node, "tagFormat").lower()] block.tagCategory = self._getAttribute(node, "tagCategory").lower() block.tagNumber = int(self._getAttribute(node, "tagNumber")) except: raise PeachException( "Error, When using tags you must specify 'tagClass', 'tagFormat', 'tagCategory', and 'tagNumber'.") # common attributes self.HandleCommonDataElementAttributes(node, block) # children self.HandleDataContainerChildren(node, block) parent.append(block) return block def HandleXmlElement(self, node, parent): # name name = self._getAttribute(node, 'name') block = XmlElement(name, parent) # elementName block.elementName = self._getAttribute(node, "elementName") if block.elementName is None: raise PeachException("Error: XmlElement without elementName attribute.") # ns block.xmlNamespace = self._getAttribute(node, "ns") # length (in bytes) if self._getAttribute(node, 'lengthType') == 'calc': block.lengthType = self._getAttribute(node, 'lengthType') block.lengthCalc = self._getAttribute(node, 'length') block.length = -1 elif node.get('length') is not None: length = self._getAttribute(node, 'length') if length is not None and len(length) != 0: block.length = int(length) else: block.length = None # common attributes self.HandleCommonDataElementAttributes(node, block) # children self.HandleDataContainerChildren(node, block) parent.append(block) return block def HandleXmlAttribute(self, node, parent): # name name = self._getAttribute(node, 'name') block = XmlAttribute(name, parent) # elementName block.attributeName = self._getAttribute(node, "attributeName") # ns block.xmlNamespace = self._getAttribute(node, "ns") # length (in bytes) if self._getAttribute(node, 'lengthType') == 'calc': block.lengthType = self._getAttribute(node, 'lengthType') block.lengthCalc = self._getAttribute(node, 'length') block.length = -1 elif node.get('length') is not None: length = self._getAttribute(node, 'length') if length is not None and len(length) != 0: block.length = int(length) else: block.length = None # common attributes self.HandleCommonDataElementAttributes(node, block) # children self.HandleDataContainerChildren(node, block) parent.append(block) return block def _getAttribute(self, node, name): attr = node.get(name) if attr is None: return None return PeachStr(attr) def _getValueType(self, node): valueType = self._getAttribute(node, 'valueType') if valueType is None: return 'string' return valueType def HandleString(self, node, parent): # name name = self._getAttribute(node, 'name') string = String(name, parent) # value string.defaultValue = self.GetValueFromNodeString(node) string.valueType = self._getValueType(node) string.defaultValue = self._HandleValueTypeString(string.defaultValue, string.valueType) # tokens string.tokens = self._getAttribute(node, 'tokens') # padCharacter if node.get('padCharacter') is not None: val = node.get('padCharacter') val = val.replace("'", "\\'") string.padCharacter = eval("u'''" + val + "'''") # type if node.get('type') is not None: type = self._getAttribute(node, 'type') if type is None or len(type) == 0: string.type = 'char' elif not (type in ['char', 'wchar', 'utf8', 'utf-8', 'utf-16le', 'utf-16be']): raise PeachException("Unknown type of String: %s" % type) else: string.type = type # nullTerminated (optional) if node.get('nullTerminated') is not None: nullTerminated = self._getAttribute(node, 'nullTerminated') if nullTerminated is None or len(nullTerminated) == 0: nullTerminated = 'false' if nullTerminated.lower() == 'true': string.nullTerminated = True elif nullTerminated.lower() == 'false': string.nullTerminated = False else: raise PeachException("nullTerminated should be true or false") # length (bytes) if self._getAttribute(node, 'lengthType') == 'calc': string.lengthType = self._getAttribute(node, 'lengthType') string.lengthCalc = self._getAttribute(node, 'length') string.length = -1 elif node.get('length') is not None: length = self._getAttribute(node, 'length') if length is None or len(length) == 0: length = None try: if length is not None: string.length = int(length) else: string.length = None except: raise PeachException("length must be a number or missing %s" % length) # Analyzer string.analyzer = self._getAttribute(node, 'analyzer') # common attributes self.HandleCommonDataElementAttributes(node, string) # Handle any common children self.HandleCommonTemplate(node, string) parent.append(string) return string def HandleNumber(self, node, parent): # name name = self._getAttribute(node, 'name') number = Number(name, parent) # value number.defaultValue = PeachStr(self.GetValueFromNodeNumber(node)) number.valueType = self._getValueType(node) if number.defaultValue is not None: try: number.defaultValue = int(number.defaultValue) except: raise PeachException("Error: The default value for <Number> elements must be an integer.") # size (bits) if node.get('size') is not None: size = self._getAttribute(node, 'size') if size is None: raise PeachException( "Number element %s is missing the 'size' attribute which is required." % number.name) number.size = int(size) if not number.size in number._allowedSizes: raise PeachException("invalid size") # endian (optional) if node.get('endian') is not None: number.endian = self._getAttribute(node, 'endian') if number.endian == 'network': number.endian = 'big' if number.endian != 'little' and number.endian != 'big': raise PeachException("invalid endian %s" % number.endian) # signed (optional) if node.get('signed') is not None: signed = self._getAttribute(node, 'signed') if signed is None or len(signed) == 0: signed = Number.defaultSigned if signed.lower() == 'true': number.signed = True elif signed.lower() == 'false': number.signed = False else: raise PeachException("signed must be true or false") # common attributes self.HandleCommonDataElementAttributes(node, number) # Handle any common children self.HandleCommonTemplate(node, number) parent.append(number) return number def HandleFlags(self, node, parent): name = self._getAttribute(node, 'name') flags = dom.Flags(name, parent) #flags.node = node # length (in bits) length = self._getAttribute(node, 'size') flags.length = int(length) if flags.length % 2 != 0: raise PeachException("length must be multiple of 2") if flags.length not in [8, 16, 24, 32, 64]: raise PeachException("Flags size must be one of 8, 16, 24, 32, or 64.") # endian if node.get('endian') is not None: flags.endian = self._getAttribute(node, 'endian') if not ( flags.endian == 'little' or flags.endian == 'big' ): raise PeachException("Invalid endian type on Flags element") # rightToLeft if node.get('rightToLeft') is not None: if self._getAttribute(node, 'rightToLeft').lower() == "true": flags.rightToLeft = True elif self._getAttribute(node, 'rightToLeft').lower() == "false": flags.rightToLeft = False else: raise PeachException("Flags attribute rightToLeft must be 'true' or 'false'.") # padding if node.get('padding') is not None: if self._getAttribute(node, 'padding').lower() == "true": flags.padding = True elif self._getAttribute(node, 'padding').lower() == "false": flags.padding = False else: raise PeachException("Flags attribute padding must be 'true' or 'false'.") # constraint flags.constraint = self._getAttribute(node, "constraint") # children for child in node.iterchildren(): child_nodeName = split_ns(child.tag)[1] if child_nodeName == 'Flag': childName = self._getAttribute(child, 'name') if childName is not None: if childName in flags: raise PeachException("Error, found duplicate Flag name in Flags set [%s]" % flags.name) self.HandleFlag(child, flags) elif child_nodeName == 'Relation': self.HandleRelation(child, flags) else: raise PeachException(PeachStr("found unexpected node in Flags: %s" % child_nodeName)) parent.append(flags) return flags def HandleFlag(self, node, parent): name = self._getAttribute(node, 'name') flag = Flag(name, parent) #flag.node = node # value flag.defaultValue = PeachStr(self.GetValueFromNode(node)) flag.valueType = self._getValueType(node) # position (in bits) position = self._getAttribute(node, 'position') flag.position = int(position) # length (in bits) length = self._getAttribute(node, 'size') flag.length = int(length) if flag.position > parent.length: raise PeachException("Invalid position, parent not big enough") if flag.position + flag.length > parent.length: raise PeachException("Invalid length, parent not big enough") # Handle any common children self.HandleCommonTemplate(node, flag) # Handle common data elements attributes self.HandleCommonDataElementAttributes(node, flag) # rest parent.append(flag) return flag def HandleBlob(self, node, parent): name = self._getAttribute(node, 'name') blob = Blob(name, parent) # value blob.defaultValue = PeachStr(self.GetValueFromNode(node)) blob.valueType = self._getValueType(node) # length (in bytes) if self._getAttribute(node, 'lengthType') == 'calc': blob.lengthType = self._getAttribute(node, 'lengthType') blob.lengthCalc = self._getAttribute(node, 'length') blob.length = -1 elif node.get('length') is not None: length = self._getAttribute(node, 'length') if length is not None and len(length) != 0: blob.length = int(length) else: blob.length = None # padValue if node.get('padValue') is not None: blob.padValue = self._getAttribute(node, 'padValue') else: blob.padValue = "\0" # Analyzer blob.analyzer = self._getAttribute(node, 'analyzer') # common attributes self.HandleCommonDataElementAttributes(node, blob) # Handle any common children self.HandleCommonTemplate(node, blob) parent.append(blob) return blob def HandleCustom(self, node, parent): name = self._getAttribute(node, 'name') cls = self._getAttribute(node, 'class') code = "PeachXml_%s(name, parent)" % cls custom = eval(code, globals(), locals()) #custom.node = node # value custom.defaultValue = PeachStr(self.GetValueFromNode(node)) custom.valueType = self._getValueType(node) # Hex handled elsewere. if custom.valueType == 'literal': custom.defaultValue = PeachStr(eval(custom.defaultValue)) # common attributes self.HandleCommonDataElementAttributes(node, custom) # Handle any common children self.HandleCommonTemplate(node, custom) # constraint custom.constraint = self._getAttribute(node, "constraint") # Custom parsing custom.handleParsing(node) # Done parent.append(custom) return custom def HandleSeek(self, node, parent): """ Parse a <Seek> element, part of a data model. """ seek = Seek(None, parent) #seek.node = node seek.expression = self._getAttribute(node, 'expression') seek.position = self._getAttribute(node, 'position') seek.relative = self._getAttribute(node, 'relative') if seek.relative is not None: seek.relative = int(seek.relative) if seek.position is not None: seek.position = int(seek.position) if seek.expression is None and seek.position is None and seek.relative is None: raise PeachException("Error: <Seek> element must have an expression, position, or relative attribute.") parent.append(seek) return seek def HandleData(self, node, parent): # attribute: name name = self._getAttribute(node, 'name') # attribute: ref if node.get('ref') is not None: if name is None or not len(name): name = Element.getUniqueName() data = self.GetDataRef(self._getAttribute(node, 'ref')).copy(parent) data.name = name else: data = Data(name) if not isinstance(parent, Action) and (name is None or not len(name)): raise PeachException("<Data> must have a name attribute!") data.elementType = 'data' # attribute: maxFileSize if node.get('maxFileSize') is not None: data.maxFileSize = int(self._getAttribute(node, 'maxFileSize')) # attribute: fileName if node.get('fileName') is not None: data.fileName = self._getAttribute(node, 'fileName') if data.fileName.find('*') != -1: data.fileGlob = data.fileName for fpath in glob.glob(data.fileGlob): if data.is_valid(fpath): data.fileName = fpath data.multipleFiles = True elif os.path.isdir(data.fileName): data.folderName = data.fileName for fname in os.listdir(data.folderName): fpath = os.path.join(data.folderName, fname) if data.is_valid(fpath): data.fileName = fpath data.multipleFiles = True if not os.path.isfile(data.fileName): raise PeachException("No sample data found matching requirements of <Data> element.") # attribute: recurse if node.get('recurse') is not None: data.recurse = bool(self._getAttribute(node, 'recurse')) # attribute: switchCount if node.get('switchCount') is not None: data.switchCount = int(self._getAttribute(node, 'switchCount')) else: data.switchCount = None # attribute: expression if node.get('expression') is not None: if data.fileName is not None: raise PeachException("<Data> can not have both a fileName and expression attribute.") data.expression = self._getAttribute(node, 'expression') # children for child in node.iterchildren(): child_nodeName = split_ns(child.tag)[1] if child_nodeName == 'Field': if data.fileName is not None or data.expression is not None: raise PeachException("<Data> can not have a fileName or expression attribute along with Field " "child elements.") self.HandleField(child, data) else: raise PeachException("Found unexpected node inside <Data>: %s" % child_nodeName) return data def HandleField(self, node, parent): # name if node.get('name') is None: raise PeachException("No attribute name found on field element") name = self._getAttribute(node, 'name') # value if node.get('value') is None: raise PeachException("No attribute value found on Field element") value = self._getAttribute(node, 'value') field = Field(name, value, parent) field.value = PeachStr(self.GetValueFromNode(node)) field.valueType = self._getValueType(node) if field.name in parent: parent[field.name] = field else: parent.append(field) return field # Handlers for Agent ################################################### def HandleAgent(self, node, parent): # name name = self._getAttribute(node, 'name') # ref if node.get('ref') is not None: if name is None or len(name) == 0: name = Element.getUniqueName() obj = self.GetRef(self._getAttribute(node, 'ref')) agent = obj.copy(parent) agent.name = name agent.ref = self._getAttribute(node, 'ref') else: agent = Agent(name, parent) #agent.node = node agent.description = self._getAttribute(node, 'description') agent.location = self._getAttribute(node, 'location') if agent.location is None or len(agent.location) == 0: agent.location = "LocalAgent" #raise PeachException("Error: Agent definition must include location attribute.") agent.password = self._getAttribute(node, 'password') if agent.password is not None and len(agent.password) == 0: agent.password = None for child in node.iterchildren(): child_nodeName = split_ns(child.tag)[1] if child_nodeName == 'Monitor': if not self._getBooleanAttribute(child, "enabled"): logging.info('Monitor "%s" is deactivated.' % self._getAttribute(child, "class")) continue if child.get("platform") is not None: validOS = [x for x in self._getAttribute(child, "platform").split(",") if x == sys.platform] if not validOS: logging.debug('Monitor "%s" for %s is not supported on this platform.' % (self._getAttribute(child, "class"), self._getAttribute(child, "platform"))) continue agent.append(self.HandleMonitor(child, agent)) logging.info('Monitor "%s" attached.' % self._getAttribute(child, "class")) elif child_nodeName == 'PythonPath': p = self.HandlePythonPath(child, agent) agent.append(p) elif child_nodeName == 'Import': p = self.HandleImport(child, agent) agent.append(p) else: raise PeachException("Found unexpected child of Agent element") ## A remote publisher might be in play #if len(agent) < 1: # raise Exception("Agent must have at least one Monitor child.") return agent def HandleMonitor(self, node, parent): """ Handle Monitor element """ name = self._getAttribute(node, 'name') monitor = Monitor(name, parent) # class if node.get("class") is None: raise PeachException("Monitor element missing class attribute") monitor.classStr = self._getAttribute(node, "class") # children for child in node.iterchildren(): child_nodeName = split_ns(child.tag)[1] if not child_nodeName == 'Param': raise PeachException(PeachStr("Unexpected Monitor child node: %s" % child_nodeName)) param = self.HandleParam(child, parent) monitor.params[param.name] = param.defaultValue return monitor # Handlers for Test ################################################### def HandleTest(self, node, parent): # name name = self._getAttribute(node, 'name') # ref if node.get('ref') is not None: if name is None or len(name) == 0: name = Element.getUniqueName() obj = self.GetRef(self._getAttribute(node, 'ref'), None, 'tests') test = obj.copy(parent) test.name = name test.ref = self._getAttribute(node, 'ref') else: test = Test(name, parent) #test.node = node if node.get('description') is not None: test.description = self._getAttribute(node, 'description') test.mutators = None for child in node.iterchildren(): child_nodeName = split_ns(child.tag)[1] if child_nodeName == 'Publisher': if not test.publishers: test.publishers = [] pub = self.HandlePublisher(child, test) test.publishers.append(pub) test.append(pub.domPublisher) elif child_nodeName == 'Agent': if child.get('ref') is not None: agent = self.GetRef(self._getAttribute(child, 'ref'), None, 'agents') if agent is None: raise PeachException(PeachStr("Unable to locate agent %s specified in Test element %s" % ( self._getAttribute(child, 'ref'), name))) test.append(agent.copy(test)) elif child_nodeName == 'StateMachine' or child_nodeName == 'StateModel': if child.get('ref') is None: raise PeachException("StateMachine element in Test declaration must have a ref attribute.") stateMachine = self.GetRef(self._getAttribute(child, 'ref'), None, 'children') if stateMachine is None: raise PeachException("Unable to locate StateMachine [%s] specified in Test [%s]" % ( str(self._getAttribute(child, 'ref')), name)) #print "*** StateMachine: ", stateMachine test.stateMachine = stateMachine.copy(test) test.append(test.stateMachine) path = None for child2 in child.iterchildren(): child2_nodeName = split_ns(child.tag)[1] if child2_nodeName == 'Path': path = self.HandlePath(child2, test.stateMachine) test.stateMachine.append(path) elif child2_nodeName == 'Stop': if path is None: raise PeachException("Stop element must be used after a Path element.") path.stop = True # Do not accept anything after Stop element ;) break elif child2_nodeName == 'Strategy': strategy = self.HandleStrategy(child2, test.stateMachine) test.stateMachine.append(strategy) else: raise PeachException("Unexpected node %s" % child2_nodeName) elif child_nodeName == 'Mutator': if child.get('class') is None: raise PeachException("Mutator element does not have required class attribute") mutator = Mutator(self._getAttribute(child, 'class'), test) if not test.mutators: test.mutators = Mutators(None, test) mutator.parent = test.mutators test.mutators.append(mutator) elif child_nodeName == 'Include' or child_nodeName == 'Exclude': self._HandleIncludeExclude(child, test) elif child_nodeName == 'Strategy': if self._getBooleanAttribute(child, "enabled"): test.mutator = self.HandleFuzzingStrategy(child, test) else: raise PeachException("Found unexpected child of Test element") if test.mutator is None: test.mutator = MutationStrategy.DefaultStrategy(None, test) if test.mutators is None: # Add the default mutators instead of erroring out test.mutators = self._locateDefaultMutators() if test.template is None and test.stateMachine is None: raise PeachException(PeachStr("Test %s does not have a Template or StateMachine defined" % name)) if len(test.publishers) == 0: raise PeachException(PeachStr("Test %s does not have a publisher defined!" % name)) if test.template is not None and test.stateMachine is not None: raise PeachException(PeachStr( "Test %s has both a Template and StateMachine defined. Only one of them can be defined at a time." % name)) # Now mark Mutatable(being fuzzed) elements # instructing on inclusions/exlusions test.markMutatableElements(node) return test def HandleFuzzingStrategy(self, node, parent): """ Handle parsing <Strategy> element that is a child of <Test> """ # name name = self._getAttribute(node, 'name') # class cls = self._getAttribute(node, 'class') # TODO why does this not work? #return globals()["PeachXml_" + cls](node, parent) exec("strategy = PeachXml_%s(node, parent)" % cls) return strategy def HandlePath(self, node, parent): if node.get('ref') is None: raise PeachException("Parser: Test::StateModel::Path missing ref attribute") stateMachine = parent ref = self._getAttribute(node, 'ref') state = self.GetRef(ref, stateMachine, None) path = Path(ref, parent) for child in node.iterchildren(): child_nodeName = split_ns(child.tag)[1] if child_nodeName == 'Include' or child_nodeName == 'Exclude': self._HandleIncludeExclude(child, state) elif child_nodeName == 'Data': # Handle Data elements at Test-level data = self.HandleData(child, path) #data.node = child actions = [child for child in state if child.elementType == 'action'] for action in actions: cracker = DataCracker(action.getRoot()) cracker.optmizeModelForCracking(action.template) action.template.setDefaults(data, self.dontCrack) elif child_nodeName not in ['Mutator']: raise PeachException("Found unexpected child of Path element") return path def _HandleIncludeExclude(self, node, parent): ref = None isExclude = split_ns(node.tag)[1] != 'Exclude' if node.get('ref') is not None and node.get('xpath') is not None: raise PeachException("Include/Exclude node can only have one of either ref or xpath attributes.") if node.get('xpath') is not None: xpath = self._getAttribute(node, 'xpath') else: ref = None if node.get('ref') is not None: ref = self._getAttribute(node, 'ref').replace('.', '/') xpath = self._retrieveXPath(ref, node.getparent()) test = self._getTest(parent) test.mutatables.append([isExclude, xpath]) def _getTest(self, element): if element is None: return None if element.elementType == 'test': return element return self._getTest(element.parent) def _retrieveXPath(self, xpath, node): if split_ns(node.tag)[1] == 'Test': if xpath is None: return "//*" else: return "//%s" % xpath if node.get('ref') is None: raise PeachException("All upper elements must have a ref attribute. Cannot retrieve relative XPath.") ref = self._getAttribute(node, 'ref') if xpath is not None: xpath = ref + "/" + xpath else: xpath = ref return self._retrieveXPath(xpath, node.getparent()) def HandleStrategy(self, node, parent): # class if node.get("class") is None: raise PeachException("Strategy element missing class attribute") classStr = self._getAttribute(node, "class") strategy = Strategy(classStr, parent) # children for child in node.iterchildren(): child_nodeName = split_ns(child.tag)[1] if not child_nodeName == 'Param': raise PeachException(PeachStr("Unexpected Strategy child node: %s" % child_nodeName)) param = self.HandleParam(child, parent) strategy.params[param.name] = eval(param.defaultValue) return strategy def _locateDefaultMutators(self, obj=None): """ Look for a default set of mutators. We will follow this search pattern: 1. Look at our self (context) level 2. Look at our imported namespaces 3. Recerse into namespaces (sub namespaces, etc) This means a <Mutators> element in the top level XML file will get precidence over the defaults.xml file which is included into a namepsace. """ if obj is None: obj = self.context # First look at us if obj.mutators is not None: return obj.mutators # Now look at namespaces for n in obj: if n.elementType == 'namespace': if n.ns.mutators is not None: return n.ns.mutators # Now look inside namespace for n in obj: if n.elementType == 'namespace': m = self._locateDefaultMutators(n.ns) if m is not None: return m # YUCK raise PeachException("Could not locate default set of Mutators to use. Please fix this!") def HandleRun(self, node, parent): haveLogger = False # name name = None if node.get('name') is not None: name = self._getAttribute(node, 'name') run = Run(name, parent) #run.node = node run.description = self._getAttribute(node, 'description') if node.get('waitTime') is not None: run.waitTime = float(self._getAttribute(node, 'waitTime')) for child in node.iterchildren(): child_nodeName = split_ns(child.tag)[1] if child_nodeName == 'Test': test = None if child.get('ref') is not None: test = self.GetRef(self._getAttribute(child, 'ref'), None, 'tests') if test is None: raise PeachException( PeachStr("Unable to locate tests %s specified in Run element %s" % (testsName, name))) test = test.copy(run) run.tests.append(test) run.append(test) elif child_nodeName == 'Logger': if not self._getBooleanAttribute(child, "enabled"): continue loggerName = self._getAttribute(child, "class") try: logger = self.HandleLogger(child, run) except Exception as msg: logging.warning(highlight.warning("Unable to attach %s: %s" % (loggerName, msg))) continue logging.info('Logger "%s" attached.' % loggerName) run.append(logger) haveLogger = True else: raise PeachException("Found unexpected child of Run element") if len(run.tests) == 0: raise PeachException(PeachStr("Run %s does not have any tests defined!" % name)) if not haveLogger: logging.warning("Run '%s' does not have logging configured!" % name) return run def HandlePublisher(self, node, parent): params = [] publisher = Publisher() # class if node.get("class") is None: raise PeachException("Publisher element missing class attribute") if len(node.get("class")) == 0: raise PeachException("Publisher class attribute is empty") publisher.classStr = publisherClass = self._getAttribute(node, "class") if node.get("name") is not None: publisher.name = self._getAttribute(node, "name") # children for child in node.iterchildren(): child_nodeName = split_ns(child.tag)[1] if child.get("name") is None: raise PeachException("Publisher element missing name attribute") if child.get("value") is None: raise PeachException("Publisher element missing value attribute") if child.get("valueType") is None: valueType = "string" else: valueType = self._getAttribute(child, "valueType") name = self._getAttribute(child, "name") value = self._getAttribute(child, "value") param = Param(publisher) param.name = name param.defaultValue = PeachStr(value) param.valueType = valueType if valueType == 'string': # create a literal out of a string value value = "'''" + value + "'''" elif valueType == 'hex': ret = '' valueLen = len(value) + 1 while valueLen > len(value): valueLen = len(value) for i in range(len(self._regsHex)): match = self._regsHex[i].search(value) if match is not None: while match is not None: ret += '\\x' + match.group(2) value = self._regsHex[i].sub('', value) match = self._regsHex[i].search(value) break value = "'" + ret + "'" publisher.append(param) params.append([name, value]) code = "PeachXml_%s(%s)" % (publisherClass, ",".join(str(v) for _,v in params)) pub = eval(code, globals(), locals()) pub.domPublisher = publisher pub.parent = parent return pub def HandleLogger(self, node, parent): params = {} logger = Logger(parent) #logger.node = node # class if node.get("class") is None: raise PeachException("Logger element missing class attribute") logger.classStr = self._getAttribute(node, "class") # children for child in node.iterchildren(): child_nodeName = split_ns(child.tag)[1] if child.get("name") is None: raise PeachException("Logger element missing name attribute") if child.get("value") is None: raise PeachException("Logger element missing value attribute") if child.get("valueType") is None: valueType = "string" else: valueType = self._getAttribute(child, "valueType") name = self._getAttribute(child, "name") value = self._getAttribute(child, "value") param = Param(logger) param.name = name param.defaultValue = PeachStr(value) param.valueType = valueType if valueType == 'string': # create a literal out of a string value value = "'''" + value + "'''" elif valueType == 'hex': ret = '' valueLen = len(value) + 1 while valueLen > len(value): valueLen = len(value) for i in range(len(self._regsHex)): match = self._regsHex[i].search(value) if match is not None: while match is not None: ret += '\\x' + match.group(2) value = self._regsHex[i].sub('', value) match = self._regsHex[i].search(value) break value = "'" + ret + "'" #print "LoggeR: Adding %s:%s" % (PeachStr(name),PeachStr(value)) logger.append(param) params[PeachStr(name)] = PeachStr(value) code = "PeachXml_" + logger.classStr + '(params)' pub = eval(code) pub.domLogger = logger return pub def HandleStateMachine(self, node, parent): if node.get("name") is None: raise PeachException("Parser: StateMachine missing name attribute") if node.get('initialState') is None: raise PeachException("Parser: StateMachine missing initialState attribute") stateMachine = StateMachine(self._getAttribute(node, "name"), parent) stateMachine.initialState = self._getAttribute(node, 'initialState') stateMachine.onLoad = self._getAttribute(node, 'onLoad') for child in node.iterchildren(): child_nodeName = split_ns(child.tag)[1] if child_nodeName == 'State': state = self.HandleState(child, stateMachine) stateMachine.append(state) else: raise PeachException("Parser: StateMachine has unknown child [%s]" % PeachStr(child_nodeName)) return stateMachine def HandleState(self, node, parent): if node.get("name") is None: raise PeachException("Parser: State missing name attribute") state = State(self._getAttribute(node, 'name'), parent) state.onEnter = self._getAttribute(node, 'onEnter') state.onExit = self._getAttribute(node, 'onExit') foundAction = False for child in node.iterchildren(): child_nodeName = split_ns(child.tag)[1] if child_nodeName == 'Action': action = self.HandleAction(child, state) if action.name in state: raise PeachException("Found duplicate Action name [%s]!" % action.name) state.append(action) foundAction = True elif child_nodeName == 'Choice': choice = self.HandleStateChoice(child, state) state.append(choice) else: raise PeachException("Parser: State has unknown child [%s]" % PeachStr(child_nodeName)) if not foundAction: raise PeachException("State [%s] has no actions" % state.name) return state def HandleStateChoice(self, node, parent): choice = StateChoice(parent) for child in node.iterchildren(): choice.append(self.HandleStateChoiceAction(child, node)) return choice def HandleStateChoiceAction(self, node, parent): if node.get("ref") is None: raise PeachException("Parser: State::Choice::Action missing ref attribute") if node.get("type") is None: raise PeachException("Parser: State::Choice::Action missing type attribute") ref = self._getAttribute(node, "ref") type = self._getAttribute(node, "type") return StateChoiceAction(ref, type, parent) def HandleAction(self, node, parent): if node.get("type") is None: raise PeachException("Parser: Action missing 'type' attribute") action = Action(self._getAttribute(node, 'name'), parent) action.type = self._getAttribute(node, 'type') if not action.type in ['input', 'output', 'call', 'setprop', 'getprop', 'changeState', 'slurp', 'connect', 'close', 'accept', 'start', 'stop', 'wait', 'open']: raise PeachException("Parser: Action type attribute is not valid [%s]." % action.type) action.onStart = self._getAttribute(node, 'onStart') action.onComplete = self._getAttribute(node, 'onComplete') action.when = self._getAttribute(node, 'when') action.ref = self._getAttribute(node, 'ref') action.setXpath = self._getAttribute(node, 'setXpath') action.valueXpath = self._getAttribute(node, 'valueXpath') action.valueLiteral = self._getAttribute(node, 'value') action.method = self._getAttribute(node, 'method') action.property = self._getAttribute(node, 'property') action.publisher = self._getAttribute(node, 'publisher') # Quick hack to get open support. open and connect are same. if action.type == 'open': action.type = 'connect' if (action.setXpath or action.valueXpath or action.valueLiteral) and ( action.type != 'slurp' and action.type != 'wait'): raise PeachException("Parser: Invalid attribute for Action were type != 'slurp'") if action.method is not None and action.type != 'call': raise PeachException("Parser: Method attribute on an Action only available when type is 'call'.") if action.property is not None and not action.type in ['setprop', 'getprop']: raise PeachException( "Parser: Property attribute on an Action only available when type is 'setprop' or 'getprop'.") for child in node.iterchildren(): child_nodeName = split_ns(child.tag)[1] if child_nodeName == 'Param': if not action.type in ['call', 'setprop', 'getprop']: raise PeachException("Parser: Param is an invalid child of Action for this Action type") param = self.HandleActionParam(child, action) if param.name in action: raise PeachException( "Error, duplicate Param name [%s] found in Action [%s]." % (param.name, action.name)) action.append(param) elif child_nodeName == 'Template' or child_nodeName == 'DataModel': if action.type not in ['input', 'output', 'getprop']: raise PeachException("Parser: DataModel is an invalid child of Action for this Action type") #if child.get('ref') is None: # raise PeachException("Parser: When DataModel is a child of Action it must have the ref attribute.") if action.template is not None: raise PeachException("Error, action [%s] already has a DataModel specified." % action.name) obj = self.HandleTemplate(child, action) action.template = obj action.append(obj) elif child_nodeName == 'Data': if not (action.type == 'input' or action.type == 'output'): raise PeachException("Parser: Data is an invalid child of Action for this Action type") if action.data is not None: raise PeachException("Error, action [%s] already has a Data element specified." % action.name) data = self.HandleData(child, action) action.data = data elif child_nodeName == 'Result': if not action.type in ['call']: raise PeachException("Parser: Result is an invalid child of Action of type 'call'.") result = self.HandleActionResult(child, action) if result.name in action: raise PeachException( "Error, duplicate Result name [%s] found in Action [%s]." % (param.name, action.name)) action.append(result) else: raise PeachException("Parser: State has unknown child [%s]" % PeachStr(child_nodeName)) if action.template is not None and action.data is not None: cracker = DataCracker(action.getRoot()) cracker.optmizeModelForCracking(action.template) # Somehow data not getting parent. Force setting action.data.parent = action action.template.setDefaults(action.data, self.dontCrack, True) # Verify action has a DataModel if needed if action.type in ['input', 'output']: if action.template is None: raise PeachException("Parser: Action [%s] of type [%s] must have a DataModel child element." % ( action.name, action.type)) # Verify that setprop has a parameter if action.type == 'setprop': foundActionParam = False for c in action: if isinstance(c, ActionParam): foundActionParam = True if not foundActionParam: raise PeachException( "Parser: Action [%s] of type [%s] must have a Param child element." % (action.name, action.type)) return action def HandleActionParam(self, node, parent): if node.get("type") is None: raise PeachException("Parser: ActionParam missing required type attribute") param = ActionParam(self._getAttribute(node, 'name'), parent) param.type = self._getAttribute(node, 'type') if not param.type in ['in', 'out', 'inout', 'return']: raise PeachException( "Parser: ActionParam type attribute is not valid [%s]. Must be one of: in, out, or inout" % param.type) for child in node.iterchildren(): child_nodeName = split_ns(child.tag)[1] if child_nodeName == 'Template' or child_nodeName == 'DataModel': #if child.get('ref') is None: # raise PeachException("Parser: When Template is a child of ActionParam it must have the ref attribute.") obj = self.HandleTemplate(child, param) param.template = obj param.append(obj) elif child_nodeName == 'Data': if not (param.type == 'in' or param.type == 'inout'): raise PeachException( "Parser: Data is an invalid child of ActionParam for this type [%s]" % param.type) data = self.HandleData(child, param) data.parent = param param.data = data else: raise PeachException("Parser: ActionParam has unknown child [%s]" % PeachStr(child_nodeName)) if param.template is not None and param.data is not None: cracker = DataCracker(param.template.getRoot()) cracker.optmizeModelForCracking(param.template) param.template.setDefaults(param.data, self.dontCrack, True) # Verify param has data model if param.template is None: raise PeachException("Parser: Action Param must have DataModel as child element.") return param def HandleActionResult(self, node, parent): result = ActionResult(self._getAttribute(node, 'name'), parent) for child in node.iterchildren(): child_nodeName = split_ns(child.tag)[1] if child_nodeName == 'Template' or child_nodeName == 'DataModel': if child.get('ref') is None: raise PeachException( "Parser: When Template is a child of ActionParam it must have the ref attribute.") obj = self.HandleTemplate(child, result) result.template = obj result.append(obj) else: raise PeachException("Parser: Action Result has unknown child [%s]" % PeachStr(child_nodeName)) # Verify param has data model if result.template is None: raise PeachException("Parser: Action Result must have DataModel as child element.") return result def _HandleValueType(self, value, valueType): """ Handle types: string, literal, and hex """ if not value or not valueType: return None if valueType == 'literal': return PeachStr(eval(value)) return PeachStr(value) def _HandleValueTypeString(self, value, valueType): """ Handle types: string, literal, and hex """ if not value or not valueType: return None if valueType == 'literal': return eval(value) return value def HandleParam(self, node, parent): param = Param(parent) if node.get("name") is None: raise PeachException( "Parser: Param element missing name attribute. Parent is [{}]".format(split_ns(node.getparent().tag)[1])) if node.get("value") is None: raise PeachException("Parser: Param element missing value attribute. Name is [{}]. Parent is [{}]".format(node.get("name"), split_ns(node.getparent().tag)[1])) if node.get("valueType") is None: valueType = "string" else: valueType = self._getAttribute(node, "valueType") name = self._getAttribute(node, "name") value = self._getAttribute(node, "value") if valueType == 'string': # create a literal out of a string value try: value = "'''" + value + "'''" except TypeError: raise PeachException("Parser: Failed converting param value to string. Name is [{}]. Value is [{}].".format(name, value)) elif valueType == 'hex': ret = '' valueLen = len(value) + 1 while valueLen > len(value): valueLen = len(value) for i in range(len(self._regsHex)): match = self._regsHex[i].search(value) if match is not None: while match is not None: ret += '\\x' + match.group(2) value = self._regsHex[i].sub('', value) match = self._regsHex[i].search(value) break value = "'" + ret + "'" param.name = name param.defaultValue = PeachStr(value) param.valueType = valueType return param def HandlePythonPath(self, node, parent): if node.get('path') is None: raise PeachException("PythonPath element did not have a path attribute!") p = PythonPath() p.name = self._getAttribute(node, 'path') return p def HandleImport(self, node, parent): # Import module if node.get('import') is None: raise PeachException("HandleImport: Import element did not have import attribute!") i = Element() i.elementType = 'import' i.importStr = self._getAttribute(node, 'import') if node.get('from') is not None: i.fromStr = self._getAttribute(node, 'from') else: i.fromStr = None return i def HandleHint(self, node, parent): if node.get('name') is None or node.get('value') is None: raise PeachException("Error: Found Hint element that didn't have both name and value attributes.") hint = Hint(self._getAttribute(node, 'name'), parent) hint.value = self._getAttribute(node, 'value') parent.hints.append(hint) return hint from Peach.Analyzers import *
MozillaSecurity/peach
Peach/Engine/parser.py
Python
mpl-2.0
109,622
// +build !consulent package consul import ( "github.com/hashicorp/consul/acl" "github.com/hashicorp/consul/agent/structs" ) func testIdentityForTokenEnterprise(string) (bool, structs.ACLIdentity, error) { return true, nil, acl.ErrNotFound } func testPolicyForIDEnterprise(string) (bool, *structs.ACLPolicy, error) { return true, nil, acl.ErrNotFound } func testRoleForIDEnterprise(string) (bool, *structs.ACLRole, error) { return true, nil, acl.ErrNotFound } // EnterpriseACLResolverTestDelegate stub type EnterpriseACLResolverTestDelegate struct{} // RPC stub for the EnterpriseACLResolverTestDelegate func (d *EnterpriseACLResolverTestDelegate) RPC(string, interface{}, interface{}) (bool, error) { return false, nil }
scalp42/consul
agent/consul/acl_oss_test.go
GO
mpl-2.0
735
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #downloadManager { background-color: ThreeDFace; } /* Download View */ @media not all and (-moz-windows-classic) { #downloadView { -moz-appearance: none; margin: 0; border-bottom: 2px solid; -moz-border-bottom-colors: ThreeDHighlight ThreeDLightShadow; } } /* Download View Items */ richlistitem[type="download"] { padding: 4px 8px 4px 4px; min-height: 46px; border-bottom: 1px solid ThreeDLightShadow; } richlistitem[type="download"] .name { font-size: larger; } richlistitem[type="download"] .dateTime { font-size: smaller; } .mini-button { -moz-appearance: none; list-style-image: url(chrome://mozapps/skin/downloads/downloadButtons.png); background-color: transparent; border: none; padding: 0; margin: 0; min-width: 0; min-height: 0; } .mini-button > .button-box { padding: 0 !important; } .cancel { -moz-image-region: rect(0px, 32px, 16px, 16px); } .cancel:hover { -moz-image-region: rect(16px, 32px, 32px, 16px); } .cancel:active { -moz-image-region: rect(32px, 32px, 48px, 16px); } .cancel[disabled="true"] { -moz-image-region: rect(48px, 32px, 64px, 16px); } .pause { -moz-image-region: rect(0px, 48px, 16px, 32px); } .pause:hover { -moz-image-region: rect(16px, 48px, 32px, 32px); } .pause:active { -moz-image-region: rect(32px, 48px, 48px, 32px); } .pause[disabled="true"] { -moz-image-region: rect(48px, 48px, 64px, 32px); } .resume { -moz-image-region: rect(0px, 16px, 16px, 0px); } .resume:hover { -moz-image-region: rect(16px, 16px, 32px, 0px); } .resume:active { -moz-image-region: rect(32px, 16px, 48px, 0px); } .resume[disabled="true"] { -moz-image-region: rect(48px, 16px, 64px, 0px); } .retry { -moz-image-region: rect(0px, 64px, 16px, 48px); } .retry:hover { -moz-image-region: rect(16px, 64px, 32px, 48px); } .retry:active { -moz-image-region: rect(32px, 64px, 48px, 48px); } .retry[disabled="true"] { -moz-image-region: rect(48px, 64px, 64px, 48px); } .blockedIcon { list-style-image: url(chrome://global/skin/icons/Error.png); } /* prevent flickering when changing states */ .downloadTypeIcon { min-height: 32px; min-width: 32px; } #clearListButton { min-height: 0; min-width: 0; margin-top: 3px; } @media (-moz-windows-compositor) { #downloadManager { -moz-appearance: -moz-win-glass; background: transparent; } #downloadView { /* Clamp glass bounds to the rich list so our glass haze stays constant. */ -moz-appearance: -moz-win-exclude-glass; border: none; } windowdragbox { -moz-binding: url("chrome://global/content/bindings/general.xml#windowdragbox"); } #clearListButton { margin-inline-start: 0; margin-bottom: 0; } #searchbox { margin-inline-end: 0; margin-bottom: 0; } }
louischan/simplewhite
whitefox/mozapps/downloads/downloads.css
CSS
mpl-2.0
2,980
<!DOCTYPE HTML> <html> <head> <title>Test for jQuery</title> <script src="/MochiKit/Base.js"></script> <script src="/MochiKit/Async.js"></script> <script src="/tests/SimpleTest/SimpleTest.js"></script> <script type="text/javascript" src="../lib/AJAX_setup.js"></script> <link rel="stylesheet" type="text/css" href="../lib/test.css" /> </head> <body> <iframe width="100%" height="500" id="testframe" src=""></iframe> </body> </html>
Yukarumya/Yukarum-Redfoxes
dom/tests/mochitest/ajax/jquery/test_jQuery.html
HTML
mpl-2.0
456
package catalog const ( TEMPLATE_VERSION_TYPE = "templateVersion" ) type TemplateVersion struct { Resource Actions map[string]interface{} `json:"actions,omitempty" yaml:"actions,omitempty"` Bindings map[string]interface{} `json:"bindings,omitempty" yaml:"bindings,omitempty"` Files map[string]interface{} `json:"files,omitempty" yaml:"files,omitempty"` Labels map[string]interface{} `json:"labels,omitempty" yaml:"labels,omitempty"` Links map[string]interface{} `json:"links,omitempty" yaml:"links,omitempty"` MaximumRancherVersion string `json:"maximumRancherVersion,omitempty" yaml:"maximum_rancher_version,omitempty"` MinimumRancherVersion string `json:"minimumRancherVersion,omitempty" yaml:"minimum_rancher_version,omitempty"` Questions []Question `json:"questions,omitempty" yaml:"questions,omitempty"` TemplateId string `json:"templateId,omitempty" yaml:"template_id,omitempty"` Type string `json:"type,omitempty" yaml:"type,omitempty"` UpgradeFrom string `json:"upgradeFrom,omitempty" yaml:"upgrade_from,omitempty"` UpgradeVersionLinks map[string]interface{} `json:"upgradeVersionLinks,omitempty" yaml:"upgrade_version_links,omitempty"` Version string `json:"version,omitempty" yaml:"version,omitempty"` } type TemplateVersionCollection struct { Collection Data []TemplateVersion `json:"data,omitempty"` client *TemplateVersionClient } type TemplateVersionClient struct { rancherClient *RancherClient } type TemplateVersionOperations interface { List(opts *ListOpts) (*TemplateVersionCollection, error) Create(opts *TemplateVersion) (*TemplateVersion, error) Update(existing *TemplateVersion, updates interface{}) (*TemplateVersion, error) ById(id string) (*TemplateVersion, error) Delete(container *TemplateVersion) error } func newTemplateVersionClient(rancherClient *RancherClient) *TemplateVersionClient { return &TemplateVersionClient{ rancherClient: rancherClient, } } func (c *TemplateVersionClient) Create(container *TemplateVersion) (*TemplateVersion, error) { resp := &TemplateVersion{} err := c.rancherClient.doCreate(TEMPLATE_VERSION_TYPE, container, resp) return resp, err } func (c *TemplateVersionClient) Update(existing *TemplateVersion, updates interface{}) (*TemplateVersion, error) { resp := &TemplateVersion{} err := c.rancherClient.doUpdate(TEMPLATE_VERSION_TYPE, &existing.Resource, updates, resp) return resp, err } func (c *TemplateVersionClient) List(opts *ListOpts) (*TemplateVersionCollection, error) { resp := &TemplateVersionCollection{} err := c.rancherClient.doList(TEMPLATE_VERSION_TYPE, opts, resp) resp.client = c return resp, err } func (cc *TemplateVersionCollection) Next() (*TemplateVersionCollection, error) { if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { resp := &TemplateVersionCollection{} err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) resp.client = cc.client return resp, err } return nil, nil } func (c *TemplateVersionClient) ById(id string) (*TemplateVersion, error) { resp := &TemplateVersion{} err := c.rancherClient.doById(TEMPLATE_VERSION_TYPE, id, resp) if apiError, ok := err.(*ApiError); ok { if apiError.StatusCode == 404 { return nil, nil } } return resp, err } func (c *TemplateVersionClient) Delete(container *TemplateVersion) error { return c.rancherClient.doResourceDelete(TEMPLATE_VERSION_TYPE, &container.Resource) }
cnicolov/terraform
vendor/github.com/rancher/go-rancher/catalog/generated_template_version.go
GO
mpl-2.0
3,414
<!DOCTYPE HTML> <html> <!-- https://bugzilla.mozilla.org/show_bug.cgi?id=388746 --> <head> <title>Test for Bug 388746</title> <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> </head> <body> <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=388746">Mozilla Bug 388746</a> <p id="display"></p> <div id="content"> <input> <textarea></textarea> <select> <option>option1</option> <optgroup label="optgroup"> <option>option2</option> </optgroup> </select> <button>Button</button> </div> <pre id="test"> <script class="testbody" type="text/javascript"> /** Test for Bug 388746 **/ var previousEventTarget = ""; function handler(evt) { if (evt.eventPhase == 2) { previousEventTarget = evt.target.localName.toLowerCase(); } } function testElementType(type) { var el = document.getElementsByTagName(type)[0]; el.addEventListener("DOMAttrModified", handler, true); el.setAttribute("foo", "bar"); ok(previousEventTarget == type, type + " element should have got DOMAttrModified event."); } function test() { testElementType("input"); testElementType("textarea"); testElementType("select"); testElementType("option"); testElementType("optgroup"); testElementType("button"); } SimpleTest.waitForExplicitFinish(); addLoadEvent(test); addLoadEvent(SimpleTest.finish); </script> </pre> </body> </html>
Yukarumya/Yukarum-Redfoxes
dom/html/test/test_bug388746.html
HTML
mpl-2.0
1,483
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * * Date: 04 Sep 2002 * SUMMARY: Just seeing that we don't crash when compiling this script - * * See http://bugzilla.mozilla.org/show_bug.cgi?id=96526 * */ //----------------------------------------------------------------------------- printBugNumber(96526); printStatus("Just seeing that we don't crash when compiling this script -"); /* * Function definition with lots of branches, from http://www.newyankee.com */ function setaction(jumpto) { if (jumpto == 0) window.location = "http://www.newyankee.com/GetYankees2.cgi?1.jpg"; else if (jumpto == [0]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ImageName"; else if (jumpto == [1]) window.location = "http://www.newyankee.com/GetYankees2.cgi?1.jpg"; else if (jumpto == [2]) window.location = "http://www.newyankee.com/GetYankees2.cgi?arsrferguson.jpg"; else if (jumpto == [3]) window.location = "http://www.newyankee.com/GetYankees2.cgi?akjamesmartin.jpg"; else if (jumpto == [4]) window.location = "http://www.newyankee.com/GetYankees2.cgi?aldaverackett.jpg"; else if (jumpto == [5]) window.location = "http://www.newyankee.com/GetYankees2.cgi?alericbrasher.jpg"; else if (jumpto == [6]) window.location = "http://www.newyankee.com/GetYankees2.cgi?algeorgewatkins.jpg"; else if (jumpto == [7]) window.location = "http://www.newyankee.com/GetYankees2.cgi?altoddcruise.jpg"; else if (jumpto == [8]) window.location = "http://www.newyankee.com/GetYankees2.cgi?arkevinc.jpg"; else if (jumpto == [9]) window.location = "http://www.newyankee.com/GetYankees2.cgi?arpaulmoore.jpg"; else if (jumpto == [10]) window.location = "http://www.newyankee.com/GetYankees2.cgi?auphillaird.jpg"; else if (jumpto == [11]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azbillhensley.jpg"; else if (jumpto == [12]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azcharleshollandjr.jpg"; else if (jumpto == [13]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azdaveholland.jpg"; else if (jumpto == [14]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azdavidholland.jpg"; else if (jumpto == [15]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azdonaldvogt.jpg"; else if (jumpto == [16]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azernestortega.jpg"; else if (jumpto == [17]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azjeromekeller.jpg"; else if (jumpto == [18]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azjimpegfulton.jpg"; else if (jumpto == [19]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azjohnbelcher.jpg"; else if (jumpto == [20]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azmikejordan.jpg"; else if (jumpto == [21]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azrickemry.jpg"; else if (jumpto == [22]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azstephensavage.jpg"; else if (jumpto == [23]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azsteveferguson.jpg"; else if (jumpto == [24]) window.location = "http://www.newyankee.com/GetYankees2.cgi?aztjhorrall.jpg"; else if (jumpto == [25]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cabillmeiners.jpg"; else if (jumpto == [26]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cabobhadley.jpg"; else if (jumpto == [27]) window.location = "http://www.newyankee.com/GetYankees2.cgi?caboblennox.jpg"; else if (jumpto == [28]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cabryanshurtz.jpg"; else if (jumpto == [29]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cabyroncleveland.jpg"; else if (jumpto == [30]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cacesarjimenez.jpg"; else if (jumpto == [31]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cadalekirstine.jpg"; else if (jumpto == [32]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cadavidlgoeffrion.jpg"; else if (jumpto == [33]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cadennisnocerini.jpg"; else if (jumpto == [34]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cadianemason.jpg"; else if (jumpto == [35]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cadominicpieranunzio.jpg"; else if (jumpto == [36]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cadonaldmotter.jpg"; else if (jumpto == [37]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cadoncroner.jpg"; else if (jumpto == [38]) window.location = "http://www.newyankee.com/GetYankees2.cgi?caelizabethwright.jpg"; else if (jumpto == [39]) window.location = "http://www.newyankee.com/GetYankees2.cgi?caericlew.jpg"; else if (jumpto == [40]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cafrancissmith.jpg"; else if (jumpto == [41]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cafranklombano.jpg"; else if (jumpto == [42]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cajaredweaver.jpg"; else if (jumpto == [43]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cajerrythompson.jpg"; else if (jumpto == [44]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cajimjanssen"; else if (jumpto == [45]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cajohncopolillo.jpg"; else if (jumpto == [46]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cajohnmessick.jpg"; else if (jumpto == [47]) window.location = "http://www.newyankee.com/GetYankees2.cgi?calaynedicker.jpg"; else if (jumpto == [48]) window.location = "http://www.newyankee.com/GetYankees2.cgi?caleeannrucker.jpg"; else if (jumpto == [49]) window.location = "http://www.newyankee.com/GetYankees2.cgi?camathewsscharch.jpg"; else if (jumpto == [50]) window.location = "http://www.newyankee.com/GetYankees2.cgi?camikedunn.jpg"; else if (jumpto == [51]) window.location = "http://www.newyankee.com/GetYankees2.cgi?camikeshay.jpg"; else if (jumpto == [52]) window.location = "http://www.newyankee.com/GetYankees2.cgi?camikeshepherd.jpg"; else if (jumpto == [53]) window.location = "http://www.newyankee.com/GetYankees2.cgi?caphillipfreer.jpg"; else if (jumpto == [54]) window.location = "http://www.newyankee.com/GetYankees2.cgi?carandy.jpg"; else if (jumpto == [55]) window.location = "http://www.newyankee.com/GetYankees2.cgi?carichardwilliams.jpg"; else if (jumpto == [56]) window.location = "http://www.newyankee.com/GetYankees2.cgi?carickgruen.jpg"; else if (jumpto == [57]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cascottbartsch.jpg"; else if (jumpto == [58]) window.location = "http://www.newyankee.com/GetYankees2.cgi?castevestrapac.jpg"; else if (jumpto == [59]) window.location = "http://www.newyankee.com/GetYankees2.cgi?catimwest.jpg"; else if (jumpto == [60]) window.location = "http://www.newyankee.com/GetYankees2.cgi?catomrietveld.jpg"; else if (jumpto == [61]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnalainpaquette.jpg"; else if (jumpto == [62]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnalanhill.jpg"; else if (jumpto == [63]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnalguerette.jpg"; else if (jumpto == [64]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnbrianhogg.jpg"; else if (jumpto == [65]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnbrucebeard.jpg"; else if (jumpto == [66]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cncraigdavey.jpg"; else if (jumpto == [67]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cndanielpattison.jpg"; else if (jumpto == [68]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cndenisstjean.jpg"; else if (jumpto == [69]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnglenngray.jpg"; else if (jumpto == [70]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnjeansebastienduguay.jpg"; else if (jumpto == [71]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnjohnbritz.jpg"; else if (jumpto == [72]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnkevinmclean.jpg"; else if (jumpto == [73]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnmarcandrecartier.jpg"; else if (jumpto == [74]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnmarcleblanc.jpg"; else if (jumpto == [75]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnmatthewgiles.jpg"; else if (jumpto == [76]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnmichelrauzon.jpg"; else if (jumpto == [77]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnpierrelalonde.jpg"; else if (jumpto == [78]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnraytyson.jpg"; else if (jumpto == [79]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnrichardboucher.jpg"; else if (jumpto == [80]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnrodbuike.jpg"; else if (jumpto == [81]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnscottpitkeathly.jpg"; else if (jumpto == [82]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnshawndavis.jpg"; else if (jumpto == [83]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnstephanepelletier.jpg"; else if (jumpto == [84]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cntodddesroches.jpg"; else if (jumpto == [85]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cntonyharnum.jpg"; else if (jumpto == [86]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnwayneconabree.jpg"; else if (jumpto == [87]) window.location = "http://www.newyankee.com/GetYankees2.cgi?codavidjbarber.jpg"; else if (jumpto == [88]) window.location = "http://www.newyankee.com/GetYankees2.cgi?codonrandquist.jpg"; else if (jumpto == [89]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cojeffpalese.jpg"; else if (jumpto == [90]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cojohnlowell.jpg"; else if (jumpto == [91]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cotroytorgerson.jpg"; else if (jumpto == [92]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ctgerrygranatowski.jpg"; else if (jumpto == [93]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ctjasonklein.jpg"; else if (jumpto == [94]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ctkevinkiss.jpg"; else if (jumpto == [95]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ctmikekennedy.jpg"; else if (jumpto == [96]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flalancanfield.jpg"; else if (jumpto == [97]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flalbertgonzalez.jpg"; else if (jumpto == [98]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flbruceloy.jpg"; else if (jumpto == [99]) window.location = "http://www.newyankee.com/GetYankees2.cgi?fldandevault.jpg"; else if (jumpto == [100]) window.location = "http://www.newyankee.com/GetYankees2.cgi?fldonstclair.jpg"; else if (jumpto == [101]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flernestbonnell.jpg"; else if (jumpto == [102]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flgeorgebarg.jpg"; else if (jumpto == [103]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flgregslavinski.jpg"; else if (jumpto == [104]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flgregwaters.jpg"; else if (jumpto == [105]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flharoldmiller.jpg"; else if (jumpto == [106]) window.location = "http://www.newyankee.com/GetYankees2.cgi?fljackwelch.jpg"; else if (jumpto == [107]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flmichaelostrowski.jpg"; else if (jumpto == [108]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flpauldoman.jpg"; else if (jumpto == [109]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flpaulsessions.jpg"; else if (jumpto == [110]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flrandymys.jpg"; else if (jumpto == [111]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flraysarnowski.jpg"; else if (jumpto == [112]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flrobertcahill.jpg"; else if (jumpto == [113]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flstevemorrison.jpg"; else if (jumpto == [114]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flstevezellner.jpg"; else if (jumpto == [115]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flterryjennings.jpg"; else if (jumpto == [116]) window.location = "http://www.newyankee.com/GetYankees2.cgi?fltimmcwilliams.jpg"; else if (jumpto == [117]) window.location = "http://www.newyankee.com/GetYankees2.cgi?fltomstellhorn.jpg"; else if (jumpto == [118]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gabobkoch.jpg"; else if (jumpto == [119]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gabrucekinney.jpg"; else if (jumpto == [120]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gadickbesemer.jpg"; else if (jumpto == [121]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gajackclunen.jpg"; else if (jumpto == [122]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gajayhart.jpg"; else if (jumpto == [123]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gajjgeller.jpg"; else if (jumpto == [124]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gakeithlacey.jpg"; else if (jumpto == [125]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gamargieminutello.jpg"; else if (jumpto == [126]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gamarvinearnest.jpg"; else if (jumpto == [127]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gamikeschwarz.jpg"; else if (jumpto == [128]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gamikeyee.jpg"; else if (jumpto == [129]) window.location = "http://www.newyankee.com/GetYankees2.cgi?garickdubree.jpg"; else if (jumpto == [130]) window.location = "http://www.newyankee.com/GetYankees2.cgi?garobimartin.jpg"; else if (jumpto == [131]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gastevewaddell.jpg"; else if (jumpto == [132]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gathorwiggins.jpg"; else if (jumpto == [133]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gawadewylie.jpg"; else if (jumpto == [134]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gawaynerobinson.jpg"; else if (jumpto == [135]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gepaulwestbury.jpg"; else if (jumpto == [136]) window.location = "http://www.newyankee.com/GetYankees2.cgi?grstewartcwolfe.jpg"; else if (jumpto == [137]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gugregmesa.jpg"; else if (jumpto == [138]) window.location = "http://www.newyankee.com/GetYankees2.cgi?hibriantokunaga.jpg"; else if (jumpto == [139]) window.location = "http://www.newyankee.com/GetYankees2.cgi?himatthewgrady.jpg"; else if (jumpto == [140]) window.location = "http://www.newyankee.com/GetYankees2.cgi?iabobparnell.jpg"; else if (jumpto == [141]) window.location = "http://www.newyankee.com/GetYankees2.cgi?iadougleonard.jpg"; else if (jumpto == [142]) window.location = "http://www.newyankee.com/GetYankees2.cgi?iajayharmon.jpg"; else if (jumpto == [143]) window.location = "http://www.newyankee.com/GetYankees2.cgi?iajohnbevier.jpg"; else if (jumpto == [144]) window.location = "http://www.newyankee.com/GetYankees2.cgi?iamartywitt.jpg"; else if (jumpto == [145]) window.location = "http://www.newyankee.com/GetYankees2.cgi?idjasonbartschi.jpg"; else if (jumpto == [146]) window.location = "http://www.newyankee.com/GetYankees2.cgi?idkellyklaas.jpg"; else if (jumpto == [147]) window.location = "http://www.newyankee.com/GetYankees2.cgi?idmikegagnon.jpg"; else if (jumpto == [148]) window.location = "http://www.newyankee.com/GetYankees2.cgi?idrennieheuer.jpg"; else if (jumpto == [149]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilbenshakman.jpg"; else if (jumpto == [150]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilcraigstocks.jpg"; else if (jumpto == [151]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ildaverubini.jpg"; else if (jumpto == [152]) window.location = "http://www.newyankee.com/GetYankees2.cgi?iledpepin.jpg"; else if (jumpto == [153]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilfredkirpec.jpg"; else if (jumpto == [154]) window.location = "http://www.newyankee.com/GetYankees2.cgi?iljoecreed.jpg"; else if (jumpto == [155]) window.location = "http://www.newyankee.com/GetYankees2.cgi?iljohnknuth.jpg"; else if (jumpto == [156]) window.location = "http://www.newyankee.com/GetYankees2.cgi?iljoshhill.jpg"; else if (jumpto == [157]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilkeithrichard.jpg"; else if (jumpto == [158]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilkrystleweber.jpg"; else if (jumpto == [159]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilmattmusich.jpg"; else if (jumpto == [160]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilmichaellane.jpg"; else if (jumpto == [161]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilrodneyschwandt.jpg"; else if (jumpto == [162]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilrogeraukerman.jpg"; else if (jumpto == [163]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilscottbreeden.jpg"; else if (jumpto == [164]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilscottgerami.jpg"; else if (jumpto == [165]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilsteveritt.jpg"; else if (jumpto == [166]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilthomasfollin.jpg"; else if (jumpto == [167]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilwaynesmith.jpg"; else if (jumpto == [168]) window.location = "http://www.newyankee.com/GetYankees2.cgi?inallenwimberly.jpg"; else if (jumpto == [169]) window.location = "http://www.newyankee.com/GetYankees2.cgi?inbutchmyers.jpg"; else if (jumpto == [170]) window.location = "http://www.newyankee.com/GetYankees2.cgi?inderrickbentley.jpg"; else if (jumpto == [171]) window.location = "http://www.newyankee.com/GetYankees2.cgi?inedmeissler.jpg"; else if (jumpto == [172]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ingarymartin.jpg"; else if (jumpto == [173]) window.location = "http://www.newyankee.com/GetYankees2.cgi?injasondavis.jpg"; else if (jumpto == [174]) window.location = "http://www.newyankee.com/GetYankees2.cgi?injeffjones.jpg"; else if (jumpto == [175]) window.location = "http://www.newyankee.com/GetYankees2.cgi?injeffwilliams.jpg"; else if (jumpto == [176]) window.location = "http://www.newyankee.com/GetYankees2.cgi?injpreslyharrington.jpg"; else if (jumpto == [177]) window.location = "http://www.newyankee.com/GetYankees2.cgi?inrichardlouden.jpg"; else if (jumpto == [178]) window.location = "http://www.newyankee.com/GetYankees2.cgi?inronmorrell.jpg"; else if (jumpto == [179]) window.location = "http://www.newyankee.com/GetYankees2.cgi?insearsweaver.jpg"; else if (jumpto == [180]) window.location = "http://www.newyankee.com/GetYankees2.cgi?irpaullaverty.jpg"; else if (jumpto == [181]) window.location = "http://www.newyankee.com/GetYankees2.cgi?irseamusmcbride.jpg"; else if (jumpto == [182]) window.location = "http://www.newyankee.com/GetYankees2.cgi?isazrielmorag.jpg"; else if (jumpto == [183]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ksalankreifels.jpg"; else if (jumpto == [184]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ksbrianbudden.jpg"; else if (jumpto == [185]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ksgarypahls.jpg"; else if (jumpto == [186]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ksmikefarnet.jpg"; else if (jumpto == [187]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ksmikethomas.jpg"; else if (jumpto == [188]) window.location = "http://www.newyankee.com/GetYankees2.cgi?kstomzillig.jpg"; else if (jumpto == [189]) window.location = "http://www.newyankee.com/GetYankees2.cgi?kybillyandrews.jpg"; else if (jumpto == [190]) window.location = "http://www.newyankee.com/GetYankees2.cgi?kydaveryno.jpg"; else if (jumpto == [191]) window.location = "http://www.newyankee.com/GetYankees2.cgi?kygreglaramore.jpg"; else if (jumpto == [192]) window.location = "http://www.newyankee.com/GetYankees2.cgi?kywilliamanderson.jpg"; else if (jumpto == [193]) window.location = "http://www.newyankee.com/GetYankees2.cgi?kyzachschuyler.jpg"; else if (jumpto == [194]) window.location = "http://www.newyankee.com/GetYankees2.cgi?laadriankliebert.jpg"; else if (jumpto == [195]) window.location = "http://www.newyankee.com/GetYankees2.cgi?labarryhumphus.jpg"; else if (jumpto == [196]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ladennisanders.jpg"; else if (jumpto == [197]) window.location = "http://www.newyankee.com/GetYankees2.cgi?larichardeckert.jpg"; else if (jumpto == [198]) window.location = "http://www.newyankee.com/GetYankees2.cgi?laronjames.jpg"; else if (jumpto == [199]) window.location = "http://www.newyankee.com/GetYankees2.cgi?lasheldonstutes.jpg"; else if (jumpto == [200]) window.location = "http://www.newyankee.com/GetYankees2.cgi?lastephenstarbuck.jpg"; else if (jumpto == [201]) window.location = "http://www.newyankee.com/GetYankees2.cgi?latroyestonich.jpg"; else if (jumpto == [202]) window.location = "http://www.newyankee.com/GetYankees2.cgi?lavaughntrosclair.jpg"; else if (jumpto == [203]) window.location = "http://www.newyankee.com/GetYankees2.cgi?maalexbrown.jpg"; else if (jumpto == [204]) window.location = "http://www.newyankee.com/GetYankees2.cgi?maalwencl.jpg"; else if (jumpto == [205]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mabrentmills.jpg"; else if (jumpto == [206]) window.location = "http://www.newyankee.com/GetYankees2.cgi?madangodziff.jpg"; else if (jumpto == [207]) window.location = "http://www.newyankee.com/GetYankees2.cgi?madanielwilusz.jpg"; else if (jumpto == [208]) window.location = "http://www.newyankee.com/GetYankees2.cgi?madavidreis.jpg"; else if (jumpto == [209]) window.location = "http://www.newyankee.com/GetYankees2.cgi?madougrecko.jpg"; else if (jumpto == [210]) window.location = "http://www.newyankee.com/GetYankees2.cgi?majasonhaley.jpg"; else if (jumpto == [211]) window.location = "http://www.newyankee.com/GetYankees2.cgi?maklausjensen.jpg"; else if (jumpto == [212]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mamikemarland.jpg"; else if (jumpto == [213]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mapetersilvestre.jpg"; else if (jumpto == [214]) window.location = "http://www.newyankee.com/GetYankees2.cgi?maraysweeney.jpg"; else if (jumpto == [215]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mdallenbarnett.jpg"; else if (jumpto == [216]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mdcharleswasson.jpg"; else if (jumpto == [217]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mdedbaranowski.jpg"; else if (jumpto == [218]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mdfranktate.jpg"; else if (jumpto == [219]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mdfredschock.jpg"; else if (jumpto == [220]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mdianstjohn.jpg"; else if (jumpto == [221]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mdjordanevans.jpg"; else if (jumpto == [222]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mdpaulwjones.jpg"; else if (jumpto == [223]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mestevesandelier.jpg"; else if (jumpto == [224]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mewilbertrbrown.jpg"; else if (jumpto == [225]) window.location = "http://www.newyankee.com/GetYankees2.cgi?midavidkeller.jpg"; else if (jumpto == [226]) window.location = "http://www.newyankee.com/GetYankees2.cgi?migaryvandenberg.jpg"; else if (jumpto == [227]) window.location = "http://www.newyankee.com/GetYankees2.cgi?migeorgeberlinger.jpg"; else if (jumpto == [228]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mijamesstapleton.jpg"; else if (jumpto == [229]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mijerryhaney.jpg"; else if (jumpto == [230]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mijohnrybarczyk.jpg"; else if (jumpto == [231]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mikeithvalliere.jpg"; else if (jumpto == [232]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mikevinpodsiadlik.jpg"; else if (jumpto == [233]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mimarkandrews.jpg"; else if (jumpto == [234]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mimikedecaussin.jpg"; else if (jumpto == [235]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mimikesegorski.jpg"; else if (jumpto == [236]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mirobertwolgast.jpg"; else if (jumpto == [237]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mitimothybruner.jpg"; else if (jumpto == [238]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mitomweaver.jpg"; else if (jumpto == [239]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mnbobgontarek.jpg"; else if (jumpto == [240]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mnbradbuffington.jpg"; else if (jumpto == [241]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mndavewilson.jpg"; else if (jumpto == [242]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mngenerajanen.jpg"; else if (jumpto == [243]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mnjohnkempkes.jpg"; else if (jumpto == [244]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mnkevinhurbanis.jpg"; else if (jumpto == [245]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mnmarklansink.jpg"; else if (jumpto == [246]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mnpaulmayer.jpg"; else if (jumpto == [247]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mnpauloman.jpg"; else if (jumpto == [248]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mnwoodylobnitz.jpg"; else if (jumpto == [249]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mocurtkempf.jpg"; else if (jumpto == [250]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mojerryhenry.jpg"; else if (jumpto == [251]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mojimfinney.jpg"; else if (jumpto == [252]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mojimrecamper.jpg"; else if (jumpto == [253]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mojohntimmons.jpg"; else if (jumpto == [254]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mojohnvaughan.jpg"; else if (jumpto == [255]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mokenroberts.jpg"; else if (jumpto == [256]) window.location = "http://www.newyankee.com/GetYankees2.cgi?momacvoss.jpg"; else if (jumpto == [257]) window.location = "http://www.newyankee.com/GetYankees2.cgi?momarktemmer.jpg"; else if (jumpto == [258]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mopaulzerjav.jpg"; else if (jumpto == [259]) window.location = "http://www.newyankee.com/GetYankees2.cgi?morobtigner.jpg"; else if (jumpto == [260]) window.location = "http://www.newyankee.com/GetYankees2.cgi?motomantrim.jpg"; else if (jumpto == [261]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mscharleshahn.jpg"; else if (jumpto == [262]) window.location = "http://www.newyankee.com/GetYankees2.cgi?msjohnjohnson.jpg"; else if (jumpto == [263]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ncandrelopez.jpg"; else if (jumpto == [264]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ncedorisak.jpg"; else if (jumpto == [265]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ncjimisbell.jpg"; else if (jumpto == [266]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ncjohnnydark.jpg"; else if (jumpto == [267]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nckevinebert.jpg"; else if (jumpto == [268]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nckevinulmer.jpg"; else if (jumpto == [269]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ncpeteparis.jpg"; else if (jumpto == [270]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ncstevelindsley.jpg"; else if (jumpto == [271]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nctimsmith.jpg"; else if (jumpto == [272]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nctonylawrence.jpg"; else if (jumpto == [273]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ncwyneaston.jpg"; else if (jumpto == [274]) window.location = "http://www.newyankee.com/GetYankees2.cgi?neberniedevlin.jpg"; else if (jumpto == [275]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nebrentesmoil.jpg"; else if (jumpto == [276]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nescottmccullough.jpg"; else if (jumpto == [277]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nhalantarring.jpg"; else if (jumpto == [278]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nhbjmolinari.jpg"; else if (jumpto == [279]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nhbrianmolinari.jpg"; else if (jumpto == [280]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nhdanhorning.jpg"; else if (jumpto == [281]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nhdonblackden.jpg"; else if (jumpto == [282]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nhjimcalandriello.jpg"; else if (jumpto == [283]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nhjohngunterman.jpg"; else if (jumpto == [284]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nhjohnmagyar.jpg"; else if (jumpto == [285]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njbudclarity.jpg"; else if (jumpto == [286]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njcraigjones.jpg"; else if (jumpto == [287]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njericrowland.jpg"; else if (jumpto == [288]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njjimsnyder.jpg"; else if (jumpto == [289]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njlarrylevinson.jpg"; else if (jumpto == [290]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njlouisdispensiere.jpg"; else if (jumpto == [291]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njmarksoloff.jpg"; else if (jumpto == [292]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njmichaelhalko.jpg"; else if (jumpto == [293]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njmichaelmalkasian.jpg"; else if (jumpto == [294]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njnigelmartin.jpg"; else if (jumpto == [295]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njrjmolinari.jpg"; else if (jumpto == [296]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njtommurasky.jpg"; else if (jumpto == [297]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njtomputnam.jpg"; else if (jumpto == [298]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nmdalepage.jpg"; else if (jumpto == [299]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nmmikethompson.jpg"; else if (jumpto == [300]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nvclydekemp.jpg"; else if (jumpto == [301]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nvharveyklene.jpg"; else if (jumpto == [302]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nvlonsimons.jpg"; else if (jumpto == [303]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nyabeweisfelner.jpg"; else if (jumpto == [304]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nyanthonygiudice.jpg"; else if (jumpto == [305]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nyaustinpierce.jpg"; else if (jumpto == [306]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nybrianmonks.jpg"; else if (jumpto == [307]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nycharlieporter.jpg"; else if (jumpto == [308]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nycorneliuswoglum.jpg"; else if (jumpto == [309]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nydennishartwell.jpg"; else if (jumpto == [310]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nydennissgheerdt.jpg"; else if (jumpto == [311]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nygeorgepettitt.jpg"; else if (jumpto == [312]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nyjohndrewes.jpg"; else if (jumpto == [313]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nyjohnminichiello.jpg"; else if (jumpto == [314]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nykevinwoolever.jpg"; else if (jumpto == [315]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nymartyrubinstein.jpg"; else if (jumpto == [316]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nyraysicina.jpg"; else if (jumpto == [317]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nyrobbartley.jpg"; else if (jumpto == [318]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nyrobertkosty.jpg"; else if (jumpto == [319]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nystephenbagnato.jpg"; else if (jumpto == [320]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nystevegiamundo.jpg"; else if (jumpto == [321]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nystevekelly.jpg"; else if (jumpto == [322]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nywayneadelkoph.jpg"; else if (jumpto == [323]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohbriannimmo.jpg"; else if (jumpto == [324]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohdavehyman.jpg"; else if (jumpto == [325]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohdavidconant.jpg"; else if (jumpto == [326]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohdennismantovani.jpg"; else if (jumpto == [327]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohgrahambennett.jpg"; else if (jumpto == [328]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohgregbrunk.jpg"; else if (jumpto == [329]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohgregfilbrun.jpg"; else if (jumpto == [330]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohjimreutener.jpg"; else if (jumpto == [331]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohjimrike.jpg"; else if (jumpto == [332]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohkeithsparks.jpg"; else if (jumpto == [333]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohkevindrinan.jpg"; else if (jumpto == [334]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohmichaelhaines.jpg"; else if (jumpto == [335]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohmichaelsteele.jpg"; else if (jumpto == [336]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohpatrickguanciale.jpg"; else if (jumpto == [337]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohscottkelly.jpg"; else if (jumpto == [338]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohscottthomas.jpg"; else if (jumpto == [339]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohstevetuckerman.jpg"; else if (jumpto == [340]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohtedfigurski.jpg"; else if (jumpto == [341]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohterrydonald.jpg"; else if (jumpto == [342]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohtimokeefe.jpg"; else if (jumpto == [343]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohtomhaydock.jpg"; else if (jumpto == [344]) window.location = "http://www.newyankee.com/GetYankees2.cgi?okbillsneller.jpg"; else if (jumpto == [345]) window.location = "http://www.newyankee.com/GetYankees2.cgi?okbobbulick.jpg"; else if (jumpto == [346]) window.location = "http://www.newyankee.com/GetYankees2.cgi?okdaryljones.jpg"; else if (jumpto == [347]) window.location = "http://www.newyankee.com/GetYankees2.cgi?okstevetarchek.jpg"; else if (jumpto == [348]) window.location = "http://www.newyankee.com/GetYankees2.cgi?okwoodymcelroy.jpg"; else if (jumpto == [349]) window.location = "http://www.newyankee.com/GetYankees2.cgi?orcoryeells.jpg"; else if (jumpto == [350]) window.location = "http://www.newyankee.com/GetYankees2.cgi?oredcavasso.jpg"; else if (jumpto == [351]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ormarkmcculley.jpg"; else if (jumpto == [352]) window.location = "http://www.newyankee.com/GetYankees2.cgi?orstevekarthauser.jpg"; else if (jumpto == [353]) window.location = "http://www.newyankee.com/GetYankees2.cgi?paalanpalmieri.jpg"; else if (jumpto == [354]) window.location = "http://www.newyankee.com/GetYankees2.cgi?pachriscarr.jpg"; else if (jumpto == [355]) window.location = "http://www.newyankee.com/GetYankees2.cgi?padansigg.jpg"; else if (jumpto == [356]) window.location = "http://www.newyankee.com/GetYankees2.cgi?padavecalabretta.jpg"; else if (jumpto == [357]) window.location = "http://www.newyankee.com/GetYankees2.cgi?padennishoffman.jpg"; else if (jumpto == [358]) window.location = "http://www.newyankee.com/GetYankees2.cgi?pafrankschlipf.jpg"; else if (jumpto == [359]) window.location = "http://www.newyankee.com/GetYankees2.cgi?pajamesevanson.jpg"; else if (jumpto == [360]) window.location = "http://www.newyankee.com/GetYankees2.cgi?pajoekrol.jpg"; else if (jumpto == [361]) window.location = "http://www.newyankee.com/GetYankees2.cgi?pakatecrimmins.jpg"; else if (jumpto == [362]) window.location = "http://www.newyankee.com/GetYankees2.cgi?pamarshallkrebs.jpg"; else if (jumpto == [363]) window.location = "http://www.newyankee.com/GetYankees2.cgi?pascottsheaffer.jpg"; else if (jumpto == [364]) window.location = "http://www.newyankee.com/GetYankees2.cgi?paterrycrippen.jpg"; else if (jumpto == [365]) window.location = "http://www.newyankee.com/GetYankees2.cgi?patjpera.jpg"; else if (jumpto == [366]) window.location = "http://www.newyankee.com/GetYankees2.cgi?patoddpatterson.jpg"; else if (jumpto == [367]) window.location = "http://www.newyankee.com/GetYankees2.cgi?patomrehm.jpg"; else if (jumpto == [368]) window.location = "http://www.newyankee.com/GetYankees2.cgi?pavicschreck.jpg"; else if (jumpto == [369]) window.location = "http://www.newyankee.com/GetYankees2.cgi?pawilliamhowen.jpg"; else if (jumpto == [370]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ricarlruggieri.jpg"; else if (jumpto == [371]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ripetermccrea.jpg"; else if (jumpto == [372]) window.location = "http://www.newyankee.com/GetYankees2.cgi?scbillmovius.jpg"; else if (jumpto == [373]) window.location = "http://www.newyankee.com/GetYankees2.cgi?scbryanrackley.jpg"; else if (jumpto == [374]) window.location = "http://www.newyankee.com/GetYankees2.cgi?scchrisgoodman.jpg"; else if (jumpto == [375]) window.location = "http://www.newyankee.com/GetYankees2.cgi?scdarrellmunn.jpg"; else if (jumpto == [376]) window.location = "http://www.newyankee.com/GetYankees2.cgi?scdonsandusky.jpg"; else if (jumpto == [377]) window.location = "http://www.newyankee.com/GetYankees2.cgi?scscotalexander.jpg"; else if (jumpto == [378]) window.location = "http://www.newyankee.com/GetYankees2.cgi?sctimbajuscik.jpg"; else if (jumpto == [379]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ststuartcoltart.jpg"; else if (jumpto == [380]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tnbilobautista.jpg"; else if (jumpto == [381]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tnbrucebowman.jpg"; else if (jumpto == [382]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tndavidchipman.jpg"; else if (jumpto == [383]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tndavidcizunas.jpg"; else if (jumpto == [384]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tndavidreed.jpg"; else if (jumpto == [385]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tnhankdunkin.jpg"; else if (jumpto == [386]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tnkenwetherington.jpg"; else if (jumpto == [387]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tnrickgodboldt.jpg"; else if (jumpto == [388]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tnroyowen.jpg"; else if (jumpto == [389]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tnsteve.jpg"; else if (jumpto == [390]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tntommymercks.jpg"; else if (jumpto == [391]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tnwarrenmonroe.jpg"; else if (jumpto == [392]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txbillvanpelt.jpg"; else if (jumpto == [393]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txcarolynmoncivais.jpg"; else if (jumpto == [394]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txchucksteding.jpg"; else if (jumpto == [395]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txclintlafont.jpg"; else if (jumpto == [396]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txcurthackett.jpg"; else if (jumpto == [397]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txdavidmcneill.jpg"; else if (jumpto == [398]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txdonowen.jpg"; else if (jumpto == [399]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txfrankcox.jpg"; else if (jumpto == [400]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txglenbang.jpg"; else if (jumpto == [401]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txhowardlaunius.jpg"; else if (jumpto == [402]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txjamienorwood.jpg"; else if (jumpto == [403]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txjimmarkle.jpg"; else if (jumpto == [404]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txjimmcnamara.jpg"; else if (jumpto == [405]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txjoelgulker.jpg"; else if (jumpto == [406]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txjoeveillon.jpg"; else if (jumpto == [407]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txjohnburns.jpg"; else if (jumpto == [408]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txkeithmartin.jpg"; else if (jumpto == [409]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txkennymiller.jpg"; else if (jumpto == [410]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txkirkconstable.jpg"; else if (jumpto == [411]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txkylekelley.jpg"; else if (jumpto == [412]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txlesjones.jpg"; else if (jumpto == [413]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txlynnlacey.jpg"; else if (jumpto == [414]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txmarksimmons.jpg"; else if (jumpto == [415]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txmauriceharris.jpg"; else if (jumpto == [416]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txmichaelbrown.jpg"; else if (jumpto == [417]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txrichardthomas.jpg"; else if (jumpto == [418]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txrickent.jpg"; else if (jumpto == [419]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txtomlovelace.jpg"; else if (jumpto == [420]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txvareckwalla.jpg"; else if (jumpto == [421]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukbrianstainton.jpg"; else if (jumpto == [422]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukdavegrimwood.jpg"; else if (jumpto == [423]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukdavidevans.jpg"; else if (jumpto == [424]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukgeoffbogg.jpg"; else if (jumpto == [425]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukgordondale.jpg"; else if (jumpto == [426]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukharborne.jpg"; else if (jumpto == [427]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukjamesobrian.jpg"; else if (jumpto == [428]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukjeffjones.jpg"; else if (jumpto == [429]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukjohnworthington.jpg"; else if (jumpto == [430]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukkeithrobinson.jpg"; else if (jumpto == [431]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukkoojanzen.jpg"; else if (jumpto == [432]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukleewebster.jpg"; else if (jumpto == [433]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukpaultebbutt.jpg"; else if (jumpto == [434]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukriaanstrydom.jpg"; else if (jumpto == [435]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukrickdare.jpg"; else if (jumpto == [436]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukterrychadwick.jpg"; else if (jumpto == [437]) window.location = "http://www.newyankee.com/GetYankees2.cgi?utbobcanestrini.jpg"; else if (jumpto == [438]) window.location = "http://www.newyankee.com/GetYankees2.cgi?utdonthornock.jpg"; else if (jumpto == [439]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vaartgreen.jpg"; else if (jumpto == [440]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vabobheller.jpg"; else if (jumpto == [441]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vaclintadkins.jpg"; else if (jumpto == [442]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vadanieltepe.jpg"; else if (jumpto == [443]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vadanmeier.jpg"; else if (jumpto == [444]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vadavidminnix.jpg"; else if (jumpto == [445]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vadavidyoho.jpg"; else if (jumpto == [446]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vadickthornsberry.jpg"; else if (jumpto == [447]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vamarksimonds.jpg"; else if (jumpto == [448]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vamichaelkoch.jpg"; else if (jumpto == [449]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vamikeperozziello.jpg"; else if (jumpto == [450]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vamikepingrey.jpg"; else if (jumpto == [451]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vapatrickkearney.jpg"; else if (jumpto == [452]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vapaulstreet.jpg"; else if (jumpto == [453]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vatonydemasi.jpg"; else if (jumpto == [454]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vatroylong.jpg"; else if (jumpto == [455]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vatroylong2.jpg"; else if (jumpto == [456]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vaweslyon.jpg"; else if (jumpto == [457]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wabryanthomas.jpg"; else if (jumpto == [458]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wageorgebryan.jpg"; else if (jumpto == [459]) window.location = "http://www.newyankee.com/GetYankees2.cgi?waglennpiersall.jpg"; else if (jumpto == [460]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wajoewanjohi.jpg"; else if (jumpto == [461]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wajohndrapala.jpg"; else if (jumpto == [462]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wajohnfernstrom.jpg"; else if (jumpto == [463]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wajohnmickelson.jpg"; else if (jumpto == [464]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wakeithjohnson.jpg"; else if (jumpto == [465]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wamarkdenman.jpg"; else if (jumpto == [466]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wamiketaylor.jpg"; else if (jumpto == [467]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wascottboyd.jpg"; else if (jumpto == [468]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wibryanschappel.jpg"; else if (jumpto == [469]) window.location = "http://www.newyankee.com/GetYankees2.cgi?widenniszuber.jpg"; else if (jumpto == [470]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wigeorgebregar.jpg"; else if (jumpto == [471]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wikevinwarren.jpg"; else if (jumpto == [472]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wirichorde.jpg"; else if (jumpto == [473]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wistevenricks.jpg"; else if (jumpto == [474]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wiweswolfrom.jpg"; else if (jumpto == [475]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wvdannorby.jpg"; } reportCompare('No Crash', 'No Crash', '');
cstipkovic/spidermonkey-research
js/src/tests/js1_5/Regress/regress-96526-001.js
JavaScript
mpl-2.0
52,180
<!DOCTYPE html> <!-- DO NOT EDIT! Generated by upgrade-insecure-requests/generic/tools/generate.py using common/security-features/tools/template/test.release.html.template. --> <html> <head> <title>Upgrade-Insecure-Requests: No upgrade-insecure-request</title> <meta charset='utf-8'> <meta name="description" content="No upgrade-insecure-request"> <link rel="author" title="Kristijan Burnik" href="[email protected]"> <link rel="help" href="https://w3c.github.io/webappsec-upgrade-insecure-requests/"> <meta name="assert" content="Upgrade-Insecure-Requests: Expects blocked for worklet-layout-import-data to same-http-downgrade origin and no-redirect redirection from https context."> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/common/security-features/resources/common.sub.js"></script> <script src="/upgrade-insecure-requests/generic/test-case.sub.js"></script> </head> <body> <script> TestCase( { "expectation": "blocked", "origin": "same-http-downgrade", "redirection": "no-redirect", "source_context_list": [ { "policyDeliveries": [], "sourceContextType": "iframe-blank" } ], "source_scheme": "https", "subresource": "worklet-layout-import-data", "subresource_policy_deliveries": [] }, document.querySelector("meta[name=assert]").content, new SanityChecker() ).start(); </script> <div id="log"></div> </body> </html>
saneyuki/servo
tests/wpt/web-platform-tests/upgrade-insecure-requests/gen/iframe-blank-inherit.meta/unset/worklet-layout-import-data/same-http-downgrade.no-redirect.https.html
HTML
mpl-2.0
1,639
(function(angular) { var app = angular.module('search.controller.spatial', ['ng-mapasculturais']); app.controller('SearchSpatialController', ['$window', '$scope', '$location', "$rootScope", "$timeout", function($window, $scope, $location, $rootScope, $timeout) { var map = null; if($scope.data.global.locationFilters.address.text != "") filterAddress(); var labels = MapasCulturais.gettext.controllerSpatial; angular.element(document).ready(function() { map = $window.leaflet.map; if(!map) return; map.invalidateSize(); var drawnItems = new L.FeatureGroup(); map.addLayer(drawnItems); $window.leaflet.map.drawnItems = drawnItems; if($scope.data.global.locationFilters.enabled){ var lf = $scope.data.global.locationFilters; (new L.Circle( new L.LatLng(lf[lf.enabled].center.lat, lf[lf.enabled].center.lng), lf[lf.enabled].radius, {className : 'vetorial-padrao'} ).addTo(map.drawnItems)); if($scope.data.global.locationFilters.enabled == 'address'){ filterAddress (); } } L.drawLocal.draw.handlers.circle.tooltip.start = labels['tooltip.start']; L.drawLocal.draw.handlers.circle.tooltip.end = labels['tooltip.end']; L.drawLocal.draw.toolbar.actions.title = labels['title']; L.drawLocal.draw.toolbar.actions.text = labels['text']; L.drawLocal.draw.toolbar.buttons.circle = labels['circle']; L.Draw.Circle = L.Draw.Circle.extend({ _onMouseMove: function(e) { var latlng = e.latlng, showRadius = this.options.showRadius, useMetric = this.options.metric, radius; this._tooltip.updatePosition(latlng); if (this._isDrawing) { this._drawShape(latlng); // Get the new radius (rounded to 1 dp) radius = this._shape.getRadius().toFixed(1); this._tooltip.updateContent({ text: L.drawLocal.draw.handlers.circle.tooltip.end, subtext: showRadius ? labels['radius'] + ': ' + L.GeometryUtil.readableDistance(radius, useMetric).replace('.',',') : '' }); } } }); var drawControl = new L.Control.Draw({ draw: { position: 'topleft', polygon: false, rectangle: false, marker: false, polyline: false, circle: { shapeOptions: { className : 'vetorial-padrao' } } }, edit: false, }); map.addControl(drawControl); map.on('draw:created', function(e) { var type = e.layerType, layer = e.layer; if (type === 'circle') { $scope.data.global.locationFilters = { enabled : 'circle', circle : { center : { lat: layer._latlng.lat, lng: layer._latlng.lng }, radius: parseInt(layer._mRadius), } }; $scope.$apply(); } if (type === 'marker') { layer.bindPopup('A popup!'); } if($window.leaflet.locationMarker) $window.leaflet.map.removeLayer($window.leaflet.locationMarker); drawnItems.addLayer(layer); //ESCONDE O CONTROLE PARA POSTERIORMENTE USAR O BOTÃO (NÃO CONSEGUI SETAR OS EVENTOS DO DRAW CIRCLE SEM ESTE CONTROLE //document.querySelector('.leaflet-draw-draw-circle').style.display = 'none'; }); //ESCONDE O CONTROLE PARA POSTERIORMENTE USAR O BOTÃO (NÃO CONSEGUI SETAR OS EVENTOS DO DRAW CIRCLE SEM ESTE CONTROLE // document.querySelector('.leaflet-draw-draw-circle').style.display = 'none'; map.on('locationfound', function(e) { $window.$timout.cancel($window.dataTimeout); var radius = e.accuracy / 2, neighborhoodRadius = $scope.defaultLocationRadius; var currentLocationLabel = labels['currentLocation']; currentLocationLabel.replace('{{errorMargin}}', radius.toString().replace('.',',')); currentLocationLabel.replace('{{radius}}', neighborhoodRadius/1000); var marker = L.marker(e.latlng, $window.leaflet.iconOptions['location']).addTo(map) .bindPopup(currentLocationLabel) .openPopup(); var circle = L.circle(e.latlng, $scope.defaultLocationRadius, {className : 'vetorial-padrao'}).addTo(map.drawnItems); $scope.data.global.locationFilters = { enabled : 'neighborhood', neighborhood : { center : { lat: map.getCenter().lat, lng: map.getCenter().lng }, radius : $scope.defaultLocationRadius } }; $scope.$apply(); if($window.leaflet.locationMarker) { $window.leaflet.map.removeLayer($window.leaflet.locationMarker); $window.leaflet.map.removeLayer($window.leaflet.locationCircle); } $window.leaflet.locationMarker = marker; $window.leaflet.locationCircle = circle; }); map.on('locationerror', function(e) { /* @TODO alert de erro para o usuário */ }); //to fix address field not getting focus on touch screens $('#endereco').on('click dblclick', function(e){ var $self = $(this); $self.focus(); e.stopPropagation(); //loose focus on click outslide $('body').one('click', function(event){ if($self.parent().find(event.target).length == 0){ $self.blur(); } }); }); }); $scope.filterNeighborhood = function (){ $window.leaflet.map.locate({setView : true, maxZoom:13}); }; function filterAddress () { var addressString = $scope.data.global.locationFilters.address.text; MapasCulturais.geocoder.geocode({'fullAddress': addressString}, function(results) { if (results) { $window.$timout.cancel($window.dataTimeout); var foundLocation = new L.latLng(results.lat, results.lon); $window.leaflet.map.setView(foundLocation, 13); if($window.leaflet.locationMarker) { $window.leaflet.map.removeLayer($window.leaflet.locationMarker); $window.leaflet.map.removeLayer($window.leaflet.locationCircle); } $window.leaflet.locationMarker = new L.marker(foundLocation, $window.leaflet.iconOptions['location']).addTo($window.leaflet.map); $window.leaflet.locationCircle = L.circle(foundLocation, $scope.defaultLocationRadius, {className : 'vetorial-padrao'}) .addTo($window.leaflet.map.drawnItems); $scope.data.global.locationFilters = { enabled : 'address', address : { text : $scope.data.global.locationFilters.address.text, center : { lat: results.lat, lng: results.lon }, radius : $scope.defaultLocationRadius } }; $scope.$apply(); } }); }; $scope.$watch('data.global.locationFilters.address.text', function(newValue, oldValue){ if(!newValue && !oldValue || newValue == oldValue){ return; } //if(newValue === '' || newValue === oldValue) return; if(!newValue || !newValue.trim()) { $scope.data.global.locationFilters.enabled = null; if($rootScope.resultLayer.getBounds()._northEast) map.fitBounds($rootScope.resultLayer.getBounds()); return; } $timeout.cancel($scope.timer2); $scope.timer2 = $timeout(function() { filterAddress(); }, 1000); }); }]); })(angular);
secultce/mapasculturais
src/protected/application/themes/BaseV1/assets/js/ng.search.controller.spatial.js
JavaScript
agpl-3.0
9,361
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Using Transactions</title> <link rel="stylesheet" href="gettingStarted.css" type="text/css" /> <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /> <link rel="start" href="index.html" title="Berkeley DB Collections Tutorial" /> <link rel="up" href="BasicProgram.html" title="Chapter 2.  The Basic Program" /> <link rel="prev" href="implementingmain.html" title="Implementing the Main Program" /> <link rel="next" href="addingdatabaseitems.html" title="Adding Database Items" /> </head> <body> <div xmlns="" class="navheader"> <div class="libver"> <p>Library Version 12.1.6.0</p> </div> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center"> Using Transactions </th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="implementingmain.html">Prev</a> </td> <th width="60%" align="center">Chapter 2.  The Basic Program </th> <td width="20%" align="right"> <a accesskey="n" href="addingdatabaseitems.html">Next</a></td> </tr> </table> <hr /> </div> <div class="sect1" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h2 class="title" style="clear: both"><a id="usingtransactions"></a> Using Transactions </h2> </div> </div> </div> <p> DB transactional applications have standard transactional characteristics: recoverability, atomicity and integrity (this is sometimes also referred to generically as <span class="emphasis"><em>ACID properties</em></span>). The DB Java Collections API provides these transactional capabilities using a <span class="emphasis"><em>transaction-per-thread</em></span> model. Once a transaction is begun, it is implicitly associated with the current thread until it is committed or aborted. This model is used for the following reasons. </p> <div class="itemizedlist"> <ul type="disc"> <li> <p> The transaction-per-thread model is commonly used in other Java APIs such as J2EE. </p> </li> <li> <p> Since the Java collections API is used for data access, there is no way to pass a transaction object to methods such as <a class="ulink" href="http://download.oracle.com/javase/1.5.0/docs/api/java/util/Map.html#put(K, V)" target="_top">Map.put</a>. </p> </li> </ul> </div> <p> The DB Java Collections API provides two transaction APIs. The lower-level API is the <a class="ulink" href="../../java/com/sleepycat/collections/CurrentTransaction.html" target="_top">CurrentTransaction</a> class. It provides a way to get the transaction for the current thread, and to begin, commit and abort transactions. It also provides access to the Berkeley DB core API <a class="ulink" href="../../java/com/sleepycat/db/Transaction.html" target="_top">Transaction</a> object. With <a class="ulink" href="../../java/com/sleepycat/collections/CurrentTransaction.html" target="_top">CurrentTransaction</a>, just as in the <span>com.sleepycat.db</span> API, the application is responsible for beginning, committing and aborting transactions, and for handling deadlock exceptions and retrying operations. This API may be needed for some applications, but it is not used in the example. </p> <p> The example uses the higher-level <a class="ulink" href="../../java/com/sleepycat/collections/TransactionRunner.html" target="_top">TransactionRunner</a> and <a class="ulink" href="../../java/com/sleepycat/collections/TransactionWorker.html" target="_top">TransactionWorker</a> APIs, which are build on top of <a class="ulink" href="../../java/com/sleepycat/collections/CurrentTransaction.html" target="_top">CurrentTransaction</a>. <code class="methodname">TransactionRunner.run()</code> automatically begins a transaction and then calls the <code class="methodname">TransactionWorker.doWork()</code> method, which is implemented by the application. </p> <p> The <code class="methodname">TransactionRunner.run()</code> method automatically detects deadlock exceptions and performs retries by repeatedly calling the <code class="methodname">TransactionWorker.doWork()</code> method until the operation succeeds or the maximum retry count is reached. If the maximum retry count is reached or if another exception (other than <span> <a class="ulink" href="../../java/com/sleepycat/db/DeadlockException.html" target="_top">DeadlockException</a>) </span> is thrown by <code class="methodname">TransactionWorker.doWork()</code>, then the transaction will be automatically aborted. Otherwise, the transaction will be automatically committed. </p> <p> Using this high-level API, if <code class="methodname">TransactionRunner.run()</code> throws an exception, the application can assume that the operation failed and the transaction was aborted; otherwise, when an exception is not thrown, the application can assume the operation succeeded and the transaction was committed. </p> <p> The <code class="methodname">Sample.run()</code> method creates a <code class="classname">TransactionRunner</code> object and calls its <code class="methodname">run()</code> method. </p> <a id="cb_sample1"></a> <pre class="programlisting"><strong class="userinput"><code>import com.sleepycat.collections.TransactionRunner; import com.sleepycat.collections.TransactionWorker;</code></strong> ... public class Sample { private SampleDatabase db; ... <strong class="userinput"><code> private void run() throws Exception { TransactionRunner runner = new TransactionRunner(db.getEnvironment()); runner.run(new PopulateDatabase()); runner.run(new PrintDatabase()); } ... private class PopulateDatabase implements TransactionWorker { public void doWork() throws Exception { } } private class PrintDatabase implements TransactionWorker { public void doWork() throws Exception { } }</code></strong> } </pre> <p> The <code class="methodname">run()</code> method is called by <code class="methodname">main()</code> and was outlined in the previous section. It first creates a <code class="classname">TransactionRunner</code>, passing the database environment to its constructor. </p> <p> It then calls <code class="methodname">TransactionRunner.run()</code> to execute two transactions, passing instances of the application-defined <code class="classname">PopulateDatabase</code> and <code class="classname">PrintDatabase</code> nested classes. These classes implement the <code class="methodname">TransactionWorker.doWork()</code> method and will be fully described in the next two sections. </p> <p> For each call to <code class="methodname">TransactionRunner.run()</code>, a separate transaction will be performed. The use of two transactions in the example — one for populating the database and another for printing its contents — is arbitrary. A real-life application should be designed to create transactions for each group of operations that should have ACID properties, while also taking into account the impact of transactions on performance. </p> <p> The advantage of using <code class="classname">TransactionRunner</code> is that deadlock retries and transaction begin, commit and abort are handled automatically. However, a <code class="classname">TransactionWorker</code> class must be implemented for each type of transaction. If desired, anonymous inner classes can be used to implement the <code class="classname">TransactionWorker</code> interface. </p> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="implementingmain.html">Prev</a> </td> <td width="20%" align="center"> <a accesskey="u" href="BasicProgram.html">Up</a> </td> <td width="40%" align="right"> <a accesskey="n" href="addingdatabaseitems.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top"> Implementing the Main Program  </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top">  Adding Database Items </td> </tr> </table> </div> </body> </html>
hyc/BerkeleyDB
docs/collections/tutorial/usingtransactions.html
HTML
agpl-3.0
9,191
// Fixed Personal Area // If you want the personal area to have a fixed position, please uncomment the following line. // .custom-css_fixed-personal-area(); .custom-css_fixed-personal-area(){ #header { margin-top: 60px; } #personalArea { position: fixed; padding-left: 0; padding-right: 0; width: 100%; z-index: 999; } #personalArea #personalAreaUser { padding-left: 40px; } #personalArea #personalAreaTime { padding-right: 40px; } } // Hide Portal Modules on Smartphones // If you want to hide portal modules on Smartphone, get the CSS-Class for the module from the source text in your browser, uncomment the following line and add the CSS Class. // .custom-css_hide-portal-modules(" .offi_conf_portal, .birthday_portal "); .custom-css_hide-portal-modules(@portal-modules:""){ @portal-modules-classes: ~'@{portal-modules}'; @media all and (max-width: 480px) { @{portal-modules-classes} { display:none; } } } // Give Article Headlines of some categories a special color // If you want to change the color of Article Headlines, change following list. // The List will be seperated for each category and the bade-color parameter is optional. // List Parameter (seperate each category by comma): article-category-id color badge-color .custom-css_article-headline-colors( // 1 #000, // This line change the category 1 to black without badge changes // 3 #fff #000, // This line change the category 3 to white and badge color to black // 4 #aaa ;); .custom-css_article-headline-colors(@article-categories, @i:1) when(@i <= length(@article-categories)){ @id: extract(extract(@article-categories, @i), 1); @color: extract(extract(@article-categories, @i), 2); @ribbon: extract(extract(@article-categories, @i), 3); .syntax-check() when(isnumber(@id)) and(iscolor(@color)){ .article-container[data-article-category-id="@{id}"] h2 a, .article_detail_container[data-article-category-id="@{id}"] h1 { color: @color; } .ribbon-color() when(iscolor(@ribbon)){ .article-container[data-article-category-id="@{id}"] .ribbon > span { background: linear-gradient(lighten(@color, 20), @color); color: @ribbon; } }.ribbon-color(); }.syntax-check(); .custom-css_article-headline-colors(@article-categories, @i+1); } // EQdkp-Plus Embedded // If you want to embedd EQdkp-Plus, uncomment the following line and use this JavaScript Code: $('body').switchClass('responsive','embedded',0); // .custom-css_embedded(); .custom-css_embedded(){ body.embedded { background:transparent; } .embedded #header, .embedded .personalAreaTime { display:none; } .embedded #contentContainer { background: transparent; margin:0; box-shadow: none; border: none; } .embedded #personalArea { padding-right: 20px; padding-left: 20px; margin-bottom: 0; box-shadow: none; } .embedded #contentBody, .embedded #contentBody2 { background: transparent; border: none; } .embedded #footer, .embedded .copyright, .embedded #footer a, .embedded #copyright a { color:inherit; } } // Show Portal Modules in a row // If you want to show portal modules in a row, uncomment following line. // .custom-css_portal-module-row(); .custom-css_portal-module-row(){ #portal-middle, #portal-footer { display: flex; justify-content: space-around; align-items: stretch; .portalbox { flex: 1 1 auto; display: flex; flex-direction: column; } .portalbox_content { display: flex; justify-content: space-around; flex: 1 1 auto; } .colorswitch { background-color: none; display: flex; align-items: flex-end; text-align: center; flex-wrap: wrap; justify-content: center; div { background-color:transparent; } } } } // Color Usernames of special Group // If you want to change the color of special groups, change following list. // List Parameter (seperate each group by comma): user-group-id color .custom-css_group-usernames( // 1 #000, // This line change the color of group 1 to black // 3 #fff, // This line change the color of group 3 to white // 4 #aaa ;); .custom-css_group-usernames(@groups, @i:1) when(@i <= length(@groups)){ @id: extract(extract(@groups, @i), 1); @color: extract(extract(@groups, @i), 2); .syntax-check() when(isnumber(@id)) and(iscolor(@color)){ a[data-user-group-id="@{id}"] { color: @color !important; } a[data-usergroup-id="@{id}"] { background-color: @color; } [data-user-group-id="@{id}"] img { border: 2px solid @color !important; } }.syntax-check(); .custom-css_group-usernames(@groups, @i+1); } // Sort Roles/Classes on Raid Event Detail View in custom order // If you want to sort the Roles/Classes on Raid Event Detail View in custom order. // Uncomment and change the following line, parameters are class-id 1,2,3,4,5... // .custom-css_sort-event-roles(5,4,1,2,3,6,7); .custom-css_sort-event-roles(@slot_order...){ .loop(@i:1) when(@i <= length(@slot_order)){ .attendee_table .class_column[data-class-id="@{i}"] { order: extract(@slot_order, @i); } .loop(@i+1); }.loop(); } // Change Status Color on Raid Event Detail View (required Version: 2.3.11) // If you want to change the Status Color on Raid Event Detail View. // Uncomment and change the following line, parameters are status-id 0,1,2,3 // .custom-css_event-status-color(#00a400, #e9ec00, #E80000, purple); .custom-css_event-status-color(@status_color...){ .loop(@i:0) when(@i < length(@status_color)){ .raidcal-attendance-status-@{i} { color: extract(@status_color, @i+1); } .loop(@i+1); }.loop(); } // Use Flag on Raid Event Detail View (required Version: 2.3.11) // If you want to use flags instead of the current icons for the attendance status indicator. // Uncomment the following line // .custom-css_event-status-icon(); .custom-css_event-status-icon(@icon:'\f024'){ .raidcal-attendance-status-0:before, .raidcal-attendance-status-1:before, .raidcal-attendance-status-2:before, .raidcal-attendance-status-3:before { font-family: FontAwesome; content: @icon; } }
EQdkpPlus/core
templates/eqdkp_modern/TEMPLATE.custom.css
CSS
agpl-3.0
6,092
# # Copyright (C) 2012 Instructure, Inc. # # This file is part of Canvas. # # Canvas is free software: you can redistribute it and/or modify it under # the terms of the GNU Affero General Public License as published by the Free # Software Foundation, version 3 of the License. # # Canvas is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more # details. # # You should have received a copy of the GNU Affero General Public License along # with this program. If not, see <http://www.gnu.org/licenses/>. # require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb') require 'socket' describe Course do before(:each) do @course = Course.new end it "should propery determine if group weights are active" do @course.update_attribute(:group_weighting_scheme, nil) @course.apply_group_weights?.should == false @course.update_attribute(:group_weighting_scheme, 'equal') @course.apply_group_weights?.should == false @course.update_attribute(:group_weighting_scheme, 'percent') @course.apply_group_weights?.should == true end it "should know if it has been soft-concluded" do @course.enrollment_term = EnrollmentTerm.create! # Both course and term end_at dates are nil @course.should_not be_soft_concluded # Course end_at is in the past @course.update_attribute(:conclude_at, Time.now - 1.week) @course.should be_soft_concluded # Course end_at in the future, term end_at in the past @course.update_attribute(:conclude_at, Time.now + 1.week) @course.enrollment_term.update_attribute(:end_at, Time.now - 1.week) @course.should be_soft_concluded # Both course and term end_at dates are in the future @course.enrollment_term.update_attribute(:end_at, Time.now + 1.week) @course.should_not be_soft_concluded end context "validation" do it "should create a new instance given valid attributes" do course_model end end it "should create a unique course." do @course = Course.create_unique @course.name.should eql("My Course") @uuid = @course.uuid @course2 = Course.create_unique(@uuid) @course.should eql(@course2) end it "should always have a uuid, if it was created" do @course.save! @course.uuid.should_not be_nil end context "permissions" do it "should follow account chain when looking for generic permissions from AccountUsers" do account = Account.create! sub_account = Account.create!(:parent_account => account) sub_sub_account = Account.create!(:parent_account => sub_account) user = account_admin_user(:account => sub_account) course = Course.create!(:account => sub_sub_account) course.grants_right?(user, nil, :manage).should be_true end # we have to reload the users after each course change here to catch the # enrollment changes that are applied directly to the db with update_all it "should grant delete to the proper individuals" do account_admin_user_with_role_changes(:membership_type => 'managecourses', :role_changes => {:manage_courses => true}) @admin1 = @admin account_admin_user_with_role_changes(:membership_type => 'managesis', :role_changes => {:manage_sis => true}) @admin2 = @admin course_with_teacher(:active_all => true) @designer = user(:active_all => true) @course.enroll_designer(@designer).accept! @ta = user(:active_all => true) @course.enroll_ta(@ta).accept! # active, non-sis course @course.grants_right?(@teacher, nil, :delete).should be_true @course.grants_right?(@designer, nil, :delete).should be_true @course.grants_right?(@ta, nil, :delete).should be_false @course.grants_right?(@admin1, nil, :delete).should be_true @course.grants_right?(@admin2, nil, :delete).should be_false # active, sis course @course.sis_source_id = 'sis_id' @course.save! [@course, @teacher, @designer, @ta, @admin1, @admin2].each(&:reload) @course.grants_right?(@teacher, nil, :delete).should be_false @course.grants_right?(@designer, nil, :delete).should be_false @course.grants_right?(@ta, nil, :delete).should be_false @course.grants_right?(@admin1, nil, :delete).should be_true @course.grants_right?(@admin2, nil, :delete).should be_true # completed, non-sis course @course.sis_source_id = nil @course.complete! [@course, @teacher, @designer, @ta, @admin1, @admin2].each(&:reload) @course.grants_right?(@teacher, nil, :delete).should be_true @course.grants_right?(@designer, nil, :delete).should be_true @course.grants_right?(@ta, nil, :delete).should be_false @course.grants_right?(@admin1, nil, :delete).should be_true @course.grants_right?(@admin2, nil, :delete).should be_false # completed, sis course @course.sis_source_id = 'sis_id' @course.save! [@course, @teacher, @designer, @ta, @admin1, @admin2].each(&:reload) @course.grants_right?(@teacher, nil, :delete).should be_false @course.grants_right?(@designer, nil, :delete).should be_false @course.grants_right?(@ta, nil, :delete).should be_false @course.grants_right?(@admin1, nil, :delete).should be_true @course.grants_right?(@admin2, nil, :delete).should be_true end it "should grant reset_content to the proper individuals" do account_admin_user_with_role_changes(:membership_type => 'managecourses', :role_changes => {:manage_courses => true}) @admin1 = @admin account_admin_user_with_role_changes(:membership_type => 'managesis', :role_changes => {:manage_sis => true}) @admin2 = @admin course_with_teacher(:active_all => true) @designer = user(:active_all => true) @course.enroll_designer(@designer).accept! @ta = user(:active_all => true) @course.enroll_ta(@ta).accept! # active, non-sis course @course.grants_right?(@teacher, nil, :reset_content).should be_true @course.grants_right?(@designer, nil, :reset_content).should be_true @course.grants_right?(@ta, nil, :reset_content).should be_false @course.grants_right?(@admin1, nil, :reset_content).should be_true @course.grants_right?(@admin2, nil, :reset_content).should be_false # active, sis course @course.sis_source_id = 'sis_id' @course.save! [@course, @teacher, @designer, @ta, @admin1, @admin2].each(&:reload) @course.grants_right?(@teacher, nil, :reset_content).should be_true @course.grants_right?(@designer, nil, :reset_content).should be_true @course.grants_right?(@ta, nil, :reset_content).should be_false @course.grants_right?(@admin1, nil, :reset_content).should be_true @course.grants_right?(@admin2, nil, :reset_content).should be_false # completed, non-sis course @course.sis_source_id = nil @course.complete! [@course, @teacher, @designer, @ta, @admin1, @admin2].each(&:reload) @course.grants_right?(@teacher, nil, :reset_content).should be_false @course.grants_right?(@designer, nil, :reset_content).should be_false @course.grants_right?(@ta, nil, :reset_content).should be_false @course.grants_right?(@admin1, nil, :reset_content).should be_true @course.grants_right?(@admin2, nil, :reset_content).should be_false # completed, sis course @course.sis_source_id = 'sis_id' @course.save! [@course, @teacher, @designer, @ta, @admin1, @admin2].each(&:reload) @course.grants_right?(@teacher, nil, :reset_content).should be_false @course.grants_right?(@designer, nil, :reset_content).should be_false @course.grants_right?(@ta, nil, :reset_content).should be_false @course.grants_right?(@admin1, nil, :reset_content).should be_true @course.grants_right?(@admin2, nil, :reset_content).should be_false end def make_date_completed @enrollment.start_at = 4.days.ago @enrollment.end_at = 2.days.ago @enrollment.save! @enrollment.state_based_on_date.should == :completed end it "should grant read_as_admin and read_forum to date-completed teacher" do course_with_teacher(:active_all => 1) make_date_completed @course.prior_enrollments.should == [] @course.grants_right?(@teacher, nil, :read_as_admin).should be_true @course.grants_right?(@teacher, nil, :read_forum).should be_true end it "should grant read_as_admin and read to date-completed teacher of unpublished course" do course_with_teacher(:active_all => 1) @course.update_attribute(:workflow_state, 'claimed') make_date_completed @course.prior_enrollments.should == [] @course.grants_right?(@teacher, nil, :read_as_admin).should be_true @course.grants_right?(@teacher, nil, :read).should be_true end it "should grant read_as_admin, read, manage, and update to date-active designer" do course(:active_all => 1) @designer = user(:active_all => 1) @course.enroll_designer(@designer).accept! @course.grants_right?(@designer, nil, :read_as_admin).should be_true @course.grants_right?(@designer, nil, :read).should be_true @course.grants_right?(@designer, nil, :manage).should be_true @course.grants_right?(@designer, nil, :update).should be_true end it "should grant read_as_admin, read_roster, and read_prior_roster to date-completed designer" do course(:active_all => 1) @designer = user(:active_all => 1) @enrollment = @course.enroll_designer(@designer) @enrollment.accept! @enrollment.start_at = 4.days.ago @enrollment.end_at = 2.days.ago @enrollment.save! @enrollment.state_based_on_date.should == :completed @course.prior_enrollments.should == [] @course.grants_right?(@designer, nil, :read_as_admin).should be_true @course.grants_right?(@designer, nil, :read_roster).should be_true @course.grants_right?(@designer, nil, :read_prior_roster).should be_true end it "should grant read_as_admin and read to date-completed designer of unpublished course" do course(:active_all => 1) @designer = user(:active_all => 1) @enrollment = @course.enroll_designer(@designer) @enrollment.accept! @course.update_attribute(:workflow_state, 'claimed') make_date_completed @course.prior_enrollments.should == [] @course.grants_right?(@designer, nil, :read_as_admin).should be_true @course.grants_right?(@designer, nil, :read).should be_true end it "should not grant read_user_notes or view_all_grades to designer" do course(:active_all => 1) @designer = user(:active_all => 1) @course.enroll_designer(@designer).accept! @course.grants_right?(@designer, nil, :read_user_notes).should be_false @course.grants_right?(@designer, nil, :view_all_grades).should be_false end it "should grant read_grades read_forum to date-completed student" do course_with_student(:active_all => 1) make_date_completed @course.prior_enrollments.should == [] @course.grants_right?(@student, nil, :read_grades).should be_true @course.grants_right?(@student, nil, :read_forum).should be_true end it "should not grant read to completed students of an unpublished course" do course_with_student(:active_user => 1) @course.should be_created @enrollment.update_attribute(:workflow_state, 'completed') @enrollment.should be_completed @course.grants_right?(:read, @student).should be_false end it "should not grant read to soft-completed students of an unpublished course" do course_with_student(:active_user => 1) @course.restrict_enrollments_to_course_dates = true @course.start_at = 4.days.ago @course.conclude_at = 2.days.ago @course.save! @course.should be_created @enrollment.update_attribute(:workflow_state, 'active') @enrollment.state_based_on_date.should == :completed @course.grants_right?(:read, @student).should be_false end it "should not grant read to soft-inactive teachers" do course_with_teacher(:active_user => 1) @course.enrollment_term.update_attributes(:start_at => 2.days.from_now, :end_at => 4.days.from_now) @enrollment.update_attribute(:workflow_state, 'active') @enrollment.state_based_on_date.should == :inactive @course.grants_right?(:read, @teacher).should be_false end end it "should clear content when resetting" do course_with_student @course.discussion_topics.create! @course.quizzes.create! @course.assignments.create! @course.wiki.wiki_page.save! @course.self_enrollment = true @course.sis_source_id = 'sis_id' @course.stuck_sis_fields = [].to_set @course.save! @course.course_sections.should_not be_empty @course.students.should == [@student] @course.stuck_sis_fields.should == [].to_set self_enrollment_code = @course.self_enrollment_code self_enrollment_code.should_not be_nil @new_course = @course.reset_content @course.reload @course.stuck_sis_fields.should == [:workflow_state].to_set @course.course_sections.should be_empty @course.students.should be_empty @course.sis_source_id.should be_nil @course.self_enrollment_code.should be_nil @new_course.reload @new_course.course_sections.should_not be_empty @new_course.students.should == [@student] @new_course.discussion_topics.should be_empty @new_course.quizzes.should be_empty @new_course.assignments.should be_empty @new_course.sis_source_id.should == 'sis_id' @new_course.syllabus_body.should be_blank @new_course.stuck_sis_fields.should == [].to_set @new_course.self_enrollment_code.should == self_enrollment_code @course.uuid.should_not == @new_course.uuid @course.wiki_id.should_not == @new_course.wiki_id @course.replacement_course_id.should == @new_course.id end it "should preserve sticky fields when resetting content" do course_with_student @course.sis_source_id = 'sis_id' @course.course_code = "cid" @course.save! @course.stuck_sis_fields = [].to_set @course.name = "course_name" @course.stuck_sis_fields.should == [:name].to_set @course.save! @course.stuck_sis_fields.should == [:name].to_set @new_course = @course.reset_content @course.reload @course.stuck_sis_fields.should == [:workflow_state, :name].to_set @course.sis_source_id.should be_nil @new_course.reload @new_course.sis_source_id.should == 'sis_id' @new_course.stuck_sis_fields.should == [:name].to_set @course.uuid.should_not == @new_course.uuid @course.replacement_course_id.should == @new_course.id end it "group_categories should not include deleted categories" do course = course_model course.group_categories.count.should == 0 category1 = course.group_categories.create(:name => 'category 1') category2 = course.group_categories.create(:name => 'category 2') course.group_categories.count.should == 2 category1.destroy course.reload course.group_categories.count.should == 1 course.group_categories.to_a.should == [category2] end it "all_group_categories should include deleted categories" do course = course_model course.all_group_categories.count.should == 0 category1 = course.group_categories.create(:name => 'category 1') category2 = course.group_categories.create(:name => 'category 2') course.all_group_categories.count.should == 2 category1.destroy course.reload course.all_group_categories.count.should == 2 end context "users_not_in_groups" do before :each do @course = course(:active_all => true) @user1 = user_model @user2 = user_model @user3 = user_model @enrollment1 = @course.enroll_user(@user1) @enrollment2 = @course.enroll_user(@user2) @enrollment3 = @course.enroll_user(@user3) end it "should not include users through deleted/rejected/completed enrollments" do @enrollment1.destroy @course.users_not_in_groups([]).size.should == 2 end it "should not include users in one of the groups" do group = @course.groups.create group.add_user(@user1) users = @course.users_not_in_groups([group]) users.size.should == 2 users.should_not be_include(@user1) end it "should include users otherwise" do group = @course.groups.create group.add_user(@user1) users = @course.users_not_in_groups([group]) users.should be_include(@user2) users.should be_include(@user3) end end it "should order results of paginate_users_not_in_groups by user's sortable name" do @course = course(:active_all => true) @user1 = user_model; @user1.sortable_name = 'jonny'; @user1.save @user2 = user_model; @user2.sortable_name = 'bob'; @user2.save @user3 = user_model; @user3.sortable_name = 'richard'; @user3.save @course.enroll_user(@user1) @course.enroll_user(@user2) @course.enroll_user(@user3) users = @course.paginate_users_not_in_groups([], 1) users.map{ |u| u.id }.should == [@user2.id, @user1.id, @user3.id] end context "events_for" do it "should return appropriate events" do course_with_teacher(:active_all => true) event1 = @course.calendar_events.create event2 = @course.calendar_events.build :child_event_data => [{:start_at => "2012-01-01", :end_at => "2012-01-02", :context_code => @course.default_section.asset_string}] event2.updating_user = @teacher event2.save! event3 = event2.child_events.first appointment_group = AppointmentGroup.create! :title => "ag", :contexts => [@course] appointment_group.publish! assignment = @course.assignments.create! events = @course.events_for(@teacher) events.should include event1 events.should_not include event2 events.should include event3 events.should include appointment_group events.should include assignment end it "should return appropriate events when no user is supplied" do course_with_teacher(:active_all => true) event1 = @course.calendar_events.create event2 = @course.calendar_events.build :child_event_data => [{:start_at => "2012-01-01", :end_at => "2012-01-02", :context_code => @course.default_section.asset_string}] event2.updating_user = @teacher event2.save! event3 = event2.child_events.first appointment_group = AppointmentGroup.create! :title => "ag", :contexts => [@course] appointment_group.publish! assignment = @course.assignments.create! events = @course.events_for(nil) events.should include event1 events.should_not include event2 events.should_not include event3 events.should_not include appointment_group events.should include assignment end end end describe Course, "enroll" do before(:each) do @course = Course.create(:name => "some_name") @user = user_with_pseudonym end it "should be able to enroll a student" do @course.enroll_student(@user) @se = @course.student_enrollments.first @se.user_id.should eql(@user.id) @se.course_id.should eql(@course.id) end it "should be able to enroll a TA" do @course.enroll_ta(@user) @tae = @course.ta_enrollments.first @tae.user_id.should eql(@user.id) @tae.course_id.should eql(@course.id) end it "should be able to enroll a teacher" do @course.enroll_teacher(@user) @te = @course.teacher_enrollments.first @te.user_id.should eql(@user.id) @te.course_id.should eql(@course.id) end it "should be able to enroll a designer" do @course.enroll_designer(@user) @de = @course.designer_enrollments.first @de.user_id.should eql(@user.id) @de.course_id.should eql(@course.id) end it "should enroll a student as creation_pending if the course isn't published" do @se = @course.enroll_student(@user) @se.user_id.should eql(@user.id) @se.course_id.should eql(@course.id) @se.should be_creation_pending end it "should enroll a teacher as invited if the course isn't published" do Notification.create(:name => "Enrollment Registration", :category => "registration") @tae = @course.enroll_ta(@user) @tae.user_id.should eql(@user.id) @tae.course_id.should eql(@course.id) @tae.should be_invited @tae.messages_sent.should be_include("Enrollment Registration") end it "should enroll a ta as invited if the course isn't published" do Notification.create(:name => "Enrollment Registration", :category => "registration") @te = @course.enroll_teacher(@user) @te.user_id.should eql(@user.id) @te.course_id.should eql(@course.id) @te.should be_invited @te.messages_sent.should be_include("Enrollment Registration") end end describe Course, "score_to_grade" do it "should correctly map scores to grades" do default = GradingStandard.default_grading_standard default.to_json.should eql([["A", 0.94], ["A-", 0.90], ["B+", 0.87], ["B", 0.84], ["B-", 0.80], ["C+", 0.77], ["C", 0.74], ["C-", 0.70], ["D+", 0.67], ["D", 0.64], ["D-", 0.61], ["F", 0]].to_json) course_model @course.score_to_grade(95).should eql(nil) @course.grading_standard_id = 0 @course.score_to_grade(1005).should eql("A") @course.score_to_grade(105).should eql("A") @course.score_to_grade(100).should eql("A") @course.score_to_grade(99).should eql("A") @course.score_to_grade(94).should eql("A") @course.score_to_grade(93.999).should eql("A-") @course.score_to_grade(93.001).should eql("A-") @course.score_to_grade(93).should eql("A-") @course.score_to_grade(92.999).should eql("A-") @course.score_to_grade(90).should eql("A-") @course.score_to_grade(89).should eql("B+") @course.score_to_grade(87).should eql("B+") @course.score_to_grade(86).should eql("B") @course.score_to_grade(85).should eql("B") @course.score_to_grade(83).should eql("B-") @course.score_to_grade(80).should eql("B-") @course.score_to_grade(79).should eql("C+") @course.score_to_grade(76).should eql("C") @course.score_to_grade(73).should eql("C-") @course.score_to_grade(71).should eql("C-") @course.score_to_grade(69).should eql("D+") @course.score_to_grade(67).should eql("D+") @course.score_to_grade(66).should eql("D") @course.score_to_grade(65).should eql("D") @course.score_to_grade(62).should eql("D-") @course.score_to_grade(60).should eql("F") @course.score_to_grade(59).should eql("F") @course.score_to_grade(0).should eql("F") @course.score_to_grade(-100).should eql("F") end end describe Course, "gradebook_to_csv" do it "should generate gradebook csv" do course_with_student(:active_all => true) @group = @course.assignment_groups.create!(:name => "Some Assignment Group", :group_weight => 100) @assignment = @course.assignments.create!(:title => "Some Assignment", :points_possible => 10, :assignment_group => @group) @assignment.grade_student(@user, :grade => "10") @assignment2 = @course.assignments.create!(:title => "Some Assignment 2", :points_possible => 10, :assignment_group => @group) @course.recompute_student_scores @user.reload @course.reload csv = @course.gradebook_to_csv csv.should_not be_nil rows = FasterCSV.parse(csv) rows.length.should equal(3) rows[0][-1].should == "Final Score" rows[1][-1].should == "(read only)" rows[2][-1].should == "50" rows[0][-2].should == "Current Score" rows[1][-2].should == "(read only)" rows[2][-2].should == "100" end it "should order assignments by due date, assignment_group, position, title" do course_with_student(:active_all => true) @assignment_group_1, @assignment_group_2 = [@course.assignment_groups.create!(:name => "Some Assignment Group 1", :group_weight => 100), @course.assignment_groups.create!(:name => "Some Assignment Group 2", :group_weight => 100)].sort_by{|a| a.id} now = Time.now @assignment = @course.assignments.create!(:title => "Some Assignment 01", :points_possible => 10, :due_at => now + 1.days, :position => 3, :assignment_group => @assignment_group_1) @assignment = @course.assignments.create!(:title => "Some Assignment 02", :points_possible => 10, :due_at => now + 1.days, :position => 1, :assignment_group => @assignment_group_1) @assignment = @course.assignments.create!(:title => "Some Assignment 03", :points_possible => 10, :due_at => now + 1.days, :position => 2, :assignment_group => @assignment_group_1) @assignment = @course.assignments.create!(:title => "Some Assignment 05", :points_possible => 10, :due_at => now + 4.days, :position => 4, :assignment_group => @assignment_group_1) @assignment = @course.assignments.create!(:title => "Some Assignment 04", :points_possible => 10, :due_at => now + 5.days, :position => 5, :assignment_group => @assignment_group_1) @assignment = @course.assignments.create!(:title => "Some Assignment 06", :points_possible => 10, :due_at => now + 7.days, :position => 6, :assignment_group => @assignment_group_1) @assignment = @course.assignments.create!(:title => "Some Assignment 07", :points_possible => 10, :due_at => now + 6.days, :position => 7, :assignment_group => @assignment_group_1) @assignment = @course.assignments.create!(:title => "Some Assignment 08", :points_possible => 10, :due_at => now + 8.days, :position => 1, :assignment_group => @assignment_group_2) @assignment = @course.assignments.create!(:title => "Some Assignment 09", :points_possible => 10, :due_at => now + 8.days, :position => 9, :assignment_group => @assignment_group_1) @assignment = @course.assignments.create!(:title => "Some Assignment 10", :points_possible => 10, :due_at => now + 8.days, :position => 10, :assignment_group => @assignment_group_2) @assignment = @course.assignments.create!(:title => "Some Assignment 11", :points_possible => 10, :due_at => now + 11.days, :position => 11, :assignment_group => @assignment_group_1) @assignment = @course.assignments.create!(:title => "Some Assignment 13", :points_possible => 10, :due_at => now + 11.days, :position => 11, :assignment_group => @assignment_group_1) @assignment = @course.assignments.create!(:title => "Some Assignment 12", :points_possible => 10, :due_at => now + 11.days, :position => 11, :assignment_group => @assignment_group_1) @assignment = @course.assignments.create!(:title => "Some Assignment 14", :points_possible => 10, :due_at => nil, :position => 14, :assignment_group => @assignment_group_1) @course.recompute_student_scores @user.reload @course.reload csv = @course.gradebook_to_csv csv.should_not be_nil rows = FasterCSV.parse(csv) rows.length.should equal(3) assignments = [] rows[0].each do |column| assignments << column.sub(/ \([0-9]+\)/, '') if column =~ /Some Assignment/ end assignments.should == ["Some Assignment 14", "Some Assignment 02", "Some Assignment 03", "Some Assignment 01", "Some Assignment 05", "Some Assignment 04", "Some Assignment 07", "Some Assignment 06", "Some Assignment 09", "Some Assignment 08", "Some Assignment 10", "Some Assignment 11", "Some Assignment 12", "Some Assignment 13"] end it "should work for just one assignment" do course_with_student(:active_all => true) now = Time.now @assignment = @course.assignments.create!(:title => "Some Assignment 1", :points_possible => 10, :assignment_group => @group, :due_at => now + 1.days, :position => 3) @assignment = @course.assignments.create!(:title => "Some Assignment 2", :points_possible => 10, :assignment_group => @group, :due_at => now + 1.days, :position => 1) @course.recompute_student_scores @user.reload @course.reload csv = @course.gradebook_to_csv :assignment_id => @assignment csv.should_not be_nil rows = FasterCSV.parse(csv) rows.length.should equal(3) assignments = [] rows[0].each do |column| assignments << column.sub(/ \([0-9]+\)/, '') if column =~ /Some Assignment/ end assignments.should == ["Some Assignment 2"] end it "should generate csv with final grade if enabled" do course_with_student(:active_all => true) @course.grading_standard_id = 0 @course.save! @group = @course.assignment_groups.create!(:name => "Some Assignment Group", :group_weight => 100) @assignment = @course.assignments.create!(:title => "Some Assignment", :points_possible => 10, :assignment_group => @group) @assignment.grade_student(@user, :grade => "10") @assignment2 = @course.assignments.create!(:title => "Some Assignment 2", :points_possible => 10, :assignment_group => @group) @assignment2.grade_student(@user, :grade => "8") @course.recompute_student_scores @user.reload @course.reload csv = @course.gradebook_to_csv csv.should_not be_nil rows = FasterCSV.parse(csv) rows.length.should equal(3) rows[0][-1].should == "Final Grade" rows[1][-1].should == "(read only)" rows[2][-1].should == "A-" rows[0][-2].should == "Final Score" rows[1][-2].should == "(read only)" rows[2][-2].should == "90" rows[0][-3].should == "Current Score" rows[1][-3].should == "(read only)" rows[2][-3].should == "90" end it "should include sis ids if enabled" do course(:active_all => true) @user1 = user_with_pseudonym(:active_all => true, :name => 'Brian', :username => '[email protected]') student_in_course(:user => @user1) @user2 = user_with_pseudonym(:active_all => true, :name => 'Cody', :username => '[email protected]') student_in_course(:user => @user2) @user3 = user(:active_all => true, :name => 'JT') student_in_course(:user => @user3) @user1.pseudonym.sis_user_id = "SISUSERID" @user1.pseudonym.save! @group = @course.assignment_groups.create!(:name => "Some Assignment Group", :group_weight => 100) @assignment = @course.assignments.create!(:title => "Some Assignment", :points_possible => 10, :assignment_group => @group) @assignment.grade_student(@user1, :grade => "10") @assignment.grade_student(@user2, :grade => "9") @assignment.grade_student(@user3, :grade => "9") @assignment2 = @course.assignments.create!(:title => "Some Assignment 2", :points_possible => 10, :assignment_group => @group) @course.recompute_student_scores @course.reload csv = @course.gradebook_to_csv(:include_sis_id => true) csv.should_not be_nil rows = FasterCSV.parse(csv) rows.length.should == 5 rows[0][1].should == 'ID' rows[0][2].should == 'SIS User ID' rows[0][3].should == 'SIS Login ID' rows[0][4].should == 'Section' rows[1][2].should == '' rows[1][3].should == '' rows[1][4].should == '' rows[1][-1].should == '(read only)' rows[2][1].should == @user1.id.to_s rows[2][2].should == 'SISUSERID' rows[2][3].should == @user1.pseudonym.unique_id rows[3][1].should == @user2.id.to_s rows[3][2].should be_nil rows[3][3].should == @user2.pseudonym.unique_id rows[4][1].should == @user3.id.to_s rows[4][2].should be_nil rows[4][3].should be_nil end it "should only include students once" do # students might have multiple enrollments in a course course(:active_all => true) @user1 = user_with_pseudonym(:active_all => true, :name => 'Brian', :username => '[email protected]') student_in_course(:user => @user1) @user2 = user_with_pseudonym(:active_all => true, :name => 'Cody', :username => '[email protected]') student_in_course(:user => @user2) @s2 = @course.course_sections.create!(:name => 'section2') StudentEnrollment.create!(:user => @user1, :course => @course, :course_section => @s2) @course.reload csv = @course.gradebook_to_csv(:include_sis_id => true) rows = FasterCSV.parse(csv) rows.length.should == 4 end it "should include muted if any assignments are muted" do course(:active_all => true) @user1 = user_with_pseudonym(:active_all => true, :name => 'Brian', :username => '[email protected]') student_in_course(:user => @user1) @user2 = user_with_pseudonym(:active_all => true, :name => 'Cody', :username => '[email protected]') student_in_course(:user => @user2) @user3 = user(:active_all => true, :name => 'JT') student_in_course(:user => @user3) @user1.pseudonym.sis_user_id = "SISUSERID" @user1.pseudonym.save! @group = @course.assignment_groups.create!(:name => "Some Assignment Group", :group_weight => 100) @assignment = @course.assignments.create!(:title => "Some Assignment", :points_possible => 10, :assignment_group => @group) @assignment.muted = true @assignment.save! @assignment.grade_student(@user1, :grade => "10") @assignment.grade_student(@user2, :grade => "9") @assignment.grade_student(@user3, :grade => "9") @assignment2 = @course.assignments.create!(:title => "Some Assignment 2", :points_possible => 10, :assignment_group => @group) @course.recompute_student_scores @course.reload csv = @course.gradebook_to_csv(:include_sis_id => true) csv.should_not be_nil rows = FasterCSV.parse(csv) rows.length.should == 6 rows[0][1].should == 'ID' rows[0][2].should == 'SIS User ID' rows[0][3].should == 'SIS Login ID' rows[0][4].should == 'Section' rows[1][0].should == 'Muted assignments do not impact Current and Final score columns' rows[1][5].should == 'Muted' rows[1][6].should == '' rows[2][2].should == '' rows[2][3].should == '' rows[2][4].should == '' rows[2][-1].should == '(read only)' rows[3][1].should == @user1.id.to_s rows[3][2].should == 'SISUSERID' rows[3][3].should == @user1.pseudonym.unique_id rows[4][1].should == @user2.id.to_s rows[4][2].should be_nil rows[4][3].should == @user2.pseudonym.unique_id rows[5][1].should == @user3.id.to_s rows[5][2].should be_nil rows[5][3].should be_nil end it "should only include students from the appropriate section for a section limited teacher" do course(:active_all => 1) @teacher.enrollments.first.update_attribute(:limit_privileges_to_course_section, true) @section = @course.course_sections.create!(:name => 'section 2') @user1 = user_with_pseudonym(:active_all => true, :name => 'Brian', :username => '[email protected]') @section.enroll_user(@user1, 'StudentEnrollment', 'active') @user2 = user_with_pseudonym(:active_all => true, :name => 'Jeremy', :username => '[email protected]') @course.enroll_student(@user2) csv = @course.gradebook_to_csv(:user => @teacher) csv.should_not be_nil rows = FasterCSV.parse(csv) # two header rows, and one student row rows.length.should == 3 rows[2][1].should == @user2.id.to_s end end describe Course, "update_account_associations" do it "should update account associations correctly" do account1 = Account.create!(:name => 'first') account2 = Account.create!(:name => 'second') @c = Course.create!(:account => account1) @c.associated_accounts.length.should eql(1) @c.associated_accounts.first.should eql(account1) @c.account = account2 @c.save! @c.reload @c.associated_accounts.length.should eql(1) @c.associated_accounts.first.should eql(account2) end end describe Course, "tabs_available" do it "should return the defaults if nothing specified" do course_with_teacher(:active_all => true) length = Course.default_tabs.length tab_ids = @course.tabs_available(@user).map{|t| t[:id] } tab_ids.should eql(Course.default_tabs.map{|t| t[:id] }) tab_ids.length.should eql(length) end it "should overwrite the order of tabs if configured" do course_with_teacher(:active_all => true) length = Course.default_tabs.length @course.tab_configuration = [{'id' => Course::TAB_COLLABORATIONS}, {'id' => Course::TAB_CHAT}] tab_ids = @course.tabs_available(@user).map{|t| t[:id] } tab_ids.should eql(([Course::TAB_COLLABORATIONS, Course::TAB_CHAT] + Course.default_tabs.map{|t| t[:id] }).uniq) tab_ids.length.should eql(length) end it "should remove ids for tabs not in the default list" do course_with_teacher(:active_all => true) @course.tab_configuration = [{'id' => 912}] @course.tabs_available(@user).map{|t| t[:id] }.should_not be_include(912) tab_ids = @course.tabs_available(@user).map{|t| t[:id] } tab_ids.should eql(Course.default_tabs.map{|t| t[:id] }) tab_ids.length.should > 0 @course.tabs_available(@user).map{|t| t[:label] }.compact.length.should eql(tab_ids.length) end it "should hide unused tabs if not an admin" do course_with_student(:active_all => true) tab_ids = @course.tabs_available(@user).map{|t| t[:id] } tab_ids.should_not be_include(Course::TAB_SETTINGS) tab_ids.length.should > 0 end it "should show grades tab for students" do course_with_student(:active_all => true) tab_ids = @course.tabs_available(@user).map{|t| t[:id] } tab_ids.should be_include(Course::TAB_GRADES) end it "should not show grades tab for observers" do course_with_student(:active_all => true) @student = @user user(:active_all => true) @oe = @course.enroll_user(@user, 'ObserverEnrollment') @oe.accept @user.reload tab_ids = @course.tabs_available(@user).map{|t| t[:id] } tab_ids.should_not be_include(Course::TAB_GRADES) end it "should show grades tab for observers if they are linked to a student" do course_with_student(:active_all => true) @student = @user user(:active_all => true) @oe = @course.enroll_user(@user, 'ObserverEnrollment') @oe.accept @oe.associated_user_id = @student.id @oe.save! @user.reload tab_ids = @course.tabs_available(@user).map{|t| t[:id] } tab_ids.should be_include(Course::TAB_GRADES) end it "should show discussion tab for observers by default" do course_with_observer tab_ids = @course.tabs_available(@user).map{|t| t[:id] } tab_ids.should be_include(Course::TAB_DISCUSSIONS) end it "should not show discussion tab for observers without read_forum" do course_with_observer RoleOverride.create!(:context => @course.account, :permission => 'read_forum', :enrollment_type => "ObserverEnrollment", :enabled => false) tab_ids = @course.tabs_available(@user).map{|t| t[:id] } tab_ids.should_not be_include(Course::TAB_DISCUSSIONS) end it "should include tabs for active external tools" do course_with_student(:active_all => true) tools = [] 2.times do |n| tools << @course.context_external_tools.create!( :url => "http://example.com/ims/lti", :consumer_key => "asdf", :shared_secret => "hjkl", :name => "external tool #{n+1}", :course_navigation => { :text => "blah", :url => "http://example.com/ims/lti", :default => false, } ) end t1, t2 = tools t2.workflow_state = "deleted" t2.save! tabs = @course.tabs_available.map { |tab| tab[:id] } tabs.should be_include(t1.asset_string) tabs.should_not be_include(t2.asset_string) end end describe Course, "backup" do it "should backup to a valid data structure" do course_to_backup data = @course.backup data.should_not be_nil data.length.should > 0 data.any?{|i| i.is_a?(Assignment)}.should eql(true) data.any?{|i| i.is_a?(WikiPage)}.should eql(true) data.any?{|i| i.is_a?(DiscussionTopic)}.should eql(true) data.any?{|i| i.is_a?(CalendarEvent)}.should eql(true) end it "should backup to a valid json string" do course_to_backup data = @course.backup_to_json data.should_not be_nil data.length.should > 0 parse = JSON.parse(data) rescue nil parse.should_not be_nil parse.should be_is_a(Array) parse.length.should > 0 end context "merge_into_course" do it "should merge implied content into another course" do course_model attachment_model @old_attachment = @attachment @old_topic = @course.discussion_topics.create!(:title => "some topic", :message => "<a href='/courses/#{@course.id}/files/#{@attachment.id}/download'>download this file</a>") html = @old_topic.message html.should match(Regexp.new("/courses/#{@course.id}/files/#{@attachment.id}/download")) @old_course = @course @new_course = course_model @new_course.merge_into_course(@old_course, :all_topics => true) @old_attachment.reload @old_attachment.cloned_item_id.should_not be_nil @new_attachment = @new_course.attachments.find_by_cloned_item_id(@old_attachment.cloned_item_id) @new_attachment.should_not be_nil @old_topic.reload @old_topic.cloned_item_id.should_not be_nil @new_topic = @new_course.discussion_topics.find_by_cloned_item_id(@old_topic.cloned_item_id) @new_topic.should_not be_nil html = @new_topic.message html.should match(Regexp.new("/courses/#{@new_course.id}/files/#{@new_attachment.id}/download")) end it "should bring over linked files if not already brought over" do course_model attachment_model @old_attachment = @attachment @old_topic = @course.discussion_topics.create!(:title => "some topic", :message => "<a href='/courses/#{@course.id}/files/#{@attachment.id}/download'>download this file</a>") html = @old_topic.message html.should match(Regexp.new("/courses/#{@course.id}/files/#{@attachment.id}/download")) @old_course = @course @new_course = course_model html = Course.migrate_content_links(@old_topic.message, @old_course, @new_course) @old_attachment.reload @old_attachment.cloned_item_id.should_not be_nil @new_attachment = @new_course.attachments.find_by_cloned_item_id(@old_attachment.cloned_item_id) @new_attachment.should_not be_nil html.should match(Regexp.new("/courses/#{@new_course.id}/files/#{@new_attachment.id}/download")) end it "should bring over linked files that have been replaced" do course_model attachment_model @orig_attachment = @attachment @old_topic = @course.discussion_topics.create!(:title => "some topic", :message => "<a href='/courses/#{@course.id}/files/#{@attachment.id}/download'>download this file</a>") html = @old_topic.message html.should match(Regexp.new("/courses/#{@course.id}/files/#{@attachment.id}/download")) @orig_attachment.destroy attachment_model @old_attachment = @attachment @old_attachment.handle_duplicates(:overwrite) @old_course = @course @new_course = course_model html = Course.migrate_content_links(@old_topic.message, @old_course, @new_course) @old_attachment.reload @old_attachment.cloned_item_id.should_not be_nil @new_attachment = @new_course.attachments.find_by_cloned_item_id(@old_attachment.cloned_item_id) @new_attachment.should_not be_nil html.should match(Regexp.new("/courses/#{@new_course.id}/files/#{@new_attachment.id}/download")) end end it "should not cross learning outcomes with learning outcome groups in the association" do pending('fails when being run in the single thread rake task') # set up two courses with two outcomes course = course_model default_group = LearningOutcomeGroup.default_for(course) outcome = course.created_learning_outcomes.create! default_group.add_item(outcome) other_course = course_model other_default_group = LearningOutcomeGroup.default_for(other_course) other_outcome = other_course.created_learning_outcomes.create! other_default_group.add_item(other_outcome) # add another group to the first course, which "coincidentally" has the # same id as the second course's outcome other_group = course.learning_outcome_groups.build other_group.id = other_outcome.id other_group.save! default_group.add_item(other_group) # reload and check course.reload other_course.reload course.learning_outcomes.should be_include(outcome) course.learning_outcomes.should_not be_include(other_outcome) other_course.learning_outcomes.should be_include(other_outcome) end it "should not count learning outcome groups as having outcomes" do course = course_model default_group = LearningOutcomeGroup.default_for(course) other_group = course.learning_outcome_groups.create! default_group.add_item(other_group) course.has_outcomes.should == false end end def course_to_backup @course = course group = @course.assignment_groups.create!(:name => "Some Assignment Group") @course.assignments.create!(:title => "Some Assignment", :assignment_group => group) @course.calendar_events.create!(:title => "Some Event", :start_at => Time.now, :end_at => Time.now) @course.wiki.wiki_pages.create!(:title => "Some Page") topic = @course.discussion_topics.create!(:title => "Some Discussion") topic.discussion_entries.create!(:message => "just a test") @course end describe Course, 'grade_publishing' do before(:each) do @course = Course.new @course.root_account_id = Account.default.id @course.save! @course_section = @course.default_section end after(:each) do Course.valid_grade_export_types.delete("test_export") end context 'mocked plugin settings' do before(:each) do @plugin_settings = Canvas::Plugin.find!("grade_export").default_settings.clone @plugin = mock() Canvas::Plugin.stubs("find!".to_sym).with('grade_export').returns(@plugin) @plugin.stubs(:settings).returns{@plugin_settings} end context 'grade_publishing_status_translation' do it 'should work with nil statuses and messages' do @course.grade_publishing_status_translation(nil, nil).should == "Unpublished" @course.grade_publishing_status_translation(nil, "hi").should == "Unpublished: hi" @course.grade_publishing_status_translation("published", nil).should == "Published" @course.grade_publishing_status_translation("published", "hi").should == "Published: hi" end it 'should work with invalid statuses' do @course.grade_publishing_status_translation("invalid_status", nil).should == "Unknown status, invalid_status" @course.grade_publishing_status_translation("invalid_status", "what what").should == "Unknown status, invalid_status: what what" end it "should work with empty string statuses and messages" do @course.grade_publishing_status_translation("", "").should == "Unpublished" @course.grade_publishing_status_translation("", "hi").should == "Unpublished: hi" @course.grade_publishing_status_translation("published", "").should == "Published" @course.grade_publishing_status_translation("published", "hi").should == "Published: hi" end it 'should work with all known statuses' do @course.grade_publishing_status_translation("error", nil).should == "Error" @course.grade_publishing_status_translation("error", "hi").should == "Error: hi" @course.grade_publishing_status_translation("unpublished", nil).should == "Unpublished" @course.grade_publishing_status_translation("unpublished", "hi").should == "Unpublished: hi" @course.grade_publishing_status_translation("pending", nil).should == "Pending" @course.grade_publishing_status_translation("pending", "hi").should == "Pending: hi" @course.grade_publishing_status_translation("publishing", nil).should == "Publishing" @course.grade_publishing_status_translation("publishing", "hi").should == "Publishing: hi" @course.grade_publishing_status_translation("published", nil).should == "Published" @course.grade_publishing_status_translation("published", "hi").should == "Published: hi" @course.grade_publishing_status_translation("unpublishable", nil).should == "Unpublishable" @course.grade_publishing_status_translation("unpublishable", "hi").should == "Unpublishable: hi" end end def make_student_enrollments @student_enrollments = [] 9.times do @student_enrollments << student_in_course({:course => @course, :active_all => true}) end @student_enrollments[0].tap do |enrollment| enrollment.grade_publishing_status = "published" enrollment.save! end @student_enrollments[2].tap do |enrollment| enrollment.grade_publishing_status = "unpublishable" enrollment.save! end @student_enrollments[1].tap do |enrollment| enrollment.grade_publishing_status = "error" enrollment.grade_publishing_message = "cause of this reason" enrollment.save! end @student_enrollments[3].tap do |enrollment| enrollment.grade_publishing_status = "error" enrollment.grade_publishing_message = "cause of that reason" enrollment.save! end @student_enrollments[4].tap do |enrollment| enrollment.grade_publishing_status = "unpublishable" enrollment.save! end @student_enrollments[5].tap do |enrollment| enrollment.grade_publishing_status = "unpublishable" enrollment.save! end @student_enrollments[6].tap do |enrollment| enrollment.workflow_state = "inactive" enrollment.save! end @student_enrollments end def grade_publishing_user @user = user_with_pseudonym @pseudonym.account_id = @course.root_account_id @pseudonym.sis_user_id = "U1" @pseudonym.save! @user end context 'grade_publishing_statuses' do it 'should generate enrollments categorized by grade publishing message' do make_student_enrollments messages, overall_status = @course.grade_publishing_statuses overall_status.should == "error" messages.count.should == 5 messages["Unpublished"].sort_by(&:id).should == [ @student_enrollments[7], @student_enrollments[8] ].sort_by(&:id) messages["Published"].should == [ @student_enrollments[0] ] messages["Error: cause of this reason"].should == [ @student_enrollments[1] ] messages["Error: cause of that reason"].should == [ @student_enrollments[3] ] messages["Unpublishable"].sort_by(&:id).should == [ @student_enrollments[2], @student_enrollments[4], @student_enrollments[5] ].sort_by(&:id) end it 'should correctly figure out the overall status with no enrollments' do @course.grade_publishing_statuses.should == [{}, "unpublished"] end it 'should correctly figure out the overall status with invalid enrollment statuses' do make_student_enrollments @student_enrollments.each do |e| e.grade_publishing_status = "invalid status" e.save! end messages, overall_status = @course.grade_publishing_statuses overall_status.should == "error" messages.count.should == 3 messages["Unknown status, invalid status: cause of this reason"].should == [@student_enrollments[1]] messages["Unknown status, invalid status: cause of that reason"].should == [@student_enrollments[3]] messages["Unknown status, invalid status"].sort_by(&:id).should == [ @student_enrollments[0], @student_enrollments[2], @student_enrollments[4], @student_enrollments[5], @student_enrollments[7], @student_enrollments[8]].sort_by(&:id) end it 'should fall back to the right overall status' do make_student_enrollments @student_enrollments.each do |e| e.grade_publishing_status = "unpublishable" e.grade_publishing_message = nil e.save! end @course.reload.grade_publishing_statuses[1].should == "unpublishable" @student_enrollments[0].tap do |e| e.grade_publishing_status = "published" e.save! end @course.reload.grade_publishing_statuses[1].should == "published" @student_enrollments[1].tap do |e| e.grade_publishing_status = "publishing" e.save! end @course.reload.grade_publishing_statuses[1].should == "publishing" @student_enrollments[2].tap do |e| e.grade_publishing_status = "pending" e.save! end @course.reload.grade_publishing_statuses[1].should == "pending" @student_enrollments[3].tap do |e| e.grade_publishing_status = "unpublished" e.save! end @course.reload.grade_publishing_statuses[1].should == "unpublished" @student_enrollments[4].tap do |e| e.grade_publishing_status = "error" e.save! end @course.reload.grade_publishing_statuses[1].should == "error" end end context 'publish_final_grades' do it 'should check whether or not grade export is enabled - success' do grade_publishing_user @course.expects(:send_final_grades_to_endpoint).with(@user).returns(nil) @plugin.stubs(:enabled?).returns(true) @plugin_settings[:publish_endpoint] = "http://localhost/endpoint" @course.publish_final_grades(@user) end it 'should check whether or not grade export is enabled - failure' do grade_publishing_user @plugin.stubs(:enabled?).returns(false) @plugin_settings[:publish_endpoint] = "http://localhost/endpoint" (lambda {@course.publish_final_grades(@user)}).should raise_error("final grade publishing disabled") end it 'should update all student enrollments with pending and a last update status' do make_student_enrollments @student_enrollments.map(&:reload).map(&:grade_publishing_status).should == ["published", "error", "unpublishable", "error", "unpublishable", "unpublishable", "unpublished", "unpublished", "unpublished"] @student_enrollments.map(&:grade_publishing_message).should == [nil, "cause of this reason", nil, "cause of that reason", nil, nil, nil, nil, nil] @student_enrollments.map(&:workflow_state).should == ["active"] * 6 + ["inactive"] + ["active"] * 2 @student_enrollments.map(&:last_publish_attempt_at).should == [nil] * 9 grade_publishing_user @course.expects(:send_final_grades_to_endpoint).with(@user).returns(nil) @plugin.stubs(:enabled?).returns(true) @plugin_settings[:publish_endpoint] = "http://localhost/endpoint" @course.publish_final_grades(@user) @student_enrollments.map(&:reload).map(&:grade_publishing_status).should == ["pending"] * 6 + ["unpublished"] + ["pending"] * 2 @student_enrollments.map(&:grade_publishing_message).should == [nil] * 9 @student_enrollments.map(&:workflow_state).should == ["active"] * 6 + ["inactive"] + ["active"] * 2 @student_enrollments.map(&:last_publish_attempt_at).each_with_index do |time, i| if i == 6 time.should be_nil else time.should >= @course.created_at end end end it 'should kick off the actual grade send' do grade_publishing_user @course.expects(:send_later_if_production).with(:send_final_grades_to_endpoint, @user).returns(nil) @plugin.stubs(:enabled?).returns(true) @plugin_settings[:publish_endpoint] = "http://localhost/endpoint" @course.publish_final_grades(@user) end it 'should kick off the timeout when a success timeout is defined and waiting is configured' do grade_publishing_user @course.expects(:send_later_if_production).with(:send_final_grades_to_endpoint, @user).returns(nil) current_time = Time.now.utc Time.stubs(:now).returns(current_time) current_time.stubs(:utc).returns(current_time) @course.expects(:send_at).with(current_time + 1.seconds, :expire_pending_grade_publishing_statuses, current_time).returns(nil) @plugin.stubs(:enabled?).returns(true) @plugin_settings.merge!({ :publish_endpoint => "http://localhost/endpoint", :success_timeout => "1", :wait_for_success => "yes" }) @course.publish_final_grades(@user) end it 'should not kick off the timeout when a success timeout is defined and waiting is not configured' do grade_publishing_user @course.expects(:send_later_if_production).with(:send_final_grades_to_endpoint, @user).returns(nil) current_time = Time.now.utc Time.stubs(:now).returns(current_time) current_time.stubs(:utc).returns(current_time) @course.expects(:send_at).times(0) @plugin.stubs(:enabled?).returns(true) @plugin_settings.merge!({ :publish_endpoint => "http://localhost/endpoint", :success_timeout => "1", :wait_for_success => "no" }) @course.publish_final_grades(@user) end it 'should not kick off the timeout when a success timeout is not defined and waiting is not configured' do grade_publishing_user @course.expects(:send_later_if_production).with(:send_final_grades_to_endpoint, @user).returns(nil) current_time = Time.now.utc Time.stubs(:now).returns(current_time) current_time.stubs(:utc).returns(current_time) @course.expects(:send_at).times(0) @plugin.stubs(:enabled?).returns(true) @plugin_settings.merge!({ :publish_endpoint => "http://localhost/endpoint", :success_timeout => "", :wait_for_success => "no" }) @course.publish_final_grades(@user) end it 'should not kick off the timeout when a success timeout is not defined and waiting is configured' do grade_publishing_user @course.expects(:send_later_if_production).with(:send_final_grades_to_endpoint, @user).returns(nil) current_time = Time.now.utc Time.stubs(:now).returns(current_time) current_time.stubs(:utc).returns(current_time) @course.expects(:send_at).times(0) @plugin.stubs(:enabled?).returns(true) @plugin_settings.merge!({ :publish_endpoint => "http://localhost/endpoint", :success_timeout => "no", :wait_for_success => "yes" }) @course.publish_final_grades(@user) end end context 'should_kick_off_grade_publishing_timeout?' do it 'should cover all the necessary cases' do @plugin_settings.merge! :success_timeout => "no", :wait_for_success => "yes" @course.should_kick_off_grade_publishing_timeout?.should be_false @plugin_settings.merge! :success_timeout => "", :wait_for_success => "no" @course.should_kick_off_grade_publishing_timeout?.should be_false @plugin_settings.merge! :success_timeout => "1", :wait_for_success => "no" @course.should_kick_off_grade_publishing_timeout?.should be_false @plugin_settings.merge! :success_timeout => "1", :wait_for_success => "yes" @course.should_kick_off_grade_publishing_timeout?.should be_true end end context 'valid_grade_export_types' do it "should support instructure_csv" do Course.valid_grade_export_types["instructure_csv"][:name].should == "Instructure formatted CSV" course = mock() enrollments = [mock(), mock()] publishing_pseudonym = mock() publishing_user = mock() course.expects(:generate_grade_publishing_csv_output).with(enrollments, publishing_user, publishing_pseudonym).returns 42 Course.valid_grade_export_types["instructure_csv"][:callback].call(course, enrollments, publishing_user, publishing_pseudonym).should == 42 Course.valid_grade_export_types["instructure_csv"][:requires_grading_standard].should be_false Course.valid_grade_export_types["instructure_csv"][:requires_publishing_pseudonym].should be_false end end context 'send_final_grades_to_endpoint' do before { make_student_enrollments } it "should clear the grade publishing message of unpublishable enrollments" do @plugin.stubs(:enabled?).returns(true) @plugin_settings.merge! :publish_endpoint => "http://localhost/endpoint", :format_type => "test_format" grade_publishing_user @ase = @student_enrollments.find_all{|e| e.workflow_state == 'active'} Course.stubs(:valid_grade_export_types).returns({ "test_format" => { :callback => lambda {|course, enrollments, publishing_user, publishing_pseudonym| course.should == @course enrollments.sort_by(&:id).should == @ase.sort_by(&:id) publishing_pseudonym.should == @pseudonym publishing_user.should == @user return [ [[@ase[2].id, @ase[5].id], "post1", "test/mime1"], [[@ase[4].id, @ase[7].id], "post2", "test/mime2"]] } } }) SSLCommon.expects(:post_data).with("http://localhost/endpoint", "post1", "test/mime1") SSLCommon.expects(:post_data).with("http://localhost/endpoint", "post2", "test/mime2") @course.send_final_grades_to_endpoint @user @student_enrollments.map(&:reload).map(&:grade_publishing_status).should == ["unpublishable", "unpublishable", "published", "unpublishable", "published", "published", "unpublished", "unpublishable", "published"] @student_enrollments.map(&:grade_publishing_message).should == [nil] * 9 end it "should try to publish appropriate enrollments" do plugin_settings = Course.valid_grade_export_types["instructure_csv"] Course.stubs(:valid_grade_export_types).returns(plugin_settings.merge({ "instructure_csv" => { :requires_grading_standard => true, :requires_publishing_pseudonym => true }})) @course.grading_standard_enabled = true @course.save! grade_publishing_user @plugin.stubs(:enabled?).returns(true) @plugin_settings.merge!({ :publish_endpoint => "http://localhost/endpoint", :format_type => "instructure_csv" }) @checked = false Course.stubs(:valid_grade_export_types).returns({ "instructure_csv" => { :callback => lambda {|course, enrollments, publishing_user, publishing_pseudonym| course.should == @course enrollments.sort_by(&:id).should == @student_enrollments.sort_by(&:id).find_all{|e| e.workflow_state == 'active'} publishing_pseudonym.should == @pseudonym publishing_user.should == @user @checked = true return [] } } }) @course.send_final_grades_to_endpoint @user @checked.should be_true end it "should make sure grade publishing is enabled" do @plugin.stubs(:enabled?).returns(false) (lambda {@course.send_final_grades_to_endpoint nil}).should raise_error("final grade publishing disabled") @student_enrollments.map(&:reload).map(&:grade_publishing_status).should == ["error"] * 6 + ["unpublished"] + ["error"] * 2 @student_enrollments.map(&:grade_publishing_message).should == ["final grade publishing disabled"] * 6 + [nil] + ["final grade publishing disabled"] * 2 end it "should make sure an endpoint is defined" do @plugin.stubs(:enabled?).returns(true) @plugin_settings.merge! :publish_endpoint => "" (lambda {@course.send_final_grades_to_endpoint nil}).should raise_error("endpoint undefined") @student_enrollments.map(&:reload).map(&:grade_publishing_status).should == ["error"] * 6 + ["unpublished"] + ["error"] * 2 @student_enrollments.map(&:grade_publishing_message).should == ["endpoint undefined"] * 6 + [nil] + ["endpoint undefined"] * 2 end it "should make sure the publishing user can publish" do plugin_settings = Course.valid_grade_export_types["instructure_csv"] Course.stubs(:valid_grade_export_types).returns(plugin_settings.merge({ "instructure_csv" => { :requires_grading_standard => false, :requires_publishing_pseudonym => true }})) @user = user @plugin.stubs(:enabled?).returns(true) @plugin_settings.merge! :publish_endpoint => "http://localhost/endpoint" (lambda {@course.send_final_grades_to_endpoint @user}).should raise_error("publishing disallowed for this publishing user") @student_enrollments.map(&:reload).map(&:grade_publishing_status).should == ["error"] * 6 + ["unpublished"] + ["error"] * 2 @student_enrollments.map(&:grade_publishing_message).should == ["publishing disallowed for this publishing user"] * 6 + [nil] + ["publishing disallowed for this publishing user"] * 2 end it "should make sure there's a grading standard" do plugin_settings = Course.valid_grade_export_types["instructure_csv"] Course.stubs(:valid_grade_export_types).returns(plugin_settings.merge({ "instructure_csv" => { :requires_grading_standard => true, :requires_publishing_pseudonym => false }})) @user = user @plugin.stubs(:enabled?).returns(true) @plugin_settings.merge! :publish_endpoint => "http://localhost/endpoint" (lambda {@course.send_final_grades_to_endpoint @user}).should raise_error("grade publishing requires a grading standard") @student_enrollments.map(&:reload).map(&:grade_publishing_status).should == ["error"] * 6 + ["unpublished"] + ["error"] * 2 @student_enrollments.map(&:grade_publishing_message).should == ["grade publishing requires a grading standard"] * 6 + [nil] + ["grade publishing requires a grading standard"] * 2 end it "should make sure the format type is supported" do grade_publishing_user @plugin.stubs(:enabled?).returns(true) @plugin_settings.merge! :publish_endpoint => "http://localhost/endpoint", :format_type => "invalid_Format" (lambda {@course.send_final_grades_to_endpoint @user}).should raise_error("unknown format type: invalid_Format") @student_enrollments.map(&:reload).map(&:grade_publishing_status).should == ["error"] * 6 + ["unpublished"] + ["error"] * 2 @student_enrollments.map(&:grade_publishing_message).should == ["unknown format type: invalid_Format"] * 6 + [nil] + ["unknown format type: invalid_Format"] * 2 end def sample_grade_publishing_request(published_status) @plugin.stubs(:enabled?).returns(true) @plugin_settings.merge! :publish_endpoint => "http://localhost/endpoint", :format_type => "test_format" grade_publishing_user @ase = @student_enrollments.find_all{|e| e.workflow_state == 'active'} Course.stubs(:valid_grade_export_types).returns({ "test_format" => { :callback => lambda {|course, enrollments, publishing_user, publishing_pseudonym| course.should == @course enrollments.sort_by(&:id).should == @ase.sort_by(&:id) publishing_pseudonym.should == @pseudonym publishing_user.should == @user return [ [[@ase[1].id, @ase[3].id], "post1", "test/mime1"], [[@ase[4].id, @ase[7].id], "post2", "test/mime2"]] } } }) SSLCommon.expects(:post_data).with("http://localhost/endpoint", "post1", "test/mime1") SSLCommon.expects(:post_data).with("http://localhost/endpoint", "post2", "test/mime2") @course.send_final_grades_to_endpoint @user @student_enrollments.map(&:reload).map(&:grade_publishing_status).should == ["unpublishable", published_status, "unpublishable", published_status, published_status, "unpublishable", "unpublished", "unpublishable", published_status] @student_enrollments.map(&:grade_publishing_message).should == [nil] * 9 end it "should make callback's requested posts and mark requested enrollment ids ignored" do sample_grade_publishing_request("published") end it "should recompute final grades" do @course.expects(:recompute_student_scores_without_send_later) sample_grade_publishing_request("published") end it "should not set the status to publishing if a timeout didn't kick off - timeout, wait" do @plugin_settings.merge! :success_timeout => "1", :wait_for_success => "yes" sample_grade_publishing_request("publishing") end it "should not set the status to publishing if a timeout didn't kick off - timeout, no wait" do @plugin_settings.merge! :success_timeout => "2", :wait_for_success => "false" sample_grade_publishing_request("published") end it "should not set the status to publishing if a timeout didn't kick off - no timeout, wait" do @plugin_settings.merge! :success_timeout => "no", :wait_for_success => "yes" sample_grade_publishing_request("published") end it "should not set the status to publishing if a timeout didn't kick off - no timeout, no wait" do @plugin_settings.merge! :success_timeout => "false", :wait_for_success => "no" sample_grade_publishing_request("published") end it "should try and make all posts even if one of the postings fails" do @plugin.stubs(:enabled?).returns(true) @plugin_settings.merge! :publish_endpoint => "http://localhost/endpoint", :format_type => "test_format" grade_publishing_user @ase = @student_enrollments.find_all{|e| e.workflow_state == 'active'} Course.stubs(:valid_grade_export_types).returns({ "test_format" => { :callback => lambda {|course, enrollments, publishing_user, publishing_pseudonym| course.should == @course enrollments.sort_by(&:id).should == @ase.sort_by(&:id) publishing_pseudonym.should == @pseudonym publishing_user.should == @user return [ [[@ase[1].id, @ase[3].id], "post1", "test/mime1"], [[@ase[4].id, @ase[7].id], "post2", "test/mime2"], [[@ase[2].id, @ase[0].id], "post3", "test/mime3"]] } } }) SSLCommon.expects(:post_data).with("http://localhost/endpoint", "post1", "test/mime1") SSLCommon.expects(:post_data).with("http://localhost/endpoint", "post2", "test/mime2").raises("waaah fail") SSLCommon.expects(:post_data).with("http://localhost/endpoint", "post3", "test/mime3") (lambda {@course.send_final_grades_to_endpoint(@user)}).should raise_error("waaah fail") @student_enrollments.map(&:reload).map(&:grade_publishing_status).should == ["published", "published", "published", "published", "error", "unpublishable", "unpublished", "unpublishable", "error"] @student_enrollments.map(&:grade_publishing_message).should == [nil] * 4 + ["waaah fail"] + [nil] * 3 + ["waaah fail"] end it "should try and make all posts even if two of the postings fail" do @plugin.stubs(:enabled?).returns(true) @plugin_settings.merge! :publish_endpoint => "http://localhost/endpoint", :format_type => "test_format" grade_publishing_user @ase = @student_enrollments.find_all{|e| e.workflow_state == 'active'} Course.stubs(:valid_grade_export_types).returns({ "test_format" => { :callback => lambda {|course, enrollments, publishing_user, publishing_pseudonym| course.should == @course enrollments.sort_by(&:id).should == @ase.sort_by(&:id) publishing_pseudonym.should == @pseudonym publishing_user.should == @user return [ [[@ase[1].id, @ase[3].id], "post1", "test/mime1"], [[@ase[4].id, @ase[7].id], "post2", "test/mime2"], [[@ase[2].id, @ase[0].id], "post3", "test/mime3"]] } } }) SSLCommon.expects(:post_data).with("http://localhost/endpoint", "post1", "test/mime1").raises("waaah fail") SSLCommon.expects(:post_data).with("http://localhost/endpoint", "post2", "test/mime2").raises("waaah fail") SSLCommon.expects(:post_data).with("http://localhost/endpoint", "post3", "test/mime3") (lambda {@course.send_final_grades_to_endpoint(@user)}).should raise_error("waaah fail") @student_enrollments.map(&:reload).map(&:grade_publishing_status).should == ["published", "error", "published", "error", "error", "unpublishable", "unpublished", "unpublishable", "error"] @student_enrollments.map(&:grade_publishing_message).should == [nil, "waaah fail", nil, "waaah fail", "waaah fail", nil, nil, nil, "waaah fail"] end it "should fail gracefully when the posting generator fails" do @plugin.stubs(:enabled?).returns(true) @plugin_settings.merge! :publish_endpoint => "http://localhost/endpoint", :format_type => "test_format" grade_publishing_user @ase = @student_enrollments.find_all{|e| e.workflow_state == 'active'} Course.stubs(:valid_grade_export_types).returns({ "test_format" => { :callback => lambda {|course, enrollments, publishiing_user, publishing_pseudonym| raise "waaah fail" } } }) (lambda {@course.send_final_grades_to_endpoint(@user)}).should raise_error("waaah fail") @student_enrollments.map(&:reload).map(&:grade_publishing_status).should == ["error", "error", "error", "error", "error", "error", "unpublished", "error", "error"] @student_enrollments.map(&:grade_publishing_message).should == ["waaah fail"] * 6 + [nil] + ["waaah fail"] * 2 end end context 'generate_grade_publishing_csv_output' do def add_pseudonym(enrollment, account, unique_id, sis_user_id) pseudonym = account.pseudonyms.build pseudonym.user = enrollment.user pseudonym.unique_id = unique_id pseudonym.sis_user_id = sis_user_id pseudonym.save! end it 'should generate valid csv without a grading standard' do make_student_enrollments grade_publishing_user @course.assignment_groups.create(:name => "Assignments") a1 = @course.assignments.create!(:title => "A1", :points_possible => 10) a2 = @course.assignments.create!(:title => "A2", :points_possible => 10) @course.enroll_teacher(@user).tap{|e| e.workflow_state = 'active'; e.save!} @ase = @student_enrollments.find_all(&:active?) a1.grade_student(@ase[0].user, { :grade => "9", :grader => @user }) a2.grade_student(@ase[0].user, { :grade => "10", :grader => @user }) a1.grade_student(@ase[1].user, { :grade => "6", :grader => @user }) a2.grade_student(@ase[1].user, { :grade => "7", :grader => @user }) a1.grade_student(@ase[7].user, { :grade => "8", :grader => @user }) a2.grade_student(@ase[7].user, { :grade => "9", :grader => @user }) add_pseudonym(@ase[2], Account.default, "student2", nil) add_pseudonym(@ase[3], Account.default, "student3", "student3") add_pseudonym(@ase[4], Account.default, "student4a", "student4a") add_pseudonym(@ase[4], Account.default, "student4b", "student4b") another_account = account_model add_pseudonym(@ase[5], another_account, "student5", nil) add_pseudonym(@ase[6], another_account, "student6", "student6") add_pseudonym(@ase[7], Account.default, "student7a", "student7a") add_pseudonym(@ase[7], Account.default, "student7b", "student7b") @course.recompute_student_scores_without_send_later @course.generate_grade_publishing_csv_output(@ase.map(&:reload), @user, @pseudonym).should == [ [@ase.map(&:id), ("publisher_id,publisher_sis_id,course_id,course_sis_id,section_id,section_sis_id," + "student_id,student_sis_id,enrollment_id,enrollment_status," + "score\n" + "#{@user.id},U1,#{@course.id},,#{@ase[0].course_section_id},,#{@ase[0].user.id},,#{@ase[0].id},active,95\n" + "#{@user.id},U1,#{@course.id},,#{@ase[1].course_section_id},,#{@ase[1].user.id},,#{@ase[1].id},active,65\n" + "#{@user.id},U1,#{@course.id},,#{@ase[2].course_section_id},,#{@ase[2].user.id},,#{@ase[2].id},active,0\n" + "#{@user.id},U1,#{@course.id},,#{@ase[3].course_section_id},,#{@ase[3].user.id},student3,#{@ase[3].id},active,0\n" + "#{@user.id},U1,#{@course.id},,#{@ase[4].course_section_id},,#{@ase[4].user.id},student4a,#{@ase[4].id},active,0\n" + "#{@user.id},U1,#{@course.id},,#{@ase[4].course_section_id},,#{@ase[4].user.id},student4b,#{@ase[4].id},active,0\n" + "#{@user.id},U1,#{@course.id},,#{@ase[5].course_section_id},,#{@ase[5].user.id},,#{@ase[5].id},active,0\n" + "#{@user.id},U1,#{@course.id},,#{@ase[6].course_section_id},,#{@ase[6].user.id},,#{@ase[6].id},active,0\n" + "#{@user.id},U1,#{@course.id},,#{@ase[7].course_section_id},,#{@ase[7].user.id},student7a,#{@ase[7].id},active,85\n" + "#{@user.id},U1,#{@course.id},,#{@ase[7].course_section_id},,#{@ase[7].user.id},student7b,#{@ase[7].id},active,85\n"), "text/csv"] ] end it 'should generate valid csv without a publishing pseudonym' do make_student_enrollments @user = user_model @course.assignment_groups.create(:name => "Assignments") a1 = @course.assignments.create!(:title => "A1", :points_possible => 10) a2 = @course.assignments.create!(:title => "A2", :points_possible => 10) @course.enroll_teacher(@user).tap{|e| e.workflow_state = 'active'; e.save!} @ase = @student_enrollments.find_all(&:active?) a1.grade_student(@ase[0].user, { :grade => "9", :grader => @user }) a2.grade_student(@ase[0].user, { :grade => "10", :grader => @user }) a1.grade_student(@ase[1].user, { :grade => "6", :grader => @user }) a2.grade_student(@ase[1].user, { :grade => "7", :grader => @user }) a1.grade_student(@ase[7].user, { :grade => "8", :grader => @user }) a2.grade_student(@ase[7].user, { :grade => "9", :grader => @user }) add_pseudonym(@ase[2], Account.default, "student2", nil) add_pseudonym(@ase[3], Account.default, "student3", "student3") add_pseudonym(@ase[4], Account.default, "student4a", "student4a") add_pseudonym(@ase[4], Account.default, "student4b", "student4b") another_account = account_model add_pseudonym(@ase[5], another_account, "student5", nil) add_pseudonym(@ase[6], another_account, "student6", "student6") add_pseudonym(@ase[7], Account.default, "student7a", "student7a") add_pseudonym(@ase[7], Account.default, "student7b", "student7b") @course.recompute_student_scores_without_send_later @course.generate_grade_publishing_csv_output(@ase.map(&:reload), @user, @pseudonym).should == [ [@ase.map(&:id), ("publisher_id,publisher_sis_id,course_id,course_sis_id,section_id,section_sis_id," + "student_id,student_sis_id,enrollment_id,enrollment_status," + "score\n" + "#{@user.id},,#{@course.id},,#{@ase[0].course_section_id},,#{@ase[0].user.id},,#{@ase[0].id},active,95\n" + "#{@user.id},,#{@course.id},,#{@ase[1].course_section_id},,#{@ase[1].user.id},,#{@ase[1].id},active,65\n" + "#{@user.id},,#{@course.id},,#{@ase[2].course_section_id},,#{@ase[2].user.id},,#{@ase[2].id},active,0\n" + "#{@user.id},,#{@course.id},,#{@ase[3].course_section_id},,#{@ase[3].user.id},student3,#{@ase[3].id},active,0\n" + "#{@user.id},,#{@course.id},,#{@ase[4].course_section_id},,#{@ase[4].user.id},student4a,#{@ase[4].id},active,0\n" + "#{@user.id},,#{@course.id},,#{@ase[4].course_section_id},,#{@ase[4].user.id},student4b,#{@ase[4].id},active,0\n" + "#{@user.id},,#{@course.id},,#{@ase[5].course_section_id},,#{@ase[5].user.id},,#{@ase[5].id},active,0\n" + "#{@user.id},,#{@course.id},,#{@ase[6].course_section_id},,#{@ase[6].user.id},,#{@ase[6].id},active,0\n" + "#{@user.id},,#{@course.id},,#{@ase[7].course_section_id},,#{@ase[7].user.id},student7a,#{@ase[7].id},active,85\n" + "#{@user.id},,#{@course.id},,#{@ase[7].course_section_id},,#{@ase[7].user.id},student7b,#{@ase[7].id},active,85\n"), "text/csv"] ] end it 'should generate valid csv with a section id' do @course_section.sis_source_id = "section1" @course_section.save! make_student_enrollments grade_publishing_user @course.assignment_groups.create(:name => "Assignments") a1 = @course.assignments.create!(:title => "A1", :points_possible => 10) a2 = @course.assignments.create!(:title => "A2", :points_possible => 10) @course.enroll_teacher(@user).tap{|e| e.workflow_state = 'active'; e.save!} @ase = @student_enrollments.find_all(&:active?) a1.grade_student(@ase[0].user, { :grade => "9", :grader => @user }) a2.grade_student(@ase[0].user, { :grade => "10", :grader => @user }) a1.grade_student(@ase[1].user, { :grade => "6", :grader => @user }) a2.grade_student(@ase[1].user, { :grade => "7", :grader => @user }) a1.grade_student(@ase[7].user, { :grade => "8", :grader => @user }) a2.grade_student(@ase[7].user, { :grade => "9", :grader => @user }) add_pseudonym(@ase[2], Account.default, "student2", nil) add_pseudonym(@ase[3], Account.default, "student3", "student3") add_pseudonym(@ase[4], Account.default, "student4a", "student4a") add_pseudonym(@ase[4], Account.default, "student4b", "student4b") another_account = account_model add_pseudonym(@ase[5], another_account, "student5", nil) add_pseudonym(@ase[6], another_account, "student6", "student6") add_pseudonym(@ase[7], Account.default, "student7a", "student7a") add_pseudonym(@ase[7], Account.default, "student7b", "student7b") @course.recompute_student_scores_without_send_later @course.generate_grade_publishing_csv_output(@ase.map(&:reload), @user, @pseudonym).should == [ [@ase.map(&:id), ("publisher_id,publisher_sis_id,course_id,course_sis_id,section_id,section_sis_id," + "student_id,student_sis_id,enrollment_id,enrollment_status," + "score\n" + "#{@user.id},U1,#{@course.id},,#{@ase[0].course_section_id},section1,#{@ase[0].user.id},,#{@ase[0].id},active,95\n" + "#{@user.id},U1,#{@course.id},,#{@ase[1].course_section_id},section1,#{@ase[1].user.id},,#{@ase[1].id},active,65\n" + "#{@user.id},U1,#{@course.id},,#{@ase[2].course_section_id},section1,#{@ase[2].user.id},,#{@ase[2].id},active,0\n" + "#{@user.id},U1,#{@course.id},,#{@ase[3].course_section_id},section1,#{@ase[3].user.id},student3,#{@ase[3].id},active,0\n" + "#{@user.id},U1,#{@course.id},,#{@ase[4].course_section_id},section1,#{@ase[4].user.id},student4a,#{@ase[4].id},active,0\n" + "#{@user.id},U1,#{@course.id},,#{@ase[4].course_section_id},section1,#{@ase[4].user.id},student4b,#{@ase[4].id},active,0\n" + "#{@user.id},U1,#{@course.id},,#{@ase[5].course_section_id},section1,#{@ase[5].user.id},,#{@ase[5].id},active,0\n" + "#{@user.id},U1,#{@course.id},,#{@ase[6].course_section_id},section1,#{@ase[6].user.id},,#{@ase[6].id},active,0\n" + "#{@user.id},U1,#{@course.id},,#{@ase[7].course_section_id},section1,#{@ase[7].user.id},student7a,#{@ase[7].id},active,85\n" + "#{@user.id},U1,#{@course.id},,#{@ase[7].course_section_id},section1,#{@ase[7].user.id},student7b,#{@ase[7].id},active,85\n"), "text/csv"] ] end it 'should generate valid csv with a grading standard' do make_student_enrollments grade_publishing_user @course.assignment_groups.create(:name => "Assignments") @course.grading_standard_id = 0 @course.save! a1 = @course.assignments.create!(:title => "A1", :points_possible => 10) a2 = @course.assignments.create!(:title => "A2", :points_possible => 10) @course.enroll_teacher(@user).tap{|e| e.workflow_state = 'active'; e.save!} @ase = @student_enrollments.find_all(&:active?) a1.grade_student(@ase[0].user, { :grade => "9", :grader => @user }) a2.grade_student(@ase[0].user, { :grade => "10", :grader => @user }) a1.grade_student(@ase[1].user, { :grade => "6", :grader => @user }) a2.grade_student(@ase[1].user, { :grade => "7", :grader => @user }) a1.grade_student(@ase[7].user, { :grade => "8", :grader => @user }) a2.grade_student(@ase[7].user, { :grade => "9", :grader => @user }) add_pseudonym(@ase[2], Account.default, "student2", nil) add_pseudonym(@ase[3], Account.default, "student3", "student3") add_pseudonym(@ase[4], Account.default, "student4a", "student4a") add_pseudonym(@ase[4], Account.default, "student4b", "student4b") another_account = account_model add_pseudonym(@ase[5], another_account, "student5", nil) add_pseudonym(@ase[6], another_account, "student6", "student6") add_pseudonym(@ase[7], Account.default, "student7a", "student7a") add_pseudonym(@ase[7], Account.default, "student7b", "student7b") @course.recompute_student_scores_without_send_later @course.generate_grade_publishing_csv_output(@ase.map(&:reload), @user, @pseudonym).should == [ [@ase.map(&:id), ("publisher_id,publisher_sis_id,course_id,course_sis_id,section_id,section_sis_id," + "student_id,student_sis_id,enrollment_id,enrollment_status," + "score,grade\n" + "#{@user.id},U1,#{@course.id},,#{@ase[0].course_section_id},,#{@ase[0].user.id},,#{@ase[0].id},active,95,A\n" + "#{@user.id},U1,#{@course.id},,#{@ase[1].course_section_id},,#{@ase[1].user.id},,#{@ase[1].id},active,65,D\n" + "#{@user.id},U1,#{@course.id},,#{@ase[2].course_section_id},,#{@ase[2].user.id},,#{@ase[2].id},active,0,F\n" + "#{@user.id},U1,#{@course.id},,#{@ase[3].course_section_id},,#{@ase[3].user.id},student3,#{@ase[3].id},active,0,F\n" + "#{@user.id},U1,#{@course.id},,#{@ase[4].course_section_id},,#{@ase[4].user.id},student4a,#{@ase[4].id},active,0,F\n" + "#{@user.id},U1,#{@course.id},,#{@ase[4].course_section_id},,#{@ase[4].user.id},student4b,#{@ase[4].id},active,0,F\n" + "#{@user.id},U1,#{@course.id},,#{@ase[5].course_section_id},,#{@ase[5].user.id},,#{@ase[5].id},active,0,F\n" + "#{@user.id},U1,#{@course.id},,#{@ase[6].course_section_id},,#{@ase[6].user.id},,#{@ase[6].id},active,0,F\n" + "#{@user.id},U1,#{@course.id},,#{@ase[7].course_section_id},,#{@ase[7].user.id},student7a,#{@ase[7].id},active,85,B\n" + "#{@user.id},U1,#{@course.id},,#{@ase[7].course_section_id},,#{@ase[7].user.id},student7b,#{@ase[7].id},active,85,B\n"), "text/csv"] ] end it 'should generate valid csv and skip users with no computed final score' do make_student_enrollments grade_publishing_user @course.assignment_groups.create(:name => "Assignments") @course.grading_standard_id = 0 @course.save! a1 = @course.assignments.create!(:title => "A1", :points_possible => 10) a2 = @course.assignments.create!(:title => "A2", :points_possible => 10) @course.enroll_teacher(@user).tap{|e| e.workflow_state = 'active'; e.save!} @ase = @student_enrollments.find_all(&:active?) a1.grade_student(@ase[0].user, { :grade => "9", :grader => @user }) a2.grade_student(@ase[0].user, { :grade => "10", :grader => @user }) a1.grade_student(@ase[1].user, { :grade => "6", :grader => @user }) a2.grade_student(@ase[1].user, { :grade => "7", :grader => @user }) a1.grade_student(@ase[7].user, { :grade => "8", :grader => @user }) a2.grade_student(@ase[7].user, { :grade => "9", :grader => @user }) add_pseudonym(@ase[2], Account.default, "student2", nil) add_pseudonym(@ase[3], Account.default, "student3", "student3") add_pseudonym(@ase[4], Account.default, "student4a", "student4a") add_pseudonym(@ase[4], Account.default, "student4b", "student4b") another_account = account_model add_pseudonym(@ase[5], another_account, "student5", nil) add_pseudonym(@ase[6], another_account, "student6", "student6") add_pseudonym(@ase[7], Account.default, "student7a", "student7a") add_pseudonym(@ase[7], Account.default, "student7b", "student7b") @course.recompute_student_scores_without_send_later @ase.map(&:reload) @ase[1].computed_final_score = nil @ase[3].computed_final_score = nil @ase[4].computed_final_score = nil @course.generate_grade_publishing_csv_output(@ase, @user, @pseudonym).should == [ [@ase.map(&:id) - [@ase[1].id, @ase[3].id, @ase[4].id], ("publisher_id,publisher_sis_id,course_id,course_sis_id,section_id,section_sis_id," + "student_id,student_sis_id,enrollment_id,enrollment_status," + "score,grade\n" + "#{@user.id},U1,#{@course.id},,#{@ase[0].course_section_id},,#{@ase[0].user.id},,#{@ase[0].id},active,95,A\n" + "#{@user.id},U1,#{@course.id},,#{@ase[2].course_section_id},,#{@ase[2].user.id},,#{@ase[2].id},active,0,F\n" + "#{@user.id},U1,#{@course.id},,#{@ase[5].course_section_id},,#{@ase[5].user.id},,#{@ase[5].id},active,0,F\n" + "#{@user.id},U1,#{@course.id},,#{@ase[6].course_section_id},,#{@ase[6].user.id},,#{@ase[6].id},active,0,F\n" + "#{@user.id},U1,#{@course.id},,#{@ase[7].course_section_id},,#{@ase[7].user.id},student7a,#{@ase[7].id},active,85,B\n" + "#{@user.id},U1,#{@course.id},,#{@ase[7].course_section_id},,#{@ase[7].user.id},student7b,#{@ase[7].id},active,85,B\n"), "text/csv"] ] end end context 'expire_pending_grade_publishing_statuses' do it 'should update the right enrollments' do make_student_enrollments first_time = Time.now.utc second_time = first_time + 2.seconds @student_enrollments.map(&:reload).map(&:grade_publishing_status).should == ["published", "error", "unpublishable", "error", "unpublishable", "unpublishable", "unpublished", "unpublished", "unpublished"] @student_enrollments[0].grade_publishing_status = "pending" @student_enrollments[0].last_publish_attempt_at = first_time @student_enrollments[1].grade_publishing_status = "publishing" @student_enrollments[1].last_publish_attempt_at = first_time @student_enrollments[2].grade_publishing_status = "pending" @student_enrollments[2].last_publish_attempt_at = second_time @student_enrollments[3].grade_publishing_status = "publishing" @student_enrollments[3].last_publish_attempt_at = second_time @student_enrollments[4].grade_publishing_status = "published" @student_enrollments[4].last_publish_attempt_at = first_time @student_enrollments[5].grade_publishing_status = "unpublished" @student_enrollments[5].last_publish_attempt_at = first_time @student_enrollments.map(&:save) @student_enrollments.map(&:reload).map(&:grade_publishing_status).should == ["pending", "publishing", "pending", "publishing", "published", "unpublished", "unpublished", "unpublished", "unpublished"] @course.expire_pending_grade_publishing_statuses(first_time) @student_enrollments.map(&:reload).map(&:grade_publishing_status).should == ["error", "error", "pending", "publishing", "published", "unpublished", "unpublished", "unpublished", "unpublished"] end end context 'grading_standard_enabled' do it 'should work for a number of boolean representations' do @course.grading_standard_enabled?.should be_false @course.grading_standard_enabled.should be_false [[false, false], [true, true], ["false", false], ["true", true], ["0", false], [0, false], ["1", true], [1, true], ["off", false], ["on", true], ["yes", true], ["no", false]].each do |val, enabled| @course.grading_standard_enabled = val @course.grading_standard_enabled?.should == enabled @course.grading_standard_enabled.should == enabled @course.grading_standard_id.should be_nil unless enabled @course.grading_standard_id.should_not be_nil if enabled @course.bool_res(val).should == enabled end end end end context 'integration suite' do def quick_sanity_check(user) Course.valid_grade_export_types["test_export"] = { :name => "test export", :callback => lambda {|course, enrollments, publishing_user, publishing_pseudonym| course.should == @course publishing_pseudonym.should == @pseudonym publishing_user.should == @user return [[[], "test-jt-data", "application/jtmimetype"]] }, :requires_grading_standard => false, :requires_publishing_pseudonym => true} server, server_thread, post_lines = start_test_http_server @plugin = Canvas::Plugin.find!('grade_export') @ps = PluginSetting.new(:name => @plugin.id, :settings => @plugin.default_settings) @ps.posted_settings = @plugin.default_settings.merge({ :format_type => "test_export", :wait_for_success => "no", :publish_endpoint => "http://localhost:#{server.addr[1]}/endpoint" }) @ps.save! @course.grading_standard_id = 0 @course.publish_final_grades(user) server_thread.join verify_post_matches(post_lines, [ "POST /endpoint HTTP/1.1", "Accept: */*", "Content-Type: application/jtmimetype", "", "test-jt-data"]) end it 'should pass a quick sanity check' do @user = user_with_pseudonym @pseudonym.account_id = @course.root_account_id @pseudonym.sis_user_id = "U1" @pseudonym.save! quick_sanity_check(@user) end it 'should not allow grade publishing for a user that is disallowed' do @user = User.new (lambda { quick_sanity_check(@user) }).should raise_error("publishing disallowed for this publishing user") end it 'should not allow grade publishing for a user with a pseudonym in the wrong account' do @user = user_with_pseudonym @pseudonym.account = account_model @pseudonym.sis_user_id = "U1" @pseudonym.save! (lambda { quick_sanity_check(@user) }).should raise_error("publishing disallowed for this publishing user") end it 'should not allow grade publishing for a user with a pseudonym without a sis id' do @user = user_with_pseudonym @pseudonym.account_id = @course.root_account_id @pseudonym.sis_user_id = nil @pseudonym.save! (lambda { quick_sanity_check(@user) }).should raise_error("publishing disallowed for this publishing user") end it 'should publish csv' do @user = user_with_pseudonym @pseudonym.sis_user_id = "U1" @pseudonym.account_id = @course.root_account_id @pseudonym.save! server, server_thread, post_lines = start_test_http_server @plugin = Canvas::Plugin.find!('grade_export') @ps = PluginSetting.new(:name => @plugin.id, :settings => @plugin.default_settings) @ps.posted_settings = @plugin.default_settings.merge({ :format_type => "instructure_csv", :wait_for_success => "no", :publish_endpoint => "http://localhost:#{server.addr[1]}/endpoint" }) @ps.save! @course.grading_standard_id = 0 @course.publish_final_grades(@user) server_thread.join verify_post_matches(post_lines, [ "POST /endpoint HTTP/1.1", "Accept: */*", "Content-Type: text/csv", "", "publisher_id,publisher_sis_id,course_id,course_sis_id,section_id,section_sis_id,student_id," + "student_sis_id,enrollment_id,enrollment_status,score,grade\n"]) end it 'should publish grades' do process_csv_data_cleanly( "user_id,login_id,password,first_name,last_name,email,status", "T1,Teacher1,,T,1,[email protected],active", "S1,Student1,,S,1,[email protected],active", "S2,Student2,,S,2,[email protected],active", "S3,Student3,,S,3,[email protected],active", "S4,Student4,,S,4,[email protected],active", "S5,Student5,,S,5,[email protected],active", "S6,Student6,,S,6,[email protected],active") process_csv_data_cleanly( "course_id,short_name,long_name,account_id,term_id,status", "C1,C1,C1,,,active") @course = Course.find_by_sis_source_id("C1") @course.assignment_groups.create(:name => "Assignments") process_csv_data_cleanly( "section_id,course_id,name,status,start_date,end_date", "S1,C1,S1,active,,", "S2,C1,S2,active,,", "S3,C1,S3,active,,", "S4,C1,S4,active,,") process_csv_data_cleanly( "course_id,user_id,role,section_id,status", ",T1,teacher,S1,active", ",S1,student,S1,active", ",S2,student,S2,active", ",S3,student,S2,active", ",S4,student,S1,active", ",S5,student,S3,active", ",S6,student,S4,active") a1 = @course.assignments.create!(:title => "A1", :points_possible => 10) a2 = @course.assignments.create!(:title => "A2", :points_possible => 10) def getpseudonym(user_sis_id) pseudo = Pseudonym.find_by_sis_user_id(user_sis_id) pseudo.should_not be_nil pseudo end def getuser(user_sis_id) user = getpseudonym(user_sis_id).user user.should_not be_nil user end def getsection(section_sis_id) section = CourseSection.find_by_sis_source_id(section_sis_id) section.should_not be_nil section end def getenroll(user_sis_id, section_sis_id) e = Enrollment.find_by_user_id_and_course_section_id(getuser(user_sis_id).id, getsection(section_sis_id).id) e.should_not be_nil e end a1.grade_student(getuser("S1"), { :grade => "6", :grader => getuser("T1") }) a1.grade_student(getuser("S2"), { :grade => "6", :grader => getuser("T1") }) a1.grade_student(getuser("S3"), { :grade => "7", :grader => getuser("T1") }) a1.grade_student(getuser("S5"), { :grade => "7", :grader => getuser("T1") }) a1.grade_student(getuser("S6"), { :grade => "8", :grader => getuser("T1") }) a2.grade_student(getuser("S1"), { :grade => "8", :grader => getuser("T1") }) a2.grade_student(getuser("S2"), { :grade => "9", :grader => getuser("T1") }) a2.grade_student(getuser("S3"), { :grade => "9", :grader => getuser("T1") }) a2.grade_student(getuser("S5"), { :grade => "10", :grader => getuser("T1") }) a2.grade_student(getuser("S6"), { :grade => "10", :grader => getuser("T1") }) stud5, stud6, sec4 = nil, nil, nil Pseudonym.find_by_sis_user_id("S5").tap do |p| stud5 = p p.sis_user_id = nil p.save end Pseudonym.find_by_sis_user_id("S6").tap do |p| stud6 = p p.sis_user_id = nil p.save end getsection("S4").tap do |s| sec4 = s sec4id = s.sis_source_id s.save end GradeCalculator.recompute_final_score(["S1", "S2", "S3", "S4"].map{|x|getuser(x).id}, @course.id) @course.reload teacher = Pseudonym.find_by_sis_user_id("T1") teacher.should_not be_nil server, server_thread, post_lines = start_test_http_server @plugin = Canvas::Plugin.find!('grade_export') @ps = PluginSetting.new(:name => @plugin.id, :settings => @plugin.default_settings) @ps.posted_settings = @plugin.default_settings.merge({ :format_type => "instructure_csv", :wait_for_success => "no", :publish_endpoint => "http://localhost:#{server.addr[1]}/endpoint" }) @ps.save! @course.publish_final_grades(teacher.user) server_thread.join verify_post_matches(post_lines, [ "POST /endpoint HTTP/1.1", "Accept: */*", "Content-Type: text/csv", "", "publisher_id,publisher_sis_id,course_id,course_sis_id,section_id,section_sis_id,student_id," + "student_sis_id,enrollment_id,enrollment_status,score\n" + "#{teacher.user.id},T1,#{@course.id},C1,#{getsection("S1").id},S1,#{getpseudonym("S1").user.id},S1,#{getenroll("S1", "S1").id},active,70\n" + "#{teacher.user.id},T1,#{@course.id},C1,#{getsection("S2").id},S2,#{getpseudonym("S2").user.id},S2,#{getenroll("S2", "S2").id},active,75\n" + "#{teacher.user.id},T1,#{@course.id},C1,#{getsection("S2").id},S2,#{getpseudonym("S3").user.id},S3,#{getenroll("S3", "S2").id},active,80\n" + "#{teacher.user.id},T1,#{@course.id},C1,#{getsection("S1").id},S1,#{getpseudonym("S4").user.id},S4,#{getenroll("S4", "S1").id},active,0\n" + "#{teacher.user.id},T1,#{@course.id},C1,#{getsection("S3").id},S3,#{stud5.user.id},,#{Enrollment.find_by_user_id_and_course_section_id(stud5.user.id, getsection("S3").id).id},active,85\n" + "#{teacher.user.id},T1,#{@course.id},C1,#{sec4.id},S4,#{stud6.user.id},,#{Enrollment.find_by_user_id_and_course_section_id(stud6.user.id, sec4.id).id},active,90\n"]) @course.grading_standard_id = 0 @course.save server, server_thread, post_lines = start_test_http_server @ps.posted_settings = @plugin.default_settings.merge({ :publish_endpoint => "http://localhost:#{server.addr[1]}/endpoint" }) @ps.save! @course.publish_final_grades(teacher.user) server_thread.join verify_post_matches(post_lines, [ "POST /endpoint HTTP/1.1", "Accept: */*", "Content-Type: text/csv", "", "publisher_id,publisher_sis_id,course_id,course_sis_id,section_id,section_sis_id,student_id," + "student_sis_id,enrollment_id,enrollment_status,score,grade\n" + "#{teacher.user.id},T1,#{@course.id},C1,#{getsection("S1").id},S1,#{getpseudonym("S1").user.id},S1,#{getenroll("S1", "S1").id},active,70,C-\n" + "#{teacher.user.id},T1,#{@course.id},C1,#{getsection("S2").id},S2,#{getpseudonym("S2").user.id},S2,#{getenroll("S2", "S2").id},active,75,C\n" + "#{teacher.user.id},T1,#{@course.id},C1,#{getsection("S2").id},S2,#{getpseudonym("S3").user.id},S3,#{getenroll("S3", "S2").id},active,80,B-\n" + "#{teacher.user.id},T1,#{@course.id},C1,#{getsection("S1").id},S1,#{getpseudonym("S4").user.id},S4,#{getenroll("S4", "S1").id},active,0,F\n" + "#{teacher.user.id},T1,#{@course.id},C1,#{getsection("S3").id},S3,#{stud5.user.id},,#{Enrollment.find_by_user_id_and_course_section_id(stud5.user.id, getsection("S3").id).id},active,85,B\n" + "#{teacher.user.id},T1,#{@course.id},C1,#{sec4.id},S4,#{stud6.user.id},,#{Enrollment.find_by_user_id_and_course_section_id(stud6.user.id, sec4.id).id},active,90,A-\n"]) admin = user_model server, server_thread, post_lines = start_test_http_server @ps.posted_settings = @plugin.default_settings.merge({ :publish_endpoint => "http://localhost:#{server.addr[1]}/endpoint" }) @ps.save! @course.publish_final_grades(admin) server_thread.join verify_post_matches(post_lines, [ "POST /endpoint HTTP/1.1", "Accept: */*", "Content-Type: text/csv", "", "publisher_id,publisher_sis_id,course_id,course_sis_id,section_id,section_sis_id,student_id," + "student_sis_id,enrollment_id,enrollment_status,score,grade\n" + "#{admin.id},,#{@course.id},C1,#{getsection("S1").id},S1,#{getpseudonym("S1").user.id},S1,#{getenroll("S1", "S1").id},active,70,C-\n" + "#{admin.id},,#{@course.id},C1,#{getsection("S2").id},S2,#{getpseudonym("S2").user.id},S2,#{getenroll("S2", "S2").id},active,75,C\n" + "#{admin.id},,#{@course.id},C1,#{getsection("S2").id},S2,#{getpseudonym("S3").user.id},S3,#{getenroll("S3", "S2").id},active,80,B-\n" + "#{admin.id},,#{@course.id},C1,#{getsection("S1").id},S1,#{getpseudonym("S4").user.id},S4,#{getenroll("S4", "S1").id},active,0,F\n" + "#{admin.id},,#{@course.id},C1,#{getsection("S3").id},S3,#{stud5.user.id},,#{Enrollment.find_by_user_id_and_course_section_id(stud5.user.id, getsection("S3").id).id},active,85,B\n" + "#{admin.id},,#{@course.id},C1,#{sec4.id},S4,#{stud6.user.id},,#{Enrollment.find_by_user_id_and_course_section_id(stud6.user.id, sec4.id).id},active,90,A-\n"]) end end end describe Course, 'tabs_available' do def new_exernal_tool(context) context.context_external_tools.new(:name => "bob", :consumer_key => "bob", :shared_secret => "bob", :domain => "example.com") end it "should not include external tools if not configured for course navigation" do course_model tool = new_exernal_tool @course tool.settings[:user_navigation] = {:url => "http://www.example.com", :text => "Example URL"} tool.save! tool.has_course_navigation.should == false @teacher = user_model @course.enroll_teacher(@teacher).accept tabs = @course.tabs_available(@teacher) tabs.map{|t| t[:id] }.should_not be_include(tool.asset_string) end it "should include external tools if configured on the course" do course_model tool = new_exernal_tool @course tool.settings[:course_navigation] = {:url => "http://www.example.com", :text => "Example URL"} tool.save! tool.has_course_navigation.should == true @teacher = user_model @course.enroll_teacher(@teacher).accept tabs = @course.tabs_available(@teacher) tabs.map{|t| t[:id] }.should be_include(tool.asset_string) tab = tabs.detect{|t| t[:id] == tool.asset_string } tab[:label].should == tool.settings[:course_navigation][:text] tab[:href].should == :course_external_tool_path tab[:args].should == [@course.id, tool.id] end it "should include external tools if configured on the account" do course_model @account = @course.root_account.sub_accounts.create!(:name => "sub-account") @course.move_to_account(@account.root_account, @account) tool = new_exernal_tool @account tool.settings[:course_navigation] = {:url => "http://www.example.com", :text => "Example URL"} tool.save! tool.has_course_navigation.should == true @teacher = user_model @course.enroll_teacher(@teacher).accept tabs = @course.tabs_available(@teacher) tabs.map{|t| t[:id] }.should be_include(tool.asset_string) tab = tabs.detect{|t| t[:id] == tool.asset_string } tab[:label].should == tool.settings[:course_navigation][:text] tab[:href].should == :course_external_tool_path tab[:args].should == [@course.id, tool.id] end it "should include external tools if configured on the root account" do course_model @account = @course.root_account.sub_accounts.create!(:name => "sub-account") @course.move_to_account(@account.root_account, @account) tool = new_exernal_tool @account.root_account tool.settings[:course_navigation] = {:url => "http://www.example.com", :text => "Example URL"} tool.save! tool.has_course_navigation.should == true @teacher = user_model @course.enroll_teacher(@teacher).accept tabs = @course.tabs_available(@teacher) tabs.map{|t| t[:id] }.should be_include(tool.asset_string) tab = tabs.detect{|t| t[:id] == tool.asset_string } tab[:label].should == tool.settings[:course_navigation][:text] tab[:href].should == :course_external_tool_path tab[:args].should == [@course.id, tool.id] end it "should only include admin-only external tools for course admins" do course_model @course.offer @course.is_public = true @course.save! tool = new_exernal_tool @course tool.settings[:course_navigation] = {:url => "http://www.example.com", :text => "Example URL", :visibility => 'admins'} tool.save! tool.has_course_navigation.should == true @teacher = user_model @course.enroll_teacher(@teacher).accept @student = user_model @student.register! @course.enroll_student(@student).accept tabs = @course.tabs_available(nil) tabs.map{|t| t[:id] }.should_not be_include(tool.asset_string) tabs = @course.tabs_available(@student) tabs.map{|t| t[:id] }.should_not be_include(tool.asset_string) tabs = @course.tabs_available(@teacher) tabs.map{|t| t[:id] }.should be_include(tool.asset_string) tab = tabs.detect{|t| t[:id] == tool.asset_string } tab[:label].should == tool.settings[:course_navigation][:text] tab[:href].should == :course_external_tool_path tab[:args].should == [@course.id, tool.id] end it "should not include member-only external tools for unauthenticated users" do course_model @course.offer @course.is_public = true @course.save! tool = new_exernal_tool @course tool.settings[:course_navigation] = {:url => "http://www.example.com", :text => "Example URL", :visibility => 'members'} tool.save! tool.has_course_navigation.should == true @teacher = user_model @course.enroll_teacher(@teacher).accept @student = user_model @student.register! @course.enroll_student(@student).accept tabs = @course.tabs_available(nil) tabs.map{|t| t[:id] }.should_not be_include(tool.asset_string) tabs = @course.tabs_available(@student) tabs.map{|t| t[:id] }.should be_include(tool.asset_string) tabs = @course.tabs_available(@teacher) tabs.map{|t| t[:id] }.should be_include(tool.asset_string) tab = tabs.detect{|t| t[:id] == tool.asset_string } tab[:label].should == tool.settings[:course_navigation][:text] tab[:href].should == :course_external_tool_path tab[:args].should == [@course.id, tool.id] end it "should allow reordering external tool position in course navigation" do course_model tool = new_exernal_tool @course tool.settings[:course_navigation] = {:url => "http://www.example.com", :text => "Example URL"} tool.save! tool.has_course_navigation.should == true @teacher = user_model @course.enroll_teacher(@teacher).accept @course.tab_configuration = Course.default_tabs.map{|t| {:id => t[:id] } }.insert(1, {:id => tool.asset_string}) @course.save! tabs = @course.tabs_available(@teacher) tabs[1][:id].should == tool.asset_string end it "should not show external tools that are hidden in course navigation" do course_model tool = new_exernal_tool @course tool.settings[:course_navigation] = {:url => "http://www.example.com", :text => "Example URL"} tool.save! tool.has_course_navigation.should == true @teacher = user_model @course.enroll_teacher(@teacher).accept tabs = @course.tabs_available(@teacher) tabs.map{|t| t[:id] }.should be_include(tool.asset_string) @course.tab_configuration = Course.default_tabs.map{|t| {:id => t[:id] } }.insert(1, {:id => tool.asset_string, :hidden => true}) @course.save! @course = Course.find(@course.id) tabs = @course.tabs_available(@teacher) tabs.map{|t| t[:id] }.should_not be_include(tool.asset_string) tabs = @course.tabs_available(@teacher, :for_reordering => true) tabs.map{|t| t[:id] }.should be_include(tool.asset_string) end end describe Course, 'scoping' do it 'should search by multiple fields' do c1 = Course.new c1.root_account = Account.create c1.name = "name1" c1.sis_source_id = "sisid1" c1.course_code = "code1" c1.save c2 = Course.new c2.root_account = Account.create c2.name = "name2" c2.course_code = "code2" c2.sis_source_id = "sisid2" c2.save Course.name_like("name1").map(&:id).should == [c1.id] Course.name_like("sisid2").map(&:id).should == [c2.id] Course.name_like("code1").map(&:id).should == [c1.id] end end describe Course, "manageable_by_user" do it "should include courses associated with the user's active accounts" do account = Account.create! sub_account = Account.create!(:parent_account => account) sub_sub_account = Account.create!(:parent_account => sub_account) user = account_admin_user(:account => sub_account) course = Course.create!(:account => sub_sub_account) Course.manageable_by_user(user.id).map{ |c| c.id }.should be_include(course.id) end it "should include courses the user is actively enrolled in as a teacher" do course = Course.create user = user_with_pseudonym course.enroll_teacher(user) e = course.teacher_enrollments.first e.accept Course.manageable_by_user(user.id).map{ |c| c.id }.should be_include(course.id) end it "should include courses the user is actively enrolled in as a ta" do course = Course.create user = user_with_pseudonym course.enroll_ta(user) e = course.ta_enrollments.first e.accept Course.manageable_by_user(user.id).map{ |c| c.id }.should be_include(course.id) end it "should include courses the user is actively enrolled in as a designer" do course = Course.create user = user_with_pseudonym course.enroll_designer(user).accept Course.manageable_by_user(user.id).map{ |c| c.id }.should be_include(course.id) end it "should not include courses the user is enrolled in when the enrollment is non-active" do course = Course.create user = user_with_pseudonym course.enroll_teacher(user) e = course.teacher_enrollments.first # it's only invited at this point Course.manageable_by_user(user.id).should be_empty e.destroy Course.manageable_by_user(user.id).should be_empty end it "should not include deleted courses the user was enrolled in" do course = Course.create user = user_with_pseudonym course.enroll_teacher(user) e = course.teacher_enrollments.first e.accept course.destroy Course.manageable_by_user(user.id).should be_empty end end describe Course, "conclusions" do it "should grant concluded users read but not participate" do enrollment = course_with_student(:active_all => 1) @course.reload # active @course.grants_rights?(@user, nil, :read, :participate_as_student).should == {:read => true, :participate_as_student => true} # soft conclusion enrollment.start_at = 4.days.ago enrollment.end_at = 2.days.ago enrollment.save! @course.reload @user.reload @user.cached_current_enrollments(:reload) enrollment.state.should == :active enrollment.state_based_on_date.should == :completed enrollment.should_not be_participating_student @course.grants_rights?(@user, nil, :read, :participate_as_student).should == {:read => true, :participate_as_student => false} # hard enrollment conclusion enrollment.start_at = enrollment.end_at = nil enrollment.workflow_state = 'completed' enrollment.save! @course.reload @user.reload @user.cached_current_enrollments(:reload) enrollment.state.should == :completed enrollment.state_based_on_date.should == :completed @course.grants_rights?(@user, nil, :read, :participate_as_student).should == {:read => true, :participate_as_student => false} # course conclusion enrollment.workflow_state = 'active' enrollment.save! @course.reload @course.complete! @user.reload @user.cached_current_enrollments(:reload) enrollment.reload enrollment.state.should == :completed enrollment.state_based_on_date.should == :completed @course.grants_rights?(@user, nil, :read, :participate_as_student).should == {:read => true, :participate_as_student => false} end context "appointment cancelation" do before do course_with_student(:active_all => true) @ag = AppointmentGroup.create!(:title => "test", :contexts => [@course], :new_appointments => [['2010-01-01 13:00:00', '2010-01-01 14:00:00'], ["#{Time.now.year + 1}-01-01 13:00:00", "#{Time.now.year + 1}-01-01 14:00:00"]]) @ag.appointments.each do |a| a.reserve_for(@user, @user) end end it "should cancel all future appointments when concluding an enrollment" do @enrollment.conclude @ag.appointments_participants.size.should eql 1 @ag.appointments_participants.current.size.should eql 0 end it "should cancel all future appointments when concluding all enrollments" do @course.complete! @ag.appointments_participants.size.should eql 1 @ag.appointments_participants.current.size.should eql 0 end end end describe Course, "inherited_assessment_question_banks" do it "should include the course's banks if include_self is true" do @account = Account.create @course = Course.create(:account => @account) @course.inherited_assessment_question_banks(true).should be_empty bank = @course.assessment_question_banks.create @course.inherited_assessment_question_banks(true).should eql [bank] end it "should include all banks in the account hierarchy" do @root_account = Account.create root_bank = @root_account.assessment_question_banks.create @account = Account.new @account.root_account = @root_account @account.save account_bank = @account.assessment_question_banks.create @course = Course.create(:account => @account) @course.inherited_assessment_question_banks.sort_by(&:id).should eql [root_bank, account_bank] end it "should return a useful scope" do @root_account = Account.create root_bank = @root_account.assessment_question_banks.create @account = Account.new @account.root_account = @root_account @account.save account_bank = @account.assessment_question_banks.create @course = Course.create(:account => @account) bank = @course.assessment_question_banks.create banks = @course.inherited_assessment_question_banks(true) banks.scoped(:order => :id).should eql [root_bank, account_bank, bank] banks.find_by_id(bank.id).should eql bank banks.find_by_id(account_bank.id).should eql account_bank banks.find_by_id(root_bank.id).should eql root_bank end end describe Course, "section_visibility" do before do @course = course(:active_course => true) @course.default_section @other_section = @course.course_sections.create @teacher = User.create @course.enroll_teacher(@teacher) @ta = User.create @course.enroll_user(@ta, "TaEnrollment", :limit_privileges_to_course_section => true) @student1 = User.create @course.enroll_user(@student1, "StudentEnrollment", :enrollment_state => 'active') @student2 = User.create @course.enroll_user(@student2, "StudentEnrollment", :section => @other_section, :enrollment_state => 'active') @observer = User.create @course.enroll_user(@observer, "ObserverEnrollment") end context "full" do it "should return students from all sections" do @course.students_visible_to(@teacher).sort_by(&:id).should eql [@student1, @student2] @course.students_visible_to(@student1).sort_by(&:id).should eql [@student1, @student2] end it "should return all sections if a teacher" do @course.sections_visible_to(@teacher).sort_by(&:id).should eql [@course.default_section, @other_section] end it "should return user's sections if a student" do @course.sections_visible_to(@student1).should eql [@course.default_section] end it "should return users from all sections" do @course.users_visible_to(@teacher).sort_by(&:id).should eql [@teacher, @ta, @student1, @student2, @observer] @course.users_visible_to(@ta).sort_by(&:id).should eql [@teacher, @ta, @student1, @observer] end end context "sections" do it "should return students from user's sections" do @course.students_visible_to(@ta).should eql [@student1] end it "should return user's sections" do @course.sections_visible_to(@ta).should eql [@course.default_section] end it "should return non-limited admins from other sections" do @course.enrollments_visible_to(@ta, :type => :teacher, :return_users => true).should eql [@teacher] end end context "restricted" do it "should return no students" do @course.students_visible_to(@observer).should eql [] end it "should return no sections" do @course.sections_visible_to(@observer).should eql [] end end context "migrate_content_links" do it "should ignore types not in the supported_types arg" do c1 = course_model c2 = course_model orig = <<-HTML We aren't translating <a href="/courses/#{c1.id}/assignments/5">links to assignments</a> HTML html = Course.migrate_content_links(orig, c1, c2, ['files']) html.should == orig end end it "should be marshal-able" do c = Course.new(:name => 'c1') Marshal.dump(c) c.save! Marshal.dump(c) end end describe Course, ".import_from_migration" do before do attachment_model(:uploaded_data => stub_file_data('test.m4v', 'asdf', 'video/mp4')) course_with_teacher end it "should wait for media objects on canvas cartridge import" do migration = mock(:migration_settings => { 'worker_class' => 'CC::Importer::Canvas::Converter' }.with_indifferent_access) MediaObject.expects(:add_media_files).with([@attachment], true) @course.import_media_objects([@attachment], migration) end it "should not wait for media objects on other import" do migration = mock(:migration_settings => { 'worker_class' => 'CC::Importer::Standard::Converter' }.with_indifferent_access) MediaObject.expects(:add_media_files).with([@attachment], false) @course.import_media_objects([@attachment], migration) end it "should know when it has open course imports" do # no course imports @course.should_not have_open_course_imports # created course import @course.course_imports.create! @course.should have_open_course_imports # started course import @course.course_imports.first.update_attribute(:workflow_state, 'started') @course.should have_open_course_imports # completed course import @course.course_imports.first.update_attribute(:workflow_state, 'completed') @course.should_not have_open_course_imports # failed course import @course.course_imports.first.update_attribute(:workflow_state, 'failed') @course.should_not have_open_course_imports end describe "setting storage quota" do before do course_with_teacher @course.storage_quota = 1 @cm = ContentMigration.new(:context => @course, :user => @user, :copy_options => {:everything => "1"}) @cm.user = @user @cm.save! end it "should not adjust for unauthorized user" do @course.import_settings_from_migration({:course=>{:storage_quota => 4}}, @cm) @course.storage_quota.should == 1 end it "should adjust for authorized user" do account_admin_user(:user => @user) @course.import_settings_from_migration({:course=>{:storage_quota => 4}}, @cm) @course.storage_quota.should == 4 end it "should be set for course copy" do @cm.source_course = @course @course.import_settings_from_migration({:course=>{:storage_quota => 4}}, @cm) @course.storage_quota.should == 4 end end end describe Course, "enrollments" do it "should update enrollments' root_account_id when necessary" do a1 = Account.create! a2 = Account.create! course_with_student @course.root_account = a1 @course.save! @course.student_enrollments.map(&:root_account_id).should eql [a1.id] @course.root_account = a2 @course.save! @course.student_enrollments(true).map(&:root_account_id).should eql [a2.id] end end describe Course, "user_is_teacher?" do it "should be true for teachers" do course = Course.create teacher = user_with_pseudonym course.enroll_teacher(teacher).accept course.user_is_teacher?(teacher).should be_true end it "should be false for designers" do course = Course.create ta = user_with_pseudonym course.enroll_ta(ta).accept course.user_is_teacher?(ta).should be_true end it "should be false for designers" do course = Course.create designer = user_with_pseudonym course.enroll_designer(designer).accept course.user_is_teacher?(designer).should be_false end end describe Course, "user_has_been_teacher?" do it "should be true for teachers, past or present" do e = course_with_teacher(:active_all => true) @course.user_has_been_teacher?(@teacher).should be_true e.conclude e.reload.workflow_state.should == "completed" @course.user_has_been_teacher?(@teacher).should be_true @course.complete @course.user_has_been_teacher?(@teacher).should be_true end end describe Course, "user_has_been_student?" do it "should be true for students, past or present" do e = course_with_student(:active_all => true) @course.user_has_been_student?(@student).should be_true e.conclude e.reload.workflow_state.should == "completed" @course.user_has_been_student?(@student).should be_true @course.complete @course.user_has_been_student?(@student).should be_true end end describe Course, "student_view_student" do before(:each) do course_with_teacher(:active_all => true) end it "should create and return the student view student for a course" do expect { @course.student_view_student }.to change(User, :count).by(1) end it "should find and return the student view student on successive calls" do @course.student_view_student expect { @course.student_view_student }.to change(User, :count).by(0) end it "should create enrollments for each section" do @section2 = @course.course_sections.create! expect { @fake_student = @course.student_view_student }.to change(Enrollment, :count).by(2) @fake_student.enrollments.all?{|e| e.fake_student?}.should be_true end it "should sync enrollments after being created" do @course.student_view_student @section2 = @course.course_sections.create! expect { @course.student_view_student }.to change(Enrollment, :count).by(1) end it "should create a pseudonym for the fake student" do expect { @fake_student = @course.student_view_student }.to change(Pseudonym, :count).by(1) @fake_student.pseudonyms.should_not be_empty end it "should allow two different student view users for two different courses" do @course1 = @course @teacher1 = @teacher course_with_teacher(:active_all => true) @course2 = @course @teacher2 = @teacher @fake_student1 = @course1.student_view_student @fake_student2 = @course2.student_view_student @fake_student1.id.should_not eql @fake_student2.id @fake_student1.pseudonym.id.should_not eql @fake_student2.pseudonym.id end it "should give fake student active student permissions even if enrollment wouldn't otherwise be active" do @course.enrollment_term.update_attributes(:start_at => 2.days.from_now, :end_at => 4.days.from_now) @fake_student = @course.student_view_student @course.grants_right?(@fake_student, nil, :read_forum).should be_true end end describe Course do describe "user_list_search_mode_for" do it "should be open for anyone if open registration is turned on" do account = Account.default account.settings = { :open_registration => true } account.save! course @course.user_list_search_mode_for(nil).should == :open @course.user_list_search_mode_for(user).should == :open end it "should be preferred for account admins" do account = Account.default course @course.user_list_search_mode_for(nil).should == :closed @course.user_list_search_mode_for(user).should == :closed user account.add_user(@user) @course.user_list_search_mode_for(@user).should == :preferred end it "should be preferred if delegated authentication is configured" do account = Account.default account.settings = { :open_registration => true } account.account_authorization_configs.create!(:auth_type => 'cas') account.save! course @course.user_list_search_mode_for(nil).should == :preferred @course.user_list_search_mode_for(user).should == :preferred end end end describe Course do describe "self_enrollment" do it "should generate a unique code" do c1 = course() c1.self_enrollment_code.should be_nil # normally only set when self_enrollment is enabled c1.update_attribute(:self_enrollment, true) c1.self_enrollment_code.should_not be_nil c1.self_enrollment_code.should =~ /\A[A-Z0-9]{6}\z/ c2 = course() c2.update_attribute(:self_enrollment, true) c2.self_enrollment_code.should =~ /\A[A-Z0-9]{6}\z/ c1.self_enrollment_code.should_not == c2.self_enrollment_code end it "should generate a code on demand for existing self enrollment courses" do c1 = course() Course.update_all({:self_enrollment => true}, {:id => @course.id}) c1.reload c1.read_attribute(:self_enrollment_code).should be_nil c1.self_enrollment_code.should_not be_nil c1.self_enrollment_code.should =~ /\A[A-Z0-9]{6}\z/ end end end
kazhuyo/canvas
spec/models/course_spec.rb
Ruby
agpl-3.0
132,089
<?php /********************************************************************************* * Zurmo is a customer relationship management program developed by * Zurmo, Inc. Copyright (C) 2013 Zurmo Inc. * * Zurmo is free software; you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License version 3 as published by the * Free Software Foundation with the addition of the following permission added * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK * IN WHICH THE COPYRIGHT IS OWNED BY ZURMO, ZURMO DISCLAIMS THE WARRANTY * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. * * Zurmo is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more * details. * * You should have received a copy of the GNU Affero General Public License along with * this program; if not, see http://www.gnu.org/licenses or write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301 USA. * * You can contact Zurmo, Inc. with a mailing address at 27 North Wacker Drive * Suite 370 Chicago, IL 60606. or at email address [email protected]. * * The interactive user interfaces in original and modified versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU Affero General Public License version 3. * * In accordance with Section 7(b) of the GNU Affero General Public License version 3, * these Appropriate Legal Notices must retain the display of the Zurmo * logo and Zurmo copyright notice. If the display of the logo is not reasonably * feasible for technical reasons, the Appropriate Legal Notices must display the words * "Copyright Zurmo Inc. 2013. All rights reserved". ********************************************************************************/ /** * Checks that the pdo extension for php is installed. */ class PdoServiceHelper extends ServiceHelper { protected function checkService() { $passed = InstallUtil::isPdoInstalled(); if ($passed) { $this->message = Zurmo::t('InstallModule', 'pdo is installed.'); } else { $this->message = Zurmo::t('InstallModule', 'pdo is not installed.'); } return $passed; } } ?>
sandeep1027/zurmo_
app/protected/modules/install/serviceHelpers/PdoServiceHelper.php
PHP
agpl-3.0
2,669
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Copyright (C) 2010 Winch Gate Property Limited // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // // 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 Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef RY_EVS_H #define RY_EVS_H #include "nel/misc/types_nl.h" #include "nel/misc/common.h" #include "nel/misc/time_nl.h" #include "nel/misc/vectord.h" #include "nel/misc/line.h" #include "nel/misc/event_listener.h" #include "nel/misc/geom_ext.h" #include <string> #include <map> #include <set> #include <list> #include <vector> #include <deque> #include "nel/net/service.h" #include "game_share/ryzom_entity_id.h" #include "game_share/entity_types.h" #include "game_share/mirror_prop_value.h" #include "game_share/ryzom_mirror_properties.h" #include "game_share/mirror.h" #include <nel/3d/u_instance.h> // raw pacs include -- not in user interface :/ #include "pacs/chain.h" #include "move_grid.h" #include "../combat_move_service/sheets.h" class CEntity; typedef CMoveGrid<CEntity*, 256, 32.0f> TEntityGrid; typedef CMoveGrid<NLPACS::COrderedChain3f*, 256, 32.0f> TChainGrid; class CEntity { public: // CEntity() : Position(0.0, 0.0, 0.0), Orientation(0.0f), Check(false), Target(NLMISC::CEntityId::Unknown), SheetId(0), Radius(0.5f), Height(2.0f), EntityIndex() {} // NLMISC::CEntityId Id; TDataSetRow EntityIndex; NLMISC::CVectorD Position; NLMISC::CVectorD NonMirroredPos; float Orientation; bool Check; TEntityGrid::CIterator Iterator; // NLMISC::CEntityId Target; // NLMISC::CSheetId SheetId; std::string SheetName; float Radius; float Height; // CMirrorPropValueAlice1DS<TYPE_COMBAT_STATE> CombatState; // CMirrorPropValueAlice1DS<TYPE_POSX> X; CMirrorPropValueAlice1DS<TYPE_POSY> Y; CMirrorPropValueAlice1DS<TYPE_POSZ> Z; CMirrorPropValueAlice1DS<TYPE_ORIENTATION> Theta; CMirrorPropValueAlice1DS<TYPE_SHEET> Sheet; // std::deque<NLMISC::CVectorD> Path; // void setup(const TDataSetRow& entityIndex); // void setSheet(const NLMISC::CSheetId &sheetId); }; /** * CEntityViewService * * \author Benjamin Legros * \author Nevrax France * \date 2001 */ class CEntityViewService : public NLNET::IService { private: typedef std::map<NLMISC::CEntityId, CEntity> TEntityMap; public: /** * init the service */ void init(void); /** * main loop */ bool update(void); /** * release */ void release(void); void displayEntities() { TEntityMap::iterator ite; uint n = 0; for (ite=_Entities.begin(); ite!=_Entities.end(); ++ite) { CEntity &entity=(*ite).second; nlinfo(" %s: (%.3f,%.3f,%.3f)", entity.Id.toString().c_str(), entity.Position.x, entity.Position.y, entity.Position.z); ++n; } nlinfo("%d entities in GPMS", n); } /// Set target void setTarget(const NLMISC::CEntityId &entity, const NLMISC::CEntityId &target) { TEntityMap::iterator ite, itt; if ((ite = _Entities.find(entity)) == _Entities.end()) return; (*ite).second.Target = target; } /// Set target void setPos(const NLMISC::CEntityId &entity, sint x, sint y, sint z) { TEntityMap::iterator ite, itt; if ((ite = _Entities.find(entity)) == _Entities.end()) return; (*ite).second.NonMirroredPos = NLMISC::CVectorD(x*0.001, y*0.001, z*0.001); } void initMirror(); CMirror Mirror; CMirroredDataSet *DataSet; // void updateEntities(); // TEntityMap::iterator createEntity(const NLMISC::CEntityId &id) { nlinfo("Create entity %s", id.toString().c_str()); std::pair<TEntityMap::iterator,bool> res = _Entities.insert(std::make_pair<NLMISC::CEntityId,CEntity>(id, CEntity())); TEntityMap::iterator ite = res.first; nlassert(ite != _Entities.end() && res.second); (*ite).second.Iterator = _EntityGrid.insert(&((*ite).second), (*ite).second.Position); (*ite).second.Id = id; return ite; } // void removeEntity(const NLMISC::CEntityId &id) { nlinfo("Remove entity %s", id.toString().c_str()); TEntityMap::iterator ite = _Entities.find(id); if (ite == _Entities.end()) return; _EntityGrid.remove((*ite).second.Iterator); _Entities.erase(ite); return; } // CEntity *getEntity(const NLMISC::CEntityId &id) { TEntityMap::iterator it = _Entities.find(id); if (it == _Entities.end()) return NULL; return &((*it).second); } private: // TEntityMap _Entities; // std::vector<NL3D::UInstance*> _OBoxes; std::vector<NL3D::UInstance*> _TBoxes; std::vector<NL3D::UInstance*> _OCylinders; std::vector<NL3D::UInstance*> _TCylinders; std::vector<NLMISC::CLine> _Directions; std::vector<NLMISC::CLineColor> _Targets; // TEntityGrid _EntityGrid; TChainGrid _ChainGrid; std::vector<NLPACS::COrderedChain3f> _Chains; }; extern CEntityViewService *pEVS; #define TheMirror (pEVS->Mirror) #define TheDataset (*(pEVS->DataSet)) #endif //RY_GPMS_H
osgcc/ryzom
ryzom/server/src/entity_view_service/entity_view_service.h
C
agpl-3.0
5,571
/* Copyright 2013 SINTEF ICT, Applied Mathematics. */ #ifndef PRINTMRSTBACKENDASTVISITOR_HEADER_INCLUDED #define PRINTMRSTBACKENDASTVISITOR_HEADER_INCLUDED #include "ASTVisitorInterface.hpp" #include "EquelleType.hpp" #include <string> #include <set> class PrintMRSTBackendASTVisitor : public ASTVisitorInterface { public: PrintMRSTBackendASTVisitor(); ~PrintMRSTBackendASTVisitor(); void visit(SequenceNode& node); void midVisit(SequenceNode& node); void postVisit(SequenceNode& node); void visit(NumberNode& node); void visit(StringNode& node); void visit(TypeNode& node); void visit(FuncTypeNode& node); void visit(BinaryOpNode& node); void midVisit(BinaryOpNode& node); void postVisit(BinaryOpNode& node); void visit(ComparisonOpNode& node); void midVisit(ComparisonOpNode& node); void postVisit(ComparisonOpNode& node); void visit(NormNode& node); void postVisit(NormNode& node); void visit(UnaryNegationNode& node); void postVisit(UnaryNegationNode& node); void visit(OnNode& node); void midVisit(OnNode& node); void postVisit(OnNode& node); void visit(TrinaryIfNode& node); void questionMarkVisit(TrinaryIfNode& node); void colonVisit(TrinaryIfNode& node); void postVisit(TrinaryIfNode& node); void visit(VarDeclNode& node); void postVisit(VarDeclNode& node); void visit(VarAssignNode& node); void postVisit(VarAssignNode& node); void visit(VarNode& node); void visit(FuncRefNode& node); void visit(JustAnIdentifierNode& node); void visit(FuncArgsDeclNode& node); void midVisit(FuncArgsDeclNode& node); void postVisit(FuncArgsDeclNode& node); void visit(FuncDeclNode& node); void postVisit(FuncDeclNode& node); void visit(FuncStartNode& node); void postVisit(FuncStartNode& node); void visit(FuncAssignNode& node); void postVisit(FuncAssignNode& node); void visit(FuncArgsNode& node); void midVisit(FuncArgsNode& node); void postVisit(FuncArgsNode& node); void visit(ReturnStatementNode& node); void postVisit(ReturnStatementNode& node); void visit(FuncCallNode& node); void postVisit(FuncCallNode& node); void visit(FuncCallStatementNode& node); void postVisit(FuncCallStatementNode& node); void visit(LoopNode& node); void postVisit(LoopNode& node); void visit(ArrayNode& node); void postVisit(ArrayNode& node); void visit(RandomAccessNode& node); void postVisit(RandomAccessNode& node); void visit(StencilAssignmentNode& node); void midVisit(StencilAssignmentNode& node); void postVisit(StencilAssignmentNode& node); void visit(StencilNode& node); void postVisit(StencilNode& node); private: // bool suppressed_; int indent_; int sequence_depth_; void endl() const; std::string indent() const; }; #endif // PRINTMRSTBACKENDASTVISITOR_HEADER_INCLUDED
sintefmath/equelle
compiler/PrintMRSTBackendASTVisitor.hpp
C++
agpl-3.0
2,938
import SPELLS from 'common/SPELLS'; import CoreBuffs from 'parser/core/modules/Buffs'; import BLOODLUST_BUFFS from 'game/BLOODLUST_BUFFS'; class Buffs extends CoreBuffs { buffs() { const combatant = this.selectedCombatant; // This should include ALL buffs that can be applied by your spec. // This data can be used by various kinds of modules to improve their results, and modules added in the future may rely on buffs that aren't used today. return [ // Core { spellId: SPELLS.ADRENALINE_RUSH.id, timelineHightlight: true, }, { spellId: SPELLS.BLADE_RUSH_TALENT.id, enabled: combatant.hasTalent(SPELLS.BLADE_RUSH_TALENT.id), }, { spellId: SPELLS.SLICE_AND_DICE_TALENT.id, enabled: combatant.hasTalent(SPELLS.SLICE_AND_DICE_TALENT.id), timelineHightlight: true, }, { spellId: SPELLS.OPPORTUNITY.id, timelineHightlight: true, }, // Roll the Bones { spellId: SPELLS.ROLL_THE_BONES.id, enabled: !combatant.hasTalent(SPELLS.SLICE_AND_DICE_TALENT.id), timelineHightlight: true, }, { spellId: SPELLS.RUTHLESS_PRECISION.id, enabled: !combatant.hasTalent(SPELLS.SLICE_AND_DICE_TALENT.id), }, { spellId: SPELLS.GRAND_MELEE.id, enabled: !combatant.hasTalent(SPELLS.SLICE_AND_DICE_TALENT.id), }, { spellId: SPELLS.BROADSIDE.id, enabled: !combatant.hasTalent(SPELLS.SLICE_AND_DICE_TALENT.id), }, { spellId: SPELLS.SKULL_AND_CROSSBONES.id, enabled: !combatant.hasTalent(SPELLS.SLICE_AND_DICE_TALENT.id), }, { spellId: SPELLS.BURIED_TREASURE.id, enabled: !combatant.hasTalent(SPELLS.SLICE_AND_DICE_TALENT.id), }, { spellId: SPELLS.TRUE_BEARING.id, enabled: !combatant.hasTalent(SPELLS.SLICE_AND_DICE_TALENT.id), }, // Misc { spellId: SPELLS.CLOAK_OF_SHADOWS.id, }, { spellId: SPELLS.CRIMSON_VIAL.id, }, { spellId: SPELLS.FEINT.id, }, { spellId: SPELLS.RIPOSTE.id, }, { spellId: SPELLS.SPRINT.id, }, { spellId: SPELLS.SHROUD_OF_CONCEALMENT.id, }, // Bloodlust Buffs { spellId: Object.keys(BLOODLUST_BUFFS).map(item => Number(item)), timelineHightlight: true, }, ]; } } export default Buffs;
sMteX/WoWAnalyzer
src/parser/rogue/outlaw/modules/Buffs.js
JavaScript
agpl-3.0
2,502
"""pkginfo.""" BASE_ID = 51
devs1991/test_edx_docmode
venv/lib/python2.7/site-packages/pylint_django/__pkginfo__.py
Python
agpl-3.0
28
<?php /********************************************************************************* * Zurmo is a customer relationship management program developed by * Zurmo, Inc. Copyright (C) 2014 Zurmo Inc. * * Zurmo is free software; you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License version 3 as published by the * Free Software Foundation with the addition of the following permission added * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK * IN WHICH THE COPYRIGHT IS OWNED BY ZURMO, ZURMO DISCLAIMS THE WARRANTY * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. * * Zurmo is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more * details. * * You should have received a copy of the GNU Affero General Public License along with * this program; if not, see http://www.gnu.org/licenses or write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301 USA. * * You can contact Zurmo, Inc. with a mailing address at 27 North Wacker Drive * Suite 370 Chicago, IL 60606. or at email address [email protected]. * * The interactive user interfaces in original and modified versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU Affero General Public License version 3. * * In accordance with Section 7(b) of the GNU Affero General Public License version 3, * these Appropriate Legal Notices must retain the display of the Zurmo * logo and Zurmo copyright notice. If the display of the logo is not reasonably * feasible for technical reasons, the Appropriate Legal Notices must display the words * "Copyright Zurmo Inc. 2014. All rights reserved". ********************************************************************************/ class CalendarTestHelper { public static function createSavedCalendarByName($name, $color) { $savedCalendar = new SavedCalendar(); $savedCalendar->name = $name; $savedCalendar->timeZone = 'America/Chicago'; $savedCalendar->location = 'Newyork'; $savedCalendar->moduleClassName = 'ProductsModule'; $savedCalendar->startAttributeName = 'createdDateTime'; $savedCalendar->color = $color; assert($savedCalendar->save()); // Not Coding Standard return $savedCalendar; } public static function createSavedCalendarSubscription($name, $color, $user) { $savedCalendars = SavedCalendar::getByName($name); $savedCalendarSubscription = new SavedCalendarSubscription(); $savedCalendarSubscription->user = $user; $savedCalendarSubscription->savedcalendar = $savedCalendars[0]; $savedCalendarSubscription->color = $color; assert($savedCalendarSubscription->save()); // Not Coding Standard return $savedCalendarSubscription; } } ?>
speixoto/zurmo-for-school
app/protected/modules/calendars/tests/unit/CalendarTestHelper.php
PHP
agpl-3.0
3,457
#include <check.h> #include "../../test.h" #include "../../builders/build.h" #include "../../../src/alloc.h" #include "../../../src/fsops.h" #include "../../../src/fzp.h" #include "../../../src/iobuf.h" #include "../../../src/protocol2/blist.h" #include "../../../src/protocol2/blk.h" #include "../../../src/server/manio.h" #include "../../../src/server/protocol2/backup_phase4.h" #define PATH "utest_merge" static const char *srca_path=PATH "/srca"; static const char *srcb_path=PATH "/srcb"; static const char *dst_path=PATH "/dst"; static void tear_down(void) { fail_unless(recursive_delete(PATH)==0); alloc_check(); } static void setup(void) { fail_unless(recursive_delete(PATH)==0); fail_unless(!mkdir(PATH, 0777)); } struct sp { char candidate[16]; char rmanifest[64]; uint64_t f[16]; size_t len; }; static void sp_to_fzp(struct fzp *fzp, struct sp *sp) { size_t f; fail_unless(!write_hook_header(fzp, "rmanifest", sp->candidate)); for(f=0; f<sp->len; f++) fail_unless(!to_fzp_fingerprint(fzp, sp->f[f])); } static void build_sparse_index(struct sp *sp, size_t s, const char *fname) { size_t i; struct fzp *fzp=NULL; fail_unless((fzp=fzp_gzopen(fname, "ab"))!=NULL); for(i=0; i<s; i++) sp_to_fzp(fzp, &sp[i]); fzp_close(&fzp); } static void init_sp(struct sp *sp, const char *candidate, uint64_t *f, size_t len) { size_t i; snprintf(sp->candidate, sizeof(sp->candidate), "%s", candidate); snprintf(sp->rmanifest, sizeof(sp->rmanifest), "rmanifest/%s", candidate); for(i=0; i<len; i++) sp->f[i]=f[i]; sp->len=len; } static void check_result(struct sp *sp, size_t splen) { int ret; size_t f=0; size_t i=0; struct fzp *fzp; struct blk blk; struct iobuf rbuf; memset(&rbuf, 0, sizeof(struct iobuf)); fail_unless(splen>0); fail_unless((fzp=fzp_gzopen(dst_path, "rb"))!=NULL); while(!(ret=iobuf_fill_from_fzp(&rbuf, fzp))) { switch(rbuf.cmd) { case CMD_MANIFEST: ck_assert_str_eq(sp[i].rmanifest, rbuf.buf); break; case CMD_FINGERPRINT: fail_unless(f<sp[i].len); blk_set_from_iobuf_fingerprint(&blk, &rbuf); fail_unless(blk.fingerprint==sp[i].f[f++]); break; default: fail_unless(0==1); } if(f==sp[i].len) { f=0; i++; if(i>=splen) { ret=iobuf_fill_from_fzp(&rbuf, fzp); break; } } iobuf_free_content(&rbuf); } fail_unless(!fzp_close(&fzp)); fail_unless(ret==1); fail_unless(i==splen); iobuf_free_content(&rbuf); } static void common(struct sp *dst, size_t dlen, struct sp *srca, size_t alen, struct sp *srcb, size_t blen) { setup(); build_sparse_index(srca, alen, srca_path); build_sparse_index(srcb, blen, srcb_path); fail_unless(!merge_sparse_indexes(dst_path, srca_path, srcb_path)); check_result(dst, dlen); tear_down(); } static uint64_t finga[1]={ 0xF000000000000000 }; static uint64_t fingb[3]={ 0xF011223344556699, 0xF122334455667788, 0xF233445566778877 }; static uint64_t fingc[1]={ 0xF111111111111111 }; static uint64_t fingd[1]={ 0xF222222222222222 }; static uint64_t finge[1]={ 0xFAAAAAAAAAAAAAAA }; static uint64_t fingf[3]={ 0xFF11223344556699, 0xFF22334455667788, 0xFF33445566778877 }; static uint64_t fingg[1]={ 0xFF11223344556677 }; START_TEST(test_merge_sparse_indexes_simple1) { struct sp srca[1]; struct sp srcb[1]; struct sp dst[2]; init_sp(&srca[0], "bbbb", fingb, ARR_LEN(fingb)); init_sp(&srcb[0], "ffff", fingf, ARR_LEN(fingf)); init_sp(&dst[0], "bbbb", fingb, ARR_LEN(fingb)); init_sp(&dst[1], "ffff", fingf, ARR_LEN(fingf)); common(dst, ARR_LEN(dst), srca, ARR_LEN(srca), srcb, ARR_LEN(srcb)); } END_TEST START_TEST(test_merge_sparse_indexes_simple2) { struct sp srca[1]; struct sp srcb[1]; struct sp dst[2]; init_sp(&srca[0], "ffff", fingf, ARR_LEN(fingf)); init_sp(&srcb[0], "bbbb", fingb, ARR_LEN(fingb)); init_sp(&dst[0], "bbbb", fingb, ARR_LEN(fingb)); init_sp(&dst[1], "ffff", fingf, ARR_LEN(fingf)); common(dst, ARR_LEN(dst), srca, ARR_LEN(srca), srcb, ARR_LEN(srcb)); } END_TEST START_TEST(test_merge_sparse_indexes_same) { struct sp srca[1]; struct sp srcb[1]; struct sp dst[1]; init_sp(&srca[0], "bbb1", fingb, ARR_LEN(fingb)); init_sp(&srcb[0], "bbb2", fingb, ARR_LEN(fingb)); init_sp(&dst[0], "bbb2", fingb, ARR_LEN(fingb)); common(dst, ARR_LEN(dst), srca, ARR_LEN(srca), srcb, ARR_LEN(srcb)); } END_TEST START_TEST(test_merge_sparse_indexes_many) { struct sp srca[3]; struct sp srcb[3]; struct sp dst[6]; init_sp(&srca[0], "aaaa", finga, ARR_LEN(finga)); init_sp(&srca[1], "cccc", fingc, ARR_LEN(fingc)); init_sp(&srca[2], "eeee", finge, ARR_LEN(finge)); init_sp(&srcb[0], "bbbb", fingb, ARR_LEN(fingb)); init_sp(&srcb[1], "dddd", fingd, ARR_LEN(fingd)); init_sp(&srcb[2], "ffff", fingf, ARR_LEN(fingf)); init_sp(&dst[0], "aaaa", finga, ARR_LEN(finga)); init_sp(&dst[1], "bbbb", fingb, ARR_LEN(fingb)); init_sp(&dst[2], "cccc", fingc, ARR_LEN(fingc)); init_sp(&dst[3], "dddd", fingd, ARR_LEN(fingd)); init_sp(&dst[4], "eeee", finge, ARR_LEN(finge)); init_sp(&dst[5], "ffff", fingf, ARR_LEN(fingf)); common(dst, ARR_LEN(dst), srca, ARR_LEN(srca), srcb, ARR_LEN(srcb)); } END_TEST START_TEST(test_merge_sparse_indexes_different_lengths1) { struct sp srca[1]; struct sp srcb[1]; struct sp dst[2]; init_sp(&srca[0], "ffff", fingf, ARR_LEN(fingf)); init_sp(&srcb[0], "gggg", fingg, ARR_LEN(fingg)); init_sp(&dst[0], "gggg", fingg, ARR_LEN(fingg)); init_sp(&dst[1], "ffff", fingf, ARR_LEN(fingf)); common(dst, ARR_LEN(dst), srca, ARR_LEN(srca), srcb, ARR_LEN(srcb)); } END_TEST START_TEST(test_merge_sparse_indexes_different_lengths2) { struct sp srca[1]; struct sp srcb[1]; struct sp dst[2]; init_sp(&srca[0], "gggg", fingg, ARR_LEN(fingg)); init_sp(&srcb[0], "ffff", fingf, ARR_LEN(fingf)); init_sp(&dst[0], "gggg", fingg, ARR_LEN(fingg)); init_sp(&dst[1], "ffff", fingf, ARR_LEN(fingf)); common(dst, ARR_LEN(dst), srca, ARR_LEN(srca), srcb, ARR_LEN(srcb)); } END_TEST static void check_result_di(uint64_t *di, size_t dlen) { int ret; size_t i=0; struct fzp *fzp; struct blk blk; struct iobuf rbuf; memset(&rbuf, 0, sizeof(struct iobuf)); fail_unless(dlen>0); fail_unless((fzp=fzp_gzopen(dst_path, "rb"))!=NULL); while(!(ret=iobuf_fill_from_fzp(&rbuf, fzp))) { switch(rbuf.cmd) { case CMD_SAVE_PATH: blk_set_from_iobuf_savepath(&blk, &rbuf); fail_unless(blk.savepath==di[i++]); break; default: fail_unless(0==1); } iobuf_free_content(&rbuf); } fail_unless(!fzp_close(&fzp)); fail_unless(ret==1); fail_unless(i==dlen); iobuf_free_content(&rbuf); } static void common_di(uint64_t *dst, size_t dlen, uint64_t *srca, size_t alen, uint64_t *srcb, size_t blen) { setup(); build_dindex(srca, alen, srca_path); build_dindex(srcb, blen, srcb_path); fail_unless(!merge_dindexes(dst_path, srca_path, srcb_path)); check_result_di(dst, dlen); tear_down(); } static uint64_t din1[2]={ 0x1111222233330000, 0x1111222244440000 }; static uint64_t din2[2]={ 0x1111222233350000, 0x1111222233390000 }; static uint64_t ex1[4]={ 0x1111222233330000, 0x1111222233350000, 0x1111222233390000, 0x1111222244440000 }; static uint64_t din3[5]={ 0x0000000011110000, 0x1111222233330000, 0x1111222244440000, 0x123456789ABC0000, 0xFFFFFFFFFFFF0000 }; static uint64_t din4[5]={ 0x0000000011100000, 0x1111222223330000, 0x1111222244540000, 0x123456889ABC0000, 0xFFFFFFFFFFFE0000 }; static uint64_t ex2[10]={ 0x0000000011100000, 0x0000000011110000, 0x1111222223330000, 0x1111222233330000, 0x1111222244440000, 0x1111222244540000, 0x123456789ABC0000, 0x123456889ABC0000, 0xFFFFFFFFFFFE0000, 0xFFFFFFFFFFFF0000 }; START_TEST(test_merge_dindexes_simple1) { common_di(ex1, ARR_LEN(ex1), din1, ARR_LEN(din1), din2, ARR_LEN(din2)); common_di(ex1, ARR_LEN(ex1), din2, ARR_LEN(din2), din1, ARR_LEN(din1)); common_di(din1, ARR_LEN(din1), din1, ARR_LEN(din1), din1, ARR_LEN(din1)); common_di(din1, ARR_LEN(din1), din1, ARR_LEN(din1), NULL, 0); common_di(din1, ARR_LEN(din1), NULL, 0, din1, ARR_LEN(din1)); common_di(ex2, ARR_LEN(ex2), din3, ARR_LEN(din3), din4, ARR_LEN(din4)); } END_TEST static void make_file_for_rename(const char *path) { FILE *fp; fail_unless(build_path_w(path)==0); fail_unless((fp=fopen(path, "wb"))!=NULL); fail_unless(!fclose(fp)); } static int calls; static int max_calls; static int merge_callback_0(const char *dst, const char *srca, const char *srcb) { fail_unless(0==1); return 0; } static int merge_callback_1(const char *dst, const char *srca, const char *srcb) { calls++; ck_assert_str_eq(srca, "utest_merge/f/sd/00000000"); fail_unless(srcb==NULL); ck_assert_str_eq(dst, "utest_merge/f/m1/00000000"); make_file_for_rename(PATH "/f/m1/00000000"); return 0; } static int merge_callback_2(const char *dst, const char *srca, const char *srcb) { calls++; ck_assert_str_eq(srca, "utest_merge/f/sd/00000000"); ck_assert_str_eq(srcb, "utest_merge/f/sd/00000001"); ck_assert_str_eq(dst, "utest_merge/f/m1/00000000"); make_file_for_rename(PATH "/f/m1/00000000"); return 0; } static int merge_callback_3(const char *dst, const char *srca, const char *srcb) { calls++; switch(calls) { case 1: ck_assert_str_eq(srca, "utest_merge/f/sd/00000000"); ck_assert_str_eq(srcb, "utest_merge/f/sd/00000001"); ck_assert_str_eq(dst, "utest_merge/f/m1/00000000"); break; case 2: ck_assert_str_eq(srca, "utest_merge/f/sd/00000002"); fail_unless(srcb==NULL); ck_assert_str_eq(dst, "utest_merge/f/m1/00000001"); break; case 3: ck_assert_str_eq(srca, "utest_merge/f/m1/00000000"); ck_assert_str_eq(srcb, "utest_merge/f/m1/00000001"); ck_assert_str_eq(dst, "utest_merge/f/m2/00000000"); make_file_for_rename(PATH "/f/m2/00000000"); break; } return 0; } static int merge_callback_4(const char *dst, const char *srca, const char *srcb) { calls++; switch(calls) { case 1: ck_assert_str_eq(srca, "utest_merge/f/sd/00000000"); ck_assert_str_eq(srcb, "utest_merge/f/sd/00000001"); ck_assert_str_eq(dst, "utest_merge/f/m1/00000000"); break; case 2: ck_assert_str_eq(srca, "utest_merge/f/sd/00000002"); ck_assert_str_eq(srcb, "utest_merge/f/sd/00000003"); ck_assert_str_eq(dst, "utest_merge/f/m1/00000001"); break; case 3: ck_assert_str_eq(srca, "utest_merge/f/m1/00000000"); ck_assert_str_eq(srcb, "utest_merge/f/m1/00000001"); ck_assert_str_eq(dst, "utest_merge/f/m2/00000000"); make_file_for_rename(PATH "/f/m2/00000000"); break; } return 0; } static int merge_callback_5(const char *dst, const char *srca, const char *srcb) { calls++; switch(calls) { case 1: ck_assert_str_eq(srca, "utest_merge/f/sd/00000000"); ck_assert_str_eq(srcb, "utest_merge/f/sd/00000001"); ck_assert_str_eq(dst, "utest_merge/f/m1/00000000"); break; case 2: ck_assert_str_eq(srca, "utest_merge/f/sd/00000002"); ck_assert_str_eq(srcb, "utest_merge/f/sd/00000003"); ck_assert_str_eq(dst, "utest_merge/f/m1/00000001"); break; case 3: ck_assert_str_eq(srca, "utest_merge/f/sd/00000004"); fail_unless(srcb==NULL); ck_assert_str_eq(dst, "utest_merge/f/m1/00000002"); break; case 4: ck_assert_str_eq(srca, "utest_merge/f/m1/00000000"); ck_assert_str_eq(srcb, "utest_merge/f/m1/00000001"); ck_assert_str_eq(dst, "utest_merge/f/m2/00000000"); break; case 5: ck_assert_str_eq(srca, "utest_merge/f/m1/00000002"); fail_unless(srcb==NULL); ck_assert_str_eq(dst, "utest_merge/f/m2/00000001"); break; case 6: ck_assert_str_eq(srca, "utest_merge/f/m2/00000000"); ck_assert_str_eq(srcb, "utest_merge/f/m2/00000001"); ck_assert_str_eq(dst, "utest_merge/f/m1/00000000"); make_file_for_rename(PATH "/f/m1/00000000"); break; } return 0; } static int merge_callback_6(const char *dst, const char *srca, const char *srcb) { calls++; switch(calls) { case 1: ck_assert_str_eq(srca, "utest_merge/f/sd/00000000"); ck_assert_str_eq(srcb, "utest_merge/f/sd/00000001"); ck_assert_str_eq(dst, "utest_merge/f/m1/00000000"); break; case 2: ck_assert_str_eq(srca, "utest_merge/f/sd/00000002"); ck_assert_str_eq(srcb, "utest_merge/f/sd/00000003"); ck_assert_str_eq(dst, "utest_merge/f/m1/00000001"); break; case 3: ck_assert_str_eq(srca, "utest_merge/f/sd/00000004"); ck_assert_str_eq(srcb, "utest_merge/f/sd/00000005"); ck_assert_str_eq(dst, "utest_merge/f/m1/00000002"); break; case 4: ck_assert_str_eq(srca, "utest_merge/f/m1/00000000"); ck_assert_str_eq(srcb, "utest_merge/f/m1/00000001"); ck_assert_str_eq(dst, "utest_merge/f/m2/00000000"); break; case 5: ck_assert_str_eq(srca, "utest_merge/f/m1/00000002"); fail_unless(srcb==NULL); ck_assert_str_eq(dst, "utest_merge/f/m2/00000001"); break; case 6: ck_assert_str_eq(srca, "utest_merge/f/m2/00000000"); ck_assert_str_eq(srcb, "utest_merge/f/m2/00000001"); ck_assert_str_eq(dst, "utest_merge/f/m1/00000000"); make_file_for_rename(PATH "/f/m1/00000000"); break; } return 0; } static void merge_common(uint64_t fcount, int set_max_calls, int merge_callback(const char *dst, const char *srca, const char *srcb)) { int r; const char *final=PATH "/dst"; const char *fmanifest=PATH "/f"; const char *srcdir="sd"; setup(); calls=0; max_calls=set_max_calls; r=merge_files_in_dir(final, fmanifest, srcdir, fcount, merge_callback); fail_unless(r==0); fail_unless(calls==max_calls); tear_down(); } START_TEST(test_merge_files_in_dir) { // fcount, set_max_calls, merge_callback merge_common(0, 0, merge_callback_0); merge_common(1, 1, merge_callback_1); merge_common(2, 1, merge_callback_2); merge_common(3, 3, merge_callback_3); merge_common(4, 3, merge_callback_4); merge_common(5, 6, merge_callback_5); merge_common(6, 6, merge_callback_6); } END_TEST Suite *suite_server_protocol2_backup_phase4(void) { Suite *s; TCase *tc_core; s=suite_create("server_protocol2_backup_phase4"); tc_core=tcase_create("Core"); tcase_add_test(tc_core, test_merge_sparse_indexes_simple1); tcase_add_test(tc_core, test_merge_sparse_indexes_simple2); tcase_add_test(tc_core, test_merge_sparse_indexes_same); tcase_add_test(tc_core, test_merge_sparse_indexes_many); tcase_add_test(tc_core, test_merge_sparse_indexes_different_lengths1); tcase_add_test(tc_core, test_merge_sparse_indexes_different_lengths2); tcase_add_test(tc_core, test_merge_dindexes_simple1); tcase_add_test(tc_core, test_merge_files_in_dir); suite_add_tcase(s, tc_core); return s; }
rubenk/burp
utest/server/protocol2/test_backup_phase4.c
C
agpl-3.0
14,503
<?php return [ 'id' => 'ID', 'months' => 'Mėnesiai', 'term' => 'Laikotarpis', 'title' => 'Pavadinimas ', 'depreciation_min' => 'Floor Value', ];
mtucker6784/snipe-it
resources/lang/lt/admin/depreciations/table.php
PHP
agpl-3.0
183
/* * ProActive Parallel Suite(TM): * The Open Source library for parallel and distributed * Workflows & Scheduling, Orchestration, Cloud Automation * and Big Data Analysis on Enterprise Grids & Clouds. * * Copyright (c) 2007 - 2017 ActiveEon * Contact: [email protected] * * This library is free software: you can redistribute it and/or * modify it under the terms of the GNU Affero General Public License * as published by the Free Software Foundation: version 3 of * the License. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * If needed, contact us to obtain a release under GPL Version 2 or 3 * or a different license than the AGPL. */ package org.ow2.proactive.resourcemanager.nodesource.policy; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; import org.apache.log4j.Logger; import org.objectweb.proactive.api.PAActiveObject; import org.objectweb.proactive.core.util.wrapper.BooleanWrapper; import org.objectweb.proactive.extensions.annotation.ActiveObject; import org.ow2.proactive.resourcemanager.authentication.Client; import org.ow2.proactive.resourcemanager.core.RMCore; import org.ow2.proactive.resourcemanager.nodesource.NodeSource; import org.ow2.proactive.resourcemanager.nodesource.NodeSourcePlugin; import org.ow2.proactive.resourcemanager.nodesource.common.Configurable; import org.ow2.proactive.resourcemanager.nodesource.utils.NamesConvertor; /** * A node source policy is a set of rules of acquiring/releasing nodes. * It describes a time and conditions when and how many nodes have to be * acquired from the infrastructure. * <p> * NOTE: NodeSourcePolicy will be an active object. * <p> * To define a new node source policy: * <ul> * <li>implement {@link NodeSourcePolicy#configure(Object...)} and setup there all policy parameters which are available through UI</li> * <li>define activation and disactivation policy behavior by implementing corresponding methods</li> * <li>define how policy should react on nodes adding request initiated by user</li> * <li>add the name of new policy class to the resource manager configuration file (config/rm/nodesource/policies).</li> * </ul> */ @ActiveObject public abstract class NodeSourcePolicy implements NodeSourcePlugin { /** logger */ private static Logger logger = Logger.getLogger(NodeSourcePolicy.class); private AtomicInteger handledNodes; private RMCore rmCore; /** Node source of the policy */ protected NodeSource nodeSource; // Users who can get nodes for computations from this node source @Configurable(description = "ME|users=name1,name2;groups=group1,group2;tokens=t1,t2|ALL") private AccessType userAccessType = AccessType.ALL; // Users who can add/remove nodes to/from this node source @Configurable(description = "ME|users=name1,name2;groups=group1,group2|ALL") private AccessType providerAccessType = AccessType.ME; /** * Configure a policy with given parameters. * @param policyParameters parameters defined by user * @throws IllegalArgumentException if parameters are incorrect */ public BooleanWrapper configure(Object... policyParameters) { if (policyParameters != null && policyParameters.length >= 2) { try { userAccessType = AccessType.valueOf(policyParameters[0].toString()); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Incorrect parameter value " + policyParameters[0]); } try { providerAccessType = AccessType.valueOf(policyParameters[1].toString()); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Incorrect parameter value " + policyParameters[1]); } } // else using default values return new BooleanWrapper(true); } /** * Reconfigure a policy (potentially running) with the given parameters. * Implementations are free to handle override of parameters as they wish. * * @see Configurable#dynamic() * * @param updatedPolicyParameters parameters potentially containing updated dynamic * parameters * * @throws IllegalArgumentException if parameters are incorrect */ public void reconfigure(Object... updatedPolicyParameters) throws Exception { // by default, reconfiguration does not overwrite any parameter } /** * Activates the policy. * @return true if the policy has been activated successfully, false otherwise. */ public abstract BooleanWrapper activate(); /** * Shutdown the policy */ public void shutdown(Client initiator) { this.rmCore.disconnect(Client.getId(PAActiveObject.getStubOnThis())); PAActiveObject.terminateActiveObject(false); } /** * Policy description for UI * @return policy description */ public abstract String getDescription(); /** * Sets a policy node source * @param nodeSource policy node source */ public void setNodeSource(NodeSource nodeSource) { this.nodeSource = nodeSource; this.rmCore = this.nodeSource.getRMCore(); Thread.currentThread().setName("Node Source Policy \"" + nodeSource.getName() + "\""); } /** * Asynchronous request to acquires n nodes from infrastructure * @param n number of nodes */ public void acquireNodes(int n) { if (n < 0) { throw new IllegalArgumentException("Negative nodes number " + n); } if (n == 0) { return; } info("Acquiring " + n + " nodes"); for (int i = 0; i < n; i++) { nodeSource.acquireNode(); } } public void acquireNodes(int n, Map<String, ?> nodeConfiguration) { if (n < 0) { throw new IllegalArgumentException("Negative nodes number " + n); } if (n == 0) { return; } info("Acquiring " + n + " nodes with configuration"); nodeSource.acquireNodes(n, nodeConfiguration); } /** * Asynchronous request to acquires all possible nodes from infrastructure */ protected void acquireAllNodes() { info("Acquiring all nodes"); nodeSource.acquireAllNodes(); } /** * Removes n nodes from the node source * * @param n number of nodes * @param preemptive if true remove nodes immediately without waiting while they will be freed */ protected void removeNodes(int n, boolean preemptive) { info("Removing " + n + " nodes"); this.handledNodes = new AtomicInteger(n); nodeSource.getRMCore().removeNodes(n, this.nodeSource.getName(), preemptive); } /** * Removes a node from the node source * * @param url the URL of the node * @param preemptive if true remove nodes immediately without waiting while they will be freed */ protected void removeNode(String url, boolean preemptive) { info("Removing node at " + url); nodeSource.getRMCore().removeNode(url, preemptive); } /** * Removed all nodes from the node source * @param preemptive if true remove nodes immediately without waiting while they will be freed */ protected void removeAllNodes(boolean preemptive) { info("Releasing all nodes"); nodeSource.getRMCore().removeAllNodes(this.nodeSource.getName(), preemptive); } /** * Prints a formatted info message to the logging system * @param message to print */ protected void info(String message) { logger.info("[" + nodeSource.getName() + "] " + message); } /** * Prints a formatted debug message to the logging system * @param message to print */ protected void debug(String message) { logger.debug("[" + nodeSource.getName() + "] " + message); } /** * Returns a node source administration type. * Could be ME, MY_GROUPS, ALL * * @return a node source administration type */ public AccessType getProviderAccessType() { return providerAccessType; } /** * Returns a nodes access type. * Could be ME, MY_GROUPS, PROVIDER, PROVIDER_GROUPS, ALL * * @return a nodes access type */ public AccessType getUserAccessType() { return userAccessType; } /** * Policy string representation. */ @Override public String toString() { return NamesConvertor.beautifyName(this.getClass().getSimpleName()) + " user access type [" + userAccessType + "]" + ", provider access type [" + providerAccessType + "]"; } }
tobwiens/scheduling
rm/rm-server/src/main/java/org/ow2/proactive/resourcemanager/nodesource/policy/NodeSourcePolicy.java
Java
agpl-3.0
9,151
# Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved. # # This file is part of Navitia, # the software to build cool stuff with public transport. # # Hope you'll enjoy and contribute to this project, # powered by Canal TP (www.canaltp.fr). # Help us simplify mobility and open public transport: # a non ending quest to the responsive locomotion way of traveling! # # LICENCE: This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # Stay tuned using # twitter @navitia # IRC #navitia on freenode # https://groups.google.com/d/forum/navitia # www.navitia.io from __future__ import absolute_import, print_function, unicode_literals, division from jormungandr.scenarios import default, helpers from jormungandr.scenarios.default import is_admin import copy import logging from jormungandr.scenarios.utils import JourneySorter, are_equals, compare, add_link from navitiacommon import response_pb2 from operator import indexOf, attrgetter from datetime import datetime import pytz from collections import defaultdict, OrderedDict from jormungandr.scenarios.helpers import has_bss_first_and_walking_last, has_walking_first_and_bss_last, \ has_bss_first_and_bss_last, has_bike_first_and_walking_last, has_bike_first_and_bss_last, \ is_non_pt_bss, is_non_pt_bike, is_non_pt_walk import itertools from jormungandr.utils import pb_del_if, timestamp_to_str from six.moves import filter from six.moves import range non_pt_types = ['non_pt_walk', 'non_pt_bike', 'non_pt_bss'] def is_pure_tc(journey): has_tc = False for section in journey.sections: if section.type in (response_pb2.STREET_NETWORK, response_pb2.CROW_FLY) \ and section.street_network.mode in (response_pb2.Bike, response_pb2.Car, response_pb2.Bss): return False if section.type == response_pb2.PUBLIC_TRANSPORT: has_tc = True return has_tc def has_bike_and_tc(journey): has_tc = False has_bike = False in_bss = False for section in journey.sections: if section.type == response_pb2.BSS_RENT: in_bss = True if section.type == response_pb2.BSS_PUT_BACK: in_bss = False if section.type in (response_pb2.STREET_NETWORK, response_pb2.CROW_FLY) \ and section.street_network.mode == response_pb2.Bike \ and not in_bss: has_bike = True if section.type == response_pb2.PUBLIC_TRANSPORT: has_tc = True return has_tc and has_bike def has_bss_and_tc(journey): has_tc = False has_bss = False has_other_fallback_mode = False for section in journey.sections: if section.type == response_pb2.BSS_RENT: has_bss = True if section.type == response_pb2.PUBLIC_TRANSPORT: has_tc = True if section.type in (response_pb2.STREET_NETWORK, response_pb2.CROW_FLY) \ and section.street_network.mode in (response_pb2.Bike, response_pb2.Car, response_pb2.Bss) \ and not has_bss: #if we take a bike before renting a bss then we have a bike mode and not a bss has_other_fallback_mode = True return has_tc and has_bss and not has_other_fallback_mode def has_car_and_tc(journey): has_tc = False has_car = False for section in journey.sections: if section.type in (response_pb2.STREET_NETWORK, response_pb2.CROW_FLY) \ and section.street_network.mode == response_pb2.Car: has_car = True if section.type == response_pb2.PUBLIC_TRANSPORT: has_tc = True return has_tc and has_car def is_alternative(journey): return is_non_pt_bike(journey) or is_non_pt_walk(journey) class DestineoJourneySorter(JourneySorter): """ sort the journeys for destineo: - N pure TC journeys, sort by departure time - 1 direct BSS journey - N TC journeys with bss as fallback mode, sort by departure time - N TC journeys with bike as fallback mode, sort by departure time - 1 journey with car as fallback mode - 1 direct walking journey - 1 direct bike journey """ def __init__(self, clockwise, timezone): super(DestineoJourneySorter, self).__init__(clockwise) self.timezone = timezone def sort_by_time(self, j1, j2): # we don't care about the clockwise for destineo if j1.departure_date_time != j2.departure_date_time: return -1 if j1.departure_date_time < j2.departure_date_time else 1 return self.sort_by_duration_and_transfert(j1, j2) def __call__(self, j1, j2): j1_dt = datetime.utcfromtimestamp(j1.departure_date_time) j2_dt = datetime.utcfromtimestamp(j2.departure_date_time) j1_date = pytz.utc.localize(j1_dt).astimezone(pytz.timezone(self.timezone)).date() j2_date = pytz.utc.localize(j2_dt).astimezone(pytz.timezone(self.timezone)).date() #we first sort by date, we want the journey of the first day in first even if it's a non_pt if j1_date != j2_date: if j1_date < j2_date: return -1 else: return 1 #first we want the pure tc journey if is_pure_tc(j1) and is_pure_tc(j2): return self.sort_by_time(j1, j2) elif is_pure_tc(j1): return -1 elif is_pure_tc(j2): return 1 #after that we want the non pt bss if is_non_pt_bss(j1) and is_non_pt_bss(j2): return self.sort_by_time(j1, j2) elif is_non_pt_bss(j1): return -1 elif is_non_pt_bss(j2): return 1 #then the TC with bss fallback if has_bss_and_tc(j1) and has_bss_and_tc(j2): return self.sort_by_time(j1, j2) elif has_bss_and_tc(j1): return -1 elif has_bss_and_tc(j2): return 1 #then the TC with bike fallback if has_bike_and_tc(j1) and has_bike_and_tc(j2): return self.sort_by_time(j1, j2) elif has_bike_and_tc(j1): return -1 elif has_bike_and_tc(j2): return 1 #if there is any, the car fallback with TC if has_car_and_tc(j1) and has_car_and_tc(j2): return self.sort_by_time(j1, j2) elif has_car_and_tc(j1): return -1 elif has_car_and_tc(j2): return 1 #the walking only trip if is_non_pt_walk(j1) and is_non_pt_walk(j2): return self.sort_by_time(j1, j2) elif is_non_pt_walk(j1): return -1 elif is_non_pt_walk(j2): return 1 #the bike only trip if is_non_pt_bike(j1) and is_non_pt_bike(j2): return self.sort_by_time(j1, j2) elif is_non_pt_bike(j1): return -1 elif is_non_pt_bike(j2): return 1 return 0 class Scenario(default.Scenario): def journeys(self, request, instance): logger = logging.getLogger(__name__) request_tc = copy.deepcopy(request) request_tc['origin_mode'] = ['walking'] request_tc['destination_mode'] = ['walking'] max_nb_journeys = request_tc['max_nb_journeys'] request_tc['max_nb_journeys'] = None request_alternative = copy.deepcopy(request) request_alternative['min_nb_journeys'] = None request_alternative['max_nb_journeys'] = None if 'walking' in request_alternative['origin_mode'] \ and len(set(request_alternative['origin_mode'])) > 1: request_alternative['origin_mode'].remove('walking') if 'walking' in request_alternative['destination_mode'] \ and len(set(request_alternative['destination_mode'])) > 1: request_alternative['destination_mode'].remove('walking') logger.debug('journeys only on TC') response_tc = super(Scenario, self).journeys(request_tc, instance) if not request['debug']: self._remove_extra_journeys(response_tc.journeys, max_nb_journeys, request['clockwise'], timezone=instance.timezone) max_duration = self._find_max_duration(response_tc.journeys, instance, request['clockwise']) if max_duration: #we find the max_duration with the pure tc call, so we use it for the alternatives request_alternative['max_duration'] = int(max_duration) if not all([is_admin(request['origin']), is_admin(request['destination'])]): logger.debug('journeys with alternative mode') response_alternative = self._get_alternatives(request_alternative, instance, response_tc.journeys) logger.debug('merge and sort responses') self.merge_response(response_tc, response_alternative) else: logger.debug('don\'t search alternative for admin to admin journeys') self._remove_non_pt_walk(response_tc.journeys) for journey in response_tc.journeys: if journey.type == 'best': journey.type = 'rapid' self._custom_sort_journeys(response_tc, clockwise=request['clockwise'], timezone=instance.timezone) self.choose_best(response_tc) for journey in response_tc.journeys: if is_alternative(journey): journey.tags.append('alternative') if is_pure_tc(journey): #we need this for the pagination journey.tags.append('is_pure_tc') # for destineo, we use a custom pagination response_tc.ClearField(str('links')) self._compute_pagination_links(response_tc, instance, request['clockwise']) return response_tc def _get_alternatives(self, args, instance, tc_journeys): logger = logging.getLogger(__name__) response_alternative = super(Scenario, self).journeys(args, instance) #we don't want to choose an alternative already in the pure_pt solutions, it can happens since bss allow walking solutions self._remove_already_present_journey(response_alternative.journeys, tc_journeys) if not args['debug']: # in debug we don't filter self._choose_best_alternatives(response_alternative.journeys) return response_alternative def _remove_already_present_journey(self, alternative_journeys, tc_journeys): logger = logging.getLogger(__name__) to_delete = [] for idx, journey in enumerate(alternative_journeys): for journey_tc in tc_journeys: if are_equals(journey, journey_tc): to_delete.append(idx) logger.debug('remove %s alternative journey already present in TC response: %s', len(to_delete), [alternative_journeys[i].type for i in to_delete]) to_delete.sort(reverse=True) for idx in to_delete: del alternative_journeys[idx] def _remove_extra_journeys(self, journeys, max_nb_journeys, clockwise, timezone): """ for destineo we want to filter certain journeys - we want at most 'max_nb_journeys', but we always want to keep the non_pt_walk - we don't want 2 alternatives using the same buses but with different boarding stations for similar journeys, we want to pick up: - the earliest one (for clockwise, else tardiest) - the one that leave the tardiest (for clockwise, else earliest) - the one with the less fallback (we know it's walking) """ to_delete = [] def same_vjs(j): #same departure date and vjs journey_dt = datetime.utcfromtimestamp(j.departure_date_time) journey_date = pytz.utc.localize(journey_dt).astimezone(pytz.timezone(timezone)).date() yield journey_date for s in j.sections: yield s.uris.vehicle_journey def get_journey_to_remove(idx_j1, j1, idx_j2, j2): if clockwise: if j1.arrival_date_time != j2.arrival_date_time: return idx_j1 if j1.arrival_date_time > j2.arrival_date_time else idx_j2 if j1.departure_date_time != j2.departure_date_time: return idx_j1 if j1.departure_date_time < j2.departure_date_time else idx_j2 else: if j1.departure_date_time != j2.departure_date_time: return idx_j1 if j1.departure_date_time < j2.departure_date_time else idx_j2 if j1.arrival_date_time != j2.arrival_date_time: return idx_j1 if j1.arrival_date_time > j2.arrival_date_time else idx_j2 return idx_j1 if helpers.walking_duration(j1) > helpers.walking_duration(j2) else idx_j2 for (idx1, j1), (idx2, j2) in itertools.combinations(enumerate(journeys), 2): if idx1 in to_delete or idx2 in to_delete: continue if not compare(j1, j2, same_vjs): continue to_delete.append(get_journey_to_remove(idx1, j1, idx2, j2)) if max_nb_journeys: count = 0 for idx, journey in enumerate(journeys): if idx in to_delete: continue if journey.type == 'non_pt_walk': continue if count >= max_nb_journeys: to_delete.append(idx) count += 1 to_delete.sort(reverse=True) logger = logging.getLogger(__name__) logger.debug('remove %s extra journeys: %s', len(to_delete), [journeys[i].type for i in to_delete]) for idx in to_delete: del journeys[idx] def _remove_non_pt_walk(self, journeys): nb_deleted = pb_del_if(journeys, lambda j: j.type == 'non_pt_walk') logger = logging.getLogger(__name__) logger.debug('remove %s non_pt_walk journey', nb_deleted) def _choose_best_alternatives(self, journeys): to_keep = [] mapping = defaultdict(list) best = None functors = OrderedDict([ ('bss_walking', has_bss_first_and_walking_last), ('walking_bss', has_walking_first_and_bss_last), ('bss_bss', has_bss_first_and_bss_last), ('bike_walking', has_bike_first_and_walking_last), ('bike_bss', has_bike_first_and_bss_last), ('car', has_car_and_tc) ]) for idx, journey in enumerate(journeys): if journey.type in non_pt_types: to_keep.append(idx) for key, func in functors.items(): if func(journey): mapping[key].append(journey) for key, _ in functors.items(): if not best and mapping[key]: best = min(mapping[key], key=attrgetter('duration')) to_keep.append(indexOf(journeys, best)) logger = logging.getLogger(__name__) logger.debug('from alternatives we keep: %s', [journeys[i].type for i in to_keep]) to_delete = list(set(range(len(journeys))) - set(to_keep)) to_delete.sort(reverse=True) for idx in to_delete: del journeys[idx] def _custom_sort_journeys(self, response, timezone, clockwise=True): if len(response.journeys) > 1: response.journeys.sort(DestineoJourneySorter(clockwise, timezone)) @staticmethod def filter_journeys(journeys): section_is_pt = lambda section: section.stop_date_times filter_journey = lambda journey: any(section_is_pt(section) for section in journey.sections) filter_journey_pure_tc = lambda journey: 'is_pure_tc' in journey.tags list_journeys = list(filter(filter_journey_pure_tc, journeys)) if not list_journeys: #if there is no pure tc journeys, we consider all journeys with TC list_journeys = list(filter(filter_journey, journeys)) return list_journeys def _add_next_link(self, resp, params, clockwise): journeys = self.filter_journeys(resp.journeys) if not journeys: return None next_journey = max(journeys, key=lambda j: j.departure_date_time) params['datetime'] = timestamp_to_str(next_journey.departure_date_time + 60) params['datetime_represents'] = 'departure' add_link(resp, rel='next', **params) def _add_prev_link(self, resp, params, clockwise): journeys = self.filter_journeys(resp.journeys) if not journeys: return None next_journey = max(journeys, key=lambda j: j.arrival_date_time) params['datetime'] = timestamp_to_str(next_journey.arrival_date_time - 60) params['datetime_represents'] = 'arrival' add_link(resp, rel='prev', **params)
antoine-de/navitia
source/jormungandr/jormungandr/scenarios/destineo.py
Python
agpl-3.0
17,517
// Copyright 2015 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. package charmrevision_test import ( "time" "github.com/juju/clock" "github.com/juju/errors" "github.com/juju/testing" jc "github.com/juju/testing/checkers" "github.com/juju/worker/v2" "github.com/juju/worker/v2/dependency" dt "github.com/juju/worker/v2/dependency/testing" gc "gopkg.in/check.v1" "github.com/juju/juju/api/base" "github.com/juju/juju/worker/charmrevision" ) type ManifoldSuite struct { testing.IsolationSuite } var _ = gc.Suite(&ManifoldSuite{}) func (s *ManifoldSuite) TestManifold(c *gc.C) { manifold := charmrevision.Manifold(charmrevision.ManifoldConfig{ APICallerName: "billy", }) c.Check(manifold.Inputs, jc.DeepEquals, []string{"billy"}) c.Check(manifold.Start, gc.NotNil) c.Check(manifold.Output, gc.IsNil) } func (s *ManifoldSuite) TestMissingAPICaller(c *gc.C) { manifold := charmrevision.Manifold(charmrevision.ManifoldConfig{ APICallerName: "api-caller", Clock: fakeClock{}, }) _, err := manifold.Start(dt.StubContext(nil, map[string]interface{}{ "api-caller": dependency.ErrMissing, })) c.Check(errors.Cause(err), gc.Equals, dependency.ErrMissing) } func (s *ManifoldSuite) TestMissingClock(c *gc.C) { manifold := charmrevision.Manifold(charmrevision.ManifoldConfig{ APICallerName: "api-caller", }) _, err := manifold.Start(dt.StubContext(nil, map[string]interface{}{ "api-caller": fakeAPICaller{}, })) c.Check(err, jc.Satisfies, errors.IsNotValid) c.Check(err.Error(), gc.Equals, "nil Clock not valid") } func (s *ManifoldSuite) TestNewFacadeError(c *gc.C) { fakeAPICaller := &fakeAPICaller{} stub := testing.Stub{} manifold := charmrevision.Manifold(charmrevision.ManifoldConfig{ APICallerName: "api-caller", Clock: fakeClock{}, NewFacade: func(apiCaller base.APICaller) (charmrevision.Facade, error) { stub.AddCall("NewFacade", apiCaller) return nil, errors.New("blefgh") }, }) _, err := manifold.Start(dt.StubContext(nil, map[string]interface{}{ "api-caller": fakeAPICaller, })) c.Check(err, gc.ErrorMatches, "cannot create facade: blefgh") stub.CheckCalls(c, []testing.StubCall{{ "NewFacade", []interface{}{fakeAPICaller}, }}) } func (s *ManifoldSuite) TestNewWorkerError(c *gc.C) { fakeClock := &fakeClock{} fakeFacade := &fakeFacade{} fakeAPICaller := &fakeAPICaller{} stub := testing.Stub{} manifold := charmrevision.Manifold(charmrevision.ManifoldConfig{ APICallerName: "api-caller", Clock: fakeClock, NewFacade: func(apiCaller base.APICaller) (charmrevision.Facade, error) { stub.AddCall("NewFacade", apiCaller) return fakeFacade, nil }, NewWorker: func(config charmrevision.Config) (worker.Worker, error) { stub.AddCall("NewWorker", config) return nil, errors.New("snrght") }, }) _, err := manifold.Start(dt.StubContext(nil, map[string]interface{}{ "api-caller": fakeAPICaller, })) c.Check(err, gc.ErrorMatches, "cannot create worker: snrght") stub.CheckCalls(c, []testing.StubCall{{ "NewFacade", []interface{}{fakeAPICaller}, }, { "NewWorker", []interface{}{charmrevision.Config{ RevisionUpdater: fakeFacade, Clock: fakeClock, }}, }}) } func (s *ManifoldSuite) TestSuccess(c *gc.C) { fakeClock := &fakeClock{} fakeFacade := &fakeFacade{} fakeWorker := &fakeWorker{} fakeAPICaller := &fakeAPICaller{} stub := testing.Stub{} manifold := charmrevision.Manifold(charmrevision.ManifoldConfig{ APICallerName: "api-caller", Clock: fakeClock, Period: 10 * time.Minute, NewFacade: func(apiCaller base.APICaller) (charmrevision.Facade, error) { stub.AddCall("NewFacade", apiCaller) return fakeFacade, nil }, NewWorker: func(config charmrevision.Config) (worker.Worker, error) { stub.AddCall("NewWorker", config) return fakeWorker, nil }, }) w, err := manifold.Start(dt.StubContext(nil, map[string]interface{}{ "api-caller": fakeAPICaller, })) c.Check(w, gc.Equals, fakeWorker) c.Check(err, jc.ErrorIsNil) stub.CheckCalls(c, []testing.StubCall{{ "NewFacade", []interface{}{fakeAPICaller}, }, { "NewWorker", []interface{}{charmrevision.Config{ Period: 10 * time.Minute, RevisionUpdater: fakeFacade, Clock: fakeClock, }}, }}) } type fakeAPICaller struct { base.APICaller } type fakeClock struct { clock.Clock } type fakeWorker struct { worker.Worker } type fakeFacade struct { charmrevision.Facade }
freyes/juju
worker/charmrevision/manifold_test.go
GO
agpl-3.0
4,492
// IMPORTANT NOTE: this component is agnostic about how highlights are persisted. // Do not add persistence related code in this file. import React from 'react'; import PropTypes from 'prop-types'; import * as Highlights from '../helpers/highlights'; export class MultipleHighlights extends React.Component<any, any> { static propTypes: any; static defaultProps: any; addHighlight(highlightType, highlightData) { const editorState = Highlights.addHighlight(this.props.editorState, highlightType, highlightData); this.props.onChange(editorState); } removeHighlight(styleName) { const editorState = Highlights.removeHighlight(this.props.editorState, styleName); this.props.onChange(editorState); } updateHighlightData(styleName, nextData) { const editorState = Highlights.updateHighlightData(this.props.editorState, styleName, nextData); this.props.onChange(editorState); } canAddHighlight(highlightType) { return Highlights.canAddHighlight(this.props.editorState, highlightType); } getHighlightData(styleName) { return Highlights.getHighlightData(this.props.editorState, styleName); } getHighlightsCount(highlightType) { return Highlights.getHighlightsCount(this.props.editorState, highlightType); } render() { const {children, editorState} = this.props; const propsExcludingOwn = Object.keys(this.props) .filter((key) => (key !== 'children')) .reduce((obj, key) => { obj[key] = this.props[key]; return obj; }, {}); const childrenWithProps = React.Children.map( children, (child: any) => React.cloneElement(child, { ...propsExcludingOwn, highlightsManager: { styleMap: Highlights.getHighlightsStyleMap(editorState), addHighlight: this.addHighlight.bind(this), removeHighlight: this.removeHighlight.bind(this), getHighlightData: this.getHighlightData.bind(this), updateHighlightData: this.updateHighlightData.bind(this), canAddHighlight: this.canAddHighlight.bind(this), styleNameBelongsToHighlight: Highlights.styleNameBelongsToHighlight, getHighlightTypeFromStyleName: Highlights.getHighlightTypeFromStyleName, getHighlightsCount: this.getHighlightsCount.bind(this), hadHighlightsChanged: Highlights.hadHighlightsChanged, availableHighlights: Highlights.availableHighlights, }, }), ); return <div>{childrenWithProps}</div>; } } MultipleHighlights.propTypes = { editorState: PropTypes.object.isRequired, onChange: PropTypes.func.isRequired, children: PropTypes.node.isRequired, };
ioanpocol/superdesk-client-core
scripts/core/editor3/components/MultipleHighlights.tsx
TypeScript
agpl-3.0
3,019
<?php /** * Unit test class for the AssignThis sniff. * * PHP version 5 * * @category PHP * @package PHP_CodeSniffer_MySource * @author Greg Sherwood <[email protected]> * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600) * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence * @version CVS: $Id: AssignThisUnitTest.php,v 1.2 2008/02/25 03:25:05 squiz Exp $ * @link http://pear.php.net/package/PHP_CodeSniffer */ /** * Unit test class for the AssignThis sniff. * * A sniff unit test checks a .inc file for expected violations of a single * coding standard. Expected errors and warnings are stored in this class. * * @category PHP * @package PHP_CodeSniffer_MySource * @author Greg Sherwood <[email protected]> * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600) * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence * @version Release: @package_version@ * @link http://pear.php.net/package/PHP_CodeSniffer */ class MySource_Tests_Objects_AssignThisUnitTest extends AbstractSniffUnitTest { /** * Returns the lines where errors should occur. * * The key of the array should represent the line number and the value * should represent the number of errors that should occur on that line. * * @param string $testFile The name of the file being tested. * * @return array(int => int) */ public function getErrorList($testFile='AssignThisUnitTest.js') { if ($testFile !== 'AssignThisUnitTest.js') { return array(); } return array( 7 => 1, 11 => 1, 16 => 1, ); }//end getErrorList() /** * Returns the lines where warnings should occur. * * The key of the array should represent the line number and the value * should represent the number of warnings that should occur on that line. * * @return array(int => int) */ public function getWarningList() { return array(); }//end getWarningList() }//end class ?>
mikesname/ehri-ica-atom
plugins/sfAuditPlugin/lib/vendor/PHP/CodeSniffer/Standards/MySource/Tests/Objects/AssignThisUnitTest.php
PHP
agpl-3.0
2,137
<?php /** * * This file is part of the phpBB Forum Software package. * * @copyright (c) phpBB Limited <https://www.phpbb.com> * @license GNU General Public License, version 2 (GPL-2.0) * * For full copyright and license information, please see * the docs/CREDITS.txt file. * */ /** */ /** * @ignore */ define('IN_PHPBB', true); $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.' . $phpEx); include($phpbb_root_path . 'includes/functions_display.' . $phpEx); // Start session management $user->session_begin(); $auth->acl($user->data); $user->setup('viewforum'); // Mark notifications read if (($mark_notification = $request->variable('mark_notification', 0))) { if ($user->data['user_id'] == ANONYMOUS) { if ($request->is_ajax()) { trigger_error('LOGIN_REQUIRED'); } login_box('', $user->lang['LOGIN_REQUIRED']); } if (check_link_hash($request->variable('hash', ''), 'mark_notification_read')) { /* @var $phpbb_notifications \phpbb\notification\manager */ $phpbb_notifications = $phpbb_container->get('notification_manager'); $notification = $phpbb_notifications->load_notifications('notification.method.board', array( 'notification_id' => $mark_notification, )); if (isset($notification['notifications'][$mark_notification])) { $notification = $notification['notifications'][$mark_notification]; $notification->mark_read(); if ($request->is_ajax()) { $json_response = new \phpbb\json_response(); $json_response->send(array( 'success' => true, )); } if (($redirect = $request->variable('redirect', ''))) { redirect(append_sid($phpbb_root_path . $redirect)); } redirect($notification->get_redirect_url()); } } } display_forums('', $config['load_moderators']); $order_legend = ($config['legend_sort_groupname']) ? 'group_name' : 'group_legend'; // Grab group details for legend display if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) { $sql = 'SELECT group_id, group_name, group_colour, group_type, group_legend FROM ' . GROUPS_TABLE . ' WHERE group_legend > 0 ORDER BY ' . $order_legend . ' ASC'; } else { $sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type, g.group_legend FROM ' . GROUPS_TABLE . ' g LEFT JOIN ' . USER_GROUP_TABLE . ' ug ON ( g.group_id = ug.group_id AND ug.user_id = ' . $user->data['user_id'] . ' AND ug.user_pending = 0 ) WHERE g.group_legend > 0 AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ') ORDER BY g.' . $order_legend . ' ASC'; } $result = $db->sql_query($sql); /** @var \phpbb\group\helper $group_helper */ $group_helper = $phpbb_container->get('group_helper'); $legend = array(); while ($row = $db->sql_fetchrow($result)) { $colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : ''; $group_name = $group_helper->get_name($row['group_name']); if ($row['group_name'] == 'BOTS' || ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile'))) { $legend[] = '<span' . $colour_text . '>' . $group_name . '</span>'; } else { $legend[] = '<a' . $colour_text . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;g=' . $row['group_id']) . '">' . $group_name . '</a>'; } } $db->sql_freeresult($result); $legend = implode($user->lang['COMMA_SEPARATOR'], $legend); // Generate birthday list if required ... $birthdays = $birthday_list = array(); if ($config['load_birthdays'] && $config['allow_birthdays'] && $auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel')) { $time = $user->create_datetime(); $now = phpbb_gmgetdate($time->getTimestamp() + $time->getOffset()); // Display birthdays of 29th february on 28th february in non-leap-years $leap_year_birthdays = ''; if ($now['mday'] == 28 && $now['mon'] == 2 && !$time->format('L')) { $leap_year_birthdays = " OR u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', 29, 2)) . "%'"; } $sql_ary = array( 'SELECT' => 'u.user_id, u.username, u.user_colour, u.user_birthday', 'FROM' => array( USERS_TABLE => 'u', ), 'LEFT_JOIN' => array( array( 'FROM' => array(BANLIST_TABLE => 'b'), 'ON' => 'u.user_id = b.ban_userid', ), ), 'WHERE' => "(b.ban_id IS NULL OR b.ban_exclude = 1) AND (u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%' $leap_year_birthdays) AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')', ); /** * Event to modify the SQL query to get birthdays data * * @event core.index_modify_birthdays_sql * @var array now The assoc array with the 'now' local timestamp data * @var array sql_ary The SQL array to get the birthdays data * @var object time The user related Datetime object * @since 3.1.7-RC1 */ $vars = array('now', 'sql_ary', 'time'); extract($phpbb_dispatcher->trigger_event('core.index_modify_birthdays_sql', compact($vars))); $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); $rows = $db->sql_fetchrowset($result); $db->sql_freeresult($result); foreach ($rows as $row) { $birthday_username = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']); $birthday_year = (int) substr($row['user_birthday'], -4); $birthday_age = ($birthday_year) ? max(0, $now['year'] - $birthday_year) : ''; $birthdays[] = array( 'USERNAME' => $birthday_username, 'AGE' => $birthday_age, ); // For 3.0 compatibility $birthday_list[] = $birthday_username . (($birthday_age) ? " ({$birthday_age})" : ''); } /** * Event to modify the birthdays list * * @event core.index_modify_birthdays_list * @var array birthdays Array with the users birthdays data * @var array rows Array with the birthdays SQL query result * @since 3.1.7-RC1 */ $vars = array('birthdays', 'rows'); extract($phpbb_dispatcher->trigger_event('core.index_modify_birthdays_list', compact($vars))); $template->assign_block_vars_array('birthdays', $birthdays); } // Assign index specific vars $template->assign_vars(array( 'TOTAL_POSTS' => $user->lang('TOTAL_POSTS_COUNT', (int) $config['num_posts']), 'TOTAL_TOPICS' => $user->lang('TOTAL_TOPICS', (int) $config['num_topics']), 'TOTAL_USERS' => $user->lang('TOTAL_USERS', (int) $config['num_users']), 'NEWEST_USER' => $user->lang('NEWEST_USER', get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])), 'LEGEND' => $legend, 'BIRTHDAY_LIST' => (empty($birthday_list)) ? '' : implode($user->lang['COMMA_SEPARATOR'], $birthday_list), 'FORUM_IMG' => $user->img('forum_read', 'NO_UNREAD_POSTS'), 'FORUM_UNREAD_IMG' => $user->img('forum_unread', 'UNREAD_POSTS'), 'FORUM_LOCKED_IMG' => $user->img('forum_read_locked', 'NO_UNREAD_POSTS_LOCKED'), 'FORUM_UNREAD_LOCKED_IMG' => $user->img('forum_unread_locked', 'UNREAD_POSTS_LOCKED'), 'S_LOGIN_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'), 'U_SEND_PASSWORD' => ($config['email_enable']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=sendpassword') : '', 'S_DISPLAY_BIRTHDAY_LIST' => ($config['load_birthdays']) ? true : false, 'S_INDEX' => true, 'U_MARK_FORUMS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}index.$phpEx", 'hash=' . generate_link_hash('global') . '&amp;mark=forums&amp;mark_time=' . time()) : '', 'U_MCP' => ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=front', true, $user->session_id) : '') ); $page_title = ($config['board_index_text'] !== '') ? $config['board_index_text'] : $user->lang['INDEX']; /** * You can use this event to modify the page title and load data for the index * * @event core.index_modify_page_title * @var string page_title Title of the index page * @since 3.1.0-a1 */ $vars = array('page_title'); extract($phpbb_dispatcher->trigger_event('core.index_modify_page_title', compact($vars))); // Output page page_header($page_title, true); $template->set_filenames(array( 'body' => 'index_body.html') ); page_footer();
armycreator/armycreator-website
web/forum/index.php
PHP
agpl-3.0
8,294
<?php /********************************************************************************* * Zurmo is a customer relationship management program developed by * Zurmo, Inc. Copyright (C) 2012 Zurmo Inc. * * Zurmo is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License version 3 as published by the * Free Software Foundation with the addition of the following permission added * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK * IN WHICH THE COPYRIGHT IS OWNED BY ZURMO, ZURMO DISCLAIMS THE WARRANTY * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. * * Zurmo 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 or write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301 USA. * * You can contact Zurmo, Inc. with a mailing address at 113 McHenry Road Suite 207, * Buffalo Grove, IL 60089, USA. or at email address [email protected]. ********************************************************************************/ class CCCModule extends Module { public function getDependencies() { return array( ); } public static function getDefaultMetadata() { $metadata = array(); $metadata['global'] = array( 'globalSearchAttributeNames' => array() ); return $metadata; } public static function getPrimaryModelName() { return 'CCC'; } public static function getGlobalSearchFormClassName() { return 'CCCSearchFormTestModel'; } } ?>
zurmo/Zurmo
app/protected/extensions/zurmoinc/framework/tests/unit/modules/CCCModule.php
PHP
agpl-3.0
2,100
{{-- Copyright 2015-2017 ppy Pty. Ltd. This file is part of osu!web. osu!web is distributed with the hope of attracting more community contributions to the core ecosystem of osu!. osu!web is free software: you can redistribute it and/or modify it under the terms of the Affero GNU General Public License version 3 as published by the Free Software Foundation. osu!web is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with osu!web. If not, see <http://www.gnu.org/licenses/>. --}} <div class="forum-topics"> <h2 class="forum-topics__title"> {{ $title }} </h2> <ul class="forum-topics__entries js-forum-topic-entries"> @if ($withNewTopicLink ?? false) @include('forum.forums._new_topic') @endif @if (count($topics) === 0) @include('forum.forums._topic_empty') @else @foreach($topics as $topic) @include($row ?? 'forum.forums._topic') @endforeach @endif </ul> </div>
Nekonyx/osu-web
resources/views/forum/forums/_topics.blade.php
PHP
agpl-3.0
1,260
<?php if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); class DHA_DocumentTemplatesNotesHook_class { function after_ui_frame_method($event, $arguments) { require_once('modules/DHA_PlantillasDocumentos/UI_Hooks.php'); MailMergeReports_after_ui_frame_hook ($event, $arguments); } } ?>
bmya/MySuiteCRMCL
custom/modules/Notes/DHA_DocumentTemplatesHooks.php
PHP
agpl-3.0
352
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2011-2013 Associazione OpenERP Italia # (<http://www.openerp-italia.org>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # 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 Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## { 'name': 'Italian Localisation - Prima Nota Cassa', 'version': '0.1', 'category': 'Localisation/Italy', 'description': """Accounting reports - Prima Nota Cassa - Webkit""", 'author': 'OpenERP Italian Community', 'website': 'http://www.openerp-italia.org', 'license': 'AGPL-3', "depends" : ['account', 'report_webkit'], "init_xml" : [ ], "update_xml" : [ 'reports.xml', 'wizard/wizard_print_prima_nota_cassa.xml', ], "demo_xml" : [], "active": False, 'installable': False }
andrea4ever/l10n-italy
__unported__/l10n_it_prima_nota_cassa/__openerp__.py
Python
agpl-3.0
1,526
/******** * This file is part of Ext.NET. * * Ext.NET is free software: you can redistribute it and/or modify * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * Ext.NET is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU AFFERO GENERAL PUBLIC LICENSE for more details. * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with Ext.NET. If not, see <http://www.gnu.org/licenses/>. * * * @version : 1.2.0 - Ext.NET Pro License * @author : Ext.NET, Inc. http://www.ext.net/ * @date : 2011-09-12 * @copyright : Copyright (c) 2006-2011, Ext.NET, Inc. (http://www.ext.net/). All rights reserved. * @license : GNU AFFERO GENERAL PUBLIC LICENSE (AGPL) 3.0. * See license.txt and http://www.ext.net/license/. * See AGPL License at http://www.gnu.org/licenses/agpl-3.0.txt ********/ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Web.UI; using System.Web.UI.WebControls; namespace Ext.Net { public partial class Cell { /* Ctor -----------------------------------------------------------------------------------------------*/ /// <summary> /// /// </summary> public Cell(Config config) { this.Apply(config); } /* Implicit Cell.Config Conversion to Cell -----------------------------------------------------------------------------------------------*/ /// <summary> /// /// </summary> public static implicit operator Cell(Cell.Config config) { return new Cell(config); } /// <summary> /// /// </summary> new public partial class Config : LayoutItem.Config { /* Implicit Cell.Config Conversion to Cell.Builder -----------------------------------------------------------------------------------------------*/ /// <summary> /// /// </summary> public static implicit operator Cell.Builder(Cell.Config config) { return new Cell.Builder(config); } /* ConfigOptions -----------------------------------------------------------------------------------------------*/ private int rowSpan = 0; /// <summary> /// /// </summary> [DefaultValue(0)] public virtual int RowSpan { get { return this.rowSpan; } set { this.rowSpan = value; } } private int colSpan = 0; /// <summary> /// /// </summary> [DefaultValue(0)] public virtual int ColSpan { get { return this.colSpan; } set { this.colSpan = value; } } private string cellCls = ""; /// <summary> /// /// </summary> [DefaultValue("")] public virtual string CellCls { get { return this.cellCls; } set { this.cellCls = value; } } private string cellId = ""; /// <summary> /// /// </summary> [DefaultValue("")] public virtual string CellId { get { return this.cellId; } set { this.cellId = value; } } } } }
daowzq/ExtNet
ext.net.community/Ext.Net/Factory/Config/CellConfig.cs
C#
agpl-3.0
3,500
"""Test for `maas.client.viscera.spaces`.""" import random from testtools.matchers import Equals from ..spaces import DeleteDefaultSpace, Space, Spaces from ..testing import bind from ...testing import make_string_without_spaces, TestCase def make_origin(): """ Create a new origin with Spaces and Space. The former refers to the latter via the origin, hence why it must be bound. """ return bind(Spaces, Space) class TestSpaces(TestCase): def test__spaces_create(self): Spaces = make_origin().Spaces name = make_string_without_spaces() description = make_string_without_spaces() Spaces._handler.create.return_value = { "id": 1, "name": name, "description": description, } Spaces.create(name=name, description=description) Spaces._handler.create.assert_called_once_with( name=name, description=description ) def test__spaces_read(self): """Spaces.read() returns a list of Spaces.""" Spaces = make_origin().Spaces spaces = [ {"id": random.randint(0, 100), "name": make_string_without_spaces()} for _ in range(3) ] Spaces._handler.read.return_value = spaces spaces = Spaces.read() self.assertThat(len(spaces), Equals(3)) class TestSpace(TestCase): def test__space_get_default(self): Space = make_origin().Space Space._handler.read.return_value = { "id": 0, "name": make_string_without_spaces(), } Space.get_default() Space._handler.read.assert_called_once_with(id=0) def test__space_read(self): Space = make_origin().Space space = {"id": random.randint(0, 100), "name": make_string_without_spaces()} Space._handler.read.return_value = space self.assertThat(Space.read(id=space["id"]), Equals(Space(space))) Space._handler.read.assert_called_once_with(id=space["id"]) def test__space_delete(self): Space = make_origin().Space space_id = random.randint(1, 100) space = Space({"id": space_id, "name": make_string_without_spaces()}) space.delete() Space._handler.delete.assert_called_once_with(id=space_id) def test__space_delete_default(self): Space = make_origin().Space space = Space({"id": 0, "name": make_string_without_spaces()}) self.assertRaises(DeleteDefaultSpace, space.delete)
blakerouse/python-libmaas
maas/client/viscera/tests/test_spaces.py
Python
agpl-3.0
2,500
/* ****************************************************************************** * Copyright (c) 2015 Particle Industries, Inc. All rights reserved. * * 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 3 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, see <http://www.gnu.org/licenses/>. ****************************************************************************** */ #pragma once //#include <stdio.h> #include <stdint.h> #include <stdarg.h> #include <string.h> #include "pipe_hal.h" #include "electronserialpipe_hal.h" #include "pinmap_hal.h" #include "system_tick_hal.h" /* Include for debug capabilty */ #define MDM_DEBUG #define USE_USART3_HARDWARE_FLOW_CONTROL_RTS_CTS 1 /** basic modem parser class */ class MDMParser { public: //! Constructor MDMParser(void); //! get static instance static MDMParser* getInstance() { return inst; }; // ---------------------------------------------------------------- // Types // ---------------------------------------------------------------- //! MT Device Types typedef enum { DEV_UNKNOWN, DEV_SARA_G350, DEV_LISA_U200, DEV_LISA_C200, DEV_SARA_U260, DEV_SARA_U270, DEV_LEON_G200 } Dev; //! SIM Status typedef enum { SIM_UNKNOWN, SIM_MISSING, SIM_PIN, SIM_READY } Sim; //! SIM Status typedef enum { LPM_DISABLED, LPM_ENABLED, LPM_ACTIVE } Lpm; //! Device status typedef struct { Dev dev; //!< Device Type Lpm lpm; //!< Power Saving Sim sim; //!< SIM Card Status char ccid[20+1]; //!< Integrated Circuit Card ID char imsi[15+1]; //!< International Mobile Station Identity char imei[15+1]; //!< International Mobile Equipment Identity char meid[18+1]; //!< Mobile Equipment IDentifier char manu[16]; //!< Manufacturer (u-blox) char model[16]; //!< Model Name (LISA-U200, LISA-C200 or SARA-G350) char ver[16]; //!< Software Version } DevStatus; //! Registration Status typedef enum { REG_UNKNOWN, REG_DENIED, REG_NONE, REG_HOME, REG_ROAMING } Reg; //! Access Technology typedef enum { ACT_UNKNOWN, ACT_GSM, ACT_EDGE, ACT_UTRAN, ACT_CDMA } AcT; //! Network Status typedef struct { Reg csd; //!< CSD Registration Status (Circuit Switched Data) Reg psd; //!< PSD Registration status (Packet Switched Data) AcT act; //!< Access Technology int rssi; //!< Received Signal Strength Indication (in dBm, range -113..-53) int ber; //!< Bit Error Rate (BER), see 3GPP TS 45.008 [20] subclause 8.2.4 char opr[16+1]; //!< Operator Name char num[32]; //!< Mobile Directory Number unsigned short lac; //!< location area code in hexadecimal format (2 bytes in hex) unsigned int ci; //!< Cell ID in hexadecimal format (2 to 4 bytes in hex) } NetStatus; //! An IP v4 address typedef uint32_t IP; #define NOIP ((MDMParser::IP)0) //!< No IP address // ip number formating and conversion #define IPSTR "%d.%d.%d.%d" #define IPNUM(ip) ((ip)>>24)&0xff, \ ((ip)>>16)&0xff, \ ((ip)>> 8)&0xff, \ ((ip)>> 0)&0xff #define IPADR(a,b,c,d) ((((MDMParser::IP)(a))<<24) | \ (((MDMParser::IP)(b))<<16) | \ (((MDMParser::IP)(c))<< 8) | \ (((MDMParser::IP)(d))<< 0)) // ---------------------------------------------------------------- // Device // ---------------------------------------------------------------- typedef enum { AUTH_NONE, AUTH_PAP, AUTH_CHAP, AUTH_DETECT } Auth; /** Combined Init, checkNetStatus, join suitable for simple applications \param simpin a optional pin of the SIM card \param apn the of the network provider e.g. "internet" or "apn.provider.com" \param username is the user name text string for the authentication phase \param password is the password text string for the authentication phase \param auth is the authentication mode (CHAP,PAP,NONE or DETECT) \return true if successful, false otherwise */ bool connect(const char* simpin = NULL, const char* apn = "spark.telefonica.com", const char* username = NULL, const char* password = NULL, Auth auth = AUTH_DETECT); /** * powerOn Initialize the modem and SIM card * \param simpin a optional pin of the SIM card * \return true if successful, false otherwise */ bool powerOn(const char* simpin = NULL); /** init (Attach) the MT to the GPRS service. \param status an optional struture to with device information \return true if successful, false otherwise */ bool init(DevStatus* status = NULL); /** get the current device status \param strocture holding the device information. */ void getDevStatus(MDMParser::DevStatus* dev) { memcpy(dev, &_dev, sizeof(DevStatus)); } const MDMParser::DevStatus* getDevStatus() { return &_dev; } /** register to the network \param status an optional structure to with network information \param timeout_ms -1 blocking, else non blocking timeout in ms \return true if successful and connected to network, false otherwise */ bool registerNet(NetStatus* status = NULL, system_tick_t timeout_ms = 300000); /** check if the network is available \param status an optional structure to with network information \return true if successful and connected to network, false otherwise */ bool checkNetStatus(NetStatus* status = NULL); /** Power off the MT, This function has to be called prior to switching off the supply. \return true if successfully, false otherwise */ bool powerOff(void); /** Setup the PDP context */ bool pdp(const char* apn = "spark.telefonica.com"); // ---------------------------------------------------------------- // Data Connection (GPRS) // ---------------------------------------------------------------- /** register (Attach) the MT to the GPRS service. \param apn the of the network provider e.g. "internet" or "apn.provider.com" \param username is the user name text string for the authentication phase \param password is the password text string for the authentication phase \param auth is the authentication mode (CHAP,PAP,NONE or DETECT) \return the ip that is assigned */ MDMParser::IP join(const char* apn = "spark.telefonica.com", const char* username = NULL, const char* password = NULL, Auth auth = AUTH_DETECT); /** deregister (detach) the MT from the GPRS service. \return true if successful, false otherwise */ bool disconnect(void); bool reconnect(void); /** Detach the MT from the GPRS service. \return true if successful, false otherwise */ bool detach(void); /** Translates a domain name to an IP address \param host the domain name to translate e.g. "u-blox.com" \return the IP if successful, 0 otherwise */ MDMParser::IP gethostbyname(const char* host); /** get the current assigned IP address \return the ip that is assigned */ MDMParser::IP getIpAddress(void) { return _ip; } // ---------------------------------------------------------------- // Sockets // ---------------------------------------------------------------- //! Type of IP protocol typedef enum { MDM_IPPROTO_TCP = 0, MDM_IPPROTO_UDP = 1 } IpProtocol; //! Socket error return codes #define MDM_SOCKET_ERROR (-1) /** Create a socket for a ip protocol (and optionaly bind) \param ipproto the protocol (UDP or TCP) \param port in case of UDP, this optional port where it is bind \return the socket handle if successful or SOCKET_ERROR on failure */ int socketSocket(IpProtocol ipproto, int port = -1); /** make a socket connection \param socket the socket handle \param host the domain name to connect e.g. "u-blox.com" \param port the port to connect \return true if successfully, false otherwise */ bool socketConnect(int socket, const char* host, int port); bool socketConnect(int socket, const IP& ip, int port); /** make a socket connection \param socket the socket handle \return true if connected, false otherwise */ bool socketIsConnected(int socket); /** Get the number of bytes pending for reading for this socket \param socket the socket handle \param timeout_ms -1 blocking, else non blocking timeout in ms \return 0 if successful or SOCKET_ERROR on failure */ bool socketSetBlocking(int socket, system_tick_t timeout_ms); /** Write socket data \param socket the socket handle \param buf the buffer to write \param len the size of the buffer to write \return the size written or SOCKET_ERROR on failure */ int socketSend(int socket, const char * buf, int len); /** Write socket data to a IP \param socket the socket handle \param ip the ip to send to \param port the port to send to \param buf the buffer to write \param len the size of the buffer to write \return the size written or SOCKET_ERROR on failure */ int socketSendTo(int socket, IP ip, int port, const char * buf, int len); /** Get the number of bytes pending for reading for this socket \param socket the socket handle \return the number of bytes pending or SOCKET_ERROR on failure */ int socketReadable(int socket); /** Read this socket \param socket the socket handle \param buf the buffer to read into \param len the size of the buffer to read into \return the number of bytes read or SOCKET_ERROR on failure */ int socketRecv(int socket, char* buf, int len); /** Read from this socket \param socket the socket handle \param ip the ip of host where the data originates from \param port the port where the data originates from \param buf the buffer to read into \param len the size of the buffer to read into \return the number of bytes read or SOCKET_ERROR on failure */ int socketRecvFrom(int socket, IP* ip, int* port, char* buf, int len); /** Close a connectied socket (that was connected with #socketConnect) \param socket the socket handle \return true if successfully, false otherwise */ bool socketClose(int socket); /** Free the socket (that was allocated before by #socketSocket) \param socket the socket handle \return true if successfully, false otherwise */ bool socketFree(int socket); // ---------------------------------------------------------------- // SMS Short Message Service // ---------------------------------------------------------------- /** count the number of sms in the device and optionally return a list with indexes from the storage locations in the device. \param stat what type of messages you can use use "REC UNREAD", "REC READ", "STO UNSENT", "STO SENT", "ALL" \param ix list where to save the storage positions \param num number of elements in the list \return the number of messages, this can be bigger than num, -1 on failure */ int smsList(const char* stat = "ALL", int* ix = NULL, int num = 0); /** Read a Message from a storage position \param ix the storage position to read \param num the originator address (~16 chars) \param buf a buffer where to save the sm \param len the length of the sm \return true if successful, false otherwise */ bool smsRead(int ix, char* num, char* buf, int len); /** Send a message to a recipient \param ix the storage position to delete \return true if successful, false otherwise */ bool smsDelete(int ix); /** Send a message to a recipient \param num the phone number of the recipient \param buf the content of the message to sent \return true if successful, false otherwise */ bool smsSend(const char* num, const char* buf); // ---------------------------------------------------------------- // USSD Unstructured Supplementary Service Data // ---------------------------------------------------------------- /** Read a Message from a storage position \param cmd the ussd command to send e.g "*#06#" \param buf a buffer where to save the reply \return true if successful, false otherwise */ bool ussdCommand(const char* cmd, char* buf); // ---------------------------------------------------------------- // FILE // ---------------------------------------------------------------- /** Delete a file in the local file system \param filename the name of the file \return true if successful, false otherwise */ bool delFile(const char* filename); /** Write some data to a file in the local file system \param filename the name of the file \param buf the data to write \param len the size of the data to write \return the number of bytes written */ int writeFile(const char* filename, const char* buf, int len); /** REad a file from the local file system \param filename the name of the file \param buf a buffer to hold the data \param len the size to read \return the number of bytes read */ int readFile(const char* filename, char* buf, int len); // ---------------------------------------------------------------- // DEBUG/DUMP status to DEBUG output // ---------------------------------------------------------------- /*! Set the debug level \param level -1 = OFF, 0 = ERROR, 1 = INFO(default), 2 = TRACE, 3 = ATCMD,TEST \return true if successful, false not possible */ bool setDebug(int level); /** dump the device status to DEBUG output */ void dumpDevStatus(MDMParser::DevStatus *status); /** dump the network status to DEBUG output */ void dumpNetStatus(MDMParser::NetStatus *status); /** dump the ip address to DEBUG output */ void dumpIp(MDMParser::IP ip); // ---------------------------------------------------------------- // Parsing // ---------------------------------------------------------------- enum { // waitFinalResp Responses NOT_FOUND = 0, WAIT = -1, // TIMEOUT RESP_OK = -2, RESP_ERROR = -3, RESP_PROMPT = -4, // getLine Responses #define LENGTH(x) (x & 0x00FFFF) //!< extract/mask the length #define TYPE(x) (x & 0xFF0000) //!< extract/mask the type TYPE_UNKNOWN = 0x000000, TYPE_OK = 0x110000, TYPE_ERROR = 0x120000, TYPE_RING = 0x210000, TYPE_CONNECT = 0x220000, TYPE_NOCARRIER = 0x230000, TYPE_NODIALTONE = 0x240000, TYPE_BUSY = 0x250000, TYPE_NOANSWER = 0x260000, TYPE_PROMPT = 0x300000, TYPE_PLUS = 0x400000, TYPE_TEXT = 0x500000, // special timout constant TIMEOUT_BLOCKING = 0xffffffff }; /** Get a line from the physical interface. This function need to be implemented in a inherited class. Usually just calls #_getLine on the rx buffer pipe. \param buf the buffer to store it \param buf size of the buffer \return type and length if something was found, WAIT if not enough data is available NOT_FOUND if nothing was found */ virtual int getLine(char* buf, int len) = 0; /* clear the pending input data */ virtual void purge(void) = 0; /** Write data to the device \param buf the buffer to write \param buf size of the buffer to write \return bytes written */ virtual int send(const char* buf, int len); /** Write formated date to the physical interface (printf style) \param fmt the format string \param .. variable arguments to be formated \return bytes written */ int sendFormated(const char* format, ...); /** callback function for #waitFinalResp with void* as argument \param type the #getLine response \param buf the parsed line \param len the size of the parsed line \param param the optional argument passed to #waitFinalResp \return WAIT if processing should continue, any other value aborts #waitFinalResp and this retunr value retuned */ typedef int (*_CALLBACKPTR)(int type, const char* buf, int len, void* param); /** Wait for a final respons \param cb the optional callback function \param param the optional callback function parameter \param timeout_ms the timeout to wait (See Estimated command response time of AT manual) */ int waitFinalResp(_CALLBACKPTR cb = NULL, void* param = NULL, system_tick_t timeout_ms = 10000); /** template version of #waitFinalResp when using callbacks, This template will allow the compiler to do type cheking but internally symply casts the arguments and call the (void*) version of #waitFinalResp. \sa waitFinalResp */ template<class T> inline int waitFinalResp(int (*cb)(int type, const char* buf, int len, T* param), T* param, system_tick_t timeout_ms = 10000) { return waitFinalResp((_CALLBACKPTR)cb, (void*)param, timeout_ms); } protected: /** Write bytes to the physical interface. This function should be implemented in a inherited class. \param buf the buffer to write \param buf size of the buffer to write \return bytes written */ virtual int _send(const void* buf, int len) = 0; /** Helper: Parse a line from the receiving buffered pipe \param pipe the receiving buffer pipe \param buf the parsed line \param len the size of the parsed line \return type and length if something was found, WAIT if not enough data is available NOT_FOUND if nothing was found */ static int _getLine(Pipe<char>* pipe, char* buffer, int length); /** Helper: Parse a match from the pipe \param pipe the buffered pipe \param number of bytes to parse at maximum, \param sta the starting string, NULL if none \param end the terminating string, NULL if none \return size of parsed match */ static int _parseMatch(Pipe<char>* pipe, int len, const char* sta, const char* end); /** Helper: Parse a match from the pipe \param pipe the buffered pipe \param number of bytes to parse at maximum, \param fmt the formating string (%d any number, %c any char of last %d len) \return size of parsed match */ static int _parseFormated(Pipe<char>* pipe, int len, const char* fmt); protected: // for rtos over riding by useing Rtos<MDMxx> //! override the lock in a rtos system virtual void lock(void) { } //! override the unlock in a rtos system virtual void unlock(void) { } protected: // parsing callbacks for different AT commands and their parameter arguments static int _cbString(int type, const char* buf, int len, char* str); static int _cbInt(int type, const char* buf, int len, int* val); // device static int _cbATI(int type, const char* buf, int len, Dev* dev); static int _cbCPIN(int type, const char* buf, int len, Sim* sim); static int _cbCCID(int type, const char* buf, int len, char* ccid); // network static int _cbCSQ(int type, const char* buf, int len, NetStatus* status); static int _cbCOPS(int type, const char* buf, int len, NetStatus* status); static int _cbCNUM(int type, const char* buf, int len, char* num); static int _cbUACTIND(int type, const char* buf, int len, int* i); static int _cbUDOPN(int type, const char* buf, int len, char* mccmnc); // sockets static int _cbCMIP(int type, const char* buf, int len, IP* ip); static int _cbUPSND(int type, const char* buf, int len, int* act); static int _cbUPSND(int type, const char* buf, int len, IP* ip); static int _cbUDNSRN(int type, const char* buf, int len, IP* ip); static int _cbUSOCR(int type, const char* buf, int len, int* handle); static int _cbUSORD(int type, const char* buf, int len, char* out); typedef struct { char* buf; IP ip; int port; } USORFparam; static int _cbUSORF(int type, const char* buf, int len, USORFparam* param); typedef struct { char* buf; char* num; } CMGRparam; static int _cbCUSD(int type, const char* buf, int len, char* resp); // sms typedef struct { int* ix; int num; } CMGLparam; static int _cbCMGL(int type, const char* buf, int len, CMGLparam* param); static int _cbCMGR(int type, const char* buf, int len, CMGRparam* param); // file typedef struct { const char* filename; char* buf; int sz; int len; } URDFILEparam; static int _cbUDELFILE(int type, const char* buf, int len, void*); static int _cbURDFILE(int type, const char* buf, int len, URDFILEparam* param); // variables DevStatus _dev; //!< collected device information NetStatus _net; //!< collected network information IP _ip; //!< assigned ip address // management struture for sockets typedef struct { int handle; system_tick_t timeout_ms; volatile bool connected; volatile int pending; } SockCtrl; // LISA-C has 6 TCP and 6 UDP sockets // LISA-U and SARA-G have 7 sockets SockCtrl _sockets[7]; int _findSocket(int handle = MDM_SOCKET_ERROR/* = CREATE*/); static MDMParser* inst; bool _init; bool _pwr; bool _activated; bool _attached; #ifdef MDM_DEBUG int _debugLevel; system_tick_t _debugTime; void _debugPrint(int level, const char* color, const char* format, ...); #endif }; // ----------------------------------------------------------------------- /** modem class which uses USART3 as physical interface. */ class MDMElectronSerial : public ElectronSerialPipe, public MDMParser { public: /** Constructor \param rxSize the size of the serial rx buffer \param txSize the size of the serial tx buffer */ MDMElectronSerial( int rxSize = 1024, int txSize = 1024 ); //! Destructor virtual ~MDMElectronSerial(void); /** Get a line from the physical interface. \param buf the buffer to store it \param buf size of the buffer \return type and length if something was found, WAIT if not enough data is available NOT_FOUND if nothing was found */ virtual int getLine(char* buffer, int length); /* clear the pending input data */ virtual void purge(void) { while (readable()) getc(); } protected: /** Write bytes to the physical interface. \param buf the buffer to write \param buf size of the buffer to write \return bytes written */ virtual int _send(const void* buf, int len); }; /* Instance of MDMElectronSerial for use in HAL_USART3_Handler */ extern MDMElectronSerial electronMDM;
etk29321/firmware
platform/spark/firmware/hal/src/electron/modem/mdm_hal.h
C
agpl-3.0
24,434
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Copyright (C) 2010 Winch Gate Property Limited // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // // 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 Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. #include "service.h" #include <sstream> #include "r2_modules/dms.h" #include "r2_modules/ai_wrapper.h" #include "r2_modules/server_animation_module.h" #include "r2_modules/server_edition_module.h" #include "r2_share/r2_ligo_config.h" #include "nel/net/unified_network.h" #include "nel/net/module_manager.h" #include "nel/ligo/primitive.h" #include "nel/ligo/ligo_config.h" #include "nel/misc/entity_id.h" #include "game_share/tick_event_handler.h" #include "game_share/ryzom_version.h" //#include "game_share/module_security.h" #include "game_share/ryzom_entity_id.h" #include "game_share/chat_group.h" #include "game_share/singleton_registry.h" using namespace NLNET; using namespace NLMISC; using namespace R2; // force admin module to link in extern void admin_modules_forceLink(); static void foo() { admin_modules_forceLink(); } namespace R2 { // The ligo config NLLIGO::CLigoConfig* LigoConfigPtr; CR2LigoConfig R2LigoConfig; } void CDynamicScenarioService::forwardToStringManagerModule (CMessage &msgin) { TDataSetRow senderId; CChatGroup::TGroupType groupType= CChatGroup::universe; std::string id_; TSessionId scenarioId; msgin.serial(senderId); msgin.serialEnum(groupType); msgin.serial(id_); msgin.serial(scenarioId); _Dms->translateAndForwardRequested(senderId,groupType,id_,scenarioId); } static void cbForwardToStringManagerModule(CMessage &msgin, const std::string &serviceName, TServiceId sid) { nldebug("forwardToStringManagerModule"); CDynamicScenarioService::instance().forwardToStringManagerModule(msgin); } static void cbForwardToStringManagerModuleWithArg(CMessage &msgin, const std::string &serviceName, TServiceId sid) { nldebug("forwardToStringManagerModuleWithArg"); IServerAnimationModule *imodule = CDynamicMapService::getInstance()->getAnimationModule(); CServerAnimationModule* module = safe_cast<CServerAnimationModule*>(imodule); nlassert(module); module->onProcessModuleMessage(0,msgin); } void CDynamicScenarioService::forwardIncarnChat(TChanID id,TDataSetRow senderId,ucstring sentence) { _Dms->forwardIncarnChat(id,senderId,sentence); nldebug("Forwarding dyn chat \"%s\" to dms",sentence.c_str()); } static void cbDynChatForward(CMessage &msgin, const std::string &serviceName, TServiceId sid) { TChanID id; TDataSetRow sender; ucstring ucsentence; std::string sentence; CChatGroup::TGroupType groupType = CChatGroup::say; msgin.serial(id); msgin.serial(sender); msgin.serial(ucsentence); sentence = ucsentence.toString(); CDynamicScenarioService::instance().forwardIncarnChat(id,sender,sentence); nldebug("forwarding dyn chat \"%s\"",sentence.c_str()); } static void cbSessionAck(CMessage &msgin, const std::string &serviceName, TServiceId sid) { CDynamicMapService* dms = CDynamicMapService::getInstance(); IServerAnimationModule *imodule = dms->getAnimationModule(); CServerAnimationModule* module = safe_cast<CServerAnimationModule*>(imodule); module->onProcessModuleMessage(0, msgin); } static void cbDssStartAct(CMessage &msgin, const std::string &serviceName, TServiceId sid) { CDynamicScenarioService& service = CDynamicScenarioService::instance(); CDynamicMapService* dms = CDynamicMapService::getInstance(); IServerAnimationModule* imodule= dms->getAnimationModule(); CServerAnimationModule* module = safe_cast<CServerAnimationModule*>(imodule); TSessionId sessionId; uint32 actId; msgin.serial(sessionId); msgin.serial(actId); module->scheduleStartAct(sessionId, actId); } static void cbExecCommandResult(CMessage &msgin, const std::string &serviceName, TServiceId sid) { // treat the rely message sent back from a service whom we asked to execute a command NLMISC::InfoLog->displayNL("EXEC_COMMAND_RESULT' Received from: %3d: %s",sid.toString().c_str(),serviceName.c_str()); // retrieve the text from the input message CSString txt; msgin.serial(txt); // divide the text into lines because NeL doesn't like long texts CVectorSString lines; txt.splitLines(lines); // display the lines of text for (uint32 i=0;i<lines.size();++i) { NLMISC::InfoLog->displayNL("%s",lines[i].c_str()); } } static void cbBotDespawnNotification(NLNET::CMessage &msgin, const std::string &serviceName, TServiceId sid) { TAIAlias alias; CEntityId creatureId; msgin.serial(alias); msgin.serial(creatureId); CDynamicMapService* dms = CDynamicMapService::getInstance(); IServerAnimationModule* imodule= dms->getAnimationModule(); CServerAnimationModule* module = safe_cast<CServerAnimationModule*>(imodule); module->onBotDespawnNotification(creatureId); } TUnifiedCallbackItem CbArray[]= { {"translateAndForward", cbForwardToStringManagerModule}, {"DYN_CHAT:FORWARD", cbDynChatForward}, {"DSS_START_ACT", cbDssStartAct}, {"translateAndForwardArg", cbForwardToStringManagerModuleWithArg}, {"SESSION_ACK", cbSessionAck}, {"EXEC_COMMAND_RESULT", cbExecCommandResult}, {"BOT_DESPAWN_NOTIFICATION", cbBotDespawnNotification}, {"BOT_DEATH_NOTIFICATION", cbBotDespawnNotification}, {"----", NULL} }; void cbServiceUp(const std::string &serviceName, TServiceId serviceId, void *) { nlinfo( "DSS: %s Service up", serviceName.c_str() ); if( serviceName == "AIS" ) { nlinfo( "DSS: AI server up" ); CDynamicMapService *dms = CDynamicMapService::getInstance(); if( dms ) { IServerAnimationModule *imodule = dms->getAnimationModule(); CServerAnimationModule* module = safe_cast<CServerAnimationModule*>(imodule); if( module ) { nlinfo( "DSS: notifying ServerAnimModule that AI server is up" ); module->onServiceUp( serviceName, serviceId ); } { IServerEditionModule*imodule = dms->getEditionModule(); CServerEditionModule* module = safe_cast<CServerEditionModule*>(imodule); if( module ) { nlinfo( "DSS: notifying ServerEditionModule that '%s' server is up", serviceName.c_str() ); module->onServiceUp( serviceName, serviceId ); } } } } if( serviceName == "BS" ) { nlinfo( "DSS: %s server up", serviceName.c_str() ); CDynamicMapService *dms = CDynamicMapService::getInstance(); if( dms ) { IServerEditionModule*imodule = dms->getEditionModule(); CServerEditionModule* module = safe_cast<CServerEditionModule*>(imodule); if( module ) { nlinfo( "DSS: notifying ServerEditionModule that '%s' server is up", serviceName.c_str() ); module->onServiceUp( serviceName, serviceId ); } } } } void cbServiceDown(const std::string &serviceName, TServiceId serviceId, void *) { nlinfo( "DSS: %s Service down", serviceName.c_str() ); if( serviceName == "AIS" ) { nlinfo( "DSS: AI server down" ); CDynamicMapService* dms = CDynamicMapService::getInstance(); if( dms ) { { IServerEditionModule*imodule = dms->getEditionModule(); CServerEditionModule* module = safe_cast<CServerEditionModule*>(imodule); if( module ) { nlinfo( "DSS: notifying ServerEditionModule that '%s' server is down", serviceName.c_str() ); module->onServiceDown( serviceName, serviceId ); } } IServerAnimationModule *imodule = dms->getAnimationModule(); CServerAnimationModule* module = safe_cast<CServerAnimationModule*>(imodule); if( module ) { nlinfo( "DSS: notifying ServerAnimModule that AI server is down" ); // module->onServiceDown( serviceName, serviceId ); } } } if( serviceName == "BS" ) { nlinfo( "DSS: %s server up", serviceName.c_str() ); CDynamicMapService *dms = CDynamicMapService::getInstance(); if( dms ) { IServerEditionModule*imodule = dms->getEditionModule(); CServerEditionModule* module = safe_cast<CServerEditionModule*>(imodule); if( module ) { nlinfo( "DSS: notifying ServerEditionModule that '%s' server is down", serviceName.c_str() ); // module->onServiceDown( serviceName, serviceId ); } } } } void CDynamicScenarioService::init() { _Dms = NULL; // initialize callbacks for service up / down CUnifiedNetwork::getInstance()->setServiceUpCallback("*", cbServiceUp, NULL); CUnifiedNetwork::getInstance()->setServiceDownCallback( "*", cbServiceDown, NULL); CSingletonRegistry::getInstance()->init(); // preset the shard ID if (ConfigFile.getVarPtr("ShardId") != NULL) { anticipateShardId(ConfigFile.getVarPtr("ShardId")->asInt()); } else { nlwarning("No variable ShardId in config file, this could result in miss registered DSS into SU because of late WS shard id message"); } CAiWrapper::setInstance(new CAiWrapperServer); setVersion (RYZOM_VERSION); LigoConfigPtr=&R2LigoConfig; // Init ligo if (!R2LigoConfig.readPrimitiveClass ("world_editor_classes.xml", false)) { // Should be in l:\leveldesign\world_editor_files nlerror ("Can't load ligo primitive config file world_editor_classes.xml"); } R2LigoConfig.updateDynamicAliasBitCount(16); // have ligo library register its own class types for its class factory NLLIGO::Register(); // setup the update systems setUpdateTimeout(100); IModuleManager &mm = IModuleManager::getInstance(); IModule * serverGw = mm.createModule("StandardGateway", "serverGw", ""); nlassert(serverGw != NULL); NLNET::IModuleSocket *socketServerGw = mm.getModuleSocket("serverGw"); nlassert(socketServerGw != NULL); _Dms = new CDynamicMapService(ConfigFile, socketServerGw); _Dms->init2(); // open the server gw with a layer 3 transport CCommandRegistry::getInstance().execute("serverGw.transportAdd L5Transport l5", *InfoLog); CCommandRegistry::getInstance().execute("serverGw.transportCmd l5(open)", *InfoLog); CSheetId::init(0); } bool CDynamicScenarioService::update() { CSingletonRegistry::getInstance()->serviceUpdate(); return true; } void CDynamicScenarioService::release() { CSheetId::uninit(); delete _Dms; _Dms = NULL; IModuleManager &mm = IModuleManager::getInstance(); IModule * clientGw = mm.getLocalModule("serverGw"); nlassert(clientGw != NULL); mm.deleteModule(clientGw); CSingletonRegistry::getInstance()->release(); } NLNET_SERVICE_MAIN( CDynamicScenarioService, "DSS", "dynamic_scenario_service", 0, CbArray, "", "" );
osgcc/ryzom
ryzom/server/src/dynamic_scenario_service/service.cpp
C++
agpl-3.0
10,862
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Copyright (C) 2010 Winch Gate Property Limited // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // // 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 Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. // ide2.h : main header file for the IDE2 application // #if !defined(AFX_IDE2_H__A3FA6447_9B87_4B84_A3F1_D73F185A1AAC__INCLUDED_) #define AFX_IDE2_H__A3FA6447_9B87_4B84_A3F1_D73F185A1AAC__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #ifndef __AFXWIN_H__ #error include 'stdafx.h' before including this file for PCH #endif #include "resource.h" // main symbols ///////////////////////////////////////////////////////////////////////////// // CIdeApp: // See ide2.cpp for the implementation of this class // class CLuaView; class CLuaDoc; class CProjectFile; class CMainFrame; struct IDebuggedAppMainLoop; class CMultiDocTemplateEx : public CMultiDocTemplate { public: CMultiDocTemplateEx(UINT nIDResource, CRuntimeClass* pDocClass, CRuntimeClass* pFrameClass, CRuntimeClass* pViewClass); // helper for cycling bewteen documents void MoveDocAfter(CDocument *doc, CDocument *target); }; class CIdeApp : public CWinApp { public: void MainLoop(); CMainFrame *GetMainFrame(); BOOL FirstFileIsNewer(CString strPathName1, CString strPathName2); void DeleteAllFilesInCurrentDir(); BOOL SaveModifiedDocuments(); CLuaView* OpenProjectFilesView(CProjectFile* pPF, int nLine=-1); CLuaView* LoadProjectFilesView(CProjectFile* pPF); CLuaView* FindProjectFilesView(CProjectFile* pPF); void CheckExternallyModifiedFiles(); CString GetModuleDir(); void FormatMessage(char* pszAPI); CIdeApp(); CDocument *GetActiveDoc(); CMultiDocTemplateEx* m_pLuaTemplate; // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CIdeApp) public: virtual BOOL InitInstance(); virtual int ExitInstance(); //}}AFX_VIRTUAL // Implementation //{{AFX_MSG(CIdeApp) afx_msg void OnAppAbout(); // NOTE - the ClassWizard will add and remove member functions here. // DO NOT EDIT what you see in these blocks of generated code ! //}}AFX_MSG DECLARE_MESSAGE_MAP() public: HWND m_EmbeddingAppWnd; IDebuggedAppMainLoop *m_DebuggedAppMainLoop; protected: HMODULE m_hScintilla; }; extern CIdeApp theApp; ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_IDE2_H__A3FA6447_9B87_4B84_A3F1_D73F185A1AAC__INCLUDED_)
osgcc/ryzom
ryzom/client/src/lua_ide_dll_nevrax/source/Ide2/ide2.h
C
agpl-3.0
3,154
#! /bin/bash for i in 40 50 70 76 80 120 144 150 152 180 196 200 310 400; do convert -resize "$i"x"$i" icon.png $i.png; done convert -resize 400x icon.png 400x.png for i in 36 48 72 96 144 168 192; do convert -resize "$i"x"$i" icon.png android-icon-"$i"x"$i".png; done
Qbix/Platform
MyApp/web/img/icon/resize.sh
Shell
agpl-3.0
271
<?php /* * This file is part of the ONGR package. * * (c) NFQ Technologies UAB <[email protected]> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace ONGR\ElasticsearchDSL\Aggregation\Bucketing; /** * Class representing TermsAggregation. * * @link https://goo.gl/xI7zoa */ class SignificantTermsAggregation extends TermsAggregation { /** * {@inheritdoc} */ public function getType() { return 'significant_terms'; } }
wlwwt/shopware
vendor/ongr/elasticsearch-dsl/src/Aggregation/Bucketing/SignificantTermsAggregation.php
PHP
agpl-3.0
549
/* * iReport - Visual Designer for JasperReports. * Copyright (C) 2002 - 2009 Jaspersoft Corporation. All rights reserved. * http://www.jaspersoft.com * * Unless you have purchased a commercial license agreement from Jaspersoft, * the following license terms apply: * * This program is part of iReport. * * iReport is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * iReport is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with iReport. If not, see <http://www.gnu.org/licenses/>. */ package com.jaspersoft.ireport.designer.menu; import com.jaspersoft.ireport.designer.IReportManager; import com.jaspersoft.ireport.designer.ReportDesignerPanel; import java.util.Iterator; import org.openide.util.HelpCtx; import org.openide.util.Lookup; import org.openide.util.LookupEvent; import org.openide.util.LookupListener; import org.openide.util.NbBundle; import org.openide.util.Utilities; import org.openide.util.actions.CallableSystemAction; public final class ZoomInAction extends CallableSystemAction implements LookupListener { private final Lookup lkp; private final Lookup.Result <? extends ReportDesignerPanel> result; public void performAction() { IReportManager.getInstance().getActiveVisualView().getReportDesignerPanel().zoomIn(); } public void resultChanged(LookupEvent e) { updateStatus(); } public void updateStatus() { Iterator<? extends ReportDesignerPanel> i = result.allInstances().iterator(); if (i.hasNext()) { setEnabled(true); } else { setEnabled(false); } } public ZoomInAction(){ this (Utilities.actionsGlobalContext()); } private ZoomInAction(Lookup lkp) { this.lkp = lkp; result = lkp.lookupResult(ReportDesignerPanel.class); result.addLookupListener(this); result.allItems(); updateStatus(); } public String getName() { return NbBundle.getMessage(ZoomInAction.class, "CTL_ZoomInAction"); } @Override protected String iconResource() { return "com/jaspersoft/ireport/designer/resources/zoomin-16.png"; } public HelpCtx getHelpCtx() { return HelpCtx.DEFAULT_HELP; } @Override protected boolean asynchronous() { return false; } }
klebergraciasoares/ireport-fork
ireport-designer/src/com/jaspersoft/ireport/designer/menu/ZoomInAction.java
Java
agpl-3.0
2,879
class DocumentsController < ApplicationController before_action :find_parent_folder, only: %w(index show new) before_action :ensure_admin, except: %w(index show download) before_action :persist_prefs, only: %(index) def index @folders = (@parent_folder.try(:folders) || DocumentFolder.top).order(:name).includes(:groups) @folders = DocumentFolderAuthorizer.readable_by(@logged_in, @folders) if @logged_in.admin?(:manage_documents) @hidden_folder_count = @folders.hidden.count @restricted_folder_count = @folders.restricted.count('distinct document_folders.id') end @folders = @folders.open unless @show_restricted_folders @folders = @folders.active unless @show_hidden_folders @documents = (@parent_folder.try(:documents) || Document.top).order(:name) cookies[:document_view] = params[:view] if params[:view].present? @view = cookies[:document_view] || 'detail' end def show @document = Document.find(params[:id]) fail ActiveRecord::RecordNotFound unless @logged_in.can_read?(@document) end def new if params[:folder] @folder = (@parent_folder.try(:folders) || DocumentFolder).new render action: 'new_folder' else @document = (@parent_folder.try(:documents) || Document).new end end def create if params[:folder] create_folder else create_documents end end def edit if params[:folder] @folder = DocumentFolder.find(params[:id]) render action: 'edit_folder' else @document = Document.find(params[:id]) end end def update if params[:folder] @folder = DocumentFolder.find(params[:id]) if @folder.update_attributes(folder_params) redirect_to documents_path(folder_id: @folder.folder_id), notice: t('documents.update_folder.notice') else render action: 'edit_folder' end else @document = Document.find(params[:id]) if @document.update_attributes(document_params) redirect_to @document, notice: t('documents.update.notice') else render action: 'edit' end end end def destroy if params[:folder] @folder = DocumentFolder.find(params[:id]) @folder.destroy redirect_to documents_path(folder_id: @folder.folder_id), notice: t('documents.delete_folder.notice') else @document = Document.find(params[:id]) @document.destroy redirect_to documents_path(folder_id: @document.folder_id), notice: t('documents.delete.notice') end end def download @document = Document.find(params[:id]) fail ActiveRecord::RecordNotFound unless @logged_in.can_read?(@document) send_file( @document.file.path, disposition: params[:inline] ? 'inline' : 'attachment', filename: @document.file_file_name, type: @document.file.content_type ) end private def create_folder @folder = DocumentFolder.new(folder_params) if @folder.save redirect_to documents_path(folder_id: @folder), notice: t('documents.create_folder.notice') else render action: 'new_folder' end end def create_documents @successes = [] @errors = [] params[:document][:file].each_with_index do |file, index| @document = Document.new( name: params[:document][:name][index], description: params[:document][:description][index], folder_id: params[:document][:folder_id], file: file ) if @document.save @successes << @document.name else @errors << @document.name end end if @errors.any? flash[:error] = t('documents.create.failure', count: @errors.size, filenames: @errors.join(', ')) else flash[:notice] = t('documents.create.notice', count: @successes.size) end redirect_to documents_path(folder_id: params[:document][:folder_id]) end def find_parent_folder return if params[:folder_id].blank? @parent_folder = DocumentFolder.find(params[:folder_id]) return if @logged_in.admin?(:manage_documents) fail ActiveRecord::RecordNotFound if @parent_folder && !@logged_in.can_read?(@parent_folder) end def folder_params params.require(:folder).permit(:name, :description, :hidden, :folder_id, group_ids: []) end def document_params params[:document] = dearray_params(params[:document]) if params[:action] == 'update' params.require(:document).permit(:name, :description, :folder_id, :file) end def dearray_params(params) params.transform_values do |value| value.is_a?(Array) ? value.first : value end end def feature_enabled? return if Setting.get(:features, :documents) redirect_to people_path false end def ensure_admin return if @logged_in.admin?(:manage_documents) render text: t('not_authorized'), layout: true false end def persist_prefs cookies[:restricted_folders] = params[:restricted_folders] if params[:restricted_folders].present? @show_restricted_folders = !@logged_in.admin?(:manage_documents) || cookies[:restricted_folders] == 'true' cookies[:hidden_folders] = params[:hidden_folders] if params[:hidden_folders].present? @show_hidden_folders = cookies[:hidden_folders] == 'true' end end
ferdinandrosario/onebody
app/controllers/documents_controller.rb
Ruby
agpl-3.0
5,264
<?php if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); /********************************************************************************* * SugarCRM is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License version 3 as published by the * Free Software Foundation with the addition of the following permission added * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. * * 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 Affero General Public License for more * details. * * You should have received a copy of the GNU Affero General Public License along with * this program; if not, see http://www.gnu.org/licenses or write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301 USA. * * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, * SW2-130, Cupertino, CA 95014, USA. or at email address [email protected]. * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU Affero General Public License version 3. * * In accordance with Section 7(b) of the GNU Affero General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by * SugarCRM" logo. If the display of the logo is not reasonably feasible for * technical reasons, the Appropriate Legal Notices must display the words * "Powered by SugarCRM". ********************************************************************************/ /********************************************************************************* * Description: TODO To be written. * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. * All Rights Reserved. * Contributor(s): ______________________________________.. ********************************************************************************/ global $mod_strings,$app_strings; if(ACLController::checkAccess('Calls', 'edit', true))$module_menu[]=Array("index.php?module=Calls&action=EditView&return_module=Calls&return_action=DetailView", $mod_strings['LNK_NEW_CALL'],"CreateCalls"); if(ACLController::checkAccess('Calls', 'list', true))$module_menu[]=Array("index.php?module=Calls&action=index&return_module=Calls&return_action=DetailView", $mod_strings['LNK_CALL_LIST'],"Calls"); if(ACLController::checkAccess('Calls', 'import', true))$module_menu[] =Array("index.php?module=Import&action=Step1&import_module=Calls&return_module=Calls&return_action=index", $mod_strings['LNK_IMPORT_CALLS'],"Import", 'Calls'); ?>
matthewpoer/SuperSweetAdmin
modules/Calls/Menu.php
PHP
agpl-3.0
3,104
#!/usr/bin/env node process.chdir(__dirname); var YUITest = require('yuitest'), path = require('path'), fs = require('fs'), dir = path.join(__dirname, '../../../../build-npm/'), YUI = require(dir).YUI, json; YUI({useSync: true }).use('test', function(Y) { Y.Test.Runner = YUITest.TestRunner; Y.Test.Case = YUITest.TestCase; Y.Test.Suite = YUITest.TestSuite; Y.Assert = YUITest.Assert; Y.applyConfig({ modules: { 'intl-tests': { fullpath: path.join(__dirname, '../unit/assets/intl-tests.js'), requires: [ 'test', 'intl' ] } } }); Y.use('intl-tests'); Y.Test.Runner.setName('INTL cli tests'); });
co-ment/comt
src/cm/media/js/lib/yui/yui3-3.15.0/src/intl/tests/cli/run.js
JavaScript
agpl-3.0
736
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## import time from datetime import datetime from dateutil.relativedelta import relativedelta from openerp.osv import osv, fields from openerp.tools.translate import _ class accountAgedpartnerBalanceWizard(osv.osv_memory): _inherit = "account.report.wiz" _name = 'aged.partner.balance.wiz' _description = 'Account Aged Partner Balance Report' _columns = { 'period_length':fields.integer('Period Length (days)'), 'direction_selection': fields.selection([('past','Past'),('future','Future')], 'Analysis Direction'), 'account_type': fields.selection([('customer','Receivable Accounts'), ('supplier','Payable Accounts'), ('customer_supplier','Receivable and Payable Accounts')],"Account type",), } _defaults = { 'period_length': 30, 'date_from': lambda *a: time.strftime('%Y-%m-%d'), 'direction_selection': 'past', 'filter': 'filter_date', } def pre_print_report(self, cr, uid, ids, data, context=None): if context is None: context = {} # read period_length and direction_selection, because those fields don't belongs to the account.report.wiz vals = self.read(cr, uid, ids,['period_length','direction_selection','account_type'], context=context)[0] #this method read the field and included it in the form (account.common.report has this method) data['form'].update(vals) return data def _print_report(self, cr, uid, ids, data, context=None): res = {} mimetype = self.pool.get('report.mimetypes') report_obj = self.pool.get('ir.actions.report.xml') report_name = '' if context is None: context = {} # we update form with display account value data = self.pre_print_report(cr, uid, ids, data, context=context) period_length = data['form']['period_length'] if period_length <= 0: raise osv.except_osv(_('UserError'), _('You must enter a period length that cannot be 0 or below !')) #In this section, create interval times, depends of period length parameter start = datetime.strptime(data['form']['date_from'], "%Y-%m-%d") if data['form']['direction_selection'] == 'past': for i in range(5)[::-1]: stop = start - relativedelta(days=period_length) res[str(i)] = { 'name': (i!=0 and (str((5-(i+1)) * period_length) + '-' + str((5-i) * period_length)) or ('+'+str(4 * period_length))), 'stop': start.strftime('%Y-%m-%d'), 'start': (i!=0 and stop.strftime('%Y-%m-%d') or False), } start = stop - relativedelta(days=1) else: for i in range(5): stop = start + relativedelta(days=period_length) res[str(5-(i+1))] = { 'name': (i!=4 and str((i) * period_length)+'-' + str((i+1) * period_length) or ('+'+str(4 * period_length))), 'start': start.strftime('%Y-%m-%d'), 'stop': (i!=4 and stop.strftime('%Y-%m-%d') or False), } start = stop + relativedelta(days=1) data['form'].update(res) #======================================================================= # onchange_in_format method changes variable out_format depending of # which in_format is choosed. # If out_format is pdf -> call record in odt format and if it's choosed # ods or xls -> call record in ods format. # ods and xls format are editable format, because they are arranged # to be changed by user and, for example, user can check and change info. #======================================================================= #======================================================================= # If mimetype is PDF -> out_format = PDF (search odt record) # If mimetype is xls or ods -> search ods record. # If record doesn't exist, return a error. #======================================================================= #======================================================================= # Create two differents records for each format, depends of the out_format # selected, choose one of this records #======================================================================= #1. Find out_format selected out_format_obj = mimetype.browse(cr, uid, [int(data['form']['out_format'])], context)[0] #2. Check out_format and set report_name for each format if out_format_obj.code == 'oo-pdf': report_name = 'account_aged_partner_balance_odt' elif out_format_obj.code == 'oo-xls' or out_format_obj.code == 'oo-ods': report_name = 'account_aged_partner_balance_ods' # If there not exist name, it's because not exist a record for this format if report_name == '': raise osv.except_osv(_('Error !'), _('There is no template defined for the selected format. Check if aeroo report exist.')) else: #Search record that match with the name, and get some extra information report_xml_id = report_obj.search(cr, uid, [('report_name','=', report_name)],context=context) report_xml = report_obj.browse(cr, uid, report_xml_id, context=context)[0] data.update({'model': report_xml.model, 'report_type':'aeroo', 'id': report_xml.id}) #Write out_format choosed in wizard report_xml.write({'out_format': out_format_obj.id}, context=context) return { 'type': 'ir.actions.report.xml', 'report_name': report_name, 'datas': data, 'context':context }
ClearCorp-dev/odoo-clearcorp
TODO-8.0/account_aged_partner_balance_report/wizard/account_aged_partner_balance_report_wizard.py
Python
agpl-3.0
7,106
/* * Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved. * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #include <string.h> #include <openssl/err.h> #include <openssl/opensslv.h> #include "ec_lcl.h" /* functions for EC_GROUP objects */ EC_GROUP *EC_GROUP_new(const EC_METHOD *meth) { EC_GROUP *ret; if (meth == NULL) { ECerr(EC_F_EC_GROUP_NEW, EC_R_SLOT_FULL); return NULL; } if (meth->group_init == 0) { ECerr(EC_F_EC_GROUP_NEW, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return NULL; } ret = OPENSSL_zalloc(sizeof(*ret)); if (ret == NULL) { ECerr(EC_F_EC_GROUP_NEW, ERR_R_MALLOC_FAILURE); return NULL; } ret->meth = meth; if ((ret->meth->flags & EC_FLAGS_CUSTOM_CURVE) == 0) { ret->order = BN_new(); if (ret->order == NULL) goto err; ret->cofactor = BN_new(); if (ret->cofactor == NULL) goto err; } ret->asn1_flag = OPENSSL_EC_NAMED_CURVE; ret->asn1_form = POINT_CONVERSION_UNCOMPRESSED; if (!meth->group_init(ret)) goto err; return ret; err: BN_free(ret->order); BN_free(ret->cofactor); OPENSSL_free(ret); return NULL; } void EC_pre_comp_free(EC_GROUP *group) { switch (group->pre_comp_type) { case PCT_none: break; case PCT_nistz256: #ifdef ECP_NISTZ256_ASM EC_nistz256_pre_comp_free(group->pre_comp.nistz256); #endif break; #ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 case PCT_nistp224: EC_nistp224_pre_comp_free(group->pre_comp.nistp224); break; case PCT_nistp256: EC_nistp256_pre_comp_free(group->pre_comp.nistp256); break; case PCT_nistp521: EC_nistp521_pre_comp_free(group->pre_comp.nistp521); break; #else case PCT_nistp224: case PCT_nistp256: case PCT_nistp521: break; #endif case PCT_ec: EC_ec_pre_comp_free(group->pre_comp.ec); break; } group->pre_comp.ec = NULL; } void EC_GROUP_free(EC_GROUP *group) { if (!group) return; if (group->meth->group_finish != 0) group->meth->group_finish(group); EC_pre_comp_free(group); BN_MONT_CTX_free(group->mont_data); EC_POINT_free(group->generator); BN_free(group->order); BN_free(group->cofactor); OPENSSL_free(group->seed); OPENSSL_free(group); } void EC_GROUP_clear_free(EC_GROUP *group) { if (!group) return; if (group->meth->group_clear_finish != 0) group->meth->group_clear_finish(group); else if (group->meth->group_finish != 0) group->meth->group_finish(group); EC_pre_comp_free(group); BN_MONT_CTX_free(group->mont_data); EC_POINT_clear_free(group->generator); BN_clear_free(group->order); BN_clear_free(group->cofactor); OPENSSL_clear_free(group->seed, group->seed_len); OPENSSL_clear_free(group, sizeof(*group)); } int EC_GROUP_copy(EC_GROUP *dest, const EC_GROUP *src) { if (dest->meth->group_copy == 0) { ECerr(EC_F_EC_GROUP_COPY, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return 0; } if (dest->meth != src->meth) { ECerr(EC_F_EC_GROUP_COPY, EC_R_INCOMPATIBLE_OBJECTS); return 0; } if (dest == src) return 1; dest->curve_name = src->curve_name; /* Copy precomputed */ dest->pre_comp_type = src->pre_comp_type; switch (src->pre_comp_type) { case PCT_none: dest->pre_comp.ec = NULL; break; case PCT_nistz256: #ifdef ECP_NISTZ256_ASM dest->pre_comp.nistz256 = EC_nistz256_pre_comp_dup(src->pre_comp.nistz256); #endif break; #ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 case PCT_nistp224: dest->pre_comp.nistp224 = EC_nistp224_pre_comp_dup(src->pre_comp.nistp224); break; case PCT_nistp256: dest->pre_comp.nistp256 = EC_nistp256_pre_comp_dup(src->pre_comp.nistp256); break; case PCT_nistp521: dest->pre_comp.nistp521 = EC_nistp521_pre_comp_dup(src->pre_comp.nistp521); break; #else case PCT_nistp224: case PCT_nistp256: case PCT_nistp521: break; #endif case PCT_ec: dest->pre_comp.ec = EC_ec_pre_comp_dup(src->pre_comp.ec); break; } if (src->mont_data != NULL) { if (dest->mont_data == NULL) { dest->mont_data = BN_MONT_CTX_new(); if (dest->mont_data == NULL) return 0; } if (!BN_MONT_CTX_copy(dest->mont_data, src->mont_data)) return 0; } else { /* src->generator == NULL */ BN_MONT_CTX_free(dest->mont_data); dest->mont_data = NULL; } if (src->generator != NULL) { if (dest->generator == NULL) { dest->generator = EC_POINT_new(dest); if (dest->generator == NULL) return 0; } if (!EC_POINT_copy(dest->generator, src->generator)) return 0; } else { /* src->generator == NULL */ EC_POINT_clear_free(dest->generator); dest->generator = NULL; } if ((src->meth->flags & EC_FLAGS_CUSTOM_CURVE) == 0) { if (!BN_copy(dest->order, src->order)) return 0; if (!BN_copy(dest->cofactor, src->cofactor)) return 0; } dest->asn1_flag = src->asn1_flag; dest->asn1_form = src->asn1_form; if (src->seed) { OPENSSL_free(dest->seed); if ((dest->seed = OPENSSL_malloc(src->seed_len)) == NULL) { ECerr(EC_F_EC_GROUP_COPY, ERR_R_MALLOC_FAILURE); return 0; } if (!memcpy(dest->seed, src->seed, src->seed_len)) return 0; dest->seed_len = src->seed_len; } else { OPENSSL_free(dest->seed); dest->seed = NULL; dest->seed_len = 0; } return dest->meth->group_copy(dest, src); } EC_GROUP *EC_GROUP_dup(const EC_GROUP *a) { EC_GROUP *t = NULL; int ok = 0; if (a == NULL) return NULL; if ((t = EC_GROUP_new(a->meth)) == NULL) return NULL; if (!EC_GROUP_copy(t, a)) goto err; ok = 1; err: if (!ok) { EC_GROUP_free(t); return NULL; } return t; } const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group) { return group->meth; } int EC_METHOD_get_field_type(const EC_METHOD *meth) { return meth->field_type; } static int ec_precompute_mont_data(EC_GROUP *); int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, const BIGNUM *order, const BIGNUM *cofactor) { if (generator == NULL) { ECerr(EC_F_EC_GROUP_SET_GENERATOR, ERR_R_PASSED_NULL_PARAMETER); return 0; } if (group->generator == NULL) { group->generator = EC_POINT_new(group); if (group->generator == NULL) return 0; } if (!EC_POINT_copy(group->generator, generator)) return 0; if (order != NULL) { if (!BN_copy(group->order, order)) return 0; } else BN_zero(group->order); if (cofactor != NULL) { if (!BN_copy(group->cofactor, cofactor)) return 0; } else BN_zero(group->cofactor); /* * Some groups have an order with * factors of two, which makes the Montgomery setup fail. * |group->mont_data| will be NULL in this case. */ if (BN_is_odd(group->order)) { return ec_precompute_mont_data(group); } BN_MONT_CTX_free(group->mont_data); group->mont_data = NULL; return 1; } const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group) { return group->generator; } BN_MONT_CTX *EC_GROUP_get_mont_data(const EC_GROUP *group) { return group->mont_data; } int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx) { if (group->order == NULL) return 0; if (!BN_copy(order, group->order)) return 0; return !BN_is_zero(order); } const BIGNUM *EC_GROUP_get0_order(const EC_GROUP *group) { return group->order; } int EC_GROUP_order_bits(const EC_GROUP *group) { return group->meth->group_order_bits(group); } int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, BN_CTX *ctx) { if (group->cofactor == NULL) return 0; if (!BN_copy(cofactor, group->cofactor)) return 0; return !BN_is_zero(group->cofactor); } const BIGNUM *EC_GROUP_get0_cofactor(const EC_GROUP *group) { return group->cofactor; } void EC_GROUP_set_curve_name(EC_GROUP *group, int nid) { group->curve_name = nid; } int EC_GROUP_get_curve_name(const EC_GROUP *group) { return group->curve_name; } void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag) { group->asn1_flag = flag; } int EC_GROUP_get_asn1_flag(const EC_GROUP *group) { return group->asn1_flag; } void EC_GROUP_set_point_conversion_form(EC_GROUP *group, point_conversion_form_t form) { group->asn1_form = form; } point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *group) { return group->asn1_form; } size_t EC_GROUP_set_seed(EC_GROUP *group, const unsigned char *p, size_t len) { OPENSSL_free(group->seed); group->seed = NULL; group->seed_len = 0; if (!len || !p) return 1; if ((group->seed = OPENSSL_malloc(len)) == NULL) { ECerr(EC_F_EC_GROUP_SET_SEED, ERR_R_MALLOC_FAILURE); return 0; } memcpy(group->seed, p, len); group->seed_len = len; return len; } unsigned char *EC_GROUP_get0_seed(const EC_GROUP *group) { return group->seed; } size_t EC_GROUP_get_seed_len(const EC_GROUP *group) { return group->seed_len; } int EC_GROUP_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) { if (group->meth->group_set_curve == 0) { ECerr(EC_F_EC_GROUP_SET_CURVE, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return 0; } return group->meth->group_set_curve(group, p, a, b, ctx); } int EC_GROUP_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx) { if (group->meth->group_get_curve == NULL) { ECerr(EC_F_EC_GROUP_GET_CURVE, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return 0; } return group->meth->group_get_curve(group, p, a, b, ctx); } #if OPENSSL_API_COMPAT < 0x10200000L int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) { return EC_GROUP_set_curve(group, p, a, b, ctx); } int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx) { return EC_GROUP_get_curve(group, p, a, b, ctx); } # ifndef OPENSSL_NO_EC2M int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) { return EC_GROUP_set_curve(group, p, a, b, ctx); } int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx) { return EC_GROUP_get_curve(group, p, a, b, ctx); } # endif #endif int EC_GROUP_get_degree(const EC_GROUP *group) { if (group->meth->group_get_degree == 0) { ECerr(EC_F_EC_GROUP_GET_DEGREE, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return 0; } return group->meth->group_get_degree(group); } int EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx) { if (group->meth->group_check_discriminant == 0) { ECerr(EC_F_EC_GROUP_CHECK_DISCRIMINANT, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return 0; } return group->meth->group_check_discriminant(group, ctx); } int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx) { int r = 0; BIGNUM *a1, *a2, *a3, *b1, *b2, *b3; BN_CTX *ctx_new = NULL; /* compare the field types */ if (EC_METHOD_get_field_type(EC_GROUP_method_of(a)) != EC_METHOD_get_field_type(EC_GROUP_method_of(b))) return 1; /* compare the curve name (if present in both) */ if (EC_GROUP_get_curve_name(a) && EC_GROUP_get_curve_name(b) && EC_GROUP_get_curve_name(a) != EC_GROUP_get_curve_name(b)) return 1; if (a->meth->flags & EC_FLAGS_CUSTOM_CURVE) return 0; if (ctx == NULL) ctx_new = ctx = BN_CTX_new(); if (ctx == NULL) return -1; BN_CTX_start(ctx); a1 = BN_CTX_get(ctx); a2 = BN_CTX_get(ctx); a3 = BN_CTX_get(ctx); b1 = BN_CTX_get(ctx); b2 = BN_CTX_get(ctx); b3 = BN_CTX_get(ctx); if (b3 == NULL) { BN_CTX_end(ctx); BN_CTX_free(ctx_new); return -1; } /* * XXX This approach assumes that the external representation of curves * over the same field type is the same. */ if (!a->meth->group_get_curve(a, a1, a2, a3, ctx) || !b->meth->group_get_curve(b, b1, b2, b3, ctx)) r = 1; if (r || BN_cmp(a1, b1) || BN_cmp(a2, b2) || BN_cmp(a3, b3)) r = 1; /* XXX EC_POINT_cmp() assumes that the methods are equal */ if (r || EC_POINT_cmp(a, EC_GROUP_get0_generator(a), EC_GROUP_get0_generator(b), ctx)) r = 1; if (!r) { const BIGNUM *ao, *bo, *ac, *bc; /* compare the order and cofactor */ ao = EC_GROUP_get0_order(a); bo = EC_GROUP_get0_order(b); ac = EC_GROUP_get0_cofactor(a); bc = EC_GROUP_get0_cofactor(b); if (ao == NULL || bo == NULL) { BN_CTX_end(ctx); BN_CTX_free(ctx_new); return -1; } if (BN_cmp(ao, bo) || BN_cmp(ac, bc)) r = 1; } BN_CTX_end(ctx); BN_CTX_free(ctx_new); return r; } /* functions for EC_POINT objects */ EC_POINT *EC_POINT_new(const EC_GROUP *group) { EC_POINT *ret; if (group == NULL) { ECerr(EC_F_EC_POINT_NEW, ERR_R_PASSED_NULL_PARAMETER); return NULL; } if (group->meth->point_init == NULL) { ECerr(EC_F_EC_POINT_NEW, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return NULL; } ret = OPENSSL_zalloc(sizeof(*ret)); if (ret == NULL) { ECerr(EC_F_EC_POINT_NEW, ERR_R_MALLOC_FAILURE); return NULL; } ret->meth = group->meth; ret->curve_name = group->curve_name; if (!ret->meth->point_init(ret)) { OPENSSL_free(ret); return NULL; } return ret; } void EC_POINT_free(EC_POINT *point) { if (!point) return; if (point->meth->point_finish != 0) point->meth->point_finish(point); OPENSSL_free(point); } void EC_POINT_clear_free(EC_POINT *point) { if (!point) return; if (point->meth->point_clear_finish != 0) point->meth->point_clear_finish(point); else if (point->meth->point_finish != 0) point->meth->point_finish(point); OPENSSL_clear_free(point, sizeof(*point)); } int EC_POINT_copy(EC_POINT *dest, const EC_POINT *src) { if (dest->meth->point_copy == 0) { ECerr(EC_F_EC_POINT_COPY, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return 0; } if (dest->meth != src->meth || (dest->curve_name != src->curve_name && dest->curve_name != 0 && src->curve_name != 0)) { ECerr(EC_F_EC_POINT_COPY, EC_R_INCOMPATIBLE_OBJECTS); return 0; } if (dest == src) return 1; return dest->meth->point_copy(dest, src); } EC_POINT *EC_POINT_dup(const EC_POINT *a, const EC_GROUP *group) { EC_POINT *t; int r; if (a == NULL) return NULL; t = EC_POINT_new(group); if (t == NULL) return NULL; r = EC_POINT_copy(t, a); if (!r) { EC_POINT_free(t); return NULL; } return t; } const EC_METHOD *EC_POINT_method_of(const EC_POINT *point) { return point->meth; } int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point) { if (group->meth->point_set_to_infinity == 0) { ECerr(EC_F_EC_POINT_SET_TO_INFINITY, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return 0; } if (group->meth != point->meth) { ECerr(EC_F_EC_POINT_SET_TO_INFINITY, EC_R_INCOMPATIBLE_OBJECTS); return 0; } return group->meth->point_set_to_infinity(group, point); } int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, EC_POINT *point, const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *ctx) { if (group->meth->point_set_Jprojective_coordinates_GFp == 0) { ECerr(EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return 0; } if (!ec_point_is_compat(point, group)) { ECerr(EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP, EC_R_INCOMPATIBLE_OBJECTS); return 0; } return group->meth->point_set_Jprojective_coordinates_GFp(group, point, x, y, z, ctx); } int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group, const EC_POINT *point, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx) { if (group->meth->point_get_Jprojective_coordinates_GFp == 0) { ECerr(EC_F_EC_POINT_GET_JPROJECTIVE_COORDINATES_GFP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return 0; } if (!ec_point_is_compat(point, group)) { ECerr(EC_F_EC_POINT_GET_JPROJECTIVE_COORDINATES_GFP, EC_R_INCOMPATIBLE_OBJECTS); return 0; } return group->meth->point_get_Jprojective_coordinates_GFp(group, point, x, y, z, ctx); } int EC_POINT_set_affine_coordinates(const EC_GROUP *group, EC_POINT *point, const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx) { if (group->meth->point_set_affine_coordinates == NULL) { ECerr(EC_F_EC_POINT_SET_AFFINE_COORDINATES, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return 0; } if (!ec_point_is_compat(point, group)) { ECerr(EC_F_EC_POINT_SET_AFFINE_COORDINATES, EC_R_INCOMPATIBLE_OBJECTS); return 0; } if (!group->meth->point_set_affine_coordinates(group, point, x, y, ctx)) return 0; if (EC_POINT_is_on_curve(group, point, ctx) <= 0) { ECerr(EC_F_EC_POINT_SET_AFFINE_COORDINATES, EC_R_POINT_IS_NOT_ON_CURVE); return 0; } return 1; } #if OPENSSL_API_COMPAT < 0x10200000L int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *point, const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx) { return EC_POINT_set_affine_coordinates(group, point, x, y, ctx); } # ifndef OPENSSL_NO_EC2M int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, EC_POINT *point, const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx) { return EC_POINT_set_affine_coordinates(group, point, x, y, ctx); } # endif #endif int EC_POINT_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *point, BIGNUM *x, BIGNUM *y, BN_CTX *ctx) { if (group->meth->point_get_affine_coordinates == NULL) { ECerr(EC_F_EC_POINT_GET_AFFINE_COORDINATES, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return 0; } if (!ec_point_is_compat(point, group)) { ECerr(EC_F_EC_POINT_GET_AFFINE_COORDINATES, EC_R_INCOMPATIBLE_OBJECTS); return 0; } if (EC_POINT_is_at_infinity(group, point)) { ECerr(EC_F_EC_POINT_GET_AFFINE_COORDINATES, EC_R_POINT_AT_INFINITY); return 0; } return group->meth->point_get_affine_coordinates(group, point, x, y, ctx); } #if OPENSSL_API_COMPAT < 0x10200000L int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, const EC_POINT *point, BIGNUM *x, BIGNUM *y, BN_CTX *ctx) { return EC_POINT_get_affine_coordinates(group, point, x, y, ctx); } # ifndef OPENSSL_NO_EC2M int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group, const EC_POINT *point, BIGNUM *x, BIGNUM *y, BN_CTX *ctx) { return EC_POINT_get_affine_coordinates(group, point, x, y, ctx); } # endif #endif int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx) { if (group->meth->add == 0) { ECerr(EC_F_EC_POINT_ADD, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return 0; } if (!ec_point_is_compat(r, group) || !ec_point_is_compat(a, group) || !ec_point_is_compat(b, group)) { ECerr(EC_F_EC_POINT_ADD, EC_R_INCOMPATIBLE_OBJECTS); return 0; } return group->meth->add(group, r, a, b, ctx); } int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX *ctx) { if (group->meth->dbl == 0) { ECerr(EC_F_EC_POINT_DBL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return 0; } if (!ec_point_is_compat(r, group) || !ec_point_is_compat(a, group)) { ECerr(EC_F_EC_POINT_DBL, EC_R_INCOMPATIBLE_OBJECTS); return 0; } return group->meth->dbl(group, r, a, ctx); } int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx) { if (group->meth->invert == 0) { ECerr(EC_F_EC_POINT_INVERT, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return 0; } if (!ec_point_is_compat(a, group)) { ECerr(EC_F_EC_POINT_INVERT, EC_R_INCOMPATIBLE_OBJECTS); return 0; } return group->meth->invert(group, a, ctx); } int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *point) { if (group->meth->is_at_infinity == 0) { ECerr(EC_F_EC_POINT_IS_AT_INFINITY, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return 0; } if (!ec_point_is_compat(point, group)) { ECerr(EC_F_EC_POINT_IS_AT_INFINITY, EC_R_INCOMPATIBLE_OBJECTS); return 0; } return group->meth->is_at_infinity(group, point); } /* * Check whether an EC_POINT is on the curve or not. Note that the return * value for this function should NOT be treated as a boolean. Return values: * 1: The point is on the curve * 0: The point is not on the curve * -1: An error occurred */ int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *ctx) { if (group->meth->is_on_curve == 0) { ECerr(EC_F_EC_POINT_IS_ON_CURVE, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return 0; } if (!ec_point_is_compat(point, group)) { ECerr(EC_F_EC_POINT_IS_ON_CURVE, EC_R_INCOMPATIBLE_OBJECTS); return 0; } return group->meth->is_on_curve(group, point, ctx); } int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx) { if (group->meth->point_cmp == 0) { ECerr(EC_F_EC_POINT_CMP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return -1; } if (!ec_point_is_compat(a, group) || !ec_point_is_compat(b, group)) { ECerr(EC_F_EC_POINT_CMP, EC_R_INCOMPATIBLE_OBJECTS); return -1; } return group->meth->point_cmp(group, a, b, ctx); } int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) { if (group->meth->make_affine == 0) { ECerr(EC_F_EC_POINT_MAKE_AFFINE, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return 0; } if (!ec_point_is_compat(point, group)) { ECerr(EC_F_EC_POINT_MAKE_AFFINE, EC_R_INCOMPATIBLE_OBJECTS); return 0; } return group->meth->make_affine(group, point, ctx); } int EC_POINTs_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], BN_CTX *ctx) { size_t i; if (group->meth->points_make_affine == 0) { ECerr(EC_F_EC_POINTS_MAKE_AFFINE, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return 0; } for (i = 0; i < num; i++) { if (!ec_point_is_compat(points[i], group)) { ECerr(EC_F_EC_POINTS_MAKE_AFFINE, EC_R_INCOMPATIBLE_OBJECTS); return 0; } } return group->meth->points_make_affine(group, num, points, ctx); } /* * Functions for point multiplication. If group->meth->mul is 0, we use the * wNAF-based implementations in ec_mult.c; otherwise we dispatch through * methods. */ int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, size_t num, const EC_POINT *points[], const BIGNUM *scalars[], BN_CTX *ctx) { int ret = 0; size_t i = 0; BN_CTX *new_ctx = NULL; if ((scalar == NULL) && (num == 0)) { return EC_POINT_set_to_infinity(group, r); } if (!ec_point_is_compat(r, group)) { ECerr(EC_F_EC_POINTS_MUL, EC_R_INCOMPATIBLE_OBJECTS); return 0; } for (i = 0; i < num; i++) { if (!ec_point_is_compat(points[i], group)) { ECerr(EC_F_EC_POINTS_MUL, EC_R_INCOMPATIBLE_OBJECTS); return 0; } } if (ctx == NULL && (ctx = new_ctx = BN_CTX_secure_new()) == NULL) { ECerr(EC_F_EC_POINTS_MUL, ERR_R_INTERNAL_ERROR); return 0; } if (group->meth->mul != NULL) ret = group->meth->mul(group, r, scalar, num, points, scalars, ctx); else /* use default */ ret = ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx); BN_CTX_free(new_ctx); return ret; } int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar, const EC_POINT *point, const BIGNUM *p_scalar, BN_CTX *ctx) { /* just a convenient interface to EC_POINTs_mul() */ const EC_POINT *points[1]; const BIGNUM *scalars[1]; points[0] = point; scalars[0] = p_scalar; return EC_POINTs_mul(group, r, g_scalar, (point != NULL && p_scalar != NULL), points, scalars, ctx); } int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx) { if (group->meth->mul == 0) /* use default */ return ec_wNAF_precompute_mult(group, ctx); if (group->meth->precompute_mult != 0) return group->meth->precompute_mult(group, ctx); else return 1; /* nothing to do, so report success */ } int EC_GROUP_have_precompute_mult(const EC_GROUP *group) { if (group->meth->mul == 0) /* use default */ return ec_wNAF_have_precompute_mult(group); if (group->meth->have_precompute_mult != 0) return group->meth->have_precompute_mult(group); else return 0; /* cannot tell whether precomputation has * been performed */ } /* * ec_precompute_mont_data sets |group->mont_data| from |group->order| and * returns one on success. On error it returns zero. */ static int ec_precompute_mont_data(EC_GROUP *group) { BN_CTX *ctx = BN_CTX_new(); int ret = 0; BN_MONT_CTX_free(group->mont_data); group->mont_data = NULL; if (ctx == NULL) goto err; group->mont_data = BN_MONT_CTX_new(); if (group->mont_data == NULL) goto err; if (!BN_MONT_CTX_set(group->mont_data, group->order, ctx)) { BN_MONT_CTX_free(group->mont_data); group->mont_data = NULL; goto err; } ret = 1; err: BN_CTX_free(ctx); return ret; } int EC_KEY_set_ex_data(EC_KEY *key, int idx, void *arg) { return CRYPTO_set_ex_data(&key->ex_data, idx, arg); } void *EC_KEY_get_ex_data(const EC_KEY *key, int idx) { return CRYPTO_get_ex_data(&key->ex_data, idx); } int ec_group_simple_order_bits(const EC_GROUP *group) { if (group->order == NULL) return 0; return BN_num_bits(group->order); } static int ec_field_inverse_mod_ord(const EC_GROUP *group, BIGNUM *r, const BIGNUM *x, BN_CTX *ctx) { BIGNUM *e = NULL; BN_CTX *new_ctx = NULL; int ret = 0; if (group->mont_data == NULL) return 0; if (ctx == NULL && (ctx = new_ctx = BN_CTX_secure_new()) == NULL) return 0; BN_CTX_start(ctx); if ((e = BN_CTX_get(ctx)) == NULL) goto err; /*- * We want inverse in constant time, therefore we utilize the fact * order must be prime and use Fermats Little Theorem instead. */ if (!BN_set_word(e, 2)) goto err; if (!BN_sub(e, group->order, e)) goto err; /*- * Exponent e is public. * No need for scatter-gather or BN_FLG_CONSTTIME. */ if (!BN_mod_exp_mont(r, x, e, group->order, ctx, group->mont_data)) goto err; ret = 1; err: if (ctx != NULL) BN_CTX_end(ctx); BN_CTX_free(new_ctx); return ret; } /*- * Default behavior, if group->meth->field_inverse_mod_ord is NULL: * - When group->order is even, this function returns an error. * - When group->order is otherwise composite, the correctness * of the output is not guaranteed. * - When x is outside the range [1, group->order), the correctness * of the output is not guaranteed. * - Otherwise, this function returns the multiplicative inverse in the * range [1, group->order). * * EC_METHODs must implement their own field_inverse_mod_ord for * other functionality. */ int ec_group_do_inverse_ord(const EC_GROUP *group, BIGNUM *res, const BIGNUM *x, BN_CTX *ctx) { if (group->meth->field_inverse_mod_ord != NULL) return group->meth->field_inverse_mod_ord(group, res, x, ctx); else return ec_field_inverse_mod_ord(group, res, x, ctx); } /*- * Coordinate blinding for EC_POINT. * * The underlying EC_METHOD can optionally implement this function: * underlying implementations should return 0 on errors, or 1 on * success. * * This wrapper returns 1 in case the underlying EC_METHOD does not * support coordinate blinding. */ int ec_point_blind_coordinates(const EC_GROUP *group, EC_POINT *p, BN_CTX *ctx) { if (group->meth->blind_coordinates == NULL) return 1; /* ignore if not implemented */ return group->meth->blind_coordinates(group, p, ctx); }
artclarke/humble-video
humble-video-captive/src/main/gnu/openssl/csrc/crypto/ec/ec_lib.c
C
agpl-3.0
31,047