func: static int handle_message(struct skinny_req *req, struct skinnysession *s) if ( ( ! s -> device ) && ( letohl ( req -> e ) != REGISTER_MESSAGE && letohl ( req -> e ) != ALARM_MESSAGE ) )  switch ( letohl ( req -> e ) )  if ( skinny_register ( req , s ) )  static int skinny_register(struct skinny_req *req, struct skinnysession *s) struct skinny_device * d ; struct sockaddr_in sin ; if ( letohl ( req -> data . reg . protocolVersion ) >= 17 )  return 0 ; s -> device = d; d -> type = letohl ( req -> data . reg . type ); d -> registered = 1; d -> session = s; sin . sin_addr = __ourip; d -> ourip = sin . sin_addr; if ( ! d )  return 0 ; return 1 ; transmit_registerack ( s -> device ); static void transmit_registerack(struct skinny_device *d) struct skinny_req * req ; if ( ! ( req = req_alloc ( sizeof ( struct register_ack_message ) , REGISTER_ACK_MESSAGE ) ) )  static struct skinny_req *req_alloc(size_t size, int response_message) struct skinny_req * req ; if ( ! ( req = ast_calloc ( 1 , skinny_header_size + size + 4 ) ) )  return NULL ; req -> len = htolel ( size + 4 ); req -> e = htolel ( response_message ); return req ; req -> data . regack . res [ 0 ] = '0'; req -> data . regack . res [ 1 ] = '\0'; req -> data . regack . keepAlive = htolel ( keep_alive ); memcpy ( req -> data . regack . dateTemplate , date_format , sizeof ( req -> data . regack . dateTemplate ) ); req -> data . regack . res2 [ 0 ] = '0'; req -> data . regack . res2 [ 1 ] = '\0'; req -> data . regack . secondaryKeepAlive = htolel ( keep_alive ); transmit_response ( d , req ); static void transmit_response(struct skinny_device *d, struct skinny_req *req) transmit_response_bysession ( d -> session , req ); static int transmit_response_bysession(struct skinnysession *s, struct skinny_req *req) if ( ! s )  if ( ( letohl ( req -> len ) > SKINNY_MAX_PACKET ) || ( letohl ( req -> len ) < 0 ) )  memset ( s -> outbuf , 0 , sizeof ( s -> outbuf ) ); memcpy ( s -> outbuf , req , skinny_header_size ); memcpy ( s -> outbuf + skinny_header_size , & req -> data , letohl ( req -> len ) ); res = write ( s -> fd , s -> outbuf , letohl ( req -> len ) + 8 ); if ( res != letohl ( req -> len ) + 8 )  ast_log ( LOG_WARNING , "Transmit: write only sent %d out of %d bytes: %s\n" , res , letohl ( req -> len ) + 8 , strerror ( errno ) ); if ( res == - 1 )  