Drizzled Public API Documentation

ipv6.h
00001 /*
00002   Original copyright header listed below. This comes via rsync.
00003   Any additional changes are provided via the same license as the original.
00004 
00005   Copyright (C) 2011 Muhammad Umair
00006 
00007 */
00008 /*
00009  * Copyright (C) 1996-2001  Internet Software Consortium.
00010  *
00011  * Permission to use, copy, modify, and distribute this software for any
00012  * purpose with or without fee is hereby granted, provided that the above
00013  * copyright notice and this permission notice appear in all copies.
00014  *
00015  * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
00016  * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
00017  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
00018  * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
00019  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
00020  * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
00021  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
00022  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
00023  */
00024 
00025 #pragma once
00026 
00027 #include <drizzled/field.h>
00028 #include <string>
00029 
00030 #include <drizzled/type/ipv6.h>
00031 
00032 namespace drizzled
00033 {
00034 namespace field
00035 {
00036 
00037 class IPv6:public Field {
00038   const charset_info_st *field_charset;
00039 
00040 public:
00041   IPv6(unsigned char *ptr_arg,
00042             uint32_t len_arg,
00043             unsigned char *null_ptr_arg,
00044             unsigned char null_bit_arg,
00045             const char *field_name_arg);
00046 
00047   enum_field_types type() const { return DRIZZLE_TYPE_IPV6; }
00048   enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
00049   bool zero_pack() const { return 0; }
00050   int  reset(void) { memset(ptr, 0, type::IPv6::LENGTH); return 0; }
00051   uint32_t pack_length() const { return type::IPv6::LENGTH; }
00052   uint32_t key_length() const { return type::IPv6::LENGTH; }
00053 
00054   int  store(const char *to,uint32_t length, const charset_info_st * const charset);
00055   int  store(int64_t nr, bool unsigned_val);
00056   double val_real() const;
00057   int64_t val_int() const;
00058   String *val_str(String*,String *) const;
00059   void sql_type(drizzled::String&)  const;
00060   int store_decimal(const drizzled::type::Decimal*);
00061 
00062   Item_result result_type () const { return STRING_RESULT; }
00063   int cmp(const unsigned char*, const unsigned char*);
00064   void sort_string(unsigned char*, uint32_t);
00065   uint32_t max_display_length() { return type::IPv6::IPV6_DISPLAY_LENGTH; }
00066 
00067   int  store(double ) { return 0; }
00068   inline String *val_str(String *str) { return val_str(str, str); }
00069   uint32_t size_of() const { return sizeof(*this); }
00070 
00071   static size_t max_string_length()
00072   {
00073     return type::IPv6::LENGTH;
00074   }
00075 };
00076 
00077 } /* namespace field */
00078 } /* namespace drizzled */
00079 
00080