static struct UserInfo *userinfo_create(char *);
static void userinfo_free(struct UserInfo *source);
-static void m_ping(char *[], unsigned int, char *, struct UserInfo *);
-static void m_invite(char *[], unsigned int, char *, struct UserInfo *);
-static void m_privmsg(char *[], unsigned int, char *, struct UserInfo *);
-static void m_ctcp(char *[], unsigned int, char *, struct UserInfo *);
-static void m_notice(char *[], unsigned int, char *, struct UserInfo *);
-static void m_perform(char *[], unsigned int, char *, struct UserInfo *);
-static void m_userhost(char *[], unsigned int, char *, struct UserInfo *);
-static void m_cannot_join(char *[], unsigned int, char *, struct UserInfo *);
-static void m_kill(char *[], unsigned int, char *, struct UserInfo *);
+static void m_ping(char *[], unsigned int, char *, const struct UserInfo *);
+static void m_invite(char *[], unsigned int, char *, const struct UserInfo *);
+static void m_privmsg(char *[], unsigned int, char *, const struct UserInfo *);
+static void m_ctcp(char *[], unsigned int, char *, const struct UserInfo *);
+static void m_notice(char *[], unsigned int, char *, const struct UserInfo *);
+static void m_perform(char *[], unsigned int, char *, const struct UserInfo *);
+static void m_userhost(char *[], unsigned int, char *, const struct UserInfo *);
+static void m_cannot_join(char *[], unsigned int, char *, const struct UserInfo *);
+static void m_kill(char *[], unsigned int, char *, const struct UserInfo *);
/*
* the source (parv[0]) is a server.
*/
static void
-m_perform(char *parv[], unsigned int parc, char *msg, struct UserInfo *notused)
+m_perform(char *parv[], unsigned int parc, char *msg, const struct UserInfo *notused)
{
node_t *node;
* the source (parv[0]) is a server.
*/
static void
-m_ping(char *parv[], unsigned int parc, char *msg, struct UserInfo *source_p)
+m_ping(char *parv[], unsigned int parc, char *msg, const struct UserInfo *source_p)
{
if (parc < 3)
return;
* the source (parv[0]) is a server.
*/
static void
-m_invite(char *parv[], unsigned int parc, char *msg, struct UserInfo *source_p)
+m_invite(char *parv[], unsigned int parc, char *msg, const struct UserInfo *source_p)
{
struct ChannelConf *channel = NULL;
* the source (parv[0]) is a server.
*/
static void
-m_privmsg(char *parv[], unsigned int parc, char *msg, struct UserInfo *source_p)
+m_privmsg(char *parv[], unsigned int parc, char *msg, const struct UserInfo *source_p)
{
struct ChannelConf *channel = NULL;
size_t nick_len;
*
*/
static void
-m_ctcp(char *parv[], unsigned int parc, char *msg, struct UserInfo *source_p)
+m_ctcp(char *parv[], unsigned int parc, char *msg, const struct UserInfo *source_p)
{
if (strncasecmp(parv[3], "\001VERSION\001", 9) == 0)
irc_send("NOTICE %s :\001VERSION Hybrid Open Proxy Monitor %s\001",
*
*/
static void
-m_notice(char *parv[], unsigned int parc, char *msg, struct UserInfo *source_p)
+m_notice(char *parv[], unsigned int parc, char *msg, const struct UserInfo *source_p)
{
static regex_t *preg = NULL;
regmatch_t pmatch[5];
int errnum;
- char *user[4];
+ const char *user[4];
/* Not interested in notices from users */
if (source_p)
*
*/
static void
-m_userhost(char *parv[], unsigned int parc, char *msg, struct UserInfo *source_p)
+m_userhost(char *parv[], unsigned int parc, char *msg, const struct UserInfo *source_p)
{
if (parc < 4)
return;
*
*/
static void
-m_cannot_join(char *parv[], unsigned int parc, char *msg, struct UserInfo *source_p)
+m_cannot_join(char *parv[], unsigned int parc, char *msg, const struct UserInfo *source_p)
{
const struct ChannelConf *channel = NULL;
*
*/
static void
-m_kill(char *parv[], unsigned int parc, char *msg, struct UserInfo *source_p)
+m_kill(char *parv[], unsigned int parc, char *msg, const struct UserInfo *source_p)
{
/* Restart hopm to rehash */
main_restart();
struct CommandHash
{
const char *command;
- void (*handler)(char *[], unsigned int, char *, struct UserInfo *);
+ void (*handler)(char *[], unsigned int, char *, const struct UserInfo *);
};
extern void irc_send(const char *, ...);
static list_t *COMMANDS = NULL; /* List of active commands */
-static struct Command *command_create(const struct OperCommandHash *, char *param, char *irc_nick, struct ChannelConf *target);
+static struct Command *command_create(const struct OperCommandHash *, char *param, char *irc_nick, const struct ChannelConf *target);
static void command_free(struct Command *);
-static void cmd_check(char *, struct ChannelConf *);
-static void cmd_stat(char *, struct ChannelConf *);
-static void cmd_fdstat(char *, struct ChannelConf *);
+static void cmd_check(char *, const struct ChannelConf *);
+static void cmd_stat(char *, const struct ChannelConf *);
+static void cmd_fdstat(char *, const struct ChannelConf *);
-static struct OperCommandHash COMMAND_TABLE[] =
+static const struct OperCommandHash COMMAND_TABLE[] =
{
{ "CHECK", cmd_check },
{ "SCAN", cmd_check },
*
*/
void
-command_parse(char *command, char *msg, struct ChannelConf *target,
- struct UserInfo *source_p)
+command_parse(char *command, char *msg, const struct ChannelConf *target,
+ const struct UserInfo *source_p)
{
char *param; /* Parsed parameters */
* Pointer to new Command
*/
static struct Command *
-command_create(const struct OperCommandHash *tab, char *param, char *irc_nick, struct ChannelConf *target)
+command_create(const struct OperCommandHash *tab, char *param, char *irc_nick,
+ const struct ChannelConf *target)
{
- struct Command *ret = xcalloc(sizeof *ret);
+ struct Command *const ret = xcalloc(sizeof *ret);
if (param)
ret->param = xstrdup(param);
*
*/
static void
-cmd_check(char *param, struct ChannelConf *target)
+cmd_check(char *param, const struct ChannelConf *target)
{
scan_manual(param, target);
}
* target: channel command was sent to
*/
static void
-cmd_stat(char *param, struct ChannelConf *target)
+cmd_stat(char *param, const struct ChannelConf *target)
{
stats_output(target->name);
}
* target: channel command was sent to
*/
static void
-cmd_fdstat(char *param, struct ChannelConf *target)
+cmd_fdstat(char *param, const struct ChannelConf *target)
{
fdstats_output(target->name);
}
struct OperCommandHash
{
const char *command;
- void (*handler)(char *, struct ChannelConf *);
+ void (*handler)(char *, const struct ChannelConf *);
};
struct Command
char *irc_nick;
/* Where the reply is to be sent. */
- struct ChannelConf *target;
+ const struct ChannelConf *target;
/*
* When it was added, because we might need to remove it if it does
extern void command_init(void);
extern void command_userhost(const char *);
extern void command_timer(void);
-extern void command_parse(char *, char *, struct ChannelConf *, struct UserInfo *);
+extern void command_parse(char *, char *, const struct ChannelConf *, const struct UserInfo *);
#endif
/* Function declarations */
-static struct scan_struct *scan_create(char *[], char *);
+static struct scan_struct *scan_create(const char *[], const char *);
static void scan_free(struct scan_struct *);
-static void scan_irckline(struct scan_struct *, const char *, const char *);
-static void scan_negative(struct scan_struct *);
+static void scan_irckline(const struct scan_struct *, const char *, const char *);
+static void scan_negative(const struct scan_struct *);
static void scan_log(OPM_REMOTE_T *);
/** Callbacks for LIBOPM */
-void scan_open_proxy(OPM_T *, OPM_REMOTE_T *, int, void *);
-void scan_negotiation_failed(OPM_T *, OPM_REMOTE_T *, int, void *);
+static void scan_open_proxy(OPM_T *, OPM_REMOTE_T *, int, void *);
+static void scan_negotiation_failed(OPM_T *, OPM_REMOTE_T *, int, void *);
static void scan_timeout(OPM_T *, OPM_REMOTE_T *, int, void *);
static void scan_end(OPM_T *, OPM_REMOTE_T *, int, void *);
static void scan_handle_error(OPM_T *, OPM_REMOTE_T *, int, void *);
scan_gettype(int protocol)
{
static const char *undef = "undefined";
- static struct protocol_assoc protocols[] =
+ static const struct protocol_assoc protocols[] =
{
{ OPM_TYPE_HTTP, "HTTP" },
{ OPM_TYPE_HTTPPOST, "HTTPPOST" },
*
*/
void
-scan_connect(char *user[], char *msg)
+scan_connect(const char *user[], const char *msg)
{
struct sockaddr_in ip;
node_t *p, *p2;
*
*/
static struct scan_struct *
-scan_create(char *user[], char *msg)
+scan_create(const char *user[], const char *msg)
{
- struct scan_struct *ss = xcalloc(sizeof *ss);
+ struct scan_struct *const ss = xcalloc(sizeof *ss);
ss->irc_nick = xstrdup(user[0]);
ss->irc_username = xstrdup(user[1]);
*
* Return: NONE
*/
-void
+static void
scan_open_proxy(OPM_T *scanner, OPM_REMOTE_T *remote, int notused, void *data)
{
struct scan_struct *ss;
* Return: NONE
*
*/
-void
+static void
scan_negotiation_failed(OPM_T *scanner, OPM_REMOTE_T *remote, int notused, void *data)
{
//struct scan_struct *ss;
*
*/
static void
-scan_negative(struct scan_struct *ss)
+scan_negative(const struct scan_struct *ss)
{
/* Insert IP in negcache */
if (OptionsItem->negcache > 0)
*
*/
static void
-scan_irckline(struct scan_struct *ss, const char *format, const char *type)
+scan_irckline(const struct scan_struct *ss, const char *format, const char *type)
{
char message[MSGLENMAX]; /* OUTPUT */
* scan_struct contains a manual_target pointer.
*/
void
-scan_manual(char *param, struct ChannelConf *target)
+scan_manual(char *param, const struct ChannelConf *target)
{
struct in_addr *addr;
struct scan_struct *ss;
unsigned int scans;
unsigned int positive;
- struct ChannelConf *manual_target;
+ const struct ChannelConf *manual_target;
};
struct scanner_struct
extern void scan_init(void);
extern const char *scan_gettype(int);
extern void scan_cycle(void);
-extern void scan_connect(char *[], char *);
+extern void scan_connect(const char *[], const char *);
extern void scan_checkfinished(struct scan_struct *);
-extern void scan_manual(char *, struct ChannelConf *);
+extern void scan_manual(char *, const struct ChannelConf *);
extern int scan_checkexempt(const char *, const char *);
extern void scan_timer(void);
extern void scan_positive(struct scan_struct *, const char *, const char *);