Browse Source

Swapped order of args to Iface_Callback

Caleb James DeLisle 9 years ago
parent
commit
85057c688e

+ 1 - 1
admin/Admin.c

@@ -444,7 +444,7 @@ static void handleMessage(struct Message* message,
     handleRequest(messageDict, message, src, alloc, admin);
 }
 
-static Iface_DEFUN receiveMessage(struct Iface* iface, struct Message* message)
+static Iface_DEFUN receiveMessage(struct Message* message, struct Iface* iface)
 {
     struct Admin_pvt* admin = Identity_check((struct Admin_pvt*) iface);
 

+ 1 - 1
admin/AdminClient.c

@@ -114,7 +114,7 @@ static void timeout(void* vreq)
     done((struct Request*) vreq, AdminClient_Error_TIMEOUT);
 }
 
-static Iface_DEFUN receiveMessage(struct Iface* addrIface, struct Message* msg)
+static Iface_DEFUN receiveMessage(struct Message* msg, struct Iface* addrIface)
 {
     struct Context* ctx = Identity_containerOf(addrIface, struct Context, addrIface);
 

+ 1 - 1
admin/angel/Hermes.c

@@ -74,7 +74,7 @@ static void timeout(void* vrequest)
     Allocator_free(req->alloc);
 }
 
-static Iface_DEFUN receiveMessage(struct Iface* iface, struct Message* msg)
+static Iface_DEFUN receiveMessage(struct Message* msg, struct Iface* iface)
 {
     struct Hermes* hermes = Identity_check((struct Hermes*) iface);
     struct Allocator* tempAlloc = msg->alloc;

+ 1 - 1
admin/angel/InterfaceWaiter.c

@@ -41,7 +41,7 @@ static void timeout(void* vcontext)
     EventBase_endLoop(ctx->eventBase);
 }
 
-static Iface_DEFUN receiveMessage(struct Iface* iface, struct Message* message)
+static Iface_DEFUN receiveMessage(struct Message* message, struct Iface* iface)
 {
     struct Context* ctx = Identity_check((struct Context*) iface);
     if (ctx->messageReceived) { return 0; }

+ 1 - 1
contrib/c/sybilsim.c

@@ -66,7 +66,7 @@ struct NodeContext {
     Identity
 };
 
-static Iface_DEFUN messageToAngel(struct Iface* iface, struct Message* msg)
+static Iface_DEFUN messageToAngel(struct Message* msg, struct Iface* iface)
 {
     struct NodeContext* ctx = Identity_check((struct NodeContext*) iface);
     if (ctx->boundAddr) { return 0; }

+ 2 - 2
crypto/CryptoAuth_benchmark.c

@@ -55,13 +55,13 @@ struct Context
     Identity
 };
 
-static Iface_DEFUN transferMessage1(struct Iface* iface, struct Message* message)
+static Iface_DEFUN transferMessage1(struct Message* message, struct Iface* iface)
 {
     struct Context* ctx = Identity_containerOf(iface, struct Context, if1);
     return otherIface->receiveMessage(message, otherIface);
 }
 
-static Iface_DEFUN transferMessage2(struct Iface* iface, struct Message* message)
+static Iface_DEFUN transferMessage2(struct Message* message, struct Iface* iface)
 {
     struct Context* ctx = Identity_containerOf(iface, struct Context, if2);
 // XXX

+ 1 - 1
dht/DHTCoreInterface.c

@@ -58,7 +58,7 @@ static int incomingFromDHT(struct DHTMessage* dmessage, void* vcim)
     return Iface_send(&cim->pub.coreIf, msg);
 }
 
-static Iface_DEFUN incomingFromCore(struct Iface* coreIf, struct Message* msg)
+static Iface_DEFUN incomingFromCore(struct Message* msg, struct Iface* coreIf)
 {
     struct DHTCoreInterface_pvt* cim = Identity_check((struct DHTCoreInterface_pvt*) coreIf);
 

+ 1 - 1
dht/Pathfinder.c

@@ -308,7 +308,7 @@ static Iface_DEFUN incomingMsg(struct Message* msg, struct Pathfinder_pvt* pf)
     return NULL;
 }
 
-static Iface_DEFUN incomingFromEventIf(struct Iface* eventIf, struct Message* msg)
+static Iface_DEFUN incomingFromEventIf(struct Message* msg, struct Iface* eventIf)
 {
     struct Pathfinder_pvt* pf = Identity_containerOf(eventIf, struct Pathfinder_pvt, eventIf);
     enum PFChan_Core ev = Message_pop32(msg, NULL);

+ 1 - 1
interface/DNSServer.c

@@ -559,7 +559,7 @@ static Iface_DEFUN receiveB(struct Message* msg, struct DNSServer_pvt* ctx, stru
     }
 }
 
-static Iface_DEFUN receiveMessage(struct Iface* iface, struct Message* msg)
+static Iface_DEFUN receiveMessage(struct Message* msg, struct Iface* iface)
 {
     struct DNSServer_pvt* const ctx = Identity_containerOf(iface, struct DNSServer_pvt, iface);
 

+ 1 - 1
interface/ETHInterface_linux.c

@@ -95,7 +95,7 @@ static void sendMessageInternal(struct Message* message,
     return;
 }
 
-static Iface_DEFUN sendMessage(struct Iface* iface, struct Message* msg)
+static Iface_DEFUN sendMessage(struct Message* msg, struct Iface* iface)
 {
     struct ETHAddrIface_pvt* ctx =
         Identity_containerOf(iface, struct ETHAddrIface_pvt, pub.generic.iface);

+ 9 - 9
interface/FramingIface.c

@@ -73,7 +73,7 @@ static struct Message* mergeMessage(struct FramingIface_pvt* fi, struct Message*
     return out;
 }
 
-static Iface_DEFUN receiveMessage(struct Iface* iface, struct Message* msg)
+static Iface_DEFUN receiveMessage(struct Message* msg, struct Iface* iface)
 {
     struct FramingIface_pvt* fi = Identity_containerOf(streamIf, struct FramingIface_pvt, streamIf);
 
@@ -91,9 +91,8 @@ static Iface_DEFUN receiveMessage(struct Iface* iface, struct Message* msg)
             struct Allocator* frameAlloc = fi->frameAlloc;
             fi->frameAlloc = NULL;
             // Run the message through again since it's almost certainly not perfect size.
-            uint8_t ret = receiveMessage(wholeMessage, iface);
+            Iface_CALL(receiveMessage, wholeMessage, iface);
             Allocator_free(frameAlloc);
-            return ret;
         }
         fi->bytesRemaining -= msg->length;
         Allocator_adopt(fi->frameAlloc, msg->alloc);
@@ -101,13 +100,13 @@ static Iface_DEFUN receiveMessage(struct Iface* iface, struct Message* msg)
         parts->msg = msg;
         parts->next = fi->frameParts;
         fi->frameParts = parts;
-        return Error_NONE;
+        return NULL;
     }
 
     for (;;) {
         while (fi->headerIndex < 4) {
             if (!msg->length) {
-                return Error_NONE;
+                return NULL;
             }
             fi->header.bytes[fi->headerIndex] = msg->bytes[0];
             Message_shift(msg, -1, NULL);
@@ -117,13 +116,14 @@ static Iface_DEFUN receiveMessage(struct Iface* iface, struct Message* msg)
 
         fi->bytesRemaining = Endian_bigEndianToHost32(fi->header.length_be);
         if (fi->bytesRemaining > fi->maxMessageSize) {
-            return Error_OVERSIZE_MESSAGE;
+            // oversize
+            return NULL;
         }
 
         if (fi->bytesRemaining == (uint32_t)msg->length) {
             Iface_send(&fi->generic, msg);
             fi->bytesRemaining = 0;
-            return Error_NONE;
+            return NULL;
 
         } else if (fi->bytesRemaining <= (uint32_t)msg->length) {
             struct Message* m = Allocator_clone(msg->alloc, msg);
@@ -148,11 +148,11 @@ static Iface_DEFUN receiveMessage(struct Iface* iface, struct Message* msg)
             fi->frameParts->msg = m;
             fi->frameParts->next = NULL;
         }
-        return Error_NONE;
+        return NULL;
     }
 }
 
-static Iface_DEFUN sendMessage(struct Iface* messageIf, struct Message* msg)
+static Iface_DEFUN sendMessage(struct Message* msg, struct Iface* messageIf)
 {
     struct FramingIface_pvt* fi =
         Identity_containerOf(messageIf, struct FramingIface_pvt, messageIf);

+ 3 - 3
interface/Iface.h

@@ -25,7 +25,7 @@ struct Iface;
  * @param thisInterface the interface which contains the sendMessage function pointer.
  * @param message the message
  */
-typedef struct Iface* (* Iface_Callback)(struct Iface* thisInterface, struct Message* message);
+typedef struct Iface* (* Iface_Callback)(struct Message* message, struct Iface* thisInterface);
 
 #define Iface_DEFUN __attribute__ ((warn_unused_result)) struct Iface*
 
@@ -55,7 +55,7 @@ static inline void Iface_send(struct Iface* iface, struct Message* msg)
             iface->currentMsg = msg;
         #endif
         #ifdef PARANOIA
-            struct Iface* ifaceNext = conn->send(conn, msg);
+            struct Iface* ifaceNext = conn->send(msg, conn);
             msg->currentIface = NULL;
             iface->currentMsg = NULL;
             iface = ifaceNext;
@@ -90,7 +90,7 @@ static inline Iface_DEFUN Iface_next(struct Iface* iface, struct Message* msg)
 #define Iface_CALL(func, msg, ...) \
     do {                                                      \
         struct Iface* Iface_x = func(msg, __VA_ARGS__);       \
-        if (Iface_x) { Iface_send(Iface_x, msg); }            \
+        if (Iface_x) { Iface_send(msg, Iface_x); }            \
     } while (0)
 // CHECKFILES_IGNORE missing ;
 

+ 1 - 1
interface/RainflyClient.c

@@ -307,7 +307,7 @@ static Iface_DEFUN handleHotKeysReply(struct Message* msg, struct RainflyClient_
     return NULL;
 }
 
-static Iface_DEFUN receiveMessage(struct Iface* iface, struct Message* msg)
+static Iface_DEFUN receiveMessage(struct Message* msg, struct Iface* iface)
 {
     struct RainflyClient_pvt* ctx = Identity_check((struct RainflyClient_pvt*)iface);
 

+ 2 - 2
interface/addressable/AddrIfaceAdapter.c

@@ -29,7 +29,7 @@ struct AddrIfaceAdapter_pvt
     Identity
 };
 
-static Iface_DEFUN incomingFromAddrIf(struct Iface* addrIf, struct Message* msg)
+static Iface_DEFUN incomingFromAddrIf(struct Message* msg, struct Iface* addrIf)
 {
     struct AddrIfaceAdapter_pvt* ctx =
         Identity_containerOf(addrIf, struct AddrIfaceAdapter_pvt, pub.generic.iface);
@@ -38,7 +38,7 @@ static Iface_DEFUN incomingFromAddrIf(struct Iface* addrIf, struct Message* msg)
     return Iface_next(&ctx->pub.inputIf, msg);
 }
 
-static Iface_DEFUN incomingFromInputIf(struct Iface* inputIf, struct Message* msg)
+static Iface_DEFUN incomingFromInputIf(struct Message* msg, struct Iface* inputIf)
 {
     struct AddrIfaceAdapter_pvt* ctx =
         Identity_containerOf(inputIf, struct AddrIfaceAdapter_pvt, pub.inputIf);

+ 2 - 2
interface/addressable/PacketHeaderToUDPAddrIface.c

@@ -27,7 +27,7 @@ struct PacketHeaderToUDPAddrIface_pvt
     Identity
 };
 
-static Iface_DEFUN incomingFromUdpIf(struct Iface* udpIf, struct Message* message)
+static Iface_DEFUN incomingFromUdpIf(struct Message* message, struct Iface* udpIf)
 {
     struct PacketHeaderToUDPAddrIface_pvt* context =
         Identity_containerOf(udpIf, struct PacketHeaderToUDPAddrIface_pvt, pub.udpIf.iface);
@@ -63,7 +63,7 @@ static Iface_DEFUN incomingFromUdpIf(struct Iface* udpIf, struct Message* messag
     return Iface_next(&context->pub.headerIf, message);
 }
 
-static Iface_DEFUN incomingFromHeaderIf(struct Iface* iface, struct Message* message)
+static Iface_DEFUN incomingFromHeaderIf(struct Message* message, struct Iface* iface)
 {
     struct PacketHeaderToUDPAddrIface_pvt* context =
         Identity_check((struct PacketHeaderToUDPAddrIface_pvt*)

+ 2 - 2
interface/tuntap/TUNInterface_sunos.c

@@ -59,7 +59,7 @@ static uint16_t ethertypeForPacketType(uint8_t highByte)
     return ((highByte >> 4) == 6) ? Ethernet_TYPE_IP6 : Ethernet_TYPE_IP4;
 }
 
-static Iface_DEFUN incomingFromWire(struct Iface* externalIf, struct Message* message)
+static Iface_DEFUN incomingFromWire(struct Message* message, struct Iface* externalIf)
 {
     struct TUNInterface_Illumos_pvt* ctx =
         Identity_containerOf(externalIf, struct TUNInterface_Illumos_pvt, externalIf);
@@ -75,7 +75,7 @@ static Iface_DEFUN incomingFromWire(struct Iface* externalIf, struct Message* me
     return Iface_next(&ctx->internalIf, message);
 }
 
-static Iface_DEFUN incomingFromUs(struct Iface* internalIf, struct Message* message)
+static Iface_DEFUN incomingFromUs(struct Message* message, struct Iface* internalIf)
 {
     struct TUNInterface_Illumos_pvt* ctx =
         Identity_containerOf(internalIf, struct TUNInterface_Illumos_pvt, internalIf);

+ 2 - 2
interface/tuntap/test/TUNTools.c

@@ -102,14 +102,14 @@ static Iface_DEFUN TUNTools_genericIP6Echo(struct TUNTools* tt, struct Message*
     return Iface_next(tt->tunIface, msg);
 }
 
-static Iface_DEFUN receiveMessageTUN(struct Iface* tunIface, struct Message* msg)
+static Iface_DEFUN receiveMessageTUN(struct Message* msg, struct Iface* tunIface)
 {
     struct TUNTools_pvt* ctx = Identity_containerOf(tunIface, struct TUNTools_pvt, pub.tunIface);
     ctx->pub.receivedMessageTUNCount++;
     return ctx->pub.cb(ctx, msg);
 }
 
-static Iface_DEFUN receiveMessageUDP(struct Iface* udpIface, struct Message* msg)
+static Iface_DEFUN receiveMessageUDP(struct Message* msg, struct Iface* udpIface)
 {
     struct Context* ctx = Identity_containerOf(udpIface, struct Context, pub.udpIface);
 

+ 2 - 2
net/ControlHandler.c

@@ -138,7 +138,7 @@ static Iface_DEFUN handlePing(struct Message* msg,
  * @param switchIf the interface which leads to the switch.
  * @param isFormV8 true if the control message is in the form specified by protocol version 8+
  */
-static Iface_DEFUN incomingFromCore(struct Iface* coreIf, struct Message* msg)
+static Iface_DEFUN incomingFromCore(struct Message* msg, struct Iface* coreIf)
 {
     struct ControlHandler_pvt* ch = Identity_check((struct ControlHandler_pvt*) coreIf);
 
@@ -187,7 +187,7 @@ static Iface_DEFUN incomingFromCore(struct Iface* coreIf, struct Message* msg)
 }
 
 // Forward from switch pinger directly to core.
-static Iface_DEFUN incomingFromSwitchPinger(struct Iface* switchPingerIf, struct Message* msg)
+static Iface_DEFUN incomingFromSwitchPinger(struct Message* msg, struct Iface* switchPingerIf)
 {
     struct ControlHandler_pvt* ch =
         Identity_containerOf(switchPingerIf, struct ControlHandler_pvt, pub.switchPingerIf);

+ 1 - 1
net/ConverterV15.c

@@ -143,7 +143,7 @@ static inline bool tryConvertDHT(struct Message* msg, struct Headers_IP6Header*
  * Incoming packet with a SessionManager header and under that either an ipv6 or ipv4 header
  * depending on whether it's destine for TUN/DHT or IpTunnel.
  */
-static Iface_DEFUN incomingFromSessionManagerIf(struct Iface* sessionManagerIf, struct Message* msg)
+static Iface_DEFUN incomingFromSessionManagerIf(struct Message* msg, struct Iface* sessionManagerIf)
 {
     struct ConverterV15_pvt* conv =
         Identity_containerOf(sessionManagerIf, struct ConverterV15_pvt, pub.sessionManagerIf);

+ 3 - 3
net/Ducttape.c

@@ -109,7 +109,7 @@ static struct Ducttape_MessageHeader* getDtHeader(struct Message* message, bool
 
 // [ struct Address ][ content (benc) ]
 // see ducttape.h -> dhtIf
-static Iface_DEFUN incomingFromDHTInterface(struct Iface* dhtIf, struct Message* msg)
+static Iface_DEFUN incomingFromDHTInterface(struct Message* msg, struct Iface* dhtIf)
 {
     struct Ducttape_pvt* ctx = Identity_containerOf(dhtIf, struct Ducttape_pvt, pub.dhtIf);
 
@@ -372,7 +372,7 @@ static inline bool isForMe(struct Message* message, struct Ducttape_pvt* context
     return (Bits_memcmp(header->destinationAddr, context->myAddr.ip6.bytes, 16) == 0);
 }
 
-static Iface_DEFUN incomingFromMagicInterface(struct Iface* magicIf, struct Message* msg)
+static Iface_DEFUN incomingFromMagicInterface(struct Message* msg, struct Iface* magicIf)
 {
     struct Ducttape_pvt* ctx = Identity_containerOf(magicIf, struct Ducttape_pvt, pub.magicIf);
 
@@ -956,7 +956,7 @@ static uint8_t incomingFromSwitch(struct Message* message, struct Iface* switchI
     return 0;
 }
 
-static Iface_DEFUN incomingFromControlHandler(struct Iface* controlIf, struct Message* message)
+static Iface_DEFUN incomingFromControlHandler(struct Message* message, struct Iface* controlIf)
 {
     struct Ducttape_pvt* ctx = Identity_containerOf(controlIf, struct Ducttape_pvt, pub.controlIf);
     Assert_true(ctx->pub.switchIf.receiveMessage);

+ 2 - 2
net/EventEmitter.c

@@ -160,7 +160,7 @@ static bool PFChan_Core_sizeOk(enum PFChan_Core ev, int size)
 Assert_compileTime(PFChan_Core__TOO_LOW == 1023);
 Assert_compileTime(PFChan_Core__TOO_HIGH == 1037);
 
-static Iface_DEFUN incomingFromCore(struct Iface* trickIf, struct Message* msg)
+static Iface_DEFUN incomingFromCore(struct Message* msg, struct Iface* trickIf)
 {
     struct EventEmitter_pvt* ee = Identity_containerOf(trickIf, struct EventEmitter_pvt, trickIf);
     Assert_true(!((uintptr_t)msg->bytes % 4) && "alignment");
@@ -267,7 +267,7 @@ static int handleFromPathfinder(enum PFChan_Pathfinder ev,
     return true;
 }
 
-static Iface_DEFUN incomingFromPathfinder(struct Iface* iface, struct Message* msg)
+static Iface_DEFUN incomingFromPathfinder(struct Message* msg, struct Iface* iface)
 {
     struct Pathfinder* pf = Identity_containerOf(iface, struct Pathfinder, iface);
     struct EventEmitter_pvt* ee = Identity_check((struct EventEmitter_pvt*) pf->ee);

+ 2 - 2
net/IfController.c

@@ -702,7 +702,7 @@ static Iface_DEFUN handleUnexpectedIncoming(struct Message* msg, struct IfContro
     return NULL;
 }
 
-static Iface_DEFUN handleIncomingFromWire(struct Iface* addrIf, struct Message* msg)
+static Iface_DEFUN handleIncomingFromWire(struct Message* msg, struct Iface* addrIf)
 {
     struct IfController_Iface_pvt* ici =
         Identity_containerOf(addrIf, struct IfController_Iface_pvt, pub.addrIf);
@@ -990,7 +990,7 @@ int IfController_disconnectPeer(struct IfController* ifController,
     return IfController_disconnectPeer_NOTFOUND;
 }
 
-static Iface_DEFUN incomingFromEventEmitterIf(struct Iface* eventEmitterIf, struct Message* msg)
+static Iface_DEFUN incomingFromEventEmitterIf(struct Message* msg, struct Iface* eventEmitterIf)
 {
     struct IfController_pvt* ic =
          Identity_containerOf(eventEmitterIf, struct IfController_pvt, eventEmitterIf);

+ 3 - 3
net/SessionManager.c

@@ -202,7 +202,7 @@ static struct SessionManager_Session_pvt* getSession(struct SessionManager_pvt*
     return sess;
 }
 
-static Iface_DEFUN incomingFromSwitchIf(struct Iface* iface, struct Message* msg)
+static Iface_DEFUN incomingFromSwitchIf(struct Message* msg, struct Iface* iface)
 {
     struct SessionManager_pvt* sm =
         Identity_containerOf(iface, struct SessionManager_pvt, pub.switchIf);
@@ -399,7 +399,7 @@ static Iface_DEFUN readyToSend(struct Message* msg,
     return Iface_next(&sm->pub.switchIf, msg);
 }
 
-static Iface_DEFUN incomingFromInsideIf(struct Iface* iface, struct Message* msg)
+static Iface_DEFUN incomingFromInsideIf(struct Message* msg, struct Iface* iface)
 {
     struct SessionManager_pvt* sm =
         Identity_containerOf(iface, struct SessionManager_pvt, pub.insideIf);
@@ -479,7 +479,7 @@ static Iface_DEFUN sessions(struct SessionManager_pvt* sm,
     return NULL;
 }
 
-static Iface_DEFUN incomingFromEventIf(struct Iface* iface, struct Message* msg)
+static Iface_DEFUN incomingFromEventIf(struct Message* msg, struct Iface* iface)
 {
     struct SessionManager_pvt* sm = Identity_containerOf(iface, struct SessionManager_pvt, eventIf);
     enum PFChan_Pathfinder ev = Message_pop32(msg, NULL);

+ 3 - 3
net/SwitchAdapter.c

@@ -33,21 +33,21 @@ struct Header {
 #define Header_SIZE 16
 Assert_compileTime(sizeof(struct Header) == Header_SIZE);
 
-static Iface_DEFUN incomingFromControlIf(struct Iface* controlIf, struct Message* msg)
+static Iface_DEFUN incomingFromControlIf(struct Message* msg, struct Iface* controlIf)
 {
     struct SwitchAdapter_pvt* sa =
         Identity_containerOf(controlIf, struct SwitchAdapter_pvt, pub.controlIf);
     return Iface_next(&sa->pub.switchIf, msg);
 }
 
-static Iface_DEFUN incomingFromSessionManagerIf(struct Iface* sessionManagerIf, struct Message* msg)
+static Iface_DEFUN incomingFromSessionManagerIf(struct Message* msg, struct Iface* sessionManagerIf)
 {
     struct SwitchAdapter_pvt* sa =
         Identity_containerOf(sessionManagerIf, struct SwitchAdapter_pvt, pub.sessionManagerIf);
     return Iface_next(&sa->pub.switchIf, msg);
 }
 
-static Iface_DEFUN incomingFromSwitchIf(struct Iface* switchIf, struct Message* msg)
+static Iface_DEFUN incomingFromSwitchIf(struct Message* msg, struct Iface* switchIf)
 {
     struct SwitchAdapter_pvt* sa =
         Identity_containerOf(switchIf, struct SwitchAdapter_pvt, pub.switchIf);

+ 1 - 1
net/SwitchPinger.c

@@ -76,7 +76,7 @@ struct Ping
 };
 
 // incoming message from network, pointing to the beginning of the switch header.
-static Iface_DEFUN messageFromControlHandler(struct Iface* iface, struct Message* msg)
+static Iface_DEFUN messageFromControlHandler(struct Message* msg, struct Iface* iface)
 {
     struct SwitchPinger_pvt* ctx = Identity_check((struct SwitchPinger_pvt*) iface);
     struct SwitchHeader* switchHeader = (struct SwitchHeader*) msg->bytes;

+ 2 - 2
net/TUNAdapter.c

@@ -33,7 +33,7 @@ struct TUNAdapter_pvt
     Identity
 };
 
-static Iface_DEFUN incomingFromTunIf(struct Iface* tunIf, struct Message* msg)
+static Iface_DEFUN incomingFromTunIf(struct Message* msg, struct Iface* tunIf)
 {
     struct TUNAdapter_pvt* ud = Identity_containerOf(tunIf, struct TUNAdapter_pvt, pub.tunIf);
 
@@ -97,7 +97,7 @@ static Iface_DEFUN incomingFromTunIf(struct Iface* tunIf, struct Message* msg)
     return Iface_next(&ud->pub.upperDistributorIf, msg);
 }
 
-static Iface_DEFUN incomingFromIpTunnelIf(struct Iface* ipTunnelIf, struct Message* msg)
+static Iface_DEFUN incomingFromIpTunnelIf(struct Message* msg, struct Iface* ipTunnelIf)
 {
 //    struct TUNAdapter_pvt* ud =
   //      Identity_containerOf(ipTunnelIf, struct TUNAdapter_pvt, pub.ipTunnelIf);

+ 4 - 4
net/UpperDistributor.c

@@ -29,7 +29,7 @@ struct UpperDistributor_pvt
     Identity
 };
 
-static Iface_DEFUN incomingFromEventIf(struct Iface* eventIf, struct Message* msg)
+static Iface_DEFUN incomingFromEventIf(struct Message* msg, struct Iface* eventIf)
 {
     struct UpperDistributor_pvt* ud =
         Identity_containerOf(eventIf, struct UpperDistributor_pvt, eventIf);
@@ -38,14 +38,14 @@ static Iface_DEFUN incomingFromEventIf(struct Iface* eventIf, struct Message* ms
     return Iface_next(&ud->pub.sessionManagerIf, msg);
 }
 
-static Iface_DEFUN incomingFromTunAdapterIf(struct Iface* tunAdapterIf, struct Message* msg)
+static Iface_DEFUN incomingFromTunAdapterIf(struct Message* msg, struct Iface* tunAdapterIf)
 {
     struct UpperDistributor_pvt* ud =
         Identity_containerOf(tunAdapterIf, struct UpperDistributor_pvt, pub.tunAdapterIf);
     return Iface_next(&ud->pub.sessionManagerIf, msg);
 }
 
-static Iface_DEFUN incomingFromIpTunnelIf(struct Iface* ipTunnelIf, struct Message* msg)
+static Iface_DEFUN incomingFromIpTunnelIf(struct Message* msg, struct Iface* ipTunnelIf)
 {
     struct UpperDistributor_pvt* ud =
         Identity_containerOf(ipTunnelIf, struct UpperDistributor_pvt, pub.ipTunnelIf);
@@ -53,7 +53,7 @@ static Iface_DEFUN incomingFromIpTunnelIf(struct Iface* ipTunnelIf, struct Messa
 }
 
 
-static Iface_DEFUN incomingFromSessionManagerIf(struct Iface* sessionManagerIf, struct Message* msg)
+static Iface_DEFUN incomingFromSessionManagerIf(struct Message* msg, struct Iface* sessionManagerIf)
 {
     struct UpperDistributor_pvt* ud =
         Identity_containerOf(sessionManagerIf, struct UpperDistributor_pvt, pub.sessionManagerIf);

+ 2 - 2
test/Beacon_test.c

@@ -59,7 +59,7 @@ struct TwoNodes
 #define TUNB 2
 #define TUNA 1
 
-static Iface_DEFUN incomingTunB(struct Iface* tunB, struct Message* msg)
+static Iface_DEFUN incomingTunB(struct Message* msg, struct Iface* tunB)
 {
     struct TwoNodes* tn = Identity_containerOf(tunB, struct TwoNodes, tunB);
     Assert_true(TUNMessageType_pop(msg, NULL) == Ethernet_TYPE_IP6);
@@ -69,7 +69,7 @@ static Iface_DEFUN incomingTunB(struct Iface* tunB, struct Message* msg)
     return 0;
 }
 
-static Iface_DEFUN incomingTunA(struct Iface* tunA, struct Message* msg)
+static Iface_DEFUN incomingTunA(struct Message* msg, struct Iface* tunA)
 {
     struct TwoNodes* tn = Identity_containerOf(tunA, struct TwoNodes, tunA);
     Assert_true(TUNMessageType_pop(msg, NULL) == Ethernet_TYPE_IP6);

+ 2 - 2
tunnel/IpTunnel.c

@@ -592,7 +592,7 @@ static struct IpTunnel_Connection* getConnection(struct IpTunnel_Connection* con
     return NULL;
 }
 
-static Iface_DEFUN incomingFromTun(struct Iface* tunIf, struct Message* message)
+static Iface_DEFUN incomingFromTun(struct Message* message, struct Iface* tunIf)
 {
     struct IpTunnel_pvt* context = Identity_check((struct IpTunnel_pvt*)tunIf);
 
@@ -668,7 +668,7 @@ static Iface_DEFUN ip4FromNode(struct Message* message,
     return Iface_next(&context->pub.tunInterface, message);
 }
 
-static Iface_DEFUN incomingFromNode(struct Iface* nodeIf, struct Message* message)
+static Iface_DEFUN incomingFromNode(struct Message* message, struct Iface* nodeIf)
 {
     struct IpTunnel_pvt* context =
         Identity_containerOf(nodeIf, struct IpTunnel_pvt, pub.nodeInterface);

+ 2 - 2
tunnel/test/IpTunnel_test.c

@@ -34,7 +34,7 @@ static uint8_t nodeCjdnsIp6[16];
 static uint8_t* fakeIp6ToGive = (uint8_t*) "\xfd\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1";
 static int called = 0;
 
-static Iface_DEFUN responseWithIpCallback(struct Iface* iface, struct Message* message)
+static Iface_DEFUN responseWithIpCallback(struct Message* message, struct Iface* iface)
 {
     struct RouteHeader* rh = (struct RouteHeader*) message->bytes;
     Assert_true(!Bits_memcmp(nodeCjdnsIp6, rh->ip6, 16));
@@ -74,7 +74,7 @@ static Iface_DEFUN responseWithIpCallback(struct Iface* iface, struct Message* m
     return 0;
 }
 
-static Iface_DEFUN messageToTun(struct Iface* iface, struct Message* message)
+static Iface_DEFUN messageToTun(struct Message* message, struct Iface* iface)
 {
     Assert_true(TUNMessageType_pop(message, NULL) == Ethernet_TYPE_IP6);
     struct Headers_IP6Header* ip = (struct Headers_IP6Header*) message->bytes;

+ 1 - 1
util/events/libuv/Pipe.c

@@ -103,7 +103,7 @@ static uint8_t sendMessage2(struct Pipe_WriteRequest_pvt* req)
     return Error_NONE;
 }
 
-static Iface_DEFUN sendMessage(struct Iface* iface, struct Message* m)
+static Iface_DEFUN sendMessage(struct Message* m, struct Iface* iface)
 {
     struct Pipe_pvt* pipe = Identity_check((struct Pipe_pvt*) iface);
 

+ 1 - 1
util/events/libuv/UDPAddrIface.c

@@ -78,7 +78,7 @@ static void sendComplete(uv_udp_send_t* uvReq, int error)
 }
 
 
-static Iface_DEFUN incomingFromIface(struct Iface* iface, struct Message* m)
+static Iface_DEFUN incomingFromIface(struct Message* m, struct Iface* iface)
 {
     struct UDPAddrIface_pvt* context = Identity_check((struct UDPAddrIface_pvt*) iface);
 

+ 2 - 2
util/test/Process_test.c

@@ -61,7 +61,7 @@ static void onConnectionParent(struct Pipe* p, int status)
     Allocator_free(alloc);
 }
 
-static Iface_DEFUN receiveMessageParent(struct Iface* iface, struct Message* msg)
+static Iface_DEFUN receiveMessageParent(struct Message* msg, struct Iface* iface)
 {
     struct Context* c = Identity_check((struct Context*) iface);
     Assert_true(msg->length == (int)CString_strlen(MESSAGEB));
@@ -81,7 +81,7 @@ static void onConnectionChild(struct Pipe* p, int status)
     printf("Child connected\n");
 }
 
-static Iface_DEFUN receiveMessageChild(struct Iface* iface, struct Message* m)
+static Iface_DEFUN receiveMessageChild(struct Message* m, struct Iface* iface)
 {
     struct Context* c = Identity_check((struct Context*) iface);
     printf("Child received message\n");

+ 1 - 1
util/test/Seccomp_test.c

@@ -76,7 +76,7 @@ static int child(char* pipeName, struct Allocator* alloc, struct Log* logger)
     return 0;
 }
 
-static Iface_DEFUN receiveMessageParent(struct Iface* iface, struct Message* msg)
+static Iface_DEFUN receiveMessageParent(struct Message* msg, struct Iface* iface)
 {
     struct Context* ctx = Identity_check((struct Context*) iface);
     Assert_true(msg->length == 3);