From 3131c081550e7eefdfddddb5939145a892863a44 Mon Sep 17 00:00:00 2001 From: Alexey Shchepin Date: Sun, 13 Jul 2003 09:00:01 +0000 Subject: [PATCH] * doc/guide.tex: Updated (thanks to Sergei Golovan) * src/expat_erl.c: Added #ifdef for WIN32 (thanks to Sergei Golovan) * src/mod_irc/iconv_erl.c: Likewise * src/configure.erl: Defines ERLANG_DIR variable (thanks to Sergei Golovan) * **/Makefile: Use ERLANG_DIR (thanks to Sergei Golovan) * **/Makefile.win32: Makefiles for windows build (thanks to Sergei Golovan) * src/configure.bat: Configuration script for windows (thanks to Sergei Golovan) SVN Revision: 123 --- ChangeLog | 17 +++ TODO | 2 - doc/guide.html | 275 +++++++++++++++++++++------------- doc/guide.tex | 110 +++++++++++--- src/Makefile | 2 +- src/Makefile.win32 | 38 +++++ src/configure.bat | 4 + src/configure.erl | 3 +- src/expat_erl.c | 4 +- src/mod_irc/Makefile | 2 +- src/mod_irc/Makefile.win32 | 52 +++++++ src/mod_irc/iconv_erl.c | 3 + src/mod_muc/Makefile | 2 +- src/mod_muc/Makefile.win32 | 20 +++ src/mod_pubsub/Makefile | 2 +- src/mod_pubsub/Makefile.win32 | 16 ++ 16 files changed, 423 insertions(+), 129 deletions(-) create mode 100644 src/Makefile.win32 create mode 100644 src/configure.bat create mode 100644 src/mod_irc/Makefile.win32 create mode 100644 src/mod_muc/Makefile.win32 create mode 100644 src/mod_pubsub/Makefile.win32 diff --git a/ChangeLog b/ChangeLog index 841f55463..cd0a81faa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2003-07-12 Alexey Shchepin + + * doc/guide.tex: Updated (thanks to Sergei Golovan) + + * src/expat_erl.c: Added #ifdef for WIN32 (thanks to Sergei + Golovan) + * src/mod_irc/iconv_erl.c: Likewise + + * src/configure.erl: Defines ERLANG_DIR variable (thanks to Sergei + Golovan) + * **/Makefile: Use ERLANG_DIR (thanks to Sergei Golovan) + + * **/Makefile.win32: Makefiles for windows build (thanks to Sergei + Golovan) + * src/configure.bat: Configuration script for windows (thanks to + Sergei Golovan) + 2003-07-09 Alexey Shchepin * src/mod_pubsub/mod_pubsub.erl: Added suport for meta-node diff --git a/TODO b/TODO index a946a663f..9f555aa88 100644 --- a/TODO +++ b/TODO @@ -18,7 +18,5 @@ add traffic shapers to c2s connection before authentification add traffic shapers to s2s connections more traffic shapers SNMP -PubSub -MUC: remove empty non-persistent conferences after timeout MUC: remove a lot of debugging output iq:last diff --git a/doc/guide.html b/doc/guide.html index 061a91e43..ab393ed7c 100644 --- a/doc/guide.html +++ b/doc/guide.html @@ -3,7 +3,7 @@ Ejabberd Installation and Operation Guide - + @@ -21,7 +21,7 @@ mailto:alexey@sevcom.net
xmpp:aleksey@jabber.ru -

February 11, 2003

+

July 12, 2003

@@ -39,59 +39,68 @@
  • 2  Installation -
  • 3  Configuration +
  • 2.2  Obtaining +
  • 2.3  Compilation -
  • 3.2  Online Configuration and Monitoring +
  • 2.4  Starting + +
  • 3  Configuration - -
  • 4  Distribution +3.1  Initial Configuration +
  • 3.2  Online Configuration and Monitoring -
  • A  Built-in Modules +
  • 4  Distribution -
  • B  I18n/L10n +
  • A  Built-in Modules + +
  • B  I18n/L10n @@ -104,21 +113,29 @@ server. It is writen mostly in Erlang.

    The main features of ejabberd is:
    • -Distributed: You may run ejabberd on a cluster of machines and all of +Works on most of popular platforms: *nix (tested on Linux and FreeBSD) + and Win32 +
    • Distributed: You may run ejabberd on a cluster of machines and all of them will serve one Jabber domain.
    • Fault-tolerance: You may setup an ejabberd cluster so that all the information required for a properly working service will be stored - permanently on more then one node. This means that if one of the nodes + permanently on more than one node. This means that if one of the nodes crashes, then the others will continue working without disruption. You can also add or replace more nodes ``on the fly''. +
    • Built-in Multi-User + Chat service +
    • Built-in IRC transport +
    • Built-in + Publish-Subscribe + service +
    • Built-in Jabber Users Directory service based on users vCards
    • Support for JEP-0030 (Service Discovery).
    • Support for JEP-0039 (Statistics Gathering). -
    • Support for xml:lang attribute in many XML elements. -
    • JUD based on users vCards. +
    • Support for xml:lang attribute in many XML elements
    @@ -130,6 +147,11 @@ Distributed: You may run ejabberd on a cluster of machines and all of

    2.1  Installation Requirements

    + + +

    2.1.1  Unix

    + + To compile ejabberd, you will need the following packages:
    • GNU Make; @@ -137,37 +159,89 @@ GNU Make;
    • libexpat 1.95 or later;
    • Erlang/OTP R8B or later.
    + + +

    2.1.2  Windows

    + + +To compile ejabberd in MS Windows environment, you will need the following +packages: + -

    2.2  Obtaining

    +

    2.2  Obtaining

    Currently no stable version has been released.

    The latest alpha version can be retrieved from CVS.
    • -export CVSROOT=:pserver:cvs@www.jabber.ru:/var/spool/cvs +export CVSROOT=:pserver:anonymous@jabberstudio.org:/home/cvs
    • cvs login
    • Press Enter when asked for a password
    • cvs -z3 co ejabberd
    -

    2.3  Compilation

    +

    2.3  Compilation

    + + +

    2.3.1  Unix

    + +
     ./configure
     make
     
    TBD

    + + +

    2.3.2  Windows

    + + +
    1. +Install Erlang emulator (for example, into C:\Program Files\erl5.1.2). +
    2. Install Expat library into C:\Program Files\Expat-1.95.6 + directory. Copy file C:\Program Files\Expat-1.95.6\Libs\libexpat.dll to your Windows system directory (for + example, C:\WINNT or C:\WINNT\System32) +
    3. Install Iconv library into C:\Program Files\GnuWin32 directory. + Copy file C:\Program Files\GnuWin32\bin\libiconv-2.dll to your + Windows system directory.
      +
      +Note: Instead of copying libexpat.dll and libiconv-2.dll to Windows + directory, you can add directories + C:\Program Files\Expat-1.95.6\Libs and + C:\Program Files\GnuWin32\bin to PATH environment + variable. +
    4. Being in ejabberd\src directory run: +
      +configure
      +nmake -f Makefile.win32
      +
    5. To build MUC, IRC and pub/sub modules run +
      +nmake -f Makefile.win32
      +
      in ejabberd\src\mod_muc, ejabberd\src\mod_muc and + ejabberd\src\mod_pubsub directories +
    6. Edit file ejabberd\src\ejabberd.cfg and run +
      +werl -s ejabberd -name ejabberd
      +
    7. Enjoy! +
    -

    2.4  Starting

    +

    2.4  Starting

    -... To use more then 1024 connections, you will need to set environment +... To use more than 1024 connections, you will need to set environment variable ERL_MAX_PORTS:
     export ERL_MAX_PORTS=32000
    @@ -180,12 +254,12 @@ TBD

    -

    3  Configuration

    +

    3  Configuration

    -

    3.1  Initial Configuration

    +

    3.1  Initial Configuration

    The configuration file is initially loaded the first time ejabberd is @@ -208,7 +282,7 @@ adding new ones.

    -

    3.1.1  Host Name

    +

    3.1.1  Host Name

    Option hostname defines name of Jabber domain that ejabberd @@ -218,7 +292,7 @@ serves. E. g. to use jabber.org domain add following line in confi
    -

    3.1.2  Access Rules

    +

    3.1.2  Access Rules

    Access control in ejabberd is performed via Access Control Lists (ACL). The @@ -304,7 +378,7 @@ Following access rules pre-defined: -

    3.1.3  Shapers Configuration

    +

    3.1.3  Shapers Configuration

    With shapers is possible to bound connection traffic. The declarations of @@ -323,7 +397,7 @@ E. g. to define shaper with name ``normal'' and maximum allowed ra -

    3.1.4  Listened Sockets

    +

    3.1.4  Listened Sockets

    Option listen defines list of listened sockets and what services @@ -331,7 +405,8 @@ runned on them. Each element of list is a tuple with following elements:
    • Port number;
    • Module that serves this port; -
    • Function in this module that starts connection (likely will be removed); +
    • Function in this module that starts connection (likely will be removed in + future versions of ejabberd);
    • Options to this module.
    Currently three modules are implemented: @@ -347,7 +422,7 @@ Following options defined: value is ``none''.
    ejabberd_s2s_in
    This module serves incoming S2S connections. -
    ejabberd_service
    This module serves connections to Jabber +
    ejabberd_service
    This module serves connections from Jabber services (i. e. that use the jabber:component:accept namespace). For example, the following configuration defines that C2S connections are @@ -371,7 +446,7 @@ limit 1000 b/s. -

    3.1.5  Modules

    +

    3.1.5  Modules

    Option modules defines the list of modules that will be loaded after @@ -397,7 +472,7 @@ Example: -

    3.2  Online Configuration and Monitoring

    +

    3.2  Online Configuration and Monitoring

    To perform online reconfiguration of ejabberd you will need to have @@ -428,7 +503,7 @@ Identity of server.

  • -

    3.2.1  Node config: Global Configuration

    +

    3.2.1  Node config: Global Configuration

    Under this node the following nodes exists:

    @@ -482,11 +557,11 @@ removed user is online, then he will be disconnected. Also user-related data
    -

    3.2.2  Node online users: List of Online Users

    +

    3.2.2  Node online users: List of Online Users

    -

    3.2.3  Node all users: List of Registered User

    +

    3.2.3  Node all users: List of Registered User


    @@ -500,11 +575,11 @@ removed user is online, then he will be disconnected. Also user-related data

    -

    3.2.4  Node outgoing s2s: List of Outgoing S2S connections

    +

    3.2.4  Node outgoing s2s: List of Outgoing S2S connections

    -

    3.2.5  Node running nodes: List of Running ejabberd Nodes

    +

    3.2.5  Node running nodes: List of Running ejabberd Nodes


    @@ -518,18 +593,18 @@ removed user is online, then he will be disconnected. Also user-related data

    -

    3.2.6  Node stopped nodes: List of Stopped Nodes

    +

    3.2.6  Node stopped nodes: List of Stopped Nodes

    TBD

    -

    4  Distribution

    +

    4  Distribution

    -

    4.1  How it works

    +

    4.1  How it works

    A Jabber domain is served by one or more ejabberd nodes. These nodes can @@ -540,7 +615,7 @@ the same magic cookie (see Erlang/OTP documentation, in other words the file needed because all nodes exchange information about connected users, S2S connections, registered services, etc...

    -Each ejabberd node must run following modules: +Each ejabberd node have following modules:
    • router;
    • local router. @@ -549,27 +624,27 @@ router;
    -

    4.1.1  Router

    +

    4.1.1  Router

    This module is the main router of Jabber packets on each node. It routes them based on their destinations domains. It has two tables: local and global routes. First, domain of packet destination searched in local table, and if it found, then the packet is routed to appropriate process. If no, then it searches in global table, and is routed to the appropriate ejabberd node or -process. If itdoes not exists in either table, then it sent to the S2S +process. If it does not exists in either tables, then it sent to the S2S manager.

    -

    4.1.2  Local Router

    +

    4.1.2  Local Router

    This module routes packets which have a destination domain equal to this server -name. If destination JID has a node, then it routed to the session manager, -else it is processed depending on it's content.
    +name. If destination JID has a non-empty user part, then it routed to the +session manager, else it is processed depending on it's content.

    -

    4.1.3  Session Manager

    +

    4.1.3  Session Manager

    This module routes packets to local users. It searches for what user resource packet must be sended via presence table. If this resource is connected to @@ -578,7 +653,7 @@ the packet is sent to session manager on that node.

    -

    4.1.4  S2S Manager

    +

    4.1.4  S2S Manager

    This module routes packets to other Jabber servers. First, it checks if an open S2S connection from the domain of the packet source to the domain of @@ -589,19 +664,19 @@ does not exist, then it is opened and registered.

    -

    A  Built-in Modules

    +

    A  Built-in Modules

    -

    A.1  Common Options

    +

    A.1  Common Options

    Following options used by many modules, so they described in separate section.

    -

    A.1.1  Option iqdisc

    +

    A.1.1  Option iqdisc

    Many modules define handlers for processing IQ queries of different namespaces to this server or to user (e. g. to myjabber.org or to @@ -616,10 +691,10 @@ these queries. Possible values are: IQ queries of namespace with this discipline, and processing of this queue done in parallel with processing of other packets. This discipline is most recommended. -
    parallel
    In this case for all packets of namespace with this - discipline spawned separate Erlang process, so all this packets processed in - parallel. Although spawning of Erlang process have relative low cost, this - can broke server normal work, because Erlang have limit of 32000 processes. +
    parallel
    In this case for all packets with this discipline + spawned separate Erlang process, so all these packets processed in parallel. + Although spawning of Erlang process have relative low cost, this can broke + server normal work, because Erlang have limit of 32000 processes. Example:
    @@ -631,7 +706,7 @@ Example:
     
    -

    A.1.2  Option host

    +

    A.1.2  Option host

    Some modules may act as services, and wants to have different domain name. This option explicitly defines this name.
    @@ -646,27 +721,27 @@ Example: -

    A.2  mod_register

    +

    A.2  mod_register

    -

    A.3  mod_roster

    +

    A.3  mod_roster

    -

    A.4  mod_configure

    +

    A.4  mod_configure

    -

    A.5  mod_disco

    +

    A.5  mod_disco

    -

    A.6  mod_stats

    +

    A.6  mod_stats

    This module adds support of @@ -681,22 +756,22 @@ TBD about access.

    -

    A.7  mod_vcard

    +

    A.7  mod_vcard

    -

    A.8  mod_offline

    +

    A.8  mod_offline

    -

    A.9  mod_echo

    +

    A.9  mod_echo

    -

    A.10  mod_private

    +

    A.10  mod_private

    This module adds support of @@ -709,7 +784,7 @@ Options: -

    A.11  mod_time

    +

    A.11  mod_time

    This module answers UTC time on jabber:iq:time queries.
    @@ -720,7 +795,7 @@ Options: -

    A.12  mod_version

    +

    A.12  mod_version

    This module answers ejabberd version on jabber:iq:version queries.
    @@ -731,7 +806,7 @@ Options: -

    B  I18n/L10n

    +

    B  I18n/L10n

    Many modules supports xml:lang attribute inside IQ queries. E. g. @@ -739,8 +814,8 @@ on figure 6 (compare with figure  EIDirS = "EI_DIR = " ++ code:lib_dir("erl_interface") ++ "\n", - file:write_file("Makefile.inc", list_to_binary(EIDirS)), + RootDirS = "ERLANG_DIR = " ++ code:root_dir() ++ "\n", + file:write_file("Makefile.inc", list_to_binary(EIDirS ++ RootDirS)), halt(). diff --git a/src/expat_erl.c b/src/expat_erl.c index 18eb0471c..a1a950e39 100644 --- a/src/expat_erl.c +++ b/src/expat_erl.c @@ -10,7 +10,6 @@ typedef struct { XML_Parser parser; } expat_data; - void *erlXML_StartElementHandler(expat_data *d, const XML_Char *name, const XML_Char **atts) @@ -147,6 +146,9 @@ ErlDrvEntry expat_driver_entry = { NULL /* F_PTR outputv, reserved */ }; +#ifdef WIN32 +__declspec(dllexport) +#endif DRIVER_INIT(expat_erl) /* must match name in driver_entry */ { return &expat_driver_entry; diff --git a/src/mod_irc/Makefile b/src/mod_irc/Makefile index e5bf89189..60e511896 100644 --- a/src/mod_irc/Makefile +++ b/src/mod_irc/Makefile @@ -2,7 +2,7 @@ include ../Makefile.inc -INCLUDES = -I/usr/lib/erlang/usr/include \ +INCLUDES = -I$(ERLANG_DIR)/usr/include \ -I$(EI_DIR)/include \ -I/usr/local/include diff --git a/src/mod_irc/Makefile.win32 b/src/mod_irc/Makefile.win32 new file mode 100644 index 000000000..515f5432a --- /dev/null +++ b/src/mod_irc/Makefile.win32 @@ -0,0 +1,52 @@ + +include ..\Makefile.inc + +GNUWIN_DIR="c:\progra~1\gnuwin32" + +OUTDIR = .. +EFLAGS = -I .. -pz .. + +OBJS = \ + $(OUTDIR)\iconv.beam \ + $(OUTDIR)\mod_irc.beam \ + $(OUTDIR)\mod_irc_connection.beam + +ALL : $(OUTDIR)\iconv_erl.dll $(OBJS) + +CLEAN : + -@erase $(OUTDIR)\iconv_erl.dll + -@erase $(OUTDIR)\iconv_erl.exp + -@erase $(OUTDIR)\iconv_erl.lib + -@erase iconv_erl.obj + -@erase iconv_erl.pch + -@erase vc60.idb + -@erase *.beam + +$(OUTDIR)\iconv.beam : iconv.erl + erlc -W $(EFLAGS) -o $(OUTDIR) iconv.erl + +$(OUTDIR)\mod_irc.beam : mod_irc.erl + erlc -W $(EFLAGS) -o $(OUTDIR) mod_irc.erl + +$(OUTDIR)\mod_irc_connection.beam : mod_irc_connection.erl + erlc -W $(EFLAGS) -o $(OUTDIR) mod_irc_connection.erl + +CPP=cl.exe +CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "$(ERLANG_DIR)\usr\include" /I "$(EI_DIR)\include" /I "$(GNUWIN_DIR)\include" /D "WIN32" /D "NDEBUG" /D "_USRDLL" /D "_MBCS" /Fpiconv_erl.pch /YX /FD /c + +.c.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib "$(ERLANG_DIR)\usr\lib\erl_dll.lib" "$(EI_DIR)\lib\ei.lib" "$(EI_DIR)\lib\erl_interface.lib" "$(GNUWIN_DIR)\lib\libiconv.lib" /nologo /subsystem:console /dll /pdb:none /machine:I386 /out:$(OUTDIR)\iconv_erl.dll +LINK32_OBJS=iconv_erl.obj + +$(OUTDIR)\iconv_erl.dll : $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +iconv_erl.obj : iconv_erl.c + diff --git a/src/mod_irc/iconv_erl.c b/src/mod_irc/iconv_erl.c index fa382f12e..de9914184 100644 --- a/src/mod_irc/iconv_erl.c +++ b/src/mod_irc/iconv_erl.c @@ -104,6 +104,9 @@ ErlDrvEntry iconv_driver_entry = { NULL /* F_PTR outputv, reserved */ }; +#ifdef WIN32 +__declspec(dllexport) +#endif DRIVER_INIT(iconv_erl) /* must match name in driver_entry */ { return &iconv_driver_entry; diff --git a/src/mod_muc/Makefile b/src/mod_muc/Makefile index b5fb3bf3d..924f5353a 100644 --- a/src/mod_muc/Makefile +++ b/src/mod_muc/Makefile @@ -2,7 +2,7 @@ include ../Makefile.inc -INCLUDES = -I/usr/lib/erlang/usr/include \ +INCLUDES = -I$(ERLANG_DIR)/usr/include \ -I$(EI_DIR)/include \ -I/usr/local/include diff --git a/src/mod_muc/Makefile.win32 b/src/mod_muc/Makefile.win32 new file mode 100644 index 000000000..790032e88 --- /dev/null +++ b/src/mod_muc/Makefile.win32 @@ -0,0 +1,20 @@ + +include ..\Makefile.inc + +OUTDIR = .. +EFLAGS = -I .. -pz .. + +OBJS = \ + $(OUTDIR)\mod_muc.beam \ + $(OUTDIR)\mod_muc_room.beam + +ALL : $(OBJS) + +CLEAN : + -@erase *.beam + +$(OUTDIR)\mod_muc.beam : mod_muc.erl + erlc -W $(EFLAGS) -o $(OUTDIR) mod_muc.erl + +$(OUTDIR)\mod_muc_room.beam : mod_muc_room.erl + erlc -W $(EFLAGS) -o $(OUTDIR) mod_muc_room.erl diff --git a/src/mod_pubsub/Makefile b/src/mod_pubsub/Makefile index 03b835fce..03b4c0814 100644 --- a/src/mod_pubsub/Makefile +++ b/src/mod_pubsub/Makefile @@ -2,7 +2,7 @@ include ../Makefile.inc -INCLUDES = -I/usr/lib/erlang/usr/include \ +INCLUDES = -I$(ERLANG_DIR)/usr/include \ -I$(EI_DIR)/include \ -I/usr/local/include diff --git a/src/mod_pubsub/Makefile.win32 b/src/mod_pubsub/Makefile.win32 new file mode 100644 index 000000000..f2421f5a5 --- /dev/null +++ b/src/mod_pubsub/Makefile.win32 @@ -0,0 +1,16 @@ + +include ..\Makefile.inc + +OUTDIR = .. +EFLAGS = -I .. -pz .. + +OBJS = \ + $(OUTDIR)\mod_pubsub.beam + +ALL : $(OBJS) + +CLEAN : + -@erase *.beam + +$(OUTDIR)\mod_pubsub.beam : mod_pubsub.erl + erlc -W $(EFLAGS) -o $(OUTDIR) mod_pubsub.erl