Navigation


Changeset 706:4ffbc9f1e922 in freeDiameter for extensions/dbg_interactive


Ignore:
Timestamp:
Feb 9, 2011, 3:26:58 PM (13 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Large UNTESTED commit with the following changes:

  • Improved DiameterIdentity? handling (esp. interationalization issues), and improve efficiency of some string operations in peers, sessions, and dictionary modules (closes #7)
  • Cleanup in the session module to free only unreferenced sessions (#16)
  • Removed fd_cpu_flush_cache(), replaced by more robust alternatives.
  • Improved peer state machine algorithm to counter SCTP multistream race condition.
Location:
extensions/dbg_interactive
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • extensions/dbg_interactive/dbg_interactive.i

    r662 r706  
    152152
    153153/* Overwrite declaration to apply typemaps */
    154 int fd_sess_fromsid ( char * STRING, size_t LENGTH, struct session ** OUTPUT, int * BOOL_OUT);
     154int fd_sess_fromsid ( unsigned char * STRING, size_t LENGTH, struct session ** OUTPUT, int * BOOL_OUT);
    155155
    156156
  • extensions/dbg_interactive/messages.i

    r688 r706  
    341341       
    342342        /* Get the source */
    343         char *source() {
    344                 char * s = NULL;
    345                 int ret = fd_msg_source_get($self, &s);
    346                 if (ret != 0) {
    347                         DI_ERROR(ret, NULL, NULL);
    348                         return NULL;
    349                 }
    350                 return s;
     343        %cstring_output_allocate_size(char ** outid, size_t * outlen, /* do not free */);
     344        void source(char ** outid, size_t * outlen) {
     345                int ret = fd_msg_source_get($self, outid, outlen);
     346                if (ret != 0) {
     347                        DI_ERROR(ret, NULL, NULL);
     348                        return;
     349                }
     350                return;
    351351        }
    352352       
  • extensions/dbg_interactive/peers.i

    r640 r706  
    9797
    9898%inline %{
    99 static struct peer_hdr * peer_search(char *diamid) {
     99static struct peer_hdr * peer_search(char *STRING, size_t LENGTH) {
    100100        struct peer_hdr *r = NULL;
    101         int ret = fd_peer_getbyid( diamid, &r );
     101        int ret = fd_peer_getbyid( STRING, LENGTH, 0, &r );
    102102        if (ret) {
    103103                DI_ERROR(ret, NULL, NULL);
  • extensions/dbg_interactive/routing.i

    r640 r706  
    5555                fd_rtd_free(&r);
    5656        }
    57         void add(char * peerid, char * realm) {
    58                 int ret = fd_rtd_candidate_add($self, peerid, realm);
     57        %apply (char *STRING, int LENGTH) { (char * peerid, size_t peeridlen) };
     58        %apply (char *STRING, int LENGTH) { (char * realm, size_t realmlen) };
     59        void add(char * peerid, size_t peeridlen, char * realm, size_t realmlen) {
     60                int ret = fd_rtd_candidate_add($self, peerid, peeridlen, realm, realmlen);
    5961                if (ret != 0) {
    6062                        DI_ERROR(ret, NULL, NULL);
     
    6264        }
    6365        void remove(char * STRING, size_t LENGTH) {
    64                 fd_rtd_candidate_del($self, STRING, LENGTH);
    65         }
    66         void error(char * dest, char * STRING, size_t LENGTH, uint32_t rcode) {
    67                 int ret =  fd_rtd_error_add($self, dest, (uint8_t *)STRING, LENGTH, rcode);
     66                fd_rtd_candidate_del($self, (os0_t)STRING, LENGTH);
     67        }
     68        void error(char * peerid, size_t peeridlen, char * STRING, size_t LENGTH, uint32_t rcode) {
     69                int ret =  fd_rtd_error_add($self, peerid, peeridlen, (os0_t)STRING, LENGTH, rcode);
    6870                if (ret != 0) {
    6971                        DI_ERROR(ret, NULL, NULL);
  • extensions/dbg_interactive/sessions.i

    r639 r706  
    4040%{
    4141/* call it (might be called from a different thread than the interpreter, when session times out) */
    42 static void call_the_python_cleanup_callback(session_state * state, char * sid, void * cb) {
     42static void call_the_python_cleanup_callback(session_state * state, os0_t sid, void * cb) {
    4343        PyObject *result;
    4444        if (!cb) {
     
    100100                int ret;
    101101                struct session * s = NULL;
    102                 ret = fd_sess_new(&s, fd_g_config->cnf_diamid, "dbg_interactive", sizeof("dbg_interactive"));
     102                ret = fd_sess_new(&s, fd_g_config->cnf_diamid, fd_g_config->cnf_diamid_len, (os0_t)"dbg_interactive", CONSTSTRLEN("dbg_interactive"));
    103103                if (ret != 0) {
    104104                        DI_ERROR(ret, NULL, NULL);
     
    110110                int ret;
    111111                struct session * s = NULL;
    112                 ret = fd_sess_new(&s, diamid, STRING, LENGTH);
     112                ret = fd_sess_new(&s, diamid, 0, (os0_t)STRING, LENGTH);
    113113                if (ret != 0) {
    114114                        DI_ERROR(ret, NULL, NULL);
     
    120120                int ret, n;
    121121                struct session * s = NULL;
    122                 ret = fd_sess_fromsid(STRING, LENGTH, &s, &n);
     122                ret = fd_sess_fromsid((os0_t)STRING, LENGTH, &s, &n);
    123123                if (ret != 0) {
    124124                        DI_ERROR(ret, NULL, NULL);
     
    144144                return;
    145145        }
    146         char * getsid() {
     146       
     147        %cstring_output_allocate_size(char ** outsid, size_t * sidlen, /* do not free */);
     148        void getsid(char ** outsid, size_t * sidlen) {
    147149                int ret;
    148                 char * sid = NULL;
    149                 ret = fd_sess_getsid( $self, &sid);
     150                ret = fd_sess_getsid( $self, (void *)outsid, sidlen);
    150151                if (ret != 0) {
    151152                        DI_ERROR(ret, NULL, NULL);
    152                         return NULL;
     153                        return;
    153154                }
    154                 return sid;
     155                return;
    155156        }
    156157        void settimeout(long seconds) {
Note: See TracChangeset for help on using the changeset viewer.