3 //=============================================================================
5 * @file LSOCK_CODgram.h
7 * @author Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
9 //=============================================================================
12 #ifndef ACE_LOCAL_SOCK_CODGRAM_H
13 #define ACE_LOCAL_SOCK_CODGRAM_H
14 #include /**/ "ace/pre.h"
16 #include /**/ "ace/config-all.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
24 #include "ace/LSOCK.h"
25 #include "ace/SOCK_CODgram.h"
28 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
31 * @class ACE_LSOCK_CODgram
33 * @brief Defines a fully specified (sometimes called "connected") UNIX-domain
34 * datagram abstraction.
36 * ACE_LSOCK_CODgram provides a way to use a UNIX-domain datagram socket in
37 * a situation where the local and peer addresses are fully known in advance.
38 * The "connection-oriented" part of "CODgram" is a misnomer. There is no
39 * connection used on this type of socket. It merely specifies that both
40 * endpoint addresses are known in advance of use. Furthermore, this class
41 * is more suited for use cases where a local endpoint wishes to communicate
42 * with a single, known peer and may or may not have a specified local address.
44 * If your use case requires receiving datagrams from multiple peers without
45 * previously known addresses, consider using ACE_LSOCK_Dgram instead.
47 class ACE_Export ACE_LSOCK_CODgram
: public ACE_SOCK_CODgram
, public ACE_LSOCK
50 /// Default constructor; requires a call to open() prior to communication.
54 * @name Initialization methods
58 * Initialize a fully-specified datagram socket.
60 * @param remote_sap Remote/peer address. This should be an ACE_UNIX_Addr
61 * object. It specifies where all sent datagrams will
63 * @param local_sap Local address. The local address to receive datagrams
64 * at. If not specified, an unused address is selected.
65 * If specified, should be an ACE_UNIX_Addr object.
69 ACE_LSOCK_CODgram (const ACE_Addr
&remote_sap
,
70 const ACE_Addr
&local_sap
= ACE_Addr::sap_any
,
71 int protocol_family
= PF_UNIX
,
75 * Initialize a fully-specified datagram socket.
77 * @retval 0 if no error.
78 * @retval -1 on error; check errno for an error reason.
80 int open (const ACE_Addr
&remote_sap
,
81 const ACE_Addr
&local_sap
= ACE_Addr::sap_any
,
82 int protocol_family
= PF_UNIX
,
86 /// Get underlying handle.
87 ACE_HANDLE
get_handle () const;
89 /// Set underlying handle.
90 void set_handle (ACE_HANDLE
);
92 /// Dump the state of an object.
95 /// Declare the dynamic allocation hooks.
96 ACE_ALLOC_HOOK_DECLARE
;
99 ACE_END_VERSIONED_NAMESPACE_DECL
101 #if defined (__ACE_INLINE__)
102 #include "ace/LSOCK_CODgram.inl"
103 #endif /* __ACE_INLINE__ */
105 #endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */
106 #include /**/ "ace/post.h"
107 #endif /* ACE_LOCAL_SOCK_CODGRAM_H */