Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add secure socket layer options for modem ports #147

Closed
wants to merge 11 commits into from
11 changes: 6 additions & 5 deletions source/cellular_common_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,14 +438,15 @@ CellularError_t Cellular_CommonSocketSetSockOpt( CellularHandle_t cellularHandle
}
else
{
if( optionLevel == CELLULAR_SOCKET_OPTION_LEVEL_IP )
if( optionLevel == CELLULAR_SOCKET_OPTION_LEVEL_TRANSPORT )
{
LogError( ( "Cellular_SocketSetSockOpt: Option not supported" ) );
cellularStatus = CELLULAR_UNSUPPORTED;
cellularStatus = _socketSetSockOptLevelTransport( option, socketHandle, pOptionValue, optionValueLength );
}
else /* optionLevel CELLULAR_SOCKET_OPTION_LEVEL_TRANSPORT. */
else
{
cellularStatus = _socketSetSockOptLevelTransport( option, socketHandle, pOptionValue, optionValueLength );
/* Other socket option levels are not supported in common layer. Modem ports
* can use their own implementation for these options. */
cellularStatus = CELLULAR_UNSUPPORTED;
}
}

Expand Down
7 changes: 5 additions & 2 deletions source/include/cellular_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,9 @@ typedef enum CellularIPAddressType
*/
typedef enum CellularSocketOptionLevel
{
CELLULAR_SOCKET_OPTION_LEVEL_IP, /**< IP layer options. */
CELLULAR_SOCKET_OPTION_LEVEL_TRANSPORT /**< Transport (TCP/UDP) layer options. */
CELLULAR_SOCKET_OPTION_LEVEL_IP, /**< IP layer options. */
CELLULAR_SOCKET_OPTION_LEVEL_TRANSPORT, /**< Transport (TCP/UDP) layer options. */
CELLULAR_SOCKET_OPTION_LEVEL_SECURE /**< Secure sockets layer options. */
} CellularSocketOptionLevel_t;

/**
Expand All @@ -327,6 +328,8 @@ typedef enum CellularSocketOption
CELLULAR_SOCKET_OPTION_SEND_TIMEOUT, /**< Set send timeout (in milliseconds). */
CELLULAR_SOCKET_OPTION_RECV_TIMEOUT, /**< Set receive timeout (in milliseconds). */
CELLULAR_SOCKET_OPTION_PDN_CONTEXT_ID, /**< Set PDN Context ID to use for the socket. */
CELLULAR_SOCKET_OPTION_SSL_CONTEXT_ID, /**< Set secure sockets layer context ID to use for the socket. */
CELLULAR_SOCKET_OPTION_SSL_USAGE, /**< Set secure sockets layer usage for the socket. */
CELLULAR_SOCKET_OPTION_SET_LOCAL_PORT /**< Set local port. */
} CellularSocketOption_t;

Expand Down