[strongswan] strongswan METHOD宏
使用METHOD宏的函数定义:
METHOD(message_t, get_message_id, uint32_t,
private_message_t *this)
{
return this->message_id;
}
METHOD宏的定义:
/**
* Method declaration/definition macro, providing private and public interface.
*
* Defines a method name with this as first parameter and a return value ret,
* and an alias for this method with a _ prefix, having the this argument
* safely casted to the public interface iface.
* _name is provided a function pointer, but will get optimized out by GCC.
*/
#define METHOD(iface, name, ret, this, ...) \
static ret name(union {iface *_public; this;} \
__attribute__((transparent_union)), ##__VA_ARGS__); \
static typeof(name) *_##name = (typeof(name)*)name; \
static ret name(this, ##__VA_ARGS__)
将METHOD宏展开后的定义:
static uint32_t get_message_id(union {message_t *_public; private_message_t *this;} __attribute__((transparent_union)));
static typeof(get_message_id)* _get_message_id = (typeof(get_message_id)*)get_message_id;
static uint32_t get_message_id(private_message_t *this)
关于transparent_union的定义:
http://nanjingabcdefg.is-programmer.com/categories/5966/posts
[strongswan] strongswan METHOD宏的更多相关文章
- [ipsec][strongswan] strongswan源码分析--(一)SA整体分析
strongswan SA分析(一) 1 概念 下面主要介绍两个本文将要阐述的核心概念.他们是SA和SP.注意,这不是一篇不需要背景知识的文章.作者认为你适合阅读接下来内容的的前提是,你已经具备了一下 ...
- [ipsec][strongswan] strongswan源码分析--(五)plugin的配置文件的添加方法与管理架构解析
前言 我们知道,strongswan是基于插件式管理的.不同的插件有不同的配置文件,在这下面, 我们以netlink的插件为例:etc/strongswan.d/charon/kernel-netli ...
- [strongswan] strongswan是如何实现与xfrm之间的trap机制的
目录 strongswan与xfrm之间的trap机制 0. 1. 前言 2. 描述 2.1 none 2.2 trap 3. 实验与过程 3.1 trap实验 3.2 none实验 4 背景知识 5 ...
- [ipsec][strongswan] strongswan源码分析-- (三) xfrm与strongswan内核接口分析
目录 strongwan sa分析(三) xfrm与strongswan内核接口分析 1. strongswan的实现 2. 交互机制 4. xfrm的消息通信的实现 strongwan sa分析(三 ...
- [ipsec][strongswan] strongswan源码分析-- (二)rekey/reauth机制分析
目录 strongwan sa分析(二) 名词约定 rekey/reauth 机制分析 1 概述 2 reauth 3 CHILD SA rekey 4 IKE SA rekey 5 其他 stron ...
- [ipsec][strongswan] strongswan源码分析--(〇)总体架构图
history: 2019-06-05, 增加配置文件解析部分. 2019-06-05,增加plugin优先级排序部分. charon进程初始化阶段的流程图 约定: 实线代表流程图. 虚线代表调用栈, ...
- [ipsec][strongswan]strongswan源码分析--(零)引子
目录 strongswan sa 资料 编译 启动 进程信息 结构 架构图与插件 配置运行 传统配置方法 新的配置方法 其他配置方法 详细的配置文档 配置示例 用法 加密库 libgmp libcry ...
- [ipsec][strongswan] strongswan源码分析--(四)plugin加载优先级原理
前言 如前所述, 我们知道,strongswan以插件功能来提供各种各样的功能.插件之间彼此相互提供功能,同时也有可能提供重复的功能. 这个时候,便需要一个优先级关系,来保证先后加载顺序. 方法 在配 ...
- [dev][crypto][strongswan] 有关strongswan的forward policy的源码分析
一 默认情况下,我们使用strongswan建立了一个ipsec隧道之后,建立的policy如下: [root@D129 OUTPUT]# ip xfrm policy src dst dir pty ...
随机推荐
- SQL Server - CLUSTERED
CREATE TABLE dbo.t_MetricBook ( MetricSetID smallint NOT NULL, BookID smallint NOT NULL, ReportingCc ...
- 题解-Codeforces1106全套
因为参加完wc后心情很差,而且在广州过年没Ubuntu,所以就没打这场比赛了,结果这套题全部1A了,现在看来真是错失良机 结果这场不计rating 今天是除夕,大家节日快乐 A. Lunar New ...
- 解决 CentOS7 安装完成后ifconfig命令不能用
今天用VMWare安装了CentOS7,选择了最小安装包模式,安装完毕之后想查看一下本机的ip地址,发现报错 # ifconfig -bash: ifconfig: command not found ...
- 第二章:Linux 基础篇章
一.shell 在系统中,人所输入到系统内部的命令,以字符类型的形式输入刡系统当中,然而系统 只识别2进制码,就如以前 doc 界面为例,输入的都是字符类的英文字母作为输入的命令代 码,然 而明显二进 ...
- 利用Centos服务器来搭建自己的splash,不再被安装的各种环境繁琐而担忧
Centos7.5 ----- docker ------- splash 第一步:服务器环境的配置 第二步:dcoker环境的配置 ...
- Java _类 相关知识
成员变量 java对象的属性就是成员变量,其实成员变量就是指普通的变量,可以设置初始值,也可以不设置.当不设置时,会被设置为默认值.(当成员变量前面有private关键词时,说明定义了一个私有成员) ...
- 咸鱼入门到放弃8--jsp<三>jsp内置对象
NO. 内置对象 类型 1 pageContext javax.servlet.jsp.PageContext 2 request javax.servlet.http.HttpServletRequ ...
- jsp填坑:找不到属性
javax.el.PropertyNotFoundException: Property [***] not found on type 接手的项目的页面是用jsp写的,虽然再有十几天就2019年了, ...
- BZOJ.2616.SPOJ PERIODNI(笛卡尔树 树形DP)
BZOJ SPOJ 直观的想法是构建笛卡尔树(每次取最小值位置划分到两边),在树上DP,这样两个儿子的子树是互不影响的. 令\(f[i][j]\)表示第\(i\)个节点,放了\(j\)个车的方案数. ...
- 英语口语练习系列-C40-电器-访友
词汇-电器 dishwasher 洗碗机 fridge 电冰箱 washing machine 洗衣机 mobile phone 手机 digital camera 数码相机 intelligent ...