1<?xml version='1.0' encoding='utf-8' ?>
2<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
3  <!ENTITY % BOOK_ENTITIES SYSTEM "Wayland.ent">
4  <!ENTITY doxygen SYSTEM "ServerAPI.xml">
5%BOOK_ENTITIES;
6]>
7<appendix id="sect-Library-Server">
8  <title>Server API</title>
9  <section><title>Introduction</title>
10  <para>
11    The open-source reference implementation of Wayland protocol is
12    split in two C libraries, <link
13    linkend="sect-Library-Client">libwayland-client</link> and
14    libwayland-server. Their main responsibility is to handle the
15    Inter-process communication (<emphasis>IPC</emphasis>) with each
16    other, therefore guaranteeing the protocol objects marshaling and
17    messages synchronization.
18  </para>
19  <para>
20    The server library is designed to work much like libwayland-client,
21    although it is considerably complicated due to the server needing
22    to support multiple versions of the protocol. It is best to learn
23    libwayland-client first.
24  </para>
25  <para>
26    Each open socket to a client is represented by a <link
27    linkend="Server-structwl__client">wl_client</link>.  The equvalent
28    of the <link linkend="Client-classwl__proxy">wl_proxy</link> that
29    libwayland-client uses to represent an object is <link
30    linkend="Server-structwl__resource">wl_resource</link> for
31    client-created objects, and <link
32    linkend="Server-structwl__global">wl_global</link> for objects
33    created by the server.
34  </para>
35  <para>
36    Often a server is also a client for another Wayland server, and
37    thus must link with both libwayland-client and libwayland-server.
38    This produces some type name conflicts (such as the <link
39    linkend="Client-classwl__display">client wl_display</link> and
40    <link linkend="Server-structwl__display">server wl_display</link>,
41    but the duplicate-but-not-the-same types are opaque, and accessed
42    only inside the correct library where it came from. Naturally that
43    means that the program writer needs to always know if a pointer to
44    a wl_display is for the server or client side and use the
45    corresponding functions.
46  </para>
47  </section>
48  &doxygen;
49</appendix>
50