-
Notifications
You must be signed in to change notification settings - Fork 0
/
opensim_grid_glue.h
130 lines (113 loc) · 5.04 KB
/
opensim_grid_glue.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/* Copyright (c) 2009-2010 Aidan Thornton, all rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY AIDAN THORNTON ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AIDAN THORNTON BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef OPENSIM_GRID_GLUE_H
#define OPENSIM_GRID_GLUE_H
#include <map>
#include <string>
#include "cajeput_grid_glue.h"
#include "caj_logging.h"
#define CAJ_LOGGER (grid->log)
struct user_name {
char *first, *last;
};
struct grid_glue_ctx {
int old_xmlrpc_grid_proto, new_userserver, use_xinventory;
simgroup_ctx *sgrp;
caj_logger *log;
gchar *user_server, *grid_server, *asset_server;
gchar *inventory_server, *avatar_server, *presence_server, *grid_user_server;
gchar *grid_recvkey, *grid_sendkey;
uuid_t region_secret;
// std::map<obj_uuid_t,user_name> uuid_name_cache; // TODO
};
struct user_grid_glue {
int refcnt;
user_ctx *ctx;
char *enter_callback_uri; // callback for teleports
std::map<uint64_t,std::string> child_seeds;
};
struct os_teleport_desc {
simulator_ctx *our_sim; // for internal use
char *sim_ip;
int sim_port, http_port;
teleport_desc* tp;
char *caps_path;
};
void user_grid_glue_ref(user_grid_glue *user_glue);
void user_grid_glue_deref(user_grid_glue *user_glue);
#define GRID_PRIV_DEF(sim) struct grid_glue_ctx* grid = (struct grid_glue_ctx*) sim_get_grid_priv(sim);
#define GRID_PRIV_DEF_SGRP(sgrp) struct grid_glue_ctx* grid = (struct grid_glue_ctx*) caj_get_grid_priv(sgrp);
#define USER_PRIV_DEF(priv) struct user_grid_glue* user_glue = (struct user_grid_glue*) (priv);
#define USER_PRIV_DEF2(user) struct user_grid_glue* user_glue = (struct user_grid_glue*) user_get_grid_priv(user);
void fetch_inventory_folder(simgroup_ctx *sgrp, user_ctx *user,
void *user_priv, const uuid_t folder_id,
void(*cb)(struct inventory_contents* inv,
void* priv),
void *cb_priv);
void fetch_inventory_item(simgroup_ctx *sgrp, user_ctx *user,
void *user_priv, const uuid_t item_id,
void(*cb)(struct inventory_item* item,
void* priv),
void *cb_priv);
void fetch_system_folders(simgroup_ctx *sgrp, user_ctx *user,
void *user_priv);
void add_inventory_item(simgroup_ctx *sgrp, user_ctx *user,
void *user_priv, inventory_item *inv,
void(*cb)(void* priv, int success, uuid_t item_id),
void *cb_priv);
void fetch_inventory_folder_x(simgroup_ctx *sgrp, user_ctx *user,
void *user_priv, const uuid_t folder_id,
void(*cb)(struct inventory_contents* inv,
void* priv),
void *cb_priv);
void fetch_inventory_item_x(simgroup_ctx *sgrp, user_ctx *user,
void *user_priv, const uuid_t item_id,
void(*cb)(struct inventory_item* item,
void* priv),
void *cb_priv);
void fetch_system_folders_x(simgroup_ctx *sgrp, user_ctx *user,
void *user_priv);
void add_inventory_item_x(simgroup_ctx *sgrp, user_ctx *user,
void *user_priv, inventory_item *inv,
void(*cb)(void* priv, int success, uuid_t item_id),
void *cb_priv);
void update_inventory_item_x(simgroup_ctx *sgrp, user_ctx *user,
void *user_priv, inventory_item *inv,
void(*cb)(void* priv, int success),
void *cb_priv);
void osglue_agent_rest_handler(SoupServer *server,
SoupMessage *msg,
const char *path,
GHashTable *query,
SoupClientContext *client,
gpointer user_data);
typedef void(*validate_session_cb)(void* state, int is_ok);
void osglue_validate_session(struct simgroup_ctx* sgrp, const char* agent_id,
const char *session_id, grid_glue_ctx* grid,
validate_session_cb callback, void *priv);
void osglue_teleport_send_agent(simulator_ctx* sim, teleport_desc *tp,
os_teleport_desc *tp_priv);
void osglue_teleport_failed(os_teleport_desc *tp_priv, const char* reason);
void osglue_get_asset(struct simgroup_ctx *sgrp, struct simple_asset *asset);
void osglue_put_asset(struct simgroup_ctx *sgrp, struct simple_asset *asset,
caj_put_asset_cb cb, void *cb_priv);
#endif