//---------------------------------------------------------------------
        MessagePtr MessageFactoryIdentityLookup::create(
                                                        ElementPtr root,
                                                        IMessageSourcePtr messageSource
                                                        )
        {
          if (!root) return MessagePtr();

          Message::MessageTypes msgType = IMessageHelper::getMessageType(root);
          Methods msgMethod = (MessageFactoryIdentityLookup::Methods)toMethod(IMessageHelper::getAttribute(root, "method"));

          switch (msgType) {
            case Message::MessageType_Invalid:                return MessagePtr();

            case Message::MessageType_Request:                return MessagePtr();
            case Message::MessageType_Result:
            {
              switch (msgMethod) {
                case Method_Invalid:                          return MessagePtr();

                case Method_IdentityLookupCheck:              return IdentityLookupCheckResult::create(root, messageSource);
                case Method_IdentityLookup:                   return IdentityLookupResult::create(root, messageSource);
              }
              break;
            }
            case Message::MessageType_Notify:                 return MessagePtr();
          }

          return MessagePtr();
        }
Example #2
0
bool bdoc::Digest::isSupported(const std::string& methodUri)
{
	if (toMethod(methodUri) != 0) {
		return true;
	}

	return false;
}
Example #3
0
void MetaInfo::load( KConfig * conf )
{
	setBookmarks( conf->readIntListEntry("Bookmarks") );
	setBreakpoints( conf->readIntListEntry("Breakpoints") );
	m_outputMethodInfo.setMethod( toMethod( conf->readEntry("OutputMethod") ) );
	m_outputMethodInfo.setOutputFile( conf->readPathEntry("OutputPath") );
	m_outputMethodInfo.setPicID( conf->readEntry("OutputPicID") );
	setCursorLine( conf->readNumEntry( "CursorLine", 0 ) );
	setCursorColumn( conf->readNumEntry( "CursorColumn", 0 ) );
}
Example #4
0
/**
 * Check if methodUri is supported by Digest.create(methodUri) method
 * For available method URIs see:
 * <li>
 *   <ul><b>W3C XML Encryption Syntax and Processing</b> (10 December 2005) http://www.w3.org/TR/xmlenc-core/</ul>
 *   <ul><b>RFC 4051</b> http://www.ietf.org/rfc/rfc4051.txt</ul>
 * </li>
 * @param methodUri igest method URI (e.g. 'http://www.w3.org/2000/09/xmldsig#sha1' for SHA1).
 * @return if methodUri is supported
 */
bool digidoc::Digest::isSupported(const std::string &methodUri)
{
    try
    {
        toMethod(methodUri);
        return true;
    }
    catch (IOException& )
    {
        return false;
    }
}
        //---------------------------------------------------------------------
        MessagePtr MessageFactoryPeer::create(
                                              ElementPtr root,
                                              IMessageSourcePtr messageSource
                                              )
        {
          if (!root) return MessagePtr();

          Message::MessageTypes msgType = IMessageHelper::getMessageType(root);
          Methods msgMethod = (MessageFactoryPeer::Methods)toMethod(IMessageHelper::getAttribute(root, "method"));

          switch (msgType) {
            case Message::MessageType_Invalid:                  return MessagePtr();

            case Message::MessageType_Request:
            {
              switch (msgMethod) {
                case Method_Invalid:                            return MessagePtr();

                case Method_PeerServicesGet:                    return MessagePtr();
              }
              break;
            }
            case Message::MessageType_Result:
            {
              switch (msgMethod) {
                case Method_Invalid:                            return MessagePtr();

                case Method_PeerServicesGet:                    return PeerServicesGetResult::create(root, messageSource);
              }
              break;
            }
            case Message::MessageType_Notify:                   {
              switch (msgMethod) {
                case Method_Invalid:                            return MessagePtr();

                case Method_PeerServicesGet:                    return MessagePtr();
              }
              break;
            }
          }

          return MessagePtr();
        }
Example #6
0
        //---------------------------------------------------------------------
        MessagePtr MessageFactoryPeerFinder::create(
                                                    ElementPtr root,
                                                    IMessageSourcePtr messageSource
                                                    )
        {
          if (!root) return MessagePtr();

          Message::MessageTypes msgType = IMessageHelper::getMessageType(root);
          Methods msgMethod = (MessageFactoryPeerFinder::Methods)toMethod(IMessageHelper::getAttribute(root, "method"));

          switch (msgType) {
            case Message::MessageType_Invalid:                return MessagePtr();

            case Message::MessageType_Request:
            {
              switch (msgMethod) {
                case Method_Invalid:                          return MessagePtr();

                case Method_ChannelMap:                       return MessagePtr();

                case Method_SessionKeepAlive:                 return MessagePtr();
                case Method_SessionCreate:                    return MessagePtr();
                case Method_SessionDelete:                    return MessagePtr();

                case Method_PeerLocationFind:                 return PeerLocationFindRequest::create(root, messageSource);
              }
              break;
            }
            case Message::MessageType_Result:
            {
              switch (msgMethod) {
                case Method_Invalid:                          return MessagePtr();

                case Method_ChannelMap:                       return ChannelMapResult::create(root, messageSource);

                case Method_SessionKeepAlive:                 return SessionKeepAliveResult::create(root, messageSource);
                case Method_SessionCreate:                    return SessionCreateResult::create(root, messageSource);
                case Method_SessionDelete:                    return SessionDeleteResult::create(root, messageSource);

                case Method_PeerLocationFind:                 return PeerLocationFindResult::create(root, messageSource);
              }
              break;
            }
            case Message::MessageType_Notify:
            {
              switch (msgMethod) {
                case Method_Invalid:                          return MessagePtr();

                case Method_ChannelMap:                       return ChannelMapNotify::create(root, messageSource);

                case Method_SessionKeepAlive:                 return MessagePtr();
                case Method_SessionCreate:                    return MessagePtr();
                case Method_SessionDelete:                    return MessagePtr();

                case Method_PeerLocationFind:                 return PeerLocationFindNotify::create(root, messageSource);
              }
              break;
            }
          }

          return MessagePtr();
        }
Example #7
0
std::auto_ptr<bdoc::Digest> bdoc::Digest::create(const std::string& methodUri)
{
	return create(toMethod(methodUri));
}
Example #8
0
/**
 * Initializes OpenSSL digest calculator.
 *
 * @param methodUri digest method URI (e.g. 'http://www.w3.org/2000/09/xmldsig#sha1' for SHA1).
 * @throws IOException throws exception if the digest calculator initialization failed.
 */
digidoc::Digest::Digest(const std::string &methodUri) throw(IOException)
    : d( new DigestPrivate )
{
    d->method = toMethod(methodUri);
    reset();
}
Example #9
0
/**
 * Initializes OpenSSL digest calculator.
 *
 * @throws IOException throws exception if the digest calculator initialization failed.
 */
digidoc::Digest::Digest() throw(IOException)
    : d( new DigestPrivate )
{
    d->method = toMethod(Conf::getInstance()->getDigestUri());
    reset();
}