Permalink
Browse files

nox/rfproxy: Whitespace fixes

  • Loading branch information...
joestringer committed Nov 25, 2012
1 parent 56f70a9 commit 47acb7559ac1b6c7fd9f21581868f151e02210f4
@@ -40,7 +40,7 @@ bool rfproxy::send_of_msg(uint64_t dp_id, uint8_t* msg) {
bool rfproxy::send_packet_out(uint64_t dp_id, uint32_t port, Buffer& data) {
- if (send_openflow_packet(datapathid::from_host(dp_id), data, port,
+ if (send_openflow_packet(datapathid::from_host(dp_id), data, port,
OFPP_NONE, true))
return FAILURE;
else
@@ -72,7 +72,7 @@ void rfproxy::flow_add(uint64_t dp_id,
src_hwaddress.toArray(src_hwaddress_);
uint8_t dst_hwaddress_[IFHWADDRLEN];
dst_hwaddress.toArray(dst_hwaddress_);
-
+
MSG ofmsg = create_flow_install_msg(address_, netmask_,
src_hwaddress_, dst_hwaddress_,
dst_port);
@@ -95,7 +95,7 @@ void rfproxy::flow_delete(uint64_t dp_id,
uint32_t netmask_ = netmask.toCIDRMask();
uint8_t src_hwaddress_[IFHWADDRLEN];
src_hwaddress.toArray(src_hwaddress_);
-
+
MSG ofmsg1 = create_flow_remove_msg(address_, netmask_, src_hwaddress_);
if (send_of_msg(dp_id, ofmsg1) == SUCCESS)
VLOG_INFO(lg,
@@ -142,14 +142,14 @@ Disposition rfproxy::on_datapath_up(const Event& e) {
Disposition rfproxy::on_datapath_down(const Event& e) {
const Datapath_leave_event& dl = assert_cast<const Datapath_leave_event&> (e);
uint64_t dp_id = dl.datapath_id.as_host();
-
+
VLOG_INFO(lg,
"Datapath is down (dp_id=0x%llx)",
dp_id);
-
+
// Delete internal entry
table.delete_dp(dp_id);
-
+
// Notify RFServer
DatapathDown dd(dp_id);
ipc->send(RFSERVER_RFPROXY_CHANNEL, RFSERVER_ID, dd);
@@ -48,41 +48,41 @@ struct eth_data {
// Association table
typedef pair<uint64_t, uint32_t> PORT;
-// We can do this because there can't be a 0xff... datapath ID or port
+// We can do this because there can't be a 0xff... datapath ID or port
PORT NONE = PORT(-1, -1);
class Table {
public:
- void update_dp_port(uint64_t dp_id, uint32_t dp_port,
+ void update_dp_port(uint64_t dp_id, uint32_t dp_port,
uint64_t vs_id, uint32_t vs_port) {
map<PORT, PORT>::iterator it;
it = dp_to_vs.find(PORT(dp_id, dp_port));
if (it != dp_to_vs.end()) {
PORT old_vs_port = dp_to_vs[PORT(dp_id, dp_port)];
vs_to_dp.erase(old_vs_port);
}
-
+
dp_to_vs[PORT(dp_id, dp_port)] = PORT(vs_id, vs_port);
vs_to_dp[PORT(vs_id, vs_port)] = PORT(dp_id, dp_port);
}
-
+
PORT dp_port_to_vs_port(uint64_t dp_id, uint32_t dp_port) {
map<PORT, PORT>::iterator it;
it = dp_to_vs.find(PORT(dp_id, dp_port));
if (it == dp_to_vs.end())
return NONE;
-
+
return dp_to_vs[PORT(dp_id, dp_port)];
}
-
+
PORT vs_port_to_dp_port(uint64_t vs_id, uint32_t vs_port) {
map<PORT, PORT>::iterator it;
it = vs_to_dp.find(PORT(vs_id, vs_port));
if (it == vs_to_dp.end())
return NONE;
-
+
return vs_to_dp[PORT(vs_id, vs_port)];
}
-
+
void delete_dp(uint64_t dp_id) {
map<PORT, PORT>::iterator it = dp_to_vs.begin();
while (it != dp_to_vs.end()) {
@@ -100,24 +100,24 @@ class Table {
++it;
}
}
-
+
private:
map<PORT, PORT> dp_to_vs;
map<PORT, PORT> vs_to_dp;
};
-class rfproxy : public Component, private IPCMessageProcessor
+class rfproxy : public Component, private IPCMessageProcessor
{
private:
IPCMessageService* ipc;
IPCMessageProcessor *processor;
RFProtocolFactory *factory;
Table table;
-
+
// Base methods
bool send_of_msg(uint64_t dp_id, uint8_t* msg);
bool send_packet_out(uint64_t dp_id, uint32_t port, Buffer& data);
-
+
// Flow installation methods
void flow_config(uint64_t dp_id, uint32_t operation_id);
void flow_add(uint64_t dp_id,
@@ -132,17 +132,17 @@ class rfproxy : public Component, private IPCMessageProcessor
Disposition on_datapath_up(const Event& e);
Disposition on_datapath_down(const Event& e);
Disposition on_packet_in(const Event& e);
-
+
// IPC message processing
bool process(const string &from, const string &to, const string &channel, IPCMessage& msg);
-
+
public:
// Initialization
rfproxy(const Context* c, const json_object* node) : Component(c) {}
void configure(const Configuration* c);
void install();
static void getInstance(const container::Context* c, rfproxy*& component);
-
+
};
}
#endif
View
@@ -53,7 +53,7 @@ void FlowTable::start(uint64_t vm_id, map<string, Interface> interfaces, IPCMess
FlowTable::interfaces = interfaces;
FlowTable::ipc = ipc;
FlowTable::down_ports = down_ports;
-
+
rtnl_open(&rth, RTMGRP_IPV4_MROUTE | RTMGRP_IPV4_ROUTE | RTMGRP_IPV6_MROUTE | RTMGRP_IPV6_ROUTE);
rtnl_open(&rthNeigh, RTMGRP_NEIGH);
@@ -319,7 +319,7 @@ bool FlowTable::is_port_down(uint32_t port) {
void FlowTable::addFlowToHw(const RouteEntry& rentry) {
if (is_port_down(rentry.interface.port))
return;
-
+
list<HostEntry>::iterator iter;
MACAddress dstMac;
@@ -367,7 +367,7 @@ void FlowTable::addFlowToHw(const RouteEntry& rentry) {
void FlowTable::addFlowToHw(const HostEntry& hentry) {
if (is_port_down(hentry.interface.port))
return;
-
+
RouteInfo msg;
msg.set_is_removal(false);
msg.set_vm_id(FlowTable::vm_id);
@@ -389,7 +389,7 @@ void FlowTable::delFlowFromHw(const RouteEntry& rentry) {
// The MAC address of the next-hop is useless when deleting flows.
if (is_port_down(rentry.interface.port))
return;
-
+
RouteInfo msg;
msg.set_is_removal(true);
msg.set_vm_id(FlowTable::vm_id);
@@ -409,7 +409,7 @@ void FlowTable::delFlowFromHw(const RouteEntry& rentry) {
void FlowTable::delFlowFromHw(const HostEntry& hentry) {
if (is_port_down(hentry.interface.port))
return;
-
+
RouteInfo msg;
msg.set_is_removal(true);
msg.set_vm_id(FlowTable::vm_id);
View
@@ -269,4 +269,4 @@ class DataPlaneMap : public IPCMessage {
uint32_t vs_port;
};
-#endif /* __RFPROTOCOL_H__ */
+#endif /* __RFPROTOCOL_H__ */
View
@@ -48,13 +48,11 @@ void ofm_init(ofp_flow_mod* ofm, size_t size) {
}
void ofm_match_in(ofp_flow_mod* ofm, uint16_t in) {
-
ofm->match.wildcards &= htonl(~OFPFW_IN_PORT);
ofm->match.in_port = htons(in);
}
void ofm_match_dl(ofp_flow_mod* ofm, uint32_t match, uint16_t type, const uint8_t src[], const uint8_t dst[]) {
-
ofm->match.wildcards &= htonl(~match);
if (match & OFPFW_DL_TYPE) { /* Ethernet frame type. */
@@ -196,15 +194,15 @@ MSG create_flow_install_msg(uint32_t ip, uint32_t mask, uint8_t srcMac[], uint8_
ofm_init(ofm, size);
- ofm_match_dl(ofm, OFPFW_DL_TYPE , 0x0800, 0, 0);
+ ofm_match_dl(ofm, OFPFW_DL_TYPE, 0x0800, 0, 0);
if (MATCH_L2)
- ofm_match_dl(ofm, OFPFW_DL_DST, 0, 0, srcMac);
+ ofm_match_dl(ofm, OFPFW_DL_DST, 0, 0, srcMac);
ofm_match_nw(ofm, (((uint32_t) 31 + mask) << OFPFW_NW_DST_SHIFT), 0, 0, 0, ip);
ofm_set_command(ofm, OFPFC_ADD, UINT32_MAX, OFP_FLOW_PERMANENT, OFP_FLOW_PERMANENT, OFPP_NONE);
if (mask == 32) {
- ofm->idle_timeout = htons(300);
+ ofm->idle_timeout = htons(300);
}
ofm->priority = htons((OFP_DEFAULT_PRIORITY + mask));
@@ -227,7 +225,7 @@ MSG create_flow_install_msg(uint32_t ip, uint32_t mask, uint8_t srcMac[], uint8_
MSG create_flow_remove_msg(uint32_t ip, uint32_t mask, uint8_t srcMac[]) {
ip = htonl(ip);
-
+
ofp_flow_mod* ofm;
size_t size = sizeof *ofm;
boost::shared_array<char> raw_of(new char[size]);
@@ -237,7 +235,7 @@ MSG create_flow_remove_msg(uint32_t ip, uint32_t mask, uint8_t srcMac[]) {
ofm_match_dl(ofm, OFPFW_DL_TYPE , 0x0800, 0, 0);
if (MATCH_L2)
- ofm_match_dl(ofm, OFPFW_DL_DST, 0, 0, srcMac);
+ ofm_match_dl(ofm, OFPFW_DL_DST, 0, 0, srcMac);
ofm_match_nw(ofm, (((uint32_t) 31 + mask) << OFPFW_NW_DST_SHIFT), 0, 0, 0, ip);
@@ -249,7 +247,7 @@ MSG create_flow_remove_msg(uint32_t ip, uint32_t mask, uint8_t srcMac[]) {
MSG create_temporary_flow_msg(uint32_t ip, uint32_t mask, uint8_t srcMac[]) {
ip = htonl(ip);
-
+
ofp_flow_mod* ofm;
size_t size = sizeof *ofm + sizeof(ofp_action_output);
boost::shared_array<char> raw_of(new char[size]);
@@ -259,7 +257,7 @@ MSG create_temporary_flow_msg(uint32_t ip, uint32_t mask, uint8_t srcMac[]) {
ofm_match_dl(ofm, OFPFW_DL_TYPE , 0x0800, 0, 0);
if (MATCH_L2)
- ofm_match_dl(ofm, OFPFW_DL_DST, 0, 0, srcMac);
+ ofm_match_dl(ofm, OFPFW_DL_DST, 0, 0, srcMac);
ofm_match_nw(ofm, (((uint32_t) 31 + mask) << OFPFW_NW_DST_SHIFT), 0, 0, 0, ip);
@@ -275,10 +273,10 @@ int main() {
// Garbage just to look pretty in the tests
uint8_t a[6];
uint8_t b[6];
-
+
MSG msg = create_flow_install_msg(0xEEAABBCC, 24, a, b, 123);
msg_save(msg, "install");
-
+
msg = create_config_msg(DC_RIPV2);
msg_save(msg, "config");
}

0 comments on commit 47acb75

Please sign in to comment.