#ifndef hostent_hpp__ #define hostent_hpp__ /*!============================================================================ * * HostEntry [クライアント] */ namespace hostentimpl { struct Worker; }; class HostEntry { // 引数無しコンストラクト,コピーの禁止 HostEntry () {} HostEntry (const HostEntry& ){} void operator = (const HostEntry& ) {} struct hostentimpl::Worker *worker_; // 実際の作業オブジェクト public: /*! * HostEntry 全体の初期化 */ static void initialize (); /*! HostEntry 全体の終了処理 * !! 注意 !! * これを呼び出すまでに HostEntry のインスタンスは * 全て破棄されていなければならない * * wait ミリ秒待って HostEntryServer が終了しなければ * terminate が true ならば強制終了 * そうでなければ false を返す * wait に 0 を入力すると,永遠に終了処理を待つ */ static bool finalize (unsigned long wait, bool terminate = false); /*! ctor * @param target ホスト名文字列もしくは IP アドレス文字列(ピリオド区切り) * * バックグラウンドなスレッドへの登録に失敗していれば * getState() が FAILED を返す */ HostEntry (const char *target); ~HostEntry (); // state enum { FAILED = -1, // 失敗 WAITING = 0, // サービスの順番待ち RESOLVED = 1, // 解決 }; int getState () const; //! state を得る const char * getName () const; //! hostent::h_name unsigned int getAliasCount () const; //! hostent::h_aliases に存在する文字列の数 const char * getAlias (unsigned int idx) const; //! hostent::h_aliases[idx] short getAddrType () const; //! hostent::h_addrtype short getLength () const; //! hostent::h_length unsigned int getAddrCount () const; //! hostent::h_addr_list に存在するアドレスの数 const char * getAddr (unsigned int idx) const; //! hostent::h_addr_list[idx] }; #endif // hostent_hpp__