rfc2812.txt
来自「中、英文RFC文档大全打包下载完全版 .」· 文本 代码 · 共 1,794 行 · 第 1/5 页
TXT
1,794 行
msgtarget = msgto *( "," msgto ) msgto = channel / ( user [ "%" host ] "@" servername ) msgto =/ ( user "%" host ) / targetmask msgto =/ nickname / ( nickname "!" user "@" host ) channel = ( "#" / "+" / ( "!" channelid ) / "&" ) chanstring [ ":" chanstring ] servername = hostname host = hostname / hostaddr hostname = shortname *( "." shortname ) shortname = ( letter / digit ) *( letter / digit / "-" ) *( letter / digit ) ; as specified in RFC 1123 [HNAME] hostaddr = ip4addr / ip6addr ip4addr = 1*3digit "." 1*3digit "." 1*3digit "." 1*3digit ip6addr = 1*hexdigit 7( ":" 1*hexdigit ) ip6addr =/ "0:0:0:0:0:" ( "0" / "FFFF" ) ":" ip4addr nickname = ( letter / special ) *8( letter / digit / special / "-" ) targetmask = ( "$" / "#" ) mask ; see details on allowed masks in section 3.3.1 chanstring = %x01-07 / %x08-09 / %x0B-0C / %x0E-1F / %x21-2B chanstring =/ %x2D-39 / %x3B-FF ; any octet except NUL, BELL, CR, LF, " ", "," and ":" channelid = 5( %x41-5A / digit ) ; 5( A-Z / 0-9 )Kalt Informational [Page 7]RFC 2812 Internet Relay Chat: Client Protocol April 2000 Other parameter syntaxes are: user = 1*( %x01-09 / %x0B-0C / %x0E-1F / %x21-3F / %x41-FF ) ; any octet except NUL, CR, LF, " " and "@" key = 1*23( %x01-05 / %x07-08 / %x0C / %x0E-1F / %x21-7F ) ; any 7-bit US_ASCII character, ; except NUL, CR, LF, FF, h/v TABs, and " " letter = %x41-5A / %x61-7A ; A-Z / a-z digit = %x30-39 ; 0-9 hexdigit = digit / "A" / "B" / "C" / "D" / "E" / "F" special = %x5B-60 / %x7B-7D ; "[", "]", "\", "`", "_", "^", "{", "|", "}" NOTES: 1) The <hostaddr> syntax is given here for the sole purpose of indicating the format to follow for IP addresses. This reflects the fact that the only available implementations of this protocol uses TCP/IP as underlying network protocol but is not meant to prevent other protocols to be used. 2) <hostname> has a maximum length of 63 characters. This is a limitation of the protocol as internet hostnames (in particular) can be longer. Such restriction is necessary because IRC messages are limited to 512 characters in length. Clients connecting from a host which name is longer than 63 characters are registered using the host (numeric) address instead of the host name. 3) Some parameters used in the following sections of this documents are not defined here as there is nothing specific about them besides the name that is used for convenience. These parameters follow the general syntax defined for <params>.2.4 Numeric replies Most of the messages sent to the server generate a reply of some sort. The most common reply is the numeric reply, used for both errors and normal replies. The numeric reply MUST be sent as one message consisting of the sender prefix, the three-digit numeric, and the target of the reply. A numeric reply is not allowed to originate from a client. In all other respects, a numeric reply is just like a normal message, except that the keyword is made up of 3 numeric digits rather than a string of letters. A list of different replies is supplied in section 5 (Replies).Kalt Informational [Page 8]RFC 2812 Internet Relay Chat: Client Protocol April 20002.5 Wildcard expressions When wildcards are allowed in a string, it is referred as a "mask". For string matching purposes, the protocol allows the use of two special characters: '?' (%x3F) to match one and only one character, and '*' (%x2A) to match any number of any characters. These two characters can be escaped using the character '\' (%x5C). The Augmented BNF syntax for this is: mask = *( nowild / noesc wildone / noesc wildmany ) wildone = %x3F wildmany = %x2A nowild = %x01-29 / %x2B-3E / %x40-FF ; any octet except NUL, "*", "?" noesc = %x01-5B / %x5D-FF ; any octet except NUL and "\" matchone = %x01-FF ; matches wildone matchmany = *matchone ; matches wildmany Examples: a?c ; Matches any string of 3 characters in length starting with "a" and ending with "c" a*c ; Matches any string of at least 2 characters in length starting with "a" and ending with "c"3. Message Details On the following pages there are descriptions of each message recognized by the IRC server and client. All commands described in this section MUST be implemented by any server for this protocol. Where the reply ERR_NOSUCHSERVER is returned, it means that the target of the message could not be found. The server MUST NOT send any other replies after this error for that command. The server to which a client is connected is required to parse the complete message, and return any appropriate errors. If multiple parameters is presented, then each MUST be checked for validity and appropriate responses MUST be sent back to the client. In the case of incorrect messages which use parameter lists with comma as an item separator, a reply MUST be sent for each item.Kalt Informational [Page 9]RFC 2812 Internet Relay Chat: Client Protocol April 20003.1 Connection Registration The commands described here are used to register a connection with an IRC server as a user as well as to correctly disconnect. A "PASS" command is not required for a client connection to be registered, but it MUST precede the latter of the NICK/USER combination (for a user connection) or the SERVICE command (for a service connection). The RECOMMENDED order for a client to register is as follows: 1. Pass message 2. Nick message 2. Service message 3. User message Upon success, the client will receive an RPL_WELCOME (for users) or RPL_YOURESERVICE (for services) message indicating that the connection is now registered and known the to the entire IRC network. The reply message MUST contain the full client identifier upon which it was registered.3.1.1 Password message Command: PASS Parameters: <password> The PASS command is used to set a 'connection password'. The optional password can and MUST be set before any attempt to register the connection is made. Currently this requires that user send a PASS command before sending the NICK/USER combination. Numeric Replies: ERR_NEEDMOREPARAMS ERR_ALREADYREGISTRED Example: PASS secretpasswordhere3.1.2 Nick message Command: NICK Parameters: <nickname> NICK command is used to give user a nickname or change the existing one.Kalt Informational [Page 10]RFC 2812 Internet Relay Chat: Client Protocol April 2000 Numeric Replies: ERR_NONICKNAMEGIVEN ERR_ERRONEUSNICKNAME ERR_NICKNAMEINUSE ERR_NICKCOLLISION ERR_UNAVAILRESOURCE ERR_RESTRICTED Examples: NICK Wiz ; Introducing new nick "Wiz" if session is still unregistered, or user changing his nickname to "Wiz" :WiZ!jto@tolsun.oulu.fi NICK Kilroy ; Server telling that WiZ changed his nickname to Kilroy.3.1.3 User message Command: USER Parameters: <user> <mode> <unused> <realname> The USER command is used at the beginning of connection to specify the username, hostname and realname of a new user. The <mode> parameter should be a numeric, and can be used to automatically set user modes when registering with the server. This parameter is a bitmask, with only 2 bits having any signification: if the bit 2 is set, the user mode 'w' will be set and if the bit 3 is set, the user mode 'i' will be set. (See Section 3.1.5 "User Modes"). The <realname> may contain space characters. Numeric Replies: ERR_NEEDMOREPARAMS ERR_ALREADYREGISTRED Example: USER guest 0 * :Ronnie Reagan ; User registering themselves with a username of "guest" and real name "Ronnie Reagan". USER guest 8 * :Ronnie Reagan ; User registering themselves with a username of "guest" and real name "Ronnie Reagan", and asking to be set invisible.Kalt Informational [Page 11]RFC 2812 Internet Relay Chat: Client Protocol April 20003.1.4 Oper message Command: OPER Parameters: <name> <password> A normal user uses the OPER command to obtain operator privileges. The combination of <name> and <password> are REQUIRED to gain Operator privileges. Upon success, the user will receive a MODE message (see section 3.1.5) indicating the new user modes. Numeric Replies: ERR_NEEDMOREPARAMS RPL_YOUREOPER ERR_NOOPERHOST ERR_PASSWDMISMATCH Example: OPER foo bar ; Attempt to register as an operator using a username of "foo" and "bar" as the password.3.1.5 User mode message Command: MODE Parameters: <nickname> *( ( "+" / "-" ) *( "i" / "w" / "o" / "O" / "r" ) ) The user MODE's are typically changes which affect either how the client is seen by others or what 'extra' messages the client is sent. A user MODE command MUST only be accepted if both the sender of the message and the nickname given as a parameter are both the same. If no other parameter is given, then the server will return the current settings for the nick. The available modes are as follows: a - user is flagged as away; i - marks a users as invisible; w - user receives wallops; r - restricted user connection; o - operator flag; O - local operator flag; s - marks a user for receipt of server notices. Additional modes may be available later on.Kalt Informational [Page 12]RFC 2812 Internet Relay Chat: Client Protocol April 2000 The flag 'a' SHALL NOT be toggled by the user using the MODE command, instead use of the AWAY command is REQUIRED. If a user attempts to make themselves an operator using the "+o" or "+O" flag, the attempt SHOULD be ignored as users could bypass the authentication mechanisms of the OPER command. There is no restriction, however, on anyone `deopping' themselves (using "-o" or "-O"). On the other hand, if a user attempts to make themselves unrestricted using the "-r" flag, the attempt SHOULD be ignored. There is no restriction, however, on anyone `deopping' themselves (using "+r"). This flag is typically set by the server upon connection for administrative reasons. While the restrictions imposed are left up to the implementation, it is typical that a restricted user not be allowed to change nicknames, nor make use of the channel operator status on channels. The flag 's' is obsolete but MAY still be used. Numeric Replies: ERR_NEEDMOREPARAMS ERR_USERSDONTMATCH ERR_UMODEUNKNOWNFLAG RPL_UMODEIS Examples: MODE WiZ -w ; Command by WiZ to turn off reception of WALLOPS messages. MODE Angel +i ; Command from Angel to make herself invisible. MODE WiZ -o ; WiZ 'deopping' (removing operator status).3.1.6 Service message Command: SERVICE Parameters: <nickname> <reserved> <distribution> <type>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?