~ubuntu-branches/debian/experimental/libtorrent/experimental

« back to all changes in this revision

Viewing changes to src/data/socket_file.h

  • Committer: Bazaar Package Importer
  • Author(s): Jose Luis Rivas
  • Date: 2007-03-31 10:31:05 UTC
  • mto: (4.1.4 gutsy) (6.2.1 squeeze) (1.3.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: james.westby@ubuntu.com-20070331103105-jzpp1rml6ud0ff75
Tags: upstream-0.11.4
ImportĀ upstreamĀ versionĀ 0.11.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
  static const int o_truncate             = O_TRUNC;
59
59
  static const int o_nonblock             = O_NONBLOCK;
60
60
 
61
 
  SocketFile() : m_fd(invalid_fd), m_prot(0), m_flags(0) {}
62
 
  ~SocketFile();
 
61
  SocketFile() : m_fd(invalid_fd) {}
 
62
  SocketFile(fd_type fd) : m_fd(fd) {}
63
63
 
64
64
  bool                open(const std::string& path, int prot, int flags, mode_t mode = 0666);
65
65
 
67
67
  
68
68
  // Reserve the space on disk if a system call is defined. 'length'
69
69
  // of zero indicates to the end of the file.
70
 
  bool                reserve(off_t offset = 0, off_t length = 0);
 
70
  bool                reserve(uint64_t offset = 0, uint64_t length = 0);
71
71
 
72
72
  bool                is_open() const                                   { return m_fd != invalid_fd; }
73
 
  bool                is_readable() const                               { return m_prot & MemoryChunk::prot_read; }
74
 
  bool                is_writable() const                               { return m_prot & MemoryChunk::prot_write; }
75
 
  bool                is_nonblock() const                               { return m_flags & o_nonblock; }
76
 
 
77
 
  off_t               size() const;
78
 
  bool                set_size(off_t s) const;
79
 
 
80
 
  int                 get_prot() const                                  { return m_prot; }
81
 
 
82
 
  MemoryChunk         create_chunk(off_t offset, uint32_t length, int prot, int flags) const;
 
73
 
 
74
  uint64_t            size() const;
 
75
  bool                set_size(uint64_t s) const;
 
76
 
 
77
  MemoryChunk         create_chunk(uint64_t offset, uint32_t length, int prot, int flags) const;
83
78
  
84
79
  fd_type             fd() const                                        { return m_fd; }
85
80
 
90
85
  void operator = (const SocketFile&);
91
86
 
92
87
  fd_type             m_fd;
93
 
  int                 m_prot;
94
 
  int                 m_flags;
95
88
};
96
89
 
97
90
}