text:
using Carrotware.CMS.Core;
using Carrotware.CMS.UI.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Security;

namespace Carrotware.CMS.UI.Admin.c3_admin {

	public partial class BlogPostAddEdit : AdminBasePage {
		public Guid guidContentID = Guid.Empty;
		public Guid guidRootContentID = Guid.Empty;
		public Guid guidVersionContentID = Guid.Empty;

		public Guid guidImportContentID = Guid.Empty;

		public bool bLocked = false;
		private string sPageMode = String.Empty;

		protected void Page_Load(object sender, EventArgs e) {
			Master.ActivateTab(AdminBaseMasterPage.SectionID.BlogContentAdd);

			RedirectIfNoSite();

			lblUpdated.Text = SiteData.CurrentSite.Now.ToString();
			lblCreateDate.Text = SiteData.CurrentSite.Now.ToString();

			guidContentID = GetGuidIDFromQuery();
			guidVersionContentID = GetGuidParameterFromQuery("versionid");
			guidImportContentID = GetGuidParameterFromQuery("importid");

			sPageMode = GetStringParameterFromQuery("mode");
			if (sPageMode.ToLowerInvariant() == "raw") {
				reBody.CssClass = "rawEditor";
				reLeftBody.CssClass = "rawEditor";
				reRightBody.CssClass = "rawEditor";
				divCenter.Visible = false;
				divRight.Visible = false;
				divLeft.Visible = false;
			}

			if (!IsPostBack) {
				DateTime dtSite = CMSConfigHelper.CalcNearestFiveMinTime(SiteData.CurrentSite.Now);

				ucReleaseDate.SetDate(dtSite);
				ucRetireDate.SetDate(dtSite.AddYears(200));

				hdnRootID.Value = Guid.Empty.ToString();

				GeneralUtilities.BindList(listCats, SiteData.CurrentSite.GetCategoryList().OrderBy(x => x.CategoryText));
				GeneralUtilities.BindList(listTags, SiteData.CurrentSite.GetTagList().OrderBy(x => x.TagText));

				ContentPage pageContents = null;
				if (guidVersionContentID != Guid.Empty) {
					pageContents = pageHelper.GetVersion(SiteID, guidVersionContentID);
				}
				if (guidContentID != Guid.Empty && pageContents == null) {
					pageContents = pageHelper.FindContentByID(SiteID, guidContentID);
				}

				if (guidImportContentID != Guid.Empty) {
					ContentPageExport cpe = ContentImportExportUtils.GetSerializedContentPageExport(guidImportContentID);

					if (cpe != null) {
						pageContents = cpe.ThePage;
						pageContents.EditDate = SiteData.CurrentSite.Now;
						pageContents.Parent_ContentID = null;
					}

					var rp = pageHelper.GetLatestContentByURL(SiteID, false, pageContents.FileName);
					if (rp != null) {
						pageContents.Root_ContentID = rp.Root_ContentID;
						pageContents.ContentID = rp.ContentID;
					} else {
						pageContents.Root_ContentID = Guid.Empty;
						pageContents.ContentID = Guid.Empty;
					}
					pageContents.Parent_ContentID = null;
					pageContents.NavOrder = SiteData.BlogSortOrderNumber;
				}

				//if (pageContents == null) {
				//    pageContents = new ContentPage(SiteData.CurrentSiteID, ContentPageType.PageType.BlogEntry);
				//}

				List<ContentPage> lstContent = pageHelper.GetAllLatestContentList(SiteID);

				GeneralUtilities.BindList(ddlTemplate, cmsHelper.Templates);

				chkDraft.Visible = false;
				divEditing.Visible = false;

				Dictionary<string, float> dictTemplates = pageHelper.GetPopularTemplateList(SiteID, ContentPageType.PageType.BlogEntry);
				if (dictTemplates.Any()) {
					try {
						GeneralUtilities.SelectListValue(ddlTemplate, dictTemplates.First().Key);
					} catch { }
				}

				if (pageContents == null) {
					btnDeleteButton.Visible = false;
				}

				if (pageContents != null) {
					bool bRet = pageHelper.RecordPageLock(pageContents.Root_ContentID, SiteData.CurrentSite.SiteID, SecurityData.CurrentUserGuid);

					if (pageContents.ContentType != ContentPageType.PageType.BlogEntry) {
						Response.Redirect(SiteFilename.PageAddEditURL + "?id=" + Request.QueryString.ToString());
					}

					cmsHelper.OverrideKey(pageContents.Root_ContentID);
					cmsHelper.cmsAdminContent = pageContents;
					cmsHelper.cmsAdminWidget = pageContents.GetWidgetList();

					BindTextDataGrid();

					guidRootContentID = pageContents.Root_ContentID;
					hdnRootID.Value = guidRootContentID.ToString();

					txtOldFile.Text = pageContents.FileName;

					if (guidImportContentID != Guid.Empty) {
						txtOldFile.Text = "";
					}

					Dictionary<string, string> dataVersions = (from v in pageHelper.GetVersionHistory(SiteID, pageContents.Root_ContentID)
															   join u in ExtendedUserData.GetUserList() on v.EditUserId equals u.UserId
															   orderby v.EditDate descending
															   select new KeyValuePair<string, string>(v.ContentID.ToString(), string.Format("{0} ({1}) {2}", v.EditDate, u.UserName, (v.IsLatestVersion ? " [**] " : " ")))
																).ToDictionary(kvp => kvp.Key, kvp => kvp.Value);

					GeneralUtilities.BindListDefaultText(ddlVersions, dataVersions, null, "Page Versions", "00000");

					bLocked = pageHelper.IsPageLocked(pageContents);

					pnlHB.Visible = !bLocked;
					pnlButtons.Visible = !bLocked;
					divEditing.Visible = bLocked;
					chkDraft.Visible = !bLocked;
					pnlHBEmpty.Visible = bLocked;

					if (bLocked && pageContents.Heartbeat_UserId != null) {
						MembershipUser usr = SecurityData.GetUserByGuid(pageContents.Heartbeat_UserId.Value);
						litUser.Text = "Read only mode. User '" + usr.UserName + "' is currently editing the page.";
					}

					txtTitle.Text = pageContents.TitleBar;
					txtNav.Text = pageContents.NavMenuText;
					txtHead.Text = pageContents.PageHead;
					txtPageSlug.Text = pageContents.PageSlug;
					txtThumb.Text = pageContents.Thumbnail;

					txtDescription.Text = pageContents.MetaDescription;
					txtKey.Text = pageContents.MetaKeyword;

					lblUpdated.Text = pageContents.EditDate.ToString();
					lblCreateDate.Text = pageContents.CreateDate.ToString();

					reBody.Text = pageContents.PageText;
					reLeftBody.Text = pageContents.LeftPageText;
					reRightBody.Text = pageContents.RightPageText;

					chkActive.Checked = pageContents.PageActive;
					chkHide.Checked = pageContents.BlockIndex;

					GeneralUtilities.BindDataBoundControl(gvTracks, pageContents.GetTrackbacks());

					ucReleaseDate.SetDate(pageContents.GoLiveDate);
					ucRetireDate.SetDate(pageContents.RetireDate);

					if (pageContents.CreditUserId.HasValue) {
						var usr = new ExtendedUserData(pageContents.CreditUserId.Value);
						hdnCreditUserID.Value = usr.UserName;
						txtSearchUser.Text = string.Format("{0} ({1})", usr.UserName, usr.EmailAddress);
					}

					pageContents.Parent_ContentID = null;

					GeneralUtilities.SelectListValue(ddlTemplate, pageContents.TemplateFile.ToLowerInvariant());

					GeneralUtilities.SelectListValues(listTags, pageContents.ContentTags.Cast<IContentMetaInfo>().Select(x => x.ContentMetaInfoID.ToString()).ToList());
					GeneralUtilities.SelectListValues(listCats, pageContents.ContentCategories.Cast<IContentMetaInfo>().Select(x => x.ContentMetaInfoID.ToString()).ToList());
				}
			}

			SetBlankText(reBody);
			SetBlankText(reLeftBody);
			SetBlankText(reRightBody);

			if (ddlVersions.Items.Count < 1) {
				pnlReview.Visible = false;
			}
		}

		private void BindTextDataGrid() {
			if (cmsHelper.cmsAdminWidget != null) {
				var ww1 = (from w in cmsHelper.cmsAdminWidget
						   where w.IsLatestVersion == true
						   && w.ControlPath.StartsWith("CLASS:Carrotware.CMS.UI.Controls.ContentRichText,")
						   select w);

				gvHtmControls.DataSource = ww1;
				gvHtmControls.DataBind();

				var ww2 = (from w in cmsHelper.cmsAdminWidget
						   where w.IsLatestVersion == true
						   && w.ControlPath.StartsWith("CLASS:Carrotware.CMS.UI.Controls.ContentPlainText,")
						   select w);

				gvTxtControls.DataSource = ww2;
				gvTxtControls.DataBind();
			}
		}

		protected void btnDelete_Click(object sender, EventArgs e) {
			guidRootContentID = new Guid(hdnRootID.Value);

			using (ContentPageHelper cph = new ContentPageHelper()) {
				cph.RemoveContent(SiteID, guidRootContentID);
			}

			Response.Redirect(SiteFilename.BlogPostIndexURL);
		}

		protected void btnSave_Click(object sender, EventArgs e) {
			SavePage(false);
		}

		protected void btnSaveVisit_Click(object sender, EventArgs e) {
			SavePage(true);
		}

		protected void SavePage(bool bRedirect) {
			ContentPage pageContents = null;
			if (guidVersionContentID != Guid.Empty) {
				pageContents = pageHelper.GetVersion(SiteID, guidVersionContentID);
			}
			if (guidContentID != Guid.Empty && pageContents == null) {
				pageContents = pageHelper.FindContentByID(SiteID, guidContentID);
			}
			if (guidImportContentID != Guid.Empty) {
				pageContents = ContentImportExportUtils.GetSerializedContentPageExport(guidImportContentID).ThePage;

				if (pageContents != null) {
					pageContents.SiteID = SiteID;
					pageContents.EditDate = SiteData.CurrentSite.Now;
					pageContents.CreateUserId = SecurityData.CurrentUserGuid;
					pageContents.CreateDate = SiteData.CurrentSite.Now;

					var rp = pageHelper.GetLatestContentByURL(SiteID, false, pageContents.FileName);
					if (rp != null) {
						pageContents.Root_ContentID = rp.Root_ContentID;
						pageContents.ContentID = rp.ContentID;
					} else {
						pageContents.Root_ContentID = Guid.Empty;
						pageContents.ContentID = Guid.Empty;
					}
					pageContents.Parent_ContentID = null;
					pageContents.NavOrder = SiteData.BlogSortOrderNumber;
				}
			}

			if (pageContents == null) {
				pageContents = new ContentPage(SiteData.CurrentSiteID, ContentPageType.PageType.BlogEntry);
			}

			DateTime dtSite = CMSConfigHelper.CalcNearestFiveMinTime(SiteData.CurrentSite.Now);
			pageContents.GoLiveDate = dtSite.AddMinutes(-5);
			pageContents.RetireDate = dtSite.AddYears(200);

			pageContents.IsLatestVersion = true;
			pageContents.Thumbnail = txtThumb.Text;

			pageContents.TemplateFile = ddlTemplate.SelectedValue;

			pageContents.TitleBar = txtTitle.Text;
			pageContents.NavMenuText = txtNav.Text;
			pageContents.PageHead = txtHead.Text;
			pageContents.PageSlug = txtPageSlug.Text;

			pageContents.MetaDescription = txtDescription.Text;
			pageContents.MetaKeyword = txtKey.Text;

			pageContents.EditDate = SiteData.CurrentSite.Now;
			pageContents.NavOrder = SiteData.BlogSortOrderNumber;

			pageContents.PageText = reBody.Text;
			pageContents.LeftPageText = reLeftBody.Text;
			pageContents.RightPageText = reRightBody.Text;

			pageContents.PageActive = chkActive.Checked;
			pageContents.ShowInSiteNav = false;
			pageContents.ShowInSiteMap = false;
			pageContents.BlockIndex = chkHide.Checked;

			pageContents.ContentType = ContentPageType.PageType.BlogEntry;

			pageContents.Parent_ContentID = null;

			if (String.IsNullOrEmpty(hdnCreditUserID.Value)) {
				pageContents.CreditUserId = null;
			} else {
				var usr = new ExtendedUserData(hdnCreditUserID.Value);
				pageContents.CreditUserId = usr.UserId;
			}

			pageContents.GoLiveDate = ucReleaseDate.GetDate();
			pageContents.RetireDate = ucRetireDate.GetDate();

			pageContents.EditUserId = SecurityData.CurrentUserGuid;

			pageContents.NewTrackBackURLs = txtTrackback.Text;

			List<ContentCategory> lstCat = new List<ContentCategory>();
			List<ContentTag> lstTag = new List<ContentTag>();

			lstCat = (from cr in GeneralUtilities.GetSelectedValues(listCats).Select(x => new Guid(x))
					  join l in SiteData.CurrentSite.GetCategoryList() on cr equals l.ContentCategoryID
					  select l).ToList();

			lstTag = (from cr in GeneralUtilities.GetSelectedValues(listTags).Select(x => new Guid(x))
					  join l in SiteData.CurrentSite.GetTagList() on cr equals l.ContentTagID
					  select l).ToList();

			pageContents.ContentCategories = lstCat;
			pageContents.ContentTags = lstTag;

			if (!chkDraft.Checked) {
				pageContents.SavePageEdit();
			} else {
				pageContents.SavePageAsDraft();
			}

			//if importing, copy in all meta data possible
			if (guidImportContentID != Guid.Empty) {
				List<Widget> widgets = ContentImportExportUtils.GetSerializedContentPageExport(guidImportContentID).ThePageWidgets;

				foreach (var wd in widgets) {
					wd.Root_ContentID = pageContents.Root_ContentID;
					wd.Root_WidgetID = Guid.NewGuid();
					wd.WidgetDataID = Guid.NewGuid();
					wd.IsPendingChange = true;
					wd.EditDate = SiteData.CurrentSite.Now;
					wd.Save();
				}

				ContentImportExportUtils.RemoveSerializedExportData(guidImportContentID);
			}

			cmsHelper.OverrideKey(pageContents.Root_ContentID);
			if (cmsHelper.cmsAdminWidget != null) {
				var ww = (from w in cmsHelper.cmsAdminWidget
						  where w.IsLatestVersion == true
						  && w.IsPendingChange == true
						  && (w.ControlPath.StartsWith("CLASS:Carrotware.CMS.UI.Controls.ContentRichText,")
						  || w.ControlPath.StartsWith("CLASS:Carrotware.CMS.UI.Controls.ContentPlainText,"))
						  select w);

				foreach (Widget w in ww) {
					w.Save();
				}
			}

			cmsHelper.cmsAdminContent = null;
			cmsHelper.cmsAdminWidget = null;

			if (pageContents.FileName.ToLowerInvariant().EndsWith(SiteData.DefaultDirectoryFilename)) {
				VirtualDirectory.RegisterRoutes(true);
			}

			if (!bRedirect) {
				if (sPageMode.Length < 1) {
					Response.Redirect(SiteData.CurrentScriptName + "?id=" + pageContents.Root_ContentID.ToString());
				} else {
					Response.Redirect(SiteData.CurrentScriptName + "?mode=raw&id=" + pageContents.Root_ContentID.ToString());
				}
			} else {
				Response.Redirect(pageContents.FileName);
			}
		}
	}
}


text:
nao_dcm
========

ROS Stack for Aldebaran's Nao Humanoid
---------------------------------------

  - Goal is to **connect to the machine of Nao** and not the API provided by Aldebaran.
  - Ιt makes use only of the **DCM and Memory Proxies**.
  - Supports **V4.0/V5.0 robots (H21 and H25 Body Types)**.
  - **Written purely in C++** and uses the lastest *C++ SDK (2.1.2.17)*.
  - **Coupled with official packages**

Version
----

0.0.1 (Beta)

Requirements
-----------

nao_dcm requires several packages to be installed in order to work properly:

* [ROS] - ROS **Hydro**
* [NaoQi C++ SDK] - **Version 2.1.2.17** - Should work on *1.14.5* too.
* [ROS MoveIt!] - Used for motion planning
* [ROS Control] - **Version >=0.6.0**
* [Webots for Nao] - The best? simulator so far [optional]
* [Gazebo] - Work in progress but with satisfactory results (**Version >= 2.2.2 alongside gazebo-ros-pkgs >= 2.3.4 and [roboticsgroup_gazebo_plugins]**) [optional]
* [Nao Robot] - A real working Nao is the best "simulator" you'll ever get!! **Version >= V4.0 and flashed OpenNao OS >= 2.1.2.17**

Basic Usage
--------------

### Bringup nao_dcm driver
```sh
roslaunch nao_dcm_bringup nao_dcm_bringup.launch
```

This will connect to Nao Robot and provide basic control over Nao.

### Webots Simulation

Launch your **Webots for Nao Simulator** and then **follow the instructions above to bringup nao_dcm driver** (remotely). *On some versions of Webots, it is required that you move the head before you get camera feedback.*

Notes/Limitations
-----------------
* **nao_dcm can be run locally**, *but you need to have built and installed ROS Hydro/Indigo on Nao as nao_dcm requires ros_controls packages* (available only on >= Hydro). Yet, running **nao_dcm** driver remotely is identical in performance as running it locally (if the connection is strong and persistent - Wi-Fi usage is not recommended).
* Tutorials will become available as soon as possible.
* Although my intension is to provide ROS integration to the machine, basic gait and motion planning schemes are on the way for those that want quick results/feedback.
* *Integration for LED, IR and Audio hardware is not available and is not on my agenda*. So, **feel free to contribute in that direction**.
* **This is only ONE part of my Diploma Thesis** (*"Navigation of Humanoid Robots in Unknown Space With Dynamic Obstacles"*), so many parts of the code are not perfect and well-thought. So, **PRs for code improvement are welcomed.**

Origin of the Name
------------------

Since my intention is to use the lowest level of Aldebaran's API possible and its name is DCM, I decided to name the ROS Stack nao_dcm.

License
----

BSD

Copyright (c) 2014-2015, **Konstantinos Chatzilygeroudis**

[ros]: http://www.ros.org
[naoqi c++ sdk]: https://community.aldebaran-robotics.com/doc/2-1/index.html
[webots for nao]: https://community.aldebaran-robotics.com/doc/2-1/software/webots/webots_index.html
[gazebo]: http://gazebosim.org/
[ros moveit!]: http://moveit.ros.org/
[nao robot]: http://www.aldebaran.com/en/humanoid-robot/nao-robot
[ros control]: http://wiki.ros.org/ros_control
[roboticsgroup_gazebo_plugins]: http://github.com/roboticsgroup/roboticsgroup_gazebo_plugins

redpajama_set_name: RedPajamaGithub


text:
import {expect} from "chai";
import {ArtifactsObjects} from "../src/artifacts_objects";
import {Class} from "../src/objects";
import {UnknownObject} from "../src/objects/_unknown_object";
import {MemoryFile} from "../src/files/memory_file";

describe("Top level artifacts", () => {

  it("CLAS", () => {
    const obj = ArtifactsObjects.newObject("ZCL_FOOBAR", "CLAS");
    expect(obj).to.be.instanceof(Class);
  });

  it("Unknown object", () => {
    const obj = ArtifactsObjects.newObject("ASDF", "ASDF");
    obj.addFile(new MemoryFile("foo.asdf.xml", "sdf"));
    expect(obj).to.be.instanceof(UnknownObject);
    expect(obj.getParsingIssues().length).to.equal(1);
  });

  it("DTEL", () => {
    const obj = ArtifactsObjects.newObject("ZDATA", "DTEL");
    expect(obj.getParsingIssues().length).to.equal(0);
  });

});


text:
package com.abhi.spectacle.utilities;

import android.annotation.SuppressLint;
import android.graphics.Bitmap;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.constraint.ConstraintLayout;
import android.support.constraint.ConstraintSet;
import android.widget.ImageView;

import com.bumptech.glide.request.target.SimpleTarget;
import com.bumptech.glide.request.transition.Transition;

public class ImageLoader {

    public static void loadImage(final ImageView imageView, final ConstraintLayout constraintLayout, String imageUrl) {
        GlideApp.with(imageView).asBitmap().load(imageUrl).dontTransform().into(new SimpleTarget<Bitmap>() {
            @Override
            public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {

                @SuppressLint("DefaultLocale") String ratio = String.format("%d:%d", resource.getWidth(), resource.getHeight());
                ConstraintSet constraintSet = new ConstraintSet();
                constraintSet.clone(constraintLayout);
                constraintSet.setDimensionRatio(imageView.getId(), ratio);
                constraintSet.applyTo(constraintLayout);
                imageView.setImageBitmap(resource);

            }
        });

    }

}


text:
package com.github.mediabuttons;

import android.content.Context;
import android.database.DataSetObserver;
import android.graphics.Bitmap;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.TextView;

/**
 * Creates the list elements for the main config activity for widget creation.
 * The list consists of one entry for each action.  It is static and all
 * elements are always enabled.
 */
public class ConfigListAdaptor implements ListAdapter {

    private String[] mLabels;
    private Context mContext;
    private int mPadding;
    private int mIconSize;

    ConfigListAdaptor(Context context, String[] labels) {
        mContext = context;
        mLabels = labels;
        // Convert from dp to px.
        final float scale = mContext.getResources().getDisplayMetrics().density;
        mPadding = (int) (4 * scale + 0.5f);
        mIconSize = (int) (64 * scale + 0.5f);
    }

    @Override
    public boolean areAllItemsEnabled() {
        return true;
    }

    @Override
    public boolean isEnabled(int position) {
        return true;
    }

    @Override
    public int getCount() {
        return mLabels.length;
    }

    @Override
    public Object getItem(int position) {
        // No data of note to return.
        return null;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public int getItemViewType(int position) {
        return 0;
    }

    /**
     * The View we create for each element consists of one (or two for
     * pause/play) images that represent the current theme for each action.
     * We also put in a text label for each action.
     */
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        LinearLayout layout = new LinearLayout(mContext);
        layout.setGravity(Gravity.CENTER_VERTICAL);

        ButtonImageSource source = ButtonImageSource.getSource();
        Bitmap bitmap = source.getIcon(position);
        layout.addView(makeImageView(bitmap));

        if (position == Configure.PLAY_PAUSE_ACTION) {
            // Display both states of the widget.
            bitmap = source.getIcon(Configure.PAUSE_PLAY_ACTION);
            layout.addView(makeImageView(bitmap));
        }

        TextView text = new TextView(mContext);
        text.setTextSize(24);
        text.setPadding(mPadding, mPadding, mPadding, mPadding);
        text.setText(mLabels[position]);
        layout.addView(text);

        return layout;
    }

    /**
     * Creates the ImageView icon for the given bitmap.
     * @param icon   The Bitmap to display on the ImageView
     * @return   An ImageView all set to go.
     */
    private ImageView makeImageView(Bitmap icon) {
        ImageView image = new ImageView(mContext);
        image.setMaxWidth(mIconSize);
        image.setMaxHeight(mIconSize);
        image.setAdjustViewBounds(true);
        image.setScaleType(ImageView.ScaleType.FIT_CENTER);
        image.setImageBitmap(icon);
        image.setPadding(mPadding, mPadding, mPadding, mPadding);
        return image;
    }

    @Override
    public int getViewTypeCount() {
        return 1;
    }

    @Override
    public boolean hasStableIds() {
        return true;
    }

    @Override
    public boolean isEmpty() {
        return false;
    }

    @Override
    public void registerDataSetObserver(DataSetObserver observer) {
        // We have a static dataset, so ignore.
    }

    @Override
    public void unregisterDataSetObserver(DataSetObserver observer) {
        // We have a static dataset, so ignore.
    }

}


text:
/**
 * Interface for Message Authentication Codes (MAC).
 *
 * Security guarantees: Message Authentication Codes provide symmetric message
 * authentication. Instances implementing this interface are secure against
 * existential forgery under chosen plaintext attack, and can be deterministic
 * or randomized. This interface should be used for authentication only, and not
 * for other purposes like generation of pseudorandom bytes.
 *
 */
export abstract class Mac {
  /**
   * Computes message authentication code (MAC) for `data`.
   *
   * @param data the data to compute MAC
   * @return the MAC tag
   */
  abstract computeMac(data: Uint8Array): Promise<Uint8Array>;

  /**
   * Verifies whether `tag` is a correct authentication code for `data`.
   *
   * @param tag  the MAC tag
   * @param data the data to compute MAC
   */
  abstract verifyMac(tag: Uint8Array, data: Uint8Array): Promise<boolean>;
}


text:
<resources>
    <string name="app_name">DianShang</string>
</resources>


text:
package org.wso2.carbon.kernel.configprovider;

import org.wso2.carbon.kernel.annotations.Configuration;

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
@Configuration(description = "Test Transport Bean")
class Transport {

    private String name = "default transport";
    private int port = 8000;
    private String secure = "false";
    private String desc = "Default Transport Configurations";
    private String password = "zzz";

    @XmlAttribute
    public void setSecure(String secure) {
        this.secure = secure;
    }

    public String isSecure() {
        return secure;
    }

    @XmlElement
    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    @XmlElement
    public void setPort(int port) {
        this.port = port;
    }

    public int getPort() {
        return port;
    }

    @XmlElement
    public void setDesc(String desc) {
        this.desc = desc;
    }

    public String getDesc() {
        return desc;
    }

    @XmlElement
    public void setPassword(String password) {
        this.password = password;
    }

    public String getPassword() {
        return password;
    }
}

@XmlRootElement
@Configuration(description = "Test Transports Bean")
class Transports {

    private List<Transport> transport;

    Transports() {
        transport = new ArrayList<>();
        transport.add(new Transport());
    }
    @XmlElement
    public void setTransport(List<Transport> transport) {
        this.transport = transport;
    }

    public List<Transport> getTransport() {
        return transport;
    }

}

/**
 * @since 5.2.0.
 */
@XmlRootElement
@Configuration(namespace = "configurations", description = "Test Configurations Bean")
public class Configurations {

    private String tenant = "default";
    private Transports transports = new Transports();

    @XmlElement
    public void setTenant(String tenant) {
        this.tenant = tenant;
    }

    public String getTenant() {
        return tenant;
    }

    @XmlElement
    public void setTransports(Transports transports) {
        this.transports = transports;
    }

    public Transports getTransports() {
        return transports;
    }
}


text:
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>FindFineTour</title>

        <link rel="stylesheet" type="text/css" href="https://code.jquery.com/ui/1.12.0/themes/blitzer/jquery-ui.css">

        <link rel="stylesheet" type="text/css" href="/static/css/login.css">

        ¦Ü³»°T®§

        §Úªº°T®§

        §Úªº°T®§¤º®e


text:
import ts from 'typescript';

import {TypeValueReference, TypeValueReferenceKind, UnavailableTypeValueReference, ValueUnavailableKind} from './host';

/**
 * Potentially convert a `ts.TypeNode` to a `TypeValueReference`, which indicates how to use the
 * type given in the `ts.TypeNode` in a value position.
 *
 * This can return `null` if the `typeNode` is `null`, if it does not refer to a symbol with a value
 * declaration, or if it is not possible to statically understand.
 */
export function typeToValue(
    typeNode: ts.TypeNode|null, checker: ts.TypeChecker): TypeValueReference {
  // It's not possible to get a value expression if the parameter doesn't even have a type.
  if (typeNode === null) {
    return missingType();
  }

  if (!ts.isTypeReferenceNode(typeNode)) {
    return unsupportedType(typeNode);
  }

  const symbols = resolveTypeSymbols(typeNode, checker);
  if (symbols === null) {
    return unknownReference(typeNode);
  }

  const {local, decl} = symbols;
  // It's only valid to convert a type reference to a value reference if the type actually
  // has a value declaration associated with it. Note that const enums are an exception,
  // because while they do have a value declaration, they don't exist at runtime.
  if (decl.valueDeclaration === undefined || decl.flags & ts.SymbolFlags.ConstEnum) {
    let typeOnlyDecl: ts.Declaration|null = null;
    if (decl.declarations !== undefined && decl.declarations.length > 0) {
      typeOnlyDecl = decl.declarations[0];
    }
    return noValueDeclaration(typeNode, typeOnlyDecl);
  }

  // The type points to a valid value declaration. Rewrite the TypeReference into an
  // Expression which references the value pointed to by the TypeReference, if possible.

  // Look at the local `ts.Symbol`'s declarations and see if it comes from an import
  // statement. If so, extract the module specifier and the name of the imported type.
  const firstDecl = local.declarations && local.declarations[0];
  if (firstDecl !== undefined) {
    if (ts.isImportClause(firstDecl) && firstDecl.name !== undefined) {
      // This is a default import.
      //   import Foo from 'foo';

      if (firstDecl.isTypeOnly) {
        // Type-only imports cannot be represented as value.
        return typeOnlyImport(typeNode, firstDecl);
      }

      return {
        kind: TypeValueReferenceKind.LOCAL,
        expression: firstDecl.name,
        defaultImportStatement: firstDecl.parent,
      };
    } else if (ts.isImportSpecifier(firstDecl)) {
      // The symbol was imported by name
      //   import {Foo} from 'foo';
      // or
      //   import {Foo as Bar} from 'foo';

      if (firstDecl.isTypeOnly) {
        // The import specifier can't be type-only (e.g. `import {type Foo} from '...')`.
        return typeOnlyImport(typeNode, firstDecl);
      }

      if (firstDecl.parent.parent.isTypeOnly) {
        // The import specifier can't be inside a type-only import clause
        // (e.g. `import type {Foo} from '...')`.
        return typeOnlyImport(typeNode, firstDecl.parent.parent);
      }

      // Determine the name to import (`Foo`) from the import specifier, as the symbol names of
      // the imported type could refer to a local alias (like `Bar` in the example above).
      const importedName = (firstDecl.propertyName || firstDecl.name).text;

      // The first symbol name refers to the local name, which is replaced by `importedName` above.
      // Any remaining symbol names make up the complete path to the value.
      const [_localName, ...nestedPath] = symbols.symbolNames;

      const moduleName = extractModuleName(firstDecl.parent.parent.parent);
      return {
        kind: TypeValueReferenceKind.IMPORTED,
        valueDeclaration: decl.valueDeclaration,
        moduleName,
        importedName,
        nestedPath
      };
    } else if (ts.isNamespaceImport(firstDecl)) {
      // The import is a namespace import
      //   import * as Foo from 'foo';

      if (firstDecl.parent.isTypeOnly) {
        // Type-only imports cannot be represented as value.
        return typeOnlyImport(typeNode, firstDecl.parent);
      }

      if (symbols.symbolNames.length === 1) {
        // The type refers to the namespace itself, which cannot be represented as a value.
        return namespaceImport(typeNode, firstDecl.parent);
      }

      // The first symbol name refers to the local name of the namespace, which is is discarded
      // as a new namespace import will be generated. This is followed by the symbol name that needs
      // to be imported and any remaining names that constitute the complete path to the value.
      const [_ns, importedName, ...nestedPath] = symbols.symbolNames;

      const moduleName = extractModuleName(firstDecl.parent.parent);
      return {
        kind: TypeValueReferenceKind.IMPORTED,
        valueDeclaration: decl.valueDeclaration,
        moduleName,
        importedName,
        nestedPath
      };
    }
  }

  // If the type is not imported, the type reference can be converted into an expression as is.
  const expression = typeNodeToValueExpr(typeNode);
  if (expression !== null) {
    return {
      kind: TypeValueReferenceKind.LOCAL,
      expression,
      defaultImportStatement: null,
    };
  } else {
    return unsupportedType(typeNode);
  }
}

function unsupportedType(typeNode: ts.TypeNode): UnavailableTypeValueReference {
  return {
    kind: TypeValueReferenceKind.UNAVAILABLE,
    reason: {kind: ValueUnavailableKind.UNSUPPORTED, typeNode},
  };
}

function noValueDeclaration(
    typeNode: ts.TypeNode, decl: ts.Declaration|null): UnavailableTypeValueReference {
  return {
    kind: TypeValueReferenceKind.UNAVAILABLE,
    reason: {kind: ValueUnavailableKind.NO_VALUE_DECLARATION, typeNode, decl},
  };
}

function typeOnlyImport(typeNode: ts.TypeNode, node: ts.ImportClause|ts.ImportSpecifier):
    UnavailableTypeValueReference {
  return {
    kind: TypeValueReferenceKind.UNAVAILABLE,
    reason: {kind: ValueUnavailableKind.TYPE_ONLY_IMPORT, typeNode, node},
  };
}

function unknownReference(typeNode: ts.TypeNode): UnavailableTypeValueReference {
  return {
    kind: TypeValueReferenceKind.UNAVAILABLE,
    reason: {kind: ValueUnavailableKind.UNKNOWN_REFERENCE, typeNode},
  };
}

function namespaceImport(
    typeNode: ts.TypeNode, importClause: ts.ImportClause): UnavailableTypeValueReference {
  return {
    kind: TypeValueReferenceKind.UNAVAILABLE,
    reason: {kind: ValueUnavailableKind.NAMESPACE, typeNode, importClause},
  };
}

function missingType(): UnavailableTypeValueReference {
  return {
    kind: TypeValueReferenceKind.UNAVAILABLE,
    reason: {kind: ValueUnavailableKind.MISSING_TYPE},
  };
}

/**
 * Attempt to extract a `ts.Expression` that's equivalent to a `ts.TypeNode`, as the two have
 * different AST shapes but can reference the same symbols.
 *
 * This will return `null` if an equivalent expression cannot be constructed.
 */
export function typeNodeToValueExpr(node: ts.TypeNode): ts.Expression|null {
  if (ts.isTypeReferenceNode(node)) {
    return entityNameToValue(node.typeName);
  } else {
    return null;
  }
}

/**
 * Resolve a `TypeReference` node to the `ts.Symbol`s for both its declaration and its local source.
 *
 * In the event that the `TypeReference` refers to a locally declared symbol, these will be the
 * same. If the `TypeReference` refers to an imported symbol, then `decl` will be the fully resolved
 * `ts.Symbol` of the referenced symbol. `local` will be the `ts.Symbol` of the `ts.Identifier`
 * which points to the import statement by which the symbol was imported.
 *
 * All symbol names that make up the type reference are returned left-to-right into the
 * `symbolNames` array, which is guaranteed to include at least one entry.
 */
function resolveTypeSymbols(typeRef: ts.TypeReferenceNode, checker: ts.TypeChecker):
    {local: ts.Symbol, decl: ts.Symbol, symbolNames: string[]}|null {
  const typeName = typeRef.typeName;
  // typeRefSymbol is the ts.Symbol of the entire type reference.
  const typeRefSymbol: ts.Symbol|undefined = checker.getSymbolAtLocation(typeName);
  if (typeRefSymbol === undefined) {
    return null;
  }

  // `local` is the `ts.Symbol` for the local `ts.Identifier` for the type.
  // If the type is actually locally declared or is imported by name, for example:
  //   import {Foo} from './foo';
  // then it'll be the same as `typeRefSymbol`.
  //
  // If the type is imported via a namespace import, for example:
  //   import * as foo from './foo';
  // and then referenced as:
  //   constructor(f: foo.Foo)
  // then `local` will be the `ts.Symbol` of `foo`, whereas `typeRefSymbol` will be the `ts.Symbol`
  // of `foo.Foo`. This allows tracking of the import behind whatever type reference exists.
  let local = typeRefSymbol;

  // Destructure a name like `foo.X.Y.Z` as follows:
  // - in `leftMost`, the `ts.Identifier` of the left-most name (`foo`) in the qualified name.
  //   This identifier is used to resolve the `ts.Symbol` for `local`.
  // - in `symbolNames`, all names involved in the qualified path, or a single symbol name if the
  //   type is not qualified.
  let leftMost = typeName;
  const symbolNames: string[] = [];
  while (ts.isQualifiedName(leftMost)) {
    symbolNames.unshift(leftMost.right.text);
    leftMost = leftMost.left;
  }
  symbolNames.unshift(leftMost.text);

  if (leftMost !== typeName) {
    const localTmp = checker.getSymbolAtLocation(leftMost);
    if (localTmp !== undefined) {
      local = localTmp;
    }
  }

  // De-alias the top-level type reference symbol to get the symbol of the actual declaration.
  let decl = typeRefSymbol;
  if (typeRefSymbol.flags & ts.SymbolFlags.Alias) {
    decl = checker.getAliasedSymbol(typeRefSymbol);
  }
  return {local, decl, symbolNames};
}

function entityNameToValue(node: ts.EntityName): ts.Expression|null {
  if (ts.isQualifiedName(node)) {
    const left = entityNameToValue(node.left);
    return left !== null ? ts.factory.createPropertyAccessExpression(left, node.right) : null;
  } else if (ts.isIdentifier(node)) {
    const clone = ts.setOriginalNode(ts.factory.createIdentifier(node.text), node);
    (clone as any).parent = node.parent;
    return clone;
  } else {
    return null;
  }
}

function extractModuleName(node: ts.ImportDeclaration): string {
  if (!ts.isStringLiteral(node.moduleSpecifier)) {
    throw new Error('not a module specifier');
  }
  return node.moduleSpecifier.text;
}


text:
package gio

import (
	L "github.com/tHinqa/outside-gtk2/glib"
	O "github.com/tHinqa/outside-gtk2/gobject"
	T "github.com/tHinqa/outside-gtk2/types"
	. "github.com/tHinqa/outside/types"
)

type DataInputStream struct {
	Parent BufferedInputStream
	_      *struct{}
}

var (
	DataInputStreamGetType func() O.Type
	DataInputStreamNew     func(baseStream *InputStream) *DataInputStream

	DataInputStreamGetByteOrder    func(d *DataInputStream) DataStreamByteOrder
	DataInputStreamGetNewlineType  func(d *DataInputStream) DataStreamNewlineType
	DataInputStreamReadByte        func(d *DataInputStream, cancellable *Cancellable, err **L.Error) T.Guchar
	DataInputStreamReadInt16       func(d *DataInputStream, cancellable *Cancellable, err **L.Error) int16
	DataInputStreamReadInt32       func(d *DataInputStream, cancellable *Cancellable, err **L.Error) T.GInt32
	DataInputStreamReadInt64       func(d *DataInputStream, cancellable *Cancellable, err **L.Error) int64
	DataInputStreamReadLine        func(d *DataInputStream, length *T.Gsize, cancellable *Cancellable, err **L.Error) string
	DataInputStreamReadLineAsync   func(d *DataInputStream, ioPriority int, cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer)
	DataInputStreamReadLineFinish  func(d *DataInputStream, result *AsyncResult, length *T.Gsize, err **L.Error) string
	DataInputStreamReadUint16      func(d *DataInputStream, cancellable *Cancellable, err **L.Error) uint16
	DataInputStreamReadUint32      func(d *DataInputStream, cancellable *Cancellable, err **L.Error) T.GUint32
	DataInputStreamReadUint64      func(d *DataInputStream, cancellable *Cancellable, err **L.Error) uint64
	DataInputStreamReadUntil       func(d *DataInputStream, stopChars string, length *T.Gsize, cancellable *Cancellable, err **L.Error) string
	DataInputStreamReadUntilAsync  func(d *DataInputStream, stopChars string, ioPriority int, cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer)
	DataInputStreamReadUntilFinish func(d *DataInputStream, result *AsyncResult, length *T.Gsize, err **L.Error) string
	DataInputStreamReadUpto        func(d *DataInputStream, stopChars string, stopCharsLen T.Gssize, length *T.Gsize, cancellable *Cancellable, err **L.Error) string
	DataInputStreamReadUptoAsync   func(d *DataInputStream, stopChars string, stopCharsLen T.Gssize, ioPriority int, cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer)
	DataInputStreamReadUptoFinish  func(d *DataInputStream, result *AsyncResult, length *T.Gsize, err **L.Error) string
	DataInputStreamSetByteOrder    func(d *DataInputStream, order DataStreamByteOrder)
	DataInputStreamSetNewlineType  func(d *DataInputStream, typ DataStreamNewlineType)
)

func (d *DataInputStream) GetByteOrder() DataStreamByteOrder { return DataInputStreamGetByteOrder(d) }
func (d *DataInputStream) GetNewlineType() DataStreamNewlineType {
	return DataInputStreamGetNewlineType(d)
}
func (d *DataInputStream) ReadByte(cancellable *Cancellable, err **L.Error) T.Guchar {
	return DataInputStreamReadByte(d, cancellable, err)
}
func (d *DataInputStream) ReadInt16(cancellable *Cancellable, err **L.Error) int16 {
	return DataInputStreamReadInt16(d, cancellable, err)
}
func (d *DataInputStream) ReadInt32(cancellable *Cancellable, err **L.Error) T.GInt32 {
	return DataInputStreamReadInt32(d, cancellable, err)
}
func (d *DataInputStream) ReadInt64(cancellable *Cancellable, err **L.Error) int64 {
	return DataInputStreamReadInt64(d, cancellable, err)
}
func (d *DataInputStream) ReadLine(length *T.Gsize, cancellable *Cancellable, err **L.Error) string {
	return DataInputStreamReadLine(d, length, cancellable, err)
}
func (d *DataInputStream) ReadLineAsync(ioPriority int, cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer) {
	DataInputStreamReadLineAsync(d, ioPriority, cancellable, callback, userData)
}
func (d *DataInputStream) ReadLineFinish(result *AsyncResult, length *T.Gsize, err **L.Error) string {
	return DataInputStreamReadLineFinish(d, result, length, err)
}
func (d *DataInputStream) ReadUint16(cancellable *Cancellable, err **L.Error) uint16 {
	return DataInputStreamReadUint16(d, cancellable, err)
}
func (d *DataInputStream) ReadUint32(cancellable *Cancellable, err **L.Error) T.GUint32 {
	return DataInputStreamReadUint32(d, cancellable, err)
}
func (d *DataInputStream) ReadUint64(cancellable *Cancellable, err **L.Error) uint64 {
	return DataInputStreamReadUint64(d, cancellable, err)
}
func (d *DataInputStream) ReadUntil(stopChars string, length *T.Gsize, cancellable *Cancellable, err **L.Error) string {
	return DataInputStreamReadUntil(d, stopChars, length, cancellable, err)
}
func (d *DataInputStream) ReadUntilAsync(stopChars string, ioPriority int, cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer) {
	DataInputStreamReadUntilAsync(d, stopChars, ioPriority, cancellable, callback, userData)
}
func (d *DataInputStream) ReadUntilFinish(result *AsyncResult, length *T.Gsize, err **L.Error) string {
	return DataInputStreamReadUntilFinish(d, result, length, err)
}
func (d *DataInputStream) ReadUpto(stopChars string, stopCharsLen T.Gssize, length *T.Gsize, cancellable *Cancellable, err **L.Error) string {
	return DataInputStreamReadUpto(d, stopChars, stopCharsLen, length, cancellable, err)
}
func (d *DataInputStream) ReadUptoAsync(stopChars string, stopCharsLen T.Gssize, ioPriority int, cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer) {
	DataInputStreamReadUptoAsync(d, stopChars, stopCharsLen, ioPriority, cancellable, callback, userData)
}
func (d *DataInputStream) ReadUptoFinish(result *AsyncResult, length *T.Gsize, err **L.Error) string {
	return DataInputStreamReadUptoFinish(d, result, length, err)
}
func (d *DataInputStream) SetByteOrder(order DataStreamByteOrder) {
	DataInputStreamSetByteOrder(d, order)
}
func (d *DataInputStream) SetNewlineType(typ DataStreamNewlineType) {
	DataInputStreamSetNewlineType(d, typ)
}

type DataOutputStream struct {
	Parent FilterOutputStream
	_      *struct{}
}

var (
	DataOutputStreamGetType func() O.Type
	DataOutputStreamNew     func(baseStream *OutputStream) *DataOutputStream

	DataOutputStreamGetByteOrder func(d *DataOutputStream) DataStreamByteOrder
	DataOutputStreamPutByte      func(d *DataOutputStream, data T.Guchar, cancellable *Cancellable, err **L.Error) bool
	DataOutputStreamPutInt16     func(d *DataOutputStream, data int16, cancellable *Cancellable, err **L.Error) bool
	DataOutputStreamPutInt32     func(d *DataOutputStream, data T.GInt32, cancellable *Cancellable, err **L.Error) bool
	DataOutputStreamPutInt64     func(d *DataOutputStream, data int64, cancellable *Cancellable, err **L.Error) bool
	DataOutputStreamPutString    func(d *DataOutputStream, str string, cancellable *Cancellable, err **L.Error) bool
	DataOutputStreamPutUint16    func(d *DataOutputStream, data uint16, cancellable *Cancellable, err **L.Error) bool
	DataOutputStreamPutUint32    func(d *DataOutputStream, data T.GUint32, cancellable *Cancellable, err **L.Error) bool
	DataOutputStreamPutUint64    func(d *DataOutputStream, data uint64, cancellable *Cancellable, err **L.Error) bool
	DataOutputStreamSetByteOrder func(d *DataOutputStream, order DataStreamByteOrder)
)

func (d *DataOutputStream) GetByteOrder() DataStreamByteOrder { return DataOutputStreamGetByteOrder(d) }
func (d *DataOutputStream) PutByte(data T.Guchar, cancellable *Cancellable, err **L.Error) bool {
	return DataOutputStreamPutByte(d, data, cancellable, err)
}
func (d *DataOutputStream) PutInt16(data int16, cancellable *Cancellable, err **L.Error) bool {
	return DataOutputStreamPutInt16(d, data, cancellable, err)
}
func (d *DataOutputStream) PutInt32(data T.GInt32, cancellable *Cancellable, err **L.Error) bool {
	return DataOutputStreamPutInt32(d, data, cancellable, err)
}
func (d *DataOutputStream) PutInt64(data int64, cancellable *Cancellable, err **L.Error) bool {
	return DataOutputStreamPutInt64(d, data, cancellable, err)
}
func (d *DataOutputStream) PutString(str string, cancellable *Cancellable, err **L.Error) bool {
	return DataOutputStreamPutString(d, str, cancellable, err)
}
func (d *DataOutputStream) PutUint16(data uint16, cancellable *Cancellable, err **L.Error) bool {
	return DataOutputStreamPutUint16(d, data, cancellable, err)
}
func (d *DataOutputStream) PutUint32(data T.GUint32, cancellable *Cancellable, err **L.Error) bool {
	return DataOutputStreamPutUint32(d, data, cancellable, err)
}
func (d *DataOutputStream) PutUint64(data uint64, cancellable *Cancellable, err **L.Error) bool {
	return DataOutputStreamPutUint64(d, data, cancellable, err)
}
func (d *DataOutputStream) SetByteOrder(order DataStreamByteOrder) {
	DataOutputStreamSetByteOrder(d, order)
}

type DataStreamByteOrder Enum

const (
	DATA_STREAM_BYTE_ORDER_BIG_ENDIAN DataStreamByteOrder = iota
	DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN
	DATA_STREAM_BYTE_ORDER_HOST_ENDIAN
)

var DataStreamByteOrderGetType func() O.Type

type DataStreamNewlineType Enum

const (
	DATA_STREAM_NEWLINE_TYPE_LF DataStreamNewlineType = iota
	DATA_STREAM_NEWLINE_TYPE_CR
	DATA_STREAM_NEWLINE_TYPE_CR_LF
	DATA_STREAM_NEWLINE_TYPE_ANY
)

var DataStreamNewlineTypeGetType func() O.Type

var (
	DBusAddressGetForBusSync   func(busType BusType, cancellable *Cancellable, err **L.Error) string
	DBusAddressGetStream       func(address string, cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer)
	DBusAddressGetStreamFinish func(res *AsyncResult, outGuid **T.Gchar, err **L.Error) *IOStream
	DBusAddressGetStreamSync   func(address string, outGuid **T.Gchar, cancellable *Cancellable, err **L.Error) *IOStream
)

type DBusAnnotationInfo struct {
	RefCount    int
	Key         *T.Gchar
	Value       *T.Gchar
	Annotations **DBusAnnotationInfo
}

var (
	DBusAnnotationInfoGetType func() O.Type

	DBusAnnotationInfoLookup func(annotations **DBusAnnotationInfo, name string) string

	DBusAnnotationInfoRef   func(d *DBusAnnotationInfo) *DBusAnnotationInfo
	DBusAnnotationInfoUnref func(d *DBusAnnotationInfo)
)

func (d *DBusAnnotationInfo) Ref() *DBusAnnotationInfo { return DBusAnnotationInfoRef(d) }
func (d *DBusAnnotationInfo) Unref()                   { DBusAnnotationInfoUnref(d) }

type DBusArgInfo struct {
	RefCount    int
	Name        *T.Gchar
	Signature   *T.Gchar
	Annotations **DBusAnnotationInfo
}

var (
	DBusArgInfoGetType func() O.Type

	DBusArgInfoRef   func(d *DBusArgInfo) *DBusArgInfo
	DBusArgInfoUnref func(d *DBusArgInfo)
)

func (d *DBusArgInfo) Ref() *DBusArgInfo { return DBusArgInfoRef(d) }
func (d *DBusArgInfo) Unref()            { DBusArgInfoUnref(d) }

type DBusAuthObserver struct{}

var (
	DBusAuthObserverGetType func() O.Type
	DBusAuthObserverNew     func() *DBusAuthObserver

	DBusAuthObserverAuthorizeAuthenticatedPeer func(d *DBusAuthObserver, stream *IOStream, credentials *Credentials) bool
)

func (d *DBusAuthObserver) AuthorizeAuthenticatedPeer(stream *IOStream, credentials *Credentials) bool {
	return DBusAuthObserverAuthorizeAuthenticatedPeer(d, stream, credentials)
}

type DBusCallFlags Enum

const (
	DBUS_CALL_FLAGS_NO_AUTO_START DBusCallFlags = 1 << iota
	DBUS_CALL_FLAGS_NONE          DBusCallFlags = 0
)

var DBusCallFlagsGetType func() O.Type

type DBusCapabilityFlags Enum

const (
	DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING DBusCapabilityFlags = 1 << iota
	DBUS_CAPABILITY_FLAGS_NONE            DBusCapabilityFlags = 0
)

var DBusCapabilityFlagsGetType func() O.Type

type DBusConnection struct{}

var (
	DBusConnectionGetType             func() O.Type
	DBusConnectionNew                 func(d *IOStream, guid string, flags DBusConnectionFlags, observer *DBusAuthObserver, cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer)
	DBusConnectionNewFinish           func(res *AsyncResult, err **L.Error) *DBusConnection
	DBusConnectionNewForAddress       func(address string, flags DBusConnectionFlags, observer *DBusAuthObserver, cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer)
	DBusConnectionNewForAddressFinish func(res *AsyncResult, err **L.Error) *DBusConnection
	DBusConnectionNewForAddressSync   func(address string, flags DBusConnectionFlags, observer *DBusAuthObserver, cancellable *Cancellable, err **L.Error) *DBusConnection
	DBusConnectionNewSync             func(d *IOStream, guid string, flags DBusConnectionFlags, observer *DBusAuthObserver, cancellable *Cancellable, err **L.Error) *DBusConnection

	DBusConnectionAddFilter                  func(d *DBusConnection, filterFunction DBusMessageFilterFunction, userData T.Gpointer, userDataFreeFunc O.DestroyNotify) uint
	DBusConnectionCall                       func(d *DBusConnection, busName, objectPath, interfaceName, methodName string, parameters *L.Variant, replyType *L.VariantType, flags DBusCallFlags, timeoutMsec int, cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer)
	DBusConnectionCallFinish                 func(d *DBusConnection, res *AsyncResult, err **L.Error) *L.Variant
	DBusConnectionCallSync                   func(d *DBusConnection, busName, objectPath, interfaceName, methodName string, parameters *L.Variant, replyType *L.VariantType, flags DBusCallFlags, timeoutMsec int, cancellable *Cancellable, err **L.Error) *L.Variant
	DBusConnectionClose                      func(d *DBusConnection, cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer)
	DBusConnectionCloseFinish                func(d *DBusConnection, res *AsyncResult, err **L.Error) bool
	DBusConnectionCloseSync                  func(d *DBusConnection, cancellable *Cancellable, err **L.Error) bool
	DBusConnectionEmitSignal                 func(d *DBusConnection, destinationBusName, objectPath, interfaceName string, signalName string, parameters *L.Variant, err **L.Error) bool
	DBusConnectionFlush                      func(d *DBusConnection, cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer)
	DBusConnectionFlushFinish                func(d *DBusConnection, res *AsyncResult, err **L.Error) bool
	DBusConnectionFlushSync                  func(d *DBusConnection, cancellable *Cancellable, err **L.Error) bool
	DBusConnectionGetCapabilities            func(d *DBusConnection) DBusCapabilityFlags
	DBusConnectionGetExitOnClose             func(d *DBusConnection) bool
	DBusConnectionGetGuid                    func(d *DBusConnection) string
	DBusConnectionGetPeerCredentials         func(d *DBusConnection) *Credentials
	DBusConnectionGetStream                  func(d *DBusConnection) *IOStream
	DBusConnectionGetUniqueName              func(d *DBusConnection) string
	DBusConnectionIsClosed                   func(d *DBusConnection) bool
	DBusConnectionRegisterObject             func(d *DBusConnection, objectPath string, interfaceInfo *DBusInterfaceInfo, vtable *DBusInterfaceVTable, userData T.Gpointer, userDataFreeFunc O.DestroyNotify, err **L.Error) uint
	DBusConnectionRegisterSubtree            func(d *DBusConnection, objectPath string, vtable *DBusSubtreeVTable, flags DBusSubtreeFlags, userData T.Gpointer, userDataFreeFunc O.DestroyNotify, err **L.Error) uint
	DBusConnectionRemoveFilter               func(d *DBusConnection, filterId uint)
	DBusConnectionSendMessage                func(d *DBusConnection, message *DBusMessage, flags DBusSendMessageFlags, outSerial *T.GUint32, err **L.Error) bool
	DBusConnectionSendMessageWithReply       func(d *DBusConnection, message *DBusMessage, flags DBusSendMessageFlags, timeoutMsec int, outSerial *T.GUint32, cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer)
	DBusConnectionSendMessageWithReplyFinish func(d *DBusConnection, res *AsyncResult, err **L.Error) *DBusMessage
	DBusConnectionSendMessageWithReplySync   func(d *DBusConnection, message *DBusMessage, flags DBusSendMessageFlags, timeoutMsec int, outSerial *T.GUint32, cancellable *Cancellable, err **L.Error) *DBusMessage
	DBusConnectionSetExitOnClose             func(d *DBusConnection, exitOnClose bool)
	DBusConnectionSignalSubscribe            func(d *DBusConnection, sender, interfaceName, member, objectPath, arg0 string, flags DBusSignalFlags, callback DBusSignalCallback, userData T.Gpointer, userDataFreeFunc O.DestroyNotify) uint
	DBusConnectionSignalUnsubscribe          func(d *DBusConnection, subscriptionId uint)
	DBusConnectionStartMessageProcessing     func(d *DBusConnection)
	DBusConnectionUnregisterObject           func(d *DBusConnection, registrationId uint) bool
	DBusConnectionUnregisterSubtree          func(d *DBusConnection, registrationId uint) bool
)

func (d *DBusConnection) AddFilter(filterFunction DBusMessageFilterFunction, userData T.Gpointer, userDataFreeFunc O.DestroyNotify) uint {
	return DBusConnectionAddFilter(d, filterFunction, userData, userDataFreeFunc)
}
func (d *DBusConnection) Call(busName, objectPath, interfaceName, methodName string, parameters *L.Variant, replyType *L.VariantType, flags DBusCallFlags, timeoutMsec int, cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer) {
	DBusConnectionCall(d, busName, objectPath, interfaceName, methodName, parameters, replyType, flags, timeoutMsec, cancellable, callback, userData)
}
func (d *DBusConnection) CallFinish(res *AsyncResult, err **L.Error) *L.Variant {
	return DBusConnectionCallFinish(d, res, err)
}
func (d *DBusConnection) CallSync(busName, objectPath, interfaceName, methodName string, parameters *L.Variant, replyType *L.VariantType, flags DBusCallFlags, timeoutMsec int, cancellable *Cancellable, err **L.Error) *L.Variant {
	return DBusConnectionCallSync(d, busName, objectPath, interfaceName, methodName, parameters, replyType, flags, timeoutMsec, cancellable, err)
}
func (d *DBusConnection) Close(cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer) {
	DBusConnectionClose(d, cancellable, callback, userData)
}
func (d *DBusConnection) CloseFinish(res *AsyncResult, err **L.Error) bool {
	return DBusConnectionCloseFinish(d, res, err)
}
func (d *DBusConnection) CloseSync(cancellable *Cancellable, err **L.Error) bool {
	return DBusConnectionCloseSync(d, cancellable, err)
}
func (d *DBusConnection) EmitSignal(destinationBusName, objectPath, interfaceName string, signalName string, parameters *L.Variant, err **L.Error) bool {
	return DBusConnectionEmitSignal(d, destinationBusName, objectPath, interfaceName, signalName, parameters, err)
}
func (d *DBusConnection) Flush(cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer) {
	DBusConnectionFlush(d, cancellable, callback, userData)
}
func (d *DBusConnection) FlushFinish(res *AsyncResult, err **L.Error) bool {
	return DBusConnectionFlushFinish(d, res, err)
}
func (d *DBusConnection) FlushSync(cancellable *Cancellable, err **L.Error) bool {
	return DBusConnectionFlushSync(d, cancellable, err)
}
func (d *DBusConnection) GetCapabilities() DBusCapabilityFlags {
	return DBusConnectionGetCapabilities(d)
}
func (d *DBusConnection) GetExitOnClose() bool             { return DBusConnectionGetExitOnClose(d) }
func (d *DBusConnection) GetGuid() string                  { return DBusConnectionGetGuid(d) }
func (d *DBusConnection) GetPeerCredentials() *Credentials { return DBusConnectionGetPeerCredentials(d) }
func (d *DBusConnection) GetStream() *IOStream             { return DBusConnectionGetStream(d) }
func (d *DBusConnection) GetUniqueName() string            { return DBusConnectionGetUniqueName(d) }
func (d *DBusConnection) IsClosed() bool                   { return DBusConnectionIsClosed(d) }
func (d *DBusConnection) RegisterObject(objectPath string, interfaceInfo *DBusInterfaceInfo, vtable *DBusInterfaceVTable, userData T.Gpointer, userDataFreeFunc O.DestroyNotify, err **L.Error) uint {
	return DBusConnectionRegisterObject(d, objectPath, interfaceInfo, vtable, userData, userDataFreeFunc, err)
}
func (d *DBusConnection) RegisterSubtree(objectPath string, vtable *DBusSubtreeVTable, flags DBusSubtreeFlags, userData T.Gpointer, userDataFreeFunc O.DestroyNotify, err **L.Error) uint {
	return DBusConnectionRegisterSubtree(d, objectPath, vtable, flags, userData, userDataFreeFunc, err)
}
func (d *DBusConnection) RemoveFilter(filterId uint) { DBusConnectionRemoveFilter(d, filterId) }
func (d *DBusConnection) SendMessage(message *DBusMessage, flags DBusSendMessageFlags, outSerial *T.GUint32, err **L.Error) bool {
	return DBusConnectionSendMessage(d, message, flags, outSerial, err)
}
func (d *DBusConnection) SendMessageWithReply(message *DBusMessage, flags DBusSendMessageFlags, timeoutMsec int, outSerial *T.GUint32, cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer) {
	DBusConnectionSendMessageWithReply(d, message, flags, timeoutMsec, outSerial, cancellable, callback, userData)
}
func (d *DBusConnection) SendMessageWithReplyFinish(res *AsyncResult, err **L.Error) *DBusMessage {
	return DBusConnectionSendMessageWithReplyFinish(d, res, err)
}
func (d *DBusConnection) SendMessageWithReplySync(message *DBusMessage, flags DBusSendMessageFlags, timeoutMsec int, outSerial *T.GUint32, cancellable *Cancellable, err **L.Error) *DBusMessage {
	return DBusConnectionSendMessageWithReplySync(d, message, flags, timeoutMsec, outSerial, cancellable, err)
}
func (d *DBusConnection) SetExitOnClose(exitOnClose bool) {
	DBusConnectionSetExitOnClose(d, exitOnClose)
}
func (d *DBusConnection) SignalSubscribe(sender, interfaceName, member, objectPath, arg0 string, flags DBusSignalFlags, callback DBusSignalCallback, userData T.Gpointer, userDataFreeFunc O.DestroyNotify) uint {
	return DBusConnectionSignalSubscribe(d, sender, interfaceName, member, objectPath, arg0, flags, callback, userData, userDataFreeFunc)
}
func (d *DBusConnection) SignalUnsubscribe(subscriptionId uint) {
	DBusConnectionSignalUnsubscribe(d, subscriptionId)
}
func (d *DBusConnection) StartMessageProcessing() { DBusConnectionStartMessageProcessing(d) }
func (d *DBusConnection) UnregisterObject(registrationId uint) bool {
	return DBusConnectionUnregisterObject(d, registrationId)
}
func (d *DBusConnection) UnregisterSubtree(registrationId uint) bool {
	return DBusConnectionUnregisterSubtree(d, registrationId)
}

type DBusConnectionFlags Enum

const (
	DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT DBusConnectionFlags = 1 << iota
	DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER
	DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS
	DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION
	DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING
	DBUS_CONNECTION_FLAGS_NONE DBusConnectionFlags = 0
)

var DBusConnectionFlagsGetType func() O.Type

var DBusErrorGetType func() O.Type

type DBusInterfaceInfo struct {
	RefCount    int
	Name        *T.Gchar
	Methods     **DBusMethodInfo
	Signals     **DBusSignalInfo
	Properties  **DBusPropertyInfo
	Annotations **DBusAnnotationInfo
}

type DBusInterfaceGetPropertyFunc func(connection *DBusConnection,
	sender, objectPath, interfaceName, propertyName string,
	err **L.Error, userData T.Gpointer)

type DBusInterfaceMethodCallFunc func(connection *DBusConnection,
	sender, objectPath, interfaceName, methodName string,
	parameters *L.Variant, invocation *DBusMethodInvocation,
	userData T.Gpointer)

type DBusInterfaceSetPropertyFunc func(connection *DBusConnection,
	sender, objectPath, interfaceName, propertyName string,
	value *L.Variant, err **L.Error, userData T.Gpointer)

type DBusInterfaceVTable struct {
	MethodCall  DBusInterfaceMethodCallFunc
	GetProperty DBusInterfaceGetPropertyFunc
	SetProperty DBusInterfaceSetPropertyFunc
	Padding     [8]T.Gpointer
}

type DBusErrorEntry struct {
	ErrorCode     int
	DbusErrorName *T.Gchar
}

var (
	DBusErrorEncodeGerror        func(err *L.Error) string
	DBusErrorGetRemoteError      func(err *L.Error) string
	DBusErrorIsRemoteError       func(err *L.Error) bool
	DBusErrorNewForDBusError     func(dbusErrorName string, dbusErrorMessage string) *L.Error
	DBusErrorQuark               func() L.Quark
	DBusErrorRegisterError       func(errorDomain L.Quark, errorCode int, dbusErrorName string) bool
	DBusErrorRegisterErrorDomain func(errorDomainQuarkName string, quarkVolatile *T.Gsize, entries *DBusErrorEntry, numEntries uint)
	DBusErrorSetDBusError        func(e **L.Error, dbusErrorName, dbusErrorMessage, format string, v ...VArg)
	DBusErrorSetDBusErrorValist  func(err **L.Error, dbusErrorName string, dbusErrorMessage string, format string, varArgs VAList)
	DBusErrorStripRemoteError    func(err *L.Error) bool
	DBusErrorUnregisterError     func(errorDomain L.Quark, errorCode int, dbusErrorName string) bool
)

var DBusGenerateGuid func() string

var (
	DBusInterfaceInfoGetType func() O.Type

	DBusInterfaceInfoGenerateXml    func(d *DBusInterfaceInfo, indent uint, stringBuilder *L.String)
	DBusInterfaceInfoLookupMethod   func(d *DBusInterfaceInfo, name string) *DBusMethodInfo
	DBusInterfaceInfoLookupProperty func(d *DBusInterfaceInfo, name string) *DBusPropertyInfo
	DBusInterfaceInfoLookupSignal   func(d *DBusInterfaceInfo, name string) *DBusSignalInfo
	DBusInterfaceInfoRef            func(d *DBusInterfaceInfo) *DBusInterfaceInfo
	DBusInterfaceInfoUnref          func(d *DBusInterfaceInfo)
)

func (d *DBusInterfaceInfo) GenerateXml(indent uint, stringBuilder *L.String) {
	DBusInterfaceInfoGenerateXml(d, indent, stringBuilder)
}
func (d *DBusInterfaceInfo) LookupMethod(name string) *DBusMethodInfo {
	return DBusInterfaceInfoLookupMethod(d, name)
}
func (d *DBusInterfaceInfo) LookupProperty(name string) *DBusPropertyInfo {
	return DBusInterfaceInfoLookupProperty(d, name)
}
func (d *DBusInterfaceInfo) LookupSignal(name string) *DBusSignalInfo {
	return DBusInterfaceInfoLookupSignal(d, name)
}
func (d *DBusInterfaceInfo) Ref() *DBusInterfaceInfo { return DBusInterfaceInfoRef(d) }
func (d *DBusInterfaceInfo) Unref()                  { DBusInterfaceInfoUnref(d) }

var (
	DBusIsAddress          func(string string) bool
	DBusIsGuid             func(string string) bool
	DBusIsInterfaceName    func(string string) bool
	DBusIsMemberName       func(string string) bool
	DBusIsName             func(string string) bool
	DBusIsSupportedAddress func(string string, err **L.Error) bool
	DBusIsUniqueName       func(string string) bool
)

type DBusMessage struct{}

var (
	DBusMessageGetType       func() O.Type
	DBusMessageNew           func() *DBusMessage
	DBusMessageNewFromBlob   func(blob *T.Guchar, blobLen T.Gsize, capabilities DBusCapabilityFlags, err **L.Error) *DBusMessage
	DBusMessageNewMethodCall func(name string, path string, interface_ string, method string) *DBusMessage
	DBusMessageNewSignal     func(path string, interface_ string, signal string) *DBusMessage

	DBusMessageBytesNeeded func(blob *T.Guchar, blobLen T.Gsize, err **L.Error) T.Gssize

	DBusMessageCopy                  func(d *DBusMessage, err **L.Error) *DBusMessage
	DBusMessageGetArg0               func(d *DBusMessage) string
	DBusMessageGetBody               func(d *DBusMessage) *L.Variant
	DBusMessageGetByteOrder          func(d *DBusMessage) DBusMessageByteOrder
	DBusMessageGetDestination        func(d *DBusMessage) string
	DBusMessageGetErrorName          func(d *DBusMessage) string
	DBusMessageGetFlags              func(d *DBusMessage) DBusMessageFlags
	DBusMessageGetHeader             func(d *DBusMessage, headerField DBusMessageHeaderField) *L.Variant
	DBusMessageGetHeaderFields       func(d *DBusMessage) *T.Guchar
	DBusMessageGetInterface          func(d *DBusMessage) string
	DBusMessageGetLocked             func(d *DBusMessage) bool
	DBusMessageGetMember             func(d *DBusMessage) string
	DBusMessageGetMessageType        func(d *DBusMessage) DBusMessageType
	DBusMessageGetNumUnixFds         func(d *DBusMessage) T.GUint32
	DBusMessageGetPath               func(d *DBusMessage) string
	DBusMessageGetReplySerial        func(d *DBusMessage) T.GUint32
	DBusMessageGetSender             func(d *DBusMessage) string
	DBusMessageGetSerial             func(d *DBusMessage) T.GUint32
	DBusMessageGetSignature          func(d *DBusMessage) string
	DBusMessageGetUnixFdList         func(d *DBusMessage) *T.GUnixFDList
	DBusMessageLock                  func(d *DBusMessage)
	DBusMessageNewMethodError        func(d *DBusMessage, errorName, errorMessageFormat string, v ...VArg) *DBusMessage
	DBusMessageNewMethodErrorLiteral func(d *DBusMessage, errorName, errorMessage string) *DBusMessage
	DBusMessageNewMethodErrorValist  func(d *DBusMessage, errorName, errorMessageFormat string, varArgs VAList) *DBusMessage
	DBusMessageNewMethodReply        func(d *DBusMessage) *DBusMessage
	DBusMessagePrint                 func(d *DBusMessage, indent uint) string
	DBusMessageSetBody               func(d *DBusMessage, body *L.Variant)
	DBusMessageSetByteOrder          func(d *DBusMessage, byteOrder DBusMessageByteOrder)
	DBusMessageSetDestination        func(d *DBusMessage, value string)
	DBusMessageSetErrorName          func(d *DBusMessage, value string)
	DBusMessageSetFlags              func(d *DBusMessage, flags DBusMessageFlags)
	DBusMessageSetHeader             func(d *DBusMessage, headerField DBusMessageHeaderField, value *L.Variant)
	DBusMessageSetInterface          func(d *DBusMessage, value string)
	DBusMessageSetMember             func(d *DBusMessage, value string)
	DBusMessageSetMessageType        func(d *DBusMessage, typ DBusMessageType)
	DBusMessageSetNumUnixFds         func(d *DBusMessage, value T.GUint32)
	DBusMessageSetPath               func(d *DBusMessage, value string)
	DBusMessageSetReplySerial        func(d *DBusMessage, value T.GUint32)
	DBusMessageSetSender             func(d *DBusMessage, value string)
	DBusMessageSetSerial             func(d *DBusMessage, serial T.GUint32)
	DBusMessageSetSignature          func(d *DBusMessage, value string)
	DBusMessageSetUnixFdList         func(d *DBusMessage, fdList *T.GUnixFDList)
	DBusMessageToBlob                func(d *DBusMessage, outSize *T.Gsize, capabilities DBusCapabilityFlags, err **L.Error) *T.Guchar
	DBusMessageToGerror              func(d *DBusMessage, err **L.Error) bool
)

func (d *DBusMessage) Copy(err **L.Error) *DBusMessage    { return DBusMessageCopy(d, err) }
func (d *DBusMessage) GetArg0() string                    { return DBusMessageGetArg0(d) }
func (d *DBusMessage) GetBody() *L.Variant                { return DBusMessageGetBody(d) }
func (d *DBusMessage) GetByteOrder() DBusMessageByteOrder { return DBusMessageGetByteOrder(d) }
func (d *DBusMessage) GetDestination() string             { return DBusMessageGetDestination(d) }
func (d *DBusMessage) GetErrorName() string               { return DBusMessageGetErrorName(d) }
func (d *DBusMessage) GetFlags() DBusMessageFlags         { return DBusMessageGetFlags(d) }
func (d *DBusMessage) GetHeader(headerField DBusMessageHeaderField) *L.Variant {
	return DBusMessageGetHeader(d, headerField)
}
func (d *DBusMessage) GetHeaderFields() *T.Guchar      { return DBusMessageGetHeaderFields(d) }
func (d *DBusMessage) GetInterface() string            { return DBusMessageGetInterface(d) }
func (d *DBusMessage) GetLocked() bool                 { return DBusMessageGetLocked(d) }
func (d *DBusMessage) GetMember() string               { return DBusMessageGetMember(d) }
func (d *DBusMessage) GetMessageType() DBusMessageType { return DBusMessageGetMessageType(d) }
func (d *DBusMessage) GetNumUnixFds() T.GUint32        { return DBusMessageGetNumUnixFds(d) }
func (d *DBusMessage) GetPath() string                 { return DBusMessageGetPath(d) }
func (d *DBusMessage) GetReplySerial() T.GUint32       { return DBusMessageGetReplySerial(d) }
func (d *DBusMessage) GetSender() string               { return DBusMessageGetSender(d) }
func (d *DBusMessage) GetSerial() T.GUint32            { return DBusMessageGetSerial(d) }
func (d *DBusMessage) GetSignature() string            { return DBusMessageGetSignature(d) }
func (d *DBusMessage) GetUnixFdList() *T.GUnixFDList   { return DBusMessageGetUnixFdList(d) }
func (d *DBusMessage) Lock()                           { DBusMessageLock(d) }
func (d *DBusMessage) NewMethodError(errorName, errorMessageFormat string, v ...VArg) *DBusMessage {
	return DBusMessageNewMethodError(d, errorName, errorMessageFormat, v)
}
func (d *DBusMessage) NewMethodErrorLiteral(errorName, errorMessage string) *DBusMessage {
	return DBusMessageNewMethodErrorLiteral(d, errorName, errorMessage)
}
func (d *DBusMessage) NewMethodErrorValist(errorName, errorMessageFormat string, varArgs VAList) *DBusMessage {
	return DBusMessageNewMethodErrorValist(d, errorName, errorMessageFormat, varArgs)
}
func (d *DBusMessage) NewMethodReply() *DBusMessage { return DBusMessageNewMethodReply(d) }
func (d *DBusMessage) Print(indent uint) string     { return DBusMessagePrint(d, indent) }
func (d *DBusMessage) SetBody(body *L.Variant)      { DBusMessageSetBody(d, body) }
func (d *DBusMessage) SetByteOrder(byteOrder DBusMessageByteOrder) {
	DBusMessageSetByteOrder(d, byteOrder)
}
func (d *DBusMessage) SetDestination(value string)     { DBusMessageSetDestination(d, value) }
func (d *DBusMessage) SetErrorName(value string)       { DBusMessageSetErrorName(d, value) }
func (d *DBusMessage) SetFlags(flags DBusMessageFlags) { DBusMessageSetFlags(d, flags) }
func (d *DBusMessage) SetHeader(headerField DBusMessageHeaderField, value *L.Variant) {
	DBusMessageSetHeader(d, headerField, value)
}
func (d *DBusMessage) SetInterface(value string)           { DBusMessageSetInterface(d, value) }
func (d *DBusMessage) SetMember(value string)              { DBusMessageSetMember(d, value) }
func (d *DBusMessage) SetMessageType(typ DBusMessageType)  { DBusMessageSetMessageType(d, typ) }
func (d *DBusMessage) SetNumUnixFds(value T.GUint32)       { DBusMessageSetNumUnixFds(d, value) }
func (d *DBusMessage) SetPath(value string)                { DBusMessageSetPath(d, value) }
func (d *DBusMessage) SetReplySerial(value T.GUint32)      { DBusMessageSetReplySerial(d, value) }
func (d *DBusMessage) SetSender(value string)              { DBusMessageSetSender(d, value) }
func (d *DBusMessage) SetSerial(serial T.GUint32)          { DBusMessageSetSerial(d, serial) }
func (d *DBusMessage) SetSignature(value string)           { DBusMessageSetSignature(d, value) }
func (d *DBusMessage) SetUnixFdList(fdList *T.GUnixFDList) { DBusMessageSetUnixFdList(d, fdList) }
func (d *DBusMessage) ToBlob(outSize *T.Gsize, capabilities DBusCapabilityFlags, err **L.Error) *T.Guchar {
	return DBusMessageToBlob(d, outSize, capabilities, err)
}
func (d *DBusMessage) ToGerror(err **L.Error) bool { return DBusMessageToGerror(d, err) }

type DBusMessageByteOrder Enum

const (
	DBUS_MESSAGE_BYTE_ORDER_BIG_ENDIAN    DBusMessageByteOrder = 'B'
	DBUS_MESSAGE_BYTE_ORDER_LITTLE_ENDIAN DBusMessageByteOrder = 'l'
)

var DBusMessageByteOrderGetType func() O.Type

type DBusMessageFilterFunction func(
	connection *DBusConnection,
	message *DBusMessage,
	incoming bool,
	userData T.Gpointer) *DBusMessage

type DBusMessageFlags Enum

const (
	DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED DBusMessageFlags = 1 << iota
	DBUS_MESSAGE_FLAGS_NO_AUTO_START
	DBUS_MESSAGE_FLAGS_NONE DBusMessageFlags = 0
)

var DBusMessageFlagsGetType func() O.Type

type DBusMessageHeaderField Enum

const (
	DBUS_MESSAGE_HEADER_FIELD_INVALID DBusMessageHeaderField = iota
	DBUS_MESSAGE_HEADER_FIELD_PATH
	DBUS_MESSAGE_HEADER_FIELD_INTERFACE
	DBUS_MESSAGE_HEADER_FIELD_MEMBER
	DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME
	DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL
	DBUS_MESSAGE_HEADER_FIELD_DESTINATION
	DBUS_MESSAGE_HEADER_FIELD_SENDER
	DBUS_MESSAGE_HEADER_FIELD_SIGNATURE
	DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS
)

var DBusMessageHeaderFieldGetType func() O.Type

type DBusMessageType Enum

const (
	DBUS_MESSAGE_TYPE_INVALID DBusMessageType = iota
	DBUS_MESSAGE_TYPE_METHOD_CALL
	DBUS_MESSAGE_TYPE_METHOD_RETURN
	DBUS_MESSAGE_TYPE_ERROR
	DBUS_MESSAGE_TYPE_SIGNAL
)

var DBusMessageTypeGetType func() O.Type

type DBusMethodInfo struct {
	RefCount    int
	Name        *T.Gchar
	InArgs      **DBusArgInfo
	OutArgs     **DBusArgInfo
	Annotations **DBusAnnotationInfo
}

var (
	DBusMethodInfoGetType func() O.Type

	DBusMethodInfoRef   func(d *DBusMethodInfo) *DBusMethodInfo
	DBusMethodInfoUnref func(d *DBusMethodInfo)
)

func (d *DBusMethodInfo) Ref() *DBusMethodInfo { return DBusMethodInfoRef(d) }
func (d *DBusMethodInfo) Unref()               { DBusMethodInfoUnref(d) }

type DBusMethodInvocation struct{}

var (
	DBusMethodInvocationGetType func() O.Type

	DBusMethodInvocationGetConnection      func(d *DBusMethodInvocation) *DBusConnection
	DBusMethodInvocationGetInterfaceName   func(d *DBusMethodInvocation) string
	DBusMethodInvocationGetMessage         func(d *DBusMethodInvocation) *DBusMessage
	DBusMethodInvocationGetMethodInfo      func(d *DBusMethodInvocation) *DBusMethodInfo
	DBusMethodInvocationGetMethodName      func(d *DBusMethodInvocation) string
	DBusMethodInvocationGetObjectPath      func(d *DBusMethodInvocation) string
	DBusMethodInvocationGetParameters      func(d *DBusMethodInvocation) *L.Variant
	DBusMethodInvocationGetSender          func(d *DBusMethodInvocation) string
	DBusMethodInvocationGetUserData        func(d *DBusMethodInvocation) T.Gpointer
	DBusMethodInvocationReturnDBusError    func(d *DBusMethodInvocation, errorName, errorMessage string)
	DBusMethodInvocationReturnError        func(d *DBusMethodInvocation, domain L.Quark, code int, format string, v ...VArg)
	DBusMethodInvocationReturnErrorLiteral func(d *DBusMethodInvocation, domain L.Quark, code int, message string)
	DBusMethodInvocationReturnErrorValist  func(d *DBusMethodInvocation, domain L.Quark, code int, format string, varArgs VAList)
	DBusMethodInvocationReturnGerror       func(d *DBusMethodInvocation, err *L.Error)
	DBusMethodInvocationReturnValue        func(d *DBusMethodInvocation, parameters *L.Variant)
)

func (d *DBusMethodInvocation) GetConnection() *DBusConnection {
	return DBusMethodInvocationGetConnection(d)
}
func (d *DBusMethodInvocation) GetInterfaceName() string {
	return DBusMethodInvocationGetInterfaceName(d)
}
func (d *DBusMethodInvocation) GetMessage() *DBusMessage { return DBusMethodInvocationGetMessage(d) }
func (d *DBusMethodInvocation) GetMethodInfo() *DBusMethodInfo {
	return DBusMethodInvocationGetMethodInfo(d)
}
func (d *DBusMethodInvocation) GetMethodName() string { return DBusMethodInvocationGetMethodName(d) }
func (d *DBusMethodInvocation) GetObjectPath() string { return DBusMethodInvocationGetObjectPath(d) }
func (d *DBusMethodInvocation) GetParameters() *L.Variant {
	return DBusMethodInvocationGetParameters(d)
}
func (d *DBusMethodInvocation) GetSender() string       { return DBusMethodInvocationGetSender(d) }
func (d *DBusMethodInvocation) GetUserData() T.Gpointer { return DBusMethodInvocationGetUserData(d) }
func (d *DBusMethodInvocation) ReturnDBusError(errorName, errorMessage string) {
	DBusMethodInvocationReturnDBusError(d, errorName, errorMessage)
}
func (d *DBusMethodInvocation) ReturnError(domain L.Quark, code int, format string, v ...VArg) {
	DBusMethodInvocationReturnError(d, domain, code, format, v)
}
func (d *DBusMethodInvocation) ReturnErrorLiteral(domain L.Quark, code int, message string) {
	DBusMethodInvocationReturnErrorLiteral(d, domain, code, message)
}
func (d *DBusMethodInvocation) ReturnErrorValist(domain L.Quark, code int, format string, varArgs VAList) {
	DBusMethodInvocationReturnErrorValist(d, domain, code, format, varArgs)
}
func (d *DBusMethodInvocation) ReturnGerror(err *L.Error) { DBusMethodInvocationReturnGerror(d, err) }
func (d *DBusMethodInvocation) ReturnValue(parameters *L.Variant) {
	DBusMethodInvocationReturnValue(d, parameters)
}

type DBusNodeInfo struct {
	Ref_count   int
	Path        *T.Gchar
	Interfaces  **DBusInterfaceInfo
	Nodes       **DBusNodeInfo
	Annotations **DBusAnnotationInfo
}

var (
	DBusNodeInfoGetType   func() O.Type
	DBusNodeInfoNewForXml func(xmlData string, err **L.Error) *DBusNodeInfo

	DBusNodeInfoGenerateXml     func(d *DBusNodeInfo, indent uint, stringBuilder *L.String)
	DBusNodeInfoLookupInterface func(d *DBusNodeInfo, name string) *DBusInterfaceInfo
	DBusNodeInfoRef             func(d *DBusNodeInfo) *DBusNodeInfo
	DBusNodeInfoUnref           func(d *DBusNodeInfo)
)

func (d *DBusNodeInfo) GenerateXml(indent uint, stringBuilder *L.String) {
	DBusNodeInfoGenerateXml(d, indent, stringBuilder)
}
func (d *DBusNodeInfo) LookupInterface(name string) *DBusInterfaceInfo {
	return DBusNodeInfoLookupInterface(d, name)
}
func (d *DBusNodeInfo) Ref() *DBusNodeInfo { return DBusNodeInfoRef(d) }
func (d *DBusNodeInfo) Unref()             { DBusNodeInfoUnref(d) }

type DBusPropertyInfo struct {
	RefCount    int
	Name        *T.Gchar
	Signature   *T.Gchar
	Flags       DBusPropertyInfoFlags
	Annotations **DBusAnnotationInfo
}

var (
	DBusPropertyInfoGetType func() O.Type

	DBusPropertyInfoRef   func(d *DBusPropertyInfo) *DBusPropertyInfo
	DBusPropertyInfoUnref func(d *DBusPropertyInfo)
)

func (d *DBusPropertyInfo) Ref() *DBusPropertyInfo { return DBusPropertyInfoRef(d) }
func (d *DBusPropertyInfo) Unref()                 { DBusPropertyInfoUnref(d) }

type DBusPropertyInfoFlags Enum

const (
	DBUS_PROPERTY_INFO_FLAGS_READABLE DBusPropertyInfoFlags = 1 << iota
	DBUS_PROPERTY_INFO_FLAGS_WRITABLE
	DBUS_PROPERTY_INFO_FLAGS_NONE DBusPropertyInfoFlags = 0
)

var DBusPropertyInfoFlagsGetType func() O.Type

type DBusProxy struct {
	Parent O.Object
	Priv   *struct{}
}

var (
	DBusProxyGetType         func() O.Type
	DBusProxyNew             func(d *DBusConnection, flags DBusProxyFlags, info *DBusInterfaceInfo, name string, objectPath string, interfaceName string, cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer)
	DBusProxyNewFinish       func(res *AsyncResult, err **L.Error) *DBusProxy
	DBusProxyNewForBus       func(busType BusType, flags DBusProxyFlags, info *DBusInterfaceInfo, name string, objectPath string, interfaceName string, cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer)
	DBusProxyNewForBusFinish func(res *AsyncResult, err **L.Error) *DBusProxy
	DBusProxyNewForBusSync   func(busType BusType, flags DBusProxyFlags, info *DBusInterfaceInfo, name string, objectPath string, interfaceName string, cancellable *Cancellable, err **L.Error) *DBusProxy
	DBusProxyNewSync         func(d *DBusConnection, flags DBusProxyFlags, info *DBusInterfaceInfo, name string, objectPath string, interfaceName string, cancellable *Cancellable, err **L.Error) *DBusProxy

	DBusProxyCall                   func(d *DBusProxy, methodName string, parameters *L.Variant, flags DBusCallFlags, timeoutMsec int, cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer)
	DBusProxyCallFinish             func(d *DBusProxy, res *AsyncResult, err **L.Error) *L.Variant
	DBusProxyCallSync               func(d *DBusProxy, methodName string, parameters *L.Variant, flags DBusCallFlags, timeoutMsec int, cancellable *Cancellable, err **L.Error) *L.Variant
	DBusProxyGetCachedProperty      func(d *DBusProxy, propertyName string) *L.Variant
	DBusProxyGetCachedPropertyNames func(d *DBusProxy) []string
	DBusProxyGetConnection          func(d *DBusProxy) *DBusConnection
	DBusProxyGetDefaultTimeout      func(d *DBusProxy) int
	DBusProxyGetFlags               func(d *DBusProxy) DBusProxyFlags
	DBusProxyGetInterfaceInfo       func(d *DBusProxy) *DBusInterfaceInfo
	DBusProxyGetInterfaceName       func(d *DBusProxy) string
	DBusProxyGetName                func(d *DBusProxy) string
	DBusProxyGetNameOwner           func(d *DBusProxy) string
	DBusProxyGetObjectPath          func(d *DBusProxy) string
	DBusProxySetCachedProperty      func(d *DBusProxy, propertyName string, value *L.Variant)
	DBusProxySetDefaultTimeout      func(d *DBusProxy, timeoutMsec int)
	DBusProxySetInterfaceInfo       func(d *DBusProxy, info *DBusInterfaceInfo)
)

func (d *DBusProxy) Call(methodName string, parameters *L.Variant, flags DBusCallFlags, timeoutMsec int, cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer) {
	DBusProxyCall(d, methodName, parameters, flags, timeoutMsec, cancellable, callback, userData)
}
func (d *DBusProxy) CallFinish(res *AsyncResult, err **L.Error) *L.Variant {
	return DBusProxyCallFinish(d, res, err)
}
func (d *DBusProxy) CallSync(methodName string, parameters *L.Variant, flags DBusCallFlags, timeoutMsec int, cancellable *Cancellable, err **L.Error) *L.Variant {
	return DBusProxyCallSync(d, methodName, parameters, flags, timeoutMsec, cancellable, err)
}
func (d *DBusProxy) GetCachedProperty(propertyName string) *L.Variant {
	return DBusProxyGetCachedProperty(d, propertyName)
}
func (d *DBusProxy) GetCachedPropertyNames() []string     { return DBusProxyGetCachedPropertyNames(d) }
func (d *DBusProxy) GetConnection() *DBusConnection       { return DBusProxyGetConnection(d) }
func (d *DBusProxy) GetDefaultTimeout() int               { return DBusProxyGetDefaultTimeout(d) }
func (d *DBusProxy) GetFlags() DBusProxyFlags             { return DBusProxyGetFlags(d) }
func (d *DBusProxy) GetInterfaceInfo() *DBusInterfaceInfo { return DBusProxyGetInterfaceInfo(d) }
func (d *DBusProxy) GetInterfaceName() string             { return DBusProxyGetInterfaceName(d) }
func (d *DBusProxy) GetName() string                      { return DBusProxyGetName(d) }
func (d *DBusProxy) GetNameOwner() string                 { return DBusProxyGetNameOwner(d) }
func (d *DBusProxy) GetObjectPath() string                { return DBusProxyGetObjectPath(d) }
func (d *DBusProxy) SetCachedProperty(propertyName string, value *L.Variant) {
	DBusProxySetCachedProperty(d, propertyName, value)
}
func (d *DBusProxy) SetDefaultTimeout(timeoutMsec int)        { DBusProxySetDefaultTimeout(d, timeoutMsec) }
func (d *DBusProxy) SetInterfaceInfo(info *DBusInterfaceInfo) { DBusProxySetInterfaceInfo(d, info) }

type DBusProxyFlags Enum

const (
	DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES DBusProxyFlags = 1 << iota
	DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS
	DBUS_PROXY_FLAGS_DO_NOT_AUTO_START
	DBUS_PROXY_FLAGS_NONE DBusProxyFlags = 0
)

var DBusProxyFlagsGetType func() O.Type

type DBusSendMessageFlags Enum

const (
	DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL DBusSendMessageFlags = 1 << iota
	DBUS_SEND_MESSAGE_FLAGS_NONE            DBusSendMessageFlags = 0
)

var DBusSendMessageFlagsGetType func() O.Type

type DBusServer struct{}

var (
	DBusServerGetType func() O.Type
	DBusServerNewSync func(address string, flags DBusServerFlags, guid string, observer *DBusAuthObserver, cancellable *Cancellable, err **L.Error) *DBusServer

	DBusServerGetClientAddress func(d *DBusServer) string
	DBusServerGetFlags         func(d *DBusServer) DBusServerFlags
	DBusServerGetGuid          func(d *DBusServer) string
	DBusServerIsActive         func(d *DBusServer) bool
	DBusServerStart            func(d *DBusServer)
	DBusServerStop             func(d *DBusServer)
)

func (d *DBusServer) GetClientAddress() string  { return DBusServerGetClientAddress(d) }
func (d *DBusServer) GetFlags() DBusServerFlags { return DBusServerGetFlags(d) }
func (d *DBusServer) GetGuid() string           { return DBusServerGetGuid(d) }
func (d *DBusServer) IsActive() bool            { return DBusServerIsActive(d) }
func (d *DBusServer) Start()                    { DBusServerStart(d) }
func (d *DBusServer) Stop()                     { DBusServerStop(d) }

type DBusServerFlags Enum

const (
	DBUS_SERVER_FLAGS_RUN_IN_THREAD DBusServerFlags = 1 << iota
	DBUS_SERVER_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS
	DBUS_SERVER_FLAGS_NONE DBusServerFlags = 0
)

var DBusServerFlagsGetType func() O.Type

type DBusSignalCallback func(connection *DBusConnection,
	senderName, objectPath, interfaceName, signalName string,
	parameters *L.Variant, userData T.Gpointer)

type DBusSignalInfo struct {
	RefCount    int
	Name        *T.Gchar
	Args        **DBusArgInfo
	Annotations **DBusAnnotationInfo
}

var (
	DBusSignalInfoGetType func() O.Type

	DBusSignalInfoRef   func(d *DBusSignalInfo) *DBusSignalInfo
	DBusSignalInfoUnref func(d *DBusSignalInfo)
)

func (d *DBusSignalInfo) Ref() *DBusSignalInfo { return DBusSignalInfoRef(d) }
func (d *DBusSignalInfo) Unref()               { DBusSignalInfoUnref(d) }

type DBusSignalFlags Enum

const (
	DBUS_SIGNAL_FLAGS_NO_MATCH_RULE DBusSignalFlags = 1 << iota
	DBUS_SIGNAL_FLAGS_NONE          DBusSignalFlags = 0
)

var DBusSignalFlagsGetType func() O.Type

type DBusSubtreeDispatchFunc func(connection *DBusConnection,
	sender, objectPath, interfaceName, node string,
	outUserData *T.Gpointer,
	userData T.Gpointer) *DBusInterfaceVTable

type DBusSubtreeEnumerateFunc func(connection *DBusConnection,
	sender, objectPath string, userData T.Gpointer) []string

type DBusSubtreeFlags Enum

const (
	DBUS_SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES DBusSubtreeFlags = 1 << iota
	DBUS_SUBTREE_FLAGS_NONE                           DBusSubtreeFlags = 0
)

var DBusSubtreeFlagsGetType func() O.Type

type DBusSubtreeIntrospectFunc func(connection *DBusConnection,
	sender, objectPath, node string,
	userData T.Gpointer) **DBusInterfaceInfo

type DBusSubtreeVTable struct {
	Enumerate  DBusSubtreeEnumerateFunc
	Introspect DBusSubtreeIntrospectFunc
	Dispatch   DBusSubtreeDispatchFunc
	Padding    [8]T.Gpointer
}

type Drive struct{}

var (
	DriveGetType func() O.Type

	DriveCanEject                 func(d *Drive) bool
	DriveCanPollForMedia          func(d *Drive) bool
	DriveCanStart                 func(d *Drive) bool
	DriveCanStartDegraded         func(d *Drive) bool
	DriveCanStop                  func(d *Drive) bool
	DriveEject                    func(d *Drive, flags MountUnmountFlags, cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer)
	DriveEjectFinish              func(d *Drive, result *AsyncResult, err **L.Error) bool
	DriveEjectWithOperation       func(d *Drive, flags MountUnmountFlags, mountOperation *MountOperation, cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer)
	DriveEjectWithOperationFinish func(d *Drive, result *AsyncResult, err **L.Error) bool
	DriveEnumerateIdentifiers     func(d *Drive) []string
	DriveGetIcon                  func(d *Drive) *Icon
	DriveGetIdentifier            func(d *Drive, kind string) string
	DriveGetName                  func(d *Drive) string
	DriveGetStartStopType         func(d *Drive) DriveStartStopType
	DriveGetVolumes               func(d *Drive) *L.List
	DriveHasMedia                 func(d *Drive) bool
	DriveHasVolumes               func(d *Drive) bool
	DriveIsMediaCheckAutomatic    func(d *Drive) bool
	DriveIsMediaRemovable         func(d *Drive) bool
	DrivePollForMedia             func(d *Drive, cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer)
	DrivePollForMediaFinish       func(d *Drive, result *AsyncResult, err **L.Error) bool
	DriveStart                    func(d *Drive, flags DriveStartFlags, mountOperation *MountOperation, cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer)
	DriveStartFinish              func(d *Drive, result *AsyncResult, err **L.Error) bool
	DriveStop                     func(d *Drive, flags MountUnmountFlags, mountOperation *MountOperation, cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer)
	DriveStopFinish               func(d *Drive, result *AsyncResult, err **L.Error) bool
)

func (d *Drive) CanEject() bool         { return DriveCanEject(d) }
func (d *Drive) CanPollForMedia() bool  { return DriveCanPollForMedia(d) }
func (d *Drive) CanStart() bool         { return DriveCanStart(d) }
func (d *Drive) CanStartDegraded() bool { return DriveCanStartDegraded(d) }
func (d *Drive) CanStop() bool          { return DriveCanStop(d) }
func (d *Drive) Eject(flags MountUnmountFlags, cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer) {
	DriveEject(d, flags, cancellable, callback, userData)
}
func (d *Drive) EjectFinish(result *AsyncResult, err **L.Error) bool {
	return DriveEjectFinish(d, result, err)
}
func (d *Drive) EjectWithOperation(flags MountUnmountFlags, mountOperation *MountOperation, cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer) {
	DriveEjectWithOperation(d, flags, mountOperation, cancellable, callback, userData)
}
func (d *Drive) EjectWithOperationFinish(result *AsyncResult, err **L.Error) bool {
	return DriveEjectWithOperationFinish(d, result, err)
}
func (d *Drive) EnumerateIdentifiers() []string       { return DriveEnumerateIdentifiers(d) }
func (d *Drive) GetIcon() *Icon                       { return DriveGetIcon(d) }
func (d *Drive) GetIdentifier(kind string) string     { return DriveGetIdentifier(d, kind) }
func (d *Drive) GetName() string                      { return DriveGetName(d) }
func (d *Drive) GetStartStopType() DriveStartStopType { return DriveGetStartStopType(d) }
func (d *Drive) GetVolumes() *L.List                  { return DriveGetVolumes(d) }
func (d *Drive) HasMedia() bool                       { return DriveHasMedia(d) }
func (d *Drive) HasVolumes() bool                     { return DriveHasVolumes(d) }
func (d *Drive) IsMediaCheckAutomatic() bool          { return DriveIsMediaCheckAutomatic(d) }
func (d *Drive) IsMediaRemovable() bool               { return DriveIsMediaRemovable(d) }
func (d *Drive) PollForMedia(cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer) {
	DrivePollForMedia(d, cancellable, callback, userData)
}
func (d *Drive) PollForMediaFinish(result *AsyncResult, err **L.Error) bool {
	return DrivePollForMediaFinish(d, result, err)
}
func (d *Drive) Start(flags DriveStartFlags, mountOperation *MountOperation, cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer) {
	DriveStart(d, flags, mountOperation, cancellable, callback, userData)
}
func (d *Drive) StartFinish(result *AsyncResult, err **L.Error) bool {
	return DriveStartFinish(d, result, err)
}
func (d *Drive) Stop(flags MountUnmountFlags, mountOperation *MountOperation, cancellable *Cancellable, callback AsyncReadyCallback, userData T.Gpointer) {
	DriveStop(d, flags, mountOperation, cancellable, callback, userData)
}
func (d *Drive) StopFinish(result *AsyncResult, err **L.Error) bool {
	return DriveStopFinish(d, result, err)
}

type DriveStartFlags Enum

const DRIVE_START_NONE DriveStartFlags = 0

var DriveStartFlagsGetType func() O.Type

type DriveStartStopType Enum

const (
	DRIVE_START_STOP_TYPE_UNKNOWN DriveStartStopType = iota
	DRIVE_START_STOP_TYPE_SHUTDOWN
	DRIVE_START_STOP_TYPE_NETWORK
	DRIVE_START_STOP_TYPE_MULTIDISK
	DRIVE_START_STOP_TYPE_PASSWORD
)

var DriveStartStopTypeGetType func() O.Type


text:
/*
 *      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.
 *      * Neither the name of the  nor the names of its
 *        contributors may be used to endorse or promote products derived from
 *        this software without specific prior written permission.
 *
 *      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 *      "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 THE COPYRIGHT
 *      OWNER OR CONTRIBUTORS 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.
 */

#include <arpa/inet.h>

#include <pppoetun.h>

int tun_alloc(char *tun_device) {
    int fd = -1;
    int err;
    struct ifreq ifr;

#ifdef USE_LINUX_TUN
    char *dev;
    if( (fd = open("/dev/net/tun", O_RDWR)) < 0 )
        return -1;

    memset(&ifr, 0, sizeof(ifr));

    ifr.ifr_flags = IFF_TUN | IFF_NO_PI;
    dev = "tun%d";
    strncpy(ifr.ifr_name, dev, IFNAMSIZ);

    err = ioctl(fd, TUNSETIFF, (void *) &ifr);
    if( err < 0 ) {
         close(fd);
         return err;
    }
    strncpy(tun_device, ifr.ifr_name, TUN_DEV_NAME_LENGTH);

   ioctl(fd, TUNSETNOCSUM, 1);
#endif

#ifdef USE_BSD_TUN
    int i;
    char tunname[128];

    sprintf(tunname, "/dev/tun%d", i);

    for( i = 0; i < MAX_TUN_NR; i++ ) {
        if( (fd = open(tunname, O_RDWR)) != -1 ) {

            break;
        }
    }

    if(fd < 0)
        return -1;

    strncpy(tun_device, tunname, TUN_DEV_NAME_LENGTH);
#endif

    return fd;
}

int pppoetun(char *in_device, char *out_device, uint16_t session_id, char *in_mac, char *out_mac, char *lock_file)
{
    return pppoetun_v(in_device, out_device, session_id, in_mac, out_mac, lock_file, 0);
}

int pppoetun_v(char *in_device, char *out_device, uint16_t session_id, char *in_mac, char *out_mac, char *lock_file, int verbose)
{
    eth_t *dnet_handle;
    pcap_t *pcap_handle;
    int tun_fd;

    unsigned char in[READ_BUFFER_SIZE];
    unsigned char out[WRITE_BUFFER_SIZE];
    int pcap_fd,l,len,fm;
    fd_set fds;

    char pcap_errbuf[PCAP_ERRBUF_SIZE];
    const u_char *pcap_packet;
    char filter[PCAP_FILTER_LENGTH];
    struct pcap_pkthdr *pcap_header;
    struct bpf_program pcap_filter;

    char tun_device[TUN_DEV_NAME_LENGTH];

    struct ether_header *eheader;
    unsigned char *start;
    int run, ret;
    struct stat fcheck;
    struct timeval timeout;

    tun_fd = tun_alloc(tun_device);
    if (tun_fd < 0) {
        fprintf(stderr, "Couldnt't create tunnel device: %s\n", strerror(errno));
        return 2;
    }
    if (verbose)
        printf("Tunnel interface %s created\n", tun_device);

    pcap_handle = pcap_create(in_device, pcap_errbuf);
    if (pcap_handle == NULL) {
        fprintf(stderr, "Couldn't open device: %s\n", pcap_geterr(pcap_handle));
        return 2;
    }

    if (pcap_set_promisc(pcap_handle, 1) == -1) {
        fprintf(stderr, "Couldn't set promisc mode: %s\n", pcap_geterr(pcap_handle));
        return 2;
    }
    if (pcap_activate(pcap_handle)) {
        fprintf(stderr, "Couldn't activate pcap: %s\n", pcap_geterr(pcap_handle));
        return 2;
    }

    if (verbose)
        printf("Opening tunnel at %s with MAC %s\n", in_device, in_mac);

    snprintf(filter, PCAP_FILTER_LENGTH, "ether dst %s and ether src %s and pppoes", in_mac, out_mac);
    if (verbose)
        printf("Using BPF '%s'\n", filter);

    if (pcap_compile(pcap_handle, &pcap_filter, filter, 0, 0) == -1) {
        fprintf(stderr, "Couldn't parse filter: %s\n", pcap_geterr(pcap_handle));
        return 2;
    }
    if (pcap_setfilter(pcap_handle, &pcap_filter) == -1) {
        fprintf(stderr, "Couldn't install filter: %s\n", pcap_geterr(pcap_handle));
        return 2;
    }

    pcap_fd = pcap_get_selectable_fd(pcap_handle);
    if (pcap_fd < 0) {
        fprintf(stderr, "Unable to get a selectable fd from pcap in_device\n");
        return 2;
    }

    dnet_handle = eth_open(out_device);
    if (dnet_handle == NULL) {
        fprintf(stderr, "Couldn't open out_device: %s\n", out_device);
        return 2;
    }
    if (verbose)
        printf("Sending to MAC %s on interface %s\n", out_mac, out_device);

    fm = max(tun_fd, pcap_fd) + 1;
    FD_ZERO(&fds);
    FD_SET(tun_fd, &fds);
    FD_SET(pcap_fd, &fds);

    for(run = 1; run; run++)
    {
        timeout.tv_sec = TIMEOUT_SEC;
        timeout.tv_usec = TIMEOUT_USEC;

        ret = select(fm, &fds, NULL, NULL, &timeout);
        bzero(out, WRITE_BUFFER_SIZE);

        if (run % CHECK_FOR_LOCKFILE || !ret) {
            if(stat(lock_file, &fcheck))
                break;
            run = 1;
        }

        if( FD_ISSET(tun_fd, &fds) ) {      //IN on TUN
            len = l = read(tun_fd, in, READ_BUFFER_SIZE);
            start = out;

            eheader = (struct ether_header *) start;
            memcpy(eheader->ether_dhost, ETH_OCTET(ether_aton(out_mac)), ETH_ALEN);
            memcpy(eheader->ether_shost, ETH_OCTET(ether_aton(in_mac)), ETH_ALEN);
            eheader->ether_type = htons(0x8864);
            start += sizeof(struct ether_header);
            l += sizeof(struct ether_header);

            //add pppoe session header
            *start = 0x11; l += 1; start++; //version = 1, type = 1
            *start = 0x00; l += 1; start++; //code = session data
            *(uint16_t *) start = htons(session_id); l += 2; start +=2;
            *(uint16_t *) start = htons(len + 2); l += 2; start += 2; //plen = original len + ppp header

            //add ppp header
            *(uint16_t *) start = htons(0x0021); l += 2; start += 2; //protocol = ip

            memcpy(start, in, len);

            if (verbose) {
                printf("t");
                fflush(stdout);
            }
            if (eth_send(dnet_handle, (u_char *) in, l) < 0) {
                fprintf(stderr, "Couldn't write packet\n");
                return 2;
            }
        }
        if( FD_ISSET(pcap_fd, &fds) ) {      //IN on PCAP
            if(pcap_next_ex(pcap_handle, &pcap_header, &pcap_packet) > 0) {
                l = pcap_header->len;
                memcpy(in, pcap_packet, min(READ_BUFFER_SIZE, l));
                start = in;

                eheader = (struct ether_header *) start;
                start += sizeof(struct ether_header);

                //skip pppoe session header
                start += 6;
                l -= 6;

                if (ntohs(*(uint16_t *) start) != 0x0021) {
                    //were only interested in ip payload

                    if (verbose) {
                        printf("i");
                        fflush(stdout);
                    }
                    continue;
                }
                //skip ppp header
                start += 2;
                l -= 2;

                if (verbose) {
                    printf("p");
                    fflush(stdout);
                }
                l = write(tun_fd, start, l);
            } else {
                fprintf(stderr, "Error on reading from pcap interface  %s\n", pcap_geterr(pcap_handle));
                return 2;
            }
        }
   }

   close(tun_fd);
   pcap_close(pcap_handle);
   eth_close(dnet_handle);

   return 0;
}