#include <string>
#include <sigc++/signal.h>
#include <msp/io/eventdispatcher.h>
+#include <msp/net/mspnet_api.h>
#include <msp/net/resolve.h>
#include <msp/net/streamsocket.h>
class Request;
class Response;
-class Client
+class MSPNET_API Client
{
public:
sigc::signal<void, const Response &> signal_response_complete;
#include <map>
#include <string>
+#include <msp/net/mspnet_api.h>
namespace Msp {
namespace Http {
class Request;
-class FormData
+class MSPNET_API FormData
{
private:
std::map<std::string, std::string> fields;
#include <map>
#include <string>
#include <vector>
+#include <msp/net/mspnet_api.h>
namespace Msp {
namespace Http {
class Message;
-struct Header
+struct MSPNET_API Header
{
enum Style
{
#include <map>
#include <string>
#include <msp/core/variant.h>
+#include <msp/net/mspnet_api.h>
#include "version.h"
namespace Msp {
namespace Http {
-class Message
+class MSPNET_API Message
{
protected:
typedef std::map<std::string, std::string> HeaderMap;
#define MSP_HTTP_REQUEST_H_
#include <string>
+#include <msp/net/mspnet_api.h>
#include "message.h"
namespace Msp {
namespace Http {
-class Request: public Message
+class MSPNET_API Request: public Message
{
private:
std::string method;
#ifndef MSP_HTTP_RESPONSE_H_
#define MSP_HTTP_RESPONSE_H_
+#include <msp/net/mspnet_api.h>
#include "message.h"
#include "status.h"
namespace Msp {
namespace Http {
-class Response: public Message
+class MSPNET_API Response: public Message
{
private:
Status status;
#define MSP_HTTP_SERVER_H_
#include <msp/io/eventdispatcher.h>
+#include <msp/net/mspnet_api.h>
#include <msp/net/streamserversocket.h>
#include <msp/time/timedelta.h>
class Request;
class Response;
-class Server
+class MSPNET_API Server
{
public:
sigc::signal<void, const Request &, Response &> signal_request;
#define MSP_HTTPSERVER_STATUS_H_
#include <ostream>
+#include <msp/net/mspnet_api.h>
namespace Msp {
namespace Http {
NOT_IMPLEMENTED = 501
};
-extern std::ostream &operator<<(std::ostream &, Status);
+MSPNET_API std::ostream &operator<<(std::ostream &, Status);
} // namespace Http
} // namespace Msp
#include <map>
#include <string>
+#include <msp/net/mspnet_api.h>
namespace Msp {
namespace Http {
typedef std::map<std::string, std::string> Query;
-std::string urlencode(const std::string &, EncodeLevel =SAFE);
-std::string urlencode_plus(const std::string &, EncodeLevel =SAFE);
-std::string urldecode(const std::string &);
-Url parse_url(const std::string &);
-std::string build_url(const Url &);
-Query parse_query(const std::string &);
-std::string build_query(const Query &);
+MSPNET_API std::string urlencode(const std::string &, EncodeLevel =SAFE);
+MSPNET_API std::string urlencode_plus(const std::string &, EncodeLevel =SAFE);
+MSPNET_API std::string urldecode(const std::string &);
+MSPNET_API Url parse_url(const std::string &);
+MSPNET_API std::string build_url(const Url &);
+MSPNET_API Query parse_query(const std::string &);
+MSPNET_API std::string build_query(const Query &);
} // namespace Http
} // namespace Msp
#define MSP_HTTP_MISC_H_
#include <string>
+#include <msp/net/mspnet_api.h>
namespace Msp {
namespace Http {
typedef unsigned Version;
-Version parse_version(const std::string &);
-std::string version_str(Version);
+MSPNET_API Version parse_version(const std::string &);
+MSPNET_API std::string version_str(Version);
} // namespace Http
} // namespace Msp
if(!connected)
throw bad_socket_state("not connected");
+ // XXX This breaks level-triggered semantics on Windows
if(size==0)
return 0;
#ifndef MSP_NET_CLIENTSOCKET_H_
#define MSP_NET_CLIENTSOCKET_H_
+#include "mspnet_api.h"
#include "socket.h"
namespace Msp {
/**
ClientSockets are used for sending and receiving data over the network.
*/
-class ClientSocket: public Socket
+class MSPNET_API ClientSocket: public Socket
{
public:
/** Emitted when the socket finishes connecting. */
#include <msp/core/except.h>
#include <msp/core/noncopyable.h>
#include <sigc++/signal.h>
+#include "mspnet_api.h"
#include "protocol.h"
namespace Msp {
class StreamSocket;
-class sequence_error: public invalid_state
+class MSPNET_API sequence_error: public invalid_state
{
public:
sequence_error(const std::string &w): invalid_state(w) { }
};
-class incompatible_protocol: public std::runtime_error
+class MSPNET_API incompatible_protocol: public std::runtime_error
{
public:
incompatible_protocol(const std::string &w): std::runtime_error(w) { }
};
-class Communicator: public NonCopyable
+class MSPNET_API Communicator: public NonCopyable
{
public:
sigc::signal<void> signal_handshake_done;
#define MSP_NET_DATAGRAMSOCKET_H_
#include "clientsocket.h"
+#include "mspnet_api.h"
namespace Msp {
namespace Net {
-class DatagramSocket: public ClientSocket
+class MSPNET_API DatagramSocket: public ClientSocket
{
public:
DatagramSocket(Family, int = 0);
#ifndef MSP_NET_INET_H_
#define MSP_NET_INET_H_
+#include "mspnet_api.h"
#include "sockaddr.h"
namespace Msp {
/**
Address class for IPv4 sockets.
*/
-class InetAddr: public SockAddr
+class MSPNET_API InetAddr: public SockAddr
{
private:
unsigned char addr[4] = { };
#ifndef MSP_NET_INET6_H_
#define MSP_NET_INET6_H_
+#include "mspnet_api.h"
#include "sockaddr.h"
namespace Msp {
namespace Net {
-class Inet6Addr: public SockAddr
+class MSPNET_API Inet6Addr: public SockAddr
{
private:
unsigned char addr[16] = { };
--- /dev/null
+#ifndef MSP_NET_API_H_
+#define MSP_NET_API_H_
+
+#if defined(_WIN32)
+#if defined(MSPNET_BUILD)
+#define MSPNET_API __declspec(dllexport)
+#elif defined(MSPNET_IMPORT)
+#define MSPNET_API __declspec(dllimport)
+#else
+#define MSPNET_API
+#endif
+#elif defined(__GNUC__)
+#define MSPNET_API __attribute__((visibility("default")))
+#else
+#define MSPNET_API
+#endif
+
+#endif
#include <stdexcept>
#include <vector>
#include <msp/core/hash.h>
+#include "mspnet_api.h"
#include "receiver.h"
namespace Msp {
namespace Net {
-class bad_packet: public std::runtime_error
+class MSPNET_API bad_packet: public std::runtime_error
{
public:
bad_packet(const std::string &w): std::runtime_error(w) { }
};
-class buffer_error: public std::runtime_error
+class MSPNET_API buffer_error: public std::runtime_error
{
public:
buffer_error(const std::string &w): std::runtime_error(w) { }
};
-class Protocol
+class MSPNET_API Protocol
{
private:
template<typename T, std::uint8_t K>
#ifndef MSP_NET_RECEIVER_H_
#define MSP_NET_RECEIVER_H_
+#include "mspnet_api.h"
+
namespace Msp {
namespace Net {
-class ReceiverBase
+class MSPNET_API ReceiverBase
{
protected:
ReceiverBase() = default;
#include <msp/core/thread.h>
#include <msp/io/eventdispatcher.h>
#include <msp/io/pipe.h>
+#include "mspnet_api.h"
#include "sockaddr.h"
namespace Msp {
the loopback address will be used. If host is "*", the wildcard address will
be used. If service is empty, a socket address with a null service will be
returned. With the IP families, these are not very useful. */
-SockAddr *resolve(const std::string &, const std::string &, Family = UNSPEC);
+MSPNET_API SockAddr *resolve(const std::string &, const std::string &, Family = UNSPEC);
/** And overload of resolve() that takes host and service as a single string,
separated by a colon. If the host part contains colons, such as is the case
with a numeric IPv6 address, it must be enclosed in brackets. */
-SockAddr *resolve(const std::string &, Family = UNSPEC);
+MSPNET_API SockAddr *resolve(const std::string &, Family = UNSPEC);
/**
An asynchronous name resolver. Blocking calls are performed in a thread and
completion is notified with one of the two signals.
*/
-class Resolver
+class MSPNET_API Resolver
{
private:
struct Task
#ifndef MSP_NET_SERVERSOCKET_H_
#define MSP_NET_SERVERSOCKET_H_
+#include "mspnet_api.h"
#include "socket.h"
namespace Msp {
ServerSockets are used to receive incoming connections. They cannot be used
for sending and receiving data.
*/
-class ServerSocket: public Socket
+class MSPNET_API ServerSocket: public Socket
{
protected:
ServerSocket(Family, int, int);
#define MSP_NET_SOCKADDR_H_
#include <string>
+#include "mspnet_api.h"
namespace Msp {
namespace Net {
};
-class SockAddr
+class MSPNET_API SockAddr
{
public:
struct SysAddr;
#include <msp/core/except.h>
#include <msp/io/eventobject.h>
#include <msp/io/handle.h>
+#include "mspnet_api.h"
#include "sockaddr.h"
namespace Msp {
namespace Net {
-class bad_socket_state: public invalid_state
+class MSPNET_API bad_socket_state: public invalid_state
{
public:
bad_socket_state(const std::string &w): invalid_state(w) { }
};
-class Socket: public IO::EventObject
+class MSPNET_API Socket: public IO::EventObject
{
protected:
enum SocketEvent
#ifndef MSP_NET_STREAMSERVERSOCKET_H_
#define MSP_NET_STREAMSERVERSOCKET_H_
+#include "mspnet_api.h"
#include "serversocket.h"
#include "streamsocket.h"
namespace Msp {
namespace Net {
-class StreamServerSocket: public ServerSocket
+class MSPNET_API StreamServerSocket: public ServerSocket
{
private:
bool listening = false;
#define MSP_NET_STREAMSOCKET_H_
#include "clientsocket.h"
+#include "mspnet_api.h"
namespace Msp {
namespace Net {
-class StreamSocket: public ClientSocket
+class MSPNET_API StreamSocket: public ClientSocket
{
friend class StreamServerSocket;
#ifndef MSP_NET_UNIX_H_
#define MSP_NET_UNIX_H_
+#include "mspnet_api.h"
#include "sockaddr.h"
namespace Msp {
namespace Net {
-class UnixAddr: public SockAddr
+class MSPNET_API UnixAddr: public SockAddr
{
private:
std::string path;