Changeset 2fac2b1d070cdb9dd9f6ba5fa4977c148cf12600
- Timestamp:
- 01/12/06 21:26:05
(2 years ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1165004765 +0000
- git-parent:
[17853c532cf3f3aebd4eb454b7d5f50dde889f03]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1165004765 +0000
- Message:
Hide httpd_t and httpd_host_t within httpd.c
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r17853c5 |
r2fac2b1 |
|
| 33 | 33 | extern const size_t libvlc_hotkeys_size; |
|---|
| 34 | 34 | |
|---|
| | 35 | extern vlc_object_t * |
|---|
| | 36 | vlc_custom_create (vlc_object_t *p_this, size_t i_size, int i_type, |
|---|
| | 37 | const char *psz_type); |
|---|
| | 38 | |
|---|
| 35 | 39 | #endif |
|---|
| ra5ed35c |
r2fac2b1 |
|
| 37 | 37 | #endif |
|---|
| 38 | 38 | |
|---|
| | 39 | #include "../libvlc.h" |
|---|
| 39 | 40 | #include <vlc_vout.h> |
|---|
| 40 | 41 | #include <vlc_aout.h> |
|---|
| … | … | |
| 54 | 55 | |
|---|
| 55 | 56 | #include "vlc_httpd.h" |
|---|
| 56 | | #include "../network/httpd.h" |
|---|
| 57 | 57 | #include "vlc_vlm.h" |
|---|
| 58 | 58 | #include "vlc_vod.h" |
|---|
| … | … | |
| 88 | 88 | static vlc_mutex_t structure_lock; |
|---|
| 89 | 89 | |
|---|
| 90 | | static vlc_object_t *vlc_custom_create( vlc_object_t *p_this, size_t i_size, |
|---|
| | 90 | vlc_object_t *vlc_custom_create( vlc_object_t *p_this, size_t i_size, |
|---|
| 91 | 91 | int i_type, const char *psz_type ) |
|---|
| 92 | 92 | { |
|---|
| … | … | |
| 286 | 286 | psz_type = "stream output"; |
|---|
| 287 | 287 | break; |
|---|
| 288 | | case VLC_OBJECT_HTTPD: |
|---|
| 289 | | i_size = sizeof( httpd_t ); |
|---|
| 290 | | psz_type = "http server"; |
|---|
| 291 | | break; |
|---|
| 292 | | case VLC_OBJECT_HTTPD_HOST: |
|---|
| 293 | | i_size = sizeof( httpd_host_t ); |
|---|
| 294 | | psz_type = "http server"; |
|---|
| 295 | | break; |
|---|
| 296 | 288 | case VLC_OBJECT_VLM: |
|---|
| 297 | 289 | i_size = sizeof( vlm_t ); |
|---|
| r5d10806 |
r2fac2b1 |
|
| 36 | 36 | #include <vlc_tls.h> |
|---|
| 37 | 37 | #include <vlc_acl.h> |
|---|
| 38 | | #include "httpd.h" |
|---|
| | 38 | #include "../libvlc.h" |
|---|
| 39 | 39 | |
|---|
| 40 | 40 | #include <string.h> |
|---|
| … | … | |
| 65 | 65 | |
|---|
| 66 | 66 | static void httpd_ClientClean( httpd_client_t *cl ); |
|---|
| | 67 | |
|---|
| | 68 | struct httpd_t |
|---|
| | 69 | { |
|---|
| | 70 | VLC_COMMON_MEMBERS |
|---|
| | 71 | |
|---|
| | 72 | int i_host; |
|---|
| | 73 | httpd_host_t **host; |
|---|
| | 74 | }; |
|---|
| | 75 | |
|---|
| | 76 | |
|---|
| | 77 | /* each host run in his own thread */ |
|---|
| | 78 | struct httpd_host_t |
|---|
| | 79 | { |
|---|
| | 80 | VLC_COMMON_MEMBERS |
|---|
| | 81 | |
|---|
| | 82 | httpd_t *httpd; |
|---|
| | 83 | |
|---|
| | 84 | /* ref count */ |
|---|
| | 85 | int i_ref; |
|---|
| | 86 | |
|---|
| | 87 | /* address/port and socket for listening at connections */ |
|---|
| | 88 | char *psz_hostname; |
|---|
| | 89 | int i_port; |
|---|
| | 90 | int *fd; |
|---|
| | 91 | |
|---|
| | 92 | /* Statistics */ |
|---|
| | 93 | counter_t *p_active_counter; |
|---|
| | 94 | counter_t *p_total_counter; |
|---|
| | 95 | |
|---|
| | 96 | vlc_mutex_t lock; |
|---|
| | 97 | |
|---|
| | 98 | /* all registered url (becarefull that 2 httpd_url_t could point at the same url) |
|---|
| | 99 | * This will slow down the url research but make my live easier |
|---|
| | 100 | * All url will have their cb trigger, but only the first one can answer |
|---|
| | 101 | * */ |
|---|
| | 102 | int i_url; |
|---|
| | 103 | httpd_url_t **url; |
|---|
| | 104 | |
|---|
| | 105 | int i_client; |
|---|
| | 106 | httpd_client_t **client; |
|---|
| | 107 | |
|---|
| | 108 | /* TLS data */ |
|---|
| | 109 | tls_server_t *p_tls; |
|---|
| | 110 | }; |
|---|
| | 111 | |
|---|
| 67 | 112 | |
|---|
| 68 | 113 | struct httpd_url_t |
|---|
| … | … | |
| 982 | 1027 | } |
|---|
| 983 | 1028 | |
|---|
| | 1029 | static const char psz_object_type[] = "http server"; |
|---|
| | 1030 | |
|---|
| 984 | 1031 | httpd_host_t *httpd_TLSHostNew( vlc_object_t *p_this, const char *psz_hostname, |
|---|
| 985 | 1032 | int i_port, |
|---|
| … | … | |
| 1012 | 1059 | { |
|---|
| 1013 | 1060 | msg_Info( p_this, "creating httpd" ); |
|---|
| 1014 | | if( ( httpd = vlc_object_create( p_this, VLC_OBJECT_HTTPD ) ) == NULL ) |
|---|
| | 1061 | httpd = (httpd_t *)vlc_custom_create( p_this, sizeof (*httpd), |
|---|
| | 1062 | VLC_OBJECT_HTTPD, |
|---|
| | 1063 | psz_object_type ); |
|---|
| | 1064 | if (httpd == NULL) |
|---|
| 1015 | 1065 | { |
|---|
| 1016 | 1066 | vlc_mutex_unlock( lockval.p_address ); |
|---|
| … | … | |
| 1072 | 1122 | |
|---|
| 1073 | 1123 | /* create the new host */ |
|---|
| 1074 | | host = vlc_object_create( p_this, VLC_OBJECT_HTTPD_HOST ); |
|---|
| | 1124 | host = (httpd_host_t *)vlc_custom_create( p_this, sizeof (*host), |
|---|
| | 1125 | VLC_OBJECT_HTTPD_HOST, |
|---|
| | 1126 | psz_object_type ); |
|---|
| | 1127 | if (host == NULL) |
|---|
| | 1128 | goto error; |
|---|
| | 1129 | |
|---|
| 1075 | 1130 | host->httpd = httpd; |
|---|
| 1076 | 1131 | vlc_mutex_init( httpd, &host->lock ); |
|---|