Merge pull request #18 from kbandla/doc-work

This commit is contained in:
Brian Wylie 2015-05-19 12:40:50 -06:00
commit 5f4de7a248
19 changed files with 993 additions and 7 deletions

View File

@ -7,6 +7,7 @@ env:
- TOXENV=py26,coveralls
- TOXENV=py27,coveralls
- TOXENV=pypy,coveralls
- TOXENV=docs
before_install:
- python --version
- virtualenv --version

45
CONTRIBUTING.rst Normal file
View File

@ -0,0 +1,45 @@
============
Contributing
============
Report a Bug or Make a Feature Request
--------------------------------------
Please go to the GitHub Issues page: https://github.com/kbandla/dpkt/issues.
Checkout the Code
----------------
::
git clone https://github.com/kblandla/dpkt.git
Become a Developer
------------------
dpkt uses the 'GitHub Flow' model: `GitHub Flow <http://scottchacon.com/2011/08/31/github-flow.html>`_
- To work on something new, create a descriptively named branch off of master (ie: my-awesome)
- Commit to that branch locally and regularly push your work to the same named branch on the server
- When you need feedback or help, or you think the branch is ready for merging, open a pull request
- After someone else has reviewed and signed off on the feature, you can merge it into master
Getting Started
~~~~~~~~~~~~~~~
- Fork the repo on GitHub
- git clone git@github.com:your_name_here/dpkt.git
New Feature or Bug
~~~~~~~~~~~~~~~~~~
::
$ git checkout -b my-awesome
$ git push -u origin my-awesome
$ <code for a bit>; git push
$ <code for a bit>; git push
$ tox (this will run all the tests)
- Go to github and hit 'New pull request'
- Someone reviews it and says 'AOK'
- Merge the pull request (green button)

View File

@ -1,2 +1,7 @@
include AUTHORS CHANGES README.rst LICENSE
recursive-include docs *
prune docs/_build
global-exclude __pycache__/*

153
docs/Makefile Normal file
View File

@ -0,0 +1,153 @@
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
-rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/pyspotify.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/pyspotify.qhc"
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/pyspotify"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/pyspotify"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."

545
docs/api/api_auto.rst Normal file
View File

@ -0,0 +1,545 @@
dpkt.ah module
--------------
.. automodule:: dpkt.ah
:members:
:undoc-members:
:show-inheritance:
dpkt.aim module
---------------
.. automodule:: dpkt.aim
:members:
:undoc-members:
:show-inheritance:
dpkt.aoe module
---------------
.. automodule:: dpkt.aoe
:members:
:undoc-members:
:show-inheritance:
dpkt.aoeata module
------------------
.. automodule:: dpkt.aoeata
:members:
:undoc-members:
:show-inheritance:
dpkt.aoecfg module
------------------
.. automodule:: dpkt.aoecfg
:members:
:undoc-members:
:show-inheritance:
dpkt.arp module
---------------
.. automodule:: dpkt.arp
:members:
:undoc-members:
:show-inheritance:
dpkt.asn1 module
----------------
.. automodule:: dpkt.asn1
:members:
:undoc-members:
:show-inheritance:
dpkt.bgp module
---------------
.. automodule:: dpkt.bgp
:members:
:undoc-members:
:show-inheritance:
dpkt.cdp module
---------------
.. automodule:: dpkt.cdp
:members:
:undoc-members:
:show-inheritance:
dpkt.crc32c module
------------------
.. automodule:: dpkt.crc32c
:members:
:undoc-members:
:show-inheritance:
dpkt.decorators module
----------------------
.. automodule:: dpkt.decorators
:members:
:undoc-members:
:show-inheritance:
dpkt.dhcp module
----------------
.. automodule:: dpkt.dhcp
:members:
:undoc-members:
:show-inheritance:
dpkt.diameter module
--------------------
.. automodule:: dpkt.diameter
:members:
:undoc-members:
:show-inheritance:
dpkt.dns module
---------------
.. automodule:: dpkt.dns
:members:
:undoc-members:
:show-inheritance:
dpkt.dpkt module
----------------
.. automodule:: dpkt.dpkt
:members:
:undoc-members:
:show-inheritance:
dpkt.dtp module
---------------
.. automodule:: dpkt.dtp
:members:
:undoc-members:
:show-inheritance:
dpkt.esp module
---------------
.. automodule:: dpkt.esp
:members:
:undoc-members:
:show-inheritance:
dpkt.ethernet module
--------------------
.. automodule:: dpkt.ethernet
:members:
:undoc-members:
:show-inheritance:
dpkt.gre module
---------------
.. automodule:: dpkt.gre
:members:
:undoc-members:
:show-inheritance:
dpkt.gzip module
----------------
.. automodule:: dpkt.gzip
:members:
:undoc-members:
:show-inheritance:
dpkt.h225 module
----------------
.. automodule:: dpkt.h225
:members:
:undoc-members:
:show-inheritance:
dpkt.hsrp module
----------------
.. automodule:: dpkt.hsrp
:members:
:undoc-members:
:show-inheritance:
dpkt.http module
----------------
.. automodule:: dpkt.http
:members:
:undoc-members:
:show-inheritance:
dpkt.icmp module
----------------
.. automodule:: dpkt.icmp
:members:
:undoc-members:
:show-inheritance:
dpkt.icmp6 module
-----------------
.. automodule:: dpkt.icmp6
:members:
:undoc-members:
:show-inheritance:
dpkt.ieee80211 module
---------------------
.. automodule:: dpkt.ieee80211
:members:
:undoc-members:
:show-inheritance:
dpkt.igmp module
----------------
.. automodule:: dpkt.igmp
:members:
:undoc-members:
:show-inheritance:
dpkt.ip module
--------------
.. automodule:: dpkt.ip
:members:
:undoc-members:
:show-inheritance:
dpkt.ip6 module
---------------
.. automodule:: dpkt.ip6
:members:
:undoc-members:
:show-inheritance:
dpkt.ipx module
---------------
.. automodule:: dpkt.ipx
:members:
:undoc-members:
:show-inheritance:
dpkt.llc module
---------------
.. automodule:: dpkt.llc
:members:
:undoc-members:
:show-inheritance:
dpkt.loopback module
--------------------
.. automodule:: dpkt.loopback
:members:
:undoc-members:
:show-inheritance:
dpkt.mrt module
---------------
.. automodule:: dpkt.mrt
:members:
:undoc-members:
:show-inheritance:
dpkt.netbios module
-------------------
.. automodule:: dpkt.netbios
:members:
:undoc-members:
:show-inheritance:
dpkt.netflow module
-------------------
.. automodule:: dpkt.netflow
:members:
:undoc-members:
:show-inheritance:
dpkt.ntp module
---------------
.. automodule:: dpkt.ntp
:members:
:undoc-members:
:show-inheritance:
dpkt.ospf module
----------------
.. automodule:: dpkt.ospf
:members:
:undoc-members:
:show-inheritance:
dpkt.pcap module
----------------
.. automodule:: dpkt.pcap
:members:
:undoc-members:
:show-inheritance:
dpkt.pim module
---------------
.. automodule:: dpkt.pim
:members:
:undoc-members:
:show-inheritance:
dpkt.pmap module
----------------
.. automodule:: dpkt.pmap
:members:
:undoc-members:
:show-inheritance:
dpkt.ppp module
---------------
.. automodule:: dpkt.ppp
:members:
:undoc-members:
:show-inheritance:
dpkt.pppoe module
-----------------
.. automodule:: dpkt.pppoe
:members:
:undoc-members:
:show-inheritance:
dpkt.qq module
--------------
.. automodule:: dpkt.qq
:members:
:undoc-members:
:show-inheritance:
dpkt.radiotap module
--------------------
.. automodule:: dpkt.radiotap
:members:
:undoc-members:
:show-inheritance:
dpkt.radius module
------------------
.. automodule:: dpkt.radius
:members:
:undoc-members:
:show-inheritance:
dpkt.rfb module
---------------
.. automodule:: dpkt.rfb
:members:
:undoc-members:
:show-inheritance:
dpkt.rip module
---------------
.. automodule:: dpkt.rip
:members:
:undoc-members:
:show-inheritance:
dpkt.rpc module
---------------
.. automodule:: dpkt.rpc
:members:
:undoc-members:
:show-inheritance:
dpkt.rtp module
---------------
.. automodule:: dpkt.rtp
:members:
:undoc-members:
:show-inheritance:
dpkt.rx module
--------------
.. automodule:: dpkt.rx
:members:
:undoc-members:
:show-inheritance:
dpkt.sccp module
----------------
.. automodule:: dpkt.sccp
:members:
:undoc-members:
:show-inheritance:
dpkt.sctp module
----------------
.. automodule:: dpkt.sctp
:members:
:undoc-members:
:show-inheritance:
dpkt.sip module
---------------
.. automodule:: dpkt.sip
:members:
:undoc-members:
:show-inheritance:
dpkt.sll module
---------------
.. automodule:: dpkt.sll
:members:
:undoc-members:
:show-inheritance:
dpkt.smb module
---------------
.. automodule:: dpkt.smb
:members:
:undoc-members:
:show-inheritance:
dpkt.snoop module
-----------------
.. automodule:: dpkt.snoop
:members:
:undoc-members:
:show-inheritance:
dpkt.ssl module
---------------
.. automodule:: dpkt.ssl
:members:
:undoc-members:
:show-inheritance:
dpkt.ssl_ciphersuites module
----------------------------
.. automodule:: dpkt.ssl_ciphersuites
:members:
:undoc-members:
:show-inheritance:
dpkt.stp module
---------------
.. automodule:: dpkt.stp
:members:
:undoc-members:
:show-inheritance:
dpkt.stun module
----------------
.. automodule:: dpkt.stun
:members:
:undoc-members:
:show-inheritance:
dpkt.tcp module
---------------
.. automodule:: dpkt.tcp
:members:
:undoc-members:
:show-inheritance:
dpkt.telnet module
------------------
.. automodule:: dpkt.telnet
:members:
:undoc-members:
:show-inheritance:
dpkt.tftp module
----------------
.. automodule:: dpkt.tftp
:members:
:undoc-members:
:show-inheritance:
dpkt.tns module
---------------
.. automodule:: dpkt.tns
:members:
:undoc-members:
:show-inheritance:
dpkt.tpkt module
----------------
.. automodule:: dpkt.tpkt
:members:
:undoc-members:
:show-inheritance:
dpkt.udp module
---------------
.. automodule:: dpkt.udp
:members:
:undoc-members:
:show-inheritance:
dpkt.vrrp module
----------------
.. automodule:: dpkt.vrrp
:members:
:undoc-members:
:show-inheritance:
dpkt.yahoo module
-----------------
.. automodule:: dpkt.yahoo
:members:
:undoc-members:
:show-inheritance:

11
docs/api/index.rst Normal file
View File

@ -0,0 +1,11 @@
API Reference
=============
The dpkt API reference section is currently a work in progress, please have patience as we fill in and improve the documentation.
**dpkt Modules**
.. toctree::
:maxdepth: 4
api_auto

7
docs/authors.rst Normal file
View File

@ -0,0 +1,7 @@
*******
Authors
*******
.. include:: ../AUTHORS
If you want to contribute to dpkt, see :doc:`contributing`.

41
docs/badges.rst Normal file
View File

@ -0,0 +1,41 @@
| |docs| |travis| |coveralls| |landscape| |version|
| |downloads| |wheel| |supported-versions| |supported-implementations|
.. |docs| image:: https://readthedocs.org/projects/dpkt/badge/?style=flat
:target: https://readthedocs.org/projects/dpkt
:alt: Documentation Status
.. |travis| image:: http://img.shields.io/travis/kbandla/dpkt/master.png?style=flat
:alt: Travis-CI Build Status
:target: https://travis-ci.org/kbandla/dpkt
.. |coveralls| image:: http://img.shields.io/coveralls/kbandla/dpkt/master.png?style=flat
:alt: Coverage Status
:target: https://coveralls.io/r/kbandla/dpkt
.. |landscape| image:: https://landscape.io/github/kbandla/dpkt/master/landscape.svg?style=flat
:target: https://landscape.io/github/kbandla/dpkt/master
:alt: Code Quality Status
.. |version| image:: http://img.shields.io/pypi/v/dpkt.png?style=flat
:alt: PyPI Package latest release
:target: https://pypi.python.org/pypi/dpkt
.. |downloads| image:: http://img.shields.io/pypi/dm/dpkt.png?style=flat
:alt: PyPI Package monthly downloads
:target: https://pypi.python.org/pypi/dpkt
.. |wheel| image:: https://pypip.in/wheel/dpkt/badge.png?style=flat
:alt: PyPI Wheel
:target: https://pypi.python.org/pypi/dpkt
.. |supported-versions| image:: https://pypip.in/py_versions/dpkt/badge.png?style=flat
:alt: Supported versions
:target: https://pypi.python.org/pypi/dpkt
.. |supported-implementations| image:: https://pypip.in/implementation/dpkt/badge.png?style=flat
:alt: Supported implementations
:target: https://pypi.python.org/pypi/dpkt

4
docs/changelog.rst Normal file
View File

@ -0,0 +1,4 @@
*********
Changelog
*********

75
docs/conf.py Normal file
View File

@ -0,0 +1,75 @@
# encoding: utf-8
"""dpkt documentation build configuration file"""
from __future__ import unicode_literals
import os
import re
import sys
import types
import mock
def get_version(filename):
init_py = open(filename).read()
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", init_py))
return metadata['version']
# -- Workarounds to have autodoc generate API docs ----------------------------
sys.path.insert(0, os.path.abspath('..'))
# Mock any objects that we might need to
foo = mock.Mock()
foo.__version__ = '0.1.1'
sys.modules['foo'] = foo
# -- General configuration ----------------------------------------------------
needs_sphinx = '1.0'
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.extlinks',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
'sphinxcontrib.napoleon'
]
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = 'dpkt'
copyright = '2009-2015 Dug Song and contributors'
release = get_version('../dpkt/__init__.py')
version = '.'.join(release.split('.')[:2])
exclude_patterns = ['_build']
pygments_style = 'sphinx'
modindex_common_prefix = ['dpkt.']
autodoc_default_flags = ['members', 'undoc-members', 'inherited-members']
autodoc_member_order = 'bysource'
# -- Options for HTML output --------------------------------------------------
html_theme = 'default'
html_static_path = ['_static']
html_use_modindex = True
html_use_index = True
html_split_index = False
html_show_sourcelink = True
htmlhelp_basename = 'dpkt'
# -- Options for extlink extension --------------------------------------------
extlinks = {
'issue': ('https://github.com/kbandla/dpkt/issues/%s', '#'),
}

1
docs/contributing.rst Normal file
View File

@ -0,0 +1 @@
.. include:: ../CONTRIBUTING.rst

23
docs/examples.rst Normal file
View File

@ -0,0 +1,23 @@
Examples
========
Current DPKG Examples
---------------------
[@jonoberheide's](https://twitter.com/jonoberheide) old examples still
apply:
- `dpkt Tutorial #1: ICMP
Echo <https://jon.oberheide.org/blog/2008/08/25/dpkt-tutorial-1-icmp-echo/>`__
- `dpkt Tutorial #2: Parsing a PCAP
File <https://jon.oberheide.org/blog/2008/10/15/dpkt-tutorial-2-parsing-a-pcap-file/>`__
- `dpkt Tutorial #3: dns
spoofing <https://jon.oberheide.org/blog/2008/12/20/dpkt-tutorial-3-dns-spoofing/>`__
- `dpkt Tutorial #4: AS Paths from
MRT/BGP <https://jon.oberheide.org/blog/2009/03/25/dpkt-tutorial-4-as-paths-from-mrt-bgp/>`__
Jeff Silverman Docs/Code
------------------------
`Jeff Silverman <https://github.com/jeffsilverm>`__ has some
`code <https://github.com/jeffsilverm/dpkt_doc>`__ and
`documentation <http://www.commercialventvac.com/dpkt.html>`__.

33
docs/index.rst Normal file
View File

@ -0,0 +1,33 @@
dpkt
====
.. include:: badges.rst
dpkt is a python module for fast, simple packet creation / parsing, with definitions for the basic TCP/IP protocols
Getting Started
===============
.. toctree::
:maxdepth: 2
installation
quickstart
examples
API Reference
=============
.. toctree::
:maxdepth: 1
api/index
About dpkt
==========
.. toctree::
:maxdepth: 2
authors
changelog
plans
contributing
license

5
docs/installation.rst Normal file
View File

@ -0,0 +1,5 @@
============
Installation
============
How to install dpkt

4
docs/license.rst Normal file
View File

@ -0,0 +1,4 @@
License
=======
BSD 3-Clause License, as the upstream project

13
docs/plans.rst Normal file
View File

@ -0,0 +1,13 @@
*****************
Development plans
*****************
Current plans
=============
- Be Awesome
Future plans
============
- Maintain the Awesome

20
docs/quickstart.rst Normal file
View File

@ -0,0 +1,20 @@
==========
Quickstart
==========
Grab some packets
-----------------
Lets first grab some packets::
import dpkt
blah
foo
Looking at Protocols
--------------------
Next lets look at some protocols::
import dpkt
blah
foo

3
docs/requirements.txt Normal file
View File

@ -0,0 +1,3 @@
mock >= 1.0
Sphinx >= 1.0
sphinxcontrib-napoleon

11
tox.ini
View File

@ -1,5 +1,5 @@
[tox]
envlist = py26, py27
envlist = py26, py27, docs
[testenv]
install_command =
@ -29,10 +29,7 @@ commands =
coveralls
[testenv:docs]
changedir=docs/
deps =
sphinx
commands =
sphinx-build -b linkcheck ./ _build/
sphinx-build -b html ./ _build/
changedir=docs
deps = -rdocs/requirements.txt
commands = sphinx-build -b html -d {envtmpdir}/doctrees . {envtmpdir}/html