Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

SOCK_Dgram_Bcast.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    SOCK_Dgram_Bcast.h
00006  *
00007  *  $Id: SOCK_Dgram_Bcast.h,v 1.1.1.4 2003/02/21 18:36:32 chad Exp $
00008  *
00009  *  @author Doug Schmidt
00010  */
00011 //=============================================================================
00012 
00013 
00014 #ifndef ACE_SOCK_DGRAM_BCAST_H
00015 #define ACE_SOCK_DGRAM_BCAST_H
00016 #include "ace/pre.h"
00017 
00018 #include "ace/INET_Addr.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 #include "ace/SOCK_Dgram.h"
00025 
00026 /**
00027  * @class ACE_Bcast_Node
00028  *
00029  * @brief Linked list of broadcast interfaces.
00030  */
00031 class ACE_Export ACE_Bcast_Node
00032 {
00033 public:
00034   /// Default constructor.
00035   ACE_Bcast_Node (ACE_INET_Addr &,
00036                   ACE_Bcast_Node *);
00037 
00038   /// Destructor.
00039   ~ACE_Bcast_Node (void);
00040 
00041   /// Broadcast address for the interface.
00042   ACE_INET_Addr bcast_addr_;
00043 
00044   /// Pointer to the next interface in the chain.
00045   ACE_Bcast_Node *next_;
00046 };
00047 
00048 /**
00049  * @class ACE_SOCK_Dgram_Bcast
00050  *
00051  * @brief Defines the member functions for the ACE_SOCK datagram
00052  * abstraction.
00053  */
00054 class ACE_Export ACE_SOCK_Dgram_Bcast : public ACE_SOCK_Dgram
00055 {
00056 public:
00057   // = Initialization and termination methods.
00058   /// Default constructor.
00059   ACE_SOCK_Dgram_Bcast (void);
00060 
00061   ACE_SOCK_Dgram_Bcast (const ACE_Addr &local,
00062                         int protocol_family = PF_INET,
00063                         int protocol = 0,
00064                         int reuse_addr = 0,
00065                         const ACE_TCHAR *host_name = 0);
00066 
00067   /// Default dtor.
00068   ~ACE_SOCK_Dgram_Bcast (void);
00069 
00070   // Initiate a connectionless datagram broadcast endpoint.
00071 
00072   /// Initiate a connectionless datagram broadcast endpoint.
00073   int open (const ACE_Addr &local,
00074             int protocol_family = PF_INET,
00075             int protocol = 0,
00076             int reuse_addr = 0,
00077             const ACE_TCHAR *host_name = 0);
00078 
00079   /// Close up and release dynamically allocated resources.
00080   int close (void);
00081 
00082   /// Broadcast the datagram to every interface.  Returns the average
00083   /// number of bytes sent.
00084   ssize_t send (const void *buf,
00085                 size_t n,
00086                 u_short portnum,
00087                 int flags = 0) const;
00088 
00089   /// Broadcast the <iovec> datagrams to every interface.  Returns the
00090   /// average number of bytes sent.
00091   ssize_t send (const iovec iov[],
00092                 int n,
00093                 u_short portnum,
00094                 int flags = 0) const;
00095 
00096   /// Broadcast an N byte datagram to ADDR (note that addr must be
00097   /// preassigned to the broadcast address of the subnet...).
00098   ssize_t send (const void *buf,
00099                 size_t n,
00100                 const ACE_Addr &addr,
00101                 int flags = 0) const;
00102 
00103   /**
00104    * Broadcast an <iovec> of size <n> to <addr> as a datagram (note
00105    * that addr must be preassigned to the broadcast address of the
00106    * subnet...)
00107    */
00108   ssize_t send (const iovec iov[],
00109                 int n,
00110                 const ACE_Addr &addr,
00111                 int flags = 0) const;
00112 
00113   /// Dump the state of an object.
00114   void dump (void) const;
00115 
00116   /// Declare the dynamic allocation hooks.
00117   ACE_ALLOC_HOOK_DECLARE;
00118 
00119 private:
00120   /// Make broadcast available for Datagram socket.
00121   int mk_broadcast (const ACE_TCHAR *host_name);
00122 
00123   /// Points to the head of the list of broadcast interfaces.
00124   ACE_Bcast_Node *if_list_;
00125 
00126   /// Do not allow this function to percolate up to this interface...
00127   int get_remote_addr (ACE_Addr &) const;
00128 };
00129 
00130 #if !defined (ACE_LACKS_INLINE_FUNCTIONS)
00131 #include "ace/SOCK_Dgram_Bcast.i"
00132 #endif
00133 
00134 #include "ace/post.h"
00135 #endif /* ACE_SOCK_DGRAM_BCAST_H */

Generated on Mon Jun 16 11:21:20 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002