| 1 |
rabbi |
1 |
/* Mixmaster version 3 -- (C) 1999 Anonymizer Inc.
|
| 2 |
|
|
|
| 3 |
|
|
Mixmaster may be redistributed and modified under certain conditions.
|
| 4 |
|
|
This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
|
| 5 |
|
|
ANY KIND, either express or implied. See the file COPYRIGHT for
|
| 6 |
|
|
details.
|
| 7 |
|
|
|
| 8 |
|
|
Function prototypes
|
| 9 |
weaselp |
182 |
$Id: mix3.h,v 1.12 2002/08/25 13:27:40 weaselp Exp $ */
|
| 10 |
rabbi |
1 |
|
| 11 |
|
|
|
| 12 |
|
|
#ifndef _MIX3_H
|
| 13 |
|
|
#define _MIX3_H
|
| 14 |
|
|
#define COPYRIGHT "Copyright Anonymizer Inc."
|
| 15 |
|
|
|
| 16 |
|
|
#include "config.h"
|
| 17 |
|
|
#include "mix.h"
|
| 18 |
|
|
|
| 19 |
|
|
#ifdef WIN32
|
| 20 |
|
|
#ifndef USE_SOCK
|
| 21 |
|
|
#define _WINSOCKAPI_ /* don't include winsock */
|
| 22 |
|
|
#endif
|
| 23 |
|
|
#include <windows.h>
|
| 24 |
rabbi |
11 |
#ifdef _MSC
|
| 25 |
|
|
#define snprintf _snprintf
|
| 26 |
rabbi |
1 |
#endif
|
| 27 |
rabbi |
11 |
#define DIRSEP '\\'
|
| 28 |
|
|
#define DIRSEPSTR "\\"
|
| 29 |
|
|
#else
|
| 30 |
|
|
#define DIRSEP '/'
|
| 31 |
|
|
#define DIRSEPSTR "/"
|
| 32 |
|
|
#endif
|
| 33 |
rabbi |
1 |
|
| 34 |
|
|
#define NOT_IMPLEMENTED {printf("Function not implemented.\n");return -1;}
|
| 35 |
|
|
#define SECONDSPERDAY 86400
|
| 36 |
|
|
|
| 37 |
|
|
/* Dynamically allocated buffers */
|
| 38 |
|
|
|
| 39 |
|
|
int buf_reset(BUFFER *buffer);
|
| 40 |
|
|
int buf_clear(BUFFER *buffer);
|
| 41 |
|
|
int buf_append(BUFFER *buffer, byte *mess, int len);
|
| 42 |
|
|
int buf_cat(BUFFER *to, BUFFER *from);
|
| 43 |
|
|
int buf_set(BUFFER *to, BUFFER *from);
|
| 44 |
|
|
int buf_rest(BUFFER *to, BUFFER *from);
|
| 45 |
|
|
int buf_appendrnd(BUFFER *to, int n);
|
| 46 |
|
|
int buf_appendzero(BUFFER *to, int n);
|
| 47 |
|
|
int buf_setc(BUFFER *buf, byte c);
|
| 48 |
|
|
int buf_appendc(BUFFER *to, byte b);
|
| 49 |
|
|
int buf_setrnd(BUFFER *b, int n);
|
| 50 |
|
|
int buf_setf(BUFFER *buffer, char *fmt, ...);
|
| 51 |
|
|
int buf_appendf(BUFFER *buffer, char *fmt, ...);
|
| 52 |
|
|
int buf_sets(BUFFER *buf, char *s);
|
| 53 |
|
|
int buf_appends(BUFFER *buffer, char *s);
|
| 54 |
|
|
int buf_nl(BUFFER *buffer);
|
| 55 |
|
|
int buf_pad(BUFFER *buffer, int size);
|
| 56 |
|
|
int buf_prepare(BUFFER *buffer, int size);
|
| 57 |
|
|
int buf_rewind(BUFFER *buffer);
|
| 58 |
|
|
int buf_getc(BUFFER *buffer);
|
| 59 |
|
|
void buf_ungetc(BUFFER *buffer);
|
| 60 |
|
|
int buf_get(BUFFER *buffer, BUFFER *to, int n);
|
| 61 |
|
|
int buf_getline(BUFFER *buffer, BUFFER *line);
|
| 62 |
|
|
int buf_chop(BUFFER *b);
|
| 63 |
|
|
void buf_move(BUFFER *dest, BUFFER *src);
|
| 64 |
|
|
byte *buf_data(BUFFER *buffer);
|
| 65 |
weaselp |
116 |
int buf_isheader(BUFFER *buffer);
|
| 66 |
rabbi |
1 |
int buf_getheader(BUFFER *buffer, BUFFER *field, BUFFER *content);
|
| 67 |
|
|
int buf_appendheader(BUFFER *buffer, BUFFER *field, BUFFER *contents);
|
| 68 |
|
|
int buf_lookahead(BUFFER *buffer, BUFFER *line);
|
| 69 |
|
|
int buf_eq(BUFFER *b1, BUFFER *b2);
|
| 70 |
|
|
int buf_ieq(BUFFER *b1, BUFFER *b2);
|
| 71 |
|
|
void buf_cut_out(BUFFER *buffer, BUFFER *cut_out, BUFFER *rest,
|
| 72 |
|
|
int from, int len);
|
| 73 |
|
|
|
| 74 |
|
|
int buf_appendl(BUFFER *b, long l);
|
| 75 |
|
|
int buf_appendl_lo(BUFFER *b, long l);
|
| 76 |
|
|
long buf_getl(BUFFER *b);
|
| 77 |
|
|
long buf_getl_lo(BUFFER *b);
|
| 78 |
|
|
int buf_appendi(BUFFER *b, int i);
|
| 79 |
|
|
int buf_appendi_lo(BUFFER *b, int i);
|
| 80 |
|
|
int buf_geti(BUFFER *b);
|
| 81 |
|
|
int buf_geti_lo(BUFFER *b);
|
| 82 |
|
|
|
| 83 |
|
|
/* String comparison */
|
| 84 |
|
|
int strieq(const char *s1, const char *s2);
|
| 85 |
|
|
int strileft(const char *string, const char *keyword);
|
| 86 |
|
|
int striright(const char *string, const char *keyword);
|
| 87 |
|
|
int strifind(const char *string, const char *keyword);
|
| 88 |
|
|
|
| 89 |
|
|
int streq(const char *s1, const char *s2);
|
| 90 |
|
|
int strfind(const char *string, const char *keyword);
|
| 91 |
|
|
int strleft(const char *string, const char *keyword);
|
| 92 |
|
|
|
| 93 |
|
|
void strcatn(char *dest, const char *src, int n);
|
| 94 |
|
|
|
| 95 |
|
|
int bufleft(BUFFER *b, char *k);
|
| 96 |
|
|
int buffind(BUFFER *b, char *k);
|
| 97 |
|
|
int bufeq(BUFFER *b, char *k);
|
| 98 |
|
|
|
| 99 |
|
|
int bufileft(BUFFER *b, char *k);
|
| 100 |
|
|
int bufifind(BUFFER *b, char *k);
|
| 101 |
|
|
int bufiright(BUFFER *b, char *k);
|
| 102 |
|
|
int bufieq(BUFFER *b, char *k);
|
| 103 |
|
|
|
| 104 |
|
|
/* Utility functions */
|
| 105 |
|
|
void whoami(char *addr, char *defaultname);
|
| 106 |
|
|
int sendinfofile(char *name, char *log, BUFFER *address, BUFFER *subject);
|
| 107 |
|
|
int stats(BUFFER *out);
|
| 108 |
|
|
int conf(BUFFER *out);
|
| 109 |
|
|
void conf_premail(BUFFER *out);
|
| 110 |
|
|
|
| 111 |
|
|
void rfc822_addr(BUFFER *line, BUFFER *list);
|
| 112 |
|
|
void rfc822_name(BUFFER *line, BUFFER *name);
|
| 113 |
|
|
void sendmail_begin(void); /* begin mail sending session */
|
| 114 |
|
|
void sendmail_end(void); /* end mail sending session */
|
| 115 |
weaselp |
116 |
int sendmail_loop(BUFFER *message, char *from, BUFFER *address);
|
| 116 |
rabbi |
1 |
int sendmail(BUFFER *message, char *from, BUFFER *address);
|
| 117 |
|
|
int mixfile(char *path, const char *name);
|
| 118 |
|
|
int file_to_out(const char *name);
|
| 119 |
|
|
FILE *mix_openfile(const char *name, const char *a);
|
| 120 |
|
|
FILE *openpipe(const char *prog);
|
| 121 |
|
|
int closepipe(FILE *fp);
|
| 122 |
weaselp |
153 |
int maildirWrite(char *maildir, BUFFER *message, int create);
|
| 123 |
rabbi |
1 |
|
| 124 |
|
|
typedef struct {
|
| 125 |
|
|
char *name;
|
| 126 |
|
|
FILE *f;
|
| 127 |
|
|
} LOCK;
|
| 128 |
|
|
|
| 129 |
|
|
int lock(FILE *f);
|
| 130 |
|
|
int unlock(FILE *f);
|
| 131 |
|
|
LOCK *lockfile(char *filename);
|
| 132 |
|
|
int unlockfile(LOCK *lock);
|
| 133 |
|
|
|
| 134 |
|
|
int filtermsg(BUFFER *msg);
|
| 135 |
|
|
BUFFER *readdestblk( );
|
| 136 |
|
|
int doblock(BUFFER *line, BUFFER *filter, int logandreset);
|
| 137 |
|
|
int doallow(BUFFER *line, BUFFER *filter);
|
| 138 |
|
|
int allowmessage(BUFFER *in);
|
| 139 |
|
|
|
| 140 |
|
|
void errlog(int type, char *format,...);
|
| 141 |
|
|
void clienterr(BUFFER *msgbuf, char *err);
|
| 142 |
|
|
void logmail(char *mailbox, BUFFER *message);
|
| 143 |
|
|
|
| 144 |
|
|
void mix_status(char *fmt,...);
|
| 145 |
|
|
void mix_genericerror(void);
|
| 146 |
|
|
|
| 147 |
|
|
#define ERRORMSG 1
|
| 148 |
|
|
#define WARNING 2
|
| 149 |
|
|
#define NOTICE 3
|
| 150 |
|
|
#define LOG 4
|
| 151 |
|
|
#define DEBUGINFO 5
|
| 152 |
|
|
|
| 153 |
|
|
int decode(BUFFER *in, BUFFER *out);
|
| 154 |
|
|
int encode(BUFFER *b, int linelen);
|
| 155 |
|
|
void id_encode(byte id[], byte *s);
|
| 156 |
|
|
void id_decode(byte *s, byte id[]);
|
| 157 |
|
|
|
| 158 |
|
|
int decode_header(BUFFER *content);
|
| 159 |
|
|
int boundary(BUFFER *line, BUFFER *mboundary);
|
| 160 |
|
|
void get_parameter(BUFFER *content, char *attribute, BUFFER *value);
|
| 161 |
|
|
int get_type(BUFFER *content, BUFFER *type, BUFFER *subtype);
|
| 162 |
|
|
int mail_encode(BUFFER *in, int encoding);
|
| 163 |
|
|
int hdr_encode(BUFFER *in, int n);
|
| 164 |
|
|
int attachfile(BUFFER *message, BUFFER *filename);
|
| 165 |
|
|
int pgpmime_sign(BUFFER *message, BUFFER *uid, BUFFER *pass, char *secring);
|
| 166 |
|
|
int mime_attach(BUFFER *message, BUFFER *attachment, BUFFER *type);
|
| 167 |
|
|
void mimedecode(BUFFER *msg);
|
| 168 |
rabbi |
41 |
int qp_decode_message(BUFFER *msg);
|
| 169 |
rabbi |
1 |
|
| 170 |
|
|
#define MIME_8BIT 1 /* transport is 8bit */
|
| 171 |
|
|
#define MIME_7BIT 2 /* transport is 7bit */
|
| 172 |
|
|
|
| 173 |
|
|
/* randomness */
|
| 174 |
|
|
int rnd_bytes(byte *b, int n);
|
| 175 |
|
|
byte rnd_byte(void);
|
| 176 |
|
|
int rnd_number(int n);
|
| 177 |
|
|
int rnd_add(byte *b, int l);
|
| 178 |
|
|
int rnd_seed(void);
|
| 179 |
|
|
void rnd_time(void);
|
| 180 |
|
|
|
| 181 |
|
|
int rnd_init(void);
|
| 182 |
|
|
int rnd_final(void);
|
| 183 |
|
|
void rnd_error(void);
|
| 184 |
|
|
|
| 185 |
|
|
#define RND_QUERY 0
|
| 186 |
|
|
#define RND_NOTSEEDED -1
|
| 187 |
|
|
#define RND_SEEDED 1
|
| 188 |
|
|
#define RND_WILLSEED 2
|
| 189 |
|
|
extern int rnd_state; /* flag for PRNG status */
|
| 190 |
|
|
|
| 191 |
|
|
/* compression */
|
| 192 |
|
|
int buf_compress(BUFFER *b);
|
| 193 |
|
|
int buf_zip(BUFFER *out, BUFFER *in, int bits);
|
| 194 |
|
|
int buf_uncompress(BUFFER *b);
|
| 195 |
|
|
int buf_unzip(BUFFER *b, int type);
|
| 196 |
|
|
|
| 197 |
|
|
/* crypto functions */
|
| 198 |
|
|
int digest_md5(BUFFER *b, BUFFER *md);
|
| 199 |
|
|
int isdigest_md5(BUFFER *b, BUFFER *md);
|
| 200 |
|
|
int digestmem_md5(byte *b, int n, BUFFER *md);
|
| 201 |
|
|
int digest_sha1(BUFFER *b, BUFFER *md);
|
| 202 |
|
|
int digest_rmd160(BUFFER *b, BUFFER *md);
|
| 203 |
|
|
|
| 204 |
|
|
int keymgt(int force);
|
| 205 |
|
|
int key(BUFFER *b);
|
| 206 |
|
|
int adminkey(BUFFER *b);
|
| 207 |
|
|
|
| 208 |
|
|
#define ENCRYPT 1
|
| 209 |
|
|
#define DECRYPT 0
|
| 210 |
|
|
int buf_crypt(BUFFER *b, BUFFER *key, BUFFER *iv, int enc);
|
| 211 |
|
|
|
| 212 |
|
|
#ifdef USE_IDEA
|
| 213 |
|
|
int buf_ideacrypt(BUFFER *b, BUFFER *key, BUFFER *iv, int enc);
|
| 214 |
|
|
#endif
|
| 215 |
|
|
int buf_bfcrypt(BUFFER *b, BUFFER *key, BUFFER *iv, int enc);
|
| 216 |
|
|
int buf_3descrypt(BUFFER *b, BUFFER *key, BUFFER *iv, int enc);
|
| 217 |
|
|
int buf_castcrypt(BUFFER *b, BUFFER *key, BUFFER *iv, int enc);
|
| 218 |
rabbi |
98 |
#ifdef USE_AES
|
| 219 |
|
|
int buf_aescrypt(BUFFER *b, BUFFER *key, BUFFER *iv, int enc);
|
| 220 |
|
|
#endif
|
| 221 |
rabbi |
1 |
|
| 222 |
|
|
int db_getseckey(byte keyid[], BUFFER *key);
|
| 223 |
|
|
int db_getpubkey(byte keyid[], BUFFER *key);
|
| 224 |
|
|
int pk_decrypt(BUFFER *encrypted, BUFFER *privkey);
|
| 225 |
|
|
int pk_encrypt(BUFFER *plaintext, BUFFER *privkey);
|
| 226 |
|
|
int check_seckey(BUFFER *buf, const byte id[]);
|
| 227 |
|
|
int check_pubkey(BUFFER *buf, const byte id[]);
|
| 228 |
|
|
int v2createkey(void);
|
| 229 |
|
|
int seckeytopub(BUFFER *pub, BUFFER *sec, byte keyid[]);
|
| 230 |
|
|
|
| 231 |
|
|
/* configuration, general remailer functions */
|
| 232 |
|
|
int mix_configline(char *line);
|
| 233 |
|
|
int mix_initialized(void);
|
| 234 |
|
|
int mix_daily(void);
|
| 235 |
|
|
|
| 236 |
|
|
/* message pool */
|
| 237 |
|
|
#define INTERMEDIATE 0
|
| 238 |
|
|
int pool_send(void);
|
| 239 |
|
|
int pool_read(BUFFER *pool);
|
| 240 |
|
|
int pool_add(BUFFER *msg, char *type);
|
| 241 |
|
|
FILE *pool_new(char *type, char *tmpname, char *path);
|
| 242 |
|
|
int mix_pool(BUFFER *msg, int type, long latent);
|
| 243 |
|
|
int pool_packetfile(char *fname, BUFFER *mid, int packetnum);
|
| 244 |
|
|
void pool_packetexp(void);
|
| 245 |
|
|
int idexp(void);
|
| 246 |
|
|
void pop3get(void);
|
| 247 |
|
|
|
| 248 |
rabbi |
82 |
typedef struct { /* added for binary id.log change */
|
| 249 |
|
|
char id[16];
|
| 250 |
|
|
long time;
|
| 251 |
|
|
} idlog_t;
|
| 252 |
|
|
|
| 253 |
rabbi |
1 |
/* statistics */
|
| 254 |
|
|
int stats_log(int);
|
| 255 |
|
|
int stats_out(int);
|
| 256 |
|
|
|
| 257 |
|
|
/* OpenPGP */
|
| 258 |
weaselp |
182 |
#define PGP_ARMOR_NORMAL 0
|
| 259 |
|
|
#define PGP_ARMOR_REM 1
|
| 260 |
|
|
#define PGP_ARMOR_KEY 2
|
| 261 |
|
|
#define PGP_ARMOR_NYMKEY 3
|
| 262 |
|
|
#define PGP_ARMOR_NYMSIG 4
|
| 263 |
|
|
#define PGP_ARMOR_SECKEY 5
|
| 264 |
|
|
|
| 265 |
rabbi |
1 |
int pgp_keymgt(int force);
|
| 266 |
|
|
int pgp_armor(BUFFER *buf, int mode);
|
| 267 |
|
|
int pgp_dearmor(BUFFER *buf, BUFFER *out);
|
| 268 |
|
|
int pgp_pubkeycert(BUFFER *userid, char *keyring, BUFFER *pass,
|
| 269 |
|
|
BUFFER *out, int remail);
|
| 270 |
|
|
int pgp_signtxt(BUFFER *msg, BUFFER *uid, BUFFER *pass,
|
| 271 |
|
|
char *secring, int remail);
|
| 272 |
|
|
int pgp_isconventional(BUFFER *buf);
|
| 273 |
|
|
int pgp_mailenc(int mode, BUFFER *msg, char *sigid,
|
| 274 |
|
|
BUFFER *pass, char *pubring, char *secring);
|
| 275 |
|
|
int pgp_signhashalgo(BUFFER *algo, BUFFER *userid, char *secring,
|
| 276 |
|
|
BUFFER *pass);
|
| 277 |
|
|
|
| 278 |
|
|
/* menu */
|
| 279 |
|
|
int menu_initialized;
|
| 280 |
|
|
void menu_main(void);
|
| 281 |
|
|
void menu_folder(char command, char *name);
|
| 282 |
|
|
int menu_getuserpass(BUFFER *p, int mode);
|
| 283 |
|
|
|
| 284 |
|
|
int user_pass(BUFFER *b);
|
| 285 |
|
|
int user_confirmpass(BUFFER *b);
|
| 286 |
|
|
void user_delpass(void);
|
| 287 |
|
|
|
| 288 |
|
|
/* remailer */
|
| 289 |
|
|
typedef struct {
|
| 290 |
|
|
char name[20];
|
| 291 |
|
|
int version;
|
| 292 |
|
|
char addr[128];
|
| 293 |
|
|
byte keyid[16];
|
| 294 |
|
|
struct {
|
| 295 |
|
|
unsigned int mix:1;
|
| 296 |
|
|
unsigned int compress:1;
|
| 297 |
|
|
|
| 298 |
|
|
unsigned int cpunk:1;
|
| 299 |
|
|
unsigned int pgp:1;
|
| 300 |
|
|
unsigned int pgponly:1;
|
| 301 |
|
|
unsigned int latent:1;
|
| 302 |
|
|
unsigned int hash:1;
|
| 303 |
|
|
unsigned int ek:1;
|
| 304 |
|
|
unsigned int esub:1;
|
| 305 |
|
|
|
| 306 |
|
|
unsigned int nym:1;
|
| 307 |
|
|
unsigned int newnym:1;
|
| 308 |
|
|
|
| 309 |
|
|
unsigned int post:1;
|
| 310 |
|
|
unsigned int middle:1;
|
| 311 |
|
|
} flags;
|
| 312 |
|
|
struct rinfo {
|
| 313 |
|
|
int reliability;
|
| 314 |
|
|
int latency;
|
| 315 |
|
|
char history[13];
|
| 316 |
|
|
} info[2];
|
| 317 |
|
|
} REMAILER;
|
| 318 |
|
|
|
| 319 |
|
|
#define CHAINMAX 421
|
| 320 |
|
|
#define MAXREM 100
|
| 321 |
weaselp |
168 |
int prepare_type2list(BUFFER *out);
|
| 322 |
rabbi |
1 |
int mix2_rlist(REMAILER remailer[]);
|
| 323 |
|
|
int t1_rlist(REMAILER remailer[]);
|
| 324 |
|
|
int pgp_rlist(REMAILER remailer[], int n);
|
| 325 |
weaselp |
171 |
int pgp_rkeylist(REMAILER remailer[], int keyid[], int n);
|
| 326 |
rabbi |
1 |
int chain_select(int hop[], char *chainstr, int maxrem, REMAILER *remailer,
|
| 327 |
|
|
int type, BUFFER *feedback);
|
| 328 |
|
|
int chain_rand(REMAILER *remailer, int maxrem,
|
| 329 |
|
|
int thischain[], int chainlen, int t);
|
| 330 |
|
|
int chain_randfinal(int type, REMAILER *remailer, int maxrem, int t);
|
| 331 |
|
|
|
| 332 |
|
|
float chain_reliability(char *chain, int chaintype,
|
| 333 |
|
|
char *reliability_string);
|
| 334 |
|
|
int mix2_encrypt(int type, BUFFER *message, char *chainstr, int numcopies,
|
| 335 |
|
|
BUFFER *feedback);
|
| 336 |
|
|
int t1_encrypt(int type, BUFFER *message, char *chainstr, int latency,
|
| 337 |
|
|
BUFFER *ek, BUFFER *feedback);
|
| 338 |
|
|
|
| 339 |
|
|
int t1_getreply(BUFFER *msg, BUFFER *ek, int len);
|
| 340 |
|
|
|
| 341 |
|
|
int t1_decrypt(BUFFER *in);
|
| 342 |
|
|
int t2_decrypt(BUFFER *in);
|
| 343 |
|
|
|
| 344 |
|
|
int mix2_decrypt(BUFFER *m);
|
| 345 |
|
|
int mix3_decrypt(BUFFER *m);
|
| 346 |
|
|
|
| 347 |
|
|
/* type 2 */
|
| 348 |
|
|
#define MAGIC0 0
|
| 349 |
|
|
#define MAGIC1 3
|
| 350 |
|
|
|
| 351 |
|
|
int v3_magic(byte *b);
|
| 352 |
|
|
int v2body(BUFFER *body);
|
| 353 |
|
|
int v2body_setlen(BUFFER *body);
|
| 354 |
|
|
int v2partial(BUFFER *body, BUFFER *mid, int packet, int numpackets);
|
| 355 |
|
|
int v2_merge(BUFFER *mid);
|
| 356 |
|
|
int mix_armor(BUFFER *in);
|
| 357 |
|
|
int mix_dearmor(BUFFER *armored, BUFFER *bin);
|
| 358 |
|
|
|
| 359 |
|
|
/* type 1 */
|
| 360 |
|
|
#define HDRMARK "::"
|
| 361 |
|
|
#define EKMARK "**"
|
| 362 |
|
|
#define HASHMARK "##"
|
| 363 |
|
|
int isline(BUFFER *line, char *text);
|
| 364 |
|
|
|
| 365 |
|
|
/* nym database */
|
| 366 |
|
|
|
| 367 |
|
|
#define NYM_WAITING 0
|
| 368 |
|
|
#define NYM_OK 1
|
| 369 |
|
|
#define NYM_DELETED 2
|
| 370 |
|
|
#define NYM_ANY -1
|
| 371 |
|
|
|
| 372 |
|
|
int nymlist_read(BUFFER *n);
|
| 373 |
|
|
int nymlist_write(BUFFER *list);
|
| 374 |
|
|
int nymlist_get(BUFFER *list, char *nym, BUFFER *config, BUFFER *ek,
|
| 375 |
|
|
BUFFER *options, BUFFER *name, BUFFER *rblocks, int *status);
|
| 376 |
|
|
int nymlist_append(BUFFER *list, char *nym, BUFFER *config, BUFFER *options,
|
| 377 |
|
|
BUFFER *name, BUFFER *chains, BUFFER *eklist, int status);
|
| 378 |
|
|
int nymlist_del(BUFFER *list, char *nym);
|
| 379 |
|
|
int nymlist_getnym(char *nym, BUFFER *config, BUFFER *ek, BUFFER *opt,
|
| 380 |
|
|
BUFFER *name, BUFFER *rblocks);
|
| 381 |
|
|
int nymlist_getstatus(char *nym);
|
| 382 |
|
|
|
| 383 |
|
|
/* Visual C lacks dirent */
|
| 384 |
|
|
#ifdef _MSC
|
| 385 |
|
|
typedef HANDLE DIR;
|
| 386 |
|
|
|
| 387 |
|
|
struct dirent {
|
| 388 |
|
|
char d_name[PATHMAX];
|
| 389 |
|
|
};
|
| 390 |
|
|
|
| 391 |
|
|
DIR *opendir(const char *name);
|
| 392 |
|
|
struct dirent *readdir(DIR *dir);
|
| 393 |
|
|
int closedir(DIR *dir);
|
| 394 |
|
|
#endif
|
| 395 |
|
|
|
| 396 |
|
|
/* sockets */
|
| 397 |
|
|
#if defined(WIN32) && defined(USE_SOCK)
|
| 398 |
|
|
#include <winsock.h>
|
| 399 |
|
|
int sock_init(void);
|
| 400 |
|
|
void sock_exit(void);
|
| 401 |
|
|
|
| 402 |
|
|
#else
|
| 403 |
|
|
typedef int SOCKET;
|
| 404 |
|
|
|
| 405 |
|
|
#define INVALID_SOCKET -1
|
| 406 |
|
|
SOCKET opensocket(char *hostname, int port);
|
| 407 |
|
|
int closesocket(SOCKET s);
|
| 408 |
|
|
|
| 409 |
|
|
#endif
|
| 410 |
|
|
|
| 411 |
rabbi |
30 |
#ifdef WIN32
|
| 412 |
|
|
int is_nt_service(void);
|
| 413 |
|
|
void set_nt_exit_event();
|
| 414 |
|
|
#endif
|
| 415 |
|
|
|
| 416 |
rabbi |
1 |
/* check for memory leaks */
|
| 417 |
|
|
#ifdef DEBUG
|
| 418 |
|
|
#define malloc mix3_malloc
|
| 419 |
|
|
#define free mix3_free
|
| 420 |
|
|
BUFFER *mix3_bufnew(char *, int, char*);
|
| 421 |
|
|
#if __GNUC__ >= 2
|
| 422 |
|
|
# define buf_new() mix3_bufnew(__FILE__, __LINE__, __PRETTY_FUNCTION__)
|
| 423 |
|
|
#else
|
| 424 |
|
|
# define buf_new() mix3_bufnew(__FILE__, __LINE__, "file")
|
| 425 |
|
|
#endif
|
| 426 |
|
|
#endif /* DEBUG */
|
| 427 |
|
|
|
| 428 |
|
|
#endif
|