static uint8_t receiveMessage(struct Message* message, struct Interface* iface) { struct TUNInterface_Illumos_pvt* ctx = Identity_check((struct TUNInterface_Illumos_pvt*)iface->receiverContext); if (message->length < 4) { return Error_NONE; } Message_shift(message, 4); ((uint16_t*) message->bytes)[0] = 0; ((uint16_t*) message->bytes)[1] = ethertypeForPacketType(message->bytes[4]); return Interface_receiveMessage(&ctx->generic, message); }
static Iface_DEFUN incomingFromWire(struct Message* message, struct Iface* externalIf) { struct TUNInterface_Illumos_pvt* ctx = Identity_containerOf(externalIf, struct TUNInterface_Illumos_pvt, externalIf); if (message->length < 4) { return 0; } Message_shift(message, 4, NULL); ((uint16_t*) message->bytes)[0] = 0; ((uint16_t*) message->bytes)[1] = ethertypeForPacketType(message->bytes[4]); return Iface_next(&ctx->internalIf, message); }
uint16_t TUNMessageType_pop_Illumos(struct Message* message) { return ethertypeForPacketType(message->bytes[0]); }
void TUNMessageType_push_Illumos(struct Message* message, uint16_t ethertype) { Assert_true(ethertype == ethertypeForPacketType(message->bytes[0])); }