A communication device (101, 201) comprising: a determination unit configured to determine a role when performing a predetermined communication procedure for providing or receiving a communication parameter, wherein determination of the role of the communication device (101, 201) is based upon information included in a message exchanged with another communication device; a base station unit configured to operate as a base station; a slave station unit configured to operate as a slave station; a providing unit configured to operate as a providing device that provides the communication parameter; a receiving unit configured to operate as a receiving device that receives the communication parameter from another providing unit of the other communication device; a first selection unit configured to select operating as a base station using the base station unit, or operating as a slave station using the slave station unit based on the role determined by the determination unit; and a second selection unit configured to select providing the communication parameter using the providing unit if the communication device (101, 201) is to operate as a base station, or receiving the communication parameter using the receiving unit if the communication device (101, 201) is to operate as a slave station; characterized in that: the information provided by the communication device indicates a first priority, wherein the information provided by the other communication device indicates a second priority, and wherein the determination unit is configured to determine the role of the communication device corresponding to operating as a base station in a case where the first priority is higher than the second priority, and to determine the role of the communication device corresponding to operating as a slave station in a case where the first priority is lower than the second priority. a determination unit configured to determine a role when performing a predetermined communication procedure for providing or receiving a communication parameter, wherein determination of the role of the communication device (101, 201) is based upon information included in a message exchanged with another communication device; a base station unit configured to operate as a base station; a slave station unit configured to operate as a slave station; a providing unit configured to operate as a providing device that provides the communication parameter; a receiving unit configured to operate as a receiving device that receives the communication parameter from another providing unit of the other communication device; a first selection unit configured to select operating as a base station using the base station unit, or operating as a slave station using the slave station unit based on the role determined by the determination unit; and a second selection unit configured to select providing the communication parameter using the providing unit if the communication device (101, 201) is to operate as a base station, or receiving the communication parameter using the receiving unit if the communication device (101, 201) is to operate as a slave station; the information provided by the communication device indicates a first priority, wherein the information provided by the other communication device indicates a second priority, and wherein the determination unit is configured to determine the role of the communication device corresponding to operating as a base station in a case where the first priority is higher than the second priority, and to determine the role of the communication device corresponding to operating as a slave station in a case where the first priority is lower than the second priority.