/* $Id$ */
+#define UDS "_UDS_"
+#ifdef __CYGWIN__
+#define DEFAULT_HOST "localhost"
+#else
+#define DEFAULT_HOST UDS
+#endif
+#define DEFAULT_PORT "citadel"
+
#include "sysdep.h"
+#include "server.h"
#ifdef HAVE_PTHREAD_H
#include <pthread.h>
#endif
#define ifree(o) free(o);
#endif
+struct CtdlServInfo {
+ int pid;
+ char nodename[32];
+ char humannode[64];
+ char fqdn[64];
+ char software[64];
+ int rev_level;
+ char site_location[64];
+ char sysadm[64];
+ char moreprompt[256];
+ int ok_floors;
+ int paging_level;
+ int supports_qnop;
+ int supports_ldap;
+};
+
/* This class is responsible for the server connection */
typedef struct _CtdlIPC {
+ /* The server info for this connection */
+ struct CtdlServInfo ServInfo;
+
#if defined(HAVE_OPENSSL)
/* NULL if not encrypted, non-NULL otherwise */
SSL *ssl;
void CtdlIPC_delete(CtdlIPC* ipc);
/* Convenience destructor; also nulls out caller's pointer */
void CtdlIPC_delete_ptr(CtdlIPC** pipc);
-/* Read a line from server, discarding newline */
-void CtdlIPC_getline(CtdlIPC* ipc, char *buf);
-/* Write a line to server, adding newline */
-void CtdlIPC_putline(CtdlIPC* ipc, const char *buf);
+/* Read a line from server, discarding newline, for chat, will go away */
+void CtdlIPC_chat_recv(CtdlIPC* ipc, char *buf);
+/* Write a line to server, adding newline, for chat, will go away */
+void CtdlIPC_chat_send(CtdlIPC* ipc, const char *buf);
struct ctdlipcroom {
char RRname[ROOMNAMELEN]; /* Name of room */
char zaps[SIZ]; /* Message ID that this supersedes */
char subject[SIZ]; /* Message subject */
char email[SIZ]; /* Email address of sender */
- char author[USERNAME_SIZE]; /* Sender of message */
- char recipient[USERNAME_SIZE]; /* Recipient of message */
- char room[ROOMNAMELEN]; /* Originating room */
- char node[16]; /* Short nodename of origin system */
- char hnod[21]; /* Humannode of origin system */
+ char author[SIZ]; /* Sender of message */
+ char recipient[SIZ]; /* Recipient of message */
+ char room[SIZ]; /* Originating room */
+ char node[SIZ]; /* Short nodename of origin system */
+ char hnod[SIZ]; /* Humannode of origin system */
struct parts *attachments; /* Available attachments */
char *text; /* Message text */
int type; /* Message type */
char description[80]; /* Description on server */
FILE *local_fd; /* Open file on client */
size_t size; /* Size of file in octets */
- int upload:1; /* uploading? 0 if downloading */
- int complete:1; /* Transfer has finished? */
+ unsigned int upload:1; /* uploading? 0 if downloading */
+ unsigned int complete:1; /* Transfer has finished? */
};
SubscribedRoomsWithNoNewMessages,
UnsubscribedRooms,
AllAccessibleRooms,
- AllPublicRooms,
+ AllPublicRooms
};
#define AllFloors -1
enum MessageList {
LastMessages,
FirstMessages,
MessagesGreaterThan,
- MessagesLessThan,
+ MessagesLessThan
};
enum MessageDirection {
ReadReverse = -1,
- ReadForward = 1,
+ ReadForward = 1
};
/* Shared Diffie-Hellman parameters */
#define DH_P "1A74527AEE4EE2568E85D4FB2E65E18C9394B9C80C42507D7A6A0DBE9A9A54B05A9A96800C34C7AA5297095B69C88901EEFD127F969DCA26A54C0E0B5C5473EBAEB00957D2633ECAE3835775425DE66C0DE6D024DBB17445E06E6B0C78415E589B8814F08531D02FD43778451E7685541079CFFB79EF0D26EFEEBBB69D1E80383"
#define DH_G "2"
#define DH_L 1024
-#define CIT_CIPHERS "ALL:RC4+RSA:+SSLv2:@STRENGTH" /* see ciphers(1) */
+#define CIT_CIPHERS "ALL:RC4+RSA:+SSLv2:+TLSv1:!MD5:@STRENGTH" /* see ciphers(1) */
int CtdlIPCNoop(CtdlIPC *ipc);
int CtdlIPCEcho(CtdlIPC *ipc, const char *arg, char *cret);
int CtdlIPCGetSingleMessage(CtdlIPC *ipc, long msgnum, int headers, int as_mime,
struct ctdlipcmessage **mret, char *cret);
int CtdlIPCWhoKnowsRoom(CtdlIPC *ipc, char **listing, char *cret);
-int CtdlIPCServerInfo(CtdlIPC *ipc, struct CtdlServInfo *ServInfo, char *cret);
+int CtdlIPCServerInfo(CtdlIPC *ipc, char *cret);
/* int CtdlIPCReadDirectory(CtdlIPC *ipc, struct ctdlipcfile **files, char *cret); */
int CtdlIPCReadDirectory(CtdlIPC *ipc, char **listing, char *cret);
int CtdlIPCSetLastRead(CtdlIPC *ipc, long msgnum, char *cret);
int CtdlIPCOnlineUsers(CtdlIPC *ipc, char **listing, time_t *stamp, char *cret);
int CtdlIPCFileDownload(CtdlIPC *ipc, const char *filename, void **buf,
size_t resume,
- void (*progress_gauge_callback)(unsigned long, unsigned long),
+ void (*progress_gauge_callback)(CtdlIPC*, unsigned long, unsigned long),
char *cret);
int CtdlIPCAttachmentDownload(CtdlIPC *ipc, long msgnum, const char *part,
void **buf,
- void (*progress_gauge_callback)(unsigned long, unsigned long),
+ void (*progress_gauge_callback)(CtdlIPC*, unsigned long, unsigned long),
char *cret);
int CtdlIPCImageDownload(CtdlIPC *ipc, const char *filename, void **buf,
- void (*progress_gauge_callback)(unsigned long, unsigned long),
+ void (*progress_gauge_callback)(CtdlIPC*, unsigned long, unsigned long),
char *cret);
int CtdlIPCFileUpload(CtdlIPC *ipc, const char *save_as, const char *comment,
const char *path,
- void (*progress_gauge_callback)(unsigned long, unsigned long),
+ void (*progress_gauge_callback)(CtdlIPC*, unsigned long, unsigned long),
char *cret);
int CtdlIPCImageUpload(CtdlIPC *ipc, int for_real, const char *path,
const char *save_as,
- void (*progress_gauge_callback)(unsigned long, unsigned long),
+ void (*progress_gauge_callback)(CtdlIPC*, unsigned long, unsigned long),
char *cret);
int CtdlIPCQueryUsername(CtdlIPC *ipc, const char *username, char *cret);
int CtdlIPCFloorListing(CtdlIPC *ipc, char **listing, char *cret);
char **listing, char *cret);
int CtdlIPCSetSystemConfigByType(CtdlIPC *ipc, const char *mimetype,
const char *listing, char *cret);
+int CtdlIPCGetRoomNetworkConfig(CtdlIPC *ipc, char **listing, char *cret);
+int CtdlIPCSetRoomNetworkConfig(CtdlIPC *ipc, const char *listing, char *cret);
int CtdlIPCRequestClientLogout(CtdlIPC *ipc, int session, char *cret);
int CtdlIPCSetMessageSeen(CtdlIPC *ipc, long msgnum, int seen, char *cret);
int CtdlIPCStartEncryption(CtdlIPC *ipc, char *cret);
/* Stuff below this line is not for public consumption */
/* ************************************************************************** */
-inline void CtdlIPC_lock(CtdlIPC *ipc);
-inline void CtdlIPC_unlock(CtdlIPC *ipc);
+INLINE void CtdlIPC_lock(CtdlIPC *ipc);
+INLINE void CtdlIPC_unlock(CtdlIPC *ipc);
char *CtdlIPCReadListing(CtdlIPC *ipc, char *dest);
int CtdlIPCSendListing(CtdlIPC *ipc, const char *listing);
size_t CtdlIPCPartialRead(CtdlIPC *ipc, void **buf, size_t offset,
size_t bytes, char *cret);
int CtdlIPCEndUpload(CtdlIPC *ipc, int discard, char *cret);
int CtdlIPCWriteUpload(CtdlIPC *ipc, const char *path,
- void (*progress_gauge_callback)(unsigned long, unsigned long),
+ void (*progress_gauge_callback)(CtdlIPC*, unsigned long, unsigned long),
char *cret);
int CtdlIPCEndDownload(CtdlIPC *ipc, char *cret);
int CtdlIPCReadDownload(CtdlIPC *ipc, void **buf, size_t bytes, size_t resume,
- void (*progress_gauge_callback)(unsigned long, unsigned long),
+ void (*progress_gauge_callback)(CtdlIPC*, unsigned long, unsigned long),
char *cret);
int CtdlIPCHighSpeedReadDownload(CtdlIPC *ipc, void **buf, size_t bytes,
size_t resume,
- void (*progress_gauge_callback)(unsigned long, unsigned long),
+ void (*progress_gauge_callback)(CtdlIPC*, unsigned long, unsigned long),
char *cret);
int CtdlIPCGenericCommand(CtdlIPC *ipc, const char *command,
const char *to_send, size_t bytes_to_send, char **to_receive,
extern int (*error_printf)(char *s, ...);
void setIPCDeathHook(void (*hook)(void));
void setIPCErrorPrintf(int (*func)(char *s, ...));
-void connection_died(CtdlIPC *ipc);
+void connection_died(CtdlIPC* ipc, int using_ssl);
int CtdlIPC_getsockfd(CtdlIPC* ipc);
char CtdlIPC_get(CtdlIPC* ipc);