[strongSwan-dev] Working of format specifiers in DBG

Andreas Steffen andreas.steffen at strongswan.org
Fri Jan 13 15:01:09 CET 2017


Hi Anand,

strongswan uses standard libc printf hooks if they are available.
Otherwise vstr is used to emulate printf hooks. The strongSwan
printf_hook_t framework is defined here:

https://git.strongswan.org/?p=strongswan.git;a=tree;f=src/libstrongswan/utils/printf_hook;h=2c506f08bef7aa1953a2f138f4d649843d181fb6;hb=HEAD

E.g. the printf_hook handler for %N (printing of enum_name_t types) is
defined here:

https://git.strongswan.org/?p=strongswan.git;a=blob;f=src/libstrongswan/utils/enum.c;h=1cead77cae75bc9de50abf118f259e3e283663e9;hb=9ad147ac63df03740a156fd1f3b017ef1d0e89ae#l137

and the all hooks used by libstrongswan are assigned here:

https://git.strongswan.org/?p=strongswan.git;a=blob;f=src/libstrongswan/library.c;h=4f79dcc5b12f7601ff2df4c5ad319108f3e60476;hb=9ad147ac63df03740a156fd1f3b017ef1d0e89ae#l338

Hope this helps

Andreas

On 13.01.2017 13:46, Anand Murali wrote:
> Hi,
>
>
> I have been going through the source code of strongswan.
>
>
> I came across lots of custom format specifiers like:
>
>
> DBG1(DBG_ENC, "U_INT Type *%N* is not supported",
> encoding_type_names, int_type);
>
> DBG2(DBG_CFG, "received proposals: *%#P*", proposals);
>
>
> I'm new to this. Have been going through this code for a week. I'm not
> able to figure out how these are evaluated.
>
>
> Any help to understand how these are evaluated?
>
>
> If there is an internal code that does this parsing, can you point me to
> that file?
>
>
> Thanks
======================================================================
Andreas Steffen                         andreas.steffen at strongswan.org
strongSwan - the Open Source VPN Solution!          www.strongswan.org
Institute for Internet Technologies and Applications
University of Applied Sciences Rapperswil
CH-8640 Rapperswil (Switzerland)
===========================================================[ITA-HSR]==

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3859 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.strongswan.org/pipermail/dev/attachments/20170113/68ce7e06/attachment.bin>


More information about the Dev mailing list