$Id: TODO,v 1.88 2004/11/15 16:46:14 andrei Exp $

( - todo, x - done)
x change subst_run/str to return error (different from not found)
x change subst_user as on serdev
x tm : fake_env: fake also bind_address (else the default will be used
 in the failure route)
- [core] parse_uri support for new uri params
x [core] on sig_child, kill the processes if they don't exit in a 
  reasonable time
- [doc] document force_rport()
- [fifo] fix fgets error handling (it does not set errno always,
   , right now kills all ser if interrupted by a signal on ?solaris?)
- [mem] make shm_realloc be fragmentation friendly: call shm_compact_frags
   for the small frags?, don't produce smaller frags -- be wastefull?
- [mem] qm_compact_frags (compacts frags if possible), keep a 
        fragment count/bucket and if too much mem. is blocked in one bucket
        de-frag.
x [mem] investigate: don't produce frag if frag size < request
      (should reduce the unrequested fragments number)
x [mem] investigate: keep an used/unused flag per fragment, on free
      check if neighboring frags were not used and if so defragment
- [timer] multiple timers? at least ticks should no be affected by the amount
   of work done in the timer handlers
- [tcp] ser intiated tcp connections use INADDR_ANY (they should be bound first
  to some ip/port ?function of the dest?)
- [tcp] need to confirm fd receipt after send_fd, before closing it (this might
 happen in tcp_send new conn.) (see FreeBSD send BUGS for more info)
x [tcp] make send_all, send  non-blocking ready ?
x [tcp] tcp_send w/ timeout (to avoid waiting forever to send DOS)

- forward port fixes from testing
- [udp] use recvmsg to get the dst ip address in udp_rcv_loop
 (it won't work on solaris, but...)
x nathelper: extract_body broken-> uses content_length value form the 
 message instead of recalculating it + duplicate code for get_body()
- fix check_sel_op -- add proto for uri proto checks
- [tcp] add setting for infinite tcp conn life?

- fix 2 different fixups for diff. no of parameter
 (add no of params to struct action?) -- linked to var. no. of params
x alias support fot tcp/tls port numbers
- warning builder set_advertised address support
- grep parse_uri & replace with parse_sip_msg_uri (e.g do_action!)
x update AUTHORS, debian/copyright, ser.8, ser.cfg.5 from stable
x update Makefile*  from stable
x update all package specs from stable
- [tcp] add BUG checks for  fd > 0 && fd <= maxfd to all selects?
- [tcp] switch to poll if HAVE_POLL defined (it's unifix so  everybody 
   should have it, but it would be slower on systems emulating it, like
   older linuxes)
- [tcp] switch to epoll if HAVE_EPOLL defined (linux 2.6.*)
- [tcp] switch to SIGIO if no epoll (linux only, better than poll)
x tcp_main_loop: BUG cases should "conitnue;"
x change len_gt into and expr (e.g msg:len).
x sipit: uri == myself doesn't match tls port = 5061 
  -- updated: new socket_info list code should fix it
x sipit: fix check_self & *_alias to work with tcp & tls
  -- updated: new socket_info list code should fix it
x sipit: fix ipv6 references in check_self
x regex subst on uris?
x port receive.c pre_script_cb fix from stable
x extend alias to include port numbers :
    something like alias= foo1.bar:5080 foo2.bar foo3.bar:*
x extend listen and alias to include port numbers and protocol:
       tcp foo.bar:5063, udp foo.bar:5062, foo2.bar
x added set_advertised_{address,port} -- was: add force_via, force_srcip a.s.o
(the advertised addresses should be overwritable from the script).
x ? add force_outbound_socket(ip)? (choose an apropriate socket from the
 listen list for sending the msg; works on udp only)

release:
- unlink_timer_lists -- unsafe ???
x print_cseq_num max. size fix.
x backport: tcp conn id fix to stable + destroy_tcp 
x backport: acc mem. leak fixes
x backport: dns mem. leak fixes (resolve.[ch])
x backport: id_builder receive_msg mem. leak (msg_translator.c)
x backport: check_self ipv6/case fixes (forward.c)
x change tcp timeouts to 2 or 3 min?
x check via ipv6 fixes and backport to stable
x fix kill(0, SIGTERM) on startup error (will kill also the launching shell
 if non-interactive)
- fix modules destroy (some modules will try to free uninitialized resources
   if modules_init was not called first)
x fix CC_VER bug in newer Makefile (move DEFS after CC?)
x openbsd 3.2 packages -> doc in share/doc (and not in doc)
- openbsd 3.2 -> add jabber and mysql to the package
x fix modules makefiles (so that cd modules/foo; make will also link the proper
   libs)
x fix -march=..., or compile w/ i386 for the release
x resolver should resolve [ipv6]
x remove parse_uri debugging info
- fix DBG("<%.*s>", len, _null_)
x add -t, -w, -u -g equivalents to the config file
x force add rport : force_rport()
- kill all the fprintf
see also tcp & tm



not so critical:
x replace  remaining mallocs/frees at least in msg_translator.c
- add $(INCLUDES) to the Makefiles
x make ser suncc ready
- fix parse_cseq!!! (it doesnt parse 1234\n INVITE a.s.o)
x fix 0 parameter module f. call
x better Via parsing (handle ' ' in uri, eg: foo.bar : 1234 ; received=) and
 ipv6 addresses ([fec0:aa::01]).
- fix format string vulnerability in log()
- fix alignment access problems (warning on Sun)
x (different way) add request header bitmap field for the modules
- introduce variables & function in the script language (cfg. file)
- ? variable number of params functions in script (no longer limited to 2)?
- kill bind_idx
x fix bind_address for tcp (in some  way)
x add conflict in debs/rpms/etc (conflict w/ older ser-mysql, ser-jabber)
x new packages ser-radius etc
x tcp_destroy (called on ser exit)
- BUG:?? ipv6 only and try to send to ipv4 => getsendsocket=>0 (send_ipv6=0)
  the reverse is also true
- SUBST lumps for replies (involves setting the send_socket in forward_reply, 
  before build_res_from_res, & adding it to buid_res_from_res).


High priority:
x- parse_uri should not copy anymore the uri members (and it should not 0
 terminate them anylonger).
x fix/replace T_REF/T_UNREF
x review all the tm locking
x if () {} else {}
x plugin interface
x ipv6 support
x reply ("response line")
x drop ACKs for our replies
x add To-tag (for the replies)
x add User-Agent (for the replies)

Low priority:
- icmp error handling
x fix via address someday
- fix listen=0.0.0.0 case (see [udp] use recvmsg...)
x forward to received= if present
- make it easier to register a statically linkable module.
x add support for -u user and -g group (not only -u uid, -g uid)
x change uid/gid after opening the sockets
- exec improvments (add format strings to it)
x command line switch for checking the config file syntax
- config file version (a la sendmail)
0 loop detection
- cfg. file reload
- flags for using names or ip adresses in Via ?
- escape char injection/printing fix (verify all log/printed messages
 for terminal escapes and remove them)

x handle SIGCHLD, SIGHUP
- use a  standard lex compatible .lex format (instead of flex)
x try & use native compiler & ld if possible

x make install
x init.d scripts (and rc.local? for *BSD or Slackware)
x man page
- autoconf scripts
x Debian package build files
x the same for rpm
x the same for *BSD


x jku: branch hash computation over canonical values
0 jku: loop checking
- jku: try CRC as opposed to MD5


x freopen stdin, stdout, stderr to /dev/null
- add a section on building ser & configuring it for maximum performance
 (-DF_MALLOC, -DNO_DBG, ... sip_warning=0, a.s.o)
x add src_port, dst_port, proto to cfg.{y,lex}
x generic locking lib
x convert tm to use new locking lib

optimizations:
- better timer interface with hashes (a la openbsd)
- change lumps (flags for malloc type, recursive? see COND lumps )
- atomic ops?
- assembly for some very common used function
- getsock* cache
- fd cache for tcp_send
- dns cache? (see DNS)
- make option to use openssl MD5 (HMAC_Init(hmac_ctx, (void*)key, 16, md5_md))
 [ 0.9.7 version is really fast ]


tcp stuff:
x timeout on long sends
x tcp disable nagle 
x set TOS to minimize delay
x tcp locking/atomic ops review
- tcp fix simultaneous connects (ser process is blocked until connect timeouts
 => possible DOS)

tm optimizations:

- inline/macro/drop for: get_tm_table, set_kr, lock_hash, unlock_hash,
  set_t, get_t
- replace snprintfs int build_uac_request, *_dlg
- fix the huge param no. in this functions (use structs if neccessary):
  build_uac_request, build_uac_request_dlg, t_uac, t_uac_dlg
- uri2proxy - t_uac_dlg => extra malloc/free (no üroxy needed here)
  
dns stuff:
 - dns cache
 - support for NAPTR (naptr(domain, pref_proto)=> srv_rec + proto => srv(srv_rec, proto) => A or AAAA => A/AAAA(name))
 - support for fallback (inside the same A/AAAA record, other ip; if fails => other SRV ; if it fails too other NAPTR
[see rfc3263]
