void mopPutHeader(u_char *pkt, int *idx, const u_char *dst, const u_char *src, u_short proto, int trans) { mopPutMulti(pkt, idx, dst, 6); mopPutMulti(pkt, idx, src, 6); if (trans == TRANS_8023) { mopPutShort(pkt, idx, 0); mopPutChar (pkt, idx, MOP_K_PROTO_802_DSAP); mopPutChar (pkt, idx, MOP_K_PROTO_802_SSAP); mopPutChar (pkt, idx, MOP_K_PROTO_802_CNTL); mopPutChar (pkt, idx, 0x08); mopPutChar (pkt, idx, 0x00); mopPutChar (pkt, idx, 0x2b); } #if !defined(__FreeBSD__) mopPutChar(pkt, idx, (proto / 256)); mopPutChar(pkt, idx, (proto % 256)); #else if (trans == TRANS_8023) { mopPutChar(pkt, idx, (proto / 256)); mopPutChar(pkt, idx, (proto % 256)); } else { mopPutChar(pkt, idx, (proto % 256)); mopPutChar(pkt, idx, (proto / 256)); } #endif if (trans == TRANS_ETHER) mopPutShort(pkt, idx, 0); }
void mopPutLength(u_char *pkt, int trans, u_short len) { int idx; switch (trans) { case TRANS_ETHER: idx = 14; mopPutShort(pkt, &idx, len-16); break; case TRANS_8023: idx = 12; #if !defined(__FreeBSD__) mopPutNShort(pkt, &idx, len-14); #else mopPutShort(pkt, &idx, len-14); #endif break; } }