text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    style="@style/identitytoolkit_page"
    android:layout_width="@dimen/identitytoolkit_page_width"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:orientation="vertical">

    <TextView
        android:id="@+id/identitytoolkit_verify_account_header"
        style="@style/identitytoolkit_text.label"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        tools:text="Verify user@domain.com" />

    <View
        style="@style/identitytoolkit_divider"
        android:layout_width="match_parent"
        android:layout_marginBottom="@dimen/identitytoolkit_space_big" />

    <TextView
        android:id="@+id/identitytoolkit_verified_account_info"
        style="@style/identitytoolkit_text.instruction"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        tools:text="Previously you signed in with Facebook." />

    <ImageView
        android:id="@+id/identitytoolkit_verified_idp_icon"
        android:layout_marginTop="@dimen/identitytoolkit_space_small"
        android:layout_marginLeft="@dimen/identitytoolkit_space_small"
        android:layout_width="@dimen/identitytoolkit_button_height"
        android:layout_height="@dimen/identitytoolkit_button_height"
        android:contentDescription="@string/identitytoolkit_idp_icon_description"
        tools:background="@drawable/identitytoolkit_idp_facebook_bg"
        tools:src="@drawable/identitytoolkit_idp_facebook_icon" />

    <TextView
        android:id="@+id/identitytoolkit_current_account_info"
        style="@style/identitytoolkit_text.instruction"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/identitytoolkit_space_small"
        tools:text="But just now, you signed in with Google." />

    <ImageView
        android:id="@+id/identitytoolkit_current_idp_icon"
        android:layout_marginTop="@dimen/identitytoolkit_space_small"
        android:layout_marginLeft="@dimen/identitytoolkit_space_small"
        android:layout_width="@dimen/identitytoolkit_button_height"
        android:layout_height="@dimen/identitytoolkit_button_height"
        android:contentDescription="@string/identitytoolkit_idp_icon_description"
        tools:background="@drawable/identitytoolkit_idp_google_bg"
        tools:src="@drawable/identitytoolkit_idp_google_icon" />

    <TextView
        android:id="@+id/identitytoolkit_verify_account_instruction"
        style="@style/identitytoolkit_text.instruction"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/identitytoolkit_space_big"
        tools:text="So we need to verify with Facebook that you are the same person." />

    <Button
        android:id="@+id/identitytoolkit_next"
        style="@style/identitytoolkit_button"
        android:layout_marginTop="@dimen/identitytoolkit_space_big"
        tools:text="Continue to Facebook" />

</LinearLayout>
<!-- From: file:/usr/local/google/home/mengcheng/Work/g/gitkit-android/google3/apps/easyconnect/easyrp/gitkit/clientsdk/android/identitytoolkit/src/main/res/layout/identitytoolkit_idp_link_account_page.xml -->


text:
package com.opengamma.core.marketdatasnapshot;

import org.threeten.bp.Instant;

/**
 * Represent a snapshot of a yield curve in a {@code StructuredMarketDataSnapshot}.
 *
 * @see StructuredMarketDataSnapshot
 */
public interface YieldCurveSnapshot {

  /**
   * Gets the valuation instant.
   *

   * This is the instant at which the yield curve was evaluated, and is
   * used to generate the snapshot keys.
   *
   * @return the valuation instant
   */
  Instant getValuationTime();

  /**
   * Gets the unstructured market data snapshot.
   *

   * This contains the values that should be applied when building the curve.
   *
   * @return the values which should be applied when building this curve
   */
  UnstructuredMarketDataSnapshot getValues();

}

redpajama_set_name: RedPajamaGithub


text:
/*
	Twenty 1.0 by HTML5 UP
	html5up.net | @n33co
	Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
*/

/* Basic */

	body, input, select, textarea {
		font-size: 14pt;
	}

	header.special {
		padding-top: 5.5em;
		margin-bottom: 4em;
	}


text:
package com.intellij.ide;

import com.intellij.openapi.ui.popup.Balloon;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.ui.awt.RelativePoint;
import com.intellij.util.ui.update.ComparableObject;

import javax.swing.*;
import java.awt.*;

public class IdeTooltip extends ComparableObject.Impl {
  public static final Object TOOLTIP_DISMISS_DELAY_KEY = "TOOLTIP_DISMISS_DELAY_KEY";
  private Component myComponent;
  private Point myPoint;

  private Balloon.Position myPreferredPosition;
  private Balloon.Layer myLayer;

  private JComponent myTipComponent;

  private boolean myToCenter = false;
  private boolean myToCenterIfSmall = true;
  private boolean myHighlighter;

  private Color myTextBackground;
  private Color myTextForeground;
  private Color myBorderColor;
  private Insets myBorderInsets;
  private Font myFont;

  private int myCalloutShift = 4;
  private boolean myExplicitClose;

  private int myPositionChangeX;
  private int myPositionChangeY;

  private Ui myUi;

  private boolean myHint = false;

  public IdeTooltip(Component component, Point point, JComponent tipComponent, Object... identity) {
    super(identity);
    myComponent = component;
    myPoint = point;
    myTipComponent = tipComponent;
    setPreferredPosition(Balloon.Position.above);
  }

  public IdeTooltip setPreferredPosition(Balloon.Position position) {
    myPreferredPosition = position;
    return this;
  }

  public Component getComponent() {
    return myComponent;
  }

  public Point getPoint() {
    return myPoint;
  }

  public RelativePoint getShowingPoint() {
    return myUi != null ? myUi.getShowingPoint() : new RelativePoint(getComponent(), getPoint());
  }

  public Balloon.Position getPreferredPosition() {
    return myPreferredPosition;
  }

  public JComponent getTipComponent() {
    return myTipComponent;
  }

  public IdeTooltip setToCenter(boolean toCenter) {
    myToCenter = toCenter;
    return this;
  }

  public boolean isToCenter() {
    return myToCenter;
  }

  public boolean isToCenterIfSmall() {
    return myToCenterIfSmall;
  }

  public IdeTooltip setToCenterIfSmall(boolean mayCenter) {
    myToCenterIfSmall = mayCenter;
    return this;
  }

  protected boolean canAutohideOn(TooltipEvent event) {
    return true;
  }

  protected void onHidden() {

  }

  protected boolean beforeShow() {
    return true;
  }

  public void hide() {
    IdeTooltipManager.getInstance().hide(this);
  }

  public boolean canBeDismissedOnTimeout() {
    return true;
  }

  public int getShowDelay() {
    return myHighlighter ? Registry.intValue("ide.tooltip.initialDelay.highlighter") : Registry.intValue("ide.tooltip.initialDelay");
  }

  public int getInitialReshowDelay() {
    return Registry.intValue("ide.tooltip.initialReshowDelay");
  }

  public int getDismissDelay() {
    if (myComponent instanceof JComponent) {
      final Object value = ((JComponent)myComponent).getClientProperty(TOOLTIP_DISMISS_DELAY_KEY);
      if (value instanceof Integer) {
        return ((Integer)value).intValue();
      }
    }
    return Registry.intValue("ide.tooltip.dismissDelay");
  }

  public IdeTooltip setHighlighterType(boolean isHighlighter) {
    myHighlighter = isHighlighter;
    return this;
  }

  void setTipComponent(JComponent tipComponent) {
    myTipComponent = tipComponent;
  }

  public IdeTooltip setTextBackground(Color textBackground) {
    myTextBackground = textBackground;
    return this;
  }

  public IdeTooltip setTextForeground(Color textForeground) {
    myTextForeground = textForeground;
    return this;
  }

  public IdeTooltip setBorderColor(Color borderColor) {
    myBorderColor = borderColor;
    return this;
  }
  public IdeTooltip setBorderInsets(Insets insets) {
    myBorderInsets = insets;
    return this;
  }

  public Color getTextBackground() {
    return myTextBackground;
  }

  public Font getFont() {
    return myFont;
  }

  public Color getTextForeground() {
    return myTextForeground;
  }

  public Color getBorderColor() {
    return myBorderColor;
  }

  public Insets getBorderInsets() {
    return myBorderInsets;
  }

  public IdeTooltip setFont(Font font) {
    myFont = font;
    return this;
  }

  public int getCalloutShift() {
    return myCalloutShift;
  }

  public IdeTooltip setCalloutShift(int calloutShift) {
    myCalloutShift = calloutShift;
    return this;
  }

  public void setComponent(Component component) {
    myComponent = component;
  }

  public void setPoint(Point point) {
    myPoint = point;
  }

  public IdeTooltip setExplicitClose(boolean explicitClose) {
    myExplicitClose = explicitClose;
    return this;
  }

  public boolean isExplicitClose() {
    return myExplicitClose;
  }

  public IdeTooltip setPositionChangeShift(int positionChangeX, int positionChangeY) {
    myPositionChangeX = positionChangeX;
    myPositionChangeY = positionChangeY;
    return this;
  }

  public int getPositionChangeX() {
    return myPositionChangeX;
  }

  public int getPositionChangeY() {
    return myPositionChangeY;
  }

  public void setUi(Ui ui) {
    myUi = ui;
  }

  public IdeTooltip setLayer(Balloon.Layer layer) {
    myLayer = layer;
    return this;
  }

  public Balloon.Layer getLayer() {
    return myLayer;
  }

  public IdeTooltip setHint(boolean hint) {
    this.myHint = hint;
    return this;
  }

  public boolean isHint() {
    return myHint;
  }

  public boolean isInside(RelativePoint target) {
    return myUi != null && myUi.isInside(target);
  }

  public interface Ui {
    boolean isInside(RelativePoint target);

    RelativePoint getShowingPoint();
  }
}


text:
create table TaskVariableImpl (
    id int8 not null,
    modificationDate timestamp,
    name varchar(255),
    processId varchar(255),
    processInstanceId int8,
    taskId int8,
    type int4,
    value varchar(255),
    primary key (id)
);
create sequence TASK_VAR_ID_SEQ;


text:
/**
 * ObjectValue.cpp -
 * @author: Jonathan Beard
 * @version: Thu Nov  7 07:35:26 2013
 */
#include "ObjectValue.hpp"


text:
<?php
namespace sample;

use f2r\Fydrate\Adapter\Configuration;
use f2r\Fydrate\Adapter\Mysql\Adapter;

require '../vendor/autoload.php';
require 'Country.php';
require 'CountryHydrator.php';
require 'City.php';
require 'CityHydrator.php';
require 'WorldRepository.php';

$adapter = new Adapter(new Configuration([
    'host' => '127.0.0.1',
    'user' => 'sample',
    'password' => 'sample',
    'database' => 'world'
]));

$world = new WorldRepository($adapter);

echo "Country from Europe\n";
/** @var Country $country */
foreach ($world->findCountryByContinent('Europe') as $country) {
    printf("- %s = %s\n", $country->name, number_format($country->population, 0, ',', ' '));
}

echo "\nBig cities in France and Belgium\n";
foreach ($world->findCitiesOfCountry(200000, ['FRA', 'BEL']) as $code => $country) {
    echo $country->name, ":\n";
    foreach ($country->cities as $city) {
        printf(" - %s (%s)\n", $city->name, number_format($city->population, 0, ',', ' '));
    }

}


text:
// Copyright (C) 2012 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.google.gerrit.server;

public class StringUtil {
  /**
   * An array of the string representations that should be used in place
   * of the non-printable characters in the beginning of the ASCII table
   * when escaping a string. The index of each element in the array
   * corresponds to its ASCII value, i.e. the string representation of
   * ASCII 0 is found in the first element of this array.
   */
  private static final String[] NON_PRINTABLE_CHARS =
    { "\\x00", "\\x01", "\\x02", "\\x03", "\\x04", "\\x05", "\\x06", "\\a",
      "\\b",   "\\t",   "\\n",   "\\v",   "\\f",   "\\r",   "\\x0e", "\\x0f",
      "\\x10", "\\x11", "\\x12", "\\x13", "\\x14", "\\x15", "\\x16", "\\x17",
      "\\x18", "\\x19", "\\x1a", "\\x1b", "\\x1c", "\\x1d", "\\x1e", "\\x1f" };

  /**
   * Escapes the input string so that all non-printable characters
   * (0x00-0x1f) are represented as a hex escape (\x00, \x01, ...)
   * or as a C-style escape sequence (\a, \b, \t, \n, \v, \f, or \r).
   * Backslashes in the input string are doubled (\\).
   */
  public static String escapeString(final String str) {
    // Allocate a buffer big enough to cover the case with a string needed
    // very excessive escaping without having to reallocate the buffer.
    final StringBuilder result = new StringBuilder(3 * str.length());

    for (int i = 0; i < str.length(); i++) {
      char c = str.charAt(i);
      if (c < NON_PRINTABLE_CHARS.length) {
        result.append(NON_PRINTABLE_CHARS[c]);
      } else if (c == '\\') {
        result.append("\\\\");
      } else {
        result.append(c);
      }
    }
    return result.toString();
  }
}


text:
<?php

namespace Figaromedias\Bundle\MgalleryBundle\Admin;

use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Show\ShowMapper;

class VilleAdmin extends Admin
{
    /**
     * @param DatagridMapper $datagridMapper
     */
    protected function configureDatagridFilters(DatagridMapper $datagridMapper)
    {
        $datagridMapper
            ->add('id')
            ->add('titre')
            ->add('accroche')
            ->add('phraseSejourner')
        ;
    }

    /**
     * @param ListMapper $listMapper
     */
    protected function configureListFields(ListMapper $listMapper)
    {
        $listMapper
            ->add('id')
            ->add('titre')
            ->add('accroche')
            ->add('phraseSejourner')
            ->add('publie', null, array('editable' => true))
            ->add('clicable', null, array('editable' => true))
            ->add('_action', 'actions', array(
                'actions' => array(
                    'show' => array(),
                    'edit' => array(),
                    'delete' => array(),
                )
            ))
        ;
    }

    /**
     * @param FormMapper $formMapper
     */
    protected function configureFormFields(FormMapper $formMapper)
    {
        if ($this->hasRequest()) {
            $context = $this->getRequest()->get('context', 'mgallery');

            if (null !== $context) {
                $link_parameters['context'] = $context;
            }
        }

        $formMapper
            //->add('id')
            ->with('Informations principales')
            ->add('titre')
            ->add('accroche')
            ->add('phraseSejourner')
            ->add('description')
            ->add('publie')
            ->add('clicable')

            ->add('bigImage', 'sonata_type_model_list', array('required' => false, 'label' => 'Grande Image'), array(
                'link_parameters' => array('context'=>'mgallery')))
            ->add('petiteImage', 'sonata_type_model_list', array('required' => false, 'label' => 'Petite Image'), array(
                'link_parameters' => array('context'=>'mgallery')))
            ->end()

            ->with('Spots')
            ->add('ville_spot', 'sonata_type_collection', array(
                'cascade_validation' => true,
                'by_reference' => false,
                'label'=>'Spots',
                'required'=>false
            ), array(
                'edit' => 'inline',
                'inline' => 'table',
                'sortable'  => 'position',
                'link_parameters' => array('context'=>'mgallery'),
            ))
            ->end()

            ->with('Hotel')
            ->add('ville_hotel', 'sonata_type_collection', array(
                'cascade_validation' => true,
                'by_reference' => false,
                'label'=>'Hotel',
                'required'=>false
            ), array(
                'edit' => 'inline',
                'inline' => 'table',
                'sortable'  => 'position',
                'link_parameters' => array('context'=>'mgallery'),
            ))
            ->end()

        ;
    }

    /**
     * @param ShowMapper $showMapper
     */
    protected function configureShowFields(ShowMapper $showMapper)
    {
        $showMapper
            ->add('id')
            ->add('titre')
            ->add('accroche')
            ->add('phraseSejourner')
            ->add('ville_talent')
            ->add('ville_spot')
        ;
    }
}


text:
#include "curl_setup.h"

#ifdef USE_GSKIT

#include <gskssl.h>
#include <qsoasync.h>

/* Some symbols are undefined/unsupported on OS400 versions < V7R1. */
#ifndef GSK_SSL_EXTN_SERVERNAME_REQUEST
#define GSK_SSL_EXTN_SERVERNAME_REQUEST         230
#endif

#ifndef GSK_TLSV10_CIPHER_SPECS
#define GSK_TLSV10_CIPHER_SPECS                 236
#endif

#ifndef GSK_TLSV11_CIPHER_SPECS
#define GSK_TLSV11_CIPHER_SPECS                 237
#endif

#ifndef GSK_TLSV12_CIPHER_SPECS
#define GSK_TLSV12_CIPHER_SPECS                 238
#endif

#ifndef GSK_PROTOCOL_TLSV11
#define GSK_PROTOCOL_TLSV11                     437
#endif

#ifndef GSK_PROTOCOL_TLSV12
#define GSK_PROTOCOL_TLSV12                     438
#endif

#ifndef GSK_FALSE
#define GSK_FALSE                               0
#endif

#ifndef GSK_TRUE
#define GSK_TRUE                                1
#endif

#ifdef HAVE_LIMITS_H
#  include <limits.h>
#endif

#include <curl/curl.h>
#include "urldata.h"
#include "sendf.h"
#include "gskit.h"
#include "vtls.h"
#include "connect.h" /* for the connect timeout */
#include "select.h"
#include "strequal.h"
#include "x509asn1.h"

#define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h>

#include "curl_memory.h"
/* The last #include file should be: */
#include "memdebug.h"

/* SSL version flags. */
#define CURL_GSKPROTO_SSLV2     0
#define CURL_GSKPROTO_SSLV2_MASK        (1 << CURL_GSKPROTO_SSLV2)
#define CURL_GSKPROTO_SSLV3     1
#define CURL_GSKPROTO_SSLV3_MASK        (1 << CURL_GSKPROTO_SSLV3)
#define CURL_GSKPROTO_TLSV10    2
#define CURL_GSKPROTO_TLSV10_MASK        (1 << CURL_GSKPROTO_TLSV10)
#define CURL_GSKPROTO_TLSV11    3
#define CURL_GSKPROTO_TLSV11_MASK        (1 << CURL_GSKPROTO_TLSV11)
#define CURL_GSKPROTO_TLSV12    4
#define CURL_GSKPROTO_TLSV12_MASK        (1 << CURL_GSKPROTO_TLSV12)
#define CURL_GSKPROTO_LAST      5

/* Supported ciphers. */
typedef struct {
  const char *name;            /* Cipher name. */
  const char *gsktoken;        /* Corresponding token for GSKit String. */
  unsigned int versions;       /* SSL version flags. */
}  gskit_cipher;

static const gskit_cipher  ciphertable[] = {
  { "null-md5",         "01",
      CURL_GSKPROTO_SSLV3_MASK | CURL_GSKPROTO_TLSV10_MASK |
      CURL_GSKPROTO_TLSV11_MASK | CURL_GSKPROTO_TLSV12_MASK },
  { "null-sha",         "02",
      CURL_GSKPROTO_SSLV3_MASK | CURL_GSKPROTO_TLSV10_MASK |
      CURL_GSKPROTO_TLSV11_MASK | CURL_GSKPROTO_TLSV12_MASK },
  { "exp-rc4-md5",      "03",
      CURL_GSKPROTO_SSLV3_MASK | CURL_GSKPROTO_TLSV10_MASK },
  { "rc4-md5",          "04",
      CURL_GSKPROTO_SSLV3_MASK | CURL_GSKPROTO_TLSV10_MASK |
      CURL_GSKPROTO_TLSV11_MASK | CURL_GSKPROTO_TLSV12_MASK },
  { "rc4-sha",          "05",
      CURL_GSKPROTO_SSLV3_MASK | CURL_GSKPROTO_TLSV10_MASK |
      CURL_GSKPROTO_TLSV11_MASK | CURL_GSKPROTO_TLSV12_MASK },
  { "exp-rc2-cbc-md5",  "06",
      CURL_GSKPROTO_SSLV3_MASK | CURL_GSKPROTO_TLSV10_MASK },
  { "exp-des-cbc-sha",  "09",
      CURL_GSKPROTO_SSLV3_MASK | CURL_GSKPROTO_TLSV10_MASK |
      CURL_GSKPROTO_TLSV11_MASK },
  { "des-cbc3-sha",     "0A",
      CURL_GSKPROTO_SSLV3_MASK | CURL_GSKPROTO_TLSV10_MASK |
      CURL_GSKPROTO_TLSV11_MASK | CURL_GSKPROTO_TLSV12_MASK },
  { "aes128-sha",       "2F",
      CURL_GSKPROTO_TLSV10_MASK | CURL_GSKPROTO_TLSV11_MASK |
      CURL_GSKPROTO_TLSV12_MASK },
  { "aes256-sha",       "35",
      CURL_GSKPROTO_TLSV10_MASK | CURL_GSKPROTO_TLSV11_MASK |
      CURL_GSKPROTO_TLSV12_MASK },
  { "null-sha256",      "3B",   CURL_GSKPROTO_TLSV12_MASK },
  { "aes128-sha256",    "3C",   CURL_GSKPROTO_TLSV12_MASK },
  { "aes256-sha256",    "3D",   CURL_GSKPROTO_TLSV12_MASK },
  { "aes128-gcm-sha256",
                        "9C",   CURL_GSKPROTO_TLSV12_MASK },
  { "aes256-gcm-sha384",
                        "9D",   CURL_GSKPROTO_TLSV12_MASK },
  { "rc4-md5",          "1",    CURL_GSKPROTO_SSLV2_MASK },
  { "exp-rc4-md5",      "2",    CURL_GSKPROTO_SSLV2_MASK },
  { "rc2-md5",          "3",    CURL_GSKPROTO_SSLV2_MASK },
  { "exp-rc2-md5",      "4",    CURL_GSKPROTO_SSLV2_MASK },
  { "des-cbc-md5",      "6",    CURL_GSKPROTO_SSLV2_MASK },
  { "des-cbc3-md5",     "7",    CURL_GSKPROTO_SSLV2_MASK },
  { (const char *) NULL, (const char *) NULL, 0       }
};

static bool is_separator(char c)
{
  /* Return whether character is a cipher list separator. */
  switch (c) {
  case ' ':
  case '\t':
  case ':':
  case ',':
  case ';':
    return true;
  }
  return false;
}

static CURLcode gskit_status(struct SessionHandle *data, int rc,
                             const char *procname, CURLcode defcode)
{
  /* Process GSKit status and map it to a CURLcode. */
  switch (rc) {
  case GSK_OK:
  case GSK_OS400_ASYNCHRONOUS_SOC_INIT:
    return CURLE_OK;
  case GSK_KEYRING_OPEN_ERROR:
  case GSK_OS400_ERROR_NO_ACCESS:
    return CURLE_SSL_CACERT_BADFILE;
  case GSK_INSUFFICIENT_STORAGE:
    return CURLE_OUT_OF_MEMORY;
  case GSK_ERROR_BAD_V2_CIPHER:
  case GSK_ERROR_BAD_V3_CIPHER:
  case GSK_ERROR_NO_CIPHERS:
    return CURLE_SSL_CIPHER;
  case GSK_OS400_ERROR_NOT_TRUSTED_ROOT:
  case GSK_ERROR_CERT_VALIDATION:
    return CURLE_PEER_FAILED_VERIFICATION;
  case GSK_OS400_ERROR_TIMED_OUT:
    return CURLE_OPERATION_TIMEDOUT;
  case GSK_WOULD_BLOCK:
    return CURLE_AGAIN;
  case GSK_OS400_ERROR_NOT_REGISTERED:
    break;
  case GSK_ERROR_IO:
    switch (errno) {
    case ENOMEM:
      return CURLE_OUT_OF_MEMORY;
    default:
      failf(data, "%s I/O error: %s", procname, strerror(errno));
      break;
    }
    break;
  default:
    failf(data, "%s: %s", procname, gsk_strerror(rc));
    break;
  }
  return defcode;
}

static CURLcode set_enum(struct SessionHandle *data, gsk_handle h,
                GSK_ENUM_ID id, GSK_ENUM_VALUE value, bool unsupported_ok)
{
  int rc = gsk_attribute_set_enum(h, id, value);

  switch (rc) {
  case GSK_OK:
    return CURLE_OK;
  case GSK_ERROR_IO:
    failf(data, "gsk_attribute_set_enum() I/O error: %s", strerror(errno));
    break;
  case GSK_ATTRIBUTE_INVALID_ID:
    if(unsupported_ok)
      return CURLE_UNSUPPORTED_PROTOCOL;
  default:
    failf(data, "gsk_attribute_set_enum(): %s", gsk_strerror(rc));
    break;
  }
  return CURLE_SSL_CONNECT_ERROR;
}

static CURLcode set_buffer(struct SessionHandle *data, gsk_handle h,
                        GSK_BUF_ID id, const char *buffer, bool unsupported_ok)
{
  int rc = gsk_attribute_set_buffer(h, id, buffer, 0);

  switch (rc) {
  case GSK_OK:
    return CURLE_OK;
  case GSK_ERROR_IO:
    failf(data, "gsk_attribute_set_buffer() I/O error: %s", strerror(errno));
    break;
  case GSK_ATTRIBUTE_INVALID_ID:
    if(unsupported_ok)
      return CURLE_UNSUPPORTED_PROTOCOL;
  default:
    failf(data, "gsk_attribute_set_buffer(): %s", gsk_strerror(rc));
    break;
  }
  return CURLE_SSL_CONNECT_ERROR;
}

static CURLcode set_numeric(struct SessionHandle *data,
                            gsk_handle h, GSK_NUM_ID id, int value)
{
  int rc = gsk_attribute_set_numeric_value(h, id, value);

  switch (rc) {
  case GSK_OK:
    return CURLE_OK;
  case GSK_ERROR_IO:
    failf(data, "gsk_attribute_set_numeric_value() I/O error: %s",
          strerror(errno));
    break;
  default:
    failf(data, "gsk_attribute_set_numeric_value(): %s", gsk_strerror(rc));
    break;
  }
  return CURLE_SSL_CONNECT_ERROR;
}

static CURLcode set_callback(struct SessionHandle *data,
                             gsk_handle h, GSK_CALLBACK_ID id, void *info)
{
  int rc = gsk_attribute_set_callback(h, id, info);

  switch (rc) {
  case GSK_OK:
    return CURLE_OK;
  case GSK_ERROR_IO:
    failf(data, "gsk_attribute_set_callback() I/O error: %s", strerror(errno));
    break;
  default:
    failf(data, "gsk_attribute_set_callback(): %s", gsk_strerror(rc));
    break;
  }
  return CURLE_SSL_CONNECT_ERROR;
}

static CURLcode set_ciphers(struct SessionHandle *data,
                                        gsk_handle h, unsigned int *protoflags)
{
  const char *cipherlist = data->set.str[STRING_SSL_CIPHER_LIST];
  const char *clp;
  const gskit_cipher *ctp;
  int i;
  int l;
  bool unsupported;
  CURLcode result;
  struct {
    char *buf;
    char *ptr;
  } ciphers[CURL_GSKPROTO_LAST];

  /* Compile cipher list into GSKit-compatible cipher lists. */

  if(!cipherlist)
    return CURLE_OK;
  while(is_separator(*cipherlist))     /* Skip initial separators. */
    cipherlist++;
  if(!*cipherlist)
    return CURLE_OK;

  /* We allocate GSKit buffers of the same size as the input string: since
     GSKit tokens are always shorter than their cipher names, allocated buffers
     will always be large enough to accomodate the result. */
  l = strlen(cipherlist) + 1;
  memset((char *) ciphers, 0, sizeof ciphers);
  for(i = 0; i < CURL_GSKPROTO_LAST; i++) {
    ciphers[i].buf = malloc(l);
    if(!ciphers[i].buf) {
      while(i--)
        free(ciphers[i].buf);
      return CURLE_OUT_OF_MEMORY;
    }
    ciphers[i].ptr = ciphers[i].buf;
    *ciphers[i].ptr = '\0';
  }

  /* Process each cipher in input string. */
  unsupported = FALSE;
  result = CURLE_OK;
  for(;;) {
    for(clp = cipherlist; *cipherlist && !is_separator(*cipherlist);)
      cipherlist++;
    l = cipherlist - clp;
    if(!l)
      break;
    /* Search the cipher in our table. */
    for(ctp = ciphertable; ctp->name; ctp++)
      if(strnequal(ctp->name, clp, l) && !ctp->name[l])
        break;
    if(!ctp->name) {
      failf(data, "Unknown cipher %.*s", l, clp);
      result = CURLE_SSL_CIPHER;
    }
    else {
      unsupported |= !(ctp->versions & (CURL_GSKPROTO_SSLV2_MASK |
                        CURL_GSKPROTO_SSLV3_MASK | CURL_GSKPROTO_TLSV10_MASK));
      for(i = 0; i < CURL_GSKPROTO_LAST; i++) {
        if(ctp->versions & (1 << i)) {
          strcpy(ciphers[i].ptr, ctp->gsktoken);
          ciphers[i].ptr += strlen(ctp->gsktoken);
        }
      }
    }

   /* Advance to next cipher name or end of string. */
    while(is_separator(*cipherlist))
      cipherlist++;
  }

  /* Disable protocols with empty cipher lists. */
  for(i = 0; i < CURL_GSKPROTO_LAST; i++) {
    if(!(*protoflags & (1 << i)) || !ciphers[i].buf[0]) {
      *protoflags &= ~(1 << i);
      ciphers[i].buf[0] = '\0';
    }
  }

  /* Try to set-up TLSv1.1 and TLSv2.1 ciphers. */
  if(*protoflags & CURL_GSKPROTO_TLSV11_MASK) {
    result = set_buffer(data, h, GSK_TLSV11_CIPHER_SPECS,
                        ciphers[CURL_GSKPROTO_TLSV11].buf, TRUE);
    if(result == CURLE_UNSUPPORTED_PROTOCOL) {
      result = CURLE_OK;
      if(unsupported) {
        failf(data, "TLSv1.1-only ciphers are not yet supported");
        result = CURLE_SSL_CIPHER;
      }
    }
  }
  if(!result && (*protoflags & CURL_GSKPROTO_TLSV12_MASK)) {
    result = set_buffer(data, h, GSK_TLSV12_CIPHER_SPECS,
                        ciphers[CURL_GSKPROTO_TLSV12].buf, TRUE);
    if(result == CURLE_UNSUPPORTED_PROTOCOL) {
      result = CURLE_OK;
      if(unsupported) {
        failf(data, "TLSv1.2-only ciphers are not yet supported");
        result = CURLE_SSL_CIPHER;
      }
    }
  }

  /* Try to set-up TLSv1.0 ciphers. If not successful, concatenate them to
     the SSLv3 ciphers. OS/400 prior to version 7.1 will understand it. */
  if(!result && (*protoflags & CURL_GSKPROTO_TLSV10_MASK)) {
    result = set_buffer(data, h, GSK_TLSV10_CIPHER_SPECS,
                        ciphers[CURL_GSKPROTO_TLSV10].buf, TRUE);
    if(result == CURLE_UNSUPPORTED_PROTOCOL) {
      result = CURLE_OK;
      strcpy(ciphers[CURL_GSKPROTO_SSLV3].ptr,
             ciphers[CURL_GSKPROTO_TLSV10].ptr);
    }
  }

  /* Set-up other ciphers. */
  if(!result && (*protoflags & CURL_GSKPROTO_SSLV3_MASK))
    result = set_buffer(data, h, GSK_V3_CIPHER_SPECS,
                        ciphers[CURL_GSKPROTO_SSLV3].buf, FALSE);
  if(!result && (*protoflags & CURL_GSKPROTO_SSLV2_MASK))
    result = set_buffer(data, h, GSK_V2_CIPHER_SPECS,
                        ciphers[CURL_GSKPROTO_SSLV2].buf, FALSE);

  /* Clean-up. */
  for(i = 0; i < CURL_GSKPROTO_LAST; i++)
    free(ciphers[i].buf);

  return result;
}

int Curl_gskit_init(void)
{
  /* No initialisation needed. */

  return 1;
}

void Curl_gskit_cleanup(void)
{
  /* Nothing to do. */
}

static CURLcode init_environment(struct SessionHandle *data,
                                 gsk_handle *envir, const char *appid,
                                 const char *file, const char *label,
                                 const char *password)
{
  int rc;
  CURLcode result;
  gsk_handle h;

  /* Creates the GSKit environment. */

  rc = gsk_environment_open(&h);
  switch (rc) {
  case GSK_OK:
    break;
  case GSK_INSUFFICIENT_STORAGE:
    return CURLE_OUT_OF_MEMORY;
  default:
    failf(data, "gsk_environment_open(): %s", gsk_strerror(rc));
    return CURLE_SSL_CONNECT_ERROR;
  }

  result = set_enum(data, h, GSK_SESSION_TYPE, GSK_CLIENT_SESSION, FALSE);
  if(!result && appid)
    result = set_buffer(data, h, GSK_OS400_APPLICATION_ID, appid, FALSE);
  if(!result && file)
    result = set_buffer(data, h, GSK_KEYRING_FILE, file, FALSE);
  if(!result && label)
    result = set_buffer(data, h, GSK_KEYRING_LABEL, label, FALSE);
  if(!result && password)
    result = set_buffer(data, h, GSK_KEYRING_PW, password, FALSE);

  if(!result) {
    /* Locate CAs, Client certificate and key according to our settings.
       Note: this call may be blocking for some tenths of seconds. */
    result = gskit_status(data, gsk_environment_init(h),
                          "gsk_environment_init()", CURLE_SSL_CERTPROBLEM);
    if(!result) {
      *envir = h;
      return result;
    }
  }
  /* Error: rollback. */
  gsk_environment_close(&h);
  return result;
}

static void cancel_async_handshake(struct connectdata *conn, int sockindex)
{
  struct ssl_connect_data *connssl = &conn->ssl[sockindex];
  Qso_OverlappedIO_t cstat;

  if(QsoCancelOperation(conn->sock[sockindex], 0) > 0)
    QsoWaitForIOCompletion(connssl->iocport, &cstat, (struct timeval *) NULL);
}

static void close_async_handshake(struct ssl_connect_data *connssl)
{
  QsoDestroyIOCompletionPort(connssl->iocport);
  connssl->iocport = -1;
}

static void close_one(struct ssl_connect_data *conn,
                      struct SessionHandle *data)
{
  if(conn->handle) {
    gskit_status(data, gsk_secure_soc_close(&conn->handle),
              "gsk_secure_soc_close()", 0);
    conn->handle = (gsk_handle) NULL;
  }
  if(conn->iocport >= 0)
    close_async_handshake(conn);
}

static ssize_t gskit_send(struct connectdata *conn, int sockindex,
                           const void *mem, size_t len, CURLcode *curlcode)
{
  struct SessionHandle *data = conn->data;
  CURLcode cc;
  int written;

  cc = gskit_status(data,
                    gsk_secure_soc_write(conn->ssl[sockindex].handle,
                                         (char *) mem, (int) len, &written),
                    "gsk_secure_soc_write()", CURLE_SEND_ERROR);
  if(cc != CURLE_OK) {
    *curlcode = cc;
    written = -1;
  }
  return (ssize_t) written; /* number of bytes */
}

static ssize_t gskit_recv(struct connectdata *conn, int num, char *buf,
                           size_t buffersize, CURLcode *curlcode)
{
  struct SessionHandle *data = conn->data;
  int buffsize;
  int nread;
  CURLcode cc;

  buffsize = buffersize > (size_t) INT_MAX? INT_MAX: (int) buffersize;
  cc = gskit_status(data, gsk_secure_soc_read(conn->ssl[num].handle,
                                              buf, buffsize, &nread),
                    "gsk_secure_soc_read()", CURLE_RECV_ERROR);
  if(cc != CURLE_OK) {
    *curlcode = cc;
    nread = -1;
  }
  return (ssize_t) nread;
}

static CURLcode gskit_connect_step1(struct connectdata *conn, int sockindex)
{
  struct SessionHandle *data = conn->data;
  struct ssl_connect_data *connssl = &conn->ssl[sockindex];
  gsk_handle envir;
  CURLcode result;
  int rc;
  char *keyringfile;
  char *keyringpwd;
  char *keyringlabel;
  char *sni;
  unsigned int protoflags;
  long timeout;
  Qso_OverlappedIO_t commarea;

  /* Create SSL environment, start (preferably asynchronous) handshake. */

  connssl->handle = (gsk_handle) NULL;
  connssl->iocport = -1;

  /* GSKit supports two ways of specifying an SSL context: either by
   *  application identifier (that should have been defined at the system
   *  level) or by keyring file, password and certificate label.
   * Local certificate name (CURLOPT_SSLCERT) is used to hold either the
   *  application identifier of the certificate label.
   * Key password (CURLOPT_KEYPASSWD) holds the keyring password.
   * It is not possible to have different keyrings for the CAs and the
   *  local certificate. We thus use the CA file (CURLOPT_CAINFO) to identify
   *  the keyring file.
   * If no key password is given and the keyring is the system keyring,
   *  application identifier mode is tried first, as recommended in IBM doc.
   */

  keyringfile = data->set.str[STRING_SSL_CAFILE];
  keyringpwd = data->set.str[STRING_KEY_PASSWD];
  keyringlabel = data->set.str[STRING_CERT];
  envir = (gsk_handle) NULL;

  if(keyringlabel && *keyringlabel && !keyringpwd &&
      !strcmp(keyringfile, CURL_CA_BUNDLE)) {
    /* Try application identifier mode. */
    init_environment(data, &envir, keyringlabel, (const char *) NULL,
                     (const char *) NULL, (const char *) NULL);
  }

  if(!envir) {
    /* Use keyring mode. */
    result = init_environment(data, &envir, (const char *) NULL,
                              keyringfile, keyringlabel, keyringpwd);
    if(result)
      return result;
  }

  /* Create secure session. */
  result = gskit_status(data, gsk_secure_soc_open(envir, &connssl->handle),
                        "gsk_secure_soc_open()", CURLE_SSL_CONNECT_ERROR);
  gsk_environment_close(&envir);
  if(result)
    return result;

  /* Determine which SSL/TLS version should be enabled. */
  protoflags = CURL_GSKPROTO_TLSV10_MASK | CURL_GSKPROTO_TLSV11_MASK |
               CURL_GSKPROTO_TLSV12_MASK;
  sni = conn->host.name;
  switch (data->set.ssl.version) {
  case CURL_SSLVERSION_SSLv2:
    protoflags = CURL_GSKPROTO_SSLV2_MASK;
    sni = (char *) NULL;
    break;
  case CURL_SSLVERSION_SSLv3:
    protoflags = CURL_GSKPROTO_SSLV3_MASK;
    sni = (char *) NULL;
    break;
  case CURL_SSLVERSION_TLSv1:
    protoflags = CURL_GSKPROTO_TLSV10_MASK |
                 CURL_GSKPROTO_TLSV11_MASK | CURL_GSKPROTO_TLSV12_MASK;
    break;
  case CURL_SSLVERSION_TLSv1_0:
    protoflags = CURL_GSKPROTO_TLSV10_MASK;
    break;
  case CURL_SSLVERSION_TLSv1_1:
    protoflags = CURL_GSKPROTO_TLSV11_MASK;
    break;
  case CURL_SSLVERSION_TLSv1_2:
    protoflags = CURL_GSKPROTO_TLSV12_MASK;
    break;
  }

  /* Process SNI. Ignore if not supported (on OS400 < V7R1). */
  if(sni) {
    result = set_buffer(data, connssl->handle,
                        GSK_SSL_EXTN_SERVERNAME_REQUEST, sni, TRUE);
    if(result == CURLE_UNSUPPORTED_PROTOCOL)
      result = CURLE_OK;
  }

  /* Set session parameters. */
  if(!result) {
    /* Compute the handshake timeout. Since GSKit granularity is 1 second,
       we round up the required value. */
    timeout = Curl_timeleft(data, NULL, TRUE);
    if(timeout < 0)
      result = CURLE_OPERATION_TIMEDOUT;
    else
      result = set_numeric(data, connssl->handle, GSK_HANDSHAKE_TIMEOUT,
                           (timeout + 999) / 1000);
  }
  if(!result)
    result = set_numeric(data, connssl->handle, GSK_FD, conn->sock[sockindex]);
  if(!result)
    result = set_ciphers(data, connssl->handle, &protoflags);
  if(!protoflags) {
    failf(data, "No SSL protocol/cipher combination enabled");
    result = CURLE_SSL_CIPHER;
  }
  if(!result)
    result = set_enum(data, connssl->handle, GSK_PROTOCOL_SSLV2,
                      (protoflags & CURL_GSKPROTO_SSLV2_MASK)?
                      GSK_PROTOCOL_SSLV2_ON: GSK_PROTOCOL_SSLV2_OFF, FALSE);
  if(!result)
    result = set_enum(data, connssl->handle, GSK_PROTOCOL_SSLV3,
                      (protoflags & CURL_GSKPROTO_SSLV3_MASK)?
                      GSK_PROTOCOL_SSLV3_ON: GSK_PROTOCOL_SSLV3_OFF, FALSE);
  if(!result)
    result = set_enum(data, connssl->handle, GSK_PROTOCOL_TLSV1,
                      (protoflags & CURL_GSKPROTO_TLSV10_MASK)?
                      GSK_PROTOCOL_TLSV1_ON: GSK_PROTOCOL_TLSV1_OFF, FALSE);
  if(!result) {
    result = set_enum(data, connssl->handle, GSK_PROTOCOL_TLSV11,
                      (protoflags & CURL_GSKPROTO_TLSV11_MASK)?
                      GSK_TRUE: GSK_FALSE, TRUE);
    if(result == CURLE_UNSUPPORTED_PROTOCOL) {
      result = CURLE_OK;
      if(protoflags == CURL_GSKPROTO_TLSV11_MASK) {
        failf(data, "TLS 1.1 not yet supported");
        result = CURLE_SSL_CIPHER;
      }
    }
  }
  if(!result) {
    result = set_enum(data, connssl->handle, GSK_PROTOCOL_TLSV12,
                      (protoflags & CURL_GSKPROTO_TLSV12_MASK)?
                      GSK_TRUE: GSK_FALSE, TRUE);
    if(result == CURLE_UNSUPPORTED_PROTOCOL) {
      result = CURLE_OK;
      if(protoflags == CURL_GSKPROTO_TLSV12_MASK) {
        failf(data, "TLS 1.2 not yet supported");
        result = CURLE_SSL_CIPHER;
      }
    }
  }
  if(!result)
    result = set_enum(data, connssl->handle, GSK_SERVER_AUTH_TYPE,
                      data->set.ssl.verifypeer? GSK_SERVER_AUTH_FULL:
                      GSK_SERVER_AUTH_PASSTHRU, FALSE);

  if(!result) {
    /* Start handshake. Try asynchronous first. */
    memset(&commarea, 0, sizeof commarea);
    connssl->iocport = QsoCreateIOCompletionPort();
    if(connssl->iocport != -1) {
      result = gskit_status(data,
                            gsk_secure_soc_startInit(connssl->handle,
                                                     connssl->iocport,
                                                     &commarea),
                            "gsk_secure_soc_startInit()",
                            CURLE_SSL_CONNECT_ERROR);
      if(!result) {
        connssl->connecting_state = ssl_connect_2;
        return CURLE_OK;
      }
      else
        close_async_handshake(connssl);
    }
    else if(errno != ENOBUFS)
      result = gskit_status(data, GSK_ERROR_IO,
                            "QsoCreateIOCompletionPort()", 0);
    else {
      /* No more completion port available. Use synchronous IO. */
      result = gskit_status(data, gsk_secure_soc_init(connssl->handle),
                            "gsk_secure_soc_init()", CURLE_SSL_CONNECT_ERROR);
      if(!result) {
        connssl->connecting_state = ssl_connect_3;
        return CURLE_OK;
      }
    }
  }

  /* Error: rollback. */
  close_one(connssl, data);
  return result;
}

static CURLcode gskit_connect_step2(struct connectdata *conn, int sockindex,
                                    bool nonblocking)
{
  struct SessionHandle *data = conn->data;
  struct ssl_connect_data *connssl = &conn->ssl[sockindex];
  Qso_OverlappedIO_t cstat;
  long timeout_ms;
  struct timeval stmv;
  CURLcode result;

  /* Poll or wait for end of SSL asynchronous handshake. */

  for(;;) {
    timeout_ms = nonblocking? 0: Curl_timeleft(data, NULL, TRUE);
    if(timeout_ms < 0)
      timeout_ms = 0;
    stmv.tv_sec = timeout_ms / 1000;
    stmv.tv_usec = (timeout_ms - stmv.tv_sec * 1000) * 1000;
    switch (QsoWaitForIOCompletion(connssl->iocport, &cstat, &stmv)) {
    case 1:             /* Operation complete. */
      break;
    case -1:            /* An error occurred: handshake still in progress. */
      if(errno == EINTR) {
        if(nonblocking)
          return CURLE_OK;
        continue;       /* Retry. */
      }
      if(errno != ETIME) {
        failf(data, "QsoWaitForIOCompletion() I/O error: %s", strerror(errno));
        cancel_async_handshake(conn, sockindex);
        close_async_handshake(connssl);
        return CURLE_SSL_CONNECT_ERROR;
      }
      /* FALL INTO... */
    case 0:             /* Handshake in progress, timeout occurred. */
      if(nonblocking)
        return CURLE_OK;
      cancel_async_handshake(conn, sockindex);
      close_async_handshake(connssl);
      return CURLE_OPERATION_TIMEDOUT;
    }
    break;
  }
  result = gskit_status(data, cstat.returnValue, "SSL handshake",
                        CURLE_SSL_CONNECT_ERROR);
  if(!result)
    connssl->connecting_state = ssl_connect_3;
  close_async_handshake(connssl);
  return result;
}

static CURLcode gskit_connect_step3(struct connectdata *conn, int sockindex)
{
  struct SessionHandle *data = conn->data;
  struct ssl_connect_data *connssl = &conn->ssl[sockindex];
  const gsk_cert_data_elem *cdev;
  int cdec;
  const gsk_cert_data_elem *p;
  const char *cert = (const char *) NULL;
  const char *certend;
  const char *ptr;
  int i;
  CURLcode result;

  /* SSL handshake done: gather certificate info and verify host. */

  if(gskit_status(data, gsk_attribute_get_cert_info(connssl->handle,
                                                    GSK_PARTNER_CERT_INFO,
                                                    &cdev, &cdec),
                  "gsk_attribute_get_cert_info()", CURLE_SSL_CONNECT_ERROR) ==
     CURLE_OK) {
    infof(data, "Server certificate:\n");
    p = cdev;
    for(i = 0; i++ < cdec; p++)
      switch (p->cert_data_id) {
      case CERT_BODY_DER:
        cert = p->cert_data_p;
        certend = cert + cdev->cert_data_l;
        break;
      case CERT_DN_PRINTABLE:
        infof(data, "\t subject: %.*s\n", p->cert_data_l, p->cert_data_p);
        break;
      case CERT_ISSUER_DN_PRINTABLE:
        infof(data, "\t issuer: %.*s\n", p->cert_data_l, p->cert_data_p);
        break;
      case CERT_VALID_FROM:
        infof(data, "\t start date: %.*s\n", p->cert_data_l, p->cert_data_p);
        break;
      case CERT_VALID_TO:
        infof(data, "\t expire date: %.*s\n", p->cert_data_l, p->cert_data_p);
        break;
    }
  }

  /* Verify host. */
  result = Curl_verifyhost(conn, cert, certend);
  if(result)
    return result;

  /* The only place GSKit can get the whole CA chain is a validation
     callback where no user data pointer is available. Therefore it's not
     possible to copy this chain into our structures for CAINFO.
     However the server certificate may be available, thus we can return
     info about it. */
  if(data->set.ssl.certinfo) {
    result = Curl_ssl_init_certinfo(data, 1);
    if(result)
      return result;

    if(cert) {
      result = Curl_extract_certinfo(conn, 0, cert, certend);
      if(result)
        return result;
    }
  }

  /* Check pinned public key. */
  ptr = data->set.str[STRING_SSL_PINNEDPUBLICKEY];
  if(!result && ptr) {
    curl_X509certificate x509;
    curl_asn1Element *p;

    if(!cert)
      return CURLE_SSL_PINNEDPUBKEYNOTMATCH;
    Curl_parseX509(&x509, cert, certend);
    p = &x509.subjectPublicKeyInfo;
    result = Curl_pin_peer_pubkey(ptr, p->header, p->end - p->header);
    if(result) {
      failf(data, "SSL: public key does not match pinned public key!");
      return result;
    }
  }

  connssl->connecting_state = ssl_connect_done;
  return CURLE_OK;
}

static CURLcode gskit_connect_common(struct connectdata *conn, int sockindex,
                                     bool nonblocking, bool *done)
{
  struct SessionHandle *data = conn->data;
  struct ssl_connect_data *connssl = &conn->ssl[sockindex];
  long timeout_ms;
  Qso_OverlappedIO_t cstat;
  CURLcode result = CURLE_OK;

  *done = connssl->state == ssl_connection_complete;
  if(*done)
    return CURLE_OK;

  /* Step 1: create session, start handshake. */
  if(connssl->connecting_state == ssl_connect_1) {
    /* check allowed time left */
    timeout_ms = Curl_timeleft(data, NULL, TRUE);

    if(timeout_ms < 0) {
      /* no need to continue if time already is up */
      failf(data, "SSL connection timeout");
      result = CURLE_OPERATION_TIMEDOUT;
    }
    else
      result = gskit_connect_step1(conn, sockindex);
  }

  /* Step 2: check if handshake is over. */
  if(!result && connssl->connecting_state == ssl_connect_2) {
    /* check allowed time left */
    timeout_ms = Curl_timeleft(data, NULL, TRUE);

    if(timeout_ms < 0) {
      /* no need to continue if time already is up */
      failf(data, "SSL connection timeout");
      result = CURLE_OPERATION_TIMEDOUT;
    }
    else
      result = gskit_connect_step2(conn, sockindex, nonblocking);
  }

  /* Step 3: gather certificate info, verify host. */
  if(!result && connssl->connecting_state == ssl_connect_3)
    result = gskit_connect_step3(conn, sockindex);

  if(result)
    close_one(connssl, data);
  else if(connssl->connecting_state == ssl_connect_done) {
    connssl->state = ssl_connection_complete;
    connssl->connecting_state = ssl_connect_1;
    conn->recv[sockindex] = gskit_recv;
    conn->send[sockindex] = gskit_send;
    *done = TRUE;
  }

  return result;
}

CURLcode Curl_gskit_connect_nonblocking(struct connectdata *conn,
                                        int sockindex,
                                        bool *done)
{
  CURLcode result;

  result = gskit_connect_common(conn, sockindex, TRUE, done);
  if(*done || result)
    conn->ssl[sockindex].connecting_state = ssl_connect_1;
  return result;
}

CURLcode Curl_gskit_connect(struct connectdata *conn, int sockindex)
{
  CURLcode result;
  bool done;

  conn->ssl[sockindex].connecting_state = ssl_connect_1;
  result = gskit_connect_common(conn, sockindex, FALSE, &done);
  if(result)
    return result;

  DEBUGASSERT(done);

  return CURLE_OK;
}

void Curl_gskit_close(struct connectdata *conn, int sockindex)
{
  struct SessionHandle *data = conn->data;
  struct ssl_connect_data *connssl = &conn->ssl[sockindex];

  if(connssl->use)
    close_one(connssl, data);
}

int Curl_gskit_shutdown(struct connectdata *conn, int sockindex)
{
  struct ssl_connect_data *connssl = &conn->ssl[sockindex];
  struct SessionHandle *data = conn->data;
  ssize_t nread;
  int what;
  int rc;
  char buf[120];

  if(!connssl->handle)
    return 0;

  if(data->set.ftp_ccc != CURLFTPSSL_CCC_ACTIVE)
    return 0;

  close_one(connssl, data);
  rc = 0;
  what = Curl_socket_ready(conn->sock[sockindex],
                           CURL_SOCKET_BAD, SSL_SHUTDOWN_TIMEOUT);

  for(;;) {
    if(what < 0) {
      /* anything that gets here is fatally bad */
      failf(data, "select/poll on SSL socket, errno: %d", SOCKERRNO);
      rc = -1;
      break;
    }

    if(!what) {                                /* timeout */
      failf(data, "SSL shutdown timeout");
      break;
    }

    /* Something to read, let's do it and hope that it is the close
       notify alert from the server. No way to gsk_secure_soc_read() now, so
       use read(). */

    nread = read(conn->sock[sockindex], buf, sizeof(buf));

    if(nread < 0) {
      failf(data, "read: %s", strerror(errno));
      rc = -1;
    }

    if(nread <= 0)
      break;

    what = Curl_socket_ready(conn->sock[sockindex], CURL_SOCKET_BAD, 0);
  }

  return rc;
}

size_t Curl_gskit_version(char *buffer, size_t size)
{
  strncpy(buffer, "GSKit", size);
  return strlen(buffer);
}

int Curl_gskit_check_cxn(struct connectdata *cxn)
{
  int err;
  int errlen;

  /* The only thing that can be tested here is at the socket level. */

  if(!cxn->ssl[FIRSTSOCKET].handle)
    return 0; /* connection has been closed */

  err = 0;
  errlen = sizeof err;

  if(getsockopt(cxn->sock[FIRSTSOCKET], SOL_SOCKET, SO_ERROR,
                 (unsigned char *) &err, &errlen) ||
     errlen != sizeof err || err)
    return 0; /* connection has been closed */

  return -1;  /* connection status unknown */
}

#endif /* USE_GSKIT */


text:
#region License

// Distributed under the MIT License
// ============================================================
// Copyright (c) 2019 Hotcakes Commerce, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software
// and associated documentation files (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge, publish, distribute,
// sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#endregion

using Hotcakes.CommerceDTO.v1.Catalog;

namespace Hotcakes.Commerce.Catalog
{
    public class CategorySnapshot
    {
        private string _RewriteUrl = string.Empty;

        public CategorySnapshot()
        {
            Bvin = string.Empty;
            StoreId = 0;
            ParentId = string.Empty;
            Name = string.Empty;
            SourceType = CategorySourceType.Manual;
            ImageUrl = string.Empty;
            CustomPageUrl = string.Empty;
            ShowInTopMenu = false;
            Hidden = false;
            SortOrder = 0;
            MetaTitle = string.Empty;
        }

        public CategorySnapshot(Category cat)
        {
            Bvin = cat.Bvin;
            StoreId = cat.StoreId;
            ParentId = cat.ParentId;
            Name = cat.Name;
            Description = cat.Description;
            SourceType = cat.SourceType;
            ImageUrl = cat.ImageUrl;
            BannerImageUrl = cat.BannerImageUrl;
            CustomPageUrl = cat.CustomPageUrl;
            ShowInTopMenu = cat.ShowInTopMenu;
            Hidden = cat.Hidden;
            SortOrder = cat.SortOrder;
            MetaTitle = cat.MetaTitle;
            RewriteUrl = cat.RewriteUrl;
        }

        /// <summary>
        ///     This is the ID of the category.
        /// </summary>
        public string Bvin { get; set; }

        /// <summary>
        ///     This is the ID of the Hotcakes store. Typically, this is 1, except in multi-tenant environments.
        /// </summary>
        public long StoreId { get; set; }

        /// <summary>
        ///     Having an ID here will make this category a child or nested category of the category that matches this ID. This
        ///     helps to create nested navigation and other features.
        /// </summary>
        public string ParentId { get; set; }

        /// <summary>
        ///     This is the name of the category that the customers will see in their views.
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        ///     If the description exists, it will be placed below the category banner.
        /// </summary>
        public string Description { get; set; }

        /// <summary>
        ///     Allows you to define whether your category is a typical category or a placeholder link to another resource.
        /// </summary>
        /// <remarks>Always use the CategorySourceType enum for this property.</remarks>
        public CategorySourceType SourceType { get; set; }

        /// <summary>
        ///     This is the image of the category that you want associated with it in the various views. It also is used to
        ///     generate the category thumbnail.
        /// </summary>
        public string ImageUrl { get; set; }

        /// <summary>
        ///     If populated with a URL, the specified banner will be displayed in the category header.
        /// </summary>
        public string BannerImageUrl { get; set; }

        /// <summary>
        ///     If populated with a URL, this value will be used as the URL for the category when clicked.
        /// </summary>
        public string CustomPageUrl { get; set; }

        /// <summary>
        ///     If true and if using a category as a custom link, this will cause the link to be opened in a new window when the
        ///     customer clicks on it. This is only used in the CategoryRotator content block.
        /// </summary>
        public bool CustomPageOpenInNewWindow { get; set; }

        /// <summary>
        ///     If true, this category will be shown in the initial list of categories in category lists.
        /// </summary>
        public bool ShowInTopMenu { get; set; }

        /// <summary>
        ///     Except when overridden by a "sort" querystring parameter, this value determines how the products in the category
        ///     will be sorted.
        /// </summary>
        /// <remarks>This needs to be tested. It doesn't appear to be referenced anywhere.</remarks>
        public bool Hidden { get; set; }

        /// <summary>
        ///     This is the slug of the URL, or the last part of the URL to be used to get to this category's landing page. It must
        ///     be unique. If empty, the application will create one based upon the name of the category.
        /// </summary>
        public string RewriteUrl
        {
            get { return _RewriteUrl; }
            set { _RewriteUrl = value.Trim().ToLowerInvariant(); }
        }

        /// <summary>
        ///     Allows you to define how the products in this category will be ordered.
        /// </summary>
        /// <remarks>Always use the CategorySortOrderDTO enum for this property.</remarks>
        public int SortOrder { get; set; }

        /// <summary>
        ///     This title is used to adjust the title in the source code of the category landing page for SEO.
        /// </summary>
        public string MetaTitle { get; set; }

        /// <summary>
        ///     Allows you to convert the current CategorySnapshot object to the DTO equivalent for use with the REST API
        /// </summary>
        /// <returns>A new instance of CategorySnapshotDTO</returns>
        public CategorySnapshotDTO ToDto()
        {
            var dto = new CategorySnapshotDTO();

            dto.Bvin = Bvin;
            dto.CustomPageOpenInNewWindow = CustomPageOpenInNewWindow;
            dto.CustomPageUrl = CustomPageUrl;
            dto.Hidden = Hidden;
            dto.ImageUrl = ImageUrl;
            dto.BannerImageUrl = BannerImageUrl;
            dto.Name = Name;
            dto.Description = Description;
            dto.ParentId = ParentId;
            dto.RewriteUrl = RewriteUrl;
            dto.ShowInTopMenu = ShowInTopMenu;
            dto.SourceType = (CategorySourceTypeDTO) (int) SourceType;
            dto.StoreId = StoreId;
            dto.SortOrder = SortOrder;
            dto.MetaTitle = MetaTitle;
            return dto;
        }
    }
}


text:
//
// Copyright (c) Microsoft.  All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

using Microsoft.Azure.Subscriptions;
using ResourceGroups.Tests;

namespace Microsoft.Azure.Test
{
    using Microsoft.Azure.Management.Resources;
    using Microsoft.Azure.Management.Resources.Models;
    using System;
    using System.Linq;

    public static class ResourcesManagementTestUtilities
    {
        /// <summary>
        /// Default constructor for management clients, using the TestSupport Infrastructure
        /// </summary>
        /// <param name="testBase">the test class</param>
        /// <returns>A resource management client, created from the current context (environment variables)</returns>
        public static ResourceManagementClient GetResourceManagementClient(this TestBase testBase)
        {
            return TestBase.GetServiceClient<ResourceManagementClient>(new CSMTestEnvironmentFactory());
        }

        /// <summary>
        /// Default constructor for management clients, using the TestSupport Infrastructure
        /// </summary>
        /// <param name="handler"></param>
        /// <returns>A resource management client, created from the current context (environment variables)</returns>
        public static ResourceManagementClient GetResourceManagementClientWithHandler(RecordedDelegatingHandler handler)
        {
            handler.IsPassThrough = true;
            return TestBase.GetServiceClient<ResourceManagementClient>(new CSMTestEnvironmentFactory()).WithHandler(handler);
        }

        /// <summary>
        /// Default constructor for management clients, using the TestSupport Infrastructure
        /// </summary>
        /// <param name="testBase">the test class</param>
        /// <returns>A subscription client, created from the current context (environment variables)</returns>
        public static SubscriptionClient GetSubscriptionClient(this TestBase testBase)
        {
            return TestBase.GetServiceClient<SubscriptionClient>(new CSMTestEnvironmentFactory());
        }

        /// <summary>
        /// Get a default resource location for a given resource type
        /// </summary>
        /// <param name="client">The resource management client</param>
        /// <param name="resourceType">The type of resource to create</param>
        /// <returns>A location where this resource type is supported for the current subscription</returns>
        public static string GetResourceLocation(ResourceManagementClient client, string resourceType)
        {
            string location = null;
            string[] parts = resourceType.Split('/');
            string providerName = parts[0];
            var provider = client.Providers.Get(providerName);
            foreach (var resource in provider.Provider.ResourceTypes)
            {
                if (string.Equals(resource.Name, parts[1], StringComparison.OrdinalIgnoreCase))
                {
                    location = resource.Locations.LastOrDefault<string>();
                }
            }

            return location;
        }

        /// <summary>
        /// Equality comparison for locatiosn returned by resource management
        /// </summary>
        /// <param name="expected">The expected location</param>
        /// <param name="actual">The actual location returned by resource management</param>
        /// <returns>true if the locations are equivalent, otherwise false</returns>
        public static bool LocationsAreEqual(string expected, string actual)
        {
            bool result = string.Equals(expected, actual, System.StringComparison.OrdinalIgnoreCase);
            if (!result && !string.IsNullOrEmpty(expected))
            {
                string normalizedLocation = expected.ToLower().Replace(" ", null);
                result = string.Equals(normalizedLocation, actual, StringComparison.OrdinalIgnoreCase);
            }

            return result;
        }

    }
}


text:
namespace DictionaryToExpandoObject
{
    using System.Collections.Generic;
    using System.Dynamic;
    using System.Linq;

    public static class ToExpandoExtension
    {
        public static ExpandoObject ToExpando(this IDictionary<string, object> dictionary) => dictionary.GetKeyValuePairs().ToExpando();

        static ExpandoObject ToExpando(this IEnumerable<KeyValuePair<string, object>> kvps) => new ExpandoObject().AddRange(kvps);

        static IEnumerable<KeyValuePair<string, object>> GetKeyValuePairs(this IDictionary<string, object> dictionary) => dictionary.Select(GetKeyValuePair);

        static KeyValuePair<string, object> GetKeyValuePair(KeyValuePair<string, object> kvp) => KeyValuePair.Create(kvp.Key, kvp.Value.SafelyGetValue());

        static object SafelyGetValue(this object value) => value.TryCast<ICollection<object>>()?.ToCollection() ?? value.SafelyGetExpando();

        static object SafelyGetExpando(this object value) => value.TryCast<IDictionary<string, object>>()?.ToExpando() ?? value;

        static T TryCast<T>(this object obj) where T : class => obj as T;

        static IEnumerable<object> ToCollection(this IEnumerable<object> collection) => collection.Select(SafelyGetExpando);
    }
}


text:
class Integer
  def u
    Influxdb::Arel::Nodes::Duration.new(self, 'u')
  end

  def s
    Influxdb::Arel::Nodes::Duration.new(self, 's')
  end

  def m
    Influxdb::Arel::Nodes::Duration.new(self, 'm')
  end

  def h
    Influxdb::Arel::Nodes::Duration.new(self, 'h')
  end

  def d
    Influxdb::Arel::Nodes::Duration.new(self, 'd')
  end

  def w
    Influxdb::Arel::Nodes::Duration.new(self, 'w')
  end
end

class Object
  def safe_clone
    self.clone
  rescue SecurityError, TypeError => e
    self
  end
end


text:
"use strict";

var assert = require("assert"),
    vows = require("vows");

var types = [
    "accesstoken",
    "activity",
    "alert",
    "application",
    "article",
    "audio",
    "authorizationcode",
    "badge",
    "bearertoken",
    "binary",
    "bookmark",
    "client",
    "collection",
    "comment",
    "confirmation",
    "credentials",
    "device",
    "dialbackrequest",
    "edge",
    "event",
    "favorite",
    "file",
    "game",
    "group",
    "host",
    "image",
    "issue",
    "job",
    "membership",
    "nonce",
    "note",
    "offer",
    "organization",
    "other",
    "page",
    "person",
    "place",
    "process",
    "product",
    "proxy",
    "question",
    "recovery",
    "recentdialbackrequests",
    "remoteaccesstoken",
    "remoterequesttoken",
    "requesttoken",
    "review",
    "service",
    "session",
    "share",
    "stream",
    "streamcount",
    "streamsegment",
    "streamsegmentcount",
    "streamsegments",
    "task",
    "user",
    "usercount",
    "userlist",
    "video"
];

vows.describe("schema module interface").addBatch({
    "When we require the schema module": {
        topic: function() {
            return require("../lib/schema");
        },
        "we get a module": function(schemamodule) {
            assert.isObject(schemamodule);
        },
        "and we get its schema": {
            topic: function(schemamodule) {
                return schemamodule.schema;
            },
            "it exists": function(schema) {
                assert.isObject(schema);
            },
            "it has all the types we expect": function(schema) {
                var i, type;
                for (i = 0; i < types.length; i++) {
                    type = types[i];
                    assert.include(schema, type);
                }
            },
            "it has no types we do not expect": function(schema) {
                var prop;
                for (prop in schema) {
                    if (schema.hasOwnProperty(prop)) {
                        assert.include(types, prop);
                    }
                }
            },
            "all its types are objects": function(schema) {
                var prop;
                for (prop in schema) {
                    if (schema.hasOwnProperty(prop)) {
                        assert.isObject(schema[prop]);
                    }
                }
            },
            "all its types have pkeys": function(schema) {
                var prop;
                for (prop in schema) {
                    if (schema.hasOwnProperty(prop)) {
                        assert.include(schema[prop], "pkey");
                        assert.isString(schema[prop].pkey);
                    }
                }
            }
        }
    }
})["export"](module);


text:
var expect = require('chai').expect;
var mockery = require('mockery');
var sinon = require('sinon');
var requireHelper = require('./util/require_helper');
var conf = requireHelper("util/Config");
var log = requireHelper("util/Logger");
var batchelor;

describe('Batchelor Tests', function () {

    var transport;
    var persistent;

    before(function () {
        mockery.enable({
            warnOnReplace: false,
            warnOnUnregistered: false,
            useCleanCache: true
        });

        transport = {setTransport: sinon.stub(), issueCalls: sinon.stub()};
        persistent = {
            preparePersistentRequests: sinon.stub(),
            persist: sinon.stub(),
            stop: sinon.stub()
        };

        // replace the module `request` with a stub object
        mockery.registerMock('./Transport', transport);
        mockery.registerMock('./Persistent', persistent);
        mockery.registerMock('./util/Logger', log);
        mockery.registerMock('./util/Config', conf);
        batchelor = requireHelper('Batchelor');
    });

    after(function () {
        mockery.disable();
    });

    it('should stop and proxy behaviour to persistent', function () {
        batchelor.stop({
            ids: "id"
        });
        expect(persistent.stop.calledOnce).to.be.true;
        expect(persistent.stop.firstCall.args[0]).to.equal("id");
    });

    it('should configure correctly', function () {
        var counter = 0;
        var newLog = {
            debug: function () {
                counter++;
            },
            info: function () {
                counter++;
            },
            error: function () {
                counter++;
            }
        };
        batchelor.configure({
            log: newLog,
            conf: {
                "maxConcurrentBatches": 10,
                "request": {
                    "method": "POST",
                    "timeout": 10000,
                    "ip": "unknown",
                    "headers": {
                        "some-header": "zzz"
                    },
                    "strictSSL": true,
                    "pool": {
                        "otherConf": "somethingElse"
                    }
                }
            }
        });
        log.debug();
        log.info();
        log.error();
        expect(counter).to.equal(4); //extra log in configure
        var cfg = conf.getConf();
        expect(cfg.maxConcurrentBatches).to.equal(10);
        expect(cfg.request.method).to.equal("POST");
        expect(cfg.request.headers["some-header"]).to.equal("zzz");
        expect(cfg.request.pool.maxSockets).to.equal(200);
        expect(cfg.request.pool.otherConf).to.equal("somethingElse");
        expect(transport.setTransport.calledOnce).to.be.true;

    });

    it('should execute requests correctly', function () {
        var result = {
            REQ1: {
                body: {
                    someBody: 1
                }
            },
            REQ2: {
                body: {
                    myBody: 1
                }
            }
        };
        transport.issueCalls.onFirstCall().yields(null, result);
        var batchId = batchelor.execute([
                {
                    name: "REQ1",
                    url: "htp://www.kojo.com",
                    encoding: "UTF8",
                    method: "GET",
                    retries: 3,
                    mimeType: "application/json",
                    data: "data",
                    persistent: true,
                    timeout: 1000,
                    persistentDelay: 20,
                    stop_persistent_once_change: true
                },
                {
                    name: "REQ2",
                    url: "htp://www.kojo.com",
                    encoding: "UTF8",
                    method: "GET",
                    retries: 3,
                    mimeType: "application/json",
                    data: "data",
                    timeout: 1000
                }],
            function (err, result) {

                expect(result["REQ1"].body.someBody).to.equal(1);
                expect(result["REQ2"].body.myBody).to.equal(1);

            });

        expect(batchId).to.be.a.string;
        expect(persistent.persist.firstCall.args[1]).to.equal(result);

    });

});


text:
'use strict';

module.exports = rtcninja;

// Dependencies.

var browser = require('bowser'),
	debug = require('debug')('rtcninja'),
	debugerror = require('debug')('rtcninja:ERROR'),
	version = require('./version'),
	Adapter = require('./Adapter'),
	RTCPeerConnection = require('./RTCPeerConnection'),

	// Internal vars.
	called = false;

debugerror.log = console.warn.bind(console);
debug('version %s', version);
debug('detected browser: %s %s [mobile:%s, tablet:%s, android:%s, ios:%s]',
		browser.name, browser.version, !!browser.mobile, !!browser.tablet,
		!!browser.android, !!browser.ios);

// Constructor.

function rtcninja(options) {
	// Load adapter
	var iface = Adapter(options || {});  // jshint ignore:line

	called = true;

	// Expose RTCPeerConnection class.
	rtcninja.RTCPeerConnection = RTCPeerConnection;

	// Expose WebRTC API and utils.
	rtcninja.getUserMedia = iface.getUserMedia;
	rtcninja.RTCSessionDescription = iface.RTCSessionDescription;
	rtcninja.RTCIceCandidate = iface.RTCIceCandidate;
	rtcninja.MediaStreamTrack = iface.MediaStreamTrack;
	rtcninja.getMediaDevices = iface.getMediaDevices;
	rtcninja.attachMediaStream = iface.attachMediaStream;
	rtcninja.closeMediaStream = iface.closeMediaStream;
	rtcninja.canRenegotiate = iface.canRenegotiate;

	// Log WebRTC support.
	if (iface.hasWebRTC()) {
		debug('WebRTC supported');
		return true;
	} else {
		debugerror('WebRTC not supported');
		return false;
	}
}

// Public API.

// If called without calling rtcninja(), call it.
rtcninja.hasWebRTC = function () {
	if (!called) {
		rtcninja();
	}

	return Adapter.hasWebRTC();
};

// Expose version property.
Object.defineProperty(rtcninja, 'version', {
	get: function () {
		return version;
	}
});

// Expose called property.
Object.defineProperty(rtcninja, 'called', {
	get: function () {
		return called;
	}
});

// Exposing stuff.

rtcninja.debug = require('debug');
rtcninja.browser = browser;


text:
Featured

                <input type="text" [(ngModel)]="searchCollectionId" />
                <input type="submit" value="Search" (click)="searchColletion()" />

                <tc-collection-card [collection]="collection" [sortable]="false"></tc-collection-card>
                <input type="checkbox" [(ngModel)]="collection.isFeatured" />isFeatured
                <input type="checkbox" [(ngModel)]="collection.isOnDiscover" />isOnDiscover
                <input type="submit" value="Update" (click)="updateCollection()" />
                <input type="submit" value="Search an other" (click)="searchAnother()" />