master 575720854de4 cached
160 files
1.4 MB
367.4k tokens
1361 symbols
1 requests
Download .txt
Showing preview only (1,526K chars total). Download the full file or copy to clipboard to get everything.
Repository: facebookarchive/augmented-traffic-control
Branch: master
Commit: 575720854de4
Files: 160
Total size: 1.4 MB

Directory structure:
gitextract_y89j86nr/

├── .coveragerc
├── .github/
│   └── ISSUE_TEMPLATE.md
├── .gitignore
├── .pep8
├── .rubocop.yml
├── .travis.yml
├── CHANGELOG.md
├── CONTRIBUTING.md
├── CONTRIBUTORS.md
├── LICENSE
├── Makefile
├── PATENTS
├── README.md
├── Setup.md
├── atc/
│   ├── atc_thrift/
│   │   ├── MANIFEST.in
│   │   ├── Makefile
│   │   ├── README.md
│   │   ├── __init__.py
│   │   ├── atc_thrift/
│   │   │   ├── Atcd-remote
│   │   │   ├── Atcd.py
│   │   │   ├── __init__.py
│   │   │   ├── constants.py
│   │   │   └── ttypes.py
│   │   ├── atc_thrift.thrift
│   │   ├── setup.cfg
│   │   └── setup.py
│   ├── atcd/
│   │   ├── MANIFEST.in
│   │   ├── README.md
│   │   ├── atcd/
│   │   │   ├── AtcdDBQueueTask.py
│   │   │   ├── AtcdDeviceTimeoutTask.py
│   │   │   ├── AtcdThriftHandlerTask.py
│   │   │   ├── AtcdVService.py
│   │   │   ├── __init__.py
│   │   │   ├── access_manager.py
│   │   │   ├── backends/
│   │   │   │   ├── __init__.py
│   │   │   │   └── linux.py
│   │   │   ├── db_manager.py
│   │   │   ├── idmanager.py
│   │   │   ├── scripts/
│   │   │   │   ├── __init__.py
│   │   │   │   └── runner.py
│   │   │   └── tools/
│   │   │       └── test_secure_access.py
│   │   ├── bin/
│   │   │   └── atcd
│   │   ├── requirements/
│   │   │   └── requirements-testing.txt
│   │   ├── requirements.txt
│   │   ├── setup.cfg
│   │   ├── setup.py
│   │   └── tests/
│   │       ├── idmanager_test.py
│   │       ├── test_AtcdDBQueueTask.py
│   │       ├── test_AtcdThriftHandlerTask.py
│   │       ├── test_AtcdVService.py
│   │       ├── test_access_manager.py
│   │       └── test_sqlite_manager.py
│   ├── django-atc-api/
│   │   ├── MANIFEST.in
│   │   ├── README.md
│   │   ├── atc_api/
│   │   │   ├── __init__.py
│   │   │   ├── atcd_client.py
│   │   │   ├── serializers.py
│   │   │   ├── settings.py
│   │   │   ├── static/
│   │   │   │   └── js/
│   │   │   │       └── atc-api.js
│   │   │   ├── urls.py
│   │   │   ├── utils.py
│   │   │   └── views.py
│   │   ├── setup.cfg
│   │   └── setup.py
│   ├── django-atc-demo-ui/
│   │   ├── MANIFEST.in
│   │   ├── README.md
│   │   ├── atc_demo_ui/
│   │   │   ├── __init__.py
│   │   │   ├── settings.py
│   │   │   ├── static/
│   │   │   │   ├── css/
│   │   │   │   │   └── atc.css
│   │   │   │   ├── js/
│   │   │   │   │   ├── atc-auth.js
│   │   │   │   │   ├── atc-profiles.js
│   │   │   │   │   ├── atc-shaping.js
│   │   │   │   │   ├── atc-utils.js
│   │   │   │   │   └── atc.js
│   │   │   │   └── vendor/
│   │   │   │       └── react/
│   │   │   │           ├── JSXTransformer-0.13.3.js
│   │   │   │           └── react-0.13.3.js
│   │   │   ├── templates/
│   │   │   │   └── atc_demo_ui/
│   │   │   │       ├── base.html
│   │   │   │       ├── index.html
│   │   │   │       └── shaping_settings.html
│   │   │   ├── urls.py
│   │   │   └── views.py
│   │   ├── requirements.txt
│   │   ├── setup.cfg
│   │   └── setup.py
│   └── django-atc-profile-storage/
│       ├── MANIFEST.in
│       ├── README.md
│       ├── atc_profile_storage/
│       │   ├── __init__.py
│       │   ├── migrations/
│       │   │   ├── 0001_initial.py
│       │   │   └── __init__.py
│       │   ├── models.py
│       │   ├── serializers.py
│       │   ├── static/
│       │   │   └── js/
│       │   │       └── atc-profile-storage.js
│       │   ├── urls.py
│       │   └── views.py
│       ├── setup.cfg
│       └── setup.py
├── chef/
│   ├── atc/
│   │   ├── .gitignore
│   │   ├── .kitchen.yml
│   │   ├── Berksfile
│   │   ├── Gemfile
│   │   ├── LICENSE
│   │   ├── README.md
│   │   ├── Thorfile
│   │   ├── Vagrantfile
│   │   ├── attributes/
│   │   │   └── default.rb
│   │   ├── chefignore
│   │   ├── files/
│   │   │   └── default/
│   │   │       └── init.d/
│   │   │           ├── atcd.debian
│   │   │           └── atcd.rhel
│   │   ├── genymotion.sh
│   │   ├── libraries/
│   │   │   └── default.rb
│   │   ├── metadata.rb
│   │   ├── providers/
│   │   │   ├── install_packages.rb
│   │   │   └── install_virtualenv_packages.rb
│   │   ├── recipes/
│   │   │   ├── _common_system.rb
│   │   │   ├── _virtualenv.rb
│   │   │   ├── atcd.rb
│   │   │   ├── atcui.rb
│   │   │   └── default.rb
│   │   ├── resources/
│   │   │   ├── install_packages.rb
│   │   │   └── install_virtualenv_packages.rb
│   │   └── templates/
│   │       └── default/
│   │           ├── atcui-setup.erb
│   │           ├── config/
│   │           │   ├── atcd.erb
│   │           │   └── atcui.erb
│   │           ├── django/
│   │           │   ├── settings.py.erb
│   │           │   └── urls.py.erb
│   │           ├── mount-udev.rules.erb
│   │           └── upstart/
│   │               └── atcui.conf.erb
│   └── atcclient/
│       ├── .gitignore
│       ├── Berksfile
│       ├── Gemfile
│       ├── LICENSE
│       ├── README.md
│       ├── Thorfile
│       ├── Vagrantfile
│       ├── chefignore
│       ├── libraries/
│       │   └── patch.rb
│       ├── metadata.rb
│       └── recipes/
│           └── default.rb
├── tests/
│   ├── Vagrantfile
│   ├── __init__.py
│   ├── host.py
│   ├── local-test.py
│   ├── provision.sh
│   ├── speed.py
│   ├── tests.py
│   ├── vagrant.py
│   └── vms.py
├── tox.ini
└── utils/
    ├── dump_system_info.sh
    ├── profiles/
    │   ├── 2G-DevelopingRural.json
    │   ├── 2G-DevelopingUrban.json
    │   ├── 3G-Average.json
    │   ├── 3G-Good.json
    │   ├── Cable.json
    │   ├── DSL.json
    │   ├── Edge-Average.json
    │   ├── Edge-Good.json
    │   ├── Edge-Lossy.json
    │   └── NoConnectivity.json
    └── restore-profiles.sh

================================================
FILE CONTENTS
================================================

================================================
FILE: .coveragerc
================================================
[run]
branch = True
omit =
  atc/atcd/tests/*
  # files generated by thrift
  atc/atc_thrift/atc_thrift/*
  # chef files
  chef/*/*



================================================
FILE: .github/ISSUE_TEMPLATE.md
================================================
<!--
If you are filling an issue, please provide the information below, if this is not a bug and just a question, you can skip it.

---------------------------------------------------
BUG REPORT INFORMATION
---------------------------------------------------
Here are a few questions that will help us get a better understanding of your setup. Please take a minute to answer them, this will avoid some back and forth communication by providing some context to us.
-->
**Meeting the requirements:**
**ATC** has a few requirements, this section is used to make sure the requirements are met. Until you can check all the boxes, **ATC** will not work on your system.
- [ ] `atcd` runs on Linux
- [ ] `atcd` has 2 physical interfaces
 - [ ] 1 that connects to the internet (WAN)
 - [ ] 1 that connects to the local network (LAN)
- [ ] the traffic from the devices that are being shaped is routed through `atcd`
- [ ] `atcd` sees the real IP of the devices (e.g there is no **NAT** on the LAN segment)

**Checking for special atcd options:**

In some cases, `atcd` default configuration may not be suitable for your system. Use:
```
atcd -h
```
do change those default to suit your setup.
For instance, if your lan interface is `wlan0`, you should start `atcd` using:
```
atcd --atcd-lan wlan0
```

**Steps to reproduce the issue:**
1.
2.
3.


**Describe the results you received:**


**Describe the results you expected:**



**Any additional information that you think is important:**


**Dumping system info:**

While this may not be required in many cases, providing the following information will help us better understand your setup.

**NOTE**: before putting the output on gist, please check its content is fine to be publically available

Run https://github.com/facebook/augmented-traffic-control/blob/master/utils/dump_system_info.sh and upload the content of the logs to [https://gist.github.com/](gist)

```
curl https://raw.githubusercontent.com/facebook/augmented-traffic-control/master/utils/dump_system_info.sh | bash -s -
```

This default to using `eth0` and `eth1` for `wan` and `lan` respectively. If you are using other interfaces (let say eth0 and wlan0 respectively), use:
```
curl https://raw.githubusercontent.com/facebook/augmented-traffic-control/master/utils/dump_system_info.sh | bash -s -  eth0 wlan0
```


================================================
FILE: .gitignore
================================================
*.log
*.pot
*.pyc
*.sqlite3
local_settings.py
*.swp
*.swo
external/
collected_static/
.vagrant
.DS_Store
Makefile.in
aclocal.m4
autom4te.cache/
build-aux/
config.h
config.h.in
config.status
configure
libtool
m4/
.deps/
.libs/
**/build/
**/dist/
*.egg-info
*.lo
*.o
*.la
stamp-h1
check_atc
check_atc.trs
*.cap
*.har
pcap2har/
internal
.coverage
.kitchen/


================================================
FILE: .pep8
================================================
[pep8]
exclude = migrations,*/atc_thrift/


================================================
FILE: .rubocop.yml
================================================
AllCops:
    Exclude:
        - '**/Berksfile'
        - '**/Vagrantfile'
        - '**/metadata.rb'
Style/HashSyntax:
    Enabled: false


================================================
FILE: .travis.yml
================================================
sudo: false
language: python
python:
    - "2.7"
install:
    - pip install flake8
    - pip install pep8
    - pip install atc/atc_thrift/ atc/atcd/ atc/django-atc-api/ atc/django-atc-demo-ui/ atc/django-atc-profile-storage/
    - pip install -r atc/atcd/requirements/requirements-testing.txt
script:
    - make python_lint
    - py.test atc/atcd/tests


================================================
FILE: CHANGELOG.md
================================================
# Changelog

* 0.1.6
    * Suport for Django 1.10 #296

* 0.1.5
    * Fix handling of POSTed profiles. #287

* 0.1.4
    * Bump django to 1.9 and django-bootstrap-themes to 3.3.6
    * Fix chef run on Ubuntu

* 0.1.3
    * Support Django rest framework 3.2

* 0.1.2
    * Fixes:
        * Better detection of logging subsystem and don't fail if /dev/log does not exist
        * Regenerating thrift files was overriding package version #107
        * Fixes the UI to run in older browsers
    * Featues:
        * UI improvements
        * Added remote controlling functionality to the UI
        * Added a set of sample profiles #56
        * Created a dockerized instance of ATC
        * Added --atcd-dont-drop-packets flag to not drop packets when going beyond the max bandwidth. Packets will be buffered instead.
    * Misc:
        * More unittest
        * More documentation fixes
        * Shape test util
        * Script to dump system config for troubleshooting purpose
        * Code refactoring
        * Updated to React 0.13.3

* 0.1.1
    * Fixes:
        * Fix profile creation in Firefox #59
        * Fix installing packages through pip when wheel is not used #77
    * Misc:
        * Added some unittest
        * Build and test PR on Travis
        * Bunch of typo fixes
        * More documentation

* 0.1.0
    * Initial Release


================================================
FILE: CONTRIBUTING.md
================================================
# Contributing to Augmented Traffic Control
We want to make contributing to this project as easy and transparent as
possible.

## Our Development Process

Augmented Traffic Control is maintained and developed on github. It is designed to be
easily extensible and contain API that can be reused by external services/frontends.

Send us your pull requests, and we'd be happy to provide feedback and merge
as appropriate.

## Pull Requests
We actively welcome your pull requests.
1. Fork the repo and create your branch from `master`.
2. If you've added code that should be tested, add tests
3. If you've changed APIs, update the documentation.
4. Make sure your code lints (e.g., pyflakes, PEP8, etc).46. If you haven't already, complete the Contributor License Agreement ("CLA").
5. If you haven't already, complete the Contributor License Agreement ("CLA").

## Contributor License Agreement ("CLA")
In order to accept your pull request, we need you to submit a CLA. You only need
to do this once to work on any of Facebook's open source projects.

Complete your CLA here: <https://code.facebook.com/cla>

## Issues
We use GitHub issues to track public bugs. Please ensure your description is
clear and has sufficient instructions to be able to reproduce the issue.

Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe
disclosure of security bugs. In those cases, please go through the process
outlined on that page and do not file a public issue.

## Coding Style
* PEP-8 compliant
* 80 character line length
* General pyFlakes compliance (e.g., no * imports)

## License
By contributing to Augmented Traffic Control, you agree that your contributions will be licensed
under its BSD license.


================================================
FILE: CONTRIBUTORS.md
================================================
* Alessandro Salvatori
* Ameesh Goyal
* Andrew Pope
* Anthony Gargiulo
* Chris Vander Mey
* Emmanuel Bretelle
* Gus Luxton
* John Morrow
* Patrick Shuff
* Zeal Jagannatha


================================================
FILE: LICENSE
================================================
BSD License

For Augmented Traffic Control software

Copyright (c) 2014-present, Facebook, Inc. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

 * 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.

 * Neither the name Facebook nor the names of its contributors may be used to
   endorse or promote products derived from this software without specific
   prior written permission.

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.


================================================
FILE: Makefile
================================================
#
#  Copyright (c) 2014, Facebook, Inc.
#  All rights reserved.
#
#  This source code is licensed under the BSD-style license found in the
#  LICENSE file in the root directory of this source tree. An additional grant
#  of patent rights can be found in the PATENTS file in the same directory.
#


# Vagrant names used for testing.
# Described fully in `tests/Vagrantfile`.
TESTVMS = gateway client server

FLAKE=python -m flake8
PEP=pep8


# By default, we just lint since we want this to be **fast**.
# In the future when unit testing becomes better this should run quick tests.
.PHONY: default
default: lint


# Do all the things!
.PHONY: all
all: lint fulltest


# Install packages locally.
.PHONY: install
install:
	cd atc/atc_thrift && pip install --upgrade --force-reinstall .
	cd atc/atcd && pip install --upgrade --force-reinstall .
	cd atc/django-atc-api && pip install --upgrade --force-reinstall .
	cd atc/django-atc-demo-ui && pip install --upgrade --force-reinstall .
	cd atc/django-atc-profile-storage && pip install --upgrade --force-reinstall .


# Publish packages to PyPi.
.PHONY: publish
publish:
	cd atc/atc_thrift && python setup.py publish
	cd atc/atcd && python setup.py publish
	cd atc/django-atc-api && python setup.py publish
	cd atc/django-atc-demo-ui && python setup.py publish
	cd atc/django-atc-profile-storage && python setup.py publish


# Cleans up python dist files
.PHONY: clean
clean:
	rm -rf atc/{atcd,atc_thrift,django-atc-api,django-atc-demo-ui,django-atc-profile-storage}/{build,dist}


# Lint the various sources that ATC includes:
#  chef/  - chef cookbooks
#  atc/   - ATC source code
#  tests/ - ATC test code
.PHONY: lint
lint: chef_lint python_lint

.PHONY: chef_lint
chef_lint:
	rubocop chef/atc
	foodcritic chef/atc

.PHONY: python_lint
python_lint:
	$(PEP) atc
	$(FLAKE) atc
	$(FLAKE) tests/


# Performs setup, runs the tests, then cleans up.
# Should be used for automated testing.
.PHONY: fulltest
fulltest: testvup test testvdown


# Runs the ATC test suite.
# This can be run manually for quick testing.
# Requires that the test VMs have been created by `testvup`
.PHONY: test
test:
	nosetests -s tests/


# Creates vagrant VMs for testing.
.PHONY: testvup
testvup:
	cd tests/ && vagrant up ${TESTVMS}


# Tears down vagrant VMs.
.PHONY: testvdown
testvdown:
	cd tests/ && vagrant destroy -f ${TESTVMS}


================================================
FILE: PATENTS
================================================
Additional Grant of Patent Rights Version 2

"Software" means the Augmented Traffic Control software distributed by Facebook, Inc.

Facebook, Inc. ("Facebook") hereby grants to each recipient of the Software
("you") a perpetual, worldwide, royalty-free, non-exclusive, irrevocable
(subject to the termination provision below) license under any Necessary
Claims, to make, have made, use, sell, offer to sell, import, and otherwise
transfer the Software. For avoidance of doubt, no license is granted under
Facebook’s rights in any patent claims that are infringed by (i) modifications
to the Software made by you or any third party or (ii) the Software in
combination with any software or other technology.

The license granted hereunder will terminate, automatically and without notice,
if you (or any of your subsidiaries, corporate affiliates or agents) initiate
directly or indirectly, or take a direct financial interest in, any Patent
Assertion: (i) against Facebook or any of its subsidiaries or corporate
affiliates, (ii) against any party if such Patent Assertion arises in whole or
in part from any software, technology, product or service of Facebook or any of
its subsidiaries or corporate affiliates, or (iii) against any party relating
to the Software. Notwithstanding the foregoing, if Facebook or any of its
subsidiaries or corporate affiliates files a lawsuit alleging patent
infringement against you in the first instance, and you respond by filing a
patent infringement counterclaim in that lawsuit against that party that is
unrelated to the Software, the license granted hereunder will not terminate
under section (i) of this paragraph due to such counterclaim.

A "Necessary Claim" is a claim of a patent owned by Facebook that is
necessarily infringed by the Software standing alone.

A "Patent Assertion" is any lawsuit or other action alleging direct, indirect,
or contributory infringement or inducement to infringe any patent, including a
cross-claim or counterclaim.


================================================
FILE: README.md
================================================
# Augmented Traffic Control

[![build-status-image]][travis]
[![pypi-version]][pypi]


Full documentation for the project is available at [http://facebook.github.io/augmented-traffic-control/](http://facebook.github.io/augmented-traffic-control/).

## Overview

Augmented Traffic Control (ATC) is a tool to simulate network conditions. It allows controlling the connection that a device has to the internet. Developers can use `ATC` to test their application across varying network conditions, easily emulating high speed, mobile, and even severely impaired networks.
Aspects of the connection that can be controlled include:

* bandwidth
* latency
* packet loss
* corrupted packets
* packets ordering

In order to be able to shape the network traffic, ATC must be running on a device that routes the traffic and sees the real IP address of the device, like your network gateway for instance. This also allows any devices that route through `ATC` to be able to shape their traffic. Traffic can be shaped/unshaped using a web interface allowing any devices with a web browser to use `ATC` without the need for a client application.

ATC is made of multiple components that interact together:
* [`atcd`](atc/atcd): The ATC daemon which is responsible for setting/unsetting traffic shaping. `atcd` exposes a [Thrift](https://thrift.apache.org/) interface to interact with it.
* [`django-atc-api`](atc/django-atc-api): A [Django](https://www.djangoproject.com/) app based on [Django Rest Framework](http://www.django-rest-framework.org/) that provides a RESTful interface to `atcd`.
* [`django-atc-demo-ui`](atc/django-atc-demo-ui): A Django app that provides a simple Web UI to use `atc` from a mobile phone.
* [`django-atc-profile-storage`](atc/django-atc-profile-storage): A Django app that can be used to save shaping profiles, making it easier to re-use them later without manually re-entering those settings.

By splitting `ATC` in sub-components, it make it easier to hack on it or build on top of it. While `django-atc-demo-ui` is shipped as part of `ATC`'s main repository to allow people to be able to use `ATC` out of the box, by providing a REST API to `atcd`, it makes it relatively easy to interact with `atcd` via the command line and opens the path for the community to be able to build creative command line tools, web UI or mobile apps that interact with `ATC`.

![ATC architecture][atc_architecture]

## Requirements

Most requirements are handled automatically by [pip](https://pip.pypa.io), the packaging system used by ATC, and each `ATC` package may have different requirements and the README.md files of the respective packages should be checked for more details. Anyhow, some requirements apply to the overall codebase:

* Python 2.7: Currently, ATC is only supported on python version 2.7.
* Django 1.10: Currently, ATC is only supported using django version 1.10.


## Installing ATC

The fact that `ATC` is splitted in multiple packages allows for multiple deployment scenarii. However, deploying all the packages on the same host is the simplest and most likely fitting most use cases.

To get more details on how to install/configure each packages, please refer to the packages' respective READMEs.

### Packages

The easiest way to install `ATC` is by using `pip`.
``` bash
pip install atc_thrift atcd django-atc-api django-atc-demo-ui django-atc-profile-storage
```

### Django

Now that we have all the packages installed, we need to create a new Django project in which we will use our Django app.

``` bash
django-admin startproject atcui
cd atcui
```

Now that we have our django project, we need to configure it to use our apps and we need to tell it how to route to our apps.

Open `atcui/settings.py` and enable the `ATC` apps by adding to `INSTALLED_APPS`:

``` python
INSTALLED_APPS = (
    ...
    # Django ATC API
    'rest_framework',
    'atc_api',
    # Django ATC Demo UI
    'bootstrap_themes',
    'django_static_jquery',
    'atc_demo_ui',
    # Django ATC Profile Storage
    'atc_profile_storage',
)
```

Now, open `atcui/urls.py` and enable routing to the `ATC` apps by adding the routes to `urlpatterns`:
``` python
...
...
from django.views.generic.base import RedirectView
from django.conf.urls import include

urlpatterns = [
    ...
    # Django ATC API
    url(r'^api/v1/', include('atc_api.urls')),
    # Django ATC Demo UI
    url(r'^atc_demo_ui/', include('atc_demo_ui.urls')),
    # Django ATC profile storage
    url(r'^api/v1/profiles/', include('atc_profile_storage.urls')),
    url(r'^$', RedirectView.as_view(url='/atc_demo_ui/', permanent=False)),
]
```

Finally, let's update the Django DB:
``` bash
python manage.py migrate
```

## Running ATC

All require packages should now be installed and configured. We now need to run the daemon and the UI interface. While we will run `ATC` straight from the command line in this example, you can refer to example [sysvinit](chef/atc/files/default/init.d) and [upstart](chef/atc/templates/default/upstart) scripts.

### atcd

`atcd` modifies network related settings and as such needs to run in privileged mode:

``` bash
sudo atcd
```
Supposing `eth0` is your interface to connect to the internet and `eth1`, your interface to connect to your lan, this should just work. If your setting is slightly different, use the command line arguments `--atcd-wan` and `--atcd-lan` to adapt to your configuration.

### ATC UI

The UI on the other hand is a standard Django Web app and can be run as a normal user. Make sure you are in the directory that was created when you ran `django-admin startproject atcui` and run:

``` bash
python manage.py runserver 0.0.0.0:8000
```

You should now be able to access the web UI at http://localhost:8000

## ATC Code Structure

ATC source code is available under the [atc](atc/) directory, it is currently composed of:

* [atc_thrift](atc/atc_thrift) the thrift interface's library
* [atcd](atc/atcd) the ATC daemon that runs on the router doing the traffic shaping
* [django-atc-api](atc/django-atc-api) A django app that provides a RESTful interface to `atcd`
* [django-atc-demo-ui](atc/django-atc-demo-ui) A django app that provides a simple demo UI leveraging the RESTful API
* [django-atc-profile-storage](atc/django-atc-profile-storage) A django app that allows saving shaping profiles to DB allowing users to select their favorite profile from a list instead of re-entering all the profile details every time.


The [chef](chef/) directory contains 2 chef cookbooks:

* [atc](chef/atc/) A cookbook to deploy ATC. It also allows to deploy ATC in a Virtual Box VM in order to develop on ATC.
* [atclient](chef/atcclient) Set up a Linux Desktop VM that can be used to test shaping end to end.

### atcd

`atcd` is the daemon that runs on the router that does the shaping. Interaction with the daemon is done using [thrift](https://thrift.apache.org/). The interface definition can be found in [atc_thrift.thrift](atc/atc_thrift/atc_thrift.thrift).

### atc_thrift

`atc_thrift` defines the thrift interface to communicate with the `atcd` daemon.

### django-atc-api

`django-atc-api` is a django app that provide a REST API to the `atcd` daemon. Web applications, command line tools can use the API in order to shape/unshape traffic.

### django-atc-demo-ui

`django-atc-demo-ui` is a simple Web UI to enable/disable traffic shaping. The UI is mostly written in [React](http://facebook.github.io/react/)

### django-atc-profile-storage

`django-atc-profile-storage` allows saving profiles to DB. A typical use case will be to save a list of predefined/often used shaping settings that you want to be able to accessing in just a few clicks/taps.

## Developing on ATC

To make ATC development easier, we use Virtual Box and Vagrant to provision and run a VM that will run the ATC daemon and the ATC UI from your git checkout.

Interacting with ATC will only shape the traffic within the VM and not on the host.

### Setting up the environment

Note: vagrant is an easy way to set up a test environment, but virtualization will produce different results than a setup on bare-metal. We recommend using vagrant only for testing/development and using bare-metal for setups which require realistic shaping settings.

You will need to install VirtualBox, Vagrant and a couple of plugins:

* [VirtualBox](https://www.virtualbox.org/wiki/Downloads)
* [Vagrant](https://www.vagrantup.com/downloads.html)
* [Chef DK](https://downloads.chef.io/chef-dk/)
* Install some vagrant plugins:
 * vagrant plugin install vagrant-berkshelf --plugin-version '>= 2.0.1'
 * vagrant plugin install vagrant-omnibus
* Clone this repo: git clone git@github.com:facebook/augmented-traffic-control.git atc

### Running ATC

Once in the repo, go to the `chef/atc` directory and run:

``` bash
vagrant up trusty
```

This will take some time before it completes, once the VM is provision, SSH into it:

``` bash
vagrant ssh trusty
```

You should now be able to access ATC at: http://localhost:8080/

### Using the Sample Profiles

Once you've got ATC up and running, you can run the script `utils/restore-profiles.sh` to setup the set of default profiles.

The script needs to be passed a `hostname:port` with the location of your ATC instance:

    utils/restore-profiles.sh localhost:8080

After doing this, you should see the 10 sample profiles listed below in your ATC instance:

- `2G - Developing Rural`
- `2G - Developing Urban`
- `3G - Average`
- `3G - Good`
- `Cable`
- `DSL`
- `Edge - Average`
- `Edge - Good`
- `Edge - Lossy`
- `No Connectivity`

Naturally, you cannot improve your natural network speed by selecting a faster profile than your service. For example, selecting the `Cable` profile will not make your network faster if your natural connection speed resembles DSL more closely.

### Hacking on the code

Hacking on ATC is done from the host and tested in the VM. In order to reflect the changes, you will need to start the services manually.

Both `atcd` and `atcui` have their python libraries installed in a *python virtualenv* so you will need to activate the environment in order to be able to run the services.

The *virtualenv* is installed in */usr/local/atc/venv/bin/activate* .

``` bash
source /usr/local/atc/venv/bin/activate
```

#### Running the daemon

The `atcd` daemon is running under the root user privileges, all operations below needs to be done as root.

To run the daemon manually, first make sure it is not running in the background:

``` bash
service atcd stop
```

And run the daemon:

``` bash
atcd
```

Once you are happy with your changes and you want to test them, you will need to kill the daemon and restart it in order to apply the changes.

#### Running the API/UI

This is a django project and, when running the django built-in HTTP server, will detect code changes and reload automatically.

To run the HTTP REST API and UI:

``` bash
cd /var/django && python manage.py runserver 0.0.0.0:8000
```

[atc_architecture]: https://facebook.github.io/augmented-traffic-control/images/atc_overview.png
[build-status-image]: https://travis-ci.org/facebook/augmented-traffic-control.svg?branch=master
[travis]: https://travis-ci.org/facebook/augmented-traffic-control?branch=master
[pypi-version]: https://pypip.in/version/atcd/badge.svg
[pypi]: https://pypi.python.org/pypi/atcd



================================================
FILE: Setup.md
================================================
Setup
========

Requirements
--------

### Linux

`ATC` makes use of [`iproute2`](http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2) which is only
supported on platforms running a linux kernel.

### Network Gateway

`ATC` is intended to be deployed to a network gateway. Normally this would mean that the machine `ATC` runs on would
require **2 network interfaces**, one for WAN and one for LAN. However it is possible to simulate this setup by making
use of more advanced [virtual interfaces](https://wiki.archlinux.org/index.php/VLAN) and routing options on the host.

### `python 2.7` and `pip`

`ATC` requires `python 2.7` to work correctly, complete with `pip`. 

### virtualenv

Although not strictly required, use of a [virtualenv](https://virtualenv.pypa.io/en/latest/) is recommended.

To setup a new virtualenv in `~/atc/venv`:

```shell
mkdir -p ~/atc
virtualenv ~/atc/venv
source ~/atc/venv/bin/activate
```

On production environments, you probably want to put your atc installation somewhere besides
`~/atc`.

ATC Daemon
--------

Installation:

```shell
pip install atcd
```

Running `atcd` (as root):

```shell
atcd --atcd-lan eth0 --atcd-wan eth1
```

ATC Interface
--------

Install the ATC API and UI packages:

```shell
pip install django-atc-api django-atc-demo-ui django-atc-profile-storage
```

### Django Webapp Setup

ATC's Interfaces are written with [Django](https://www.djangoproject.com/), so they require a
`django` webapp to work correctly.

To create and setup this webapp you will need the `django` python package:

```shell
pip install django
```

To create a new Django webapp:

```shell
cd ~/atc
django-admin startproject atcui
```

Once you have a django webapp setup, you can enable the ATC apps by adding them to the `INSTALLED_APPS` list in
django's `settings.py`:

```python
INSTALLED_APPS = (
    ...
    # Django ATC API
    'rest_framework',
    'atc_api',
    # Django ATC Demo UI
    'bootstrap_themes',
    'django_static_jquery',
    'atc_demo_ui',
    # Django ATC Profile Storage
    'atc_profile_storage',
)
```

Once this is done, you can add the ATC urls to the django webapp's `urls.py`:

```python
from django.views.generic.base import RedirectView

...

urlpatterns = patterns('',
    ...
    # Django ATC API
    url(r'^api/v1/', include('atc_api.urls')),
    # Django ATC Demo UI
    url(r'^atc_demo_ui/', include('atc_demo_ui.urls')),
    # Django ATC profile storage
    url(r'^api/v1/profiles/', include('atc_profile_storage.urls')),
    url(r'^$', RedirectView.as_view(url='/atc_demo_ui/', permanent=False)),
)
```

Migrate the django database:

```shell
python manage.py migrate
```

And finally, run the django server:

```shell
python manage.py runserver 0.0.0.0:8080
```


================================================
FILE: atc/atc_thrift/MANIFEST.in
================================================
include README.md


================================================
FILE: atc/atc_thrift/Makefile
================================================
all:
	thrift  --out . --gen py:new_style atc_thrift.thrift


================================================
FILE: atc/atc_thrift/README.md
================================================
ATC Thrift
==========

ATC Thrift is `Augmented Traffic Control` (ATC) Thrift Library

`atc_thrift.thrift` contains the description of the atc_thrift interface.
Change to the API should be made in this file and the client/server code should
be regenerated using:
  make


================================================
FILE: atc/atc_thrift/__init__.py
================================================


================================================
FILE: atc/atc_thrift/atc_thrift/Atcd-remote
================================================
#!/usr/bin/env python
#
# Autogenerated by Thrift Compiler (0.9.1)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
#  options string: py:new_style
#

import sys
import pprint
from urlparse import urlparse
from thrift.transport import TTransport
from thrift.transport import TSocket
from thrift.transport import THttpClient
from thrift.protocol import TBinaryProtocol

from atc_thrift import Atcd
from atc_thrift.ttypes import *

if len(sys.argv) <= 1 or sys.argv[1] == '--help':
  print ''
  print 'Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] function [arg1 [arg2...]]'
  print ''
  print 'Functions:'
  print '  TrafficControlRc startShaping(TrafficControl tc)'
  print '  TrafficControlRc stopShaping(TrafficControlledDevice device)'
  print '  TrafficControl getCurrentShaping(TrafficControlledDevice device)'
  print '  bool isShaped(TrafficControlledDevice device)'
  print '  PacketCapture startPacketCapture(TrafficControlledDevice device, i32 timeout)'
  print '  PacketCapture stopPacketCapture(TrafficControlledDevice device)'
  print '  void stopAllPacketCaptures()'
  print '   listPacketCaptures(TrafficControlledDevice device)'
  print '   listRunningPacketCaptures()'
  print '  i32 getShapedDeviceCount()'
  print '  AccessToken requestToken(string ip, i32 duration)'
  print '  bool requestRemoteControl(TrafficControlledDevice device, AccessToken accessToken)'
  print '   getDevicesControlledBy(string ip)'
  print '   getDevicesControlling(string ip)'
  print ''
  sys.exit(0)

pp = pprint.PrettyPrinter(indent = 2)
host = 'localhost'
port = 9090
uri = ''
framed = False
http = False
argi = 1

if sys.argv[argi] == '-h':
  parts = sys.argv[argi+1].split(':')
  host = parts[0]
  if len(parts) > 1:
    port = int(parts[1])
  argi += 2

if sys.argv[argi] == '-u':
  url = urlparse(sys.argv[argi+1])
  parts = url[1].split(':')
  host = parts[0]
  if len(parts) > 1:
    port = int(parts[1])
  else:
    port = 80
  uri = url[2]
  if url[4]:
    uri += '?%s' % url[4]
  http = True
  argi += 2

if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed':
  framed = True
  argi += 1

cmd = sys.argv[argi]
args = sys.argv[argi+1:]

if http:
  transport = THttpClient.THttpClient(host, port, uri)
else:
  socket = TSocket.TSocket(host, port)
  if framed:
    transport = TTransport.TFramedTransport(socket)
  else:
    transport = TTransport.TBufferedTransport(socket)
protocol = TBinaryProtocol.TBinaryProtocol(transport)
client = Atcd.Client(protocol)
transport.open()

if cmd == 'startShaping':
  if len(args) != 1:
    print 'startShaping requires 1 args'
    sys.exit(1)
  pp.pprint(client.startShaping(eval(args[0]),))

elif cmd == 'stopShaping':
  if len(args) != 1:
    print 'stopShaping requires 1 args'
    sys.exit(1)
  pp.pprint(client.stopShaping(eval(args[0]),))

elif cmd == 'getCurrentShaping':
  if len(args) != 1:
    print 'getCurrentShaping requires 1 args'
    sys.exit(1)
  pp.pprint(client.getCurrentShaping(eval(args[0]),))

elif cmd == 'isShaped':
  if len(args) != 1:
    print 'isShaped requires 1 args'
    sys.exit(1)
  pp.pprint(client.isShaped(eval(args[0]),))

elif cmd == 'startPacketCapture':
  if len(args) != 2:
    print 'startPacketCapture requires 2 args'
    sys.exit(1)
  pp.pprint(client.startPacketCapture(eval(args[0]),eval(args[1]),))

elif cmd == 'stopPacketCapture':
  if len(args) != 1:
    print 'stopPacketCapture requires 1 args'
    sys.exit(1)
  pp.pprint(client.stopPacketCapture(eval(args[0]),))

elif cmd == 'stopAllPacketCaptures':
  if len(args) != 0:
    print 'stopAllPacketCaptures requires 0 args'
    sys.exit(1)
  pp.pprint(client.stopAllPacketCaptures())

elif cmd == 'listPacketCaptures':
  if len(args) != 1:
    print 'listPacketCaptures requires 1 args'
    sys.exit(1)
  pp.pprint(client.listPacketCaptures(eval(args[0]),))

elif cmd == 'listRunningPacketCaptures':
  if len(args) != 0:
    print 'listRunningPacketCaptures requires 0 args'
    sys.exit(1)
  pp.pprint(client.listRunningPacketCaptures())

elif cmd == 'getShapedDeviceCount':
  if len(args) != 0:
    print 'getShapedDeviceCount requires 0 args'
    sys.exit(1)
  pp.pprint(client.getShapedDeviceCount())

elif cmd == 'requestToken':
  if len(args) != 2:
    print 'requestToken requires 2 args'
    sys.exit(1)
  pp.pprint(client.requestToken(args[0],eval(args[1]),))

elif cmd == 'requestRemoteControl':
  if len(args) != 2:
    print 'requestRemoteControl requires 2 args'
    sys.exit(1)
  pp.pprint(client.requestRemoteControl(eval(args[0]),eval(args[1]),))

elif cmd == 'getDevicesControlledBy':
  if len(args) != 1:
    print 'getDevicesControlledBy requires 1 args'
    sys.exit(1)
  pp.pprint(client.getDevicesControlledBy(args[0],))

elif cmd == 'getDevicesControlling':
  if len(args) != 1:
    print 'getDevicesControlling requires 1 args'
    sys.exit(1)
  pp.pprint(client.getDevicesControlling(args[0],))

else:
  print 'Unrecognized method %s' % cmd
  sys.exit(1)

transport.close()


================================================
FILE: atc/atc_thrift/atc_thrift/Atcd.py
================================================
#
# Autogenerated by Thrift Compiler (0.9.1)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
#  options string: py:new_style
#

from thrift.Thrift import TType, TMessageType, TException, TApplicationException
from ttypes import *
from thrift.Thrift import TProcessor
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol, TProtocol
try:
  from thrift.protocol import fastbinary
except:
  fastbinary = None


class Iface(object):
  def startShaping(self, tc):
    """
    Parameters:
     - tc
    """
    pass

  def stopShaping(self, device):
    """
    Parameters:
     - device
    """
    pass

  def getCurrentShaping(self, device):
    """
    Parameters:
     - device
    """
    pass

  def isShaped(self, device):
    """
    Parameters:
     - device
    """
    pass

  def startPacketCapture(self, device, timeout):
    """
    Parameters:
     - device
     - timeout
    """
    pass

  def stopPacketCapture(self, device):
    """
    Parameters:
     - device
    """
    pass

  def stopAllPacketCaptures(self):
    pass

  def listPacketCaptures(self, device):
    """
    Parameters:
     - device
    """
    pass

  def listRunningPacketCaptures(self):
    pass

  def getShapedDeviceCount(self):
    pass

  def requestToken(self, ip, duration):
    """
    Parameters:
     - ip
     - duration
    """
    pass

  def requestRemoteControl(self, device, accessToken):
    """
    Parameters:
     - device
     - accessToken
    """
    pass

  def getDevicesControlledBy(self, ip):
    """
    Parameters:
     - ip
    """
    pass

  def getDevicesControlling(self, ip):
    """
    Parameters:
     - ip
    """
    pass


class Client(Iface):
  def __init__(self, iprot, oprot=None):
    self._iprot = self._oprot = iprot
    if oprot is not None:
      self._oprot = oprot
    self._seqid = 0

  def startShaping(self, tc):
    """
    Parameters:
     - tc
    """
    self.send_startShaping(tc)
    return self.recv_startShaping()

  def send_startShaping(self, tc):
    self._oprot.writeMessageBegin('startShaping', TMessageType.CALL, self._seqid)
    args = startShaping_args()
    args.tc = tc
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_startShaping(self):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = startShaping_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    if result.failure is not None:
      raise result.failure
    raise TApplicationException(TApplicationException.MISSING_RESULT, "startShaping failed: unknown result");

  def stopShaping(self, device):
    """
    Parameters:
     - device
    """
    self.send_stopShaping(device)
    return self.recv_stopShaping()

  def send_stopShaping(self, device):
    self._oprot.writeMessageBegin('stopShaping', TMessageType.CALL, self._seqid)
    args = stopShaping_args()
    args.device = device
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_stopShaping(self):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = stopShaping_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    if result.failure is not None:
      raise result.failure
    raise TApplicationException(TApplicationException.MISSING_RESULT, "stopShaping failed: unknown result");

  def getCurrentShaping(self, device):
    """
    Parameters:
     - device
    """
    self.send_getCurrentShaping(device)
    return self.recv_getCurrentShaping()

  def send_getCurrentShaping(self, device):
    self._oprot.writeMessageBegin('getCurrentShaping', TMessageType.CALL, self._seqid)
    args = getCurrentShaping_args()
    args.device = device
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_getCurrentShaping(self):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = getCurrentShaping_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    if result.failure is not None:
      raise result.failure
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getCurrentShaping failed: unknown result");

  def isShaped(self, device):
    """
    Parameters:
     - device
    """
    self.send_isShaped(device)
    return self.recv_isShaped()

  def send_isShaped(self, device):
    self._oprot.writeMessageBegin('isShaped', TMessageType.CALL, self._seqid)
    args = isShaped_args()
    args.device = device
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_isShaped(self):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = isShaped_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    if result.failure is not None:
      raise result.failure
    raise TApplicationException(TApplicationException.MISSING_RESULT, "isShaped failed: unknown result");

  def startPacketCapture(self, device, timeout):
    """
    Parameters:
     - device
     - timeout
    """
    self.send_startPacketCapture(device, timeout)
    return self.recv_startPacketCapture()

  def send_startPacketCapture(self, device, timeout):
    self._oprot.writeMessageBegin('startPacketCapture', TMessageType.CALL, self._seqid)
    args = startPacketCapture_args()
    args.device = device
    args.timeout = timeout
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_startPacketCapture(self):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = startPacketCapture_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    if result.failure is not None:
      raise result.failure
    raise TApplicationException(TApplicationException.MISSING_RESULT, "startPacketCapture failed: unknown result");

  def stopPacketCapture(self, device):
    """
    Parameters:
     - device
    """
    self.send_stopPacketCapture(device)
    return self.recv_stopPacketCapture()

  def send_stopPacketCapture(self, device):
    self._oprot.writeMessageBegin('stopPacketCapture', TMessageType.CALL, self._seqid)
    args = stopPacketCapture_args()
    args.device = device
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_stopPacketCapture(self):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = stopPacketCapture_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    if result.failure is not None:
      raise result.failure
    raise TApplicationException(TApplicationException.MISSING_RESULT, "stopPacketCapture failed: unknown result");

  def stopAllPacketCaptures(self):
    self.send_stopAllPacketCaptures()
    self.recv_stopAllPacketCaptures()

  def send_stopAllPacketCaptures(self):
    self._oprot.writeMessageBegin('stopAllPacketCaptures', TMessageType.CALL, self._seqid)
    args = stopAllPacketCaptures_args()
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_stopAllPacketCaptures(self):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = stopAllPacketCaptures_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    return

  def listPacketCaptures(self, device):
    """
    Parameters:
     - device
    """
    self.send_listPacketCaptures(device)
    return self.recv_listPacketCaptures()

  def send_listPacketCaptures(self, device):
    self._oprot.writeMessageBegin('listPacketCaptures', TMessageType.CALL, self._seqid)
    args = listPacketCaptures_args()
    args.device = device
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_listPacketCaptures(self):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = listPacketCaptures_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    if result.failure is not None:
      raise result.failure
    raise TApplicationException(TApplicationException.MISSING_RESULT, "listPacketCaptures failed: unknown result");

  def listRunningPacketCaptures(self):
    self.send_listRunningPacketCaptures()
    return self.recv_listRunningPacketCaptures()

  def send_listRunningPacketCaptures(self):
    self._oprot.writeMessageBegin('listRunningPacketCaptures', TMessageType.CALL, self._seqid)
    args = listRunningPacketCaptures_args()
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_listRunningPacketCaptures(self):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = listRunningPacketCaptures_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    raise TApplicationException(TApplicationException.MISSING_RESULT, "listRunningPacketCaptures failed: unknown result");

  def getShapedDeviceCount(self):
    self.send_getShapedDeviceCount()
    return self.recv_getShapedDeviceCount()

  def send_getShapedDeviceCount(self):
    self._oprot.writeMessageBegin('getShapedDeviceCount', TMessageType.CALL, self._seqid)
    args = getShapedDeviceCount_args()
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_getShapedDeviceCount(self):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = getShapedDeviceCount_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getShapedDeviceCount failed: unknown result");

  def requestToken(self, ip, duration):
    """
    Parameters:
     - ip
     - duration
    """
    self.send_requestToken(ip, duration)
    return self.recv_requestToken()

  def send_requestToken(self, ip, duration):
    self._oprot.writeMessageBegin('requestToken', TMessageType.CALL, self._seqid)
    args = requestToken_args()
    args.ip = ip
    args.duration = duration
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_requestToken(self):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = requestToken_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    raise TApplicationException(TApplicationException.MISSING_RESULT, "requestToken failed: unknown result");

  def requestRemoteControl(self, device, accessToken):
    """
    Parameters:
     - device
     - accessToken
    """
    self.send_requestRemoteControl(device, accessToken)
    return self.recv_requestRemoteControl()

  def send_requestRemoteControl(self, device, accessToken):
    self._oprot.writeMessageBegin('requestRemoteControl', TMessageType.CALL, self._seqid)
    args = requestRemoteControl_args()
    args.device = device
    args.accessToken = accessToken
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_requestRemoteControl(self):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = requestRemoteControl_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    raise TApplicationException(TApplicationException.MISSING_RESULT, "requestRemoteControl failed: unknown result");

  def getDevicesControlledBy(self, ip):
    """
    Parameters:
     - ip
    """
    self.send_getDevicesControlledBy(ip)
    return self.recv_getDevicesControlledBy()

  def send_getDevicesControlledBy(self, ip):
    self._oprot.writeMessageBegin('getDevicesControlledBy', TMessageType.CALL, self._seqid)
    args = getDevicesControlledBy_args()
    args.ip = ip
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_getDevicesControlledBy(self):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = getDevicesControlledBy_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getDevicesControlledBy failed: unknown result");

  def getDevicesControlling(self, ip):
    """
    Parameters:
     - ip
    """
    self.send_getDevicesControlling(ip)
    return self.recv_getDevicesControlling()

  def send_getDevicesControlling(self, ip):
    self._oprot.writeMessageBegin('getDevicesControlling', TMessageType.CALL, self._seqid)
    args = getDevicesControlling_args()
    args.ip = ip
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_getDevicesControlling(self):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = getDevicesControlling_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getDevicesControlling failed: unknown result");


class Processor(Iface, TProcessor):
  def __init__(self, handler):
    self._handler = handler
    self._processMap = {}
    self._processMap["startShaping"] = Processor.process_startShaping
    self._processMap["stopShaping"] = Processor.process_stopShaping
    self._processMap["getCurrentShaping"] = Processor.process_getCurrentShaping
    self._processMap["isShaped"] = Processor.process_isShaped
    self._processMap["startPacketCapture"] = Processor.process_startPacketCapture
    self._processMap["stopPacketCapture"] = Processor.process_stopPacketCapture
    self._processMap["stopAllPacketCaptures"] = Processor.process_stopAllPacketCaptures
    self._processMap["listPacketCaptures"] = Processor.process_listPacketCaptures
    self._processMap["listRunningPacketCaptures"] = Processor.process_listRunningPacketCaptures
    self._processMap["getShapedDeviceCount"] = Processor.process_getShapedDeviceCount
    self._processMap["requestToken"] = Processor.process_requestToken
    self._processMap["requestRemoteControl"] = Processor.process_requestRemoteControl
    self._processMap["getDevicesControlledBy"] = Processor.process_getDevicesControlledBy
    self._processMap["getDevicesControlling"] = Processor.process_getDevicesControlling

  def process(self, iprot, oprot):
    (name, type, seqid) = iprot.readMessageBegin()
    if name not in self._processMap:
      iprot.skip(TType.STRUCT)
      iprot.readMessageEnd()
      x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name))
      oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid)
      x.write(oprot)
      oprot.writeMessageEnd()
      oprot.trans.flush()
      return
    else:
      self._processMap[name](self, seqid, iprot, oprot)
    return True

  def process_startShaping(self, seqid, iprot, oprot):
    args = startShaping_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = startShaping_result()
    try:
      result.success = self._handler.startShaping(args.tc)
    except TrafficControlException, failure:
      result.failure = failure
    oprot.writeMessageBegin("startShaping", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_stopShaping(self, seqid, iprot, oprot):
    args = stopShaping_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = stopShaping_result()
    try:
      result.success = self._handler.stopShaping(args.device)
    except TrafficControlException, failure:
      result.failure = failure
    oprot.writeMessageBegin("stopShaping", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_getCurrentShaping(self, seqid, iprot, oprot):
    args = getCurrentShaping_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = getCurrentShaping_result()
    try:
      result.success = self._handler.getCurrentShaping(args.device)
    except TrafficControlException, failure:
      result.failure = failure
    oprot.writeMessageBegin("getCurrentShaping", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_isShaped(self, seqid, iprot, oprot):
    args = isShaped_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = isShaped_result()
    try:
      result.success = self._handler.isShaped(args.device)
    except TrafficControlException, failure:
      result.failure = failure
    oprot.writeMessageBegin("isShaped", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_startPacketCapture(self, seqid, iprot, oprot):
    args = startPacketCapture_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = startPacketCapture_result()
    try:
      result.success = self._handler.startPacketCapture(args.device, args.timeout)
    except PacketCaptureException, failure:
      result.failure = failure
    oprot.writeMessageBegin("startPacketCapture", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_stopPacketCapture(self, seqid, iprot, oprot):
    args = stopPacketCapture_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = stopPacketCapture_result()
    try:
      result.success = self._handler.stopPacketCapture(args.device)
    except PacketCaptureException, failure:
      result.failure = failure
    oprot.writeMessageBegin("stopPacketCapture", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_stopAllPacketCaptures(self, seqid, iprot, oprot):
    args = stopAllPacketCaptures_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = stopAllPacketCaptures_result()
    self._handler.stopAllPacketCaptures()
    oprot.writeMessageBegin("stopAllPacketCaptures", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_listPacketCaptures(self, seqid, iprot, oprot):
    args = listPacketCaptures_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = listPacketCaptures_result()
    try:
      result.success = self._handler.listPacketCaptures(args.device)
    except TrafficControlException, failure:
      result.failure = failure
    oprot.writeMessageBegin("listPacketCaptures", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_listRunningPacketCaptures(self, seqid, iprot, oprot):
    args = listRunningPacketCaptures_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = listRunningPacketCaptures_result()
    result.success = self._handler.listRunningPacketCaptures()
    oprot.writeMessageBegin("listRunningPacketCaptures", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_getShapedDeviceCount(self, seqid, iprot, oprot):
    args = getShapedDeviceCount_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = getShapedDeviceCount_result()
    result.success = self._handler.getShapedDeviceCount()
    oprot.writeMessageBegin("getShapedDeviceCount", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_requestToken(self, seqid, iprot, oprot):
    args = requestToken_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = requestToken_result()
    result.success = self._handler.requestToken(args.ip, args.duration)
    oprot.writeMessageBegin("requestToken", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_requestRemoteControl(self, seqid, iprot, oprot):
    args = requestRemoteControl_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = requestRemoteControl_result()
    result.success = self._handler.requestRemoteControl(args.device, args.accessToken)
    oprot.writeMessageBegin("requestRemoteControl", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_getDevicesControlledBy(self, seqid, iprot, oprot):
    args = getDevicesControlledBy_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = getDevicesControlledBy_result()
    result.success = self._handler.getDevicesControlledBy(args.ip)
    oprot.writeMessageBegin("getDevicesControlledBy", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_getDevicesControlling(self, seqid, iprot, oprot):
    args = getDevicesControlling_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = getDevicesControlling_result()
    result.success = self._handler.getDevicesControlling(args.ip)
    oprot.writeMessageBegin("getDevicesControlling", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()


# HELPER FUNCTIONS AND STRUCTURES

class startShaping_args(object):
  """
  Attributes:
   - tc
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'tc', (TrafficControl, TrafficControl.thrift_spec), None, ), # 1
  )

  def __init__(self, tc=None,):
    self.tc = tc

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.STRUCT:
          self.tc = TrafficControl()
          self.tc.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('startShaping_args')
    if self.tc is not None:
      oprot.writeFieldBegin('tc', TType.STRUCT, 1)
      self.tc.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class startShaping_result(object):
  """
  Attributes:
   - success
   - failure
  """

  thrift_spec = (
    (0, TType.STRUCT, 'success', (TrafficControlRc, TrafficControlRc.thrift_spec), None, ), # 0
    (1, TType.STRUCT, 'failure', (TrafficControlException, TrafficControlException.thrift_spec), None, ), # 1
  )

  def __init__(self, success=None, failure=None,):
    self.success = success
    self.failure = failure

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 0:
        if ftype == TType.STRUCT:
          self.success = TrafficControlRc()
          self.success.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 1:
        if ftype == TType.STRUCT:
          self.failure = TrafficControlException()
          self.failure.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('startShaping_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.STRUCT, 0)
      self.success.write(oprot)
      oprot.writeFieldEnd()
    if self.failure is not None:
      oprot.writeFieldBegin('failure', TType.STRUCT, 1)
      self.failure.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class stopShaping_args(object):
  """
  Attributes:
   - device
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'device', (TrafficControlledDevice, TrafficControlledDevice.thrift_spec), None, ), # 1
  )

  def __init__(self, device=None,):
    self.device = device

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.STRUCT:
          self.device = TrafficControlledDevice()
          self.device.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('stopShaping_args')
    if self.device is not None:
      oprot.writeFieldBegin('device', TType.STRUCT, 1)
      self.device.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class stopShaping_result(object):
  """
  Attributes:
   - success
   - failure
  """

  thrift_spec = (
    (0, TType.STRUCT, 'success', (TrafficControlRc, TrafficControlRc.thrift_spec), None, ), # 0
    (1, TType.STRUCT, 'failure', (TrafficControlException, TrafficControlException.thrift_spec), None, ), # 1
  )

  def __init__(self, success=None, failure=None,):
    self.success = success
    self.failure = failure

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 0:
        if ftype == TType.STRUCT:
          self.success = TrafficControlRc()
          self.success.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 1:
        if ftype == TType.STRUCT:
          self.failure = TrafficControlException()
          self.failure.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('stopShaping_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.STRUCT, 0)
      self.success.write(oprot)
      oprot.writeFieldEnd()
    if self.failure is not None:
      oprot.writeFieldBegin('failure', TType.STRUCT, 1)
      self.failure.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class getCurrentShaping_args(object):
  """
  Attributes:
   - device
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'device', (TrafficControlledDevice, TrafficControlledDevice.thrift_spec), None, ), # 1
  )

  def __init__(self, device=None,):
    self.device = device

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.STRUCT:
          self.device = TrafficControlledDevice()
          self.device.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('getCurrentShaping_args')
    if self.device is not None:
      oprot.writeFieldBegin('device', TType.STRUCT, 1)
      self.device.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class getCurrentShaping_result(object):
  """
  Attributes:
   - success
   - failure
  """

  thrift_spec = (
    (0, TType.STRUCT, 'success', (TrafficControl, TrafficControl.thrift_spec), None, ), # 0
    (1, TType.STRUCT, 'failure', (TrafficControlException, TrafficControlException.thrift_spec), None, ), # 1
  )

  def __init__(self, success=None, failure=None,):
    self.success = success
    self.failure = failure

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 0:
        if ftype == TType.STRUCT:
          self.success = TrafficControl()
          self.success.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 1:
        if ftype == TType.STRUCT:
          self.failure = TrafficControlException()
          self.failure.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('getCurrentShaping_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.STRUCT, 0)
      self.success.write(oprot)
      oprot.writeFieldEnd()
    if self.failure is not None:
      oprot.writeFieldBegin('failure', TType.STRUCT, 1)
      self.failure.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class isShaped_args(object):
  """
  Attributes:
   - device
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'device', (TrafficControlledDevice, TrafficControlledDevice.thrift_spec), None, ), # 1
  )

  def __init__(self, device=None,):
    self.device = device

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.STRUCT:
          self.device = TrafficControlledDevice()
          self.device.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('isShaped_args')
    if self.device is not None:
      oprot.writeFieldBegin('device', TType.STRUCT, 1)
      self.device.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class isShaped_result(object):
  """
  Attributes:
   - success
   - failure
  """

  thrift_spec = (
    (0, TType.BOOL, 'success', None, None, ), # 0
    (1, TType.STRUCT, 'failure', (TrafficControlException, TrafficControlException.thrift_spec), None, ), # 1
  )

  def __init__(self, success=None, failure=None,):
    self.success = success
    self.failure = failure

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 0:
        if ftype == TType.BOOL:
          self.success = iprot.readBool();
        else:
          iprot.skip(ftype)
      elif fid == 1:
        if ftype == TType.STRUCT:
          self.failure = TrafficControlException()
          self.failure.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('isShaped_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.BOOL, 0)
      oprot.writeBool(self.success)
      oprot.writeFieldEnd()
    if self.failure is not None:
      oprot.writeFieldBegin('failure', TType.STRUCT, 1)
      self.failure.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class startPacketCapture_args(object):
  """
  Attributes:
   - device
   - timeout
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'device', (TrafficControlledDevice, TrafficControlledDevice.thrift_spec), None, ), # 1
    (2, TType.I32, 'timeout', None, None, ), # 2
  )

  def __init__(self, device=None, timeout=None,):
    self.device = device
    self.timeout = timeout

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.STRUCT:
          self.device = TrafficControlledDevice()
          self.device.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I32:
          self.timeout = iprot.readI32();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('startPacketCapture_args')
    if self.device is not None:
      oprot.writeFieldBegin('device', TType.STRUCT, 1)
      self.device.write(oprot)
      oprot.writeFieldEnd()
    if self.timeout is not None:
      oprot.writeFieldBegin('timeout', TType.I32, 2)
      oprot.writeI32(self.timeout)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class startPacketCapture_result(object):
  """
  Attributes:
   - success
   - failure
  """

  thrift_spec = (
    (0, TType.STRUCT, 'success', (PacketCapture, PacketCapture.thrift_spec), None, ), # 0
    (1, TType.STRUCT, 'failure', (PacketCaptureException, PacketCaptureException.thrift_spec), None, ), # 1
  )

  def __init__(self, success=None, failure=None,):
    self.success = success
    self.failure = failure

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 0:
        if ftype == TType.STRUCT:
          self.success = PacketCapture()
          self.success.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 1:
        if ftype == TType.STRUCT:
          self.failure = PacketCaptureException()
          self.failure.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('startPacketCapture_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.STRUCT, 0)
      self.success.write(oprot)
      oprot.writeFieldEnd()
    if self.failure is not None:
      oprot.writeFieldBegin('failure', TType.STRUCT, 1)
      self.failure.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class stopPacketCapture_args(object):
  """
  Attributes:
   - device
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'device', (TrafficControlledDevice, TrafficControlledDevice.thrift_spec), None, ), # 1
  )

  def __init__(self, device=None,):
    self.device = device

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.STRUCT:
          self.device = TrafficControlledDevice()
          self.device.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('stopPacketCapture_args')
    if self.device is not None:
      oprot.writeFieldBegin('device', TType.STRUCT, 1)
      self.device.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class stopPacketCapture_result(object):
  """
  Attributes:
   - success
   - failure
  """

  thrift_spec = (
    (0, TType.STRUCT, 'success', (PacketCapture, PacketCapture.thrift_spec), None, ), # 0
    (1, TType.STRUCT, 'failure', (PacketCaptureException, PacketCaptureException.thrift_spec), None, ), # 1
  )

  def __init__(self, success=None, failure=None,):
    self.success = success
    self.failure = failure

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 0:
        if ftype == TType.STRUCT:
          self.success = PacketCapture()
          self.success.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 1:
        if ftype == TType.STRUCT:
          self.failure = PacketCaptureException()
          self.failure.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('stopPacketCapture_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.STRUCT, 0)
      self.success.write(oprot)
      oprot.writeFieldEnd()
    if self.failure is not None:
      oprot.writeFieldBegin('failure', TType.STRUCT, 1)
      self.failure.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class stopAllPacketCaptures_args(object):

  thrift_spec = (
  )

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('stopAllPacketCaptures_args')
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class stopAllPacketCaptures_result(object):

  thrift_spec = (
  )

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('stopAllPacketCaptures_result')
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class listPacketCaptures_args(object):
  """
  Attributes:
   - device
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'device', (TrafficControlledDevice, TrafficControlledDevice.thrift_spec), None, ), # 1
  )

  def __init__(self, device=None,):
    self.device = device

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.STRUCT:
          self.device = TrafficControlledDevice()
          self.device.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('listPacketCaptures_args')
    if self.device is not None:
      oprot.writeFieldBegin('device', TType.STRUCT, 1)
      self.device.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class listPacketCaptures_result(object):
  """
  Attributes:
   - success
   - failure
  """

  thrift_spec = (
    (0, TType.LIST, 'success', (TType.STRUCT,(PacketCapture, PacketCapture.thrift_spec)), None, ), # 0
    (1, TType.STRUCT, 'failure', (TrafficControlException, TrafficControlException.thrift_spec), None, ), # 1
  )

  def __init__(self, success=None, failure=None,):
    self.success = success
    self.failure = failure

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 0:
        if ftype == TType.LIST:
          self.success = []
          (_etype10, _size7) = iprot.readListBegin()
          for _i11 in xrange(_size7):
            _elem12 = PacketCapture()
            _elem12.read(iprot)
            self.success.append(_elem12)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      elif fid == 1:
        if ftype == TType.STRUCT:
          self.failure = TrafficControlException()
          self.failure.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('listPacketCaptures_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.LIST, 0)
      oprot.writeListBegin(TType.STRUCT, len(self.success))
      for iter13 in self.success:
        iter13.write(oprot)
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    if self.failure is not None:
      oprot.writeFieldBegin('failure', TType.STRUCT, 1)
      self.failure.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class listRunningPacketCaptures_args(object):

  thrift_spec = (
  )

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('listRunningPacketCaptures_args')
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class listRunningPacketCaptures_result(object):
  """
  Attributes:
   - success
  """

  thrift_spec = (
    (0, TType.LIST, 'success', (TType.STRUCT,(PacketCapture, PacketCapture.thrift_spec)), None, ), # 0
  )

  def __init__(self, success=None,):
    self.success = success

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 0:
        if ftype == TType.LIST:
          self.success = []
          (_etype17, _size14) = iprot.readListBegin()
          for _i18 in xrange(_size14):
            _elem19 = PacketCapture()
            _elem19.read(iprot)
            self.success.append(_elem19)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('listRunningPacketCaptures_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.LIST, 0)
      oprot.writeListBegin(TType.STRUCT, len(self.success))
      for iter20 in self.success:
        iter20.write(oprot)
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class getShapedDeviceCount_args(object):

  thrift_spec = (
  )

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('getShapedDeviceCount_args')
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class getShapedDeviceCount_result(object):
  """
  Attributes:
   - success
  """

  thrift_spec = (
    (0, TType.I32, 'success', None, None, ), # 0
  )

  def __init__(self, success=None,):
    self.success = success

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 0:
        if ftype == TType.I32:
          self.success = iprot.readI32();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('getShapedDeviceCount_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.I32, 0)
      oprot.writeI32(self.success)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class requestToken_args(object):
  """
  Attributes:
   - ip
   - duration
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'ip', None, None, ), # 1
    (2, TType.I32, 'duration', None, None, ), # 2
  )

  def __init__(self, ip=None, duration=None,):
    self.ip = ip
    self.duration = duration

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.STRING:
          self.ip = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I32:
          self.duration = iprot.readI32();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('requestToken_args')
    if self.ip is not None:
      oprot.writeFieldBegin('ip', TType.STRING, 1)
      oprot.writeString(self.ip)
      oprot.writeFieldEnd()
    if self.duration is not None:
      oprot.writeFieldBegin('duration', TType.I32, 2)
      oprot.writeI32(self.duration)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class requestToken_result(object):
  """
  Attributes:
   - success
  """

  thrift_spec = (
    (0, TType.STRUCT, 'success', (AccessToken, AccessToken.thrift_spec), None, ), # 0
  )

  def __init__(self, success=None,):
    self.success = success

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 0:
        if ftype == TType.STRUCT:
          self.success = AccessToken()
          self.success.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('requestToken_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.STRUCT, 0)
      self.success.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class requestRemoteControl_args(object):
  """
  Attributes:
   - device
   - accessToken
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'device', (TrafficControlledDevice, TrafficControlledDevice.thrift_spec), None, ), # 1
    (2, TType.STRUCT, 'accessToken', (AccessToken, AccessToken.thrift_spec), None, ), # 2
  )

  def __init__(self, device=None, accessToken=None,):
    self.device = device
    self.accessToken = accessToken

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.STRUCT:
          self.device = TrafficControlledDevice()
          self.device.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRUCT:
          self.accessToken = AccessToken()
          self.accessToken.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('requestRemoteControl_args')
    if self.device is not None:
      oprot.writeFieldBegin('device', TType.STRUCT, 1)
      self.device.write(oprot)
      oprot.writeFieldEnd()
    if self.accessToken is not None:
      oprot.writeFieldBegin('accessToken', TType.STRUCT, 2)
      self.accessToken.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class requestRemoteControl_result(object):
  """
  Attributes:
   - success
  """

  thrift_spec = (
    (0, TType.BOOL, 'success', None, None, ), # 0
  )

  def __init__(self, success=None,):
    self.success = success

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 0:
        if ftype == TType.BOOL:
          self.success = iprot.readBool();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('requestRemoteControl_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.BOOL, 0)
      oprot.writeBool(self.success)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class getDevicesControlledBy_args(object):
  """
  Attributes:
   - ip
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'ip', None, None, ), # 1
  )

  def __init__(self, ip=None,):
    self.ip = ip

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.STRING:
          self.ip = iprot.readString();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('getDevicesControlledBy_args')
    if self.ip is not None:
      oprot.writeFieldBegin('ip', TType.STRING, 1)
      oprot.writeString(self.ip)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class getDevicesControlledBy_result(object):
  """
  Attributes:
   - success
  """

  thrift_spec = (
    (0, TType.LIST, 'success', (TType.STRUCT,(RemoteControlInstance, RemoteControlInstance.thrift_spec)), None, ), # 0
  )

  def __init__(self, success=None,):
    self.success = success

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 0:
        if ftype == TType.LIST:
          self.success = []
          (_etype24, _size21) = iprot.readListBegin()
          for _i25 in xrange(_size21):
            _elem26 = RemoteControlInstance()
            _elem26.read(iprot)
            self.success.append(_elem26)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('getDevicesControlledBy_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.LIST, 0)
      oprot.writeListBegin(TType.STRUCT, len(self.success))
      for iter27 in self.success:
        iter27.write(oprot)
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class getDevicesControlling_args(object):
  """
  Attributes:
   - ip
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'ip', None, None, ), # 1
  )

  def __init__(self, ip=None,):
    self.ip = ip

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.STRING:
          self.ip = iprot.readString();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('getDevicesControlling_args')
    if self.ip is not None:
      oprot.writeFieldBegin('ip', TType.STRING, 1)
      oprot.writeString(self.ip)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class getDevicesControlling_result(object):
  """
  Attributes:
   - success
  """

  thrift_spec = (
    (0, TType.LIST, 'success', (TType.STRUCT,(RemoteControlInstance, RemoteControlInstance.thrift_spec)), None, ), # 0
  )

  def __init__(self, success=None,):
    self.success = success

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 0:
        if ftype == TType.LIST:
          self.success = []
          (_etype31, _size28) = iprot.readListBegin()
          for _i32 in xrange(_size28):
            _elem33 = RemoteControlInstance()
            _elem33.read(iprot)
            self.success.append(_elem33)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('getDevicesControlling_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.LIST, 0)
      oprot.writeListBegin(TType.STRUCT, len(self.success))
      for iter34 in self.success:
        iter34.write(oprot)
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)


================================================
FILE: atc/atc_thrift/atc_thrift/__init__.py
================================================
__all__ = ['ttypes', 'constants', 'Atcd']


================================================
FILE: atc/atc_thrift/atc_thrift/constants.py
================================================
#
# Autogenerated by Thrift Compiler (0.9.1)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
#  options string: py:new_style
#

from thrift.Thrift import TType, TMessageType, TException, TApplicationException
from ttypes import *



================================================
FILE: atc/atc_thrift/atc_thrift/ttypes.py
================================================
#
# Autogenerated by Thrift Compiler (0.9.1)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
#  options string: py:new_style
#

from thrift.Thrift import TType, TMessageType, TException, TApplicationException

from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol, TProtocol
try:
  from thrift.protocol import fastbinary
except:
  fastbinary = None


class ReturnCode(object):
  OK = 0
  INVALID_IP = 1
  INVALID_TIMEOUT = 2
  ID_EXHAUST = 3
  NETLINK_ERROR = 4
  UNKNOWN_ERROR = 5
  NETLINK_HTB_ERROR = 6
  UNKNOWN_HTB_ERROR = 7
  NETLINK_NETEM_ERROR = 8
  UNKNOWN_NETEM_ERROR = 9
  NETLINK_FW_ERROR = 10
  UNKNOWN_FW_ERROR = 11
  UNKNOWN_SESSION = 12
  UNKNOWN_IP = 13
  ACCESS_DENIED = 14

  _VALUES_TO_NAMES = {
    0: "OK",
    1: "INVALID_IP",
    2: "INVALID_TIMEOUT",
    3: "ID_EXHAUST",
    4: "NETLINK_ERROR",
    5: "UNKNOWN_ERROR",
    6: "NETLINK_HTB_ERROR",
    7: "UNKNOWN_HTB_ERROR",
    8: "NETLINK_NETEM_ERROR",
    9: "UNKNOWN_NETEM_ERROR",
    10: "NETLINK_FW_ERROR",
    11: "UNKNOWN_FW_ERROR",
    12: "UNKNOWN_SESSION",
    13: "UNKNOWN_IP",
    14: "ACCESS_DENIED",
  }

  _NAMES_TO_VALUES = {
    "OK": 0,
    "INVALID_IP": 1,
    "INVALID_TIMEOUT": 2,
    "ID_EXHAUST": 3,
    "NETLINK_ERROR": 4,
    "UNKNOWN_ERROR": 5,
    "NETLINK_HTB_ERROR": 6,
    "UNKNOWN_HTB_ERROR": 7,
    "NETLINK_NETEM_ERROR": 8,
    "UNKNOWN_NETEM_ERROR": 9,
    "NETLINK_FW_ERROR": 10,
    "UNKNOWN_FW_ERROR": 11,
    "UNKNOWN_SESSION": 12,
    "UNKNOWN_IP": 13,
    "ACCESS_DENIED": 14,
  }


class Delay(object):
  """
  Attributes:
   - delay
   - jitter
   - correlation
  """

  thrift_spec = (
    None, # 0
    (1, TType.I32, 'delay', None, None, ), # 1
    (2, TType.I32, 'jitter', None, 0, ), # 2
    (3, TType.DOUBLE, 'correlation', None, 0, ), # 3
  )

  def __init__(self, delay=None, jitter=thrift_spec[2][4], correlation=thrift_spec[3][4],):
    self.delay = delay
    self.jitter = jitter
    self.correlation = correlation

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.I32:
          self.delay = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I32:
          self.jitter = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.DOUBLE:
          self.correlation = iprot.readDouble();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('Delay')
    if self.delay is not None:
      oprot.writeFieldBegin('delay', TType.I32, 1)
      oprot.writeI32(self.delay)
      oprot.writeFieldEnd()
    if self.jitter is not None:
      oprot.writeFieldBegin('jitter', TType.I32, 2)
      oprot.writeI32(self.jitter)
      oprot.writeFieldEnd()
    if self.correlation is not None:
      oprot.writeFieldBegin('correlation', TType.DOUBLE, 3)
      oprot.writeDouble(self.correlation)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class Loss(object):
  """
  Attributes:
   - percentage
   - correlation
  """

  thrift_spec = (
    None, # 0
    (1, TType.DOUBLE, 'percentage', None, None, ), # 1
    (2, TType.DOUBLE, 'correlation', None, 0, ), # 2
  )

  def __init__(self, percentage=None, correlation=thrift_spec[2][4],):
    self.percentage = percentage
    self.correlation = correlation

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.DOUBLE:
          self.percentage = iprot.readDouble();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.DOUBLE:
          self.correlation = iprot.readDouble();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('Loss')
    if self.percentage is not None:
      oprot.writeFieldBegin('percentage', TType.DOUBLE, 1)
      oprot.writeDouble(self.percentage)
      oprot.writeFieldEnd()
    if self.correlation is not None:
      oprot.writeFieldBegin('correlation', TType.DOUBLE, 2)
      oprot.writeDouble(self.correlation)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class Reorder(object):
  """
  Attributes:
   - percentage
   - gap
   - correlation
  """

  thrift_spec = (
    None, # 0
    (1, TType.DOUBLE, 'percentage', None, None, ), # 1
    (2, TType.I32, 'gap', None, 0, ), # 2
    (3, TType.DOUBLE, 'correlation', None, 0, ), # 3
  )

  def __init__(self, percentage=None, gap=thrift_spec[2][4], correlation=thrift_spec[3][4],):
    self.percentage = percentage
    self.gap = gap
    self.correlation = correlation

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.DOUBLE:
          self.percentage = iprot.readDouble();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I32:
          self.gap = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.DOUBLE:
          self.correlation = iprot.readDouble();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('Reorder')
    if self.percentage is not None:
      oprot.writeFieldBegin('percentage', TType.DOUBLE, 1)
      oprot.writeDouble(self.percentage)
      oprot.writeFieldEnd()
    if self.gap is not None:
      oprot.writeFieldBegin('gap', TType.I32, 2)
      oprot.writeI32(self.gap)
      oprot.writeFieldEnd()
    if self.correlation is not None:
      oprot.writeFieldBegin('correlation', TType.DOUBLE, 3)
      oprot.writeDouble(self.correlation)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class Corruption(object):
  """
  Attributes:
   - percentage
   - correlation
  """

  thrift_spec = (
    None, # 0
    (1, TType.DOUBLE, 'percentage', None, 0, ), # 1
    (2, TType.DOUBLE, 'correlation', None, 0, ), # 2
  )

  def __init__(self, percentage=thrift_spec[1][4], correlation=thrift_spec[2][4],):
    self.percentage = percentage
    self.correlation = correlation

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.DOUBLE:
          self.percentage = iprot.readDouble();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.DOUBLE:
          self.correlation = iprot.readDouble();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('Corruption')
    if self.percentage is not None:
      oprot.writeFieldBegin('percentage', TType.DOUBLE, 1)
      oprot.writeDouble(self.percentage)
      oprot.writeFieldEnd()
    if self.correlation is not None:
      oprot.writeFieldBegin('correlation', TType.DOUBLE, 2)
      oprot.writeDouble(self.correlation)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class Shaping(object):
  """
  Attributes:
   - rate
   - delay
   - loss
   - reorder
   - corruption
   - iptables_options
  """

  thrift_spec = (
    None, # 0
    (1, TType.I32, 'rate', None, None, ), # 1
    (2, TType.STRUCT, 'delay', (Delay, Delay.thrift_spec), Delay(**{
      "delay" : 0,
    }), ), # 2
    (3, TType.STRUCT, 'loss', (Loss, Loss.thrift_spec), Loss(**{
      "percentage" : 0,
    }), ), # 3
    (4, TType.STRUCT, 'reorder', (Reorder, Reorder.thrift_spec), Reorder(**{
      "percentage" : 0,
    }), ), # 4
    (5, TType.STRUCT, 'corruption', (Corruption, Corruption.thrift_spec), Corruption(**{
      "percentage" : 0,
    }), ), # 5
    (6, TType.LIST, 'iptables_options', (TType.STRING,None), None, ), # 6
  )

  def __init__(self, rate=None, delay=thrift_spec[2][4], loss=thrift_spec[3][4], reorder=thrift_spec[4][4], corruption=thrift_spec[5][4], iptables_options=None,):
    self.rate = rate
    if delay is self.thrift_spec[2][4]:
      delay = Delay(**{
      "delay" : 0,
    })
    self.delay = delay
    if loss is self.thrift_spec[3][4]:
      loss = Loss(**{
      "percentage" : 0,
    })
    self.loss = loss
    if reorder is self.thrift_spec[4][4]:
      reorder = Reorder(**{
      "percentage" : 0,
    })
    self.reorder = reorder
    if corruption is self.thrift_spec[5][4]:
      corruption = Corruption(**{
      "percentage" : 0,
    })
    self.corruption = corruption
    self.iptables_options = iptables_options

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.I32:
          self.rate = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRUCT:
          self.delay = Delay()
          self.delay.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.STRUCT:
          self.loss = Loss()
          self.loss.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.STRUCT:
          self.reorder = Reorder()
          self.reorder.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 5:
        if ftype == TType.STRUCT:
          self.corruption = Corruption()
          self.corruption.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 6:
        if ftype == TType.LIST:
          self.iptables_options = []
          (_etype3, _size0) = iprot.readListBegin()
          for _i4 in xrange(_size0):
            _elem5 = iprot.readString();
            self.iptables_options.append(_elem5)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('Shaping')
    if self.rate is not None:
      oprot.writeFieldBegin('rate', TType.I32, 1)
      oprot.writeI32(self.rate)
      oprot.writeFieldEnd()
    if self.delay is not None:
      oprot.writeFieldBegin('delay', TType.STRUCT, 2)
      self.delay.write(oprot)
      oprot.writeFieldEnd()
    if self.loss is not None:
      oprot.writeFieldBegin('loss', TType.STRUCT, 3)
      self.loss.write(oprot)
      oprot.writeFieldEnd()
    if self.reorder is not None:
      oprot.writeFieldBegin('reorder', TType.STRUCT, 4)
      self.reorder.write(oprot)
      oprot.writeFieldEnd()
    if self.corruption is not None:
      oprot.writeFieldBegin('corruption', TType.STRUCT, 5)
      self.corruption.write(oprot)
      oprot.writeFieldEnd()
    if self.iptables_options is not None:
      oprot.writeFieldBegin('iptables_options', TType.LIST, 6)
      oprot.writeListBegin(TType.STRING, len(self.iptables_options))
      for iter6 in self.iptables_options:
        oprot.writeString(iter6)
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class TrafficControlSetting(object):
  """
  Attributes:
   - up
   - down
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'up', (Shaping, Shaping.thrift_spec), None, ), # 1
    (2, TType.STRUCT, 'down', (Shaping, Shaping.thrift_spec), None, ), # 2
  )

  def __init__(self, up=None, down=None,):
    self.up = up
    self.down = down

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.STRUCT:
          self.up = Shaping()
          self.up.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRUCT:
          self.down = Shaping()
          self.down.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('TrafficControlSetting')
    if self.up is not None:
      oprot.writeFieldBegin('up', TType.STRUCT, 1)
      self.up.write(oprot)
      oprot.writeFieldEnd()
    if self.down is not None:
      oprot.writeFieldBegin('down', TType.STRUCT, 2)
      self.down.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class TrafficControlledDevice(object):
  """
  Attributes:
   - controlledIP
   - controllingIP
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'controlledIP', None, None, ), # 1
    (2, TType.STRING, 'controllingIP', None, None, ), # 2
  )

  def __init__(self, controlledIP=None, controllingIP=None,):
    self.controlledIP = controlledIP
    self.controllingIP = controllingIP

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.STRING:
          self.controlledIP = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRING:
          self.controllingIP = iprot.readString();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('TrafficControlledDevice')
    if self.controlledIP is not None:
      oprot.writeFieldBegin('controlledIP', TType.STRING, 1)
      oprot.writeString(self.controlledIP)
      oprot.writeFieldEnd()
    if self.controllingIP is not None:
      oprot.writeFieldBegin('controllingIP', TType.STRING, 2)
      oprot.writeString(self.controllingIP)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class RemoteControlInstance(object):
  """
  Attributes:
   - device
   - timeout
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'device', (TrafficControlledDevice, TrafficControlledDevice.thrift_spec), None, ), # 1
    (2, TType.I32, 'timeout', None, None, ), # 2
  )

  def __init__(self, device=None, timeout=None,):
    self.device = device
    self.timeout = timeout

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.STRUCT:
          self.device = TrafficControlledDevice()
          self.device.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I32:
          self.timeout = iprot.readI32();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('RemoteControlInstance')
    if self.device is not None:
      oprot.writeFieldBegin('device', TType.STRUCT, 1)
      self.device.write(oprot)
      oprot.writeFieldEnd()
    if self.timeout is not None:
      oprot.writeFieldBegin('timeout', TType.I32, 2)
      oprot.writeI32(self.timeout)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class TrafficControl(object):
  """
  Attributes:
   - settings
   - device
   - timeout
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'settings', (TrafficControlSetting, TrafficControlSetting.thrift_spec), None, ), # 1
    (2, TType.STRUCT, 'device', (TrafficControlledDevice, TrafficControlledDevice.thrift_spec), None, ), # 2
    (3, TType.I32, 'timeout', None, None, ), # 3
  )

  def __init__(self, settings=None, device=None, timeout=None,):
    self.settings = settings
    self.device = device
    self.timeout = timeout

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.STRUCT:
          self.settings = TrafficControlSetting()
          self.settings.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRUCT:
          self.device = TrafficControlledDevice()
          self.device.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.I32:
          self.timeout = iprot.readI32();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('TrafficControl')
    if self.settings is not None:
      oprot.writeFieldBegin('settings', TType.STRUCT, 1)
      self.settings.write(oprot)
      oprot.writeFieldEnd()
    if self.device is not None:
      oprot.writeFieldBegin('device', TType.STRUCT, 2)
      self.device.write(oprot)
      oprot.writeFieldEnd()
    if self.timeout is not None:
      oprot.writeFieldBegin('timeout', TType.I32, 3)
      oprot.writeI32(self.timeout)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class TrafficControlRc(object):
  """
  Attributes:
   - code
   - message
  """

  thrift_spec = (
    None, # 0
    (1, TType.I32, 'code', None, None, ), # 1
    (2, TType.STRING, 'message', None, None, ), # 2
  )

  def __init__(self, code=None, message=None,):
    self.code = code
    self.message = message

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.I32:
          self.code = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRING:
          self.message = iprot.readString();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('TrafficControlRc')
    if self.code is not None:
      oprot.writeFieldBegin('code', TType.I32, 1)
      oprot.writeI32(self.code)
      oprot.writeFieldEnd()
    if self.message is not None:
      oprot.writeFieldBegin('message', TType.STRING, 2)
      oprot.writeString(self.message)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class TrafficControlException(TException):
  """
  Attributes:
   - code
   - message
  """

  thrift_spec = (
    None, # 0
    (1, TType.I32, 'code', None, None, ), # 1
    (2, TType.STRING, 'message', None, None, ), # 2
  )

  def __init__(self, code=None, message=None,):
    self.code = code
    self.message = message

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.I32:
          self.code = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRING:
          self.message = iprot.readString();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('TrafficControlException')
    if self.code is not None:
      oprot.writeFieldBegin('code', TType.I32, 1)
      oprot.writeI32(self.code)
      oprot.writeFieldEnd()
    if self.message is not None:
      oprot.writeFieldBegin('message', TType.STRING, 2)
      oprot.writeString(self.message)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __str__(self):
    return repr(self)

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class PacketCaptureException(TException):
  """
  Attributes:
   - message
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'message', None, None, ), # 1
  )

  def __init__(self, message=None,):
    self.message = message

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.STRING:
          self.message = iprot.readString();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('PacketCaptureException')
    if self.message is not None:
      oprot.writeFieldBegin('message', TType.STRING, 1)
      oprot.writeString(self.message)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __str__(self):
    return repr(self)

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class PacketCaptureFile(object):
  """
  Attributes:
   - name
   - url
   - bytes
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'name', None, None, ), # 1
    (2, TType.STRING, 'url', None, None, ), # 2
    (3, TType.I32, 'bytes', None, 0, ), # 3
  )

  def __init__(self, name=None, url=None, bytes=thrift_spec[3][4],):
    self.name = name
    self.url = url
    self.bytes = bytes

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.STRING:
          self.name = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRING:
          self.url = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.I32:
          self.bytes = iprot.readI32();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('PacketCaptureFile')
    if self.name is not None:
      oprot.writeFieldBegin('name', TType.STRING, 1)
      oprot.writeString(self.name)
      oprot.writeFieldEnd()
    if self.url is not None:
      oprot.writeFieldBegin('url', TType.STRING, 2)
      oprot.writeString(self.url)
      oprot.writeFieldEnd()
    if self.bytes is not None:
      oprot.writeFieldBegin('bytes', TType.I32, 3)
      oprot.writeI32(self.bytes)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class PacketCapture(object):
  """
  Attributes:
   - ip
   - start_time
   - file
   - pid
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'ip', None, None, ), # 1
    (2, TType.I32, 'start_time', None, None, ), # 2
    (3, TType.STRUCT, 'file', (PacketCaptureFile, PacketCaptureFile.thrift_spec), None, ), # 3
    (4, TType.I32, 'pid', None, 0, ), # 4
  )

  def __init__(self, ip=None, start_time=None, file=None, pid=thrift_spec[4][4],):
    self.ip = ip
    self.start_time = start_time
    self.file = file
    self.pid = pid

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.STRING:
          self.ip = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I32:
          self.start_time = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.STRUCT:
          self.file = PacketCaptureFile()
          self.file.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.I32:
          self.pid = iprot.readI32();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('PacketCapture')
    if self.ip is not None:
      oprot.writeFieldBegin('ip', TType.STRING, 1)
      oprot.writeString(self.ip)
      oprot.writeFieldEnd()
    if self.start_time is not None:
      oprot.writeFieldBegin('start_time', TType.I32, 2)
      oprot.writeI32(self.start_time)
      oprot.writeFieldEnd()
    if self.file is not None:
      oprot.writeFieldBegin('file', TType.STRUCT, 3)
      self.file.write(oprot)
      oprot.writeFieldEnd()
    if self.pid is not None:
      oprot.writeFieldBegin('pid', TType.I32, 4)
      oprot.writeI32(self.pid)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class AccessToken(object):
  """
  Attributes:
   - token
   - interval
   - valid_until
  """

  thrift_spec = (
    None, # 0
    (1, TType.I32, 'token', None, None, ), # 1
    (2, TType.I32, 'interval', None, None, ), # 2
    (3, TType.I32, 'valid_until', None, None, ), # 3
  )

  def __init__(self, token=None, interval=None, valid_until=None,):
    self.token = token
    self.interval = interval
    self.valid_until = valid_until

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.I32:
          self.token = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I32:
          self.interval = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.I32:
          self.valid_until = iprot.readI32();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('AccessToken')
    if self.token is not None:
      oprot.writeFieldBegin('token', TType.I32, 1)
      oprot.writeI32(self.token)
      oprot.writeFieldEnd()
    if self.interval is not None:
      oprot.writeFieldBegin('interval', TType.I32, 2)
      oprot.writeI32(self.interval)
      oprot.writeFieldEnd()
    if self.valid_until is not None:
      oprot.writeFieldBegin('valid_until', TType.I32, 3)
      oprot.writeI32(self.valid_until)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)


================================================
FILE: atc/atc_thrift/atc_thrift.thrift
================================================
#
#  Copyright (c) 2014, Facebook, Inc.
#  All rights reserved.
#
#  This source code is licensed under the BSD-style license found in the
#  LICENSE file in the root directory of this source tree. An additional grant
#  of patent rights can be found in the PATENTS file in the same directory.
#
#
enum ReturnCode {
    OK = 0,
    INVALID_IP,
    INVALID_TIMEOUT,
    ID_EXHAUST,
    NETLINK_ERROR,
    UNKNOWN_ERROR,
    NETLINK_HTB_ERROR,
    UNKNOWN_HTB_ERROR,
    NETLINK_NETEM_ERROR,
    UNKNOWN_NETEM_ERROR,
    NETLINK_FW_ERROR,
    UNKNOWN_FW_ERROR,
    UNKNOWN_SESSION,
    UNKNOWN_IP,
    ACCESS_DENIED,
}

struct Delay {
  1: i32 delay,
  2: optional i32 jitter = 0,
  3: optional double correlation = 0,
}

struct Loss {
  1: double percentage,
  2: optional double correlation = 0,
}

struct Reorder {
  1: double percentage,
  2: i32 gap = 0,
  3: optional double correlation = 0,
}

struct Corruption {
  1: double percentage = 0,
  2: optional double correlation = 0,
}

struct Shaping {
  1: i32 rate,
  2: optional Delay delay = {"delay": 0},
  3: optional Loss loss = {"percentage": 0},
  4: optional Reorder reorder = {"percentage": 0},
  5: optional Corruption corruption = {"percentage": 0},
  6: optional list<string> iptables_options,
}

struct TrafficControlSetting {
  1: Shaping up,
  2: Shaping down,
}

struct TrafficControlledDevice {
  1: string controlledIP,
  2: optional string controllingIP,
}

struct RemoteControlInstance {
  1: TrafficControlledDevice device,
  2: optional i32 timeout,
}

struct TrafficControl {
  1: TrafficControlSetting settings,
  2: TrafficControlledDevice device,
  3: i32 timeout,
}

struct TrafficControlRc {
  1: ReturnCode code,
  2: optional string message,
}

exception TrafficControlException {
  1: ReturnCode code,
  2: optional string message,
}

exception PacketCaptureException {
  1: string message,
}

struct PacketCaptureFile {
  1: string name,
  2: string url,
  3: optional i32 bytes = 0,
}

struct PacketCapture {
  1: string ip,
  2: i32 start_time,
  3: PacketCaptureFile file,
  4: optional i32 pid = 0,
}

struct AccessToken {
  1: i32 token,
  2: i32 interval,
  3: i32 valid_until,
}

service Atcd {
  TrafficControlRc startShaping(1: TrafficControl tc)
    throws (1: TrafficControlException failure),
  TrafficControlRc stopShaping(1: TrafficControlledDevice device)
    throws (1: TrafficControlException failure),
  TrafficControl getCurrentShaping(1: TrafficControlledDevice device)
    throws (1: TrafficControlException failure),
  /* tell if whether of not an ip is shaped */
  bool isShaped(1: TrafficControlledDevice device)
    throws (1: TrafficControlException failure),
  PacketCapture startPacketCapture(1: TrafficControlledDevice device, 2: i32 timeout)
    throws (1: PacketCaptureException failure),
  PacketCapture stopPacketCapture(1: TrafficControlledDevice device)
    throws (1: PacketCaptureException failure),
  void stopAllPacketCaptures(),
  list<PacketCapture> listPacketCaptures(1: TrafficControlledDevice device)
    throws (1: TrafficControlException failure)
  list<PacketCapture> listRunningPacketCaptures(),
  /* returns the number of actively shaped devices */
  i32 getShapedDeviceCount(),
  /* Remote Control */
  AccessToken requestToken(1: string ip, 2: i32 duration),
  bool requestRemoteControl(1: TrafficControlledDevice device  2: AccessToken accessToken),
  list<RemoteControlInstance> getDevicesControlledBy(1: string ip),
  list<RemoteControlInstance> getDevicesControlling(1: string ip),
}


================================================
FILE: atc/atc_thrift/setup.cfg
================================================
[wheel]
universal = 1
[build]
executable = /usr/bin/env python


================================================
FILE: atc/atc_thrift/setup.py
================================================
#!/usr/bin/env python
#
#  Copyright (c) 2014, Facebook, Inc.
#  All rights reserved.
#
#  This source code is licensed under the BSD-style license found in the
#  LICENSE file in the root directory of this source tree. An additional grant
#  of patent rights can be found in the PATENTS file in the same directory.
#
#
import os
import sys
from setuptools import setup

version = '0.1.6'

readme = open('README.md', 'r')


if sys.argv[-1] == 'publish':
    if os.system("pip freeze | grep wheel"):
        print("wheel not installed.\nUse `pip install wheel`.\nExiting.")
        sys.exit()
    if os.system("pip freeze | grep twine"):
        print("twine not installed.\nUse `pip install twine`.\nExiting.")
        sys.exit()
    os.system("python setup.py sdist bdist_wheel")
    os.system("twine upload dist/*")
    print("You probably want to also tag the version now:")
    print("  git tag -a %s -m 'version %s'" % (version, version))
    print("  git push --tags")
    sys.exit()

setup(
    name='atc_thrift',
    version=version,
    description='ATC Thrift Library',
    author='Emmanuel Bretelle',
    author_email='chantra@fb.com',
    url='https://github.com/facebook/augmented-traffic-control',
    packages=['atc_thrift'],
    classifiers=['Programming Language :: Python', ],
    long_description=readme.read(),
    install_requires=['thrift']
)


================================================
FILE: atc/atcd/MANIFEST.in
================================================
include README.md
include requirements.txt


================================================
FILE: atc/atcd/README.md
================================================
# ATCD

## Introduction

ATCD is the `Augmented Traffic Control` (ATC) Daemon which is reponsible for
handling traffic shaping request for the devices.

`atcd` is written in python and provide a [Thrift](https://thrift.apache.org/) interface to interact with it.

## Requirements

In order to be able to shape traffic, `atcd` must be running on a router that forwards the packets of your devices.

`atcd` works at Layer 3 so it does shape traffic on a per IP basis, as such, the
`atcd` gateway **must** see the real IP of the devices. In other words, if you are using
NATting, all the devices behind the NAT will get shaped using the same shaping rules.

`atcd` depends on the following packages:

* python 2.7
* pyroute2==0.3.3
* pyotp==1.4.1
* sparts==0.7.1
* atc_thrift==0.1.6

## Installation

The easiest way to install `atcd` is to install it directly from [pip](https://pypi.python.org/pypi).

### From pip

``` bash
pip install atcd
```

### From source

``` bash
cd path/to/atcd
pip install .
```

## Configuration

`atcd` is configured via command line arguments, to get the full list of options
run:

```
atcd -h
```

The most important options to configure are:

* --atcd-wan: The interface used to connect to internet.
* --atcd-lan: The interface used to connect to your devices.
* --sqlite-file: The location where atcd will keep current device settings.

`atcd` init files for debian and rhel based distro can be found in the [chef cookbook](../../chef/atc/files/default/init.d/)

## How atcd works

### Overview

In order to shape traffic, `atcd` leverages Linux's builtin [Traffic Control subsystem][tchowto]. Communication with the Traffic Control subsystem is done over the netlink API and facilitated by [pyroute2][pyroute2], a pure python netlink library.

Packets that needs to be shaped are expected to be marked. Based on that mark, a classifier will put the packets in the right "buckets", which then will throttle the bandwith, add latency, drop packets, corrupt them... depending on the shaping settings.

The diagram below illustrate the flow an IP packet goes through:
![ATC Diagram][atc_diagram]

### In more details

#### Marking packets

Packets are marked by using iptables'`MARK` target within the `mangle` table. Marking is done as the packet traverses the router on the `FORWARD` chain, e.g when shaping packets for/to IPs 10.0.2.2, 10.0.2.4 and 10.0.2.5:

```bash
-A FORWARD -d 10.0.2.2/32 -i eth0 -j MARK --set-xmark 0x2/0xffffffff
-A FORWARD -s 10.0.2.2/32 -i eth1 -j MARK --set-xmark 0x2/0xffffffff
-A FORWARD -d 10.0.2.4/32 -i eth0 -j MARK --set-xmark 0x3/0xffffffff
-A FORWARD -s 10.0.2.4/32 -i eth1 -j MARK --set-xmark 0x3/0xffffffff
-A FORWARD -d 10.0.2.5/32 -i eth0 -j MARK --set-xmark 0x4/0xffffffff
-A FORWARD -s 10.0.2.5/32 -i eth1 -j MARK --set-xmark 0x4/0xffffffff
```
where `eth0` is the network interface that connects to the internet.

#### Shaping packets

The Traffic Controlling part is more complex. Below is what the shaping on the uplink may look like for 3 devices with IPs 10.0.2.2, 10.0.2.4 and 10.0.2.5:
```bash
# tc filter show dev eth0
filter parent 1: protocol ip pref 1 fw
filter parent 1: protocol ip pref 1 fw handle 0x2 classid 1:2  police 0x1 rate 100000bit burst 12000b mtu 2Kb action drop overhead 0b
ref 1 bind 1

filter parent 1: protocol ip pref 1 fw handle 0x3 classid 1:3  police 0x3 rate 200000bit burst 12000b mtu 2Kb action drop overhead 0b
ref 1 bind 1

filter parent 1: protocol ip pref 1 fw handle 0x4 classid 1:4  police 0x5 rate 200000bit burst 12000b mtu 2Kb action drop overhead 0b
ref 1 bind 1

# tc class show dev eth0
class htb 1:4 root leaf 8005: prio 0 rate 200000bit ceil 200000bit burst 1600b cburst 1600b
class htb 1:2 root leaf 8001: prio 0 rate 100000bit ceil 100000bit burst 1600b cburst 1600b
class htb 1:3 root leaf 8003: prio 0 rate 200000bit ceil 200000bit burst 1600b cburst 1600b
# tc qdisc show dev eth0
qdisc htb 1: root refcnt 2 r2q 10 default 0 direct_packets_stat 3755 direct_qlen 1000
qdisc netem 8001: parent 1:2 limit 1000 delay 10.0ms loss 1%
qdisc netem 8003: parent 1:3 limit 1000 delay 20.0ms loss 2%
qdisc netem 8005: parent 1:4 limit 1000 delay 20.0ms loss 2%
```

So what goes on? When a packets gets in, it goes through the root qdisc (line 4), which is virtually unlimited, filters are checked and if a packet is marked with mark 0x2, it will be passed onto the class with id 1:2 where throttling happens. After that, the packet is passed to its child qdisc that uses netem to provide packet loss, corruption, reordering... and then off it goes on the wire.

The diagram below represents how the `filter`, `class` and `qdisc` fit together:

```
                   root 1:
                    _ |_          <-- filter matching
                   /  |  \
                  /   |   \
                 /    |    \
               1:2   1:3   1:4    <-- bandwidth limits
                |     |     |
              8001: 8003:  8005:  <-- delay, packet loss, reordering and corruption
```

When requesting `atcd` to shape/unshape traffic for a given device, `atcd` will set/unset the needed `iptables` rules and `filter`, `class` and `qdisc` to control the traffic. Aside from this, it will run some periodic tasks for housekeeping (like expiring shaping settings...).

## Security

`atcd` has currently almost no authentication/authorization mechanism built-in. It is recommended to make `atcd` only listen on `localhost`, and offload the authentication to the API.

[tchowto]: http://www.tldp.org/HOWTO/Traffic-Control-HOWTO/
[pyroute2]: https://github.com/svinota/pyroute2
[atc_diagram]: https://facebook.github.io/augmented-traffic-control/images/atc_diagram.png


================================================
FILE: atc/atcd/atcd/AtcdDBQueueTask.py
================================================
#
#  Copyright (c) 2014, Facebook, Inc.
#  All rights reserved.
#
#  This source code is licensed under the BSD-style license found in the
#  LICENSE file in the root directory of this source tree. An additional grant
#  of patent rights can be found in the PATENTS file in the same directory.
#
#
from sqlite3 import OperationalError
from atcd.db_manager import SQLiteManager
from sparts.sparts import option
from sparts.tasks.queue import QueueTask


class AtcdDBQueueTask(QueueTask):
    OPT_PREFIX = 'sqlite'
    workers = 1

    DEFAULT_SQLITE_FILE = '/var/lib/atcd.db'

    sqlite_file = option(
        default=DEFAULT_SQLITE_FILE,
        metavar='SQLITE_FILE',
        help='Location to store the sqlite3 db [%(default)s]',
        name='file',
    )

    def initTask(self):
        super(AtcdDBQueueTask, self).initTask()
        try:
            self.sqlite_manager = SQLiteManager(self.sqlite_file, self.logger)
        except OperationalError:
            self.logger.exception(
                'Unable to initialize DB from file "{0}"'.format(
                    self.sqlite_file
                )
            )
            raise

    def execute(self, item, context):
        try:
            obj, action = item
        except ValueError:
            self.logger.exception('Error executing on item: {0}'.format(item))
            return
        try:
            func = getattr(self.sqlite_manager, action)
        except AttributeError:
            self.logger.exception(
                'unable to run action, {0}, no such method'.format(action)
            )
            raise
        try:
            if isinstance(obj, tuple):
                func(*obj)
            else:
                func(obj)
        except OperationalError:
            self.logger.exception("Unsupported operation")
            return

    def get_saved_shapings(self):
        return self.sqlite_manager.get_saved_shapings()


================================================
FILE: atc/atcd/atcd/AtcdDeviceTimeoutTask.py
================================================
#
#  Copyright (c) 2014, Facebook, Inc.
#  All rights reserved.
#
#  This source code is licensed under the BSD-style license found in the
#  LICENSE file in the root directory of this source tree. An additional grant
#  of patent rights can be found in the PATENTS file in the same directory.
#
#
from atcd.AtcdThriftHandlerTask import AtcdThriftHandlerTask
from sparts.tasks.periodic import PeriodicTask


class AtcdDeviceTimeoutTask(PeriodicTask):
    INTERVAL = 10.0

    def initTask(self):
        super(AtcdDeviceTimeoutTask, self).initTask()
        self.required_task = AtcdThriftHandlerTask.factory()

    def execute(self):
        AtcdMainTask = self.service.requireTask(
            self.required_task
        )
        AtcdMainTask.stop_expired_shapings()


================================================
FILE: atc/atcd/atcd/AtcdThriftHandlerTask.py
================================================
#!/usr/bin/env python
#
#  Copyright (c) 2014, Facebook, Inc.
#  All rights reserved.
#
#  This source code is licensed under the BSD-style license found in the
#  LICENSE file in the root directory of this source tree. An additional grant
#  of patent rights can be found in the PATENTS file in the same directory.
#
#
import functools
import logging
import logging.handlers
import os
import shlex
import socket
import subprocess
from subprocess import Popen
import time

from sparts.tasks.thrift import NBServerTask
from sparts.tasks.thrift import ThriftHandlerTask
from sparts.sparts import option

from atc_thrift import Atcd

# Atc thrift files
import atc_thrift.ttypes
from atc_thrift.ttypes import PacketCapture
from atc_thrift.ttypes import PacketCaptureException
from atc_thrift.ttypes import PacketCaptureFile
from atc_thrift.ttypes import ReturnCode
from atc_thrift.ttypes import TrafficControl
from atc_thrift.ttypes import TrafficControlException
from atc_thrift.ttypes import TrafficControlRc
from atc_thrift.ttypes import TrafficControlledDevice

from atcd.access_manager import AccessManager
from atcd.access_manager import AccessTokenException
from atcd.idmanager import IdManager
from atcd.AtcdDBQueueTask import AtcdDBQueueTask

from sqlite3 import OperationalError


def AccessCheck(func):
    @functools.wraps(func)
    def wrapper(self, tc_or_dev, *args, **kwargs):
        if isinstance(tc_or_dev, TrafficControl):
            dev = tc_or_dev.device
        elif isinstance(tc_or_dev, TrafficControlledDevice):
            dev = tc_or_dev
        else:
            raise TypeError(
                "You are using this decorator on the wrong kind of function."
                " Valid functions are `name(self, tc)` or `name(self, device)`"
            )
        if self.access_manager.access_allowed(dev):
            return func(self, tc_or_dev)
        else:
            raise TrafficControlException(
                code=ReturnCode.ACCESS_DENIED,
                message="The device {0} is not allowed to control {1}"
                .format(dev.controllingIP, dev.controlledIP),
            )

    return wrapper


def from_module_import_class(modulename, classname):
    """Import a class from a module.

    Allows importing a class from a module by using the class and module name
    as strings.
    ex: from_module_import_class('os.path', 'basename')

    Args:
        modulename: A string containing the name of the module to import from.
        classname: A string containing the name of the class to import.

    Returns:
        None

    Raises:
        AttributeError: An error accessing the class.
        ImportError: An error accessing the module.
    """
    klass = getattr(
        __import__(modulename, globals(), locals(), [classname], -1),
        classname
    )
    globals()[classname] = klass


class AtcdNBServerTask(NBServerTask):
    """Atcd Non Blocking Thrift server.

    Overrides sparks' Non blocking thrift server defaults for Atcd use.
    """
    DEFAULT_PORT = 9090
    DEFAULT_HOST = '127.0.0.1'


class AtcdThriftHandlerTask(ThriftHandlerTask):
    """Atcd's thrift handler.

    This is the main entry point of the program that implements the atcd.thrift
    interface definition.
    Platform specific behaviour will be implemented in Atcd`Platform`Shaper
    class.
    """
    ID_MANAGER_ID_MIN = 1
    ID_MANAGER_ID_MAX = 2**16

    MODULE = Atcd
    DEPS = [AtcdDBQueueTask]
    DEFAULT_LAN = 'eth1'
    DEFAULT_WAN = 'eth0'
    DEFAULT_IPTABLES = '/sbin/iptables'
    DEFAULT_TCPDUMP = '/usr/sbin/tcpdump'
    DEFAULT_PCAP_DIR = '/tmp'
    DEFAULT_PCAP_URL_BASE = 'http://localhost:80'
    DEFAULT_BURST_SIZE = 12000
    DEFAULT_MODE = 'secure'

    OPT_PREFIX = 'atcd'

    lan_name = option(
        default=DEFAULT_LAN,
        metavar='LAN',
        help='name of the LAN interface [%(default)s]',
        name='lan',
    )
    wan_name = option(
        default=DEFAULT_WAN,
        metavar='WAN',
        help='name of the WAN interface [%(default)s]',
        name='wan',
    )
    iptables = option(
        default=DEFAULT_IPTABLES,
        metavar='IPTABLES',
        help='location of the iptables binary [%(default)s]'
    )
    tcpdump = option(
        default=DEFAULT_TCPDUMP,
        metavar='TCPDUMP',
        help='location of the tcpdump binary [%(default)s]'
    )
    pcap_dir = option(
        default=DEFAULT_PCAP_DIR,
        metavar='PCAP_DIR',
        help='Directory to store pcap files [%(default)s]'
    )
    pcap_url_base = option(
        default=DEFAULT_PCAP_URL_BASE,
        metavar='PCAP_URL_BASE',
        help='URL for pcap service [%(default)s]'
    )
    burst_size = option(
        default=DEFAULT_BURST_SIZE,
        metavar='BURST_SIZE',
        type=int,
        help='Amount of bytes that can be burst at a capped speed '
                '[%(default)s]'
    )
    dont_drop_packets = option(
        action='store_true',
        help='[EXPERIMENTAL] Do not drop packets when going above max allowed'
             ' rate. Packets will be queued instead. Please mind that this'
             ' option will likely disappear in the future and is only provided'
             '  as a workaround until better longer term solution is found.',
    )
    fresh_start = option(
        action='store_true',
        help='Bypass saved shapings from a previous run [%(default)s]',
    )

    mode = option(
        choices=['secure', 'unsecure'],
        default=DEFAULT_MODE,
        help='In which mode should atcd run? [%(default)s]',
    )

    @staticmethod
    def factory():
        """Static method to discover and import the shaper to use.

        Discover the platform on which Atcd is running and import the shaping
        backend for this platform.

        Returns:
            The shaping backend class

        Raises:
            NotImplementedError: the shaping backend class couldn't be imported
        """
        os_name = os.uname()[0]
        klass = 'Atcd{0}Shaper'.format(os_name)
        # If not imported yet, try to import
        try:
            if klass not in globals():
                from_module_import_class(
                    'atcd.backends.{0}'.format(os_name.lower()), klass
                )
        except AttributeError:
            raise NotImplementedError('{0} is not implemented!'.format(klass))
        except ImportError:
            raise NotImplementedError(
                '{0} backend is not implemented!'.format(os_name.lower())
            )
        return globals()[klass]

    def initTask(self):
        """Thrift handler task initialization.

        Performs the steps needed to initialize the shaping subsystem.
        """
        super(AtcdThriftHandlerTask, self).initTask()

        # Do this first because it can error out and it's better to
        # error out before touching the networking stacks
        self.db_task = self.service.tasks.AtcdDBQueueTask

        self.lan = {'name': self.lan_name}
        self.wan = {'name': self.wan_name}
        self._links_lookup()

        self._ip_to_id_map = {}
        self._id_to_ip_map = {}
        self.initialize_id_manager()
        self.ip_to_pcap_proc_map = {}
        self.initialize_shaping_system()

        # Map of IP address to tc object that is currently
        # being used to shape traffic from that IP.
        # {ip: {'tc': tc, 'timeout': timeout}}
        # {'10.0.0.1': {'tc': TrafficControl(...), 'timeout': 1234567890.1234}}
        self._current_shapings = {}

        self.access_manager = AccessManager(secure=self.mode != 'unsecure')
        if not self.fresh_start:
            self.logger.info('Restoring shaped connection from DB')
            self._restore_saved_shapings()

    def _links_lookup(self):
        """Initialize our mapping from network interface name to their device
        id. Will raise and exception if one of the device is not found
        """
        raise NotImplementedError('Subclass should implement this')

    def initialize_id_manager(self):
        """Initialize the Id Manager. This is architecture dependant as the
        shaping subsystems may have different requirements.
        """
        self.idmanager = IdManager(
            first_id=type(self).ID_MANAGER_ID_MIN,
            max_id=type(self).ID_MANAGER_ID_MAX
        )

    def _restore_saved_shapings(self):
        """Restore the shapings from the sqlite3 db.
        """
        # Isolate the things we are using eval on to reduce possible clownyness
        # later on, also this way we don't have unused imports from importing
        # blindly for eval
        names = [
            'TrafficControlledDevice', 'TrafficControl', 'Shaping',
            'TrafficControlSetting', 'Loss', 'Delay', 'Corruption', 'Reorder'
        ]
        globals = {name: getattr(atc_thrift.ttypes, name) for name in names}

        # CurrentShapings(ip varchar primary key, tc blob, timeout int)
        results = []
        try:
            results = self.db_task.get_saved_shapings()
        except OperationalError:
            self.logger.exception('Unable to perform DB operation')
        for result in results:
            tc = eval(result['tc'], globals)
            timeout = float(result['timeout'])
            if timeout > time.time():
                tc.timeout = timeout - time.time()
                try:
                    self.startShaping(tc)
                except TrafficControlException as e:
                    # We have a shaping set in database that is denied
                    # probably because it was set in unsecure mode, passing
                    if (
                            e.code == ReturnCode.ACCESS_DENIED and
                            self.mode == 'secure'):
                        self.logger.warn(
                            'Shaping Denied in secure mode, passing:'
                            ' {0}'.format(e.message)
                        )
                        continue
                    raise
            else:
                self.db_task.queue.put(
                    (tc.device.controlledIP, 'remove_shaping')
                )

    def stop(self):
        """Implements sparts.vtask.VTask.stop()

        Each shaping platform should implement its own in order to clean
        its state before shutting down the main loop.
        """
        raise NotImplementedError('Subclass should implement this')

    def initialize_shaping_system(self):
        """Initialize the shaping subsystem.

        Each shaping platform should implement its own.
        """
        raise NotImplementedError('Subclass should implement this')

    def set_logger(self):
        """Initialize the logging subsystem.
        """
        self.logger = logging.getLogger(__name__)
        self.logger.setLevel(logging.DEBUG)
        fmt = logging.Formatter(fmt=logging.BASIC_FORMAT)
        # create console handler and set level to debug
        ch = logging.StreamHandler()
        ch.setLevel(logging.DEBUG)
        ch.setFormatter(fmt=fmt)
        self.logger.addHandler(ch)
        # create syslog handler and set level to debug
        sh = logging.handlers.SysLogHandler(address='/dev/log')
        sh.setLevel(logging.DEBUG)
        sh.setFormatter(fmt=fmt)
        self.logger.addHandler(sh)

    def getShapedDeviceCount(self):
        """Get the number of devices currently being shaped.

        Returns:
            The number of devices currently shaped.
        """
        self.logger.info("Request getShapedDeviceCount")
        return len(self._ip_to_id_map)

    @AccessCheck
    def startShaping(self, tc):
        """Start shaping a connection for a given device.

        Implements the `startShaping` thrift method.
        If the connection is already being shaped, the shaping will be updated
        and the old one deleted.

        Args:
            A TrafficControl object that contains the device to be shaped, the
            settings and the timeout.

        Returns:
            A TrafficControlRc object with code and message set to reflect
            success/failure.

        Raises:
            A TrafficControlException with code and message set on uncaught
            exception.
        """
        self.logger.info("Request startShaping {0}".format(tc))
        # Sanity checking
        # IP
        try:
            socket.inet_aton(tc.device.controlledIP)
        except Exception as e:
            return TrafficControlRc(
                code=ReturnCode.INVALID_IP,
                message="Invalid IP {}".format(tc.device.controlledIP))
        # timer
        if tc.timeout < 0:
            return TrafficControlRc(
                code=ReturnCode.INVALID_TIMEOUT,
                message="Invalid Timeout {}".format(tc.timeout))

        new_id = None
        try:
            new_id = self.idmanager.new()
        except Exception as e:
            return TrafficControlRc(
                code=ReturnCode.ID_EXHAUST,
                message="No more session available: {0}".format(e))

        old_id = self._ip_to_id_map.get(tc.device.controlledIP, None)
        old_settings = self._current_shapings.get(
            tc.device.controlledIP, {}
        ).get('tc')

        tcrc = self._shape_interface(
            new_id,
            self.wan,
            tc.device.controlledIP,
            tc.settings.up,
        )
        if tcrc.code != ReturnCode.OK:
            return tcrc
        tcrc = self._shape_interface(
            new_id,
            self.lan,
            tc.device.controlledIP,
            tc.settings.down,
        )
        # If we failed to set shaping for LAN interfaces, we should remove
        # the shaping we just created for the WAN
        if tcrc.code != ReturnCode.OK:
            self._unshape_interface(
                new_id,
                self.wan,
                tc.device.controlledIP,
                tc.settings.up
            )
            return tcrc
        self._add_mapping(new_id, tc)
        self.db_task.queue.put(((tc, tc.timeout + time.time()), 'add_shaping'))
        # if there were an existing id, remove it from dict
        if old_id is not None:
            self._unshape_interface(
                old_id,
                self.wan,
                tc.device.controlledIP,
                old_settings.settings.up,
            )
            self._unshape_interface(
                old_id,
                self.lan,
                tc.device.controlledIP,
                old_settings.settings.down,
            )
            del self._id_to_ip_map[old_id]
            self.idmanager.free(old_id)

        return TrafficControlRc(code=ReturnCode.OK)

    @AccessCheck
    def stopShaping(self, dev):
        """Stop shaping a connection for a given traffic controlled device.

        Implements the `stopShaping` thrift method.

        Args:
            A TrafficControlledDevice object that contains the shaped device.

        Returns:
            A TrafficControlRc object with code and message set to reflect
            success/failure.

        Raises:
            A TrafficControlException with code and message set on uncaught
            exception.
        """
        self.logger.info(
            "Request stopShaping for ip {0}".format(dev.controlledIP)
        )
        try:
            socket.inet_aton(dev.controlledIP)
        except Exception as e:
            return TrafficControlRc(
                code=ReturnCode.INVALID_IP,
                message="Invalid IP {0}: {1}".format(dev.controlledIP, e))

        id = self._ip_to_id_map.get(dev.controlledIP, None)
        shaping = self._current_shapings.get(dev.controlledIP, {}).get('tc')
        if id is not None:
            self._unshape_interface(
                id,
                self.wan,
                dev.controlledIP,
                shaping.settings.up,
            )
            self._unshape_interface(
                id,
                self.lan,
                dev.controlledIP,
                shaping.settings.down,
            )
            self._del_mapping(id, dev.controlledIP)
            self.db_task.queue.put((dev.controlledIP, 'remove_shaping'))
            self.idmanager.free(id)
        else:
            return TrafficControlRc(
                code=ReturnCode.UNKNOWN_SESSION,
                message="No session for IP {} found".format(dev.controlledIP))
        return TrafficControlRc(code=ReturnCode.OK)

    def _unshape_interface(self, mark, eth, ip, settings):
        """Unshape traffic for a given IP/setting on a network interface
        """
        raise NotImplementedError('Subclass should implement this')

    def _shape_interface(self, mark, eth, ip, shaping):
        """Shape traffic for a given IP
        """
        raise NotImplementedError('Subclass should implement this')

    def isShaped(self, dev):
        self.logger.info(
            "Request isShaped for ip {0}".format(dev.controlledIP)
        )
        return dev.controlledIP in self._ip_to_id_map

    def getCurrentShaping(self, dev):
        """Get the TrafficControl object used to shape a
            TrafficControlledDevice.

        Args:
            dev: a TrafficControlledDevice.

        Returns:
            A TrafficControl object representing the current shaping for the
            device.

        Raises:
            A TrafficControlException if there is no TC object for that IP
        """

        self.logger.info(
            'Request getCurrentShaping for ip {0}'.format(dev.controlledIP)
        )
        shaping = self._current_shapings.get(dev.controlledIP, {}).get('tc')
        if shaping is None:
            raise TrafficControlException(
                code=ReturnCode.UNKNOWN_IP,
                message='This IP ({0}) is not being shaped'.format(
                    dev.controlledIP
                )
            )
        return shaping

    def _add_mapping(self, id, tc):
        """Adds a mapping from id to IP address and vice versa.

        It also updates the dict mapping IPs to TrafficControl configs.

        Args:
            id: the id to map.
            tc: the TrafficControl object to map.
        """
        self._id_to_ip_map[id] = tc.device.controlledIP
        self._ip_to_id_map[tc.device.controlledIP] = id
        self._current_shapings[tc.device.controlledIP] = {
            'tc': tc, 'timeout': time.time() + tc.timeout}

    def _del_mapping(self, id, ip):
        """Removes mappings from IP to id and id to IP.

        Also  remove the mapping from IP to TrafficControl configs.
        """

        try:
            del self._id_to_ip_map[id]
            del self._ip_to_id_map[ip]
            del self._current_shapings[ip]
        except KeyError:
            self.logger.exception('Unable to remove key from dict')

    def run_cmd(self, cmd):
        self.logger.info("Running {}".format(cmd))
        return subprocess.call(shlex.split(cmd))

    def _pcap_filename(self, ip, start_time):
        return "%s_%d.cap" % (ip, start_time)

    def _pcap_parse_filename(self, filename):
        if filename.endswith(".cap"):
            ip, start_time = filename.replace(".cap", "").split("_")
            return ip, int(start_time)

    def _pcap_url(self, filename):
        return os.path.join(self.pcap_url_base, filename)

    def _pcap_full_path(self, filename):
        return os.path.join(self.pcap_dir, filename)

    def _pcap_file_size(self, filename):
        try:
            return int(os.path.getsize(self._pcap_full_path(filename)))
        except OSError:
            return 0

    def _cleanup_packet_capture_procs(self):
        '''Delete finished procs from the map'''
        for ip, p in self.ip_to_pcap_proc_map.items():
            if not p or p.poll() is not None:
                del self.ip_to_pcap_proc_map[ip]

    @AccessCheck
    def startPacketCapture(self, dev, timeout=3600):
        """Start a tcpdump process to capture packets for an ipaddr.

        The process will run until the timeout expires or stopPacketCapture()
        is called.

        Args:
            dev: a TrafficControlledDevice.
            timeout: int Max time for tcpdump process to run.

        Returns:
            True if process started ok, otherwise False.
        """
        self.logger.info(
            "Request startPacketCapture for ip {0}, timeout {1}".format(
                dev.controlledIP, timeout))
        start_time = time.time()
        filename = self._pcap_filename(dev.controlledIP, start_time)
        cmd = """timeout {timeout!s}
            {tcpdump} -vvv -s0 -i {eth} -w {filepath} host {ip}""".format(
            timeout=timeout,
            tcpdump=self.tcpdump,
            eth=self.lan["name"],
            filepath=self._pcap_full_path(filename),
            ip=dev.controlledIP)
        # Daemonize set the umask to 0o27 which prevents the http proxy service
        # from reading the file. For lack of better solution for now, we can
        # change the umask before spawning the subprocess and then restore its
        # original value
        umask = os.umask(0)
        p = Popen(shlex.split(cmd))
        os.umask(umask)
        if p and p.poll() is None:
            p.pcap = PacketCapture(
                ip=dev.controlledIP,
                start_time=start_time,
                file=PacketCaptureFile(
                    name=filename,
                    url=self._pcap_url(filename),
                    bytes=0),
                pid=p.pid)
            self.ip_to_pcap_proc_map[dev.controlledIP] = p
            return p.pcap
        else:
            raise PacketCaptureException(
                message="Failed to start tcpdump process")

    @AccessCheck
    def stopPacketCapture(self, dev):
        """Stop a tcpdump process that was started with startPacketCapture().

        Args:
           dev: a TrafficControlledDevice.

        Returns:
           The HTTP URL for the pcap file or empty string.
        """
        self.logger.info(
            "Request stopPacketCapture for ip {0}".format(dev.controlledIP)
        )
        self._cleanup_packet_capture_procs()
        if dev.controlledIP in self.ip_to_pcap_proc_map:
            p = self.ip_to_pcap_proc_map[dev.controlledIP]
            p.terminate()
            # Wait a few secs for processes to die, while cleaning up dead ones
            max_secs = 5
            start_time = time.time()
            while p.poll() is None and (time.time() - start_time) < max_secs:
                time.sleep(0.5)
            if p.poll() is None:
                p.kill()
            p.pcap.file.bytes = self._pcap_file_size(p.pcap.file.name)
            return p.pcap
        else:
            raise PacketCaptureException(
                message="No capture proc for given ipaddr")

    def stopAllPacketCaptures(self):
        """Stop all running tcpdump procs.
        """
        self.logger.info("Request stopAllPacketCaptures")
        self._cleanup_packet_capture_procs()
        if self.ip_to_pcap_proc_map:
            for p in self.ip_to_pcap_proc_map.values():
                p.terminate()
            # Wait a few secs for processes to die, while cleaning up dead ones
            max_secs = 5
            start_time = time.time()
            while self.ip_to_pcap_proc_map and \
                    (time.time() - start_time) < max_secs:
                time.sleep(0.5)
                self._cleanup_packet_capture_procs()
        if self.ip_to_pcap_proc_map:
            for p in self.ip_to_pcap_proc_map.values():
                p.kill()

    def listPacketCaptures(self, dev):
        """List the packet captures available for a given device.

        Args:
            dev: a TrafficControlledDevice.

        Returns:
            A list of PacketCapture ojbects.
        """
        ip = dev.controlledIP
        self.logger.info("Request listPacketCaptures for ip {0}".format(ip))
        pcap_list = []
        for filename in os.listdir(self.pcap_dir):
            if not filename.endswith(".cap"):
                continue
            file_ip, start_time = self._pcap_parse_filename(filename)
            if not file_ip == ip:
                continue
            pcap = PacketCapture(
                ip=ip,
                start_time=start_time,
                file=PacketCaptureFile(
                    name=filename,
                    url=self._pcap_url(filename),
                    bytes=self._pcap_file_size(filename)))
            pcap_list.append(pcap)
        return pcap_list

    def listRunningPacketCaptures(self):
        """List the running packet captures.

        Returns:
           A list of PacketCapture ojbects.
        """
        self.logger.info("Request listRunningPacketCaptures")
        pcap_list = []
        self._cleanup_packet_capture_procs()
        for ip, p in self.ip_to_pcap_proc_map.items():
            p.pcap.file.bytes = self._pcap_file_size(p.pcap.file.name)
            pcap_list.append(p.pcap)
        return pcap_list

    def stop_expired_shapings(self):
        """Stop shaping that have expired.
        """
        expired_devs = [
            attrs['tc'].device
            for ip, attrs in self._current_shapings.iteritems()
            if attrs['timeout'] <= time.time()
        ]
        for dev in expired_devs:
            self.logger.info('Shaping for Device "{0}" expired'.format(dev))
            self.logger.debug('calling stopShaping for "{0}"'.format(dev))
            self.stopShaping(dev)

    def requestToken(self, ip, duration):
        """Returns a unique, random access code.

        Random token to be given to a host to control the `ip`.
        The token validity is limited in time.

        Args:
            ip: The IP to control.
            duration: How long the token will be valid for.

        Returns:
            An AccessToken.
        """

        self.logger.info(
            "Request requestToken({0}, {1})".format(ip, duration)
        )
        token = self.access_manager.generate_token(ip, duration)
        return token

    def requestRemoteControl(self, dev, accessToken):
        """Request to control a remote device.

        Returns true if the token given is a valid token for the remote IP
            according to the totp object stored for that IP

        Args:
            dev: The TrafficControlledDevice.
            accessToken: The token to grant access.
        Returns:
            True if access is granted, False otherwise.
        """

        self.logger.info(
            "Request requestControl({0}, {1})".format(dev, accessToken)
        )
        access_granted = False
        try:
            self.access_manager.validate_token(
                dev,
                accessToken,
            )
            access_granted = True
        except AccessTokenException:
            self.logger.exception("Access Denied for request")
        return access_granted

    def getDevicesControlledBy(self, ip):
        """Get the devices controlled by a given IP.

        Args:
            ip: The IP of the controlling host.

        Returns:
            A list of RemoteControlInstance.
        """
        return self.access_manager.get_devices_controlled_by(ip)

    def getDevicesControlling(self, ip):
        """Get the devices controlling a given IP.

        Args:
            ip: The IP of the controlled host.

        Returns:
            A list of RemoteControlInstance.
        """
        return self.access_manager.get_devices_controlling(ip)


================================================
FILE: atc/atcd/atcd/AtcdVService.py
================================================
#
#  Copyright (c) 2014, Facebook, Inc.
#  All rights reserved.
#
#  This source code is licensed under the BSD-style license found in the
#  LICENSE file in the root directory of this source tree. An additional grant
#  of patent rights can be found in the PATENTS file in the same directory.
#
#
import logging
import os
import sys

from sparts.vservice import VService


class AtcdVService(VService):
    def initLogging(self):
        super(AtcdVService, self).initLogging()
        sh = logging.handlers.SysLogHandler(address=self._syslog_address())
        sh.setLevel(logging.DEBUG)
        self.logger.addHandler(sh)
        # Make sparts.tasks logging go to syslog
        sparts_tasks_logger = logging.getLogger('sparts.tasks')
        sparts_tasks_logger.addHandler(sh)

    def _syslog_address(self):
        address = None
        if sys.platform == 'linux2':
            address = '/dev/log'
        elif sys.platform == 'darwin':
            address = '/var/run/syslog'

        if address is None or not os.path.exists(address):
            address = ('localhost', 514)
        return address


================================================
FILE: atc/atcd/atcd/__init__.py
================================================
__version__ = '0.1.6'


================================================
FILE: atc/atcd/atcd/access_manager.py
================================================
#
#  Copyright (c) 2014, Facebook, Inc.
#  All rights reserved.
#
#  This source code is licensed under the BSD-style license found in the
#  LICENSE file in the root directory of this source tree. An additional grant
#  of patent rights can be found in the PATENTS file in the same directory.
#
#
import datetime
import pyotp
import time

from atc_thrift.ttypes import AccessToken
from atc_thrift.ttypes import TrafficControlledDevice
from atc_thrift.ttypes import RemoteControlInstance


def _dev_to_tuple(device):
    return device.controllingIP, device.controlledIP


def _tuple_to_dev(tup):
    return TrafficControlledDevice(
        controllingIP=tup[0],
        controlledIP=tup[1],
    )


def _remote_control_instance(tup, timeout):
    return RemoteControlInstance(
        device=_tuple_to_dev(tup),
        timeout=timeout,
    )


class AccessTokenException(Exception):
    pass


class AtcdTOTP(pyotp.TOTP):
    def valid_until(self, for_time):
        """
        Returns the time that a code will expire, given a Time object.

        @param [Time] Time object
        @return [Time] time the code that would be generated at `for_time`
        is valid until
        """
        valid_time = (self.timecode(for_time) + 1) * self.interval
        valid_datetime = datetime.datetime.fromtimestamp(valid_time)
        return valid_datetime


class AccessManager(object):
    ACCESS_TOKEN_INTERVAL = 60

    def __init__(self, secure=True):
        self._ip_to_totp_map = {}
        self._control_allowed = {}
        self.secure = secure

    def generate_token(self, ip, duration):
        """
        takes an ip to generate an AccessToken for and a durati
Download .txt
gitextract_y89j86nr/

├── .coveragerc
├── .github/
│   └── ISSUE_TEMPLATE.md
├── .gitignore
├── .pep8
├── .rubocop.yml
├── .travis.yml
├── CHANGELOG.md
├── CONTRIBUTING.md
├── CONTRIBUTORS.md
├── LICENSE
├── Makefile
├── PATENTS
├── README.md
├── Setup.md
├── atc/
│   ├── atc_thrift/
│   │   ├── MANIFEST.in
│   │   ├── Makefile
│   │   ├── README.md
│   │   ├── __init__.py
│   │   ├── atc_thrift/
│   │   │   ├── Atcd-remote
│   │   │   ├── Atcd.py
│   │   │   ├── __init__.py
│   │   │   ├── constants.py
│   │   │   └── ttypes.py
│   │   ├── atc_thrift.thrift
│   │   ├── setup.cfg
│   │   └── setup.py
│   ├── atcd/
│   │   ├── MANIFEST.in
│   │   ├── README.md
│   │   ├── atcd/
│   │   │   ├── AtcdDBQueueTask.py
│   │   │   ├── AtcdDeviceTimeoutTask.py
│   │   │   ├── AtcdThriftHandlerTask.py
│   │   │   ├── AtcdVService.py
│   │   │   ├── __init__.py
│   │   │   ├── access_manager.py
│   │   │   ├── backends/
│   │   │   │   ├── __init__.py
│   │   │   │   └── linux.py
│   │   │   ├── db_manager.py
│   │   │   ├── idmanager.py
│   │   │   ├── scripts/
│   │   │   │   ├── __init__.py
│   │   │   │   └── runner.py
│   │   │   └── tools/
│   │   │       └── test_secure_access.py
│   │   ├── bin/
│   │   │   └── atcd
│   │   ├── requirements/
│   │   │   └── requirements-testing.txt
│   │   ├── requirements.txt
│   │   ├── setup.cfg
│   │   ├── setup.py
│   │   └── tests/
│   │       ├── idmanager_test.py
│   │       ├── test_AtcdDBQueueTask.py
│   │       ├── test_AtcdThriftHandlerTask.py
│   │       ├── test_AtcdVService.py
│   │       ├── test_access_manager.py
│   │       └── test_sqlite_manager.py
│   ├── django-atc-api/
│   │   ├── MANIFEST.in
│   │   ├── README.md
│   │   ├── atc_api/
│   │   │   ├── __init__.py
│   │   │   ├── atcd_client.py
│   │   │   ├── serializers.py
│   │   │   ├── settings.py
│   │   │   ├── static/
│   │   │   │   └── js/
│   │   │   │       └── atc-api.js
│   │   │   ├── urls.py
│   │   │   ├── utils.py
│   │   │   └── views.py
│   │   ├── setup.cfg
│   │   └── setup.py
│   ├── django-atc-demo-ui/
│   │   ├── MANIFEST.in
│   │   ├── README.md
│   │   ├── atc_demo_ui/
│   │   │   ├── __init__.py
│   │   │   ├── settings.py
│   │   │   ├── static/
│   │   │   │   ├── css/
│   │   │   │   │   └── atc.css
│   │   │   │   ├── js/
│   │   │   │   │   ├── atc-auth.js
│   │   │   │   │   ├── atc-profiles.js
│   │   │   │   │   ├── atc-shaping.js
│   │   │   │   │   ├── atc-utils.js
│   │   │   │   │   └── atc.js
│   │   │   │   └── vendor/
│   │   │   │       └── react/
│   │   │   │           ├── JSXTransformer-0.13.3.js
│   │   │   │           └── react-0.13.3.js
│   │   │   ├── templates/
│   │   │   │   └── atc_demo_ui/
│   │   │   │       ├── base.html
│   │   │   │       ├── index.html
│   │   │   │       └── shaping_settings.html
│   │   │   ├── urls.py
│   │   │   └── views.py
│   │   ├── requirements.txt
│   │   ├── setup.cfg
│   │   └── setup.py
│   └── django-atc-profile-storage/
│       ├── MANIFEST.in
│       ├── README.md
│       ├── atc_profile_storage/
│       │   ├── __init__.py
│       │   ├── migrations/
│       │   │   ├── 0001_initial.py
│       │   │   └── __init__.py
│       │   ├── models.py
│       │   ├── serializers.py
│       │   ├── static/
│       │   │   └── js/
│       │   │       └── atc-profile-storage.js
│       │   ├── urls.py
│       │   └── views.py
│       ├── setup.cfg
│       └── setup.py
├── chef/
│   ├── atc/
│   │   ├── .gitignore
│   │   ├── .kitchen.yml
│   │   ├── Berksfile
│   │   ├── Gemfile
│   │   ├── LICENSE
│   │   ├── README.md
│   │   ├── Thorfile
│   │   ├── Vagrantfile
│   │   ├── attributes/
│   │   │   └── default.rb
│   │   ├── chefignore
│   │   ├── files/
│   │   │   └── default/
│   │   │       └── init.d/
│   │   │           ├── atcd.debian
│   │   │           └── atcd.rhel
│   │   ├── genymotion.sh
│   │   ├── libraries/
│   │   │   └── default.rb
│   │   ├── metadata.rb
│   │   ├── providers/
│   │   │   ├── install_packages.rb
│   │   │   └── install_virtualenv_packages.rb
│   │   ├── recipes/
│   │   │   ├── _common_system.rb
│   │   │   ├── _virtualenv.rb
│   │   │   ├── atcd.rb
│   │   │   ├── atcui.rb
│   │   │   └── default.rb
│   │   ├── resources/
│   │   │   ├── install_packages.rb
│   │   │   └── install_virtualenv_packages.rb
│   │   └── templates/
│   │       └── default/
│   │           ├── atcui-setup.erb
│   │           ├── config/
│   │           │   ├── atcd.erb
│   │           │   └── atcui.erb
│   │           ├── django/
│   │           │   ├── settings.py.erb
│   │           │   └── urls.py.erb
│   │           ├── mount-udev.rules.erb
│   │           └── upstart/
│   │               └── atcui.conf.erb
│   └── atcclient/
│       ├── .gitignore
│       ├── Berksfile
│       ├── Gemfile
│       ├── LICENSE
│       ├── README.md
│       ├── Thorfile
│       ├── Vagrantfile
│       ├── chefignore
│       ├── libraries/
│       │   └── patch.rb
│       ├── metadata.rb
│       └── recipes/
│           └── default.rb
├── tests/
│   ├── Vagrantfile
│   ├── __init__.py
│   ├── host.py
│   ├── local-test.py
│   ├── provision.sh
│   ├── speed.py
│   ├── tests.py
│   ├── vagrant.py
│   └── vms.py
├── tox.ini
└── utils/
    ├── dump_system_info.sh
    ├── profiles/
    │   ├── 2G-DevelopingRural.json
    │   ├── 2G-DevelopingUrban.json
    │   ├── 3G-Average.json
    │   ├── 3G-Good.json
    │   ├── Cable.json
    │   ├── DSL.json
    │   ├── Edge-Average.json
    │   ├── Edge-Good.json
    │   ├── Edge-Lossy.json
    │   └── NoConnectivity.json
    └── restore-profiles.sh
Download .txt
SYMBOL INDEX (1361 symbols across 46 files)

FILE: atc/atc_thrift/atc_thrift/Atcd.py
  class Iface (line 20) | class Iface(object):
    method startShaping (line 21) | def startShaping(self, tc):
    method stopShaping (line 28) | def stopShaping(self, device):
    method getCurrentShaping (line 35) | def getCurrentShaping(self, device):
    method isShaped (line 42) | def isShaped(self, device):
    method startPacketCapture (line 49) | def startPacketCapture(self, device, timeout):
    method stopPacketCapture (line 57) | def stopPacketCapture(self, device):
    method stopAllPacketCaptures (line 64) | def stopAllPacketCaptures(self):
    method listPacketCaptures (line 67) | def listPacketCaptures(self, device):
    method listRunningPacketCaptures (line 74) | def listRunningPacketCaptures(self):
    method getShapedDeviceCount (line 77) | def getShapedDeviceCount(self):
    method requestToken (line 80) | def requestToken(self, ip, duration):
    method requestRemoteControl (line 88) | def requestRemoteControl(self, device, accessToken):
    method getDevicesControlledBy (line 96) | def getDevicesControlledBy(self, ip):
    method getDevicesControlling (line 103) | def getDevicesControlling(self, ip):
  class Client (line 111) | class Client(Iface):
    method __init__ (line 112) | def __init__(self, iprot, oprot=None):
    method startShaping (line 118) | def startShaping(self, tc):
    method send_startShaping (line 126) | def send_startShaping(self, tc):
    method recv_startShaping (line 134) | def recv_startShaping(self):
    method stopShaping (line 150) | def stopShaping(self, device):
    method send_stopShaping (line 158) | def send_stopShaping(self, device):
    method recv_stopShaping (line 166) | def recv_stopShaping(self):
    method getCurrentShaping (line 182) | def getCurrentShaping(self, device):
    method send_getCurrentShaping (line 190) | def send_getCurrentShaping(self, device):
    method recv_getCurrentShaping (line 198) | def recv_getCurrentShaping(self):
    method isShaped (line 214) | def isShaped(self, device):
    method send_isShaped (line 222) | def send_isShaped(self, device):
    method recv_isShaped (line 230) | def recv_isShaped(self):
    method startPacketCapture (line 246) | def startPacketCapture(self, device, timeout):
    method send_startPacketCapture (line 255) | def send_startPacketCapture(self, device, timeout):
    method recv_startPacketCapture (line 264) | def recv_startPacketCapture(self):
    method stopPacketCapture (line 280) | def stopPacketCapture(self, device):
    method send_stopPacketCapture (line 288) | def send_stopPacketCapture(self, device):
    method recv_stopPacketCapture (line 296) | def recv_stopPacketCapture(self):
    method stopAllPacketCaptures (line 312) | def stopAllPacketCaptures(self):
    method send_stopAllPacketCaptures (line 316) | def send_stopAllPacketCaptures(self):
    method recv_stopAllPacketCaptures (line 323) | def recv_stopAllPacketCaptures(self):
    method listPacketCaptures (line 335) | def listPacketCaptures(self, device):
    method send_listPacketCaptures (line 343) | def send_listPacketCaptures(self, device):
    method recv_listPacketCaptures (line 351) | def recv_listPacketCaptures(self):
    method listRunningPacketCaptures (line 367) | def listRunningPacketCaptures(self):
    method send_listRunningPacketCaptures (line 371) | def send_listRunningPacketCaptures(self):
    method recv_listRunningPacketCaptures (line 378) | def recv_listRunningPacketCaptures(self):
    method getShapedDeviceCount (line 392) | def getShapedDeviceCount(self):
    method send_getShapedDeviceCount (line 396) | def send_getShapedDeviceCount(self):
    method recv_getShapedDeviceCount (line 403) | def recv_getShapedDeviceCount(self):
    method requestToken (line 417) | def requestToken(self, ip, duration):
    method send_requestToken (line 426) | def send_requestToken(self, ip, duration):
    method recv_requestToken (line 435) | def recv_requestToken(self):
    method requestRemoteControl (line 449) | def requestRemoteControl(self, device, accessToken):
    method send_requestRemoteControl (line 458) | def send_requestRemoteControl(self, device, accessToken):
    method recv_requestRemoteControl (line 467) | def recv_requestRemoteControl(self):
    method getDevicesControlledBy (line 481) | def getDevicesControlledBy(self, ip):
    method send_getDevicesControlledBy (line 489) | def send_getDevicesControlledBy(self, ip):
    method recv_getDevicesControlledBy (line 497) | def recv_getDevicesControlledBy(self):
    method getDevicesControlling (line 511) | def getDevicesControlling(self, ip):
    method send_getDevicesControlling (line 519) | def send_getDevicesControlling(self, ip):
    method recv_getDevicesControlling (line 527) | def recv_getDevicesControlling(self):
  class Processor (line 542) | class Processor(Iface, TProcessor):
    method __init__ (line 543) | def __init__(self, handler):
    method process (line 561) | def process(self, iprot, oprot):
    method process_startShaping (line 576) | def process_startShaping(self, seqid, iprot, oprot):
    method process_stopShaping (line 590) | def process_stopShaping(self, seqid, iprot, oprot):
    method process_getCurrentShaping (line 604) | def process_getCurrentShaping(self, seqid, iprot, oprot):
    method process_isShaped (line 618) | def process_isShaped(self, seqid, iprot, oprot):
    method process_startPacketCapture (line 632) | def process_startPacketCapture(self, seqid, iprot, oprot):
    method process_stopPacketCapture (line 646) | def process_stopPacketCapture(self, seqid, iprot, oprot):
    method process_stopAllPacketCaptures (line 660) | def process_stopAllPacketCaptures(self, seqid, iprot, oprot):
    method process_listPacketCaptures (line 671) | def process_listPacketCaptures(self, seqid, iprot, oprot):
    method process_listRunningPacketCaptures (line 685) | def process_listRunningPacketCaptures(self, seqid, iprot, oprot):
    method process_getShapedDeviceCount (line 696) | def process_getShapedDeviceCount(self, seqid, iprot, oprot):
    method process_requestToken (line 707) | def process_requestToken(self, seqid, iprot, oprot):
    method process_requestRemoteControl (line 718) | def process_requestRemoteControl(self, seqid, iprot, oprot):
    method process_getDevicesControlledBy (line 729) | def process_getDevicesControlledBy(self, seqid, iprot, oprot):
    method process_getDevicesControlling (line 740) | def process_getDevicesControlling(self, seqid, iprot, oprot):
  class startShaping_args (line 754) | class startShaping_args(object):
    method __init__ (line 765) | def __init__(self, tc=None,):
    method read (line 768) | def read(self, iprot):
    method write (line 788) | def write(self, oprot):
    method validate (line 800) | def validate(self):
    method __repr__ (line 804) | def __repr__(self):
    method __eq__ (line 809) | def __eq__(self, other):
    method __ne__ (line 812) | def __ne__(self, other):
  class startShaping_result (line 815) | class startShaping_result(object):
    method __init__ (line 827) | def __init__(self, success=None, failure=None,):
    method read (line 831) | def read(self, iprot):
    method write (line 857) | def write(self, oprot):
    method validate (line 873) | def validate(self):
    method __repr__ (line 877) | def __repr__(self):
    method __eq__ (line 882) | def __eq__(self, other):
    method __ne__ (line 885) | def __ne__(self, other):
  class stopShaping_args (line 888) | class stopShaping_args(object):
    method __init__ (line 899) | def __init__(self, device=None,):
    method read (line 902) | def read(self, iprot):
    method write (line 922) | def write(self, oprot):
    method validate (line 934) | def validate(self):
    method __repr__ (line 938) | def __repr__(self):
    method __eq__ (line 943) | def __eq__(self, other):
    method __ne__ (line 946) | def __ne__(self, other):
  class stopShaping_result (line 949) | class stopShaping_result(object):
    method __init__ (line 961) | def __init__(self, success=None, failure=None,):
    method read (line 965) | def read(self, iprot):
    method write (line 991) | def write(self, oprot):
    method validate (line 1007) | def validate(self):
    method __repr__ (line 1011) | def __repr__(self):
    method __eq__ (line 1016) | def __eq__(self, other):
    method __ne__ (line 1019) | def __ne__(self, other):
  class getCurrentShaping_args (line 1022) | class getCurrentShaping_args(object):
    method __init__ (line 1033) | def __init__(self, device=None,):
    method read (line 1036) | def read(self, iprot):
    method write (line 1056) | def write(self, oprot):
    method validate (line 1068) | def validate(self):
    method __repr__ (line 1072) | def __repr__(self):
    method __eq__ (line 1077) | def __eq__(self, other):
    method __ne__ (line 1080) | def __ne__(self, other):
  class getCurrentShaping_result (line 1083) | class getCurrentShaping_result(object):
    method __init__ (line 1095) | def __init__(self, success=None, failure=None,):
    method read (line 1099) | def read(self, iprot):
    method write (line 1125) | def write(self, oprot):
    method validate (line 1141) | def validate(self):
    method __repr__ (line 1145) | def __repr__(self):
    method __eq__ (line 1150) | def __eq__(self, other):
    method __ne__ (line 1153) | def __ne__(self, other):
  class isShaped_args (line 1156) | class isShaped_args(object):
    method __init__ (line 1167) | def __init__(self, device=None,):
    method read (line 1170) | def read(self, iprot):
    method write (line 1190) | def write(self, oprot):
    method validate (line 1202) | def validate(self):
    method __repr__ (line 1206) | def __repr__(self):
    method __eq__ (line 1211) | def __eq__(self, other):
    method __ne__ (line 1214) | def __ne__(self, other):
  class isShaped_result (line 1217) | class isShaped_result(object):
    method __init__ (line 1229) | def __init__(self, success=None, failure=None,):
    method read (line 1233) | def read(self, iprot):
    method write (line 1258) | def write(self, oprot):
    method validate (line 1274) | def validate(self):
    method __repr__ (line 1278) | def __repr__(self):
    method __eq__ (line 1283) | def __eq__(self, other):
    method __ne__ (line 1286) | def __ne__(self, other):
  class startPacketCapture_args (line 1289) | class startPacketCapture_args(object):
    method __init__ (line 1302) | def __init__(self, device=None, timeout=None,):
    method read (line 1306) | def read(self, iprot):
    method write (line 1331) | def write(self, oprot):
    method validate (line 1347) | def validate(self):
    method __repr__ (line 1351) | def __repr__(self):
    method __eq__ (line 1356) | def __eq__(self, other):
    method __ne__ (line 1359) | def __ne__(self, other):
  class startPacketCapture_result (line 1362) | class startPacketCapture_result(object):
    method __init__ (line 1374) | def __init__(self, success=None, failure=None,):
    method read (line 1378) | def read(self, iprot):
    method write (line 1404) | def write(self, oprot):
    method validate (line 1420) | def validate(self):
    method __repr__ (line 1424) | def __repr__(self):
    method __eq__ (line 1429) | def __eq__(self, other):
    method __ne__ (line 1432) | def __ne__(self, other):
  class stopPacketCapture_args (line 1435) | class stopPacketCapture_args(object):
    method __init__ (line 1446) | def __init__(self, device=None,):
    method read (line 1449) | def read(self, iprot):
    method write (line 1469) | def write(self, oprot):
    method validate (line 1481) | def validate(self):
    method __repr__ (line 1485) | def __repr__(self):
    method __eq__ (line 1490) | def __eq__(self, other):
    method __ne__ (line 1493) | def __ne__(self, other):
  class stopPacketCapture_result (line 1496) | class stopPacketCapture_result(object):
    method __init__ (line 1508) | def __init__(self, success=None, failure=None,):
    method read (line 1512) | def read(self, iprot):
    method write (line 1538) | def write(self, oprot):
    method validate (line 1554) | def validate(self):
    method __repr__ (line 1558) | def __repr__(self):
    method __eq__ (line 1563) | def __eq__(self, other):
    method __ne__ (line 1566) | def __ne__(self, other):
  class stopAllPacketCaptures_args (line 1569) | class stopAllPacketCaptures_args(object):
    method read (line 1574) | def read(self, iprot):
    method write (line 1588) | def write(self, oprot):
    method validate (line 1596) | def validate(self):
    method __repr__ (line 1600) | def __repr__(self):
    method __eq__ (line 1605) | def __eq__(self, other):
    method __ne__ (line 1608) | def __ne__(self, other):
  class stopAllPacketCaptures_result (line 1611) | class stopAllPacketCaptures_result(object):
    method read (line 1616) | def read(self, iprot):
    method write (line 1630) | def write(self, oprot):
    method validate (line 1638) | def validate(self):
    method __repr__ (line 1642) | def __repr__(self):
    method __eq__ (line 1647) | def __eq__(self, other):
    method __ne__ (line 1650) | def __ne__(self, other):
  class listPacketCaptures_args (line 1653) | class listPacketCaptures_args(object):
    method __init__ (line 1664) | def __init__(self, device=None,):
    method read (line 1667) | def read(self, iprot):
    method write (line 1687) | def write(self, oprot):
    method validate (line 1699) | def validate(self):
    method __repr__ (line 1703) | def __repr__(self):
    method __eq__ (line 1708) | def __eq__(self, other):
    method __ne__ (line 1711) | def __ne__(self, other):
  class listPacketCaptures_result (line 1714) | class listPacketCaptures_result(object):
    method __init__ (line 1726) | def __init__(self, success=None, failure=None,):
    method read (line 1730) | def read(self, iprot):
    method write (line 1761) | def write(self, oprot):
    method validate (line 1780) | def validate(self):
    method __repr__ (line 1784) | def __repr__(self):
    method __eq__ (line 1789) | def __eq__(self, other):
    method __ne__ (line 1792) | def __ne__(self, other):
  class listRunningPacketCaptures_args (line 1795) | class listRunningPacketCaptures_args(object):
    method read (line 1800) | def read(self, iprot):
    method write (line 1814) | def write(self, oprot):
    method validate (line 1822) | def validate(self):
    method __repr__ (line 1826) | def __repr__(self):
    method __eq__ (line 1831) | def __eq__(self, other):
    method __ne__ (line 1834) | def __ne__(self, other):
  class listRunningPacketCaptures_result (line 1837) | class listRunningPacketCaptures_result(object):
    method __init__ (line 1847) | def __init__(self, success=None,):
    method read (line 1850) | def read(self, iprot):
    method write (line 1875) | def write(self, oprot):
    method validate (line 1890) | def validate(self):
    method __repr__ (line 1894) | def __repr__(self):
    method __eq__ (line 1899) | def __eq__(self, other):
    method __ne__ (line 1902) | def __ne__(self, other):
  class getShapedDeviceCount_args (line 1905) | class getShapedDeviceCount_args(object):
    method read (line 1910) | def read(self, iprot):
    method write (line 1924) | def write(self, oprot):
    method validate (line 1932) | def validate(self):
    method __repr__ (line 1936) | def __repr__(self):
    method __eq__ (line 1941) | def __eq__(self, other):
    method __ne__ (line 1944) | def __ne__(self, other):
  class getShapedDeviceCount_result (line 1947) | class getShapedDeviceCount_result(object):
    method __init__ (line 1957) | def __init__(self, success=None,):
    method read (line 1960) | def read(self, iprot):
    method write (line 1979) | def write(self, oprot):
    method validate (line 1991) | def validate(self):
    method __repr__ (line 1995) | def __repr__(self):
    method __eq__ (line 2000) | def __eq__(self, other):
    method __ne__ (line 2003) | def __ne__(self, other):
  class requestToken_args (line 2006) | class requestToken_args(object):
    method __init__ (line 2019) | def __init__(self, ip=None, duration=None,):
    method read (line 2023) | def read(self, iprot):
    method write (line 2047) | def write(self, oprot):
    method validate (line 2063) | def validate(self):
    method __repr__ (line 2067) | def __repr__(self):
    method __eq__ (line 2072) | def __eq__(self, other):
    method __ne__ (line 2075) | def __ne__(self, other):
  class requestToken_result (line 2078) | class requestToken_result(object):
    method __init__ (line 2088) | def __init__(self, success=None,):
    method read (line 2091) | def read(self, iprot):
    method write (line 2111) | def write(self, oprot):
    method validate (line 2123) | def validate(self):
    method __repr__ (line 2127) | def __repr__(self):
    method __eq__ (line 2132) | def __eq__(self, other):
    method __ne__ (line 2135) | def __ne__(self, other):
  class requestRemoteControl_args (line 2138) | class requestRemoteControl_args(object):
    method __init__ (line 2151) | def __init__(self, device=None, accessToken=None,):
    method read (line 2155) | def read(self, iprot):
    method write (line 2181) | def write(self, oprot):
    method validate (line 2197) | def validate(self):
    method __repr__ (line 2201) | def __repr__(self):
    method __eq__ (line 2206) | def __eq__(self, other):
    method __ne__ (line 2209) | def __ne__(self, other):
  class requestRemoteControl_result (line 2212) | class requestRemoteControl_result(object):
    method __init__ (line 2222) | def __init__(self, success=None,):
    method read (line 2225) | def read(self, iprot):
    method write (line 2244) | def write(self, oprot):
    method validate (line 2256) | def validate(self):
    method __repr__ (line 2260) | def __repr__(self):
    method __eq__ (line 2265) | def __eq__(self, other):
    method __ne__ (line 2268) | def __ne__(self, other):
  class getDevicesControlledBy_args (line 2271) | class getDevicesControlledBy_args(object):
    method __init__ (line 2282) | def __init__(self, ip=None,):
    method read (line 2285) | def read(self, iprot):
    method write (line 2304) | def write(self, oprot):
    method validate (line 2316) | def validate(self):
    method __repr__ (line 2320) | def __repr__(self):
    method __eq__ (line 2325) | def __eq__(self, other):
    method __ne__ (line 2328) | def __ne__(self, other):
  class getDevicesControlledBy_result (line 2331) | class getDevicesControlledBy_result(object):
    method __init__ (line 2341) | def __init__(self, success=None,):
    method read (line 2344) | def read(self, iprot):
    method write (line 2369) | def write(self, oprot):
    method validate (line 2384) | def validate(self):
    method __repr__ (line 2388) | def __repr__(self):
    method __eq__ (line 2393) | def __eq__(self, other):
    method __ne__ (line 2396) | def __ne__(self, other):
  class getDevicesControlling_args (line 2399) | class getDevicesControlling_args(object):
    method __init__ (line 2410) | def __init__(self, ip=None,):
    method read (line 2413) | def read(self, iprot):
    method write (line 2432) | def write(self, oprot):
    method validate (line 2444) | def validate(self):
    method __repr__ (line 2448) | def __repr__(self):
    method __eq__ (line 2453) | def __eq__(self, other):
    method __ne__ (line 2456) | def __ne__(self, other):
  class getDevicesControlling_result (line 2459) | class getDevicesControlling_result(object):
    method __init__ (line 2469) | def __init__(self, success=None,):
    method read (line 2472) | def read(self, iprot):
    method write (line 2497) | def write(self, oprot):
    method validate (line 2512) | def validate(self):
    method __repr__ (line 2516) | def __repr__(self):
    method __eq__ (line 2521) | def __eq__(self, other):
    method __ne__ (line 2524) | def __ne__(self, other):

FILE: atc/atc_thrift/atc_thrift/ttypes.py
  class ReturnCode (line 19) | class ReturnCode(object):
  class Delay (line 73) | class Delay(object):
    method __init__ (line 88) | def __init__(self, delay=None, jitter=thrift_spec[2][4], correlation=t...
    method read (line 93) | def read(self, iprot):
    method write (line 122) | def write(self, oprot):
    method validate (line 142) | def validate(self):
    method __repr__ (line 146) | def __repr__(self):
    method __eq__ (line 151) | def __eq__(self, other):
    method __ne__ (line 154) | def __ne__(self, other):
  class Loss (line 157) | class Loss(object):
    method __init__ (line 170) | def __init__(self, percentage=None, correlation=thrift_spec[2][4],):
    method read (line 174) | def read(self, iprot):
    method write (line 198) | def write(self, oprot):
    method validate (line 214) | def validate(self):
    method __repr__ (line 218) | def __repr__(self):
    method __eq__ (line 223) | def __eq__(self, other):
    method __ne__ (line 226) | def __ne__(self, other):
  class Reorder (line 229) | class Reorder(object):
    method __init__ (line 244) | def __init__(self, percentage=None, gap=thrift_spec[2][4], correlation...
    method read (line 249) | def read(self, iprot):
    method write (line 278) | def write(self, oprot):
    method validate (line 298) | def validate(self):
    method __repr__ (line 302) | def __repr__(self):
    method __eq__ (line 307) | def __eq__(self, other):
    method __ne__ (line 310) | def __ne__(self, other):
  class Corruption (line 313) | class Corruption(object):
    method __init__ (line 326) | def __init__(self, percentage=thrift_spec[1][4], correlation=thrift_sp...
    method read (line 330) | def read(self, iprot):
    method write (line 354) | def write(self, oprot):
    method validate (line 370) | def validate(self):
    method __repr__ (line 374) | def __repr__(self):
    method __eq__ (line 379) | def __eq__(self, other):
    method __ne__ (line 382) | def __ne__(self, other):
  class Shaping (line 385) | class Shaping(object):
    method __init__ (line 414) | def __init__(self, rate=None, delay=thrift_spec[2][4], loss=thrift_spe...
    method read (line 438) | def read(self, iprot):
    method write (line 491) | def write(self, oprot):
    method validate (line 526) | def validate(self):
    method __repr__ (line 530) | def __repr__(self):
    method __eq__ (line 535) | def __eq__(self, other):
    method __ne__ (line 538) | def __ne__(self, other):
  class TrafficControlSetting (line 541) | class TrafficControlSetting(object):
    method __init__ (line 554) | def __init__(self, up=None, down=None,):
    method read (line 558) | def read(self, iprot):
    method write (line 584) | def write(self, oprot):
    method validate (line 600) | def validate(self):
    method __repr__ (line 604) | def __repr__(self):
    method __eq__ (line 609) | def __eq__(self, other):
    method __ne__ (line 612) | def __ne__(self, other):
  class TrafficControlledDevice (line 615) | class TrafficControlledDevice(object):
    method __init__ (line 628) | def __init__(self, controlledIP=None, controllingIP=None,):
    method read (line 632) | def read(self, iprot):
    method write (line 656) | def write(self, oprot):
    method validate (line 672) | def validate(self):
    method __repr__ (line 676) | def __repr__(self):
    method __eq__ (line 681) | def __eq__(self, other):
    method __ne__ (line 684) | def __ne__(self, other):
  class RemoteControlInstance (line 687) | class RemoteControlInstance(object):
    method __init__ (line 700) | def __init__(self, device=None, timeout=None,):
    method read (line 704) | def read(self, iprot):
    method write (line 729) | def write(self, oprot):
    method validate (line 745) | def validate(self):
    method __repr__ (line 749) | def __repr__(self):
    method __eq__ (line 754) | def __eq__(self, other):
    method __ne__ (line 757) | def __ne__(self, other):
  class TrafficControl (line 760) | class TrafficControl(object):
    method __init__ (line 775) | def __init__(self, settings=None, device=None, timeout=None,):
    method read (line 780) | def read(self, iprot):
    method write (line 811) | def write(self, oprot):
    method validate (line 831) | def validate(self):
    method __repr__ (line 835) | def __repr__(self):
    method __eq__ (line 840) | def __eq__(self, other):
    method __ne__ (line 843) | def __ne__(self, other):
  class TrafficControlRc (line 846) | class TrafficControlRc(object):
    method __init__ (line 859) | def __init__(self, code=None, message=None,):
    method read (line 863) | def read(self, iprot):
    method write (line 887) | def write(self, oprot):
    method validate (line 903) | def validate(self):
    method __repr__ (line 907) | def __repr__(self):
    method __eq__ (line 912) | def __eq__(self, other):
    method __ne__ (line 915) | def __ne__(self, other):
  class TrafficControlException (line 918) | class TrafficControlException(TException):
    method __init__ (line 931) | def __init__(self, code=None, message=None,):
    method read (line 935) | def read(self, iprot):
    method write (line 959) | def write(self, oprot):
    method validate (line 975) | def validate(self):
    method __str__ (line 979) | def __str__(self):
    method __repr__ (line 982) | def __repr__(self):
    method __eq__ (line 987) | def __eq__(self, other):
    method __ne__ (line 990) | def __ne__(self, other):
  class PacketCaptureException (line 993) | class PacketCaptureException(TException):
    method __init__ (line 1004) | def __init__(self, message=None,):
    method read (line 1007) | def read(self, iprot):
    method write (line 1026) | def write(self, oprot):
    method validate (line 1038) | def validate(self):
    method __str__ (line 1042) | def __str__(self):
    method __repr__ (line 1045) | def __repr__(self):
    method __eq__ (line 1050) | def __eq__(self, other):
    method __ne__ (line 1053) | def __ne__(self, other):
  class PacketCaptureFile (line 1056) | class PacketCaptureFile(object):
    method __init__ (line 1071) | def __init__(self, name=None, url=None, bytes=thrift_spec[3][4],):
    method read (line 1076) | def read(self, iprot):
    method write (line 1105) | def write(self, oprot):
    method validate (line 1125) | def validate(self):
    method __repr__ (line 1129) | def __repr__(self):
    method __eq__ (line 1134) | def __eq__(self, other):
    method __ne__ (line 1137) | def __ne__(self, other):
  class PacketCapture (line 1140) | class PacketCapture(object):
    method __init__ (line 1157) | def __init__(self, ip=None, start_time=None, file=None, pid=thrift_spe...
    method read (line 1163) | def read(self, iprot):
    method write (line 1198) | def write(self, oprot):
    method validate (line 1222) | def validate(self):
    method __repr__ (line 1226) | def __repr__(self):
    method __eq__ (line 1231) | def __eq__(self, other):
    method __ne__ (line 1234) | def __ne__(self, other):
  class AccessToken (line 1237) | class AccessToken(object):
    method __init__ (line 1252) | def __init__(self, token=None, interval=None, valid_until=None,):
    method read (line 1257) | def read(self, iprot):
    method write (line 1286) | def write(self, oprot):
    method validate (line 1306) | def validate(self):
    method __repr__ (line 1310) | def __repr__(self):
    method __eq__ (line 1315) | def __eq__(self, other):
    method __ne__ (line 1318) | def __ne__(self, other):

FILE: atc/atcd/atcd/AtcdDBQueueTask.py
  class AtcdDBQueueTask (line 16) | class AtcdDBQueueTask(QueueTask):
    method initTask (line 29) | def initTask(self):
    method execute (line 41) | def execute(self, item, context):
    method get_saved_shapings (line 63) | def get_saved_shapings(self):

FILE: atc/atcd/atcd/AtcdDeviceTimeoutTask.py
  class AtcdDeviceTimeoutTask (line 14) | class AtcdDeviceTimeoutTask(PeriodicTask):
    method initTask (line 17) | def initTask(self):
    method execute (line 21) | def execute(self):

FILE: atc/atcd/atcd/AtcdThriftHandlerTask.py
  function AccessCheck (line 46) | def AccessCheck(func):
  function from_module_import_class (line 70) | def from_module_import_class(modulename, classname):
  class AtcdNBServerTask (line 95) | class AtcdNBServerTask(NBServerTask):
  class AtcdThriftHandlerTask (line 104) | class AtcdThriftHandlerTask(ThriftHandlerTask):
    method factory (line 186) | def factory():
    method initTask (line 214) | def initTask(self):
    method _links_lookup (line 246) | def _links_lookup(self):
    method initialize_id_manager (line 252) | def initialize_id_manager(self):
    method _restore_saved_shapings (line 261) | def _restore_saved_shapings(self):
    method stop (line 303) | def stop(self):
    method initialize_shaping_system (line 311) | def initialize_shaping_system(self):
    method set_logger (line 318) | def set_logger(self):
    method getShapedDeviceCount (line 335) | def getShapedDeviceCount(self):
    method startShaping (line 345) | def startShaping(self, tc):
    method stopShaping (line 438) | def stopShaping(self, dev):
    method _unshape_interface (line 488) | def _unshape_interface(self, mark, eth, ip, settings):
    method _shape_interface (line 493) | def _shape_interface(self, mark, eth, ip, shaping):
    method isShaped (line 498) | def isShaped(self, dev):
    method getCurrentShaping (line 504) | def getCurrentShaping(self, dev):
    method _add_mapping (line 532) | def _add_mapping(self, id, tc):
    method _del_mapping (line 546) | def _del_mapping(self, id, ip):
    method run_cmd (line 559) | def run_cmd(self, cmd):
    method _pcap_filename (line 563) | def _pcap_filename(self, ip, start_time):
    method _pcap_parse_filename (line 566) | def _pcap_parse_filename(self, filename):
    method _pcap_url (line 571) | def _pcap_url(self, filename):
    method _pcap_full_path (line 574) | def _pcap_full_path(self, filename):
    method _pcap_file_size (line 577) | def _pcap_file_size(self, filename):
    method _cleanup_packet_capture_procs (line 583) | def _cleanup_packet_capture_procs(self):
    method startPacketCapture (line 590) | def startPacketCapture(self, dev, timeout=3600):
    method stopPacketCapture (line 638) | def stopPacketCapture(self, dev):
    method stopAllPacketCaptures (line 667) | def stopAllPacketCaptures(self):
    method listPacketCaptures (line 686) | def listPacketCaptures(self, dev):
    method listRunningPacketCaptures (line 714) | def listRunningPacketCaptures(self):
    method stop_expired_shapings (line 728) | def stop_expired_shapings(self):
    method requestToken (line 741) | def requestToken(self, ip, duration):
    method requestRemoteControl (line 761) | def requestRemoteControl(self, dev, accessToken):
    method getDevicesControlledBy (line 788) | def getDevicesControlledBy(self, ip):
    method getDevicesControlling (line 799) | def getDevicesControlling(self, ip):

FILE: atc/atcd/atcd/AtcdVService.py
  class AtcdVService (line 17) | class AtcdVService(VService):
    method initLogging (line 18) | def initLogging(self):
    method _syslog_address (line 27) | def _syslog_address(self):

FILE: atc/atcd/atcd/access_manager.py
  function _dev_to_tuple (line 19) | def _dev_to_tuple(device):
  function _tuple_to_dev (line 23) | def _tuple_to_dev(tup):
  function _remote_control_instance (line 30) | def _remote_control_instance(tup, timeout):
  class AccessTokenException (line 37) | class AccessTokenException(Exception):
  class AtcdTOTP (line 41) | class AtcdTOTP(pyotp.TOTP):
    method valid_until (line 42) | def valid_until(self, for_time):
  class AccessManager (line 55) | class AccessManager(object):
    method __init__ (line 58) | def __init__(self, secure=True):
    method generate_token (line 63) | def generate_token(self, ip, duration):
    method validate_token (line 96) | def validate_token(self, dev, access_token):
    method access_allowed (line 120) | def access_allowed(self, dev):
    method get_devices_controlled_by (line 141) | def get_devices_controlled_by(self, ip):
    method get_devices_controlling (line 156) | def get_devices_controlling(self, ip):

FILE: atc/atcd/atcd/backends/linux.py
  function int_to_classid (line 36) | def int_to_classid(i):
  class AtcdLinuxShaper (line 41) | class AtcdLinuxShaper(AtcdThriftHandlerTask):
    method initTask (line 46) | def initTask(self):
    method stop (line 50) | def stop(self):
    method _release_ipr (line 53) | def _release_ipr(self):
    method _links_lookup (line 56) | def _links_lookup(self):
    method initialize_shaping_system (line 67) | def initialize_shaping_system(self):
    method _initialize_iptables (line 76) | def _initialize_iptables(self):
    method _initialize_tc_for_interface (line 83) | def _initialize_tc_for_interface(self, eth):
    method _initialize_tc (line 126) | def _initialize_tc(self):
    method _unset_htb_class (line 132) | def _unset_htb_class(self, mark, eth):
    method _set_htb_class (line 164) | def _set_htb_class(self, mark, eth, shaping):
    method _unset_netem_qdisc (line 203) | def _unset_netem_qdisc(self, mark, eth):
    method _set_netem_qdisc (line 208) | def _set_netem_qdisc(self, mark, eth, shaping):
    method _unset_filter (line 258) | def _unset_filter(self, mark, eth):
    method _set_filter (line 293) | def _set_filter(self, mark, eth, shaping):
    method _unset_iptables (line 342) | def _unset_iptables(self, mark, eth, ip, options=None):
    method _set_iptables (line 364) | def _set_iptables(self, mark, eth, ip, options=None):
    method _shape_interface (line 389) | def _shape_interface(self, mark, eth, ip, shaping):
    method _unshape_interface (line 443) | def _unshape_interface(self, mark, eth, ip, settings):

FILE: atc/atcd/atcd/db_manager.py
  class SQLiteManager (line 14) | class SQLiteManager(object):
    method __init__ (line 28) | def __init__(self, file_name, logger=None):
    method get_saved_shapings (line 35) | def get_saved_shapings(self):
    method add_shaping (line 55) | def add_shaping(self, tc, timeout):
    method remove_shaping (line 63) | def remove_shaping(self, ip):
    method _get_conn (line 69) | def _get_conn(self):

FILE: atc/atcd/atcd/idmanager.py
  class IdManager (line 15) | class IdManager(object):
    method __init__ (line 17) | def __init__(self, first_id=0, max_id=None):
    method free (line 27) | def free(self, id):
    method new (line 35) | def new(self):

FILE: atc/atcd/atcd/scripts/runner.py
  function initialize_thrift (line 25) | def initialize_thrift():
  function run (line 33) | def run():

FILE: atc/atcd/atcd/tools/test_secure_access.py
  function getAtcClient (line 23) | def getAtcClient():
  function parse_arguments (line 31) | def parse_arguments():

FILE: atc/atcd/setup.py
  function get_version (line 36) | def get_version(package):

FILE: atc/atcd/tests/idmanager_test.py
  class TestIdManager (line 14) | class TestIdManager(unittest.TestCase):
    method setUp (line 17) | def setUp(self):
    method test_assignement (line 20) | def test_assignement(self):
    method test_exhaustion (line 41) | def test_exhaustion(self):

FILE: atc/atcd/tests/test_AtcdDBQueueTask.py
  function atc_db_file (line 23) | def atc_db_file():
  class AtcdDBQueueTestTask (line 33) | class AtcdDBQueueTestTask(AtcdDBQueueTask):
  class TestAtcdDBQueueTask (line 37) | class TestAtcdDBQueueTask(SingleTaskTestCase):
    method test_get_saved_shaping (line 41) | def test_get_saved_shaping(self):
    method test_execute_missing_arg (line 44) | def test_execute_missing_arg(self):
    method test_operational_error (line 51) | def test_operational_error(self):
    method test_execute_unkown_action (line 60) | def test_execute_unkown_action(self):
    method test_add_shaping_wrong_arguments (line 65) | def test_add_shaping_wrong_arguments(self):
    method test_add_shaping_missing_arguments (line 73) | def test_add_shaping_missing_arguments(self):
    method test_add_shaping_correct_arguments (line 81) | def test_add_shaping_correct_arguments(self):
    method test_remove_shaping_not_in_db (line 90) | def test_remove_shaping_not_in_db(self):
    method _make_tc_device (line 98) | def _make_tc_device(self, ip='1.1.1.1'):

FILE: atc/atcd/tests/test_AtcdVService.py
  class AtcdVServiceTest (line 17) | class AtcdVServiceTest(ServiceTestCase):
    method getServiceClass (line 19) | def getServiceClass(self):
    method test_logger_use_syslog (line 22) | def test_logger_use_syslog(self):
    method test_logger_spart_syslog (line 28) | def test_logger_spart_syslog(self):
    method test_syslog_macosx_path_exists (line 36) | def test_syslog_macosx_path_exists(self, mock_pathexists, mock_sys):
    method test_syslog_macosx_path_dont_exists (line 43) | def test_syslog_macosx_path_dont_exists(self, mock_pathexists, mock_sys):

FILE: atc/atcd/tests/test_access_manager.py
  function control_allowed (line 26) | def control_allowed():
  function ip_to_totp_map (line 38) | def ip_to_totp_map():
  function am (line 52) | def am():
  function fake_am (line 57) | def fake_am(am, control_allowed, ip_to_totp_map):
  function fail_verify (line 64) | def fail_verify(monkeypatch):
  function succeed_verify (line 69) | def succeed_verify(monkeypatch):
  function _make_device (line 73) | def _make_device(controlling, controlled=None):
  function _make_token (line 80) | def _make_token(token):
  class TestAtcdTOTP (line 84) | class TestAtcdTOTP(unittest.TestCase):
    method test_valid_until (line 89) | def test_valid_until(self):
  class TestAccessManager (line 109) | class TestAccessManager():
    method setup_method (line 111) | def setup_method(self, method):
    method teardown_method (line 118) | def teardown_method(self, method):
    method test_generate_token (line 121) | def test_generate_token(self, fake_am):
    method test_controlled_by_existing (line 129) | def test_controlled_by_existing(self, fake_am):
    method test_controlled_by_non_existent (line 133) | def test_controlled_by_non_existent(self, fake_am):
    method test_controlling_existing (line 137) | def test_controlling_existing(self, fake_am):
    method test_controlling_non_existent (line 141) | def test_controlling_non_existent(self, fake_am):
    method test_access_allowed_controlling_ip_none (line 145) | def test_access_allowed_controlling_ip_none(self, fake_am):
    method test_access_allowed_valid (line 152) | def test_access_allowed_valid(self, fake_am):
    method test_access_allowed_non_existent (line 160) | def test_access_allowed_non_existent(self, fake_am):
    method test_access_allowed_expired (line 171) | def test_access_allowed_expired(self, fake_am):
    method test_access_allowed_self (line 182) | def test_access_allowed_self(self, fake_am):
    method test_validate_token_valid (line 190) | def test_validate_token_valid(self, fake_am, succeed_verify):
    method test_validate_token_invalid (line 196) | def test_validate_token_invalid(self, fake_am, fail_verify):
    method test_validate_token_expired_valid (line 205) | def test_validate_token_expired_valid(self, fake_am, fail_verify):
    method test_validate_token_expired_invalid (line 214) | def test_validate_token_expired_invalid(self, fake_am, fail_verify):
    method test_validate_token_non_existent (line 222) | def test_validate_token_non_existent(self, fake_am):
  class Timecop (line 233) | class Timecop(object):
    method __init__ (line 238) | def __init__(self, freeze_timestamp):
    method __enter__ (line 241) | def __enter__(self):
    method __exit__ (line 245) | def __exit__(self, type, value, traceback):
    method frozen_datetime (line 248) | def frozen_datetime(self):

FILE: atc/atcd/tests/test_sqlite_manager.py
  function atc_db_file (line 27) | def atc_db_file():
  function dbm (line 38) | def dbm(atc_db_file):
  function test_shaping (line 43) | def test_shaping():
  function test_db (line 67) | def test_db(dbm, test_shaping):
  class TestSQLiteManager (line 72) | class TestSQLiteManager():
    method test_sqlite_file_not_found (line 78) | def test_sqlite_file_not_found(self):
    method test_sqlite_init (line 82) | def test_sqlite_init(self, dbm):
    method test_sqlite_add_shaping (line 92) | def test_sqlite_add_shaping(self, dbm, test_shaping):
    method test_sqlite_remove_shaping (line 105) | def test_sqlite_remove_shaping(self, test_db):
    method test_sqlite_get_saved_shapings (line 114) | def test_sqlite_get_saved_shapings(self, test_db):

FILE: atc/django-atc-api/atc_api/atcd_client.py
  function atcdClient (line 16) | def atcdClient():

FILE: atc/django-atc-api/atc_api/serializers.py
  function validate_ipaddr (line 25) | def validate_ipaddr(ipaddr):
  class ThriftSerializer (line 33) | class ThriftSerializer(serializers.Serializer):
    method create (line 43) | def create(self, attrs):
  class BaseShapingSettingSerializer (line 71) | class BaseShapingSettingSerializer(ThriftSerializer):
  class DelaySerializer (line 76) | class DelaySerializer(ThriftSerializer):
  class LossSerializer (line 84) | class LossSerializer(BaseShapingSettingSerializer):
  class CorruptionSerializer (line 88) | class CorruptionSerializer(BaseShapingSettingSerializer):
  class ReorderSerializer (line 92) | class ReorderSerializer(BaseShapingSettingSerializer):
  class IptablesOptionsField (line 98) | class IptablesOptionsField(serializers.Field):
    method to_representation (line 100) | def to_representation(self, data):
    method to_internal_value (line 107) | def to_internal_value(self, obj):
  class ShapingSerializer (line 114) | class ShapingSerializer(ThriftSerializer):
  class SettingSerializer (line 127) | class SettingSerializer(ThriftSerializer):
  class DeviceSerializer (line 134) | class DeviceSerializer(ThriftSerializer):
    method validate_address (line 156) | def validate_address(self, value):
    method validate_client (line 172) | def validate_client(self, value):
    method _get_client_ip (line 178) | def _get_client_ip(self):

FILE: atc/django-atc-api/atc_api/settings.py
  class APISettings (line 39) | class APISettings(object):
    method __init__ (line 41) | def __init__(self, user_settings=None, defaults=None):
    method __getattr__ (line 45) | def __getattr__(self, attr):

FILE: atc/django-atc-api/atc_api/static/js/atc-api.js
  function AtcRestClient (line 11) | function AtcRestClient (endpoint) {
  function AtcSettings (line 84) | function AtcSettings () {

FILE: atc/django-atc-api/atc_api/utils.py
  function get_client_ip (line 14) | def get_client_ip(request):

FILE: atc/django-atc-api/atc_api/views.py
  class BadGateway (line 25) | class BadGateway(APIException):
  function serviced (line 30) | def serviced(method):
  class AtcApi (line 44) | class AtcApi(APIView):
    method get (line 50) | def get(self, request, service, address=None, format=None):
    method post (line 80) | def post(self, request, service, address=None, format=None):
    method delete (line 120) | def delete(self, request, service, address=None, format=None):
  class AuthApi (line 148) | class AuthApi(APIView):
    method get (line 151) | def get(self, request, service, address=None):
    method post (line 175) | def post(self, request, service, address=None):
  class TokenApi (line 217) | class TokenApi(APIView):
    method get (line 220) | def get(self, request, service):

FILE: atc/django-atc-api/setup.py
  function get_version (line 21) | def get_version(package):
  function get_packages (line 29) | def get_packages(package):
  function get_package_data (line 38) | def get_package_data(package):

FILE: atc/django-atc-demo-ui/atc_demo_ui/settings.py
  class APISettings (line 42) | class APISettings(object):
    method __init__ (line 44) | def __init__(self, user_settings=None, defaults=None):
    method __getattr__ (line 48) | def __getattr__(self, attr):

FILE: atc/django-atc-demo-ui/atc_demo_ui/static/js/atc-utils.js
  function capitalizeFirstLetter (line 26) | function capitalizeFirstLetter(s) {
  function setPath (line 40) | function setPath (obj, path, value) {
  function getPath (line 45) | function getPath (obj, path) {
  function resolvePath (line 50) | function resolvePath (obj, keys) {
  function handleAPI (line 84) | function handleAPI(callback, notify) {

FILE: atc/django-atc-demo-ui/atc_demo_ui/static/js/atc.js
  function objectEquals (line 138) | function objectEquals(x, y) {

FILE: atc/django-atc-demo-ui/atc_demo_ui/static/vendor/react/JSXTransformer-0.13.3.js
  function s (line 4) | function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&re...
  function transformReact (line 40) | function transformReact(source, options) {
  function exec (line 61) | function exec(source, options) {
  function createSourceCodeErrorMessage (line 79) | function createSourceCodeErrorMessage(code, e) {
  function transformCode (line 124) | function transformCode(code, url, options) {
  function run (line 181) | function run(code, url, options) {
  function load (line 194) | function load(url, successCallback, errorCallback) {
  function loadScripts (line 226) | function loadScripts(scripts) {
  function runScripts (line 299) | function runScripts() {
  function processOptions (line 392) | function processOptions(opts) {
  function innerTransform (line 416) | function innerTransform(input, options) {
  function Buffer (line 505) | function Buffer (subject, encoding) {
  function SlowBuffer (line 569) | function SlowBuffer (subject, encoding) {
  function arrayIndexOf (line 772) | function arrayIndexOf (arr, val, byteOffset) {
  function hexWrite (line 800) | function hexWrite (buf, string, offset, length) {
  function utf8Write (line 827) | function utf8Write (buf, string, offset, length) {
  function asciiWrite (line 832) | function asciiWrite (buf, string, offset, length) {
  function binaryWrite (line 837) | function binaryWrite (buf, string, offset, length) {
  function base64Write (line 841) | function base64Write (buf, string, offset, length) {
  function utf16leWrite (line 846) | function utf16leWrite (buf, string, offset, length) {
  function base64Slice (line 920) | function base64Slice (buf, start, end) {
  function utf8Slice (line 928) | function utf8Slice (buf, start, end) {
  function asciiSlice (line 945) | function asciiSlice (buf, start, end) {
  function binarySlice (line 955) | function binarySlice (buf, start, end) {
  function hexSlice (line 965) | function hexSlice (buf, start, end) {
  function utf16leSlice (line 978) | function utf16leSlice (buf, start, end) {
  function checkOffset (line 1027) | function checkOffset (offset, ext, length) {
  function checkInt (line 1188) | function checkInt (buf, value, offset, ext, max, min) {
  function objectWriteUInt16 (line 1235) | function objectWriteUInt16 (buf, value, offset, littleEndian) {
  function objectWriteUInt32 (line 1269) | function objectWriteUInt32 (buf, value, offset, littleEndian) {
  function checkIEEE754 (line 1417) | function checkIEEE754 (buf, value, offset, ext, max, min) {
  function writeFloat (line 1423) | function writeFloat (buf, value, offset, littleEndian, noAssert) {
  function writeDouble (line 1439) | function writeDouble (buf, value, offset, littleEndian, noAssert) {
  function base64clean (line 1617) | function base64clean (str) {
  function stringtrim (line 1629) | function stringtrim (str) {
  function isArrayish (line 1634) | function isArrayish (subject) {
  function toHex (line 1640) | function toHex (n) {
  function utf8ToBytes (line 1645) | function utf8ToBytes (string, units) {
  function asciiToBytes (line 1726) | function asciiToBytes (str) {
  function utf16leToBytes (line 1735) | function utf16leToBytes (str, units) {
  function base64ToBytes (line 1751) | function base64ToBytes (str) {
  function blitBuffer (line 1755) | function blitBuffer (src, dst, offset, length) {
  function decodeUtf8Char (line 1763) | function decodeUtf8Char (str) {
  function decode (line 1789) | function decode (elt) {
  function b64ToByteArray (line 1807) | function b64ToByteArray (b64) {
  function uint8ToBase64 (line 1853) | function uint8ToBase64 (uint8) {
  function normalizeArray (line 2045) | function normalizeArray(parts, allowAboveRoot) {
  function trim (line 2154) | function trim(arr) {
  function filter (line 2227) | function filter (xs, f) {
  function drainQueue (line 2253) | function drainQueue() {
  function noop (line 2285) | function noop() {}
  function assert (line 2617) | function assert(condition, message) {
  function StringMap (line 2624) | function StringMap() {
  function isDecimalDigit (line 2649) | function isDecimalDigit(ch) {
  function isHexDigit (line 2653) | function isHexDigit(ch) {
  function isOctalDigit (line 2657) | function isOctalDigit(ch) {
  function isWhiteSpace (line 2664) | function isWhiteSpace(ch) {
  function isLineTerminator (line 2675) | function isLineTerminator(ch) {
  function isIdentifierStart (line 2681) | function isIdentifierStart(ch) {
  function isIdentifierPart (line 2689) | function isIdentifierPart(ch) {
  function isFutureReservedWord (line 2700) | function isFutureReservedWord(id) {
  function isStrictModeReservedWord (line 2714) | function isStrictModeReservedWord(id) {
  function isRestrictedWord (line 2731) | function isRestrictedWord(id) {
  function isKeyword (line 2737) | function isKeyword(id) {
  function addComment (line 2776) | function addComment(type, value, start, end, loc) {
  function skipSingleLineComment (line 2806) | function skipSingleLineComment() {
  function skipMultiLineComment (line 2848) | function skipMultiLineComment() {
  function skipComment (line 2897) | function skipComment() {
  function scanHexEscape (line 2931) | function scanHexEscape(prefix) {
  function scanUnicodeCodePointEscape (line 2946) | function scanUnicodeCodePointEscape() {
  function getEscapedIdentifier (line 2978) | function getEscapedIdentifier() {
  function getIdentifier (line 3023) | function getIdentifier() {
  function scanIdentifier (line 3044) | function scanIdentifier() {
  function scanPunctuator (line 3078) | function scanPunctuator() {
  function scanHexLiteral (line 3300) | function scanHexLiteral(start) {
  function scanBinaryLiteral (line 3327) | function scanBinaryLiteral(start) {
  function scanOctalLiteral (line 3362) | function scanOctalLiteral(prefix, start) {
  function scanNumericLiteral (line 3400) | function scanNumericLiteral() {
  function scanStringLiteral (line 3480) | function scanStringLiteral() {
  function scanTemplate (line 3591) | function scanTemplate() {
  function scanTemplateElement (line 3717) | function scanTemplateElement(option) {
  function testRegExp (line 3736) | function testRegExp(pattern, flags) {
  function scanRegExpBody (line 3776) | function scanRegExpBody() {
  function scanRegExpFlags (line 3823) | function scanRegExpFlags() {
  function scanRegExp (line 3868) | function scanRegExp() {
  function isIdentifierName (line 3904) | function isIdentifierName(token) {
  function advanceSlash (line 3911) | function advanceSlash() {
  function advance (line 3971) | function advance() {
  function lex (line 4038) | function lex() {
  function peek (line 4055) | function peek() {
  function lookahead2 (line 4067) | function lookahead2() {
  function rewind (line 4096) | function rewind(token) {
  function markerCreate (line 4103) | function markerCreate() {
  function markerCreatePreserveWhitespace (line 4111) | function markerCreatePreserveWhitespace() {
  function processComment (line 4118) | function processComment(node) {
  function markerApply (line 4170) | function markerApply(marker, node) {
  function peekLineTerminator (line 5085) | function peekLineTerminator() {
  function throwError (line 5102) | function throwError(token, messageFormat) {
  function throwErrorTolerant (line 5129) | function throwErrorTolerant() {
  function throwUnexpected (line 5144) | function throwUnexpected(token) {
  function expect (line 5182) | function expect(value) {
  function expectKeyword (line 5192) | function expectKeyword(keyword, contextual) {
  function expectContextualKeyword (line 5203) | function expectContextualKeyword(keyword) {
  function match (line 5209) | function match(value) {
  function matchKeyword (line 5215) | function matchKeyword(keyword, contextual) {
  function matchContextualKeyword (line 5222) | function matchContextualKeyword(keyword) {
  function matchAssign (line 5228) | function matchAssign() {
  function matchYield (line 5253) | function matchYield() {
  function matchAsync (line 5257) | function matchAsync() {
  function matchAwait (line 5269) | function matchAwait() {
  function consumeSemicolon (line 5273) | function consumeSemicolon() {
  function isLeftHandSide (line 5305) | function isLeftHandSide(expr) {
  function isAssignableLeftHandSide (line 5309) | function isAssignableLeftHandSide(expr) {
  function parseArrayInitialiser (line 5315) | function parseArrayInitialiser() {
  function parsePropertyFunction (line 5379) | function parsePropertyFunction(options) {
  function parsePropertyMethodFunction (line 5414) | function parsePropertyMethodFunction(options) {
  function parseObjectPropertyKey (line 5442) | function parseObjectPropertyKey() {
  function parseObjectProperty (line 5471) | function parseObjectProperty() {
  function parseObjectSpreadProperty (line 5668) | function parseObjectSpreadProperty() {
  function getFieldName (line 5674) | function getFieldName(key) {
  function parseObjectInitialiser (line 5682) | function parseObjectInitialiser() {
  function parseTemplateElement (line 5734) | function parseTemplateElement(option) {
  function parseTemplateLiteral (line 5743) | function parseTemplateLiteral() {
  function parseGroupExpression (line 5761) | function parseGroupExpression() {
  function matchAsyncFuncExprOrDecl (line 5785) | function matchAsyncFuncExprOrDecl() {
  function parsePrimaryExpression (line 5800) | function parsePrimaryExpression() {
  function parseArguments (line 5886) | function parseArguments() {
  function parseSpreadOrAssignmentExpression (line 5911) | function parseSpreadOrAssignmentExpression() {
  function parseNonComputedProperty (line 5920) | function parseNonComputedProperty() {
  function parseNonComputedMember (line 5931) | function parseNonComputedMember() {
  function parseComputedMember (line 5937) | function parseComputedMember() {
  function parseNewExpression (line 5949) | function parseNewExpression() {
  function parseLeftHandSideExpressionAllowCall (line 5959) | function parseLeftHandSideExpressionAllowCall() {
  function parseLeftHandSideExpression (line 5980) | function parseLeftHandSideExpression() {
  function parsePostfixExpression (line 6000) | function parsePostfixExpression() {
  function parseUnaryExpression (line 6028) | function parseUnaryExpression() {
  function binaryPrecedence (line 6072) | function binaryPrecedence(token, allowIn) {
  function parseBinaryExpression (line 6151) | function parseBinaryExpression() {
  function parseConditionalExpression (line 6217) | function parseConditionalExpression() {
  function reinterpretAsAssignmentBindingPattern (line 6240) | function reinterpretAsAssignmentBindingPattern(expr) {
  function reinterpretAsDestructuredParameter (line 6287) | function reinterpretAsDestructuredParameter(options, expr) {
  function reinterpretAsCoverFormalsList (line 6327) | function reinterpretAsCoverFormalsList(expressions) {
  function parseArrowFunctionExpression (line 6386) | function parseArrowFunctionExpression(options, marker) {
  function parseAssignmentExpression (line 6419) | function parseAssignmentExpression() {
  function parseExpression (line 6525) | function parseExpression() {
  function parseStatementList (line 6563) | function parseStatementList() {
  function parseBlock (line 6581) | function parseBlock() {
  function parseTypeParameterDeclaration (line 6595) | function parseTypeParameterDeclaration() {
  function parseTypeParameterInstantiation (line 6612) | function parseTypeParameterInstantiation() {
  function parseObjectTypeIndexer (line 6633) | function parseObjectTypeIndexer(marker, isStatic) {
  function parseObjectTypeMethodish (line 6652) | function parseObjectTypeMethodish(marker) {
  function parseObjectTypeMethod (line 6682) | function parseObjectTypeMethod(marker, isStatic, key) {
  function parseObjectTypeCallProperty (line 6694) | function parseObjectTypeCallProperty(marker, isStatic) {
  function parseObjectType (line 6702) | function parseObjectType(allowStatic) {
  function parseGenericType (line 6767) | function parseGenericType() {
  function parseVoidType (line 6791) | function parseVoidType() {
  function parseTypeofType (line 6797) | function parseTypeofType() {
  function parseTupleType (line 6806) | function parseTupleType() {
  function parseFunctionTypeParam (line 6823) | function parseFunctionTypeParam() {
  function parseFunctionTypeParams (line 6839) | function parseFunctionTypeParams() {
  function parsePrimaryType (line 6858) | function parsePrimaryType() {
  function parsePostfixType (line 6969) | function parsePostfixType() {
  function parsePrefixType (line 6979) | function parsePrefixType() {
  function parseIntersectionType (line 6991) | function parseIntersectionType() {
  function parseUnionType (line 7007) | function parseUnionType() {
  function parseType (line 7022) | function parseType() {
  function parseTypeAnnotation (line 7032) | function parseTypeAnnotation() {
  function parseVariableIdentifier (line 7041) | function parseVariableIdentifier() {
  function parseTypeAnnotatableIdentifier (line 7052) | function parseTypeAnnotatableIdentifier(requireTypeAnnotation, canBeOpti...
  function parseVariableDeclaration (line 7075) | function parseVariableDeclaration(kind) {
  function parseVariableDeclarationList (line 7117) | function parseVariableDeclarationList(kind) {
  function parseVariableStatement (line 7131) | function parseVariableStatement() {
  function parseConstLetDeclaration (line 7147) | function parseConstLetDeclaration(kind) {
  function parseModuleSpecifier (line 7161) | function parseModuleSpecifier() {
  function parseExportBatchSpecifier (line 7173) | function parseExportBatchSpecifier() {
  function parseExportSpecifier (line 7179) | function parseExportSpecifier() {
  function parseExportDeclaration (line 7196) | function parseExportDeclaration() {
  function parseImportSpecifier (line 7308) | function parseImportSpecifier() {
  function parseNamedImports (line 7321) | function parseNamedImports() {
  function parseImportDefaultSpecifier (line 7334) | function parseImportDefaultSpecifier() {
  function parseImportNamespaceSpecifier (line 7343) | function parseImportNamespaceSpecifier() {
  function parseImportDeclaration (line 7357) | function parseImportDeclaration() {
  function parseEmptyStatement (line 7416) | function parseEmptyStatement() {
  function parseExpressionStatement (line 7424) | function parseExpressionStatement() {
  function parseIfStatement (line 7432) | function parseIfStatement() {
  function parseDoWhileStatement (line 7457) | function parseDoWhileStatement() {
  function parseWhileStatement (line 7484) | function parseWhileStatement() {
  function parseForVariableDeclaration (line 7505) | function parseForVariableDeclaration() {
  function parseForStatement (line 7513) | function parseForStatement(opts) {
  function parseContinueStatement (line 7607) | function parseContinueStatement() {
  function parseBreakStatement (line 7650) | function parseBreakStatement() {
  function parseReturnStatement (line 7693) | function parseReturnStatement() {
  function parseWithStatement (line 7728) | function parseWithStatement() {
  function parseSwitchCase (line 7750) | function parseSwitchCase() {
  function parseSwitchStatement (line 7779) | function parseSwitchStatement() {
  function parseThrowStatement (line 7826) | function parseThrowStatement() {
  function parseCatchClause (line 7844) | function parseCatchClause() {
  function parseTryStatement (line 7865) | function parseTryStatement() {
  function parseDebuggerStatement (line 7890) | function parseDebuggerStatement() {
  function parseStatement (line 7901) | function parseStatement() {
  function parseConciseBody (line 7989) | function parseConciseBody() {
  function parseFunctionSourceElements (line 7996) | function parseFunctionSourceElements() {
  function validateParam (line 8062) | function validateParam(options, param, name) {
  function parseParam (line 8087) | function parseParam(options) {
  function parseParams (line 8152) | function parseParams(firstRestricted) {
  function parseFunctionDeclaration (line 8188) | function parseFunctionDeclaration() {
  function parseFunctionExpression (line 8270) | function parseFunctionExpression() {
  function parseYieldExpression (line 8356) | function parseYieldExpression() {
  function parseAwaitExpression (line 8372) | function parseAwaitExpression() {
  function specialMethod (line 8386) | function specialMethod(methodDefinition) {
  function parseMethodDefinition (line 8392) | function parseMethodDefinition(key, isStatic, generator, computed) {
  function parseClassProperty (line 8472) | function parseClassProperty(key, computed, isStatic) {
  function parseClassElement (line 8486) | function parseClassElement() {
  function parseClassBody (line 8528) | function parseClassBody() {
  function parseClassImplements (line 8572) | function parseClassImplements() {
  function parseClassExpression (line 8599) | function parseClassExpression() {
  function parseClassDeclaration (line 8644) | function parseClassDeclaration() {
  function parseSourceElement (line 8683) | function parseSourceElement() {
  function parseProgramElement (line 8740) | function parseProgramElement() {
  function parseProgramElements (line 8755) | function parseProgramElements() {
  function parseProgram (line 8793) | function parseProgram() {
  function getQualifiedJSXName (line 9059) | function getQualifiedJSXName(object) {
  function isJSXIdentifierStart (line 9077) | function isJSXIdentifierStart(ch) {
  function isJSXIdentifierPart (line 9082) | function isJSXIdentifierPart(ch) {
  function scanJSXIdentifier (line 9087) | function scanJSXIdentifier() {
  function scanJSXEntity (line 9108) | function scanJSXEntity() {
  function scanJSXText (line 9146) | function scanJSXText(stopChars) {
  function scanJSXStringLiteral (line 9179) | function scanJSXStringLiteral() {
  function advanceJSXChild (line 9206) | function advanceJSXChild() {
  function parseJSXIdentifier (line 9217) | function parseJSXIdentifier() {
  function parseJSXNamespacedName (line 9228) | function parseJSXNamespacedName() {
  function parseJSXMemberExpression (line 9238) | function parseJSXMemberExpression() {
  function parseJSXElementName (line 9250) | function parseJSXElementName() {
  function parseJSXAttributeName (line 9261) | function parseJSXAttributeName() {
  function parseJSXAttributeValue (line 9269) | function parseJSXAttributeValue() {
  function parseJSXEmptyExpression (line 9291) | function parseJSXEmptyExpression() {
  function parseJSXExpressionContainer (line 9299) | function parseJSXExpressionContainer() {
  function parseJSXSpreadAttribute (line 9323) | function parseJSXSpreadAttribute() {
  function parseJSXAttribute (line 9344) | function parseJSXAttribute() {
  function parseJSXChild (line 9364) | function parseJSXChild() {
  function parseJSXClosingElement (line 9379) | function parseJSXClosingElement() {
  function parseJSXOpeningElement (line 9397) | function parseJSXOpeningElement() {
  function parseJSXElement (line 9432) | function parseJSXElement() {
  function parseTypeAlias (line 9472) | function parseTypeAlias() {
  function parseInterfaceExtends (line 9485) | function parseInterfaceExtends() {
  function parseInterfaceish (line 9499) | function parseInterfaceish(marker, allowStatic) {
  function parseInterface (line 9531) | function parseInterface() {
  function parseDeclareClass (line 9543) | function parseDeclareClass() {
  function parseDeclareFunction (line 9553) | function parseDeclareFunction() {
  function parseDeclareVariable (line 9595) | function parseDeclareVariable() {
  function parseDeclareModule (line 9608) | function parseDeclareModule() {
  function collectToken (line 9649) | function collectToken() {
  function collectRegex (line 9691) | function collectRegex() {
  function filterTokenLocation (line 9734) | function filterTokenLocation() {
  function patch (line 9761) | function patch() {
  function unpatch (line 9771) | function unpatch() {
  function extend (line 9780) | function extend(object, properties) {
  function tokenize (line 9800) | function tokenize(code, options) {
  function parse (line 9892) | function parse(code, options) {
  function ArraySet (line 10070) | function ArraySet() {
  function toVLQSigned (line 10222) | function toVLQSigned(aValue) {
  function fromVLQSigned (line 10234) | function fromVLQSigned(aValue) {
  function recursiveSearch (line 10360) | function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare) {
  function SourceMapConsumer (line 10469) | function SourceMapConsumer(aSourceMap) {
  function SourceMapGenerator (line 10925) | function SourceMapGenerator(aArgs) {
  function SourceNode (line 11310) | function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
  function addMappingWithCode (line 11410) | function addMappingWithCode(mapping, code) {
  function getArg (line 11678) | function getArg(aArgs, aName, aDefaultValue) {
  function urlParse (line 11692) | function urlParse(aUrl) {
  function urlGenerate (line 11707) | function urlGenerate(aParsedUrl) {
  function join (line 11725) | function join(aRoot, aPath) {
  function toSetString (line 11750) | function toSetString(aStr) {
  function fromSetString (line 11755) | function fromSetString(aStr) {
  function relative (line 11760) | function relative(aRoot, aPath) {
  function strcmp (line 11774) | function strcmp(aStr1, aStr2) {
  function compareByOriginalPositions (line 11788) | function compareByOriginalPositions(mappingA, mappingB, onlyCompareOrigi...
  function compareByGeneratedPositions (line 11829) | function compareByGeneratedPositions(mappingA, mappingB, onlyCompareGene...
  function amdefine (line 11885) | function amdefine(module, requireFn) {
  function extract (line 12189) | function extract(contents) {
  function parse (line 12209) | function parse(docblock) {
  function parseAsObject (line 12240) | function parseAsObject(docblock) {
  function _nodeIsClosureScopeBoundary (line 12288) | function _nodeIsClosureScopeBoundary(node, parentNode) {
  function _nodeIsBlockScopeBoundary (line 12306) | function _nodeIsBlockScopeBoundary(node, parentNode) {
  function traverse (line 12320) | function traverse(node, path, state) {
  function collectClosureIdentsAndTraverse (line 12437) | function collectClosureIdentsAndTraverse(node, path, state) {
  function collectBlockIdentsAndTraverse (line 12447) | function collectBlockIdentsAndTraverse(node, path, state) {
  function visitLocalClosureIdentifiers (line 12457) | function visitLocalClosureIdentifiers(node, path, state) {
  function visitLocalBlockIdentifiers (line 12483) | function visitLocalBlockIdentifiers(node, path, state) {
  function walker (line 12490) | function walker(node, path, state) {
  function getAstForSource (line 12501) | function getAstForSource(source, options) {
  function transform (line 12524) | function transform(visitors, source, options) {
  function createState (line 12589) | function createState(source, rootNode, transformOptions) {
  function updateState (line 12741) | function updateState(state, update) {
  function catchup (line 12758) | function catchup(end, state, contentTransformer) {
  function getNodeSourceText (line 12814) | function getNodeSourceText(node, state) {
  function _replaceNonWhite (line 12818) | function _replaceNonWhite(value) {
  function _stripNonWhite (line 12825) | function _stripNonWhite(value) {
  function getNextSyntacticCharOffset (line 12841) | function getNextSyntacticCharOffset(char, state) {
  function catchupWhiteOut (line 12890) | function catchupWhiteOut(end, state) {
  function catchupWhiteSpace (line 12897) | function catchupWhiteSpace(end, state) {
  function stripNonNewline (line 12905) | function stripNonNewline(value) {
  function catchupNewlines (line 12917) | function catchupNewlines(end, state) {
  function move (line 12928) | function move(end, state) {
  function append (line 12954) | function append(str, state) {
  function updateIndent (line 12980) | function updateIndent(str, state) {
  function indentBefore (line 13008) | function indentBefore(start, state) {
  function getDocblock (line 13021) | function getDocblock(state) {
  function identWithinLexicalScope (line 13030) | function identWithinLexicalScope(identName, state, stopBeforeNode) {
  function identInLocalScope (line 13046) | function identInLocalScope(identName, state) {
  function initScopeMetadata (line 13055) | function initScopeMetadata(boundaryNode, path, node) {
  function declareIdentInLocalScope (line 13063) | function declareIdentInLocalScope(identName, metaData, state) {
  function getLexicalBindingMetadata (line 13072) | function getLexicalBindingMetadata(identName, state) {
  function getLocalBindingMetadata (line 13083) | function getLocalBindingMetadata(identName, state) {
  function analyzeAndTraverse (line 13098) | function analyzeAndTraverse(analyzer, traverser, node, path, state) {
  function getOrderedChildren (line 13128) | function getOrderedChildren(node) {
  function enqueueNodeWithStartIndex (line 13151) | function enqueueNodeWithStartIndex(queue, node) {
  function containsChildOfType (line 13170) | function containsChildOfType(node, type) {
  function containsChildMatching (line 13176) | function containsChildMatching(node, matcher) {
  function getBoundaryNode (line 13204) | function getBoundaryNode(path) {
  function getTempVar (line 13216) | function getTempVar(tempVarIndex) {
  function injectTempVar (line 13220) | function injectTempVar(state) {
  function injectTempVarDeclarations (line 13226) | function injectTempVarDeclarations(state, index) {
  function visitArrowFunction (line 13315) | function visitArrowFunction(traverse, node, path, state) {
  function renderParams (line 13361) | function renderParams(traverse, node, path, state) {
  function isParensFreeSingleParam (line 13375) | function isParensFreeSingleParam(node, state) {
  function renderExpressionBody (line 13380) | function renderExpressionBody(traverse, node, path, state) {
  function renderStatementBody (line 13411) | function renderStatementBody(traverse, node, path, state) {
  function process (line 13443) | function process(traverse, node, path, state) {
  function visitCallSpread (line 13449) | function visitCallSpread(traverse, node, path, state) {
  function resetSymbols (line 13571) | function resetSymbols() {
  function _generateAnonymousClassName (line 13583) | function _generateAnonymousClassName(state) {
  function _getMungedName (line 13595) | function _getMungedName(identName, state) {
  function _getSuperClassInfo (line 13627) | function _getSuperClassInfo(node, state) {
  function _isConstructorMethod (line 13654) | function _isConstructorMethod(classElement) {
  function _shouldMungeIdentifier (line 13665) | function _shouldMungeIdentifier(node, state) {
  function visitClassMethod (line 13679) | function visitClassMethod(traverse, node, path, state) {
  function visitClassFunctionExpression (line 13706) | function visitClassFunctionExpression(traverse, node, path, state) {
  function visitClassMethodParam (line 13823) | function visitClassMethodParam(traverse, node, path, state) {
  function _renderClassBody (line 13850) | function _renderClassBody(traverse, node, path, state) {
  function visitClassDeclaration (line 13940) | function visitClassDeclaration(traverse, node, path, state) {
  function visitClassExpression (line 13964) | function visitClassExpression(traverse, node, path, state) {
  function visitPrivateIdentifier (line 13991) | function visitPrivateIdentifier(traverse, node, path, state) {
  function visitSuperCallExpression (line 14037) | function visitSuperCallExpression(traverse, node, path, state) {
  function visitSuperMemberExpression (line 14098) | function visitSuperMemberExpression(traverse, node, path, state) {
  function visitStructuredVariable (line 14178) | function visitStructuredVariable(traverse, node, path, state) {
  function isStructuredPattern (line 14196) | function isStructuredPattern(node) {
  function getDestructuredComponents (line 14203) | function getDestructuredComponents(node, state) {
  function getPatternItems (line 14255) | function getPatternItems(node) {
  function getPatternItemAccessor (line 14259) | function getPatternItemAccessor(node, patternItem, tmpIndex, idx) {
  function getPatternItemValue (line 14274) | function getPatternItemValue(node, patternItem) {
  function visitStructuredAssignment (line 14287) | function visitStructuredAssignment(traverse, node, path, state) {
  function visitStructuredParameter (line 14320) | function visitStructuredParameter(traverse, node, path, state) {
  function getParamIndex (line 14326) | function getParamIndex(paramNode, path) {
  function isFunctionNode (line 14345) | function isFunctionNode(node) {
  function visitFunctionBodyForStructuredParameter (line 14358) | function visitFunctionBodyForStructuredParameter(traverse, node, path, s...
  function renderDestructuredComponents (line 14374) | function renderDestructuredComponents(funcNode, state) {
  function visitObjectConciseMethod (line 14442) | function visitObjectConciseMethod(traverse, node, path, state) {
  function visitObjectLiteralShortNotation (line 14514) | function visitObjectLiteralShortNotation(traverse, node, path, state) {
  function _nodeIsFunctionWithRestParam (line 14573) | function _nodeIsFunctionWithRestParam(node) {
  function visitFunctionParamsWithRestParam (line 14580) | function visitFunctionParamsWithRestParam(traverse, node, path, state) {
  function renderRestParamSetup (line 14610) | function renderRestParamSetup(functionNode, state) {
  function visitFunctionBodyWithRestParam (line 14622) | function visitFunctionBodyWithRestParam(traverse, node, path, state) {
  function visitTemplateLiteral (line 14670) | function visitTemplateLiteral(traverse, node, path, state) {
  function visitTaggedTemplateExpression (line 14726) | function visitTaggedTemplateExpression(traverse, node, path, state) {
  function getCookedValue (line 14785) | function getCookedValue(templateElement) {
  function getRawValue (line 14789) | function getRawValue(templateElement) {
  function getPropertyNames (line 14840) | function getPropertyNames(properties) {
  function getRestFunctionCall (line 14856) | function getRestFunctionCall(source, exclusion) {
  function getSimpleShallowCopy (line 14860) | function getSimpleShallowCopy(accessorExpression) {
  function renderRestExpression (line 14867) | function renderRestExpression(accessorExpression, excludedProperties) {
  function visitObjectLiteralSpread (line 14899) | function visitObjectLiteralSpread(traverse, node, path, state) {
  function visitProperty (line 15095) | function visitProperty(traverse, node, path, state) {
  function visitMemberExpression (line 15114) | function visitMemberExpression(traverse, node, path, state) {
  function _isFunctionNode (line 15142) | function _isFunctionNode(node) {
  function visitClassProperty (line 15148) | function visitClassProperty(traverse, node, path, state) {
  function visitTypeAlias (line 15157) | function visitTypeAlias(traverse, node, path, state) {
  function visitTypeCast (line 15165) | function visitTypeCast(traverse, node, path, state) {
  function visitInterfaceDeclaration (line 15178) | function visitInterfaceDeclaration(traverse, node, path, state) {
  function visitDeclare (line 15186) | function visitDeclare(traverse, node, path, state) {
  function visitFunctionParametricAnnotation (line 15201) | function visitFunctionParametricAnnotation(traverse, node, path, state) {
  function visitFunctionReturnAnnotation (line 15213) | function visitFunctionReturnAnnotation(traverse, node, path, state) {
  function visitOptionalFunctionParameterAnnotation (line 15222) | function visitOptionalFunctionParameterAnnotation(traverse, node, path, ...
  function visitTypeAnnotatedIdentifier (line 15234) | function visitTypeAnnotatedIdentifier(traverse, node, path, state) {
  function visitTypeAnnotatedObjectOrArrayPattern (line 15243) | function visitTypeAnnotatedObjectOrArrayPattern(traverse, node, path, st...
  function visitMethod (line 15265) | function visitMethod(traverse, node, path, state) {
  function visitImportType (line 15286) | function visitImportType(traverse, node, path, state) {
  function renderJSXLiteral (line 15324) | function renderJSXLiteral(object, isLast, state, start, end) {
  function renderJSXExpressionContainer (line 15388) | function renderJSXExpressionContainer(traverse, object, isLast, path, st...
  function quoteAttrName (line 15406) | function quoteAttrName(attr) {
  function trimLeft (line 15414) | function trimLeft(value) {
  function stripNonWhiteParen (line 15460) | function stripNonWhiteParen(value) {
  function isTagName (line 15465) | function isTagName(name) {
  function visitReactTag (line 15469) | function visitReactTag(traverse, object, path, state) {
  function addDisplayName (line 15682) | function addDisplayName(displayName, object, state) {
  function visitReactDisplayName (line 15728) | function visitReactDisplayName(traverse, object, path, state) {
  function getAllVisitors (line 15847) | function getAllVisitors(excludes) {
  function getVisitorsBySet (line 15864) | function getVisitorsBySet(sets) {
  function inlineSourceMap (line 15903) | function inlineSourceMap(sourceMap, sourceCode, sourceFilename) {

FILE: atc/django-atc-demo-ui/atc_demo_ui/static/vendor/react/react-0.13.3.js
  function s (line 4) | function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&re...
  function isPresto (line 242) | function isPresto() {
  function isKeypressCommand (line 322) | function isKeypressCommand(nativeEvent) {
  function getCompositionEventType (line 337) | function getCompositionEventType(topLevelType) {
  function isFallbackCompositionStart (line 356) | function isFallbackCompositionStart(topLevelType, nativeEvent) {
  function isFallbackCompositionEnd (line 370) | function isFallbackCompositionEnd(topLevelType, nativeEvent) {
  function getDataFromCustomEvent (line 398) | function getDataFromCustomEvent(nativeEvent) {
  function extractCompositionEvent (line 416) | function extractCompositionEvent(
  function getNativeBeforeInputChars (line 477) | function getNativeBeforeInputChars(topLevelType, nativeEvent) {
  function getFallbackBeforeInputChars (line 531) | function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
  function extractBeforeInputEvent (line 590) | function extractBeforeInputEvent(
  function prefixKey (line 725) | function prefixKey(prefix, key) {
  function CallbackQueue (line 1011) | function CallbackQueue() {
  function shouldUseChangeEvent (line 1136) | function shouldUseChangeEvent(elem) {
  function manualDispatchChangeEvent (line 1151) | function manualDispatchChangeEvent(nativeEvent) {
  function runEventInBatch (line 1173) | function runEventInBatch(event) {
  function startWatchingForChangeEventIE8 (line 1178) | function startWatchingForChangeEventIE8(target, targetID) {
  function stopWatchingForChangeEventIE8 (line 1184) | function stopWatchingForChangeEventIE8() {
  function getTargetIDForChangeEvent (line 1193) | function getTargetIDForChangeEvent(
  function handleEventsForChangeEventIE8 (line 1201) | function handleEventsForChangeEventIE8(
  function startWatchingForValueChange (line 1248) | function startWatchingForValueChange(target, targetID) {
  function stopWatchingForValueChange (line 1265) | function stopWatchingForValueChange() {
  function handlePropertyChange (line 1284) | function handlePropertyChange(nativeEvent) {
  function getTargetIDForInputEvent (line 1300) | function getTargetIDForInputEvent(
  function handleEventsForInputEventIE (line 1312) | function handleEventsForInputEventIE(
  function getTargetIDForInputEventIE (line 1338) | function getTargetIDForInputEventIE(
  function shouldUseClickEvent (line 1366) | function shouldUseClickEvent(elem) {
  function getTargetIDForClickEvent (line 1376) | function getTargetIDForClickEvent(
  function insertChildAt (line 1515) | function insertChildAt(parentNode, childNode, index) {
  function checkMask (line 1641) | function checkMask(value, bitmask) {
  function shouldIgnoreValue (line 1939) | function shouldIgnoreValue(name, value) {
  function getNodeName (line 2147) | function getNodeName(markup) {
  function validateInstanceHandle (line 2693) | function validateInstanceHandle() {
  function recomputePluginOrdering (line 2941) | function recomputePluginOrdering() {
  function publishEventForPlugin (line 2993) | function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
  function publishRegistrationName (line 3034) | function publishRegistrationName(registrationName, PluginModule, eventNa...
  function isEndish (line 3229) | function isEndish(topLevelType) {
  function isMoveish (line 3235) | function isMoveish(topLevelType) {
  function isStartish (line 3239) | function isStartish(topLevelType) {
  function forEachEventDispatch (line 3270) | function forEachEventDispatch(event, cb) {
  function executeDispatch (line 3295) | function executeDispatch(event, listener, domID) {
  function executeDispatchesInOrder (line 3305) | function executeDispatchesInOrder(event, cb) {
  function executeDispatchesInOrderStopAtTrueImpl (line 3318) | function executeDispatchesInOrderStopAtTrueImpl(event) {
  function executeDispatchesInOrderStopAtTrue (line 3345) | function executeDispatchesInOrderStopAtTrue(event) {
  function executeDirectDispatch (line 3361) | function executeDirectDispatch(event) {
  function hasDispatches (line 3383) | function hasDispatches(event) {
  function listenerAtPhase (line 3433) | function listenerAtPhase(id, event, propagationPhase) {
  function accumulateDirectionalDispatches (line 3445) | function accumulateDirectionalDispatches(domID, upwards, event) {
  function accumulateTwoPhaseDispatchesSingle (line 3467) | function accumulateTwoPhaseDispatchesSingle(event) {
  function accumulateDispatches (line 3483) | function accumulateDispatches(id, ignoredDirection, event) {
  function accumulateDirectDispatchesSingle (line 3500) | function accumulateDirectDispatchesSingle(event) {
  function accumulateTwoPhaseDispatches (line 3506) | function accumulateTwoPhaseDispatches(events) {
  function accumulateEnterLeaveDispatches (line 3510) | function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {
  function accumulateDirectDispatches (line 3521) | function accumulateDirectDispatches(events) {
  function FallbackCompositionState (line 3621) | function FallbackCompositionState(root) {
  function _assertSingleLink (line 3921) | function _assertSingleLink(input) {
  function _assertValueLink (line 3928) | function _assertValueLink(input) {
  function _assertCheckedLink (line 3937) | function _assertCheckedLink(input) {
  function _handleLinkedValueChange (line 3950) | function _handleLinkedValueChange(e) {
  function _handleLinkedCheckChange (line 3958) | function _handleLinkedCheckChange(e) {
  function remove (line 4066) | function remove(event) {
  function assign (line 4175) | function assign(target, sources) {
  function getListeningForDocument (line 4484) | function getListeningForDocument(mountAt) {
  function ForEachBookKeeping (line 4864) | function ForEachBookKeeping(forEachFunction, forEachContext) {
  function forEachSingleChild (line 4870) | function forEachSingleChild(traverseContext, child, name, i) {
  function forEachChildren (line 4886) | function forEachChildren(children, forEachFunc, forEachContext) {
  function MapBookKeeping (line 4906) | function MapBookKeeping(mapResult, mapFunction, mapContext) {
  function mapSingleChildIntoContext (line 4913) | function mapSingleChildIntoContext(traverseContext, child, name, i) {
  function mapChildren (line 4949) | function mapChildren(children, func, context) {
  function forEachSingleChildDummy (line 4961) | function forEachSingleChildDummy(traverseContext, child, name, i) {
  function countChildren (line 4972) | function countChildren(children, context) {
  function validateTypeDef (line 5374) | function validateTypeDef(Constructor, typeDef, location) {
  function validateMethodOverride (line 5391) | function validateMethodOverride(proto, name) {
  function mixSpecIntoComponent (line 5425) | function mixSpecIntoComponent(Constructor, spec) {
  function mixStaticSpecIntoComponent (line 5526) | function mixStaticSpecIntoComponent(Constructor, statics) {
  function mergeIntoWithNoDuplicateKeys (line 5565) | function mergeIntoWithNoDuplicateKeys(one, two) {
  function createMergedResultFunction (line 5596) | function createMergedResultFunction(one, two) {
  function createChainedFunction (line 5620) | function createChainedFunction(one, two) {
  function bindAutoBindMethod (line 5634) | function bindAutoBindMethod(component, method) {
  function bindAutoBindMethods (line 5680) | function bindAutoBindMethods(component) {
  function ReactComponent (line 5950) | function ReactComponent(props, context) {
  function getDeclarationErrorAddendum (line 6220) | function getDeclarationErrorAddendum(component) {
  function createDOMFactory (line 7233) | function createDOMFactory(tag) {
  function assertValidProps (line 7501) | function assertValidProps(props) {
  function putListener (line 7542) | function putListener(id, registrationName, listener, transaction) {
  function validateDangerousTag (line 7595) | function validateDangerousTag(tag) {
  function ReactDOMComponent (line 7616) | function ReactDOMComponent(tag) {
  function forceUpdateIfMounted (line 8292) | function forceUpdateIfMounted() {
  function updateOptionsIfPendingUpdateAndMounted (line 8512) | function updateOptionsIfPendingUpdateAndMounted() {
  function selectValueType (line 8527) | function selectValueType(props, propName, componentName) {
  function updateOptions (line 8553) | function updateOptions(component, propValue) {
  function isCollapsed (line 8689) | function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) {
  function getIEOffsets (line 8707) | function getIEOffsets(node) {
  function getModernOffsets (line 8730) | function getModernOffsets(node) {
  function setIEOffsets (line 8786) | function setIEOffsets(node, offsets) {
  function setModernOffsets (line 8820) | function setModernOffsets(node, offsets) {
  function forceUpdateIfMounted (line 9024) | function forceUpdateIfMounted() {
  function ReactDefaultBatchingStrategyTransaction (line 9167) | function ReactDefaultBatchingStrategyTransaction() {
  function autoGenerateWrapperClass (line 9257) | function autoGenerateWrapperClass(type) {
  function inject (line 9273) | function inject() {
  function roundFloat (line 9385) | function roundFloat(val) {
  function addValue (line 9389) | function addValue(obj, key, val) {
  function getTotalTime (line 9658) | function getTotalTime(measurements) {
  function getDOMSummary (line 9671) | function getDOMSummary(measurements) {
  function getExclusiveSummary (line 9690) | function getExclusiveSummary(measurements) {
  function getInclusiveSummary (line 9742) | function getInclusiveSummary(measurements, onlyClean) {
  function getUnchangedComponents (line 9801) | function getUnchangedComponents(measurement) {
  function defineWarningProperty (line 9867) | function defineWarningProperty(object, key) {
  function defineMutationMembrane (line 9904) | function defineMutationMembrane(prototype) {
  function getDeclarationErrorAddendum (line 10173) | function getDeclarationErrorAddendum() {
  function getName (line 10200) | function getName(instance) {
  function getCurrentOwnerDisplayName (line 10218) | function getCurrentOwnerDisplayName() {
  function validateExplicitKey (line 10235) | function validateExplicitKey(element, parentType) {
  function validatePropertyKey (line 10257) | function validatePropertyKey(name, element, parentType) {
  function warnAndMonitorForKeyUse (line 10276) | function warnAndMonitorForKeyUse(message, element, parentType) {
  function validateChildKeys (line 10325) | function validateChildKeys(node, parentType) {
  function checkPropTypes (line 10369) | function checkPropTypes(componentName, propTypes, props, location) {
  function warnForPropsMutation (line 10411) | function warnForPropsMutation(propName, element) {
  function is (line 10444) | function is(a, b) {
  function checkAndWarnForMutatedProps (line 10464) | function checkAndWarnForMutatedProps(element) {
  function validatePropTypes (line 10493) | function validatePropTypes(element) {
  function registerNullComponentID (line 10669) | function registerNullComponentID(id) {
  function deregisterNullComponentID (line 10677) | function deregisterNullComponentID(id) {
  function isNullComponentID (line 10685) | function isNullComponentID(id) {
  function runEventQueueInBatch (line 10745) | function runEventQueueInBatch(events) {
  function findParent (line 10812) | function findParent(node) {
  function TopLevelCallbackBookKeeping (line 10824) | function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {
  function handleTopLevelImpl (line 10841) | function handleTopLevelImpl(bookKeeping) {
  function scrollValueMonitor (line 10868) | function scrollValueMonitor(cb) {
  function isInDocument (line 11207) | function isInDocument(node) {
  function getReactRootIDString (line 11356) | function getReactRootIDString(index) {
  function isBoundary (line 11368) | function isBoundary(id, index) {
  function isValidID (line 11379) | function isValidID(id) {
  function isAncestorIDOf (line 11393) | function isAncestorIDOf(ancestorID, descendantID) {
  function getParentID (line 11407) | function getParentID(id) {
  function getNextDescendantID (line 11420) | function getNextDescendantID(ancestorID, destinationID) {
  function getFirstCommonAncestorID (line 11460) | function getFirstCommonAncestorID(oneID, twoID) {
  function traverseParentPath (line 11497) | function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
  function firstDifferenceIndex (line 11855) | function firstDifferenceIndex(string1, string2) {
  function getReactRootID (line 11869) | function getReactRootID(container) {
  function getID (line 11884) | function getID(node) {
  function internalGetID (line 11906) | function internalGetID(node) {
  function setID (line 11919) | function setID(node, id) {
  function getNode (line 11935) | function getNode(id) {
  function getNodeFromInstance (line 11949) | function getNodeFromInstance(instance) {
  function isValid (line 11970) | function isValid(node, id) {
  function purgeID (line 11992) | function purgeID(id) {
  function findDeepestCachedAncestorImpl (line 11997) | function findDeepestCachedAncestorImpl(ancestorID) {
  function findDeepestCachedAncestor (line 12011) | function findDeepestCachedAncestor(targetID) {
  function mountComponentIntoNode (line 12032) | function mountComponentIntoNode(
  function batchedMountComponentIntoNode (line 12053) | function batchedMountComponentIntoNode(
  function enqueueMarkup (line 12735) | function enqueueMarkup(parentID, markup, toIndex) {
  function enqueueMove (line 12756) | function enqueueMove(parentID, fromIndex, toIndex) {
  function enqueueRemove (line 12776) | function enqueueRemove(parentID, fromIndex) {
  function enqueueTextContent (line 12796) | function enqueueTextContent(parentID, textContent) {
  function processQueue (line 12814) | function processQueue() {
  function clearQueue (line 12829) | function clearQueue() {
  function getComponentClassForElement (line 13194) | function getComponentClassForElement(element) {
  function createInternalComponent (line 13212) | function createInternalComponent(element) {
  function createInstanceForText (line 13225) | function createInstanceForText(text) {
  function isTextComponent (line 13233) | function isTextComponent(component) {
  function _noMeasure (line 13453) | function _noMeasure(objName, fnName, func) {
  function createChainableTypeChecker (line 13600) | function createChainableTypeChecker(validate) {
  function createPrimitiveTypeChecker (line 13623) | function createPrimitiveTypeChecker(expectedType) {
  function createAnyTypeChecker (line 13644) | function createAnyTypeChecker() {
  function createArrayOfTypeChecker (line 13648) | function createArrayOfTypeChecker(typeChecker) {
  function createElementTypeChecker (line 13670) | function createElementTypeChecker() {
  function createInstanceTypeChecker (line 13684) | function createInstanceTypeChecker(expectedClass) {
  function createEnumTypeChecker (line 13699) | function createEnumTypeChecker(expectedValues) {
  function createObjectOfTypeChecker (line 13718) | function createObjectOfTypeChecker(typeChecker) {
  function createUnionTypeChecker (line 13742) | function createUnionTypeChecker(arrayOfTypeCheckers) {
  function createNodeChecker (line 13760) | function createNodeChecker() {
  function createShapeTypeChecker (line 13774) | function createShapeTypeChecker(shapeTypes) {
  function isNode (line 13800) | function isNode(propValue) {
  function getPropType (line 13828) | function getPropType(propValue) {
  function getPreciseType (line 13844) | function getPreciseType(propValue) {
  function ReactPutListenerQueue (line 13877) | function ReactPutListenerQueue() {
  function ReactReconcileTransaction (line 14035) | function ReactReconcileTransaction() {
  function attachRefs (line 14111) | function attachRefs() {
  function attachRef (line 14230) | function attachRef(ref, component, owner) {
  function detachRef (line 14239) | function detachRef(ref, component, owner) {
  function renderToString (line 14342) | function renderToString(element) {
  function renderToStaticMarkup (line 14369) | function renderToStaticMarkup(element) {
  function ReactServerRenderingTransaction (line 14454) | function ReactServerRenderingTransaction(renderToStaticMarkup) {
  function enqueueUpdate (line 14531) | function enqueueUpdate(internalInstance) {
  function getInternalInstanceReadyForUpdate (line 14541) | function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
  function ensureInjected (line 14835) | function ensureInjected() {
  function ReactUpdatesFlushTransaction (line 14873) | function ReactUpdatesFlushTransaction() {
  function batchedUpdates (line 14912) | function batchedUpdates(callback, a, b, c, d) {
  function mountOrderComparator (line 14924) | function mountOrderComparator(c1, c2) {
  function runBatchedUpdates (line 14928) | function runBatchedUpdates(transaction) {
  function enqueueUpdate (line 15002) | function enqueueUpdate(component) {
  function asap (line 15030) | function asap(callback, context) {
  function getSelection (line 15236) | function getSelection(node) {
  function constructSelectEvent (line 15268) | function constructSelectEvent(nativeEvent) {
  function SyntheticClipboardEvent (line 15867) | function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeE...
  function SyntheticCompositionEvent (line 15906) | function SyntheticCompositionEvent(
  function SyntheticDragEvent (line 15951) | function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  function SyntheticEvent (line 16016) | function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  function SyntheticFocusEvent (line 16156) | function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  function SyntheticInputEvent (line 16196) | function SyntheticInputEvent(
  function SyntheticKeyboardEvent (line 16289) | function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEv...
  function SyntheticMouseEvent (line 16370) | function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  function SyntheticTouchEvent (line 16418) | function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  function SyntheticUIEvent (line 16480) | function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  function SyntheticWheelEvent (line 16541) | function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  function accumulateInto (line 16847) | function accumulateInto(current, next) {
  function adler32 (line 16903) | function adler32(data) {
  function camelize (line 16939) | function camelize(string) {
  function camelizeStyleName (line 16983) | function camelizeStyleName(string) {
  function containsNode (line 17013) | function containsNode(outerNode, innerNode) {
  function hasArrayNature (line 17063) | function hasArrayNature(obj) {
  function createArrayFromMixed (line 17107) | function createArrayFromMixed(obj) {
  function createFullPageComponent (line 17151) | function createFullPageComponent(tag) {
  function getNodeName (line 17217) | function getNodeName(markup) {
  function createNodesFromMarkup (line 17232) | function createNodesFromMarkup(markup, handleScript) {
  function dangerousStyleValue (line 17295) | function dangerousStyleValue(name, value) {
  function makeEmptyFunction (line 17337) | function makeEmptyFunction(arg) {
  function emptyFunction (line 17348) | function emptyFunction() {}
  function escaper (line 17405) | function escaper(match) {
  function escapeTextContentForBrowser (line 17415) | function escapeTextContentForBrowser(text) {
  function findDOMNode (line 17450) | function findDOMNode(componentOrElement) {
  function flattenSingleChildIntoContext (line 17514) | function flattenSingleChildIntoContext(traverseContext, child, name) {
  function flattenChildren (line 17537) | function flattenChildren(children) {
  function focusNode (line 17565) | function focusNode(node) {
  function getActiveElement (line 17627) | function getActiveElement() /*?DOMElement*/ {
  function getEventCharCode (line 17662) | function getEventCharCode(nativeEvent) {
  function getEventKey (line 17763) | function getEventKey(nativeEvent) {
  function modifierStateGetter (line 17824) | function modifierStateGetter(keyArg) {
  function getEventModifierState (line 17835) | function getEventModifierState(nativeEvent) {
  function getEventTarget (line 17863) | function getEventTarget(nativeEvent) {
  function getIteratorFn (line 17905) | function getIteratorFn(maybeIterable) {
  function getMarkupWrap (line 18014) | function getMarkupWrap(nodeName) {
  function getLeafNode (line 18053) | function getLeafNode(node) {
  function getSiblingNode (line 18067) | function getSiblingNode(node) {
  function getNodeForCharacterOffset (line 18083) | function getNodeForCharacterOffset(root, offset) {
  function getReactRootElementInContainer (line 18129) | function getReactRootElementInContainer(container) {
  function getTextContentAccessor (line 18167) | function getTextContentAccessor() {
  function getUnboundedScrollPosition (line 18205) | function getUnboundedScrollPosition(scrollable) {
  function hyphenate (line 18247) | function hyphenate(string) {
  function hyphenateStyleName (line 18288) | function hyphenateStyleName(string) {
  function isInternalComponentType (line 18334) | function isInternalComponentType(type) {
  function instantiateReactComponent (line 18351) | function instantiateReactComponent(node, parentCompositeType) {
  function isEventSupported (line 18525) | function isEventSupported(eventNameSuffix, capture) {
  function isNode (line 18567) | function isNode(object) {
  function isTextInputElement (line 18612) | function isTextInputElement(elem) {
  function isTextNode (line 18639) | function isTextNode(object) {
  function mapObject (line 18772) | function mapObject(object, callback, context) {
  function memoizeStringOnly (line 18808) | function memoizeStringOnly(callback) {
  function onlyChild (line 18848) | function onlyChild(children) {
  function quoteAttributeValueForBrowser (line 18936) | function quoteAttributeValueForBrowser(value) {
  function shallowEqual (line 19094) | function shallowEqual(objA, objB) {
  function shouldUpdateReactComponent (line 19145) | function shouldUpdateReactComponent(prevElement, nextElement) {
  function toArray (line 19243) | function toArray(obj) {
  function userProvidedKeyEscaper (line 19329) | function userProvidedKeyEscaper(match) {
  function getComponentKey (line 19340) | function getComponentKey(component, index) {
  function escapeUserProvidedKey (line 19355) | function escapeUserProvidedKey(text) {
  function wrapUserProvidedKey (line 19369) | function wrapUserProvidedKey(key) {
  function traverseAllChildrenImpl (line 19382) | function traverseAllChildrenImpl(
  function traverseAllChildren (line 19530) | function traverseAllChildren(children, callback, traverseContext) {

FILE: atc/django-atc-demo-ui/atc_demo_ui/views.py
  function index (line 16) | def index(request):

FILE: atc/django-atc-demo-ui/setup.py
  function get_version (line 28) | def get_version(package):
  function get_packages (line 36) | def get_packages(package):
  function get_package_data (line 45) | def get_package_data(package):

FILE: atc/django-atc-profile-storage/atc_profile_storage/migrations/0001_initial.py
  class Migration (line 7) | class Migration(migrations.Migration):

FILE: atc/django-atc-profile-storage/atc_profile_storage/models.py
  class Profile (line 13) | class Profile(models.Model):

FILE: atc/django-atc-profile-storage/atc_profile_storage/serializers.py
  class ProfileSerializer (line 15) | class ProfileSerializer(serializers.ModelSerializer):
    class Meta (line 16) | class Meta:
    method to_representation (line 20) | def to_representation(self, instance):

FILE: atc/django-atc-profile-storage/atc_profile_storage/views.py
  class JSONResponse (line 18) | class JSONResponse(HttpResponse):
    method __init__ (line 19) | def __init__(self, data, **kwargs):
  function profile_list (line 26) | def profile_list(request):
  function profile_detail (line 46) | def profile_detail(request, pk):

FILE: atc/django-atc-profile-storage/setup.py
  function get_version (line 21) | def get_version(package):
  function get_packages (line 29) | def get_packages(package):
  function get_package_data (line 38) | def get_package_data(package):

FILE: chef/atc/libraries/default.rb
  class Chef (line 11) | class Chef
    class Node (line 13) | class Node
      method virtualized? (line 14) | def virtualized?
      method vagrant? (line 22) | def vagrant?
      method default_user (line 26) | def default_user
      method repo_basedir (line 31) | def repo_basedir
      method selinux? (line 35) | def selinux?

FILE: chef/atc/providers/install_virtualenv_packages.rb
  function handle_packages (line 15) | def handle_packages(packages, virtualenv)

FILE: chef/atcclient/libraries/patch.rb
  class ::Chef::Provider::Package::Apt (line 12) | class ::Chef::Provider::Package::Apt
    method run_noninteractive (line 13) | def run_noninteractive(command)

FILE: tests/host.py
  class Nothing (line 22) | class Nothing(object):
    method __getattr__ (line 24) | def __getattr__(self, name):
  class Host (line 30) | class Host(paramiko.SSHClient):
    method __init__ (line 35) | def __init__(self, ssh_config):
    method getIp (line 48) | def getIp(self, prefix='192.168.'):
    method cmd (line 60) | def cmd(self, command):
    method proc (line 64) | def proc(self, command):
    method close (line 69) | def close(self):
    method __exit__ (line 72) | def __exit__(self, type, val, tb):
    method __str__ (line 76) | def __str__(self):
  class Process (line 80) | class Process(object):
    method __init__ (line 85) | def __init__(self, host, command):
    method stdout (line 94) | def stdout(self):
    method kill (line 97) | def kill(self):
    method __enter__ (line 104) | def __enter__(self):
    method __exit__ (line 107) | def __exit__(self, type, val, tb):

FILE: tests/local-test.py
  function parseIPerfPrefix (line 25) | def parseIPerfPrefix(s):
  function parseIPerfOutput (line 37) | def parseIPerfOutput(stdout):
  function run_iperf (line 44) | def run_iperf(server):
  function test_network (line 57) | def test_network(gateway, server, rate):
  function print_header (line 62) | def print_header():
  function print_results (line 66) | def print_results(rate, things):
  function rateList (line 71) | def rateList(rate_str):
  function getGateway (line 78) | def getGateway(server):
  function main (line 91) | def main():

FILE: tests/speed.py
  class Speed (line 17) | class Speed(object):
    method __init__ (line 20) | def __init__(self, value, unit=BITS):
    method faster (line 23) | def faster(self, other):
    method slower (line 26) | def slower(self, other):
    method kbps (line 29) | def kbps(self):
    method __str__ (line 32) | def __str__(self):
    method __add__ (line 46) | def __add__(self, other):
    method __sub__ (line 52) | def __sub__(self, other):
    method __div__ (line 58) | def __div__(self, other):
    method __mul__ (line 64) | def __mul__(self, other):
  function parseIPerfSpeed (line 76) | def parseIPerfSpeed(s):

FILE: tests/tests.py
  class TestAtcdE2E (line 24) | class TestAtcdE2E(unittest.TestCase):
    method test_shapesBandwidth (line 26) | def test_shapesBandwidth(self):

FILE: tests/vagrant.py
  class _sshGroup (line 18) | class _sshGroup(object):
    method closeAll (line 21) | def closeAll(cls, clients):
    method __init__ (line 29) | def __init__(self):
    method append (line 32) | def append(self, client):
    method __enter__ (line 35) | def __enter__(self):
    method __exit__ (line 38) | def __exit__(self, type, value, tb):
  class _vagrant (line 43) | class _vagrant(object):
    method ssh (line 46) | def ssh(self, *names):
    method sshConfig (line 53) | def sshConfig(self, name):

FILE: tests/vms.py
  function speedBetween (line 17) | def speedBetween(client, server, time=30, udp=False):
  function shape (line 29) | def shape(gateway, host, speed):
  function unshape (line 111) | def unshape(gateway, host):
Condensed preview — 160 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,565K chars).
[
  {
    "path": ".coveragerc",
    "chars": 133,
    "preview": "[run]\nbranch = True\nomit =\n  atc/atcd/tests/*\n  # files generated by thrift\n  atc/atc_thrift/atc_thrift/*\n  # chef files"
  },
  {
    "path": ".github/ISSUE_TEMPLATE.md",
    "chars": 2328,
    "preview": "<!--\nIf you are filling an issue, please provide the information below, if this is not a bug and just a question, you ca"
  },
  {
    "path": ".gitignore",
    "chars": 354,
    "preview": "*.log\n*.pot\n*.pyc\n*.sqlite3\nlocal_settings.py\n*.swp\n*.swo\nexternal/\ncollected_static/\n.vagrant\n.DS_Store\nMakefile.in\nacl"
  },
  {
    "path": ".pep8",
    "chars": 42,
    "preview": "[pep8]\nexclude = migrations,*/atc_thrift/\n"
  },
  {
    "path": ".rubocop.yml",
    "chars": 138,
    "preview": "AllCops:\n    Exclude:\n        - '**/Berksfile'\n        - '**/Vagrantfile'\n        - '**/metadata.rb'\nStyle/HashSyntax:\n "
  },
  {
    "path": ".travis.yml",
    "chars": 354,
    "preview": "sudo: false\nlanguage: python\npython:\n    - \"2.7\"\ninstall:\n    - pip install flake8\n    - pip install pep8\n    - pip inst"
  },
  {
    "path": "CHANGELOG.md",
    "chars": 1354,
    "preview": "# Changelog\n\n* 0.1.6\n    * Suport for Django 1.10 #296\n\n* 0.1.5\n    * Fix handling of POSTed profiles. #287\n\n* 0.1.4\n   "
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 1722,
    "preview": "# Contributing to Augmented Traffic Control\nWe want to make contributing to this project as easy and transparent as\nposs"
  },
  {
    "path": "CONTRIBUTORS.md",
    "chars": 171,
    "preview": "* Alessandro Salvatori\n* Ameesh Goyal\n* Andrew Pope\n* Anthony Gargiulo\n* Chris Vander Mey\n* Emmanuel Bretelle\n* Gus Luxt"
  },
  {
    "path": "LICENSE",
    "chars": 1546,
    "preview": "BSD License\n\nFor Augmented Traffic Control software\n\nCopyright (c) 2014-present, Facebook, Inc. All rights reserved.\n\nRe"
  },
  {
    "path": "Makefile",
    "chars": 2358,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "PATENTS",
    "chars": 1994,
    "preview": "Additional Grant of Patent Rights Version 2\n\n\"Software\" means the Augmented Traffic Control software distributed by Face"
  },
  {
    "path": "README.md",
    "chars": 11343,
    "preview": "# Augmented Traffic Control\n\n[![build-status-image]][travis]\n[![pypi-version]][pypi]\n\n\nFull documentation for the projec"
  },
  {
    "path": "Setup.md",
    "chars": 2761,
    "preview": "Setup\n========\n\nRequirements\n--------\n\n### Linux\n\n`ATC` makes use of [`iproute2`](http://www.linuxfoundation.org/collabo"
  },
  {
    "path": "atc/atc_thrift/MANIFEST.in",
    "chars": 18,
    "preview": "include README.md\n"
  },
  {
    "path": "atc/atc_thrift/Makefile",
    "chars": 59,
    "preview": "all:\n\tthrift  --out . --gen py:new_style atc_thrift.thrift\n"
  },
  {
    "path": "atc/atc_thrift/README.md",
    "chars": 270,
    "preview": "ATC Thrift\n==========\n\nATC Thrift is `Augmented Traffic Control` (ATC) Thrift Library\n\n`atc_thrift.thrift` contains the "
  },
  {
    "path": "atc/atc_thrift/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "atc/atc_thrift/atc_thrift/Atcd-remote",
    "chars": 4994,
    "preview": "#!/usr/bin/env python\n#\n# Autogenerated by Thrift Compiler (0.9.1)\n#\n# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHA"
  },
  {
    "path": "atc/atc_thrift/atc_thrift/Atcd.py",
    "chars": 79640,
    "preview": "#\n# Autogenerated by Thrift Compiler (0.9.1)\n#\n# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING\n#\n#  o"
  },
  {
    "path": "atc/atc_thrift/atc_thrift/__init__.py",
    "chars": 42,
    "preview": "__all__ = ['ttypes', 'constants', 'Atcd']\n"
  },
  {
    "path": "atc/atc_thrift/atc_thrift/constants.py",
    "chars": 254,
    "preview": "#\n# Autogenerated by Thrift Compiler (0.9.1)\n#\n# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING\n#\n#  o"
  },
  {
    "path": "atc/atc_thrift/atc_thrift/ttypes.py",
    "chars": 40076,
    "preview": "#\n# Autogenerated by Thrift Compiler (0.9.1)\n#\n# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING\n#\n#  o"
  },
  {
    "path": "atc/atc_thrift/atc_thrift.thrift",
    "chars": 3525,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "atc/atc_thrift/setup.cfg",
    "chars": 63,
    "preview": "[wheel]\nuniversal = 1\n[build]\nexecutable = /usr/bin/env python\n"
  },
  {
    "path": "atc/atc_thrift/setup.py",
    "chars": 1365,
    "preview": "#!/usr/bin/env python\n#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed "
  },
  {
    "path": "atc/atcd/MANIFEST.in",
    "chars": 43,
    "preview": "include README.md\ninclude requirements.txt\n"
  },
  {
    "path": "atc/atcd/README.md",
    "chars": 5683,
    "preview": "# ATCD\n\n## Introduction\n\nATCD is the `Augmented Traffic Control` (ATC) Daemon which is reponsible for\nhandling traffic s"
  },
  {
    "path": "atc/atcd/atcd/AtcdDBQueueTask.py",
    "chars": 1921,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "atc/atcd/atcd/AtcdDeviceTimeoutTask.py",
    "chars": 770,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "atc/atcd/atcd/AtcdThriftHandlerTask.py",
    "chars": 27496,
    "preview": "#!/usr/bin/env python\n#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed "
  },
  {
    "path": "atc/atcd/atcd/AtcdVService.py",
    "chars": 1109,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "atc/atcd/atcd/__init__.py",
    "chars": 22,
    "preview": "__version__ = '0.1.6'\n"
  },
  {
    "path": "atc/atcd/atcd/access_manager.py",
    "chars": 5368,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "atc/atcd/atcd/backends/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "atc/atcd/atcd/backends/linux.py",
    "chars": 17449,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "atc/atcd/atcd/db_manager.py",
    "chars": 2521,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "atc/atcd/atcd/idmanager.py",
    "chars": 1599,
    "preview": "#!/usr/bin/env python\n#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed "
  },
  {
    "path": "atc/atcd/atcd/scripts/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "atc/atcd/atcd/scripts/runner.py",
    "chars": 891,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "atc/atcd/atcd/tools/test_secure_access.py",
    "chars": 1950,
    "preview": "#!/usr/bin/env python\n#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed "
  },
  {
    "path": "atc/atcd/bin/atcd",
    "chars": 366,
    "preview": "#!/usr/bin/env python\n#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed "
  },
  {
    "path": "atc/atcd/requirements/requirements-testing.txt",
    "chars": 12,
    "preview": "pytest\nmock\n"
  },
  {
    "path": "atc/atcd/requirements.txt",
    "chars": 50,
    "preview": "--index-url https://pypi.python.org/simple/\n\n-e .\n"
  },
  {
    "path": "atc/atcd/setup.cfg",
    "chars": 63,
    "preview": "[wheel]\nuniversal = 1\n[build]\nexecutable = /usr/bin/env python\n"
  },
  {
    "path": "atc/atcd/setup.py",
    "chars": 2010,
    "preview": "#!/usr/bin/env python\n#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed "
  },
  {
    "path": "atc/atcd/tests/idmanager_test.py",
    "chars": 1258,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "atc/atcd/tests/test_AtcdDBQueueTask.py",
    "chars": 3623,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "atc/atcd/tests/test_AtcdThriftHandlerTask.py",
    "chars": 641,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "atc/atcd/tests/test_AtcdVService.py",
    "chars": 1597,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "atc/atcd/tests/test_access_manager.py",
    "chars": 7769,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "atc/atcd/tests/test_sqlite_manager.py",
    "chars": 3972,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "atc/django-atc-api/MANIFEST.in",
    "chars": 18,
    "preview": "include README.md\n"
  },
  {
    "path": "atc/django-atc-api/README.md",
    "chars": 9857,
    "preview": "# ATC Api\n\nATC API is a Django app that allow to bridge a REST API to ATCD's thrift API.\n\n# Setup\n\n## Requirements\n\n* [D"
  },
  {
    "path": "atc/django-atc-api/atc_api/__init__.py",
    "chars": 22,
    "preview": "__version__ = '0.1.6'\n"
  },
  {
    "path": "atc/django-atc-api/atc_api/atcd_client.py",
    "chars": 919,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "atc/django-atc-api/atc_api/serializers.py",
    "chars": 5366,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "atc/django-atc-api/atc_api/settings.py",
    "chars": 1628,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "atc/django-atc-api/atc_api/static/js/atc-api.js",
    "chars": 4056,
    "preview": "/**\n * Copyright (c) 2014, Facebook, Inc.\n * All rights reserved.\n *\n *  This source code is licensed under the BSD-styl"
  },
  {
    "path": "atc/django-atc-api/atc_api/urls.py",
    "chars": 766,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "atc/django-atc-api/atc_api/utils.py",
    "chars": 728,
    "preview": "#\n#  Copyright (c) 2015, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "atc/django-atc-api/atc_api/views.py",
    "chars": 7410,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "atc/django-atc-api/setup.cfg",
    "chars": 63,
    "preview": "[wheel]\nuniversal = 1\n[build]\nexecutable = /usr/bin/env python\n"
  },
  {
    "path": "atc/django-atc-api/setup.py",
    "chars": 2569,
    "preview": "#!/usr/bin/env python\n#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed "
  },
  {
    "path": "atc/django-atc-demo-ui/MANIFEST.in",
    "chars": 43,
    "preview": "include README.md\ninclude requirements.txt\n"
  },
  {
    "path": "atc/django-atc-demo-ui/README.md",
    "chars": 1874,
    "preview": "# ATC DEMO UI\n\nDjango ATC Demo UI is a Django app that allow to modify traffic shaping applied to a device via a Web UI."
  },
  {
    "path": "atc/django-atc-demo-ui/atc_demo_ui/__init__.py",
    "chars": 22,
    "preview": "__version__ = '0.1.6'\n"
  },
  {
    "path": "atc/django-atc-demo-ui/atc_demo_ui/settings.py",
    "chars": 1778,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "atc/django-atc-demo-ui/atc_demo_ui/static/css/atc.css",
    "chars": 538,
    "preview": "/**\n * Copyright (c) 2014, Facebook, Inc.\n * All rights reserved.\n *\n *  This source code is licensed under the BSD-styl"
  },
  {
    "path": "atc/django-atc-demo-ui/atc_demo_ui/static/js/atc-auth.js",
    "chars": 5689,
    "preview": "/** @jsx React.DOM */\n/**\n * Copyright (c) 2014, Facebook, Inc.\n * All rights reserved.\n *\n *  This source code is licen"
  },
  {
    "path": "atc/django-atc-demo-ui/atc_demo_ui/static/js/atc-profiles.js",
    "chars": 5038,
    "preview": "/** @jsx React.DOM */\n/**\n * Copyright (c) 2014, Facebook, Inc.\n * All rights reserved.\n *\n *  This source code is licen"
  },
  {
    "path": "atc/django-atc-demo-ui/atc_demo_ui/static/js/atc-shaping.js",
    "chars": 7003,
    "preview": "/** @jsx React.DOM */\n/**\n * Copyright (c) 2014, Facebook, Inc.\n * All rights reserved.\n *\n *  This source code is licen"
  },
  {
    "path": "atc/django-atc-demo-ui/atc_demo_ui/static/js/atc-utils.js",
    "chars": 2793,
    "preview": "/** @jsx React.DOM */\n/**\n * Copyright (c) 2014, Facebook, Inc.\n * All rights reserved.\n *\n *  This source code is licen"
  },
  {
    "path": "atc/django-atc-demo-ui/atc_demo_ui/static/js/atc.js",
    "chars": 8356,
    "preview": "/** @jsx React.DOM */\n/**\n * Copyright (c) 2014, Facebook, Inc.\n * All rights reserved.\n *\n *  This source code is licen"
  },
  {
    "path": "atc/django-atc-demo-ui/atc_demo_ui/static/vendor/react/JSXTransformer-0.13.3.js",
    "chars": 493024,
    "preview": "/**\n * JSXTransformer v0.13.3\n */\n(function(f){if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports"
  },
  {
    "path": "atc/django-atc-demo-ui/atc_demo_ui/static/vendor/react/react-0.13.3.js",
    "chars": 600572,
    "preview": "/**\n * React v0.13.3\n */\n(function(f){if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=f()}else"
  },
  {
    "path": "atc/django-atc-demo-ui/atc_demo_ui/templates/atc_demo_ui/base.html",
    "chars": 2256,
    "preview": "<!DOCTYPE html>\n<html lang=\"en\">\n{% load staticfiles %}\n{% load bootstrap_themes %}\n    <head>\n    <title>{{ atc_demo_ui"
  },
  {
    "path": "atc/django-atc-demo-ui/atc_demo_ui/templates/atc_demo_ui/index.html",
    "chars": 277,
    "preview": "{% extends \"atc_demo_ui/base.html\" %}\n{% block content %}\n<div id=\"atc_demo_ui\">\n\n\n</div>\n\n<script type=\"text/jsx\">\n    "
  },
  {
    "path": "atc/django-atc-demo-ui/atc_demo_ui/templates/atc_demo_ui/shaping_settings.html",
    "chars": 661,
    "preview": "<form class=\"form-horizontal\" role=\"form\">\n{% with 'up down' as links %}\n{% for link in links.split %}\n    <div class=\"f"
  },
  {
    "path": "atc/django-atc-demo-ui/atc_demo_ui/urls.py",
    "chars": 436,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "atc/django-atc-demo-ui/atc_demo_ui/views.py",
    "chars": 647,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "atc/django-atc-demo-ui/requirements.txt",
    "chars": 50,
    "preview": "--index-url https://pypi.python.org/simple/\n\n-e .\n"
  },
  {
    "path": "atc/django-atc-demo-ui/setup.cfg",
    "chars": 63,
    "preview": "[wheel]\nuniversal = 1\n[build]\nexecutable = /usr/bin/env python\n"
  },
  {
    "path": "atc/django-atc-demo-ui/setup.py",
    "chars": 2690,
    "preview": "#!/usr/bin/env python\n#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed "
  },
  {
    "path": "atc/django-atc-profile-storage/MANIFEST.in",
    "chars": 18,
    "preview": "include README.md\n"
  },
  {
    "path": "atc/django-atc-profile-storage/README.md",
    "chars": 1216,
    "preview": "# ATC Profile Storage\n\nATC Profile Storage is a Django app that allows to store predefined ATC profiles in DB.\n\n## Requi"
  },
  {
    "path": "atc/django-atc-profile-storage/atc_profile_storage/__init__.py",
    "chars": 22,
    "preview": "__version__ = '0.1.6'\n"
  },
  {
    "path": "atc/django-atc-profile-storage/atc_profile_storage/migrations/0001_initial.py",
    "chars": 619,
    "preview": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migrat"
  },
  {
    "path": "atc/django-atc-profile-storage/atc_profile_storage/migrations/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "atc/django-atc-profile-storage/atc_profile_storage/models.py",
    "chars": 500,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "atc/django-atc-profile-storage/atc_profile_storage/serializers.py",
    "chars": 756,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "atc/django-atc-profile-storage/atc_profile_storage/static/js/atc-profile-storage.js",
    "chars": 827,
    "preview": "/**\n * Copyright (c) 2014, Facebook, Inc.\n * All rights reserved.\n *\n *  This source code is licensed under the BSD-styl"
  },
  {
    "path": "atc/django-atc-profile-storage/atc_profile_storage/urls.py",
    "chars": 477,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "atc/django-atc-profile-storage/atc_profile_storage/views.py",
    "chars": 2225,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "atc/django-atc-profile-storage/setup.cfg",
    "chars": 63,
    "preview": "[wheel]\nuniversal = 1\n[build]\nexecutable = /usr/bin/env python\n"
  },
  {
    "path": "atc/django-atc-profile-storage/setup.py",
    "chars": 2611,
    "preview": "#!/usr/bin/env python\n#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed "
  },
  {
    "path": "chef/atc/.gitignore",
    "chars": 108,
    "preview": ".vagrant\nBerksfile.lock\n*~\n*#\n.#*\n\\#*#\n.*.sw[a-z]\n*.un~\n/cookbooks\n\n# Bundler\nGemfile.lock\nbin/*\n.bundle/*\n\n"
  },
  {
    "path": "chef/atc/.kitchen.yml",
    "chars": 523,
    "preview": "---\ndriver:\n    name: vagrant\n    synced_folders:\n        - [\"../../atc\", \"/usr/local/src/atc/atc\"]\n    network:\n       "
  },
  {
    "path": "chef/atc/Berksfile",
    "chars": 208,
    "preview": "site :opscode\n\nmetadata\ncookbook 'simple_iptables', git: 'https://github.com/rtkwlf/cookbook-simple-iptables.git', tag: "
  },
  {
    "path": "chef/atc/Gemfile",
    "chars": 47,
    "preview": "source 'https://rubygems.org'\n\ngem 'berkshelf'\n"
  },
  {
    "path": "chef/atc/LICENSE",
    "chars": 72,
    "preview": "Copyright (C) 2014 YOUR_NAME\n\nAll rights reserved - Do Not Redistribute\n"
  },
  {
    "path": "chef/atc/README.md",
    "chars": 685,
    "preview": "# atc cookbook\n\nInstall and configure atc\n\n# Requirements\n## Platforms\n- Centos 6\n- Ubuntu\n\n## Cookbooks\n- python\n- yum-"
  },
  {
    "path": "chef/atc/Thorfile",
    "chars": 86,
    "preview": "# encoding: utf-8\n\nrequire 'bundler'\nrequire 'bundler/setup'\nrequire 'berkshelf/thor'\n"
  },
  {
    "path": "chef/atc/Vagrantfile",
    "chars": 2146,
    "preview": "# -*- mode: ruby -*-\n# vi: set ft=ruby :\nboxes = [\n    {\n        :name => :precise,\n        :box    => 'bento/ubuntu-12."
  },
  {
    "path": "chef/atc/attributes/default.rb",
    "chars": 2682,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "chef/atc/chefignore",
    "chars": 985,
    "preview": "# Put files/directories that should be ignored in this file when uploading\n# or sharing to the community site.\n# Lines t"
  },
  {
    "path": "chef/atc/files/default/init.d/atcd.debian",
    "chars": 1742,
    "preview": "#!/bin/sh\n#\n# atcd - this script starts and stops the atcd traffic shaping daemon\n#\n# config: /etc/default/atcd /etc/atc"
  },
  {
    "path": "chef/atc/files/default/init.d/atcd.rhel",
    "chars": 1937,
    "preview": "#!/bin/sh\n#\n# atcd - this script starts and stops the atcd traffic shaping daemon\n#\n# chkconfig:   2345 80 20\n# descript"
  },
  {
    "path": "chef/atc/genymotion.sh",
    "chars": 455,
    "preview": "#!/bin/bash\n\nPLATFORM=$(uname -s)\n\nif [[ \"${PLATFORM}\" == 'Darwin' ]]; then\n    VBOXMANAGE='/Applications/VirtualBox.app"
  },
  {
    "path": "chef/atc/libraries/default.rb",
    "chars": 864,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "chef/atc/metadata.rb",
    "chars": 684,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "chef/atc/providers/install_packages.rb",
    "chars": 516,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "chef/atc/providers/install_virtualenv_packages.rb",
    "chars": 813,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "chef/atc/recipes/_common_system.rb",
    "chars": 895,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "chef/atc/recipes/_virtualenv.rb",
    "chars": 918,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "chef/atc/recipes/atcd.rb",
    "chars": 3603,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "chef/atc/recipes/atcui.rb",
    "chars": 3233,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "chef/atc/recipes/default.rb",
    "chars": 435,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "chef/atc/resources/install_packages.rb",
    "chars": 452,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "chef/atc/resources/install_virtualenv_packages.rb",
    "chars": 521,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "chef/atc/templates/default/atcui-setup.erb",
    "chars": 766,
    "preview": "#!/bin/bash\n\nRED=\"\\e[0;31m\"\nGREEN=\"\\e[0;32m\"\nNC=\"\\e[00m\"\n\nUSER=\"<%= node['atc']['atcui']['user'] %>\"\n\n# Allow either $US"
  },
  {
    "path": "chef/atc/templates/default/config/atcd.erb",
    "chars": 759,
    "preview": "<% if node['atc']['atcd']['listen']['address'] %>\nATCD_LISTEN_ADDRESS=<%= node['atc']['atcd']['listen']['address'] %>\n<%"
  },
  {
    "path": "chef/atc/templates/default/config/atcui.erb",
    "chars": 562,
    "preview": "<% if node['atc']['atcui']['listen']['address'] %>\nATCUI_LISTEN_ADDRESS=<%= node['atc']['atcui']['listen']['address'] %>"
  },
  {
    "path": "chef/atc/templates/default/django/settings.py.erb",
    "chars": 5593,
    "preview": "# Django settings for atc_ui project.\n\nimport os\n\nDEBUG = True\nTEMPLATE_DEBUG = DEBUG\n\n# Uncomment the following to run "
  },
  {
    "path": "chef/atc/templates/default/django/urls.py.erb",
    "chars": 640,
    "preview": "from django.conf.urls import include\nfrom django.conf.urls import url\nfrom django.contrib import admin\nfrom django.views"
  },
  {
    "path": "chef/atc/templates/default/mount-udev.rules.erb",
    "chars": 269,
    "preview": "# File generated by chef, do not edit\n\n# Start <%= @service %> on vagrant mount\nSUBSYSTEM==\"bdi\",ACTION==\"add\",RUN+=\"/et"
  },
  {
    "path": "chef/atc/templates/default/upstart/atcui.conf.erb",
    "chars": 922,
    "preview": "# Augmented Traffic Control User Interface\n\n#author \"Author Here\"\nversion \"0.0.1\"\ndescription \"Augmented Traffic Control"
  },
  {
    "path": "chef/atcclient/.gitignore",
    "chars": 108,
    "preview": ".vagrant\nBerksfile.lock\n*~\n*#\n.#*\n\\#*#\n.*.sw[a-z]\n*.un~\n/cookbooks\n\n# Bundler\nGemfile.lock\nbin/*\n.bundle/*\n\n"
  },
  {
    "path": "chef/atcclient/Berksfile",
    "chars": 24,
    "preview": "site :opscode\n\nmetadata\n"
  },
  {
    "path": "chef/atcclient/Gemfile",
    "chars": 47,
    "preview": "source 'https://rubygems.org'\n\ngem 'berkshelf'\n"
  },
  {
    "path": "chef/atcclient/LICENSE",
    "chars": 72,
    "preview": "Copyright (C) 2014 YOUR_NAME\n\nAll rights reserved - Do Not Redistribute\n"
  },
  {
    "path": "chef/atcclient/README.md",
    "chars": 116,
    "preview": "# atcclient cookbook\n\n# Requirements\n\n# Usage\n\n# Attributes\n\n# Recipes\n\n# Author\n\nAuthor:: YOUR_NAME (<YOUR_EMAIL>)\n"
  },
  {
    "path": "chef/atcclient/Thorfile",
    "chars": 86,
    "preview": "# encoding: utf-8\n\nrequire 'bundler'\nrequire 'bundler/setup'\nrequire 'berkshelf/thor'\n"
  },
  {
    "path": "chef/atcclient/Vagrantfile",
    "chars": 5646,
    "preview": "# -*- mode: ruby -*-\n# vi: set ft=ruby :\n\nDFT_BOX = 'chef/ubuntu-12.04'\nTOTAL_BOXES = 5\nbox = {\n    :box    => DFT_BOX,\n"
  },
  {
    "path": "chef/atcclient/chefignore",
    "chars": 985,
    "preview": "# Put files/directories that should be ignored in this file when uploading\n# or sharing to the community site.\n# Lines t"
  },
  {
    "path": "chef/atcclient/libraries/patch.rb",
    "chars": 780,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "chef/atcclient/metadata.rb",
    "chars": 576,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "chef/atcclient/recipes/default.rb",
    "chars": 484,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "tests/Vagrantfile",
    "chars": 2709,
    "preview": "# -*- mode: ruby -*-\n# vi: set ft=ruby :\n\n#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This sour"
  },
  {
    "path": "tests/__init__.py",
    "chars": 298,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "tests/host.py",
    "chars": 3003,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "tests/local-test.py",
    "chars": 2958,
    "preview": "#!/usr/bin/env python\n\nfrom subprocess import Popen, PIPE\nimport argparse\n\nfrom speed import Speed, parseIPerfSpeed, KIL"
  },
  {
    "path": "tests/provision.sh",
    "chars": 903,
    "preview": "#!/bin/bash -eu\n\n#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under"
  },
  {
    "path": "tests/speed.py",
    "chars": 2666,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "tests/tests.py",
    "chars": 2156,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "tests/vagrant.py",
    "chars": 1676,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "tests/vms.py",
    "chars": 3398,
    "preview": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style li"
  },
  {
    "path": "tox.ini",
    "chars": 66,
    "preview": "[flake8]\nexclude = migrations,settings.py,*/atc_thrift/atc_thrift\n"
  },
  {
    "path": "utils/dump_system_info.sh",
    "chars": 570,
    "preview": "#!/bin/bash\n\nWAN=${1:-eth0}\nLAN=${2:-eth1}\n\nfunction title {\n    echo\n    echo \"######### $1 #########\"\n    echo\n}\n\nfunc"
  },
  {
    "path": "utils/profiles/2G-DevelopingRural.json",
    "chars": 1210,
    "preview": "{\n    \"content\": {\n        \"down\": {\n            \"corruption\": {\n                \"correlation\": 0,\n                \"perc"
  },
  {
    "path": "utils/profiles/2G-DevelopingUrban.json",
    "chars": 1206,
    "preview": "{\n    \"content\": {\n        \"down\": {\n            \"corruption\": {\n                \"correlation\": 0,\n                \"perc"
  },
  {
    "path": "utils/profiles/3G-Average.json",
    "chars": 1199,
    "preview": "{\n    \"content\": {\n        \"down\": {\n            \"corruption\": {\n                \"correlation\": 0,\n                \"perc"
  },
  {
    "path": "utils/profiles/3G-Good.json",
    "chars": 1195,
    "preview": "{\n    \"content\": {\n        \"down\": {\n            \"corruption\": {\n                \"correlation\": 0,\n                \"perc"
  },
  {
    "path": "utils/profiles/Cable.json",
    "chars": 1190,
    "preview": "{\n    \"content\": {\n        \"down\": {\n            \"corruption\": {\n                \"correlation\": 0,\n                \"perc"
  },
  {
    "path": "utils/profiles/DSL.json",
    "chars": 1187,
    "preview": "{\n    \"content\": {\n        \"down\": {\n            \"corruption\": {\n                \"correlation\": 0,\n                \"perc"
  },
  {
    "path": "utils/profiles/Edge-Average.json",
    "chars": 1205,
    "preview": "{\n    \"content\": {\n        \"down\": {\n            \"corruption\": {\n                \"correlation\": 0,\n                \"perc"
  },
  {
    "path": "utils/profiles/Edge-Good.json",
    "chars": 1202,
    "preview": "{\n    \"content\": {\n        \"down\": {\n            \"corruption\": {\n                \"correlation\": 0,\n                \"perc"
  },
  {
    "path": "utils/profiles/Edge-Lossy.json",
    "chars": 1203,
    "preview": "{\n    \"content\": {\n        \"down\": {\n            \"corruption\": {\n                \"correlation\": 0,\n                \"perc"
  },
  {
    "path": "utils/profiles/NoConnectivity.json",
    "chars": 1199,
    "preview": "{\n    \"content\": {\n        \"down\": {\n            \"corruption\": {\n                \"correlation\": 0,\n                \"perc"
  },
  {
    "path": "utils/restore-profiles.sh",
    "chars": 579,
    "preview": "#!/usr/bin/env bash\n\nATC_HOST=\"$1\"\n\nif [ -z \"$ATC_HOST\" ] ; then\n    echo \"usage: $0 HOST\"\n    echo \"    HOST should be "
  }
]

About this extraction

This page contains the full source code of the facebookarchive/augmented-traffic-control GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 160 files (1.4 MB), approximately 367.4k tokens, and a symbol index with 1361 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!