acceptor.h File Reference


Detailed Description

CDiameterPeer Acceptor initialization.

Author:
Dragos Vingarzan vingarzan -at- fokus dot fraunhofer dot de

Definition in file acceptor.h.

#include "worker.h"
#include "config.h"

Go to the source code of this file.

Functions

void acceptor_process (dp_config *cfg)
 Called from diameter_peer_start, after a process was forked for this.


Function Documentation

void acceptor_process ( dp_config cfg  ) 

Called from diameter_peer_start, after a process was forked for this.

Definition at line 86 of file acceptor.c.

References dp_config::acceptors, dp_config::acceptors_cnt, acceptor_config::bind, create_socket(), listening_socks, LOG_NO_MEM, and acceptor_config::port.

Referenced by diameter_peer_start().

00087 {
00088     int i,k;
00089     unsigned int sock;
00090     
00091     LOG(L_INFO,"INFO:Acceptor process starting up...\n");
00092     listening_socks = pkg_malloc((cfg->acceptors_cnt+1)*sizeof(int));
00093     if (!listening_socks){
00094         LOG_NO_MEM("pkg",(cfg->acceptors_cnt+1)*sizeof(int));
00095         goto done;
00096     }
00097     memset(listening_socks,0,(cfg->acceptors_cnt+1)*sizeof(int));   
00098     k=0;
00099     for(i=0;i<cfg->acceptors_cnt;i++)
00100         if (create_socket(cfg->acceptors[i].port,cfg->acceptors[i].bind,&sock)){
00101             listening_socks[k++]=sock;          
00102         }   
00103 
00104     
00105     LOG(L_INFO,"INFO:... Acceptor opened sockets. Entering accept loop ...\n");     
00106     accept_loop();
00107 
00108     for(i=0;listening_socks[i];i++)
00109         close(listening_socks[i]);
00110     
00111     if (listening_socks) pkg_free(listening_socks);
00112 #ifdef CDP_FOR_SER
00113 #else
00114 #ifdef PKG_MALLOC
00115     #ifdef PKG_MALLOC
00116         LOG(memlog, "Acceptor Memory status (pkg):\n");
00117         //pkg_status();
00118         #ifdef pkg_sums
00119             pkg_sums();
00120         #endif 
00121     #endif
00122 #endif
00123         dp_del_pid(getpid());       
00124 #endif      
00125 done:       
00126     LOG(L_INFO,"INFO:... Acceptor process finished\n");
00127     exit(0);
00128 }


Generated on Sat Sep 6 04:17:49 2008 for Open IMS Core CSCFs by  doxygen 1.5.2