Advertisement
Guest User

datagram.h

a guest
Aug 22nd, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.52 KB | None | 0 0
  1. #ifndef UNTITLED_DATAGRAM_H
  2. #define UNTITLED_DATAGRAM_H
  3.  
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <string.h>
  7. #include <netinet/in.h>
  8. #include <endian.h>
  9.  
  10.  
  11. class Datagram {
  12.  
  13.  
  14.  
  15. public:
  16.     Datagram();
  17.     void clear_datagram();
  18.  
  19.     void pack_next_int8_bit_value_buffer(int8_t v);
  20.     void pack_next_uint32_bit_value_buffer(uint32_t v);
  21.     void pack_next_uint64_bit_value_buffer(uint64_t v);
  22.  
  23.     void get_int8_bit_value_fbuffer(int8_t& v, int start_in_datagram);
  24.     void get_int32_bit_value_fbuffer(uint32_t& v, int start_in_datagram);
  25.     void get_int64_bit_value_fbuffer(uint64_t& v, int start_in_datagram);
  26. };
  27. /*
  28.  
  29. class Client_datagram: public Datagram {
  30. public:
  31.     void create_datagram(const uint64_t& session_id, const int8_t& turn_direction,
  32.                          const uint32_t& next_expected_event_no, string p);
  33.     bool read_datagram_from_client(uint64_t& session_id, int8_t& turn_direction,
  34.                                    uint32_t& next_expected_event_no, string& player_name);
  35.     void test(string t);
  36. };
  37.  
  38.  
  39. class Server_datagram: public Datagram {
  40. public:
  41.     bool read_datagram_from_client(uint64_t& session_id, int8_t& turn_direction,
  42.                                    uint32_t& next_expected_event_no, string& player_name);
  43.  
  44. };
  45.  
  46.  
  47.  
  48.  
  49. class TESTOWA {
  50.  
  51.  
  52. public:
  53.     char datagram_buffer[512 + 1];// \0
  54.     int next_free_byte;
  55.     int recv_length;
  56.  
  57. public:
  58.     TESTOWA();
  59.  
  60.     void clear_datagram();
  61.     void s(string t);
  62. };
  63.  
  64.  
  65. */
  66. #endif //UNTITLED_DATAGRAM_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement