Messaging: Difference between revisions

From SambaWiki
m (typo)
m (little decoration)
Line 7: Line 7:
This implementaion uses [[Tdb]] file for storing messages and UNIX signals for notifying message receiver.
This implementaion uses [[Tdb]] file for storing messages and UNIX signals for notifying message receiver.


All messages are stored in _messages.tdb_ file (one can find it in _var/locks_ directory). Each message is just a database record that has six fields:
All messages are stored in ''messages.tdb'' file (one can find it in ''var/locks'' directory). Each message is just a database record that has six fields:
* messaging version (there is only one version now - 1)
* messaging version (there is only one version now - 1)
* message type
* message type
Line 15: Line 15:
* message data
* message data


There are lot of message types in [[Samba3]], you can see them all in _include/messages.h_ file.
There are lot of message types in [[Samba3]], you can see them all in ''include/messages.h'' file.


Process sends a message to other process with special function [[message_send_pid]] and to all processes with [[message_send_all]].
Process sends a message to other process with special function [[message_send_pid]] and to all processes with [[message_send_all]].

Revision as of 13:34, 4 May 2006

Samba Messaging

Multiple smbd processes usually run simultaneously - a main daemon process and couple of connections processes. Samba code has special API that allows different processes send messages each other. There are two implementations of Messaging code - different in current Samba3 and Samba4 code.

Samba 3 implementation

This implementaion uses Tdb file for storing messages and UNIX signals for notifying message receiver.

All messages are stored in messages.tdb file (one can find it in var/locks directory). Each message is just a database record that has six fields:

  • messaging version (there is only one version now - 1)
  • message type
  • sender process id
  • receiver process id
  • message data length
  • message data

There are lot of message types in Samba3, you can see them all in include/messages.h file.

Process sends a message to other process with special function message_send_pid and to all processes with message_send_all. Each process should call message_dispatch routinely to check if messages were received and run appropriate handler.

Samba 4 implementation

This implementation uses UNIX domain sockets.