| 1 |
pippijn |
1.1 |
#include <map> |
| 2 |
|
|
|
| 3 |
|
|
#include <atheme.h> |
| 4 |
|
|
#include <users.h> |
| 5 |
|
|
|
| 6 |
|
|
#include <connection.h> |
| 7 |
|
|
|
| 8 |
|
|
#include <account/chanacs.h> |
| 9 |
|
|
#include <account/kline.h> |
| 10 |
|
|
#include <account/metadata.h> |
| 11 |
|
|
#include <account/mychan.h> |
| 12 |
|
|
#include <account/mymemo.h> |
| 13 |
|
|
#include <account/mynick.h> |
| 14 |
|
|
#include <account/myuser.h> |
| 15 |
|
|
#include <account/svsignore.h> |
| 16 |
|
|
#include <confparse.h> |
| 17 |
|
|
#include <servers.h> |
| 18 |
|
|
|
| 19 |
|
|
// macro clashes |
| 20 |
|
|
#undef _ |
| 21 |
|
|
#define warn_opers warn |
| 22 |
|
|
#undef warn |
| 23 |
|
|
|
| 24 |
|
|
#include <EXTERN.h> |
| 25 |
|
|
#include <perl.h> |
| 26 |
|
|
#include <XSUB.h> |
| 27 |
|
|
|
| 28 |
|
|
#include "perlxsi.c" |
| 29 |
|
|
|
| 30 |
pippijn |
1.2 |
static char const rcsid[] = "$Id: svsperl.xs,v 1.1 2007-07-19 08:24:54 pippijn Exp $"; |
| 31 |
pippijn |
1.1 |
|
| 32 |
|
|
struct perl_listeners : callback::has_listeners |
| 33 |
|
|
{ |
| 34 |
|
|
}; |
| 35 |
|
|
|
| 36 |
|
|
perl_listeners listeners; |
| 37 |
|
|
|
| 38 |
pippijn |
1.2 |
DECLARE_MODULE_V1 ("misc/svsperl", false, _modinit, _moddeinit, "$Id: svsperl.xs,v 1.1 2007-07-19 08:24:54 pippijn Exp $", "The Ermyth Team <http://services.one09.net>"); |
| 39 |
pippijn |
1.1 |
|
| 40 |
|
|
static PerlInterpreter *perl; |
| 41 |
|
|
|
| 42 |
|
|
static HV *stash_svs; |
| 43 |
|
|
|
| 44 |
|
|
// Make an std::map<char *, char *> from a HV |
| 45 |
|
|
typedef std::map<char *, char *, str_lt> charmap; |
| 46 |
|
|
|
| 47 |
|
|
charmap |
| 48 |
|
|
HvMAP (HV *hv) |
| 49 |
|
|
{ |
| 50 |
|
|
SV *sv; |
| 51 |
|
|
char *key; |
| 52 |
|
|
STRLEN len; |
| 53 |
|
|
charmap hvmap; |
| 54 |
|
|
|
| 55 |
|
|
I32 i, count = hv_iterinit (hv); |
| 56 |
|
|
|
| 57 |
|
|
for (i = 1; i <= count; i++) |
| 58 |
|
|
{ |
| 59 |
|
|
sv = hv_iternextsv(hv, &key, (I32*) &len); |
| 60 |
|
|
hvmap[key] = SvPV(sv, len); |
| 61 |
|
|
} |
| 62 |
|
|
|
| 63 |
|
|
return hvmap; |
| 64 |
|
|
} |
| 65 |
|
|
|
| 66 |
|
|
|
| 67 |
|
|
void * |
| 68 |
|
|
get_mortalspace (int nbytes) |
| 69 |
|
|
{ |
| 70 |
|
|
SV *mortal; |
| 71 |
|
|
mortal = sv_2mortal (NEWSV (2040, nbytes)); |
| 72 |
|
|
return (void *) SvPVX (mortal); |
| 73 |
|
|
} |
| 74 |
|
|
|
| 75 |
|
|
// convert a perl arrayref to a char* array |
| 76 |
|
|
char ** |
| 77 |
|
|
XS_unpack_charPtrPtr (SV *arg) |
| 78 |
|
|
{ |
| 79 |
|
|
AV *avref; |
| 80 |
|
|
char **array; |
| 81 |
|
|
int len; |
| 82 |
|
|
SV **elem; |
| 83 |
|
|
int i; |
| 84 |
|
|
|
| 85 |
|
|
avref = (AV *) SvRV (arg); |
| 86 |
|
|
len = av_len (avref) + 1; |
| 87 |
|
|
|
| 88 |
|
|
array = (char **) get_mortalspace ((len + 1) * sizeof (*array)); |
| 89 |
|
|
|
| 90 |
|
|
for (i = 0; i < len; i++) { |
| 91 |
|
|
elem = av_fetch (avref, i, 0); |
| 92 |
|
|
array[i] = SvPV_nolen (*elem); |
| 93 |
|
|
} |
| 94 |
|
|
|
| 95 |
|
|
array[len] = NULL; |
| 96 |
|
|
|
| 97 |
|
|
return array; |
| 98 |
|
|
} |
| 99 |
|
|
|
| 100 |
|
|
// convert char* array to perl arrayref |
| 101 |
|
|
void |
| 102 |
|
|
XS_pack_charPtrPtr (SV *arg, char **array, int count) |
| 103 |
|
|
{ |
| 104 |
|
|
int i; |
| 105 |
|
|
AV *avref; |
| 106 |
|
|
|
| 107 |
|
|
avref = (AV *) sv_2mortal ((SV *) newAV ()); |
| 108 |
|
|
|
| 109 |
|
|
for (i = 0; i < count; i++) |
| 110 |
|
|
av_push (avref, newSVpv (array[i], strlen (array[i]))); |
| 111 |
|
|
|
| 112 |
|
|
SvSetSV (arg, newRV ((SV *) avref)); |
| 113 |
|
|
} |
| 114 |
|
|
|
| 115 |
|
|
|
| 116 |
|
|
SV *sv_cast (char const * v) { return newSVpv (v, 0); } |
| 117 |
|
|
SV *sv_cast (bool v) { return newSViv (v); } |
| 118 |
|
|
SV *sv_cast ( signed char v) { return newSViv (v); } |
| 119 |
|
|
SV *sv_cast (unsigned char v) { return newSViv (v); } |
| 120 |
|
|
SV *sv_cast ( signed short v) { return newSViv (v); } |
| 121 |
|
|
SV *sv_cast (unsigned short v) { return newSVuv (v); } |
| 122 |
|
|
SV *sv_cast ( signed int v) { return newSViv (v); } |
| 123 |
|
|
SV *sv_cast (unsigned int v) { return newSVuv (v); } |
| 124 |
|
|
SV *sv_cast ( signed long v) { return newSViv (v); } |
| 125 |
|
|
SV *sv_cast (unsigned long v) { return newSVuv (v); } |
| 126 |
|
|
SV *sv_cast (float v) { return newSVnv (v); } |
| 127 |
|
|
SV *sv_cast (double v) { return newSVnv (v); } |
| 128 |
|
|
|
| 129 |
|
|
// base template for casting from SV * |
| 130 |
|
|
template<class outT> outT sv_cast (SV *from); |
| 131 |
|
|
|
| 132 |
|
|
template<> char const * sv_cast<char const * > (SV *from) { return SvOK (from) ? SvPV_nolen (from) : 0; } |
| 133 |
|
|
template<> bool sv_cast<bool > (SV *from) { return SvIV (from); } |
| 134 |
|
|
template<> signed char sv_cast< signed char > (SV *from) { return SvIV (from); } |
| 135 |
|
|
template<> unsigned char sv_cast<unsigned char > (SV *from) { return SvUV (from); } |
| 136 |
|
|
template<> signed short sv_cast< signed short> (SV *from) { return SvIV (from); } |
| 137 |
|
|
template<> unsigned short sv_cast<unsigned short> (SV *from) { return SvUV (from); } |
| 138 |
|
|
template<> signed int sv_cast< signed int > (SV *from) { return SvIV (from); } |
| 139 |
|
|
template<> unsigned int sv_cast<unsigned int > (SV *from) { return SvUV (from); } |
| 140 |
|
|
template<> signed long sv_cast< signed long > (SV *from) { return SvIV (from); } |
| 141 |
|
|
template<> unsigned long sv_cast<unsigned long > (SV *from) { return SvUV (from); } |
| 142 |
|
|
template<> float sv_cast<float > (SV *from) { return SvNV (from); } |
| 143 |
|
|
template<> double sv_cast<double > (SV *from) { return SvNV (from); } |
| 144 |
|
|
|
| 145 |
|
|
|
| 146 |
|
|
void |
| 147 |
|
|
_perlinit () |
| 148 |
|
|
{ |
| 149 |
|
|
stash_svs = gv_stashpvn ("svs", 3, 1); |
| 150 |
|
|
} |
| 151 |
|
|
|
| 152 |
|
|
void |
| 153 |
|
|
_modinit (module_t *m) |
| 154 |
|
|
{ |
| 155 |
|
|
PERL_SYS_INIT3 (&me.argc, &me.argv, 0); |
| 156 |
|
|
perl = perl_alloc (); |
| 157 |
|
|
perl_construct (perl); |
| 158 |
|
|
|
| 159 |
|
|
PL_exit_flags |= PERL_EXIT_DESTRUCT_END; |
| 160 |
|
|
|
| 161 |
|
|
char *argv[] = { |
| 162 |
|
|
me.argv [0], |
| 163 |
|
|
"-e" |
| 164 |
|
|
"use strict; use warnings; use utf8;" |
| 165 |
|
|
"svs->bootstrap;" |
| 166 |
|
|
"unshift @INC, svs::DATADIR ();" |
| 167 |
|
|
"require svs;" |
| 168 |
|
|
}; |
| 169 |
|
|
|
| 170 |
|
|
if (perl_parse (perl, xs_init, 2, argv, NULL) |
| 171 |
|
|
|| perl_run (perl)) |
| 172 |
|
|
{ |
| 173 |
|
|
m->mflags = MODTYPE_FAIL; |
| 174 |
|
|
return; |
| 175 |
|
|
} |
| 176 |
|
|
|
| 177 |
|
|
dSP; |
| 178 |
|
|
|
| 179 |
|
|
PUSHMARK (SP); |
| 180 |
|
|
PUTBACK; |
| 181 |
|
|
call_pv ("svs::init", G_DISCARD | G_VOID); |
| 182 |
|
|
} |
| 183 |
|
|
|
| 184 |
|
|
void |
| 185 |
|
|
_moddeinit () |
| 186 |
|
|
{ |
| 187 |
|
|
perl_destruct (perl); |
| 188 |
|
|
perl_free (perl); |
| 189 |
|
|
PERL_SYS_TERM (); |
| 190 |
|
|
} |
| 191 |
|
|
|
| 192 |
|
|
MODULE = svs PACKAGE = svs |
| 193 |
|
|
|
| 194 |
|
|
BOOT: |
| 195 |
|
|
{ |
| 196 |
|
|
#define const_iv(name) { #name, name } |
| 197 |
|
|
#define stash_pv(name) newCONSTSUB (stash_svs, #name, newSVpv (name, sizeof (name) - 1)) |
| 198 |
|
|
|
| 199 |
|
|
_perlinit (); |
| 200 |
|
|
|
| 201 |
|
|
// provided on the commandline |
| 202 |
|
|
stash_pv (PREFIX); |
| 203 |
|
|
stash_pv (LOCALEDIR); |
| 204 |
|
|
stash_pv (SHAREDIR); |
| 205 |
|
|
stash_pv (SYSCONFDIR); |
| 206 |
|
|
stash_pv (LOGDIR); |
| 207 |
|
|
stash_pv (RUNDIR); |
| 208 |
|
|
stash_pv (DATADIR); |
| 209 |
|
|
|
| 210 |
|
|
stash_pv (PRIV_USER_AUSPEX); |
| 211 |
|
|
stash_pv (PRIV_USER_ADMIN); |
| 212 |
|
|
stash_pv (PRIV_USER_SENDPASS); |
| 213 |
|
|
stash_pv (PRIV_USER_VHOST); |
| 214 |
|
|
stash_pv (PRIV_USER_FREGISTER); |
| 215 |
|
|
stash_pv (PRIV_CHAN_AUSPEX); |
| 216 |
|
|
stash_pv (PRIV_CHAN_ADMIN); |
| 217 |
|
|
stash_pv (PRIV_CHAN_CMODES); |
| 218 |
|
|
stash_pv (PRIV_JOIN_STAFFONLY); |
| 219 |
|
|
stash_pv (PRIV_MARK); |
| 220 |
|
|
stash_pv (PRIV_HOLD); |
| 221 |
|
|
stash_pv (PRIV_REG_NOLIMIT); |
| 222 |
|
|
stash_pv (PRIV_SERVER_AUSPEX); |
| 223 |
|
|
stash_pv (PRIV_VIEWPRIVS); |
| 224 |
|
|
stash_pv (PRIV_FLOOD); |
| 225 |
|
|
stash_pv (PRIV_METADATA); |
| 226 |
|
|
stash_pv (PRIV_ADMIN); |
| 227 |
|
|
stash_pv (PRIV_OMODE); |
| 228 |
|
|
stash_pv (PRIV_AKILL); |
| 229 |
|
|
stash_pv (PRIV_MASS_AKILL); |
| 230 |
|
|
stash_pv (PRIV_JUPE); |
| 231 |
|
|
stash_pv (PRIV_NOOP); |
| 232 |
|
|
stash_pv (PRIV_GLOBAL); |
| 233 |
|
|
stash_pv (PRIV_GRANT); |
| 234 |
|
|
|
| 235 |
|
|
stash_pv (AC_IRCOP); |
| 236 |
|
|
stash_pv (AC_SRA); |
| 237 |
|
|
|
| 238 |
|
|
stash_pv (PACKAGE); |
| 239 |
|
|
stash_pv (PACKAGE_BUGREPORT); |
| 240 |
|
|
stash_pv (PACKAGE_NAME); |
| 241 |
|
|
stash_pv (PACKAGE_STRING); |
| 242 |
|
|
stash_pv (PACKAGE_TARNAME); |
| 243 |
|
|
stash_pv (PACKAGE_VERSION); |
| 244 |
|
|
stash_pv (VERSION); |
| 245 |
|
|
#undef stash_pv |
| 246 |
|
|
|
| 247 |
|
|
static const struct { |
| 248 |
|
|
char *name; |
| 249 |
|
|
IV iv; |
| 250 |
|
|
} *civ, const_iv[] = { |
| 251 |
|
|
// channels.h |
| 252 |
|
|
const_iv (MAXEXTMODES), |
| 253 |
|
|
|
| 254 |
|
|
const_iv (CMODE_OP), const_iv (CMODE_VOICE), const_iv (CMODE_INVITE), const_iv (CMODE_KEY), const_iv (CMODE_LIMIT), |
| 255 |
|
|
const_iv (CMODE_MOD), const_iv (CMODE_NOEXT), const_iv (CMODE_PRIV), const_iv (CMODE_SEC), const_iv (CMODE_TOPIC), |
| 256 |
|
|
|
| 257 |
|
|
const_iv (MTYPE_NUL), const_iv (MTYPE_ADD), const_iv (MTYPE_DEL), |
| 258 |
|
|
|
| 259 |
|
|
// common.h |
| 260 |
|
|
const_iv (BUFSIZE), const_iv (MAXMODES), const_iv (MAX_EVENTS), const_iv (HOSTLEN), const_iv (NICKLEN), const_iv (IDLEN), |
| 261 |
|
|
const_iv (CHANNELLEN), const_iv (USERLEN), const_iv (HOSTIPLEN), const_iv (GECOSLEN), const_iv (KEYLEN), const_iv (EMAILLEN), |
| 262 |
|
|
const_iv (MEMOLEN), const_iv (MAXMSIGNORES), |
| 263 |
|
|
|
| 264 |
|
|
// confparse.h |
| 265 |
|
|
const_iv (TOKEN_UNMATCHED), const_iv (TOKEN_ERROR), |
| 266 |
|
|
|
| 267 |
|
|
// connection.h |
| 268 |
|
|
const_iv (CF_UPLINK), const_iv (CF_DCCOUT), const_iv (CF_DCCIN), const_iv (CF_CONNECTING), const_iv (CF_LISTENING), |
| 269 |
|
|
const_iv (CF_CONNECTED), const_iv (CF_DEAD), const_iv (CF_NONEWLINE), const_iv (CF_SEND_EOF), const_iv (CF_SEND_DEAD), |
| 270 |
|
|
|
| 271 |
|
|
// global.h |
| 272 |
|
|
const_iv (AUTH_NONE), const_iv (AUTH_EMAIL), |
| 273 |
|
|
|
| 274 |
|
|
const_iv (RF_LIVE), const_iv (RF_SHUTDOWN), const_iv (RF_STARTING), const_iv (RF_RESTART), const_iv (RF_REHASHING), |
| 275 |
|
|
|
| 276 |
|
|
// match.h |
| 277 |
|
|
const_iv (MATCH_RFC1459), const_iv (MATCH_ASCII), const_iv (C_ALPHA), const_iv (C_DIGIT), const_iv (AREGEX_ICASE), |
| 278 |
|
|
|
| 279 |
|
|
// metadata.h |
| 280 |
|
|
const_iv (MYUSER), const_iv (MYCHAN), const_iv (CHANACS), |
| 281 |
|
|
|
| 282 |
|
|
// module.h |
| 283 |
|
|
const_iv (MODTYPE_STANDARD), const_iv (MODTYPE_CORE), const_iv (MODTYPE_FAIL), |
| 284 |
|
|
|
| 285 |
|
|
const_iv (MAX_CMD_PARC), |
| 286 |
|
|
|
| 287 |
|
|
// phandler.h |
| 288 |
|
|
const_iv (PROTOCOL_ASUKA), const_iv (PROTOCOL_BAHAMUT), const_iv (PROTOCOL_CHARYBDIS), const_iv (PROTOCOL_DREAMFORGE), |
| 289 |
|
|
const_iv (PROTOCOL_HYPERION), const_iv (PROTOCOL_INSPIRCD), const_iv (PROTOCOL_IRCNET), const_iv (PROTOCOL_MONKEY), |
| 290 |
|
|
const_iv (PROTOCOL_PLEXUS), const_iv (PROTOCOL_PTLINK), const_iv (PROTOCOL_RATBOX), const_iv (PROTOCOL_SCYLLA), |
| 291 |
|
|
const_iv (PROTOCOL_SHADOWIRCD), const_iv (PROTOCOL_SORCERY), const_iv (PROTOCOL_ULTIMATE3), const_iv (PROTOCOL_UNDERNET), |
| 292 |
|
|
const_iv (PROTOCOL_UNREAL), const_iv (PROTOCOL_SOLIDIRCD), const_iv (PROTOCOL_NEFARIOUS), const_iv (PROTOCOL_OFFICEIRC), |
| 293 |
|
|
const_iv (PROTOCOL_OTHER), |
| 294 |
|
|
|
| 295 |
|
|
const_iv (IRCD_CIDR_BANS), |
| 296 |
|
|
|
| 297 |
|
|
const_iv (FNC_REGAIN), const_iv (FNC_FORCE), |
| 298 |
|
|
|
| 299 |
|
|
// privs.h |
| 300 |
|
|
const_iv (OPERCLASS_NEEDOPER), const_iv (SOPER_CONF), |
| 301 |
|
|
|
| 302 |
|
|
// sasl.h |
| 303 |
|
|
const_iv (ASASL_FAIL), const_iv (ASASL_MORE), const_iv (ASASL_DONE), const_iv (ASASL_MARKED_FOR_DELETION), |
| 304 |
|
|
const_iv (ASASL_NEED_LOG), |
| 305 |
|
|
|
| 306 |
|
|
// servers.h |
| 307 |
|
|
const_iv (SF_HIDE), const_iv (SF_EOB), const_iv (SF_EOB2), const_iv (SF_JUPE_PENDING), |
| 308 |
|
|
|
| 309 |
|
|
// tools.h |
| 310 |
|
|
const_iv (EMAIL_REGISTER), const_iv (EMAIL_SENDPASS), const_iv (EMAIL_SETEMAIL), |
| 311 |
|
|
const_iv (EMAIL_MEMO), const_iv (EMAIL_SETPASS), |
| 312 |
|
|
|
| 313 |
|
|
const_iv (LG_NONE), const_iv (LG_INFO), const_iv (LG_ERROR), const_iv (LG_IOERROR), const_iv (LG_DEBUG), |
| 314 |
|
|
const_iv (LG_CMD_ADMIN), const_iv (LG_CMD_REGISTER), const_iv (LG_CMD_SET), const_iv (LG_CMD_DO), |
| 315 |
|
|
const_iv (LG_CMD_LOGIN), const_iv (LG_CMD_GET), const_iv (LG_NETWORK), const_iv (LG_WALLOPS), |
| 316 |
|
|
const_iv (LG_RAWDATA), const_iv (LG_REGISTER), const_iv (LG_WARN1), const_iv (LG_WARN2), |
| 317 |
|
|
const_iv (LG_CMD_ALL), const_iv (LG_ALL), |
| 318 |
|
|
|
| 319 |
|
|
const_iv (CMDLOG_ADMIN), const_iv (CMDLOG_REGISTER), const_iv (CMDLOG_SET), const_iv (CMDLOG_DO), |
| 320 |
|
|
const_iv (CMDLOG_LOGIN), const_iv (CMDLOG_GET), |
| 321 |
|
|
|
| 322 |
|
|
// users.h |
| 323 |
|
|
const_iv (UF_AWAY), const_iv (UF_INVIS), const_iv (UF_IRCOP), |
| 324 |
|
|
const_iv (UF_ADMIN), const_iv (UF_SEENINFO), const_iv (UF_HIDEHOSTREQ), |
| 325 |
|
|
|
| 326 |
|
|
// account/chanacs.h |
| 327 |
|
|
const_iv (CA_VOICE), const_iv (CA_AUTOVOICE), const_iv (CA_OP), const_iv (CA_AUTOOP), const_iv (CA_TOPIC), |
| 328 |
|
|
const_iv (CA_SET), const_iv (CA_REMOVE), const_iv (CA_INVITE), const_iv (CA_RECOVER), const_iv (CA_FLAGS), |
| 329 |
|
|
const_iv (CA_HALFOP), const_iv (CA_AUTOHALFOP), const_iv (CA_ACLVIEW), const_iv (CA_AKICK), const_iv (CA_NONE), |
| 330 |
|
|
const_iv (CA_VOP_DEF), const_iv (CA_HOP_DEF), const_iv (CA_AOP_DEF), const_iv (CA_SOP_DEF), const_iv (CA_SUCCESSOR_0), |
| 331 |
|
|
const_iv (CA_FOUNDER_0), const_iv (CA_INITIAL), const_iv (CA_USEDUPDATE), const_iv (CA_ALLPRIVS), |
| 332 |
|
|
const_iv (CA_ALL_ALL), const_iv (OLD_CA_AOP), |
| 333 |
|
|
const_iv (SHRIKE_CA_VOP), const_iv (SHRIKE_CA_AOP), const_iv (SHRIKE_CA_SOP), const_iv (SHRIKE_CA_FOUNDER), |
| 334 |
|
|
const_iv (SHRIKE_CA_SUCCESSOR), |
| 335 |
|
|
|
| 336 |
|
|
// account/mychan.h |
| 337 |
|
|
const_iv (MC_HOLD), const_iv (MC_NOOP), const_iv (MC_RESTRICTED), const_iv (MC_SECURE), const_iv (MC_VERBOSE), |
| 338 |
|
|
const_iv (MC_STAFFONLY), const_iv (MC_KEEPTOPIC), const_iv (MC_VERBOSE_OPS), const_iv (MC_TOPICLOCK), |
| 339 |
|
|
const_iv (MC_GUARD), const_iv (MC_INHABIT), const_iv (MC_MLOCK_CHECK), const_iv (MC_FORCEVERBOSE), |
| 340 |
|
|
const_iv (MC_VERBOSE_MASK), |
| 341 |
|
|
|
| 342 |
|
|
// account/mymemo.h |
| 343 |
|
|
const_iv (MEMO_READ), const_iv (MEMO_CHANNEL), const_iv (MEMO_MAX_NUM), const_iv (MEMO_MAX_TIME), |
| 344 |
|
|
|
| 345 |
|
|
// account/myuser.h |
| 346 |
|
|
const_iv (MU_HOLD), const_iv (MU_NEVEROP), const_iv (MU_NOOP), const_iv (MU_WAITAUTH), const_iv (MU_HIDEMAIL), |
| 347 |
|
|
const_iv (MU_OLD_ALIAS), const_iv (MU_NOMEMO), const_iv (MU_EMAILMEMOS), const_iv (MU_CRYPTPASS), |
| 348 |
|
|
const_iv (MU_OLD_SASL), const_iv (MU_NOBURSTLOGIN) |
| 349 |
|
|
}; |
| 350 |
|
|
#undef const_iv |
| 351 |
|
|
|
| 352 |
|
|
for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
| 353 |
|
|
newCONSTSUB (stash_svs, civ->name, newSViv (civ->iv)); |
| 354 |
|
|
} |
| 355 |
|
|
|
| 356 |
|
|
void slog (unsigned level, char *msg) |
| 357 |
|
|
|
| 358 |
|
|
char *gen_pw (int sz) |
| 359 |
|
|
|
| 360 |
|
|
void tb2sp (char *line) |
| 361 |
|
|
|
| 362 |
|
|
char *replace (char *s, int size, char const *src, char const *dest) |
| 363 |
|
|
|
| 364 |
|
|
#-------------------------------------------------- |
| 365 |
|
|
# char *itoa (int num) |
| 366 |
|
|
# CODE: |
| 367 |
|
|
# RETVAL = itoa<char> (num); |
| 368 |
|
|
# OUTPUT: |
| 369 |
|
|
# RETVAL |
| 370 |
|
|
# |
| 371 |
|
|
# int validemail (char *email) |
| 372 |
|
|
# |
| 373 |
|
|
# bool validhostmask (char *host) |
| 374 |
|
|
# |
| 375 |
|
|
# char const *sbytes (float x) |
| 376 |
|
|
# |
| 377 |
|
|
# float bytes (float x) |
| 378 |
|
|
# |
| 379 |
|
|
# unsigned long makekey () |
| 380 |
|
|
# |
| 381 |
|
|
# unsigned int shash (unsigned char const *text) |
| 382 |
|
|
# |
| 383 |
|
|
# char *time_ago (time_t event) |
| 384 |
|
|
# |
| 385 |
|
|
# char *timediff (time_t seconds) |
| 386 |
|
|
# |
| 387 |
|
|
# int sjtoken (char *message, char delimiter, AV *parv) |
| 388 |
|
|
# CODE: |
| 389 |
|
|
# { |
| 390 |
|
|
# char *cparv[256]; |
| 391 |
|
|
# int i; |
| 392 |
|
|
# RETVAL = sjtoken (message, delimiter, cparv); |
| 393 |
|
|
# |
| 394 |
|
|
# /if (!parv) |
| 395 |
|
|
# { |
| 396 |
|
|
# parv = newAV (); |
| 397 |
|
|
# av_extend (parv, RETVAL); |
| 398 |
|
|
# } |
| 399 |
|
|
# |
| 400 |
|
|
# for (i = 0; i < RETVAL; i++) |
| 401 |
|
|
# av_push (parv, newSVpv (cparv[i], 0)); |
| 402 |
|
|
# } |
| 403 |
|
|
# OUTPUT: |
| 404 |
|
|
# RETVAL |
| 405 |
|
|
# |
| 406 |
|
|
# char const *uinttobase64 (char *buf, uint64_t v, int64_t count) |
| 407 |
|
|
# |
| 408 |
|
|
# unsigned int base64touint (char const *buf) |
| 409 |
|
|
# |
| 410 |
|
|
# |
| 411 |
|
|
# MODULE = svs PACKAGE = svs::kline_t |
| 412 |
|
|
# |
| 413 |
|
|
# kline_t * |
| 414 |
|
|
# new (char const *klass, char *user, char *host, char *reason, long duration) |
| 415 |
|
|
# CODE: |
| 416 |
|
|
# RETVAL = kline_t::create (user, host, reason, duration); |
| 417 |
|
|
# OUTPUT: |
| 418 |
|
|
# RETVAL |
| 419 |
|
|
# |
| 420 |
|
|
# void |
| 421 |
|
|
# destroy (char const *klass, char const *user, char const *host) |
| 422 |
|
|
# CODE: |
| 423 |
|
|
# kline_t::destroy (user, host); |
| 424 |
|
|
# |
| 425 |
|
|
# kline_t * |
| 426 |
|
|
# find (char const *klass, char const *user, char const *host) |
| 427 |
|
|
# CODE: |
| 428 |
|
|
# RETVAL = kline_t::find (user, host); |
| 429 |
|
|
# OUTPUT: |
| 430 |
|
|
# RETVAL |
| 431 |
|
|
# |
| 432 |
|
|
# kline_t * |
| 433 |
|
|
# find_num (char const *klass, unsigned number) |
| 434 |
|
|
# CODE: |
| 435 |
|
|
# RETVAL = kline_t::find (number); |
| 436 |
|
|
# OUTPUT: |
| 437 |
|
|
# RETVAL |
| 438 |
|
|
# |
| 439 |
|
|
# kline_t * |
| 440 |
|
|
# find_user (char const *klass, user_t *u) |
| 441 |
|
|
# CODE: |
| 442 |
|
|
# RETVAL = kline_t::find (u); |
| 443 |
|
|
# OUTPUT: |
| 444 |
|
|
# RETVAL |
| 445 |
|
|
# |
| 446 |
|
|
# INCLUDE: $PERL $SRCDIR/svsperl/genacc kline_t $SRCDIR/../../include/account/kline.h | |
| 447 |
|
|
# |
| 448 |
|
|
# |
| 449 |
|
|
# MODULE = svs PACKAGE = svs::server_t |
| 450 |
|
|
# |
| 451 |
|
|
# server_t * |
| 452 |
|
|
# new (char const *klass, char const *name, unsigned int hops, char const *uplink, char const *id, char const *desc) |
| 453 |
|
|
# CODE: |
| 454 |
|
|
# RETVAL = server_t::create (name, hops, uplink, id, desc); |
| 455 |
|
|
# OUTPUT: |
| 456 |
|
|
# RETVAL |
| 457 |
|
|
# |
| 458 |
|
|
# server_t * |
| 459 |
|
|
# find (char const *klass, char const *name) |
| 460 |
|
|
# CODE: |
| 461 |
|
|
# RETVAL = server_t::find (name); |
| 462 |
|
|
# OUTPUT: |
| 463 |
|
|
# RETVAL |
| 464 |
|
|
# |
| 465 |
|
|
# void |
| 466 |
|
|
# destroy (char const *klass, char const *name) |
| 467 |
|
|
# CODE: |
| 468 |
|
|
# server_delete (name); |
| 469 |
|
|
# |
| 470 |
|
|
# INCLUDE: $PERL $SRCDIR/svsperl/genacc server_t $SRCDIR/../../include/servers.h | |
| 471 |
|
|
# |
| 472 |
|
|
# |
| 473 |
|
|
# MODULE = svs PACKAGE = svs::svsignore_t |
| 474 |
|
|
# |
| 475 |
|
|
# svsignore_t * |
| 476 |
|
|
# new (char const *klass, char *mask, char *reason) |
| 477 |
|
|
# CODE: |
| 478 |
|
|
# RETVAL = svsignore_add (mask, reason); |
| 479 |
|
|
# OUTPUT: |
| 480 |
|
|
# RETVAL |
| 481 |
|
|
# |
| 482 |
|
|
# void |
| 483 |
|
|
# svsignore_t::DESTROY () |
| 484 |
|
|
# CODE: |
| 485 |
|
|
# svsignore_delete (THIS); |
| 486 |
|
|
# |
| 487 |
|
|
# svsignore_t * |
| 488 |
|
|
# find (char const *klass, user_t *u) |
| 489 |
|
|
# CODE: |
| 490 |
|
|
# RETVAL = svsignore_find (u); |
| 491 |
|
|
# OUTPUT: |
| 492 |
|
|
# RETVAL |
| 493 |
|
|
# |
| 494 |
|
|
# INCLUDE: $PERL $SRCDIR/svsperl/genacc svsignore_t $SRCDIR/../../include/account/svsignore.h | |
| 495 |
|
|
# |
| 496 |
|
|
# |
| 497 |
|
|
# MODULE = svs PACKAGE = svs::user_t |
| 498 |
|
|
# |
| 499 |
|
|
# user_t * |
| 500 |
|
|
# new (char const *klass, char const *nick, char const *user, char const *host, char const *vhost, char const *ip, char const *uid, char const *gecos, server_t *server, time_t ts) |
| 501 |
|
|
# CODE: |
| 502 |
|
|
# RETVAL = user_t::create (nick, user, host, vhost, ip, uid, gecos, server, ts); |
| 503 |
|
|
# OUTPUT: |
| 504 |
|
|
# RETVAL |
| 505 |
|
|
# |
| 506 |
|
|
# void |
| 507 |
|
|
# user_t::DESTROY () |
| 508 |
|
|
# CODE: |
| 509 |
|
|
# user_delete (THIS); |
| 510 |
|
|
# |
| 511 |
|
|
# user_t * |
| 512 |
|
|
# find (char const *klass, char const *nick) |
| 513 |
|
|
# CODE: |
| 514 |
|
|
# RETVAL = user_t::find (nick); |
| 515 |
|
|
# OUTPUT: |
| 516 |
|
|
# RETVAL |
| 517 |
|
|
# |
| 518 |
|
|
# user_t * |
| 519 |
|
|
# find_named (char const *klass, char const *nick) |
| 520 |
|
|
# CODE: |
| 521 |
|
|
# RETVAL = user_t::find_named (nick); |
| 522 |
|
|
# OUTPUT: |
| 523 |
|
|
# RETVAL |
| 524 |
|
|
# |
| 525 |
|
|
# INCLUDE: $PERL $SRCDIR/svsperl/genacc user_t $SRCDIR/../../include/users.h | |
| 526 |
|
|
#-------------------------------------------------- |