parser_f.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * $Id$
  3. *
  4. * Copyright (C) 2001-2003 Fhg Fokus
  5. *
  6. * This file is part of ser, a free SIP server.
  7. *
  8. * ser is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version
  12. *
  13. * For a license to use the ser software under conditions
  14. * other than those described here, or to purchase support for this
  15. * software, please contact iptel.org by e-mail at the following addresses:
  16. * [email protected]
  17. *
  18. * ser is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU General Public License
  24. * along with this program; if not, write to the Free Software
  25. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  26. */
  27. #ifndef parser_f_h
  28. #define parser_f_h
  29. char* eat_line(char* buffer, unsigned int len);
  30. /* turn the most frequently called functions into inline functions */
  31. inline static char* eat_space_end(char* p, char* pend)
  32. {
  33. for(;(p<pend)&&(*p==' ' || *p=='\t') ;p++);
  34. return p;
  35. }
  36. inline static char* eat_token_end(char* p, char* pend)
  37. {
  38. for (;(p<pend)&&(*p!=' ')&&(*p!='\t')&&(*p!='\n')&&(*p!='\r'); p++);
  39. return p;
  40. }
  41. inline static char* eat_token2_end(char* p, char* pend, char delim)
  42. {
  43. for (;(p<pend)&&(*p!=(delim))&&(*p!='\n')&&(*p!='\r'); p++);
  44. return p;
  45. }
  46. inline static int is_empty_end(char* p, char* pend )
  47. {
  48. p=eat_space_end(p, pend );
  49. return ((p<(pend )) && (*p=='\r' || *p=='\n'));
  50. }
  51. #endif /* parser_f_h */