[RTPproxy Devel] About data structure naming(pls reply to my email box directly)

Zhang William wireless.mobile.3 at gmail.com
Sat Jul 12 21:52:20 PDT 2008


Hello Maxim,

I am thinking whether we can apply some changes to the source code. I feel
some parts of the codes is not so easy to understand.

As a sample, I list one structure here:

struct rtpp_session {
  /* ttl for caller [0] and callee [1] */
  int ttl[2];
  rtpp_ttl_mode ttl_mode;
  unsigned long pcount[4];
  char *call_id;
  char *tag;
  rtpp_log_t log;
  struct rtpp_session* rtcp;
  struct rtpp_session* rtp;
  /* Remote source addresses, one for caller and one for callee */
  struct sockaddr *addr[2];
  /* Flag which tells if we are allowed to update address with RTP src IP */
  int canupdate[2];
  /* Local listen addresses/ports */
  struct sockaddr *laddr[2];
  int ports[2];
  /* Descriptors */
  int fds[2];
  /* Session is complete, that is we received both request and reply */
  int complete;
  int asymmetric[2];
  /* Flags: strong create/delete; weak ones */
  int strong;
  int weak[2];
  /* Pointers to rtpp_record's opaque data type */
  void *rrcs[2];
  struct rtp_server *rtps[2];
  /* References to fd-to-session table */
  int sidx[2];
  /* Reference to active RTP generators table */
  int sridx;
  /* Flag that indicates whether or not address supplied by client can't be
trusted */
  int untrusted_addr[2];
  struct rtp_resizer resizers[2];
  struct rtpp_session *prev;
  struct rtpp_session *next;
  struct rtpp_timeout_handler *timeout_handler;
};

we don't know what pcount[0], pcount[1], pcount[2], pcount[3] stands for
before reading

the documentation or looking into the codes using this structure. Even we
know there

meaning now, as time flies, we may forget later.

For easy read purpose, the strcuture member name should speak for
themselves.

for example, a standalone structre can be defined with each member having a
sound name.

Also, there are many xxx[2] members, can we define such form structure, to
me it will be

much clear:

structure rtpp_server {

     int ttl;

     struct sockaddr *addr;

     int canupdate;

     struct sockaddr *laddr;

     int ports;
     int fds;

    int asymmetric;

    int weak;

    void *rrcs;

     struct rtp_server *rtps;

     ....

}

struct rtpp_session {

     rtpp_server inbound_server;

     rtpp_server outbound_server;

}

Thanks,

William
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rtpproxy.org/pipermail/devel/attachments/20080713/79a467c0/attachment.html 


More information about the Devel mailing list