module srvsvc

typedef uint32 LONG;
typedef uint32 *ENUM_HND;

typedef struct _UNISTR2 {
       uint32 max_len;
       uint32 undoc;
       uint32 str_len;
       wchar  buffer[str_len];
} UNISTR2;

typedef UNISTR2 *LPWSTR;

/* function 8 */
struct CONN_INFO_0 {
	uint32 id; /* connection id. */
};

struct CONN_INFO_1 {
	uint32 id; 
	uint32 type;
	uint32 num_opens;
	uint32 num_users;
	uint32 open_time;
	LPWSTR usr_name;
	LPWSTR net_name; 
};

struct CONN_ENUM_CTR {
	uint32 level;
	uint32 level2;
	uint32 num_entries;
	uint32 num_entries2;
	union *info[level] {
		case 0 CONN_INFO_0 info0[num_entries]; 
		case 1 CONN_INFO_1 info1[num_entries]; 
	}
};

struct SRV_R_NET_CONN_ENUM {
        .trailer;
	CONN_ENUM_CTR ctr;
        uint32 num_entries;
        ENUM_HND handle;
        uint32 status2;
};

struct SRV_Q_NET_CONN_ENUM {
       .trailer;
       LPWSTR dest_srv;
       LPWSTR qual_srv;
       uint32 level;
       uint32 level2;
       CONN_ENUM_CTR *ctr;
       uint32 max_len;
       ENUM_HND handle;
};

/* function 9 */
struct FILE_INFO_3 {
	uint32 id;            /* file index */
	uint32 perms;         /* file permissions. don't know what format */
	uint32 num_locks;     /* file locks */
	LPWSTR path_name; /* file name */
	LPWSTR user_name; /* file owner */
};

struct SRV_FILE_INFO_CTR {
	uint32 level;
	uint32 num_entries;
	uint32 dummy;
	union *file[level] {
	      case 3 FILE_INFO_3 info3[num_entries];
	}
};

struct SRV_Q_NET_FILE_ENUM {
       .trailer;
       LPWSTR srv_name;
       LPWSTR qual_name;
       uint32 dummy;
       uint32 level;
       SRV_FILE_INFO_CTR ctr;
       uint32 *status;
       uint32 preferred_len;
       ENUM_HND enum_hnd;
};


struct SRV_R_NET_FILE_ENUM {
       .trailer;
       uint32 level;
       uint32 dummy;
       SRV_FILE_INFO_CTR *ctr;
       uint32 total_entries;                    /* total number of files */
       ENUM_HND enum_hnd;
       uint32 status;        /* return status */
};


/* function 15 */
struct SRV_SHARE_INFO_1 {
	LPWSTR uni_netname;
	uint32 type;
	LPWSTR uni_remark;
};

struct SRV_SHARE_INFO_2 {
	LPWSTR uni_netname;
	uint32 type;
	LPWSTR uni_remark;
	uint32 perms;
	uint32 max_uses;
	uint32 num_uses;
	LPWSTR path;
	LPWSTR passwd;
};

struct SRV_R_NET_SHARE_ENUM {
       uint32 level;
       uint32 level2;
       uint32 *ret_count;
       uint32 num_entries;
       union *info[level] {
              case 1 SRV_SHARE_INFO_1 info1[num_entries];
              case 2 SRV_SHARE_INFO_2 info2[num_entries];
       }
       .trailer;
       uint32 count;
       ENUM_HND handle;
       uint32 status;
};



/* function 21 */
struct SERVER_INFO_100 {
	uint32  dwPlatformID;
	LPWSTR pszName;
};

struct SERVER_INFO_101 {
	    uint32  dwPlatformID;
	    LPWSTR pszName;
	    uint32  dwVerMajor;
	    uint32  dwVerMinor;
	    uint32  dwType;
	    LPWSTR pszComment;
};

struct SERVER_INFO_102 {
    uint32 dwPlatformID;
    LPWSTR pszName;
    uint32 dwVerMajor;
    uint32 dwVerMinor;
    uint32 dwType;
    LPWSTR pszComment;
    uint32 dwUsers;
    uint32 lDisc;
    uint32 bHidden;
    uint32 dwAnnounce;
    uint32 dwAnnDelta;
    uint32 dwLicenses;
    LPWSTR pszUserPath;
};

struct SRV_R_NET_SERVER_INFO {
       .trailer;
       uint32 level;
       union *info[level] {
		case 100 SERVER_INFO_100 sv100;
		case 101 SERVER_INFO_101 sv101;
		case 102 SERVER_INFO_102 sv102;
       }
       uint32 status;
};

struct SRV_Q_NET_SERVER_INFO {
       .trailer;
       LPWSTR server;
       uint32 level;
};

