http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e57c2a52/proton-c/include/proton/value.h
----------------------------------------------------------------------
diff --git a/proton-c/include/proton/value.h b/proton-c/include/proton/value.h
deleted file mode 100644
index c47fe83..0000000
--- a/proton-c/include/proton/value.h
+++ /dev/null
@@ -1,240 +0,0 @@
-#ifndef _PROTON_VALUE_H
-#define _PROTON_VALUE_H 1
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <unistd.h>
-
-enum TYPE {
-  EMPTY,
-  BOOLEAN,
-  UBYTE,
-  USHORT,
-  UINT,
-  ULONG,
-  BYTE,
-  SHORT,
-  INT,
-  LONG,
-  FLOAT,
-  DOUBLE,
-  CHAR,
-  SYMBOL,
-  STRING,
-  BINARY,
-  ARRAY,
-  LIST,
-  MAP,
-  TAG,
-  REF
-};
-
-typedef struct pn_value_t pn_value_t;
-typedef struct pn_symbol_t pn_symbol_t;
-typedef struct pn_string_t pn_string_t;
-typedef struct pn_binary_t pn_binary_t;
-typedef struct pn_array_t pn_array_t;
-typedef struct pn_list_t pn_list_t;
-typedef struct pn_map_t pn_map_t;
-typedef struct pn_tag_t pn_tag_t;
-
-struct  pn_value_t {
-  enum TYPE type;
-  union {
-    bool as_boolean;
-    uint8_t as_ubyte;
-    uint16_t as_ushort;
-    uint32_t as_uint;
-    uint64_t as_ulong;
-    int8_t as_byte;
-    int16_t as_short;
-    int32_t as_int;
-    int64_t as_long;
-    float as_float;
-    double as_double;
-    wchar_t as_char;
-    pn_symbol_t *as_symbol;
-    pn_string_t *as_string;
-    pn_binary_t *as_binary;
-    pn_array_t *as_array;
-    pn_list_t *as_list;
-    pn_map_t *as_map;
-    pn_tag_t *as_tag;
-    void *as_ref;
-  } u;
-};
-
-struct pn_tag_t {
-  pn_value_t descriptor;
-  pn_value_t value;
-};
-
-#define EMPTY_VALUE ((pn_value_t) {.type = EMPTY})
-
-int pn_scan(pn_value_t *value, const char *fmt, ...);
-int pn_vscan(pn_value_t *value, const char *fmt, va_list ap);
-pn_value_t pn_value(const char *fmt, ...);
-pn_value_t pn_vvalue(const char *fmt, va_list ap);
-
-pn_list_t *pn_to_list(pn_value_t v);
-pn_map_t *pn_to_map(pn_value_t v);
-pn_tag_t *pn_to_tag(pn_value_t v);
-void *pn_to_ref(pn_value_t v);
-
-pn_value_t pn_from_list(pn_list_t *l);
-pn_value_t pn_from_map(pn_map_t *m);
-pn_value_t pn_from_tag(pn_tag_t *t);
-pn_value_t pn_from_ref(void *r);
-pn_value_t pn_from_binary(pn_binary_t *b);
-pn_value_t pn_from_symbol(pn_symbol_t *s);
-
-int pn_compare_symbol(pn_symbol_t *a, pn_symbol_t *b);
-int pn_compare_string(pn_string_t *a, pn_string_t *b);
-int pn_compare_binary(pn_binary_t *a, pn_binary_t *b);
-int pn_compare_list(pn_list_t *a, pn_list_t *b);
-int pn_compare_map(pn_map_t *a, pn_map_t *b);
-int pn_compare_tag(pn_tag_t *a, pn_tag_t *b);
-int pn_compare_value(pn_value_t a, pn_value_t b);
-
-uintptr_t pn_hash_string(pn_string_t *s);
-uintptr_t pn_hash_binary(pn_binary_t *b);
-uintptr_t pn_hash_list(pn_list_t *l);
-uintptr_t pn_hash_map(pn_map_t *m);
-uintptr_t pn_hash_tag(pn_tag_t *t);
-uintptr_t pn_hash_value(pn_value_t v);
-
-size_t pn_format_sizeof(pn_value_t v);
-size_t pn_format_sizeof_array(pn_array_t *array);
-size_t pn_format_sizeof_list(pn_list_t *list);
-size_t pn_format_sizeof_map(pn_map_t *map);
-size_t pn_format_sizeof_tag(pn_tag_t *tag);
-
-int pn_format_symbol(char **pos, char *limit, pn_symbol_t *sym);
-int pn_format_binary(char **pos, char *limit, pn_binary_t *binary);
-int pn_format_array(char **pos, char *limit, pn_array_t *array);
-int pn_format_list(char **pos, char *limit, pn_list_t *list);
-int pn_format_map(char **pos, char *limit, pn_map_t *map);
-int pn_format_tag(char **pos, char *limit, pn_tag_t *tag);
-int pn_format_value(char **pos, char *limit, pn_value_t *values, size_t n);
-int pn_format(char *buf, size_t size, pn_value_t v);
-char *pn_aformat(pn_value_t v);
-
-size_t pn_encode_sizeof(pn_value_t v);
-size_t pn_encode(pn_value_t v, char *out);
-ssize_t pn_decode(pn_value_t *v, char *bytes, size_t n);
-
-void pn_free_value(pn_value_t v);
-void pn_free_array(pn_array_t *a);
-void pn_free_list(pn_list_t *l);
-void pn_free_map(pn_map_t *m);
-void pn_free_tag(pn_tag_t *t);
-void pn_free_symbol(pn_symbol_t *s);
-void pn_free_binary(pn_binary_t *b);
-void pn_free_string(pn_string_t *s);
-
-void pn_visit(pn_value_t v, void (*visitor)(pn_value_t));
-void pn_visit_array(pn_array_t *v, void (*visitor)(pn_value_t));
-void pn_visit_list(pn_list_t *l, void (*visitor)(pn_value_t));
-void pn_visit_map(pn_map_t *m, void (*visitor)(pn_value_t));
-void pn_visit_tag(pn_tag_t *t, void (*visitor)(pn_value_t));
-
-/* scalars */
-#define pn_boolean(V) ((pn_value_t) {.type = BOOLEAN, .u.as_boolean = (V)})
-#define pn_uint(V) ((pn_value_t) {.type = UINT, .u.as_uint = (V)})
-#define pn_ulong(V) ((pn_value_t) {.type = ULONG, .u.as_ulong = (V)})
-#define pn_to_uint8(V) ((V).u.as_ubyte)
-#define pn_to_uint16(V) ((V).u.as_ushort)
-#define pn_to_uint32(V) ((V).u.as_uint)
-#define pn_to_int32(V) ((V).u.as_int)
-#define pn_to_bool(V) ((V).u.as_boolean)
-#define pn_to_string(V) ((V).u.as_string)
-#define pn_to_binary(V) ((V).u.as_binary)
-#define pn_to_symbol(V) ((V).u.as_symbol)
-
-/* symbol */
-pn_symbol_t *pn_symbol(const char *name);
-pn_symbol_t *pn_symboln(const char *name, size_t size);
-size_t pn_symbol_size(pn_symbol_t *s);
-const char *pn_symbol_name(pn_symbol_t *s);
-pn_symbol_t *pn_symbol_dup(pn_symbol_t *s);
-
-/* string */
-
-pn_string_t *pn_string(wchar_t *wcs);
-size_t pn_string_size(pn_string_t *str);
-wchar_t *pn_string_wcs(pn_string_t *str);
-
-/* binary */
-
-pn_binary_t *pn_binary(char *bytes, size_t size);
-size_t pn_binary_size(pn_binary_t *b);
-const char *pn_binary_bytes(pn_binary_t *b);
-pn_binary_t *pn_binary_dup(pn_binary_t *b);
-
-/* arrays */
-
-pn_array_t *pn_array(enum TYPE type, int capacity);
-pn_value_t pn_array_get(pn_array_t *a, int index);
-size_t pn_encode_sizeof_array(pn_array_t *a);
-size_t pn_encode_array(pn_array_t *array, char *out);
-
-/* lists */
-
-pn_list_t *pn_list(int capacity);
-pn_value_t pn_list_get(pn_list_t *l, int index);
-pn_value_t pn_list_set(pn_list_t *l, int index, pn_value_t v);
-int pn_list_add(pn_list_t *l, pn_value_t v);
-bool pn_list_remove(pn_list_t *l, pn_value_t v);
-pn_value_t pn_list_pop(pn_list_t *l, int index);
-int pn_list_extend(pn_list_t *l, const char *fmt, ...);
-int pn_list_fill(pn_list_t *l, pn_value_t v, int n);
-void pn_list_clear(pn_list_t *l);
-int pn_list_size(pn_list_t *l);
-size_t pn_encode_sizeof_list(pn_list_t *l);
-size_t pn_encode_list(pn_list_t *l, char *out);
-
-/* maps */
-
-pn_map_t *pn_map(int capacity);
-int pn_map_set(pn_map_t *map, pn_value_t key, pn_value_t value);
-pn_value_t pn_map_get(pn_map_t *map, pn_value_t key);
-pn_value_t pn_map_pop(pn_map_t *map, pn_value_t key);
-size_t pn_encode_sizeof_map(pn_map_t *map);
-size_t pn_encode_map(pn_map_t *m, char *out);
-
-/* tags */
-
-pn_tag_t *pn_tag(pn_value_t descriptor, pn_value_t value);
-pn_value_t pn_tag_descriptor(pn_tag_t *t);
-pn_value_t pn_tag_value(pn_tag_t *t);
-size_t pn_encode_sizeof_tag(pn_tag_t *t);
-size_t pn_encode_tag(pn_tag_t *t, char *out);
-
-/* random */
-
-int pn_fmt(char **pos, char *limit, const char *fmt, ...);
-
-#endif /* value.h */

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e57c2a52/proton-c/mllib/__init__.py
----------------------------------------------------------------------
diff --git a/proton-c/mllib/__init__.py b/proton-c/mllib/__init__.py
deleted file mode 100644
index 9aa1e56..0000000
--- a/proton-c/mllib/__init__.py
+++ /dev/null
@@ -1,85 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-"""
-This module provides document parsing and transformation utilities for
-both SGML and XML.
-"""
-
-import os, dom, transforms, parsers, sys
-import xml.sax, types
-from xml.sax.handler import ErrorHandler
-from xml.sax.xmlreader import InputSource
-from cStringIO import StringIO
-
-def transform(node, *args):
-  result = node
-  for t in args:
-    if isinstance(t, types.ClassType):
-      t = t()
-    result = result.dispatch(t)
-  return result
-
-def sgml_parse(source):
-  if isinstance(source, basestring):
-    source = StringIO(source)
-    fname = "<string>"
-  elif hasattr(source, "name"):
-    fname = source.name
-  p = parsers.SGMLParser()
-  num = 1
-  for line in source:
-    p.feed(line)
-    p.parser.line(fname, num, None)
-    num += 1
-  p.close()
-  return p.parser.tree
-
-class Resolver:
-
-  def __init__(self, path):
-    self.path = path
-
-  def resolveEntity(self, publicId, systemId):
-    for p in self.path:
-      fname = os.path.join(p, systemId)
-      if os.path.exists(fname):
-        source = InputSource(systemId)
-        source.setByteStream(open(fname))
-        return source
-    return InputSource(systemId)
-
-def xml_parse(filename, path=()):
-  if sys.version_info[0:2] == (2,3):
-    # XXX: this is for older versions of python
-    source = "file://%s" % os.path.abspath(filename)
-  else:
-    source = filename
-  h = parsers.XMLParser()
-  p = xml.sax.make_parser()
-  p.setContentHandler(h)
-  p.setErrorHandler(ErrorHandler())
-  p.setEntityResolver(Resolver(path))
-  p.parse(source)
-  return h.parser.tree
-
-def sexp(node):
-  s = transforms.Sexp()
-  node.dispatch(s)
-  return s.out

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e57c2a52/proton-c/mllib/dom.py
----------------------------------------------------------------------
diff --git a/proton-c/mllib/dom.py b/proton-c/mllib/dom.py
deleted file mode 100644
index 486f708..0000000
--- a/proton-c/mllib/dom.py
+++ /dev/null
@@ -1,310 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-"""
-Simple DOM for both SGML and XML documents.
-"""
-
-from __future__ import division
-from __future__ import generators
-from __future__ import nested_scopes
-
-import transforms
-
-class Container:
-
-  def __init__(self):
-    self.children = []
-
-  def add(self, child):
-    child.parent = self
-    self.children.append(child)
-
-  def extend(self, children):
-    for child in children:
-      child.parent = self
-      self.children.append(child)
-
-class Component:
-
-  def __init__(self):
-    self.parent = None
-
-  def index(self):
-    if self.parent:
-      return self.parent.children.index(self)
-    else:
-      return 0
-
-  def _line(self, file, line, column):
-    self.file = file
-    self.line = line
-    self.column = column
-
-class DispatchError(Exception):
-
-  def __init__(self, scope, f):
-    msg = "no such attribtue"
-
-class Dispatcher:
-
-  def is_type(self, type):
-    cls = self
-    while cls != None:
-      if cls.type == type:
-        return True
-      cls = cls.base
-    return False
-
-  def dispatch(self, f, attrs = ""):
-    cls = self
-    while cls != None:
-      if hasattr(f, cls.type):
-        return getattr(f, cls.type)(self)
-      else:
-        cls = cls.base
-
-    cls = self
-    while cls != None:
-      if attrs:
-        sep = ", "
-        if cls.base == None:
-          sep += "or "
-      else:
-        sep = ""
-      attrs += "%s'%s'" % (sep, cls.type)
-      cls = cls.base
-
-    raise AttributeError("'%s' object has no attribute %s" %
-                         (f.__class__.__name__, attrs))
-
-class Node(Container, Component, Dispatcher):
-
-  type = "node"
-  base = None
-
-  def __init__(self):
-    Container.__init__(self)
-    Component.__init__(self)
-    self.query = Query([self])
-
-  def __getitem__(self, name):
-    for nd in self.query[name]:
-      return nd
-
-  def text(self):
-    return self.dispatch(transforms.Text())
-
-  def tag(self, name, *attrs, **kwargs):
-    t = Tag(name, *attrs, **kwargs)
-    self.add(t)
-    return t
-
-  def data(self, s):
-    d = Data(s)
-    self.add(d)
-    return d
-
-  def entity(self, s):
-    e = Entity(s)
-    self.add(e)
-    return e
-
-class Tree(Node):
-
-  type = "tree"
-  base = Node
-
-class Tag(Node):
-
-  type = "tag"
-  base = Node
-
-  def __init__(self, _name, *attrs, **kwargs):
-    Node.__init__(self)
-    self.name = _name
-    self.attrs = list(attrs)
-    self.attrs.extend(kwargs.items())
-    self.singleton = False
-
-  def get_attr(self, name):
-    for k, v in self.attrs:
-      if name == k:
-        return v
-
-  def _idx(self, attr):
-    idx = 0
-    for k, v in self.attrs:
-      if k == attr:
-        return idx
-      idx += 1
-    return None
-
-  def set_attr(self, name, value):
-    idx = self._idx(name)
-    if idx is None:
-      self.attrs.append((name, value))
-    else:
-      self.attrs[idx] = (name, value)
-
-  def dispatch(self, f):
-    try:
-      attr = "do_" + self.name
-      method = getattr(f, attr)
-    except AttributeError:
-      return Dispatcher.dispatch(self, f, "'%s'" % attr)
-    return method(self)
-
-class Leaf(Component, Dispatcher):
-
-  type = "leaf"
-  base = None
-
-  def __init__(self, data):
-    assert isinstance(data, basestring)
-    self.data = data
-
-class Data(Leaf):
-  type = "data"
-  base = Leaf
-
-class Entity(Leaf):
-  type = "entity"
-  base = Leaf
-
-class Character(Leaf):
-  type = "character"
-  base = Leaf
-
-class Comment(Leaf):
-  type = "comment"
-  base = Leaf
-
-###################
-## Query Classes ##
-###########################################################################
-
-class Adder:
-
-  def __add__(self, other):
-    return Sum(self, other)
-
-class Sum(Adder):
-
-  def __init__(self, left, right):
-    self.left = left
-    self.right = right
-
-  def __iter__(self):
-    for x in self.left:
-      yield x
-    for x in self.right:
-      yield x
-
-class View(Adder):
-
-  def __init__(self, source):
-    self.source = source
-
-class Filter(View):
-
-  def __init__(self, predicate, source):
-    View.__init__(self, source)
-    self.predicate = predicate
-
-  def __iter__(self):
-    for nd in self.source:
-      if self.predicate(nd): yield nd
-
-class Flatten(View):
-
-  def __iter__(self):
-    sources = [iter(self.source)]
-    while sources:
-      try:
-        nd = sources[-1].next()
-        if isinstance(nd, Tree):
-          sources.append(iter(nd.children))
-        else:
-          yield nd
-      except StopIteration:
-        sources.pop()
-
-class Children(View):
-
-  def __iter__(self):
-    for nd in self.source:
-      for child in nd.children:
-        yield child
-
-class Attributes(View):
-
-  def __iter__(self):
-    for nd in self.source:
-      for a in nd.attrs:
-        yield a
-
-class Values(View):
-
-  def __iter__(self):
-    for name, value in self.source:
-      yield value
-
-def flatten_path(path):
-  if isinstance(path, basestring):
-    for part in path.split("/"):
-      yield part
-  elif callable(path):
-    yield path
-  else:
-    for p in path:
-      for fp in flatten_path(p):
-        yield fp
-
-class Query(View):
-
-  def __iter__(self):
-    for nd in self.source:
-      yield nd
-
-  def __getitem__(self, path):
-    query = self.source
-    for p in flatten_path(path):
-      if callable(p):
-        select = Query
-        pred = p
-        source = query
-      elif isinstance(p, basestring):
-        if p[0] == "@":
-          select = Values
-          pred = lambda x, n=p[1:]: x[0] == n
-          source = Attributes(query)
-        elif p[0] == "#":
-          select = Query
-          pred = lambda x, t=p[1:]: x.is_type(t)
-          source = Children(query)
-        else:
-          select = Query
-          pred = lambda x, n=p: isinstance(x, Tag) and x.name == n
-          source = Flatten(Children(query))
-      else:
-        raise ValueError(p)
-      query = select(Filter(pred, source))
-
-    return query

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e57c2a52/proton-c/mllib/parsers.py
----------------------------------------------------------------------
diff --git a/proton-c/mllib/parsers.py b/proton-c/mllib/parsers.py
deleted file mode 100644
index 3e7cc10..0000000
--- a/proton-c/mllib/parsers.py
+++ /dev/null
@@ -1,139 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-"""
-Parsers for SGML and XML to dom.
-"""
-
-import sgmllib, xml.sax.handler
-from dom import *
-
-class Parser:
-
-  def __init__(self):
-    self.tree = Tree()
-    self.node = self.tree
-    self.nodes = []
-
-  def line(self, id, lineno, colno):
-    while self.nodes:
-      n = self.nodes.pop()
-      n._line(id, lineno, colno)
-
-  def add(self, node):
-    self.node.add(node)
-    self.nodes.append(node)
-
-  def start(self, name, attrs):
-    tag = Tag(name, *attrs)
-    self.add(tag)
-    self.node = tag
-
-  def end(self, name):
-    self.balance(name)
-    self.node = self.node.parent
-
-  def data(self, data):
-    children = self.node.children
-    if children and isinstance(children[-1], Data):
-      children[-1].data += data
-    else:
-      self.add(Data(data))
-
-  def comment(self, comment):
-    self.add(Comment(comment))
-
-  def entity(self, ref):
-    self.add(Entity(ref))
-
-  def character(self, ref):
-    self.add(Character(ref))
-
-  def balance(self, name = None):
-    while self.node != self.tree and name != self.node.name:
-      self.node.parent.extend(self.node.children)
-      del self.node.children[:]
-      self.node.singleton = True
-      self.node = self.node.parent
-
-
-class SGMLParser(sgmllib.SGMLParser):
-
-  def __init__(self, entitydefs = None):
-    sgmllib.SGMLParser.__init__(self)
-    if entitydefs == None:
-      self.entitydefs = {}
-    else:
-      self.entitydefs = entitydefs
-    self.parser = Parser()
-
-  def unknown_starttag(self, name, attrs):
-    self.parser.start(name, attrs)
-
-  def handle_data(self, data):
-    self.parser.data(data)
-
-  def handle_comment(self, comment):
-    self.parser.comment(comment)
-
-  def unknown_entityref(self, ref):
-    self.parser.entity(ref)
-
-  def unknown_charref(self, ref):
-    self.parser.character(ref)
-
-  def unknown_endtag(self, name):
-    self.parser.end(name)
-
-  def close(self):
-    sgmllib.SGMLParser.close(self)
-    self.parser.balance()
-    assert self.parser.node == self.parser.tree
-
-class XMLParser(xml.sax.handler.ContentHandler):
-
-  def __init__(self):
-    self.parser = Parser()
-    self.locator = None
-
-  def line(self):
-    if self.locator != None:
-      self.parser.line(self.locator.getSystemId(),
-                       self.locator.getLineNumber(),
-                       self.locator.getColumnNumber())
-
-  def setDocumentLocator(self, locator):
-    self.locator = locator
-
-  def startElement(self, name, attrs):
-    self.parser.start(name, attrs.items())
-    self.line()
-
-  def endElement(self, name):
-    self.parser.end(name)
-    self.line()
-
-  def characters(self, content):
-    self.parser.data(content)
-    self.line()
-
-  def skippedEntity(self, name):
-    self.parser.entity(name)
-    self.line()
-

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e57c2a52/proton-c/mllib/transforms.py
----------------------------------------------------------------------
diff --git a/proton-c/mllib/transforms.py b/proton-c/mllib/transforms.py
deleted file mode 100644
index 69d9912..0000000
--- a/proton-c/mllib/transforms.py
+++ /dev/null
@@ -1,164 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-"""
-Useful transforms for dom objects.
-"""
-
-import dom
-from cStringIO import StringIO
-
-class Visitor:
-
-  def descend(self, node):
-    for child in node.children:
-      child.dispatch(self)
-
-  def node(self, node):
-    self.descend(node)
-
-  def leaf(self, leaf):
-    pass
-
-class Identity:
-
-  def descend(self, node):
-    result = []
-    for child in node.children:
-      result.append(child.dispatch(self))
-    return result
-
-  def default(self, tag):
-    result = dom.Tag(tag.name, *tag.attrs)
-    result.extend(self.descend(tag))
-    return result
-
-  def tree(self, tree):
-    result = dom.Tree()
-    result.extend(self.descend(tree))
-    return result
-
-  def tag(self, tag):
-    return self.default(tag)
-
-  def leaf(self, leaf):
-    return leaf.__class__(leaf.data)
-
-class Sexp(Identity):
-
-  def __init__(self):
-    self.stack = []
-    self.level = 0
-    self.out = ""
-
-  def open(self, s):
-    self.out += "(%s" % s
-    self.level += len(s) + 1
-    self.stack.append(s)
-
-  def line(self, s = ""):
-    self.out = self.out.rstrip()
-    self.out += "\n" + " "*self.level + s
-
-  def close(self):
-    s = self.stack.pop()
-    self.level -= len(s) + 1
-    self.out = self.out.rstrip()
-    self.out += ")"
-
-  def tree(self, tree):
-    self.open("+ ")
-    for child in tree.children:
-      self.line(); child.dispatch(self)
-    self.close()
-
-  def tag(self, tag):
-    self.open("Node(%s) " % tag.name)
-    for child in tag.children:
-      self.line(); child.dispatch(self)
-    self.close()
-
-  def leaf(self, leaf):
-    self.line("%s(%s)" % (leaf.__class__.__name__, leaf.data))
-
-class Output:
-
-  def descend(self, node):
-    out = StringIO()
-    for child in node.children:
-      out.write(child.dispatch(self))
-    return out.getvalue()
-
-  def default(self, tag):
-    out = StringIO()
-    out.write("<%s" % tag.name)
-    for k, v in tag.attrs:
-      out.write(' %s="%s"' % (k, v))
-    out.write(">")
-    out.write(self.descend(tag))
-    if not tag.singleton:
-      out.write("</%s>" % tag.name)
-    return out.getvalue()
-
-  def tree(self, tree):
-    return self.descend(tree)
-
-  def tag(self, tag):
-    return self.default(tag)
-
-  def data(self, leaf):
-    return leaf.data
-
-  def entity(self, leaf):
-    return "&%s;" % leaf.data
-
-  def character(self, leaf):
-    raise Exception("TODO")
-
-  def comment(self, leaf):
-    return "<!-- %s -->" % leaf.data
-
-class Empty(Output):
-
-  def tag(self, tag):
-    return self.descend(tag)
-
-  def data(self, leaf):
-    return ""
-
-  def entity(self, leaf):
-    return ""
-
-  def character(self, leaf):
-    return ""
-
-  def comment(self, leaf):
-    return ""
-
-class Text(Empty):
-
-  def data(self, leaf):
-    return leaf.data
-
-  def entity(self, leaf):
-    return "&%s;" % leaf.data
-
-  def character(self, leaf):
-    # XXX: is this right?
-    return "&#%s;" % leaf.data

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e57c2a52/proton-c/musings.txt
----------------------------------------------------------------------
diff --git a/proton-c/musings.txt b/proton-c/musings.txt
deleted file mode 100644
index 909960a..0000000
--- a/proton-c/musings.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-
-  - interfaces more connection/transfer oriented with links + sessions
-    as views on the total ordering of messages on the connection
-    + circular buffer of transfers with pointers to the next session and link 
transfers?
-  - who allocates transfers?
-    + probably engine can manage the transfers themselves
-  - who allocates message data?
-    + if engine then this forces another copy
-    + if user then we need to be able to pass back an empty transfer
-      and have the bytes pointer be supplied by the user
-  - expanded or additional low level interface that would cover
-    creation of multiple network connections, and/por accepting of
-    incoming connections
-  - change sessions and links to be fully contained by connections
-    without independent lifecycle

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e57c2a52/proton-c/src/codec/codec.c
----------------------------------------------------------------------
diff --git a/proton-c/src/codec/codec.c b/proton-c/src/codec/codec.c
deleted file mode 100644
index 6132792..0000000
--- a/proton-c/src/codec/codec.c
+++ /dev/null
@@ -1,529 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#define _GNU_SOURCE
-
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <inttypes.h>
-#include <arpa/inet.h>
-#include <proton/codec.h>
-#include "encodings.h"
-
-typedef union {
-  uint32_t i;
-  uint32_t a[2];
-  uint64_t l;
-  float f;
-  double d;
-} conv_t;
-
-static int pn_write_code(char **pos, char *limit, uint8_t code) {
-  char *dst = *pos;
-  if (limit - dst < 1) {
-    return -1;
-  } else {
-    dst[0] = code;
-    *pos += 1;
-    return 0;
-  }
-}
-int pn_write_descriptor(char **pos, char *limit) {
-  return pn_write_code(pos, limit, PNE_DESCRIPTOR);
-}
-int pn_write_null(char **pos, char *limit) {
-  return pn_write_code(pos, limit, PNE_NULL);
-}
-
-static int pn_write_fixed8(char **pos, char *limit, uint8_t v, uint8_t code) {
-  char *dst = *pos;
-  if (limit - dst < 2) {
-    return -1;
-  } else {
-    dst[0] = code;
-    dst[1] = v;
-    *pos += 2;
-    return 0;
-  }
-}
-
-int pn_write_boolean(char **pos, char *limit, bool v) {
-  return pn_write_fixed8(pos, limit, v, PNE_BOOLEAN);
-}
-int pn_write_ubyte(char **pos, char *limit, uint8_t v) {
-  return pn_write_fixed8(pos, limit, v, PNE_UBYTE);
-}
-int pn_write_byte(char **pos, char *limit, int8_t v) {
-  return pn_write_fixed8(pos, limit, v, PNE_BYTE);
-}
-
-static int pn_write_fixed16(char **pos, char *limit, uint16_t v,
-                            uint8_t code) {
-  char *dst = *pos;
-  if (limit - dst < 3) {
-    return -1;
-  } else {
-    dst[0] = code;
-    *((uint16_t *) (dst + 1)) = htons(v);
-    *pos += 3;
-    return 0;
-  }
-}
-int pn_write_ushort(char **pos, char *limit, uint16_t v) {
-  return pn_write_fixed16(pos, limit, v, PNE_USHORT);
-}
-int pn_write_short(char **pos, char *limit, int16_t v) {
-  return pn_write_fixed16(pos, limit, v, PNE_SHORT);
-}
-
-static int pn_write_fixed32(char **pos, char *limit, uint32_t v, uint8_t code) 
{
-  char *dst = *pos;
-  if (limit - dst < 5) {
-    return -1;
-  } else {
-    dst[0] = code;
-    *((uint32_t *) (dst + 1)) = htonl(v);
-    *pos += 5;
-    return 0;
-  }
-}
-int pn_write_uint(char **pos, char *limit, uint32_t v) {
-  return pn_write_fixed32(pos, limit, v, PNE_UINT);
-}
-int pn_write_int(char **pos, char *limit, int32_t v) {
-  return pn_write_fixed32(pos, limit, v, PNE_INT);
-}
-int pn_write_char(char **pos, char *limit, wchar_t v) {
-  return pn_write_fixed32(pos, limit, v, PNE_UTF32);
-}
-int pn_write_float(char **pos, char *limit, float v) {
-  conv_t c;
-  c.f = v;
-  return pn_write_fixed32(pos, limit, c.i, PNE_FLOAT);
-}
-
-static int pn_write_fixed64(char **pos, char *limit, uint64_t v, uint8_t code) 
{
-  char *dst = *pos;
-  if (limit - dst < 9) {
-    return -1;
-  } else {
-    dst[0] = code;
-    uint32_t hi = v >> 32;
-    uint32_t lo = v;
-    *((uint32_t *) (dst + 1)) = htonl(hi);
-    *((uint32_t *) (dst + 5)) = htonl(lo);
-    *pos += 9;
-    return 0;
-  }
-}
-int pn_write_ulong(char **pos, char *limit, uint64_t v) {
-  return pn_write_fixed64(pos, limit, v, PNE_ULONG);
-}
-int pn_write_long(char **pos, char *limit, int64_t v) {
-  return pn_write_fixed64(pos, limit, v, PNE_LONG);
-}
-int pn_write_double(char **pos, char *limit, double v) {
-  conv_t c;
-  c.d = v;
-  return pn_write_fixed64(pos, limit, c.l, PNE_DOUBLE);
-}
-
-#define CONSISTENT (1)
-
-static int pn_write_variable(char **pos, char *limit, size_t size, char *src,
-                             uint8_t code8, uint8_t code32) {
-  int n;
-
-  if (!CONSISTENT && size < 256) {
-    if ((n = pn_write_fixed8(pos, limit, size, code8)))
-      return n;
-  } else {
-    if ((n = pn_write_fixed32(pos, limit, size, code32)))
-      return n;
-  }
-
-  if (limit - *pos < size) return -1;
-
-  memmove(*pos, src, size);
-  *pos += size;
-  return 0;
-}
-int pn_write_binary(char **pos, char *limit, size_t size, char *src) {
-  return pn_write_variable(pos, limit, size, src, PNE_VBIN8, PNE_VBIN32);
-}
-int pn_write_utf8(char **pos, char *limit, size_t size, char *utf8) {
-  return pn_write_variable(pos, limit, size, utf8, PNE_STR8_UTF8, 
PNE_STR32_UTF8);
-}
-int pn_write_symbol(char **pos, char *limit, size_t size, const char *symbol) {
-  return pn_write_variable(pos, limit, size, (char *) symbol, PNE_SYM8, 
PNE_SYM32);
-}
-
-int pn_write_start(char **pos, char *limit, char **start) {
-  char *dst = *pos;
-  if (limit - dst < 9) {
-    return -1;
-  } else {
-    *start = dst;
-    *pos += 9;
-    return 0;
-  }
-}
-
-static int pn_write_end(char **pos, char *limit, char *start, size_t count, 
uint8_t code) {
-  int n;
-  if ((n = pn_write_fixed32(&start, limit, *pos - start - 5, code)))
-    return n;
-  *((uint32_t *) start) = htonl(count);
-  return 0;
-}
-
-int pn_write_list(char **pos, char *limit, char *start, size_t count) {
-  return pn_write_end(pos, limit, start, count, PNE_LIST32);
-}
-
-int pn_write_map(char **pos, char *limit, char *start, size_t count) {
-  return pn_write_end(pos, limit, start, 2*count, PNE_MAP32);
-}
-
-ssize_t pn_read_datum(char *bytes, size_t n, pn_data_callbacks_t *cb, void 
*ctx);
-
-ssize_t pn_read_type(char *bytes, size_t n, pn_data_callbacks_t *cb, void 
*ctx, uint8_t *code)
-{
-  if (bytes[0] != PNE_DESCRIPTOR) {
-    *code = bytes[0];
-    return 1;
-  } else {
-    ssize_t offset = 1;
-    ssize_t rcode;
-    cb->start_descriptor(ctx);
-    rcode = pn_read_datum(bytes + offset, n - offset, cb, ctx);
-    cb->stop_descriptor(ctx);
-    if (rcode < 0) return rcode;
-    offset += rcode;
-    rcode = pn_read_type(bytes + offset, n - offset, cb, ctx, code);
-    if (rcode < 0) return rcode;
-    offset += rcode;
-    return offset;
-  }
-}
-
-ssize_t pn_read_encoding(char *bytes, size_t n, pn_data_callbacks_t *cb, void 
*ctx, uint8_t code)
-{
-  size_t size;
-  size_t count;
-  conv_t conv;
-  ssize_t rcode;
-  int offset = 0;
-
-  switch (code)
-  {
-  case PNE_DESCRIPTOR:
-    return -8;
-  case PNE_NULL:
-    cb->on_null(ctx);
-    return offset;
-  case PNE_TRUE:
-    cb->on_bool(ctx, true);
-    return offset;
-  case PNE_FALSE:
-    cb->on_bool(ctx, false);
-    return offset;
-  case PNE_BOOLEAN:
-    cb->on_bool(ctx, *(bytes + offset) != 0);
-    offset += 1;
-    return offset;
-  case PNE_UBYTE:
-    cb->on_ubyte(ctx, *((uint8_t *) (bytes + offset)));
-    offset += 1;
-    return offset;
-  case PNE_BYTE:
-    cb->on_byte(ctx, *((int8_t *) (bytes + offset)));
-    offset += 1;
-    return offset;
-  case PNE_USHORT:
-    cb->on_ushort(ctx, ntohs(*((uint16_t *) (bytes + offset))));
-    offset += 2;
-    return offset;
-  case PNE_SHORT:
-    cb->on_short(ctx, (int16_t) ntohs(*((int16_t *) (bytes + offset))));
-    offset += 2;
-    return offset;
-  case PNE_UINT:
-    cb->on_uint(ctx, ntohl(*((uint32_t *) (bytes + offset))));
-    offset += 4;
-    return offset;
-  case PNE_UINT0:
-    cb->on_uint(ctx, 0);
-    return offset;
-  case PNE_SMALLUINT:
-    cb->on_uint(ctx, *((uint8_t *) (bytes + offset)));
-    offset += 1;
-    return offset;
-  case PNE_INT:
-    cb->on_int(ctx, ntohl(*((uint32_t *) (bytes + offset))));
-    offset += 4;
-    return offset;
-  case PNE_FLOAT:
-    // XXX: this assumes the platform uses IEEE floats
-    conv.i = ntohl(*((uint32_t *) (bytes + offset)));
-    cb->on_float(ctx, conv.f);
-    offset += 4;
-    return offset;
-  case PNE_ULONG:
-  case PNE_LONG:
-  case PNE_DOUBLE:
-    {
-      uint32_t hi = ntohl(*((uint32_t *) (bytes + offset)));
-      offset += 4;
-      uint32_t lo = ntohl(*((uint32_t *) (bytes + offset)));
-      offset += 4;
-      conv.l = (((uint64_t) hi) << 32) | lo;
-    }
-
-    switch (code)
-    {
-    case PNE_ULONG:
-      cb->on_ulong(ctx, conv.l);
-      break;
-    case PNE_LONG:
-      cb->on_long(ctx, (int64_t) conv.l);
-      break;
-    case PNE_DOUBLE:
-      // XXX: this assumes the platform uses IEEE floats
-      cb->on_double(ctx, conv.d);
-      break;
-    default:
-      return -1;
-    }
-
-    return offset;
-  case PNE_ULONG0:
-    cb->on_ulong(ctx, 0);
-    return offset;
-  case PNE_SMALLULONG:
-    cb->on_ulong(ctx, *((uint8_t *) (bytes + offset)));
-    offset += 1;
-    return offset;
-  case PNE_VBIN8:
-  case PNE_STR8_UTF8:
-  case PNE_SYM8:
-  case PNE_VBIN32:
-  case PNE_STR32_UTF8:
-  case PNE_SYM32:
-    switch (code & 0xF0)
-    {
-    case 0xA0:
-      size = *(uint8_t *) (bytes + offset);
-      offset += 1;
-      break;
-    case 0xB0:
-      size = ntohl(*(uint32_t *) (bytes + offset));
-      offset += 4;
-      break;
-    default:
-      return -2;
-    }
-
-    {
-      char *start = (char *) (bytes + offset);
-      switch (code & 0x0F)
-      {
-      case 0x0:
-        cb->on_binary(ctx, size, start);
-        break;
-      case 0x1:
-        cb->on_utf8(ctx, size, start);
-        break;
-      case 0x3:
-        cb->on_symbol(ctx, size, start);
-        break;
-      default:
-        return -3;
-      }
-    }
-
-    offset += size;
-    return offset;
-  case PNE_LIST0:
-    count = 0;
-    cb->start_list(ctx, count);
-    cb->stop_list(ctx, count);
-    return offset;
-  case PNE_ARRAY8:
-  case PNE_ARRAY32:
-  case PNE_LIST8:
-  case PNE_LIST32:
-  case PNE_MAP8:
-  case PNE_MAP32:
-    switch (code)
-    {
-    case PNE_ARRAY8:
-    case PNE_LIST8:
-    case PNE_MAP8:
-      size = *(uint8_t *) (bytes + offset);
-      offset += 1;
-      count = *(uint8_t *) (bytes + offset);
-      offset += 1;
-      break;
-    case PNE_ARRAY32:
-    case PNE_LIST32:
-    case PNE_MAP32:
-      size = ntohl(*(uint32_t *) (bytes + offset));
-      offset += 4;
-      count = ntohl(*(uint32_t *) (bytes + offset));
-      offset += 4;
-      break;
-    default:
-      return -4;
-    }
-
-    switch (code)
-    {
-    case PNE_ARRAY8:
-    case PNE_ARRAY32:
-      {
-        uint8_t acode;
-        rcode = pn_read_type(bytes + offset, n - offset, cb, ctx, &acode);
-        cb->start_array(ctx, count, acode);
-        if (rcode < 0) return rcode;
-        offset += rcode;
-        for (int i = 0; i < count; i++)
-        {
-          rcode = pn_read_encoding(bytes + offset, n - offset, cb, ctx, acode);
-          if (rcode < 0) return rcode;
-          offset += rcode;
-        }
-        cb->stop_array(ctx, count, acode);
-      }
-      return offset;
-    case PNE_LIST8:
-    case PNE_LIST32:
-      cb->start_list(ctx, count);
-      break;
-    case PNE_MAP8:
-    case PNE_MAP32:
-      cb->start_map(ctx, count);
-      break;
-    default:
-      return -5;
-    }
-
-    for (int i = 0; i < count; i++)
-    {
-      rcode = pn_read_datum(bytes + offset, n - offset, cb, ctx);
-      if (rcode < 0) return rcode;
-      offset += rcode;
-    }
-
-    switch (code)
-    {
-    case PNE_LIST8:
-    case PNE_LIST32:
-      cb->stop_list(ctx, count);
-      break;
-    case PNE_MAP8:
-    case PNE_MAP32:
-      cb->stop_map(ctx, count);
-      break;
-    default:
-      return -6;
-    }
-
-    return offset;
-  default:
-    printf("Unrecognised typecode: %u\n", code);
-    return -7;
-  }
-}
-
-ssize_t pn_read_datum(char *bytes, size_t n, pn_data_callbacks_t *cb, void 
*ctx)
-{
-  uint8_t code;
-  ssize_t rcode;
-  size_t offset = 0;
-
-  rcode = pn_read_type(bytes + offset, n - offset, cb, ctx, &code);
-  if (rcode < 0) return rcode;
-  offset += rcode;
-  rcode = pn_read_encoding(bytes + offset, n - offset, cb, ctx, code);
-  if (rcode < 0) return rcode;
-  offset += rcode;
-  return offset;
-}
-
-void noop_null(void *ctx) {}
-void noop_bool(void *ctx, bool v) {}
-void noop_ubyte(void *ctx, uint8_t v) {}
-void noop_byte(void *ctx, int8_t v) {}
-void noop_ushort(void *ctx, uint16_t v) {}
-void noop_short(void *ctx, int16_t v) {}
-void noop_uint(void *ctx, uint32_t v) {}
-void noop_int(void *ctx, int32_t v) {}
-void noop_float(void *ctx, float f) {}
-void noop_ulong(void *ctx, uint64_t v) {}
-void noop_long(void *ctx, int64_t v) {}
-void noop_double(void *ctx, double v) {}
-void noop_binary(void *ctx, size_t size, char *bytes) {}
-void noop_utf8(void *ctx, size_t size, char *bytes) {}
-void noop_symbol(void *ctx, size_t size, char *bytes) {}
-void noop_start_array(void *ctx, size_t count, uint8_t code) {}
-void noop_stop_array(void *ctx, size_t count, uint8_t code) {}
-void noop_start_list(void *ctx, size_t count) {}
-void noop_stop_list(void *ctx, size_t count) {}
-void noop_start_map(void *ctx, size_t count) {}
-void noop_stop_map(void *ctx, size_t count) {}
-void noop_start_descriptor(void *ctx) {}
-void noop_stop_descriptor(void *ctx) {}
-
-pn_data_callbacks_t *noop = &PN_DATA_CALLBACKS(noop);
-
-void print_null(void *ctx) { printf("null\n"); }
-void print_bool(void *ctx, bool v) { if (v) printf("true\n"); else 
printf("false\n"); }
-void print_ubyte(void *ctx, uint8_t v) { printf("%hhu\n", v); }
-void print_byte(void *ctx, int8_t v) { printf("%hhi\n", v); }
-void print_ushort(void *ctx, uint16_t v) { printf("%hu\n", v); }
-void print_short(void *ctx, int16_t v) { printf("%hi\n", v); }
-void print_uint(void *ctx, uint32_t v) { printf("%u\n", v); }
-void print_int(void *ctx, int32_t v) { printf("%i\n", v); }
-void print_float(void *ctx, float v) { printf("%f\n", v); }
-void print_ulong(void *ctx, uint64_t v) { printf("%"PRIu64"\n", v); }
-void print_long(void *ctx, int64_t v) { printf("%"PRIi64"\n", v); }
-void print_double(void *ctx, double v) { printf("%f\n", v); }
-
-void print_bytes(char *label, int size, char *bytes) {
-  printf("%s(%.*s)\n", label, size, bytes);
-}
-
-void print_binary(void *ctx, size_t size, char *bytes) { print_bytes("bin", 
size, bytes); }
-void print_utf8(void *ctx, size_t size, char *bytes) { print_bytes("utf8", 
size, bytes); }
-void print_symbol(void *ctx, size_t size, char *bytes) { print_bytes("sym", 
size, bytes); }
-void print_start_array(void *ctx, size_t count, uint8_t code) { printf("start 
array %zd\n", count); }
-void print_stop_array(void *ctx, size_t count, uint8_t code) { printf("stop 
array %zd\n", count); }
-void print_start_list(void *ctx, size_t count) { printf("start list %zd\n", 
count); }
-void print_stop_list(void *ctx, size_t count) { printf("stop list %zd\n", 
count); }
-void print_start_map(void *ctx, size_t count) { printf("start map %zd\n", 
count); }
-void print_stop_map(void *ctx, size_t count) { printf("stop map %zd\n", 
count); }
-void print_start_descriptor(void *ctx) { printf("start descriptor "); }
-void print_stop_descriptor(void *ctx) { printf("stop descriptor "); }
-
-pn_data_callbacks_t *printer = &PN_DATA_CALLBACKS(print);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e57c2a52/proton-c/src/codec/encodings.h.py
----------------------------------------------------------------------
diff --git a/proton-c/src/codec/encodings.h.py 
b/proton-c/src/codec/encodings.h.py
deleted file mode 100755
index 71fb9ea..0000000
--- a/proton-c/src/codec/encodings.h.py
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/python
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-import mllib, optparse, os, sys
-
-xml = os.path.join(os.path.dirname(__file__), "types.xml")
-doc = mllib.xml_parse(xml)
-
-print "/* generated from %s */" % xml
-print "#ifndef _PROTON_ENCODINGS_H"
-print "#define _PROTON_ENCODINGS_H 1"
-print
-print "#define PNE_DESCRIPTOR          (0x00)"
-
-for enc in doc.query["amqp/section/type/encoding"]:
-  name = enc["@name"] or enc.parent["@name"]
-  # XXX: a bit hacky
-  if name == "ieee-754":
-    name = enc.parent["@name"]
-  cname = "PNE_" + name.replace("-", "_").upper()
-  print "#define %s%s(%s)" % (cname, " "*(20-len(cname)), enc["@code"])
-
-print
-print "#endif /* encodings.h */"

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e57c2a52/proton-c/src/codec/types.xml
----------------------------------------------------------------------
diff --git a/proton-c/src/codec/types.xml b/proton-c/src/codec/types.xml
deleted file mode 100644
index 4aa9c0f..0000000
--- a/proton-c/src/codec/types.xml
+++ /dev/null
@@ -1,125 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
-Copyright Bank of America, N.A., Barclays Bank PLC, Cisco Systems, Credit
-Suisse, Deutsche Boerse, Envoy Technologies Inc., Goldman Sachs, HCL
-Technologies Ltd, IIT Software GmbH, iMatix Corporation, INETCO Systems 
Limited,
-Informatica Corporation, JPMorgan Chase & Co., Kaazing Corporation, N.A,
-Microsoft Corporation, my-Channels, Novell, Progress Software, Red Hat Inc.,
-Software AG, Solace Systems Inc., StormMQ Ltd., Tervela Inc., TWIST Process
-Innovations Ltd, VMware, Inc., and WS02 Inc. 2006-2011. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-2. 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.
-3. The name of the author may not be used to endorse or promote products
-derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
--->
-
-<amqp name="types" xmlns="http://www.amqp.org/schema/amqp.xsd";>
-  <section name="encodings">
-    <type name="null" class="primitive">
-      <encoding code="0x40" category="fixed" width="0"/>
-    </type>
-    <type name="boolean" class="primitive">
-      <encoding code="0x56" category="fixed" width="1"/>
-      <encoding name="true" code="0x41" category="fixed" width="0"/>
-      <encoding name="false" code="0x42" category="fixed" width="0"/>
-    </type>
-    <type name="ubyte" class="primitive">
-      <encoding code="0x50" category="fixed" width="1"/>
-    </type>
-    <type name="ushort" class="primitive">
-      <encoding code="0x60" category="fixed" width="2"/>
-    </type>
-    <type name="uint" class="primitive">
-      <encoding code="0x70" category="fixed" width="4"/>
-      <encoding name="smalluint" code="0x52" category="fixed" width="1"/>
-      <encoding name="uint0" code="0x43" category="fixed" width="0"/>
-    </type>
-    <type name="ulong" class="primitive">
-      <encoding code="0x80" category="fixed" width="8"/>
-      <encoding name="smallulong" code="0x53" category="fixed" width="1"/>
-      <encoding name="ulong0" code="0x44" category="fixed" width="0"/>
-    </type>
-    <type name="byte" class="primitive">
-      <encoding code="0x51" category="fixed" width="1"/>
-    </type>
-    <type name="short" class="primitive">
-      <encoding code="0x61" category="fixed" width="2"/>
-    </type>
-    <type name="int" class="primitive">
-      <encoding code="0x71" category="fixed" width="4"/>
-      <encoding name="smallint" code="0x54" category="fixed" width="1"/>
-    </type>
-    <type name="long" class="primitive">
-      <encoding code="0x81" category="fixed" width="8"/>
-      <encoding name="smalllong" code="0x55" category="fixed" width="1"/>
-    </type>
-    <type name="float" class="primitive">
-      <encoding name="ieee-754" code="0x72" category="fixed" width="4"/>
-    </type>
-    <type name="double" class="primitive">
-      <encoding name="ieee-754" code="0x82" category="fixed" width="8"/>
-    </type>
-    <type name="decimal32" class="primitive">
-      <encoding name="ieee-754" code="0x74" category="fixed" width="4"/>
-    </type>
-    <type name="decimal64" class="primitive">
-      <encoding name="ieee-754" code="0x84" category="fixed" width="8"/>
-    </type>
-    <type name="decimal128" class="primitive">
-      <encoding name="ieee-754" code="0x94" category="fixed" width="16"/>
-    </type>
-    <type name="char" class="primitive">
-      <encoding name="utf32" code="0x73" category="fixed" width="4"/>
-    </type>
-    <type name="timestamp" class="primitive">
-      <encoding name="ms64" code="0x83" category="fixed" width="8"/>
-    </type>
-    <type name="uuid" class="primitive">
-      <encoding code="0x98" category="fixed" width="16"/>
-    </type>
-    <type name="binary" class="primitive">
-      <encoding name="vbin8" code="0xa0" category="variable" width="1"/>
-      <encoding name="vbin32" code="0xb0" category="variable" width="4"/>
-    </type>
-    <type name="string" class="primitive">
-      <encoding name="str8-utf8" code="0xa1" category="variable" width="1"/>
-      <encoding name="str32-utf8" code="0xb1" category="variable" width="4"/>
-    </type>
-    <type name="symbol" class="primitive">
-      <encoding name="sym8" code="0xa3" category="variable" width="1"/>
-      <encoding name="sym32" code="0xb3" category="variable" width="4"/>
-    </type>
-    <type name="list" class="primitive">
-      <encoding name="list0" code="0x45" category="fixed" width="0"/>
-      <encoding name="list8" code="0xc0" category="compound" width="1"/>
-      <encoding name="list32" code="0xd0" category="compound" width="4"/>
-    </type>
-    <type name="map" class="primitive">
-      <encoding name="map8" code="0xc1" category="compound" width="1"/>
-      <encoding name="map32" code="0xd1" category="compound" width="4"/>
-    </type>
-    <type name="array" class="primitive">
-      <encoding name="array8" code="0xe0" category="array" width="1"/>
-      <encoding name="array32" code="0xf0" category="array" width="4"/>
-    </type>
-  </section>
-</amqp>

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e57c2a52/proton-c/src/dispatcher/dispatcher.c
----------------------------------------------------------------------
diff --git a/proton-c/src/dispatcher/dispatcher.c 
b/proton-c/src/dispatcher/dispatcher.c
deleted file mode 100644
index aa1a09a..0000000
--- a/proton-c/src/dispatcher/dispatcher.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <proton/framing.h>
-#include <proton/engine.h>
-#include "dispatcher.h"
-#include "../util.h"
-
-pn_dispatcher_t *pn_dispatcher(uint8_t frame_type, void *context)
-{
-  pn_dispatcher_t *disp = calloc(sizeof(pn_dispatcher_t), 1);
-
-  disp->frame_type = frame_type;
-  disp->context = context;
-  disp->trace = PN_TRACE_OFF;
-
-  disp->channel = 0;
-  disp->code = 0;
-  disp->args = NULL;
-  disp->payload = NULL;
-  disp->size = 0;
-
-  disp->output_args = pn_list(16);
-  // XXX
-  disp->capacity = 4*1024;
-  disp->output = malloc(disp->capacity);
-  disp->available = 0;
-
-  return disp;
-}
-
-void pn_dispatcher_destroy(pn_dispatcher_t *disp)
-{
-  pn_free_list(disp->output_args);
-  free(disp->output);
-  free(disp);
-}
-
-void pn_dispatcher_action(pn_dispatcher_t *disp, uint8_t code, const char 
*name,
-                          pn_action_t *action)
-{
-  disp->actions[code] = action;
-  disp->names[code] = name;
-}
-
-typedef enum {IN, OUT} pn_dir_t;
-
-static void pn_do_trace(pn_dispatcher_t *disp, uint16_t ch, pn_dir_t dir,
-                        uint8_t code, pn_list_t *args, const char *payload,
-                        size_t size)
-{
-  if (disp->trace & PN_TRACE_FRM) {
-    pn_format(disp->scratch, SCRATCH, pn_from_list(args));
-    fprintf(stderr, "[%u] %s %s %s", ch, dir == OUT ? "->" : "<-",
-            disp->names[code], disp->scratch);
-    if (size) {
-      size_t capacity = 4*size + 1;
-      char buf[capacity];
-      pn_quote_data(buf, capacity, payload, size);
-      fprintf(stderr, " (%zu) \"%s\"\n", size, buf);
-    } else {
-      fprintf(stderr, "\n");
-    }
-  }
-}
-
-ssize_t pn_dispatcher_input(pn_dispatcher_t *disp, char *bytes, size_t 
available)
-{
-  size_t read = 0;
-  while (true) {
-    pn_frame_t frame;
-    size_t n = pn_read_frame(&frame, bytes + read, available);
-    if (n) {
-      pn_value_t performative;
-      ssize_t e = pn_decode(&performative, frame.payload, frame.size);
-      if (e < 0) {
-        fprintf(stderr, "Error decoding frame: %zi\n", e);
-        pn_format(disp->scratch, SCRATCH, pn_value("z", frame.size, 
frame.payload));
-        fprintf(stderr, "%s\n", disp->scratch);
-        return e;
-      }
-
-      disp->channel = frame.channel;
-      // XXX: assuming numeric
-      uint8_t code = pn_to_uint8(pn_tag_descriptor(pn_to_tag(performative)));
-      disp->code = code;
-      disp->args = pn_to_list(pn_tag_value(pn_to_tag(performative)));
-      disp->size = frame.size - e;
-      if (disp->size)
-        disp->payload = frame.payload + e;
-
-      pn_do_trace(disp, disp->channel, IN, code, disp->args, disp->payload, 
disp->size);
-
-      pn_action_t *action = disp->actions[code];
-      action(disp);
-
-      disp->channel = 0;
-      disp->code = 0;
-      disp->args = NULL;
-      disp->size = 0;
-      disp->payload = NULL;
-      pn_visit(performative, pn_free_value);
-
-      available -= n;
-      read += n;
-    } else {
-      break;
-    }
-  }
-
-  return read;
-}
-
-void pn_init_frame(pn_dispatcher_t *disp)
-{
-  pn_list_clear(disp->output_args);
-  disp->output_payload = NULL;
-  disp->output_size = 0;
-}
-
-void pn_field(pn_dispatcher_t *disp, int index, pn_value_t arg)
-{
-  int n = pn_list_size(disp->output_args);
-  if (index >= n)
-    pn_list_fill(disp->output_args, EMPTY_VALUE, index - n + 1);
-  pn_list_set(disp->output_args, index, arg);
-}
-
-void pn_append_payload(pn_dispatcher_t *disp, const char *data, size_t size)
-{
-  disp->output_payload = data;
-  disp->output_size = size;
-}
-
-void pn_post_frame(pn_dispatcher_t *disp, uint16_t ch, uint32_t performative)
-{
-  pn_tag_t tag = { .descriptor = pn_ulong(performative),
-                   .value = pn_from_list(disp->output_args) };
-  pn_do_trace(disp, ch, OUT, performative, disp->output_args, 
disp->output_payload,
-              disp->output_size);
-  pn_frame_t frame = {disp->frame_type};
-  char bytes[pn_encode_sizeof(pn_from_tag(&tag)) + disp->output_size];
-  size_t size = pn_encode(pn_from_tag(&tag), bytes);
-  for (int i = 0; i < pn_list_size(disp->output_args); i++)
-    pn_visit(pn_list_get(disp->output_args, i), pn_free_value);
-  if (disp->output_size) {
-    memmove(bytes + size, disp->output_payload, disp->output_size);
-    size += disp->output_size;
-    disp->output_payload = NULL;
-    disp->output_size = 0;
-  }
-  frame.channel = ch;
-  frame.payload = bytes;
-  frame.size = size;
-  size_t n;
-  while (!(n = pn_write_frame(disp->output + disp->available,
-                              disp->capacity - disp->available, frame))) {
-    disp->capacity *= 2;
-    disp->output = realloc(disp->output, disp->capacity);
-  }
-  if (disp->trace & PN_TRACE_RAW) {
-    fprintf(stderr, "RAW: \"");
-    pn_fprint_data(stderr, disp->output + disp->available, n);
-    fprintf(stderr, "\"\n");
-  }
-  disp->available += n;
-}
-
-ssize_t pn_dispatcher_output(pn_dispatcher_t *disp, char *bytes, size_t size)
-{
-  int n = disp->available < size ? disp->available : size;
-  memmove(bytes, disp->output, n);
-  memmove(disp->output, disp->output + n, disp->available - n);
-  disp->available -= n;
-  // XXX: need to check for errors
-  return n;
-}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e57c2a52/proton-c/src/dispatcher/dispatcher.h
----------------------------------------------------------------------
diff --git a/proton-c/src/dispatcher/dispatcher.h 
b/proton-c/src/dispatcher/dispatcher.h
deleted file mode 100644
index ebde9d4..0000000
--- a/proton-c/src/dispatcher/dispatcher.h
+++ /dev/null
@@ -1,66 +0,0 @@
-#ifndef _PROTON_DISPATCHER_H
-#define _PROTON_DISPATCHER_H 1
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <sys/types.h>
-#include <stdbool.h>
-#include <proton/value.h>
-
-typedef struct pn_dispatcher_t pn_dispatcher_t;
-
-typedef void (pn_action_t)(pn_dispatcher_t *disp);
-
-#define SCRATCH (1024)
-
-struct pn_dispatcher_t {
-  pn_action_t *actions[256];
-  const char *names[256];
-  uint8_t frame_type;
-  pn_trace_t trace;
-  uint16_t channel;
-  uint8_t code;
-  pn_list_t *args;
-  char *payload;
-  size_t size;
-  pn_list_t *output_args;
-  const char *output_payload;
-  size_t output_size;
-  size_t capacity;
-  size_t available;
-  char *output;
-  void *context;
-  char scratch[SCRATCH];
-};
-
-pn_dispatcher_t *pn_dispatcher(uint8_t frame_type, void *context);
-void pn_dispatcher_destroy(pn_dispatcher_t *disp);
-void pn_dispatcher_action(pn_dispatcher_t *disp, uint8_t code, const char 
*name,
-                          pn_action_t *action);
-void pn_init_frame(pn_dispatcher_t *disp);
-void pn_field(pn_dispatcher_t *disp, int index, pn_value_t arg);
-void pn_append_payload(pn_dispatcher_t *disp, const char *data, size_t size);
-void pn_post_frame(pn_dispatcher_t *disp, uint16_t ch, uint32_t performative);
-ssize_t pn_dispatcher_input(pn_dispatcher_t *disp, char *bytes, size_t 
available);
-ssize_t pn_dispatcher_output(pn_dispatcher_t *disp, char *bytes, size_t size);
-
-#endif /* dispatcher.h */

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e57c2a52/proton-c/src/driver.c
----------------------------------------------------------------------
diff --git a/proton-c/src/driver.c b/proton-c/src/driver.c
deleted file mode 100644
index 4973793..0000000
--- a/proton-c/src/driver.c
+++ /dev/null
@@ -1,526 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#define _POSIX_C_SOURCE 1
-
-#include <poll.h>
-#include <stdio.h>
-#include <time.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <unistd.h>
-
-#include <proton/driver.h>
-#include <proton/sasl.h>
-#include "util.h"
-
-
-/* Decls */
-
-struct pn_driver_t {
-  pn_selectable_t *head;
-  pn_selectable_t *tail;
-  size_t size;
-  int ctrl[2]; //pipe for updating selectable status
-  bool stopping;
-  pn_trace_t trace;
-};
-
-#define IO_BUF_SIZE (4*1024)
-
-struct pn_selectable_t {
-  pn_driver_t *driver;
-  pn_selectable_t *next;
-  pn_selectable_t *prev;
-  int fd;
-  int status;
-  time_t wakeup;
-  pn_callback_t *read;
-  pn_callback_t *write;
-  time_t (*tick)(pn_selectable_t *sel, time_t now);
-  size_t input_size;
-  char input[IO_BUF_SIZE];
-  size_t output_size;
-  char output[IO_BUF_SIZE];
-  pn_sasl_t *sasl;
-  pn_connection_t *connection;
-  pn_transport_t *transport;
-  ssize_t (*process_input)(pn_selectable_t *sel);
-  ssize_t (*process_output)(pn_selectable_t *sel);
-  pn_callback_t *callback;
-  void *context;
-};
-
-/* Impls */
-
-static void pn_driver_add(pn_driver_t *d, pn_selectable_t *s)
-{
-  LL_ADD(d->head, d->tail, s);
-  s->driver = d;
-  d->size++;
-}
-
-static void pn_driver_remove(pn_driver_t *d, pn_selectable_t *s)
-{
-  LL_REMOVE(d->head, d->tail, s);
-  s->driver = NULL;
-  d->size--;
-}
-
-static void pn_selectable_read(pn_selectable_t *sel);
-static void pn_selectable_write(pn_selectable_t *sel);
-static time_t pn_selectable_tick(pn_selectable_t *sel, time_t now);
-
-static ssize_t pn_selectable_read_sasl_header(pn_selectable_t *sel);
-static ssize_t pn_selectable_read_sasl(pn_selectable_t *sel);
-static ssize_t pn_selectable_read_amqp_header(pn_selectable_t *sel);
-static ssize_t pn_selectable_read_amqp(pn_selectable_t *sel);
-static ssize_t pn_selectable_write_sasl_header(pn_selectable_t *sel);
-static ssize_t pn_selectable_write_sasl(pn_selectable_t *sel);
-static ssize_t pn_selectable_write_amqp_header(pn_selectable_t *sel);
-static ssize_t pn_selectable_write_amqp(pn_selectable_t *sel);
-
-pn_selectable_t *pn_selectable(pn_driver_t *driver, int fd, pn_callback_t 
*callback, void *context)
-{
-  pn_selectable_t *s = malloc(sizeof(pn_selectable_t));
-  if (!s) return NULL;
-  s->driver = driver;
-  s->next = NULL;
-  s->prev = NULL;
-  s->fd = fd;
-  s->status = 0;
-  s->wakeup = 0;
-  s->read = pn_selectable_read;
-  s->write = pn_selectable_write;
-  s->tick = pn_selectable_tick;
-  s->input_size = 0;
-  s->output_size = 0;
-  s->sasl = pn_sasl();
-  s->connection = pn_connection();
-  s->transport = pn_transport(s->connection);
-  s->process_input = pn_selectable_read_sasl_header;
-  s->process_output = pn_selectable_write_sasl_header;
-  s->callback = callback;
-  s->context = context;
-
-  pn_selectable_trace(s, driver->trace);
-
-  pn_driver_add(driver, s);
-
-  return s;
-}
-
-void pn_selectable_trace(pn_selectable_t *sel, pn_trace_t trace)
-{
-  pn_sasl_trace(sel->sasl, trace);
-  pn_trace(sel->transport, trace);
-}
-
-pn_sasl_t *pn_selectable_sasl(pn_selectable_t *sel)
-{
-  return sel->sasl;
-}
-
-pn_connection_t *pn_selectable_connection(pn_selectable_t *sel)
-{
-  return sel->connection;
-}
-
-void *pn_selectable_context(pn_selectable_t *sel)
-{
-  return sel->context;
-}
-
-void pn_selectable_destroy(pn_selectable_t *sel)
-{
-  if (sel->driver) pn_driver_remove(sel->driver, sel);
-  if (sel->connection) pn_destroy((pn_endpoint_t *) sel->connection);
-  if (sel->sasl) pn_sasl_destroy(sel->sasl);
-  free(sel);
-}
-
-static void pn_selectable_close(pn_selectable_t *sel)
-{
-  // XXX: should probably signal engine and callback here
-  sel->status = 0;
-  if (close(sel->fd) == -1)
-    perror("close");
-}
-
-static void pn_selectable_consume(pn_selectable_t *sel, int n)
-{
-  sel->input_size -= n;
-  memmove(sel->input, sel->input + n, sel->input_size);
-}
-
-static void pn_selectable_read(pn_selectable_t *sel)
-{
-  ssize_t n = recv(sel->fd, sel->input + sel->input_size, IO_BUF_SIZE - 
sel->input_size, 0);
-
-  if (n <= 0) {
-    printf("disconnected: %zi\n", n);
-    pn_selectable_close(sel);
-    pn_selectable_destroy(sel);
-    return;
-  } else {
-    sel->input_size += n;
-  }
-
-  while (sel->input_size > 0) {
-    n = sel->process_input(sel);
-    if (n > 0) {
-      pn_selectable_consume(sel, n);
-    } else if (n == 0) {
-      return;
-    } else {
-      if (n != PN_EOS) printf("error in process_input: %zi\n", n);
-      pn_selectable_close(sel);
-      pn_selectable_destroy(sel);
-      return;
-    }
-  }
-}
-
-static ssize_t pn_selectable_read_sasl_header(pn_selectable_t *sel)
-{
-  if (sel->input_size >= 8) {
-    if (memcmp(sel->input, "AMQP\x03\x01\x00\x00", 8)) {
-      fprintf(stderr, "sasl header missmatch\n");
-      return PN_ERR;
-    } else {
-      fprintf(stderr, "    <- AMQP SASL 1.0\n");
-      sel->process_input = pn_selectable_read_sasl;
-      return 8;
-    }
-  }
-
-  return 0;
-}
-
-static ssize_t pn_selectable_read_sasl(pn_selectable_t *sel)
-{
-  pn_sasl_t *sasl = sel->sasl;
-  ssize_t n = pn_sasl_input(sasl, sel->input, sel->input_size);
-  if (n == PN_EOS) {
-    sel->process_input = pn_selectable_read_amqp_header;
-    return sel->process_input(sel);
-  } else {
-    return n;
-  }
-}
-
-static ssize_t pn_selectable_read_amqp_header(pn_selectable_t *sel)
-{
-  if (sel->input_size >= 8) {
-    if (memcmp(sel->input, "AMQP\x00\x01\x00\x00", 8)) {
-      fprintf(stderr, "amqp header missmatch\n");
-      return PN_ERR;
-    } else {
-      fprintf(stderr, "    <- AMQP 1.0\n");
-      sel->process_input = pn_selectable_read_amqp;
-      return 8;
-    }
-  }
-
-  return 0;
-}
-
-static ssize_t pn_selectable_read_amqp(pn_selectable_t *sel)
-{
-  pn_transport_t *transport = sel->transport;
-  return pn_input(transport, sel->input, sel->input_size);
-}
-
-static char *pn_selectable_output(pn_selectable_t *sel)
-{
-  return sel->output + sel->output_size;
-}
-
-static size_t pn_selectable_available(pn_selectable_t *sel)
-{
-  return IO_BUF_SIZE - sel->output_size;
-}
-
-static void pn_selectable_write(pn_selectable_t *sel)
-{
-  while (pn_selectable_available(sel) > 0) {
-    ssize_t n = sel->process_output(sel);
-    if (n > 0) {
-      sel->output_size += n;
-    } else if (n == 0) {
-      break;
-    } else {
-      if (n != PN_EOS) fprintf(stderr, "error in process_output: %zi", n);
-      pn_selectable_close(sel);
-      pn_selectable_destroy(sel);
-      return;
-    }
-  }
-
-  if (sel->output_size > 0) {
-    ssize_t n = send(sel->fd, sel->output, sel->output_size, 0);
-    if (n < 0) {
-      // XXX
-      perror("send");
-      pn_selectable_close(sel);
-      pn_selectable_destroy(sel);
-      return;
-    } else {
-      sel->output_size -= n;
-      memmove(sel->output, sel->output + n, sel->output_size);
-    }
-
-    if (sel->output_size)
-      sel->status |= PN_SEL_WR;
-    else
-      sel->status &= ~PN_SEL_WR;
-  }
-}
-
-static ssize_t pn_selectable_write_sasl_header(pn_selectable_t *sel)
-{
-  fprintf(stderr, "    -> AMQP SASL 1.0\n");
-  memmove(pn_selectable_output(sel), "AMQP\x03\x01\x00\x00", 8);
-  sel->process_output = pn_selectable_write_sasl;
-  return 8;
-}
-
-static ssize_t pn_selectable_write_sasl(pn_selectable_t *sel)
-{
-  pn_sasl_t *sasl = sel->sasl;
-  ssize_t n = pn_sasl_output(sasl, pn_selectable_output(sel), 
pn_selectable_available(sel));
-  if (n == PN_EOS) {
-    sel->process_output = pn_selectable_write_amqp_header;
-    return sel->process_output(sel);
-  } else {
-    return n;
-  }
-}
-
-static ssize_t pn_selectable_write_amqp_header(pn_selectable_t *sel)
-{
-  fprintf(stderr, "    -> AMQP 1.0\n");
-  memmove(pn_selectable_output(sel), "AMQP\x00\x01\x00\x00", 8);
-  sel->process_output = pn_selectable_write_amqp;
-  pn_open((pn_endpoint_t *) sel->transport);
-  return 8;
-}
-
-static ssize_t pn_selectable_write_amqp(pn_selectable_t *sel)
-{
-  pn_transport_t *transport = sel->transport;
-  return pn_output(transport, pn_selectable_output(sel), 
pn_selectable_available(sel));
-}
-
-static time_t pn_selectable_tick(pn_selectable_t *sel, time_t now)
-{
-  // XXX: should probably have a function pointer for this and switch it with 
different layers
-  time_t result = pn_tick(sel->transport, now);
-  if (sel->callback) sel->callback(sel);
-  pn_selectable_write(sel);
-  return result;
-}
-
-pn_driver_t *pn_driver()
-{
-  pn_driver_t *d = malloc(sizeof(pn_driver_t));
-  if (!d) return NULL;
-  d->head = NULL;
-  d->tail = NULL;
-  d->size = 0;
-  d->ctrl[0] = 0;
-  d->ctrl[1] = 0;
-  d->stopping = false;
-  d->trace = ((pn_env_bool("PN_TRACE_RAW") ? PN_TRACE_RAW : PN_TRACE_OFF) |
-              (pn_env_bool("PN_TRACE_FRM") ? PN_TRACE_FRM : PN_TRACE_OFF));
-  return d;
-}
-
-void pn_driver_trace(pn_driver_t *d, pn_trace_t trace)
-{
-  d->trace = trace;
-}
-
-void pn_driver_destroy(pn_driver_t *d)
-{
-  while (d->head)
-    pn_selectable_destroy(d->head);
-  free(d);
-}
-
-void pn_driver_run(pn_driver_t *d)
-{
-  int i, nfds = 0;
-  struct pollfd *fds = NULL;
-
-  if (pipe(d->ctrl)) {
-      perror("Can't create control pipe");
-  }
-  while (!d->stopping)
-  {
-    int n = d->size;
-    if (n == 0) break;
-    if (n > nfds) {
-      fds = realloc(fds, (n+1)*sizeof(struct pollfd));
-      nfds = n;
-    }
-
-    pn_selectable_t *s = d->head;
-    for (i = 0; i < n; i++)
-    {
-      fds[i].fd = s->fd;
-      fds[i].events = (s->status & PN_SEL_RD ? POLLIN : 0) |
-        (s->status & PN_SEL_WR ? POLLOUT : 0);
-      fds[i].revents = 0;
-      // XXX
-      s->tick(s, 0);
-      s = s->next;
-    }
-    fds[n].fd = d->ctrl[0];
-    fds[n].events = POLLIN;
-    fds[n].revents = 0;
-
-    DIE_IFE(poll(fds, n+1, -1));
-
-    s = d->head;
-    for (i = 0; i < n; i++)
-    {
-      // XXX: this is necessary because read or write might close the
-      // selectable, should probably fix this by making them mark it
-      // as closed and closing from this loop
-      pn_selectable_t *next = s->next;
-      if (fds[i].revents & POLLIN)
-        s->read(s);
-      if (fds[i].revents & POLLOUT)
-        s->write(s);
-      s = next;
-    }
-
-    if (fds[n].revents & POLLIN) {
-      //clear the pipe
-      char buffer[512];
-      while (read(d->ctrl[0], buffer, 512) == 512);
-    }
-  }
-
-  close(d->ctrl[0]);
-  close(d->ctrl[1]);
-  free(fds);
-}
-
-void pn_driver_stop(pn_driver_t *d)
-{
-  d->stopping = true;
-  write(d->ctrl[1], "x", 1);
-}
-
-pn_selectable_t *pn_connector(pn_driver_t *driver, char *host, char *port, 
pn_callback_t *callback, void *context)
-{
-  struct addrinfo *addr;
-  int code = getaddrinfo(host, port, NULL, &addr);
-  if (code) {
-    fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(code));
-    return NULL;
-  }
-
-  int sock = socket(AF_INET, SOCK_STREAM, getprotobyname("tcp")->p_proto);
-  if (sock == -1)
-    return NULL;
-
-  if (connect(sock, addr->ai_addr, addr->ai_addrlen) == -1) {
-    freeaddrinfo(addr);
-    return NULL;
-  }
-
-  freeaddrinfo(addr);
-
-  pn_selectable_t *s = pn_selectable(driver, sock, callback, context);
-  s->status = PN_SEL_RD | PN_SEL_WR;
-
-  printf("Connected to %s:%s\n", host, port);
-  return s;
-}
-
-static void do_accept(pn_selectable_t *s)
-{
-  struct sockaddr_in addr = {0};
-  addr.sin_family = AF_INET;
-  socklen_t addrlen = sizeof(addr);
-  int sock = accept(s->fd, (struct sockaddr *) &addr, &addrlen);
-  if (sock == -1) {
-    perror("accept");
-  } else {
-    char host[1024], serv[64];
-    int code;
-    if ((code = getnameinfo((struct sockaddr *) &addr, addrlen, host, 1024, 
serv, 64, 0))) {
-      fprintf(stderr, "getnameinfo: %s\n", gai_strerror(code));
-      if (close(sock) == -1)
-        perror("close");
-    } else {
-      printf("accepted from %s:%s\n", host, serv);
-      pn_selectable_t *a = pn_selectable(s->driver, sock, s->callback, 
s->context);
-      a->status = PN_SEL_RD | PN_SEL_WR;
-    }
-  }
-}
-
-static void do_nothing(pn_selectable_t *s) {}
-static time_t never_tick(pn_selectable_t *s, time_t now) { return 0; }
-
-pn_selectable_t *pn_acceptor(pn_driver_t *driver, char *host, char *port, 
pn_callback_t *callback, void* context)
-{
-  struct addrinfo *addr;
-  int code = getaddrinfo(host, port, NULL, &addr);
-  if (code) {
-    fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(code));
-    return NULL;
-  }
-
-  int sock = socket(AF_INET, SOCK_STREAM, getprotobyname("tcp")->p_proto);
-  if (sock == -1)
-    return NULL;
-
-  int optval = 1;
-  if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)) == 
-1)
-    return NULL;
-
-  if (bind(sock, addr->ai_addr, addr->ai_addrlen) == -1) {
-    freeaddrinfo(addr);
-    return NULL;
-  }
-
-  freeaddrinfo(addr);
-
-  if (listen(sock, 50) == -1)
-    return NULL;
-
-  // XXX: should factor into pure selectable and separate subclass
-  pn_selectable_t *s = pn_selectable(driver, sock, callback, context);
-  s->read = do_accept;
-  s->write = do_nothing;
-  s->tick = never_tick;
-  s->status = PN_SEL_RD;
-
-  printf("Listening on %s:%s\n", host, port);
-  return s;
-}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e57c2a52/proton-c/src/engine/engine-internal.h
----------------------------------------------------------------------
diff --git a/proton-c/src/engine/engine-internal.h 
b/proton-c/src/engine/engine-internal.h
deleted file mode 100644
index 65224e8..0000000
--- a/proton-c/src/engine/engine-internal.h
+++ /dev/null
@@ -1,202 +0,0 @@
-#ifndef _PROTON_ENGINE_INTERNAL_H
-#define _PROTON_ENGINE_INTERNAL_H 1
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <proton/engine.h>
-#include <proton/value.h>
-#include "../dispatcher/dispatcher.h"
-#include "../util.h"
-
-#define DESCRIPTION (1024)
-
-struct pn_error_t {
-  const char *condition;
-  char description[DESCRIPTION];
-  pn_map_t *info;
-};
-
-struct pn_endpoint_t {
-  pn_endpoint_type_t type;
-  pn_endpoint_state_t local_state, remote_state;
-  pn_error_t local_error, remote_error;
-  pn_endpoint_t *endpoint_next;
-  pn_endpoint_t *endpoint_prev;
-  pn_endpoint_t *transport_next;
-  pn_endpoint_t *transport_prev;
-  bool modified;
-};
-
-typedef int32_t pn_sequence_t;
-
-typedef struct {
-  pn_delivery_t *delivery;
-  pn_sequence_t id;
-  bool sent;
-} pn_delivery_state_t;
-
-typedef struct {
-  pn_sequence_t next;
-  size_t capacity;
-  size_t head;
-  size_t size;
-  pn_delivery_state_t *deliveries;
-} pn_delivery_buffer_t;
-
-typedef struct {
-  pn_link_t *link;
-  // XXX: stop using negative numbers
-  uint32_t local_handle;
-  uint32_t remote_handle;
-  pn_sequence_t delivery_count;
-  // XXX: this is only used for receiver
-  pn_sequence_t link_credit;
-} pn_link_state_t;
-
-typedef struct {
-  pn_session_t *session;
-  // XXX: stop using negative numbers
-  uint16_t local_channel;
-  uint16_t remote_channel;
-  pn_delivery_buffer_t incoming;
-  pn_delivery_buffer_t outgoing;
-  pn_link_state_t *links;
-  size_t link_capacity;
-  pn_link_state_t **handles;
-  size_t handle_capacity;
-} pn_session_state_t;
-
-#define SCRATCH (1024)
-
-struct pn_transport_t {
-  pn_endpoint_t endpoint;
-  pn_connection_t *connection;
-  pn_dispatcher_t *disp;
-  bool open_sent;
-  bool close_sent;
-  pn_session_state_t *sessions;
-  size_t session_capacity;
-  pn_session_state_t **channels;
-  size_t channel_capacity;
-  char scratch[SCRATCH];
-};
-
-struct pn_connection_t {
-  pn_endpoint_t endpoint;
-  pn_endpoint_t *endpoint_head;
-  pn_endpoint_t *endpoint_tail;
-  pn_endpoint_t *transport_head;
-  pn_endpoint_t *transport_tail;
-  pn_session_t **sessions;
-  size_t session_capacity;
-  size_t session_count;
-  pn_transport_t *transport;
-  pn_delivery_t *work_head;
-  pn_delivery_t *work_tail;
-  pn_delivery_t *tpwork_head;
-  pn_delivery_t *tpwork_tail;
-  wchar_t *container;
-  wchar_t *hostname;
-};
-
-struct pn_session_t {
-  pn_endpoint_t endpoint;
-  pn_connection_t *connection;
-  pn_link_t **links;
-  size_t link_capacity;
-  size_t link_count;
-  size_t id;
-};
-
-struct pn_link_t {
-  pn_endpoint_t endpoint;
-  wchar_t *name;
-  pn_session_t *session;
-  wchar_t *local_source;
-  wchar_t *local_target;
-  wchar_t *remote_source;
-  wchar_t *remote_target;
-  pn_delivery_t *head;
-  pn_delivery_t *tail;
-  pn_delivery_t *current;
-  pn_delivery_t *settled_head;
-  pn_delivery_t *settled_tail;
-  pn_sequence_t credit;
-  size_t id;
-};
-
-struct pn_sender_t {
-  pn_link_t link;
-};
-
-struct pn_receiver_t {
-  pn_link_t link;
-  pn_sequence_t credits;
-};
-
-struct pn_delivery_t {
-  pn_link_t *link;
-  pn_binary_t *tag;
-  int local_state;
-  int remote_state;
-  bool local_settled;
-  bool remote_settled;
-  bool dirty;
-  pn_delivery_t *link_next;
-  pn_delivery_t *link_prev;
-  pn_delivery_t *work_next;
-  pn_delivery_t *work_prev;
-  bool work;
-  pn_delivery_t *tpwork_next;
-  pn_delivery_t *tpwork_prev;
-  bool tpwork;
-  char *bytes;
-  size_t size;
-  size_t capacity;
-  void *context;
-};
-
-void pn_destroy_connection(pn_connection_t *connection);
-void pn_destroy_transport(pn_transport_t *transport);
-void pn_destroy_session(pn_session_t *session);
-void pn_destroy_sender(pn_sender_t *sender);
-void pn_destroy_receiver(pn_receiver_t *receiver);
-
-void pn_link_dump(pn_link_t *link);
-
-#define PN_ENSURE(ARRAY, CAPACITY, COUNT)                      \
-  while ((CAPACITY) < (COUNT)) {                                \
-    (CAPACITY) = (CAPACITY) ? 2 * (CAPACITY) : 16;              \
-    (ARRAY) = realloc((ARRAY), (CAPACITY) * sizeof (*(ARRAY))); \
-  }                                                             \
-
-#define PN_ENSUREZ(ARRAY, CAPACITY, COUNT)                \
-  {                                                        \
-    size_t _old_capacity = (CAPACITY);                     \
-    PN_ENSURE((ARRAY), (CAPACITY), (COUNT));              \
-    memset((ARRAY) + _old_capacity, 0,                     \
-           sizeof(*(ARRAY))*((CAPACITY) - _old_capacity)); \
-  }
-
-void pn_dump(pn_connection_t *conn);
-
-#endif /* engine-internal.h */


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to