Fixed a minor bug.
[GoMoku3D.git] / doc / DP / protocol-schema.xml
blob52c85f24620c5939b31fc71fb4998c79f1744c6a
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
3                    targetNamespace="http://www.itworks.org/GoMoku3D/NetworkProtocol"
4                    xmlns="http://www.itworks.org/GoMoku3D/NetworkProtocol"
5                    elementFormDefault="qualified">
7         <xs:include schemaLocation="data-types.xml"/>
9         <!-- root element -->
10         <xs:element name="stream">
11                 <xs:complexType>
12                         <xs:choice minOccurs="0" maxOccurs="unbounded">
14                                 <!-- sent by: sendGameSettings() - received by: receivedGameSettings() -->
15                                 <xs:element name="settings" type="Tsettings"/>
17                                 <!-- sent by: sendPlayerJoined() - received by: playerJoined() -->
18                                 <xs:element name="playerJoined" type="Tplayer"/>
20                                 <!-- sent by: sendPlayerLeft() or cancelJoin() - received by: playerLeft() -->
21                                 <xs:element name="playerLeft" type="TplayerId"/>
23                                 <!-- sent by: joinGame() - received by: joinRequested() -->
24                                 <xs:element name="joinRequest" type="TjoinRequest"/>
26                                 <!-- sent by: acceptJoin() - received by: joinAccepted() -->
27                                 <xs:element name="joinACK" type="TplayerId"/>
29                                 <!-- sent by: refuseJoin() - received by: joinRefused() -->
30                                 <xs:element name="joinNAK" type="xs:unsignedByte"/>
32                                 <!-- sent by: sendStartGame() - received by: startGame() -->
33                                 <xs:element name="startGame" type="Tempty"/>
35                                 <!-- sent by: sendMove() - received by: receivedMove() -->
36                                 <xs:element name="move" type="Tmove"/>
38                                 <!-- sent by: sendHistory() - received by: receivedHistory() -->
39                                 <xs:element name="history" type="Thistory"/>
41                                 <!-- sent by: sendChatMsg() - received by: receivedChatMsg() -->
42                                 <xs:element name="chatMessage" type="Tchat"/>
44                         </xs:choice>
46                         <!-- protocol version -->
47                         <xs:attribute name="version" type="xs:string" use="required"/>
49                 </xs:complexType>
50         </xs:element>
52         <xs:complexType name="Tchat">
53                 <xs:simpleContent>
54                         <xs:extension base="xs:string">
55                                 <xs:attribute name="from" type="xs:string" use="required"/>
56                         </xs:extension>
57                 </xs:simpleContent>
58         </xs:complexType>
60         <xs:complexType name="TjoinRequest">
61                 <xs:simpleContent>
62                         <xs:extension base="xs:string">
63                                 <xs:attribute name="gameMode" type="TgameMode" use="required"/>
64                         </xs:extension>
65                 </xs:simpleContent>
66         </xs:complexType>
68         <xs:simpleType name="TgameMode">
69                 <xs:restriction base="xs:string">
70                         <xs:enumeration value="player"/>
71                         <xs:enumeration value="spectator"/>
72                 </xs:restriction>
73         </xs:simpleType>
75         <xs:complexType name="Tsettings">
76                 <xs:sequence>
77                         <xs:element name="difficultyOne">
78                                 <xs:simpleType>
79                                         <xs:restriction base="xs:unsignedByte">
80                                                 <xs:pattern value="[579]"/>
81                                         </xs:restriction>
82                                 </xs:simpleType>
83                         </xs:element>
84                         <xs:element name="difficultyTwo">
85                                 <xs:simpleType>
86                                         <xs:restriction base="xs:unsignedByte">
87                                                 <xs:pattern value="[123]"/>
88                                         </xs:restriction>
89                                 </xs:simpleType>
90                         </xs:element>
91                         <xs:element name="numberOfPlayers">
92                                 <xs:simpleType>
93                                         <xs:restriction base="xs:unsignedByte">
94                                                 <xs:pattern value="[23]"/>
95                                         </xs:restriction>
96                                 </xs:simpleType>
97                         </xs:element>
98                         <xs:element name="timerDuration" type="xs:nonNegativeInteger" minOccurs="0"/>
99                 </xs:sequence>
100                 <xs:attribute name="playing" type="xs:boolean" default="false"/>
101         </xs:complexType>
103 </xs:schema>