Navigation


Changeset 1103:d8591b1c56cd in freeDiameter for libfdproto/messages.c


Ignore:
Timestamp:
May 10, 2013, 7:48:57 PM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Implemented a few hooks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdproto/messages.c

    r1101 r1103  
    202202        init_chain( &msg->msg_chain, MSG_MSG);
    203203        msg->msg_eyec = MSG_MSG_EYEC;
     204       
     205        fd_list_init(&msg->msg_pmdl.sentinel, NULL);
     206        CHECK_POSIX_DO( pthread_mutex_init(&msg->msg_pmdl.lock, NULL), );
    204207}
    205208
     
    19521955        CHECK_PARAMS(  buffer &&  *buffer  &&  msg  &&  (buflen >= GETMSGHDRSZ())  );
    19531956        buf = *buffer;
    1954         *buffer = NULL;
    19551957       
    19561958        if ( buf[0] != DIAMETER_VERSION) {
    19571959                TRACE_DEBUG(INFO, "Invalid version in message: %d (supported: %d)", buf[0], DIAMETER_VERSION);
    1958                 free(buf);
    19591960                return EBADMSG;
    19601961        }
     
    19631964        if ( buflen < msglen ) { 
    19641965                TRACE_DEBUG(INFO, "Truncated message (%zd / %d)", buflen, msglen );
    1965                 free(buf);
    19661966                return EBADMSG;
    19671967        }
    19681968       
    19691969        /* Create a new object */
    1970         CHECK_MALLOC_DO( new = malloc (sizeof(struct msg)),  { free(buf); return ENOMEM; } );
     1970        CHECK_MALLOC( new = malloc (sizeof(struct msg)) );
    19711971       
    19721972        /* Initialize the fields */
     
    19841984        new->msg_public.msg_eteid = ntohl(*(uint32_t *)(buf+16));
    19851985       
    1986         new->msg_rawbuffer = buf;
    1987        
    19881986        /* Parse the AVP list */
    19891987        CHECK_FCT_DO( ret = parsebuf_list(buf + GETMSGHDRSZ(), buflen - GETMSGHDRSZ(), &new->msg_chain.children), { destroy_tree(_C(new)); return ret; }  );
    19901988       
     1989        /* Parsing successful */
     1990        new->msg_rawbuffer = buf;
     1991        *buffer = NULL;
    19911992        *msg = new;
    19921993        return 0;
Note: See TracChangeset for help on using the changeset viewer.