Source for "src_dst_swap" #define IP_SRC_ADDR 12 #define IP_DST_ADDR 16 #define TCP_SRC_PORT 20 #define TCP_DST_PORT 22 #define TCP_SEQ_NUM 24 #define TCP_ACK_NUM 28 #define SCRATCH 15 ld [IP_SRC_ADDR:4]; // load src IP address st M[SCRATCH]; // store to scratch location ld [IP_DST_ADDR: 4]; // load dst IP address st [IP_SRC_ADDR: 4]; // store to src IP location in packet ld M[SCRATCH]; // load scratch location st [IP_DST_ADDR: 4]; // store to dst IP location in packet ld [TCP_SRC_PORT: 2]; // load src port st M[SCRATCH]; // store to scratch location ld [TCP_DST_PORT: 2]; // load dst port st [TCP_SRC_PORT: 2]; // store to src port location in packet ld M[SCRATCH]; // load scratch location st [TCP_DST_PORT: 2]; // store to dst ld [TCP_SEQ_NUM:4]; // load sequence number st M[SCRATCH]; // store to scratch location ld [TCP_ACK_NUM: 4]; // load last ack'd sequence number st [TCP_SEQ_NUM: 4]; // store as sequence number ld M[SCRATCH]; // load scratch location st [TCP_ACK_NUM: 4]; // store as last ack'd sequence number