欧美一区2区三区4区公司二百,国产精品婷婷午夜在线观看,自拍偷拍亚洲精品,国产美女诱惑一区二区

c++ c#結(jié)構(gòu)體調(diào)用

2、還存在另外一種情況,是結(jié)構(gòu)體中嵌套有結(jié)構(gòu)體時(shí)需要做一些特殊處理,具體如下:

結(jié)構(gòu)體

typedef struct {
? int ctx_num; /*/< Index to the context to use */
? int sec_level; /* < Security Level to validate frames per context based */
? int drop_maxpn; /* < Enable packet drop when max pn is reached for this context>*/
? int drop; ? ?/*/< Drop this Packet */
? int redir; ? /*/< For Egress, redirect the packet to ingress path (NDL). For Ingress, redirect the packet to alternate destination. */
? int auth_en; /*/< Encapsulate and authenticate this packet. */
? int enc_en; ?/*/< Encrypt this packet. auth_en must also be set when this bit is set. (Valid only for egress path). */
} ACT_FLD;

typedef struct {
? ACT_FLD ? *lk_act_fld; ? /*/< Action to take for an entry within a port */
} LKUP_T;

C++ 函數(shù)

uint ?msec_port_set_egr_entry (IN int port, IN int ent_num, IN LKUP_T *egr_lkup)

{

// ?

}

C#在調(diào)用時(shí)首先將相應(yīng)dll import進(jìn)來,進(jìn)行相應(yīng)結(jié)構(gòu)體的定義和相應(yīng)函數(shù)的聲明,具體如下:

? ? ? ? [DllImport("..\\debug\\mgd_MacSec.dll")]
? ? ? ? private static extern UInt32 msec_set_igr_gen_cfg(int port, IntPtr igr_gen);

? ? [StructLayout(LayoutKind.Sequential)]
? ? public class ACT_FLD?
? ? {
? ? ? ? public int ctx_num; /*/< Index to the context to use */
? ? ? ? public int sec_level; /* < Security Level to validate frames per context based */
? ? ? ? public int drop_maxpn; /* < Enable packet drop when max pn is reached for this context>*/
? ? ? ? public int drop; ? ?/*/< Drop this Packet */
? ? ? ? public int redir; ? /*/< For Egress, redirect the packet to ingress path (NDL). For Ingress, redirect the packet to alternate destination. */
? ? ? ? public int auth_en; /*/< Encapsulate and authenticate this packet. */
? ? ? ? public int enc_en; ?/*/< Encrypt this packet. auth_en must also be set when this bit is set. (Valid only for egress path). */
? ? ? ? public ACT_FLD()
? ? ? ? {
? ? ? ? ? ? ctx_num = 0;
? ? ? ? ? ? sec_level = 0;
? ? ? ? ? ? drop_maxpn = 0;
? ? ? ? ? ? drop = 0;
? ? ? ? ? ? redir = 0;
? ? ? ? ? ? auth_en = 0;
? ? ? ? ? ? enc_en = 0;
? ? ? ? }
? ? }?

? ? [StructLayout(LayoutKind.Sequential)]
? ? public class LKUP_T
? ? {
? ? ? ? public IntPtr lk_act_fld;

? ? ? ? public LKUP_T()
? ? ? ? {
? ? ? ? ? ? ACT_FLD lk_act_fld_s = new ACT_FLD();
? ? ? ? ? ? lk_act_fld = Marshal.AllocHGlobal(Marshal.SizeOf(lk_act_fld_s));
? ? ? ? ? ? Marshal.StructureToPtr(lk_act_fld_s, lk_act_fld, false);
? ? ? ? }
? ? }?

? ? 具體在代碼中引用時(shí)如下所示:

? ? ? ? ? ? IntPtr egr_lkup_ptr = Marshal.AllocHGlobal(Marshal.SizeOf(egr_lkup));
? ? ? ? ? ? Marshal.StructureToPtr(egr_lkup, egr_lkup_ptr, false);
? ? ? ? ? ? uint ret = _msec_port_set_egr_entry(port, ent_num, egr_lkup_ptr);
? ? ? ? ? ? egr_lkup = (LKUP_T)Marshal.PtrToStructure(egr_lkup_ptr, typeof(LKUP_T));
? ? ? ? ? ? Marshal.FreeHGlobal(egr_lkup_ptr);

?

文章鏈接: http://m.qzkangyuan.com/21895.html

文章標(biāo)題:c++ c#結(jié)構(gòu)體調(diào)用

文章版權(quán):夢(mèng)飛科技所發(fā)布的內(nèi)容,部分為原創(chuàng)文章,轉(zhuǎn)載請(qǐng)注明來源,網(wǎng)絡(luò)轉(zhuǎn)載文章如有侵權(quán)請(qǐng)聯(lián)系我們!

聲明:本站所有文章,如無特殊說明或標(biāo)注,均為本站原創(chuàng)發(fā)布。任何個(gè)人或組織,在未征得本站同意時(shí),禁止復(fù)制、盜用、采集、發(fā)布本站內(nèi)容到任何網(wǎng)站、書籍等各類媒體平臺(tái)。如若本站內(nèi)容侵犯了原著者的合法權(quán)益,可聯(lián)系我們進(jìn)行處理。

給TA打賞
共{{data.count}}人
人已打賞
建站教程

C#調(diào)用

2023-7-7 14:44:32

建站教程

JAVA數(shù)據(jù)結(jié)構(gòu)

2023-7-11 13:54:03

0 條回復(fù) A文章作者 M管理員
    暫無討論,說說你的看法吧
?
個(gè)人中心
購(gòu)物車
優(yōu)惠劵
今日簽到
有新私信 私信列表
搜索
主站蜘蛛池模板: 通州区| 新田县| 乌拉特中旗| 宿迁市| 宜州市| 牟定县| 长春市| 木兰县| 遂宁市| 新宾| 克拉玛依市| 吴桥县| 辽阳县| 武功县| 石棉县| 汝阳县| 绥中县| 江川县| 饶平县| 辉南县| 元朗区| 剑河县| 威远县| 乐东| 万年县| 桓仁| 吉木萨尔县| 江永县| 南川市| 鄂尔多斯市| 凤凰县| 仁布县| 镇沅| 化德县| 抚松县| 新闻| 井陉县| 平陆县| 海林市| 务川| 肃南|