network_protocol.txt 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. * Network protocol of pdb server and sip-router module *
  2. The pdb server daemon listen only for UDP messages. The requests contains in
  3. the UDP payload the number starting with an international prefix, e.g. '49' for
  4. germany. It must contain only numbers like this: '49721913742734'.
  5. The answer packet contains then the number string from the respective request,
  6. null-terminated and followed by two bytes which represents the result. This
  7. two bytes are interpreted as 16 bit signed integer value, the UDP payload is
  8. in network byte order (most significant byte first).
  9. Possible values for the search request:
  10. * 0: the number could not be found
  11. * 1-999 the number was found and the result represents its carrier ID
  12. * 1000: the number could be found, but it is owned from a carrier which is
  13. not interesting for us and belongs to the "other carrier" group
  14. From PDB_VERSION_1 onwards the pdb request and reply looks like this:
  15. +-------+----+----+------+--+-------+
  16. | header | body |
  17. +-------+----+----+------+--+-------+
  18. |version|type|code|length|id|payload|
  19. +-------+----+----+------+--+-------+
  20. Version
  21. Current version is 1 (0x01).
  22. Type
  23. PDB_TYPE_REQUEST_ID = 0, /* request pdb type */
  24. PDB_TYPE_REPLY_ID, /* reply pdb type */
  25. Code
  26. PDB_CODE_DEFAULT = 0, /* for request */
  27. PDB_CODE_OK, /* for response - OK */
  28. PDB_CODE_NOT_NUMBER, /* for response - letters found in the number */
  29. PDB_CODE_NOT_FOUND, /* for response - no pdb_id found for the number */
  30. Length
  31. The length of the whole message
  32. Id
  33. A pdb_msg id which might be used for asynchronous queries.
  34. Payload
  35. Request number including '\0' for request.
  36. Request number including '\0' and pdb_id for reply.
  37. Backwards compatibility with the old msg protocol is kept when the first byte
  38. received is different from the known versions ('0x01' for now)
  39. For more info about the data structures used, see common.h file.