Go to the documentation of this file.
93 if (sl->
len+size >
sizeof(sl->
buf)) {
189 assert(len <= 65535);
204 size =
sizeof(sl->
buf)-sl->
len;
210 if (
n <= -1 || (
size_t)
n >= size) {
213 sl->
len += (size_t)
n;
244 return sizeof(sl->
buf)-sl->
len;
279 stat = recv(fd,
reinterpret_cast<char *
>(sl->
buf+sl->
len), 2-sl->
len, 0);
283 stat = read(fd, sl->
buf+sl->
len, 2-sl->
len);
284 }
while ((stat == -1) && (errno == EINTR));
291 if ((stat == -1) && WSAGetLastError() != WSAEWOULDBLOCK) {
292 if (WSAGetLastError() == WSAECONNRESET)
295 LOG(
llevDebug,
"ReadPacket got error %d, returning -1\n", WSAGetLastError());
300 if (errno == ECONNRESET) {
301 LOG(
llevDebug,
"ReadPacket got error %s, returning -1\n", strerror(errno));
304 if (errno != EAGAIN && errno != EWOULDBLOCK) {
305 LOG(
llevDebug,
"ReadPacket got error %s, returning 0\n", strerror(errno));
323 toread = 2+(sl->
buf[0]<<8)+sl->
buf[1]-sl->
len;
324 if ((toread+(
int)sl->
len) >= len) {
325 LOG(
llevError,
"SockList_ReadPacket: Want to read more bytes than will fit in buffer (%lu>=%lu).\n", (
unsigned long)toread+sl->
len, (
unsigned long)len);
331 stat = recv(fd,
reinterpret_cast<char *
>(sl->
buf+2), 100, 0);
333 stat = read(fd, sl->
buf+2, 100);
342 stat = recv(fd,
reinterpret_cast<char *
>(sl->
buf+sl->
len), toread, 0);
345 stat = read(fd, sl->
buf+sl->
len, toread);
346 }
while ((stat < 0) && (errno == EINTR));
350 if ((stat == -1) && WSAGetLastError() != WSAEWOULDBLOCK) {
351 if (WSAGetLastError() == WSAECONNRESET)
354 LOG(
llevDebug,
"ReadPacket got error %d, returning -1\n", WSAGetLastError());
359 if (errno != EAGAIN && errno != EWOULDBLOCK) {
360 LOG(
llevDebug,
"ReadPacket got error %s, returning 0\n", strerror(errno));
376 LOG(
llevError,
"SockList_ReadPacket: Read more bytes than desired.\n");
379 }
while (toread > 0);
398 LOG(
llevDebug,
"Write_To_Socket called with dead socket\n");
403 const int amt =
send(ns->
fd,
reinterpret_cast<const char *
>(
buf), len, 0);
405 const int amt =
send(ns->
fd,
buf, len, 0);
409 if (amt == -1 && WSAGetLastError() != WSAEWOULDBLOCK) {
410 LOG(
llevInfo,
"New socket write failed WTS (%d).\n",
413 if (errno != EWOULDBLOCK) {
421 "Write_To_Socket: write would block; disconnecting. Try "
422 "increasing SOCKETBUFSIZE.\n");
426 }
else if (amt != len) {
427 LOG(
llevError,
"Write_To_Socket: write wrote less than requested; "
428 "disconnecting. Try increasing SOCKETBUFSIZE.\n");
448 sl->
buf[0] = ((sl->
len-2)>>8)&0xFF;
449 sl->
buf[1] = (sl->
len-2)&0xFF;
461 static int count_all_players() {
485 LOG(
llevInfo,
"CSSTAT: %.16s tot %d %d %d %ld inc %d %d %d %ld\n",
void SockList_AddShort(SockList *sl, uint16_t data)
void Send_With_Handling(socket_struct *ns, SockList *sl)
void SockList_NullTerminate(SockList *sl)
void LOG(LogLevel logLevel, const char *format,...)
based on the size of the this randomly makes land number of spaces randomly lower or higher The default is Note that this is run also based on the the altitude amount will likely be less So if you do something like l and n
short GetShort_String(const unsigned char *data)
void SockList_AddData(SockList *sl, const void *data, size_t len)
non standard information is not specified or uptime this means how long since the executable has been started A particular host may have been running a server for quite a long time
void SockList_Reset(SockList *sl)
static void SockList_Ensure(const SockList *sl, size_t size)
void SockList_Term(SockList *sl)
char * stringbuffer_finish(StringBuffer *sb)
unsigned char buf[MAXSOCKBUF]
void SockList_Init(SockList *sl)
void SockList_AddLen8Data(SockList *sl, const void *data, size_t len)
void SockList_AddChar(SockList *sl, unsigned char data)
void fatal(enum fatal_error err)
void SockList_AddInt(SockList *sl, uint32_t data)
std::vector< archetype * > players
void write_cs_stats(void)
void SockList_AddStringBuffer(SockList *sl, StringBuffer *sb)
int SockList_ReadPacket(int fd, SockList *sl, int len)
size_t SockList_Avail(const SockList *sl)
Python Guilds Quick outline Add a guild(mapmakers) this is still a problem *after dropping the token to gain access to the stove a woodfloor now appears which is Toolshed Token(found in Guild_HQ) *Note also have multiple gates in place to protect players and items from the mana explosion drop x for Jewelers room *Jewelers room works just need to determine what x is drop x for Thaumaturgy room *Thaumaturgy room works just need to determine what x is drop gold dropping the Firestar named fearless allows access to but I suspect that the drop location of the chest is not as intended because the player is in the way once you enter the chest the exit back to the basement is things such as the message et al reside on teleporters which then transport items to the map as they are when the map is already purchased items reappear in that area From my this does not cause any problems at the moment But this should be corrected fixed Major it s now possible to buy guilds Ryo Update Uploaded guild package to CVS Changes the cauldrons and the charging room I spent a while agonizing over They were natural guild enhancements but much too much value for any reasonable expense to buy them Then I thought that they should be pay access but at a greatly reduced rate SO when you buy a forge or whatever for your guild it is available on a perplayer daily rate but it will be accessable for testing and to DMs to play with Like I said lots still to do with the especially comingt up with quest items for buying things like the new workshops and stuff One of the things I would like some input on would be proposals for additional fields for either the guildhouses or guild datafiles to play with Currently the Guildhouse but there is no reason we can t have more than one measure of a guild perhaps have dues relate to Dues and use points for some other suspended or inactive or when a guild is founded inactive active Guilds have the format
static void Write_To_Socket(socket_struct *ns, const unsigned char *buf, const int len)
void SockList_AddInt64(SockList *sl, uint64_t data)
void SockList_ResetRead(SockList *sl)
Crossfire Protocol most of the time after the actual code was already omit certain important and possibly make life miserable any new developer or curious player should be able to find most of the relevant information here If inconsistencies are found or this documentation proves to be consider the latest server side protocol code in the public source code repository as the authoritative reference Introduction If you were ever curious enough to telnet or netcat to a Crossfire chances are you were sorely disappointed While the protocol may seem to use plain text at it actually uses a mix of ASCII and binary data This handbook attempts to document various aspects of the Crossfire protocol As consult the README file to find out how to get in touch with helpful people via mailing and more History the communications plan was set to be a text based system It was up to the server and client to parse these messages and determine what to do These messages were assumed to be line per message At a reasonably early stage of Eric Anderson wrote a then the data itself you could send many data and after the other end could decode these commands This works fairly but I think the creation of numerous sub packets has some performance hit the eutl was not especially well so writing a client for a different platform became more Eric left to work on other products shortly after writing his which didn t really leave anyone with a full understanding of the socket code I have decided to remove the eutl dependency At least one advantage is that having this network related code directly in the client and server makes error handling a bit easier cleaner Packet Format the outside packet method the byte size for the size information is not included here Eutl originally used bytes for the size to bytes seems it makes a least some sense The actual data is something of the nature of the commands listed below It is a text followed by possible other data The remaining data can be binary it is up to the client and server to decode what it sent The commands as described below is just the data portion of the packet If writing a new remember that you must take into account the size of the packet There is no termination of other than knowing how long it should be For now
void SockList_AddLen16Data(SockList *sl, const void *data, size_t len)
void SockList_AddPrintf(SockList *sl, const char *format,...)
void SockList_AddString(SockList *sl, const char *data)
int GetInt_String(const unsigned char *data)