5359edc160de518d8e43fdd3448365c15b912c3c galt Mon Jul 22 11:48:10 2019 -0700 Added ipv6 support. Listening processes us hybrid dual stack feature of OS to simplify implementation and use a single listening socket. Works with both TCP and UDP. Parasol working. geoIp also updated and ready for IPv6. Should be invisible to most users, while providing connections via ipv6 where available. Supports both ipv4 and ipv6. diff --git src/parasol/inc/paraMessage.h src/parasol/inc/paraMessage.h index c31fd76..ecba0c3 100644 --- src/parasol/inc/paraMessage.h +++ src/parasol/inc/paraMessage.h @@ -1,52 +1,51 @@ /* paraMessage - routines to pack and unpack messages in * the parasol system, and also to send them via sockets. */ #ifndef PARAMESSAGE_H #define PARAMESSAGE_H #ifndef RUDP_H #include "rudp.h" #endif struct paraMessage /* A parasol message. */ { struct paraMessage *next; /* Next in list. */ - struct sockaddr_in ipAddress; /* IP address of machine message is from/to */ + struct sockaddr_storage ipAddress; /* IP address of machine message is from/to */ int size; /* Size of data. */ char data[rudpMaxSize+1]; /* Data. Extra byte for zero tag at end. */ }; struct paraMultiMessage /* A parasol multi-packet response message. */ { struct paraMessage *pm; - struct sockaddr_in ipAddress; /* IP address of machine message is from/to */ + struct sockaddr_storage ipAddress; /* IP address of machine message is from/to */ bits32 id; /* Message id. Returned with ack. */ }; -void pmInit(struct paraMessage *pm, rudpHost ipAddress, bits16 port); -/* Initialize message (that might be on stack). ipAddress is in host - * order. */ +void pmInit(struct paraMessage *pm, char *ipStr, char *portStr); +/* Initialize message (that might be on stack). */ -void pmInitFromName(struct paraMessage *pm, char *hostName, bits16 port); +void pmInitFromName(struct paraMessage *pm, char *hostName, char *portStr); /* Initialize message with ascii ip address. */ -struct paraMessage *pmNew(rudpHost ipAddress, bits16 port); -/* Create new message in memory. ipAddress is in host order. */ +struct paraMessage *pmNew(char *ipStr, char *portStr); +/* Create new message in memory. */ struct paraMessage *pmNewFromName(char *hostName, bits16 port); /* Create new message in memory */ void pmFree(struct paraMessage **pPm); /* Free up message. */ void pmClear(struct paraMessage *pm); /* Clear out data buffer. */ void pmSet(struct paraMessage *pm, char *message); /* Set message in data buffer. Aborts if message too long (rudpMaxSize or more). */ void pmPrintf(struct paraMessage *pm, char *format, ...) /* Print message into end of data buffer. Warn if it goes @@ -65,31 +64,31 @@ /* Send out given message strng. Print warning message and return FALSE if * there is a problem. */ void pmCheckCommandSize(char *string, int len); /* Check that string of given len is not too long to fit into paraMessage. * If it is, abort with good error message assuming it was a command string */ boolean pmReceive(struct paraMessage *pm, struct rudp *ru); /* Receive message. Print warning message and return FALSE if * there is a problem. */ boolean pmReceiveTimeOut(struct paraMessage *pm, struct rudp *ru, int timeOut); /* Wait up to timeOut microseconds for message. To wait forever * set timeOut to zero. */ -void pmmInit(struct paraMultiMessage *pmm, struct paraMessage *pm, struct in_addr sin_addr); +void pmmInit(struct paraMultiMessage *pmm, struct paraMessage *pm); /* Initialize structure for multi-message response */ boolean pmmReceiveTimeOut(struct paraMultiMessage *pmm, struct rudp *ru, int timeOut); /* Multi-message receive * Wait up to timeOut microseconds for message. To wait forever * set timeOut to zero. For multi-message response * We know the ip, and can track the port for continuity * and the packet id for sequential series. */ boolean pmmReceive(struct paraMultiMessage *pmm, struct rudp *ru); /* Receive multi message. Print warning message and return FALSE if * there is a problem. */ void pmFetchOpenFile(struct paraMessage *pm, struct rudp *ru, char *fileName);