src/irc_proto.h
changeset 45 71e65564afd2
parent 39 a4891d71aca9
child 72 43084f103c2a
equal deleted inserted replaced
44:6bd70113e1ed 45:71e65564afd2
     8  */
     8  */
     9 #include "error.h"
     9 #include "error.h"
    10 #include <stddef.h>
    10 #include <stddef.h>
    11 
    11 
    12 /**
    12 /**
    13  * Maximum length of an IRC nickname including terminating NUL
    13  * Maximum length of an IRC nickname including terminating NUL.
    14  */
    14  */
    15 #define IRC_NICK_MAX 31
    15 #define IRC_NICK_MAX 31
       
    16 
       
    17 /**
       
    18  * Maximum length of an IRC prefix/nickmask string, including any termianting NULs.
       
    19  *
       
    20  * XXX: currently this is pretty large, but does it really matter? We have more than 4k stack...
       
    21  */
       
    22 #define IRC_PREFIX_MAX 510
    16 
    23 
    17 /**
    24 /**
    18  * Parsed nickmask
    25  * Parsed nickmask
    19  */
    26  */
    20 struct irc_nm {
    27 struct irc_nm {
    29 };
    36 };
    30 
    37 
    31 /**
    38 /**
    32  * Parse a full nickmask from a prefix. This fails if the prefix is a server name.
    39  * Parse a full nickmask from a prefix. This fails if the prefix is a server name.
    33  *
    40  *
    34  * XXX: not implemented, and memory-management issues
    41  * Since we cannot modify the prefix string, the user must provide a buffer of at least IRC_PREFIX_MAX bytes to store
       
    42  * the procesed prefix. The returned nm's fields will point into this buffer.
    35  */
    43  */
    36 err_t irc_nm_parse (struct irc_nm *nm, char *prefix);
    44 err_t irc_nm_parse (struct irc_nm *nm, char *buf, const char *prefix);
    37 
    45 
    38 /**
    46 /**
    39  * Compare two nicknames for equality, with standard strcmp() semantics.
    47  * Compare two nicknames for equality, with standard strcmp() semantics.
    40  */
    48  */
    41 int irc_cmp_nick (const char *nick1, const char *nick2);
    49 int irc_cmp_nick (const char *nick1, const char *nick2);