nis-util  1.0.D108
lib/space/netid.h
Go to the documentation of this file.
00001 //
00002 // nis-util - NIS Administration Utilities
00003 // Copyright (C) 2002, 2008, 2009, 2012 Peter Miller
00004 //
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation; either version 2 of the License, or (at
00008 // your option) any later version.
00009 //
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program. If not, see <http://www.gnu.org/licenses/>.
00017 //
00018 
00019 #ifndef LIB_SPACE_NETID_H
00020 #define LIB_SPACE_NETID_H
00021 
00022 #include <boost/shared_ptr.hpp>
00023 
00024 #include <lib/space.h>
00025 
00032 class space_netid:
00033     public space
00034 {
00035 public:
00036     typedef boost::shared_ptr<space_netid> pointer;
00037 
00041     virtual ~space_netid();
00042 
00050     static pointer create(const rcstring &filename);
00051 
00056     class record
00057     {
00058     public:
00059         typedef boost::shared_ptr<record> pointer;
00060 
00064         ~record();
00065 
00066         typedef std::vector<rcstring> gids_t;
00067 
00072         static pointer create(const source_location &locn, const rcstring &uid1,
00073             const rcstring &domain, const rcstring &uid2, const gids_t &gids);
00074 
00075         const source_location &get_source_location(void) const { return locn; }
00076         rcstring get_uid1(void) const { return uid1; }
00077         rcstring get_domain(void) const { return domain; }
00078         rcstring get_uid2(void) const { return uid2; }
00079         const gids_t &get_gids(void) const { return gids; }
00080 
00081         bool is_host_kind(void) const;
00082 
00086         rcstring name(void) const;
00087 
00094         rcstring representation(void) const;
00095 
00100         void append(const rcstring &gid);
00101 
00102     private:
00106         record(const source_location &locn, const rcstring &uid1,
00107             const rcstring &domain, const rcstring &uid2, const gids_t &gids);
00108 
00109         source_location locn;
00110         rcstring uid1;
00111         rcstring domain;
00112         rcstring uid2;
00113         gids_t gids;
00114 
00118         record();
00119 
00123         record(const record &rhs);
00124 
00128         record &operator=(const record &rhs);
00129     };
00130 
00142     record::pointer get(void);
00143 
00144 protected:
00152     space_netid(const rcstring &filename);
00153 
00154 private:
00155     int last_uid;
00156 
00160     space_netid();
00161 
00165     space_netid(const space_netid &);
00166 
00170     space_netid &operator=(const space_netid &);
00171 };
00172 
00173 // vim: set ts=8 sw=4 et :
00174 #endif // LIB_SPACE_NETID_H