Skip to content

Consolidate switch logic in OS_SocketOpen_Impl #859

@skliper

Description

@skliper

Is your feature request related to a problem? Please describe.
Duplicate switch cases that could be consolidated:

switch (stream->socket_type)
{
case OS_SocketType_DATAGRAM:
os_type = SOCK_DGRAM;
break;
case OS_SocketType_STREAM:
os_type = SOCK_STREAM;
break;
default:
return OS_ERR_NOT_IMPLEMENTED;
}

/* Only AF_INET* at this point, can add cases if support is expanded */
switch (stream->socket_type)
{
case OS_SocketType_DATAGRAM:
os_proto = IPPROTO_UDP;
break;
case OS_SocketType_STREAM:
os_proto = IPPROTO_TCP;
break;
}

Describe the solution you'd like
Consolidate

Describe alternatives you've considered
Was separate if future domains were added... but is currently awkward looking.

Additional context
None

Requester Info
Jacob Hageman - NASA/GSFC, OSAL code review

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions