00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <config.h>
00021
00022 #include <stdio.h>
00023 #include <stdlib.h>
00024
00025 #ifdef HAVE_STRING_H
00026 #include <string.h>
00027 #endif
00028
00029 #include "protocol.h"
00030
00031
00032 static Protocol_T mydefault= NULL;
00033 static Protocol_T myhttp= NULL;
00034 static Protocol_T myftp= NULL;
00035 static Protocol_T mysmtp= NULL;
00036 static Protocol_T mypop= NULL;
00037 static Protocol_T myimap= NULL;
00038 static Protocol_T mynntp= NULL;
00039 static Protocol_T myssh= NULL;
00040 static Protocol_T mydwp= NULL;
00041 static Protocol_T myldap2= NULL;
00042 static Protocol_T myldap3= NULL;
00043
00044
00057
00058
00059
00060 void gc_protocols() {
00061
00062 free(mydefault); mydefault= NULL;
00063 free(myhttp); myhttp= NULL;
00064 free(myftp); myftp= NULL;
00065 free(mysmtp); mysmtp= NULL;
00066 free(mypop); mypop= NULL;
00067 free(myimap); myimap= NULL;
00068 free(mynntp); mynntp= NULL;
00069 free(myssh); myssh= NULL;
00070 free(mydwp); mydwp= NULL;
00071 free(myldap2); myldap2= NULL;
00072 free(myldap3); myldap3= NULL;
00073
00074 }
00075
00076
00077 void *create_default() {
00078
00079 if(mydefault == NULL) {
00080 static const char *name= "DEFAULT";
00081 mydefault= NEW(mydefault);
00082 mydefault->name= name;
00083 mydefault->check= check_default;
00084 }
00085
00086 return mydefault;
00087
00088 }
00089
00090
00091 void *create_http() {
00092
00093 if(myhttp == NULL) {
00094 static const char *name= "HTTP";
00095 myhttp= NEW(myhttp);
00096 myhttp->name= name;
00097 myhttp->check= check_http;
00098 }
00099
00100 return myhttp;
00101
00102 }
00103
00104
00105 void *create_ftp() {
00106
00107 if(myftp == NULL) {
00108 static const char *name= "FTP";
00109 myftp= NEW(myftp);
00110 myftp->name= name;
00111 myftp->check= check_ftp;
00112 }
00113
00114 return myftp;
00115
00116 }
00117
00118
00119 void *create_smtp() {
00120
00121 if(mysmtp == NULL) {
00122 static const char *name= "SMTP";
00123 mysmtp= NEW(mysmtp);
00124 mysmtp->name= name;
00125 mysmtp->check= check_smtp;
00126 }
00127
00128 return mysmtp;
00129
00130 }
00131
00132
00133 void *create_pop() {
00134
00135 if(mypop == NULL) {
00136 static const char *name= "POP";
00137 mypop= NEW(mypop);
00138 mypop->name= name;
00139 mypop->check= check_pop;
00140 }
00141
00142 return mypop;
00143
00144 }
00145
00146
00147 void *create_imap() {
00148
00149 if(myimap == NULL) {
00150 static const char *name= "IMAP";
00151 myimap= NEW(myimap);
00152 myimap->name= name;
00153 myimap->check= check_imap;
00154 }
00155
00156 return myimap;
00157
00158 }
00159
00160
00161 void *create_nntp() {
00162
00163 if(mynntp == NULL) {
00164 static const char *name= "NNTP";
00165 mynntp= NEW(mynntp);
00166 mynntp->name= name;
00167 mynntp->check= check_nntp;
00168 }
00169
00170 return mynntp;
00171
00172 }
00173
00174
00175 void *create_ssh() {
00176
00177 if(myssh == NULL) {
00178 static const char *name= "SSH";
00179 myssh= NEW(myssh);
00180 myssh->name= name;
00181 myssh->check= check_ssh;
00182 }
00183
00184 return myssh;
00185
00186 }
00187
00188
00189 void *create_dwp() {
00190
00191 if(mydwp == NULL) {
00192 static const char *name= "DWP";
00193 mydwp= NEW(mydwp);
00194 mydwp->name= name;
00195 mydwp->check= check_dwp;
00196 }
00197
00198 return mydwp;
00199
00200 }
00201
00202
00203 void *create_ldap2() {
00204
00205 if(myldap2 == NULL) {
00206 static const char *name= "LDAP2";
00207 myldap2= NEW(myldap2);
00208 myldap2->name= name;
00209 myldap2->check= check_ldap2;
00210 }
00211
00212 return myldap2;
00213
00214 }
00215
00216
00217 void *create_ldap3() {
00218
00219 if(myldap3 == NULL) {
00220 static const char *name= "LDAP3";
00221 myldap3= NEW(myldap3);
00222 myldap3->name= name;
00223 myldap3->check= check_ldap3;
00224 }
00225
00226 return myldap3;
00227
00228 }
00229