2019-04-27 19:12:09 +00:00
|
|
|
#ifndef WINGS_SOCKET_H
|
|
|
|
#define WINGS_SOCKET_H
|
|
|
|
#include <dart_api.h>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace wings
|
|
|
|
{
|
|
|
|
struct WingsSocketInfo
|
|
|
|
{
|
|
|
|
const char *address;
|
|
|
|
uint64_t port;
|
|
|
|
bool shared;
|
|
|
|
uint64_t backlog;
|
|
|
|
bool v6Only;
|
|
|
|
Dart_Handle sendPortHandle;
|
|
|
|
bool operator==(const WingsSocketInfo& other) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
class WingsSocket
|
|
|
|
{
|
|
|
|
public:
|
2019-04-29 05:10:27 +00:00
|
|
|
explicit WingsSocket(int sockfd, const WingsSocketInfo& info);
|
2019-04-27 19:12:09 +00:00
|
|
|
void incrRef(Dart_Port port);
|
2019-04-29 05:10:27 +00:00
|
|
|
const WingsSocketInfo& getInfo() const;
|
2019-04-27 19:12:09 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
WingsSocketInfo info;
|
|
|
|
int sockfd;
|
|
|
|
int refCount;
|
|
|
|
std::vector<Dart_Port> sendPorts;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern std::vector<WingsSocket*> globalSocketList;
|
|
|
|
} // namespace wings
|
|
|
|
|
|
|
|
#endif
|