summaryrefslogtreecommitdiff
path: root/protocols/ace/RMCast/RMCast_Partial_Message.h
blob: af66435825a63c577f6cd2a14a4c683dbc266fa6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// $Id$

// ============================================================================
//
// = DESCRIPTION
//   Helper class used in the reassembly layer of the realiable
//   multicast library.
//
// = AUTHOR
//    Carlos O'Ryan <coryan@cs.wustl.edu>
//
// ============================================================================

#ifndef ACE_RMCAST_PARTIAL_MESSAGE_H
#define ACE_RMCAST_PARTIAL_MESSAGE_H
#include "ace/pre.h"

#include "RMCast_Export.h"
#include "ace/Task.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#ifndef ACE_RMCAST_DEFAULT_HOLE_COUNT
#define ACE_RMCAST_DEFAULT_HOLE_COUNT 16
#endif /* ACE_RMCAST_DEFAULT_HOLE_COUNT */

class ACE_RMCast_Export ACE_RMCast_Partial_Message
{
public:
  ACE_RMCast_Partial_Message (ACE_UINT32 message_size);
  ~ACE_RMCast_Partial_Message (void);

  int fragment_received (ACE_UINT32 message_size,
                         ACE_UINT32 offset,
                         ACE_Message_Block *mb);
  int is_complete (void) const;

  ACE_Message_Block *message_body (void);
  // Return the body of the message, the memory is owned by the
  // class.

private:
  int insert_hole (size_t i,
                   ACE_UINT32 start,
                   ACE_UINT32 end);
  // Insert a new hole into the list

  int remove_hole (size_t i);
  // Remove a hole from the list

private:
  ACE_Message_Block message_body_;
  // Used to rebuild the body of the message

  struct Hole
  {
    ACE_UINT32 start;
    ACE_UINT32 end;
  };

  Hole *hole_list_;
  size_t max_hole_count_;
  size_t hole_count_;
  // The current list of holes in the message_body.
};

#if defined (__ACE_INLINE__)
#include "RMCast_Partial_Message.i"
#endif /* __ACE_INLINE__ */

#include "ace/post.h"
#endif /* ACE_RMCAST_PARTIAL_MESSAGE_H */