Rework tool_capabilities a bit (maxwear->uses, scale dig time according to leveldiff)
[oweals/minetest.git] / src / connection.h
index dc61394face1a4eb53b3571babfb14ef8eff66f2..b793f580f90d4c73687d6b720c4a183f68b6e5b7 100644 (file)
@@ -59,6 +59,14 @@ public:
        {}
 };
 
+class ConnectionBindFailed : public BaseException
+{
+public:
+       ConnectionBindFailed(const char *s):
+               BaseException(s)
+       {}
+};
+
 /*class ThrottlingException : public BaseException
 {
 public:
@@ -424,6 +432,7 @@ enum ConnectionEventType{
        CONNEVENT_DATA_RECEIVED,
        CONNEVENT_PEER_ADDED,
        CONNEVENT_PEER_REMOVED,
+       CONNEVENT_BIND_FAILED,
 };
 
 struct ConnectionEvent
@@ -447,6 +456,8 @@ struct ConnectionEvent
                        return "CONNEVENT_PEER_ADDED";
                case CONNEVENT_PEER_REMOVED: 
                        return "CONNEVENT_PEER_REMOVED";
+               case CONNEVENT_BIND_FAILED: 
+                       return "CONNEVENT_BIND_FAILED";
                }
                return "Invalid ConnectionEvent";
        }
@@ -470,6 +481,10 @@ struct ConnectionEvent
                timeout = timeout_;
                address = address_;
        }
+       void bindFailed()
+       {
+               type = CONNEVENT_BIND_FAILED;
+       }
 };
 
 enum ConnectionCommandType{
@@ -551,7 +566,7 @@ public:
        void Connect(Address address);
        bool Connected();
        void Disconnect();
-       u32 Receive(u16 &peer_id, u8 *data, u32 datasize);
+       u32 Receive(u16 &peer_id, SharedBuffer<u8> &data);
        void SendToAll(u8 channelnum, SharedBuffer<u8> data, bool reliable);
        void Send(u16 peer_id, u8 channelnum, SharedBuffer<u8> data, bool reliable);
        void RunTimeouts(float dtime); // dummy