131 lines
2.3 KiB
C
131 lines
2.3 KiB
C
#ifndef IRC_STRUCTS_H
|
|
#define IRC_STRUCTS_H
|
|
|
|
#include "IRC/IRC_events.h"
|
|
#include "netcode.h"
|
|
#include <stdbool.h>
|
|
#include <openssl/ssl.h>
|
|
|
|
typedef enum
|
|
{
|
|
SASL_MECHANISM_NONE,
|
|
SASL_MECHANISM_PLAIN,
|
|
SASL_MECHANISM_EXTERNAL
|
|
} irc_sasl_mechanism_t;
|
|
|
|
typedef struct
|
|
{
|
|
char nickname[32];
|
|
char ident[16];
|
|
char hostname;
|
|
} irc_hostmask_t;
|
|
|
|
typedef struct {
|
|
char line[513];
|
|
char *source;
|
|
char *command;
|
|
char *argv[16];
|
|
int argc;
|
|
} irc_message_t;
|
|
|
|
typedef struct
|
|
{
|
|
irc_event_type_t type;
|
|
char line[513];
|
|
} irc_event_t;
|
|
|
|
typedef struct
|
|
{
|
|
irc_hostmask_t hostmask;
|
|
char prefix;
|
|
} irc_chanuser_t;
|
|
|
|
typedef struct
|
|
{
|
|
char name[64];
|
|
char topic[513];
|
|
irc_chanuser_t* users;
|
|
} irc_channel_t;
|
|
|
|
typedef struct
|
|
{
|
|
char capLine[96]; // A place for name and args to point to.
|
|
char *name;
|
|
char *args;
|
|
} irc_capability_t;
|
|
|
|
typedef struct
|
|
{
|
|
char username[32];
|
|
char password[64];
|
|
} irc_sasl_plain_credentials_t;
|
|
|
|
typedef struct
|
|
{
|
|
char nickname[32];
|
|
unsigned char fingerprint[20];
|
|
} irc_sasl_external_credentials_t;
|
|
|
|
typedef struct
|
|
{
|
|
irc_sasl_mechanism_t mechanism;
|
|
union {
|
|
irc_sasl_plain_credentials_t plain_credentials;
|
|
irc_sasl_external_credentials_t external_credentials;
|
|
};
|
|
} irc_auth_t;
|
|
|
|
typedef struct
|
|
{
|
|
char nick[32];
|
|
char altnick[32];
|
|
char altnick2[32];
|
|
char username[16];
|
|
char realname[128];
|
|
} irc_identity_t;
|
|
typedef enum
|
|
{
|
|
IRC_CONNECTION_PLAINTEXT,
|
|
IRC_CONNECTION_TLS
|
|
} irc_connection_type_t;
|
|
|
|
typedef struct
|
|
{
|
|
char host[128];
|
|
int port;
|
|
irc_connection_type_t connType;
|
|
} irc_connection_info_t;
|
|
|
|
typedef struct
|
|
{
|
|
irc_event_t *events;
|
|
int eventsSize;
|
|
int front;
|
|
int rear;
|
|
} irc_event_queue_t;
|
|
|
|
typedef struct
|
|
{
|
|
irc_connection_info_t connectionInfo;
|
|
sslSockfd_t connection;
|
|
irc_hostmask_t ownHostmask;
|
|
char supportedCapabilities[513];
|
|
char requestedCapabilities[513];
|
|
irc_capability_t acked[16];
|
|
|
|
/* Authentication parameters */
|
|
irc_auth_t saslAuth;
|
|
|
|
/* Identity */
|
|
irc_identity_t identity;
|
|
|
|
/* Event queues */
|
|
irc_event_queue_t evtQueue;
|
|
} irc_client_t;
|
|
|
|
typedef struct {
|
|
const char *name;
|
|
void (*handler)(irc_message_t *msg, irc_client_t *irc);
|
|
} irc_command_t;
|
|
|
|
#endif |