Sha256: 468136709725b26f60ae588486eb15ed7e02703962a077cbab34a6d45bcc5c1b

Contents?: true

Size: 1.8 KB

Versions: 2

Compression:

Stored size: 1.8 KB

Contents

#pragma once

#include "types.h"

namespace discord {

class NetworkManager final {
public:
    ~NetworkManager() = default;

    /**
     * Get the local peer ID for this process.
     */
    void GetPeerId(NetworkPeerId* peerId);
    /**
     * Send pending network messages.
     */
    Result Flush();
    /**
     * Open a connection to a remote peer.
     */
    Result OpenPeer(NetworkPeerId peerId, char const* routeData);
    /**
     * Update the route data for a connected peer.
     */
    Result UpdatePeer(NetworkPeerId peerId, char const* routeData);
    /**
     * Close the connection to a remote peer.
     */
    Result ClosePeer(NetworkPeerId peerId);
    /**
     * Open a message channel to a connected peer.
     */
    Result OpenChannel(NetworkPeerId peerId, NetworkChannelId channelId, bool reliable);
    /**
     * Close a message channel to a connected peer.
     */
    Result CloseChannel(NetworkPeerId peerId, NetworkChannelId channelId);
    /**
     * Send a message to a connected peer over an opened message channel.
     */
    Result SendMessage(NetworkPeerId peerId,
                       NetworkChannelId channelId,
                       std::uint8_t* data,
                       std::uint32_t dataLength);

    Event<NetworkPeerId, NetworkChannelId, std::uint8_t*, std::uint32_t> OnMessage;
    Event<char const*> OnRouteUpdate;

private:
    friend class Core;

    NetworkManager() = default;
    NetworkManager(NetworkManager const& rhs) = delete;
    NetworkManager& operator=(NetworkManager const& rhs) = delete;
    NetworkManager(NetworkManager&& rhs) = delete;
    NetworkManager& operator=(NetworkManager&& rhs) = delete;

    IDiscordNetworkManager* internal_;
    static IDiscordNetworkEvents events_;
};

} // namespace discord

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rdiscord_sdk-1.1.1 third-party/include/network_manager.h
rdiscord_sdk-1.1.0 third-party/include/network_manager.h