strongswan源代码结构与数据结构


strongswan Github下载地址

源代码结构

目录下内容

strongswan$ ls
Android.common.mk.in  ChangeLog        COPYING      HACKING  m4           README            SECURITY.md               TODO
Android.mk            conf             doc          init     Makefile.am  README_LEGACY.md  sonar-project.properties
AUTHORS               configure.ac     Doxyfile.in  INSTALL  man          README.md         src
autogen.sh            CONTRIBUTING.md  fuzz         LICENSE  NEWS         scripts           testing
文件夹描述
conf配置文件
docRFC标准文档
init初始化信息
src源代码文件
scripts脚本信息
testing测试程序

Components

The src directory in the strongSwan distribution contains the following components:

ComponentDescription
aikgenUtility to generate an Attestation Identity Key bound to a TPM 1.2
charonThe IKE keying daemon
charon-cmdA command line IKE client
charon-nmThe back end for the NetworkManager D-BUS plugin
charon-svcThe Windows IKE service
charon-systemdAn IKE daemon similar to charon but specifically designed for use with systemd
charon-tkmA variant of charon that is backed by a Trusted Key Manager (TKM)
checksumUtility to generate checksums of built executables and libraries
conftestConformance test tool
frontends/androidVPN client for Android
frontends/gnomeNetworkManager plugin
frontends/osxcharon-xpc helper daemon for the native macOS application
ipsecThe legacy ipsec command line tool wrapping commands and other tools
libcharonContains most of the code and the plugins of the charon daemon
libfastA lightweight framework to build native web applications using ClearSilver and FastCGI
libimcvVarious Integrity Measurement Collectors (IMCs), Integrity Measuremeent Validators (IMVs) and the library code shared by them
libipsecA userland IPsec implementation used by kernel-libipsec and the Android VPN Client app
libptsContains code for TPM-based Platform Trust Services (PTS) and SWID tag handling
libpttlsImplements the PT-TLS protocol
libradiusRADIUS protocol implementation used by e.g. the eap-radius and tnc-pdp plugins
libsimakaContains code shared by several EAP-SIM/AKA plugins
libstrongswanThe strongSwan library with basic functions used by the daemons and utilities
libtlsTLS implementation used by the eap-tls, eap-ttls, eap-peap and other plugins
libtnccsImplements the IF-TNCCS interface
libtncifImplmements the IF-IMC/IF-IMV interfaces
managerA deprecated graphical management application for charon based on libfast
medsrvAn experimental management front end for mediation servers based on libfast
pkiPublic Key Infrastructure utility
poolUtility to manage attributes and IP address pools provided by the attr-sql plugin
pt-tls-clientIntegrity measurement client using the PT-TLS protocol
scepclientUtility to enroll certificates using the SCEP protocol
sec-updaterUtility extracting information about security updates and backports of Linux repositories (e.g. Debian or Ubuntu)
starterLegacy daemon that reads ipsec.conf and controls the keying daemon charon
strokeLegacy command line utility to control charon via the stroke protocol
swanctlConfiguration and control utility that communicates via the vici interface
sw-collectorUtility extracting information about software package installation, update or removal events from the apt history log
tpm_extendpcrTool that extends a digest into a TPM PCR
_updownDefault script called by the updown plugin on tunnel up/down events
xfrmiCreate an XFRM interface

libstrongswan/目录下文件描述

文件描述
backtrace.c backtrace.h回溯
chunk.c chunk.h
debug.c debug.h调试
integrity_checker.c integrity_checker.h完整性检查
lexparser.c lexparser.h
printf_hook/
utils/ utils.c utils.h
compat/兼容性
enum.c enum.h枚举
optionsfrom.c optionsfrom.h参数
process.c process.h处理
capabilities.c capabilities.h能力
cpu_feature.c cpu_feature.hCPU特性
leak_detective.c leak_detective.h丢包检测
identification.c identification.h识别
parser_helper.c parser_helper.h解析帮助
test.c test.h测试

数据结构

strongswan/src/libstrongswan/utils/utils/object.h

/**
 * Object allocation/initialization macro, using designated initializer.
 */
#define INIT(this, ...) { (this) = malloc(sizeof(*(this))); \
                           *(this) = (typeof(*(this))){ __VA_ARGS__ }; }

/**
 * 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__)

/**
 * Callback declaration/definition macro, allowing casted first parameter.
 *
 * This is very similar to METHOD, but instead of casting the first parameter
 * to a public interface, it uses a void*. This allows type safe definition
 * of a callback function, while using the real type for the first parameter.
 */
#define CALLBACK(name, ret, param1, ...) \
    static ret _cb_##name(union {void *_generic; param1;} \
    __attribute__((transparent_union)), ##__VA_ARGS__); \
    static typeof(_cb_##name) *name = (typeof(_cb_##name)*)_cb_##name; \
    static ret _cb_##name(param1, ##__VA_ARGS__)

strongswan/src/libstrongswan/utils/enum.h

/**
 * Begin a new enum_name list.
 *
 * @param name  name of the enum_name list
 * @param first enum value of the first enum string
 * @param last  enum value of the last enum string
 * @param ...   a list of strings
 */
#define ENUM_BEGIN(name, first, last, ...) \
    static enum_name_t name##last = {first, last + \
        BUILD_ASSERT(((last)-(first)+1) == countof(((char*[]){__VA_ARGS__}))), \
        NULL, { __VA_ARGS__ }}

/**
 * Continue a enum name list started with ENUM_BEGIN.
 *
 * @param name  name of the enum_name list
 * @param first enum value of the first enum string
 * @param last  enum value of the last enum string
 * @param prev  enum value of the "last" defined in ENUM_BEGIN/previous ENUM_NEXT
 * @param ...   a list of strings
 */
#define ENUM_NEXT(name, first, last, prev, ...) \
    static enum_name_t name##last = {first, last + \
        BUILD_ASSERT(((last)-(first)+1) == countof(((char*[]){__VA_ARGS__}))), \
        &name##prev, { __VA_ARGS__ }}

/**
 * Complete enum name list started with ENUM_BEGIN.
 *
 * @param name  name of the enum_name list
 * @param prev  enum value of the "last" defined in ENUM_BEGIN/previous ENUM_NEXT
 */
#define ENUM_END(name, prev) enum_name_t *name = &name##prev;

/**
 * Define a enum name with only one range.
 *
 * This is a convenience macro to use when a enum_name list contains only
 * one range, and is equal as defining ENUM_BEGIN followed by ENUM_END.
 *
 * @param name  name of the enum_name list
 * @param first enum value of the first enum string
 * @param last  enum value of the last enum string
 * @param ...   a list of strings
 */
#define ENUM(name, first, last, ...) \
    ENUM_BEGIN(name, first, last, __VA_ARGS__); ENUM_END(name, last)

strongswan/src/libstrongswan/utils/chunk.h

typedef struct chunk_t chunk_t;

/**
 * General purpose pointer/length abstraction.
 */
struct chunk_t {
    /** Pointer to start of data */
    u_char *ptr;
    /** Length of data in bytes */
    size_t len;
};

  • 2
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值