⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 address.h

📁 JdonFramework need above jdk 1.4.0 This version has passed under Tomcat 4.x/5.x JBoss 3.x/JBoss 4.0
💻 H
📖 第 1 页 / 共 3 页
字号:
  IpxAddress(const GenAddress &genaddr);  // destructor  ~IpxAddress() {};  /**   * Return the syntax.   *   * @return This method always returns sNMP_SYNTAX_OCTETS.   */  virtual SmiUINT32 get_syntax() const { return sNMP_SYNTAX_OCTETS; };  /**   * Return the space needed for serialization.   */  virtual int get_asn1_length() const  { return IPXLEN + 2; };  /**   * Map other SnmpSyntax objects to IpxAddress.   */  SnmpSyntax& operator=(const SnmpSyntax &val);  // assignment to another IpAddress object overloaded  IpxAddress& operator=(const IpxAddress &ipxaddress);#ifdef _MAC_ADDRESS  // get the host id portion of an ipx address  int get_hostid(MacAddress& mac) const;#endif  /**   * Clone this object.   *   * @return Pointer to the newly created object (allocated through new).   */  SnmpSyntax *clone() const { return (SnmpSyntax *) new IpxAddress(*this); };  /**   * Get a printable ASCII value of the address.   *   * @return String containing the numerical address   */  virtual const char *get_printable() const    { if (addr_changed) format_output(); return output_buffer; };  /**   * Overloaded operator for streaming output.   *   * @return String containing the numerical address   */  virtual operator const char *() const    { if (addr_changed) format_output(); return output_buffer; };  /**   * Get the length of the binary address (accessible through operator[]).   */  virtual int get_length() const { return IPXLEN; };  /**   * Return the type of the address.   * @see Address::addr_type   * @return Always Address:type_ipx   */  virtual addr_type get_type() const { return type_ipx; };  /**   * Reset the object.   */  void clear()    { Address::clear(); memset(output_buffer, 0, sizeof(output_buffer)); }; protected:  // ipx format separator  char separator;  SNMP_PP_MUTABLE char output_buffer[OUTBUFF];           // output buffer  // redefined parse address for ipx strings  virtual bool parse_address(const char  *inaddr);  // redefined format output for ipx strings  // uses same separator as when constructed  virtual void format_output() const;};//------------------------------------------------------------------------//---------[ IpxSock Address Class ]--------------------------------------//------------------------------------------------------------------------class DLLOPT IpxSockAddress : public IpxAddress {public:  // constructor, no args  IpxSockAddress();  // constructor with a dotted string  IpxSockAddress(const char *inaddr);  // construct an Udp address with another Udp address  IpxSockAddress(const IpxSockAddress &ipxaddr);  //constructor with a GenAddress  IpxSockAddress(const GenAddress &genaddr);  //constructor with a IpxAddress  // default socket # is 0  IpxSockAddress(const IpxAddress &ipxaddr);  // destructor  ~IpxSockAddress() {};  // syntax type  //virtual SmiUINT32 get_syntax() const { return sNMP_SYNTAX_OCTETS; };  /**   * Return the space needed for serialization.   */  virtual int get_asn1_length() const { return IPXSOCKLEN + 2; };  /**   * Map other SnmpSyntax objects to IpxSockAddress.   */  SnmpSyntax& operator=(const SnmpSyntax &val);  // assignment to another IpAddress object overloaded  IpxSockAddress& operator=(const IpxSockAddress &ipxaddr);  /**   * Clone this object.   *   * @return Pointer to the newly created object (allocated through new).   */  SnmpSyntax *clone() const { return (SnmpSyntax *)new IpxSockAddress(*this); };  // set the socket number  void set_socket(const unsigned short s);  // get the socket number  unsigned short get_socket() const;  /**   * Get a printable ASCII value of the address.   *   * @return String containing the numerical address   */  virtual const char *get_printable() const    { if (addr_changed) format_output(); return output_buffer; };  /**   * Overloaded operator for streaming output.   *   * @return String containing the numerical address   */  virtual operator const char *() const    { if (addr_changed) format_output(); return output_buffer; };  /**   * Get the length of the binary address (accessible through operator[]).   */  virtual int get_length() const { return IPXSOCKLEN; };  /**   * Return the type of the address.   * @see Address::addr_type   * @return Always Address:type_ipxsock   */  virtual addr_type get_type() const { return type_ipxsock; };  /**   * Reset the object.   */  void clear()    { Address::clear(); memset(output_buffer, 0, sizeof(output_buffer)); }; protected:  SNMP_PP_MUTABLE char output_buffer[OUTBUFF];           // output buffer  // redefined parse address for ipx strings  virtual bool parse_address(const char  *inaddr);  // redefined format output  // specific to IP addresses  virtual void format_output() const;};#endif // _IPX_ADDRESS//-------------------------------------------------------------------------//--------[ Generic Address ]----------------------------------------------//-------------------------------------------------------------------------class DLLOPT GenAddress : public Address{ public:  /**   * Construct an empty invalid generic address object.   */  GenAddress();  /**   * Construct a generic address from a string.   *   * To optimize the speed of the parsing method, use_type can be used   * to indicate that the address string is of the specified type.   *   * @param addr     - address string   * @param use_type - if this value is set, the input string is only   *                   parsed for the given type    */  GenAddress(const char *addr,	     const Address::addr_type use_type = Address::type_invalid);  /**   * Construct a generic address from an Address object.   *   * @param addr - Any address object   */  GenAddress(const Address &addr);  /**   * Construct a generic address from another generic address object.   *   * @param addr - Generic address object to copy   */  GenAddress(const GenAddress &addr);  /**   * Destructor, free memory.   */  ~GenAddress() { if (address) delete address; };  /**   * Return the syntax.   *   * @return This method returns sNMP_SYNTAX_IPADDR, sNMP_SYNTAX_OCTETS   *         or sNMP_SYNTAX_NULL if the generic address does not have   *         an address object.   */  SmiUINT32 get_syntax() const    { return address ? address->get_syntax() : sNMP_SYNTAX_NULL; };  /**   * Return the space needed for serialization.   */  virtual int get_asn1_length() const    { return address ? address->get_asn1_length() : 2; };  /**   * Clone this object.   *   * @return Pointer to the newly created object (allocated through new).   */  SnmpSyntax *clone() const { return (SnmpSyntax *)new GenAddress(*this); };  /**   * Overloaded assignment operator for a GenAddress.   */  GenAddress& operator=(const GenAddress &addr);  /**   * Overloaded assignment operator for a Address.   */  GenAddress& operator=(const Address &addr);  /**   * Map other SnmpSyntax objects to GenAddress.   */  SnmpSyntax& operator=(const SnmpSyntax &val);  /**   * Get a printable ASCII value of the address.   *   * @return String containing the numerical address   */  virtual const char *get_printable() const    { return (address) ? address->get_printable() : output_buffer; };  /**   * Overloaded operator for streaming output.   *   * @return String containing the numerical address   */  virtual operator const char *() const    { return address ? (const char *)*address : output_buffer; };  /**   * Get the length of the binary address (accessible through operator[]).   */  virtual int get_length() const    { return (address) ? address->get_length() : 0; };  /**   * Reset the object.   */  void clear() { if (address) address->clear(); };  /**   * Return the type of the address.   * @see Address::addr_type   * @return Type of the contained address object or Address::type_invalid   *         if it is not valid().   */  virtual addr_type get_type() const    { return (valid()) ? address->get_type() : type_invalid; };  /**   * Access the protected address.   * The caller must make sure that this GenAddress object ist valid()   * and is of the right type (get_type()).   */  const IpAddress  &cast_ipaddress()  const { return (IpAddress& )*address; };  /**   * Access the protected address.   * The caller must make sure that this GenAddress object ist valid()   * and is of the right type (get_type()).   */  const UdpAddress &cast_udpaddress() const { return (UdpAddress&)*address; };#ifdef _MAC_ADDRESS  /**   * Access the protected address.   * The caller must make sure that this GenAddress object ist valid()   * and is of the right type (get_type()).   */  const MacAddress &cast_macaddress() const { return (MacAddress&)*address; };#endif#ifdef _IPX_ADDRESS  /**   * Access the protected address.   * The caller must make sure that this GenAddress object ist valid()   * and is of the right type (get_type()).   */  const IpxAddress &cast_ipxaddress() const { return (IpxAddress&)*address; };  /**   * Access the protected address.   * The caller must make sure that this GenAddress object ist valid()   * and is of the right type (get_type()).   */  const IpxSockAddress &cast_ipxsockaddress() const    { return (IpxSockAddress&)*address; };#endifprotected:  // pointer to a concrete address  Address *address;  char output_buffer[1];           // output buffer  // redefined parse address for generic address  virtual bool parse_address(const char *addr)    { return parse_address(addr, Address::type_invalid); };  virtual bool parse_address(const char *addr,			     const Address::addr_type use_type);  // format output for a generic address  virtual void format_output() const {};  /**   * Is this a GenAddress object.   */  virtual bool is_gen_address() const { return true; };};#if !defined (DLLOPT_TEMPL_ADDRESSCOLLECTION)#define DLLOPT_TEMPL_ADDRESSCOLLECTION//	DLLOPT_TEMPL template class DLLOPT SnmpCollection<GenAddress>;//	DLLOPT_TEMPL template class DLLOPT SnmpCollection<UdpAddress>;#endif// create AddressCollection typetypedef SnmpCollection <GenAddress> AddressCollection;typedef SnmpCollection <UdpAddress> UdpAddressCollection;#ifdef SNMP_PP_NAMESPACE}; // end of namespace Snmp_pp#endif #endif  //_ADDRESS

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -