1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | /* Packet infomation including data, length, received port. */ struct pofdp_packet{ ... uint32_t ori_len; /* The original packet length. uint8_t *buf; /* The memery which stores the whole packet. */ /* Output. */ uint16_t output_packet_len; /* Byte unit. */ /* The length of output packet. */ uint16_t output_packet_offset; /* Byte unit. */ /* The start position of output. */ uint16_t output_metadata_len; /* Byte unit. */ uint16_t output_metadata_offset; /* Bit unit. */ /* The output metadata length and offset. * Packet data output right behind the metadata. */ uint16_t output_whole_len; /* = output_packet_len + output_metadata_len. */ uint8_t *buf_out; /* The memery which store the output data. */ /* Offset. */ uint16_t offset; /* Byte unit. */ /* The base offset of table field and actions. */ uint8_t *buf_offset; /* The packet pointer shift offset. * buf_offset = buf + offset */ uint32_t left_len; /* Length of left packet after shifting offset. * left_len = metadata->len - offset. */ /* Metadata. */ struct pofdp_metadata *metadata; /* The memery which stores the packet metadata. * The packet WHOLE length and input port index * has been stored in metadata. */ uint16_t metadata_len; /* The length of packet metadata in byte. */ /* Instruction & Actions. */ struct pof_instruction *ins;/* The memery which stores the instructions need * to be implemented. */ ... }; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | static uint32_t pofdp_main_task(void *arg_ptr){ ... struct pof_instruction first_ins[1] = {0}; ... set_goto_first_table_instruction(first_ins); while(1){ ret = pofdp_recv_raw(dpp); ... if(dpp->ori_l en > POFDP_PACKET_RAW_MAX_LEN){ ... } if(POF_OK != poflr_check_flow_table_exist(POFDP_FIRST_TABLE_ID)){ ... } /* Forward the packet. */ ret = pofdp_forward(dpp, first_ins); ... } return POF_OK; } |
欢迎光临 51学通信论坛2017新版 (http://bbs.51xuetongxin.com/) | Powered by Discuz! X3 |