Merge pull request #24 from rlane/licenses

Add license pointer to generated code
diff --git a/c_gen/c_code_gen.py b/c_gen/c_code_gen.py
index 0d44a6d..b9a5560 100644
--- a/c_gen/c_code_gen.py
+++ b/c_gen/c_code_gen.py
@@ -796,6 +796,7 @@
 def common_top_matter(out, name):
     loxi_utils.gen_c_copy_license(out)
     out.write("""\
+
 /****************************************************************
  * File: %s
  *
diff --git a/c_gen/templates/_copyright.c b/c_gen/templates/_copyright.c
new file mode 100644
index 0000000..4d38f6d
--- /dev/null
+++ b/c_gen/templates/_copyright.c
@@ -0,0 +1,31 @@
+:: # Copyright 2013, Big Switch Networks, Inc.
+:: #
+:: # LoxiGen is licensed under the Eclipse Public License, version 1.0 (EPL), with
+:: # the following special exception:
+:: #
+:: # LOXI Exception
+:: #
+:: # As a special exception to the terms of the EPL, you may distribute libraries
+:: # generated by LoxiGen (LoxiGen Libraries) under the terms of your choice, provided
+:: # that copyright and licensing notices generated by LoxiGen are not altered or removed
+:: # from the LoxiGen Libraries and the notice provided below is (i) included in
+:: # the LoxiGen Libraries, if distributed in source code form and (ii) included in any
+:: # documentation for the LoxiGen Libraries, if distributed in binary form.
+:: #
+:: # Notice: "Copyright 2013, Big Switch Networks, Inc. This library was generated by the LoxiGen Compiler."
+:: #
+:: # You may not use this file except in compliance with the EPL or LOXI Exception. You may obtain
+:: # a copy of the EPL at:
+:: #
+:: # http://www.eclipse.org/legal/epl-v10.html
+:: #
+:: # 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
+:: # EPL for the specific language governing permissions and limitations
+:: # under the EPL.
+::
+/* Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University */
+/* Copyright (c) 2011, 2012 Open Networking Foundation */
+/* Copyright (c) 2012, 2013 Big Switch Networks, Inc. */
+/* See the file LICENSE.loci which should have been included in the source distribution */
diff --git a/c_gen/templates/bsn_ext.h b/c_gen/templates/bsn_ext.h
index 6afa211..d810ab3 100644
--- a/c_gen/templates/bsn_ext.h
+++ b/c_gen/templates/bsn_ext.h
@@ -25,7 +25,7 @@
 :: # EPL for the specific language governing permissions and limitations
 :: # under the EPL.
 ::
-/* Copyright 2013, Big Switch Networks, Inc. */
+:: include('_copyright.c')
 
 /**
  * BSN OpenFlow extension definition header file
diff --git a/c_gen/templates/loci_dox.h b/c_gen/templates/loci_dox.h
index 86c29db..d37a6c1 100644
--- a/c_gen/templates/loci_dox.h
+++ b/c_gen/templates/loci_dox.h
@@ -25,7 +25,7 @@
 :: # EPL for the specific language governing permissions and limitations
 :: # under the EPL.
 ::
-/* Copyright 2013, Big Switch Networks, Inc. */
+:: include('_copyright.c')
 
 /**************************************************************************//**
  * 
diff --git a/c_gen/templates/loci_dump.h b/c_gen/templates/loci_dump.h
index 12bba6e..c2fd53a 100644
--- a/c_gen/templates/loci_dump.h
+++ b/c_gen/templates/loci_dump.h
@@ -25,7 +25,7 @@
 :: # EPL for the specific language governing permissions and limitations
 :: # under the EPL.
 ::
-/* Copyright 2012, Big Switch Networks, Inc. */
+:: include('_copyright.c')
 
 #if !defined(_LOCI_DUMP_H_)
 #define _LOCI_DUMP_H_
diff --git a/c_gen/templates/loci_int.h b/c_gen/templates/loci_int.h
index ce5ecb0..87cfd1e 100644
--- a/c_gen/templates/loci_int.h
+++ b/c_gen/templates/loci_int.h
@@ -25,7 +25,7 @@
 :: # EPL for the specific language governing permissions and limitations
 :: # under the EPL.
 ::
-/* Copyright 2013, Big Switch Networks, Inc. */
+:: include('_copyright.c')
 
 /******************************************************************************
  *
diff --git a/c_gen/templates/loci_log.c b/c_gen/templates/loci_log.c
index cf34eae..2a06811 100644
--- a/c_gen/templates/loci_log.c
+++ b/c_gen/templates/loci_log.c
@@ -25,7 +25,7 @@
 :: # EPL for the specific language governing permissions and limitations
 :: # under the EPL.
 ::
-/* Copyright 2012, Big Switch Networks, Inc. */
+:: include('_copyright.c')
 
 #include <stdarg.h>
 
diff --git a/c_gen/templates/loci_log.h b/c_gen/templates/loci_log.h
index 3e22d81..25b9a67 100644
--- a/c_gen/templates/loci_log.h
+++ b/c_gen/templates/loci_log.h
@@ -25,7 +25,7 @@
 :: # EPL for the specific language governing permissions and limitations
 :: # under the EPL.
 ::
-/* Copyright 2012, Big Switch Networks, Inc. */
+:: include('_copyright.c')
 
 #if !defined(_LOCI_LOG_H_)
 #define _LOCI_LOG_H_
diff --git a/c_gen/templates/loci_show.h b/c_gen/templates/loci_show.h
index 1a1f80f..bf9b93b 100644
--- a/c_gen/templates/loci_show.h
+++ b/c_gen/templates/loci_show.h
@@ -25,7 +25,7 @@
 :: # EPL for the specific language governing permissions and limitations
 :: # under the EPL.
 ::
-/* Copyright 2012, Big Switch Networks, Inc. */
+:: include('_copyright.c')
 
 #if !defined(_LOCI_SHOW_H_)
 #define _LOCI_SHOW_H_
diff --git a/c_gen/templates/locitest/locitest_config.c b/c_gen/templates/locitest/locitest_config.c
index c7c6fa2..837010e 100644
--- a/c_gen/templates/locitest/locitest_config.c
+++ b/c_gen/templates/locitest/locitest_config.c
@@ -25,7 +25,7 @@
 :: # EPL for the specific language governing permissions and limitations
 :: # under the EPL.
 ::
-/* Copyright 2012, Big Switch Networks, Inc. */
+:: include('_copyright.c')
 
 /******************************************************************************
  *
diff --git a/c_gen/templates/locitest/locitest_enums.c b/c_gen/templates/locitest/locitest_enums.c
index 7c3f074..193f7cd 100644
--- a/c_gen/templates/locitest/locitest_enums.c
+++ b/c_gen/templates/locitest/locitest_enums.c
@@ -25,7 +25,7 @@
 :: # EPL for the specific language governing permissions and limitations
 :: # under the EPL.
 ::
-/* Copyright 2012, Big Switch Networks, Inc. */
+:: include('_copyright.c')
 
 /******************************************************************************
  *
diff --git a/c_gen/templates/locitest/locitest_int.h b/c_gen/templates/locitest/locitest_int.h
index b058604..b4d6c7f 100644
--- a/c_gen/templates/locitest/locitest_int.h
+++ b/c_gen/templates/locitest/locitest_int.h
@@ -25,7 +25,7 @@
 :: # EPL for the specific language governing permissions and limitations
 :: # under the EPL.
 ::
-/* Copyright 2012, Big Switch Networks, Inc. */
+:: include('_copyright.c')
 
 /******************************************************************************
  *
diff --git a/c_gen/templates/locitest/main.c b/c_gen/templates/locitest/main.c
index c3c9a77..df80f9f 100644
--- a/c_gen/templates/locitest/main.c
+++ b/c_gen/templates/locitest/main.c
@@ -1,3 +1,5 @@
+:: include('_copyright.c')
+
 /**
  * @file test_main
  *
diff --git a/c_gen/templates/locitest/test_ext.c b/c_gen/templates/locitest/test_ext.c
index 1efcaf6..87f9916 100644
--- a/c_gen/templates/locitest/test_ext.c
+++ b/c_gen/templates/locitest/test_ext.c
@@ -25,7 +25,7 @@
 :: # EPL for the specific language governing permissions and limitations
 :: # under the EPL.
 ::
-/* Copyright 2012, Big Switch Networks, Inc. */
+:: include('_copyright.c')
 
 /**
  * Test extensions
diff --git a/c_gen/templates/locitest/test_list_limits.c b/c_gen/templates/locitest/test_list_limits.c
index aef91d8..d8368ff 100644
--- a/c_gen/templates/locitest/test_list_limits.c
+++ b/c_gen/templates/locitest/test_list_limits.c
@@ -25,7 +25,7 @@
 :: # EPL for the specific language governing permissions and limitations
 :: # under the EPL.
 ::
-/* Copyright 2013, Big Switch Networks, Inc. */
+:: include('_copyright.c')
 
 /**
  * Test that list append fails gracefully when running out of wire buffer
diff --git a/c_gen/templates/locitest/test_match_utils.c b/c_gen/templates/locitest/test_match_utils.c
index 6e4a95e..8b116bf 100644
--- a/c_gen/templates/locitest/test_match_utils.c
+++ b/c_gen/templates/locitest/test_match_utils.c
@@ -25,7 +25,7 @@
 :: # EPL for the specific language governing permissions and limitations
 :: # under the EPL.
 ::
-/* Copyright 2013, Big Switch Networks, Inc. */
+:: include('_copyright.c')
 
 /**
  *
diff --git a/c_gen/templates/locitest/test_setup_from_add.c b/c_gen/templates/locitest/test_setup_from_add.c
index 6988572..d8911f3 100644
--- a/c_gen/templates/locitest/test_setup_from_add.c
+++ b/c_gen/templates/locitest/test_setup_from_add.c
@@ -25,7 +25,7 @@
 :: # EPL for the specific language governing permissions and limitations
 :: # under the EPL.
 ::
-/* Copyright 2013, Big Switch Networks, Inc. */
+:: include('_copyright.c')
 
 /**
  * Test code for setup from flow add routines
diff --git a/c_gen/templates/locitest/test_utils.c b/c_gen/templates/locitest/test_utils.c
index adc6d42..bcd4194 100644
--- a/c_gen/templates/locitest/test_utils.c
+++ b/c_gen/templates/locitest/test_utils.c
@@ -25,7 +25,7 @@
 :: # EPL for the specific language governing permissions and limitations
 :: # under the EPL.
 ::
-/* Copyright 2013, Big Switch Networks, Inc. */
+:: include('_copyright.c')
 
 /**
  *
diff --git a/c_gen/templates/locitest/test_validator.c b/c_gen/templates/locitest/test_validator.c
index cac67f7..db8079e 100644
--- a/c_gen/templates/locitest/test_validator.c
+++ b/c_gen/templates/locitest/test_validator.c
@@ -25,7 +25,7 @@
 :: # EPL for the specific language governing permissions and limitations
 :: # under the EPL.
 ::
-/* Copyright 2013, Big Switch Networks, Inc. */
+:: include('_copyright.c')
 
 /**
  * Test message validator
diff --git a/c_gen/templates/locitest/unittest.h b/c_gen/templates/locitest/unittest.h
index 7ffc413..c897d67 100644
--- a/c_gen/templates/locitest/unittest.h
+++ b/c_gen/templates/locitest/unittest.h
@@ -25,7 +25,7 @@
 :: # EPL for the specific language governing permissions and limitations
 :: # under the EPL.
 ::
-/* Copyright 2013, Big Switch Networks, Inc. */
+:: include('_copyright.c')
 
 #ifndef UNITTEST_H
 #define UNITTEST_H
diff --git a/c_gen/templates/of_buffer.h b/c_gen/templates/of_buffer.h
index 05cc587..1788939 100644
--- a/c_gen/templates/of_buffer.h
+++ b/c_gen/templates/of_buffer.h
@@ -25,7 +25,7 @@
 :: # EPL for the specific language governing permissions and limitations
 :: # under the EPL.
 ::
-/* Copyright 2013, Big Switch Networks, Inc. */
+:: include('_copyright.c')
 
 /****************************************************************
  *
diff --git a/c_gen/templates/of_doc.h b/c_gen/templates/of_doc.h
index 9e352f0..d9bf64b 100644
--- a/c_gen/templates/of_doc.h
+++ b/c_gen/templates/of_doc.h
@@ -25,7 +25,7 @@
 :: # EPL for the specific language governing permissions and limitations
 :: # under the EPL.
 ::
-/* Copyright 2013, Big Switch Networks, Inc. */
+:: include('_copyright.c')
 
 /**
  * @file of_doc.h
diff --git a/c_gen/templates/of_message.h b/c_gen/templates/of_message.h
index 77066bc..944f6d2 100644
--- a/c_gen/templates/of_message.h
+++ b/c_gen/templates/of_message.h
@@ -25,7 +25,7 @@
 :: # EPL for the specific language governing permissions and limitations
 :: # under the EPL.
 ::
-/* Copyright 2013, Big Switch Networks, Inc. */
+:: include('_copyright.c')
 
 /*
  * These routines manipulate a low level buffer assuming it holds
diff --git a/c_gen/templates/of_object.c b/c_gen/templates/of_object.c
index a5cfecd..0b3ec3a 100644
--- a/c_gen/templates/of_object.c
+++ b/c_gen/templates/of_object.c
@@ -25,7 +25,7 @@
 :: # EPL for the specific language governing permissions and limitations
 :: # under the EPL.
 ::
-/* Copyright 2013, Big Switch Networks, Inc. */
+:: include('_copyright.c')
 
 /****************************************************************
  *
diff --git a/c_gen/templates/of_object.h b/c_gen/templates/of_object.h
index cb9342e..ff4c9c5 100644
--- a/c_gen/templates/of_object.h
+++ b/c_gen/templates/of_object.h
@@ -25,7 +25,7 @@
 :: # EPL for the specific language governing permissions and limitations
 :: # under the EPL.
 ::
-/* Copyright 2013, Big Switch Networks, Inc. */
+:: include('_copyright.c')
 
 /*
  * @fixme THIS FILE NEEDS CLEANUP.  It may just go away.
diff --git a/c_gen/templates/of_type_maps.c b/c_gen/templates/of_type_maps.c
index f1fab57..2c1032d 100644
--- a/c_gen/templates/of_type_maps.c
+++ b/c_gen/templates/of_type_maps.c
@@ -25,7 +25,7 @@
 :: # EPL for the specific language governing permissions and limitations
 :: # under the EPL.
 ::
-/* Copyright 2013, Big Switch Networks, Inc. */
+:: include('_copyright.c')
 
 /****************************************************************
  *
diff --git a/c_gen/templates/of_utils.c b/c_gen/templates/of_utils.c
index f9c1972..ba22536 100644
--- a/c_gen/templates/of_utils.c
+++ b/c_gen/templates/of_utils.c
@@ -25,7 +25,7 @@
 :: # EPL for the specific language governing permissions and limitations
 :: # under the EPL.
 ::
-/* Copyright 2013, Big Switch Networks, Inc. */
+:: include('_copyright.c')
 
 /****************************************************************
  * File: of_utils.h
diff --git a/c_gen/templates/of_utils.h b/c_gen/templates/of_utils.h
index 1a3a29a..5510d67 100644
--- a/c_gen/templates/of_utils.h
+++ b/c_gen/templates/of_utils.h
@@ -25,7 +25,7 @@
 :: # EPL for the specific language governing permissions and limitations
 :: # under the EPL.
 ::
-/* Copyright 2013, Big Switch Networks, Inc. */
+:: include('_copyright.c')
 
 /****************************************************************
  * File: of_utils.h
diff --git a/c_gen/templates/of_wire_buf.c b/c_gen/templates/of_wire_buf.c
index acfcb84..054dc01 100644
--- a/c_gen/templates/of_wire_buf.c
+++ b/c_gen/templates/of_wire_buf.c
@@ -25,7 +25,7 @@
 :: # EPL for the specific language governing permissions and limitations
 :: # under the EPL.
 ::
-/* Copyright 2013, Big Switch Networks, Inc. */
+:: include('_copyright.c')
 
 /****************************************************************
  *
diff --git a/c_gen/templates/of_wire_buf.h b/c_gen/templates/of_wire_buf.h
index cf1ee17..9e91b9b 100644
--- a/c_gen/templates/of_wire_buf.h
+++ b/c_gen/templates/of_wire_buf.h
@@ -25,7 +25,7 @@
 :: # EPL for the specific language governing permissions and limitations
 :: # under the EPL.
 ::
-/* Copyright 2013, Big Switch Networks, Inc. */
+:: include('_copyright.c')
 
 #if !defined(_OF_WIRE_BUF_H_)
 #define _OF_WIRE_BUF_H_
diff --git a/loxi_utils/loxi_utils.py b/loxi_utils/loxi_utils.py
index d14cb43..648e109 100644
--- a/loxi_utils/loxi_utils.py
+++ b/loxi_utils/loxi_utils.py
@@ -476,12 +476,8 @@
     """
     Generate the top comments for copyright and license
     """
-    out.write("""\
-/* Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University */
-/* Copyright (c) 2011, 2012 Open Networking Foundation */
-/* Copyright (c) 2012, 2013 Big Switch Networks, Inc. */
-
-""")
+    import c_gen.util
+    c_gen.util.render_template(out, '_copyright.c')
 
 def accessor_returns_error(a_type, m_type):
     is_var_len = (not type_is_scalar(m_type)) and \
diff --git a/py_gen/templates/_copyright.py b/py_gen/templates/_copyright.py
index 24dc1b6..6084abe 100644
--- a/py_gen/templates/_copyright.py
+++ b/py_gen/templates/_copyright.py
@@ -28,3 +28,4 @@
 # Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
 # Copyright (c) 2011, 2012 Open Networking Foundation
 # Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+# See the file LICENSE.pyloxi which should have been included in the source distribution