vendredi 27 décembre 2019

C++ Hold all socket definitions in a container

We are trying to write a Socket APIs wrapper for both IPV4 and IPV6 such that the application is detached from socket library.

The issue I am facing is that constants and #defines that socket.h has for IPv4 and IPV6 like:

IN6ADDR_LOOPBACK_INIT 
in6addr_loopback
IN6ADDR_ANY_INIT
INADDR_ANY
INADDR_LOOPBACK
etc and others

All my attempts to store them in a user defined container / variable are failing - objective is that user can specify request to create IPv4 or IPV6 socket by providing a IP, PORT and PROTOCOL - so it can provide the above defined one.

Since my objective is to hide all the declarations, I need to write a wrapper that hides all definitions and create / map new dataset to it?

Any idea how the same can be achievable?

Aucun commentaire:

Enregistrer un commentaire