Showing posts with label kamailio. Show all posts
Showing posts with label kamailio. Show all posts

Saturday, 21 April 2012

How to set EMACS C STYLE to hack KAMAILIO code

Kamailio (former OpenSER) is a SIP proxy server, call router, and user agent registration server used in Voice over Internet Protocol and instant messaging applications. Kamailio is free software (GPL licensed).

In this post we are going to learn how to configure emacs to follow kamailio coding style guidelines.


KAMAILIO CODING STYLE GUIDELINES


From Kamailio documentation: http://sip-router.org/wiki/coding_style

As a resume:
  • Use tabs for indentation instead of spaces.
  • Set tab stops to 4 spaces.
  • Wrap lines that are longer than 78 characters (80 characters - two characters for window decorations).
  • Avoid C++ style comments (//)
  • Do not declare variables inside blocks.
  • Use the following style for function declarations
  • int func(int x)
    {
        /* body */
    }
    


EMACS C KAMAILIO CODING STYLE


We are going to create an emacs C coding style in order to comply with most of those rules.