split IRC.c and moved it to a different repo
This commit is contained in:
123
include/IRC/IRC_structs.h
Normal file
123
include/IRC/IRC_structs.h
Normal file
@@ -0,0 +1,123 @@
|
||||
#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;
|
||||
irc_message_t orig_msg;
|
||||
} 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_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;
|
||||
|
||||
irc_event_t* eventQueue; // lives on the heap
|
||||
int eventQueuePtr;
|
||||
} irc_client_t;
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
void (*handler)(irc_message_t *msg, irc_client_t *irc);
|
||||
} command_t;
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user