📄 slp_message.h
字号:
{ int errorcode; int urlcount; SLPUrlEntry* urlarray;}SLPSrvRply;/*=========================================================================*/typedef struct _SLPSrvReg/*=========================================================================*/{ SLPUrlEntry urlentry; int srvtypelen; const char* srvtype; int scopelistlen; const char* scopelist; int attrlistlen; const char* attrlist; int authcount; SLPAuthBlock* autharray; /* The following are used for OpenSLP specific extensions */ uint32_t pid; /* The following are not part of the RFC protocol. They are used by */ /* the OpenSLP implementation for convenience */ int source;}SLPSrvReg;/*=========================================================================*/typedef struct _SLPSrvDeReg/*=========================================================================*/{ int scopelistlen; const char* scopelist; SLPUrlEntry urlentry; int taglistlen; const char* taglist;}SLPSrvDeReg;/*=========================================================================*/typedef struct _SLPSrvAck/*=========================================================================*/{ int errorcode;}SLPSrvAck;/*=========================================================================*/typedef struct _SLPDAAdvert/*=========================================================================*/{ int errorcode; unsigned int bootstamp; int urllen; const char* url; int scopelistlen; const char* scopelist; int attrlistlen; const char* attrlist; int spilistlen; const char* spilist; int authcount; SLPAuthBlock* autharray;}SLPDAAdvert;/*=========================================================================*/typedef struct _SLPAttrRqst/*=========================================================================*/{ int prlistlen; const char* prlist; int urllen; const char* url; int scopelistlen; const char* scopelist; int taglistlen; const char* taglist; int spistrlen; const char* spistr;}SLPAttrRqst;/*=========================================================================*/typedef struct _SLPAttrRply/*=========================================================================*/{ int errorcode; int attrlistlen; const char* attrlist; int authcount; SLPAuthBlock* autharray;}SLPAttrRply;/*=========================================================================*/typedef struct _SLPSrvTypeRqst/*=========================================================================*/{ int prlistlen; const char* prlist; int namingauthlen; const char* namingauth; int scopelistlen; const char* scopelist;}SLPSrvTypeRqst;/*=========================================================================*/typedef struct _SLPSrvTypeRply/*=========================================================================*/{ int errorcode; int srvtypelistlen; const char* srvtypelist;}SLPSrvTypeRply;/*=========================================================================*/typedef struct _SLPSAAdvert/*=========================================================================*/{ int urllen; const char* url; int scopelistlen; const char* scopelist; int attrlistlen; const char* attrlist; int authcount; SLPAuthBlock* autharray;}SLPSAAdvert;/*=========================================================================*/typedef struct _SLPMessage/*=========================================================================*/{ struct sockaddr_in peer; SLPHeader header; union _body { SLPSrvRqst srvrqst; SLPSrvRply srvrply; SLPSrvReg srvreg; SLPSrvDeReg srvdereg; SLPSrvAck srvack; SLPDAAdvert daadvert; SLPAttrRqst attrrqst; SLPAttrRply attrrply; SLPSrvTypeRqst srvtyperqst; SLPSrvTypeRply srvtyperply; SLPSAAdvert saadvert; }body; }*SLPMessage;/*=========================================================================*/void SLPMessageFreeInternals(SLPMessage message);/*=========================================================================*//*=========================================================================*/SLPMessage SLPMessageAlloc();/* Allocates memory for a SLP message descriptor *//* *//* Returns - A newly allocated SLPMessage pointer of NULL on ENOMEM *//*=========================================================================*//*=========================================================================*/SLPMessage SLPMessageRealloc(SLPMessage msg);/* Reallocates memory for a SLP message descriptor *//* *//* Returns - A newly allocated SLPMessage pointer of NULL on ENOMEM *//*=========================================================================*//*=========================================================================*/void SLPMessageFree(SLPMessage message);/* Frees memory that might have been allocated by the SLPMessage for *//* UrlEntryLists or AuthBlockLists. *//* *//* message - (IN) the SLPMessage to free *//*=========================================================================*//*=========================================================================*/int SLPMessageParseHeader(SLPBuffer buffer, SLPHeader* header);/* Fill out a header structure with what ever is in the buffer *//* *//* buffer (IN) the buffer to be parsed *//* *//* header (IN/OUT) pointer to the header structure to fill out *//*=========================================================================*//*=========================================================================*/int SLPMessageParseBuffer(struct sockaddr_in* peerinfo, SLPBuffer buffer, SLPMessage message);/* Initializes a message descriptor by parsing the specified buffer. *//* *//* peerinfo - (IN) pointer to the network address information that sent */ /* buffer *//* *//* buffer - (IN) pointer the SLPBuffer to parse *//* *//* message - (OUT) set to describe the message from the buffer *//* *//* Returns - Zero on success, SLP_ERROR_PARSE_ERROR, or *//* SLP_ERROR_INTERNAL_ERROR if out of memory. SLPMessage is *//* invalid return is not successful. *//* *//* WARNING - If successful, pointers in the SLPMessage reference memory in*/ /* the parsed SLPBuffer. If SLPBufferFree() is called then the *//* pointers in SLPMessage will be invalidated. *//*=========================================================================*//*=========================================================================*//* Functions used to parse buffers */unsigned short AsUINT16(const char *charptr);unsigned int AsUINT24(const char *charptr);unsigned int AsUINT32(const char *charptr);/*=========================================================================*//*=========================================================================*//* Functions used to set buffers */void ToUINT16(char *charptr, unsigned int val);void ToUINT24(char *charptr, unsigned int val);void ToUINT32(char *charptr, unsigned int val);/*=========================================================================*/#ifdef i386/*=========================================================================*//* Macros to check in_addr */#define ISLOCAL(addr) ((ntohl((addr).s_addr) & 0xff000000) == 0x7f000000)#define ISMCAST(addr) ((ntohl((addr).s_addr) & 0xff000000) >= 0xef000000)/*=========================================================================*/#else /*=========================================================================*//* Macros to check in_addr */#define ISLOCAL(addr) (((addr).s_addr & 0xff000000) == 0x7f000000)#define ISMCAST(addr) (((addr).s_addr & 0xff000000) >= 0xef000000)/*=========================================================================*/#endif#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -