有人可以告訴我確實從C到德爾福是我的談話得好:C到德爾福結構的轉換
C代碼
struct nfq_data {
/* packet_hdr - it HAVE to be the same as struct nfqnl_msg_packet_hdr */
struct {
uint32_t packet_id; /* unique ID of packet in queue in network order */
uint16_t hw_protocol; /* hw protocol in network order */
uint8_t hook; /* netfilter hook */
} packet_hdr;
/* packet_hw - it HAVE to be the same as struct nfqnl_msg_packet_hw */
struct {
uint16_t hw_addrlen; /* len of hw_addr in network order */
uint16_t _pad;
uint8_t hw_addr[8];
} packet_hw;
/* tm */
struct {
long sec;
long usec;
} tm;
uint32_t if_index; /* Unique iface id */
uint32_t verdict; /* Netfilter verdict value */
uint32_t mark; /* Mark value */
uint8_t if_name[IFNAMSIZE]; /* Name of incoming or outgoing iface */
uint32_t data_len; /* Length of packet */
uint8_t payload[0]; /* packet data */
};
其中
typedef unsigned char uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
德爾福
_packet_hdr = record
packet_id: Cardinal;
hw_protocol: Word;
hook: Byte;
end;
_packet_hw = record
hw_addrlen: Word;
_pad: Word;
hw_addr: array[0..7] of byte;
end;
_tm = record
sec: Int64;
usec: Int64;
end;
pnfq_data = ^nfq_data;
nfq_data = record
packet_hdr: _packet_hdr;
packet_hw: _packet_hw;
tm: _tm;
if_index: Cardinal;
verdict: Cardinal;
mark: Cardinal;
if_name: array[0..254] of Byte;
data_len: Cardinal;
payload: PChar; //TBytes;
end;
packet_hdr: _packet_hdr;
packet_hw: _packet_hw;
我很好,但一個沒有什麼好的。
在此先感謝
博揚
我想你不應該鍵入'uintN_t'標識符。如果你有C99,你將覆蓋系統標識符(在''中;如果你還沒有,那麼當你最終轉換到C99時,你只是在等待不好的事情發生。 –
pmg
2010-11-13 12:36:14
沒有足夠的信息來查找問題。在你的代碼中找到行爲不好的第一個位置,並將代碼放在這裏。在這裏描述當前的行爲和期望的行爲。如果有幫助,添加一些內存轉儲。 – Dialecticus 2010-11-13 13:19:33