Ben Murdoch | bb1529c | 2013-08-08 10:24:53 +0100 | [diff] [blame^] | 1 | // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef LIBRARIES_NACL_IO_HOST_RESOLVER_H_ |
| 6 | #define LIBRARIES_NACL_IO_HOST_RESOLVER_H_ |
| 7 | |
| 8 | #include "nacl_io/ossocket.h" |
| 9 | #include "nacl_io/pepper_interface.h" |
| 10 | |
| 11 | #ifdef PROVIDES_SOCKET_API |
| 12 | |
| 13 | namespace nacl_io { |
| 14 | |
| 15 | class HostResolver { |
| 16 | public: |
| 17 | HostResolver(); |
| 18 | ~HostResolver(); |
| 19 | |
| 20 | void Init(PepperInterface* ppapi); |
| 21 | |
| 22 | struct hostent* gethostbyname(const char* name); |
| 23 | static void herror(const char* s); |
| 24 | static const char* hstrerror(int err); |
| 25 | |
| 26 | private: |
| 27 | void hostent_initialize(); |
| 28 | void hostent_cleanup(); |
| 29 | |
| 30 | struct hostent hostent_; |
| 31 | PepperInterface *ppapi_; |
| 32 | }; |
| 33 | |
| 34 | } // namespace nacl_io |
| 35 | |
| 36 | #endif // PROVIDES_SOCKET_API |
| 37 | #endif // LIBRARIES_NACL_IO_HOST_RESOLVER_H_ |