diff -Naur openflow_089_mpls/lib/fault.c openflow-new/lib/fault.c
--- openflow_089_mpls/lib/fault.c 2010-08-10 06:03:52.000000000 -0700
+++ openflow-new/lib/fault.c 2012-10-07 07:03:58.000000000 -0700
@@ -73,7 +73,7 @@
} else {
fprintf(stderr, " 0x%08"PRIxPTR" (%s+0x%x)\n",
(uintptr_t) frame[1], addrinfo.dli_sname,
- (char *) frame[1] - (char *) addrinfo.dli_saddr);
+ (unsigned int)((char *) frame[1] - (char *) addrinfo.dli_saddr));
}
}
fflush(stderr);
diff -Naur openflow_089_mpls/lib/freelist.c openflow-new/lib/freelist.c
--- openflow_089_mpls/lib/freelist.c 2010-08-10 06:03:52.000000000 -0700
+++ openflow-new/lib/freelist.c 2012-10-07 07:03:58.000000000 -0700
@@ -9,7 +9,7 @@
0x10, 0x20, 0x40, 0x80};
// PROTOTYPES
-byte_t *get_byte(freeListPtr list, size_t index);
+byte_t *get_byte(freeListPtr list, uint32_t index);
bool bit_set(freeListPtr list, uint32_t index);
void set_bit(freeListPtr list, uint32_t index);
void clear_bit(freeListPtr list, uint32_t index);
diff -Naur openflow_089_mpls/lib/freelist.h openflow-new/lib/freelist.h
--- openflow_089_mpls/lib/freelist.h 2010-08-10 06:03:52.000000000 -0700
+++ openflow-new/lib/freelist.h 2012-10-07 07:28:07.000000000 -0700
@@ -7,7 +7,9 @@
#define FREELIST_H
typedef unsigned char byte_t;
+#ifndef NS3
typedef unsigned int size_t;
+#endif
// The freelist is implemented as a bitmap that is dynamically allocated in
// BLOCK_SIZE byte chunks.
diff -Naur openflow_089_mpls/lib/read-mpls-fib.c openflow-new/lib/read-mpls-fib.c
--- openflow_089_mpls/lib/read-mpls-fib.c 2010-08-10 06:03:52.000000000 -0700
+++ openflow-new/lib/read-mpls-fib.c 2012-10-07 07:29:24.000000000 -0700
@@ -254,6 +254,7 @@
+#ifndef NS3
static void
printIlmEntry(ilmPtr cur) {
@@ -263,6 +264,7 @@
printf(" mpls_label: %u\n", cur->mpls_label);
printf("======= \n");
}
+#endif
static ilmPtr
parse_ilm(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, struct mpls_switch *sw) {
@@ -320,6 +322,7 @@
}
+#ifndef NS3
static void
printFtnEntry(ftnPtr cur) {
struct in_addr addr;
@@ -347,6 +350,7 @@
printf(" -------------------------:\n");
printf("============================== \n");
}
+#endif
static ftnPtr
parse_ftn(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, struct mpls_switch *sw) {
diff -Naur openflow_089_mpls/lib/stack.c openflow-new/lib/stack.c
--- openflow_089_mpls/lib/stack.c 2010-08-10 06:03:52.000000000 -0700
+++ openflow-new/lib/stack.c 2012-10-07 07:29:52.000000000 -0700
@@ -3,9 +3,11 @@
* */
#include "stack.h"
+#ifndef NS3
int StackNotEmpty(stk_stack * theStack) {
return( theStack ? (int) theStack->top : 0);
}
+#endif
stk_stack * StackJoin(stk_stack * stack1, stk_stack * stack2) {
if (!stack1->tail) {
diff -Naur openflow_089_mpls/lib/stack.h openflow-new/lib/stack.h
--- openflow_089_mpls/lib/stack.h 2010-08-10 06:03:52.000000000 -0700
+++ openflow-new/lib/stack.h 2012-10-07 07:30:10.000000000 -0700
@@ -45,6 +45,8 @@
void StackPush(stk_stack * theStack, DATA_TYPE newInfoPointer);
void * StackPop(stk_stack * theStack);
+#ifndef NS3
int StackNotEmpty(stk_stack *);
+#endif
#endif
diff -Naur openflow_089_mpls/switch/datapath.c openflow-new/switch/datapath.c
--- openflow_089_mpls/switch/datapath.c 2010-08-10 06:03:53.000000000 -0700
+++ openflow-new/switch/datapath.c 2012-10-07 08:29:36.000000000 -0700
@@ -106,8 +106,13 @@
const void *, size_t);
uint32_t save_buffer(struct ofpbuf *);
+#ifdef NS3
+struct ofpbuf *retrieve_buffer(uint32_t id);
+void discard_buffer(uint32_t id);
+#else
static struct ofpbuf *retrieve_buffer(uint32_t id);
static void discard_buffer(uint32_t id);
+#endif
static int port_no(struct datapath *dp, struct sw_port *p)
{
@@ -1271,9 +1276,9 @@
return 0;
}
-static int flow_stats_dump_callback(struct sw_flow *flow, void *private)
+static int flow_stats_dump_callback(struct sw_flow *flow, void *private_)
{
- struct flow_stats_state *s = private;
+ struct flow_stats_state *s = private_;
fill_flow_stats(s->buffer, flow, s->table_idx, s->now);
return s->buffer->size >= MAX_FLOW_STATS_BYTES;
@@ -1325,9 +1330,9 @@
return 0;
}
-static int aggregate_stats_dump_callback(struct sw_flow *flow, void *private)
+static int aggregate_stats_dump_callback(struct sw_flow *flow, void *private_)
{
- struct ofp_aggregate_stats_reply *rpy = private;
+ struct ofp_aggregate_stats_reply *rpy = private_;
rpy->packet_count += flow->packet_count;
rpy->byte_count += flow->byte_count;
rpy->flow_count++;
@@ -1868,7 +1873,11 @@
return id;
}
+#ifdef NS3
+struct ofpbuf *retrieve_buffer(uint32_t id)
+#else
static struct ofpbuf *retrieve_buffer(uint32_t id)
+#endif
{
struct ofpbuf *buffer = NULL;
struct packet_buffer *p;
@@ -1885,7 +1894,11 @@
return buffer;
}
+#ifdef NS3
+void discard_buffer(uint32_t id)
+#else
static void discard_buffer(uint32_t id)
+#endif
{
struct packet_buffer *p;
diff -Naur openflow_089_mpls/switch/dp_act.c openflow-new/switch/dp_act.c
--- openflow_089_mpls/switch/dp_act.c 2010-08-10 06:03:53.000000000 -0700
+++ openflow-new/switch/dp_act.c 2012-10-07 07:39:29.000000000 -0700
@@ -177,7 +177,11 @@
}
}
+#ifdef NS3
+void
+#else
static void
+#endif
set_vlan_vid(struct ofpbuf *buffer, struct sw_flow_key *key,
const struct ofp_action_header *ah)
{
@@ -187,7 +191,11 @@
modify_vlan_tci(buffer, key, tci, VLAN_VID_MASK);
}
+#ifdef NS3
+void
+#else
static void
+#endif
set_vlan_pcp(struct ofpbuf *buffer, struct sw_flow_key *key,
const struct ofp_action_header *ah)
{
@@ -197,7 +205,11 @@
modify_vlan_tci(buffer, key, tci, VLAN_PCP_MASK);
}
+#ifdef NS3
+void
+#else
static void
+#endif
strip_vlan(struct ofpbuf *buffer, struct sw_flow_key *key,
const struct ofp_action_header *ah)
{
@@ -205,7 +217,11 @@
key->flow.dl_vlan = htons(OFP_VLAN_NONE);
}
+#ifdef NS3
+void
+#else
static void
+#endif
set_dl_addr(struct ofpbuf *buffer, struct sw_flow_key *key,
const struct ofp_action_header *ah)
{
@@ -220,7 +236,11 @@
}
// MAH: start
+#ifdef NS3
+void
+#else
static void
+#endif
set_mpls_label(struct ofpbuf *buffer, struct sw_flow_key *key,
const struct ofp_action_header *ah)
{
@@ -228,7 +248,11 @@
set_mpls_label_act(buffer, key, ml->label_out);
}
+#ifdef NS3
+void
+#else
static void
+#endif
set_mpls_exp(struct ofpbuf *buffer, struct sw_flow_key *key,
const struct ofp_action_header *ah)
{
@@ -237,7 +261,11 @@
}
// MAH: end
+#ifdef NS3
+void
+#else
static void
+#endif
set_nw_addr(struct ofpbuf *buffer, struct sw_flow_key *key,
const struct ofp_action_header *ah)
{
@@ -268,7 +296,11 @@
}
}
+#ifdef NS3
+void
+#else
static void
+#endif
set_tp_port(struct ofpbuf *buffer, struct sw_flow_key *key,
const struct ofp_action_header *ah)
{
diff -Naur openflow_089_mpls/switch/pt_act.c openflow-new/switch/pt_act.c
--- openflow_089_mpls/switch/pt_act.c 2010-08-10 06:03:53.000000000 -0700
+++ openflow-new/switch/pt_act.c 2012-10-07 08:25:49.000000000 -0700
@@ -6,7 +6,11 @@
#include "csum.h"
#include "packets.h"
+#ifdef NS3
+void inline
+#else
static void inline
+#endif
update_checksums(struct ofpbuf *buffer, const struct sw_flow_key *key,
uint32_t old_word, uint32_t new_word) {
struct ip_header *nh = buffer->l3;
@@ -177,16 +181,22 @@
if (eth_proto == ETH_TYPE_MPLS_UNICAST) {
mpls_h.s = 0; // must be 0
// For a set of other allowed EtherTypes the current label is pushed as 'bottom-of-stack' label. Currently all EtherType values are accepted
- } else if ( 1 ) {
+#ifdef NS3
+ } else if (eth_proto == ETH_TYPE_IP) {
+#else
+ } else if ( 1 ) {
+#endif
mpls_h.s = 1; // bottom of stack
// also change the Ethertype to MPLS
eth_h->eth_type = htons(ETH_TYPE_MPLS_UNICAST);
+#ifndef NS3
} else {
//
// To Be Discussed: when the ethertype identifies an Ethernet related payload (e.g., ARP, LLDP), should/should not push the MPLS header?
// If SHOULD NOT: this 'else' branch should trigger some specific notification e.g., to controller.
//
- }
+#endif
+ }
// next determine where to get the ttl and exp bits
if (apm->flags & MPLS_PUSH_TTL_PREV) {
diff -Naur openflow_089_mpls/switch/switch.c openflow-new/switch/switch.c
--- openflow_089_mpls/switch/switch.c 2010-08-10 06:03:53.000000000 -0700
+++ openflow-new/switch/switch.c 2012-10-07 08:26:40.000000000 -0700
@@ -51,7 +51,9 @@
#include "rconn.h"
#include "timeval.h"
#include "vconn.h"
+#ifndef NS3
#include "vconn-ssl.h"
+#endif
#include "vlog-socket.h"
#define THIS_MODULE VLM_switch
@@ -79,6 +81,9 @@
static void add_ports(struct datapath *dp, char *port_list);
+#ifdef NS3
+/* ns-3 version is a library and should not have a main() function */
+#else
int
main(int argc, char *argv[])
{
@@ -136,6 +141,7 @@
return 0;
}
+#endif
static void
add_ports(struct datapath *dp, char *port_list)
diff -Naur openflow_089_mpls/switch/switch-flow.c openflow-new/switch/switch-flow.c
--- openflow_089_mpls/switch/switch-flow.c 2010-08-10 06:03:53.000000000 -0700
+++ openflow-new/switch/switch-flow.c 2012-10-07 08:20:32.000000000 -0700
@@ -43,9 +43,15 @@
#include "timeval.h"
/* Internal function used to compare fields in flow. */
+#ifdef NS3
+static inline int
+flow_fields_match(const struct flow *a, const struct flow *b, uint16_t w,
+ uint32_t src_mask, uint32_t dst_mask)
+#else
static inline int
flow_fields_match(const struct flow *a, const struct flow *b, uint32_t w,
uint32_t src_mask, uint32_t dst_mask) // 3rd Attribute type set to uint32_t from uint16_t
+#endif
{
// print_flow_(a, w);
//print_flow_(b, w);
@@ -170,6 +176,9 @@
// just assume that there is a second label
// the second will be wildcarded if we match on only one
// to->wildcards &= ~OFPFW_MPLS_L1; Do not clear WILDCARD of MPLS_1: It allows the controller to define "ANY" wildcard on MPLS label...
+#ifdef NS3
+ to->wildcards &= ~OFPFW_MPLS_L1;
+#endif
if (ntohl(to->flow.mpls_label1) >= 0x00100000) {
printf("Invalid first MPLS label %x\n", to->flow.mpls_label1);
}
@@ -177,9 +186,15 @@
// so set the mask bit
if (ntohl(to->flow.mpls_label2) < 0x00100000) {
// to->wildcards &= ~OFPFW_MPLS_L2; DO NOT ALTER WILDCARDs
+#ifdef NS3
+ to->wildcards &= ~OFPFW_MPLS_L2;
+#endif
}
// wildcard remaining headers
// to->wildcards |= OFPFW_NW | OFPFW_TP; SHOULD NOT wildcarding higher layer flow entries here if we insist on original OpenFlow concept (i.e., cross-layer switching)
+#ifdef NS3
+ to->wildcards |= OFPFW_NW | OFPFW_TP;
+#endif
// MAH: end
} else {
diff -Naur openflow_089_mpls/switch/switch-port.c openflow-new/switch/switch-port.c
--- openflow_089_mpls/switch/switch-port.c 2010-08-10 06:03:53.000000000 -0700
+++ openflow-new/switch/switch-port.c 2012-10-07 07:03:58.000000000 -0700
@@ -25,7 +25,7 @@
void PortEntryPrint(void* a) {
struct vport_table_entry *vpe = (struct vport_table_entry *)a;
- printf("VPortTableEntry:\nvport = %u actions_len = %u\n", vpe->vport, vpe->port_acts->actions_len);
+ printf("VPortTableEntry:\nvport = %u actions_len = %u\n", vpe->vport, (unsigned)vpe->port_acts->actions_len);
}
void PortEntryDest(void *a){
diff -Naur openflow_089_mpls/waf openflow-new/waf
--- openflow_089_mpls/waf 1969-12-31 16:00:00.000000000 -0800
+++ openflow-new/waf 2012-10-07 07:03:58.000000000 -0700
@@ -0,0 +1,162 @@
+#!/usr/bin/env python
+# encoding: ISO8859-1
+# Thomas Nagy, 2005-2010
+
+"""
+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.
+"""
+
+import os, sys
+if sys.hexversion<0x203000f: raise ImportError("Waf requires Python >= 2.3")
+
+if 'PSYCOWAF' in os.environ:
+ try:import psyco;psyco.full()
+ except:pass
+
+VERSION="1.5.16"
+REVISION="e6d03192b5ddfa5ef2c8d65308e48e42"
+INSTALL=''
+C1='#5'
+C2='#,'
+cwd = os.getcwd()
+join = os.path.join
+
+WAF='waf'
+def b(x):
+ return x
+
+if sys.hexversion>0x300000f:
+ WAF='waf3'
+ def b(x):
+ return x.encode()
+
+def err(m):
+ print(('\033[91mError: %s\033[0m' % m))
+ sys.exit(1)
+
+def unpack_wafdir(dir):
+ f = open(sys.argv[0],'rb')
+ c = "corrupted waf (%d)"
+ while 1:
+ line = f.readline()
+ if not line: err("run waf-light from a folder containing wafadmin")
+ if line == b('#==>\n'):
+ txt = f.readline()
+ if not txt: err(c % 1)
+ if f.readline()!=b('#<==\n'): err(c % 2)
+ break
+ if not txt: err(c % 3)
+ txt = txt[1:-1].replace(b(C1), b('\n')).replace(b(C2), b('\r'))
+
+ import shutil, tarfile
+ try: shutil.rmtree(dir)
+ except OSError: pass
+ try:
+ for x in ['Tools', '3rdparty']:
+ os.makedirs(join(dir, 'wafadmin', x))
+ except OSError:
+ err("Cannot unpack waf lib into %s\nMove waf into a writeable directory" % dir)
+
+ os.chdir(dir)
+ tmp = 't.bz2'
+ t = open(tmp,'wb')
+ t.write(txt)
+ t.close()
+
+ t = None
+ try:
+ t = tarfile.open(tmp)
+ except:
+ try:
+ os.system('bunzip2 t.bz2')
+ t = tarfile.open('t')
+ except:
+ os.chdir(cwd)
+ try: shutil.rmtree(dir)
+ except OSError: pass
+ err("Waf cannot be unpacked, check that bzip2 support is present")
+
+ for x in t: t.extract(x)
+ t.close()
+
+ for x in ['Tools', '3rdparty']:
+ os.chmod(join('wafadmin',x), 493)
+
+ if sys.hexversion>0x300000f:
+ sys.path = [join(dir, 'wafadmin')] + sys.path
+ import py3kfixes
+ py3kfixes.fixdir(dir)
+
+ os.chdir(cwd)
+
+def test(dir):
+ try: os.stat(join(dir, 'wafadmin')); return os.path.abspath(dir)
+ except OSError: pass
+
+def find_lib():
+ name = sys.argv[0]
+ base = os.path.dirname(os.path.abspath(name))
+
+ #devs use $WAFDIR
+ w=test(os.environ.get('WAFDIR', ''))
+ if w: return w
+
+ #waf-light
+ if name.endswith('waf-light'):
+ w = test(base)
+ if w: return w
+ err("waf-light requires wafadmin -> export WAFDIR=/folder")
+
+ dir = "/lib/%s-%s-%s/" % (WAF, VERSION, REVISION)
+ for i in [INSTALL,'/usr','/usr/local','/opt']:
+ w = test(i+dir)
+ if w: return w
+
+ #waf-local
+ s = '.%s-%s-%s'
+ if sys.platform == 'win32': s = s[1:]
+ dir = join(base, s % (WAF, VERSION, REVISION))
+ w = test(dir)
+ if w: return w
+
+ #unpack
+ unpack_wafdir(dir)
+ return dir
+
+wafdir = find_lib()
+w = join(wafdir, 'wafadmin')
+t = join(w, 'Tools')
+f = join(w, '3rdparty')
+sys.path = [w, t, f] + sys.path
+
+if __name__ == '__main__':
+ import Scripting
+ Scripting.prepare(t, cwd, VERSION, wafdir)
+
+#==>
+#BZh91AY&SY< H JH0B ,ap s#]vzW;-ʹV:.X{7ջknsVP^}m2kP7ȗl}Q;WT>vzځ˻vћo}| 1 @"; ;ey㷣iop4t [{lՃMO@z4٨" ]* T2((5C*-}ugsYqQgw- ʍ4Vxo;ڻȾom{tv뷯^K[#,y{ކۖw{0ѶuAZH5.;bH VݷAX{jXUaMm۫YGn=u]}nnNuӝ!}7k֣xǭU}J7cbr⚠oEO>K.}>jEvwofzznݪUլUj|ן|>Ogwo}ٔ|旵{۾3ywn]:.%ݻtɖ=wz{̀V#,JK@nu[AQs-]N 2es6헃)}n۾PQWymۺklFyWoUZwot|ܖϑ;rNF]k{}}jms y=Mrs