BIO_parse_hostserv.pod 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. =pod
  2. =head1 NAME
  3. BIO_hostserv_priorities,
  4. BIO_parse_hostserv
  5. - utility routines to parse a standard host and service string
  6. =head1 SYNOPSIS
  7. #include <openssl/bio.h>
  8. enum BIO_hostserv_priorities {
  9. BIO_PARSE_PRIO_HOST, BIO_PARSE_PRIO_SERV
  10. };
  11. int BIO_parse_hostserv(const char *hostserv, char **host, char **service,
  12. enum BIO_hostserv_priorities hostserv_prio);
  13. =head1 DESCRIPTION
  14. BIO_parse_hostserv() will parse the information given in B<hostserv>,
  15. create strings with the host name and service name and give those
  16. back via B<host> and B<service>. Those will need to be freed after
  17. they are used. B<hostserv_prio> helps determine if B<hostserv> shall
  18. be interpreted primarily as a host name or a service name in ambiguous
  19. cases.
  20. The syntax the BIO_parse_hostserv() recognises is:
  21. host + ':' + service
  22. host + ':' + '*'
  23. host + ':'
  24. ':' + service
  25. '*' + ':' + service
  26. host
  27. service
  28. The host part can be a name or an IP address. If it's a IPv6
  29. address, it MUST be enclosed in brackets, such as '[::1]'.
  30. The service part can be a service name or its port number.
  31. The returned values will depend on the given B<hostserv> string
  32. and B<hostserv_prio>, as follows:
  33. host + ':' + service => *host = "host", *service = "service"
  34. host + ':' + '*' => *host = "host", *service = NULL
  35. host + ':' => *host = "host", *service = NULL
  36. ':' + service => *host = NULL, *service = "service"
  37. '*' + ':' + service => *host = NULL, *service = "service"
  38. in case no ':' is present in the string, the result depends on
  39. hostserv_prio, as follows:
  40. when hostserv_prio == BIO_PARSE_PRIO_HOST
  41. host => *host = "host", *service untouched
  42. when hostserv_prio == BIO_PARSE_PRIO_SERV
  43. service => *host untouched, *service = "service"
  44. =head1 SEE ALSO
  45. L<BIO_ADDRINFO(3)>
  46. =head1 COPYRIGHT
  47. Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
  48. Licensed under the OpenSSL license (the "License"). You may not use
  49. this file except in compliance with the License. You can obtain a copy
  50. in the file LICENSE in the source distribution or at
  51. L<https://www.openssl.org/source/license.html>.
  52. =cut