// extent wire protocol

#ifndef extent_protocol_h
#define extent_protocol_h

#include "../rpc/rpc.h"

class extent_protocol {
 public:
  typedef int status;
  typedef unsigned long long extentid_t;
  enum xxstatus { OK, RPCERR, NOENT, IOERR, FBIG};
  enum rpc_numbers {
    put = 0x6001,
    get,
    getattr,
    setattr,
    remove,
    print_map
  };
  static const unsigned int maxextent = 8192*1000;

  struct attr {
    unsigned long atime;
    unsigned long mtime;
    unsigned long ctime;
    unsigned long size;
  };
};

inline unmarshall &
operator>>(unmarshall &u, extent_protocol::attr &a)
{
  u >> a.atime;
  u >> a.mtime;
  u >> a.ctime;
  u >> a.size;
  return u;
}

inline marshall &
operator<<(marshall &m, extent_protocol::attr a)
{
  m << a.atime;
  m << a.mtime;
  m << a.ctime;
  m << a.size;
  return m;
}

#endif 
