Main Page | Class Hierarchy | Class List | Directories | File List | Class Members

Validate.h

00001 /* -*- Mode: C++; c-file-style: "stroustrup"; indent-tabs-mode: nil -*- */
00002 /*
00003  * Validate.h
00004  *   Header file for the Validate class.
00005  *
00006  * $Id: Validate.h,v 1.11 2002/03/30 22:21:17 benoit Exp $
00007  *
00008  * Copyright (c) 2000 Remi Lefebvre <remi@dhis.net>
00009  *                and Luca Filipozzi <lfilipoz@dhis.net>
00010  *                and Benoit Joly <benoit@dhis.net>
00011  *
00012  * Licensed under the GPLv2
00013  */
00014 
00015 #ifndef VALIDATE_H
00016 #define VALIDATE_H
00017 
00018 #include <sys/types.h>
00019 #include <regexx.hh>
00020 
00021 #include <fstream>
00022 
00023 #include "DdtManager.h"
00024 
00025 using namespace regexx;
00026 
00027 class Validate
00028 {
00029 public:
00030     Validate(const char *bannedHostFileName, const char *reservedHostFileName);
00031     ~Validate ();
00032 
00033     // FIXME: no check to prevent stealing subdomains
00034       
00035     bool isThirdLevelDomain(const char *domain);
00036     bool isValidDomain(const char *domain, const char *baseDomain);
00037     bool isValidDomain(const char *domain);
00038     bool isBannedDomain(const char *domain);
00039     bool isReservedDomain(const char *domain);
00040     bool email(const char *email, const char *baseDomain);
00041     bool name(const char *name);
00042     bool ip(const char *ip);
00043           
00044     // check validity of a record request
00045     bool recordAdd (DdtManager *manager, int id, const char *dname, 
00046                     DnsRecordType type, const char *data, 
00047                     const char *baseDomain);
00048 protected:
00049     Validate () { /* intentionally empty */ };
00050 
00051 private:
00052     Regexx *rxx;
00053     char *bannedHostFileName;
00054     char *reservedHostFileName;
00055 };
00056 #endif // VALIDATE_H

Generated on Tue Sep 13 01:32:47 2005 for DDT Project by  doxygen 1.4.4