0

Torを少し変更した後、コンパイルに問題があります。

と呼ばれるファイルに、 (にある)control.cと呼ばれる構造体を参照するコードを追加しました。以前は含まれていなかったので、の先頭に含めました。rend_service_trendservice.hrendservice.hcontrol.c

含まれているMakefileを使用しようとすると、次のエラーが発生します。

control.c:2841: error: 'rend_service_t' undeclared (first use in this function)

それが含まれていないか、最初にコンパイルされていないのではないかと推測してrendservice.cいるので、ディレクトリを確認しましたが、rendserviceのオブジェクトファイルがありません。明らかに含まれているので、私はこれに少し混乱しています。これが発生する原因は何ですか?

前に来るMakefile.am/.inように編集してみましたが、違いはありません。rendservice.c/hcontrol.c/h

control.c

...
#include "rendservice.h"
...
static int
handle_control_addservice(control_connection_t *conn, uint32_t len,
                             const char *body)
{
  smartlist_t *args;
  rend_service_t *service;
...

rendservice.c

...
/** Represents a single hidden service running at this OP. */
typedef struct rend_service_t {
  /* Fields specified in config file */
  char *directory; /**< where in the filesystem it stores it */
  smartlist_t *ports; /**< List of rend_service_port_config_t */
  rend_auth_type_t auth_type; /**< Client authorization type or 0 if no client
                               * authorization is performed. */
  smartlist_t *clients; /**< List of rend_authorized_client_t's of
                         * clients that may access our service. Can be NULL
                         * if no client authorization is performed. */
  /* Other fields */
  crypto_pk_env_t *private_key; /**< Permanent hidden-service key. */
  char service_id[REND_SERVICE_ID_LEN_BASE32+1]; /**< Onion address without
                                                  * '.onion' */
  char pk_digest[DIGEST_LEN]; /**< Hash of permanent hidden-service key. */
  smartlist_t *intro_nodes; /**< List of rend_intro_point_t's we have,
                             * or are trying to establish. */
  time_t intro_period_started; /**< Start of the current period to build
                                * introduction points. */
  int n_intro_circuits_launched; /**< Count of intro circuits we have
                                  * established in this period. */
  rend_service_descriptor_t *desc; /**< Current hidden service descriptor. */
  time_t desc_is_dirty; /**< Time at which changes to the hidden service
                         * descriptor content occurred, or 0 if it's
                         * up-to-date. */
  time_t next_upload_time; /**< Scheduled next hidden service descriptor
                            * upload time. */
  /** Map from digests of Diffie-Hellman values INTRODUCE2 to time_t of when
   * they were received; used to prevent replays. */
  digestmap_t *accepted_intros;
  /** Time at which we last removed expired values from accepted_intros. */
  time_t last_cleaned_accepted_intros;
} rend_service_t;
...
4

2 に答える 2

1

rend_service_tはプライベートな構造であり、rendservice.cその.cファイルの外部での使用を目的としていないようであり、で宣言されていませんrendservice.h。(私が見ているバージョンを参照してrendservice.cください:https ://doxygen.torproject.org/rendservice_8c_source.html )。

したがって、これはヘッダーの包含の問題ではありません。構造はヘッダーでまったく削除されません。

何のために使用するつもりだったかについて質問する必要がありますstruct rend_service_t

于 2012-07-18T02:21:08.277 に答える
0

ファイルcontrol.cがコンパイルされており、コンパイルエラーが発生しています。rendservice.cがコンパイルされる前か後かは関係ありません。コンパイラが調べるのは、control.cとそれが取り込むヘッダーだけです。

おそらく、rend_service_tの定義はifdefセクション内にあるため、コンパイラーはそれをスキップしています。おそらく、REND_SERVICEまたは同様のものを#defineする必要があります... rendservice.hを調べて、read_service_t定義がifdefブロック内にあるかどうかを確認してください。

于 2012-07-18T02:19:39.997 に答える