nss_ocsp.h revision 5821806d5e7f356e8fa4b058a389a808ea183019
15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef NET_OCSP_NSS_OCSP_H_
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define NET_OCSP_NSS_OCSP_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "net/base/net_export.h"
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace net {
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class URLRequestContext;
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Sets the MessageLoop for NSS's HTTP client functions (i.e. OCSP, CA
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// certificate and CRL fetches) to the current message loop.  This should be
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// called before EnsureNSSHttpIOInit() if you want to control the message loop.
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)NET_EXPORT void SetMessageLoopForNSSHttpIO();
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Initializes HTTP client functions for NSS.  This must be called before any
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// certificate verification functions.  This function is thread-safe, and HTTP
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// handlers will only ever be initialized once.  ShutdownNSSHttpIO() must be
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// called on shutdown.
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)NET_EXPORT void EnsureNSSHttpIOInit();
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This should be called once on shutdown to stop issuing URLRequests for NSS
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// related HTTP fetches.
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)NET_EXPORT void ShutdownNSSHttpIO();
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Can be called after a call to |ShutdownNSSHttpIO()| to reset internal state
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// and associate it with the current thread.
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)NET_EXPORT void ResetNSSHttpIOForTesting();
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Sets the URLRequestContext for HTTP requests issued by NSS.
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)NET_EXPORT void SetURLRequestContextForNSSHttpIO(
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    URLRequestContext* request_context);
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace net
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // NET_OCSP_NSS_OCSP_H_
40