123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- // One of the headers for HaxServ
- //
- // Written by: Test_User <hax@andrewyu.org>
- //
- // This is free and unencumbered software released into the public
- // domain.
- //
- // Anyone is free to copy, modify, publish, use, compile, sell, or
- // distribute this software, either in source code form or as a compiled
- // binary, for any purpose, commercial or non-commercial, and by any
- // means.
- //
- // In jurisdictions that recognize copyright laws, the author or authors
- // of this software dedicate any and all copyright interest in the
- // software to the public domain. We make this dedication for the benefit
- // of the public at large and to the detriment of our heirs and
- // successors. We intend this dedication to be an overt act of
- // relinquishment in perpetuity of all present and future rights to this
- // software under copyright law.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- // IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- // OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- // OTHER DEALINGS IN THE SOFTWARE.
- #pragma once
- #include <netinet/in.h>
- #include <pthread.h>
- #include <limits.h>
- #include "types.h"
- #include "table.h"
- // ID is the index you got this from
- struct server_info {
- uint64_t distance; // gl if you exceed this
- struct string address;
- struct string name;
- struct string via; // netsplit purposes
- // TODO: this v
- struct table user_list;
- // TODO: metadata
- };
- struct user_info {
- uint64_t nick_ts;
- uint64_t user_ts;
- struct string server;
- struct string nick;
- struct string hostname;
- struct string vhost;
- struct string ident;
- struct string ip;
- struct string realname;
- struct string opertype;
- // TODO: this v
- struct table channel_list;
- struct table metadata;
- };
- struct channel_info {
- uint64_t ts;
- struct string topic;
- uint64_t topic_ts;
- struct table modes; // TODO: Parse modes properly
- struct table user_list; // points to corresponding user_info struct (if available, currently not)
- struct table metadata;
- };
- extern struct table server_network_commands;
- extern struct table client_network_commands;
- extern struct table channel_list;
- extern struct table server_list;
- extern struct table user_list;
- extern pthread_mutex_t send_lock;
- extern int client_fd;
- extern int client_listen_fd;
- extern struct string client_nick;
- extern uint8_t client_connected;
- extern int resolve(char* address, char* port, struct sockaddr *server);
- extern int initservernetwork(void);
- extern int initclientnetwork(void);
- #define MODE_TYPE_UNKNOWN 0
- #define MODE_TYPE_NOARGS 1
- #define MODE_TYPE_REPLACE 2
- #define MODE_TYPE_MULTIPLE 3
- // Mode goes away when the user leaves the channel
- #define MODE_TYPE_USERS 4
- extern char channel_mode_types[UCHAR_MAX+1];
- #if LOGALL
- extern ssize_t SENDCLIENT(struct string msg);
- #else
- #define SENDCLIENT(x) write(client_fd, x.data, x.len)
- #endif
- extern int privmsg(struct string source, struct string target, size_t num_message_parts, struct string message[num_message_parts]);
- extern int add_local_client(struct string uid, struct string nick_arg, struct string vhost_arg, struct string ident_arg, struct string realname_arg, time_t timestamp, char fake_cert);
- extern int remove_user(struct string uid, struct string reason);
|