📄 smtpalrt.h
字号:
/* smtpalrt.c
Support for doing email alarms (aka SMTP alerts)
Copyright 1997 by InterNice Technologies Inc. All rights reserved.
5/12/96 - Ported to WebPort. -JB-
*/
#ifndef SMTPALRT_H
#define SMTPALRT_H 1
#ifndef SMTP_HEADER_SIZE
#define SMTP_HEADER_SIZE 256 /* header data buffer size */
#endif
struct alertmessage
{
struct alertmessage * next;
char hdrbuf[SMTP_HEADER_SIZE];
int hdrlen; /* number of valid chars in hdrbuf */
char * databuf; /* pointer to message data */
int datalen; /* length of message data */
int rcpts; /* count of recipients already posted */
int state; /* one of the HTSM_ defines below */
/* optional routine to call back when databuf is sent */
int (*callback)(char * buf, int errcode);
};
typedef struct alertmessage * alertmsg_p;
#define HTSM_NEW 1 /* new message, nothing done yet */
#define HTSM_CONNECTED 2 /* got banner from server */
#define HTSM_MAILSENT 3 /* "MAIL" command sent */
#define HTSM_MAILOK 4 /* got OK for MAIL */
#define HTSM_RCPTSENT 5 /* "RCPT" command sent */
#define HTSM_RCPTOK 6 /* got OK for RCPT */
#define HTSM_DATASENT 7 /* "DATA" command sent */
#define HTSM_DATAACK 8 /* got 354 (ack) for DATA */
#define HTSM_MSGSENT 9 /* sent actual message body */
#define HTSM_MSGOK 10 /* got 250 OK for message body */
extern int emsess_state; /* state of email session */
extern u_long emsess_tmo; /* cticks value to expire current state */
#define HCSM_NBCON 1 /* waiting for non-blocking connection */
#define HCSM_NEW 2 /* Just open, awaiting banner */
#define HCSM_HELOSENT 3 /* Helo sent */
#define HCSM_CONN 4 /* Connected (got OK for Helo) */
#define HCSM_QUITSENT 5 /* sent quit */
#define HCSM_QUITOK 6 /* all done! */
#define HCSM_ABORT 7 /* terminating this connect */
/* smtpalrt function return error codes */
#define SAE_DISABLE -1
#define SAE_NORCPT -2
#define SAE_RESOURCE -3
/* smtpalrt general error codes */
#define EEM_OK 0 /* not really an error */
#define EEM_WAIT 1 /* still waiting for reply */
#define EEM_NBCON 2 /* still waiting for non-blocking connection */
#define EEM_SOCK -1 /* socket error */
#define EEM_SMTP -2 /* bad smtp code */
#define EEM_PARM -3 /* bad parameter or logic */
/* user settable mail header strings */
extern char * smtp_sendermach; /* email sender machine */
extern char * smtp_subject; /* "Subject:" line */
extern char * smtp_sendername; /* "From:" name */
extern alertmsg_p alertmsghead;
extern unshort smtp_tcpport; /* email server port, for overwrites */
extern ip_addr smtp_serverip; /* IP address of email (SMTP) server */
extern char smtp_rcpt[MAX_SMTP_RCPTS][MAX_RCPT_LEN];
extern WP_SOCKTYPE smtpalert_sock;
/* some timing tools to make sure reply polling is working */
extern u_long em_ltick; /* ctick of last reply */
extern u_long em_loops; /* idle loops since last reply */
/* the programmatic interface to emailer: */
int smtpalert(char *buf, unsigned len,
int (*callback)(char*,int)); /* send smtp message */
void smtpalert_check(void); /* poll to drive smtp logic */
int smtpalert_show(void * pio); /* printf smtp status and stats */
int smtpalert_setrcpt(char * rcpt); /* add SMTP recipient to list */
int smtpalert_delrcpt(char * rcpt); /* remove SMTP recipient from list */
int smtpalert_disable(void);
#endif /* SMTPALRT_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -