SWRU455M February 2017 – October 2020 CC3120 , CC3120MOD , CC3130 , CC3135 , CC3135MOD , CC3220MOD , CC3220MODA , CC3220R , CC3220S , CC3220SF , CC3230S , CC3230SF , CC3235MODAS , CC3235MODASF , CC3235MODS , CC3235MODSF , CC3235S , CC3235SF
Set one free text protocol name – can be used alone to add the ALPN extension to the client hello message, and can be combined with the list of fixed ALPN protocol names if used along with SL_SO_SECURE_ALPN option. This option is available only in client mode.
Errors that could return from usage of this API:
To retrieve the result from the server after connection (indicate if this protocol been selected or not), use getsockopt with this opt ID. If the SL_SO_SECURE_ALPN is also used, issue a getsockopt with the SL_SO_SECURE_ALPN, to indicate if the server picked one of the fixed protocol names.
Example:
sl_SetSockOpt(sd,SL_SOL_SOCKET,SL_SO_SECURE_ALPN_GENERAL,"h2",strlen("h2"));
sl_Connect(sd, ( SlSockAddr_t *)&addr, addrSize);
length = 10;
sl_GetSockOpt(sd,SL_SOL_SOCKET,SL_SO_SECURE_ALPN_GENERAL,buf,&length);
if(length == 0)
{
//this protocol was not selected by the server
}
else if(memcmp(buf,"h2",length) == 0)
{
//the protocol that was set was picked by the server
}